Page MenuHomePhabricator

[StructLayout] Use TrailingObjects to allocate space for MemberOffsets.

Authored by craig.topper on Tue, Mar 30, 10:10 AM.



MemberOffsets are stored at the end of StructLayout. The class
contains a single entry array to mark the start of the member
offsets. getStructLayout calculates the additional space needed
for additional elements before allocating memory.

This patch converts this to use TrailingObjects. This simplifies
the size computation in getStructLayout and gets rid of the
single entry array.

This is prep work, but to use TypeSize instead of uint64_t for
D98169. The single entry array doesn't work with TypeSize because
TypeSize doesn't have a default constructor. We thought this
change was an improvement by itself so we've separated it out.

Diff Detail

Event Timeline

craig.topper created this revision.Tue, Mar 30, 10:10 AM
craig.topper requested review of this revision.Tue, Mar 30, 10:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptTue, Mar 30, 10:10 AM
mehdi_amini accepted this revision.Tue, Mar 30, 3:05 PM
This revision is now accepted and ready to land.Tue, Mar 30, 3:05 PM
This revision was landed with ongoing or failed builds.Tue, Mar 30, 5:37 PM
This revision was automatically updated to reflect the committed changes.