[cfe-dev] replacing Statement/Expression

Chris Lattner clattner at apple.com
Sun Aug 17 18:04:45 PDT 2008

On Aug 17, 2008, at 12:52 PM, Rajesh Karmani wrote:

> Hello,
> Is there a facility to replace a statement or an expression with  
> another
> in the AST? In the scenario that I am looking at, the text replacement
> strategy doesn't work because after rewriting the child expression,  
> when
> I rewrite the parent expression it picks the child expressions from  
> the
> AST which do not reflect the "updated" child expression.

As Ted says, the child iterators make this easy.  You might want to  
look at the objc rewriter, which has similar issues and has a clean  


More information about the cfe-dev mailing list