Index: clang-tools-extra/trunk/clangd/FindTarget.cpp =================================================================== --- clang-tools-extra/trunk/clangd/FindTarget.cpp +++ clang-tools-extra/trunk/clangd/FindTarget.cpp @@ -489,6 +489,11 @@ ReferenceLoc{NestedNameSpecifierLoc(), L.getNameLoc(), {L.getDecl()}}; } + void VisitTemplateTypeParmTypeLoc(TemplateTypeParmTypeLoc L) { + Ref = + ReferenceLoc{NestedNameSpecifierLoc(), L.getNameLoc(), {L.getDecl()}}; + } + void VisitTemplateSpecializationTypeLoc(TemplateSpecializationTypeLoc L) { Ref = ReferenceLoc{ NestedNameSpecifierLoc(), L.getTemplateNameLoc(), Index: clang-tools-extra/trunk/clangd/unittests/FindTargetTests.cpp =================================================================== --- clang-tools-extra/trunk/clangd/unittests/FindTargetTests.cpp +++ clang-tools-extra/trunk/clangd/unittests/FindTargetTests.cpp @@ -706,6 +706,26 @@ "0: targets = {x}\n" "1: targets = {X::func, X::func}\n" "2: targets = {t}\n"}, + // Type template parameters. + {R"cpp( + template + void foo() { + static_cast<$0^T>(0); + $1^T(); + $2^T t; + } + )cpp", + "0: targets = {T}\n" + "1: targets = {T}\n" + "2: targets = {T}\n"}, + // Non-type template parameters. + {R"cpp( + template + void foo() { + int x = $0^I; + } + )cpp", + "0: targets = {I}\n"}, }; for (const auto &C : Cases) {