[clang] [analyzer] WebKit checkers: support ref and deref defined on different classes. (PR #68170)
Ryosuke Niwa via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 20 15:59:02 PDT 2023
================
@@ -18,24 +18,26 @@ using namespace clang;
namespace {
-bool hasPublicRefAndDeref(const CXXRecordDecl *R) {
+bool hasPublicRefMethod(const CXXRecordDecl *R) {
assert(R);
assert(R->hasDefinition());
- bool hasRef = false;
- bool hasDeref = false;
for (const CXXMethodDecl *MD : R->methods()) {
const auto MethodName = safeGetName(MD);
+ if (MethodName == "ref" && MD->getAccess() == AS_public)
+ return true;
+ }
+ return false;
+}
- if (MethodName == "ref" && MD->getAccess() == AS_public) {
- if (hasDeref)
- return true;
- hasRef = true;
- } else if (MethodName == "deref" && MD->getAccess() == AS_public) {
- if (hasRef)
- return true;
- hasDeref = true;
- }
+bool hasPublicDerefMethod(const CXXRecordDecl *R) {
----------------
rniwa wrote:
Sure, done that.
https://github.com/llvm/llvm-project/pull/68170
More information about the cfe-commits
mailing list