<font color="#330099"><font size="2"><font face="georgia,serif"><br>Hello Vasil,<br><br>Thanks for your detail explanation. The main thing what I want to do is AST level optimization. But before implementing optimizations, I need to transform the resulting AST which is build by clang after parsing the given source code. That mean i want to transform this AST to another AST. Later it will be easy to implement optimizations on the new AST. When i read clang source files, I got TreeTransformation.h file. I thought that there is tree to tree transformation that is already implemented inside clang. But I couldn't get the implementation. Now am getting information from you guys that this file is just a facility or base for implementation other transformations. So, this is good information that I got from you guys. Now am going to do the transformation by my self and implementing optimizations later on. If there was implemented tree to tree transformation, i don't need to go implement tree transformation. <br>

<br>Hope you got my idea. It is just my ideal design and didn't go further. I will start the tasks soon. Do you have any idea or suggestion how to go? Thanks again.<br></font></font></font><br><div class="gmail_quote">

On Thu, Dec 1, 2011 at 9:01 PM, Vassil Vassilev <span dir="ltr"><<a href="mailto:vasil.georgiev.vasilev@cern.ch">vasil.georgiev.vasilev@cern.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<u></u>

  
    
  
  <div bgcolor="#ffffff" text="#000000">
    Hi,<br>
      TreeTransform is the facility used to rebuild the templated nodes
    of the AST once<br>
    clang has the full type/value information (for example at
    instantiation time). It replaces<br>
    the nodes that are marked as of dependent type with their actual
    instantiation type and<br>
    performs the semantic checks with the new types.<br>
    <br>
      Maybe if you clarify a little bit more (and perhaps give examples)
    I can be more helpful.<br>
    In general TreeTransform is not meant to implement every possible
    tree-to-tree transformation.<br>
    <br>
    Nevertheless, it can be used as model how to build your own one.
    Right now I am not aware of<br>
    an interface that implements arbitrary tree-to-tree transformation.
    <br>
    However, there are couple of interfaces that you might find useful
    for that. You might want to<br>
    have a look at clang::ASTConsumer, clang::SemaConsumer and
    clang::RecursiveASTVisitor<br>
    <br>
    Depending on what is the exact idea of the transformation you could
    also use clang's <br>
    rewrite subsystem, which is pretty powerful, but it AFAIK it doesn't
    work on AST level. It is more<br>
    source-to-source transformation.<br>
    <br>
    Vassil<div><div class="h5"><br>
    <br>
    On 11/30/2011 04:20 AM, eyasu getahun wrote:
    </div></div><blockquote type="cite"><div><div class="h5">
      
      <font color="#330099"><font size="2"><font face="georgia,serif">Hello
            all,<br>
            <br>
             I have seen tree transformation in clang(TreeTransform.h).
            This is to transform one AST to another AST. But it is not
            clear for me how they used this header file for the
            transformation. I didn't see the function for the
            transformation. Just they used this header file for semantic
            template instantiation and template deduction. Even there is
            no explicit command line option for the transformation. Do
            you guys think that the transformation is well implemented
            and documented? please let me know if you have any idea
            about the transformation that they used in clang. Thanks in
            advance!<span><font color="#888888"><br clear="all">
              </font></span></font></font></font>
      <div>
        <div><img src=""></div>
      </div>
      <br clear="all">
      <br>
      -- <br>
      <b>With Best Regards,<br>
        <br>
        ===========================================<br>
        Eyasu Getahun</b><br>
      <br>
      <br>
      </div></div><pre><fieldset></fieldset>
_______________________________________________
cfe-dev mailing list
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a>
</pre>
    </blockquote>
    <br>
  </div>

</blockquote></div><br><br clear="all"><br>-- <br><b>With Best Regards,<br><br>===========================================<br>Eyasu Getahun</b><br><br>1 Fusionopolis way, #08-10 Connexis North Tower<br>Singapore 138632, Singapore<br>

Mobile: +393279239907<br><b>===========================================<br></b><br>