summaryrefslogtreecommitdiff
path: root/Source/cmDefinitions.cxx
diff options
context:
space:
mode:
authorPavel Solodovnikov <hellyeahdominate@gmail.com>2017-09-11 13:40:26 +0300
committerPavel Solodovnikov <hellyeahdominate@gmail.com>2017-09-12 16:22:47 +0300
commit7d5095796ab616cf9b709036387bb95ab9984141 (patch)
treec010e922adad95ef86ab4a3ac2a3abd63e9f33ef /Source/cmDefinitions.cxx
parent00975e926199eea21763470e2ab876246e36669a (diff)
downloadcmake-7d5095796ab616cf9b709036387bb95ab9984141.tar.gz
Meta: modernize old-fashioned loops to range-based `for`.
Changes done via `clang-tidy` with some manual fine-tuning for the variable naming and `auto` type deduction where appropriate.
Diffstat (limited to 'Source/cmDefinitions.cxx')
-rw-r--r--Source/cmDefinitions.cxx27
1 files changed, 12 insertions, 15 deletions
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 021f2e8138..e766854a67 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -66,10 +66,9 @@ std::vector<std::string> cmDefinitions::UnusedKeys() const
std::vector<std::string> keys;
keys.reserve(this->Map.size());
// Consider local definitions.
- for (MapType::const_iterator mi = this->Map.begin(); mi != this->Map.end();
- ++mi) {
- if (!mi->second.Used) {
- keys.push_back(mi->first);
+ for (auto const& mi : this->Map) {
+ if (!mi.second.Used) {
+ keys.push_back(mi.first);
}
}
return keys;
@@ -81,15 +80,14 @@ cmDefinitions cmDefinitions::MakeClosure(StackIter begin, StackIter end)
std::set<std::string> undefined;
for (StackIter it = begin; it != end; ++it) {
// Consider local definitions.
- for (MapType::const_iterator mi = it->Map.begin(); mi != it->Map.end();
- ++mi) {
+ for (auto const& mi : it->Map) {
// Use this key if it is not already set or unset.
- if (closure.Map.find(mi->first) == closure.Map.end() &&
- undefined.find(mi->first) == undefined.end()) {
- if (mi->second.Exists) {
- closure.Map.insert(*mi);
+ if (closure.Map.find(mi.first) == closure.Map.end() &&
+ undefined.find(mi.first) == undefined.end()) {
+ if (mi.second.Exists) {
+ closure.Map.insert(mi);
} else {
- undefined.insert(mi->first);
+ undefined.insert(mi.first);
}
}
}
@@ -105,11 +103,10 @@ std::vector<std::string> cmDefinitions::ClosureKeys(StackIter begin,
for (StackIter it = begin; it != end; ++it) {
defined.reserve(defined.size() + it->Map.size());
- for (MapType::const_iterator mi = it->Map.begin(); mi != it->Map.end();
- ++mi) {
+ for (auto const& mi : it->Map) {
// 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);
+ if (bound.insert(mi.first).second && mi.second.Exists) {
+ defined.push_back(mi.first);
}
}
}