Fix a crash on a top-level objc string, patch by Nico Weber

llvm-svn: 45370
This commit is contained in:
Chris Lattner 2007-12-27 20:29:42 +00:00
parent 05568bbd98
commit 11221033be
2 changed files with 8 additions and 2 deletions

View File

@ -87,9 +87,9 @@ Parser::StmtResult Parser::ParseStatementOrDeclaration(bool OnlyStatement) {
case tok::at: // May be a @try or @throw statement
{
AtLoc = ConsumeToken(); // consume @
if (Tok.getIdentifierInfo()->getObjCKeywordID() == tok::objc_try)
if (Tok.isObjCAtKeyword(tok::objc_try))
return ParseObjCTryStmt(AtLoc);
else if (Tok.getIdentifierInfo()->getObjCKeywordID() == tok::objc_throw)
else if (Tok.isObjCAtKeyword(tok::objc_throw))
return ParseObjCThrowStmt(AtLoc);
ExprResult Res = ParseExpressionWithLeadingAt(AtLoc);
if (Res.isInvalid) {

View File

@ -0,0 +1,6 @@
// RUN: clang -parse-noop %s
void test1() {
@"s"; // expected-warning {{expression result unused}}
}