[clang] [webkit.UncountedLambdaCapturesChecker] Ignore trivial functions and [[clang::noescape]]. (PR #113845)
Rashmi Mudduluru via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 30 16:19:17 PDT 2024
================
@@ -45,8 +49,62 @@ class UncountedLambdaCapturesChecker
bool shouldVisitTemplateInstantiations() const { return true; }
bool shouldVisitImplicitCode() const { return false; }
- bool VisitLambdaExpr(LambdaExpr *L) {
- Checker->visitLambdaExpr(L);
+ bool VisitDeclRefExpr(DeclRefExpr *DRE) {
+ if (DeclRefExprsToIgnore.contains(DRE))
+ return true;
+ if (auto *VD = dyn_cast_or_null<VarDecl>(DRE->getDecl())) {
+ auto *Init = VD->getInit()->IgnoreParenCasts();
+ if (auto *L = dyn_cast_or_null<LambdaExpr>(Init)) {
+ Checker->visitLambdaExpr(L);
+ return true;
+ }
+ }
+ return true;
----------------
t-rasmud wrote:
Is the return value in both the true and the false cases of the branch supposed to be `true`?
https://github.com/llvm/llvm-project/pull/113845
More information about the cfe-commits
mailing list