[clang-tools-extra] [clangd] Handle template template parameters in TargetFinder::VisitDeducedTemplateSpecializationType (PR #228601)
Aleksandr Platonov via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 3 02:05:49 PDT 2026
================
@@ -397,14 +397,21 @@ struct TargetFinder {
if (const auto *USD = DTST->getTemplateName().getAsUsingShadowDecl())
Outer.add(USD, Flags);
- // FIXME: This is a workaround for https://llvm.org/PR42914,
- // which is causing DTST->getDeducedType() to be empty. We
- // fall back to the template pattern and miss the instantiation
- // even when it's known in principle. Once that bug is fixed,
- // the following code can be removed (the existing handling in
- // VisitDeducedType() is sufficient).
- if (auto *TD = DTST->getTemplateName().getAsTemplateDecl())
+ TemplateDecl *TD = DTST->getTemplateName().getAsTemplateDecl();
+ // Template template parameters have no templated decl, so they must
+ // refer to the parameter itself.
+ if (const auto *Parm =
+ llvm::dyn_cast_or_null<TemplateTemplateParmDecl>(TD)) {
----------------
ArcsinX wrote:
Maybe we can use `DTST->getTemplateName().getAsTemplateTemplateParmDecl()` here? `TD` is `nullptr` in case of c++26 pack indexing. E.g.
```cpp
template <template <typename> class... X>
void foo() {
[[X...[0]]] a(1);
}
```
https://github.com/llvm/llvm-project/pull/228601
More information about the cfe-commits
mailing list