With pragma pack, the layout engine would produce vfptrs that were
packed width rather than pointer width. This patch addresses the issue
and adds a test case.
llvm-svn: 198059
The alignment impact of the virtual bases apperas to be applied in
order, rather than up front. This patch adds the new behavior and
provides a test case.
llvm-svn: 197639
This refactor addresses bugzilla bug 18167 and simplifies the code at
the same time. Also I add a test case for the bug. Also I make a
non-functional change to the basic layout lit tests to make them more
reliable (using CHECK-NEXT instead of CHECK).
llvm-svn: 197183
Prior to this patch, the alignment imposed by virtual bases only
included direct virtual bases. This patch fixes it to look at all
virtual bases.
llvm-svn: 196997
In order to address latent bugs that were easier to expose in 64-bit
mode, we move the application of __declspec(align) to before the layout
of vbases rather than after.
llvm-svn: 196861
MS-ABI adds padding before *every* vbase if the last field in a record
is a bit-field. This changes clangs behavior to match. I also fix some
windows-style line endings in the test file.
Differential Revision: http://llvm-reviews.chandlerc.com/D2277
llvm-svn: 196605
Adds padding between bases or virtual bases in an attempt to avoid
aliasing of zero-sized sub-objects. The approach used by the ABI adds
two more bits of state. Detailed comments are in the code. Test cases
included.
Differential Revision: http://llvm-reviews.chandlerc.com/D2258
llvm-svn: 196602
__declspec(align())
This patch implements required alignment in a way that makes
__declspec(align()) and #pragma pack play correctly together. In the
MS-ABI, __declspec(align()) is a hard rule and cannot be overridden by
#pragma pack. This cases each record to have two interesting alignments
"preferred alignment" (which matches Itanium's concept of alignment) and
"required alignment" which is an alignment that must never be violated,
even in the case of #pragma pack. This patch introduces the concept of
Required Alignment to the record builder and tracks/uses it
appropriately. Test cases are included.
Differential Revision: http://llvm-reviews.chandlerc.com/D2283
llvm-svn: 196549
Microsoft adds an extra byte of padding before laying out zero sized
non-virtual bases if the non-virtual base before it contains a vbptr.
This patch adds the same behavior to clang.
Differential Revision: http://llvm-reviews.chandlerc.com/D2106
llvm-svn: 195158
This patch tests introduces a proper codegen test in place of the
"codegen no longer crashes" test introduced in r193664. The test is also
moved from layout to CodeGenCXX.
Differential Revision: http://llvm-reviews.chandlerc.com/D2174
llvm-svn: 194739
Differential Revision: http://llvm-reviews.chandlerc.com/D2090
Clang was "improperly" over-aligning arrays with sizes are not a multiple of
their alignment.
This behavior was removed in microsoft 32 bit mode.
In addition, after examination of ASTContext::getTypeInfoImpl, a redundant code block in
MicrosoftRecordLayoutBuilder::getAdjustedFieldInfo was deleted.
llvm-svn: 193898
it. Also removes all of the microsoft C++ ABI related code from the
itanium layout builder.
Differential Revision: http://llvm-reviews.chandlerc.com/D2003
llvm-svn: 193290
We have to reserve at least the width of a pointer for the vfptr. For
classes with small alignment, we weren't reserving enough space, and
were overlapping the first field with the vfptr.
llvm-svn: 192626
This patch fixes the distructor test when checking for vtordisp requirements in
microsoft record layout. A test case is also included.
Addresses:
http://llvm.org/bugs/show_bug.cgi?id=16406#c7
llvm-svn: 192616