[cfe-dev] accessing clang's AST
cdavis at mymail.mines.edu
Fri Feb 26 17:25:32 PST 2010
Octav Chipara wrote:
> 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
More information about the cfe-dev