diff options
author | Chris Lattner <sabre@nondot.org> | 2007-12-27 20:29:42 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-12-27 20:29:42 +0000 |
commit | 516bd467c25071b677bf2ec98c84f27294f56801 (patch) | |
tree | a35c391fb46db6a326f2199a4b98cd104df93cc0 | |
parent | cb53b361bce341c8591333c6997f62e480acc0b4 (diff) |
Fix a crash on a top-level objc string, patch by Nico Weber
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45370 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Parse/ParseStmt.cpp | 4 | ||||
-rw-r--r-- | test/Parser/expressions.m | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/Parse/ParseStmt.cpp b/Parse/ParseStmt.cpp index 063735196e..80d0b9ece4 100644 --- a/Parse/ParseStmt.cpp +++ b/Parse/ParseStmt.cpp @@ -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) { diff --git a/test/Parser/expressions.m b/test/Parser/expressions.m new file mode 100644 index 0000000000..8e314aca6f --- /dev/null +++ b/test/Parser/expressions.m @@ -0,0 +1,6 @@ +// RUN: clang -parse-noop %s + +void test1() { + @"s"; // expected-warning {{expression result unused}} +} + |