From 55ecd818f6bf70590d61584a87aae7bba992e26d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 20:08:42 +0200 Subject: cmGlobalGenerator: Store languages as vector, not map. The second component of the map is never used. --- Source/cmGlobalGenerator.cxx | 17 ++++++++++------- Source/cmGlobalGenerator.h | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 35394b8..6a6a503 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -968,7 +968,13 @@ void cmGlobalGenerator::SetLanguageEnabled(const std::string& l, void cmGlobalGenerator::SetLanguageEnabledFlag(const std::string& l, cmMakefile* mf) { - this->LanguageEnabled[l] = true; + std::vector::iterator it = + std::lower_bound(this->LanguageEnabled.begin(), + this->LanguageEnabled.end(), l); + if (it == this->LanguageEnabled.end() || *it != l) + { + this->LanguageEnabled.insert(it, l); + } // Fill the language-to-extension map with the current variable // settings to make sure it is available for the try_compile() @@ -1079,7 +1085,8 @@ bool cmGlobalGenerator::IgnoreFile(const char* ext) const bool cmGlobalGenerator::GetLanguageEnabled(const std::string& l) const { - return (this->LanguageEnabled.find(l)!= this->LanguageEnabled.end()); + return std::binary_search(this->LanguageEnabled.begin(), + this->LanguageEnabled.end(), l); } void cmGlobalGenerator::ClearEnabledLanguages() @@ -1958,11 +1965,7 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, void cmGlobalGenerator::GetEnabledLanguages(std::vector& lang) const { - for(std::map::const_iterator i = - this->LanguageEnabled.begin(); i != this->LanguageEnabled.end(); ++i) - { - lang.push_back(i->first); - } + lang = this->LanguageEnabled; } int cmGlobalGenerator::GetLinkerPreference(const std::string& lang) const diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 5b9ddee..ce3f037 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -441,7 +441,7 @@ private: // If you add a new map here, make sure it is copied // in EnableLanguagesFromGenerator std::map IgnoreExtensions; - std::map LanguageEnabled; + std::vector LanguageEnabled; std::set LanguagesReady; // Ready for try_compile std::map OutputExtensions; std::map LanguageToOutputExtension; -- cgit v0.12