[PATCH] D68120: [clangd] Handle type template parameters in findExplicitReferences
Ilya Biryukov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 26 23:32:00 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/D68120
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
@@ -706,6 +706,18 @@
"0: targets = {x}\n"
"1: targets = {X::func, X::func}\n"
"2: targets = {t}\n"},
+ // Type template parameters.
+ {R"cpp(
+ template <class T>
+ 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"},
};
for (const auto &C : Cases) {
Index: clang-tools-extra/clangd/FindTarget.cpp
===================================================================
--- clang-tools-extra/clangd/FindTarget.cpp
+++ clang-tools-extra/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(),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68120.222084.patch
Type: text/x-patch
Size: 1417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190927/5207ed81/attachment-0001.bin>
More information about the cfe-commits
mailing list