[clang] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis pattern. (PR #120528)

via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 19 12:55:43 PST 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 08849083a797b03c93487d177f6019d709d44d93 6d56aea468a785da81495e8aa8ddea31f9a7f880 --extensions cpp -- clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp 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 83165b512c..da9698e327 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp
@@ -215,7 +215,7 @@ public:
         bool hasProtectThis = false;
         for (const LambdaCapture &OtherCapture : L->captures()) {
           if (!OtherCapture.capturesVariable())
-              continue;
+            continue;
           if (auto *ValueDecl = OtherCapture.getCapturedVar()) {
             if (protectThis(ValueDecl)) {
               hasProtectThis = true;

``````````

</details>


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


More information about the cfe-commits mailing list