Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DWARF debug information emitted for empty enum #433

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions llvm/tools/objwriter/debugInfo/dwarf/dwarfAbbrev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ void Dump(MCObjectStreamer *Streamer, uint16_t DwarfVersion, unsigned TargetPoin
dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1,
0, 0,

EnumerationTypeNoChildren,
dwarf::DW_TAG_enumeration_type, dwarf::DW_CHILDREN_no,
dwarf::DW_AT_name, dwarf::DW_FORM_strp,
dwarf::DW_AT_type, dwarf::DW_FORM_ref4,
dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1,
0, 0,

Enumerator1,
dwarf::DW_TAG_enumerator, dwarf::DW_CHILDREN_no,
dwarf::DW_AT_name, dwarf::DW_FORM_strp,
Expand Down
1 change: 1 addition & 0 deletions llvm/tools/objwriter/debugInfo/dwarf/dwarfAbbrev.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ enum DwarfAbbrev : uint16_t
CompileUnit = 0x1,
BaseType,
EnumerationType,
EnumerationTypeNoChildren,
Enumerator1,
Enumerator2,
Enumerator4,
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/objwriter/debugInfo/dwarf/dwarfTypeBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void DwarfEnumTypeInfo::DumpStrings(MCObjectStreamer *Streamer) {

void DwarfEnumTypeInfo::DumpTypeInfo(MCObjectStreamer *Streamer, UserDefinedDwarfTypesBuilder *TypeBuilder) {
// Abbrev Number
Streamer->emitULEB128IntValue(DwarfAbbrev::EnumerationType);
Streamer->emitULEB128IntValue(HasChildren() ? DwarfAbbrev::EnumerationType : DwarfAbbrev::EnumerationTypeNoChildren);

// DW_AT_name
EmitSectionOffset(Streamer, StrSymbol, 4);
Expand Down