[clang][CodeGen] Use base subobject type layout for potentially-overlapping fields
authorVladislav Dzhidzhoev <vdzhidzhoev@accesssoftek.com>
Fri, 13 Jan 2023 23:38:10 +0000 (02:38 +0300)
committerVladislav Dzhidzhoev <vdzhidzhoev@accesssoftek.com>
Fri, 17 Feb 2023 14:11:42 +0000 (15:11 +0100)
commitaf6c0b6d8c9dc52485d56e82f79a03de09aa188f
tree2971559ffabb8625d6e1d6f7df3885b703c4152f
parent4bf6cc63aa77a7fea7e410f7d45899abcde2b58a
[clang][CodeGen] Use base subobject type layout for potentially-overlapping fields

RecordLayoutBuilder assumes the size of a potentially-overlapping
class/struct 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]