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

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 22 06:09:43 PST 2021


jmorse marked 4 inline comments as done.
jmorse 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)) {
----------------
dblaikie wrote:
> 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?)
No example, I added this to be conservative, I was confident all the other call sites would be safe against definition/declaration differences except this. Now removed!


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

https://reviews.llvm.org/D94976



More information about the llvm-commits mailing list