summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/RecordLayoutBuilder.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Simplify crash recovery cleanup registration.Ted Kremenek2011-03-221-3/+2
| | | | llvm-svn: 128057
* Recover memory from RecordLayoutBuilders during crashes.Ted Kremenek2011-03-191-1/+6
| | | | llvm-svn: 127931
* Instead of round up sizes to '8', round them up to the alignment of the charKen Dyck2011-03-101-2/+4
| | | | | | type. llvm-svn: 127391
* Round up the non-virtual size to the next char instead of rounding down.Ken Dyck2011-03-101-2/+3
| | | | llvm-svn: 127390
* Use CharUnits for TypeAlign variable in LayoutWideBitField(). No change inKen Dyck2011-03-011-4/+5
| | | | | | functionality intended. llvm-svn: 126730
* Change the return type of GetVirtualPointersSize() to CharUnits. No changeKen Dyck2011-03-011-8/+10
| | | | | | in functionality intended. llvm-svn: 126727
* Retry r126357. Use CharUnits for the Size and DataSize calculations whenKen Dyck2011-02-281-36/+27
| | | | | | | | they are known to be exact multiples of the width of the char type. Add a test case to CodeGen/union.c that would have caught the problem with the previous attempt. No change in functionality intended. llvm-svn: 126628
* Revert "Use CharUnits values for Size and DataSize outside of the bitfieldDaniel Dunbar2011-02-241-19/+23
| | | | | | layout", it broke some GCC tests. llvm-svn: 126386
* Use CharUnits values for Size and DataSize outside of the bitfield layoutKen Dyck2011-02-241-23/+19
| | | | | | | methods, when they are known to be exact multiples of the width of the char type. llvm-svn: 126357
* Use Context.getCharWidth() in place of literal '8's in assertions.Ken Dyck2011-02-241-2/+2
| | | | llvm-svn: 126356
* Make the Size and DataSize members more CharUnits-friendly by wrapping themKen Dyck2011-02-241-35/+58
| | | | | | | | | | | with getter and setter methods in both bit units and CharUnits. This will help simplify some of the unit mismatch in the parts of the code where sizes are known to be exact multiples of the width of the char type. Assertions in the getters help guard against accidentally converting to CharUnits when sizes are not exact multiples of the char width. llvm-svn: 126354
* Expand use of CharUnits in LayoutField(). No change in functionalityKen Dyck2011-02-201-29/+34
| | | | | | intended. llvm-svn: 126066
* Expand use of CharUnits for alignments further. No change in functionalityKen Dyck2011-02-191-30/+30
| | | | | | intended. llvm-svn: 126034
* Convert MaxFieldAlignment to CharUnits from bits. No change in functionalityKen Dyck2011-02-171-18/+23
| | | | | | intended. llvm-svn: 125704
* Convert the UnpackedAlignment field to CharUnits from bits. No change inKen Dyck2011-02-161-6/+9
| | | | | | functionality intended. llvm-svn: 125643
* Convert Alignment member to CharUnits from bits. No change in functionalityKen Dyck2011-02-161-15/+16
| | | | | | intended. llvm-svn: 125641
* Convert NonVirtualSize to CharUnits from bits. No change in functionalityKen Dyck2011-02-161-7/+9
| | | | | | intended. llvm-svn: 125639
* Convert NonVirtualAlignment to CharUnits. No change in functionalityKen Dyck2011-02-161-6/+5
| | | | | | intended. llvm-svn: 125638
* Convert RecordLayout::Alignment to CharUnits from bit units. No change inKen Dyck2011-02-151-6/+9
| | | | | | functionality intended. llvm-svn: 125549
* Convert RecordLayout::DataSize to CharUnits from bits, eliminating twoKen Dyck2011-02-111-6/+7
| | | | | | | unnecessary calls to RoundUpToAlignment. No changes to functionality intended. llvm-svn: 125356
* Add a helper function, ASTContext::toBits(), that converts sizes inKen Dyck2011-02-111-14/+6
| | | | | | | CharUnits to sizes in bits, and use it to tidy up the places where the conversion was done explicitly. llvm-svn: 125332
* Convert RecordLayout::Size to CharUnits from bits. No changes toKen Dyck2011-02-091-11/+18
| | | | | | functionality intended. llvm-svn: 125156
* Convert RecordLayout::NonVirtualAlign to CharUnits. No change inKen Dyck2011-02-081-3/+5
| | | | | | functionality intended. llvm-svn: 125069
* For gcc compatibility, size of a class which is zeroFariborz Jahanian2011-02-021-2/+11
| | | | | | | | but has non-empty data fields, such as array of zero length, remains zero. // rdar://8945175 llvm-svn: 124741
* Basic support for -mms-bitfields, from Carl Norum!Douglas Gregor2011-02-011-0/+14
| | | | llvm-svn: 124661
* Convert RecordLayout::NonVirtualSize from bit units to CharUnits.Ken Dyck2011-02-011-3/+4
| | | | llvm-svn: 124646
* Remove private toCharUnits() helper method, replacing with calls toKen Dyck2011-01-241-17/+10
| | | | | | ASTContext::toCharUnitsFromBits(). llvm-svn: 124092
* Replace calls to CharUnits::fromQuantity() with onesKen Dyck2011-01-181-4/+3
| | | | | | ASTContext::toCharUnitsFromBits() when converting from bit sizes to char units. llvm-svn: 123715
* PR3558: mark "logically const" accessor methods in ASTContext as const,Jay Foad2011-01-121-9/+12
| | | | | | | and mark the fields they use as mutable. This allows us to remove a few const_casts. llvm-svn: 123314
* Fix PR8796.Rafael Espindola2010-12-291-3/+5
| | | | | | | | The problem was that we were asserting the we never added an empty class to the same offset twice. This is not true for unions, where two members, empty or not, can have the some offset. llvm-svn: 122633
* Fix another unnecessary-struct-padding issue.Argyrios Kyrtzidis2010-12-091-1/+10
| | | | llvm-svn: 121352
* Before determining the effect the alignment of base struct will have in the ↵Argyrios Kyrtzidis2010-12-091-2/+9
| | | | | | | | | | aligment of the sub-struct, take into account if the sub-struct is packed and its maximum field alignment. Fixes rdar://8745206 llvm-svn: 121335
* Move isNearlyEmpty out into the ASTContext so it can be called from CodeGen ↵Anders Carlsson2010-11-251-28/+1
| | | | | | as well. llvm-svn: 120137
* Rename RecordLayout::getPrimaryBaseWasVirtual to isPrimaryBaseVirtual.Anders Carlsson2010-11-241-2/+2
| | | | llvm-svn: 120133
* Use the newly added function in ASTRecordLayoutBuilder.Anders Carlsson2010-11-241-38/+3
| | | | llvm-svn: 120131
* Refactoring of Diagnostic class.Argyrios Kyrtzidis2010-11-181-2/+1
| | | | | | | | | | | -Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class. -DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units. -The rest of the state in Diagnostic object is considered related and tied to one translation unit. -Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a SourceLocation instead of a FullSourceLoc. -Reflect the changes to various interfaces. llvm-svn: 119730
* Don't update empty field subobjects for bitfields. Fixes PR8519.Anders Carlsson2010-11-011-1/+3
| | | | llvm-svn: 117921
* Get rid of more calls to getBaseClassOffsetInBits.Anders Carlsson2010-11-011-10/+5
| | | | llvm-svn: 117883
* Port over a couple of getVBaseClassOffsetInBits call sites to use ↵Anders Carlsson2010-10-311-18/+18
| | | | | | getVBaseClassOffset instead. llvm-svn: 117882
* Rename getBaseClassOffset to getBaseClassOffsetInBits and introduce a ↵Anders Carlsson2010-10-311-9/+9
| | | | | | getBaseClassOffset which returns the offset in CharUnits. Do the same thing for getVBaseClassOffset. llvm-svn: 117881
* Start converting over the RecordLayoutBuilder next.Anders Carlsson2010-10-311-20/+15
| | | | llvm-svn: 117878
* EmptyObjectMap now uses CharUnits wherever possible.Anders Carlsson2010-10-311-61/+61
| | | | llvm-svn: 117877
* More CharUnits conversion.Anders Carlsson2010-10-311-22/+44
| | | | llvm-svn: 117875
* More CharUnits conversion.Anders Carlsson2010-10-311-21/+28
| | | | llvm-svn: 117874
* Use CharUnits in the EmptyClassOffsets map.Anders Carlsson2010-10-311-3/+12
| | | | llvm-svn: 117873
* Baby steps towards using only CharUnits for base class offsets in ↵Anders Carlsson2010-10-311-4/+10
| | | | | | ASTRecordLayout. Start by storing the offsets in CharUnits in the ASTRecordLayout object. llvm-svn: 117869
* Move classes into anonymous namespaces.Benjamin Kramer2010-10-221-9/+11
| | | | llvm-svn: 117104
* Store in PCH the key function of C++ class to avoid deserializing the ↵Argyrios Kyrtzidis2010-10-141-3/+0
| | | | | | | | complete declaration context in order to compute it. Progress for rdar://7260160. llvm-svn: 116508
* Embrace C++ ABI 5.2.6 and consider that template instantiations don't have ↵Argyrios Kyrtzidis2010-10-131-0/+7
| | | | | | key functions (same as GCC). llvm-svn: 116391
* Implement -Wpadded and -Wpacked.Argyrios Kyrtzidis2010-09-221-22/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -Wpadded warns when undesired padding is introduced in a struct. (rdar://7469556) -Wpacked warns if a struct is given the packed attribute, but the packed attribute has no effect on the layout or the size of the struct. Such structs may be mis-aligned for little benefit. The warnings are emitted at the point where layout is calculated, that is at RecordLayoutBuilder. To avoid calculating the layouts of all structs regardless of whether they are needed or not, I let the layouts be lazily constructed when needed. This has the disadvantage that the above warnings will be emitted only when they are used for IR gen, and not e.g with -fsyntax-only: $ cat t.c struct S { char c; int i; }; void f(struct S* s) {} $ clang -fsyntax-only -Wpadded t.c $ clang -c -Wpadded t.c -o t.o t.c:3:7: warning: padding struct 'struct S' with 3 bytes to align 'i' [-Wpadded] int i; ^ 1 warning generated. This is a good tradeoff between providing the warnings and not calculating layouts for all structs in case the user has enabled a couple of rarely used warnings. llvm-svn: 114544
OpenPOWER on IntegriCloud