zyn0217 wrote:

> If so, get its TemplateTypeParmDecl, find the template whose parameter it is, 
> and see if the template has a getOnlyInstantiation.

Thanks for the suggestion! Admittedly, it looks neat and terse. However, I 
suspect it won't work with the present `TemplateTypeParm{Type,Decl}` models. 
`TemplateTypeParmDecl` per se is not tied to any `CXXRecordDecl` nor 
`FunctionDecl` that  the template parameter is declaring with. (For the most 
seemingly-relevant part, i.e. the `DeclContext` it records, is the scope that 
the template defines.)

> If so, find the argument type substituted for this template parameter, and 
> replace the template parameter with this type.

I was thinking this way before getting into the details :-). Soon I realized 
that we had to tackle synthesized types e.g.
```cpp
template <template <class, int> typename C, typename D, int E>
void work() {
  C<D, E> complicated_type;
  // ^ Shall we perform the type substitution once again? ;)
}
```




https://github.com/llvm/llvm-project/pull/71279
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to