diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html --- a/clang/docs/LibASTMatchersReference.html +++ b/clang/docs/LibASTMatchersReference.html @@ -4550,35 +4550,6 @@ -
Matches each lambda capture in a lambda expression. - -Given - int main() { - int x, y; - float z; - auto f = [=]() { return x + y + z; }; - } -lambdaExpr(forEachLambdaCapture( - lambdaCapture(capturesVar(varDecl(hasType(isInteger())))))) -will trigger two matches, binding for 'x' and 'y' respectively. -
Matches any capture in a lambda expression. - -Given - void foo() { - int t = 5; - auto f = [=](){ return t; }; - } -lambdaExpr(hasAnyCapture(lambdaCapture())) and -lambdaExpr(hasAnyCapture(lambdaCapture(refersToVarDecl(hasName("t"))))) - both match `[=](){ return t; }`. -
Matches member expressions that are called with '->' as opposed to '.'. @@ -8405,6 +8376,35 @@
Matches each lambda capture in a lambda expression. + +Given + int main() { + int x, y; + float z; + auto f = [=]() { return x + y + z; }; + } +lambdaExpr(forEachLambdaCapture( + lambdaCapture(capturesVar(varDecl(hasType(isInteger())))))) +will trigger two matches, binding for 'x' and 'y' respectively. +
Matches any capture in a lambda expression. + +Given + void foo() { + int t = 5; + auto f = [=](){ return t; }; + } +lambdaExpr(hasAnyCapture(lambdaCapture())) and +lambdaExpr(hasAnyCapture(lambdaCapture(refersToVarDecl(hasName("t"))))) + both match `[=](){ return t; }`. +
Matches a node if the declaration associated with that node matches the given matcher. diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h --- a/clang/include/clang/ASTMatchers/ASTMatchers.h +++ b/clang/include/clang/ASTMatchers/ASTMatchers.h @@ -4227,8 +4227,8 @@ /// lambdaExpr(forEachLambdaCapture( /// lambdaCapture(capturesVar(varDecl(hasType(isInteger())))))) /// will trigger two matches, binding for 'x' and 'y' respectively. -AST_MATCHER_P(LambdaExpr, forEachLambdaCapture, LambdaCaptureMatcher, - InnerMatcher) { +AST_MATCHER_P(LambdaExpr, forEachLambdaCapture, + internal::Matcher, InnerMatcher) { BoundNodesTreeBuilder Result; bool Matched = false; for (const auto &Capture : Node.captures()) { @@ -4655,7 +4655,8 @@ /// lambdaExpr(hasAnyCapture(lambdaCapture())) and /// lambdaExpr(hasAnyCapture(lambdaCapture(refersToVarDecl(hasName("t"))))) /// both match `[=](){ return t; }`. -AST_MATCHER_P(LambdaExpr, hasAnyCapture, LambdaCaptureMatcher, InnerMatcher) { +AST_MATCHER_P(LambdaExpr, hasAnyCapture, internal::Matcher , + InnerMatcher) { for (const LambdaCapture &Capture : Node.captures()) { clang::ast_matchers::internal::BoundNodesTreeBuilder Result(*Builder); if (InnerMatcher.matches(Capture, Finder, &Result)) {