diff --git a/clang-tools-extra/clangd/FindTarget.cpp b/clang-tools-extra/clangd/FindTarget.cpp --- a/clang-tools-extra/clangd/FindTarget.cpp +++ b/clang-tools-extra/clangd/FindTarget.cpp @@ -474,7 +474,8 @@ DeducedTemplateSpecializationTypeLoc L) { Ref = ReferenceLoc{ NestedNameSpecifierLoc(), L.getNameLoc(), - explicitReferenceTargets(DynTypedNode::create(L.getType()))}; + explicitReferenceTargets(DynTypedNode::create(L.getType()), + DeclRelation::Alias)}; } void VisitTagTypeLoc(TagTypeLoc L) { @@ -485,7 +486,8 @@ void VisitTemplateSpecializationTypeLoc(TemplateSpecializationTypeLoc L) { Ref = ReferenceLoc{ NestedNameSpecifierLoc(), L.getTemplateNameLoc(), - explicitReferenceTargets(DynTypedNode::create(L.getType()))}; + explicitReferenceTargets(DynTypedNode::create(L.getType()), + DeclRelation::Alias)}; } void VisitDependentTemplateSpecializationTypeLoc( diff --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp --- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp +++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp @@ -609,20 +609,18 @@ )cpp", "0: targets = {vector}\n" "1: targets = {vector}\n"}, - // FIXME: Fix 'allTargetDecls' to return alias template and re-enable. // Template type aliases. - // {R"cpp( - // template struct vector { using value_type = T; }; - // template <> struct vector { using value_type = bool; }; - // template using valias = vector; - // void foo() { - // $0^valias vi; - // $1^valias vb; - // } - // )cpp", - // "0: targets = {valias}\n" - // "1: targets = {valias}\n"}, - + {R"cpp( + template struct vector { using value_type = T; }; + template <> struct vector { using value_type = bool; }; + template using valias = vector; + void foo() { + $0^valias vi; + $1^valias vb; + } + )cpp", + "0: targets = {valias}\n" + "1: targets = {valias}\n"}, // MemberExpr should know their using declaration. {R"cpp( struct X { void func(int); }