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

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

Issue 2972113002: Remove ScopedVector from tools/gn/. (Closed)
Patch Set: Created 3 years, 5 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/function_get_target_outputs_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/build_settings.h" 5 #include "tools/gn/build_settings.h"
6 #include "tools/gn/functions.h" 6 #include "tools/gn/functions.h"
7 #include "tools/gn/parse_tree.h" 7 #include "tools/gn/parse_tree.h"
8 #include "tools/gn/settings.h" 8 #include "tools/gn/settings.h"
9 #include "tools/gn/substitution_writer.h" 9 #include "tools/gn/substitution_writer.h"
10 #include "tools/gn/target.h" 10 #include "tools/gn/target.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 // Find the referenced target. The targets previously encountered in this 87 // Find the referenced target. The targets previously encountered in this
88 // scope will have been stashed in the item collector (they'll be dispatched 88 // scope will have been stashed in the item collector (they'll be dispatched
89 // when this file is done running) so we can look through them. 89 // when this file is done running) so we can look through them.
90 const Target* target = nullptr; 90 const Target* target = nullptr;
91 Scope::ItemVector* collector = scope->GetItemCollector(); 91 Scope::ItemVector* collector = scope->GetItemCollector();
92 if (!collector) { 92 if (!collector) {
93 *err = Err(function, "No targets defined in this context."); 93 *err = Err(function, "No targets defined in this context.");
94 return Value(); 94 return Value();
95 } 95 }
96 for (auto* item : *collector) { 96 for (const auto& item : *collector) {
97 if (item->label() != label) 97 if (item->label() != label)
98 continue; 98 continue;
99 99
100 const Target* as_target = item->AsTarget(); 100 const Target* as_target = item->AsTarget();
101 if (!as_target) { 101 if (!as_target) {
102 *err = Err(function, "Label does not refer to a target.", 102 *err = Err(function, "Label does not refer to a target.",
103 label.GetUserVisibleName(false) + 103 label.GetUserVisibleName(false) +
104 "\nrefers to a " + item->GetItemTypeName()); 104 "\nrefers to a " + item->GetItemTypeName());
105 return Value(); 105 return Value();
106 } 106 }
(...skipping 25 matching lines...) Expand all
132 // Convert to Values. 132 // Convert to Values.
133 Value ret(function, Value::LIST); 133 Value ret(function, Value::LIST);
134 ret.list_value().reserve(files.size()); 134 ret.list_value().reserve(files.size());
135 for (const auto& file : files) 135 for (const auto& file : files)
136 ret.list_value().push_back(Value(function, file.value())); 136 ret.list_value().push_back(Value(function, file.value()));
137 137
138 return ret; 138 return ret;
139 } 139 }
140 140
141 } // namespace functions 141 } // namespace functions
OLDNEW
« no previous file with comments | « no previous file | tools/gn/function_get_target_outputs_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698