[cfe-dev] accessibility of codegen headers
Chris Lattner
clattner at apple.com
Thu Jun 17 17:33:30 PDT 2010
On Jun 17, 2010, at 1:22 AM, Jochen Wilhelmy wrote:
>
>> What are you using these for? They should be private implementation details of the IR generation module. The layout information for structs is known in the AST level.
>>
>
> In the AST level there is no information about the alignment, e.g.
> struct {char a; double b}; may result in a being at index 0 and
> b being at index 2 because some alignment padding is between a and b.
>
> I need the index of a and b as they appear in the resulting IR because (in my
> custom application) I need to know if a getelementptr accesses a or b.
> Currently the only way for me to find this out is using CGRecordLayout.
This information should be available at the AST level, because offsetof and sizeof structs needs to be evaluated without codegen. Take a look at the include/clang/AST/RecordLayout.h header.
-Chris
More information about the cfe-dev
mailing list