OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef TOOLS_GN_HEADER_CHECKER_H_ | 5 #ifndef TOOLS_GN_HEADER_CHECKER_H_ |
6 #define TOOLS_GN_HEADER_CHECKER_H_ | 6 #define TOOLS_GN_HEADER_CHECKER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 FRIEND_TEST_ALL_PREFIXES(HeaderCheckerTest, IsDependencyOf); | 51 FRIEND_TEST_ALL_PREFIXES(HeaderCheckerTest, IsDependencyOf); |
52 FRIEND_TEST_ALL_PREFIXES(HeaderCheckerTest, | 52 FRIEND_TEST_ALL_PREFIXES(HeaderCheckerTest, |
53 IsDependencyOf_ForwardsDirectDependentConfigs); | 53 IsDependencyOf_ForwardsDirectDependentConfigs); |
54 FRIEND_TEST_ALL_PREFIXES(HeaderCheckerTest, CheckInclude); | 54 FRIEND_TEST_ALL_PREFIXES(HeaderCheckerTest, CheckInclude); |
55 FRIEND_TEST_ALL_PREFIXES(HeaderCheckerTest, CheckIncludeAllowCircular); | 55 FRIEND_TEST_ALL_PREFIXES(HeaderCheckerTest, CheckIncludeAllowCircular); |
56 FRIEND_TEST_ALL_PREFIXES(HeaderCheckerTest, | 56 FRIEND_TEST_ALL_PREFIXES(HeaderCheckerTest, |
57 GetDependentConfigChainProblemIndex); | 57 GetDependentConfigChainProblemIndex); |
58 ~HeaderChecker(); | 58 ~HeaderChecker(); |
59 | 59 |
60 struct TargetInfo { | 60 struct TargetInfo { |
61 TargetInfo() : target(NULL), is_public(false) {} | 61 TargetInfo() : target(NULL), is_public(false), is_generated(false) {} |
62 TargetInfo(const Target* t, bool p) : target(t), is_public(p) {} | 62 TargetInfo(const Target* t, bool is_pub, bool is_gen) |
| 63 : target(t), |
| 64 is_public(is_pub), |
| 65 is_generated(is_gen) { |
| 66 } |
63 | 67 |
64 const Target* target; | 68 const Target* target; |
| 69 |
| 70 // True if the file is public in the given target. |
65 bool is_public; | 71 bool is_public; |
| 72 |
| 73 // True if this file is generated and won't actually exist on disk. |
| 74 bool is_generated; |
66 }; | 75 }; |
67 | 76 |
68 typedef std::vector<TargetInfo> TargetVector; | 77 typedef std::vector<TargetInfo> TargetVector; |
69 typedef std::map<SourceFile, TargetVector> FileMap; | 78 typedef std::map<SourceFile, TargetVector> FileMap; |
70 | 79 |
71 // Backend for Run() that takes the list of files to check. The errors_ list | 80 // Backend for Run() that takes the list of files to check. The errors_ list |
72 // will be populate on failure. | 81 // will be populate on failure. |
73 void RunCheckOverFiles(const FileMap& flies, bool force_check); | 82 void RunCheckOverFiles(const FileMap& flies, bool force_check); |
74 | 83 |
75 void DoWork(const Target* target, const SourceFile& file); | 84 void DoWork(const Target* target, const SourceFile& file); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // These are mutable during runtime and require locking. | 162 // These are mutable during runtime and require locking. |
154 | 163 |
155 base::Lock lock_; | 164 base::Lock lock_; |
156 | 165 |
157 std::vector<Err> errors_; | 166 std::vector<Err> errors_; |
158 | 167 |
159 DISALLOW_COPY_AND_ASSIGN(HeaderChecker); | 168 DISALLOW_COPY_AND_ASSIGN(HeaderChecker); |
160 }; | 169 }; |
161 | 170 |
162 #endif // TOOLS_GN_HEADER_CHECKER_H_ | 171 #endif // TOOLS_GN_HEADER_CHECKER_H_ |
OLD | NEW |