[PATCH] D152095: DWARFVerifier: Verifies that definition subprograms cannot be nested within structures such as classes and structs

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 7 09:59:57 PDT 2023


dblaikie added a comment.

> Could you explain the issues related to subroutines?

So the issue is that member functions might be defined in multiple CUs (and that might be important that they be defined in the correct CU - if, eg, that member function definition calls into a file-static function that's emitted into the suitable CU, so name lookup should find the CU-specific context like that) - but we can't simultaneously respect those two requirements in an LTO build, without duplicating the type into multiple CUs. Whereas the out of line member function definition can be in one CU, with the type definition (containing a member function declaration) can be in another CU and a cross-CU reference can be used to reference the member function declaration from the member funciton definition.

We /could/ do this by emitting a type /declaration/ into the CU with the other member function definition in an LTO build, but that seems a bit ugly, then requiring debuggers to stitch together these various descriptions of the type.

Also, I'm not sure what this metadata would do to DWARF type units (the type description would no longer be canonical, and we'd end up trying to emit a definition into the type in the type unit, which wouldn't be right).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152095



More information about the llvm-commits mailing list