diff options
author | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2017-09-15 22:04:51 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-09-19 12:06:08 (GMT) |
commit | f43baf69814176f52b2b229667c4d3e88154bdea (patch) | |
tree | 58d8ff3131b492e71be8feb701a013e28f00dd9c /Source/CPack/cpack.cxx | |
parent | c0c5f924fe46fcf83603117689b372cb8520c4bb (diff) | |
download | CMake-f43baf69814176f52b2b229667c4d3e88154bdea.zip CMake-f43baf69814176f52b2b229667c4d3e88154bdea.tar.gz CMake-f43baf69814176f52b2b229667c4d3e88154bdea.tar.bz2 |
Meta: modernize old-fashioned loops to range-based `for` (CPack).
Changes done via `clang-tidy` with some manual fine-tuning
for the variable naming and `auto` type deduction
where appropriate.
Diffstat (limited to 'Source/CPack/cpack.cxx')
-rw-r--r-- | Source/CPack/cpack.cxx | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 9970721..ca904a2 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -293,10 +293,8 @@ int main(int argc, char const* const* argv) cpackProjectDirectory.c_str()); } } - cpackDefinitions::MapType::iterator cdit; - for (cdit = definitions.Map.begin(); cdit != definitions.Map.end(); - ++cdit) { - globalMF->AddDefinition(cdit->first, cdit->second.c_str()); + for (auto const& cd : definitions.Map) { + globalMF->AddDefinition(cd.first, cd.second.c_str()); } const char* cpackModulesPath = @@ -311,9 +309,7 @@ int main(int argc, char const* const* argv) } else { std::vector<std::string> generatorsVector; cmSystemTools::ExpandListArgument(genList, generatorsVector); - std::vector<std::string>::iterator it; - for (it = generatorsVector.begin(); it != generatorsVector.end(); ++it) { - const char* gen = it->c_str(); + for (std::string const& gen : generatorsVector) { cmMakefile::ScopePushPop raii(globalMF.get()); cmMakefile* mf = globalMF.get(); cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, @@ -413,12 +409,10 @@ int main(int argc, char const* const* argv) doc.PrependSection("Options", cmDocumentationOptions); std::vector<cmDocumentationEntry> v; - cmCPackGeneratorFactory::DescriptionsMap::const_iterator generatorIt; - for (generatorIt = generators.GetGeneratorsList().begin(); - generatorIt != generators.GetGeneratorsList().end(); ++generatorIt) { + for (auto const& g : generators.GetGeneratorsList()) { cmDocumentationEntry e; - e.Name = generatorIt->first; - e.Brief = generatorIt->second; + e.Name = g.first; + e.Brief = g.second; v.push_back(e); } doc.SetSection("Generators", v); |