[llvm] [LLVM][DWARF] Add support for monolithic types in .debug_names (PR #70515)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 1 17:06:28 PDT 2023
================
@@ -3552,8 +3565,16 @@ void DwarfDebug::addAccelNameImpl(const DICompileUnit &CU,
AppleAccel.addName(Ref, Die);
break;
case AccelTableKind::Dwarf: {
- DwarfCompileUnit *DCU = CUMap.lookup(&CU);
- AccelDebugNames.addName(Ref, Die, *DCU);
+ DWARF5AccelTable &Current = getCurrentDWARF5AccelTable();
+ // The type unit can be discarded, so need to add references to final
+ // acceleration table once we know it's complete and we emit it.
+ if (getCurrentAccelTableKind() == DWARF5AccelTableKind::CU) {
+ DwarfCompileUnit *Unit = CUMap.lookup(&CU);
+ Current.addName(Ref, Die, *Unit);
+ } else {
+ DwarfTypeUnit *Unit = TypeUnitsUnderConstruction.back().first.get();
+ Current.addName(Ref, Die, *Unit);
+ }
----------------
dwblaikie wrote:
Could the unit or its index be passed in from the caller? Rather than special casing this in here? (especially the `TypeUnitsUnderConstruction.back().first.get()` seems pretty subtle - we might not be emitting the most recent type unit under construction, right?)
https://github.com/llvm/llvm-project/pull/70515
More information about the llvm-commits
mailing list