if (!match(*Node->getBody()))
return false;
- return true;
+ return VisitorBase::TraverseStmt(Node->getBody());
}
bool shouldVisitTemplateInstantiations() const { return true; }
float i = 42.0;
}
+void func15() {
+ int count = 0;
+ auto l = [&] { ++count; };
+ (void)l;
+}
+
)cpp";
EXPECT_TRUE(
functionDecl(hasName("func14"), hasDescendant(floatLiteral()))),
langCxx20OrLater()));
+ EXPECT_TRUE(matches(
+ Code,
+ traverse(TK_IgnoreUnlessSpelledInSource,
+ compoundStmt(
+ hasDescendant(varDecl(hasName("count")).bind("countVar")),
+ hasDescendant(
+ declRefExpr(to(varDecl(equalsBoundNode("countVar"))))))),
+ langCxx20OrLater()));
+
Code = R"cpp(
void foo() {
int explicit_captured = 0;