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

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

Issue 986113002: tools/gn: Convert for loops to use the new range-based loops in C++11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more fixes Created 5 years, 9 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
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/ninja_copy_target_writer.h" 5 #include "tools/gn/ninja_copy_target_writer.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "tools/gn/ninja_utils.h" 8 #include "tools/gn/ninja_utils.h"
9 #include "tools/gn/output_file.h" 9 #include "tools/gn/output_file.h"
10 #include "tools/gn/scheduler.h" 10 #include "tools/gn/scheduler.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // dependency will be fine as long as the input to the copy is properly 93 // dependency will be fine as long as the input to the copy is properly
94 // listed as the output from the step that generated it. 94 // listed as the output from the step that generated it.
95 // 95 //
96 // Moreover, doing this assumes that the copy step is always a simple 96 // Moreover, doing this assumes that the copy step is always a simple
97 // locally run command, so there is no need for a toolchain dependency. 97 // locally run command, so there is no need for a toolchain dependency.
98 // 98 //
99 // Note that there is the need in some cases for order-only dependencies 99 // Note that there is the need in some cases for order-only dependencies
100 // where a command might need to make sure something else runs before it runs 100 // where a command might need to make sure something else runs before it runs
101 // to avoid conflicts. Such cases should be avoided where possible, but 101 // to avoid conflicts. Such cases should be avoided where possible, but
102 // sometimes that's not possible. 102 // sometimes that's not possible.
103 for (size_t i = 0; i < target_->sources().size(); i++) { 103 for (const auto& input_file : target_->sources()) {
104 const SourceFile& input_file = target_->sources()[i];
105
106 OutputFile output_file = 104 OutputFile output_file =
107 SubstitutionWriter::ApplyPatternToSourceAsOutputFile( 105 SubstitutionWriter::ApplyPatternToSourceAsOutputFile(
108 target_->settings(), output_subst, input_file); 106 target_->settings(), output_subst, input_file);
109 output_files->push_back(output_file); 107 output_files->push_back(output_file);
110 108
111 out_ << "build "; 109 out_ << "build ";
112 path_output_.WriteFile(out_, output_file); 110 path_output_.WriteFile(out_, output_file);
113 out_ << ": " << tool_name << " "; 111 out_ << ": " << tool_name << " ";
114 path_output_.WriteFile(out_, input_file); 112 path_output_.WriteFile(out_, input_file);
115 if (!input_dep.value().empty()) { 113 if (!input_dep.value().empty()) {
116 out_ << " || "; 114 out_ << " || ";
117 path_output_.WriteFile(out_, input_dep); 115 path_output_.WriteFile(out_, input_dep);
118 } 116 }
119 out_ << std::endl; 117 out_ << std::endl;
120 } 118 }
121 } 119 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698