[clang] [webkit.UncountedLambdaCapturesChecker] Add a fallback for checking lambda captures (PR #119800)
Ryosuke Niwa via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 13 13:59:13 PST 2024
================
@@ -61,6 +62,24 @@ class UncountedLambdaCapturesChecker
return result && *result;
}
+ bool VisitLambdaExpr(LambdaExpr *L) override {
+ if (LambdasToIgnore.contains(L))
+ return true;
+ Checker->visitLambdaExpr(L, shouldCheckThis());
+ return true;
+ }
+
+ bool VisitVarDecl(VarDecl *VD) override {
+ auto *Init = VD->getInit();
+ if (!Init)
+ return true;
+ auto *L = dyn_cast_or_null<LambdaExpr>(Init->IgnoreParenCasts());
+ if (!L)
+ return true;
+ LambdasToIgnore.insert(L); // Evaluate lambdas in VisitDeclRefExpr.
----------------
rniwa wrote:
Oh, I'm saying that this lambda will be checked inside VisitDeclRefExpr.
https://github.com/llvm/llvm-project/pull/119800
More information about the cfe-commits
mailing list