[PATCH] D68124: [clangd] Fix template type aliases in findExplicitReference
Ilya Biryukov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 27 02:11:35 PDT 2019
ilya-biryukov created this revision.
ilya-biryukov added a reviewer: kadircet.
Herald added subscribers: usaxena95, arphaman, jkorous, MaskRay.
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D68124
Files:
clang-tools-extra/clangd/FindTarget.cpp
clang-tools-extra/clangd/unittests/FindTargetTests.cpp
Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -609,20 +609,18 @@
)cpp",
"0: targets = {vector<int>}\n"
"1: targets = {vector<bool>}\n"},
- // FIXME: Fix 'allTargetDecls' to return alias template and re-enable.
// Template type aliases.
- // {R"cpp(
- // template <class T> struct vector { using value_type = T; };
- // template <> struct vector<bool> { using value_type = bool; };
- // template <class T> using valias = vector<T>;
- // void foo() {
- // $0^valias<int> vi;
- // $1^valias<bool> vb;
- // }
- // )cpp",
- // "0: targets = {valias}\n"
- // "1: targets = {valias}\n"},
-
+ {R"cpp(
+ template <class T> struct vector { using value_type = T; };
+ template <> struct vector<bool> { using value_type = bool; };
+ template <class T> using valias = vector<T>;
+ void foo() {
+ $0^valias<int> vi;
+ $1^valias<bool> vb;
+ }
+ )cpp",
+ "0: targets = {valias}\n"
+ "1: targets = {valias}\n"},
// MemberExpr should know their using declaration.
{R"cpp(
struct X { void func(int); }
Index: clang-tools-extra/clangd/FindTarget.cpp
===================================================================
--- clang-tools-extra/clangd/FindTarget.cpp
+++ 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(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68124.222104.patch
Type: text/x-patch
Size: 2583 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190927/4a0b94f9/attachment.bin>
More information about the cfe-commits
mailing list