Skip to content

Fix an implicit cast to a base ref counted class generates a false positive. #80934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ std::optional<bool> isRefCountable(const CXXRecordDecl* R)
if (AnyInconclusiveBase)
return std::nullopt;

Paths.clear();
const auto hasPublicDerefInBase =
[&AnyInconclusiveBase](const CXXBaseSpecifier *Base, CXXBasePath &) {
auto hasDerefInBase = clang::hasPublicMethodInBase(Base, "deref");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s
// expected-no-diagnostics

#include "mock-types.h"

class Base {
public:
virtual ~Base();
void ref() const;
void deref() const;
};

class Event : public Base {
protected:
explicit Event();
};

class SubEvent : public Event {
public:
static Ref<SubEvent> create();
private:
SubEvent() = default;
};

void someFunction(Base&);

static void test()
{
someFunction(SubEvent::create());
}