[all-commits] [llvm/llvm-project] e96cc9: [llvm][DebugInfo] Unwrap template parameters that ...

Michael Buch via All-commits all-commits at lists.llvm.org
Thu Nov 20 09:50:15 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e96cc996875f58306aa7f28f2e47b51cadc180b7
      https://github.com/llvm/llvm-project/commit/e96cc996875f58306aa7f28f2e47b51cadc180b7
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2025-11-20 (Thu, 20 Nov 2025)

  Changed paths:
    M cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.test
    M llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h

  Log Message:
  -----------
  [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.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list