diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2019-05-09 19:25:54 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2019-05-12 16:56:53 (GMT) |
commit | 8691b3cf914c97ed9e3612009707bc5a791ef4f0 (patch) | |
tree | 2c30b040f20098880037cef0d7ddc9db98b4c217 | |
parent | 47da9859e8b5e938fa40b69d117aecef82e090a9 (diff) | |
download | CMake-8691b3cf914c97ed9e3612009707bc5a791ef4f0.zip CMake-8691b3cf914c97ed9e3612009707bc5a791ef4f0.tar.gz CMake-8691b3cf914c97ed9e3612009707bc5a791ef4f0.tar.bz2 |
Ninja: Inline range loop range arguments
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 33 | ||||
-rw-r--r-- | Source/cmLocalNinjaGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 3 |
3 files changed, 14 insertions, 28 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 71516a2..760a5ab 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -995,8 +995,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends( { if (target->GetType() == cmStateEnums::GLOBAL_TARGET) { // These depend only on other CMake-provided targets, e.g. "all". - std::set<BT<std::string>> const& utils = target->GetUtilities(); - for (BT<std::string> const& util : utils) { + for (BT<std::string> const& util : target->GetUtilities()) { std::string d = target->GetLocalGenerator()->GetCurrentBinaryDirectory() + "/" + util.Value; @@ -1004,8 +1003,8 @@ void cmGlobalNinjaGenerator::AppendTargetDepends( } } else { cmNinjaDeps outs; - cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target); - for (cmTargetDepend const& targetDep : targetDeps) { + for (cmTargetDepend const& targetDep : + this->GetTargetDirectDepends(target)) { if (targetDep->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -1039,10 +1038,9 @@ void cmGlobalNinjaGenerator::AppendTargetDependsClosure( // relevant for filling the cache entries properly isolated and a global // result set that is relevant for the result of the top level call to // AppendTargetDependsClosure. - auto const& targetDeps = this->GetTargetDirectDepends(target); cmNinjaOuts this_outs; // this will be the new cache entry - for (auto const& dep_target : targetDeps) { + for (auto const& dep_target : this->GetTargetDirectDepends(target)) { if (dep_target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -1138,9 +1136,7 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os) // The directory-level rule should depend on the directory-level // rules of the subdirectories. - std::vector<cmStateSnapshot> const& children = - lg->GetStateSnapshot().GetChildren(); - for (cmStateSnapshot const& state : children) { + for (cmStateSnapshot const& state : lg->GetStateSnapshot().GetChildren()) { std::string const currentBinaryDir = state.GetDirectory().GetCurrentBinary(); @@ -1201,26 +1197,21 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) for (cmLocalGenerator* lg : this->LocalGenerators) { // get the vector of files created by this makefile and convert them // to ninja paths, which are all relative in respect to the build directory - const std::vector<std::string>& files = - lg->GetMakefile()->GetOutputFiles(); - for (std::string const& file : files) { + for (std::string const& file : lg->GetMakefile()->GetOutputFiles()) { knownDependencies.insert(this->ConvertToNinjaPath(file)); } if (!this->GlobalSettingIsOn("CMAKE_SUPPRESS_REGENERATION")) { // get list files which are implicit dependencies as well and will be // phony for rebuild manifest - std::vector<std::string> const& lf = lg->GetMakefile()->GetListFiles(); - for (std::string const& j : lf) { + for (std::string const& j : lg->GetMakefile()->GetListFiles()) { knownDependencies.insert(this->ConvertToNinjaPath(j)); } } - std::vector<cmGeneratorExpressionEvaluationFile*> const& ef = - lg->GetMakefile()->GetEvaluationFiles(); - for (cmGeneratorExpressionEvaluationFile* li : ef) { + for (cmGeneratorExpressionEvaluationFile* li : + lg->GetMakefile()->GetEvaluationFiles()) { // get all the files created by generator expressions and convert them // to ninja paths - std::vector<std::string> evaluationFiles = li->GetFiles(); - for (std::string const& evaluationFile : evaluationFiles) { + for (std::string const& evaluationFile : li->GetFiles()) { knownDependencies.insert(this->ConvertToNinjaPath(evaluationFile)); } } @@ -1347,9 +1338,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) cmNinjaDeps implicitDeps; cmNinjaDeps explicitDeps; for (cmLocalGenerator* localGen : this->LocalGenerators) { - std::vector<std::string> const& lf = - localGen->GetMakefile()->GetListFiles(); - for (std::string const& fi : lf) { + for (std::string const& fi : localGen->GetMakefile()->GetListFiles()) { implicitDeps.push_back(this->ConvertToNinjaPath(fi)); } } diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index f4e3ed8..515651a 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -79,8 +79,7 @@ void cmLocalNinjaGenerator::Generate() } } - const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); - for (cmGeneratorTarget* target : targets) { + for (cmGeneratorTarget* target : this->GetGeneratorTargets()) { if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -283,8 +282,7 @@ void cmLocalNinjaGenerator::AppendTargetDepends(cmGeneratorTarget* target, void cmLocalNinjaGenerator::AppendCustomCommandDeps( cmCustomCommandGenerator const& ccg, cmNinjaDeps& ninjaDeps) { - const std::vector<std::string>& deps = ccg.GetDepends(); - for (std::string const& i : deps) { + for (std::string const& i : ccg.GetDepends()) { std::string dep; if (this->GetRealDependency(i, this->GetConfigName(), dep)) { ninjaDeps.push_back( diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 2324839..ee10891 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1212,8 +1212,7 @@ void cmNinjaTargetGenerator::WriteTargetDependInfo(std::string const& lang) Json::Value& tdi_linked_target_dirs = tdi["linked-target-dirs"] = Json::arrayValue; - std::vector<std::string> linked = this->GetLinkedTargetDirectories(); - for (std::string const& l : linked) { + for (std::string const& l : this->GetLinkedTargetDirectories()) { tdi_linked_target_dirs.append(l); } |