clang  8.0.0svn
AnalysisConsumer.h
Go to the documentation of this file.
1 //===--- AnalysisConsumer.h - Front-end Analysis Engine Hooks ---*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This header contains the functions necessary for a front-end to run various
11 // analyses.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CLANG_STATICANALYZER_FRONTEND_ANALYSISCONSUMER_H
16 #define LLVM_CLANG_STATICANALYZER_FRONTEND_ANALYSISCONSUMER_H
17 
18 #include "clang/AST/ASTConsumer.h"
19 #include "clang/Basic/LLVM.h"
20 #include <functional>
21 #include <memory>
22 
23 namespace clang {
24 
25 class Preprocessor;
26 class DiagnosticsEngine;
27 class CodeInjector;
28 class CompilerInstance;
29 
30 namespace ento {
31 class PathDiagnosticConsumer;
32 class CheckerManager;
33 class CheckerRegistry;
34 
36 public:
37  virtual void AddDiagnosticConsumer(PathDiagnosticConsumer *Consumer) = 0;
38 
39  /// This method allows registering statically linked custom checkers that are
40  /// not a part of the Clang tree. It employs the same mechanism that is used
41  /// by plugins.
42  ///
43  /// Example:
44  ///
45  /// Consumer->AddCheckerRegistrationFn([] (CheckerRegistry& Registry) {
46  /// Registry.addChecker<MyCustomChecker>("example.MyCustomChecker",
47  /// "Description");
48  /// });
49  virtual void
50  AddCheckerRegistrationFn(std::function<void(CheckerRegistry &)> Fn) = 0;
51 };
52 
53 /// CreateAnalysisConsumer - Creates an ASTConsumer to run various code
54 /// analysis passes. (The set of analyses run is controlled by command-line
55 /// options.)
56 std::unique_ptr<AnalysisASTConsumer>
58 
59 } // end GR namespace
60 
61 } // end clang namespace
62 
63 #endif
Manages a set of available checkers for running a static analysis.
virtual void AddDiagnosticConsumer(PathDiagnosticConsumer *Consumer)=0
virtual void AddCheckerRegistrationFn(std::function< void(CheckerRegistry &)> Fn)=0
This method allows registering statically linked custom checkers that are not a part of the Clang tre...
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs...
Definition: ASTConsumer.h:34
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
Dataflow Directional Tag Classes.
std::unique_ptr< AnalysisASTConsumer > CreateAnalysisConsumer(CompilerInstance &CI)
CreateAnalysisConsumer - Creates an ASTConsumer to run various code analysis passes.