summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2021-01-22 15:39:02 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2021-01-27 13:54:18 (GMT)
commitef935b17ab47739b1e81e9c6baf6112b7a20f9cb (patch)
tree7f31fc4bcf6efb450e67b29ba6713937515ca956 /Source/cmLocalGenerator.cxx
parent9ac8dbbb941194e79fd59acfc4affa018a222745 (diff)
downloadCMake-ef935b17ab47739b1e81e9c6baf6112b7a20f9cb.zip
CMake-ef935b17ab47739b1e81e9c6baf6112b7a20f9cb.tar.gz
CMake-ef935b17ab47739b1e81e9c6baf6112b7a20f9cb.tar.bz2
clang-tidy: fix `readability-use-anyofallof` warnings
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx44
1 files changed, 18 insertions, 26 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index bd38446..349b53b 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1853,17 +1853,12 @@ bool cmLocalGenerator::AllAppleArchSysrootsAreTheSame(
return false;
}
- for (std::string const& arch : archs) {
- std::string const& archSysroot = this->AppleArchSysroots[arch];
- if (cmIsOff(archSysroot)) {
- continue;
- }
- if (archSysroot != sysroot) {
- return false;
- }
- }
-
- return true;
+ return std::all_of(archs.begin(), archs.end(),
+ [this, &sysroot](std::string const& arch) -> bool {
+ std::string const& archSysroot =
+ this->AppleArchSysroots[arch];
+ return cmIsOff(archSysroot) || archSysroot == sysroot;
+ });
}
void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
@@ -4039,26 +4034,23 @@ cmSourceFile* AddCustomCommand(
bool AnyOutputMatches(const std::string& name,
const std::vector<std::string>& outputs)
{
- for (std::string const& output : outputs) {
- std::string::size_type pos = output.rfind(name);
- // If the output matches exactly
- if (pos != std::string::npos && pos == output.size() - name.size() &&
- (pos == 0 || output[pos - 1] == '/')) {
- return true;
- }
- }
- return false;
+ return std::any_of(outputs.begin(), outputs.end(),
+ [&name](std::string const& output) -> bool {
+ std::string::size_type pos = output.rfind(name);
+ // If the output matches exactly
+ return (pos != std::string::npos &&
+ pos == output.size() - name.size() &&
+ (pos == 0 || output[pos - 1] == '/'));
+ });
}
bool AnyTargetCommandOutputMatches(
const std::string& name, const std::vector<cmCustomCommand>& commands)
{
- for (cmCustomCommand const& command : commands) {
- if (AnyOutputMatches(name, command.GetByproducts())) {
- return true;
- }
- }
- return false;
+ return std::any_of(commands.begin(), commands.end(),
+ [&name](cmCustomCommand const& command) -> bool {
+ return AnyOutputMatches(name, command.GetByproducts());
+ });
}
}