summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-01-31 13:34:41 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-01-31 13:34:59 (GMT)
commita7ee918f197300ffed8f4ae0fafe6c3c2f4ea1b6 (patch)
treecf4e1a754da10d718b6f3b5c81d3edb95597b221
parent3fd01be56bfa0215bcabbe27f1690654c3755b43 (diff)
parentaed227fd5ae6775a5bbdd54540666a70163c9fcb (diff)
downloadCMake-a7ee918f197300ffed8f4ae0fafe6c3c2f4ea1b6.zip
CMake-a7ee918f197300ffed8f4ae0fafe6c3c2f4ea1b6.tar.gz
CMake-a7ee918f197300ffed8f4ae0fafe6c3c2f4ea1b6.tar.bz2
Merge topic 'generate_speedup'
aed227fd cmLocalGenerator: change ImportedGeneratorTargets from vector to map 4443adc1 cmLocalGenerator: remove public GetImportedGeneratorTargets Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Attila Krasznahorkay <attila.krasznahorkay@gmail.com> Merge-request: !1717
-rw-r--r--Source/cmLocalGenerator.cxx28
-rw-r--r--Source/cmLocalGenerator.h7
2 files changed, 6 insertions, 29 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 859aa44..afdcc84 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -553,14 +553,13 @@ void cmLocalGenerator::GenerateInstallRules()
void cmLocalGenerator::AddGeneratorTarget(cmGeneratorTarget* gt)
{
this->GeneratorTargets.push_back(gt);
- this->GeneratorTargetSearchIndex.insert(
- std::pair<std::string, cmGeneratorTarget*>(gt->GetName(), gt));
+ this->GeneratorTargetSearchIndex.emplace(gt->GetName(), gt);
this->GlobalGenerator->IndexGeneratorTarget(gt);
}
void cmLocalGenerator::AddImportedGeneratorTarget(cmGeneratorTarget* gt)
{
- this->ImportedGeneratorTargets.push_back(gt);
+ this->ImportedGeneratorTargets.emplace(gt->GetName(), gt);
this->GlobalGenerator->IndexGeneratorTarget(gt);
}
@@ -569,22 +568,6 @@ void cmLocalGenerator::AddOwnedImportedGeneratorTarget(cmGeneratorTarget* gt)
this->OwnedImportedGeneratorTargets.push_back(gt);
}
-struct NamedGeneratorTargetFinder
-{
- NamedGeneratorTargetFinder(std::string const& name)
- : Name(name)
- {
- }
-
- bool operator()(cmGeneratorTarget* tgt)
- {
- return tgt->GetName() == this->Name;
- }
-
-private:
- std::string Name;
-};
-
cmGeneratorTarget* cmLocalGenerator::FindLocalNonAliasGeneratorTarget(
const std::string& name) const
{
@@ -1395,11 +1378,10 @@ void cmLocalGenerator::AddLanguageFlagsForLinking(
cmGeneratorTarget* cmLocalGenerator::FindGeneratorTargetToUse(
const std::string& name) const
{
- std::vector<cmGeneratorTarget*>::const_iterator imported = std::find_if(
- this->ImportedGeneratorTargets.begin(),
- this->ImportedGeneratorTargets.end(), NamedGeneratorTargetFinder(name));
+ GeneratorTargetMap::const_iterator imported =
+ this->ImportedGeneratorTargets.find(name);
if (imported != this->ImportedGeneratorTargets.end()) {
- return *imported;
+ return imported->second;
}
if (cmGeneratorTarget* t = this->FindLocalNonAliasGeneratorTarget(name)) {
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index a66fa6e..58bbe77 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -139,11 +139,6 @@ public:
return this->GeneratorTargets;
}
- const std::vector<cmGeneratorTarget*>& GetImportedGeneratorTargets() const
- {
- return this->ImportedGeneratorTargets;
- }
-
void AddGeneratorTarget(cmGeneratorTarget* gt);
void AddImportedGeneratorTarget(cmGeneratorTarget* gt);
void AddOwnedImportedGeneratorTarget(cmGeneratorTarget* gt);
@@ -394,7 +389,7 @@ protected:
std::vector<cmGeneratorTarget*> GeneratorTargets;
std::set<cmGeneratorTarget const*> WarnCMP0063;
- std::vector<cmGeneratorTarget*> ImportedGeneratorTargets;
+ GeneratorTargetMap ImportedGeneratorTargets;
std::vector<cmGeneratorTarget*> OwnedImportedGeneratorTargets;
std::map<std::string, std::string> AliasTargets;