[clang] [webkit.UncountedLambdaCapturesChecker] Add a fallback for checking lambda captures (PR #119800)
Rashmi Mudduluru via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 13 13:18:26 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.
----------------
t-rasmud wrote:
Not sure I understand this comment. `L` is a lambda that should be ignored. Is this saying it will be evaluated in `VisitDeclRefExpr` again?
https://github.com/llvm/llvm-project/pull/119800
More information about the cfe-commits
mailing list