Missing service for CommentHandlers

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Missing service for CommentHandlers

Abramo Bagnara-2
(Resent using another subscription, the other address seems to not find
its way to the list. Sorry for possible duplicates).

Recently it has been commited a patch to allow comment handlers to enter
token in the preprocessed stream, but AFAICT we lack the possibility for
handlers to know if the preprocessor is currently skipping an excluded
block.

Currently if the comment handler enter tokens also when preprocessor is
skipping, these token are not consumed by SkipExcludedConditionalBlock
and then will be read on exit of this function (obviously this is wrong).

We have some alternative way to cope with this problem:

1) make SkipExcludedConditionalBlock to consume also the tokens from
CurTokenLexer

2) set a flag in SkipExcludedConditionalBlock available in public
interface to make it know that currently Preprocessor is skipping an
excluded block

3) add a public method to PreprocessorLexer to consult conditional stack
and say if we are currently skipping an excluded block

I'm willing to write the patch, but I'd like to know which is the way
that clang gurus prefers before to contribute something unacceptable ;-)

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Missing service for CommentHandlers

Douglas Gregor

On Jan 27, 2010, at 1:43 AM, Abramo Bagnara wrote:

> (Resent using another subscription, the other address seems to not find
> its way to the list. Sorry for possible duplicates).
>
> Recently it has been commited a patch to allow comment handlers to enter
> token in the preprocessed stream, but AFAICT we lack the possibility for
> handlers to know if the preprocessor is currently skipping an excluded
> block.
>
> Currently if the comment handler enter tokens also when preprocessor is
> skipping, these token are not consumed by SkipExcludedConditionalBlock
> and then will be read on exit of this function (obviously this is wrong).
>
> We have some alternative way to cope with this problem:
>
> 1) make SkipExcludedConditionalBlock to consume also the tokens from
> CurTokenLexer

This seems like the right approach to me.

        - Doug
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev