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

Unified Diff: tools/gn/function_toolchain.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/function_rebase_path.cc ('k') | tools/gn/function_write_file.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/function_toolchain.cc
diff --git a/tools/gn/function_toolchain.cc b/tools/gn/function_toolchain.cc
index 0ac15580735602208ff21c433bfb1d3f60fc80d8..85163c173a5c0607ce44f2bb323e4e0b86402b85 100644
--- a/tools/gn/function_toolchain.cc
+++ b/tools/gn/function_toolchain.cc
@@ -62,8 +62,7 @@ bool ValidateSubstitutionList(const std::vector<SubstitutionType>& list,
bool (*validate)(SubstitutionType),
const Value* origin,
Err* err) {
- for (size_t i = 0; i < list.size(); i++) {
- SubstitutionType cur_type = list[i];
+ for (const auto& cur_type : list) {
if (!validate(cur_type)) {
*err = Err(*origin, "Pattern not valid here.",
"You used the pattern " + std::string(kSubstitutionNames[cur_type]) +
@@ -179,8 +178,7 @@ bool IsLinkerTool(Toolchain::ToolType type) {
bool IsPatternInOutputList(const SubstitutionList& output_list,
const SubstitutionPattern& pattern) {
- for (size_t output_i = 0; output_i < output_list.list().size(); output_i++) {
- const SubstitutionPattern& cur = output_list.list()[output_i];
+ for (const auto& cur : output_list.list()) {
if (pattern.ranges().size() == cur.ranges().size() &&
std::equal(pattern.ranges().begin(), pattern.ranges().end(),
cur.ranges().begin()))
« no previous file with comments | « tools/gn/function_rebase_path.cc ('k') | tools/gn/function_write_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698