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
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index a5b342d..1d7efe4 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -3533,6 +3533,7 @@
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 @@
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 @@
CXTok.ptr_data = 0;
}
CXTokens.push_back(CXTok);
+ previousWasAt = Tok.is(tok::at);
} while (Lex.getBufferLocation() <= EffectiveBufferEnd);
if (CXTokens.empty())