Fix crash on invalid code where a @throw statement is not followed by a ';'

llvm-svn: 101941
This commit is contained in:
Ted Kremenek 2010-04-20 21:21:51 +00:00
parent 8f5bc9f0e1
commit 15a81e59ca
2 changed files with 9 additions and 1 deletions

View File

@ -1448,7 +1448,8 @@ Parser::OwningStmtResult Parser::ParseObjCThrowStmt(SourceLocation atLoc) {
return StmtError();
}
}
ConsumeToken(); // consume ';'
// consume ';'
ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@throw");
return Actions.ActOnObjCAtThrowStmt(atLoc, move(Res), CurScope);
}

View File

@ -12,3 +12,10 @@ void test1() {
__PRETTY_FUNCTION__; // expected-warning{{expression result unused}}
}
@end
// <rdar://problem/7881045>
// This previously triggered a crash because a ';' was expected after the @throw statement.
void foo() {
@throw (id)0 // expected-error{{expected ';' after @throw}}
}