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

Side by Side Diff: tools/gn/binary_target_generator.cc

Issue 610043002: Convert GN's deps iterator to work with range-based for loops. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | tools/gn/builder.cc » ('j') | tools/gn/command_refs.cc » ('J')
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 (size_t circular_i = 0; circular_i < circular.size(); circular_i++) {
122 bool found_dep = false; 122 bool found_dep = false;
123 for (DepsIterator iter(target_, DepsIterator::LINKED_ONLY); 123 for (const auto& dep_pair : target_->GetDeps(Target::DEPS_LINKED)) {
124 !iter.done(); iter.Advance()) { 124 if (dep_pair.label == circular[circular_i]) {
125 if (iter.label() == circular[circular_i]) {
126 found_dep = true; 125 found_dep = true;
127 break; 126 break;
128 } 127 }
129 } 128 }
130 if (!found_dep) { 129 if (!found_dep) {
131 *err_ = Err(*value, "Label not in deps.", 130 *err_ = Err(*value, "Label not in deps.",
132 "The label \"" + circular[circular_i].GetUserVisibleName(false) + 131 "The label \"" + circular[circular_i].GetUserVisibleName(false) +
133 "\"\nwas not in the deps of this target. " 132 "\"\nwas not in the deps of this target. "
134 "allow_circular_includes_from only allows\ntargets present in the " 133 "allow_circular_includes_from only allows\ntargets present in the "
135 "deps."); 134 "deps.");
136 return false; 135 return false;
137 } 136 }
138 } 137 }
139 138
140 // Add to the set. 139 // Add to the set.
141 for (size_t i = 0; i < circular.size(); i++) 140 for (size_t i = 0; i < circular.size(); i++)
142 target_->allow_circular_includes_from().insert(circular[i]); 141 target_->allow_circular_includes_from().insert(circular[i]);
143 return true; 142 return true;
144 } 143 }
OLDNEW
« no previous file with comments | « no previous file | tools/gn/builder.cc » ('j') | tools/gn/command_refs.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698