From 7b8a990424228716cc3161027dcf2c18ef9793b6 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 11 Mar 2014 00:22:02 -0400 Subject: [PATCH] perf: Cache the language property string --- Source/cmSourceFile.cxx | 6 ++++-- Source/cmSourceFile.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 3b130ec61..b833d3fd4 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -40,6 +40,8 @@ std::string const& cmSourceFile::GetExtension() const return this->Extension; } +const std::string cmSourceFile::propLANGUAGE = "LANGUAGE"; + //---------------------------------------------------------------------------- void cmSourceFile::SetObjectLibrary(std::string const& objlib) { @@ -56,7 +58,7 @@ std::string cmSourceFile::GetObjectLibrary() const std::string cmSourceFile::GetLanguage() { // 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; } @@ -93,7 +95,7 @@ std::string cmSourceFile::GetLanguage() std::string cmSourceFile::GetLanguage() const { // 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; } diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 42d6f8af2..bdcdbfd4c 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -117,6 +117,8 @@ private: void CheckLanguage(std::string const& ext); std::vector Depends; + + static const std::string propLANGUAGE; }; // TODO: Factor out into platform information modules.