[cfe-dev] Reflection from AST?
Chris Lattner
clattner at apple.com
Wed Oct 14 08:05:46 PDT 2009
On Oct 14, 2009, at 7:14 AM, Axel Naumann wrote:
> Hi,
>
> similar to my other question, but different enough to start a separate
> thread: I need to get e.g. the offsets of data members in classes, of
> base classes, and the size of a class. Would the AST be the right
> place?
> I cannot find that data anywhere in there - is it too "early", do I
> have
> to look at IR? Is there maybe an example anywhere?
Given an ASTContext you can use Ctx.getASTRecordLayout(D) to get the
layout information for a record decl. This is needed for C semantic
analysis because sizeof() must be evaluatable.
-Chris
More information about the cfe-dev
mailing list