loplugin:unnecessaryoverride: no warnings when fns are actually different
Change-Id: I90d8af7a1affa459400b1cae4805e3a80b6c5200 Reviewed-on: https://gerrit.libreoffice.org/44593 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
@@ -11,6 +11,10 @@ struct Base
|
|||||||
{
|
{
|
||||||
virtual ~Base();
|
virtual ~Base();
|
||||||
virtual void f();
|
virtual void f();
|
||||||
|
void variadic(int, ...);
|
||||||
|
void cv() const volatile;
|
||||||
|
void ref();
|
||||||
|
static void staticFn();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SimpleDerived : Base
|
struct SimpleDerived : Base
|
||||||
@@ -45,4 +49,12 @@ struct MultiClassDerived : Intermediate1, MultiClassIntermediate2
|
|||||||
void f() override { Intermediate1::f(); } // no warning
|
void f() override { Intermediate1::f(); } // no warning
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct DerivedDifferent : Base
|
||||||
|
{
|
||||||
|
void variadic(int x) { Base::variadic(x); } // no warning
|
||||||
|
void cv() { Base::cv(); } // no warning
|
||||||
|
void ref() && { Base::ref(); } // no warning
|
||||||
|
void staticFn() { Base::staticFn(); } // no warning
|
||||||
|
};
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||||
|
@@ -399,6 +399,15 @@ const CXXMethodDecl* UnnecessaryOverride::findOverriddenOrSimilarMethodInSupercl
|
|||||||
if (!baseMethod->getDeclName().isIdentifier() || methodDecl->getName() != baseMethod->getName()) {
|
if (!baseMethod->getDeclName().isIdentifier() || methodDecl->getName() != baseMethod->getName()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (methodDecl->isStatic() != baseMethod->isStatic()
|
||||||
|
|| methodDecl->isConst() != baseMethod->isConst()
|
||||||
|
|| methodDecl->isVolatile() != baseMethod->isVolatile()
|
||||||
|
|| (methodDecl->getRefQualifier()
|
||||||
|
!= baseMethod->getRefQualifier())
|
||||||
|
|| methodDecl->isVariadic() != baseMethod->isVariadic())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (compat::getReturnType(*methodDecl).getCanonicalType()
|
if (compat::getReturnType(*methodDecl).getCanonicalType()
|
||||||
!= compat::getReturnType(*baseMethod).getCanonicalType())
|
!= compat::getReturnType(*baseMethod).getCanonicalType())
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user