[Cmake-commits] CMake branch, next, updated. v3.2.2-2318-gc56d562

Stephen Kelly steveire at gmail.com
Wed Apr 29 17:17:58 EDT 2015


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, next has been updated
       via  c56d56295184eb9387cf40ea34f02c69e53bfa06 (commit)
       via  c9fc715e5290ef35b4aa125cff9a14195d221fcc (commit)
      from  fc61a05bcedf783768b6f39a8d45e9519064d987 (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c56d56295184eb9387cf40ea34f02c69e53bfa06
commit c56d56295184eb9387cf40ea34f02c69e53bfa06
Merge: fc61a05 c9fc715
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Apr 29 17:17:57 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Apr 29 17:17:57 2015 -0400

    Merge topic 'ClosureKeys-external-loop' into next
    
    c9fc715e cmDefinitions: Externalize looping for ClosureKeys.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c9fc715e5290ef35b4aa125cff9a14195d221fcc
commit c9fc715e5290ef35b4aa125cff9a14195d221fcc
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Apr 26 15:38:36 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Apr 29 23:16:57 2015 +0200

    cmDefinitions: Externalize looping for ClosureKeys.

diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 2ee2618..855dcba 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -112,26 +112,19 @@ void cmDefinitions::MakeClosure(std::set<std::string>& undefined,
 }
 
 //----------------------------------------------------------------------------
-std::vector<std::string> cmDefinitions::ClosureKeys() const
+std::vector<std::string>
+cmDefinitions::ClosureKeys(std::set<std::string>& bound) const
 {
   std::vector<std::string> defined;
-  std::set<std::string> bound;
-
-  cmDefinitions const* up = this;
-
-  while (up)
+  defined.reserve(this->Map.size());
+  for(MapType::const_iterator mi = this->Map.begin();
+      mi != this->Map.end(); ++mi)
     {
-    // Consider local definitions.
-    for(MapType::const_iterator mi = up->Map.begin();
-        mi != up->Map.end(); ++mi)
+    // Use this key if it is not already set or unset.
+    if(bound.insert(mi->first).second && mi->second.Exists)
       {
-      // Use this key if it is not already set or unset.
-      if(bound.insert(mi->first).second && mi->second.Exists)
-        {
-        defined.push_back(mi->first);
-        }
+      defined.push_back(mi->first);
       }
-    up = up->Up;
     }
   return defined;
 }
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index 6917402..211c8e1 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -45,8 +45,8 @@ public:
   /** Get the set of all local keys.  */
   std::vector<std::string> LocalKeys() const;
 
-  /** Compute the set of all defined keys.  */
-  std::vector<std::string> ClosureKeys() const;
+  std::vector<std::string>
+  ClosureKeys(std::set<std::string>& bound) const;
 
   cmDefinitions MakeClosure() const;
 
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 8cfb83a..e414808 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -96,7 +96,16 @@ public:
 
   std::vector<std::string> ClosureKeys() const
   {
-    return this->VarStack.back().ClosureKeys();
+    std::vector<std::string> closureKeys;
+    std::set<std::string> bound;
+    for (std::list<cmDefinitions>::const_reverse_iterator it =
+         this->VarStack.rbegin(); it != this->VarStack.rend(); ++it)
+      {
+      std::vector<std::string> const& localKeys = it->ClosureKeys(bound);
+      closureKeys.insert(closureKeys.end(),
+                         localKeys.begin(), localKeys.end());
+      }
+    return closureKeys;
   }
 
   void PopDefinitions()

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

Summary of changes:
 Source/cmDefinitions.cxx |   23 ++++++++---------------
 Source/cmDefinitions.h   |    4 ++--
 Source/cmMakefile.cxx    |   11 ++++++++++-
 3 files changed, 20 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list