cfe-dev Digest, Vol 59, Issue 11

Can you not use Rewriter.InsertText() to copy the full For statement
over the SourceRange of the For statement? Then since you are at the
start of the For, you still have access to the body to perform your
transformations on the original body?
It seems easier than trying to clone the AST node.

For an example of using the Rewriter class, have a look at my tutorial
CIrewriter.cpp at:

Another option is to have a look at the new LibTooling library as part
of Clang 3.1.

Best regards,
Robert Ankeney