diff options
-rw-r--r-- | clang/lib/Parse/ParseObjc.cpp | 6 | ||||
-rw-r--r-- | clang/test/Parser/objc-quirks.m | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index f52ecfb7fb1..90a14949667 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -255,6 +255,12 @@ void Parser::ParseObjCInterfaceDeclList(DeclTy *interfaceDecl, // If we don't have an @ directive, parse it as a function definition. if (Tok.isNot(tok::at)) { + // The code below does not consume '}'s because it is afraid of eating the + // end of a namespace. Because of the way this code is structured, an + // erroneous r_brace would cause an infinite loop if not handled here. + if (Tok.is(tok::r_brace)) + break; + // FIXME: as the name implies, this rule allows function definitions. // We could pass a flag or check for functions during semantic analysis. ParseDeclarationOrFunctionDefinition(); diff --git a/clang/test/Parser/objc-quirks.m b/clang/test/Parser/objc-quirks.m index b726d9a8274..c5fe8bb1a18 100644 --- a/clang/test/Parser/objc-quirks.m +++ b/clang/test/Parser/objc-quirks.m @@ -2,3 +2,9 @@ // FIXME: This is a horrible error message here. Fix. int @"s" = 5; // expected-error {{prefix attribute must be}} + + +// rdar://6480479 +@interface A +}; // expected-error {{missing @end}} expected-error {{expected external declaration}} + |