Index: tools/gn/header_checker.h |
diff --git a/tools/gn/header_checker.h b/tools/gn/header_checker.h |
index 59b795352564cb0aa33e807b7407f49b2677610e..bdfbb551624b029ff6f45fd98b3cd62c3c676276 100644 |
--- a/tools/gn/header_checker.h |
+++ b/tools/gn/header_checker.h |
@@ -41,8 +41,11 @@ class HeaderChecker : public base::RefCountedThreadSafe<HeaderChecker> { |
private: |
friend class base::RefCountedThreadSafe<HeaderChecker>; |
FRIEND_TEST_ALL_PREFIXES(HeaderCheckerTest, IsDependencyOf); |
+ FRIEND_TEST_ALL_PREFIXES(HeaderCheckerTest, |
+ IsDependencyOf_ForwardsDirectDependentConfigs); |
FRIEND_TEST_ALL_PREFIXES(HeaderCheckerTest, CheckInclude); |
- FRIEND_TEST_ALL_PREFIXES(HeaderCheckerTest, DoDirectDependentConfigsApply); |
+ FRIEND_TEST_ALL_PREFIXES(HeaderCheckerTest, |
+ GetDependentConfigChainProblemIndex); |
~HeaderChecker(); |
struct TargetInfo { |
@@ -84,32 +87,40 @@ class HeaderChecker : public base::RefCountedThreadSafe<HeaderChecker> { |
Err* err) const; |
// Returns true if the given search_for target is a dependency of |
- // search_from. Many subtrees are duplicated so this function avoids |
- // duplicate checking across recursive calls by keeping track of checked |
- // targets in the given set. It should point to an empty set for the first |
- // call. A target is not considered to be a dependency of itself. |
+ // search_from. |
// |
// If found, the vector given in "chain" will be filled with the reverse |
// dependency chain from the dest target (chain[0] = search_for) to the src |
// target (chain[chain.size() - 1] = search_from). |
+ // |
+ // If prefer_direct_dependent_configs is true, chains which forward direct |
+ // dependent configs will be considered first, and a chain which does not |
+ // will be returned only if no such chain exists. |
+ // |
+ // If direct_dependent_configs_apply is non-null, it will be set to true |
+ // if the chain was found during a search that requires forwarding direct |
+ // dependent configs, and false if it was found during a search of the |
+ // entire dependency graph. |
bool IsDependencyOf(const Target* search_for, |
const Target* search_from, |
- std::vector<const Target*>* chain) const; |
+ bool prefer_direct_dependent_configs, |
+ std::vector<const Target*>* chain, |
+ bool* direct_dependent_configs_apply) const; |
+ |
+ // For internal use by the previous override of IsDependencyOf. |
+ // If requires_dependent_configs is true, only chains which forward |
+ // direct dependent configs are considered. |
bool IsDependencyOf(const Target* search_for, |
const Target* search_from, |
- std::vector<const Target*>* chain, |
- std::set<const Target*>* checked) const; |
+ bool requires_dependent_configs, |
+ std::vector<const Target*>* chain) const; |
// Given a reverse dependency chain (chain[0] is the lower-level target, |
- // chain[end] is the higher-level target), determines if all direct dependent |
- // configs on the lower-level target would apply to the higher-level one. |
- // |
- // If configs do not apply, this function returns false and indicates the |
- // index of the target that caused the config to not apply by putting it in |
- // problematic_index. |
- static bool DoDirectDependentConfigsApply( |
- const std::vector<const Target*>& chain, |
- size_t* problematic_index); |
+ // chain[end] is the higher-level target) which does not forward direct |
+ // dependent configs, determines the index of the target that caused the |
+ // config to not apply. |
+ static size_t GetDependentConfigChainProblemIndex( |
+ const std::vector<const Target*>& chain); |
// Non-locked variables ------------------------------------------------------ |
// |