diff options
-rw-r--r-- | include/clang/Basic/DiagnosticParseKinds.td | 2 | ||||
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 4 | ||||
-rw-r--r-- | test/Parser/missing-closing-rbrace.m | 6 |
3 files changed, 12 insertions, 0 deletions
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index 2656a8bb8b..55afaa5455 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -406,6 +406,8 @@ def err_missing_catch_finally : Error< def err_objc_concat_string : Error<"unexpected token after Objective-C string">; def err_expected_objc_container : Error< "'@end' must appear in an Objective-C context">; +def err_objc_unexpected_atend : Error< + "'@end' appears where closing brace '}' is expected">; def error_property_ivar_decl : Error< "property synthesize requires specification of an ivar">; def err_synthesized_property_name : Error< diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index ddb6a707f5..b95b41f722 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -1288,6 +1288,10 @@ void Parser::ParseObjCClassInstanceVariables(Decl *interfaceDecl, visibility = Tok.getObjCKeywordID(); ConsumeToken(); continue; + case tok::objc_end: + Diag(Tok, diag::err_objc_unexpected_atend); + ConsumeToken(); + continue; 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 new file mode 100644 index 0000000000..ae1291e1e3 --- /dev/null +++ b/test/Parser/missing-closing-rbrace.m @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// rdar: //6854840 +@interface A {@end // expected-error {{'@end' appears where closing brace '}' is expected}}\ + // expected-note {{to match this '{'}}\ + // expected-note {{class started here}} + // expected-error {{expected '}'}} expected-error {{missing '@end'}} |