From 3add520ef612716df5dc5c896041c1c70e52015f Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Wed, 1 Dec 2021 21:54:10 +0300 Subject: Replace missing std::any_of with Internal::any_of Change-Id: Ic17ce136f1438dbdc4cf1d5c88947d004748fd70 Reviewed-by: Christian Kandeler --- src/app/qbs-create-project/createproject.cpp | 6 +++--- src/app/qbs-setup-qt/setupqt.cpp | 2 +- src/lib/corelib/buildgraph/buildgraphloader.cpp | 4 +--- src/lib/corelib/buildgraph/environmentscriptrunner.cpp | 6 +++--- src/lib/corelib/buildgraph/executor.cpp | 9 +++++---- src/lib/corelib/language/language.cpp | 2 +- src/lib/corelib/language/moduleloader.cpp | 4 ++-- src/lib/corelib/tools/error.cpp | 6 ++++-- 8 files changed, 20 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/app/qbs-create-project/createproject.cpp b/src/app/qbs-create-project/createproject.cpp index f2f1364f5..cde4a1a18 100644 --- a/src/app/qbs-create-project/createproject.cpp +++ b/src/app/qbs-create-project/createproject.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -164,9 +165,8 @@ bool ProjectCreator::isSourceFile(const QString &fileName) const auto isMatch = [fileName](const QRegularExpression &rex) { return rex.match(fileName).hasMatch(); }; - return !std::any_of(m_blackList.cbegin(), m_blackList.cend(), isMatch) - && (m_whiteList.empty() - || std::any_of(m_whiteList.cbegin(), m_whiteList.cend(), isMatch)); + return !qbs::Internal::any_of(m_blackList, isMatch) + && (m_whiteList.empty() || qbs::Internal::any_of(m_whiteList, isMatch)); } ProjectCreator::ProductFlags ProjectCreator::getFlags(const ProjectCreator::Project &project) diff --git a/src/app/qbs-setup-qt/setupqt.cpp b/src/app/qbs-setup-qt/setupqt.cpp index d43332459..f5d479d94 100644 --- a/src/app/qbs-setup-qt/setupqt.cpp +++ b/src/app/qbs-setup-qt/setupqt.cpp @@ -214,7 +214,7 @@ static bool isQtProfile(const Profile &profile) // For Profiles created with setup-qt < 5.13. const QStringList searchPaths = profile.value(QStringLiteral("preferences.qbsSearchPaths")).toStringList(); - return std::any_of(searchPaths.cbegin(), searchPaths.cend(), [] (const QString &path) { + return Internal::any_of(searchPaths, [] (const QString &path) { return QFileInfo(path + QStringLiteral("/modules/Qt")).isDir(); }); } diff --git a/src/lib/corelib/buildgraph/buildgraphloader.cpp b/src/lib/corelib/buildgraph/buildgraphloader.cpp index 145bca293..3e5dab2ee 100644 --- a/src/lib/corelib/buildgraph/buildgraphloader.cpp +++ b/src/lib/corelib/buildgraph/buildgraphloader.cpp @@ -602,9 +602,7 @@ bool BuildGraphLoader::hasProductFileChanged(const std::vectorgroups) { if (!group->wildcards) continue; - const bool reExpansionRequired = std::any_of( - group->wildcards->dirTimeStamps.cbegin(), - group->wildcards->dirTimeStamps.cend(), + const bool reExpansionRequired = Internal::any_of(group->wildcards->dirTimeStamps, [](const std::pair &pair) { return FileInfo(pair.first).lastModified() > pair.second; }); diff --git a/src/lib/corelib/buildgraph/environmentscriptrunner.cpp b/src/lib/corelib/buildgraph/environmentscriptrunner.cpp index 9dafbf296..841f39a8d 100644 --- a/src/lib/corelib/buildgraph/environmentscriptrunner.cpp +++ b/src/lib/corelib/buildgraph/environmentscriptrunner.cpp @@ -45,9 +45,10 @@ #include #include #include +#include #include #include -#include +#include #include #include @@ -123,8 +124,7 @@ void EnvironmentScriptRunner::setupEnvironment() const auto hasScript = [this](const ResolvedModuleConstPtr &m) { return !getScript(m.get()).sourceCode().isEmpty(); }; - const bool hasAnyScripts = std::any_of(m_product->modules.cbegin(), m_product->modules.cend(), - hasScript); + const bool hasAnyScripts = Internal::any_of(m_product->modules, hasScript); if (!hasAnyScripts) return; diff --git a/src/lib/corelib/buildgraph/executor.cpp b/src/lib/corelib/buildgraph/executor.cpp index fe2815aa7..4c3cf7001 100644 --- a/src/lib/corelib/buildgraph/executor.cpp +++ b/src/lib/corelib/buildgraph/executor.cpp @@ -67,6 +67,7 @@ #include #include #include +#include #include #include @@ -661,8 +662,8 @@ bool Executor::transformerHasMatchingOutputTags(const TransformerConstPtr &trans if (m_activeFileTags.empty()) return true; // No filtering requested. - return std::any_of(transformer->outputs.cbegin(), transformer->outputs.cend(), - [this](const Artifact *a) { return artifactHasMatchingOutputTags(a); }); + return Internal::any_of(transformer->outputs, [this](const Artifact *a) { + return artifactHasMatchingOutputTags(a); }); } bool Executor::artifactHasMatchingOutputTags(const Artifact *artifact) const @@ -1230,8 +1231,8 @@ void Executor::syncFileDependencies() if (!product->buildData) continue; const auto artifactList = filterByType(product->buildData->allNodes()); - isReferencedByArtifact = std::any_of(artifactList.begin(), artifactList.end(), - [dep](const Artifact *a) { return a->fileDependencies.contains(dep); }); + isReferencedByArtifact = Internal::any_of(artifactList, [dep](const Artifact *a) { + return a->fileDependencies.contains(dep); }); // TODO: Would it be safe to mark the artifact as "not up to date" here and clear // its list of file dependencies, rather than doing the check again in // isUpToDate()? diff --git a/src/lib/corelib/language/language.cpp b/src/lib/corelib/language/language.cpp index 8c90d0ba8..c7b2095fa 100644 --- a/src/lib/corelib/language/language.cpp +++ b/src/lib/corelib/language/language.cpp @@ -114,7 +114,7 @@ bool Probe::needsReconfigure(const FileTime &referenceTime) const FileInfo fi(filePath); return !fi.exists() || fi.lastModified() > referenceTime; }; - return std::any_of(m_importedFilesUsed.cbegin(), m_importedFilesUsed.cend(), criterion); + return Internal::any_of(m_importedFilesUsed, criterion); } diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp index de42752fc..b09749deb 100644 --- a/src/lib/corelib/language/moduleloader.cpp +++ b/src/lib/corelib/language/moduleloader.cpp @@ -2928,8 +2928,8 @@ public: const CodeLocation &dependsLocation) : m_dependsChain(dependsChain) { - const bool alreadyInChain = std::any_of(dependsChain.cbegin(), dependsChain.cend(), - [&module](const DependsChainEntry &e) { + const bool alreadyInChain = Internal::any_of(dependsChain, + [&module](const DependsChainEntry &e) { return e.name == module; }); if (alreadyInChain) { diff --git a/src/lib/corelib/tools/error.cpp b/src/lib/corelib/tools/error.cpp index fe5027313..2ff36d1d1 100644 --- a/src/lib/corelib/tools/error.cpp +++ b/src/lib/corelib/tools/error.cpp @@ -45,6 +45,8 @@ #include "setupprojectparameters.h" #include "logging/logger.h" +#include + #include #include #include @@ -306,8 +308,8 @@ bool ErrorInfo::isInternalError() const bool ErrorInfo::hasLocation() const { - return std::any_of(d->items.cbegin(), d->items.cend(), - [](const ErrorItem &ei) { return ei.codeLocation().isValid(); }); + return Internal::any_of(d->items, [](const ErrorItem &ei) { + return ei.codeLocation().isValid(); }); } void ErrorInfo::load(Internal::PersistentPool &pool) -- cgit v1.2.3