[PATCH] D143985: [DwarfDebug] Move emission of imported entities from beginModule() to endModule() (2/7)

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 10 10:54:00 PST 2023


dblaikie added a comment.

Hmm - have you checked/could you check if debuggers (gdb and lldb at least) care about where a namespace-scoped imported entity appears in the DWARF? It looks like this patch would move namespace-scoped imported entities to the end of the DWARF, and I could imagine an implementation trying to do name lookup might try to consider only the imported entities that appear lexically before in the DWARF? (admittedly we haven't put enough information in the IR to get these things in the /correct/ place, but maybe before is more likely to be correct than after) - though of course the same bug might exist in function-local imported entities (& other function local names) - and similarly we don't have enough info or ways to insert things in the right order anyway...



================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1434-1439
+  for (DICompileUnit *CUNode : MMI->getModule()->debug_compile_units()) {
+    DwarfCompileUnit *CU = CUMap.lookup(CUNode);
+    // Skip empty DICompileUnits.
+    if (!CU)
+      continue;
+
----------------
Could we iterate the CUMap directly - to avoid needing to do lookups? like teh old code - *p.first would be the DICompileUnit* CUNode?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143985/new/

https://reviews.llvm.org/D143985



More information about the llvm-commits mailing list