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_refs.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_refs.cc
diff --git a/tools/gn/command_refs.cc b/tools/gn/command_refs.cc
index a1b37e578af34e8749b98609b3de8865cff7447d..c55726b3fb26655bff774d9450dde8557bc8d95e 100644
--- a/tools/gn/command_refs.cc
+++ b/tools/gn/command_refs.cc
@@ -27,12 +27,9 @@ typedef std::multimap<const Target*, const Target*> DepMap;
// Populates the reverse dependency map for the targets in the Setup.
void FillDepMap(Setup* setup, DepMap* dep_map) {
- std::vector<const Target*> targets =
- setup->builder()->GetAllResolvedTargets();
-
- 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]));
+ for (const auto& target : setup->builder()->GetAllResolvedTargets()) {
+ for (const auto& dep_pair : target->GetDeps(Target::DEPS_ALL))
+ dep_map->insert(std::make_pair(dep_pair.ptr, target));
}
}
« no previous file with comments | « tools/gn/command_desc.cc ('k') | tools/gn/deps_iterator.h » ('j') | tools/gn/target.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698