diff options
author | Ivan Komissarov <ABBAPOH@gmail.com> | 2022-08-11 09:17:48 +0200 |
---|---|---|
committer | Ivan Komissarov <ABBAPOH@gmail.com> | 2022-08-16 17:16:26 +0000 |
commit | 015deadb1be852973b5821ebdb799b01ca565866 (patch) | |
tree | c4705db4166531efbddfebec742babe809cf8fcf | |
parent | cc5f5b9456d9a1bb4213dbc6f0ac9d742ced5295 (diff) | |
download | qbs-015deadb1be852973b5821ebdb799b01ca565866.tar.gz |
clang-tidy: fix 'performance-no-automatic-move' warning
Change-Id: I0fea777445be769080b5e5534eb8dd05cf4652be
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
21 files changed, 25 insertions, 28 deletions
diff --git a/src/app/qbs-setup-qt/setupqt.cpp b/src/app/qbs-setup-qt/setupqt.cpp index 08caec657..bac766482 100644 --- a/src/app/qbs-setup-qt/setupqt.cpp +++ b/src/app/qbs-setup-qt/setupqt.cpp @@ -156,7 +156,7 @@ static QString archFromDirName(const QString &dir) const std::string dirString = dir.toStdString(); if (!std::regex_match(dirString, match, regexp)) return {}; - const QString arch = QString::fromStdString(match[1]); + QString arch = QString::fromStdString(match[1]); if (arch == QLatin1String("32")) return QStringLiteral("x86"); if (arch == QLatin1String("64")) diff --git a/src/app/qbs-setup-toolchains/clangclprobe.cpp b/src/app/qbs-setup-toolchains/clangclprobe.cpp index c9c5a428c..094f8aa14 100644 --- a/src/app/qbs-setup-toolchains/clangclprobe.cpp +++ b/src/app/qbs-setup-toolchains/clangclprobe.cpp @@ -85,7 +85,7 @@ Profile createProfileHelper( QString findClangCl() { const auto compilerName = HostOsInfo::appendExecutableSuffix(QStringLiteral("clang-cl")); - const auto compilerFromPath = findExecutable(compilerName); + auto compilerFromPath = findExecutable(compilerName); if (!compilerFromPath.isEmpty()) return compilerFromPath; diff --git a/src/app/qbs-setup-toolchains/dmcprobe.cpp b/src/app/qbs-setup-toolchains/dmcprobe.cpp index cbe113dfd..097b1caed 100644 --- a/src/app/qbs-setup-toolchains/dmcprobe.cpp +++ b/src/app/qbs-setup-toolchains/dmcprobe.cpp @@ -105,8 +105,7 @@ static QStringList dumpOutput(const QFileInfo &compiler, const QStringList &flag p.waitForFinished(3000); fakeIn.remove(); static QRegularExpression re(QLatin1String("\\r?\\n")); - const QStringList lines = QString::fromUtf8(p.readAllStandardOutput()).split(re); - return lines; + return QString::fromUtf8(p.readAllStandardOutput()).split(re); } static std::optional<Target> dumpDmcTarget(const QFileInfo &compiler, const QStringList &flags) diff --git a/src/app/qbs-setup-toolchains/sdccprobe.cpp b/src/app/qbs-setup-toolchains/sdccprobe.cpp index b53615218..25a3d9751 100644 --- a/src/app/qbs-setup-toolchains/sdccprobe.cpp +++ b/src/app/qbs-setup-toolchains/sdccprobe.cpp @@ -84,8 +84,7 @@ static QStringList dumpOutput(const QFileInfo &compiler, const QString &targetFl } static QRegularExpression re(QStringLiteral("\\r?\\n")); - const QStringList lines = QString::fromUtf8(p.readAllStandardOutput()).split(re); - return lines; + return QString::fromUtf8(p.readAllStandardOutput()).split(re); } static bool supportsSdccArchitecture(const QFileInfo &compiler, QStringView flag) diff --git a/src/app/qbs-setup-toolchains/watcomprobe.cpp b/src/app/qbs-setup-toolchains/watcomprobe.cpp index 13cb8d50c..cc9fee2b4 100644 --- a/src/app/qbs-setup-toolchains/watcomprobe.cpp +++ b/src/app/qbs-setup-toolchains/watcomprobe.cpp @@ -118,8 +118,8 @@ static QStringList dumpOutput(const QFileInfo &compiler, QStringView flag, p.start(compiler.absoluteFilePath(), args); p.waitForFinished(3000); fakeIn.remove(); - const QStringList lines = QString::fromUtf8(p.readAllStandardOutput()) - .split(QRegularExpression(QLatin1String("\\r?\\n"))); + QStringList lines = QString::fromUtf8(p.readAllStandardOutput()) + .split(QRegularExpression(QLatin1String("\\r?\\n"))); return lines; } diff --git a/src/app/qbs/sessionpacket.cpp b/src/app/qbs/sessionpacket.cpp index dd6d1726e..5af252179 100644 --- a/src/app/qbs/sessionpacket.cpp +++ b/src/app/qbs/sessionpacket.cpp @@ -82,7 +82,7 @@ SessionPacket::Status SessionPacket::parseInput(QByteArray &input) QJsonObject SessionPacket::retrievePacket() { QBS_ASSERT(isComplete(), return QJsonObject()); - const auto packet = QJsonDocument::fromJson(QByteArray::fromBase64(m_payload)).object(); + auto packet = QJsonDocument::fromJson(QByteArray::fromBase64(m_payload)).object(); m_payload.clear(); m_expectedPayloadLength = -1; return packet; diff --git a/src/lib/corelib/api/internaljobs.cpp b/src/lib/corelib/api/internaljobs.cpp index 0fabc6279..f3bb46d48 100644 --- a/src/lib/corelib/api/internaljobs.cpp +++ b/src/lib/corelib/api/internaljobs.cpp @@ -337,7 +337,7 @@ void InternalSetupProjectJob::resolveBuildDataFromScratch(const RulesEvaluationC BuildGraphLoadResult InternalSetupProjectJob::restoreProject(const RulesEvaluationContextPtr &evalContext) { BuildGraphLoader bgLoader(logger()); - const BuildGraphLoadResult loadResult + BuildGraphLoadResult loadResult = bgLoader.load(m_existingProject, m_parameters, evalContext); return loadResult; } diff --git a/src/lib/corelib/buildgraph/processcommandexecutor.cpp b/src/lib/corelib/buildgraph/processcommandexecutor.cpp index 57d69ac0b..e687342e1 100644 --- a/src/lib/corelib/buildgraph/processcommandexecutor.cpp +++ b/src/lib/corelib/buildgraph/processcommandexecutor.cpp @@ -211,7 +211,7 @@ void ProcessCommandExecutor::cancel(const qbs::ErrorInfo &reason) QString ProcessCommandExecutor::filterProcessOutput(const QByteArray &_output, const QString &filterFunctionSource) { - const QString output = QString::fromLocal8Bit(_output); + QString output = QString::fromLocal8Bit(_output); if (filterFunctionSource.isEmpty()) return output; diff --git a/src/lib/corelib/language/item.cpp b/src/lib/corelib/language/item.cpp index 2f23de210..178a34b00 100644 --- a/src/lib/corelib/language/item.cpp +++ b/src/lib/corelib/language/item.cpp @@ -168,8 +168,8 @@ ItemValuePtr Item::itemProperty(const QString &name, const Item *itemTemplate, if (!itemTemplate) return ItemValuePtr(); const bool createdByPropertiesBlock = itemValue && itemValue->createdByPropertiesBlock(); - const ItemValuePtr result = ItemValue::create(Item::create(m_pool, itemTemplate->type()), - createdByPropertiesBlock); + ItemValuePtr result = ItemValue::create(Item::create(m_pool, itemTemplate->type()), + createdByPropertiesBlock); setProperty(name, result); return result; } diff --git a/src/lib/corelib/language/language.cpp b/src/lib/corelib/language/language.cpp index 3db41b8c8..bd134040d 100644 --- a/src/lib/corelib/language/language.cpp +++ b/src/lib/corelib/language/language.cpp @@ -592,7 +592,7 @@ TopLevelProject::~TopLevelProject() QString TopLevelProject::deriveId(const QVariantMap &config) { const QVariantMap qbsProperties = config.value(StringConstants::qbsModule()).toMap(); - const QString configurationName = qbsProperties.value( + QString configurationName = qbsProperties.value( StringConstants::configurationNameProperty()).toString(); return configurationName; } diff --git a/src/lib/corelib/language/loader.cpp b/src/lib/corelib/language/loader.cpp index 1de84da63..3fff71c10 100644 --- a/src/lib/corelib/language/loader.cpp +++ b/src/lib/corelib/language/loader.cpp @@ -169,7 +169,7 @@ TopLevelProjectPtr Loader::loadProject(const SetupProjectParameters &_parameters const ModuleLoaderResult loadResult = moduleLoader.load(parameters); ProjectResolver resolver(&evaluator, loadResult, std::move(parameters), m_logger); resolver.setProgressObserver(m_progressObserver); - const TopLevelProjectPtr project = resolver.resolve(); + TopLevelProjectPtr project = resolver.resolve(); project->lastStartResolveTime = resolveTime; project->lastEndResolveTime = FileTime::currentTime(); diff --git a/src/lib/corelib/language/projectresolver.cpp b/src/lib/corelib/language/projectresolver.cpp index d7ae11aaf..4d2d38fc3 100644 --- a/src/lib/corelib/language/projectresolver.cpp +++ b/src/lib/corelib/language/projectresolver.cpp @@ -233,7 +233,7 @@ TopLevelProjectPtr ProjectResolver::resolveTopLevelProject() { if (m_progressObserver) m_progressObserver->setMaximum(int(m_loadResult.productInfos.size())); - const TopLevelProjectPtr project = TopLevelProject::create(); + TopLevelProjectPtr project = TopLevelProject::create(); project->buildDirectory = TopLevelProject::deriveBuildDirectory(m_setupParams.buildRoot(), TopLevelProject::deriveId(m_setupParams.finalBuildConfigurationTree())); project->buildSystemFiles = m_loadResult.qbsFiles; diff --git a/src/lib/corelib/language/scriptengine.cpp b/src/lib/corelib/language/scriptengine.cpp index 0614f31f5..8c14673f6 100644 --- a/src/lib/corelib/language/scriptengine.cpp +++ b/src/lib/corelib/language/scriptengine.cpp @@ -394,7 +394,7 @@ void ScriptEngine::importFile(const QString &filePath, QScriptValue &targetObjec static QString findExtensionDir(const QStringList &searchPaths, const QString &extensionPath) { for (const QString &searchPath : searchPaths) { - const QString dirPath = searchPath + QStringLiteral("/imports/") + extensionPath; + QString dirPath = searchPath + QStringLiteral("/imports/") + extensionPath; QFileInfo fi(dirPath); if (fi.exists() && fi.isDir()) return dirPath; diff --git a/src/lib/corelib/tools/architectures.cpp b/src/lib/corelib/tools/architectures.cpp index cf9fec27b..f139509e4 100644 --- a/src/lib/corelib/tools/architectures.cpp +++ b/src/lib/corelib/tools/architectures.cpp @@ -55,7 +55,7 @@ QString canonicalTargetArchitecture(const QString &architecture, const QString &system, const QString &abi) { - const QString arch = canonicalArchitecture(architecture); + QString arch = canonicalArchitecture(architecture); const bool isApple = (vendor == QStringLiteral("apple") || system == QStringLiteral("darwin") || system == QStringLiteral("macosx") diff --git a/src/lib/corelib/tools/clangclinfo.cpp b/src/lib/corelib/tools/clangclinfo.cpp index a9a1cb449..68486b91f 100644 --- a/src/lib/corelib/tools/clangclinfo.cpp +++ b/src/lib/corelib/tools/clangclinfo.cpp @@ -61,7 +61,7 @@ static std::vector<MSVCInstallInfo> compatibleMsvcs(Logger &logger) static QString findCompatibleVcsarsallBat(const std::vector<MSVCInstallInfo> &msvcs) { for (const auto &msvc: msvcs) { - const auto vcvarsallPath = msvc.findVcvarsallBat(); + auto vcvarsallPath = msvc.findVcvarsallBat(); if (!vcvarsallPath.isEmpty()) return vcvarsallPath; } diff --git a/src/lib/corelib/tools/installoptions.cpp b/src/lib/corelib/tools/installoptions.cpp index 5e112e6de..563f04a7b 100644 --- a/src/lib/corelib/tools/installoptions.cpp +++ b/src/lib/corelib/tools/installoptions.cpp @@ -68,7 +68,7 @@ public: QString effectiveInstallRoot(const InstallOptions &options, const TopLevelProject *project) { - const QString installRoot = options.installRoot(); + QString installRoot = options.installRoot(); if (!installRoot.isEmpty()) return installRoot; diff --git a/src/lib/corelib/tools/msvcinfo.cpp b/src/lib/corelib/tools/msvcinfo.cpp index 418a76ba1..b770b6f46 100644 --- a/src/lib/corelib/tools/msvcinfo.cpp +++ b/src/lib/corelib/tools/msvcinfo.cpp @@ -309,7 +309,7 @@ static QString vswhereFilePath() static const std::vector<const char *> envVarCandidates{"ProgramFiles", "ProgramFiles(x86)"}; for (const char * const envVar : envVarCandidates) { const QString value = QDir::fromNativeSeparators(QString::fromLocal8Bit(qgetenv(envVar))); - const QString cmd = value + QString cmd = value + QStringLiteral("/Microsoft Visual Studio/Installer/vswhere.exe"); if (QFileInfo(cmd).exists()) return cmd; @@ -509,7 +509,7 @@ void MSVC::init() QString MSVC::architectureFromClPath(const QString &clPath) { const auto parentDir = QFileInfo(clPath).absolutePath(); - const auto parentDirName = QFileInfo(parentDir).fileName().toLower(); + auto parentDirName = QFileInfo(parentDir).fileName().toLower(); // can be the case when cl.exe is present within the Windows SDK installation... but can it? if (parentDirName == QLatin1String("bin")) return QStringLiteral("x86"); @@ -722,7 +722,7 @@ QString MSVCInstallInfo::findVcvarsallBat() const std::vector<MSVCInstallInfo> MSVCInstallInfo::installedMSVCs(Logger &logger) { - const auto installInfos = installedMSVCsFromVsWhere(logger); + auto installInfos = installedMSVCsFromVsWhere(logger); if (installInfos.empty()) return installedMSVCsFromRegistry(); return installInfos; diff --git a/src/lib/corelib/tools/profile.cpp b/src/lib/corelib/tools/profile.cpp index 2eac25091..0fe0ba19d 100644 --- a/src/lib/corelib/tools/profile.cpp +++ b/src/lib/corelib/tools/profile.cpp @@ -213,7 +213,7 @@ QVariant Profile::possiblyInheritedValue(const QString &key, const QVariant &def QStringList profileChain) const { extendAndCheckProfileChain(profileChain); - const QVariant v = localValue(key); + QVariant v = localValue(key); if (v.isValid()) return v; const QString baseProfileName = baseProfile(); diff --git a/src/lib/corelib/tools/qbsprocess.cpp b/src/lib/corelib/tools/qbsprocess.cpp index de2590e8a..3fdc05afe 100644 --- a/src/lib/corelib/tools/qbsprocess.cpp +++ b/src/lib/corelib/tools/qbsprocess.cpp @@ -120,7 +120,7 @@ void QbsProcess::sendPacket(const LauncherPacket &packet) QByteArray QbsProcess::readAndClear(QByteArray &data) { - const QByteArray tmp = data; + QByteArray tmp = data; data.clear(); return tmp; } diff --git a/src/lib/msbuild/solution/visualstudiosolutionfileproject.cpp b/src/lib/msbuild/solution/visualstudiosolutionfileproject.cpp index 7a67ce22b..e1b83d801 100644 --- a/src/lib/msbuild/solution/visualstudiosolutionfileproject.cpp +++ b/src/lib/msbuild/solution/visualstudiosolutionfileproject.cpp @@ -52,7 +52,7 @@ VisualStudioSolutionFileProject::~VisualStudioSolutionFileProject() = default; QString VisualStudioSolutionFileProject::name() const { - const auto projectName = IVisualStudioSolutionProject::name(); + auto projectName = IVisualStudioSolutionProject::name(); if (projectName.isEmpty()) return QFileInfo(filePath()).baseName(); return projectName; diff --git a/src/plugins/generator/clangcompilationdb/clangcompilationdbgenerator.cpp b/src/plugins/generator/clangcompilationdb/clangcompilationdbgenerator.cpp index fc1a36c96..dc5450967 100644 --- a/src/plugins/generator/clangcompilationdb/clangcompilationdbgenerator.cpp +++ b/src/plugins/generator/clangcompilationdb/clangcompilationdbgenerator.cpp @@ -115,12 +115,11 @@ QJsonObject ClangCompilationDatabaseGenerator::createEntry(const QString &filePa const QStringList arguments = QStringList() << ruleCommand.executable() << ruleCommand.arguments(); - const QJsonObject object = { + return QJsonObject{ { QStringLiteral("directory"), QJsonValue(workDir) }, { QStringLiteral("arguments"), QJsonArray::fromStringList(arguments) }, { QStringLiteral("file"), QJsonValue(filePath) } }; - return object; } void ClangCompilationDatabaseGenerator::writeProjectDatabase(const QString &filePath, |