[lldb][DWARFASTParserClang] Attach linkage name to ctors/dtors if missing
authorMichael Buch <michaelbuch12@gmail.com>
Tue, 7 Feb 2023 13:53:30 +0000 (13:53 +0000)
committerMichael Buch <michaelbuch12@gmail.com>
Fri, 10 Feb 2023 17:22:02 +0000 (17:22 +0000)
commitb296ddd91cb8e7676b3c38ca7f6d7bdbd84eb4af
tree224de198570d87b060cf5eba5e5883e3d68e70c7
parentb8ef007fca1d959947d65853f56e407560d7699d
[lldb][DWARFASTParserClang] Attach linkage name to ctors/dtors if missing

**Summary**

This patch addresses the case where we have a `DW_AT_external`
subprogram for a constructor (and/or destructor) that doesn't carry
a `DW_AT_linkage_name` attribute. The corresponding DIE(s) that
represent the definition will have a linkage name, but if the name
contains constructs that LLDBs fallback mechanism for guessing mangled
names to resolve external symbols doesn't support (e.g., abi-tags)
then we end up failing to resolve the function call.

We address this by trying to find the linkage name before we create
the constructor/destructor decl, which will get attached using
an `AsmLabelAttr` to make symbol resolution easier.

**Testing**

* Added API test

Differential Revision: https://reviews.llvm.org/D143652
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/test/API/lang/cpp/external_ctor_dtor_lookup/Makefile [new file with mode: 0644]
lldb/test/API/lang/cpp/external_ctor_dtor_lookup/TestExternalCtorDtorLookup.py [new file with mode: 0644]
lldb/test/API/lang/cpp/external_ctor_dtor_lookup/lib.h [new file with mode: 0644]
lldb/test/API/lang/cpp/external_ctor_dtor_lookup/main.cpp [new file with mode: 0644]