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

Unified Diff: tools/gn/command_desc.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, 3 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 side-by-side diff with in-line comments
Download patch
Index: tools/gn/command_desc.cc
diff --git a/tools/gn/command_desc.cc b/tools/gn/command_desc.cc
index ccce001e9666280a02f9f3e0b8a6a619dcd2e569..d43577eade8e85f1672735e1e88b93cdfc22ecdf 100644
--- a/tools/gn/command_desc.cc
+++ b/tools/gn/command_desc.cc
@@ -51,8 +51,8 @@ void RecursiveCollectDeps(const Target* target, std::set<Label>* result) {
}
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
@@ -65,8 +65,8 @@ void RecursivePrintDeps(const Target* target,
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>());
@@ -140,8 +140,8 @@ void PrintDeps(const Target* target, bool 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());
« no previous file with comments | « tools/gn/builder.cc ('k') | tools/gn/command_refs.cc » ('j') | tools/gn/command_refs.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698