[PATCH] D87257: [clang] Traverse init-captures while indexing
Nathan Ridge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 7 17:13:55 PDT 2020
nridge updated this revision to Diff 290379.
nridge added a comment.
Fix typo
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87257/new/
https://reviews.llvm.org/D87257
Files:
clang-tools-extra/clangd/unittests/XRefsTests.cpp
clang/lib/Index/IndexBody.cpp
Index: clang/lib/Index/IndexBody.cpp
===================================================================
--- clang/lib/Index/IndexBody.cpp
+++ clang/lib/Index/IndexBody.cpp
@@ -391,11 +391,13 @@
if (C->capturesThis() || C->capturesVLAType())
return true;
+ if (!base::TraverseStmt(Init))
+ return false;
+
if (C->capturesVariable() && IndexCtx.shouldIndexFunctionLocalSymbols())
return IndexCtx.handleReference(C->getCapturedVar(), C->getLocation(),
Parent, ParentDC, SymbolRoleSet());
- // FIXME: Lambda init-captures.
return true;
}
Index: clang-tools-extra/clangd/unittests/XRefsTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/XRefsTests.cpp
+++ clang-tools-extra/clangd/unittests/XRefsTests.cpp
@@ -1589,6 +1589,12 @@
[[Vector]]<int> x2;
Vector<double> y;
)cpp",
+ R"cpp(// Lambda capture initializer
+ void foo() {
+ int [[w^aldo]] = 42;
+ auto lambda = [x = [[waldo]]](){};
+ }
+ )cpp",
};
for (const char *Test : Tests) {
Annotations T(Test);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87257.290379.patch
Type: text/x-patch
Size: 1185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200908/f6d55557/attachment.bin>
More information about the cfe-commits
mailing list