diff options
author | Michael Buch <michaelbuch12@gmail.com> | 2025-09-09 09:50:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-09 09:50:11 +0100 |
commit | 06d202b6cb13b38165af03dbf12a3beaac0b38ea (patch) | |
tree | c92d62f544fabd76dffb93ea91cf3bed60d3c220 /clang/lib/CodeGen/CGClass.cpp | |
parent | 9b1b93766dfa34ee94859d91a5fcfef853b95265 (diff) | |
download | llvm-06d202b6cb13b38165af03dbf12a3beaac0b38ea.zip llvm-06d202b6cb13b38165af03dbf12a3beaac0b38ea.tar.gz llvm-06d202b6cb13b38165af03dbf12a3beaac0b38ea.tar.bz2 |
[clang][DebugInfo] Emit unified (Itanium) mangled name to structor declarations (#154142)
Depends on https://github.com/llvm/llvm-project/pull/154137
This patch is motivated by
https://github.com/llvm/llvm-project/pull/149827, where we plan on using
mangled names on structor declarations to find the exact structor
definition that LLDB's expression evaluator should call.
Given a `DW_TAG_subprogram` for a function declaration, the most
convenient way for a debugger to find the corresponding definition is to
use the `DW_AT_linkage_name` (i.e., the mangled name). However, we
currently can't do that for constructors/destructors because Clang
doesn't attach linkage names to them. This is because, depending on ABI,
there can be multiple definitions for a single constructor/destructor
declaration. The way GCC works around this is by producing a `C4`/`D4`
"unified" mangling for structor declarations (see
[godbolt](https://godbolt.org/z/Wds6cja9K)). GDB uses this to locate the
relevant definitions.
This patch aligns Clang with GCC's DWARF output and allows us to
implement the same lookup scheme in LLDB.
Diffstat (limited to 'clang/lib/CodeGen/CGClass.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGClass.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index bae55aa..6742c19 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -1481,6 +1481,8 @@ void CodeGenFunction::EmitDestructorBody(FunctionArgList &Args) { // we'd introduce *two* handler blocks. In the Microsoft ABI, we // always delegate because we might not have a definition in this TU. switch (DtorType) { + case Dtor_Unified: + llvm_unreachable("not expecting a unified dtor"); case Dtor_Comdat: llvm_unreachable("not expecting a COMDAT"); case Dtor_Deleting: llvm_unreachable("already handled deleting case"); |