From 6e4a2540d4d8ad9e141b87ac3d2123d1c96366ef Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 29 Aug 2019 10:35:23 +0200 Subject: new loplugin:noexceptmove idea from mike kaganski look for places where we can mark move operators as noexcept, which makes some STL operations more efficient Change-Id: Id732b89d1fcadd5ceb0ea2b9d159fed06136330f Reviewed-on: https://gerrit.libreoffice.org/78251 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/com/sun/star/uno/Reference.h | 4 ++-- include/com/sun/star/uno/Reference.hxx | 4 ++-- include/cppuhelper/weakref.hxx | 2 +- include/osl/pipe.hxx | 4 ++-- include/osl/pipe_decl.hxx | 4 ++-- include/osl/socket.hxx | 4 ++-- include/osl/socket_decl.hxx | 4 ++-- include/registry/registry.hxx | 2 +- include/rtl/byteseq.h | 4 ++-- include/rtl/byteseq.hxx | 4 ++-- include/rtl/ref.hxx | 2 +- include/rtl/string.hxx | 4 ++-- include/rtl/ustring.hxx | 4 ++-- include/sfx2/objsh.hxx | 4 ++-- include/store/store.hxx | 4 ++-- include/tools/globname.hxx | 4 ++-- include/tools/poly.hxx | 4 ++-- include/typelib/typedescription.hxx | 4 ++-- include/uno/dispatcher.hxx | 2 +- include/uno/environment.hxx | 2 +- include/uno/mapping.hxx | 4 ++-- include/unotools/itemholderbase.hxx | 2 +- include/unotools/tempfile.hxx | 2 +- include/vcl/alpha.hxx | 2 +- include/vcl/font.hxx | 4 ++-- include/vcl/region.hxx | 4 ++-- 26 files changed, 44 insertions(+), 44 deletions(-) (limited to 'include') diff --git a/include/com/sun/star/uno/Reference.h b/include/com/sun/star/uno/Reference.h index 5f4c8ddea85f..50afd26a83b4 100644 --- a/include/com/sun/star/uno/Reference.h +++ b/include/com/sun/star/uno/Reference.h @@ -307,7 +307,7 @@ public: @param rRef another reference */ - inline Reference( Reference< interface_type > && rRef ); + inline Reference( Reference< interface_type > && rRef ) noexcept; #endif /** Up-casting conversion constructor: Copies interface reference. @@ -586,7 +586,7 @@ public: @param rRef an interface reference @return this reference */ - inline Reference< interface_type > & SAL_CALL operator = ( Reference< interface_type > && rRef ); + inline Reference< interface_type > & SAL_CALL operator = ( Reference< interface_type > && rRef ) noexcept; #endif /** Queries given interface reference for type interface_type. diff --git a/include/com/sun/star/uno/Reference.hxx b/include/com/sun/star/uno/Reference.hxx index c6869d922d7e..9edbd70d0f88 100644 --- a/include/com/sun/star/uno/Reference.hxx +++ b/include/com/sun/star/uno/Reference.hxx @@ -126,7 +126,7 @@ inline Reference< interface_type >::Reference( const Reference< interface_type > #if defined LIBO_INTERNAL_ONLY template< class interface_type > -inline Reference< interface_type >::Reference( Reference< interface_type > && rRef ) +inline Reference< interface_type >::Reference( Reference< interface_type > && rRef ) noexcept { _pInterface = rRef._pInterface; rRef._pInterface = nullptr; @@ -353,7 +353,7 @@ inline Reference< interface_type > & Reference< interface_type >::operator = ( #if defined LIBO_INTERNAL_ONLY template< class interface_type > inline Reference< interface_type > & Reference< interface_type >::operator = ( - Reference< interface_type > && rRef ) + Reference< interface_type > && rRef ) noexcept { if (_pInterface) _pInterface->release(); diff --git a/include/cppuhelper/weakref.hxx b/include/cppuhelper/weakref.hxx index cd05d3bee39b..c681284bac77 100644 --- a/include/cppuhelper/weakref.hxx +++ b/include/cppuhelper/weakref.hxx @@ -64,7 +64,7 @@ public: WeakReferenceHelper( const WeakReferenceHelper & rWeakRef ); #if defined LIBO_INTERNAL_ONLY - WeakReferenceHelper(WeakReferenceHelper && other): m_pImpl(other.m_pImpl) + WeakReferenceHelper(WeakReferenceHelper && other) noexcept : m_pImpl(other.m_pImpl) { other.m_pImpl = nullptr; } #endif diff --git a/include/osl/pipe.hxx b/include/osl/pipe.hxx index e9cfe2e6c3f0..50022b7545c8 100644 --- a/include/osl/pipe.hxx +++ b/include/osl/pipe.hxx @@ -51,7 +51,7 @@ namespace osl } #if defined LIBO_INTERNAL_ONLY - Pipe::Pipe(Pipe && other): m_handle(other.m_handle) { + Pipe::Pipe(Pipe && other) noexcept : m_handle(other.m_handle) { other.m_handle = nullptr; } #endif @@ -97,7 +97,7 @@ namespace osl } #if defined LIBO_INTERNAL_ONLY - Pipe & Pipe::operator =(Pipe && other) { + Pipe & Pipe::operator =(Pipe && other) noexcept { if (m_handle != nullptr) { osl_releasePipe(m_handle); } diff --git a/include/osl/pipe_decl.hxx b/include/osl/pipe_decl.hxx index 146b77a5624e..57f2c76b1c7c 100644 --- a/include/osl/pipe_decl.hxx +++ b/include/osl/pipe_decl.hxx @@ -59,7 +59,7 @@ public: inline Pipe(const Pipe& pipe); #if defined LIBO_INTERNAL_ONLY - inline Pipe(Pipe && other); + inline Pipe(Pipe && other) noexcept; #endif /** Constructs a Pipe reference without acquiring the handle @@ -108,7 +108,7 @@ public: inline Pipe& SAL_CALL operator= (const Pipe& pipe); #if defined LIBO_INTERNAL_ONLY - inline Pipe & operator =(Pipe && other); + inline Pipe & operator =(Pipe && other) noexcept; #endif /** Assignment operator. If pipe was already created, the old one will diff --git a/include/osl/socket.hxx b/include/osl/socket.hxx index 0227095df089..640880144177 100644 --- a/include/osl/socket.hxx +++ b/include/osl/socket.hxx @@ -35,7 +35,7 @@ namespace osl } #if defined LIBO_INTERNAL_ONLY - SocketAddr::SocketAddr(SocketAddr && other): m_handle(other.m_handle) { + SocketAddr::SocketAddr(SocketAddr && other) noexcept : m_handle(other.m_handle) { other.m_handle = nullptr; } #endif @@ -141,7 +141,7 @@ namespace osl } #if defined LIBO_INTERNAL_ONLY - SocketAddr & SocketAddr::operator =(SocketAddr && other) { + SocketAddr & SocketAddr::operator =(SocketAddr && other) noexcept { if (m_handle != nullptr) { osl_destroySocketAddr(m_handle); } diff --git a/include/osl/socket_decl.hxx b/include/osl/socket_decl.hxx index 3d2a05634348..25916897d0f9 100644 --- a/include/osl/socket_decl.hxx +++ b/include/osl/socket_decl.hxx @@ -51,7 +51,7 @@ namespace osl inline SocketAddr(const SocketAddr& Addr); #if defined LIBO_INTERNAL_ONLY - inline SocketAddr(SocketAddr && other); + inline SocketAddr(SocketAddr && other) noexcept; #endif /** The SocketAddr takes over the responsibility of the handle (which means @@ -141,7 +141,7 @@ namespace osl inline SocketAddr & SAL_CALL operator= (const SocketAddr& Addr); #if defined LIBO_INTERNAL_ONLY - inline SocketAddr & operator =(SocketAddr && other); + inline SocketAddr & operator =(SocketAddr && other) noexcept; #endif /** Assigns the socket addr without copyconstructing it. diff --git a/include/registry/registry.hxx b/include/registry/registry.hxx index 200d91b4f426..9e264f4a30bd 100644 --- a/include/registry/registry.hxx +++ b/include/registry/registry.hxx @@ -90,7 +90,7 @@ public: /// Copy constructor inline Registry(const Registry& toCopy); - Registry(Registry && other): m_pApi(other.m_pApi), m_hImpl(other.m_hImpl) + Registry(Registry && other) noexcept : m_pApi(other.m_pApi), m_hImpl(other.m_hImpl) { other.m_hImpl = nullptr; } /// Destructor. The Destructor close the registry if it is open. diff --git a/include/rtl/byteseq.h b/include/rtl/byteseq.h index 0ec93c066652..e47d60e83e00 100644 --- a/include/rtl/byteseq.h +++ b/include/rtl/byteseq.h @@ -190,7 +190,7 @@ public: */ inline ByteSequence( const ByteSequence & rSeq ); #if defined LIBO_INTERNAL_ONLY - inline ByteSequence( ByteSequence && rSeq ); + inline ByteSequence( ByteSequence && rSeq ) noexcept; #endif /** Copy constructor Creates a copy from the C-Handle. @@ -236,7 +236,7 @@ public: */ inline ByteSequence & SAL_CALL operator = ( const ByteSequence & rSeq ); #if defined LIBO_INTERNAL_ONLY - inline ByteSequence & SAL_CALL operator = ( ByteSequence && rSeq ); + inline ByteSequence & SAL_CALL operator = ( ByteSequence && rSeq ) noexcept; #endif /** Gets the length of sequence. diff --git a/include/rtl/byteseq.hxx b/include/rtl/byteseq.hxx index bf287830c77d..597e336e43ad 100644 --- a/include/rtl/byteseq.hxx +++ b/include/rtl/byteseq.hxx @@ -41,7 +41,7 @@ inline ByteSequence::ByteSequence( const ByteSequence & rSeq ) } #if defined LIBO_INTERNAL_ONLY -inline ByteSequence::ByteSequence( ByteSequence && rSeq ) +inline ByteSequence::ByteSequence( ByteSequence && rSeq ) noexcept : _pSequence(rSeq._pSequence) { rSeq._pSequence = nullptr; @@ -95,7 +95,7 @@ inline ByteSequence & ByteSequence::operator = ( const ByteSequence & rSeq ) } #if defined LIBO_INTERNAL_ONLY -inline ByteSequence & ByteSequence::operator = ( ByteSequence && rSeq ) +inline ByteSequence & ByteSequence::operator = ( ByteSequence && rSeq ) noexcept { ::rtl_byte_sequence_release(_pSequence); _pSequence = rSeq._pSequence; diff --git a/include/rtl/ref.hxx b/include/rtl/ref.hxx index 73c03ff7657d..b0324d99313d 100644 --- a/include/rtl/ref.hxx +++ b/include/rtl/ref.hxx @@ -77,7 +77,7 @@ public: #ifdef LIBO_INTERNAL_ONLY /** Move constructor... */ - Reference (Reference && handle) + Reference (Reference && handle) noexcept : m_pBody (handle.m_pBody) { handle.m_pBody = nullptr; diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx index 3b33ee4f1ae5..d06a1b727394 100644 --- a/include/rtl/string.hxx +++ b/include/rtl/string.hxx @@ -129,7 +129,7 @@ public: @param str an OString. @since LibreOffice 5.2 */ - OString( OString && str ) + OString( OString && str ) noexcept { pData = str.pData; str.pData = nullptr; @@ -313,7 +313,7 @@ public: @param str an OString. @since LibreOffice 5.2 */ - OString & operator=( OString && str ) + OString & operator=( OString && str ) noexcept { rtl_string_release( pData ); pData = str.pData; diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx index 8050e0af9c41..18b717fd2b04 100644 --- a/include/rtl/ustring.hxx +++ b/include/rtl/ustring.hxx @@ -158,7 +158,7 @@ public: @param str an OUString. @since LibreOffice 5.2 */ - OUString( OUString && str ) + OUString( OUString && str ) noexcept { pData = str.pData; str.pData = nullptr; @@ -462,7 +462,7 @@ public: @param str an OUString. @since LibreOffice 5.2 */ - OUString & operator=( OUString && str ) + OUString & operator=( OUString && str ) noexcept { rtl_uString_release( pData ); pData = str.pData; diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index a25d60aa2db1..53797278c056 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -778,7 +778,7 @@ protected: public: SfxObjectShellLock() { pObj = nullptr; } inline SfxObjectShellLock( const SfxObjectShellLock & rObj ); - inline SfxObjectShellLock( SfxObjectShellLock && rObj ); + inline SfxObjectShellLock( SfxObjectShellLock && rObj ) noexcept; inline SfxObjectShellLock( SfxObjectShell * pObjP ); inline void Clear(); inline ~SfxObjectShellLock(); @@ -797,7 +797,7 @@ inline SfxObjectShellLock::SfxObjectShellLock( const SfxObjectShellLock & rObj ) if( pObj ) pObj->OwnerLock( true ); } -inline SfxObjectShellLock::SfxObjectShellLock( SfxObjectShellLock && rObj ) +inline SfxObjectShellLock::SfxObjectShellLock( SfxObjectShellLock && rObj ) noexcept { pObj = rObj.pObj; rObj.pObj = nullptr; diff --git a/include/store/store.hxx b/include/store/store.hxx index fb4b430c5f2e..c4f4ce6db5fb 100644 --- a/include/store/store.hxx +++ b/include/store/store.hxx @@ -147,7 +147,7 @@ public: /** Move construction. */ - OStoreDirectory (OStoreDirectory && rhs) + OStoreDirectory (OStoreDirectory && rhs) noexcept : m_hImpl (rhs.m_hImpl) { rhs.m_hImpl = nullptr; @@ -167,7 +167,7 @@ public: /** Move assignment. */ - OStoreDirectory & operator= (OStoreDirectory && rhs) + OStoreDirectory & operator= (OStoreDirectory && rhs) noexcept { if (m_hImpl) (void) store_releaseHandle (m_hImpl); diff --git a/include/tools/globname.hxx b/include/tools/globname.hxx index 3280cb69a2f6..9672f444ccad 100644 --- a/include/tools/globname.hxx +++ b/include/tools/globname.hxx @@ -60,7 +60,7 @@ public: pImp( rObj.pImp ) { } - SvGlobalName( SvGlobalName && rObj ) : + SvGlobalName( SvGlobalName && rObj ) noexcept : pImp( std::move(rObj.pImp) ) { } @@ -75,7 +75,7 @@ public: SvGlobalName( const SvGUID & rId ); SvGlobalName & operator = ( const SvGlobalName & rObj ); - SvGlobalName & operator = ( SvGlobalName && rObj ); + SvGlobalName & operator = ( SvGlobalName && rObj ) noexcept; ~SvGlobalName(); TOOLS_DLLPUBLIC friend SvStream & operator >> ( SvStream &, SvGlobalName & ); diff --git a/include/tools/poly.hxx b/include/tools/poly.hxx index b0c6190b6eb8..aed40ece0367 100644 --- a/include/tools/poly.hxx +++ b/include/tools/poly.hxx @@ -98,7 +98,7 @@ public: sal_uInt16 nPoints ); Polygon( const tools::Polygon& rPoly ); - Polygon( tools::Polygon&& rPoly); + Polygon( tools::Polygon&& rPoly) noexcept; ~Polygon(); void SetPoint( const Point& rPt, sal_uInt16 nPos ); @@ -155,7 +155,7 @@ public: Point& operator[]( sal_uInt16 nPos ); tools::Polygon& operator=( const tools::Polygon& rPoly ); - tools::Polygon& operator=( tools::Polygon&& rPoly ); + tools::Polygon& operator=( tools::Polygon&& rPoly ) noexcept; bool operator==( const tools::Polygon& rPoly ) const; bool operator!=( const tools::Polygon& rPoly ) const { return !(Polygon::operator==( rPoly )); } diff --git a/include/typelib/typedescription.hxx b/include/typelib/typedescription.hxx index ae8599bb1fdd..bfe7596801ea 100644 --- a/include/typelib/typedescription.hxx +++ b/include/typelib/typedescription.hxx @@ -83,7 +83,7 @@ public: */ inline TypeDescription( const TypeDescription & rDescr ); #if defined LIBO_INTERNAL_ONLY - TypeDescription(TypeDescription && other): _pTypeDescr(other._pTypeDescr) + TypeDescription(TypeDescription && other) noexcept : _pTypeDescr(other._pTypeDescr) { other._pTypeDescr = nullptr; } #endif /** Constructor: @@ -115,7 +115,7 @@ public: { return this->operator =( rTypeDescr.get() ); } #if defined LIBO_INTERNAL_ONLY - TypeDescription & operator =(TypeDescription && other) { + TypeDescription & operator =(TypeDescription && other) noexcept { if (_pTypeDescr != nullptr) { typelib_typedescription_release(_pTypeDescr); } diff --git a/include/uno/dispatcher.hxx b/include/uno/dispatcher.hxx index bfd00d46b374..f23268e55593 100644 --- a/include/uno/dispatcher.hxx +++ b/include/uno/dispatcher.hxx @@ -59,7 +59,7 @@ public: inline UnoInterfaceReference( UnoInterfaceReference const & ref ); #if defined LIBO_INTERNAL_ONLY - UnoInterfaceReference(UnoInterfaceReference && other): + UnoInterfaceReference(UnoInterfaceReference && other) noexcept : m_pUnoI(other.m_pUnoI) { other.m_pUnoI = nullptr; } #endif diff --git a/include/uno/environment.hxx b/include/uno/environment.hxx index 5d5ef86021ef..0484790cfa36 100644 --- a/include/uno/environment.hxx +++ b/include/uno/environment.hxx @@ -95,7 +95,7 @@ public: inline Environment( const Environment & rEnv ); #if defined LIBO_INTERNAL_ONLY - Environment(Environment && other): _pEnv(other._pEnv) + Environment(Environment && other) noexcept : _pEnv(other._pEnv) { other._pEnv = nullptr; } #endif diff --git a/include/uno/mapping.hxx b/include/uno/mapping.hxx index a575f251539f..be21909eb5c6 100644 --- a/include/uno/mapping.hxx +++ b/include/uno/mapping.hxx @@ -111,7 +111,7 @@ public: inline Mapping( const Mapping & rMapping ); #if defined LIBO_INTERNAL_ONLY - Mapping(Mapping && other): _pMapping(other._pMapping) + Mapping(Mapping && other) noexcept : _pMapping(other._pMapping) { other._pMapping = nullptr; } #endif @@ -134,7 +134,7 @@ public: { return operator = ( rMapping._pMapping ); } #if defined LIBO_INTERNAL_ONLY - Mapping & operator =(Mapping && other) { + Mapping & operator =(Mapping && other) noexcept { if (_pMapping != nullptr) { (*_pMapping->release)(_pMapping); } diff --git a/include/unotools/itemholderbase.hxx b/include/unotools/itemholderbase.hxx index b401de3435c1..eeb5fa6ee9c0 100644 --- a/include/unotools/itemholderbase.hxx +++ b/include/unotools/itemholderbase.hxx @@ -83,7 +83,7 @@ struct TItemInfo { } - TItemInfo(TItemInfo&& other) + TItemInfo(TItemInfo&& other) noexcept : pItem(std::move(other.pItem)) , eItem(other.eItem) { diff --git a/include/unotools/tempfile.hxx b/include/unotools/tempfile.hxx index b77d6e3a798f..b20a4f2fdf40 100644 --- a/include/unotools/tempfile.hxx +++ b/include/unotools/tempfile.hxx @@ -71,7 +71,7 @@ public: TempFile( const OUString& rLeadingChars, bool _bStartWithZero=true, const OUString* pExtension=nullptr, const OUString* pParent=nullptr, bool bCreateParentDirs=false ); - TempFile(TempFile && other); + TempFile(TempFile && other) noexcept; /** TempFile will be removed from disk in dtor if EnableKillingFile(true) was called before. diff --git a/include/vcl/alpha.hxx b/include/vcl/alpha.hxx index b0ea775e1516..f87ac133970a 100644 --- a/include/vcl/alpha.hxx +++ b/include/vcl/alpha.hxx @@ -42,7 +42,7 @@ public: AlphaMask& operator=( const Bitmap& rBitmap ); AlphaMask& operator=( const AlphaMask& rAlphaMask ) { return static_cast( Bitmap::operator=( rAlphaMask ) ); } - AlphaMask& operator=( AlphaMask&& rAlphaMask ) { return static_cast( Bitmap::operator=( std::move(rAlphaMask) ) ); } + AlphaMask& operator=( AlphaMask&& rAlphaMask ) noexcept { return static_cast( Bitmap::operator=( std::move(rAlphaMask) ) ); } bool operator!() const { return Bitmap::operator!(); } bool operator==( const AlphaMask& rAlphaMask ) const { return Bitmap::operator==(rAlphaMask); } bool operator!=( const AlphaMask& rAlphaMask ) const { return Bitmap::operator!=(rAlphaMask); } diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx index 34ccf2ab5dd4..ac8c6d4c2153 100644 --- a/include/vcl/font.hxx +++ b/include/vcl/font.hxx @@ -48,7 +48,7 @@ class VCL_DLLPUBLIC Font public: explicit Font(); Font( const Font& ); // TODO make me explicit - Font( Font&& ); + Font( Font&& ) noexcept; explicit Font( const OUString& rFamilyName, const Size& ); explicit Font( const OUString& rFamilyName, const OUString& rStyleName, const Size& ); explicit Font( FontFamily eFamily, const Size& ); @@ -150,7 +150,7 @@ public: void GetFontAttributes( FontAttributes& rAttrs ) const; Font& operator=( const Font& ); - Font& operator=( Font&& ); + Font& operator=( Font&& ) noexcept; bool operator==( const Font& ) const; bool operator!=( const Font& rFont ) const { return !(Font::operator==( rFont )); } diff --git a/include/vcl/region.hxx b/include/vcl/region.hxx index 3edcaa033636..faa2da61141d 100644 --- a/include/vcl/region.hxx +++ b/include/vcl/region.hxx @@ -72,7 +72,7 @@ public: explicit Region(const tools::PolyPolygon& rPolyPoly); explicit Region(const basegfx::B2DPolyPolygon&); Region(const vcl::Region& rRegion); - Region(vcl::Region&& rRegion); + Region(vcl::Region&& rRegion) noexcept; ~Region(); // direct access to contents @@ -114,7 +114,7 @@ public: bool IsOver( const tools::Rectangle& rRect ) const; vcl::Region& operator=( const vcl::Region& rRegion ); - vcl::Region& operator=( vcl::Region&& rRegion ); + vcl::Region& operator=( vcl::Region&& rRegion ) noexcept; vcl::Region& operator=( const tools::Rectangle& rRect ); bool operator==( const vcl::Region& rRegion ) const; -- cgit