cmDefinitions: Use list of cmDefinitions* to create closure.

This commit is contained in:
Stephen Kelly 2015-04-26 15:54:02 +02:00
parent aaaa65b6a5
commit d858f36339
1 changed files with 11 additions and 3 deletions

View File

@ -11,6 +11,8 @@
============================================================================*/ ============================================================================*/
#include "cmDefinitions.h" #include "cmDefinitions.h"
#include <list>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmDefinitions::Def cmDefinitions::NoDef; cmDefinitions::Def cmDefinitions::NoDef;
@ -87,11 +89,18 @@ cmDefinitions cmDefinitions::MakeClosure() const
void cmDefinitions::MakeClosure(std::set<std::string>& undefined, void cmDefinitions::MakeClosure(std::set<std::string>& undefined,
cmDefinitions const* defs) cmDefinitions const* defs)
{ {
std::list<cmDefinitions const*> ups;
while(defs) while(defs)
{ {
ups.push_back(defs);
defs = defs->Up;
}
for (std::list<cmDefinitions const*>::const_iterator it = ups.begin();
it != ups.end(); ++it)
{
// Consider local definitions. // Consider local definitions.
for(MapType::const_iterator mi = defs->Map.begin(); for(MapType::const_iterator mi = (*it)->Map.begin();
mi != defs->Map.end(); ++mi) mi != (*it)->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(this->Map.find(mi->first) == this->Map.end() && if(this->Map.find(mi->first) == this->Map.end() &&
@ -107,7 +116,6 @@ void cmDefinitions::MakeClosure(std::set<std::string>& undefined,
} }
} }
} }
defs = defs->Up;
} }
} }