Getting started with clang

Hello everyone,
I am quite impressed about the clang project but I have problems in getting started with it. Actually I want to use clang as a component, thus embed the parser, static analyzer and rewriting mechanism into another program.

I can't find any examples about that, at the moment I can run the clang parser from the command line but it's not what I really need! :slight_smile: I don't even know which are the header files I should include in my project. Could you please give me a pointer to something (even an header file should be great) where I can start? How can I build the AST starting from a source file?

thanks in advance for the help!
best regards,

Simone Pellegrini

After compiling you will have clang's include files in
and llvm's include files in

To begin see what the clang program itself does checking the files in the
folder llvm/toots/clang/Driver .

We can give some other hints if you tell us what you need to do.


Hi Simone,

I would suggest you look at "ASTConsumers" in the Driver subproject and "ParseAST" in lib/Sema.