================
@@ -69,9 +73,13 @@ void
LambdaFunctionNameCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
}
void LambdaFunctionNameCheck::registerMatchers(MatchFinder *Finder) {
- // Match on PredefinedExprs inside a lambda.
- Finder->addMatcher(predefinedExpr(hasAncestor(lambdaExpr())).bind("E"),
- this);
+ Finder->addMatcher(
+ functionDecl(cxxMethodDecl(isInLambda()),
+ hasBody(hasDescendant(expr(
+ predefinedExpr(hasAncestor(functionDecl().bind("fn")))
+ .bind("E")))),
+ functionDecl(equalsBoundNode("fn"))),
+ this);
----------------
5chmidti wrote:
If you make the outer `functionDecl` the `cxxMethodDecl`, then you can remove
the inner `cxxMethodDecl` that encloses the lambda. Or was there a reason for
doing it this way?
You can also drop the `expr` matcher that surrounds the `predefinedExpr`, and
the `functionDecl` surrounding the `equalsBoundNode`.
I.e.:
```c++
cxxMethodDecl(isInLambda(),
hasBody(hasDescendant(
predefinedExpr(hasAncestor(functionDecl().bind("fn")))
.bind("E"))),
equalsBoundNode("fn"))
```
https://github.com/llvm/llvm-project/pull/89076
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits