diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2021-01-22 15:39:02 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2021-01-27 13:54:18 (GMT) |
commit | ef935b17ab47739b1e81e9c6baf6112b7a20f9cb (patch) | |
tree | 7f31fc4bcf6efb450e67b29ba6713937515ca956 /Source/cmQtAutoMocUic.cxx | |
parent | 9ac8dbbb941194e79fd59acfc4affa018a222745 (diff) | |
download | CMake-ef935b17ab47739b1e81e9c6baf6112b7a20f9cb.zip CMake-ef935b17ab47739b1e81e9c6baf6112b7a20f9cb.tar.gz CMake-ef935b17ab47739b1e81e9c6baf6112b7a20f9cb.tar.bz2 |
clang-tidy: fix `readability-use-anyofallof` warnings
Diffstat (limited to 'Source/cmQtAutoMocUic.cxx')
-rw-r--r-- | Source/cmQtAutoMocUic.cxx | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index 48354bc..68d3c6c 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -1426,13 +1426,12 @@ bool cmQtAutoMocUicT::JobEvalCacheMocT::FindIncludedHeader( return true; } // Search in include directories - for (std::string const& path : this->MocConst().IncludePaths) { - if (findHeader(cmStrCat(path, '/', includeBase))) { - return true; - } - } - // Return without success - return false; + auto const& includePaths = this->MocConst().IncludePaths; + return std::any_of( + includePaths.begin(), includePaths.end(), + [&findHeader, &includeBase](std::string const& path) -> bool { + return findHeader(cmStrCat(path, '/', includeBase)); + }); } bool cmQtAutoMocUicT::JobEvalCacheMocT::RegisterIncluded( @@ -1538,31 +1537,30 @@ bool cmQtAutoMocUicT::JobEvalCacheUicT::EvalFile( } std::string const sourceDirPrefix = SubDirPrefix(sourceFile.FileName); - for (IncludeKeyT const& incKey : Include) { - // Find .ui file - this->UiName = cmStrCat(incKey.Base, ".ui"); - if (!this->FindIncludedUi(sourceDirPrefix, incKey.Dir)) { - this->LogError( - GenT::UIC, - cmStrCat(this->MessagePath(sourceFile.FileName), - "\nincludes the uic file ", this->MessagePath(incKey.Key), - ",\nbut the user interface file ", - this->MessagePath(this->UiName), - "\ncould not be found in the following directories\n", - this->MessageSearchLocations())); - return false; - } - // Check if the file is skipped - if (this->UicConst().skipped(this->UiFileHandle->FileName)) { - continue; - } - // Register mapping - if (!this->RegisterMapping(incKey.Key, sourceFileHandle)) { - return false; - } - } - - return true; + return std::all_of( + Include.begin(), Include.end(), + [this, &sourceDirPrefix, &sourceFile, + &sourceFileHandle](IncludeKeyT const& incKey) -> bool { + // Find .ui file + this->UiName = cmStrCat(incKey.Base, ".ui"); + if (!this->FindIncludedUi(sourceDirPrefix, incKey.Dir)) { + this->LogError( + GenT::UIC, + cmStrCat(this->MessagePath(sourceFile.FileName), + "\nincludes the uic file ", this->MessagePath(incKey.Key), + ",\nbut the user interface file ", + this->MessagePath(this->UiName), + "\ncould not be found in the following directories\n", + this->MessageSearchLocations())); + return false; + } + // Check if the file is skipped + if (this->UicConst().skipped(this->UiFileHandle->FileName)) { + return true; + } + // Register mapping + return this->RegisterMapping(incKey.Key, sourceFileHandle); + }); } bool cmQtAutoMocUicT::JobEvalCacheUicT::FindIncludedUi( |