[cfe-commits] r134588 - in /cfe/trunk: lib/Lex/TokenLexer.cpp test/Preprocessor/macro_paste_hashhash.c

Argyrios Kyrtzidis kyrtzidis at apple.com
Thu Jul 7 10:48:21 PDT 2011


On Jul 7, 2011, at 10:47 AM, Chris Lattner wrote:

> 
> On Jul 7, 2011, at 10:45 AM, Argyrios Kyrtzidis wrote:
> 
>>> This really shouldn't be using SM.isBeforeInSourceLocationOffset.  The way we handle hashhash elsewhere is to turn it into tok::other when it shouldn't cause token pasting.  For example:
>>> 
>>>    // Turn ## into 'unknown' to avoid # ## # from looking like a paste
>>>    // operator.
>>>    if (Result.is(tok::hashhash))
>>>      Result.setKind(tok::unknown);
>>> 
>>> Can you rework this to have the argument expansion logic strip tok::hashhash's from arguments instead of using the SM.isBeforeInSourceLocationOffset query?
>> 
>> Are you sure ? If we keep tok::hashhash we will be able to have the parser provide an error like gcc's diagnostic "error: stray ‘##’ in program".
> 
> We can still produce that diagnostic.  Just use "stray '%0' in program" and use the spelling of a tok::other token when reporting the error.

Ok, sound good!

> 
> -Chris





More information about the cfe-commits mailing list