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

Unified Diff: tools/gn/target.h

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/target.h
diff --git a/tools/gn/target.h b/tools/gn/target.h
index 9d4b4bee45bfe7027f9f8ac55cdabdb225ba93af..947edc25b8afe123a28ca9ef2c08a662b6f8421c 100644
--- a/tools/gn/target.h
+++ b/tools/gn/target.h
@@ -23,6 +23,7 @@
#include "tools/gn/source_file.h"
#include "tools/gn/unique_vector.h"
+class DepsIteratorRange;
class InputFile;
class Settings;
class Token;
@@ -41,6 +42,12 @@ class Target : public Item {
ACTION,
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<std::string> StringVector;
@@ -125,6 +132,11 @@ class Target : public Item {
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.
const LabelTargetVector& private_deps() const { return private_deps_; }
LabelTargetVector& private_deps() { return private_deps_; }

Powered by Google App Engine
This is Rietveld 408576698