[cfe-commits] r116439 - /cfe/trunk/tools/libclang/CIndex.cpp

David Chisnall csdavec at swan.ac.uk
Wed Oct 13 14:44:48 PDT 2010


Author: theraven
Date: Wed Oct 13 16:44:48 2010
New Revision: 116439

URL: http://llvm.org/viewvc/llvm-project?rev=116439&view=rev
Log:
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;


Modified:
    cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=116439&r1=116438&r2=116439&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Wed Oct 13 16:44:48 2010
@@ -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())





More information about the cfe-commits mailing list