Open
Description
Split from #72913.
Consider the following case:
struct alignas(8) Base {} a;
struct Derived : Base {} b;
Debug info emitted by clang ./bin/clang -cc1 -emit-llvm -debug-info-kind=limited /tmp/t.cpp -o -
!8 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Derived", file: !7, line: 4, size: 64, flags: DIFlagTypePassByValue, elements: !9, identifier: "_ZTS7Derived")
!9 = !{!10}
!10 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !8, baseType: !11, extraData: i32 0)
!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Base", file: !7, line: 2, size: 64, align: 64, flags: DIFlagTypePassByValue, elements: !12, identifier: "_ZTS4Base")
The DICompositeType
for Derived
is missing the align
attribute, it is a critical information for lldb to get correct layout for the structure.
This is a regression caused by https://reviews.llvm.org/D24426.
Comments from @Michael137:
FWIW, GCC does do this "alignment propagation" and attaches DW_AT_alignment to the derived class too: https://godbolt.org/z/j5MWdWYaf