[cfe-dev] "Fixes" for two crashes, rant on Tok.getIdentifierInfo() and two more bugs

Chris Lattner clattner at apple.com
Thu Jan 3 12:46:09 PST 2008


On Dec 27, 2007, at 12:11 PM, Chris Lattner wrote:
>> (Why is it a good idea to treat stuff like @try as two tokens  
>> instead of one?)
>
> The answer is that thing like @ /*comment*/ try   are legal, sadly  
> enough.  However, it seems that we could probably do something in  
> the lexer (when it sees the "@", to handle this.  I'll see what I  
> can do about this when I have time.

Okay, so it's quite possible to hack the lexer to merge these into two  
tokens.  The problem with this is that it would lose the location info  
of the two pieces.  I'd prefer to keep the lexer pure, and have it  
return perfect location info.  This allows the client (eventually sema  
in this case) throw away loc info it doesn't need, but allows other  
clients to use it (e.g. -E mode).

This means we're stuck with the parser having to handle these as two  
tokens, sorry.

-Chris



More information about the cfe-dev mailing list