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

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 30 13:58:00 PDT 2023


================
@@ -306,10 +306,20 @@ void DwarfStreamer::emitDebugNames(DWARF5AccelTable &Table) {
   }
 
   Asm->OutStreamer->switchSection(MOFI->getDwarfDebugNamesSection());
-  emitDWARF5AccelTable(Asm.get(), Table, CompUnits,
-                       [&UniqueIdToCuMap](const DWARF5AccelTableData &Entry) {
-                         return UniqueIdToCuMap[Entry.getUnitID()];
-                       });
+  dwarf::Form Form = DIEInteger::BestForm(/*IsSigned*/ false,
+                                          (uint64_t)UniqueIdToCuMap.size() - 1);
+  /// llvm-dwarfutil doesn't support type units + .debug_names right now anyway,
+  /// so just keeping current behavior.
+  emitDWARF5AccelTable(
+      Asm.get(), Table, CompUnits,
+      [&UniqueIdToCuMap,
+       &Form](const DWARF5AccelTableData &Entry) -> GetIndexForEntryReturnType {
----------------
dwblaikie wrote:

usually for a lambda thta doesn't excape its enclosing scope, we use `[&]` - no need to enumerate the specific captures

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


More information about the llvm-commits mailing list