[cfe-dev] Once I have an AST, how do I compile it?

Martin C.Martin martin at martincmartin.com
Tue Apr 6 09:02:17 PDT 2010


On 4/5/2010 4:58 PM, Eli Friedman wrote:
> On Mon, Apr 5, 2010 at 1:06 PM, Martin C.Martin
> <martin at martincmartin.com>  wrote:
>> I've managed to create a test program, included below for the curious,
>> which creates a super simple AST corresponding to "void foo() { }".
>> What do I call to generate code from it?  Any pointers on what
>> classes/files to look at?
>
> Call CreateLLVMCodeGen in include/clang/CodeGen/ModuleBuilder.h to get
> an ASTConsumer, then call the appropriate APIs (see
> include/clang/AST/ASTConsumer.h) to make it generate code.
>
> -Eli

Thanks Eli.  What's the memory contract?  Should I call delete on 
CreateLLVMCodeGen()'s value when I'm done with it?

Best,
Martin



More information about the cfe-dev mailing list