Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1077)

Unified Diff: tools/gn/ninja_target_writer.cc

Issue 986113002: tools/gn: Convert for loops to use the new range-based loops in C++11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more fixes Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/gn/ninja_target_writer.cc
diff --git a/tools/gn/ninja_target_writer.cc b/tools/gn/ninja_target_writer.cc
index db94a1b942183ba7e00b2f435d39b668e8872606..0434ed627e8c060ae012454b805e25f37e971b73 100644
--- a/tools/gn/ninja_target_writer.cc
+++ b/tools/gn/ninja_target_writer.cc
@@ -195,16 +195,14 @@ OutputFile NinjaTargetWriter::WriteInputDepsStampAndGetDep(
}
// Input files are order-only deps.
- const Target::FileList& prereqs = target_->inputs();
- for (size_t i = 0; i < prereqs.size(); i++) {
+ for (const auto& input : target_->inputs()) {
out_ << " ";
- path_output_.WriteFile(out_, prereqs[i]);
+ path_output_.WriteFile(out_, input);
}
if (list_sources_as_input_deps) {
- const Target::FileList& sources = target_->sources();
- for (size_t i = 0; i < sources.size(); i++) {
+ for (const auto& source : target_->sources()) {
out_ << " ";
- path_output_.WriteFile(out_, sources[i]);
+ path_output_.WriteFile(out_, source);
}
}
@@ -225,8 +223,8 @@ OutputFile NinjaTargetWriter::WriteInputDepsStampAndGetDep(
// toolchains often have more than one dependency, we could consider writing
// a toolchain-specific stamp file and only include the stamp here.
const LabelTargetVector& toolchain_deps = target_->toolchain()->deps();
- for (size_t i = 0; i < toolchain_deps.size(); i++)
- unique_deps.insert(toolchain_deps[i].ptr);
+ for (const auto& toolchain_dep : toolchain_deps)
+ unique_deps.insert(toolchain_dep.ptr);
for (const auto& dep : unique_deps) {
DCHECK(!dep->dependency_output_file().value().empty());

Powered by Google App Engine
This is Rietveld 408576698