diff --git a/llvm/include/llvm/MC/MCDwarf.h b/llvm/include/llvm/MC/MCDwarf.h --- a/llvm/include/llvm/MC/MCDwarf.h +++ b/llvm/include/llvm/MC/MCDwarf.h @@ -43,8 +43,7 @@ namespace mcdwarf { // Emit the common part of the DWARF 5 range/locations list tables header. -void emitListsTableHeaderStart(MCStreamer *S, MCSymbol *TableStart, - MCSymbol *TableEnd); +MCSymbol *emitListsTableHeaderStart(MCStreamer &S); } // namespace mcdwarf /// Instances of this class represent the name of the dwarf .file directive and diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2405,10 +2405,7 @@ // complete. static MCSymbol *emitRnglistsTableHeader(AsmPrinter *Asm, const DwarfFile &Holder) { - MCSymbol *TableStart = Asm->createTempSymbol("debug_rnglist_table_start"); - MCSymbol *TableEnd = Asm->createTempSymbol("debug_rnglist_table_end"); - mcdwarf::emitListsTableHeaderStart(Asm->OutStreamer.get(), TableStart, - TableEnd); + MCSymbol *TableEnd = mcdwarf::emitListsTableHeaderStart(*Asm->OutStreamer); Asm->OutStreamer->AddComment("Offset entry count"); Asm->emitInt32(Holder.getRangeLists().size()); @@ -2425,10 +2422,7 @@ // complete. static MCSymbol *emitLoclistsTableHeader(AsmPrinter *Asm, const DwarfDebug &DD) { - MCSymbol *TableStart = Asm->createTempSymbol("debug_loclist_table_start"); - MCSymbol *TableEnd = Asm->createTempSymbol("debug_loclist_table_end"); - mcdwarf::emitListsTableHeaderStart(Asm->OutStreamer.get(), TableStart, - TableEnd); + MCSymbol *TableEnd = mcdwarf::emitListsTableHeaderStart(*Asm->OutStreamer); const auto &DebugLocs = DD.getDebugLocs(); diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/lib/MC/MCDwarf.cpp @@ -45,17 +45,21 @@ using namespace llvm; -void mcdwarf::emitListsTableHeaderStart(MCStreamer *S, MCSymbol *TableStart, - MCSymbol *TableEnd) { - S->AddComment("Length"); - S->emitAbsoluteSymbolDiff(TableEnd, TableStart, 4); - S->emitLabel(TableStart); - S->AddComment("Version"); - S->emitInt16(S->getContext().getDwarfVersion()); - S->AddComment("Address size"); - S->emitInt8(S->getContext().getAsmInfo()->getCodePointerSize()); - S->AddComment("Segment selector size"); - S->emitInt8(0); +MCSymbol *mcdwarf::emitListsTableHeaderStart(MCStreamer &S) { + MCSymbol *Start = + S.getContext().createTempSymbol("debug_list_header_start", true, true); + MCSymbol *End = + S.getContext().createTempSymbol("debug_list_header_end", true, true); + S.AddComment("Length"); + S.emitAbsoluteSymbolDiff(End, Start, 4); + S.emitLabel(Start); + S.AddComment("Version"); + S.emitInt16(S.getContext().getDwarfVersion()); + S.AddComment("Address size"); + S.emitInt8(S.getContext().getAsmInfo()->getCodePointerSize()); + S.AddComment("Segment selector size"); + S.emitInt8(0); + return End; } /// Manage the .debug_line_str section contents, if we use it. @@ -1117,11 +1121,7 @@ if (MCOS->getContext().getDwarfVersion() >= 5) { MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfRnglistsSection()); - MCSymbol *StartSymbol = - context.createTempSymbol("debug_rnglists_start", true, true); - MCSymbol *EndSymbol = - context.createTempSymbol("debug_rnglists_end", true, true); - mcdwarf::emitListsTableHeaderStart(MCOS, StartSymbol, EndSymbol); + MCSymbol *EndSymbol = mcdwarf::emitListsTableHeaderStart(*MCOS); MCOS->AddComment("Offset entry count"); MCOS->emitInt32(0); RangesSymbol = context.createTempSymbol("debug_rnglist0_start", true, true);