Fix rdar://6480479 - [parser] infinite loop on invalid input

llvm-svn: 61975
This commit is contained in:
Chris Lattner 2009-01-09 04:34:13 +00:00
parent cc1b6e8fce
commit c7c9ab7947
2 changed files with 12 additions and 0 deletions

View File

@ -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();

View File

@ -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}}