perf: Cache the language property string

This commit is contained in:
Ben Boeckel 2014-03-11 00:22:02 -04:00 committed by Ben Boeckel
parent 10baf00f3d
commit 7b8a990424
2 changed files with 6 additions and 2 deletions

View File

@ -40,6 +40,8 @@ std::string const& cmSourceFile::GetExtension() const
return this->Extension; return this->Extension;
} }
const std::string cmSourceFile::propLANGUAGE = "LANGUAGE";
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmSourceFile::SetObjectLibrary(std::string const& objlib) void cmSourceFile::SetObjectLibrary(std::string const& objlib)
{ {
@ -56,7 +58,7 @@ std::string cmSourceFile::GetObjectLibrary() const
std::string cmSourceFile::GetLanguage() std::string cmSourceFile::GetLanguage()
{ {
// If the language was set explicitly by the user then use it. // If the language was set explicitly by the user then use it.
if(const char* lang = this->GetProperty("LANGUAGE")) if(const char* lang = this->GetProperty(propLANGUAGE))
{ {
return lang; return lang;
} }
@ -93,7 +95,7 @@ std::string cmSourceFile::GetLanguage()
std::string cmSourceFile::GetLanguage() const std::string cmSourceFile::GetLanguage() const
{ {
// If the language was set explicitly by the user then use it. // If the language was set explicitly by the user then use it.
if(const char* lang = this->GetProperty("LANGUAGE")) if(const char* lang = this->GetProperty(propLANGUAGE))
{ {
return lang; return lang;
} }

View File

@ -117,6 +117,8 @@ private:
void CheckLanguage(std::string const& ext); void CheckLanguage(std::string const& ext);
std::vector<std::string> Depends; std::vector<std::string> Depends;
static const std::string propLANGUAGE;
}; };
// TODO: Factor out into platform information modules. // TODO: Factor out into platform information modules.