Michael137 added a comment.

We thought a bit about what it would take to link a constructor declaration DIE 
to the various definitions (e.g., via a `DW_AT_LLVM_complete_ctor_linkage_name` 
or `DW_AT_LLVM_complete_ctor_ref`). The issue with this is that it would mess 
with type uniquing. E.g., what if two different CUs each had a constructor 
declaration but differed only in which definitions they linked to? LLDB would 
have to support the case where two constructor DIEs for the same type point to 
different definitions depending on how they were used in the corresponding 
object files.

One could instead have some new attribute on the various constructor 
definitions specifying which constructor type it is, and then implement 
@pavel's suggestion of attaching multiple `asm` labels to the 
`CXXConstructorDecl`. To support that in LLDB we'd have to do a lookup in the 
DWARF index and filter appropriately. But it's unclear to me whether this is 
much better than the proposed patch (in terms of simplicity). I pinged the 
libcxx people regarding their policy of using abi-tags on structures/namespaces

Some more findings on the Clang side: a very naive way to support multiple 
`asm` labels is to adjust the `ManglingContext::mangleName` to be aware of 
multiple `asm` labels and pick the correct one based on the `GlobalDecl` we're 
mangling. But we'd need to somehow match `CtorType` to the `AsmLabelAttr` in 
question. Which is possibly doable by encoding the `CtorType` into the label. 
E.g., `asm("C2<mangled_name>")` (?) Though that seems tacky


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144181

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

Reply via email to