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/cmTestGenerator.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/cmTestGenerator.cxx')
-rw-r--r-- | Source/cmTestGenerator.cxx | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 85d4b97..78ca6bc 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -2,7 +2,6 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmTestGenerator.h" -#include <map> #include <ostream> #include <utility> @@ -114,10 +113,10 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, if (!pm.empty()) { os << indent << "set_tests_properties(" << this->Test->GetName() << " PROPERTIES "; - for (cmPropertyMap::const_iterator i = pm.begin(); i != pm.end(); ++i) { - os << " " << i->first << " " + for (auto const& i : pm) { + os << " " << i.first << " " << cmOutputConverter::EscapeForCMake( - ge.Parse(i->second.GetValue())->Evaluate(this->LG, config)); + ge.Parse(i.second.GetValue())->Evaluate(this->LG, config)); } os << ")" << std::endl; } @@ -154,15 +153,14 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, Indent indent) // Just double-quote all arguments so they are re-parsed // correctly by the test system. fout << " \""; - for (std::string::const_iterator c = argit->begin(); c != argit->end(); - ++c) { + for (char c : *argit) { // Escape quotes within arguments. We should escape // backslashes too but we cannot because it makes the result // inconsistent with previous behavior of this command. - if ((*c == '"')) { + if (c == '"') { fout << '\\'; } - fout << *c; + fout << c; } fout << "\""; } @@ -173,9 +171,9 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, Indent indent) if (!pm.empty()) { fout << indent << "set_tests_properties(" << this->Test->GetName() << " PROPERTIES "; - for (cmPropertyMap::const_iterator i = pm.begin(); i != pm.end(); ++i) { - fout << " " << i->first << " " - << cmOutputConverter::EscapeForCMake(i->second.GetValue()); + for (auto const& i : pm) { + fout << " " << i.first << " " + << cmOutputConverter::EscapeForCMake(i.second.GetValue()); } fout << ")" << std::endl; } |