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

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

Issue 2938163003: Use ContainsValue() instead of std::find() in tools/ (Closed)
Patch Set: Fixing build error. Created 3 years, 6 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_process_file_template.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/action_target_generator.h" 5 #include "tools/gn/action_target_generator.h"
6 6
7 #include "base/stl_util.h"
7 #include "tools/gn/build_settings.h" 8 #include "tools/gn/build_settings.h"
8 #include "tools/gn/err.h" 9 #include "tools/gn/err.h"
9 #include "tools/gn/filesystem_utils.h" 10 #include "tools/gn/filesystem_utils.h"
10 #include "tools/gn/parse_tree.h" 11 #include "tools/gn/parse_tree.h"
11 #include "tools/gn/scope.h" 12 #include "tools/gn/scope.h"
12 #include "tools/gn/value.h" 13 #include "tools/gn/value.h"
13 #include "tools/gn/value_extractors.h" 14 #include "tools/gn/value_extractors.h"
14 #include "tools/gn/variables.h" 15 #include "tools/gn/variables.h"
15 16
16 ActionTargetGenerator::ActionTargetGenerator( 17 ActionTargetGenerator::ActionTargetGenerator(
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 if (!CheckOutputs()) 67 if (!CheckOutputs())
67 return; 68 return;
68 69
69 // Action outputs don't depend on the current toolchain so we can skip adding 70 // Action outputs don't depend on the current toolchain so we can skip adding
70 // that dependency. 71 // that dependency.
71 72
72 // response_file_contents and {{response_file_name}} in the args must go 73 // response_file_contents and {{response_file_name}} in the args must go
73 // together. 74 // together.
74 const auto& required_args_substitutions = 75 const auto& required_args_substitutions =
75 target_->action_values().args().required_types(); 76 target_->action_values().args().required_types();
76 bool has_rsp_file_name = std::find(required_args_substitutions.begin(), 77 bool has_rsp_file_name = base::ContainsValue(required_args_substitutions,
77 required_args_substitutions.end(), 78 SUBSTITUTION_RSP_FILE_NAME);
78 SUBSTITUTION_RSP_FILE_NAME) !=
79 required_args_substitutions.end();
80 if (target_->action_values().uses_rsp_file() && !has_rsp_file_name) { 79 if (target_->action_values().uses_rsp_file() && !has_rsp_file_name) {
81 *err_ = Err(function_call_, "Missing {{response_file_name}} in args.", 80 *err_ = Err(function_call_, "Missing {{response_file_name}} in args.",
82 "This target defines response_file_contents but doesn't use\n" 81 "This target defines response_file_contents but doesn't use\n"
83 "{{response_file_name}} in the args, which means the response file\n" 82 "{{response_file_name}} in the args, which means the response file\n"
84 "will be unused."); 83 "will be unused.");
85 return; 84 return;
86 } 85 }
87 if (!target_->action_values().uses_rsp_file() && has_rsp_file_name) { 86 if (!target_->action_values().uses_rsp_file() && has_rsp_file_name) {
88 *err_ = Err(function_call_, "Missing response_file_contents definition.", 87 *err_ = Err(function_call_, "Missing response_file_contents definition.",
89 "This target uses {{response_file_name}} in the args, but does not\n" 88 "This target uses {{response_file_name}} in the args, but does not\n"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 *err_ = Err(function_call_, 192 *err_ = Err(function_call_,
194 "action_foreach should have a pattern in the output.", 193 "action_foreach should have a pattern in the output.",
195 "An action_foreach target should have a source expansion pattern in\n" 194 "An action_foreach target should have a source expansion pattern in\n"
196 "it to map source file to unique output file name. Otherwise, the\n" 195 "it to map source file to unique output file name. Otherwise, the\n"
197 "build system can't determine when your script needs to be run."); 196 "build system can't determine when your script needs to be run.");
198 return false; 197 return false;
199 } 198 }
200 } 199 }
201 return true; 200 return true;
202 } 201 }
OLDNEW
« no previous file with comments | « no previous file | tools/gn/function_process_file_template.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698