diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-04-26 14:13:56 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-04-29 21:54:17 (GMT) |
commit | aa4d1ee80f1ced5b09335cc84bdd373c0875fd80 (patch) | |
tree | 17b4cc2a21e72453fa93439e3497c18fca0624c3 /Source | |
parent | 60becdc65c5f8cfad4b2c6a33e3649d2acbddf39 (diff) | |
download | CMake-aa4d1ee80f1ced5b09335cc84bdd373c0875fd80.zip CMake-aa4d1ee80f1ced5b09335cc84bdd373c0875fd80.tar.gz CMake-aa4d1ee80f1ced5b09335cc84bdd373c0875fd80.tar.bz2 |
cmDefinitions: Convert MakeClosure into a static method.
Accept a range of cmDefinitions*.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmDefinitions.cxx | 13 | ||||
-rw-r--r-- | Source/cmDefinitions.h | 4 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 10 |
3 files changed, 16 insertions, 11 deletions
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 873a7b4..d1fbe74 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -75,18 +75,13 @@ std::vector<std::string> cmDefinitions::LocalKeys() const } //---------------------------------------------------------------------------- -cmDefinitions cmDefinitions::MakeClosure() const +cmDefinitions cmDefinitions::MakeClosure( + std::list<cmDefinitions const*>::iterator begin, + std::list<cmDefinitions const*>::iterator end) { std::set<std::string> undefined; cmDefinitions closure; - cmDefinitions const* defs = this; - std::list<cmDefinitions const*> ups; - while(defs) - { - ups.push_back(defs); - defs = defs->Up; - } - closure.MakeClosure(undefined, ups.begin(), ups.end()); + closure.MakeClosure(undefined, begin, end); return closure; } diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 40e0531..67b6170 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -50,7 +50,9 @@ public: /** Compute the set of all defined keys. */ std::vector<std::string> ClosureKeys() const; - cmDefinitions MakeClosure() const; + static cmDefinitions MakeClosure( + std::list<cmDefinitions const*>::iterator begin, + std::list<cmDefinitions const*>::iterator end); private: // String with existence boolean. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8cfb83a..8797090 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -63,7 +63,15 @@ public: void InitializeDefinitions(cmMakefile* parent) { - this->VarStack.back() = parent->Internal->VarStack.back().MakeClosure(); + std::list<cmDefinitions const*> defPtrs; + for (std::list<cmDefinitions>::iterator it = + parent->Internal->VarStack.begin(); + it != parent->Internal->VarStack.end(); ++it) + { + defPtrs.push_back(&*it); + } + this->VarStack.back() = cmDefinitions::MakeClosure(defPtrs.begin(), + defPtrs.end()); } const char* GetDefinition(std::string const& name) |