Fix <rdar://problem/6764172> [sema] crash on invalid.

llvm-svn: 68568
This commit is contained in:
Steve Naroff 2009-04-07 22:56:58 +00:00
parent ea10ab668f
commit 65a0089eb7
2 changed files with 16 additions and 1 deletions

View File

@ -1294,8 +1294,14 @@ Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
FirstPart = Actions.ActOnParamDeclarator(CurScope, ParmDecl);
} else
ConsumeToken(); // consume '...'
SourceLocation RParenLoc = ConsumeParen();
SourceLocation RParenLoc;
if (Tok.is(tok::r_paren))
RParenLoc = ConsumeParen();
else // Skip over garbage, until we get to ')'. Eat the ')'.
SkipUntil(tok::r_paren, true, false);
OwningStmtResult CatchBody(Actions, true);
if (Tok.is(tok::l_brace))
CatchBody = ParseCompoundStatementBody();

View File

@ -0,0 +1,9 @@
// RUN: clang-cc %s -verify -fsyntax-only
// Note: NSException is not declared.
void f0(id x) {
@try {
} @catch (NSException *x) { // expected-warning{{type specifier missing, defaults to 'int'}} expected-error{{@catch parameter is not an Objective-C class type}}
}
}