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

Change-Id: I2bd9c4c8ced5f0edb9dbf560fe0ed126b9233c26
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134519
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2022-05-18 11:52:59 +02:00
parent 2c6cea672a
commit 225328b1e3
7 changed files with 39 additions and 35 deletions

View file

@ -27,6 +27,7 @@
#include <set>
#include <string_view>
#include <memory>
#include <utility>
#include <vector>
#include <iostream>
@ -152,8 +153,7 @@ bool isBootstrapType(OUString const & name)
class CppuType
{
public:
CppuType(
OUString const & name, rtl::Reference< TypeManager > const & typeMgr);
CppuType(OUString name, rtl::Reference< TypeManager > const & typeMgr);
virtual ~CppuType() {}
@ -273,12 +273,12 @@ private:
};
CppuType::CppuType(
OUString const & name, rtl::Reference< TypeManager > const & typeMgr):
OUString name, rtl::Reference< TypeManager > const & typeMgr):
m_inheritedMemberCount(0)
, m_cppuTypeLeak(false)
, m_cppuTypeDynamic(true)
, m_indentLength(0)
, name_(name)
, name_(std::move(name))
, id_(name_.copy(name_.lastIndexOf('.') + 1))
, m_typeMgr(typeMgr)
, m_dependencies(typeMgr, name_)
@ -1051,9 +1051,9 @@ class BaseOffset
{
public:
BaseOffset(
rtl::Reference< TypeManager > const & manager,
rtl::Reference< TypeManager > manager,
rtl::Reference< unoidl::InterfaceTypeEntity > const & entity):
manager_(manager), offset_(0) {
manager_(std::move(manager)), offset_(0) {
calculateBases(entity);
}
BaseOffset(const BaseOffset&) = delete;

View file

@ -33,14 +33,15 @@
#include <rtl/ustring.hxx>
#include <sal/types.h>
#include <utility>
#include <vector>
using codemaker::cppumaker::Includes;
Includes::Includes(
rtl::Reference< TypeManager > const & manager,
rtl::Reference< TypeManager > manager,
codemaker::cppumaker::Dependencies const & dependencies, bool hpp):
m_manager(manager), m_map(dependencies.getMap()), m_hpp(hpp),
m_manager(std::move(manager)), m_map(dependencies.getMap()), m_hpp(hpp),
m_includeCassert(false),
m_includeAny(dependencies.hasAnyDependency()), m_includeReference(false),
m_includeSequence(dependencies.hasSequenceDependency()),

View file

@ -33,7 +33,7 @@ namespace codemaker::cppumaker {
class Includes {
public:
Includes(
rtl::Reference< TypeManager > const & manager,
rtl::Reference< TypeManager > manager,
Dependencies const & dependencies, bool hpp);
~Includes();

View file

@ -320,7 +320,7 @@ SpecialType getFieldDescriptor(
class MethodDescriptor {
public:
MethodDescriptor(
rtl::Reference< TypeManager > const & manager,
rtl::Reference< TypeManager > manager,
std::set<OUString> * dependencies, std::u16string_view returnType,
SpecialType * specialReturnType,
PolymorphicUnoType * polymorphicUnoType);
@ -346,10 +346,10 @@ private:
};
MethodDescriptor::MethodDescriptor(
rtl::Reference< TypeManager > const & manager, std::set<OUString> * dependencies,
rtl::Reference< TypeManager > manager, std::set<OUString> * dependencies,
std::u16string_view returnType, SpecialType * specialReturnType,
PolymorphicUnoType * polymorphicUnoType):
m_manager(manager), m_dependencies(dependencies), m_needsSignature(false)
m_manager(std::move(manager)), m_dependencies(dependencies), m_needsSignature(false)
{
assert(dependencies != nullptr);
m_descriptorStart.append('(');
@ -400,20 +400,20 @@ public:
// KIND_MEMBER:
TypeInfo(
OString const & name, SpecialType specialType, sal_Int32 index,
OString name, SpecialType specialType, sal_Int32 index,
PolymorphicUnoType const & polymorphicUnoType,
sal_Int32 typeParameterIndex);
// KIND_ATTRIBUTE/METHOD:
TypeInfo(
Kind kind, OString const & name, SpecialType specialType, Flags flags,
sal_Int32 index, PolymorphicUnoType const & polymorphicUnoType);
Kind kind, OString name, SpecialType specialType, Flags flags,
sal_Int32 index, PolymorphicUnoType polymorphicUnoType);
// KIND_PARAMETER:
TypeInfo(
OString const & parameterName, SpecialType specialType,
bool inParameter, bool outParameter, OString const & methodName,
sal_Int32 index, PolymorphicUnoType const & polymorphicUnoType);
OString parameterName, SpecialType specialType,
bool inParameter, bool outParameter, OString methodName,
sal_Int32 index, PolymorphicUnoType polymorphicUnoType);
sal_uInt16 generateCode(ClassFile::Code & code, std::set<OUString> * dependencies)
const;
@ -447,10 +447,10 @@ sal_Int32 translateSpecialTypeFlags(
}
TypeInfo::TypeInfo(
OString const & name, SpecialType specialType, sal_Int32 index,
OString name, SpecialType specialType, sal_Int32 index,
PolymorphicUnoType const & polymorphicUnoType,
sal_Int32 typeParameterIndex):
m_kind(KIND_MEMBER), m_name(name),
m_kind(KIND_MEMBER), m_name(std::move(name)),
m_flags(translateSpecialTypeFlags(specialType, false, false)),
m_index(index), m_polymorphicUnoType(polymorphicUnoType),
m_typeParameterIndex(typeParameterIndex)
@ -461,24 +461,24 @@ TypeInfo::TypeInfo(
}
TypeInfo::TypeInfo(
Kind kind, OString const & name, SpecialType specialType, Flags flags,
sal_Int32 index, PolymorphicUnoType const & polymorphicUnoType):
m_kind(kind), m_name(name),
Kind kind, OString name, SpecialType specialType, Flags flags,
sal_Int32 index, PolymorphicUnoType polymorphicUnoType):
m_kind(kind), m_name(std::move(name)),
m_flags(flags | translateSpecialTypeFlags(specialType, false, false)),
m_index(index), m_polymorphicUnoType(polymorphicUnoType),
m_index(index), m_polymorphicUnoType(std::move(polymorphicUnoType)),
m_typeParameterIndex(0)
{
assert(kind == KIND_ATTRIBUTE || kind == KIND_METHOD);
}
TypeInfo::TypeInfo(
OString const & parameterName, SpecialType specialType, bool inParameter,
bool outParameter, OString const & methodName, sal_Int32 index,
PolymorphicUnoType const & polymorphicUnoType):
m_kind(KIND_PARAMETER), m_name(parameterName),
OString parameterName, SpecialType specialType, bool inParameter,
bool outParameter, OString methodName, sal_Int32 index,
PolymorphicUnoType polymorphicUnoType):
m_kind(KIND_PARAMETER), m_name(std::move(parameterName)),
m_flags(translateSpecialTypeFlags(specialType, inParameter, outParameter)),
m_index(index), m_methodName(methodName),
m_polymorphicUnoType(polymorphicUnoType),
m_index(index), m_methodName(std::move(methodName)),
m_polymorphicUnoType(std::move(polymorphicUnoType)),
m_typeParameterIndex(0)
{}

View file

@ -24,6 +24,7 @@
#include <rtl/string.hxx>
#include <memory>
#include <utility>
#include <vector>
class TypeManager;
@ -37,8 +38,8 @@ struct ExceptionTreeNode {
typedef std::vector< std::unique_ptr<ExceptionTreeNode> > Children;
// Internally used by ExceptionTree:
ExceptionTreeNode(rtl::OString const & theName):
name(theName), present(false) {}
ExceptionTreeNode(rtl::OString theName):
name(std::move(theName)), present(false) {}
// Internally used by ExceptionTree:
~ExceptionTreeNode() { clearChildren(); }

View file

@ -20,6 +20,7 @@
#ifndef INCLUDED_CODEMAKER_GLOBAL_HXX
#define INCLUDED_CODEMAKER_GLOBAL_HXX
#include <utility>
#include <vector>
#include <string_view>
@ -80,7 +81,7 @@ bool removeTypeFile(const ::rtl::OString& fileName);
class CannotDumpException final {
public:
CannotDumpException(OUString const & message): message_(message) {}
CannotDumpException(OUString message): message_(std::move(message)) {}
~CannotDumpException() noexcept;

View file

@ -22,6 +22,7 @@
#include <codemaker/global.hxx>
#include <unordered_map>
#include <utility>
typedef std::unordered_map
<
@ -33,8 +34,8 @@ typedef std::unordered_map
class IllegalArgument
{
public:
IllegalArgument(const ::rtl::OString& msg)
: m_message(msg) {}
IllegalArgument(::rtl::OString msg)
: m_message(std::move(msg)) {}
::rtl::OString m_message;
};