[clang] [llvm] [Clang] Emit DW_TAG_template_alias for template aliases (PR #87623)
Orlando Cazalet-Hyams via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 15 09:08:09 PDT 2024
OCHyams wrote:
Thanks @dwblaikie
> Bit unfortunate to store template parameters in different ways (in the extraData for the alias template, but in the templateParams for the composite types) - but I guess it'd be more invasive to try to represent alias templates as composite types?
I hadn't actually tried using DICompsiteType. I didn't choose DIDerivedType for any particularly principled reasons: typedefs use derived types which made it very easy to find places that needed updating, and an alias "felt" more like a derived type than composite type. Having looked only briefly, I don't _think_ it'd be any more invasive to use composite types instead (not 100% sure without diving in). I'm happy to give that a go if that is your preference?
---
I've just found an input that causes an assertion failure in `CollectTemplateParams` with my implementation:
```
template<typename Y, typename Z>
struct X {
Y m1;
Z m2;
};
template<typename... Ts>
using A = X<Ts...>;
A<int, int> a;
```
There's a mismatch between the template parameter list and template argument list sizes, created here:
```
if (CGM.getCodeGenOpts().DebugTemplateAlias) {
TemplateArgs Args = {TD->getTemplateParameters(), Ty->template_arguments()}; // <--- here
```
I notice that we emit `DW_TAG_GNU_template_parameter_pack` for, e.g., variadic template struct instantiations. I've not figured out how to fix this just yet, but thought I'd bring it up in case there's something obvious.
https://github.com/llvm/llvm-project/pull/87623
More information about the llvm-commits
mailing list