summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2024-07-01 16:48:32 (GMT)
committerBrad King <brad.king@kitware.com>2024-07-18 14:29:46 (GMT)
commit206961bc6089031483667f91b0d50e19ed8b3604 (patch)
treeddcf41d3a8dc00e5cf571062a8b20fe79823fbe7 /Source/cmMakefile.cxx
parent2e16b58b7c72525f78b8aa1eebb7ccd9a0a24512 (diff)
downloadCMake-206961bc6089031483667f91b0d50e19ed8b3604.zip
CMake-206961bc6089031483667f91b0d50e19ed8b3604.tar.gz
CMake-206961bc6089031483667f91b0d50e19ed8b3604.tar.bz2
cmMakefile::FormatListFileStack: Refactor "manual" loop into algorithms
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx20
1 files changed, 7 insertions, 13 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 9952bd6..10a7c99 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4265,20 +4265,14 @@ std::string cmMakefile::FormatListFileStack() const
return {};
}
- std::reverse(listFiles.begin(), listFiles.end());
- std::ostringstream tmp;
- size_t depth = listFiles.size();
- auto it = listFiles.end();
- do {
- if (depth != listFiles.size()) {
- tmp << "\n ";
- }
- --it;
- tmp << '[' << depth << "]\t" << *it;
- depth--;
- } while (it != listFiles.begin());
+ auto depth = 1;
+ std::transform(listFiles.begin(), listFiles.end(), listFiles.begin(),
+ [&depth](const std::string& file) {
+ return cmStrCat('[', depth++, "]\t", file);
+ });
- return tmp.str();
+ return cmJoinStrings(cmMakeRange(listFiles.rbegin(), listFiles.rend()),
+ "\n "_s, {});
}
void cmMakefile::PushScope()