cmDefinitions: Replace ClosureKeys recursion with looping.

This commit is contained in:
Stephen Kelly 2015-04-26 11:38:08 +02:00
parent 818bf727c1
commit 78e1454ea0
1 changed files with 15 additions and 15 deletions

View File

@ -131,9 +131,13 @@ std::set<std::string> cmDefinitions::ClosureKeys() const
void cmDefinitions::ClosureKeys(std::set<std::string>& defined, void cmDefinitions::ClosureKeys(std::set<std::string>& defined,
std::set<std::string>& undefined) const std::set<std::string>& undefined) const
{ {
cmDefinitions const* up = this;
while (up)
{
// Consider local definitions. // Consider local definitions.
for(MapType::const_iterator mi = this->Map.begin(); for(MapType::const_iterator mi = up->Map.begin();
mi != this->Map.end(); ++mi) mi != up->Map.end(); ++mi)
{ {
// Use this key if it is not already set or unset. // Use this key if it is not already set or unset.
if(defined.find(mi->first) == defined.end() && if(defined.find(mi->first) == defined.end() &&
@ -143,10 +147,6 @@ void cmDefinitions::ClosureKeys(std::set<std::string>& defined,
m.insert(mi->first); m.insert(mi->first);
} }
} }
up = up->Up;
// Traverse parents.
if(cmDefinitions const* up = this->Up)
{
up->ClosureKeys(defined, undefined);
} }
} }