[clang-tools-extra] [clang-tidy] bugprone-lambda-function-name ignore macro in captures (PR #89076)
Piotr Zegar via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 18 10:12:53 PDT 2024
================
@@ -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(
+ cxxMethodDecl(isInLambda(),
+ hasBody(hasDescendant(expr(
----------------
PiotrZSL wrote:
May work, as forEachDescendant may be doing new "set" of variables, to be sure try this:
```
[] {
struct S {
void f() {
__func__;
}
};
__func__();
struct S2 {
void f() {
__func__;
}
};
__func__();
}();
```
If it work correctly then both func should be found.
https://github.com/llvm/llvm-project/pull/89076
More information about the cfe-commits
mailing list