[clang] [webkit.UncountedLambdaCapturesChecker] Ignore trivial functions and [[clang::noescape]]. (PR #113845)

via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 27 16:36:45 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff fb33af08e4c105a05855f8beeb972d493410e72f 1524ca532c9c1ef015c162360d4e4688296bbc0d --extensions h,cpp -- clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp clang/test/Analysis/Checkers/WebKit/mock-types.h clang/test/Analysis/Checkers/WebKit/uncounted-lambda-captures.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp
index 02f68ac5e4..1d0730e9d5 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp
@@ -62,8 +62,8 @@ public:
         return true;
       }
 
-      // WTF::switchOn(T, F... f) is a variadic template function and couldn't be annotated with NOESCAPE.
-      // We hard code it here to workaround that.
+      // WTF::switchOn(T, F... f) is a variadic template function and couldn't
+      // be annotated with NOESCAPE. We hard code it here to workaround that.
       bool shouldTreatAllArgAsNoEscape(FunctionDecl *Decl) {
         auto *NsDecl = Decl->getParent();
         if (!NsDecl || !isa<NamespaceDecl>(NsDecl))
@@ -82,7 +82,8 @@ public:
                     auto *Init = VD->getInit()->IgnoreParenCasts();
                     if (auto *L = dyn_cast_or_null<LambdaExpr>(Init)) {
                       DeclRefExprsToIgnore.insert(DRE);
-                      Checker->visitLambdaExpr(L, /* ignoreParamVarDecl */ true);
+                      Checker->visitLambdaExpr(L,
+                                               /* ignoreParamVarDecl */ true);
                     }
                   }
                 }
@@ -98,7 +99,8 @@ public:
               break;
             auto *Arg = CE->getArg(ArgIndex)->IgnoreParenCasts();
             if (!Param->hasAttr<NoEscapeAttr>() && !TreatAllArgsAsNoEscape) {
-              if (auto *L = dyn_cast_or_null<LambdaExpr>(Arg->IgnoreParenCasts()))
+              if (auto *L =
+                      dyn_cast_or_null<LambdaExpr>(Arg->IgnoreParenCasts()))
                 Checker->visitLambdaExpr(L);
             }
             ++ArgIndex;
@@ -171,7 +173,8 @@ public:
       Os << "Implicitly captured ";
     }
 
-    Os << "raw-pointer 'this' to ref-counted / CheckedPtr capable type is unsafe.";
+    Os << "raw-pointer 'this' to ref-counted / CheckedPtr capable type is "
+          "unsafe.";
 
     PathDiagnosticLocation BSLoc(Capture.getLocation(), BR->getSourceManager());
     auto Report = std::make_unique<BasicBugReport>(Bug, Os.str(), BSLoc);

``````````

</details>


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


More information about the cfe-commits mailing list