================ @@ -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(); ---------------- haoNoQ wrote:
`.getTypePtrOrNull()` is typically unnecessary, most of the code can use the overloaded `QualType::operator->()` to access the underlying `Type`: QualType T = Base->getType(); if (T.isNull()) return false; const CXXRecordDecl *C = T->getAsCXXRecordDecl(); etc. https://github.com/llvm/llvm-project/pull/69985 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits