diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-04-25 15:21:51 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-04-29 20:51:47 (GMT) |
commit | aaaa65b6a5cdf227282a9d04bf5287413757ff03 (patch) | |
tree | 6802d9991f0ec49f95366cd36ae98518b336591e /Source | |
parent | f983d8913b3293f0f328811d243222c6e19c795e (diff) | |
download | CMake-aaaa65b6a5cdf227282a9d04bf5287413757ff03.zip CMake-aaaa65b6a5cdf227282a9d04bf5287413757ff03.tar.gz CMake-aaaa65b6a5cdf227282a9d04bf5287413757ff03.tar.bz2 |
cmMakefile: Remove stack adaptor for the VarStack.
The purpose of the stack is to allow access only to the top of it. Access
to items which are not at the top is needed, so cmDefinitions objects
get a Parent pointer.
The existence of the Parent pointer is a workaround for the inappropriate
use of stack in the first place. Remove it now.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmMakefile.cxx | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index dbb355c..8cfb83a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -46,7 +46,7 @@ class cmMakefile::Internals { public: - std::stack<cmDefinitions, std::list<cmDefinitions> > VarStack; + std::list<cmDefinitions> VarStack; std::stack<std::set<std::string> > VarInitStack; std::stack<std::set<std::string> > VarUsageStack; bool IsSourceFileTryCompile; @@ -56,24 +56,24 @@ public: cmDefinitions* parent = 0; if (!this->VarStack.empty()) { - parent = &this->VarStack.top(); + parent = &this->VarStack.back(); } - this->VarStack.push(cmDefinitions(parent)); + this->VarStack.push_back(cmDefinitions(parent)); } void InitializeDefinitions(cmMakefile* parent) { - this->VarStack.top() = parent->Internal->VarStack.top().MakeClosure(); + this->VarStack.back() = parent->Internal->VarStack.back().MakeClosure(); } const char* GetDefinition(std::string const& name) { - return this->VarStack.top().Get(name); + return this->VarStack.back().Get(name); } void SetDefinition(std::string const& name, std::string const& value) { - this->VarStack.top().Set(name, value.c_str()); + this->VarStack.back().Set(name, value.c_str()); } void RemoveDefinition(std::string const& name) @@ -81,32 +81,32 @@ public: if (this->VarStack.size() > 1) { // In lower scopes we store keys, defined or not. - this->VarStack.top().Set(name, 0); + this->VarStack.back().Set(name, 0); } else { - this->VarStack.top().Erase(name); + this->VarStack.back().Erase(name); } } std::vector<std::string> LocalKeys() const { - return this->VarStack.top().LocalKeys(); + return this->VarStack.back().LocalKeys(); } std::vector<std::string> ClosureKeys() const { - return this->VarStack.top().ClosureKeys(); + return this->VarStack.back().ClosureKeys(); } void PopDefinitions() { - this->VarStack.pop(); + this->VarStack.pop_back(); } bool RaiseScope(std::string const& var, const char* varDef, cmMakefile* mf) { - cmDefinitions& cur = this->VarStack.top(); + cmDefinitions& cur = this->VarStack.back(); if(cmDefinitions* up = cur.GetParent()) { // First localize the definition in the current scope. |