From 096428b351ebf5de9871ce11e06ba6f2d8276ab5 Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Wed, 13 Oct 2010 21:44:48 +0000 Subject: [PATCH] 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 --- tools/libclang/CIndex.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 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()) -- 2.40.0