}
void RecursiveCollectChildDeps(const Target* target, std::set<Label>* result) {
- for (DepsIterator iter(target); !iter.done(); iter.Advance())
- RecursiveCollectDeps(iter.target(), result);
+ for (const auto& pair : target->GetDeps(Target::DEPS_ALL))
+ RecursiveCollectDeps(pair.ptr, result);
}
// Prints dependencies of the given target (not the target itself). If the
int indent_level) {
// Combine all deps into one sorted list.
std::vector<LabelTargetPair> sorted_deps;
- for (DepsIterator iter(target); !iter.done(); iter.Advance())
- sorted_deps.push_back(iter.pair());
+ for (const auto& pair : target->GetDeps(Target::DEPS_ALL))
+ sorted_deps.push_back(pair);
std::sort(sorted_deps.begin(), sorted_deps.end(),
LabelPtrLabelLess<Target>());
std::string indent(indent_level * 2, ' ');
- for (size_t i = 0; i < sorted_deps.size(); i++) {
- const Target* cur_dep = sorted_deps[i].ptr;
+ for (const auto& pair : sorted_deps) {
+ const Target* cur_dep = pair.ptr;
OutputString(indent +
cur_dep->label().GetUserVisibleName(default_toolchain));
std::set<Label> all_deps;
RecursiveCollectChildDeps(target, &all_deps);
- for (std::set<Label>::iterator i = all_deps.begin();
- i != all_deps.end(); ++i)
- deps.push_back(*i);
+ for (const auto& dep : all_deps)
+ deps.push_back(dep);
} else {
// Show direct dependencies only.
if (display_header) {
"\nDirect dependencies "
"(try also \"--all\", \"--tree\", or even \"--all --tree\"):\n");
}
- for (DepsIterator iter(target); !iter.done(); iter.Advance())
- deps.push_back(iter.label());
+ for (const auto& pair : target->GetDeps(Target::DEPS_ALL))
+ deps.push_back(pair.label);
}
std::sort(deps.begin(), deps.end());
- for (size_t i = 0; i < deps.size(); i++)
- OutputString(" " + deps[i].GetUserVisibleName(toolchain_label) + "\n");
+ for (const auto& dep : deps)
+ OutputString(" " + dep.GetUserVisibleName(toolchain_label) + "\n");
}
void PrintForwardDependentConfigsFrom(const Target* target,
// Collect the sorted list of deps.
std::vector<Label> forward;
- for (size_t i = 0; i < target->forward_dependent_configs().size(); i++)
- forward.push_back(target->forward_dependent_configs()[i].label);
+ for (const auto& pair : target->forward_dependent_configs())
+ forward.push_back(pair.label);
std::sort(forward.begin(), forward.end());
Label toolchain_label = target->label().GetToolchainLabel();
- for (size_t i = 0; i < forward.size(); i++)
- OutputString(" " + forward[i].GetUserVisibleName(toolchain_label) + "\n");
+ for (const auto& fwd : forward)
+ OutputString(" " + fwd.GetUserVisibleName(toolchain_label) + "\n");
}
// libs and lib_dirs are special in that they're inherited. We don't currently
Target::FileList public_headers = target->public_headers();
std::sort(public_headers.begin(), public_headers.end());
- for (size_t i = 0; i < public_headers.size(); i++)
- OutputString(" " + public_headers[i].value() + "\n");
+ for (const auto& hdr : public_headers)
+ OutputString(" " + hdr.value() + "\n");
}
void PrintCheckIncludes(const Target* target, bool display_header) {
OutputString("\nallow_circular_includes_from:\n");
Label toolchain_label = target->label().GetToolchainLabel();
- const std::set<Label>& allow = target->allow_circular_includes_from();
- for (std::set<Label>::const_iterator iter = allow.begin();
- iter != allow.end(); ++iter)
- OutputString(" " + iter->GetUserVisibleName(toolchain_label) + "\n");
+ for (const auto& cur : target->allow_circular_includes_from())
+ OutputString(" " + cur.GetUserVisibleName(toolchain_label) + "\n");
}
void PrintVisibility(const Target* target, bool display_header) {