summaryrefslogtreecommitdiff
path: root/Source/cmExtraCodeBlocksGenerator.cxx
diff options
context:
space:
mode:
authorAaron Orenstein <aorenste@fb.com>2017-08-11 14:11:18 -0700
committerAaron Orenstein <aorenste@fb.com>2017-08-16 15:35:38 -0700
commitaf3fd6f22f317d4209ff679e4f7c8dd8d2d0f89f (patch)
treef032e00aecd7a92e828b4f8bf0d3229f3bab307a /Source/cmExtraCodeBlocksGenerator.cxx
parentc47c011c77bfd1bfb8d2060511a2b957ce181c62 (diff)
downloadcmake-af3fd6f22f317d4209ff679e4f7c8dd8d2d0f89f.tar.gz
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/cmExtraCodeBlocksGenerator.cxx')
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 5b7b82762f..e7a8975992 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -296,8 +296,9 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
// and UTILITY targets
for (std::vector<cmLocalGenerator*>::const_iterator lg = lgs.begin();
lg != lgs.end(); lg++) {
- std::vector<cmGeneratorTarget*> targets = (*lg)->GetGeneratorTargets();
- for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
+ const std::vector<cmGeneratorTarget*>& targets =
+ (*lg)->GetGeneratorTargets();
+ for (std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin();
ti != targets.end(); ti++) {
std::string targetName = (*ti)->GetName();
switch ((*ti)->GetType()) {
@@ -359,8 +360,9 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
for (std::vector<cmLocalGenerator*>::const_iterator lg = lgs.begin();
lg != lgs.end(); lg++) {
cmMakefile* makefile = (*lg)->GetMakefile();
- std::vector<cmGeneratorTarget*> targets = (*lg)->GetGeneratorTargets();
- for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
+ const std::vector<cmGeneratorTarget*>& targets =
+ (*lg)->GetGeneratorTargets();
+ for (std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin();
ti != targets.end(); ti++) {
switch ((*ti)->GetType()) {
case cmStateEnums::EXECUTABLE: