OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CLANG_PLUGINS_CHROMECLASSTESTER_H_ | 5 #ifndef TOOLS_CLANG_PLUGINS_CHROMECLASSTESTER_H_ |
6 #define TOOLS_CLANG_PLUGINS_CHROMECLASSTESTER_H_ | 6 #define TOOLS_CLANG_PLUGINS_CHROMECLASSTESTER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 private: | 47 private: |
48 void BuildBannedLists(); | 48 void BuildBannedLists(); |
49 | 49 |
50 void CheckTag(clang::TagDecl*); | 50 void CheckTag(clang::TagDecl*); |
51 | 51 |
52 // Filtered versions of tags that are only called with things defined in | 52 // Filtered versions of tags that are only called with things defined in |
53 // chrome header files. | 53 // chrome header files. |
54 virtual void CheckChromeClass(clang::SourceLocation record_location, | 54 virtual void CheckChromeClass(clang::SourceLocation record_location, |
55 clang::CXXRecordDecl* record) = 0; | 55 clang::CXXRecordDecl* record) = 0; |
56 | 56 |
| 57 // Filtered versions of enum type that are only called with things defined |
| 58 // in chrome header files. |
| 59 virtual void CheckChromeEnum(clang::SourceLocation enum_location, |
| 60 clang::EnumDecl* enum_decl) { |
| 61 } |
| 62 |
57 // Utility methods used for filtering out non-chrome classes (and ones we | 63 // Utility methods used for filtering out non-chrome classes (and ones we |
58 // deliberately ignore) in HandleTagDeclDefinition(). | 64 // deliberately ignore) in HandleTagDeclDefinition(). |
59 std::string GetNamespaceImpl(const clang::DeclContext* context, | 65 std::string GetNamespaceImpl(const clang::DeclContext* context, |
60 const std::string& candidate); | 66 const std::string& candidate); |
61 bool InBannedDirectory(clang::SourceLocation loc); | 67 bool InBannedDirectory(clang::SourceLocation loc); |
62 bool IsIgnoredType(const std::string& base_name); | 68 bool IsIgnoredType(const std::string& base_name); |
63 | 69 |
64 // Attempts to determine the filename for the given SourceLocation. | 70 // Attempts to determine the filename for the given SourceLocation. |
65 // Returns false if the filename could not be determined. | 71 // Returns false if the filename could not be determined. |
66 bool GetFilename(clang::SourceLocation loc, std::string* filename); | 72 bool GetFilename(clang::SourceLocation loc, std::string* filename); |
67 | 73 |
68 clang::CompilerInstance& instance_; | 74 clang::CompilerInstance& instance_; |
69 clang::DiagnosticsEngine& diagnostic_; | 75 clang::DiagnosticsEngine& diagnostic_; |
70 | 76 |
71 // List of banned namespaces. | 77 // List of banned namespaces. |
72 std::vector<std::string> banned_namespaces_; | 78 std::vector<std::string> banned_namespaces_; |
73 | 79 |
74 // List of banned directories. | 80 // List of banned directories. |
75 std::vector<std::string> banned_directories_; | 81 std::vector<std::string> banned_directories_; |
76 | 82 |
77 // List of types that we don't check. | 83 // List of types that we don't check. |
78 std::set<std::string> ignored_record_names_; | 84 std::set<std::string> ignored_record_names_; |
79 | 85 |
80 // List of decls to check once the current top-level decl is parsed. | 86 // List of decls to check once the current top-level decl is parsed. |
81 std::vector<clang::TagDecl*> pending_class_decls_; | 87 std::vector<clang::TagDecl*> pending_class_decls_; |
82 }; | 88 }; |
83 | 89 |
84 #endif // TOOLS_CLANG_PLUGINS_CHROMECLASSTESTER_H_ | 90 #endif // TOOLS_CLANG_PLUGINS_CHROMECLASSTESTER_H_ |
OLD | NEW |