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

jahanian fjahanian at apple.com
Thu Oct 14 09:34:27 PDT 2010


Please provide a test case. I use the simple 'unsigned end;' declaration and it works fine.

% cat t.m
unsigned end;
% clang -c t.m
% 

- Fariborz

On Oct 13, 2010, at 3:10 PM, jahanian wrote:

> A test case please?
> 
> - Fariborz
> 
> On Oct 13, 2010, at 2:44 PM, David Chisnall wrote:
> 
>> 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())
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 





More information about the cfe-commits mailing list