[Cmake-commits] CMake branch, next, updated. v3.2.2-2270-gce6e191

Stephen Kelly steveire at gmail.com
Tue Apr 28 19:10:25 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  ce6e191ff8036edf510f5ee0ebb8e79d8ae054d2 (commit)
       via  28d80f11ba1be3126175904c16b148b20a868329 (commit)
       via  42a21db772fbe407babaf30ae822023004505248 (commit)
      from  cacf47a2354c547f40a0cbd6ad9aed248c216c0e (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=ce6e191ff8036edf510f5ee0ebb8e79d8ae054d2
commit ce6e191ff8036edf510f5ee0ebb8e79d8ae054d2
Merge: cacf47a 28d80f1
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Apr 28 19:10:22 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Apr 28 19:10:22 2015 -0400

    Merge topic 'simplify-cmDefinitions-Closure' into next
    
    28d80f11 cmDefinitions: Replace recursion with loop.
    42a21db7 cmDefinitions: Replace private constructor with MakeClosure.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=28d80f11ba1be3126175904c16b148b20a868329
commit 28d80f11ba1be3126175904c16b148b20a868329
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Apr 26 15:49:43 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Apr 29 01:01:18 2015 +0200

    cmDefinitions: Replace recursion with loop.

diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index ccd20db..9ab6239 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -89,29 +89,27 @@ cmDefinitions cmDefinitions::MakeClosure() const
 void cmDefinitions::MakeClosure(std::set<std::string>& undefined,
                                 cmDefinitions const* defs)
 {
-  // Consider local definitions.
-  for(MapType::const_iterator mi = defs->Map.begin();
-      mi != defs->Map.end(); ++mi)
+  while(defs)
     {
-    // Use this key if it is not already set or unset.
-    if(this->Map.find(mi->first) == this->Map.end() &&
-       undefined.find(mi->first) == undefined.end())
+    // Consider local definitions.
+    for(MapType::const_iterator mi = defs->Map.begin();
+        mi != defs->Map.end(); ++mi)
       {
-      if(mi->second.Exists)
-        {
-        this->Map.insert(*mi);
-        }
-      else
+      // Use this key if it is not already set or unset.
+      if(this->Map.find(mi->first) == this->Map.end() &&
+         undefined.find(mi->first) == undefined.end())
         {
-        undefined.insert(mi->first);
+        if(mi->second.Exists)
+          {
+          this->Map.insert(*mi);
+          }
+        else
+          {
+          undefined.insert(mi->first);
+          }
         }
       }
-    }
-
-  // Traverse parents.
-  if(cmDefinitions const* up = defs->Up)
-    {
-    this->MakeClosure(undefined, up);
+    defs = defs->Up;
     }
 }
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=42a21db772fbe407babaf30ae822023004505248
commit 42a21db772fbe407babaf30ae822023004505248
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Apr 26 15:44:26 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Apr 29 01:01:17 2015 +0200

    cmDefinitions: Replace private constructor with MakeClosure.

diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 0556654..ccd20db 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -77,21 +77,16 @@ std::vector<std::string> cmDefinitions::LocalKeys() const
 }
 
 //----------------------------------------------------------------------------
-cmDefinitions cmDefinitions::Closure() const
-{
-  return cmDefinitions(ClosureTag(), this);
-}
-
-//----------------------------------------------------------------------------
-cmDefinitions::cmDefinitions(ClosureTag const&, cmDefinitions const* root):
-  Up(0)
+cmDefinitions cmDefinitions::MakeClosure() const
 {
   std::set<std::string> undefined;
-  this->ClosureImpl(undefined, root);
+  cmDefinitions closure;
+  closure.MakeClosure(undefined, this);
+  return closure;
 }
 
 //----------------------------------------------------------------------------
-void cmDefinitions::ClosureImpl(std::set<std::string>& undefined,
+void cmDefinitions::MakeClosure(std::set<std::string>& undefined,
                                 cmDefinitions const* defs)
 {
   // Consider local definitions.
@@ -116,7 +111,7 @@ void cmDefinitions::ClosureImpl(std::set<std::string>& undefined,
   // Traverse parents.
   if(cmDefinitions const* up = defs->Up)
     {
-    this->ClosureImpl(undefined, up);
+    this->MakeClosure(undefined, up);
     }
 }
 
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index 4664090..6917402 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -45,13 +45,11 @@ public:
   /** Get the set of all local keys.  */
   std::vector<std::string> LocalKeys() const;
 
-  /** Compute the closure of all defined keys with values.
-      This flattens the scope.  The result has no parent.  */
-  cmDefinitions Closure() const;
-
   /** Compute the set of all defined keys.  */
   std::vector<std::string> ClosureKeys() const;
 
+  cmDefinitions MakeClosure() const;
+
 private:
   // String with existence boolean.
   struct Def: public std::string
@@ -81,10 +79,7 @@ private:
   // Internal query and update methods.
   Def const& GetInternal(const std::string& key);
 
-  // Implementation of Closure() method.
-  struct ClosureTag {};
-  cmDefinitions(ClosureTag const&, cmDefinitions const* root);
-  void ClosureImpl(std::set<std::string>& undefined,
+  void MakeClosure(std::set<std::string>& undefined,
                    cmDefinitions const* defs);
 };
 
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index cbf32dd..5fc8647 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -63,7 +63,7 @@ public:
 
   void InitializeDefinitions(cmMakefile* parent)
   {
-    this->VarStack.top() = parent->Internal->VarStack.top().Closure();
+    this->VarStack.top() = parent->Internal->VarStack.top().MakeClosure();
   }
 
   const char* GetDefinition(std::string const& name)

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

Summary of changes:
 Source/cmDefinitions.cxx |   49 ++++++++++++++++++++--------------------------
 Source/cmDefinitions.h   |   11 +++--------
 Source/cmMakefile.cxx    |    2 +-
 3 files changed, 25 insertions(+), 37 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list