-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
clang:codegenIR generation bugs: mangling, exceptions, etc.IR generation bugs: mangling, exceptions, etc.debuginfo
Description
GCC and LLVM diverge in this. GCC chooses to omit DW_AT_data_member_location
for union members because it's going to be 0x0
anyway. LLVM still adds the attribute: Godbolt
Here's the LLVM DWARF:
0x00000034: DW_TAG_member
DW_AT_name ("x")
DW_AT_type (0x00000047 "int")
DW_AT_decl_file ("/app/example.cpp")
DW_AT_decl_line (2)
DW_AT_data_member_location (0x00)
0x0000003d: DW_TAG_member
DW_AT_name ("y")
DW_AT_type (0x00000047 "int")
DW_AT_decl_file ("/app/example.cpp")
DW_AT_decl_line (3)
DW_AT_data_member_location (0x00)
This came up in #159401. LLDB already knows how to handle both cases, so LLVM could choose to omit it. Not sure if the size benefits would be particularly appealing, to warrant the extra complexity. Though if it's just a case of "don't emit DW_AT_data_member_location for union types", that's rather trivial to implement.
Metadata
Metadata
Assignees
Labels
clang:codegenIR generation bugs: mangling, exceptions, etc.IR generation bugs: mangling, exceptions, etc.debuginfo