aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-12-01 21:46:47 +0000
committerDouglas Gregor <dgregor@apple.com>2008-12-01 21:46:47 +0000
commitbec1c9d6f3feeec112cc8eeae90c1be29c6aaf13 (patch)
tree10e0dc8f6a9429ba3fae034786e5a4302d4e3b79
parentec0bf0500c4fd737975a40b781983ee0c4c0eb09 (diff)
Objective-C keywords are not always identifiers. Some are also C++ keywords
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60373 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Lex/Lexer.cpp5
-rw-r--r--test/Parser/objc-try-catch-1.m4
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
index d72c319d97..f85cfd9f0f 100644
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -41,8 +41,9 @@ static void InitCharacterInfo();
/// isObjCAtKeyword - Return true if we have an ObjC keyword identifier.
bool Token::isObjCAtKeyword(tok::ObjCKeywordKind objcKey) const {
- return is(tok::identifier) &&
- getIdentifierInfo()->getObjCKeywordID() == objcKey;
+ if (IdentifierInfo *II = getIdentifierInfo())
+ return II->getObjCKeywordID() == objcKey;
+ return false;
}
/// getObjCKeywordID - Return the ObjC keyword kind.
diff --git a/test/Parser/objc-try-catch-1.m b/test/Parser/objc-try-catch-1.m
index 072c4609eb..d8264fabbe 100644
--- a/test/Parser/objc-try-catch-1.m
+++ b/test/Parser/objc-try-catch-1.m
@@ -1,5 +1,5 @@
-// RUN: clang -fsyntax-only -verify %s
-
+// RUN: clang -fsyntax-only -verify %s &&
+// RUN: clang -fsyntax-only -verify -x objective-c++ %s
void * proc();
@interface NSConstantString