diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 889303b4278ed7..c3b2a0dc407035 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -351,8 +351,6 @@ void DwarfCompileUnit::initStmtList() { if (CUNode->isDebugDirectivesOnly()) return; - // Define start line table label for each Compile Unit. - MCSymbol *LineTableStartSym; const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering(); if (DD->useSectionsAsReferences()) { LineTableStartSym = TLOF.getDwarfLineSection()->getBeginSymbol(); @@ -366,13 +364,14 @@ void DwarfCompileUnit::initStmtList() { // left in the skeleton CU and so not included. // The line table entries are not always emitted in assembly, so it // is not okay to use line_table_start here. - StmtListValue = addSectionLabel(getUnitDie(), dwarf::DW_AT_stmt_list, LineTableStartSym, TLOF.getDwarfLineSection()->getBeginSymbol()); } void DwarfCompileUnit::applyStmtList(DIE &D) { - D.addValue(DIEValueAllocator, *StmtListValue); + const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering(); + addSectionLabel(D, dwarf::DW_AT_stmt_list, LineTableStartSym, + TLOF.getDwarfLineSection()->getBeginSymbol()); } void DwarfCompileUnit::attachLowHighPC(DIE &D, const MCSymbol *Begin, diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h index 5d0afee4c3df00..4ccd8c96dd0df4 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h @@ -47,9 +47,9 @@ class DwarfCompileUnit final : public DwarfUnit { unsigned UniqueID; bool HasRangeLists = false; - /// The attribute index of DW_AT_stmt_list in the compile unit DIE, avoiding - /// the need to search for it in applyStmtList. - DIE::value_iterator StmtListValue; + /// The start of the unit line section, this is also + /// reused in appyStmtList. + MCSymbol *LineTableStartSym; /// Skeleton unit associated with this unit. DwarfCompileUnit *Skeleton = nullptr; @@ -123,6 +123,9 @@ class DwarfCompileUnit final : public DwarfUnit { /// Apply the DW_AT_stmt_list from this compile unit to the specified DIE. void applyStmtList(DIE &D); + /// Get line table start symbol for this unit. + MCSymbol *getLineTableStartSym() const { return LineTableStartSym; } + /// A pair of GlobalVariable and DIExpression. struct GlobalExpr { const GlobalVariable *Var;