summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-05-16 03:33:30 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-05-17 14:50:18 (GMT)
commitf170985e7aaec7562ca481bab49228ece233c4e4 (patch)
tree41b6cfdc135d8243545faf8e608daca6b51f795e /Source
parent98c5c90361f89f810cdd6fb233f3e822b638f143 (diff)
downloadCMake-f170985e7aaec7562ca481bab49228ece233c4e4.zip
CMake-f170985e7aaec7562ca481bab49228ece233c4e4.tar.gz
CMake-f170985e7aaec7562ca481bab49228ece233c4e4.tar.bz2
cmDefinitions: Make the ClosureKeys method static.
For consistency with all other closure-related methods.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmDefinitions.cxx20
-rw-r--r--Source/cmDefinitions.h4
-rw-r--r--Source/cmMakefile.cxx12
3 files changed, 17 insertions, 19 deletions
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 6fcc002..e2c6876 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -105,18 +105,24 @@ cmDefinitions cmDefinitions::MakeClosure(StackConstIter begin,
//----------------------------------------------------------------------------
std::vector<std::string>
-cmDefinitions::ClosureKeys(std::set<std::string>& bound) const
+cmDefinitions::ClosureKeys(StackConstIter begin, StackConstIter end)
{
+ std::set<std::string> bound;
std::vector<std::string> defined;
- defined.reserve(this->Map.size());
- for(MapType::const_iterator mi = this->Map.begin();
- mi != this->Map.end(); ++mi)
+
+ for (StackConstIter it = begin; it != end; ++it)
{
- // Use this key if it is not already set or unset.
- if(bound.insert(mi->first).second && mi->second.Exists)
+ defined.reserve(defined.size() + it->Map.size());
+ for(MapType::const_iterator mi = it->Map.begin();
+ mi != it->Map.end(); ++mi)
{
- defined.push_back(mi->first);
+ // 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);
+ }
}
}
+
return defined;
}
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index b95ae6b..80643a9 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -44,8 +44,8 @@ public:
/** Get the set of all local keys. */
std::vector<std::string> LocalKeys() const;
- std::vector<std::string>
- ClosureKeys(std::set<std::string>& bound) const;
+ static std::vector<std::string> ClosureKeys(StackConstIter begin,
+ StackConstIter end);
static cmDefinitions MakeClosure(StackConstIter begin, StackConstIter end);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 7b8d3af..9f9171c 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -94,16 +94,8 @@ public:
std::vector<std::string> ClosureKeys() const
{
- 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;
+ return cmDefinitions::ClosureKeys(this->VarStack.rbegin(),
+ this->VarStack.rend());
}
void PopDefinitions()