aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Chisnall <csdavec@swan.ac.uk>2010-10-13 21:44:48 +0000
committerDavid Chisnall <csdavec@swan.ac.uk>2010-10-13 21:44:48 +0000
commit096428b351ebf5de9871ce11e06ba6f2d8276ab5 (patch)
tree1663a1eb5f965e84db71f88f4b7baa686ae8b724
parent6b0656a7c386662e1bec5f23a3bd0bf2687a9635 (diff)
Don't claim that things that are Objective-C keywords if preceded by an @ are keywords unless they are preceded by an @.
For example, don't claim that end is a keyword in: unsigned end; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116439 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/libclang/CIndex.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index a5b342dbe7..1d7efe4208 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -3533,6 +3533,7 @@ void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
const char *EffectiveBufferEnd = Buffer.data() + EndLocInfo.second;
llvm::SmallVector<CXToken, 32> CXTokens;
Token Tok;
+ bool previousWasAt = false;
do {
// Lex the next token
Lex.LexFromRawLexer(Tok);
@@ -3565,7 +3566,7 @@ void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
IdentifierInfo *II
= CXXUnit->getPreprocessor().LookUpIdentifierInfo(Tok, StartPos);
- if (II->getObjCKeywordID() != tok::objc_not_keyword) {
+ if ((II->getObjCKeywordID() != tok::objc_not_keyword) && previousWasAt) {
CXTok.int_data[0] = CXToken_Keyword;
}
else {
@@ -3582,6 +3583,7 @@ void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
CXTok.ptr_data = 0;
}
CXTokens.push_back(CXTok);
+ previousWasAt = Tok.is(tok::at);
} while (Lex.getBufferLocation() <= EffectiveBufferEnd);
if (CXTokens.empty())