diff options
author | Ivan Komissarov <ABBAPOH@gmail.com> | 2019-11-24 10:12:55 +0900 |
---|---|---|
committer | Ivan Komissarov <ABBAPOH@gmail.com> | 2020-01-28 20:22:21 +0000 |
commit | 960c10da41461741d75d1b1c9e99541964269bfb (patch) | |
tree | b45c2961241e52b5eeeca01fc00a834b1f5f17c9 | |
parent | eafd4a73ecdcfc1bc016af24e133de871c72dd53 (diff) | |
download | qbs-960c10da41461741d75d1b1c9e99541964269bfb.tar.gz |
Apply 'modernize-pass-by-value' fix-it
Also, treat this warning as error
This amends 936eee744db9b2fd1b9b66d168d80a113002aad2
Change-Id: I372c3b11baa08375d581052282f4546b2ba2e057
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
32 files changed, 107 insertions, 97 deletions
diff --git a/.clang-tidy b/.clang-tidy index f9dfcf6e0..e60f5a454 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,6 +1,6 @@ --- -Checks: '-*,bugprone-*,cppcoreguidelines-c-copy-assignment-signature,cppcoreguidelines-interfaces-global-init,cppcoreguidelines-pro-bounds-constant-array-index,cppcoreguidelines-pro-type-cstyle-cast,cppcoreguidelines-pro-type-member-init,cppcoreguidelines-slicing,fuchsia-virtual-inheritance,google-build-explicit-make-pair,google-build-namespaces,google-global-names-in-headers,google-objc-*,google-readability-casting,google-readability-function-size,google-readability-namespace-comments,google-runtime-operator,misc-definitions-in-headers,misc-misplaced-const,misc-new-delete-overloads,misc-non-copyable-objects,misc-redundant-expression,misc-static-assert,misc-unconventional-assign-operator,misc-uniqueptr-reset-release,misc-unused-*,modernize-avoid-bind,modernize-deprecated-headers,modernize-loop-convert,modernize-make-*,modernize-redundant-void-arg,modernize-replace-*,modernize-return-braced-init-list,modernize-shrink-to-fit,modernize-unary-static-assert,modernize-use-auto,modernize-use-bool-literals,modernize-use-emplace,modernize-use-equals-*,modernize-use-noexcept,modernize-use-override,modernize-use-transparent-functors,modernize-use-using,performance-*,readability-avoid-const-params-in-decls,readability-container-size-empty,readability-delete-null-pointer,readability-deleted-default,readability-function-size,readability-identifier-naming,readability-misleading-indentation,readability-misplaced-array-index,readability-non-const-parameter,readability-redundant-*,readability-simplify-boolean-expr,readability-static-definition-in-anonymous-namespace,readability-uniqueptr-delete-release' -WarningsAsErrors: 'bugprone-*,-bugprone-suspicious-enum-usage,-bugprone-macro-parentheses,-bugprone-narrowing-conversions,modernize-make-*,modernize-use-emplace,modernize-use-equals-default,modernize-use-override,performance-*' +Checks: '-*,bugprone-*,cppcoreguidelines-c-copy-assignment-signature,cppcoreguidelines-interfaces-global-init,cppcoreguidelines-pro-bounds-constant-array-index,cppcoreguidelines-pro-type-cstyle-cast,cppcoreguidelines-pro-type-member-init,cppcoreguidelines-slicing,fuchsia-virtual-inheritance,google-build-explicit-make-pair,google-build-namespaces,google-global-names-in-headers,google-objc-*,google-readability-casting,google-readability-function-size,google-readability-namespace-comments,google-runtime-operator,misc-definitions-in-headers,misc-misplaced-const,misc-new-delete-overloads,misc-non-copyable-objects,misc-redundant-expression,misc-static-assert,misc-unconventional-assign-operator,misc-uniqueptr-reset-release,misc-unused-*,modernize-avoid-bind,modernize-deprecated-headers,modernize-loop-convert,modernize-make-*,modernize-pass-by-value,modernize-redundant-void-arg,modernize-replace-*,modernize-return-braced-init-list,modernize-shrink-to-fit,modernize-unary-static-assert,modernize-use-auto,modernize-use-bool-literals,modernize-use-emplace,modernize-use-equals-*,modernize-use-noexcept,modernize-use-override,modernize-use-transparent-functors,modernize-use-using,performance-*,readability-avoid-const-params-in-decls,readability-container-size-empty,readability-delete-null-pointer,readability-deleted-default,readability-function-size,readability-identifier-naming,readability-misleading-indentation,readability-misplaced-array-index,readability-non-const-parameter,readability-redundant-*,readability-simplify-boolean-expr,readability-static-definition-in-anonymous-namespace,readability-uniqueptr-delete-release' +WarningsAsErrors: 'bugprone-*,-bugprone-suspicious-enum-usage,-bugprone-macro-parentheses,-bugprone-narrowing-conversions,modernize-make-*,modernize-pass-by-value,modernize-use-emplace,modernize-use-equals-default,modernize-use-override,performance-*' HeaderFilterRegex: '' AnalyzeTemporaryDtors: false CheckOptions: diff --git a/src/app/config/configcommandlineparser.h b/src/app/config/configcommandlineparser.h index b567134fd..f1f026678 100644 --- a/src/app/config/configcommandlineparser.h +++ b/src/app/config/configcommandlineparser.h @@ -60,7 +60,7 @@ public: class Error { public: - Error(const QString &message) : m_message(message) { } + Error(QString message) : m_message(std::move(message)) { } QString message() const { return m_message; } private: QString m_message; diff --git a/src/app/qbs/session.cpp b/src/app/qbs/session.cpp index 3307f5866..75f0e3bc9 100644 --- a/src/app/qbs/session.cpp +++ b/src/app/qbs/session.cpp @@ -148,7 +148,7 @@ private: struct ProductSelection { ProductSelection(Project::ProductSelection s) : selection(s) {} - ProductSelection(const QList<ProductData> &p) : products(p) {} + ProductSelection(QList<ProductData> p) : products(std::move(p)) {} Project::ProductSelection selection = Project::ProductSelectionDefaultOnly; QList<ProductData> products; diff --git a/src/lib/corelib/api/changeset.cpp b/src/lib/corelib/api/changeset.cpp index 5d375fd65..57ea3b569 100644 --- a/src/lib/corelib/api/changeset.cpp +++ b/src/lib/corelib/api/changeset.cpp @@ -48,8 +48,8 @@ ChangeSet::ChangeSet() { } -ChangeSet::ChangeSet(const QList<EditOp> &operations) - : m_string(nullptr), m_cursor(nullptr), m_operationList(operations), m_error(false) +ChangeSet::ChangeSet(QList<EditOp> operations) + : m_string(nullptr), m_cursor(nullptr), m_operationList(std::move(operations)), m_error(false) { } diff --git a/src/lib/corelib/api/changeset.h b/src/lib/corelib/api/changeset.h index 13d3908d4..23248c48e 100644 --- a/src/lib/corelib/api/changeset.h +++ b/src/lib/corelib/api/changeset.h @@ -86,7 +86,7 @@ public: public: ChangeSet(); - ChangeSet(const QList<EditOp> &operations); + ChangeSet(QList<EditOp> operations); bool empty() const; diff --git a/src/lib/corelib/api/project_p.h b/src/lib/corelib/api/project_p.h index 2afc9cd79..60c8311f3 100644 --- a/src/lib/corelib/api/project_p.h +++ b/src/lib/corelib/api/project_p.h @@ -62,8 +62,8 @@ namespace Internal { class ProjectPrivate : public QSharedData { public: - ProjectPrivate(const TopLevelProjectPtr &internalProject, const Logger &logger) - : internalProject(internalProject), logger(logger) + ProjectPrivate(TopLevelProjectPtr internalProject, Logger logger) + : internalProject(std::move(internalProject)), logger(std::move(logger)) { } diff --git a/src/lib/corelib/api/projectfileupdater.cpp b/src/lib/corelib/api/projectfileupdater.cpp index 04f8e630f..bc2648adf 100644 --- a/src/lib/corelib/api/projectfileupdater.cpp +++ b/src/lib/corelib/api/projectfileupdater.cpp @@ -115,7 +115,7 @@ private: }; -ProjectFileUpdater::ProjectFileUpdater(const QString &projectFile) : m_projectFile(projectFile) +ProjectFileUpdater::ProjectFileUpdater(QString projectFile) : m_projectFile(std::move(projectFile)) { } @@ -201,11 +201,10 @@ void ProjectFileUpdater::apply() } -ProjectFileGroupInserter::ProjectFileGroupInserter(const ProductData &product, - const QString &groupName) +ProjectFileGroupInserter::ProjectFileGroupInserter(ProductData product, QString groupName) : ProjectFileUpdater(product.location().filePath()) - , m_product(product) - , m_groupName(groupName) + , m_product(std::move(product)) + , m_groupName(std::move(groupName)) { } @@ -273,12 +272,12 @@ static int getBindingLine(const ChangeSet &changeSet, const QString &fileContent } -ProjectFileFilesAdder::ProjectFileFilesAdder(const ProductData &product, const GroupData &group, - const QStringList &files) +ProjectFileFilesAdder::ProjectFileFilesAdder(ProductData product, GroupData group, + QStringList files) : ProjectFileUpdater(product.location().filePath()) - , m_product(product) - , m_group(group) - , m_files(files) + , m_product(std::move(product)) + , m_group(std::move(group)) + , m_files(std::move(files)) { } @@ -405,12 +404,12 @@ void ProjectFileFilesAdder::doApply(QString &fileContent, UiProgram *ast) changeSet.apply(&fileContent); } -ProjectFileFilesRemover::ProjectFileFilesRemover(const ProductData &product, const GroupData &group, - const QStringList &files) +ProjectFileFilesRemover::ProjectFileFilesRemover(ProductData product, GroupData group, + QStringList files) : ProjectFileUpdater(product.location().filePath()) - , m_product(product) - , m_group(group) - , m_files(files) + , m_product(std::move(product)) + , m_group(std::move(group)) + , m_files(std::move(files)) { } @@ -512,10 +511,10 @@ void ProjectFileFilesRemover::doApply(QString &fileContent, UiProgram *ast) } -ProjectFileGroupRemover::ProjectFileGroupRemover(const ProductData &product, const GroupData &group) +ProjectFileGroupRemover::ProjectFileGroupRemover(ProductData product, GroupData group) : ProjectFileUpdater(product.location().filePath()) - , m_product(product) - , m_group(group) + , m_product(std::move(product)) + , m_group(std::move(group)) { } diff --git a/src/lib/corelib/api/projectfileupdater.h b/src/lib/corelib/api/projectfileupdater.h index c0d46c747..3459d788e 100644 --- a/src/lib/corelib/api/projectfileupdater.h +++ b/src/lib/corelib/api/projectfileupdater.h @@ -61,7 +61,7 @@ public: int lineOffset() const { return m_lineOffset; } protected: - ProjectFileUpdater(const QString &projectFile); + ProjectFileUpdater(QString projectFile); QString projectFile() const { return m_projectFile; } @@ -92,7 +92,7 @@ private: class ProjectFileGroupInserter : public ProjectFileUpdater { public: - ProjectFileGroupInserter(const ProductData &product, const QString &groupName); + ProjectFileGroupInserter(ProductData product, QString groupName); private: void doApply(QString &fileContent, QbsQmlJS::AST::UiProgram *ast) override; @@ -105,8 +105,7 @@ private: class ProjectFileFilesAdder : public ProjectFileUpdater { public: - ProjectFileFilesAdder(const ProductData &product, const GroupData &group, - const QStringList &files); + ProjectFileFilesAdder(ProductData product, GroupData group, QStringList files); private: void doApply(QString &fileContent, QbsQmlJS::AST::UiProgram *ast) override; @@ -119,8 +118,8 @@ private: class ProjectFileFilesRemover : public ProjectFileUpdater { public: - ProjectFileFilesRemover(const ProductData &product, const GroupData &group, - const QStringList &files); + ProjectFileFilesRemover(ProductData product, GroupData group, + QStringList files); private: void doApply(QString &fileContent, QbsQmlJS::AST::UiProgram *ast) override; @@ -133,7 +132,7 @@ private: class ProjectFileGroupRemover : public ProjectFileUpdater { public: - ProjectFileGroupRemover(const ProductData &product, const GroupData &group); + ProjectFileGroupRemover(ProductData product, GroupData group); private: void doApply(QString &fileContent, QbsQmlJS::AST::UiProgram *ast) override; diff --git a/src/lib/corelib/api/qmljsrewriter.cpp b/src/lib/corelib/api/qmljsrewriter.cpp index 55db2e6e8..bf333df9b 100644 --- a/src/lib/corelib/api/qmljsrewriter.cpp +++ b/src/lib/corelib/api/qmljsrewriter.cpp @@ -63,12 +63,12 @@ static QString toString(UiQualifiedId *qualifiedId, QChar delimiter = QLatin1Cha } -Rewriter::Rewriter(const QString &originalText, +Rewriter::Rewriter(QString originalText, ChangeSet *changeSet, - const QStringList &propertyOrder) - : m_originalText(originalText) + QStringList propertyOrder) + : m_originalText(std::move(originalText)) , m_changeSet(changeSet) - , m_propertyOrder(propertyOrder) + , m_propertyOrder(std::move(propertyOrder)) { Q_ASSERT(changeSet); } diff --git a/src/lib/corelib/api/qmljsrewriter.h b/src/lib/corelib/api/qmljsrewriter.h index 797b05459..3788035f2 100644 --- a/src/lib/corelib/api/qmljsrewriter.h +++ b/src/lib/corelib/api/qmljsrewriter.h @@ -60,9 +60,9 @@ public: using Range = ChangeSet::Range; public: - Rewriter(const QString &originalText, + Rewriter(QString originalText, ChangeSet *changeSet, - const QStringList &propertyOrder); + QStringList propertyOrder); Range addBinding(AST::UiObjectInitializer *ast, const QString &propertyName, diff --git a/src/lib/corelib/buildgraph/buildgraphloader.h b/src/lib/corelib/buildgraph/buildgraphloader.h index a89272958..c62ba7fa7 100644 --- a/src/lib/corelib/buildgraph/buildgraphloader.h +++ b/src/lib/corelib/buildgraph/buildgraphloader.h @@ -122,8 +122,8 @@ private: struct ChildrenInfo { ChildrenInfo() = default; - ChildrenInfo(const ArtifactSet &c1, const ArtifactSet &c2) - : children(c1), childrenAddedByScanner(c2) {} + ChildrenInfo(ArtifactSet c1, ArtifactSet c2) + : children(std::move(c1)), childrenAddedByScanner(std::move(c2)) {} ArtifactSet children; ArtifactSet childrenAddedByScanner; }; diff --git a/src/lib/corelib/buildgraph/rescuableartifactdata.h b/src/lib/corelib/buildgraph/rescuableartifactdata.h index 3e4d6e25f..6dd10f76c 100644 --- a/src/lib/corelib/buildgraph/rescuableartifactdata.h +++ b/src/lib/corelib/buildgraph/rescuableartifactdata.h @@ -84,9 +84,12 @@ public: struct ChildData { - ChildData(const QString &n = QString(), const QString &m = QString(), - const QString &c = QString(), bool byScanner = false) - : productName(n), productMultiplexId(m), childFilePath(c), addedByScanner(byScanner) + ChildData(QString n = QString(), QString m = QString(), + QString c = QString(), bool byScanner = false) + : productName(std::move(n)) + , productMultiplexId(std::move(m)) + , childFilePath(std::move(c)) + , addedByScanner(byScanner) {} template<PersistentPool::OpType opType> void completeSerializationOp(PersistentPool &pool) diff --git a/src/lib/corelib/buildgraph/scriptclasspropertyiterator.h b/src/lib/corelib/buildgraph/scriptclasspropertyiterator.h index f6154f993..b57072236 100644 --- a/src/lib/corelib/buildgraph/scriptclasspropertyiterator.h +++ b/src/lib/corelib/buildgraph/scriptclasspropertyiterator.h @@ -57,10 +57,10 @@ class ScriptClassPropertyIterator : public QScriptClassPropertyIterator { public: ScriptClassPropertyIterator(const QScriptValue &object, const QVariantMap &properties, - const std::vector<QString> &additionalProperties) + std::vector<QString> additionalProperties) : QScriptClassPropertyIterator(object), m_it(properties), - m_additionalProperties(additionalProperties) + m_additionalProperties(std::move(additionalProperties)) { } diff --git a/src/lib/corelib/language/deprecationinfo.h b/src/lib/corelib/language/deprecationinfo.h index 220f99ad3..89cd07f4a 100644 --- a/src/lib/corelib/language/deprecationinfo.h +++ b/src/lib/corelib/language/deprecationinfo.h @@ -50,9 +50,9 @@ class DeprecationInfo { public: explicit DeprecationInfo(const Version &removalVersion, - const QString &additionalUserInfo = QString()) + QString additionalUserInfo = QString()) : m_removalVersion(removalVersion) - , m_additionalUserInfo(additionalUserInfo) + , m_additionalUserInfo(std::move(additionalUserInfo)) {} DeprecationInfo() = default; diff --git a/src/lib/corelib/language/language.h b/src/lib/corelib/language/language.h index 2d934edc2..bbd851333 100644 --- a/src/lib/corelib/language/language.h +++ b/src/lib/corelib/language/language.h @@ -140,19 +140,19 @@ public: private: Probe() = default; - Probe(const QString &globalId, + Probe(QString globalId, const CodeLocation &location, bool condition, - const QString &configureScript, - const QVariantMap &properties, - const QVariantMap &initialProperties, - const std::vector<QString> &importedFilesUsed) - : m_globalId(globalId) + QString configureScript, + QVariantMap properties, + QVariantMap initialProperties, + std::vector<QString> importedFilesUsed) + : m_globalId(std::move(globalId)) , m_location(location) - , m_configureScript(configureScript) - , m_properties(properties) - , m_initialProperties(initialProperties) - , m_importedFilesUsed(importedFilesUsed) + , m_configureScript(std::move(configureScript)) + , m_properties(std::move(properties)) + , m_initialProperties(std::move(initialProperties)) + , m_importedFilesUsed(std::move(importedFilesUsed)) , m_condition(condition) {} diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp index 50ff1cbd3..f8a651e45 100644 --- a/src/lib/corelib/language/moduleloader.cpp +++ b/src/lib/corelib/language/moduleloader.cpp @@ -380,9 +380,9 @@ class PropertyDeclarationCheck : public ValueHandler Logger &m_logger; public: PropertyDeclarationCheck(const Set<Item *> &disabledItems, - const SetupProjectParameters ¶ms, Logger &logger) + SetupProjectParameters params, Logger &logger) : m_disabledItems(disabledItems) - , m_params(params) + , m_params(std::move(params)) , m_logger(logger) { } diff --git a/src/lib/corelib/language/moduleloader.h b/src/lib/corelib/language/moduleloader.h index 2a7a89727..0b169612a 100644 --- a/src/lib/corelib/language/moduleloader.h +++ b/src/lib/corelib/language/moduleloader.h @@ -425,8 +425,8 @@ private: struct DependsChainEntry { - DependsChainEntry(const QualifiedId &name, const CodeLocation &location) - : name(name), location(location) + DependsChainEntry(QualifiedId name, const CodeLocation &location) + : name(std::move(name)), location(location) { } diff --git a/src/lib/corelib/language/moduleproviderinfo.h b/src/lib/corelib/language/moduleproviderinfo.h index fef9d9765..4f757d3d9 100644 --- a/src/lib/corelib/language/moduleproviderinfo.h +++ b/src/lib/corelib/language/moduleproviderinfo.h @@ -55,9 +55,12 @@ class ModuleProviderInfo { public: ModuleProviderInfo() = default; - ModuleProviderInfo(const QualifiedId &name, const QVariantMap &config, - const QStringList &searchPaths, bool transientOutput) - : name(name), config(config), searchPaths(searchPaths), transientOutput(transientOutput) + ModuleProviderInfo(QualifiedId name, QVariantMap config, + QStringList searchPaths, bool transientOutput) + : name(std::move(name)) + , config(std::move(config)) + , searchPaths(std::move(searchPaths)) + , transientOutput(transientOutput) {} static QString outputBaseDirName() { return QStringLiteral("genmodules"); } diff --git a/src/lib/corelib/language/projectresolver.h b/src/lib/corelib/language/projectresolver.h index 428ba144d..a1e24a555 100644 --- a/src/lib/corelib/language/projectresolver.h +++ b/src/lib/corelib/language/projectresolver.h @@ -139,9 +139,9 @@ private: struct ProductDependencyInfo { - ProductDependencyInfo(const ResolvedProductPtr &product, - const QVariantMap ¶meters = QVariantMap()) - : product(product), parameters(parameters) + ProductDependencyInfo(ResolvedProductPtr product, + QVariantMap parameters = QVariantMap()) + : product(std::move(product)), parameters(std::move(parameters)) { } diff --git a/src/lib/corelib/language/property.h b/src/lib/corelib/language/property.h index 204704672..78061bf6f 100644 --- a/src/lib/corelib/language/property.h +++ b/src/lib/corelib/language/property.h @@ -65,9 +65,13 @@ public: { } - Property(const QString &product, const QString &module, const QString &property, - const QVariant &v, Kind k) - : productName(product), moduleName(module), propertyName(property), value(v), kind(k) + Property(QString product, QString module, QString property, + QVariant v, Kind k) + : productName(std::move(product)) + , moduleName(std::move(module)) + , propertyName(std::move(property)) + , value(std::move(v)) + , kind(k) { } diff --git a/src/lib/corelib/language/value.h b/src/lib/corelib/language/value.h index a48e974d3..d3a748d92 100644 --- a/src/lib/corelib/language/value.h +++ b/src/lib/corelib/language/value.h @@ -151,14 +151,14 @@ public: struct PropertyData { PropertyData() = default; - PropertyData(const QString &v, const CodeLocation &l) : value(v), location(l) {} + PropertyData(QString v, const CodeLocation &l) : value(std::move(v)), location(l) {} QString value; CodeLocation location; }; Alternative() = default; - Alternative(const PropertyData &c, const PropertyData &o, const JSSourceValuePtr &v) - : condition(c), overrideListProperties(o), value(v) {} + Alternative(PropertyData c, PropertyData o, JSSourceValuePtr v) + : condition(std::move(c)), overrideListProperties(std::move(o)), value(std::move(v)) {} Alternative clone() const { return Alternative(condition, overrideListProperties, diff --git a/src/lib/corelib/logging/logger.h b/src/lib/corelib/logging/logger.h index 419a371c2..389dc7e05 100644 --- a/src/lib/corelib/logging/logger.h +++ b/src/lib/corelib/logging/logger.h @@ -90,7 +90,7 @@ private: class QBS_EXPORT MessageTag { public: - explicit MessageTag(const QString &tag) : m_tag(tag) {} + explicit MessageTag(QString tag) : m_tag(std::move(tag)) {} const QString &tag() const { return m_tag; } diff --git a/src/lib/corelib/parser/qmljsengine_p.h b/src/lib/corelib/parser/qmljsengine_p.h index 19e76a699..c55d525f8 100644 --- a/src/lib/corelib/parser/qmljsengine_p.h +++ b/src/lib/corelib/parser/qmljsengine_p.h @@ -59,6 +59,7 @@ #include <QtCore/qstring.h> #include <set> +#include <utility> namespace QbsQmlJS { @@ -74,8 +75,8 @@ public: DiagnosticMessage() : kind(Error) {} - DiagnosticMessage(Kind kind, const AST::SourceLocation &loc, const QString &message) - : kind(kind), loc(loc), message(message) {} + DiagnosticMessage(Kind kind, const AST::SourceLocation &loc, QString message) + : kind(kind), loc(loc), message(std::move(message)) {} bool isWarning() const { return kind == Warning; } diff --git a/src/lib/corelib/tools/shellutils.h b/src/lib/corelib/tools/shellutils.h index 6f1d82afb..f4ad35044 100644 --- a/src/lib/corelib/tools/shellutils.h +++ b/src/lib/corelib/tools/shellutils.h @@ -77,7 +77,7 @@ public: private: struct Argument { - Argument(const QString &value = QString()) : value(value) { } + Argument(QString value = QString()) : value(std::move(value)) { } QString value; bool isFilePath = false; bool shouldQuote = true; diff --git a/tests/auto/blackbox/tst_blackboxbase.h b/tests/auto/blackbox/tst_blackboxbase.h index 251f3752d..c1c4d39b2 100644 --- a/tests/auto/blackbox/tst_blackboxbase.h +++ b/tests/auto/blackbox/tst_blackboxbase.h @@ -42,14 +42,14 @@ public: init(); } - QbsRunParameters(const QString &cmd, const QStringList &args = QStringList()) - : command(cmd), arguments(args) + QbsRunParameters(QString cmd, QStringList args = QStringList()) + : command(std::move(cmd)), arguments(std::move(args)) { init(); } - QbsRunParameters(const QStringList &args) - : arguments(args) + QbsRunParameters(QStringList args) + : arguments(std::move(args)) { init(); } diff --git a/tests/benchmarker/benchmarker.cpp b/tests/benchmarker/benchmarker.cpp index 5ecdbf08b..2cc442a72 100644 --- a/tests/benchmarker/benchmarker.cpp +++ b/tests/benchmarker/benchmarker.cpp @@ -34,16 +34,17 @@ #include <QtConcurrent/qtconcurrentrun.h> #include <iostream> +#include <utility> namespace qbsBenchmarker { -Benchmarker::Benchmarker(Activities activities, const QString &oldCommit, const QString &newCommit, - const QString &testProject, const QString &qbsRepo) +Benchmarker::Benchmarker(Activities activities, QString oldCommit, QString newCommit, + QString testProject, QString qbsRepo) : m_activities(activities) - , m_oldCommit(oldCommit) - , m_newCommit(newCommit) - , m_testProject(testProject) - , m_qbsRepo(qbsRepo) + , m_oldCommit(std::move(oldCommit)) + , m_newCommit(std::move(newCommit)) + , m_testProject(std::move(testProject)) + , m_qbsRepo(std::move(qbsRepo)) { } diff --git a/tests/benchmarker/benchmarker.h b/tests/benchmarker/benchmarker.h index 9b6d5a157..6313e8094 100644 --- a/tests/benchmarker/benchmarker.h +++ b/tests/benchmarker/benchmarker.h @@ -53,8 +53,8 @@ using BenchmarkResults = QHash<Activity, BenchmarkResult>; class Benchmarker { public: - Benchmarker(Activities activities, const QString &oldCommit, const QString &newCommit, - const QString &testProject, const QString &qbsRepo); + Benchmarker(Activities activities, QString oldCommit, QString newCommit, + QString testProject, QString qbsRepo); ~Benchmarker(); void benchmark(); diff --git a/tests/benchmarker/exception.h b/tests/benchmarker/exception.h index 216189b70..9fab479ea 100644 --- a/tests/benchmarker/exception.h +++ b/tests/benchmarker/exception.h @@ -35,7 +35,7 @@ namespace qbsBenchmarker { class Exception : public QException { public: - explicit Exception(const QString &description) : m_description(description) {} + explicit Exception(QString description) : m_description(std::move(description)) {} ~Exception() throw() override = default; QString description() const { return m_description; } diff --git a/tests/benchmarker/valgrindrunner.cpp b/tests/benchmarker/valgrindrunner.cpp index 344a23516..174781318 100644 --- a/tests/benchmarker/valgrindrunner.cpp +++ b/tests/benchmarker/valgrindrunner.cpp @@ -44,10 +44,10 @@ namespace qbsBenchmarker { -ValgrindRunner::ValgrindRunner(Activities activities, const QString &testProject, +ValgrindRunner::ValgrindRunner(Activities activities, QString testProject, const QString &qbsBuildDir, const QString &baseOutputDir) : m_activities(activities) - , m_testProject(testProject) + , m_testProject(std::move(testProject)) , m_qbsBinary(qbsBuildDir + "/bin/qbs") , m_baseOutputDir(baseOutputDir) { diff --git a/tests/benchmarker/valgrindrunner.h b/tests/benchmarker/valgrindrunner.h index 3ec82a6a2..378723868 100644 --- a/tests/benchmarker/valgrindrunner.h +++ b/tests/benchmarker/valgrindrunner.h @@ -55,7 +55,7 @@ public: class ValgrindRunner { public: - ValgrindRunner(Activities activities, const QString &testProject, const QString &qbsBuildDir, + ValgrindRunner(Activities activities, QString testProject, const QString &qbsBuildDir, const QString &baseOutputDir); void run(); diff --git a/tests/fuzzy-test/commandlineparser.h b/tests/fuzzy-test/commandlineparser.h index 6dcbf84bc..76b49331b 100644 --- a/tests/fuzzy-test/commandlineparser.h +++ b/tests/fuzzy-test/commandlineparser.h @@ -35,7 +35,7 @@ class ParseException : public std::exception { public: - ParseException(const QString &error) : errorMessage(error) { } + ParseException(QString error) : errorMessage(std::move(error)) { } ~ParseException() throw() override = default; QString errorMessage; diff --git a/tests/fuzzy-test/fuzzytester.h b/tests/fuzzy-test/fuzzytester.h index bc1fc5f18..2d0279e1a 100644 --- a/tests/fuzzy-test/fuzzytester.h +++ b/tests/fuzzy-test/fuzzytester.h @@ -35,7 +35,7 @@ class TestError { public: - TestError(const QString &errorMessage) : errorMessage(errorMessage) {} + TestError(QString errorMessage) : errorMessage(std::move(errorMessage)) {} ~TestError() throw() = default; QString errorMessage; |