diff options
| author | Michael Buch <michaelbuch12@gmail.com> | 2025-11-20 17:49:53 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-20 17:49:53 +0000 |
| commit | e96cc996875f58306aa7f28f2e47b51cadc180b7 (patch) | |
| tree | 693fe9f4df63b48e0289b89fc5510a377f531747 /cross-project-tests | |
| parent | ccdb71932aa84a36f3d9689eca97b80bf643c500 (diff) | |
[llvm][DebugInfo] Unwrap template parameters that are typedefs when reconstructing DIE names (#168734)
Depends on:
* https://github.com/llvm/llvm-project/pull/168725
When compiling with `-glldb`, we repoint the `DW_AT_type` of a DIE to be
a typedef that refers to the `preferred_name`. I.e.,:
```
template <typename T> structure t7;
using t7i = t7<int>;
template <typename T> struct __attribute__((__preferred_name__(t7i))) t7 {};
template <typename... Ts> void f1()
int main() { f1<t7i>(); }
```
would produce following (minified) DWARF:
```
DW_TAG_subprogram
DW_AT_name ("_STN|f1|<t7<int> >")
DW_TAG_template_type_parameter
DW_AT_type (0x0000299c "t7i")
...
DW_TAG_typedef
DW_AT_type (0x000029a7 "t7<int>")
DW_AT_name ("t7i")
```
Note how the `DW_AT_type` of the template parameter is a typedef itself
(instead of the canonical type). The `DWARFTypePrinter` would take the
`DW_AT_name` of this typedef when reconstructing the name of `f1`, so we
would end up with a verifier failure:
```
error: Simplified template DW_AT_name could not be reconstituted:
original: f1<t7<int> >
reconstituted: f1<t7i>
```
Fixing this allows us to un-XFAIL the `simplified-template-names.cpp`
test in `cross-project-tests`. Unfortunately this is only tested on
Darwin, where LLDB tuning is the default. AFAIK, there is no other case
where the template parameter type wouldn't be canonical.
Diffstat (limited to 'cross-project-tests')
| -rw-r--r-- | cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.test | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.test b/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.test index 0adb2403db30..5a0da903e2a8 100644 --- a/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.test +++ b/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.test @@ -1,4 +1,3 @@ -// XFAIL: system-darwin // RUN: %clang %target_itanium_abi_host_triple %p/Inputs/simplified_template_names.cpp -c -o - -gdwarf-4 -Xclang -gsimple-template-names=mangled -Xclang -debug-forward-template-params -std=c++20 -gtemplate-alias \ // RUN: | llvm-dwarfdump --verify - // |
