[cfe-dev] accessibility of codegen headers

Chris Lattner clattner at apple.com
Sat Jun 19 10:35:12 PDT 2010


On Jun 19, 2010, at 3:53 AM, Jochen Wilhelmy wrote:

> 
>> 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.
>>  
> 
> It looks that AST/RecordLayout hast info about alignment, field offsets and struct size,
> but not about field index of the resulting llvm type.
> For this I would need a getFieldIndexInIR(unsigned FieldNo) method.

Given the offset, you can compute that with TargetData's StructLayout helper, the StructLayout::getElementContainingOffset method does it.

-Chris



More information about the cfe-dev mailing list