| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These features are new in VS 2013 and are necessary in order to layout
std::ostream correctly. Currently we have an ABI incompatibility when
self-hosting with the 2013 stdlib in our convertible_fwd_ostream wrapper
in gtest.
This change adds another implicit attribute, MSVtorDispAttr, because
implicit attributes are currently the best way to make sure the
information stays on class templates through instantiation.
Reviewers: majnemer
Differential Revision: http://llvm-reviews.chandlerc.com/D2746
llvm-svn: 201274
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
vptr injection must inject padding equivalent to the alignment of the
most aligned non-virtual subobject, not the alignment of the enclosing
record.
To fascilitate this change, don't let record layout observe the
alignment of the record until we've injected our vptrs. Also, do not
allow the alignment of vbases to affect required alignment until just
before we insert the vtordisp field.
llvm-svn: 201199
|
|
|
|
|
|
|
|
|
| |
code for legibility, and fix a bug with bitfields in packed
ms_structs.
rdar://15926990
llvm-svn: 200379
|
|
|
|
|
|
|
|
|
| |
This patch makes a small behavioral change to the interaction between
pack and alignment. Specifically it makes __declspec(align()) on a
field change that field's alignment without respect to pack but the
alignment change to the record alignment as a whole still obeys pack.
llvm-svn: 199172
|
|
|
|
|
|
|
|
|
|
| |
Although VBPtrs were being placed correctly by the ms-abi layout engine,
their offsets were being improperly reported to the ASTRecordLayout
builder due to a bug. This patch fixes that and fixes the test cases to
use the correct values.
y
llvm-svn: 199168
|
|
|
|
|
|
|
|
| |
This patch moves the check for pragma pack until after the application
of __declspec align to before pragma pack. This causes observable
changes in the use of tail padding for bases. A test case is included.
llvm-svn: 199154
|
|
|
|
|
|
|
|
|
|
| |
The MS-ABI tracks a bit that asserts that the first sub-object is zero
sized. This bit is used to add padding between objects if there's the
potential for zero sized objects to alias. The bit is still true even
if the zero sized base is lead by a VFPtr. This patch makes clang mimic
that behavior.
llvm-svn: 199132
|
|
|
|
|
|
|
| |
This fixes llvm::SmallVector, which fixes lots of TUs in the MS ABI self
host.
llvm-svn: 199129
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch more cleanly seperates the concepts of Preferred Alignment
and Required Alignment. Most notable that changes to Required Alignment
do *not* impact preferred alignment until late in struct layout. This
is observable when using pragma pack and non-virtual bases and the use
of tail padding when laying them out.
Test cases included.
llvm-svn: 198988
|
|
|
|
|
|
|
|
|
|
|
| |
The presence of a VBPtr suppresses the presence of zero sized
sub-objects in the non-virtual portion of the object in the context of
determining if two base objects need alias-avoidance padding placed
between them.
Test cases included.
llvm-svn: 198975
|
|
|
|
|
|
|
|
|
|
| |
__declspec(align), when applied to bitfields affects their perferred
alignment instead of their required alignment. We don't know why.
Also, #pragma pack(n) turns packing *off* if n is greater than the
pointer size. This is now observable because of the impact of
declspec(align) on bitfields.
llvm-svn: 198907
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The MS abi lays out *all* non-virtual bases with leading vfptrs before
laying out non-virutal bases without vfptrs. This guarantees that the
primary base is laid out first. r198818 fixed RecordLayoutBuilder to
produce compatiable layouts. This patch fixes CGRecordLayoutBuilder to
be able to consume those layouts and produce meaningful output without
tripping any asserts about assumed incoming layout.
A test case is included that shows CGRecordLayoutBuilder in fact
produces output in the compatiable order.
llvm-svn: 198900
|
|
|
|
| |
llvm-svn: 198837
|
|
|
|
|
|
|
|
|
| |
This patch refactors microsoft record layout to be more "natural". The
most dominant change is that vbptrs and vfptrs are injected after the
fact. This simplifies the implementation and the math for the offest
for the first base/field after the vbptr.
llvm-svn: 198818
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 197626
|
|
|
|
| |
llvm-svn: 197507
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
After r196549 there is no need to separate FinalizeCXXLayout and
FinalizeLayout so they were merged and FinalizeCXXLayout was eliminated.
llvm-svn: 197083
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Also includes a minor refactor with no functional change.
llvm-svn: 196627
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 196510
|
|
|
|
|
|
|
| |
This patch tries to avoid unrelated changes other than fixing a few
hyphen-related ambiguities in nearby lines.
llvm-svn: 196466
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
improving comments to make documentation more accurate.
Differential Revision:http://llvm-reviews.chandlerc.com/D2172
llvm-svn: 194609
|
|
|
|
|
|
| |
Reviewed at http://llvm-reviews.chandlerc.com/D2120
llvm-svn: 194256
|
|
|
|
|
|
|
|
|
|
| |
bitfield
This patch adds the same behavior to clang.
Differential Revision: http://llvm-reviews.chandlerc.com/D2103
llvm-svn: 194115
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 193395
|
|
|
|
| |
llvm-svn: 193313
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Every other function in Redeclarable.h was using Decl instead of Declaration.
llvm-svn: 192900
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
We're not ready to use it everywhere we use a win32 triple yet.
llvm-svn: 192502
|
|
|
|
| |
llvm-svn: 192495
|
|
|
|
| |
llvm-svn: 192494
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
these in eagerly if we're not actually processing a translation unit. The added
laziness here also avoids us loading in parts of a CXXRecordDecl earlier than an
upcoming class template specialization merging patch would like.
Ideally, we should mark the vtable as used when we see a definition for the key
function, rather than having a separate pass over dynamic classes at the end of
the TU. The existing approach is pretty bad for PCH/modules, since it forcibly
loads the declarations of all key functions in all imported modules, whether or
not those key functions are defined.
llvm-svn: 189627
|
|
|
|
|
|
|
|
|
| |
The record layout code didn't properly take into account that
an empty class at offset 0 can have an alignment greater than 1.
Patch by Andrea Di Biagio.
llvm-svn: 186370
|
|
|
|
|
|
|
| |
Guarded malloc emits some messages at the beginning in stderr when enabled.
These messages caused a few tests to fail.
llvm-svn: 186219
|
|
|
|
| |
llvm-svn: 185042
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The old implementation of ms_struct in RecordLayoutBuilder was a
complete mess: it depended on complicated conditionals which didn't
really reflect the underlying logic, and placed a burden on users of
the resulting RecordLayout. This commit rips out almost all of the
old code, and replaces it with simple checks in
RecordLayoutBuilder::LayoutBitField.
This commit also fixes <rdar://problem/14252115>, a bug where class
inheritance would cause us to lay out bitfields incorrectly.
llvm-svn: 185018
|
|
|
|
|
|
|
|
|
|
|
| |
When the decl that we're getting alignment for is a FieldDecl, and the field's
parent record is invalid, skip the actual field alignment calculation (and
return 1-byte alignment in the general case).
Also, assert in in getASTRecordLayout that the decl is valid. This was
inspired by PR16292; see also r184581 and r184751.
llvm-svn: 184883
|
|
|
|
|
|
|
|
|
|
|
| |
MSVC's class data is always comdat, so clang's should always be
linkonce_odr in LLVM IR.
Reviewers: pcc
Differential Revision: http://llvm-reviews.chandlerc.com/D838
llvm-svn: 182865
|
|
|
|
|
|
|
|
|
|
|
|
| |
Most of the complexity of this patch is figuring out which types get the
qualifier and which don't. If we implement __ptr32/64, then we should
check the qualifier instead of assuming all pointers are 64-bit.
This fixes PR13792.
Patch by Warren Hunt!
llvm-svn: 181825
|