cmMakefile::FormatListFileStack: Refactor 'while' into 'for'

This commit is contained in:
Alex Turbov
2024-07-01 19:08:04 +04:00
committed by Brad King
parent b8fb4b778c
commit 29fb605822

View File

@@ -4256,11 +4256,11 @@ void cmMakefile::AddCMakeDependFilesFromUser()
std::string cmMakefile::FormatListFileStack() const
{
std::vector<std::string> 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();