krisb added inline comments.

================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:689
   auto ScopeDIE = DIE::get(DIEValueAllocator, dwarf::DW_TAG_lexical_block);
+  insertDIE(Scope->getScopeNode(), ScopeDIE);
   if (Scope->isAbstractScope())
----------------
In case of compiling optimized code with inlining enabled, the `Scope` may be 
either a scope of an inlined instance (which may appear multiple times), an 
abstract scope or a concrete out-of-line scope. All of them will match a single 
ScopeNode, so this will override the map's value multiple times and `getDIE()` 
will likely return something that one may not expect.
I've been working on patches that make possible for local types, imports and 
static variables to be scoped in a lexical block, see D125693 for 
backend-related changes. May be you could find something useful there (see 
`DwarfCompileUnit::getOrCreateLexicalBlockDIE()` and 
`DwarfCompileUnit::getOrCreateContextDIE()`) or could help to review the 
patches.


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

https://reviews.llvm.org/D124982

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to