[cfe-dev] Preprocessor::LookNext

Chris Lattner clattner at apple.com
Wed Jul 9 16:29:45 PDT 2008


On Jul 9, 2008, at 3:54 PM, Argiris Kirtzidis wrote:

> I incorporated the suggestions and committed the patches here:

Thanks!

>> +++ lib/Lex/PPLexerChange.cpp    (working copy)
>> @@ -85,6 +85,10 @@
>>   // size we new to a multiple of 16 tokens.  If the previous  
>> buffer has space
>>   // left, we can just grow it.  This means we only have to do the  
>> new 1/16th as
>>   // often.
>> +
>> +  // Optimized LookAhead(0) case.
>> +  if (N == 0)
>> +    return LookNext();
>>
>>   Token *LookaheadTokens = new Token[N+1];
>>
>> Is this correct for the LookAhead(1) case?
>
> I don't quite understand what you mean, LookAhead(1) isn't affected  
> by this change, can you elaborate ?

I haven't looked at the code, I just want to make sure that  
LookAhead(1) or LookAhead(2) doesn't get off-by-one due to the peeked  
token.

-Chris



More information about the cfe-dev mailing list