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

Unified Diff: tools/gn/command_desc.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: review 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
« no previous file with comments | « tools/gn/command_clean.cc ('k') | tools/gn/err.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/command_desc.cc
diff --git a/tools/gn/command_desc.cc b/tools/gn/command_desc.cc
index ecb2fad30404337580638740ee48a252628fbcc2..8b321e4a20f41307c7dfe1a071c2af4ce61266c0 100644
--- a/tools/gn/command_desc.cc
+++ b/tools/gn/command_desc.cc
@@ -257,9 +257,9 @@ void PrintConfigsVector(const Target* target,
OutputString("\n" + heading + " (in order applying):\n");
Label toolchain_label = target->label().GetToolchainLabel();
- for (size_t i = 0; i < configs.size(); i++) {
- OutputString(" " +
- configs[i].label.GetUserVisibleName(toolchain_label) + "\n");
+ for (const auto& config : configs) {
+ OutputString(" " + config.label.GetUserVisibleName(toolchain_label) +
+ "\n");
}
}
@@ -275,9 +275,9 @@ void PrintConfigsVector(const Target* target,
OutputString("\n" + heading + " (in order applying):\n");
Label toolchain_label = target->label().GetToolchainLabel();
- for (size_t i = 0; i < configs.size(); i++) {
- OutputString(" " +
- configs[i].label.GetUserVisibleName(toolchain_label) + "\n");
+ for (const auto& config : configs) {
+ OutputString(" " + config.label.GetUserVisibleName(toolchain_label) +
+ "\n");
}
}
@@ -310,8 +310,8 @@ void PrintFileList(const Target::FileList& files,
Target::FileList sorted = files;
std::sort(sorted.begin(), sorted.end());
- for (size_t i = 0; i < sorted.size(); i++)
- OutputString(indent + sorted[i].value() + "\n");
+ for (const auto& elem : sorted)
+ OutputString(indent + elem.value() + "\n");
}
void PrintSources(const Target* target, bool display_header) {
@@ -328,11 +328,8 @@ void PrintOutputs(const Target* target, bool display_header) {
if (target->output_type() == Target::ACTION) {
// Action, print out outputs, don't apply sources to it.
- for (size_t i = 0; i < target->action_values().outputs().list().size();
- i++) {
- OutputString(" " +
- target->action_values().outputs().list()[i].AsString() +
- "\n");
+ for (const auto& elem : target->action_values().outputs().list()) {
+ OutputString(" " + elem.AsString() + "\n");
}
} else {
const SubstitutionList& outputs = target->action_values().outputs();
@@ -340,8 +337,8 @@ void PrintOutputs(const Target* target, bool display_header) {
// Display the pattern and resolved pattern separately, since there are
// subtitutions used.
OutputString(" Output pattern:\n");
- for (size_t i = 0; i < outputs.list().size(); i++)
- OutputString(" " + outputs.list()[i].AsString() + "\n");
+ for (const auto& elem : outputs.list())
+ OutputString(" " + elem.AsString() + "\n");
// Now display what that resolves to given the sources.
OutputString("\n Resolved output file list:\n");
@@ -364,9 +361,8 @@ void PrintScript(const Target* target, bool display_header) {
void PrintArgs(const Target* target, bool display_header) {
if (display_header)
OutputString("\nargs:\n");
- for (size_t i = 0; i < target->action_values().args().list().size(); i++) {
- OutputString(" " +
- target->action_values().args().list()[i].AsString() + "\n");
+ for (const auto& elem : target->action_values().args().list()) {
+ OutputString(" " + elem.AsString() + "\n");
}
}
« no previous file with comments | « tools/gn/command_clean.cc ('k') | tools/gn/err.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698