[Cmake-commits] CMake branch, next, updated. v3.2.2-2132-g2957cd5
Stephen Kelly
steveire at gmail.com
Sun Apr 26 13:11:38 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 2957cd5ced0996b845a7756443c22d36f432d169 (commit)
via 4756cbffb43848b8990561a4a783da2cf48aa807 (commit)
via 18dce339403f77e2558012d5f94a2162baf3ab55 (commit)
via d67c3c879d504410d163ebbf6aa92725716b06d2 (commit)
via dcb443e897e59c1e9b878bf99ab8ddcab304fa9e (commit)
via b9a5bb7ffd11e29291f41a368652e2aae736b4bb (commit)
via 6447c3f530994342be10ffab4f80a655cf6a0ece (commit)
via f0034e57044def1c4f6fd3821353c33b18d5b984 (commit)
via 33b14b6711173d491a5efa914e19c942d5b371ef (commit)
from 5abf2f0f4d7b30d44c5cbbb81e5a4da77ccf3ec7 (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=2957cd5ced0996b845a7756443c22d36f432d169
commit 2957cd5ced0996b845a7756443c22d36f432d169
Merge: 5abf2f0 4756cbf
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Apr 26 13:11:37 2015 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun Apr 26 13:11:37 2015 -0400
Merge topic 'refactor-cmDefinitions' into next
4756cbff cmMakefile: Store definition stack as a vector.
18dce339 cmDefinitions: Remove Parent pointer.
d67c3c87 cmDefinitions: Convert MakeClosure into a static method.
dcb443e8 cmDefinitions: Implement MakeClosure in terms of a vector of ancestors.
b9a5bb7f cmDefinitions: Use vector of cmDefinitions* to create closure.
6447c3f5 cmDefinitions: Replace recursion with loop.
f0034e57 cmDefinitions: Replace private constructor with MakeClosure.
33b14b67 cmDefinitions: Externalize looping for ClosureKeys.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4756cbffb43848b8990561a4a783da2cf48aa807
commit 4756cbffb43848b8990561a4a783da2cf48aa807
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Apr 26 16:22:52 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Apr 26 19:11:17 2015 +0200
cmMakefile: Store definition stack as a vector.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 0acb486..a124105 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -46,23 +46,21 @@
class cmMakefile::Internals
{
public:
- std::list<cmDefinitions> VarStack;
+ std::vector<cmDefinitions> VarStack;
std::stack<std::set<std::string> > VarInitStack;
std::stack<std::set<std::string> > VarUsageStack;
bool IsSourceFileTryCompile;
void PushDefinitions()
{
- this->VarStack.push_back(cmDefinitions());
+ this->VarStack.resize(this->VarStack.size() + 1);
}
void InitializeDefinitions(cmMakefile* parent)
{
std::vector<cmDefinitions const*> defPtrs;
- defPtrs.reserve(this->VarStack.size());
- for (std::list<cmDefinitions>::iterator it =
- parent->Internal->VarStack.begin();
- it != parent->Internal->VarStack.end(); ++it)
+ for (std::vector<cmDefinitions>::iterator it = parent->Internal->VarStack.begin();
+ it != parent->Internal->VarStack.end(); ++it)
{
defPtrs.push_back(&*it);
}
@@ -75,7 +73,7 @@ public:
{
std::vector<cmDefinitions*> defPtrs;
defPtrs.reserve(this->VarStack.size());
- for (std::list<cmDefinitions>::iterator it = this->VarStack.begin();
+ for (std::vector<cmDefinitions>::iterator it = this->VarStack.begin();
it != this->VarStack.end(); ++it)
{
defPtrs.push_back(&*it);
@@ -126,7 +124,7 @@ public:
{
std::vector<std::string> closureKeys;
std::vector<std::string> undefinedKeys;
- for (std::list<cmDefinitions>::const_iterator it = this->VarStack.begin();
+ for (std::vector<cmDefinitions>::const_iterator it = this->VarStack.begin();
it != this->VarStack.end(); ++it)
{
std::vector<std::string> const& localKeys = it->Keys(undefinedKeys);
@@ -147,14 +145,14 @@ public:
bool RaiseScope(std::string const& var, const char* varDef, cmMakefile* mf)
{
- cmDefinitions& cur = this->VarStack.back();
- if(cmDefinitions* up = cur.GetParent())
+ if(this->VarStack.size() > 1)
{
// First localize the definition in the current scope.
- cur.Get(var);
+ this->GetDefinition(var);
// Now update the definition in the parent scope.
- up->Set(var, varDef);
+ cmDefinitions& up = this->VarStack[this->VarStack.size() - 2];
+ up.Set(var, varDef);
}
else if(cmLocalGenerator* plg = mf->GetLocalGenerator()->GetParent())
{
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=18dce339403f77e2558012d5f94a2162baf3ab55
commit 18dce339403f77e2558012d5f94a2162baf3ab55
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Apr 26 16:19:11 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Apr 26 19:11:17 2015 +0200
cmDefinitions: Remove Parent pointer.
All structural knowledge of the stack of scopes is now external.
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index fe27b76..a39855f 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -14,12 +14,6 @@
#include <assert.h>
//----------------------------------------------------------------------------
-cmDefinitions::cmDefinitions(cmDefinitions* parent)
- : Up(parent)
-{
-}
-
-//----------------------------------------------------------------------------
std::pair<const char*, bool> cmDefinitions::Get(const std::string& key)
{
MapType::const_iterator i = this->Map.find(key);
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index bd09d7c..8ac310a 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -27,12 +27,6 @@
class cmDefinitions
{
public:
- /** Construct with the given parent scope. */
- cmDefinitions(cmDefinitions* parent = 0);
-
- /** Returns the parent scope, if any. */
- cmDefinitions* GetParent() const { return this->Up; }
-
/** Get the value associated with a key; null if none.
Store the result locally if it came from a parent. */
std::pair<const char*, bool> Get(const std::string& key);
@@ -70,9 +64,6 @@ private:
bool Exists;
};
- // Parent scope, if any.
- cmDefinitions* Up;
-
// Local definitions, set or unset.
#if defined(CMAKE_BUILD_WITH_CMAKE)
typedef cmsys::hash_map<std::string, Def> MapType;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 7362ec4..0acb486 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -53,12 +53,7 @@ public:
void PushDefinitions()
{
- cmDefinitions* parent = 0;
- if (!this->VarStack.empty())
- {
- parent = &this->VarStack.back();
- }
- this->VarStack.push_back(cmDefinitions(parent));
+ this->VarStack.push_back(cmDefinitions());
}
void InitializeDefinitions(cmMakefile* parent)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d67c3c879d504410d163ebbf6aa92725716b06d2
commit d67c3c879d504410d163ebbf6aa92725716b06d2
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Apr 26 16:13:56 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Apr 26 19:11:17 2015 +0200
cmDefinitions: Convert MakeClosure into a static method.
Accept a range of cmDefinitions*.
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 8613ea9..fe27b76 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -61,18 +61,13 @@ std::vector<std::string> cmDefinitions::LocalKeys() const
}
//----------------------------------------------------------------------------
-cmDefinitions cmDefinitions::MakeClosure() const
+cmDefinitions cmDefinitions::MakeClosure(
+ std::vector<cmDefinitions const*>::iterator begin,
+ std::vector<cmDefinitions const*>::iterator end)
{
std::set<std::string> undefined;
cmDefinitions closure;
- cmDefinitions const* defs = this;
- std::vector<cmDefinitions const*> ups;
- while(defs)
- {
- ups.push_back(defs);
- defs = defs->Up;
- }
- closure.MakeClosure(undefined, ups.begin(), ups.end());
+ closure.MakeClosure(undefined, begin, end);
return closure;
}
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index c3cde46..bd09d7c 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -52,7 +52,9 @@ public:
std::vector<std::string>
Keys(std::vector<std::string>& undefinedKeys) const;
- cmDefinitions MakeClosure() const;
+ static cmDefinitions MakeClosure(
+ std::vector<cmDefinitions const*>::iterator begin,
+ std::vector<cmDefinitions const*>::iterator end);
private:
// String with existence boolean.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index a68a05a..7362ec4 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -63,7 +63,17 @@ public:
void InitializeDefinitions(cmMakefile* parent)
{
- this->VarStack.back() = parent->Internal->VarStack.back().MakeClosure();
+ std::vector<cmDefinitions const*> defPtrs;
+ defPtrs.reserve(this->VarStack.size());
+ for (std::list<cmDefinitions>::iterator it =
+ parent->Internal->VarStack.begin();
+ it != parent->Internal->VarStack.end(); ++it)
+ {
+ defPtrs.push_back(&*it);
+ }
+ std::reverse(defPtrs.begin(), defPtrs.end());
+ this->VarStack.back() = cmDefinitions::MakeClosure(defPtrs.begin(),
+ defPtrs.end());
}
const char* GetDefinition(std::string const& name)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dcb443e897e59c1e9b878bf99ab8ddcab304fa9e
commit dcb443e897e59c1e9b878bf99ab8ddcab304fa9e
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Apr 26 16:00:18 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Apr 26 19:11:17 2015 +0200
cmDefinitions: Implement MakeClosure in terms of a vector of ancestors.
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index d9f28f0..8613ea9 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -65,22 +65,25 @@ cmDefinitions cmDefinitions::MakeClosure() const
{
std::set<std::string> undefined;
cmDefinitions closure;
- closure.MakeClosure(undefined, this);
- return closure;
-}
-
-//----------------------------------------------------------------------------
-void cmDefinitions::MakeClosure(std::set<std::string>& undefined,
- cmDefinitions const* defs)
-{
- std::vector<cmDefinitions*> ups;
+ cmDefinitions const* defs = this;
+ std::vector<cmDefinitions const*> ups;
while(defs)
{
ups.push_back(defs);
defs = defs->Up;
}
- for (std::vector<cmDefinitions*>::const_iterator it = ups.begin();
- it != ups.end(); ++it)
+ closure.MakeClosure(undefined, ups.begin(), ups.end());
+ return closure;
+}
+
+//----------------------------------------------------------------------------
+void
+cmDefinitions::MakeClosure(std::set<std::string>& undefined,
+ std::vector<cmDefinitions const*>::iterator begin,
+ std::vector<cmDefinitions const*>::iterator end)
+{
+ for (std::vector<cmDefinitions const*>::const_iterator it = begin;
+ it != end; ++it)
{
// Consider local definitions.
for(MapType::const_iterator mi = (*it)->Map.begin();
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index cf075de..c3cde46 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -80,7 +80,8 @@ private:
MapType Map;
void MakeClosure(std::set<std::string>& undefined,
- cmDefinitions const* defs);
+ std::vector<cmDefinitions const*>::iterator begin,
+ std::vector<cmDefinitions const*>::iterator end);
};
#endif
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b9a5bb7ffd11e29291f41a368652e2aae736b4bb
commit b9a5bb7ffd11e29291f41a368652e2aae736b4bb
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Apr 26 15:54:02 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Apr 26 19:11:17 2015 +0200
cmDefinitions: Use vector of cmDefinitions* to create closure.
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 988d28b..d9f28f0 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -73,11 +73,18 @@ cmDefinitions cmDefinitions::MakeClosure() const
void cmDefinitions::MakeClosure(std::set<std::string>& undefined,
cmDefinitions const* defs)
{
+ std::vector<cmDefinitions*> ups;
while(defs)
{
+ ups.push_back(defs);
+ defs = defs->Up;
+ }
+ for (std::vector<cmDefinitions*>::const_iterator it = ups.begin();
+ it != ups.end(); ++it)
+ {
// Consider local definitions.
- for(MapType::const_iterator mi = defs->Map.begin();
- mi != defs->Map.end(); ++mi)
+ for(MapType::const_iterator mi = (*it)->Map.begin();
+ mi != (*it)->Map.end(); ++mi)
{
// Use this key if it is not already set or unset.
if(this->Map.find(mi->first) == this->Map.end() &&
@@ -93,7 +100,6 @@ void cmDefinitions::MakeClosure(std::set<std::string>& undefined,
}
}
}
- defs = defs->Up;
}
}
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6447c3f530994342be10ffab4f80a655cf6a0ece
commit 6447c3f530994342be10ffab4f80a655cf6a0ece
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Apr 26 15:49:43 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Apr 26 19:11:16 2015 +0200
cmDefinitions: Replace recursion with loop.
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 51271c6..988d28b 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -73,29 +73,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->ClosureImpl(undefined, up);
+ defs = defs->Up;
}
}
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f0034e57044def1c4f6fd3821353c33b18d5b984
commit f0034e57044def1c4f6fd3821353c33b18d5b984
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Apr 26 15:44:26 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Apr 26 19:11:16 2015 +0200
cmDefinitions: Replace private constructor with MakeClosure.
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 844d72b..51271c6 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -61,21 +61,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.
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index cca08c8..cf075de 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -52,6 +52,8 @@ public:
std::vector<std::string>
Keys(std::vector<std::string>& undefinedKeys) const;
+ cmDefinitions MakeClosure() const;
+
private:
// String with existence boolean.
struct Def: public std::string
@@ -77,10 +79,7 @@ private:
#endif
MapType Map;
- // 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 0a2119c..a68a05a 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -63,7 +63,7 @@ public:
void InitializeDefinitions(cmMakefile* parent)
{
- this->VarStack.back() = parent->Internal->VarStack.back().Closure();
+ this->VarStack.back() = parent->Internal->VarStack.back().MakeClosure();
}
const char* GetDefinition(std::string const& name)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=33b14b6711173d491a5efa914e19c942d5b371ef
commit 33b14b6711173d491a5efa914e19c942d5b371ef
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Apr 26 15:38:36 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Apr 26 19:11:16 2015 +0200
cmDefinitions: Externalize looping for ClosureKeys.
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index d612a63..844d72b 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -105,28 +105,19 @@ void cmDefinitions::ClosureImpl(std::set<std::string>& undefined,
}
//----------------------------------------------------------------------------
-std::vector<std::string> cmDefinitions::ClosureKeys() const
+std::vector<std::string>
+cmDefinitions::Keys(std::vector<std::string>& undefined) const
{
- std::set<std::string> defined;
- std::set<std::string> undefined;
-
- cmDefinitions const* up = this;
-
- while (up)
+ std::vector<std::string> defined;
+ 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(defined.find(mi->first) == defined.end() &&
- undefined.find(mi->first) == undefined.end())
- {
- std::set<std::string>& m = mi->second.Exists? defined : undefined;
- m.insert(mi->first);
- }
- }
- up = this->Up;
+ std::vector<std::string>& m = mi->second.Exists? defined : undefined;
+ m.push_back(mi->first);
}
- return std::vector<std::string>(defined.begin(), defined.end());
+ std::sort(undefined.begin(), undefined.end());
+ undefined.erase(std::unique(undefined.begin(), undefined.end()),
+ undefined.end());
+ return defined;
}
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index 050bdb8..cca08c8 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -49,8 +49,8 @@ public:
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;
+ std::vector<std::string>
+ Keys(std::vector<std::string>& undefinedKeys) const;
private:
// String with existence boolean.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 526e8b4..0a2119c 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -119,7 +119,20 @@ public:
std::vector<std::string> ClosureKeys() const
{
- return this->VarStack.back().ClosureKeys();
+ std::vector<std::string> closureKeys;
+ std::vector<std::string> undefinedKeys;
+ for (std::list<cmDefinitions>::const_iterator it = this->VarStack.begin();
+ it != this->VarStack.end(); ++it)
+ {
+ std::vector<std::string> const& localKeys = it->Keys(undefinedKeys);
+ closureKeys.insert(closureKeys.end(), localKeys.begin(), localKeys.end());
+ std::vector<std::string>::iterator newIt =
+ closureKeys.end() - localKeys.size();
+ std::inplace_merge(closureKeys.begin(), newIt, closureKeys.end());
+ }
+ closureKeys.erase(std::unique(closureKeys.begin(),
+ closureKeys.end()), closureKeys.end());
+ return closureKeys;
}
void PopDefinitions()
-----------------------------------------------------------------------
Summary of changes:
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list