[Cmake-commits] CMake branch, master, updated. v3.9.1-536-g9a0a6f9

Kitware Robot kwrobot at kitware.com
Mon Aug 21 09:15:02 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  9a0a6f91ae5c8e25197d50e7045b6c4418f607b2 (commit)
       via  7bc65770171924e550d2937b07b54b83b9fb59ab (commit)
      from  b14fdea3a63c7c8d91b0b02c57d1254a106376de (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=9a0a6f91ae5c8e25197d50e7045b6c4418f607b2
commit 9a0a6f91ae5c8e25197d50e7045b6c4418f607b2
Merge: b14fdea 7bc6577
Author:     Craig Scott <craig.scott at crascit.com>
AuthorDate: Mon Aug 21 13:13:53 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Aug 21 09:13:59 2017 -0400

    Merge topic 'perf-targetIter-missedGenerators'
    
    7bc65770 Performance: Fix a few more unnecessary vector copies missed in af3fd6f
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1157


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7bc65770171924e550d2937b07b54b83b9fb59ab
commit 7bc65770171924e550d2937b07b54b83b9fb59ab
Author:     Aaron Orenstein <aorenste at fb.com>
AuthorDate: Fri Aug 18 07:59:52 2017 -0700
Commit:     Aaron Orenstein <aorenste at fb.com>
CommitDate: Fri Aug 18 07:59:52 2017 -0700

    Performance: Fix a few more unnecessary vector copies missed in af3fd6f

diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 42ab4d9..788a179 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -260,7 +260,7 @@ void cmGlobalGhsMultiGenerator::Generate()
     for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) {
       cmLocalGhsMultiGenerator* lg =
         static_cast<cmLocalGhsMultiGenerator*>(this->LocalGenerators[i]);
-      std::vector<cmGeneratorTarget*> tgts = lg->GetGeneratorTargets();
+      const std::vector<cmGeneratorTarget*>& tgts = lg->GetGeneratorTargets();
       this->UpdateBuildFiles(tgts);
     }
   }
@@ -436,9 +436,9 @@ std::string cmGlobalGhsMultiGenerator::GetFileNameFromPath(
 }
 
 void cmGlobalGhsMultiGenerator::UpdateBuildFiles(
-  std::vector<cmGeneratorTarget*> tgts)
+  const std::vector<cmGeneratorTarget*>& tgts)
 {
-  for (std::vector<cmGeneratorTarget*>::iterator tgtsI = tgts.begin();
+  for (std::vector<cmGeneratorTarget*>::const_iterator tgtsI = tgts.begin();
        tgtsI != tgts.end(); ++tgtsI) {
     const cmGeneratorTarget* tgt = *tgtsI;
     if (IsTgtForBuild(tgt)) {
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h
index 7b3eebb..05a3a3c 100644
--- a/Source/cmGlobalGhsMultiGenerator.h
+++ b/Source/cmGlobalGhsMultiGenerator.h
@@ -116,7 +116,7 @@ private:
     std::vector<cmsys::String>::const_iterator end,
     GhsMultiGpj::Types projType);
   static std::string GetFileNameFromPath(std::string const& path);
-  void UpdateBuildFiles(std::vector<cmGeneratorTarget*> tgts);
+  void UpdateBuildFiles(const std::vector<cmGeneratorTarget*>& tgts);
   bool IsTgtForBuild(const cmGeneratorTarget* tgt);
 
   std::vector<cmGeneratedFileStream*> TargetSubProjects;
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 7a42b72..ed1ef1b 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -320,10 +320,10 @@ void cmGlobalVisualStudio8Generator::AddExtraIDETargets()
   cmGlobalVisualStudio7Generator::AddExtraIDETargets();
   if (this->AddCheckTarget()) {
     for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) {
-      std::vector<cmGeneratorTarget*> tgts =
+      const std::vector<cmGeneratorTarget*>& tgts =
         this->LocalGenerators[i]->GetGeneratorTargets();
       // All targets depend on the build-system check target.
-      for (std::vector<cmGeneratorTarget*>::iterator ti = tgts.begin();
+      for (std::vector<cmGeneratorTarget*>::const_iterator ti = tgts.begin();
            ti != tgts.end(); ++ti) {
         if ((*ti)->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) {
           (*ti)->Target->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 87a22d1..f85e409 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -82,8 +82,10 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
       // Now make all targets depend on the ALL_BUILD target
       for (std::vector<cmLocalGenerator*>::iterator i = gen.begin();
            i != gen.end(); ++i) {
-        std::vector<cmGeneratorTarget*> targets = (*i)->GetGeneratorTargets();
-        for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
+        const std::vector<cmGeneratorTarget*>& targets =
+          (*i)->GetGeneratorTargets();
+        for (std::vector<cmGeneratorTarget*>::const_iterator t =
+               targets.begin();
              t != targets.end(); ++t) {
           cmGeneratorTarget* tgt = *t;
           if (tgt->GetType() == cmStateEnums::GLOBAL_TARGET ||
@@ -298,8 +300,10 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
     std::vector<cmLocalGenerator*>& gen = it->second;
     for (std::vector<cmLocalGenerator*>::iterator i = gen.begin();
          i != gen.end(); ++i) {
-      std::vector<cmGeneratorTarget*> targets = (*i)->GetGeneratorTargets();
-      for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
+      const std::vector<cmGeneratorTarget*>& targets =
+        (*i)->GetGeneratorTargets();
+      for (std::vector<cmGeneratorTarget*>::const_iterator ti =
+             targets.begin();
            ti != targets.end(); ++ti) {
         this->ComputeVSTargetDepends(*ti);
       }
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 071d49c..8f260ec 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -440,8 +440,8 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
       continue;
     }
 
-    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++) {
       cmGeneratorTarget* target = *l;
 
@@ -925,12 +925,12 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
   cmLocalGenerator* gen, std::vector<cmXCodeObject*>& targets)
 {
   this->SetCurrentLocalGenerator(gen);
-  std::vector<cmGeneratorTarget*> tgts =
+  const std::vector<cmGeneratorTarget*>& tgts =
     this->CurrentLocalGenerator->GetGeneratorTargets();
   typedef std::map<std::string, cmGeneratorTarget*, cmCompareTargets>
     cmSortedTargets;
   cmSortedTargets sortedTargets;
-  for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+  for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
        l != tgts.end(); l++) {
     sortedTargets[(*l)->GetName()] = *l;
   }
@@ -1210,7 +1210,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
 void cmGlobalXCodeGenerator::ForceLinkerLanguages()
 {
   for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) {
-    std::vector<cmGeneratorTarget*> tgts =
+    const std::vector<cmGeneratorTarget*>& tgts =
       this->LocalGenerators[i]->GetGeneratorTargets();
     // All targets depend on the build-system check target.
     for (std::vector<cmGeneratorTarget*>::const_iterator ti = tgts.begin();
@@ -2706,8 +2706,8 @@ bool cmGlobalXCodeGenerator::CreateGroups(
        i != generators.end(); ++i) {
     cmMakefile* mf = (*i)->GetMakefile();
     std::vector<cmSourceGroup> sourceGroups = mf->GetSourceGroups();
-    std::vector<cmGeneratorTarget*> tgts = (*i)->GetGeneratorTargets();
-    for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+    const std::vector<cmGeneratorTarget*>& tgts = (*i)->GetGeneratorTargets();
+    for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
          l != tgts.end(); l++) {
       cmGeneratorTarget* gtgt = *l;
 
diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx
index 5f37af5..ab6774e 100644
--- a/Source/cmLocalGhsMultiGenerator.cxx
+++ b/Source/cmLocalGhsMultiGenerator.cxx
@@ -20,9 +20,9 @@ cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator()
 
 void cmLocalGhsMultiGenerator::Generate()
 {
-  std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
+  const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets();
 
-  for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+  for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
        l != tgts.end(); ++l) {
     if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 85d4a73..db1776a 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -60,8 +60,8 @@ cmLocalVisualStudio10Generator::~cmLocalVisualStudio10Generator()
 void cmLocalVisualStudio10Generator::Generate()
 {
 
-  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/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index dd08e5b..857ce46 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -62,8 +62,8 @@ cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator()
 void cmLocalVisualStudio7Generator::AddHelperCommands()
 {
   // Now create GUIDs for targets
-  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;
@@ -91,8 +91,9 @@ void cmLocalVisualStudio7Generator::AddCMakeListsRules()
     // specification source changes.
     if (cmSourceFile* sf = this->CreateVCProjBuildRule()) {
       // Add the rule to targets that need 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::GLOBAL_TARGET) {
           continue;
@@ -110,8 +111,8 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
   // Visual Studio .NET 2003 Service Pack 1 will not run post-build
   // commands for targets in which no sources are built.  Add dummy
   // rules to force these targets to build.
-  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::GLOBAL_TARGET) {
       std::vector<std::string> no_depends;
@@ -150,10 +151,10 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles()
   }
 
   // Get the set of targets in this directory.
-  std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
+  const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets();
 
   // Create the project file for each target.
-  for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+  for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
        l != tgts.end(); l++) {
     if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
       continue;
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index 739ef43..355c394 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -42,8 +42,8 @@ void cmLocalXCodeGenerator::Generate()
 {
   cmLocalGenerator::Generate();
 
-  std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
-  for (std::vector<cmGeneratorTarget*>::iterator iter = targets.begin();
+  const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets();
+  for (std::vector<cmGeneratorTarget*>::const_iterator iter = targets.begin();
        iter != targets.end(); ++iter) {
     (*iter)->HasMacOSXRpathInstallNameDir("");
   }
@@ -53,8 +53,8 @@ void cmLocalXCodeGenerator::GenerateInstallRules()
 {
   cmLocalGenerator::GenerateInstallRules();
 
-  std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
-  for (std::vector<cmGeneratorTarget*>::iterator iter = targets.begin();
+  const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets();
+  for (std::vector<cmGeneratorTarget*>::const_iterator iter = targets.begin();
        iter != targets.end(); ++iter) {
     (*iter)->HasMacOSXRpathInstallNameDir("");
   }
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index baaf11a..2063c82 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -903,7 +903,7 @@ static Json::Value DumpTargetsList(
 
   std::vector<cmGeneratorTarget*> targetList;
   for (const auto& lgIt : generators) {
-    auto list = lgIt->GetGeneratorTargets();
+    const auto& list = lgIt->GetGeneratorTargets();
     targetList.insert(targetList.end(), list.begin(), list.end());
   }
   std::sort(targetList.begin(), targetList.end());

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

Summary of changes:
 Source/cmGlobalGhsMultiGenerator.cxx      |    6 +++---
 Source/cmGlobalGhsMultiGenerator.h        |    2 +-
 Source/cmGlobalVisualStudio8Generator.cxx |    4 ++--
 Source/cmGlobalVisualStudioGenerator.cxx  |   12 ++++++++----
 Source/cmGlobalXCodeGenerator.cxx         |   14 +++++++-------
 Source/cmLocalGhsMultiGenerator.cxx       |    4 ++--
 Source/cmLocalVisualStudio10Generator.cxx |    4 ++--
 Source/cmLocalVisualStudio7Generator.cxx  |   17 +++++++++--------
 Source/cmLocalXCodeGenerator.cxx          |    8 ++++----
 Source/cmServerProtocol.cxx               |    2 +-
 10 files changed, 39 insertions(+), 34 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list