summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-06-06 07:41:30 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-06-07 07:29:31 (GMT)
commit5181fae264444ad7736614ceb1e78c51def2b97c (patch)
tree6c0577c3bc103de8eef07431260fcb5d1f495d43
parent3ac4b90bfdcca97f1f63056c97afee38cf66ea12 (diff)
downloadCMake-5181fae264444ad7736614ceb1e78c51def2b97c.zip
CMake-5181fae264444ad7736614ceb1e78c51def2b97c.tar.gz
CMake-5181fae264444ad7736614ceb1e78c51def2b97c.tar.bz2
cmPropertyMap: Remove chaining logic.
The chaining logic doesn't belong to the container, and the CMakeInstance pointer doesn't need to be in cmPropertyMap. Size goes from 56 to 48 bytes with GNU libstdc++-5.1.
-rw-r--r--Source/cmCPluginAPI.cxx10
-rw-r--r--Source/cmCacheManager.cxx7
-rw-r--r--Source/cmGlobalGenerator.cxx1
-rw-r--r--Source/cmMakefile.cxx16
-rw-r--r--Source/cmMakefile.h3
-rw-r--r--Source/cmPropertyMap.cxx11
-rw-r--r--Source/cmPropertyMap.h13
-rw-r--r--Source/cmSetTestsPropertiesCommand.cxx6
-rw-r--r--Source/cmSourceFile.cxx14
-rw-r--r--Source/cmState.cxx4
-rw-r--r--Source/cmTarget.cxx16
-rw-r--r--Source/cmTest.cxx14
12 files changed, 42 insertions, 73 deletions
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index bd8c10c..0d24ed5 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -526,11 +526,9 @@ void * CCONV cmCreateSourceFile(void)
return (void*)new cmCPluginAPISourceFile;
}
-void * CCONV cmCreateNewSourceFile(void *arg)
+void * CCONV cmCreateNewSourceFile(void *)
{
- cmMakefile *mf = static_cast<cmMakefile *>(arg);
cmCPluginAPISourceFile *sf = new cmCPluginAPISourceFile;
- sf->Properties.SetCMakeInstance(mf->GetCMakeInstance());
return (void*)sf;
}
@@ -630,11 +628,7 @@ const char * CCONV cmSourceFileGetProperty(void *arg,const char *prop)
{
return sf->FullPath.c_str();
}
- bool chain = false;
- // Ignore chain because old code will not expect it and it is a
- // pain to implement here anyway.
- return sf->Properties.GetPropertyValue(prop, cmProperty::SOURCE_FILE,
- chain);
+ return sf->Properties.GetPropertyValue(prop);
}
}
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 6af14f2..54209c5 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -161,7 +161,6 @@ bool cmCacheManager::LoadCache(const std::string& path,
// Format is key:type=value
std::string helpString;
CacheEntry e;
- e.Properties.SetCMakeInstance(this->CMakeInstance);
cmSystemTools::GetLineFromStream(fin, buffer);
realbuffer = buffer.c_str();
while(*realbuffer != '0' &&
@@ -323,7 +322,6 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey,
{
// Create an entry and store the property.
CacheEntry& ne = this->Cache[key];
- ne.Properties.SetCMakeInstance(this->CMakeInstance);
ne.Type = cmState::UNINITIALIZED;
ne.SetProperty(*p, e.Value.c_str());
}
@@ -645,7 +643,6 @@ void cmCacheManager::AddCacheEntry(const std::string& key,
cmState::CacheEntryType type)
{
CacheEntry& e = this->Cache[key];
- e.Properties.SetCMakeInstance(this->CMakeInstance);
if ( value )
{
e.Value = value;
@@ -744,9 +741,7 @@ cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const
{
return this->Value.c_str();
}
- bool c = false;
- return
- this->Properties.GetPropertyValue(prop, cmProperty::CACHE, c);
+ return this->Properties.GetPropertyValue(prop);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 481de19..bd949bb 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2438,7 +2438,6 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
{
// Package
cmTarget target;
- target.GetProperties().SetCMakeInstance(this->CMakeInstance);
target.SetType(cmTarget::GLOBAL_TARGET, name);
target.SetProperty("EXCLUDE_FROM_ALL","TRUE");
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 9c0d4b1..bc308f1 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -213,8 +213,6 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$");
#endif
- this->Properties.SetCMakeInstance(this->GetCMakeInstance());
-
{
const char* dir = this->GetCMakeInstance()->GetHomeDirectory();
this->AddDefinition("CMAKE_SOURCE_DIR", dir);
@@ -4134,11 +4132,13 @@ void cmMakefile::AppendProperty(const std::string& prop,
const char *cmMakefile::GetProperty(const std::string& prop) const
{
- return this->GetProperty(prop, cmProperty::DIRECTORY);
+ const bool chain = this->GetState()->
+ IsPropertyChained(prop, cmProperty::DIRECTORY);
+ return this->GetProperty(prop, chain);
}
const char *cmMakefile::GetProperty(const std::string& prop,
- cmProperty::ScopeType scope) const
+ bool chain) const
{
// watch for specific properties
static std::string output;
@@ -4242,15 +4242,13 @@ const char *cmMakefile::GetProperty(const std::string& prop,
return output.c_str();
}
- bool chain = false;
- const char *retVal =
- this->Properties.GetPropertyValue(prop, scope, chain);
- if (chain)
+ const char *retVal = this->Properties.GetPropertyValue(prop);
+ if (!retVal && chain)
{
if(this->LocalGenerator->GetParent())
{
return this->LocalGenerator->GetParent()->GetMakefile()->
- GetProperty(prop, scope);
+ GetProperty(prop, chain);
}
return this->GetState()->GetGlobalProperty(prop);
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index def0c23..7518631 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -717,8 +717,7 @@ public:
void AppendProperty(const std::string& prop, const char *value,
bool asString=false);
const char *GetProperty(const std::string& prop) const;
- const char *GetProperty(const std::string& prop,
- cmProperty::ScopeType scope) const;
+ const char *GetProperty(const std::string& prop, bool chain) const;
bool GetPropertyAsBool(const std::string& prop) const;
const char* GetFeature(const std::string& feature,
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index de2cd05..ef09dbc 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -57,22 +57,13 @@ void cmPropertyMap::AppendProperty(const std::string& name, const char* value,
}
const char *cmPropertyMap
-::GetPropertyValue(const std::string& name,
- cmProperty::ScopeType scope,
- bool &chain) const
+::GetPropertyValue(const std::string& name) const
{
- chain = false;
assert(!name.empty());
cmPropertyMap::const_iterator it = this->find(name);
if (it == this->end())
{
- // should we chain up?
- if (this->CMakeInstance)
- {
- chain = this->CMakeInstance->GetState()->
- IsPropertyChained(name,scope);
- }
return 0;
}
return it->second.GetValue();
diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h
index 722732b..a9062db 100644
--- a/Source/cmPropertyMap.h
+++ b/Source/cmPropertyMap.h
@@ -14,8 +14,6 @@
#include "cmProperty.h"
-class cmake;
-
class cmPropertyMap : public std::map<std::string,cmProperty>
{
public:
@@ -26,16 +24,7 @@ public:
void AppendProperty(const std::string& name, const char* value,
bool asString=false);
- const char *GetPropertyValue(const std::string& name,
- cmProperty::ScopeType scope,
- bool &chain) const;
-
- void SetCMakeInstance(cmake *cm) { this->CMakeInstance = cm; }
-
- cmPropertyMap() { this->CMakeInstance = 0;}
-
-private:
- cmake *CMakeInstance;
+ const char *GetPropertyValue(const std::string& name) const;
};
#endif
diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx
index e9cfacc..53dc5a8 100644
--- a/Source/cmSetTestsPropertiesCommand.cxx
+++ b/Source/cmSetTestsPropertiesCommand.cxx
@@ -85,8 +85,10 @@ bool cmSetTestsPropertiesCommand
unsigned int k;
for (k = 0; k < propertyPairs.size(); k = k + 2)
{
- test->SetProperty(propertyPairs[k],
- propertyPairs[k+1].c_str());
+ if (!propertyPairs[k].empty())
+ {
+ test->SetProperty(propertyPairs[k], propertyPairs[k+1].c_str());
+ }
}
}
else
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index df511d8..86f0a7a 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -22,7 +22,6 @@ cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name):
Location(mf, name)
{
this->CustomCommand = 0;
- this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
this->FindFullPathFailed = false;
this->IsUiFile = (".ui" ==
cmSystemTools::GetFilenameLastExtension(this->Location.GetName()));
@@ -361,13 +360,16 @@ const char* cmSourceFile::GetProperty(const std::string& prop) const
}
}
- bool chain = false;
- const char *retVal =
- this->Properties.GetPropertyValue(prop, cmProperty::SOURCE_FILE, chain);
- if (chain)
+ const char *retVal = this->Properties.GetPropertyValue(prop);
+ if (!retVal)
{
cmMakefile const* mf = this->Location.GetMakefile();
- return mf->GetProperty(prop,cmProperty::SOURCE_FILE);
+ const bool chain = mf->GetState()->
+ IsPropertyChained(prop, cmProperty::SOURCE_FILE);
+ if (chain)
+ {
+ return mf->GetProperty(prop, chain);
+ }
}
return retVal;
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 7bfeda1..25b4966 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -482,9 +482,7 @@ const char *cmState::GetGlobalProperty(const std::string& prop)
return FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT) + 1;
}
#undef STRING_LIST_ELEMENT
- bool dummy = false;
- return this->GlobalProperties.GetPropertyValue(prop, cmProperty::GLOBAL,
- dummy);
+ return this->GlobalProperties.GetPropertyValue(prop);
}
bool cmState::GetGlobalPropertyAsBool(const std::string& prop)
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 8731632..d1399ef 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -286,9 +286,6 @@ void cmTarget::SetMakefile(cmMakefile* mf)
// Set our makefile.
this->Makefile = mf;
- // set the cmake instance of the properties
- this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
-
// Check whether this is a DLL platform.
this->DLLPlatform = (this->Makefile->IsOn("WIN32") ||
this->Makefile->IsOn("CYGWIN") ||
@@ -3167,12 +3164,15 @@ const char *cmTarget::GetProperty(const std::string& prop,
}
}
- bool chain = false;
- const char *retVal =
- this->Properties.GetPropertyValue(prop, cmProperty::TARGET, chain);
- if (chain)
+ const char *retVal = this->Properties.GetPropertyValue(prop);
+ if (!retVal)
{
- return this->Makefile->GetProperty(prop, cmProperty::TARGET);
+ const bool chain = this->GetMakefile()->GetState()->
+ IsPropertyChained(prop, cmProperty::TARGET);
+ if (chain)
+ {
+ return this->Makefile->GetProperty(prop, chain);
+ }
}
return retVal;
}
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index c606859..6fcd0dc 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -21,7 +21,6 @@ cmTest::cmTest(cmMakefile* mf)
{
this->Makefile = mf;
this->OldStyle = true;
- this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
}
//----------------------------------------------------------------------------
@@ -50,12 +49,15 @@ void cmTest::SetCommand(std::vector<std::string> const& command)
//----------------------------------------------------------------------------
const char *cmTest::GetProperty(const std::string& prop) const
{
- bool chain = false;
- const char *retVal =
- this->Properties.GetPropertyValue(prop, cmProperty::TEST, chain);
- if (chain)
+ const char *retVal = this->Properties.GetPropertyValue(prop);
+ if (!retVal)
{
- return this->Makefile->GetProperty(prop,cmProperty::TEST);
+ const bool chain = this->Makefile->GetState()->
+ IsPropertyChained(prop, cmProperty::TEST);
+ if (chain)
+ {
+ return this->Makefile->GetProperty(prop, chain);
+ }
}
return retVal;
}