From 29fb6058226757d42fb792b455cfc7890c28c24a Mon Sep 17 00:00:00 2001 From: Alex Turbov Date: Mon, 1 Jul 2024 19:08:04 +0400 Subject: cmMakefile::FormatListFileStack: Refactor 'while' into 'for' --- Source/cmMakefile.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 4fc3340..6bbfc7c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4256,11 +4256,11 @@ void cmMakefile::AddCMakeDependFilesFromUser() std::string cmMakefile::FormatListFileStack() const { std::vector listFiles; - cmStateSnapshot snp = this->StateSnapshot; - while (snp.IsValid()) { - listFiles.push_back(snp.GetExecutionListFile()); - snp = snp.GetCallStackParent(); + for (auto snp = this->StateSnapshot; snp.IsValid(); + snp = snp.GetCallStackParent()) { + listFiles.emplace_back(snp.GetExecutionListFile()); } + std::reverse(listFiles.begin(), listFiles.end()); std::ostringstream tmp; size_t depth = listFiles.size(); -- cgit v0.12