[Libreoffice-commits] core.git: 2 commits - compilerplugins/clang include/svx svx/source ucb/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Jul 31 12:59:53 UTC 2018
compilerplugins/clang/test/unnecessaryoverride.cxx | 31 +++++++++++++++++++++
compilerplugins/clang/unnecessaryoverride.cxx | 28 ++++++++++++++----
include/svx/svdview.hxx | 2 -
svx/source/svdraw/svdview.cxx | 5 ---
ucb/source/ucp/cmis/cmis_datasupplier.cxx | 9 ++----
ucb/source/ucp/cmis/cmis_datasupplier.hxx | 2 -
ucb/source/ucp/ftp/ftpdirp.cxx | 3 --
ucb/source/ucp/ftp/ftpdirp.hxx | 2 -
ucb/source/ucp/webdav-neon/webdavcontent.cxx | 4 +-
ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx | 4 --
ucb/source/ucp/webdav-neon/webdavprovider.hxx | 2 -
11 files changed, 63 insertions(+), 29 deletions(-)
New commits:
commit 7d13fe52bdb31d1263148567fec009df1de6e330
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 30 15:35:13 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 31 14:59:41 2018 +0200
loplugin:returnconstant in ucb
Change-Id: I2810468e64bba8bc9f8af4dff170bc1ab310fe2f
Reviewed-on: https://gerrit.libreoffice.org/58337
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/ucb/source/ucp/cmis/cmis_datasupplier.cxx b/ucb/source/ucp/cmis/cmis_datasupplier.cxx
index 13133a2d27ad..01819ad36a03 100644
--- a/ucb/source/ucp/cmis/cmis_datasupplier.cxx
+++ b/ucb/source/ucp/cmis/cmis_datasupplier.cxx
@@ -30,10 +30,10 @@ namespace cmis
{
}
- bool DataSupplier::getData()
+ void DataSupplier::getData()
{
if ( mbCountFinal )
- return true;
+ return;
std::vector< uno::Reference< ucb::XContent > > aChildren = m_pChildrenProvider->getChildren( );
@@ -51,8 +51,6 @@ namespace cmis
}
}
mbCountFinal = true;
-
- return true;
}
DataSupplier::~DataSupplier()
@@ -90,7 +88,8 @@ namespace cmis
if ( maResults.size() > nIndex ) // Result already present.
return true;
- if ( getData() && maResults.size() > nIndex )
+ getData();
+ if ( maResults.size() > nIndex )
return true;
return false;
diff --git a/ucb/source/ucp/cmis/cmis_datasupplier.hxx b/ucb/source/ucp/cmis/cmis_datasupplier.hxx
index 619af90e355c..0f618f04bc54 100644
--- a/ucb/source/ucp/cmis/cmis_datasupplier.hxx
+++ b/ucb/source/ucp/cmis/cmis_datasupplier.hxx
@@ -39,7 +39,7 @@ namespace cmis
ChildrenProvider* m_pChildrenProvider;
sal_Int32 mnOpenMode;
bool mbCountFinal;
- bool getData();
+ void getData();
ResultList maResults;
public:
diff --git a/ucb/source/ucp/ftp/ftpdirp.cxx b/ucb/source/ucp/ftp/ftpdirp.cxx
index f4ab59afbbe8..ca439aa31a8a 100644
--- a/ucb/source/ucp/ftp/ftpdirp.cxx
+++ b/ucb/source/ucp/ftp/ftpdirp.cxx
@@ -1219,7 +1219,7 @@ bool FTPDirectoryParser::parseUNIX_isTime (
* checked for validity of the given day in the given month and year.
*
*/
-bool FTPDirectoryParser::setYear (
+void FTPDirectoryParser::setYear (
DateTime &rDateTime, sal_uInt16 nYear)
{
if (nYear < 100)
@@ -1249,7 +1249,6 @@ bool FTPDirectoryParser::setYear (
}
rDateTime.SetYear(nYear);
- return true;
}
/*
diff --git a/ucb/source/ucp/ftp/ftpdirp.hxx b/ucb/source/ucp/ftp/ftpdirp.hxx
index 3284c7357fb4..983fab1d29ae 100644
--- a/ucb/source/ucp/ftp/ftpdirp.hxx
+++ b/ucb/source/ucp/ftp/ftpdirp.hxx
@@ -143,7 +143,7 @@ namespace ftp {
sal_uInt16 nHour,
DateTime& rDateTime);
- static bool setYear (
+ static void setYear (
DateTime& rDateTime,
sal_uInt16 nYear);
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index 3113b3c1f5f1..db25abd32205 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -1256,8 +1256,8 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
while ( it != end )
{
- if ( pProvider->getProperty( (*it).first, aProp ) )
- xRow->appendObject( aProp, (*it).second.value() );
+ pProvider->getProperty( (*it).first, aProp );
+ xRow->appendObject( aProp, (*it).second.value() );
++it;
}
diff --git a/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx b/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx
index 5599b04ff65f..38b840bcbc15 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx
@@ -62,7 +62,7 @@ using namespace webdav_ucp;
// ContentProvider implementation.
-bool ContentProvider::getProperty(
+void ContentProvider::getProperty(
const OUString & rPropName, beans::Property & rProp )
{
if ( !m_pProps )
@@ -277,8 +277,6 @@ bool ContentProvider::getProperty(
cppu::UnoType<OUString>::get(),
beans::PropertyAttribute::BOUND );
}
-
- return true;
}
diff --git a/ucb/source/ucp/webdav-neon/webdavprovider.hxx b/ucb/source/ucp/webdav-neon/webdavprovider.hxx
index e90d5364a742..06639ff3ba62 100644
--- a/ucb/source/ucp/webdav-neon/webdavprovider.hxx
+++ b/ucb/source/ucp/webdav-neon/webdavprovider.hxx
@@ -103,7 +103,7 @@ public:
// Non-interface methods.
- bool getProperty( const OUString & rPropName,
+ void getProperty( const OUString & rPropName,
css::beans::Property & rProp );
};
commit f2fb91390c443248e9c70363ef3038b1e2265e45
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Jul 31 10:54:41 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 31 14:59:31 2018 +0200
loplugin:unnecessaryoverride small improvement
when we have two definitions of the same method in a straight
inheritance path up our hierarchy, we were missing a warning
Change-Id: Ibc0f11644c7321a0d5618024860c2503665d8835
Reviewed-on: https://gerrit.libreoffice.org/58354
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/compilerplugins/clang/test/unnecessaryoverride.cxx b/compilerplugins/clang/test/unnecessaryoverride.cxx
index 7941263e2cec..a4db41aa5a99 100644
--- a/compilerplugins/clang/test/unnecessaryoverride.cxx
+++ b/compilerplugins/clang/test/unnecessaryoverride.cxx
@@ -148,4 +148,35 @@ public:
void f1() { Base3::f1(); }
};
+// check the case where the method occurs more than once in a direct path up the class hierarchy
+struct Base4
+{
+ void f1();
+};
+struct Derived4_1 : public Base4
+{
+ void f1();
+};
+struct Derived4_2 : public Derived4_1
+{
+ void
+ f1() // expected-error {{public function just calls public parent [loplugin:unnecessaryoverride]}}
+ {
+ Derived4_1::f1();
+ }
+};
+
+struct Base5_1
+{
+ void f1();
+};
+struct Base5_2
+{
+ void f1();
+};
+struct Derived5 : public Base5_1, public Base5_2
+{
+ void f1() { Base5_1::f1(); } // no warning expected
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/unnecessaryoverride.cxx b/compilerplugins/clang/unnecessaryoverride.cxx
index 092decc797fc..a4cf1da809c0 100644
--- a/compilerplugins/clang/unnecessaryoverride.cxx
+++ b/compilerplugins/clang/unnecessaryoverride.cxx
@@ -389,7 +389,8 @@ const CXXMethodDecl* UnnecessaryOverride::findOverriddenOrSimilarMethodInSupercl
return nullptr;
}
- std::vector<const CXXMethodDecl*> maSimilarMethods;
+ const CXXMethodDecl* similarMethod = nullptr;
+ CXXBasePath similarBasePath;
auto BaseMatchesCallback = [&](const CXXBaseSpecifier *cxxBaseSpecifier, CXXBasePath& path)
{
@@ -438,18 +439,31 @@ const CXXMethodDecl* UnnecessaryOverride::findOverriddenOrSimilarMethodInSupercl
}
}
if (bParamsMatch)
- maSimilarMethods.push_back(baseMethod);
+ {
+ // if we have already found a method directly below us in the inheritance hierarchy, just ignore this one
+ auto Compare = [&](CXXBasePathElement const & lhs, CXXBasePathElement const & rhs)
+ {
+ return lhs.Class == rhs.Class;
+ };
+ if (similarMethod
+ && similarBasePath.size() < path.size()
+ && std::equal(similarBasePath.begin(), similarBasePath.end(),
+ path.begin(), Compare))
+ break;
+ if (similarMethod)
+ return true; // short circuit the process
+ similarMethod = baseMethod;
+ similarBasePath = path;
+ }
}
return false;
};
CXXBasePaths aPaths;
- methodDecl->getParent()->lookupInBases(BaseMatchesCallback, aPaths);
+ if (methodDecl->getParent()->lookupInBases(BaseMatchesCallback, aPaths))
+ return nullptr;
- if (maSimilarMethods.size() == 1) {
- return maSimilarMethods[0];
- }
- return nullptr;
+ return similarMethod;
}
diff --git a/include/svx/svdview.hxx b/include/svx/svdview.hxx
index bab4ecd10d90..a4708917de00 100644
--- a/include/svx/svdview.hxx
+++ b/include/svx/svdview.hxx
@@ -194,8 +194,6 @@ public:
/* new interface src537 */
void GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr=false) const;
- SfxStyleSheet* GetStyleSheet() const;
-
// incomplete implementation:
// OutputDevice is necessary to determine HandleSize.
// If NULL the first signed on Win is used.
diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx
index 5022243ff455..91bccc57f5e2 100644
--- a/svx/source/svdraw/svdview.cxx
+++ b/svx/source/svdraw/svdview.cxx
@@ -253,11 +253,6 @@ void SdrView::GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const
SdrCreateView::GetAttributes(rTargetSet, bOnlyHardAttr);
}
-SfxStyleSheet* SdrView::GetStyleSheet() const
-{
- return SdrCreateView::GetStyleSheet();
-}
-
SdrHitKind SdrView::PickAnything(const MouseEvent& rMEvt, SdrMouseEventKind nEventKind, SdrViewEvent& rVEvt) const
{
rVEvt.bMouseDown=nEventKind==SdrMouseEventKind::BUTTONDOWN;
More information about the Libreoffice-commits
mailing list