[Cmake-commits] CMake branch, master, updated. v3.9.1-506-g999192b

Kitware Robot kwrobot at kitware.com
Thu Aug 17 16:45:04 EDT 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  999192b0f7a1ccf9eb68a8338bfcbb3c13368b99 (commit)
       via  af3fd6f22f317d4209ff679e4f7c8dd8d2d0f89f (commit)
      from  d3760354a522fa91dcef88aa768fa22654636686 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=999192b0f7a1ccf9eb68a8338bfcbb3c13368b99
commit 999192b0f7a1ccf9eb68a8338bfcbb3c13368b99
Merge: d376035 af3fd6f
Author:     Craig Scott <craig.scott at crascit.com>
AuthorDate: Thu Aug 17 20:38:03 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Aug 17 16:38:24 2017 -0400

    Merge topic 'perf-targetIterAndLookup-cmLocalGenerator'
    
    af3fd6f2 Performance: Add an index to Change cmLocalGenerator::GeneratorTargets.
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1136


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=af3fd6f22f317d4209ff679e4f7c8dd8d2d0f89f
commit af3fd6f22f317d4209ff679e4f7c8dd8d2d0f89f
Author:     Aaron Orenstein <aorenste at fb.com>
AuthorDate: Fri Aug 11 14:11:18 2017 -0700
Commit:     Aaron Orenstein <aorenste at fb.com>
CommitDate: Wed Aug 16 15:35:38 2017 -0700

    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.

diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index ff19eac..8a3a671 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -161,7 +161,7 @@ void cmComputeTargetDepends::CollectTargets()
   std::vector<cmLocalGenerator*> const& lgens =
     this->GlobalGenerator->GetLocalGenerators();
   for (unsigned int i = 0; i < lgens.size(); ++i) {
-    const std::vector<cmGeneratorTarget*> targets =
+    const std::vector<cmGeneratorTarget*>& targets =
       lgens[i]->GetGeneratorTargets();
     for (std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin();
          ti != targets.end(); ++ti) {
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 5b7b827..e7a8975 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:
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index b478f34..96502d5 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -292,8 +292,9 @@ void cmExtraCodeLiteGenerator::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++) {
       projectType = CollectSourceFiles(makefile, *ti, cFiles, otherFiles);
     }
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 2a6ce98..473af37 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -475,7 +475,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml)
          this->GlobalGenerator->GetLocalGenerators().begin();
        lgIt != this->GlobalGenerator->GetLocalGenerators().end(); ++lgIt) {
     cmMakefile* makefile = (*lgIt)->GetMakefile();
-    const std::vector<cmGeneratorTarget*> targets =
+    const std::vector<cmGeneratorTarget*>& targets =
       (*lgIt)->GetGeneratorTargets();
 
     for (std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin();
@@ -853,8 +853,9 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
   for (std::vector<cmLocalGenerator*>::const_iterator it =
          this->GlobalGenerator->GetLocalGenerators().begin();
        it != this->GlobalGenerator->GetLocalGenerators().end(); ++it) {
-    std::vector<cmGeneratorTarget*> targets = (*it)->GetGeneratorTargets();
-    for (std::vector<cmGeneratorTarget*>::iterator l = targets.begin();
+    const std::vector<cmGeneratorTarget*>& targets =
+      (*it)->GetGeneratorTargets();
+    for (std::vector<cmGeneratorTarget*>::const_iterator l = targets.begin();
          l != targets.end(); ++l) {
       std::vector<std::string> includeDirs;
       std::string config = mf->GetSafeDefinition("CMAKE_BUILD_TYPE");
@@ -910,7 +911,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
   for (std::vector<cmLocalGenerator*>::const_iterator it =
          this->GlobalGenerator->GetLocalGenerators().begin();
        it != this->GlobalGenerator->GetLocalGenerators().end(); ++it) {
-    const std::vector<cmGeneratorTarget*> targets =
+    const std::vector<cmGeneratorTarget*>& targets =
       (*it)->GetGeneratorTargets();
     std::string subdir = (*it)->ConvertToRelativePath(
       this->HomeOutputDirectory, (*it)->GetCurrentBinaryDirectory());
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index 3730433..e366774 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -115,7 +115,7 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
   for (std::vector<cmLocalGenerator*>::const_iterator it =
          this->GlobalGenerator->GetLocalGenerators().begin();
        it != this->GlobalGenerator->GetLocalGenerators().end(); ++it) {
-    const std::vector<cmGeneratorTarget*> targets =
+    const std::vector<cmGeneratorTarget*>& targets =
       (*it)->GetGeneratorTargets();
     std::string currentDir = (*it)->GetCurrentBinaryDirectory();
     bool topLevel = (currentDir == (*it)->GetBinaryDirectory());
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 1fd1418..a62a546 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -185,8 +185,9 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
   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++) {
       std::string targetName = (*ti)->GetName();
       switch ((*ti)->GetType()) {
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;
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index e72c6e3..85a1417 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -128,8 +128,9 @@ bool cmGlobalKdevelopGenerator::CreateFilelistFile(
     }
 
     // get all sources
-    std::vector<cmGeneratorTarget*> targets = (*it)->GetGeneratorTargets();
-    for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
+    const std::vector<cmGeneratorTarget*>& targets =
+      (*it)->GetGeneratorTargets();
+    for (std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin();
          ti != targets.end(); ti++) {
       std::vector<cmSourceFile*> sources;
       cmGeneratorTarget* gt = *ti;
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 23b3718..e42bf20 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -382,8 +382,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefileLanguageRules(
   for (unsigned int i = 0; i < lGenerators.size(); ++i) {
     lg = static_cast<cmLocalUnixMakefileGenerator3*>(lGenerators[i]);
     // for all of out targets
-    std::vector<cmGeneratorTarget*> tgts = lg->GetGeneratorTargets();
-    for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+    const std::vector<cmGeneratorTarget*>& tgts = lg->GetGeneratorTargets();
+    for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
          l != tgts.end(); l++) {
       if (((*l)->GetType() == cmStateEnums::EXECUTABLE) ||
           ((*l)->GetType() == cmStateEnums::STATIC_LIBRARY) ||
@@ -414,8 +414,8 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2(
   // The directory-level rule should depend on the target-level rules
   // for all targets in the directory.
   std::vector<std::string> depends;
-  std::vector<cmGeneratorTarget*> targets = lg->GetGeneratorTargets();
-  for (std::vector<cmGeneratorTarget*>::iterator l = targets.begin();
+  const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets();
+  for (std::vector<cmGeneratorTarget*>::const_iterator l = targets.begin();
        l != targets.end(); ++l) {
     cmGeneratorTarget* gtarget = *l;
     int type = gtarget->GetType();
@@ -547,8 +547,8 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules(
   for (i = 0; i < this->LocalGenerators.size(); ++i) {
     lg = static_cast<cmLocalUnixMakefileGenerator3*>(this->LocalGenerators[i]);
     // for each target Generate the rule files for each target.
-    std::vector<cmGeneratorTarget*> targets = lg->GetGeneratorTargets();
-    for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
+    const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets();
+    for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin();
          t != targets.end(); ++t) {
       cmGeneratorTarget* gtarget = *t;
       // Don't emit the same rule twice (e.g. two targets with the same
@@ -629,8 +629,8 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
   depends.push_back("cmake_check_build_system");
 
   // for each target Generate the rule files for each target.
-  std::vector<cmGeneratorTarget*> targets = lg->GetGeneratorTargets();
-  for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
+  const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets();
+  for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin();
        t != targets.end(); ++t) {
     cmGeneratorTarget* gtarget = *t;
     int type = gtarget->GetType();
@@ -807,7 +807,7 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks()
          this->LocalGenerators.begin();
        lgi != this->LocalGenerators.end(); ++lgi) {
     cmLocalGenerator* lg = *lgi;
-    std::vector<cmGeneratorTarget*> targets = lg->GetGeneratorTargets();
+    const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets();
     for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin();
          t != targets.end(); ++t) {
       cmGeneratorTarget* gt = *t;
@@ -952,8 +952,9 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule(
     // the targets
     if (lg2 == lg || lg->IsRootMakefile()) {
       // for each target Generate the rule files for each target.
-      std::vector<cmGeneratorTarget*> targets = lg2->GetGeneratorTargets();
-      for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
+      const std::vector<cmGeneratorTarget*>& targets =
+        lg2->GetGeneratorTargets();
+      for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin();
            t != targets.end(); ++t) {
         cmGeneratorTarget* target = *t;
         cmStateEnums::TargetType type = target->GetType();
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 7e953ce..015f887 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -420,7 +420,8 @@ int cmGraphVizWriter::CollectAllTargets()
   for (std::vector<cmLocalGenerator*>::const_iterator lit =
          this->LocalGenerators.begin();
        lit != this->LocalGenerators.end(); ++lit) {
-    std::vector<cmGeneratorTarget*> targets = (*lit)->GetGeneratorTargets();
+    const std::vector<cmGeneratorTarget*>& targets =
+      (*lit)->GetGeneratorTargets();
     for (std::vector<cmGeneratorTarget*>::const_iterator it = targets.begin();
          it != targets.end(); ++it) {
       const char* realTargetName = (*it)->GetName().c_str();
@@ -445,7 +446,8 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
   for (std::vector<cmLocalGenerator*>::const_iterator lit =
          this->LocalGenerators.begin();
        lit != this->LocalGenerators.end(); ++lit) {
-    std::vector<cmGeneratorTarget*> targets = (*lit)->GetGeneratorTargets();
+    const std::vector<cmGeneratorTarget*>& targets =
+      (*lit)->GetGeneratorTargets();
     for (std::vector<cmGeneratorTarget*>::const_iterator it = targets.begin();
          it != targets.end(); ++it) {
       const char* realTargetName = (*it)->GetName().c_str();
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 2c5db10..2c8157e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -214,8 +214,8 @@ void cmLocalGenerator::TraceDependencies()
     this->GlobalGenerator->CreateEvaluationSourceFiles(*ci);
   }
   // Generate the rule files for each target.
-  std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
-  for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
+  const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets();
+  for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin();
        t != targets.end(); ++t) {
     if ((*t)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
@@ -548,6 +548,8 @@ 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->GlobalGenerator->IndexGeneratorTarget(gt);
 }
 
@@ -581,11 +583,10 @@ private:
 cmGeneratorTarget* cmLocalGenerator::FindLocalNonAliasGeneratorTarget(
   const std::string& name) const
 {
-  std::vector<cmGeneratorTarget*>::const_iterator ti =
-    std::find_if(this->GeneratorTargets.begin(), this->GeneratorTargets.end(),
-                 NamedGeneratorTargetFinder(name));
-  if (ti != this->GeneratorTargets.end()) {
-    return *ti;
+  GeneratorTargetMap::const_iterator ti =
+    this->GeneratorTargetSearchIndex.find(name);
+  if (ti != this->GeneratorTargetSearchIndex.end()) {
+    return ti->second;
   }
   return CM_NULLPTR;
 }
@@ -600,8 +601,8 @@ void cmLocalGenerator::ComputeTargetManifest()
   }
 
   // Add our targets to the manifest for each configuration.
-  std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
-  for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
+  const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets();
+  for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin();
        t != targets.end(); ++t) {
     cmGeneratorTarget* target = *t;
     if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
@@ -625,8 +626,8 @@ bool cmLocalGenerator::ComputeTargetCompileFeatures()
   }
 
   // Process compile features of all targets.
-  std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
-  for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
+  const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets();
+  for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin();
        t != targets.end(); ++t) {
     cmGeneratorTarget* target = *t;
     for (std::vector<std::string>::iterator ci = configNames.begin();
@@ -2121,8 +2122,8 @@ void cmLocalGenerator::GenerateTargetInstallRules(
 {
   // Convert the old-style install specification from each target to
   // an install generator and run it.
-  std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
-  for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+  const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets();
+  for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
        l != tgts.end(); ++l) {
     if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 9f78be4..9083c83 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -16,6 +16,7 @@
 #include "cmOutputConverter.h"
 #include "cmPolicies.h"
 #include "cmStateSnapshot.h"
+#include "cm_unordered_map.hxx"
 #include "cmake.h"
 
 class cmComputeLinkInformation;
@@ -353,8 +354,11 @@ protected:
   std::string::size_type ObjectPathMax;
   std::set<std::string> ObjectMaxPathViolations;
 
-  std::set<cmGeneratorTarget const*> WarnCMP0063;
+  typedef CM_UNORDERED_MAP<std::string, cmGeneratorTarget*> GeneratorTargetMap;
+  GeneratorTargetMap GeneratorTargetSearchIndex;
   std::vector<cmGeneratorTarget*> GeneratorTargets;
+
+  std::set<cmGeneratorTarget const*> WarnCMP0063;
   std::vector<cmGeneratorTarget*> ImportedGeneratorTargets;
   std::vector<cmGeneratorTarget*> OwnedImportedGeneratorTargets;
   std::map<std::string, std::string> AliasTargets;
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 266710c..9fa3ca5 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -79,8 +79,8 @@ void cmLocalNinjaGenerator::Generate()
     }
   }
 
-  std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
-  for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
+  const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets();
+  for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin();
        t != targets.end(); ++t) {
     if ((*t)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 9b9d22c..2d10021 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -116,10 +116,10 @@ void cmLocalUnixMakefileGenerator3::Generate()
     this->Makefile->IsOn("CMAKE_SKIP_ASSEMBLY_SOURCE_RULES");
 
   // Generate the rule files for each target.
-  std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
+  const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets();
   cmGlobalUnixMakefileGenerator3* gg =
     static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
-  for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
+  for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin();
        t != targets.end(); ++t) {
     if ((*t)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
@@ -172,8 +172,8 @@ void cmLocalUnixMakefileGenerator3::ComputeObjectFilenames(
 void cmLocalUnixMakefileGenerator3::GetLocalObjectFiles(
   std::map<std::string, LocalObjectInfo>& localObjectFiles)
 {
-  std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
-  for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
+  const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets();
+  for (std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin();
        ti != targets.end(); ++ti) {
     cmGeneratorTarget* gt = *ti;
     if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
@@ -382,9 +382,9 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
 
   // for each target we just provide a rule to cd up to the top and do a make
   // on the target
-  std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
+  const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets();
   std::string localName;
-  for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
+  for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin();
        t != targets.end(); ++t) {
     if (((*t)->GetType() == cmStateEnums::EXECUTABLE) ||
         ((*t)->GetType() == cmStateEnums::STATIC_LIBRARY) ||
@@ -1562,8 +1562,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
   this->WriteDivider(ruleFileStream);
   ruleFileStream << "# Targets provided globally by CMake.\n"
                  << "\n";
-  std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
-  std::vector<cmGeneratorTarget*>::iterator glIt;
+  const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets();
+  std::vector<cmGeneratorTarget*>::const_iterator glIt;
   for (glIt = targets.begin(); glIt != targets.end(); ++glIt) {
     if ((*glIt)->GetType() == cmStateEnums::GLOBAL_TARGET) {
       std::string targetString =

-----------------------------------------------------------------------

Summary of changes:
 Source/cmComputeTargetDepends.cxx         |    2 +-
 Source/cmExtraCodeBlocksGenerator.cxx     |   10 ++++++----
 Source/cmExtraCodeLiteGenerator.cxx       |    5 +++--
 Source/cmExtraEclipseCDT4Generator.cxx    |    9 +++++----
 Source/cmExtraKateGenerator.cxx           |    2 +-
 Source/cmExtraSublimeTextGenerator.cxx    |    5 +++--
 Source/cmGlobalGenerator.cxx              |    8 ++++----
 Source/cmGlobalKdevelopGenerator.cxx      |    5 +++--
 Source/cmGlobalUnixMakefileGenerator3.cxx |   23 ++++++++++++-----------
 Source/cmGraphVizWriter.cxx               |    6 ++++--
 Source/cmLocalGenerator.cxx               |   27 ++++++++++++++-------------
 Source/cmLocalGenerator.h                 |    6 +++++-
 Source/cmLocalNinjaGenerator.cxx          |    4 ++--
 Source/cmLocalUnixMakefileGenerator3.cxx  |   16 ++++++++--------
 14 files changed, 71 insertions(+), 57 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list