Commit a09df11a authored by brettw's avatar brettw Committed by Commit bot

Convert GN's deps iterator to work with range-based for loops.

Reworks DepsIterator so it is compatible with STL iterators enough to work with range-based for loops. The iterator is now created by a target rather than taking a target as an argument, which makes the loops more natural.

I also changed some loops around code I was touching to use range-based.

Review URL: https://codereview.chromium.org/610043002

Cr-Commit-Position: refs/heads/master@{#297122}
parent f446a070
...@@ -120,9 +120,8 @@ bool BinaryTargetGenerator::FillAllowCircularIncludesFrom() { ...@@ -120,9 +120,8 @@ bool BinaryTargetGenerator::FillAllowCircularIncludesFrom() {
// Validate that all circular includes entries are in the deps. // Validate that all circular includes entries are in the deps.
for (size_t circular_i = 0; circular_i < circular.size(); circular_i++) { for (size_t circular_i = 0; circular_i < circular.size(); circular_i++) {
bool found_dep = false; bool found_dep = false;
for (DepsIterator iter(target_, DepsIterator::LINKED_ONLY); for (const auto& dep_pair : target_->GetDeps(Target::DEPS_LINKED)) {
!iter.done(); iter.Advance()) { if (dep_pair.label == circular[circular_i]) {
if (iter.label() == circular[circular_i]) {
found_dep = true; found_dep = true;
break; break;
} }
......
...@@ -481,14 +481,13 @@ bool Builder::ResolveForwardDependentConfigs(Target* target, Err* err) { ...@@ -481,14 +481,13 @@ bool Builder::ResolveForwardDependentConfigs(Target* target, Err* err) {
// Assume that the lists are small so that brute-force n^2 is appropriate. // Assume that the lists are small so that brute-force n^2 is appropriate.
for (size_t config_i = 0; config_i < configs.size(); config_i++) { for (size_t config_i = 0; config_i < configs.size(); config_i++) {
for (DepsIterator dep_iter(target, DepsIterator::LINKED_ONLY); for (const auto& dep_pair : target->GetDeps(Target::DEPS_LINKED)) {
!dep_iter.done(); dep_iter.Advance()) { if (configs[config_i].label == dep_pair.label) {
if (configs[config_i].label == dep_iter.label()) { DCHECK(dep_pair.ptr); // Should already be resolved.
DCHECK(dep_iter.target()); // Should already be resolved.
// UniqueVector's contents are constant so uniqueness is preserved, but // UniqueVector's contents are constant so uniqueness is preserved, but
// we want to update this pointer which doesn't change uniqueness // we want to update this pointer which doesn't change uniqueness
// (uniqueness in this vector is determined by the label only). // (uniqueness in this vector is determined by the label only).
const_cast<LabelTargetPair&>(configs[config_i]).ptr = dep_iter.target(); const_cast<LabelTargetPair&>(configs[config_i]).ptr = dep_pair.ptr;
break; break;
} }
} }
......
...@@ -51,8 +51,8 @@ void RecursiveCollectDeps(const Target* target, std::set<Label>* result) { ...@@ -51,8 +51,8 @@ void RecursiveCollectDeps(const Target* target, std::set<Label>* result) {
} }
void RecursiveCollectChildDeps(const Target* target, std::set<Label>* result) { void RecursiveCollectChildDeps(const Target* target, std::set<Label>* result) {
for (DepsIterator iter(target); !iter.done(); iter.Advance()) for (const auto& pair : target->GetDeps(Target::DEPS_ALL))
RecursiveCollectDeps(iter.target(), result); RecursiveCollectDeps(pair.ptr, result);
} }
// Prints dependencies of the given target (not the target itself). If the // Prints dependencies of the given target (not the target itself). If the
...@@ -65,8 +65,8 @@ void RecursivePrintDeps(const Target* target, ...@@ -65,8 +65,8 @@ void RecursivePrintDeps(const Target* target,
int indent_level) { int indent_level) {
// Combine all deps into one sorted list. // Combine all deps into one sorted list.
std::vector<LabelTargetPair> sorted_deps; std::vector<LabelTargetPair> sorted_deps;
for (DepsIterator iter(target); !iter.done(); iter.Advance()) for (const auto& pair : target->GetDeps(Target::DEPS_ALL))
sorted_deps.push_back(iter.pair()); sorted_deps.push_back(pair);
std::sort(sorted_deps.begin(), sorted_deps.end(), std::sort(sorted_deps.begin(), sorted_deps.end(),
LabelPtrLabelLess<Target>()); LabelPtrLabelLess<Target>());
...@@ -140,8 +140,8 @@ void PrintDeps(const Target* target, bool display_header) { ...@@ -140,8 +140,8 @@ void PrintDeps(const Target* target, bool display_header) {
"\nDirect dependencies " "\nDirect dependencies "
"(try also \"--all\", \"--tree\", or even \"--all --tree\"):\n"); "(try also \"--all\", \"--tree\", or even \"--all --tree\"):\n");
} }
for (DepsIterator iter(target); !iter.done(); iter.Advance()) for (const auto& pair : target->GetDeps(Target::DEPS_ALL))
deps.push_back(iter.label()); deps.push_back(pair.label);
} }
std::sort(deps.begin(), deps.end()); std::sort(deps.begin(), deps.end());
......
...@@ -27,12 +27,9 @@ typedef std::multimap<const Target*, const Target*> DepMap; ...@@ -27,12 +27,9 @@ typedef std::multimap<const Target*, const Target*> DepMap;
// Populates the reverse dependency map for the targets in the Setup. // Populates the reverse dependency map for the targets in the Setup.
void FillDepMap(Setup* setup, DepMap* dep_map) { void FillDepMap(Setup* setup, DepMap* dep_map) {
std::vector<const Target*> targets = for (const auto& target : setup->builder()->GetAllResolvedTargets()) {
setup->builder()->GetAllResolvedTargets(); for (const auto& dep_pair : target->GetDeps(Target::DEPS_ALL))
dep_map->insert(std::make_pair(dep_pair.ptr, target));
for (size_t target_i = 0; target_i < targets.size(); target_i++) {
for (DepsIterator iter(targets[target_i]); !iter.done(); iter.Advance())
dep_map->insert(std::make_pair(iter.target(), targets[target_i]));
} }
} }
......
...@@ -6,23 +6,22 @@ ...@@ -6,23 +6,22 @@
#include "tools/gn/target.h" #include "tools/gn/target.h"
DepsIterator::DepsIterator(const Target* t) : current_index_(0) { DepsIterator::DepsIterator() : current_index_(0) {
vect_stack_[0] = &t->public_deps(); vect_stack_[0] = nullptr;
vect_stack_[1] = &t->private_deps(); vect_stack_[1] = nullptr;
vect_stack_[2] = &t->data_deps(); vect_stack_[2] = nullptr;
if (vect_stack_[0]->empty())
Advance();
} }
// Iterate over the public and private linked deps, but not the data deps. DepsIterator::DepsIterator(const LabelTargetVector* a,
DepsIterator::DepsIterator(const Target* t, LinkedOnly) : current_index_(0) { const LabelTargetVector* b,
vect_stack_[0] = &t->public_deps(); const LabelTargetVector* c)
vect_stack_[1] = &t->private_deps(); : current_index_(0) {
vect_stack_[2] = NULL; vect_stack_[0] = a;
vect_stack_[1] = b;
vect_stack_[2] = c;
if (vect_stack_[0]->empty()) if (vect_stack_[0] && vect_stack_[0]->empty())
Advance(); operator++();
} }
// Advance to the next position. This assumes there are more vectors. // Advance to the next position. This assumes there are more vectors.
...@@ -30,7 +29,7 @@ DepsIterator::DepsIterator(const Target* t, LinkedOnly) : current_index_(0) { ...@@ -30,7 +29,7 @@ DepsIterator::DepsIterator(const Target* t, LinkedOnly) : current_index_(0) {
// For internal use, this function tolerates an initial index equal to the // For internal use, this function tolerates an initial index equal to the
// length of the current vector. In this case, it will advance to the next // length of the current vector. In this case, it will advance to the next
// one. // one.
void DepsIterator::Advance() { DepsIterator& DepsIterator::operator++() {
DCHECK(vect_stack_[0]); DCHECK(vect_stack_[0]);
current_index_++; current_index_++;
...@@ -38,11 +37,20 @@ void DepsIterator::Advance() { ...@@ -38,11 +37,20 @@ void DepsIterator::Advance() {
// Advance to next vect. Shift the elements left by one. // Advance to next vect. Shift the elements left by one.
vect_stack_[0] = vect_stack_[1]; vect_stack_[0] = vect_stack_[1];
vect_stack_[1] = vect_stack_[2]; vect_stack_[1] = vect_stack_[2];
vect_stack_[2] = NULL; vect_stack_[2] = nullptr;
current_index_ = 0; current_index_ = 0;
if (vect_stack_[0] && vect_stack_[0]->empty()) if (vect_stack_[0] && vect_stack_[0]->empty())
Advance(); operator++();
} }
return *this;
}
DepsIteratorRange::DepsIteratorRange(const DepsIterator& b)
: begin_(b),
end_() {
}
DepsIteratorRange::~DepsIteratorRange() {
} }
...@@ -10,52 +10,64 @@ ...@@ -10,52 +10,64 @@
class Target; class Target;
// Iterates over the deps of a target. // Provides an iterator for iterating over multiple LabelTargetVectors to
// make it convenient to iterate over all deps of a target.
// //
// Since there are multiple kinds of deps, this iterator allows looping over // This works by maintaining a simple stack of vectors (since we have a fixed
// each one in one loop. // number of deps types). When the stack is empty, we've reached the end. This
// means that the default-constructed iterator == end() for any sequence.
class DepsIterator { class DepsIterator {
public: public:
enum LinkedOnly { // Creates an empty iterator.
LINKED_ONLY, DepsIterator();
};
// Iterate over public, private, and data deps. // Iterate over the deps in the given vectors. If passing less than three,
explicit DepsIterator(const Target* t); // pad with nulls.
DepsIterator(const LabelTargetVector* a,
const LabelTargetVector* b,
const LabelTargetVector* c);
// Iterate over the public and private linked deps, but not the data deps. // Prefix increment operator. This assumes there are more items (i.e.
DepsIterator(const Target* t, LinkedOnly); // *this != DepsIterator()).
// Returns true when there are no more targets.
bool done() const {
return !vect_stack_[0];
}
// Advance to the next position. This assumes !done().
// //
// For internal use, this function tolerates an initial index equal to the // For internal use, this function tolerates an initial index equal to the
// length of the current vector. In this case, it will advance to the next // length of the current vector. In this case, it will advance to the next
// one. // one.
void Advance(); DepsIterator& operator++();
// The current dependency. // Comparison for STL-based loops.
const LabelTargetPair& pair() const { bool operator!=(const DepsIterator& other) {
return current_index_ != other.current_index_ ||
vect_stack_[0] != other.vect_stack_[0] ||
vect_stack_[1] != other.vect_stack_[1] ||
vect_stack_[2] != other.vect_stack_[2];
}
// Dereference operator for STL-compatible iterators.
const LabelTargetPair& operator*() const {
DCHECK_LT(current_index_, vect_stack_[0]->size()); DCHECK_LT(current_index_, vect_stack_[0]->size());
return (*vect_stack_[0])[current_index_]; return (*vect_stack_[0])[current_index_];
} }
// The pointer to the current dependency.
const Target* target() const { return pair().ptr; }
// The label of the current dependency.
const Label& label() const { return pair().label; }
private: private:
const LabelTargetVector* vect_stack_[3]; const LabelTargetVector* vect_stack_[3];
size_t current_index_; size_t current_index_;
};
// Provides a virtual container implementing begin() and end() for a
// sequence of deps. This can then be used in range-based for loops.
class DepsIteratorRange {
public:
explicit DepsIteratorRange(const DepsIterator& b);
~DepsIteratorRange();
const DepsIterator& begin() const { return begin_; }
const DepsIterator& end() const { return end_; }
DISALLOW_COPY_AND_ASSIGN(DepsIterator); private:
DepsIterator begin_;
DepsIterator end_;
}; };
#endif // TOOLS_GN_DEPS_ITERATOR_H_ #endif // TOOLS_GN_DEPS_ITERATOR_H_
...@@ -32,9 +32,8 @@ void NinjaActionTargetWriter::Run() { ...@@ -32,9 +32,8 @@ void NinjaActionTargetWriter::Run() {
// operating on the result of that previous step, so we need to be sure to // operating on the result of that previous step, so we need to be sure to
// serialize these. // serialize these.
std::vector<const Target*> extra_hard_deps; std::vector<const Target*> extra_hard_deps;
for (DepsIterator iter(target_, DepsIterator::LINKED_ONLY); for (const auto& pair : target_->GetDeps(Target::DEPS_LINKED))
!iter.done(); iter.Advance()) extra_hard_deps.push_back(pair.ptr);
extra_hard_deps.push_back(iter.target());
// For ACTIONs this is a bit inefficient since it creates an input dep // For ACTIONs this is a bit inefficient since it creates an input dep
// stamp file even though we're only going to use it once. It would save a // stamp file even though we're only going to use it once. It would save a
......
...@@ -375,26 +375,21 @@ void NinjaBinaryTargetWriter::GetDeps( ...@@ -375,26 +375,21 @@ void NinjaBinaryTargetWriter::GetDeps(
UniqueVector<OutputFile>* extra_object_files, UniqueVector<OutputFile>* extra_object_files,
UniqueVector<const Target*>* linkable_deps, UniqueVector<const Target*>* linkable_deps,
UniqueVector<const Target*>* non_linkable_deps) const { UniqueVector<const Target*>* non_linkable_deps) const {
const UniqueVector<const Target*>& inherited =
target_->inherited_libraries();
// Normal public/private deps. // Normal public/private deps.
for (DepsIterator iter(target_, DepsIterator::LINKED_ONLY); !iter.done(); for (const auto& pair : target_->GetDeps(Target::DEPS_LINKED)) {
iter.Advance()) { ClassifyDependency(pair.ptr, extra_object_files,
ClassifyDependency(iter.target(), extra_object_files,
linkable_deps, non_linkable_deps); linkable_deps, non_linkable_deps);
} }
// Inherited libraries. // Inherited libraries.
for (size_t i = 0; i < inherited.size(); i++) { for (const auto& inherited_target : target_->inherited_libraries()) {
ClassifyDependency(inherited[i], extra_object_files, ClassifyDependency(inherited_target, extra_object_files,
linkable_deps, non_linkable_deps); linkable_deps, non_linkable_deps);
} }
// Data deps. // Data deps.
const LabelTargetVector& data_deps = target_->data_deps(); for (const auto& data_dep_pair : target_->data_deps())
for (size_t i = 0; i < data_deps.size(); i++) non_linkable_deps->push_back(data_dep_pair.ptr);
non_linkable_deps->push_back(data_deps[i].ptr);
} }
void NinjaBinaryTargetWriter::ClassifyDependency( void NinjaBinaryTargetWriter::ClassifyDependency(
......
...@@ -22,14 +22,13 @@ void NinjaGroupTargetWriter::Run() { ...@@ -22,14 +22,13 @@ void NinjaGroupTargetWriter::Run() {
// A group rule just generates a stamp file with dependencies on each of // A group rule just generates a stamp file with dependencies on each of
// the deps and data_deps in the group. // the deps and data_deps in the group.
std::vector<OutputFile> output_files; std::vector<OutputFile> output_files;
for (DepsIterator iter(target_, DepsIterator::LINKED_ONLY); for (const auto& pair : target_->GetDeps(Target::DEPS_LINKED))
!iter.done(); iter.Advance()) output_files.push_back(pair.ptr->dependency_output_file());
output_files.push_back(iter.target()->dependency_output_file());
std::vector<OutputFile> data_output_files; std::vector<OutputFile> data_output_files;
const LabelTargetVector& data_deps = target_->data_deps(); const LabelTargetVector& data_deps = target_->data_deps();
for (size_t i = 0; i < data_deps.size(); i++) for (const auto& pair : data_deps)
data_output_files.push_back(data_deps[i].ptr->dependency_output_file()); data_output_files.push_back(pair.ptr->dependency_output_file());
WriteStampForTarget(output_files, data_output_files); WriteStampForTarget(output_files, data_output_files);
} }
...@@ -30,11 +30,9 @@ void MergePublicConfigsFrom(const Target* from_target, ...@@ -30,11 +30,9 @@ void MergePublicConfigsFrom(const Target* from_target,
void MergeAllDependentConfigsFrom(const Target* from_target, void MergeAllDependentConfigsFrom(const Target* from_target,
UniqueVector<LabelConfigPair>* dest, UniqueVector<LabelConfigPair>* dest,
UniqueVector<LabelConfigPair>* all_dest) { UniqueVector<LabelConfigPair>* all_dest) {
const UniqueVector<LabelConfigPair>& all = for (const auto& pair : from_target->all_dependent_configs()) {
from_target->all_dependent_configs(); all_dest->push_back(pair);
for (size_t i = 0; i < all.size(); i++) { dest->push_back(pair);
all_dest->push_back(all[i]);
dest->push_back(all[i]);
} }
} }
...@@ -154,6 +152,16 @@ bool Target::IsFinal() const { ...@@ -154,6 +152,16 @@ bool Target::IsFinal() const {
(output_type_ == STATIC_LIBRARY && complete_static_lib_); (output_type_ == STATIC_LIBRARY && complete_static_lib_);
} }
DepsIteratorRange Target::GetDeps(DepsIterationType type) const {
if (type == DEPS_LINKED) {
return DepsIteratorRange(DepsIterator(
&public_deps_, &private_deps_, nullptr));
}
// All deps.
return DepsIteratorRange(DepsIterator(
&public_deps_, &private_deps_, &data_deps_));
}
std::string Target::GetComputedOutputName(bool include_prefix) const { std::string Target::GetComputedOutputName(bool include_prefix) const {
DCHECK(toolchain_) DCHECK(toolchain_)
<< "Toolchain must be specified before getting the computed output name."; << "Toolchain must be specified before getting the computed output name.";
...@@ -203,9 +211,8 @@ bool Target::SetToolchain(const Toolchain* toolchain, Err* err) { ...@@ -203,9 +211,8 @@ bool Target::SetToolchain(const Toolchain* toolchain, Err* err) {
void Target::PullDependentTargetInfo() { void Target::PullDependentTargetInfo() {
// Gather info from our dependents we need. // Gather info from our dependents we need.
for (DepsIterator iter(this, DepsIterator::LINKED_ONLY); !iter.done(); for (const auto& pair : GetDeps(DEPS_LINKED)) {
iter.Advance()) { const Target* dep = pair.ptr;
const Target* dep = iter.target();
MergeAllDependentConfigsFrom(dep, &configs_, &all_dependent_configs_); MergeAllDependentConfigsFrom(dep, &configs_, &all_dependent_configs_);
MergePublicConfigsFrom(dep, &configs_); MergePublicConfigsFrom(dep, &configs_);
...@@ -230,12 +237,12 @@ void Target::PullDependentTargetInfo() { ...@@ -230,12 +237,12 @@ void Target::PullDependentTargetInfo() {
void Target::PullForwardedDependentConfigs() { void Target::PullForwardedDependentConfigs() {
// Pull public configs from each of our dependency's public deps. // Pull public configs from each of our dependency's public deps.
for (size_t dep = 0; dep < public_deps_.size(); dep++) for (const auto& dep : public_deps_)
PullForwardedDependentConfigsFrom(public_deps_[dep].ptr); PullForwardedDependentConfigsFrom(dep.ptr);
// Forward public configs if explicitly requested. // Forward public configs if explicitly requested.
for (size_t dep = 0; dep < forward_dependent_configs_.size(); dep++) { for (const auto& dep : forward_dependent_configs_) {
const Target* from_target = forward_dependent_configs_[dep].ptr; const Target* from_target = dep.ptr;
// The forward_dependent_configs_ must be in the deps (public or private) // The forward_dependent_configs_ must be in the deps (public or private)
// already, so we don't need to bother copying to our configs, only // already, so we don't need to bother copying to our configs, only
...@@ -257,18 +264,17 @@ void Target::PullForwardedDependentConfigsFrom(const Target* from) { ...@@ -257,18 +264,17 @@ void Target::PullForwardedDependentConfigsFrom(const Target* from) {
} }
void Target::PullRecursiveHardDeps() { void Target::PullRecursiveHardDeps() {
for (DepsIterator iter(this, DepsIterator::LINKED_ONLY); !iter.done(); for (const auto& pair : GetDeps(DEPS_LINKED)) {
iter.Advance()) { if (pair.ptr->hard_dep())
if (iter.target()->hard_dep()) recursive_hard_deps_.insert(pair.ptr);
recursive_hard_deps_.insert(iter.target());
// Android STL doesn't like insert(begin, end) so do it manually. // Android STL doesn't like insert(begin, end) so do it manually.
// TODO(brettw) this can be changed to // TODO(brettw) this can be changed to
// insert(iter.target()->begin(), iter.target()->end()) // insert(iter.target()->begin(), iter.target()->end())
// when Android uses a better STL. // when Android uses a better STL.
for (std::set<const Target*>::const_iterator cur = for (std::set<const Target*>::const_iterator cur =
iter.target()->recursive_hard_deps().begin(); pair.ptr->recursive_hard_deps().begin();
cur != iter.target()->recursive_hard_deps().end(); ++cur) cur != pair.ptr->recursive_hard_deps().end(); ++cur)
recursive_hard_deps_.insert(*cur); recursive_hard_deps_.insert(*cur);
} }
} }
...@@ -333,8 +339,8 @@ void Target::FillOutputFiles() { ...@@ -333,8 +339,8 @@ void Target::FillOutputFiles() {
} }
bool Target::CheckVisibility(Err* err) const { bool Target::CheckVisibility(Err* err) const {
for (DepsIterator iter(this); !iter.done(); iter.Advance()) { for (const auto& pair : GetDeps(DEPS_ALL)) {
if (!Visibility::CheckItemVisibility(this, iter.target(), err)) if (!Visibility::CheckItemVisibility(this, pair.ptr, err))
return false; return false;
} }
return true; return true;
...@@ -347,9 +353,9 @@ bool Target::CheckTestonly(Err* err) const { ...@@ -347,9 +353,9 @@ bool Target::CheckTestonly(Err* err) const {
return true; return true;
// Verify no deps have "testonly" set. // Verify no deps have "testonly" set.
for (DepsIterator iter(this); !iter.done(); iter.Advance()) { for (const auto& pair : GetDeps(DEPS_ALL)) {
if (iter.target()->testonly()) { if (pair.ptr->testonly()) {
*err = MakeTestOnlyError(this, iter.target()); *err = MakeTestOnlyError(this, pair.ptr);
return false; return false;
} }
} }
...@@ -364,17 +370,17 @@ bool Target::CheckNoNestedStaticLibs(Err* err) const { ...@@ -364,17 +370,17 @@ bool Target::CheckNoNestedStaticLibs(Err* err) const {
return true; return true;
// Verify no deps are static libraries. // Verify no deps are static libraries.
for (DepsIterator iter(this); !iter.done(); iter.Advance()) { for (const auto& pair : GetDeps(DEPS_ALL)) {
if (iter.target()->output_type() == Target::STATIC_LIBRARY) { if (pair.ptr->output_type() == Target::STATIC_LIBRARY) {
*err = MakeStaticLibDepsError(this, iter.target()); *err = MakeStaticLibDepsError(this, pair.ptr);
return false; return false;
} }
} }
// Verify no inherited libraries are static libraries. // Verify no inherited libraries are static libraries.
for (size_t i = 0; i < inherited_libraries().size(); ++i) { for (const auto& lib : inherited_libraries()) {
if (inherited_libraries()[i]->output_type() == Target::STATIC_LIBRARY) { if (lib->output_type() == Target::STATIC_LIBRARY) {
*err = MakeStaticLibDepsError(this, inherited_libraries()[i]); *err = MakeStaticLibDepsError(this, lib);
return false; return false;
} }
} }
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "tools/gn/source_file.h" #include "tools/gn/source_file.h"
#include "tools/gn/unique_vector.h" #include "tools/gn/unique_vector.h"
class DepsIteratorRange;
class InputFile; class InputFile;
class Settings; class Settings;
class Token; class Token;
...@@ -41,6 +42,12 @@ class Target : public Item { ...@@ -41,6 +42,12 @@ class Target : public Item {
ACTION, ACTION,
ACTION_FOREACH, ACTION_FOREACH,
}; };
enum DepsIterationType {
DEPS_ALL, // Iterates through all public, private, and data deps.
DEPS_LINKED, // Iterates through all non-data dependencies.
};
typedef std::vector<SourceFile> FileList; typedef std::vector<SourceFile> FileList;
typedef std::vector<std::string> StringVector; typedef std::vector<std::string> StringVector;
...@@ -125,6 +132,11 @@ class Target : public Item { ...@@ -125,6 +132,11 @@ class Target : public Item {
output_type_ == COPY_FILES; output_type_ == COPY_FILES;
} }
// Returns the iterator range which can be used in range-based for loops
// to iterate over multiple types of deps in one loop:
// for (const auto& pair : target->GetDeps(Target::DEPS_ALL)) ...
DepsIteratorRange GetDeps(DepsIterationType type) const;
// Linked private dependencies. // Linked private dependencies.
const LabelTargetVector& private_deps() const { return private_deps_; } const LabelTargetVector& private_deps() const { return private_deps_; }
LabelTargetVector& private_deps() { return private_deps_; } LabelTargetVector& private_deps() { return private_deps_; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment