[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:16 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())) {
----------------
t-rasmud wrote:

Would be great if we can continue the "early return coding style" like in the 2 lines above:
```
auto *VD = dyn_cast_or_null<VarDecl>(DRE->getDecl());
if (!VD)
    return false;
```
Same comment for the following lines and for code in `VisitCallExpr`

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


More information about the cfe-commits mailing list