]> granicus.if.org Git - clang/commit
CodeGen: ConstStructBuilder must verify packed constraints after padding
authorDavid Majnemer <david.majnemer@gmail.com>
Sun, 19 Oct 2014 23:40:06 +0000 (23:40 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Sun, 19 Oct 2014 23:40:06 +0000 (23:40 +0000)
commit05db1e2826e6125353689fc8729d73b608e62eea
tree56568140e002c2393e03dd832ea2fc87bd910111
parentfc2ae6a98b8815fb86285c6173e72f39b431b886
CodeGen: ConstStructBuilder must verify packed constraints after padding

This reverts commit r220169 which reverted r220153.  However, it also
contains additional changes:
- We may need to add padding *after* we've packed the struct.  This
  occurs when the aligned next field offset is greater than the new
  field's offset.  When this occurs, we make the struct packed.
  *However*, once packed the next field offset might be less than the
  new feild's offset.  It is in this case that we might further pad the
  struct.
- We would pad structs which were perfectly sized!  This behavior is
  immensely old.  This behavior came from blindly subtracting
  NextFieldOffsetInChars from RecordSize.  This doesn't take into
  account the fact that the struct might have a greater overall
  alignment than the last field.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220175 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGExprConstant.cpp
test/CodeGen/2008-07-22-bitfield-init-after-zero-len-array.c
test/CodeGen/const-init.c
test/CodeGenCXX/atomicinit.cpp
test/CodeGenCXX/debug-info-template.cpp
test/Modules/templates.mm