[PATCH] D94976: [DWARF] Create subprogram's DIE in the unit specified by its DISubprogram

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 21 11:27:19 PST 2021


dblaikie added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp:863
       if (auto *SP = dyn_cast<DISubprogram>(Element))
-        getOrCreateSubprogramDIE(SP);
+        getOrCreateContextDIE(SP);
       else if (auto *DDTy = dyn_cast<DIDerivedType>(Element)) {
----------------
jmorse wrote:
> Changed this to call getOrCreateContextDIE so that it'll switch on whether the SP is a definition or a declaration.
Hmm, this doesn't make sense to me - my expectation would be that definitions never appear in the elements list of a class/structure type DI metadata. (I'd expect a definition DISubprogram to be attached to an llvm::Function, and for that DISubprogram to refer to a declaration DISubprogram in the structure type's elements/member list)

Do you have an example where there are definitions in the elements list?

(at least, even if this is valid - it doesn't seem to be covered by the test?)


================
Comment at: llvm/test/DebugInfo/X86/subprogram-across-cus.ll:31
+;
+; See PR48790 for more discussion and original compile commands.
+;
----------------
Probably good to include the compile commands here (though handy to have the bug reference for extra context).


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

https://reviews.llvm.org/D94976



More information about the llvm-commits mailing list