summaryrefslogtreecommitdiffstats
path: root/Source/cmDefinitions.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-04-26 13:36:49 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-04-29 20:51:28 (GMT)
commit012a75a00f060d6ca36cc9ffb97439a7ad526395 (patch)
tree38f915c86709817fb4001b46778d62c8ec2181b7 /Source/cmDefinitions.cxx
parentca9fa77d5d34a993073cd5256d65f88cd2e1a28f (diff)
downloadCMake-012a75a00f060d6ca36cc9ffb97439a7ad526395.zip
CMake-012a75a00f060d6ca36cc9ffb97439a7ad526395.tar.gz
CMake-012a75a00f060d6ca36cc9ffb97439a7ad526395.tar.bz2
cmDefinitions: Make ClosureKeys API vector-based.
Construct the final list directly in a named return value. Use a single set to track bindings already found. Co-Author: Brad King <brad.king@kitware.com>
Diffstat (limited to 'Source/cmDefinitions.cxx')
-rw-r--r--Source/cmDefinitions.cxx12
1 files changed, 5 insertions, 7 deletions
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 4b0eed4..f2100eb 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -119,10 +119,10 @@ void cmDefinitions::ClosureImpl(std::set<std::string>& undefined,
}
//----------------------------------------------------------------------------
-std::set<std::string> cmDefinitions::ClosureKeys() const
+std::vector<std::string> cmDefinitions::ClosureKeys() const
{
- std::set<std::string> defined;
- std::set<std::string> undefined;
+ std::vector<std::string> defined;
+ std::set<std::string> bound;
cmDefinitions const* up = this;
@@ -133,11 +133,9 @@ std::set<std::string> cmDefinitions::ClosureKeys() const
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())
+ if(bound.insert(mi->first).second && mi->second.Exists)
{
- std::set<std::string>& m = mi->second.Exists? defined : undefined;
- m.insert(mi->first);
+ defined.push_back(mi->first);
}
}
up = up->Up;