[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


================
@@ -230,9 +230,18 @@ void DwarfEmitterImpl::emitDebugNames(DWARF5AccelTable &Table,
     return;
 
   Asm->OutStreamer->switchSection(MOFI->getDwarfDebugNamesSection());
+  dwarf::Form Form =
+      DIEInteger::BestForm(/*IsSigned*/ false, (uint64_t)CUidToIdx.size() - 1);
+  /// DWARFLinker doesn't support type units + .debug_names right now anyway,
+  /// so just keeping current behavior.
   emitDWARF5AccelTable(Asm.get(), Table, CUOffsets,
-                       [&CUidToIdx](const DWARF5AccelTableData &Entry) {
-                         return CUidToIdx[Entry.getUnitID()];
+                       [&](const DWARF5AccelTableData &Entry)
+                           -> DWARF5AccelTableEntryReturnType {
+                         DWARF5AccelTableEntryReturnType Index = std::nullopt;
+                         if (CUidToIdx.size() > 1)
+                           Index = {CUidToIdx[Entry.getUnitID()],
+                                    {dwarf::DW_IDX_compile_unit, Form}};
+                         return Index;
----------------
dwblaikie wrote:

could remove the temp Index?
```
if (CUidToIdx.size() <= 1)
  return std::nullopt;
return {{CUidToIdx[Entry.getUnitId()], {dwarf::DW_IDX_compile_unit, Form}};
```

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


More information about the llvm-commits mailing list