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

Side by Side Diff: tools/clang/plugins/ChromeClassTester.h

Issue 1703713002: clang-plugin: Enable RecursiveASTVisitor approach by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: +https Created 4 years, 10 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
« no previous file with comments | « no previous file | tools/clang/plugins/ChromeClassTester.cpp » ('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 (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
11 #include "Options.h" 11 #include "Options.h"
12 #include "clang/AST/ASTConsumer.h" 12 #include "clang/AST/ASTConsumer.h"
13 #include "clang/AST/TypeLoc.h" 13 #include "clang/AST/TypeLoc.h"
14 #include "clang/Frontend/CompilerInstance.h" 14 #include "clang/Frontend/CompilerInstance.h"
15 15
16 // A class on top of ASTConsumer that forwards classes defined in Chromium 16 // A class on top of ASTConsumer that forwards classes defined in Chromium
17 // headers to subclasses which implement CheckChromeClass(). 17 // headers to subclasses which implement CheckChromeClass().
18 class ChromeClassTester : public clang::ASTConsumer { 18 // TODO(vmpstr): Fold this class into FindBadConstructsConsumer.
19 class ChromeClassTester {
19 public: 20 public:
20 ChromeClassTester(clang::CompilerInstance& instance, 21 ChromeClassTester(clang::CompilerInstance& instance,
21 const chrome_checker::Options& options); 22 const chrome_checker::Options& options);
22 virtual ~ChromeClassTester(); 23 virtual ~ChromeClassTester();
23 24
24 // clang::ASTConsumer:
25 virtual void HandleTagDeclDefinition(clang::TagDecl* tag);
26 virtual bool HandleTopLevelDecl(clang::DeclGroupRef group_ref);
27
28 void CheckTag(clang::TagDecl*); 25 void CheckTag(clang::TagDecl*);
29 26
30 clang::DiagnosticsEngine::Level getErrorLevel(); 27 clang::DiagnosticsEngine::Level getErrorLevel();
31 28
32 protected: 29 protected:
33 clang::CompilerInstance& instance() { return instance_; } 30 clang::CompilerInstance& instance() { return instance_; }
34 clang::DiagnosticsEngine& diagnostic() { return diagnostic_; } 31 clang::DiagnosticsEngine& diagnostic() { return diagnostic_; }
35 32
36 // Emits a simple warning; this shouldn't be used if you require printf-style 33 // Emits a simple warning; this shouldn't be used if you require printf-style
37 // printing. 34 // printing.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 86
90 // List of directories allowed even though their parent directories are in 87 // List of directories allowed even though their parent directories are in
91 // |banned_directories_|, below. 88 // |banned_directories_|, below.
92 std::set<std::string> allowed_directories_; 89 std::set<std::string> allowed_directories_;
93 90
94 // List of banned directories. 91 // List of banned directories.
95 std::set<std::string> banned_directories_; 92 std::set<std::string> banned_directories_;
96 93
97 // List of types that we don't check. 94 // List of types that we don't check.
98 std::set<std::string> ignored_record_names_; 95 std::set<std::string> ignored_record_names_;
99
100 // List of decls to check once the current top-level decl is parsed.
101 std::vector<clang::TagDecl*> pending_class_decls_;
102 }; 96 };
103 97
104 #endif // TOOLS_CLANG_PLUGINS_CHROMECLASSTESTER_H_ 98 #endif // TOOLS_CLANG_PLUGINS_CHROMECLASSTESTER_H_
OLDNEW
« no previous file with comments | « no previous file | tools/clang/plugins/ChromeClassTester.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698