[PATCH] D70740: [clangd] Find reference to template parameter in 'sizeof...' expression
Nathan Ridge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 26 12:25:06 PST 2019
nridge created this revision.
nridge added a reviewer: ilya-biryukov.
Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman, jkorous, MaskRay.
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D70740
Files:
clang-tools-extra/clangd/FindTarget.cpp
clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -625,6 +625,13 @@
$InactiveCode[[]] #else
int $Variable[[Active2]];
#endif
+ )cpp",
+ // Argument to 'sizeof...'
+ R"cpp(
+ template <typename... $TemplateParameter[[Elements]]>
+ struct $Class[[TupleSize]] {
+ static const int $StaticField[[size]] = sizeof...($TemplateParameter[[Elements]]);
+ };
)cpp"};
for (const auto &TestCase : TestCases) {
checkHighlightings(TestCase);
Index: clang-tools-extra/clangd/FindTarget.cpp
===================================================================
--- clang-tools-extra/clangd/FindTarget.cpp
+++ clang-tools-extra/clangd/FindTarget.cpp
@@ -491,6 +491,13 @@
llvm::SmallVector<const NamedDecl *, 1>(
E->decls().begin(), E->decls().end())});
}
+
+ void VisitSizeOfPackExpr(const SizeOfPackExpr *E) {
+ Refs.push_back(ReferenceLoc{NestedNameSpecifierLoc(),
+ E->getPackLoc(),
+ /*IsDecl=*/false,
+ {E->getPack()}});
+ }
};
Visitor V;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70740.231120.patch
Type: text/x-patch
Size: 1421 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191126/03cf9503/attachment.bin>
More information about the cfe-commits
mailing list