[clang] Fix WebKit static analyzers to support ref and deref methods to be defined on different classes. (PR #69985)
Ryosuke Niwa via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 9 15:45:00 PST 2023
================
@@ -77,14 +77,53 @@ class RefCntblBaseVirtualDtorChecker
(AccSpec == AS_none && RD->isClass()))
return false;
- std::optional<const CXXRecordDecl*> RefCntblBaseRD = isRefCountable(Base);
- if (!RefCntblBaseRD || !(*RefCntblBaseRD))
+ auto hasRefInBase = clang::hasPublicMethodInBase(Base, "ref");
+ auto hasDerefInBase = clang::hasPublicMethodInBase(Base, "deref");
+
+ bool hasRef = hasRefInBase && *hasRefInBase != nullptr;
+ bool hasDeref = hasDerefInBase && *hasDerefInBase != nullptr;
+
+ const Type *T = Base->getType().getTypePtrOrNull();
+ if (!T)
+ return false;
+
+ const CXXRecordDecl *C = T->getAsCXXRecordDecl();
----------------
rniwa wrote:
Fixed.
https://github.com/llvm/llvm-project/pull/69985
More information about the cfe-commits
mailing list