[cfe-dev] Function Rewriting

John McCall rjmccall at apple.com
Tue Aug 11 09:45:15 PDT 2009


Cédric Venet wrote:
> I didn't respond earlier because I do not remember exactly the function 
> to use. I do not think this is a bug, but a design decision. it is 
> always only the start which is in the AST (for single token construct at 
> least), to get the end of the token, use a Lex function lextoken or 
> something like this. However, this is just my understanding. you can 
> check how the caret diagnostic are generated, it will show you the good 
> way to do what you want.
>   

No, it's a bug.  I'm not sure how that function works well enough to 
tell you if it works after the parse phase, but regardless, in C/C++, 
knowing the endpoint of the identifier token does not actually tell you 
where the end of the parameter declaration is.

    void apply(int count, int /*unused */, int array[], int 
(*function)(void ()) = &standard_callback);

John.



More information about the cfe-dev mailing list