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

Neil Booth neil at daikokuya.co.uk
Fri Jan 4 03:12:22 PST 2008


Chris Lattner wrote:-

> 
> 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.

Moreover I distinctly remember the justification for two tokens was
to enable macro expansion of the second part; this was a specific
requirement Apple (Stan) had.

Neil.



More information about the cfe-dev mailing list