summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/RecordLayoutBuilder.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-301-14/+14
| | | | | | | | | | | | | filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) llvm-svn: 155808
* When laying out an Objective-C object, consultSean Callanan2012-03-151-0/+2
| | | | | | | | | the external source to complete the Decl if it hasn't been completed already. This fixes a crash in LLDB. llvm-svn: 152807
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-6/+6
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* If a struct needs to be laid out, and it has notSean Callanan2012-02-081-0/+4
| | | | | | | | been completed yet, then complete it if possible. This fixes some assertion failures encountered by LLDB. llvm-svn: 150020
* Allow the external AST source to provide a layout without specifyingDouglas Gregor2012-01-281-42/+76
| | | | | | | the alignment (because it's not encoded in DWARF). In this case, make an educated guess at the alignment. llvm-svn: 149161
* Extend the ExternalASTSource interface to allow the AST source toDouglas Gregor2012-01-261-41/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | provide the layout of records, rather than letting Clang compute the layout itself. LLDB provides the motivation for this feature: because various layout-altering attributes (packed, aligned, etc.) don't get reliably get placed into DWARF, the record layouts computed by LLDB from the reconstructed records differ from the actual layouts, and badness occurs. This interface lets the DWARF data drive layout, so we don't need the attributes preserved to get the answer write. The testing methodology for this change is fun. I've introduced a variant of -fdump-record-layouts called -fdump-record-layouts-simple that always has the simple C format and provides size/alignment/field offsets. There is also a -cc1 option -foverride-record-layout=<file> to take the output of -fdump-record-layouts-simple and parse it to produce a set of overridden layouts, which is introduced into the AST via a testing-only ExternalASTSource (called LayoutOverrideSource). Each test contains a number of records to lay out, which use various layout-changing attributes, and then dumps the layouts. We then run the test again, using the preprocessor to eliminate the layout-changing attributes entirely (which would give us different layouts for the records), but supplying the previously-computed record layouts. Finally, we diff the layouts produced from the two runs to be sure that they are identical. Note that this code makes the assumption that we don't *have* to provide the offsets of bases or virtual bases to get the layout right, because the alignment attributes don't affect it. I believe this assumption holds, but if it does not, we can extend LayoutOverrideSource to also provide base offset information. Fixes the Clang side of <rdar://problem/10169539>. llvm-svn: 149055
* constexpr irgen: Add irgen support for APValue::Struct, APValue::Union,Richard Smith2012-01-141-0/+22
| | | | | | | | | | | | | | | | | | | | APValue::Array and APValue::MemberPointer. All APValue values can now be emitted as constants. Add new CGCXXABI entry point for emitting an APValue MemberPointer. The other entrypoints dealing with constant member pointers are no longer necessary and will be removed in a later change. Switch codegen from using EvaluateAsRValue/EvaluateAsLValue to VarDecl::evaluateValue. This performs caching and deals with the nasty cases in C++11 where a non-const object's initializer can refer indirectly to previously-initialized fields within the same object. Building the intermediate APValue object incurs a measurable performance hit on pathological testcases with huge initializer lists, so we continue to build IR directly from the Expr nodes for array and record types outside of C++11. llvm-svn: 148178
* Recommit r148056 with fixes to deal with weirdness with bitfields in unions.Eli Friedman2012-01-121-4/+4
| | | | | | Original message: Make sure adding a field to a struct never reduces its size. PR11745. llvm-svn: 148070
* Revert r148056 while I investigate failures.Eli Friedman2012-01-121-4/+5
| | | | llvm-svn: 148068
* Make sure adding a field to a struct never reduces its size. PR11745.Eli Friedman2012-01-121-5/+4
| | | | llvm-svn: 148056
* When performing layout for an Objective-C class, make sure to dig outDouglas Gregor2011-12-201-1/+3
| | | | | | the definition of that class. Fixes PR11613 / <rdar://problem/10604077>. llvm-svn: 146976
* Keep track of all declarations of an Objective-C class (both forwardDouglas Gregor2011-12-151-1/+1
| | | | | | | | | | declarations and definitions) as ObjCInterfaceDecls within the same redeclaration chain. This new representation matches what we do for C/C++ variables/functions/classes/templates/etc., and makes it possible to answer the query "where are all of the declarations of this class?" llvm-svn: 146679
* Fixes a bug in calculation of field offsets of ms_structFariborz Jahanian2011-12-121-3/+14
| | | | | | | fields by just following what comment says. // rdar://10513599 llvm-svn: 146414
* Fix bitfield handling for record layout with #pragma pack. ↵Eli Friedman2011-12-021-3/+5
| | | | | | <rdar://problem/10494810> and PR9560. llvm-svn: 145673
* Fix MSVC class layout for empty classes. Patch by Dmitry Sokolov.Eli Friedman2011-12-011-4/+9
| | | | llvm-svn: 145544
* Fix the layout of vb-tables and vf-tables in the MS C++ ABI.John McCall2011-11-081-184/+202
| | | | | | Based on work by Dmitry Sokolov! llvm-svn: 144072
* Now that we have a portable 64 bit format string use it to make this simple ↵Benjamin Kramer2011-11-051-2/+1
| | | | | | again. llvm-svn: 143800
* Fix incorrect format string in debug output.Eli Friedman2011-11-051-1/+2
| | | | llvm-svn: 143768
* More ASTRecordLayout changes for MS ABI; based on patch by r4start.Eli Friedman2011-10-211-24/+32
| | | | llvm-svn: 142694
* Revert accidental commit.Eli Friedman2011-10-181-2/+2
| | | | llvm-svn: 142326
* Rewrite parts of MS ABI C++ layout. Based on work by r4start; I ended up ↵Eli Friedman2011-10-181-87/+82
| | | | | | doing this while I was trying to review his patch. llvm-svn: 142325
* Change operator<< for raw_ostream and NamedDecl to take a reference instead ↵Benjamin Kramer2011-10-141-4/+4
| | | | | | | | of a pointer. Passing a pointer was a bad idea as it collides with the overload for void*. llvm-svn: 141971
* Constant expression evaluation refactoring:Richard Smith2011-10-101-10/+6
| | | | | | | | | | | - Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions, and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert behaviour. - Factor out evaluation of bitfield bit widths. - Fix a few places which would evaluate an expression twice: once to determine whether it is a constant expression, then again to get the value. llvm-svn: 141561
* Rename TagDecl::isDefinition -> isCompleteDefinitionJohn McCall2011-10-071-1/+1
| | | | | | | for better self-documenting code, since the semantics are subtly different from getDefinition(). llvm-svn: 141355
* Record layout requires not just a definition, but a completeJohn McCall2011-10-071-0/+5
| | | | | | | | definition. Assert this. Change IR generation to not try to aggressively emit the IR translation of a record during its own definition. Fixes PR10912. llvm-svn: 141350
* Driver & AST: Implement support for -fpack-struct and -fpack-struct= commandDaniel Dunbar2011-10-051-0/+5
| | | | | | | line options. - <rdar://problem/10120602>, PR9631 llvm-svn: 141211
* Fix doxygen comment.Eric Christopher2011-10-051-2/+2
| | | | llvm-svn: 141165
* Some changes to improve compatibility for MSVC-style C++ struct layout. ↵Eli Friedman2011-09-271-38/+207
| | | | | | Patch from r4start at gmail.com (with some minor modifications by me). llvm-svn: 140623
* Don't emit -Wpadded warnings without a valid SourceLocation. This can ↵Ted Kremenek2011-09-061-0/+5
| | | | | | happen when RecordLayoutBuilder is used by Codegen, not Sema. llvm-svn: 139162
* Extend the ASTContext constructor to delay the initialization ofDouglas Gregor2011-09-021-22/+22
| | | | | | | | builtin types (When requested). This is another step toward making ASTUnit build the ASTContext as needed when loading an AST file, rather than doing so after the fact. No actual functionality change (yet). llvm-svn: 138985
* Add support for using anonymous bitfields (e.g., int : 0) to enforce alignment.Chad Rosier2011-08-051-23/+39
| | | | | | | | | | | | | | | This fixes cases where the anonymous bitfield is followed by a bitfield member. E.g., struct t4 { char foo; long : 0; char bar : 1; }; rdar://9859156 llvm-svn: 136991
* More whitespace and naming fixup. No functionality change.Chad Rosier2011-08-041-2/+2
| | | | llvm-svn: 136944
* Fix style and remove obviously redundant code.Chad Rosier2011-08-041-2/+1
| | | | llvm-svn: 136907
OpenPOWER on IntegriCloud