[cfe-dev] accessing clang's AST

Octav Chipara ochipara at gmail.com
Fri Feb 26 18:21:21 PST 2010


Dear Chip,

Thanks for the info. Is there an plug-in the exports the AST? I tried the
ast-dump, however, it crashes:

 0x10490e360 Assertion failed: (0 && "Unexpected decl"), function
DumpDeclarator, file StmtDumper.cpp, line 263.

Thanks,
-- Octav

On Fri, Feb 26, 2010 at 5:25 PM, Charles Davis <cdavis at mymail.mines.edu>wrote:

> Octav Chipara wrote:
> > Hi,
> >
> > I would like to use the AST already generated by clang to perform some
> > transformations. I am new to clang & llvm and I was wondering if I could
> > get a couple of pointers. Is there a good example which initializes the
> > parser and traverser the AST?
> Yes! Take a look at lib/Frontend/RewriteObjC.cpp. It uses the Rewriter
> library to take a fully-parsed AST for an ObjC program and turn it into
> C++.
>
> Also, have a look at the CompilerInstance and CompilerInvocation classes
> from the Frontend library. They will really come in handy for setting up
> your environment.
>
> Chip
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100226/5ee68c90/attachment.html>


More information about the cfe-dev mailing list