Author: Adam Dangoor
Date: 2026-10-26T15:03:40Z
New Revision: 7b13fff74df0b5efe953eba9fe2ce542438dc770

URL: 
https://github.com/llvm/llvm-project/commit/7b13fff74df0b5efe953eba9fe2ce542438dc770
DIFF: 
https://github.com/llvm/llvm-project/commit/7b13fff74df0b5efe953eba9fe2ce542438dc770.diff

LOG: [clang][webkit][NFC] Avoid stringifying non-WTF base types when we can 
(#235713)

Fixes #235705

Added: 
    
clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-deep-types.cpp

Modified: 
    clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp

Removed: 
    


################################################################################
diff  --git 
a/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp
index b883cb78705b6b..1859536cae6d69 100644
--- 
a/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp
+++ 
b/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp
@@ -199,8 +199,8 @@ class RefCntblBaseVirtualDtorChecker
           if (!C)
             continue;
 
-          bool isExempt = T.getAsString() == "NoVirtualDestructorBase" &&
-                          safeGetName(C->getParent()) == "WTF";
+          bool isExempt = safeGetName(C->getParent()) == "WTF" &&
+                          T.getAsString() == "NoVirtualDestructorBase";
           if (isExempt || ExemptDecls.contains(C)) {
             ExemptDecls.insert(RD);
             continue;

diff  --git 
a/clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-deep-types.cpp
 
b/clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-deep-types.cpp
new file mode 100644
index 00000000000000..aed8871ab793eb
--- /dev/null
+++ 
b/clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-deep-types.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=webkit.RefCntblBaseVirtualDtor 
-std=c++17 -verify %s
+// expected-no-diagnostics
+
+template<class T> struct Alloc {};
+template<class T, class A> struct Storage {};
+template<class T, class A=Alloc<T>> struct Node : Storage<T,A> {};
+struct Derived : 
Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<int>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 {};


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to