[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
Wed Apr 17 08:25:56 PDT 2024


================
@@ -69,9 +71,8 @@ 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);
+  auto IsInsideALambda = hasAncestor(cxxMethodDecl(isInLambda()));
+  Finder->addMatcher(predefinedExpr(IsInsideALambda).bind("E"), this);
----------------
PiotrZSL wrote:

this may not work for `[] (const char* func = __func__){ func; }();`
maybe we should check only body of function




https://github.com/llvm/llvm-project/pull/89076


More information about the cfe-commits mailing list