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

Side by Side Diff: tools/gn/binary_target_generator.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, 2 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 unified diff | Download patch
« no previous file with comments | « tools/gn/args.cc ('k') | tools/gn/builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/binary_target_generator.h" 5 #include "tools/gn/binary_target_generator.h"
6 6
7 #include "tools/gn/config_values_generator.h" 7 #include "tools/gn/config_values_generator.h"
8 #include "tools/gn/deps_iterator.h" 8 #include "tools/gn/deps_iterator.h"
9 #include "tools/gn/err.h" 9 #include "tools/gn/err.h"
10 #include "tools/gn/functions.h" 10 #include "tools/gn/functions.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 if (!value) 111 if (!value)
112 return true; 112 return true;
113 113
114 UniqueVector<Label> circular; 114 UniqueVector<Label> circular;
115 ExtractListOfUniqueLabels(*value, scope_->GetSourceDir(), 115 ExtractListOfUniqueLabels(*value, scope_->GetSourceDir(),
116 ToolchainLabelForScope(scope_), &circular, err_); 116 ToolchainLabelForScope(scope_), &circular, err_);
117 if (err_->has_error()) 117 if (err_->has_error())
118 return false; 118 return false;
119 119
120 // Validate that all circular includes entries are in the deps. 120 // Validate that all circular includes entries are in the deps.
121 for (size_t circular_i = 0; circular_i < circular.size(); circular_i++) { 121 for (const auto& cur : circular) {
122 bool found_dep = false; 122 bool found_dep = false;
123 for (const auto& dep_pair : target_->GetDeps(Target::DEPS_LINKED)) { 123 for (const auto& dep_pair : target_->GetDeps(Target::DEPS_LINKED)) {
124 if (dep_pair.label == circular[circular_i]) { 124 if (dep_pair.label == cur) {
125 found_dep = true; 125 found_dep = true;
126 break; 126 break;
127 } 127 }
128 } 128 }
129 if (!found_dep) { 129 if (!found_dep) {
130 *err_ = Err(*value, "Label not in deps.", 130 *err_ = Err(*value, "Label not in deps.",
131 "The label \"" + circular[circular_i].GetUserVisibleName(false) + 131 "The label \"" + cur.GetUserVisibleName(false) +
132 "\"\nwas not in the deps of this target. " 132 "\"\nwas not in the deps of this target. "
133 "allow_circular_includes_from only allows\ntargets present in the " 133 "allow_circular_includes_from only allows\ntargets present in the "
134 "deps."); 134 "deps.");
135 return false; 135 return false;
136 } 136 }
137 } 137 }
138 138
139 // Add to the set. 139 // Add to the set.
140 for (size_t i = 0; i < circular.size(); i++) 140 for (const auto& cur : circular)
141 target_->allow_circular_includes_from().insert(circular[i]); 141 target_->allow_circular_includes_from().insert(cur);
142 return true; 142 return true;
143 } 143 }
OLDNEW
« no previous file with comments | « tools/gn/args.cc ('k') | tools/gn/builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698