From 861c81ab8603a01c23e97543837670503538119e Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Sun, 24 Nov 2019 16:14:53 +0900 Subject: Fix 'performance-unnecessary-value-param' warnings Use more pass-by-const-ref since there is no point in passing objects by value in these cases Also, treat this warning as error Change-Id: I5382dcd56639f535cf240205cc5c3ac667c4ece3 Reviewed-by: Christian Kandeler --- src/lib/corelib/buildgraph/rulecommands.cpp | 2 +- src/lib/corelib/buildgraph/transformer.cpp | 2 +- src/lib/corelib/buildgraph/transformer.h | 2 +- src/lib/corelib/buildgraph/transformerchangetracking.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/lib/corelib/buildgraph') diff --git a/src/lib/corelib/buildgraph/rulecommands.cpp b/src/lib/corelib/buildgraph/rulecommands.cpp index c09c31c2c..88ab1ce06 100644 --- a/src/lib/corelib/buildgraph/rulecommands.cpp +++ b/src/lib/corelib/buildgraph/rulecommands.cpp @@ -78,7 +78,7 @@ static QString stdoutFilterFunctionProperty() { return QStringLiteral("stdoutFil static QString timeoutProperty() { return QStringLiteral("timeout"); } static QString workingDirProperty() { return QStringLiteral("workingDirectory"); } -static QString invokedSourceCode(const QScriptValue codeOrFunction) +static QString invokedSourceCode(const QScriptValue &codeOrFunction) { const QString &code = codeOrFunction.toString(); return codeOrFunction.isFunction() ? QStringLiteral("(") + code + QStringLiteral(")()") : code; diff --git a/src/lib/corelib/buildgraph/transformer.cpp b/src/lib/corelib/buildgraph/transformer.cpp index 5e27c3e74..29f2bcdf0 100644 --- a/src/lib/corelib/buildgraph/transformer.cpp +++ b/src/lib/corelib/buildgraph/transformer.cpp @@ -194,7 +194,7 @@ void Transformer::setupInputs(QScriptValue targetScriptValue, const ArtifactSet targetScriptValue.setProperty(StringConstants::inputVar(), inputScriptValue); } -void Transformer::setupInputs(QScriptValue targetScriptValue) +void Transformer::setupInputs(const QScriptValue &targetScriptValue) { setupInputs(targetScriptValue, inputs, rule->module->name); } diff --git a/src/lib/corelib/buildgraph/transformer.h b/src/lib/corelib/buildgraph/transformer.h index 2f6a8e56d..8772ed868 100644 --- a/src/lib/corelib/buildgraph/transformer.h +++ b/src/lib/corelib/buildgraph/transformer.h @@ -95,7 +95,7 @@ public: const Artifact *artifact, const QString &defaultModuleName); ResolvedProductPtr product() const; - void setupInputs(QScriptValue targetScriptValue); + void setupInputs(const QScriptValue &targetScriptValue); void setupOutputs(QScriptValue targetScriptValue); void setupExplicitlyDependsOn(QScriptValue targetScriptValue); void createCommands(ScriptEngine *engine, const PrivateScriptFunction &script, diff --git a/src/lib/corelib/buildgraph/transformerchangetracking.cpp b/src/lib/corelib/buildgraph/transformerchangetracking.cpp index 505f0cbba..e44c31639 100644 --- a/src/lib/corelib/buildgraph/transformerchangetracking.cpp +++ b/src/lib/corelib/buildgraph/transformerchangetracking.cpp @@ -71,7 +71,7 @@ private: const char *context) const; bool isExportedModuleUpToDate(const QString &productName, const ExportedModule &module) const; bool areExportedModulesUpToDate( - const std::unordered_map exportedModules) const; + const std::unordered_map &exportedModules) const; const Artifact *getArtifact(const QString &filePath, const QString &productName) const; const ResolvedProduct *getProduct(const QString &name) const; @@ -207,7 +207,7 @@ bool TrafoChangeTracker::isExportedModuleUpToDate(const QString &productName, } bool TrafoChangeTracker::areExportedModulesUpToDate( - const std::unordered_map exportedModules) const + const std::unordered_map &exportedModules) const { for (const auto &kv : exportedModules) { if (!isExportedModuleUpToDate(kv.first, kv.second)) -- cgit v1.2.3