summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorAaron Orenstein <aorenste@fb.com>2017-08-11 21:11:18 (GMT)
committerAaron Orenstein <aorenste@fb.com>2017-08-16 22:35:38 (GMT)
commitaf3fd6f22f317d4209ff679e4f7c8dd8d2d0f89f (patch)
treef032e00aecd7a92e828b4f8bf0d3229f3bab307a /Source/cmGlobalGenerator.cxx
parentc47c011c77bfd1bfb8d2060511a2b957ce181c62 (diff)
downloadCMake-af3fd6f22f317d4209ff679e4f7c8dd8d2d0f89f.zip
CMake-af3fd6f22f317d4209ff679e4f7c8dd8d2d0f89f.tar.gz
CMake-af3fd6f22f317d4209ff679e4f7c8dd8d2d0f89f.tar.bz2
Performance: Add an index to Change cmLocalGenerator::GeneratorTargets.
Add an index to Change cmLocalGenerator::GeneratorTargets for faster lookup by name. Also changed a bunch of uses of cmLocalGenerator::GetGeneratorTargets() to take const references instead of copying the vector. Represent generator targets as a map (name -> target) to make name lookups more efficient instead of looping through the entire vector to find the desired one.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 18d10c5..85ba5ee 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2594,9 +2594,9 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets,
continue;
}
// Get the targets in the makefile
- std::vector<cmGeneratorTarget*> tgts = (*i)->GetGeneratorTargets();
+ const std::vector<cmGeneratorTarget*>& tgts = (*i)->GetGeneratorTargets();
// loop over all the targets
- for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+ for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
l != tgts.end(); ++l) {
cmGeneratorTarget* target = *l;
if (this->IsRootOnlyTarget(target) &&
@@ -2789,9 +2789,9 @@ void cmGlobalGenerator::WriteSummary()
cmGeneratedFileStream fout(fname.c_str());
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) {
- std::vector<cmGeneratorTarget*> tgts =
+ const std::vector<cmGeneratorTarget*>& tgts =
this->LocalGenerators[i]->GetGeneratorTargets();
- for (std::vector<cmGeneratorTarget*>::iterator it = tgts.begin();
+ for (std::vector<cmGeneratorTarget*>::const_iterator it = tgts.begin();
it != tgts.end(); ++it) {
if ((*it)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;