Hi Doug,<br><br>Thanks. I have another question:<br><br>Assuming that somehow I implemented the cloning. What would be the proper way to add new nodes to the AST?<br><br>I think there are two ways for adding new nodes to the AST:<br>
  1.Appending children nodes<br>  2.Inserting nodes in arbitrary order not necessary at the end<br><br>I took a look at how the parser builds the AST of compound statements specially and it seems that the parser pushes back the statements on a vector. Then it calls the acton method from Sema to create the objects.<br>
<br>Best regards,<br>Moataz<br><br><div class="gmail_quote">On Tue, May 12, 2009 at 6:13 PM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com">dgregor@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5"><br>
On May 12, 2009, at 8:33 AM, moataz ragab wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
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.<br>
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.<br>
<br>
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.<br>
</blockquote>
<br></div></div>
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!<br>
<br>
        - Doug<br>
</blockquote></div><br>