Skip to content

Commit

Permalink
Fix llvm-dwarfdump warnings (#164)
Browse files Browse the repository at this point in the history
Fixes https://github.com/dotnet/runtimelab/issues/1535. No warnings left with llvm-dwarfdump from LLVM 12.
  • Loading branch information
MichalStrehovsky authored Jan 24, 2022
1 parent fe77708 commit afc9070
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
11 changes: 11 additions & 0 deletions llvm/tools/objwriter/debugInfo/dwarf/dwarfAbbrev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,17 @@ void Dump(MCObjectStreamer *Streamer, uint16_t DwarfVersion, unsigned TargetPoin
dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present,
0, 0,

SubprogramStaticNoChildrenSpec,
dwarf::DW_TAG_subprogram, dwarf::DW_CHILDREN_no,
dwarf::DW_AT_name, dwarf::DW_FORM_strp,
dwarf::DW_AT_linkage_name, dwarf::DW_FORM_strp,
dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1,
dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1,
dwarf::DW_AT_type, dwarf::DW_FORM_ref4,
dwarf::DW_AT_external, dwarf::DW_FORM_flag_present,
dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present,
0, 0,

Variable,
dwarf::DW_TAG_variable, 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 @@ -30,6 +30,7 @@ enum DwarfAbbrev : uint16_t
SubprogramStatic,
SubprogramSpec,
SubprogramStaticSpec,
SubprogramStaticNoChildrenSpec,
Variable,
VariableLoc,
VariableStatic,
Expand Down
6 changes: 5 additions & 1 deletion llvm/tools/objwriter/debugInfo/dwarf/dwarfTypeBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,12 @@ void DwarfMemberFunctionIdTypeInfo::DumpStrings(MCObjectStreamer *Streamer) {
void DwarfMemberFunctionIdTypeInfo::DumpTypeInfo(MCObjectStreamer *Streamer, UserDefinedDwarfTypesBuilder *TypeBuilder) {
// Abbrev Number
bool IsStatic = MemberFunctionTypeInfo->IsStatic();
bool HasParameters = MemberFunctionTypeInfo->GetArgTypes().size();

Streamer->emitULEB128IntValue(IsStatic ? DwarfAbbrev::SubprogramStaticSpec : DwarfAbbrev::SubprogramSpec);
Streamer->emitULEB128IntValue(
IsStatic ? (HasParameters ? DwarfAbbrev::SubprogramStaticSpec
: DwarfAbbrev::SubprogramStaticNoChildrenSpec)
: DwarfAbbrev::SubprogramSpec);

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

0 comments on commit afc9070

Please sign in to comment.