From 0b171939dcde885bb670ebe9b532c6e5ed6a4437 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Wed, 20 Mar 2013 18:45:49 +0000 Subject: [PATCH] Do the error recovery for @end only. I am not sure how much we can improve for when a randon ObjC keyword is thrown into the ivar decl. block. // rdar://6854840 llvm-svn: 177553 --- clang/lib/Parse/ParseObjc.cpp | 11 +++++++---- clang/test/Parser/missing-closing-rbrace.m | 9 --------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index badbee2..e4a880e 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -1303,10 +1303,9 @@ void Parser::ParseObjCClassInstanceVariables(Decl *interfaceDecl, visibility = Tok.getObjCKeywordID(); ConsumeToken(); continue; - default: - Diag(Tok, (Tok.getObjCKeywordID() == tok::objc_end) ? - diag::err_objc_unexpected_atend : - diag::err_objc_illegal_visibility_spec); + + case tok::objc_end: + Diag(Tok, diag::err_objc_unexpected_atend); Tok.setLocation(Tok.getLocation().getLocWithOffset(-1)); Tok.setKind(tok::at); Tok.setLength(1); @@ -1314,6 +1313,10 @@ void Parser::ParseObjCClassInstanceVariables(Decl *interfaceDecl, HelperActionsForIvarDeclarations(interfaceDecl, atLoc, T, AllIvarDecls, true); return; + + default: + Diag(Tok, diag::err_objc_illegal_visibility_spec); + continue; } } diff --git a/clang/test/Parser/missing-closing-rbrace.m b/clang/test/Parser/missing-closing-rbrace.m index 89c1f18..d811421 100644 --- a/clang/test/Parser/missing-closing-rbrace.m +++ b/clang/test/Parser/missing-closing-rbrace.m @@ -1,12 +1,3 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // rdar: //6854840 @interface A {@end // expected-error {{'@end' appears where closing brace '}' is expected}} - - -@interface B { -@public - int ivar; -@protected - id pp; -@property (copy) id PROP; // expected-error {{illegal visibility specification}} -@end -- 2.7.4