summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2021-11-13 20:54:54 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2021-11-16 17:31:18 +0000
commitf471e1d5a9ef588bf4823279303668e81c97044a (patch)
treed92923a3d1d08f29384e95b11b8b1f45b3922637
parent154e6f50ca1d3efaecd40ff232ca7dd4678dde79 (diff)
downloadqbs-f471e1d5a9ef588bf4823279303668e81c97044a.tar.gz
Fix Clang-Tidy & Clazy 'clazy-qfileinfo-exists' warnings
This patch fixes the "Use the static QFileInfo::exists() instead. It's documented to be faster. [clazy-qfileinfo-exists]" warnings. Change-Id: I64aa7179202674048306e1ed3d327d143e1a0ea9 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--src/app/qbs/status.cpp2
-rw-r--r--src/lib/corelib/tools/clangclinfo.cpp6
-rw-r--r--src/lib/corelib/tools/settingscreator.cpp2
3 files changed, 5 insertions, 5 deletions
diff --git a/src/app/qbs/status.cpp b/src/app/qbs/status.cpp
index a5e0c8228..127d26a50 100644
--- a/src/app/qbs/status.cpp
+++ b/src/app/qbs/status.cpp
@@ -146,7 +146,7 @@ int printStatus(const ProjectData &project)
QStringList sourceFiles = group.allFilePaths();
std::sort(sourceFiles.begin(), sourceFiles.end());
for (const QString &sourceFile : qAsConst(sourceFiles)) {
- if (!QFileInfo(sourceFile).exists())
+ if (!QFileInfo::exists(sourceFile))
missingFiles.push_back(sourceFile);
qbsInfo() << " " << sourceFile.mid(projectDirectoryPathLength + 1);
untrackedFilesInProject.removeOne(sourceFile);
diff --git a/src/lib/corelib/tools/clangclinfo.cpp b/src/lib/corelib/tools/clangclinfo.cpp
index 0090b8f2c..36845da6d 100644
--- a/src/lib/corelib/tools/clangclinfo.cpp
+++ b/src/lib/corelib/tools/clangclinfo.cpp
@@ -122,7 +122,7 @@ std::vector<ClangClInfo> ClangClInfo::installedCompilers(
if (registry.contains(key)) {
const auto compilerPath = QDir::fromNativeSeparators(registry.value(key).toString())
+ QStringLiteral("/bin/") + compilerName;
- if (QFileInfo(compilerPath).exists())
+ if (QFileInfo::exists(compilerPath))
compilerPaths.push_back(compilerPath);
}
@@ -133,7 +133,7 @@ std::vector<ClangClInfo> ClangClInfo::installedCompilers(
const auto value
= QDir::fromNativeSeparators(QString::fromLocal8Bit(qgetenv(envVar)));
const auto compilerPath = value + QStringLiteral("/LLVM/bin/") + compilerName;
- if (QFileInfo(compilerPath).exists() && !contains(compilerPaths, compilerPath))
+ if (QFileInfo::exists(compilerPath) && !contains(compilerPaths, compilerPath))
compilerPaths.push_back(compilerPath);
}
@@ -156,7 +156,7 @@ std::vector<ClangClInfo> ClangClInfo::installedCompilers(
for (const auto &msvc : msvcs) {
const auto compilerPath = QStringLiteral("%1/VC/Tools/Llvm/bin/%2")
.arg(msvc.installDir, compilerName);
- if (QFileInfo(compilerPath).exists()) {
+ if (QFileInfo::exists(compilerPath)) {
const auto vcvarsallPath = msvc.findVcvarsallBat();
if (vcvarsallPath.isEmpty()) {
logger.qbsWarning()
diff --git a/src/lib/corelib/tools/settingscreator.cpp b/src/lib/corelib/tools/settingscreator.cpp
index 455e35b34..f94ae6f10 100644
--- a/src/lib/corelib/tools/settingscreator.cpp
+++ b/src/lib/corelib/tools/settingscreator.cpp
@@ -85,7 +85,7 @@ void SettingsCreator::migrate()
if (thePredecessor.isValid())
oldSettingsDir.append(QLatin1String("/qbs/")).append(thePredecessor.toString());
const QString oldSettingsFilePath = oldSettingsDir + QLatin1Char('/') + m_settingsFileName;
- if (QFileInfo(oldSettingsFilePath).exists()
+ if (QFileInfo::exists(oldSettingsFilePath)
&& (!QDir::root().mkpath(m_newSettingsDir)
|| !QFile::copy(oldSettingsFilePath, m_newSettingsFilePath))) {
qWarning() << "Error in settings migration: Could not copy" << oldSettingsFilePath