Minor loplugin:unnecessaryoverride improvement

Change-Id: I3afb31b642a47e767dda0614d223b6b7f22e5d54
This commit is contained in:
Stephan Bergmann
2017-03-13 17:24:09 +01:00
parent e20d9867e2
commit 6661bdb076
3 changed files with 8 additions and 14 deletions

View File

@@ -114,10 +114,6 @@ bool UnnecessaryOverride::VisitCXXMethodDecl(const CXXMethodDecl* methodDecl)
// operator to change from being an obsolete feature to being a standard
// feature. That difference is not taken into account here.
auto cls = methodDecl->getParent();
if (methodDecl->isVirtual() && cls->getNumBases() == 0)
{
return true;
}
if (methodDecl->getAccess() != AS_public)
{
return true;
@@ -131,6 +127,7 @@ bool UnnecessaryOverride::VisitCXXMethodDecl(const CXXMethodDecl* methodDecl)
// if it's virtual, but it has a base-class with a non-virtual destructor
if (methodDecl->isVirtual())
{
bool baseWithVirtualDtor = false;
for (auto baseSpecifier = cls->bases_begin(); baseSpecifier != cls->bases_end(); ++baseSpecifier)
{
const RecordType* baseRecordType = baseSpecifier->getType()->getAs<RecordType>();
@@ -138,15 +135,16 @@ bool UnnecessaryOverride::VisitCXXMethodDecl(const CXXMethodDecl* methodDecl)
{
const CXXRecordDecl* baseRecordDecl = dyn_cast<CXXRecordDecl>(baseRecordType->getDecl());
if (baseRecordDecl && baseRecordDecl->getDestructor()
&& !baseRecordDecl->getDestructor()->isVirtual())
&& baseRecordDecl->getDestructor()->isVirtual())
{
return true;
baseWithVirtualDtor = true;
break;
}
}
else
{
return true; // dependent base
}
}
if (!baseWithVirtualDtor)
{
return true;
}
}
// corner case

View File

@@ -245,7 +245,6 @@ public:
SwUnoCursor& GetCursor();
sw::UnoCursorPointer m_pUnoCursor;
SwFrameFormat* GetFrameFormat() const { return const_cast<SwFrameFormat*>(static_cast<const SwFrameFormat*>(GetRegisteredIn())); }
virtual ~SwXTextTableCursor() override { };
};
struct SwRangeDescriptor

View File

@@ -192,9 +192,6 @@ public:
maTempFile.EnableKillingFile();
}
virtual ~SwModelTestBase() override
{}
virtual void setUp() override
{
test::BootstrapFixture::setUp();