Get the layout offset of an aggregate type's leave types

Hi,

I have an aggregate type like
{i32, {i8*, i16}, [2xi8], … },
[2 x {i8*, i32}],
and wanted to get the offset of a leaf type from the beginning of the aggregate type at compilation time.

DataLayout::getStructLayout returns the layout of the current level of a struct.

  • Do we have any API to get the layout for all leave types for sub-struct?
  • How to get the offset of each element of an Array type?

Thank you, j