Warren Hunt
d640d7d96e
[ms-abi] Refactor Microsoft Record Layout
...
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
2014-01-09 00:30:56 +00:00
Warren Hunt
049f673dae
[MS-ABI] Fix alias-avoidance padding between bases
...
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
2013-12-06 19:54:25 +00:00
Warren Hunt
7b252d24ad
Support MS-ABI's concept of "Required Alignment" imposed by
...
__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
2013-12-06 00:01:17 +00:00
Warren Hunt
486e71460d
No functional change. Renaming a variable in RecordLayoutBuilder and
...
improving comments to make documentation more accurate.
Differential Revision:http://llvm-reviews.chandlerc.com/D2172
llvm-svn: 194609
2013-11-13 22:16:13 +00:00
Timur Iskhodzhanov
2c9341f979
Thread the info about vbptr sharing through ASTRecordLayout
...
Reviewed at http://llvm-reviews.chandlerc.com/D2120
llvm-svn: 194256
2013-11-08 11:45:35 +00:00
Warren Hunt
8f8bad723d
Adds Microsoft compatiable C++ record layout code to clang.
...
llvm-svn: 192494
2013-10-11 20:19:00 +00:00
John McCall
359b885e12
First pass at abstracting out a class for the target C++ ABI.
...
llvm-svn: 173514
2013-01-25 22:30:49 +00:00
Benjamin Kramer
2ef3031496
Remove get(V)BaseClassOffsetInBits, the CharUnit functions should be used instead.
...
No functionality change.
llvm-svn: 159719
2012-07-04 18:45:14 +00:00
John McCall
e42a336604
Add support for laying out vtordisps according to our current
...
working knowledge of the Microsoft ABI. Based on a patch by
Dmitry Sokolov.
llvm-svn: 155905
2012-05-01 08:55:32 +00:00
Eli Friedman
43114f9084
More ASTRecordLayout changes for MS ABI; based on patch by r4start.
...
llvm-svn: 142694
2011-10-21 22:49:56 +00:00
Eli Friedman
84d2d3a90e
Some changes to improve compatibility for MSVC-style C++ struct layout. Patch from r4start at gmail.com (with some minor modifications by me).
...
llvm-svn: 140623
2011-09-27 19:12:27 +00:00
Ken Dyck
7ad11e70b6
Convert RecordLayout::Alignment to CharUnits from bit units. No change in
...
functionality intended.
llvm-svn: 125549
2011-02-15 02:32:40 +00:00
Ken Dyck
d5090c16f8
Convert RecordLayout::DataSize to CharUnits from bits, eliminating two
...
unnecessary calls to RoundUpToAlignment. No changes to functionality
intended.
llvm-svn: 125356
2011-02-11 02:20:09 +00:00
Ken Dyck
c8ae55050d
Convert RecordLayout::Size to CharUnits from bits. No changes to
...
functionality intended.
llvm-svn: 125156
2011-02-09 01:59:34 +00:00
Ken Dyck
bec0285d7f
Convert RecordLayout::NonVirtualAlign to CharUnits. No change in
...
functionality intended.
llvm-svn: 125069
2011-02-08 02:02:47 +00:00
Ken Dyck
316d6f69bc
Convert RecordLayout::NonVirtualSize from bit units to CharUnits.
...
llvm-svn: 124646
2011-02-01 01:52:10 +00:00
Jay Foad
39c7980772
PR3558: mark "logically const" accessor methods in ASTContext as const,
...
and mark the fields they use as mutable. This allows us to remove a few
const_casts.
llvm-svn: 123314
2011-01-12 09:06:06 +00:00
Anders Carlsson
19bda8af16
Remove the PrimaryBaseInfo class.
...
llvm-svn: 120134
2010-11-24 23:20:19 +00:00
Anders Carlsson
7f95cd1817
Rename RecordLayout::getPrimaryBaseWasVirtual to isPrimaryBaseVirtual.
...
llvm-svn: 120133
2010-11-24 23:12:57 +00:00
Anders Carlsson
3f01871647
Port over a couple of getVBaseClassOffsetInBits call sites to use getVBaseClassOffset instead.
...
llvm-svn: 117882
2010-10-31 23:45:59 +00:00
Anders Carlsson
fd88a6160d
Rename getBaseClassOffset to getBaseClassOffsetInBits and introduce a getBaseClassOffset which returns the offset in CharUnits. Do the same thing for getVBaseClassOffset.
...
llvm-svn: 117881
2010-10-31 23:22:37 +00:00
Anders Carlsson
28466ab8f4
EmptyObjectMap now uses CharUnits wherever possible.
...
llvm-svn: 117877
2010-10-31 22:13:23 +00:00
Argyrios Kyrtzidis
96dbfa2e65
Plug leak. The DenseMaps of CXXRecordLayoutInfo weren't freed.
...
llvm-svn: 112006
2010-08-25 00:32:19 +00:00
Anders Carlsson
d20e7cd3c6
No need to use the PrimaryBaseInfo struct in the builder.
...
llvm-svn: 104681
2010-05-26 05:20:58 +00:00
Anders Carlsson
2357bfd9d0
Add a SizeOfLargestEmptySubobject member to ASTRecordLayout. For C++ classes this will hold the largest empty subobject or 0 if the class doesn't have any empty subobjects.
...
llvm-svn: 103359
2010-05-08 22:35:05 +00:00
Anders Carlsson
6a84889d3f
Replace the class offset vectors in RecordLayoutBuilder with maps instead so we'll have faster lookup and so we can detect duplicates.
...
llvm-svn: 98231
2010-03-11 04:10:39 +00:00
Anders Carlsson
09db5370b7
Assert that primary bases always have offset 0.
...
llvm-svn: 98223
2010-03-11 01:49:18 +00:00
Benjamin Kramer
bbf5c262ab
Replace copy loops with memcpy.
...
llvm-svn: 98055
2010-03-09 12:53:38 +00:00
Ted Kremenek
c3015a914f
Allocate ASTRecordLayout objects using the allocator associated with ASTContext.
...
This allows them to be allocated using a BumpPtrAllocated
in the common case.
llvm-svn: 97978
2010-03-08 20:56:29 +00:00