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>
This commit is contained in:
parent
ca9fa77d5d
commit
012a75a00f
@ -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::vector<std::string> defined;
|
||||||
std::set<std::string> undefined;
|
std::set<std::string> bound;
|
||||||
|
|
||||||
cmDefinitions const* up = this;
|
cmDefinitions const* up = this;
|
||||||
|
|
||||||
@ -133,11 +133,9 @@ std::set<std::string> cmDefinitions::ClosureKeys() const
|
|||||||
mi != up->Map.end(); ++mi)
|
mi != up->Map.end(); ++mi)
|
||||||
{
|
{
|
||||||
// Use this key if it is not already set or unset.
|
// Use this key if it is not already set or unset.
|
||||||
if(defined.find(mi->first) == defined.end() &&
|
if(bound.insert(mi->first).second && mi->second.Exists)
|
||||||
undefined.find(mi->first) == undefined.end())
|
|
||||||
{
|
{
|
||||||
std::set<std::string>& m = mi->second.Exists? defined : undefined;
|
defined.push_back(mi->first);
|
||||||
m.insert(mi->first);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
up = up->Up;
|
up = up->Up;
|
||||||
|
@ -50,7 +50,7 @@ public:
|
|||||||
cmDefinitions Closure() const;
|
cmDefinitions Closure() const;
|
||||||
|
|
||||||
/** Compute the set of all defined keys. */
|
/** Compute the set of all defined keys. */
|
||||||
std::set<std::string> ClosureKeys() const;
|
std::vector<std::string> ClosureKeys() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// String with existence boolean.
|
// String with existence boolean.
|
||||||
|
@ -94,7 +94,7 @@ public:
|
|||||||
return this->VarStack.top().LocalKeys();
|
return this->VarStack.top().LocalKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<std::string> ClosureKeys() const
|
std::vector<std::string> ClosureKeys() const
|
||||||
{
|
{
|
||||||
return this->VarStack.top().ClosureKeys();
|
return this->VarStack.top().ClosureKeys();
|
||||||
}
|
}
|
||||||
@ -2514,8 +2514,7 @@ std::vector<std::string> cmMakefile
|
|||||||
std::vector<std::string> res;
|
std::vector<std::string> res;
|
||||||
if ( !cacheonly )
|
if ( !cacheonly )
|
||||||
{
|
{
|
||||||
std::set<std::string> definitions = this->Internal->ClosureKeys();
|
res = this->Internal->ClosureKeys();
|
||||||
res.insert(res.end(), definitions.begin(), definitions.end());
|
|
||||||
}
|
}
|
||||||
std::vector<std::string> cacheKeys =
|
std::vector<std::string> cacheKeys =
|
||||||
this->GetState()->GetCacheEntryKeys();
|
this->GetState()->GetCacheEntryKeys();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user