OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |