diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -421,7 +421,6 @@ // Identify a debugger for "tuning" the debug info. DebuggerKind DebuggerTuning = DebuggerKind::Default; - MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &); const SmallVectorImpl> &getUnits() { return InfoHolder.getUnits(); @@ -642,6 +641,8 @@ void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier, DIE &Die, const DICompositeType *CTy); + MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &); + class NonTypeUnitContext { DwarfDebug *DD; decltype(DwarfDebug::TypeUnitsUnderConstruction) TypeUnitsUnderConstruction; 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 @@ -3233,8 +3233,7 @@ bool TopLevelType = TypeUnitsUnderConstruction.empty(); AddrPool.resetUsedFlag(); - auto OwnedUnit = std::make_unique(CU, Asm, this, &InfoHolder, - getDwoLineTable(CU)); + auto OwnedUnit = std::make_unique(CU, Asm, this, &InfoHolder); DwarfTypeUnit &NewTU = *OwnedUnit; DIE &UnitDie = NewTU.getUnitDie(); TypeUnitsUnderConstruction.emplace_back(std::move(OwnedUnit), CTy); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h @@ -343,7 +343,6 @@ uint64_t TypeSignature; const DIE *Ty; DwarfCompileUnit &CU; - MCDwarfDwoLineTable *SplitLineTable; bool UsedLineTable = false; unsigned getOrCreateSourceID(const DIFile *File) override; @@ -352,7 +351,7 @@ public: DwarfTypeUnit(DwarfCompileUnit &CU, AsmPrinter *A, DwarfDebug *DW, - DwarfFile *DWU, MCDwarfDwoLineTable *SplitLineTable = nullptr); + DwarfFile *DWU); void setTypeSignature(uint64_t Signature) { TypeSignature = Signature; } void setType(const DIE *Ty) { this->Ty = Ty; } diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -95,11 +95,8 @@ } DwarfTypeUnit::DwarfTypeUnit(DwarfCompileUnit &CU, AsmPrinter *A, - DwarfDebug *DW, DwarfFile *DWU, - MCDwarfDwoLineTable *SplitLineTable) - : DwarfUnit(dwarf::DW_TAG_type_unit, CU.getCUNode(), A, DW, DWU), CU(CU), - SplitLineTable(SplitLineTable) { -} + DwarfDebug *DW, DwarfFile *DWU) + : DwarfUnit(dwarf::DW_TAG_type_unit, CU.getCUNode(), A, DW, DWU), CU(CU) {} DwarfUnit::~DwarfUnit() { for (unsigned j = 0, M = DIEBlocks.size(); j < M; ++j) @@ -325,6 +322,7 @@ } unsigned DwarfTypeUnit::getOrCreateSourceID(const DIFile *File) { + MCDwarfDwoLineTable *SplitLineTable = DD->getDwoLineTable(getCU()); if (!SplitLineTable) return getCU().getOrCreateSourceID(File); if (!UsedLineTable) {