Dear Chip,<br><br>Thanks for the info. Is there an plug-in the exports the AST? I tried the ast-dump, however, it crashes:<br><br> 0x10490e360 Assertion failed: (0 && "Unexpected decl"), function DumpDeclarator, file StmtDumper.cpp, line 263.<br>
<br>Thanks,<br>-- Octav<br><br><div class="gmail_quote">On Fri, Feb 26, 2010 at 5:25 PM, Charles Davis <span dir="ltr"><<a href="mailto:cdavis@mymail.mines.edu">cdavis@mymail.mines.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div class="h5">Octav Chipara wrote:<br>
> Hi,<br>
><br>
> I would like to use the AST already generated by clang to perform some<br>
> transformations. I am new to clang & llvm and I was wondering if I could<br>
> get a couple of pointers. Is there a good example which initializes the<br>
> parser and traverser the AST?<br>
</div></div>Yes! Take a look at lib/Frontend/RewriteObjC.cpp. It uses the Rewriter<br>
library to take a fully-parsed AST for an ObjC program and turn it into C++.<br>
<br>
Also, have a look at the CompilerInstance and CompilerInvocation classes<br>
from the Frontend library. They will really come in handy for setting up<br>
your environment.<br>
<br>
Chip<br>
<br>
</blockquote></div><br>