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

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

Issue 610043002: Convert GN's deps iterator to work with range-based for loops. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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_group_target_writer.h" 5 #include "tools/gn/ninja_group_target_writer.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "tools/gn/deps_iterator.h" 8 #include "tools/gn/deps_iterator.h"
9 #include "tools/gn/output_file.h" 9 #include "tools/gn/output_file.h"
10 #include "tools/gn/string_utils.h" 10 #include "tools/gn/string_utils.h"
11 #include "tools/gn/target.h" 11 #include "tools/gn/target.h"
12 12
13 NinjaGroupTargetWriter::NinjaGroupTargetWriter(const Target* target, 13 NinjaGroupTargetWriter::NinjaGroupTargetWriter(const Target* target,
14 std::ostream& out) 14 std::ostream& out)
15 : NinjaTargetWriter(target, out) { 15 : NinjaTargetWriter(target, out) {
16 } 16 }
17 17
18 NinjaGroupTargetWriter::~NinjaGroupTargetWriter() { 18 NinjaGroupTargetWriter::~NinjaGroupTargetWriter() {
19 } 19 }
20 20
21 void NinjaGroupTargetWriter::Run() { 21 void NinjaGroupTargetWriter::Run() {
22 // A group rule just generates a stamp file with dependencies on each of 22 // A group rule just generates a stamp file with dependencies on each of
23 // the deps and data_deps in the group. 23 // the deps and data_deps in the group.
24 std::vector<OutputFile> output_files; 24 std::vector<OutputFile> output_files;
25 for (DepsIterator iter(target_, DepsIterator::LINKED_ONLY); 25 for (const auto& pair : target_->GetDeps(Target::DEPS_LINKED))
26 !iter.done(); iter.Advance()) 26 output_files.push_back(pair.ptr->dependency_output_file());
27 output_files.push_back(iter.target()->dependency_output_file());
28 27
29 std::vector<OutputFile> data_output_files; 28 std::vector<OutputFile> data_output_files;
30 const LabelTargetVector& data_deps = target_->data_deps(); 29 const LabelTargetVector& data_deps = target_->data_deps();
31 for (size_t i = 0; i < data_deps.size(); i++) 30 for (const auto& pair : data_deps)
32 data_output_files.push_back(data_deps[i].ptr->dependency_output_file()); 31 data_output_files.push_back(pair.ptr->dependency_output_file());
33 32
34 WriteStampForTarget(output_files, data_output_files); 33 WriteStampForTarget(output_files, data_output_files);
35 } 34 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698