Fix TBAA representation for zero-sized fields and unnamed bit-fields.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 22 Jun 2019 21:30:43 +0000 (21:30 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 22 Jun 2019 21:30:43 +0000 (21:30 +0000)
commit1fa07ebd929383f769994818c3f8c55919bf0a0e
tree1f68cf27e569af8a9ce77a0faaac3edfa641e60d
parent780c374b2056afb5665377690183cdd50bf97f09
Fix TBAA representation for zero-sized fields and unnamed bit-fields.

Unnamed bit-fields should not be represented in the TBAA metadata
because they do not represent storage fields (they only affect layout).

Zero-sized fields should not be represented in the TBAA metadata
because by definition they have no associated storage (so we will never
emit a load or store through them), and they might not appear in
declaration order within the struct layout.

Fixes a verifier failure when emitting a TBAA-enabled load through a
class type containing a zero-sized field.

llvm-svn: 364140
clang/lib/CodeGen/CodeGenTBAA.cpp
clang/test/CodeGen/tbaa-struct.cpp
clang/test/CodeGen/tbaa.cpp
clang/test/CodeGenCXX/no-unique-address.cpp