[clang] [webkit.UncountedLambdaCapturesChecker] Ignore a lambda which gets called immediately (PR #162977)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 10 23:47:53 PDT 2025


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 origin/main HEAD --extensions cpp -- clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefLambdaCapturesChecker.cpp clang/test/Analysis/Checkers/WebKit/uncounted-lambda-captures.cpp
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefLambdaCapturesChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefLambdaCapturesChecker.cpp
index 6b3a4a77e..50532abfb 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefLambdaCapturesChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefLambdaCapturesChecker.cpp
@@ -259,7 +259,7 @@ public:
         if (!Callee)
           return;
         Callee = Callee->IgnoreParenCasts();
-        if (auto* L = dyn_cast_or_null<LambdaExpr>(Callee)) {
+        if (auto *L = dyn_cast_or_null<LambdaExpr>(Callee)) {
           LambdasToIgnore.insert(L); // Calling a lambda upon creation is safe.
           return;
         }

``````````

</details>


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


More information about the cfe-commits mailing list