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

Side by Side Diff: tools/gn/target.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 | « tools/gn/runtime_deps_unittest.cc ('k') | no next file » | 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/target.h" 5 #include "tools/gn/target.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm>
10
11 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/stl_util.h"
12 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
13 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
14 #include "tools/gn/config_values_extractors.h" 13 #include "tools/gn/config_values_extractors.h"
15 #include "tools/gn/deps_iterator.h" 14 #include "tools/gn/deps_iterator.h"
16 #include "tools/gn/filesystem_utils.h" 15 #include "tools/gn/filesystem_utils.h"
17 #include "tools/gn/functions.h" 16 #include "tools/gn/functions.h"
18 #include "tools/gn/scheduler.h" 17 #include "tools/gn/scheduler.h"
19 #include "tools/gn/source_file_type.h" 18 #include "tools/gn/source_file_type.h"
20 #include "tools/gn/substitution_writer.h" 19 #include "tools/gn/substitution_writer.h"
21 #include "tools/gn/tool.h" 20 #include "tools/gn/tool.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 if (file == target->write_runtime_deps_output()) 87 if (file == target->write_runtime_deps_output())
89 return true; 88 return true;
90 89
91 // Check binary target intermediate files if requested. 90 // Check binary target intermediate files if requested.
92 if (consider_object_files && target->IsBinary()) { 91 if (consider_object_files && target->IsBinary()) {
93 std::vector<OutputFile> source_outputs; 92 std::vector<OutputFile> source_outputs;
94 for (const SourceFile& source : target->sources()) { 93 for (const SourceFile& source : target->sources()) {
95 Toolchain::ToolType tool_type; 94 Toolchain::ToolType tool_type;
96 if (!target->GetOutputFilesForSource(source, &tool_type, &source_outputs)) 95 if (!target->GetOutputFilesForSource(source, &tool_type, &source_outputs))
97 continue; 96 continue;
98 if (std::find(source_outputs.begin(), source_outputs.end(), file) != 97 if (base::ContainsValue(source_outputs, file))
99 source_outputs.end())
100 return true; 98 return true;
101 } 99 }
102 } 100 }
103 101
104 if (check_data_deps) { 102 if (check_data_deps) {
105 check_data_deps = false; // Consider only direct data_deps. 103 check_data_deps = false; // Consider only direct data_deps.
106 for (const auto& pair : target->data_deps()) { 104 for (const auto& pair : target->data_deps()) {
107 if (EnsureFileIsGeneratedByDependency(pair.ptr, file, false, 105 if (EnsureFileIsGeneratedByDependency(pair.ptr, file, false,
108 consider_object_files, 106 consider_object_files,
109 check_data_deps, seen_targets)) 107 check_data_deps, seen_targets))
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 check_data_deps = g_scheduler->IsFileGeneratedByWriteRuntimeDeps(out_file); 853 check_data_deps = g_scheduler->IsFileGeneratedByWriteRuntimeDeps(out_file);
856 // Check object files (much slower and very rare) only if the "normal" 854 // Check object files (much slower and very rare) only if the "normal"
857 // output check failed. 855 // output check failed.
858 consider_object_files = !check_data_deps; 856 consider_object_files = !check_data_deps;
859 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, 857 if (!EnsureFileIsGeneratedByDependency(this, out_file, true,
860 consider_object_files, 858 consider_object_files,
861 check_data_deps, &seen_targets)) 859 check_data_deps, &seen_targets))
862 g_scheduler->AddUnknownGeneratedInput(this, source); 860 g_scheduler->AddUnknownGeneratedInput(this, source);
863 } 861 }
864 } 862 }
OLDNEW
« no previous file with comments | « tools/gn/runtime_deps_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698