Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:37:10

0001 //===--- AnalysisConsumer.h - Front-end Analysis Engine Hooks ---*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This header contains the functions necessary for a front-end to run various
0010 // analyses.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_CLANG_STATICANALYZER_FRONTEND_ANALYSISCONSUMER_H
0015 #define LLVM_CLANG_STATICANALYZER_FRONTEND_ANALYSISCONSUMER_H
0016 
0017 #include "clang/AST/ASTConsumer.h"
0018 #include "clang/Basic/LLVM.h"
0019 #include <functional>
0020 #include <memory>
0021 
0022 namespace clang {
0023 
0024 class CompilerInstance;
0025 
0026 namespace ento {
0027 class PathDiagnosticConsumer;
0028 class CheckerRegistry;
0029 
0030 class AnalysisASTConsumer : public ASTConsumer {
0031 public:
0032   virtual void AddDiagnosticConsumer(PathDiagnosticConsumer *Consumer) = 0;
0033 
0034   /// This method allows registering statically linked custom checkers that are
0035   /// not a part of the Clang tree. It employs the same mechanism that is used
0036   /// by plugins.
0037   ///
0038   /// Example:
0039   ///
0040   ///   Consumer->AddCheckerRegistrationFn([] (CheckerRegistry& Registry) {
0041   ///     Registry.addChecker<MyCustomChecker>("example.MyCustomChecker",
0042   ///                                          "Description");
0043   ///   });
0044   virtual void
0045   AddCheckerRegistrationFn(std::function<void(CheckerRegistry &)> Fn) = 0;
0046 };
0047 
0048 /// CreateAnalysisConsumer - Creates an ASTConsumer to run various code
0049 /// analysis passes.  (The set of analyses run is controlled by command-line
0050 /// options.)
0051 std::unique_ptr<AnalysisASTConsumer>
0052 CreateAnalysisConsumer(CompilerInstance &CI);
0053 
0054 } // namespace ento
0055 
0056 } // end clang namespace
0057 
0058 #endif