[cfe-dev] Function Rewriting

Cédric Venet cedric.venet at laposte.net
Tue Aug 11 07:16:18 PDT 2009


>
> "loc" is the location of the start of the identifier, not the location 
> of the end of the parameter declaration;  thus when you insert at that 
> point, it inserts before the variable name.  You want to insert after 
> the end of the variable declaration;  unfortunately, it looks like 
> that location just isn't preserved in the AST.  That's definitely 
> worth filing a bug about.

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.

regards,

Cédric.



More information about the cfe-dev mailing list