summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-09-18 14:15:59 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-09-19 11:42:47 +0200
commit82572caae4a282cdf79456b977508ca71507c584 (patch)
treebefc8478f8cd9bf7e7c9a87a776b063a9ed4b718
parent71ef762f21ada8c25aad2183065478171e985e8c (diff)
improve and enable loplugin:fragiledestructor
Where the problem was benign and the class was not extended, I marked the class as final. Where the problem was benign and the class was extended, I marked the relevant callee methods as final. Other cases were excluded in the plugin. Change-Id: Idb762fb2206af4e8b534aa35ff77f8368c7909bc Reviewed-on: https://gerrit.libreoffice.org/79089 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx2
-rw-r--r--compilerplugins/clang/fragiledestructor.cxx113
-rw-r--r--compilerplugins/clang/test/fragiledestructor.cxx88
-rw-r--r--connectivity/source/drivers/evoab2/NConnection.hxx2
-rw-r--r--connectivity/source/drivers/evoab2/NResultSet.cxx4
-rw-r--r--connectivity/source/drivers/firebird/Connection.hxx2
-rw-r--r--connectivity/source/inc/file/FConnection.hxx4
-rw-r--r--connectivity/source/inc/file/FResultSet.hxx2
-rw-r--r--connectivity/source/inc/odbc/OConnection.hxx4
-rw-r--r--cppuhelper/source/weak.cxx2
-rw-r--r--formula/source/core/api/token.cxx2
-rw-r--r--include/oox/helper/binaryinputstream.hxx2
-rw-r--r--include/oox/helper/binaryoutputstream.hxx2
-rw-r--r--include/svx/fmgridif.hxx4
-rw-r--r--sc/inc/chgtrack.hxx4
-rw-r--r--sd/source/ui/inc/sdxfer.hxx2
-rw-r--r--sd/source/ui/slideshow/slideshowimpl.hxx2
-rw-r--r--solenv/CompilerTest_compilerplugins_clang.mk1
-rw-r--r--sw/inc/finalthreadmanager.hxx2
-rw-r--r--sw/inc/section.hxx3
-rw-r--r--ucb/source/ucp/file/filinpstr.hxx2
-rw-r--r--ucb/source/ucp/gio/gio_inputstream.hxx2
-rw-r--r--ucb/source/ucp/gio/gio_outputstream.hxx2
-rw-r--r--vcl/inc/unx/gtk/gtkdata.hxx2
-rw-r--r--vcl/inc/unx/salbmp.h2
-rw-r--r--vcl/inc/unx/salframe.h2
-rw-r--r--vcl/source/app/svdata.cxx2
-rw-r--r--vcl/unx/generic/printer/printerinfomanager.cxx2
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx4
-rw-r--r--vcl/workben/vcldemo.cxx2
30 files changed, 193 insertions, 76 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx
index 350e5df4e6a2..faf45a8b0590 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx
@@ -64,7 +64,7 @@ public:
~GeneratedPad() override { get()->~type_info(); }
- std::type_info * get() const override
+ std::type_info * get() const override final
{ return reinterpret_cast<std::type_info *>(pad_.get()); }
private:
diff --git a/compilerplugins/clang/fragiledestructor.cxx b/compilerplugins/clang/fragiledestructor.cxx
index 1631cb30c1e9..a1a09a2e6081 100644
--- a/compilerplugins/clang/fragiledestructor.cxx
+++ b/compilerplugins/clang/fragiledestructor.cxx
@@ -6,6 +6,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#ifndef LO_CLANG_SHARED_PLUGINS
#include <string>
#include <iostream>
@@ -28,71 +29,99 @@ public:
explicit FragileDestructor(loplugin::InstantiationData const & data):
FilteringPlugin(data) {}
- virtual void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
+ virtual bool preRun() override
+ {
+ StringRef fn(handler.getMainFileName());
+
+ // TODO, these all need fixing
+
+ if (loplugin::isSamePathname(fn, SRCDIR "/comphelper/source/misc/proxyaggregation.cxx"))
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/svx/source/svdraw/svdpntv.cxx")) // ~SdrPaintView calling ClearPageView
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/svx/source/svdraw/svdobj.cxx")) // ~SdrObject calling GetLastBoundRect
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/svx/source/svdraw/svdedxv.cxx")) // ~SdrObjEditView calling SdrEndTextEdit
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/connectivity/source/drivers/file/FStatement.cxx")) // ~OStatement_Base calling disposing
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sd/source/core/CustomAnimationEffect.cxx")) // ~EffectSequenceHelper calling reset
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sd/source/ui/view/sdview.cxx")) // ~View calling DeleteWindowFromPaintView
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/core/layout/ssfrm.cxx")) // ~SwFrame calling IsDeleteForbidden
+ return false;
- bool TraverseCXXDestructorDecl(CXXDestructorDecl *);
+ return true;
+ }
+
+ virtual void run() override
+ {
+ if (preRun())
+ TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+ }
+ bool PreTraverseCXXDestructorDecl(CXXDestructorDecl*);
+ bool PostTraverseCXXDestructorDecl(CXXDestructorDecl*, bool);
+ bool TraverseCXXDestructorDecl(CXXDestructorDecl*);
bool VisitCXXMemberCallExpr(const CXXMemberCallExpr *);
private:
- bool mbChecking = false;
+ std::vector<CXXDestructorDecl*> m_vDestructors;
};
-bool FragileDestructor::TraverseCXXDestructorDecl(CXXDestructorDecl* pCXXDestructorDecl)
+bool FragileDestructor::PreTraverseCXXDestructorDecl(CXXDestructorDecl* cxxDestructorDecl)
{
- if (ignoreLocation(pCXXDestructorDecl)) {
- return RecursiveASTVisitor::TraverseCXXDestructorDecl(pCXXDestructorDecl);
- }
- if (!pCXXDestructorDecl->isThisDeclarationADefinition()) {
- return RecursiveASTVisitor::TraverseCXXDestructorDecl(pCXXDestructorDecl);
- }
- // ignore this for now, too tricky for me to work out
- StringRef aFileName = getFileNameOfSpellingLoc(
- compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(pCXXDestructorDecl)));
- if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/include/comphelper/")
- || loplugin::hasPathnamePrefix(aFileName, SRCDIR "/include/cppuhelper/")
- || loplugin::hasPathnamePrefix(aFileName, SRCDIR "/cppuhelper/")
- || loplugin::hasPathnamePrefix(aFileName, SRCDIR "/comphelper/")
- // don't know how to detect this in clang - it is making an explicit call to its own method, so presumably OK
- || loplugin::isSamePathname(aFileName, SRCDIR "/basic/source/sbx/sbxvalue.cxx")
- )
- return RecursiveASTVisitor::TraverseCXXDestructorDecl(pCXXDestructorDecl);
- mbChecking = true;
- bool ret = RecursiveASTVisitor::TraverseCXXDestructorDecl(pCXXDestructorDecl);
- mbChecking = false;
+ if (ignoreLocation(cxxDestructorDecl))
+ return true;
+ if (!cxxDestructorDecl->isThisDeclarationADefinition())
+ return true;
+ if (cxxDestructorDecl->getParent()->hasAttr<FinalAttr>())
+ return true;
+ m_vDestructors.push_back(cxxDestructorDecl);
+ return true;
+}
+
+bool FragileDestructor::PostTraverseCXXDestructorDecl(CXXDestructorDecl* cxxDestructorDecl, bool)
+{
+ if (!m_vDestructors.empty() && m_vDestructors.back() == cxxDestructorDecl)
+ m_vDestructors.pop_back();
+ return true;
+}
+
+bool FragileDestructor::TraverseCXXDestructorDecl(CXXDestructorDecl* cxxDestructorDecl)
+{
+ PreTraverseCXXDestructorDecl(cxxDestructorDecl);
+ auto ret = FilteringPlugin::TraverseCXXDestructorDecl(cxxDestructorDecl);
+ PostTraverseCXXDestructorDecl(cxxDestructorDecl, ret);
return ret;
}
bool FragileDestructor::VisitCXXMemberCallExpr(const CXXMemberCallExpr* callExpr)
{
- if (!mbChecking || ignoreLocation(callExpr)) {
+ if (m_vDestructors.empty() || ignoreLocation(callExpr))
return true;
- }
const CXXMethodDecl* methodDecl = callExpr->getMethodDecl();
- if (!methodDecl->isVirtual() || methodDecl->hasAttr<FinalAttr>()) {
+ if (!methodDecl->isVirtual() || methodDecl->hasAttr<FinalAttr>())
return true;
- }
const CXXRecordDecl* parentRecordDecl = methodDecl->getParent();
- if (parentRecordDecl->hasAttr<FinalAttr>()) {
+ if (parentRecordDecl->hasAttr<FinalAttr>())
return true;
- }
- if (!callExpr->getImplicitObjectArgument()->IgnoreImpCasts()->isImplicitCXXThis()) {
+ if (!callExpr->getImplicitObjectArgument()->IgnoreImpCasts()->isImplicitCXXThis())
return true;
- }
+
// if we see an explicit call to its own method, that's OK
auto s1 = compiler.getSourceManager().getCharacterData(compat::getBeginLoc(callExpr));
auto s2 = compiler.getSourceManager().getCharacterData(compat::getEndLoc(callExpr));
std::string tok(s1, s2-s1);
- if (tok.find("::") != std::string::npos) {
+ if (tok.find("::") != std::string::npos)
return true;
- }
- // e.g. osl/thread.hxx and cppuhelper/compbase.hxx
- StringRef aFileName = getFileNameOfSpellingLoc(
- compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(methodDecl)));
- if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/include/osl/")
- || loplugin::hasPathnamePrefix(aFileName, SRCDIR "/include/comphelper/")
- || loplugin::hasPathnamePrefix(aFileName, SRCDIR "/include/cppuhelper/"))
+
+ // Very common pattern that we call acquire/dispose in destructors of UNO objects
+ // to make sure they are cleaned up.
+ if (methodDecl->getName() == "acquire" || methodDecl->getName() == "dispose")
return true;
+
report(
DiagnosticsEngine::Warning,
"calling virtual method from destructor, either make the virtual method final, or make this class final",
@@ -107,8 +136,10 @@ bool FragileDestructor::VisitCXXMemberCallExpr(const CXXMemberCallExpr* callExpr
}
-loplugin::Plugin::Registration< FragileDestructor > X("fragiledestructor", false);
+loplugin::Plugin::Registration<FragileDestructor> fragiledestructor("fragiledestructor");
}
+#endif // LO_CLANG_SHARED_PLUGINS
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/compilerplugins/clang/test/fragiledestructor.cxx b/compilerplugins/clang/test/fragiledestructor.cxx
new file mode 100644
index 000000000000..e2fbfc59660d
--- /dev/null
+++ b/compilerplugins/clang/test/fragiledestructor.cxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "sal/config.h"
+
+// no warning expected
+namespace test1
+{
+class Foo
+{
+ ~Foo() { f(); }
+ void f();
+};
+}
+
+namespace test2
+{
+class Foo
+{
+ ~Foo() { f(); }
+ // expected-error@-1 {{calling virtual method from destructor, either make the virtual method final, or make this class final [loplugin:fragiledestructor]}}
+ virtual void f();
+ // expected-note@-1 {{callee method here [loplugin:fragiledestructor]}}
+};
+}
+
+// no warning expected
+namespace test3
+{
+class Foo final
+{
+ ~Foo() { f(); }
+ virtual void f();
+};
+}
+
+namespace test4
+{
+struct Bar
+{
+ virtual ~Bar();
+ virtual void f();
+ // expected-note@-1 {{callee method here [loplugin:fragiledestructor]}}
+};
+class Foo : public Bar
+{
+ ~Foo() { f(); }
+ // expected-error@-1 {{calling virtual method from destructor, either make the virtual method final, or make this class final [loplugin:fragiledestructor]}}
+};
+}
+
+// no warning expected
+namespace test5
+{
+struct Bar
+{
+ virtual ~Bar();
+ virtual void f();
+};
+class Foo : public Bar
+{
+ ~Foo() { f(); }
+ virtual void f() final override;
+};
+}
+
+// no warning expected
+namespace test6
+{
+struct Bar
+{
+ virtual ~Bar();
+ virtual void f();
+};
+class Foo : public Bar
+{
+ ~Foo() { Foo::f(); }
+ virtual void f() override;
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/evoab2/NConnection.hxx b/connectivity/source/drivers/evoab2/NConnection.hxx
index 2b2737927b53..2ba2a8db7ea8 100644
--- a/connectivity/source/drivers/evoab2/NConnection.hxx
+++ b/connectivity/source/drivers/evoab2/NConnection.hxx
@@ -47,7 +47,7 @@ namespace connectivity
typedef connectivity::OMetaConnection OConnection_BASE; // implements basics and text encoding
- class OEvoabConnection :public OConnection_BASE
+ class OEvoabConnection final :public OConnection_BASE
{
private:
const OEvoabDriver& m_rDriver;
diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx
index 0c438f650479..28c7278f2010 100644
--- a/connectivity/source/drivers/evoab2/NResultSet.cxx
+++ b/connectivity/source/drivers/evoab2/NResultSet.cxx
@@ -435,7 +435,7 @@ public:
return isBookBackend(pBook, "local");
}
- virtual void freeContacts() override
+ virtual void freeContacts() override final
{
e_client_util_free_object_slist(m_pContacts);
m_pContacts = nullptr;
@@ -560,7 +560,7 @@ public:
!strncmp( "local:", e_book_get_uri( pBook ), 6 ) );
}
- virtual void freeContacts() override
+ virtual void freeContacts() override final
{
g_list_free(m_pContacts);
m_pContacts = nullptr;
diff --git a/connectivity/source/drivers/firebird/Connection.hxx b/connectivity/source/drivers/firebird/Connection.hxx
index f1d4f7dd8003..d6e70fdbee63 100644
--- a/connectivity/source/drivers/firebird/Connection.hxx
+++ b/connectivity/source/drivers/firebird/Connection.hxx
@@ -66,7 +66,7 @@ namespace connectivity
typedef std::vector< ::connectivity::OTypeInfo> TTypeInfoVector;
typedef std::vector< css::uno::WeakReferenceHelper > OWeakRefArray;
- class Connection : public Connection_BASE
+ class Connection final : public Connection_BASE
{
::osl::Mutex m_aMutex;
diff --git a/connectivity/source/inc/file/FConnection.hxx b/connectivity/source/inc/file/FConnection.hxx
index 4041e060816f..e791e6ec3f07 100644
--- a/connectivity/source/inc/file/FConnection.hxx
+++ b/connectivity/source/inc/file/FConnection.hxx
@@ -90,7 +90,7 @@ namespace connectivity
virtual sal_Bool SAL_CALL getAutoCommit( ) override;
virtual void SAL_CALL commit( ) override;
virtual void SAL_CALL rollback( ) override;
- virtual sal_Bool SAL_CALL isClosed( ) override;
+ virtual sal_Bool SAL_CALL isClosed( ) override final;
virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override;
virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override;
virtual sal_Bool SAL_CALL isReadOnly( ) override;
@@ -101,7 +101,7 @@ namespace connectivity
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override;
virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override;
// XCloseable
- virtual void SAL_CALL close( ) override;
+ virtual void SAL_CALL close( ) override final;
// XWarningsSupplier
virtual css::uno::Any SAL_CALL getWarnings( ) override;
virtual void SAL_CALL clearWarnings( ) override;
diff --git a/connectivity/source/inc/file/FResultSet.hxx b/connectivity/source/inc/file/FResultSet.hxx
index 61bc7f033775..71f3d3b95ff5 100644
--- a/connectivity/source/inc/file/FResultSet.hxx
+++ b/connectivity/source/inc/file/FResultSet.hxx
@@ -163,7 +163,7 @@ namespace connectivity
OResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator);
// ::cppu::OComponentHelper
- virtual void SAL_CALL disposing() override;
+ virtual void SAL_CALL disposing() override final;
// XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
virtual void SAL_CALL acquire() throw() override;
diff --git a/connectivity/source/inc/odbc/OConnection.hxx b/connectivity/source/inc/odbc/OConnection.hxx
index 3cfda3792a8e..cb05d7373407 100644
--- a/connectivity/source/inc/odbc/OConnection.hxx
+++ b/connectivity/source/inc/odbc/OConnection.hxx
@@ -43,12 +43,10 @@ namespace connectivity
typedef connectivity::OMetaConnection OConnection_BASE;
typedef std::vector< ::connectivity::OTypeInfo> TTypeInfoVector;
- class OOO_DLLPUBLIC_ODBCBASE OConnection :
+ class OOO_DLLPUBLIC_ODBCBASE OConnection final :
public OConnection_BASE,
public OAutoRetrievingBase
{
- protected:
-
// Data attributes
std::map< SQLHANDLE, rtl::Reference<OConnection>> m_aConnections; // holds all connections which are need for several statements
diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx
index cfb455f54488..a7ef2410eeb8 100644
--- a/cppuhelper/source/weak.cxx
+++ b/cppuhelper/source/weak.cxx
@@ -340,7 +340,7 @@ namespace uno
//-- OWeakRefListener -----------------------------------------------------
-class OWeakRefListener: public XReference
+class OWeakRefListener final : public XReference
{
public:
explicit OWeakRefListener(const Reference< XInterface >& xInt);
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index 3d466feef5ea..bb08d4447e0d 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -577,7 +577,7 @@ FormulaTokenArray::FormulaTokenArray( const FormulaTokenArray& rArr )
FormulaTokenArray::~FormulaTokenArray()
{
- Clear();
+ FormulaTokenArray::Clear();
}
void FormulaTokenArray::Finalize()
diff --git a/include/oox/helper/binaryinputstream.hxx b/include/oox/helper/binaryinputstream.hxx
index 1174b0f61f2f..2e7f2e55012a 100644
--- a/include/oox/helper/binaryinputstream.hxx
+++ b/include/oox/helper/binaryinputstream.hxx
@@ -234,7 +234,7 @@ sal_Int32 BinaryInputStream::readArray( ::std::vector< Type >& orVector, sal_Int
The binary data in the stream is assumed to be in little-endian format.
*/
-class OOX_DLLPUBLIC BinaryXInputStream : public BinaryXSeekableStream, public BinaryInputStream
+class OOX_DLLPUBLIC BinaryXInputStream final : public BinaryXSeekableStream, public BinaryInputStream
{
public:
/** Constructs the wrapper object for the passed input stream.
diff --git a/include/oox/helper/binaryoutputstream.hxx b/include/oox/helper/binaryoutputstream.hxx
index 7041131d81e3..7f7cea6a2115 100644
--- a/include/oox/helper/binaryoutputstream.hxx
+++ b/include/oox/helper/binaryoutputstream.hxx
@@ -125,7 +125,7 @@ void BinaryOutputStream::writeValue( Type nValue )
The binary data in the stream is written in little-endian format.
*/
-class OOX_DLLPUBLIC BinaryXOutputStream : public BinaryXSeekableStream, public BinaryOutputStream
+class OOX_DLLPUBLIC BinaryXOutputStream final : public BinaryXSeekableStream, public BinaryOutputStream
{
public:
/** Constructs the wrapper object for the passed output stream.
diff --git a/include/svx/fmgridif.hxx b/include/svx/fmgridif.hxx
index 38984b191a7e..541dee399e64 100644
--- a/include/svx/fmgridif.hxx
+++ b/include/svx/fmgridif.hxx
@@ -382,7 +382,7 @@ public:
// css::form::XGridPeer
virtual css::uno::Reference< css::container::XIndexContainer > SAL_CALL getColumns( ) override;
- virtual void SAL_CALL setColumns( const css::uno::Reference< css::container::XIndexContainer >& aColumns ) override;
+ virtual void SAL_CALL setColumns( const css::uno::Reference< css::container::XIndexContainer >& aColumns ) override final;
// css::lang::XComponent
virtual void SAL_CALL dispose() override;
@@ -446,7 +446,7 @@ public:
// css::sdb::XRowSetSupplier
virtual css::uno::Reference< css::sdbc::XRowSet > SAL_CALL getRowSet() override;
- virtual void SAL_CALL setRowSet(const css::uno::Reference< css::sdbc::XRowSet >& xDataSource) override;
+ virtual void SAL_CALL setRowSet(const css::uno::Reference< css::sdbc::XRowSet >& xDataSource) override final;
// css::util::XModifyBroadcaster
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener >& l) override;
diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index 9c8cc6ab4b5c..502d463a6c3e 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -426,7 +426,7 @@ public:
short GetCutOffTo() const { return nCutOffTo; }
};
-class ScChangeActionDel : public ScChangeAction
+class ScChangeActionDel final : public ScChangeAction
{
friend class ScChangeTrack;
friend void ScChangeAction::Accept();
@@ -499,7 +499,7 @@ public:
};
// ScChangeActionMove
-class ScChangeActionMove : public ScChangeAction
+class ScChangeActionMove final : public ScChangeAction
{
friend class ScChangeTrack;
friend struct std::default_delete<ScChangeActionMove>; // for std::unique_ptr
diff --git a/sd/source/ui/inc/sdxfer.hxx b/sd/source/ui/inc/sdxfer.hxx
index cd9fca61c58f..bebbcd2c7c11 100644
--- a/sd/source/ui/inc/sdxfer.hxx
+++ b/sd/source/ui/inc/sdxfer.hxx
@@ -107,7 +107,7 @@ protected:
virtual void AddSupportedFormats() override;
virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
virtual bool WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override;
- virtual void ObjectReleased() override;
+ virtual void ObjectReleased() override final;
virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) override;
diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx
index 80cab80c199b..a696064c6836 100644
--- a/sd/source/ui/slideshow/slideshowimpl.hxx
+++ b/sd/source/ui/slideshow/slideshowimpl.hxx
@@ -127,7 +127,7 @@ private:
typedef ::cppu::WeakComponentImplHelper< css::presentation::XSlideShowController, css::container::XIndexAccess > SlideshowImplBase;
-class SlideshowImpl : private ::cppu::BaseMutex, public SlideshowImplBase
+class SlideshowImpl final : private ::cppu::BaseMutex, public SlideshowImplBase
{
friend class SlideShow;
friend class SlideShowView;
diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk
index 167433f7974c..8308ee840008 100644
--- a/solenv/CompilerTest_compilerplugins_clang.mk
+++ b/solenv/CompilerTest_compilerplugins_clang.mk
@@ -33,6 +33,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
compilerplugins/clang/test/faileddyncast \
compilerplugins/clang/test/finalprotected \
compilerplugins/clang/test/flatten \
+ compilerplugins/clang/test/fragiledestructor \
compilerplugins/clang/test/indentation \
compilerplugins/clang/test/logexceptionnicely \
compilerplugins/clang/test/loopvartoosmall \
diff --git a/sw/inc/finalthreadmanager.hxx b/sw/inc/finalthreadmanager.hxx
index 587afbeb83f1..dfdf5407efca 100644
--- a/sw/inc/finalthreadmanager.hxx
+++ b/sw/inc/finalthreadmanager.hxx
@@ -36,7 +36,7 @@ class CancelJobsThread;
class TerminateOfficeThread;
class SwPauseThreadStarting;
-class FinalThreadManager : public ::cppu::WeakImplHelper< css::lang::XServiceInfo,
+class FinalThreadManager final : public ::cppu::WeakImplHelper< css::lang::XServiceInfo,
css::util::XJobManager,
css::frame::XTerminateListener2 >
{
diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx
index bdaff9c102be..1fcbf5028474 100644
--- a/sw/inc/section.hxx
+++ b/sw/inc/section.hxx
@@ -267,7 +267,7 @@ class SwSectionFrameMoveAndDeleteHint : public SfxHint
enum class SectionSort { Not, Pos };
-class SW_DLLPUBLIC SwSectionFormat
+class SW_DLLPUBLIC SwSectionFormat final
: public SwFrameFormat
, public ::sfx2::Metadatable
{
@@ -281,7 +281,6 @@ class SW_DLLPUBLIC SwSectionFormat
SAL_DLLPRIVATE void UpdateParent(); // Parent has been changed.
-protected:
SwSectionFormat( SwFrameFormat* pDrvdFrame, SwDoc *pDoc );
virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) override;
diff --git a/ucb/source/ucp/file/filinpstr.hxx b/ucb/source/ucp/file/filinpstr.hxx
index 92cfb12f134a..37354f258b08 100644
--- a/ucb/source/ucp/file/filinpstr.hxx
+++ b/ucb/source/ucp/file/filinpstr.hxx
@@ -34,7 +34,7 @@ namespace fileaccess {
class TaskManager;
- class XInputStream_impl
+ class XInputStream_impl final
: public cppu::OWeakObject,
public css::lang::XTypeProvider,
public css::io::XInputStream,
diff --git a/ucb/source/ucp/gio/gio_inputstream.hxx b/ucb/source/ucp/gio/gio_inputstream.hxx
index 2ee4eb03e961..2a808ade71d5 100644
--- a/ucb/source/ucp/gio/gio_inputstream.hxx
+++ b/ucb/source/ucp/gio/gio_inputstream.hxx
@@ -31,7 +31,7 @@
namespace gio
{
-class InputStream: public cppu::WeakImplHelper<css::io::XInputStream>
+class InputStream final : public cppu::WeakImplHelper<css::io::XInputStream>
{
private:
GFileInputStream * const mpStream;
diff --git a/ucb/source/ucp/gio/gio_outputstream.hxx b/ucb/source/ucp/gio/gio_outputstream.hxx
index 689cb38dd068..705eb68955c8 100644
--- a/ucb/source/ucp/gio/gio_outputstream.hxx
+++ b/ucb/source/ucp/gio/gio_outputstream.hxx
@@ -33,7 +33,7 @@
namespace gio
{
-class OutputStream :
+class OutputStream final :
public css::io::XOutputStream,
public Seekable
{
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index 2475b20a28d4..f1750b7dc3a6 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -82,7 +82,7 @@ inline void widget_set_can_default(GtkWidget *widget, gboolean can_default)
#endif
}
-class GtkSalTimer : public SalTimer
+class GtkSalTimer final : public SalTimer
{
struct SalGtkTimeoutSource *m_pTimeout;
public:
diff --git a/vcl/inc/unx/salbmp.h b/vcl/inc/unx/salbmp.h
index f889d44349f1..72283421d224 100644
--- a/vcl/inc/unx/salbmp.h
+++ b/vcl/inc/unx/salbmp.h
@@ -34,7 +34,7 @@ class ImplSalDDB;
class ImplSalBitmapCache;
-class VCLPLUG_GEN_PUBLIC X11SalBitmap : public SalBitmap
+class VCLPLUG_GEN_PUBLIC X11SalBitmap final : public SalBitmap
{
private:
diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h
index 7a67f92db49d..a913fc6165b0 100644
--- a/vcl/inc/unx/salframe.h
+++ b/vcl/inc/unx/salframe.h
@@ -58,7 +58,7 @@ enum class WMWindowType
Dock
};
-class VCLPLUG_GEN_PUBLIC X11SalFrame : public SalFrame, public NativeWindowHandleProvider
+class VCLPLUG_GEN_PUBLIC X11SalFrame final : public SalFrame, public NativeWindowHandleProvider
{
friend class vcl_sal::WMAdaptor;
friend class vcl_sal::NetWMAdaptor;
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index cb467f034d4e..d88afef8a40c 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -94,7 +94,7 @@ namespace
{
typedef ::std::map< basegfx::SystemDependentData_SharedPtr, sal_uInt32 > EntryMap;
- class SystemDependentDataBuffer : public basegfx::SystemDependentDataManager, protected cppu::BaseMutex
+ class SystemDependentDataBuffer final : public basegfx::SystemDependentDataManager, protected cppu::BaseMutex
{
private:
std::unique_ptr<AutoTimer> maTimer;
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx
index 333ba10b987e..104c5e04e091 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -46,7 +46,7 @@ using namespace osl;
namespace psp
{
- class SystemQueueInfo : public Thread
+ class SystemQueueInfo final : public Thread
{
mutable Mutex m_aMutex;
bool m_bChanged;
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index be846d27d6b2..c1df1f534a43 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3535,7 +3535,7 @@ public:
}
};
-class GtkInstanceAboutDialog : public GtkInstanceDialog, public virtual weld::AboutDialog
+class GtkInstanceAboutDialog final : public GtkInstanceDialog, public virtual weld::AboutDialog
{
private:
GtkAboutDialog* m_pAboutDialog;
@@ -4154,7 +4154,7 @@ static GtkSelectionMode VclToGtk(SelectionMode eType)
return eRet;
}
-class GtkInstanceScrolledWindow : public GtkInstanceContainer, public virtual weld::ScrolledWindow
+class GtkInstanceScrolledWindow final : public GtkInstanceContainer, public virtual weld::ScrolledWindow
{
private:
GtkScrolledWindow* m_pScrolledWindow;
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 833108467728..29d148158b9a 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -1717,7 +1717,7 @@ class DemoWin : public WorkWindow
bool underTesting;
bool testThreads;
- class RenderThread : public salhelper::Thread {
+ class RenderThread final : public salhelper::Thread {
DemoWin &mrWin;
sal_uInt32 const mnDelaySecs = 0;
public: