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

Unified Diff: tools/gn/command_args.cc

Issue 610293003: Replace more for loops in GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 6 years, 3 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/builder.cc ('k') | tools/gn/command_desc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/command_args.cc
diff --git a/tools/gn/command_args.cc b/tools/gn/command_args.cc
index 8b1478fc8883fa733658e10d6946eec283454ec3..e2f4a9c09a7f11acab47339bbc0163ee60ec49d3 100644
--- a/tools/gn/command_args.cc
+++ b/tools/gn/command_args.cc
@@ -128,9 +128,8 @@ int ListArgs(const std::string& build_dir) {
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(kSwitchList);
if (list_value.empty()) {
// List all values.
- for (Scope::KeyValueMap::const_iterator i = build_args.begin();
- i != build_args.end(); ++i)
- sorted_args.insert(*i);
+ for (const auto& arg : build_args)
+ sorted_args.insert(arg);
} else {
// List just the one specified as the parameter to --list.
Scope::KeyValueMap::const_iterator found_arg = build_args.find(list_value);
@@ -145,20 +144,18 @@ int ListArgs(const std::string& build_dir) {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(kSwitchShort)) {
// Short key=value output.
- for (std::map<base::StringPiece, Value>::iterator i = sorted_args.begin();
- i != sorted_args.end(); ++i) {
- OutputString(i->first.as_string());
+ for (const auto& arg : sorted_args) {
+ OutputString(arg.first.as_string());
OutputString(" = ");
- OutputString(i->second.ToString(true));
+ OutputString(arg.second.ToString(true));
OutputString("\n");
}
return 0;
}
// Long output.
- for (std::map<base::StringPiece, Value>::iterator i = sorted_args.begin();
- i != sorted_args.end(); ++i) {
- PrintArgHelp(i->first, i->second);
+ for (const auto& arg : sorted_args) {
+ PrintArgHelp(arg.first, arg.second);
OutputString("\n");
}
« no previous file with comments | « tools/gn/builder.cc ('k') | tools/gn/command_desc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698