[PATCH] D71976: Match code following lambdas when ignoring invisible nodes
Stephen Kelly via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 29 12:41:53 PST 2019
steveire created this revision.
steveire added a reviewer: aaron.ballman.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D71976
Files:
clang/lib/ASTMatchers/ASTMatchFinder.cpp
clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
Index: clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
===================================================================
--- clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
@@ -1760,6 +1760,7 @@
void func14() {
[] <typename TemplateType> (TemplateType t, TemplateType u) { int e = t + u; };
+ float i = 42.0;
}
)cpp";
@@ -1849,6 +1850,11 @@
lambdaExpr(
forFunction(functionDecl(hasName("func14"))),
has(templateTypeParmDecl(hasName("TemplateType")))))));
+
+ EXPECT_TRUE(
+ matches(Code, traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource,
+ functionDecl(hasName("func14"),
+ hasDescendant(floatLiteral())))));
}
TEST(IgnoringImpCasts, MatchesImpCasts) {
Index: clang/lib/ASTMatchers/ASTMatchFinder.cpp
===================================================================
--- clang/lib/ASTMatchers/ASTMatchFinder.cpp
+++ clang/lib/ASTMatchers/ASTMatchFinder.cpp
@@ -248,7 +248,7 @@
if (!match(*Node->getBody()))
return false;
- return false;
+ return true;
}
bool shouldVisitTemplateInstantiations() const { return true; }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71976.235519.patch
Type: text/x-patch
Size: 1301 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191229/d36b6c38/attachment.bin>
More information about the cfe-commits
mailing list