[LLVMdev] StructType member offset
alexander.herz at mytum.de
Tue Oct 26 07:32:39 CDT 2010
how can i correctly calculate the size of a member of a struct
(including alignment etc)?
This doesn't work :
const StructType *STy = cast<StructType>(Ty);
for (StructType::element_iterator I = STy->element_begin(),
E = STy->element_end(); I != E; ++I)
usigned size =I->get()->getScalarSizeInBits(); //often
returns 0, not what I need
Basically I want to add up the sizes of the different members to
calculate the offset (which I want to compare to
DIType::getOffsetInBits()). Or if there is a direct way to get the
offset of a struct member without adding their sizes that'd be even better.
More information about the LLVMdev