mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-19 11:18:40 +08:00
cmDefinitions: Cleanups
This commit is contained in:
@@ -13,10 +13,12 @@ cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key,
|
|||||||
StackIter end, bool raise)
|
StackIter end, bool raise)
|
||||||
{
|
{
|
||||||
assert(begin != end);
|
assert(begin != end);
|
||||||
MapType::iterator i = begin->Map.find(key);
|
{
|
||||||
if (i != begin->Map.end()) {
|
MapType::iterator it = begin->Map.find(key);
|
||||||
i->second.Used = true;
|
if (it != begin->Map.end()) {
|
||||||
return i->second;
|
it->second.Used = true;
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
StackIter it = begin;
|
StackIter it = begin;
|
||||||
++it;
|
++it;
|
||||||
@@ -27,7 +29,7 @@ cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key,
|
|||||||
if (!raise) {
|
if (!raise) {
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
return begin->Map.insert(MapType::value_type(key, def)).first->second;
|
return begin->Map.emplace(key, def).first->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string* cmDefinitions::Get(const std::string& key, StackIter begin,
|
const std::string* cmDefinitions::Get(const std::string& key, StackIter begin,
|
||||||
@@ -47,8 +49,7 @@ bool cmDefinitions::HasKey(const std::string& key, StackIter begin,
|
|||||||
StackIter end)
|
StackIter end)
|
||||||
{
|
{
|
||||||
for (StackIter it = begin; it != end; ++it) {
|
for (StackIter it = begin; it != end; ++it) {
|
||||||
MapType::const_iterator i = it->Map.find(key);
|
if (it->Map.find(key) != it->Map.end()) {
|
||||||
if (i != it->Map.end()) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,8 +98,8 @@ cmDefinitions cmDefinitions::MakeClosure(StackIter begin, StackIter end)
|
|||||||
std::vector<std::string> cmDefinitions::ClosureKeys(StackIter begin,
|
std::vector<std::string> cmDefinitions::ClosureKeys(StackIter begin,
|
||||||
StackIter end)
|
StackIter end)
|
||||||
{
|
{
|
||||||
std::set<std::string> bound;
|
|
||||||
std::vector<std::string> defined;
|
std::vector<std::string> defined;
|
||||||
|
std::set<std::string> bound;
|
||||||
|
|
||||||
for (StackIter it = begin; it != end; ++it) {
|
for (StackIter it = begin; it != end; ++it) {
|
||||||
defined.reserve(defined.size() + it->Map.size());
|
defined.reserve(defined.size() + it->Map.size());
|
||||||
|
Reference in New Issue
Block a user