diff options
author | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2017-09-11 10:40:26 (GMT) |
---|---|---|
committer | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2017-09-12 13:22:47 (GMT) |
commit | 7d5095796ab616cf9b709036387bb95ab9984141 (patch) | |
tree | c010e922adad95ef86ab4a3ac2a3abd63e9f33ef /Source/cmCacheManager.cxx | |
parent | 00975e926199eea21763470e2ab876246e36669a (diff) | |
download | CMake-7d5095796ab616cf9b709036387bb95ab9984141.zip CMake-7d5095796ab616cf9b709036387bb95ab9984141.tar.gz CMake-7d5095796ab616cf9b709036387bb95ab9984141.tar.bz2 |
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/cmCacheManager.cxx')
-rw-r--r-- | Source/cmCacheManager.cxx | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index d599275..56f48c3 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -297,10 +297,8 @@ bool cmCacheManager::SaveCache(const std::string& path) fout << "########################\n"; fout << "\n"; - for (std::map<std::string, CacheEntry>::const_iterator i = - this->Cache.begin(); - i != this->Cache.end(); ++i) { - const CacheEntry& ce = (*i).second; + for (auto const& i : this->Cache) { + CacheEntry const& ce = i.second; cmStateEnums::CacheEntryType t = ce.Type; if (!ce.Initialized) { /* @@ -315,7 +313,7 @@ bool cmCacheManager::SaveCache(const std::string& path) } else { cmCacheManager::OutputHelpString(fout, "Missing description"); } - this->OutputKey(fout, i->first); + this->OutputKey(fout, i.first); fout << ":" << cmState::CacheEntryTypeToString(t) << "="; this->OutputValue(fout, ce.Value); fout << "\n\n"; @@ -462,11 +460,9 @@ void cmCacheManager::PrintCache(std::ostream& out) const { out << "=================================================" << std::endl; out << "CMakeCache Contents:" << std::endl; - for (std::map<std::string, CacheEntry>::const_iterator i = - this->Cache.begin(); - i != this->Cache.end(); ++i) { - if ((*i).second.Type != cmStateEnums::INTERNAL) { - out << (*i).first << " = " << (*i).second.Value << std::endl; + for (auto const& i : this->Cache) { + if (i.second.Type != cmStateEnums::INTERNAL) { + out << i.first << " = " << i.second.Value << std::endl; } } out << "\n\n"; @@ -494,11 +490,10 @@ void cmCacheManager::AddCacheEntry(const std::string& key, const char* value, cmSystemTools::ExpandListArgument(e.Value, paths); const char* sep = ""; e.Value = ""; - for (std::vector<std::string>::iterator i = paths.begin(); - i != paths.end(); ++i) { - cmSystemTools::ConvertToUnixSlashes(*i); + for (std::string& i : paths) { + cmSystemTools::ConvertToUnixSlashes(i); e.Value += sep; - e.Value += *i; + e.Value += i; sep = ";"; } } else { |