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,22 +131,22 @@ std::set<std::string> cmDefinitions::ClosureKeys() const
void cmDefinitions::ClosureKeys(std::set<std::string>& defined,
std::set<std::string>& undefined) const
{
// Consider local definitions.
for(MapType::const_iterator mi = this->Map.begin();
mi != this->Map.end(); ++mi)
{
// Use this key if it is not already set or unset.
if(defined.find(mi->first) == defined.end() &&
undefined.find(mi->first) == undefined.end())
{
std::set<std::string>& m = mi->second.Exists? defined : undefined;
m.insert(mi->first);
}
}
cmDefinitions const* up = this;
// Traverse parents.
if(cmDefinitions const* up = this->Up)
while (up)
{
up->ClosureKeys(defined, undefined);
// Consider local definitions.
for(MapType::const_iterator mi = up->Map.begin();
mi != up->Map.end(); ++mi)
{
// Use this key if it is not already set or unset.
if(defined.find(mi->first) == defined.end() &&
undefined.find(mi->first) == undefined.end())
{
std::set<std::string>& m = mi->second.Exists? defined : undefined;
m.insert(mi->first);
}
}
up = up->Up;
}
}