From d858f36339d61e45913165bc957d645bf1060f54 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 26 Apr 2015 15:54:02 +0200 Subject: [PATCH] cmDefinitions: Use list of cmDefinitions* to create closure. --- Source/cmDefinitions.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 2ee2618d0..5fe57c84c 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmDefinitions.h" +#include + //---------------------------------------------------------------------------- cmDefinitions::Def cmDefinitions::NoDef; @@ -87,11 +89,18 @@ cmDefinitions cmDefinitions::MakeClosure() const void cmDefinitions::MakeClosure(std::set& undefined, cmDefinitions const* defs) { + std::list ups; while(defs) { + ups.push_back(defs); + defs = defs->Up; + } + for (std::list::const_iterator it = ups.begin(); + it != ups.end(); ++it) + { // Consider local definitions. - for(MapType::const_iterator mi = defs->Map.begin(); - mi != defs->Map.end(); ++mi) + for(MapType::const_iterator mi = (*it)->Map.begin(); + mi != (*it)->Map.end(); ++mi) { // Use this key if it is not already set or unset. if(this->Map.find(mi->first) == this->Map.end() && @@ -107,7 +116,6 @@ void cmDefinitions::MakeClosure(std::set& undefined, } } } - defs = defs->Up; } }