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

Side by Side Diff: trunk/src/tools/gn/header_checker.h

Issue 231293003: Revert 262747 "Improve GN public header file checking" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/src/tools/gn/c_include_iterator_unittest.cc ('k') | trunk/src/tools/gn/header_checker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/run_loop.h" 15 #include "base/run_loop.h"
16 #include "base/strings/string_piece.h" 16 #include "base/strings/string_piece.h"
17 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
18 #include "tools/gn/err.h" 18 #include "tools/gn/err.h"
19 19
20 class BuildSettings; 20 class BuildSettings;
21 class InputFile;
22 class Label; 21 class Label;
23 class LocationRange;
24 class SourceFile; 22 class SourceFile;
25 class Target; 23 class Target;
26 24
27 namespace base { 25 namespace base {
28 class MessageLoop; 26 class MessageLoop;
29 } 27 }
30 28
31 class HeaderChecker : public base::RefCountedThreadSafe<HeaderChecker> { 29 class HeaderChecker : public base::RefCountedThreadSafe<HeaderChecker> {
32 public: 30 public:
33 HeaderChecker(const BuildSettings* build_settings, 31 HeaderChecker(const BuildSettings* build_settings,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // Resolves the contents of an include to a SourceFile. 64 // Resolves the contents of an include to a SourceFile.
67 SourceFile SourceFileForInclude(const base::StringPiece& input) const; 65 SourceFile SourceFileForInclude(const base::StringPiece& input) const;
68 66
69 // from_target is the target the file was defined from. It will be used in 67 // from_target is the target the file was defined from. It will be used in
70 // error messages. 68 // error messages.
71 bool CheckFile(const Target* from_target, 69 bool CheckFile(const Target* from_target,
72 const SourceFile& file, 70 const SourceFile& file,
73 Err* err) const; 71 Err* err) const;
74 72
75 // Checks that the given file in the given target can include the given 73 // Checks that the given file in the given target can include the given
76 // include file. If disallowed, returns false and sets the error. The 74 // include file. If disallowed, returns false and sets the error.
77 // range indicates the location of the include in the file for error
78 // reporting.
79 bool CheckInclude(const Target* from_target, 75 bool CheckInclude(const Target* from_target,
80 const InputFile& source_file, 76 const SourceFile& source_file,
81 const SourceFile& include_file, 77 const SourceFile& include_file,
82 const LocationRange& range,
83 Err* err) const; 78 Err* err) const;
84 79
85 // Returns true if the given search_for target is a dependency of 80 // Returns true if the given search_for target is a dependency of
86 // search_from. Many subtrees are duplicated so this function avoids 81 // search_from. Many subtrees are duplicated so this function avoids
87 // duplicate checking across recursive calls by keeping track of checked 82 // duplicate checking across recursive calls by keeping track of checked
88 // targets in the given set. It should point to an empty set for the first 83 // targets in the given set. It should point to an empty set for the first
89 // call. A target is not considered to be a dependency of itself. 84 // call. A target is not considered to be a dependency of itself.
90 bool IsDependencyOf(const Target* search_for, 85 bool IsDependencyOf(const Target* search_for,
91 const Target* search_from) const; 86 const Target* search_from) const;
92 bool IsDependencyOf(const Target* search_for, 87 bool IsDependencyOf(const Target* search_for,
(...skipping 19 matching lines...) Expand all
112 // These are mutable during runtime and require locking. 107 // These are mutable during runtime and require locking.
113 108
114 base::Lock lock_; 109 base::Lock lock_;
115 110
116 std::vector<Err> errors_; 111 std::vector<Err> errors_;
117 112
118 DISALLOW_COPY_AND_ASSIGN(HeaderChecker); 113 DISALLOW_COPY_AND_ASSIGN(HeaderChecker);
119 }; 114 };
120 115
121 #endif // TOOLS_GN_HEADER_CHECKER_H_ 116 #endif // TOOLS_GN_HEADER_CHECKER_H_
OLDNEW
« no previous file with comments | « trunk/src/tools/gn/c_include_iterator_unittest.cc ('k') | trunk/src/tools/gn/header_checker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698