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/cmLocalNinjaGenerator.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/cmLocalNinjaGenerator.cxx')
-rw-r--r-- | Source/cmLocalNinjaGenerator.cxx | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 9fa3ca5..8a7f455 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -80,18 +80,18 @@ void cmLocalNinjaGenerator::Generate() } const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin(); - t != targets.end(); ++t) { - if ((*t)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + for (cmGeneratorTarget* target : targets) { + if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } - cmNinjaTargetGenerator* tg = cmNinjaTargetGenerator::New(*t); + cmNinjaTargetGenerator* tg = cmNinjaTargetGenerator::New(target); if (tg) { tg->Generate(); // Add the target to "all" if required. if (!this->GetGlobalNinjaGenerator()->IsExcluded( - this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0], *t)) { - this->GetGlobalNinjaGenerator()->AddDependencyToAll(*t); + this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0], + target)) { + this->GetGlobalNinjaGenerator()->AddDependencyToAll(target); } delete tg; } @@ -212,8 +212,7 @@ void cmLocalNinjaGenerator::WritePools(std::ostream& os) os, "Pools defined by global property JOB_POOLS"); std::vector<std::string> pools; cmSystemTools::ExpandListArgument(jobpools, pools); - for (size_t i = 0; i < pools.size(); ++i) { - std::string const& pool = pools[i]; + for (std::string const& pool : pools) { const std::string::size_type eq = pool.find('='); unsigned int jobs; if (eq != std::string::npos && @@ -250,12 +249,10 @@ void cmLocalNinjaGenerator::ComputeObjectFilenames( { // Determine if these object files should use a custom extension char const* custom_ext = gt->GetCustomObjectExtension(); - for (std::map<cmSourceFile const*, std::string>::iterator si = - mapping.begin(); - si != mapping.end(); ++si) { - cmSourceFile const* sf = si->first; + for (auto& si : mapping) { + cmSourceFile const* sf = si.first; bool keptSourceExtension; - si->second = this->GetObjectFileNameWithoutTarget( + si.second = this->GetObjectFileNameWithoutTarget( *sf, gt->ObjectDirectory, &keptSourceExtension, custom_ext); } } @@ -291,10 +288,9 @@ void cmLocalNinjaGenerator::AppendCustomCommandDeps( cmCustomCommandGenerator const& ccg, cmNinjaDeps& ninjaDeps) { const std::vector<std::string>& deps = ccg.GetDepends(); - for (std::vector<std::string>::const_iterator i = deps.begin(); - i != deps.end(); ++i) { + for (std::string const& i : deps) { std::string dep; - if (this->GetRealDependency(*i, this->GetConfigName(), dep)) { + if (this->GetRealDependency(i, this->GetConfigName(), dep)) { ninjaDeps.push_back( this->GetGlobalNinjaGenerator()->ConvertToNinjaPath(dep)); } @@ -408,9 +404,8 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( this->GetGlobalNinjaGenerator()->MapToNinjaPath()); this->AppendCustomCommandDeps(ccg, ninjaDeps); - for (cmNinjaDeps::iterator i = ninjaOutputs.begin(); i != ninjaOutputs.end(); - ++i) { - this->GetGlobalNinjaGenerator()->SeenCustomCommandOutput(*i); + for (std::string const& ninjaOutput : ninjaOutputs) { + this->GetGlobalNinjaGenerator()->SeenCustomCommandOutput(ninjaOutput); } std::vector<std::string> cmdLines; @@ -445,10 +440,9 @@ void cmLocalNinjaGenerator::AddCustomCommandTarget(cmCustomCommand const* cc, void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements() { - for (std::vector<cmCustomCommand const*>::iterator vi = - this->CustomCommands.begin(); - vi != this->CustomCommands.end(); ++vi) { - CustomCommandTargetMap::iterator i = this->CustomCommandTargets.find(*vi); + for (cmCustomCommand const* customCommand : this->CustomCommands) { + CustomCommandTargetMap::iterator i = + this->CustomCommandTargets.find(customCommand); assert(i != this->CustomCommandTargets.end()); // A custom command may appear on multiple targets. However, some build |