cmMakefile: Mark definitions explicitly erased, even at top level.

Presumably the intention here is to attempt to optimize memory by not
storing what is not needed.  However, all keys need to be tracked
anyway to implement initialization tracking, and this special case
gets in the way of simplifying the implementation of that.

This doesn't change any observable effects because values set
to 0 are considered not to exist by the cmDefinitions API.
This commit is contained in:
Stephen Kelly 2015-05-17 15:20:38 +02:00
parent ea7b962be2
commit f58c3774d1
3 changed files with 1 additions and 16 deletions

View File

@ -61,11 +61,6 @@ void cmDefinitions::Set(const std::string& key, const char* value)
this->Map[key] = def; this->Map[key] = def;
} }
void cmDefinitions::Erase(const std::string& key)
{
this->Map.erase(key);
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::vector<std::string> cmDefinitions::LocalKeys() const std::vector<std::string> cmDefinitions::LocalKeys() const
{ {

View File

@ -43,8 +43,6 @@ public:
/** Set (or unset if null) a value associated with a key. */ /** Set (or unset if null) a value associated with a key. */
void Set(const std::string& key, const char* value); void Set(const std::string& key, const char* value);
void Erase(const std::string& key);
/** Get the set of all local keys. */ /** Get the set of all local keys. */
std::vector<std::string> LocalKeys() const; std::vector<std::string> LocalKeys() const;

View File

@ -76,16 +76,8 @@ public:
void RemoveDefinition(std::string const& name) void RemoveDefinition(std::string const& name)
{ {
if (this->VarStack.size() > 1)
{
// In lower scopes we store keys, defined or not.
this->VarStack.back().Set(name, 0); this->VarStack.back().Set(name, 0);
} }
else
{
this->VarStack.back().Erase(name);
}
}
std::vector<std::string> LocalKeys() const std::vector<std::string> LocalKeys() const
{ {