diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-18 12:05:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-18 14:45:27 +0200 |
commit | 75918e709a6d0e2b94b5e4fd9c2eb248ef912e00 (patch) | |
tree | f5231910ba430165e4ce04dfb54bd4cf32c435a4 /unoidl | |
parent | f8560e09006cec5cc6ef26ccbf4f21aa28c22ac3 (diff) |
clang-tidy modernize-pass-by-value in unoidl
Change-Id: Ibeb6aa656d6ed8b8ba78e800c9e28ba63ec0ec40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134521
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unoidl')
-rw-r--r-- | unoidl/source/legacyprovider.cxx | 11 | ||||
-rw-r--r-- | unoidl/source/sourceprovider-parser-requires.hxx | 13 | ||||
-rw-r--r-- | unoidl/source/sourceprovider-scanner.hxx | 25 | ||||
-rw-r--r-- | unoidl/source/sourcetreeprovider.cxx | 3 | ||||
-rw-r--r-- | unoidl/source/unoidl-check.cxx | 3 | ||||
-rw-r--r-- | unoidl/source/unoidl-read.cxx | 4 | ||||
-rw-r--r-- | unoidl/source/unoidl-write.cxx | 4 | ||||
-rw-r--r-- | unoidl/source/unoidl.cxx | 9 | ||||
-rw-r--r-- | unoidl/source/unoidlprovider.cxx | 13 |
9 files changed, 46 insertions, 39 deletions
diff --git a/unoidl/source/legacyprovider.cxx b/unoidl/source/legacyprovider.cxx index ab99fcf59dd1..9299ae7ce046 100644 --- a/unoidl/source/legacyprovider.cxx +++ b/unoidl/source/legacyprovider.cxx @@ -10,6 +10,7 @@ #include <sal/config.h> #include <cassert> +#include <utility> #include <vector> #include <registry/reader.hxx> @@ -75,7 +76,7 @@ rtl::Reference< Entity > readEntity( class Cursor: public MapCursor { public: Cursor( - rtl::Reference< Manager > const & manager, RegistryKey const & ucr, + rtl::Reference< Manager > manager, RegistryKey const & ucr, RegistryKey const & key); private: @@ -92,9 +93,9 @@ private: }; Cursor::Cursor( - rtl::Reference< Manager > const & manager, RegistryKey const & ucr, + rtl::Reference< Manager > manager, RegistryKey const & ucr, RegistryKey const & key): - manager_(manager), ucr_(ucr), key_(key), index_(0) + manager_(std::move(manager)), ucr_(ucr), key_(key), index_(0) { if (!ucr_.isValid()) return; @@ -129,9 +130,9 @@ rtl::Reference< Entity > Cursor::getNext(OUString * name) { class Module: public ModuleEntity { public: Module( - rtl::Reference< Manager > const & manager, RegistryKey const & ucr, + rtl::Reference< Manager > manager, RegistryKey const & ucr, RegistryKey const & key): - manager_(manager), ucr_(ucr), key_(key) + manager_(std::move(manager)), ucr_(ucr), key_(key) {} private: diff --git a/unoidl/source/sourceprovider-parser-requires.hxx b/unoidl/source/sourceprovider-parser-requires.hxx index 59c79b39943c..5d9e5f6e3fda 100644 --- a/unoidl/source/sourceprovider-parser-requires.hxx +++ b/unoidl/source/sourceprovider-parser-requires.hxx @@ -11,6 +11,7 @@ #include <sal/config.h> +#include <utility> #include <vector> #include <rtl/ustring.hxx> @@ -97,25 +98,25 @@ struct SourceProviderType { { assert(componentType != nullptr); subtypes.push_back(*componentType); } SourceProviderType( - Type theType, OUString const & theName, + Type theType, OUString theName, SourceProviderEntity const * theEntity): - type(theType), name(theName), entity(theEntity) + type(theType), name(std::move(theName)), entity(theEntity) { assert(theType >= TYPE_ENUM && theType <= TYPE_INTERFACE); assert(theEntity != nullptr); } SourceProviderType( - OUString const & polymorphicStructTypeTemplateName, + OUString polymorphicStructTypeTemplateName, SourceProviderEntity const * theEntity, std::vector<SourceProviderType>&& typeArguments): type(TYPE_INSTANTIATED_POLYMORPHIC_STRUCT), - name(polymorphicStructTypeTemplateName), entity(theEntity), + name(std::move(polymorphicStructTypeTemplateName)), entity(theEntity), subtypes(std::move(typeArguments)) { assert(theEntity != nullptr); } - explicit SourceProviderType(OUString const & identifier): - type(TYPE_PARAMETER), name(identifier), + explicit SourceProviderType(OUString identifier): + type(TYPE_PARAMETER), name(std::move(identifier)), entity() // avoid false warnings about uninitialized member {} diff --git a/unoidl/source/sourceprovider-scanner.hxx b/unoidl/source/sourceprovider-scanner.hxx index 8c973b9db169..08ed189f9f6b 100644 --- a/unoidl/source/sourceprovider-scanner.hxx +++ b/unoidl/source/sourceprovider-scanner.hxx @@ -14,6 +14,7 @@ #include <cassert> #include <map> #include <set> +#include <utility> #include <vector> #include <rtl/ref.hxx> @@ -107,10 +108,10 @@ class SourceProviderInterfaceTypeEntityPad: public SourceProviderEntityPad { public: struct DirectBase { DirectBase( - OUString const & theName, + OUString theName, rtl::Reference<unoidl::InterfaceTypeEntity> const & theEntity, std::vector<OUString>&& theAnnotations): - name(theName), entity(theEntity), annotations(std::move(theAnnotations)) + name(std::move(theName)), entity(theEntity), annotations(std::move(theAnnotations)) { assert(theEntity.is()); } OUString name; @@ -127,7 +128,7 @@ public: OUString mandatory; std::set<OUString> optional; - explicit Member(const OUString & theMandatory): mandatory(theMandatory) {} + explicit Member(OUString theMandatory): mandatory(std::move(theMandatory)) {} }; SourceProviderInterfaceTypeEntityPad(bool published, bool theSingleBase): @@ -196,9 +197,9 @@ public: struct Constructor { struct Parameter { Parameter( - OUString const & theName, - SourceProviderType const & theType, bool theRest): - name(theName), type(theType), rest(theRest) + OUString theName, + SourceProviderType theType, bool theRest): + name(std::move(theName)), type(std::move(theType)), rest(theRest) {} OUString name; @@ -209,9 +210,9 @@ public: }; Constructor( - OUString const & theName, + OUString theName, std::vector< OUString >&& theAnnotations): - name(theName), annotations(std::move(theAnnotations)) + name(std::move(theName)), annotations(std::move(theAnnotations)) {} OUString name; @@ -224,8 +225,8 @@ public: }; explicit SourceProviderSingleInterfaceBasedServiceEntityPad( - bool published, OUString const & theBase): - SourceProviderEntityPad(published), base(theBase) + bool published, OUString theBase): + SourceProviderEntityPad(published), base(std::move(theBase)) {} OUString const base; @@ -284,8 +285,8 @@ struct SourceProviderEntity { struct SourceProviderScannerData { explicit SourceProviderScannerData( - rtl::Reference<unoidl::Manager> const & theManager): - manager(theManager), + rtl::Reference<unoidl::Manager> theManager): + manager(std::move(theManager)), sourcePosition(), sourceEnd(), // avoid false warnings about uninitialized members errorLine(0), publishedContext(false) diff --git a/unoidl/source/sourcetreeprovider.cxx b/unoidl/source/sourcetreeprovider.cxx index fea67405cd54..399329f30e40 100644 --- a/unoidl/source/sourcetreeprovider.cxx +++ b/unoidl/source/sourcetreeprovider.cxx @@ -11,6 +11,7 @@ #include <sal/log.hxx> #include <map> +#include <utility> #include <vector> #include <osl/file.h> @@ -111,7 +112,7 @@ private: class SourceModuleEntity: public ModuleEntity { public: - SourceModuleEntity(Manager& manager, OUString const & uri): manager_(manager), uri_(uri) {} + SourceModuleEntity(Manager& manager, OUString uri): manager_(manager), uri_(std::move(uri)) {} private: virtual ~SourceModuleEntity() noexcept override {} diff --git a/unoidl/source/unoidl-check.cxx b/unoidl/source/unoidl-check.cxx index 253079024106..892793eab395 100644 --- a/unoidl/source/unoidl-check.cxx +++ b/unoidl/source/unoidl-check.cxx @@ -14,6 +14,7 @@ #include <cstdlib> #include <iostream> #include <string_view> +#include <utility> #include <vector> #include <osl/file.hxx> @@ -150,7 +151,7 @@ OUString showDirection( } struct EqualsAnnotation { - explicit EqualsAnnotation(OUString const & name): name_(name) {} + explicit EqualsAnnotation(OUString name): name_(std::move(name)) {} bool operator ()(unoidl::AnnotatedReference const & ref) { return ref.name == name_; } diff --git a/unoidl/source/unoidl-read.cxx b/unoidl/source/unoidl-read.cxx index 706fe7f3d64c..283c660ce974 100644 --- a/unoidl/source/unoidl-read.cxx +++ b/unoidl/source/unoidl-read.cxx @@ -143,8 +143,8 @@ struct Entity { enum class Written { NO, DECLARATION, DEFINITION }; explicit Entity( - rtl::Reference<unoidl::Entity> const & theEntity, bool theRelevant, Entity * theParent): - entity(theEntity), relevant(theRelevant), sorted(Sorted::NO), + rtl::Reference<unoidl::Entity> theEntity, bool theRelevant, Entity * theParent): + entity(std::move(theEntity)), relevant(theRelevant), sorted(Sorted::NO), written(Written::NO), parent(theParent) {} diff --git a/unoidl/source/unoidl-write.cxx b/unoidl/source/unoidl-write.cxx index 5ddd98468359..84cad5bdda69 100644 --- a/unoidl/source/unoidl-write.cxx +++ b/unoidl/source/unoidl-write.cxx @@ -298,8 +298,8 @@ void writeKind( } struct Item { - explicit Item(rtl::Reference< unoidl::Entity > const & theEntity): - entity(theEntity), nameOffset(0), dataOffset(0) + explicit Item(rtl::Reference< unoidl::Entity > theEntity): + entity(std::move(theEntity)), nameOffset(0), dataOffset(0) {} rtl::Reference< unoidl::Entity > entity; diff --git a/unoidl/source/unoidl.cxx b/unoidl/source/unoidl.cxx index 749f9afe4f25..2022bcd058ac 100644 --- a/unoidl/source/unoidl.cxx +++ b/unoidl/source/unoidl.cxx @@ -11,6 +11,7 @@ #include <sal/log.hxx> #include <set> +#include <utility> #include <vector> #include <osl/file.h> @@ -33,8 +34,8 @@ class AggregatingModule: public ModuleEntity { public: AggregatingModule( std::vector< rtl::Reference< Provider > >&& providers, - OUString const & name): - providers_(std::move(providers)), name_(name) + OUString name): + providers_(std::move(providers)), name_(std::move(name)) {} private: @@ -65,8 +66,8 @@ class AggregatingCursor: public MapCursor { public: AggregatingCursor( std::vector< rtl::Reference< Provider > >&& providers, - OUString const & name): - providers_(std::move(providers)), name_(name), iterator_(providers_.begin()) + OUString name): + providers_(std::move(providers)), name_(std::move(name)), iterator_(providers_.begin()) { findCursor(); } private: diff --git a/unoidl/source/unoidlprovider.cxx b/unoidl/source/unoidlprovider.cxx index 216bf564e14d..d6f4d4ddd51a 100644 --- a/unoidl/source/unoidlprovider.cxx +++ b/unoidl/source/unoidlprovider.cxx @@ -14,6 +14,7 @@ #include <cstring> #include <set> #include <string_view> +#include <utility> #include <vector> #include <o3tl/string_view.hxx> @@ -35,7 +36,7 @@ namespace unoidl::detail { class MappedFile: public salhelper::SimpleReferenceObject { public: - explicit MappedFile(OUString const & fileUrl); + explicit MappedFile(OUString fileUrl); sal_uInt8 read8(sal_uInt32 offset) const; @@ -258,7 +259,7 @@ void checkEntityName( } -MappedFile::MappedFile(OUString const & fileUrl): uri(fileUrl), handle(nullptr) { +MappedFile::MappedFile(OUString fileUrl): uri(std::move(fileUrl)), handle(nullptr) { oslFileError e = osl_openFile(uri.pData, &handle, osl_File_OpenFlag_Read); switch (e) { case osl_File_E_None: @@ -657,11 +658,11 @@ class UnoidlModuleEntity; class UnoidlCursor: public MapCursor { public: UnoidlCursor( - rtl::Reference< MappedFile > const & file, - rtl::Reference<UnoidlProvider> const & reference1, - rtl::Reference<UnoidlModuleEntity> const & reference2, + rtl::Reference< MappedFile > file, + rtl::Reference<UnoidlProvider> reference1, + rtl::Reference<UnoidlModuleEntity> reference2, NestedMap const & map): - file_(file), reference1_(reference1), reference2_(reference2), + file_(std::move(file)), reference1_(std::move(reference1)), reference2_(std::move(reference2)), map_(map), index_(0) {} |