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.
This commit is contained in:
parent
3ac4b90bfd
commit
5181fae264
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue