[cfe-dev] clang rewriter

mobi phil mobi at mobiphil.com
Sun Dec 21 06:45:40 PST 2014


On Fri, Dec 19, 2014 at 4:54 PM, Xiaohui Chen <xchen422 at uwo.ca> wrote:

> Hi there:
>
> suppose i have already built the AST of the following compound Stmt,  i
> will traversal this
>  AST twice,
>
> {
>         .......       // A
>         .......       //  B
> }
>
> in the first traverse, i use  Rewrite.InsertText  to  insert "int var"
> between A and B,
>
> in the second traverse, can i use visitvardecl method to visit "int var"?
>

Not sure, if this answers your question (given all the unrelated text you
are quoting) but towards the end of the tutorial video of Manuel Klimek,
https://www.youtube.com/watch?v=VqCkCDFLSsc, Richard answers the question.
The inserted rewrites are not affecting your ast, thus new matches/visits
will not see your rewrite, unless you rebuild the AST with the rewritten
code (text).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141221/df195e4f/attachment.html>


More information about the cfe-dev mailing list