[PATCH] D147620: [DebugInfo] Keep the CU consistent for operating `DISubprogram`.
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 1 17:26:49 PDT 2023
dblaikie added a comment.
> This has nothing to do with members, just a declaration to switch the parent DIE from scope to unit. I don't think this makes sense.
Could you explain in more detail why you don't think this makes sense?
> If I understand correctly, this is because the ODR merges the DICompositeType. In this case, it is possible that scope and unit refer to different CUs.
Roughly, yes. DICompositeTypes shouldn't have a scope that refers to a unit - they should be unit-agnostic. But DISubprograms do exist concretely in specific units (though, still, I don't think their `scope` field indicates that/should lead to any unit - it should just be a series of namespaces that leads to null) - so, since one DICompositeType can have two DISubprograms defined in different units - those DISubprograms can't be directly scoped inside the DICompositeType - they need to be indirected through declarations.
That's the fix at the source here - producers should produce declarations for these member functions and then it'll work.
I don't think we should workaround this issue in LLVM - producers should be fixed instead. At some point/if anything, LLVM's DebugInfo verifier should reject DWARF that looks like this (with defining DISubprograms scoped directly underneath DICompositeTypes).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147620/new/
https://reviews.llvm.org/D147620
More information about the llvm-commits
mailing list