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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177553 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index badbee2..e4a880e 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -1303,10 +1303,9 @@
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 @@
HelperActionsForIvarDeclarations(interfaceDecl, atLoc,
T, AllIvarDecls, true);
return;
+
+ default:
+ Diag(Tok, diag::err_objc_illegal_visibility_spec);
+ continue;
}
}
diff --git a/test/Parser/missing-closing-rbrace.m b/test/Parser/missing-closing-rbrace.m
index 89c1f18..d811421 100644
--- a/test/Parser/missing-closing-rbrace.m
+++ b/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