summaryrefslogtreecommitdiffstats
path: root/Source/cmDefinitions.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-10-24 17:38:32 (GMT)
committerBrad King <brad.king@kitware.com>2014-10-24 17:38:32 (GMT)
commit0c3ddf8b652311ec2a9447a9e6303691841628b4 (patch)
tree79965c9e0285edd13cc17474a89afe817c76f898 /Source/cmDefinitions.cxx
parent9c4551f274d4d502590c4728aeba112c92c13385 (diff)
parentd1b62185d6b66b27a3ef31b79d4cff1c5126793e (diff)
downloadCMake-0c3ddf8b652311ec2a9447a9e6303691841628b4.zip
CMake-0c3ddf8b652311ec2a9447a9e6303691841628b4.tar.gz
CMake-0c3ddf8b652311ec2a9447a9e6303691841628b4.tar.bz2
Merge branch 'revert-definition-map-lookup' into releasev3.1.0-rc1
Diffstat (limited to 'Source/cmDefinitions.cxx')
-rw-r--r--Source/cmDefinitions.cxx22
1 files changed, 5 insertions, 17 deletions
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 5515f35..fe32dd5 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -29,7 +29,7 @@ void cmDefinitions::Reset(cmDefinitions* parent)
//----------------------------------------------------------------------------
cmDefinitions::Def const&
-cmDefinitions::GetInternal(const std::string& key) const
+cmDefinitions::GetInternal(const std::string& key)
{
MapType::const_iterator i = this->Map.find(key);
if(i != this->Map.end())
@@ -38,8 +38,9 @@ cmDefinitions::GetInternal(const std::string& key) const
}
if(cmDefinitions* up = this->Up)
{
- // Query the parent scope.
- return up->GetInternal(key);
+ // Query the parent scope and store the result locally.
+ Def def = up->GetInternal(key);
+ return this->Map.insert(MapType::value_type(key, def)).first->second;
}
return this->NoDef;
}
@@ -62,26 +63,13 @@ cmDefinitions::SetInternal(const std::string& key, Def const& def)
}
//----------------------------------------------------------------------------
-const char* cmDefinitions::Get(const std::string& key) const
+const char* cmDefinitions::Get(const std::string& key)
{
Def const& def = this->GetInternal(key);
return def.Exists? def.c_str() : 0;
}
//----------------------------------------------------------------------------
-void cmDefinitions::Pull(const std::string& key)
-{
- if (this->Up)
- {
- Def const& def = this->Up->GetInternal(key);
- if (def.Exists)
- {
- this->SetInternal(key, def);
- }
- }
-}
-
-//----------------------------------------------------------------------------
const char* cmDefinitions::Set(const std::string& key, const char* value)
{
Def const& def = this->SetInternal(key, Def(value));