[clang] [alpha.webkit.UncountedCallArgsChecker] Ignore calls to WTF's container methods (PR #82156)

via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 18 01:39:11 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 ead0a9777f8ccb5c26d50d96bade6cd5b47f496b 907c06c6675ae2ca06ec70e005966b2bdd7125c1 -- clang/test/Analysis/Checkers/WebKit/call-args-wtf-containers.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp
index 33e640f4d6..9ed7f2a4e0 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp
@@ -25,7 +25,7 @@ using namespace ento;
 
 namespace {
 
-bool stringEndsWith(const std::string& str, const std::string& suffix) {
+bool stringEndsWith(const std::string &str, const std::string &suffix) {
   auto index = str.rfind(suffix);
   return index != std::string::npos && str.size() - suffix.size() == index;
 }
@@ -217,12 +217,12 @@ public:
     auto nsName = safeGetName(NsDecl);
     // FIXME: These should be implemented via attributes.
     return nsName == "WTF" &&
-      (methodName == "find" || methodName == "findIf" ||
-      methodName == "reverseFind" || methodName == "reverseFindIf" ||
-      methodName == "get" || methodName == "inlineGet" ||
-      methodName == "contains" || methodName == "containsIf") &&
-      (stringEndsWith(clsName, "Vector") || stringEndsWith(clsName, "Set") ||
-      stringEndsWith(clsName, "Map"));
+           (methodName == "find" || methodName == "findIf" ||
+            methodName == "reverseFind" || methodName == "reverseFindIf" ||
+            methodName == "get" || methodName == "inlineGet" ||
+            methodName == "contains" || methodName == "containsIf") &&
+           (stringEndsWith(clsName, "Vector") ||
+            stringEndsWith(clsName, "Set") || stringEndsWith(clsName, "Map"));
   }
 
   void reportBug(const Expr *CallArg, const ParmVarDecl *Param) const {

``````````

</details>


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


More information about the cfe-commits mailing list