[cfe-dev] Using clang as a meta-data generator.

Douglas Gregor dgregor at apple.com
Tue Jun 22 09:56:11 PDT 2010


On Jun 22, 2010, at 9:16 AM, chris nuernberger wrote:

> OK, cool.  I have it producing an AST.  I don't need it to compile or
> even produce a perfect AST, but I do need it to attempt to produce as
> much of the AST as it can.  It appears to do that; can I always count
> on that behavior?

Yes.

> This is on a large, established code base (PhysX) so I can't mess with
> the code base much nor do I want to.
> 
> So, just some notes: unless I use cc1, I get a bizarre error message
> stating that clang itself can't execute "clang".  It appears the
> driver wraps the clang invocation with many more command line
> arguments and relaunches.  This doesn't appear to work on windows; at
> least not right now.

I've not seen this issue before. Please file a bug with more information when you get the chance.

> __int64 isn't an intrinsic type so the windows c headers won't
> compile.  Judging by the compiler output, it looks like you would want
> a truly portable std library implementation or something like that.

Pass -fms-extensions to turn on Microsoft compatibility mode, which includes a definition of __int64.

> For this stage of the project, I just need to know variable names.
> 
> For the next stage, when I need to mangle binary data, I will need to
> know the exact binary offsets of member variables.  How do you
> recommend I go about getting this information?  It seems much later in
> the pipeline but something must annotate the AST graph with such
> information somewhere...


ASTContext::getASTRecordLayout will give you this information for any complete RecordDecl.

	- Doug



More information about the cfe-dev mailing list