From 5067ae41b03442a7dba9210595e782678835a3ff Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Apr 2015 16:36:48 +0200 Subject: cmDefinitions: Externalize the Set logic. --- Source/cmDefinitions.cxx | 11 +---------- Source/cmMakefile.cxx | 10 +++++++++- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 58500c9..d2b37bb 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -49,16 +49,7 @@ const char* cmDefinitions::Get(const std::string& key) void cmDefinitions::Set(const std::string& key, const char* value) { Def def(value); - if(this->Up || def.Exists) - { - // In lower scopes we store keys, defined or not. - this->Map[key] = def; - } - else - { - // In the top-most scope we need not store undefined keys. - this->Map.erase(key); - } + this->Map[key] = def; } void cmDefinitions::Erase(const std::string& key) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d71b815..8754427 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -78,7 +78,15 @@ public: void RemoveDefinition(std::string const& name) { - this->VarStack.top().Set(name, 0); + if (this->VarStack.size() > 1) + { + // In lower scopes we store keys, defined or not. + this->VarStack.top().Set(name, 0); + } + else + { + this->VarStack.top().Erase(name); + } } std::set LocalKeys() const -- cgit v0.12