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/cmNinjaUtilityTargetGenerator.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/cmNinjaUtilityTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaUtilityTargetGenerator.cxx | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index 500ff4a..7adeb8e 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -51,17 +51,15 @@ void cmNinjaUtilityTargetGenerator::Generate() bool uses_terminal = false; for (unsigned i = 0; i != 2; ++i) { - for (std::vector<cmCustomCommand>::const_iterator ci = - cmdLists[i]->begin(); - ci != cmdLists[i]->end(); ++ci) { - cmCustomCommandGenerator ccg(*ci, this->GetConfigName(), + for (cmCustomCommand const& ci : *cmdLists[i]) { + cmCustomCommandGenerator ccg(ci, this->GetConfigName(), this->GetLocalGenerator()); this->GetLocalGenerator()->AppendCustomCommandDeps(ccg, deps); this->GetLocalGenerator()->AppendCustomCommandLines(ccg, commands); std::vector<std::string> const& ccByproducts = ccg.GetByproducts(); std::transform(ccByproducts.begin(), ccByproducts.end(), std::back_inserter(util_outputs), MapToNinjaPath()); - if (ci->GetUsesTerminal()) { + if (ci.GetUsesTerminal()) { uses_terminal = true; } } @@ -71,9 +69,8 @@ void cmNinjaUtilityTargetGenerator::Generate() std::string config = this->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); this->GetGeneratorTarget()->GetSourceFiles(sources, config); - for (std::vector<cmSourceFile*>::const_iterator source = sources.begin(); - source != sources.end(); ++source) { - if (cmCustomCommand* cc = (*source)->GetCustomCommand()) { + for (cmSourceFile const* source : sources) { + if (cmCustomCommand const* cc = source->GetCustomCommand()) { cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), this->GetLocalGenerator()); this->GetLocalGenerator()->AddCustomCommandTarget( @@ -132,10 +129,8 @@ void cmNinjaUtilityTargetGenerator::Generate() return; } - for (cmNinjaDeps::const_iterator oi = util_outputs.begin(), - oe = util_outputs.end(); - oi != oe; ++oi) { - this->GetGlobalGenerator()->SeenCustomCommandOutput(*oi); + for (std::string const& util_output : util_outputs) { + this->GetGlobalGenerator()->SeenCustomCommandOutput(util_output); } this->GetGlobalGenerator()->WriteCustomCommandBuild( |