[cfe-dev] Patch to allow comment translators implementation

Abramo Bagnara abramobagnara at tin.it
Mon Jan 18 17:02:02 PST 2010

Il 18/01/2010 23:36, Chris Lattner ha scritto:
>>> Il 12/01/2010 22:40, Chris Lattner ha scritto:
>>>>> The only proposal I see that would not change a lot of things is to
>>>>> remove Token argument from CommentHandler and to specify that they
>>>>> always shall use EnterTokenStream also when they need to insert
>>>>> only one
>>>>> token.
>>>>> Then at end of Preprocessor::HandleComment if any of the comment
>>>>> handlers has informed the caller to have inserted some tokens the
>>>>> first
>>>>> one available is fetched and returned by Preprocessor::HandleComment.
>>>> Yes, I think this is a good plan.
>>> You find attached a revised patch (based on r93512) that work as
>>> designed.
>>> The patch passes all clang tests.
>> Looks fine to me. Chris?
> Looks good to me, committed in r93795.  I didn't commit the
> lib/Lex/PPDirectives.cpp hunk, because it didn't look necessary.  Please
> correct me if I'm wrong.

This part of the patch is strictly related to the others: the way for
CommentHandler to push tokens is to call EnterTokenStream and this
method add a TokenLexer (that was ignored by SkipExcludedConditionalBlock)

Without this part of the patch the pushed tokens related to comments
found inside skipped conditional block are not read until return from
Preprocessor::SkipExcludedConditionalBlock and this is clearly unwanted.

More information about the cfe-dev mailing list