summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/RecordLayoutBuilder.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix indentation from r197490 plus some typosAlp Toker2013-12-171-1/+1
| | | | llvm-svn: 197507
* [ms-abi] Refactoring Non-virtual base layout in record layoutWarren Hunt2013-12-121-69/+39
| | | | | | | | | 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
* [ms-abi][cleanup] Removing FinalizeCXXLayout : no functional changeWarren Hunt2013-12-111-10/+1
| | | | | | | After r196549 there is no need to separate FinalizeCXXLayout and FinalizeLayout so they were merged and FinalizeCXXLayout was eliminated. llvm-svn: 197083
* [ms-abi] Makes Virtual Base Alignment Look at All Virtual BasesWarren Hunt2013-12-111-5/+8
| | | | | | | | 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
* [ms-abi] 64-bit fixes for r196549Warren Hunt2013-12-101-10/+17
| | | | | | | | 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
* Fixing assertion failure introduced in 196602.Warren Hunt2013-12-071-6/+4
| | | | | | Also includes a minor refactor with no functional change. llvm-svn: 196627
* [MS-ABI] adds padding before all vbases after a bitfieldWarren Hunt2013-12-061-8/+7
| | | | | | | | | | 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
* [MS-ABI] Fix alias-avoidance padding between basesWarren Hunt2013-12-061-63/+70
| | | | | | | | | | | 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
* Support MS-ABI's concept of "Required Alignment" imposed by Warren Hunt2013-12-061-24/+53
| | | | | | | | | | | | | | | | | | __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
* Fix a tranche of comment, test and doc typosAlp Toker2013-12-051-3/+3
| | | | llvm-svn: 196510
* Correct hyphenations in comments and assert messagesAlp Toker2013-12-051-1/+1
| | | | | | | This patch tries to avoid unrelated changes other than fixing a few hyphen-related ambiguities in nearby lines. llvm-svn: 196466
* Microsoft Record Layout: zero sized base after base with vbtbl fixWarren Hunt2013-11-191-0/+11
| | | | | | | | | | 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
* No functional change. Renaming a variable in RecordLayoutBuilder and Warren Hunt2013-11-131-10/+13
| | | | | | | | improving comments to make documentation more accurate. Differential Revision:http://llvm-reviews.chandlerc.com/D2172 llvm-svn: 194609
* Thread the info about vbptr sharing through ASTRecordLayoutTimur Iskhodzhanov2013-11-081-5/+4
| | | | | | Reviewed at http://llvm-reviews.chandlerc.com/D2120 llvm-svn: 194256
* Microsoft adds weird padding before virtual bases if the last field was a ↵Warren Hunt2013-11-061-0/+9
| | | | | | | | | | bitfield This patch adds the same behavior to clang. Differential Revision: http://llvm-reviews.chandlerc.com/D2103 llvm-svn: 194115
* Improves compatibility with cl.exe when laying out array fieldsWarren Hunt2013-11-011-19/+3
| | | | | | | | | | | | | 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
* Remove dead variables.Benjamin Kramer2013-10-251-11/+2
| | | | llvm-svn: 193395
* Remove dead recursive function.Benjamin Kramer2013-10-241-22/+0
| | | | llvm-svn: 193313
* Implements 64 bit microsoft record layout and adds lit tests to cover Warren Hunt2013-10-231-388/+70
| | | | | | | | | 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
* Rename some functions for consistency.Rafael Espindola2013-10-171-1/+1
| | | | | | Every other function in Redeclarable.h was using Decl instead of Declaration. llvm-svn: 192900
* PR17576: Fix assertion on polymorphic classes with small alignmentReid Kleckner2013-10-141-1/+1
| | | | | | | | 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
* Correctly check for distructors when realizing vtordispsWarren Hunt2013-10-141-1/+1
| | | | | | | | | | 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
* Only use the MS record layout when using the MS C++ ABIReid Kleckner2013-10-111-5/+5
| | | | | | We're not ready to use it everywhere we use a win32 triple yet. llvm-svn: 192502
* Fix unused variable warning in MS record layout.Reid Kleckner2013-10-111-3/+1
| | | | llvm-svn: 192495
* Adds Microsoft compatiable C++ record layout code to clang.Warren Hunt2013-10-111-31/+728
| | | | llvm-svn: 192494
* Be lazier when loading KeyFunctions from PCH/modules. We don't need to loadRichard Smith2013-08-291-12/+11
| | | | | | | | | | | | | | 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
* Fix alignment of class derived from empty class.Eli Friedman2013-07-161-3/+4
| | | | | | | | | 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
* Changes so that a few tests do not fail when running under guarded malloc.Argyrios Kyrtzidis2013-07-121-2/+2
| | | | | | | Guarded malloc emits some messages at the beginning in stderr when enabled. These messages caused a few tests to fail. llvm-svn: 186219
* Simplify code.Eli Friedman2013-06-261-39/+7
| | | | llvm-svn: 185042
* Rewrite record layout for ms_struct structs.Eli Friedman2013-06-261-162/+78
| | | | | | | | | | | | | | 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
* Don't try to get the layout of an invalid decl in getDeclAlign.Matt Beaumont-Gay2013-06-251-0/+1
| | | | | | | | | | | 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
* [ms-cxxabi] There are no key functions in the Microsoft C++ ABIReid Kleckner2013-05-291-0/+3
| | | | | | | | | | | 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
* [ms-cxxabi] Mangle in an implicit 'E' for certain types on win64Reid Kleckner2013-05-141-1/+1
| | | | | | | | | | | | 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
* Cleanup handling of UniqueExternalLinkage.Rafael Espindola2013-05-131-1/+1
| | | | | | | | | | | | | This patch renames getLinkage to getLinkageInternal. Only code that needs to handle UniqueExternalLinkage specially should call this. Linkage, as defined in the c++ standard, is provided by getFormalLinkage. It maps UniqueExternalLinkage to ExternalLinkage. Most places in the compiler actually want isExternallyVisible, which handles UniqueExternalLinkage as internal. llvm-svn: 181677
* Abstract the behavior of when to use base-class tail padding.John McCall2013-01-291-8/+49
| | | | | | | For fun, I added a comedy "actually obey the C++11 POD rules" option which nobody is allowed to use. llvm-svn: 173744
* The standard ARM C++ ABI dictates that inline functions areJohn McCall2013-01-251-10/+40
| | | | | | | | never key functions. We did not implement that rule for the iOS ABI, which was driven by what was implemented in gcc-4.2. However, implement it now for other ARM-based platforms. llvm-svn: 173515
* First pass at abstracting out a class for the target C++ ABI.John McCall2013-01-251-2/+6
| | | | llvm-svn: 173514
* Currently when AST record layouts are dumped with -fdump-record-layouts, theEli Bendersky2012-12-081-3/+11
| | | | | | | | | | | | | | following: sizeof=132, dsize=132, align=4 nvsize=132, nvalign=4 Is not indented, so when classes are nested there is no way to know to which class it belongs. Fix this problem by indenting the size summary properly for each class. llvm-svn: 169654
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-3/+3
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* When an externally-supplied record layout has a size that clearlyDouglas Gregor2012-10-261-15/+33
| | | | | | | | | | | doesn't include padding up to the alignment of the record, take this as a cue that the alignment of the record should (conservatively) be set to 1. This is similar to other the other cues we use to determine that the record has a lower alignment, e.g., that the externally-supplied layout places fields at lower offsets than we would. Fixes <rdar://problem/12582052>; test case in LLDB. llvm-svn: 166824
* Make -mms-bitfields behave consistently.Eli Friedman2012-10-121-5/+5
| | | | | | Patch by Jeremiah Zanin. llvm-svn: 165849
* Use LLVM_DELETED_FUNCTION in place of 'DO NOT IMPLEMENT' comments.Dmitri Gribenko2012-09-151-2/+2
| | | | llvm-svn: 163983
* Dont cast away const needlessly. Found by gcc48 -Wcast-qual.Roman Divacky2012-09-061-2/+2
| | | | llvm-svn: 163325
* Remove windows line endings.Benjamin Kramer2012-08-311-36/+34
| | | | | | While there fix a dead assert. llvm-svn: 163031
* Improved MSVC __interface support by adding first class support for it, ↵Joao Matos2012-08-311-20/+36
| | | | | | instead of aliasing to "struct" which had some incorrect behaviour. Patch by David Robins. llvm-svn: 163013
* Flesh out test for defaulted key functions a bit more.Benjamin Kramer2012-08-031-0/+1
| | | | llvm-svn: 161243
* Fix failed to generate vtables in certain cases.Benjamin Kramer2012-08-031-0/+3
| | | | | | | | | | | By C++ standard, the vtable should be generated if the first non-inline virtual function is defined in the TU. Current version of clang doesn't generate vtable if the first virtual function is defaulted, because the key function is regarded as the defaulted function. Patch by Li Kan! llvm-svn: 161236
* Remove get(V)BaseClassOffsetInBits, the CharUnit functions should be used ↵Benjamin Kramer2012-07-041-0/+1
| | | | | | | | instead. No functionality change. llvm-svn: 159719
* Revert Decl's iterators back to pointer value_type rather than reference ↵David Blaikie2012-06-061-21/+15
| | | | | | | | | | | | | | value_type In addition, I've made the pointer and reference typedef 'void' rather than T* just so they can't get misused. I would've omitted them entirely but std::distance likes them to be there even if it doesn't use them. This rolls back r155808 and r155869. Review by Doug Gregor incorporating feedback from Chandler Carruth. llvm-svn: 158104
* Add support for laying out vtordisps according to our currentJohn McCall2012-05-011-33/+231
| | | | | | | working knowledge of the Microsoft ABI. Based on a patch by Dmitry Sokolov. llvm-svn: 155905
OpenPOWER on IntegriCloud