[cfe-dev] Cloning Clang Stmts, declarations and other AST objects

Douglas Gregor dgregor at apple.com
Tue May 12 09:13:55 PDT 2009


On May 12, 2009, at 8:33 AM, moataz ragab wrote:

> Hi,
>
> I would like to implement a set of transformations on Clang AST one  
> after the other. Therefore I want to modify the AST by adding or  
> removing nodes from it.
> For example, I would like to do first loop-unrolling on the inner  
> loop and add the unrolled copies in the AST and then make other  
> transformations on the AST.
>
> My question: is there a way to clone the stmts in the body of the  
> loop and just go in and modify these copies and add them to the AST.

No, we don't have an easy way to do this. However, we will eventually  
need this functionality, so patches to implement AST cloning would be  
welcome!

	- Doug



More information about the cfe-dev mailing list