aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/RecordLayoutBuilder.cpp
AgeCommit message (Collapse)Author
2011-08-04Add partial support for using anonymous bitfields (e.g., int : 0) to enforce Chad Rosier
alignment. This fixes cases where the anonymous bitfield is followed by a non-bitfield member. E.g., struct t4 { int foo : 1; long : 0; char bar; }; Part of rdar://9859156 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136858 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-23remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner
LLVM.h imports them into the clang namespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-22Add a const overload for ObjCInterfaceDecl::all_declared_ivar_begin.Jordy Rose
This was previously not-const only because it has to lazily construct a chain of ivars the first time it is called (and after the chain is invalidated). In practice, all the clients were just const_casting their const Decls; all those now-unnecessary const_casts have been removed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135741 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28Eliminate most uses of ShallowCollectObjCIvars which requiresFariborz Jahanian
a vector for collection. Use iterators where needed instead. // rdar://6817577 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134015 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-10PR10120: Make CodeGenModule::getVTableLinkage use NamedDecl::getLinkage to ↵Eli Friedman
determine whether the vtable should be externally visible, instead of a rough approximation of it which messes up with templates. While I'm here, zap the other user of isInAnonymousNamespace outside of Decl.cpp. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132861 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-11Implenment #pack pragma and ms_struct attribute layout.Fariborz Jahanian
Concludes // radar://8823265. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131188 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-10Support pack pragma and ms_struct attributes. // rdar://8823265Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131142 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-09'long long' requires special treatment in ms_structFariborz Jahanian
structs (impacts 32-bit only though). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131103 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-06In ms_struct structs, Establish a new alignment for a Fariborz Jahanian
non-bitfield following a bitfield if size of their types differ. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131032 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-06Establish a new alignment for an ms_struct bitfield followingFariborz Jahanian
a non-bitfield if size of their types differ. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131023 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-04More ms_struct bitfield stuff:Fariborz Jahanian
Adjacent bit fields are packed into the same 1-, 2-, or 4-byte allocation unit if the integral types are the same size. // rdar://8823265. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130851 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-03Only the first zero-length bitfield decides alignment ofFariborz Jahanian
the followup data member in an ms_struct struct. // rdar:// 8823265 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130795 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-03Finish off rules for z-length bitfields in ms_structFariborz Jahanian
structs. // rdar://8823265 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130783 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-02More rule enforcement of zero bitfields for ms_struct.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130696 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-27Some refactoring of my ms_struct patch.Fariborz Jahanian
// rdar://8823265 related. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130311 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-26With ms_struct attribut, Zero-length bitfields following Fariborz Jahanian
non-bitfield members are ignore. // rdar://8823265 wip git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130257 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-22Simplify crash recovery cleanup registration.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128057 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19Recover memory from RecordLayoutBuilders during crashes.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127931 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10Instead of round up sizes to '8', round them up to the alignment of the charKen Dyck
type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127391 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10Round up the non-virtual size to the next char instead of rounding down.Ken Dyck
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127390 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01Use CharUnits for TypeAlign variable in LayoutWideBitField(). No change inKen Dyck
functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126730 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01Change the return type of GetVirtualPointersSize() to CharUnits. No changeKen Dyck
in functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126727 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-28Retry r126357. Use CharUnits for the Size and DataSize calculations whenKen Dyck
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126628 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-24Revert "Use CharUnits values for Size and DataSize outside of the bitfieldDaniel Dunbar
layout", it broke some GCC tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126386 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-24Use CharUnits values for Size and DataSize outside of the bitfield layoutKen Dyck
methods, when they are known to be exact multiples of the width of the char type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126357 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-24Use Context.getCharWidth() in place of literal '8's in assertions.Ken Dyck
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126356 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-24Make the Size and DataSize members more CharUnits-friendly by wrapping themKen Dyck
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126354 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-20Expand use of CharUnits in LayoutField(). No change in functionalityKen Dyck
intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126066 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-19Expand use of CharUnits for alignments further. No change in functionalityKen Dyck
intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126034 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-17Convert MaxFieldAlignment to CharUnits from bits. No change in functionalityKen Dyck
intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125704 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-16Convert the UnpackedAlignment field to CharUnits from bits. No change inKen Dyck
functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125643 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-16Convert Alignment member to CharUnits from bits. No change in functionalityKen Dyck
intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125641 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-16Convert NonVirtualSize to CharUnits from bits. No change in functionalityKen Dyck
intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125639 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-16Convert NonVirtualAlignment to CharUnits. No change in functionalityKen Dyck
intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125638 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-15Convert RecordLayout::Alignment to CharUnits from bit units. No change inKen Dyck
functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125549 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11Convert RecordLayout::DataSize to CharUnits from bits, eliminating twoKen Dyck
unnecessary calls to RoundUpToAlignment. No changes to functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125356 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11Add a helper function, ASTContext::toBits(), that converts sizes inKen Dyck
CharUnits to sizes in bits, and use it to tidy up the places where the conversion was done explicitly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125332 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09Convert RecordLayout::Size to CharUnits from bits. No changes toKen Dyck
functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125156 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08Convert RecordLayout::NonVirtualAlign to CharUnits. No change inKen Dyck
functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125069 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-02For gcc compatibility, size of a class which is zeroFariborz Jahanian
but has non-empty data fields, such as array of zero length, remains zero. // rdar://8945175 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124741 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-01Basic support for -mms-bitfields, from Carl Norum!Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124661 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-01Convert RecordLayout::NonVirtualSize from bit units to CharUnits.Ken Dyck
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124646 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-24Remove private toCharUnits() helper method, replacing with calls toKen Dyck
ASTContext::toCharUnitsFromBits(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124092 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-18Replace calls to CharUnits::fromQuantity() with onesKen Dyck
ASTContext::toCharUnitsFromBits() when converting from bit sizes to char units. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123715 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-12PR3558: mark "logically const" accessor methods in ASTContext as const,Jay Foad
and mark the fields they use as mutable. This allows us to remove a few const_casts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123314 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-29Fix PR8796.Rafael Espindola
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122633 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09Fix another unnecessary-struct-padding issue.Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121352 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09Before determining the effect the alignment of base struct will have in the ↵Argyrios Kyrtzidis
aligment of the sub-struct, take into account if the sub-struct is packed and its maximum field alignment. Fixes rdar://8745206 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121335 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-25Move isNearlyEmpty out into the ASTContext so it can be called from CodeGen ↵Anders Carlsson
as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120137 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24Rename RecordLayout::getPrimaryBaseWasVirtual to isPrimaryBaseVirtual.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120133 91177308-0d34-0410-b5e6-96231b3b80d8