[llvm] [LLVM][DWARF] Add support for monolithic types in .debug_names (PR #70515)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 11:53:11 PST 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:

We might not be adding a name from the most recent one under construction (eg: one type unit leads to creating another type unit, but then the second type unit is completed, but the first isn't complete & so we add another name and might that accidentally get associated with the second type unit instead of the first?)

https://github.com/llvm/llvm-project/pull/70515


More information about the llvm-commits mailing list