[clang] [llvm] Add support for template as type parameter (PR #127654)
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 7 15:35:59 PST 2025
dwblaikie wrote:
> > 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::type, for instance.
>
> I believe, in this case, the debug information of "v2" can still be improved and align with DWARF v5
Right - like I said, I get that "v2" gets better, but "v1" doesn't, right? And I imagine many/(most?) uses of type parameters in templates are more complicated - so I'm not sure how much this helps, and will feel awkwardly inconsistent for DWARF consumers/users?
> > 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.
>
> While I acknowledge that current debuggers may not fully support this DWARF representation, I suggest that this implementation be controlled by a switch until downstream tools are updated to accommodate these changes.
Yeah - not sure it rises to the level of needing a flag (flags are a bit of an unfortunate maintenance burden - means more DWARF variety, harder to know everyone's doing the same thing, etc... ) - but some testing ahead of time would be good.
https://github.com/llvm/llvm-project/pull/127654
More information about the cfe-commits
mailing list