[clang] [llvm] Add support for template as type parameter (PR #127654)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 21 12:10:36 PST 2025
dwblaikie wrote:
> For template classes with type parameters, the information of which member variables are of a "templated type" is lost. The debugger cannot differentiate between "templated" types and "hardcoded" types. This is because both types have the same debug information, so there is no way that gdb can distinguish between them. This patch adds support for templates as type by representing the template type as a derived type.
What features are you hoping to build on this debug info?
Mostly I worry it won't be terribly complete, because it can't work through situations, like this:
```
template<typename T>
struct trait {
using type = T;
};
template<typename T>
struct other {
trait<T>::type v1;
T v2;
};
```
In this case, v2 can be described as being of type "T" referencing the template_type_parameter, but v1 can't be - because it references trait<int>::type, for instance.
Also, I'd worry that most debuggers/DWARF consumers aren't ready to handle type references to template_type_parameters? So best to test this with at least LLDB and GDB before we commit it.
https://github.com/llvm/llvm-project/pull/127654
More information about the llvm-commits
mailing list