clang-tidy modernize-pass-by-value in stoc

Change-Id: Ia628b2af646e576d52b6c72352255710a885c23f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136452
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2022-06-27 09:46:16 +02:00
parent 04073c5fed
commit 69485e422c
19 changed files with 76 additions and 61 deletions

View File

@@ -153,7 +153,7 @@ public:
// Ctor
IdlClassImpl( IdlReflectionServiceImpl * pReflection,
const OUString & rName, typelib_TypeClass eTypeClass,
OUString aName, typelib_TypeClass eTypeClass,
typelib_TypeDescription * pTypeDescr );
virtual ~IdlClassImpl() override;
@@ -338,7 +338,7 @@ public:
{ return _pDeclTypeDescr; }
// ctor/ dtor
IdlMemberImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName,
IdlMemberImpl( IdlReflectionServiceImpl * pReflection, OUString aName,
typelib_TypeDescription * pTypeDescr, typelib_TypeDescription * pDeclTypeDescr );
virtual ~IdlMemberImpl() override;

View File

@@ -19,6 +19,8 @@
#include <uno/any2.h>
#include <utility>
#include "base.hxx"
using namespace css::reflection;
@@ -41,10 +43,10 @@ ClassNameVector g_aClassNames;
IdlClassImpl::IdlClassImpl( IdlReflectionServiceImpl * pReflection,
const OUString & rName, typelib_TypeClass eTypeClass,
OUString aName, typelib_TypeClass eTypeClass,
typelib_TypeDescription * pTypeDescr )
: m_xReflection( pReflection )
, _aName( rName )
, _aName(std::move( aName ))
, _eTypeClass( static_cast<TypeClass>(eTypeClass) )
, _pTypeDescr( pTypeDescr )
{
@@ -201,11 +203,11 @@ Reference< XIdlArray > IdlClassImpl::getArray()
}
IdlMemberImpl::IdlMemberImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName,
IdlMemberImpl::IdlMemberImpl( IdlReflectionServiceImpl * pReflection, OUString aName,
typelib_TypeDescription * pTypeDescr,
typelib_TypeDescription * pDeclTypeDescr )
: m_xReflection( pReflection )
, _aName( rName )
, _aName(std::move( aName ))
, _pTypeDescr( pTypeDescr )
, _pDeclTypeDescr( pDeclTypeDescr )
{

View File

@@ -18,6 +18,7 @@
*/
#include <utility>
#include <vector>
#include <osl/diagnose.h>
@@ -40,9 +41,9 @@ struct Link
OUString m_name;
OUString m_target;
Link( OUString const & name, OUString const & target )
: m_name( name )
, m_target( target )
Link( OUString name, OUString target )
: m_name(std::move( name ))
, m_target(std::move( target ))
{}
};

View File

@@ -64,6 +64,7 @@
#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
#include <unordered_map>
#include <utility>
using namespace css::uno;
using namespace css::lang;
@@ -687,7 +688,7 @@ class ImplIntrospectionAccess : public IntrospectionAccessHelper
void cacheXIndexContainer();
public:
ImplIntrospectionAccess( const Any& obj, rtl::Reference< IntrospectionAccessStatic_Impl > const & pStaticImpl_ );
ImplIntrospectionAccess( Any obj, rtl::Reference< IntrospectionAccessStatic_Impl > pStaticImpl_ );
// Methods from XIntrospectionAccess
virtual sal_Int32 SAL_CALL getSuppliedMethodConcepts() override;
@@ -772,8 +773,8 @@ public:
};
ImplIntrospectionAccess::ImplIntrospectionAccess
( const Any& obj, rtl::Reference< IntrospectionAccessStatic_Impl > const & pStaticImpl_ )
: maInspectedObject( obj ), mpStaticImpl( pStaticImpl_ ) ,
( Any obj, rtl::Reference< IntrospectionAccessStatic_Impl > pStaticImpl_ )
: maInspectedObject(std::move( obj )), mpStaticImpl(std::move( pStaticImpl_ )) ,
mnLastPropertyConcept(-1), mnLastMethodConcept(-1) //, maAdapter()
{
// Save object as an interface if possible
@@ -1430,9 +1431,9 @@ OUString ImplIntrospectionAccess::getExactName( const OUString& rApproximateName
struct TypeKey {
TypeKey(
css::uno::Reference<css::beans::XPropertySetInfo> const & theProperties,
css::uno::Reference<css::beans::XPropertySetInfo> theProperties,
std::vector<css::uno::Type> const & theTypes):
properties(theProperties)
properties(std::move(theProperties))
{
//TODO: Could even sort the types lexicographically first, to increase
// the chance of matches between different implementations' getTypes(),
@@ -1500,8 +1501,8 @@ public:
private:
struct Data {
explicit Data(
rtl::Reference<IntrospectionAccessStatic_Impl> const & theAccess):
access(theAccess), hits(1)
rtl::Reference<IntrospectionAccessStatic_Impl> theAccess):
access(std::move(theAccess)), hits(1)
{}
rtl::Reference<IntrospectionAccessStatic_Impl> access;

View File

@@ -67,6 +67,7 @@
// this one is header-only
#include <comphelper/sequence.hxx>
#include <utility>
namespace com::sun::star::registry { class XRegistryKey; }
@@ -258,7 +259,7 @@ class JavaComponentLoader
public:
/// @throws RuntimeException
explicit JavaComponentLoader(const css::uno::Reference<XComponentContext> & xCtx);
explicit JavaComponentLoader(css::uno::Reference<XComponentContext> xCtx);
public:
// XServiceInfo
@@ -495,9 +496,9 @@ const css::uno::Reference<XImplementationLoader> & JavaComponentLoader::getJavaL
return m_javaLoader;
}
JavaComponentLoader::JavaComponentLoader(const css::uno::Reference<XComponentContext> & xCtx)
JavaComponentLoader::JavaComponentLoader(css::uno::Reference<XComponentContext> xCtx)
: WeakComponentImplHelper(m_aMutex)
, m_xComponentContext(xCtx)
, m_xComponentContext(std::move(xCtx))
{
}

View File

@@ -24,6 +24,7 @@
#include <com/sun/star/task/XInteractionRetry.hpp>
#include <cppuhelper/implbase.hxx>
#include <mutex>
#include <utility>
namespace com::sun::star::task { class XInteractionContinuation; }
@@ -78,8 +79,8 @@ bool InteractionRequest::RetryContinuation::isSelected() const
return m_bSelected;
}
InteractionRequest::InteractionRequest(css::uno::Any const & rRequest):
m_aRequest(rRequest)
InteractionRequest::InteractionRequest(css::uno::Any aRequest):
m_aRequest(std::move(aRequest))
{
m_xRetryContinuation = new RetryContinuation;
m_aContinuations = { new AbortContinuation, m_xRetryContinuation };

View File

@@ -36,7 +36,7 @@ class InteractionRequest:
public cppu::WeakImplHelper< css::task::XInteractionRequest >
{
public:
explicit InteractionRequest(css::uno::Any const & rRequest);
explicit InteractionRequest(css::uno::Any aRequest);
virtual css::uno::Any SAL_CALL getRequest() override;

View File

@@ -67,6 +67,7 @@
#include <string.h>
#include <time.h>
#include <memory>
#include <utility>
#include <vector>
// Properties of the javavm can be put
@@ -470,9 +471,9 @@ private:
}
JavaVirtualMachine::JavaVirtualMachine(
css::uno::Reference< css::uno::XComponentContext > const & rContext):
css::uno::Reference< css::uno::XComponentContext > xContext):
WeakComponentImplHelper(m_aMutex),
m_xContext(rContext),
m_xContext(std::move(xContext)),
m_bDisposed(false),
m_pJavaVm(nullptr),
m_aAttachGuards(destroyAttachGuards) // TODO check for validity

View File

@@ -61,7 +61,7 @@ class JavaVirtualMachine:
public:
explicit JavaVirtualMachine(
css::uno::Reference<
css::uno::XComponentContext > const & rContext);
css::uno::XComponentContext > xContext);
// XInitialization
virtual void SAL_CALL

View File

@@ -36,6 +36,7 @@
#include <com/sun/star/reflection/XProxyFactory.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <utility>
using namespace ::com::sun::star;
@@ -133,7 +134,7 @@ struct ProxyRoot : public ::cppu::OWeakAggObject
// XAggregation
virtual Any SAL_CALL queryAggregation( Type const & rType ) override;
ProxyRoot( ::rtl::Reference< FactoryImpl > const & factory,
ProxyRoot( ::rtl::Reference< FactoryImpl > factory,
Reference< XInterface > const & xTarget );
::rtl::Reference< FactoryImpl > m_factory;
@@ -152,9 +153,9 @@ struct binuno_Proxy : public uno_Interface
TypeDescription m_typeDescr;
binuno_Proxy(
::rtl::Reference< ProxyRoot > const & root,
UnoInterfaceReference const & target,
OUString const & oid, TypeDescription const & typeDescr );
::rtl::Reference< ProxyRoot > root,
UnoInterfaceReference target,
OUString oid, TypeDescription typeDescr );
};
extern "C"
@@ -251,14 +252,14 @@ static void binuno_proxy_dispatch(
binuno_Proxy::binuno_Proxy(
::rtl::Reference< ProxyRoot > const & root,
UnoInterfaceReference const & target,
OUString const & oid, TypeDescription const & typeDescr )
::rtl::Reference< ProxyRoot > root,
UnoInterfaceReference target,
OUString oid, TypeDescription typeDescr )
: m_nRefCount( 1 ),
m_root( root ),
m_target( target ),
m_oid( oid ),
m_typeDescr( typeDescr )
m_root(std::move( root )),
m_target(std::move( target )),
m_oid(std::move( oid )),
m_typeDescr(std::move( typeDescr ))
{
uno_Interface::acquire = binuno_proxy_acquire;
uno_Interface::release = binuno_proxy_release;
@@ -266,9 +267,9 @@ binuno_Proxy::binuno_Proxy(
}
ProxyRoot::ProxyRoot(
::rtl::Reference< FactoryImpl > const & factory,
::rtl::Reference< FactoryImpl > factory,
Reference< XInterface > const & xTarget )
: m_factory( factory )
: m_factory(std::move( factory ))
{
m_factory->m_cpp2uno.mapInterface(
reinterpret_cast< void ** >( &m_target.m_pUnoI ), xTarget.get(),

View File

@@ -18,6 +18,7 @@
*/
#include <utility>
#include <vector>
#include <osl/diagnose.h>
@@ -174,8 +175,8 @@ class acc_Policy
public:
explicit acc_Policy(
PermissionCollection const & permissions )
: m_permissions( permissions )
PermissionCollection permissions )
: m_permissions(std::move( permissions ))
{}
// XAccessControlContext impl

View File

@@ -38,6 +38,7 @@
#include <string_view>
#include <unordered_map>
#include <utility>
constexpr OUStringLiteral IMPL_NAME = u"com.sun.star.security.comp.stoc.FilePolicy";
@@ -152,7 +153,7 @@ class PolicyReader
{ return (';' == c || ',' == c || '{' == c || '}' == c); }
public:
PolicyReader( OUString const & file, AccessControl & ac );
PolicyReader( OUString file, AccessControl & ac );
~PolicyReader();
void error( std::u16string_view msg );
@@ -328,8 +329,8 @@ void PolicyReader::error( std::u16string_view msg )
"] " + msg);
}
PolicyReader::PolicyReader( OUString const & fileName, AccessControl & ac )
: m_fileName( fileName )
PolicyReader::PolicyReader( OUString fileName, AccessControl & ac )
: m_fileName(std::move( fileName ))
, m_linepos( 0 )
, m_pos( 1 ) // force readline
, m_back( '\0' )

View File

@@ -22,6 +22,7 @@
#include <rtl/ref.hxx>
#include <rtl/ustring.hxx>
#include <salhelper/simplereferenceobject.hxx>
#include <utility>
namespace com::sun::star::uno { class Any; }
namespace com::sun::star::uno { template <class E> class Sequence; }
@@ -38,8 +39,8 @@ public:
Permission(
t_type type,
::rtl::Reference< Permission > const & next )
: m_next( next )
::rtl::Reference< Permission > next )
: m_next(std::move( next ))
, m_type( type )
{}
@@ -66,8 +67,8 @@ class PermissionCollection
public:
PermissionCollection()
{}
explicit PermissionCollection( ::rtl::Reference< Permission > const & single )
: m_head( single )
explicit PermissionCollection( ::rtl::Reference< Permission > single )
: m_head(std::move( single ))
{}
PermissionCollection(
css::uno::Sequence< css::uno::Any > const & permissions,

View File

@@ -55,6 +55,7 @@
#include <string_view>
#include <unordered_map>
#include <unordered_set>
#include <utility>
using namespace com::sun::star;
using namespace css::uno;
@@ -205,8 +206,8 @@ sal_Bool PropertySetInfo_Impl::hasPropertyByName( OUString const & name )
class ImplementationEnumeration_Impl : public WeakImplHelper< XEnumeration >
{
public:
explicit ImplementationEnumeration_Impl( const HashSet_Ref & rImplementationMap )
: aImplementationMap( rImplementationMap )
explicit ImplementationEnumeration_Impl( HashSet_Ref xImplementationMap )
: aImplementationMap(std::move( xImplementationMap ))
, aIt( aImplementationMap.begin() )
{}

View File

@@ -21,6 +21,7 @@
#include <cstdlib>
#include <mutex>
#include <utility>
#include <vector>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -100,9 +101,9 @@ private:
class Key: public cppu::WeakImplHelper< css::registry::XRegistryKey > {
public:
Key(
rtl::Reference< SimpleRegistry > const & registry,
rtl::Reference< SimpleRegistry > registry,
RegistryKey const & key):
registry_(registry), key_(key) {}
registry_(std::move(registry)), key_(key) {}
private:
virtual OUString SAL_CALL getKeyName() override;

View File

@@ -25,16 +25,17 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.hxx>
#include <utility>
#include <sal/types.h>
using stoc::uriproc::UriReference;
UriReference::UriReference(
OUString const & scheme, bool bHasAuthority,
OUString const & authority, OUString const & path,
OUString scheme, bool bHasAuthority,
OUString const & authority, OUString path,
bool bHasQuery, OUString const & query):
m_path(path),
m_scheme(scheme),
m_path(std::move(path)),
m_scheme(std::move(scheme)),
m_authority(authority),
m_query(query),
m_hasAuthority(bHasAuthority),

View File

@@ -30,8 +30,8 @@ namespace stoc::uriproc {
class UriReference {
public:
UriReference(
OUString const & scheme, bool hasAuthority,
OUString const & authority, OUString const & path,
OUString scheme, bool hasAuthority,
OUString const & authority, OUString path,
bool hasQuery, OUString const & query);
~UriReference();

View File

@@ -284,8 +284,8 @@ class Factory:
{
public:
explicit Factory(
css::uno::Reference< css::uno::XComponentContext > const & context):
m_context(context) {}
css::uno::Reference< css::uno::XComponentContext > context):
m_context(std::move(context)) {}
Factory(const Factory&) = delete;
Factory& operator=(const Factory&) = delete;

View File

@@ -31,6 +31,7 @@
#include <rtl/uri.h>
#include <rtl/uri.hxx>
#include <rtl/ustring.hxx>
#include <utility>
#include <sal/types.h>
namespace com::sun::star::uno { class XComponentContext; }
@@ -44,8 +45,8 @@ class Factory:
{
public:
explicit Factory(
css::uno::Reference< css::uno::XComponentContext > const & context):
m_context(context) {}
css::uno::Reference< css::uno::XComponentContext > context):
m_context(std::move(context)) {}
Factory(const Factory&) = delete;
Factory& operator=(const Factory&) = delete;