suppress COPY_INSTEAD_OF_MOVE suggestions for uno::Reference

rtl::Reference, uno::Any and rtl::O[U]String

where we have implemented move ctors to take let the compiler take
advantage of any little optimization possibility that it can take
but where the potential optimization probably doesn't outweigh
enforcing dusting error-prone std::move all over every case where
the compiler doesn't/can't use the move ctor but could.

Change-Id: Icf184d96d3278a1740a76c7eb1150e60392351ab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162337
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara 2024-01-01 20:24:22 +00:00
parent 93e3443f6c
commit db44ffd219
7 changed files with 15 additions and 0 deletions

View file

@ -146,7 +146,9 @@ public:
inline Any & SAL_CALL operator = ( const Any & rAny );
#if defined LIBO_INTERNAL_ONLY
#if !defined(__COVERITY__) // suppress COPY_INSTEAD_OF_MOVE suggestions
inline Any(Any && other) noexcept;
#endif
inline Any & operator =(Any && other) noexcept;
#endif

View file

@ -133,6 +133,7 @@ inline Any & Any::operator = ( const Any & rAny )
#if defined LIBO_INTERNAL_ONLY
#if !defined(__COVERITY__) // suppress COPY_INSTEAD_OF_MOVE suggestions
Any::Any(Any && other) noexcept {
uno_any_construct(this, nullptr, nullptr, &cpp_acquire);
std::swap(other.pType, pType);
@ -146,6 +147,7 @@ Any::Any(Any && other) noexcept {
// only that it isn't a nullptr (as e.g. >>= -> uno_type_assignData ->
// _assignData takes a null pSource to mean "construct a default value").
}
#endif
Any & Any::operator =(Any && other) noexcept {
std::swap(other.pType, pType);

View file

@ -264,7 +264,9 @@ public:
@param rRef another reference
*/
#if !defined(__COVERITY__) // suppress COPY_INSTEAD_OF_MOVE suggestions
inline Reference( Reference< interface_type > && rRef ) noexcept;
#endif
/** Up-casting conversion constructor: Copies interface reference.

View file

@ -129,12 +129,15 @@ inline Reference< interface_type >::Reference( const Reference< interface_type >
}
#if defined LIBO_INTERNAL_ONLY
#if !defined(__COVERITY__)
template< class interface_type >
inline Reference< interface_type >::Reference( Reference< interface_type > && rRef ) noexcept
{
_pInterface = rRef._pInterface;
rRef._pInterface = nullptr;
}
#endif
template< class interface_type > template< class derived_type >
inline Reference< interface_type >::Reference(

View file

@ -83,6 +83,7 @@ public:
}
#ifdef LIBO_INTERNAL_ONLY
#if !defined(__COVERITY__) // suppress COPY_INSTEAD_OF_MOVE suggestions
/** Move constructor...
*/
Reference (Reference<reference_type> && handle) noexcept
@ -91,6 +92,7 @@ public:
handle.m_pBody = nullptr;
}
#endif
#endif
#if defined LIBO_INTERNAL_ONLY
/** Up-casting conversion constructor: Copies interface reference.

View file

@ -229,6 +229,7 @@ public:
}
#if defined LIBO_INTERNAL_ONLY
#if !defined(__COVERITY__) // suppress COPY_INSTEAD_OF_MOVE suggestions
/**
Move constructor.
@ -255,6 +256,7 @@ public:
str.pData = nullptr;
rtl_string_new( &str.pData );
}
#endif
#endif
/**

View file

@ -208,6 +208,7 @@ public:
}
#if defined LIBO_INTERNAL_ONLY
#if !defined(__COVERITY__) // suppress COPY_INSTEAD_OF_MOVE suggestions
/**
Move constructor.
@ -234,6 +235,7 @@ public:
str.pData = nullptr;
rtl_uString_new( &str.pData );
}
#endif
#endif
/**