[cfe-dev] Problem in locations

Abramo Bagnara abramobagnara at tin.it
Thu Aug 13 09:00:47 PDT 2009


Chris Lattner ha scritto:
> 
> On Aug 13, 2009, at 8:40 AM, Chris Lattner wrote:
> 
>>
>> On Aug 12, 2009, at 11:51 PM, Abramo Bagnara wrote:
>>>> What do you mean?  Escaped newline can occur anywhere in a token, the
>>>> start of the token isn't special:
>>>>
>>>> foo\
>>>> bar??/
>>>> baz
>>>>
>>>> is one token.
>>>
>>> Of course, but I believe that a leading ignorable should be ignored,
>>> not
>>> included.
>>
>> You're right, the implementation is more efficient this way though.
> 
> Rather you're right that it "could" ignore the leading escape, but I
> don't see any reason that clients should depend on this.

The diagnostic is far more readable if we point to the first non
ignorable character instead of the first ignorable character and it
seems to me that to have an indefinite number of ignorable embedded in a
single char token is a bit senseless.

\
\
\
\
\
\
\
+

Note also that current implementation of getSpellingLineNumber and
getSpellingColumnNumber are confused by this thing and they return the
position less useful instead of the more useful one.

Also it seems strange to me under a theoretical point of view that the
efficiency is undermined by the more rational behaviour, but certainly
you know better than me.

If I'd see a way that do not compromise the efficiency are you willing
to accept a patch?




More information about the cfe-dev mailing list