[clang] [webkit.RefCntblBaseVirtualDtor] Ignore WTF::RefCounted<T> and its variants missing virtual destructor (PR #91009)

via cfe-commits cfe-commits at lists.llvm.org
Sat May 4 06:50:17 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 37f6ba4fb2db2c78cda7d0a69cd0a2eff2b924e3 2b5782f9a7f6473174ccefa005268debb79aa744 -- clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-templates.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp
index 5d3a20315f..7f4c3a7b78 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "DiagOutputUtils.h"
 #include "ASTUtils.h"
+#include "DiagOutputUtils.h"
 #include "PtrTypesSemantics.h"
 #include "clang/AST/CXXInheritance.h"
 #include "clang/AST/RecursiveASTVisitor.h"
@@ -168,7 +168,7 @@ public:
     return false;
   }
 
-  static bool isRefCountedClass(const CXXRecordDecl* D) {
+  static bool isRefCountedClass(const CXXRecordDecl *D) {
     if (!D->getTemplateInstantiationPattern())
       return false;
     auto *NsDecl = D->getParent();
@@ -177,8 +177,9 @@ public:
     auto NamespaceName = safeGetName(NsDecl);
     auto ClsNameStr = safeGetName(D);
     StringRef ClsName = ClsNameStr; // FIXME: Make safeGetName return StringRef.
-    return NamespaceName == "WTF" && (ClsName.ends_with("RefCounted") ||
-        ClsName == "ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr");
+    return NamespaceName == "WTF" &&
+           (ClsName.ends_with("RefCounted") ||
+            ClsName == "ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr");
   }
 
   void reportBug(const CXXRecordDecl *DerivedClass,

``````````

</details>


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


More information about the cfe-commits mailing list