[clang][CodeGen] Use base subobject type layout for potentially-overlapping fields
authorVladislav Dzhidzhoev <vdzhidzhoev@accesssoftek.com>
Fri, 9 Dec 2022 18:36:16 +0000 (21:36 +0300)
committerVladislav Dzhidzhoev <vdzhidzhoev@accesssoftek.com>
Thu, 15 Dec 2022 12:10:41 +0000 (15:10 +0300)
commit731abdfdcc33d813e6c3b4b89eff307aa5c18083
tree8f6fd5fefb9f86125a86db2ce38fb2e45bba76b6
parent4d852374b1d69c95363c0d3f540616f6d2481d47
[clang][CodeGen] Use base subobject type layout for potentially-overlapping fields

RecordLayoutBuilder assumes the size of a potentially-overlapping field
with non-zero size as the size of the base subobject type corresponding
to the field type.
Make CGRecordLayoutBuilder to acknowledge that in order to avoid incorrect
padding insertion.

Differential Revision: https://reviews.llvm.org/D139741
clang/include/clang/AST/Decl.h
clang/lib/AST/Decl.cpp
clang/lib/AST/RecordLayoutBuilder.cpp
clang/lib/CodeGen/CGRecordLayoutBuilder.cpp
clang/test/CodeGenCXX/no-unique-address-3.cpp [new file with mode: 0644]