clang  14.0.0git
CreateCheckerManager.cpp
Go to the documentation of this file.
1 //===- CheckerManager.h - Static Analyzer Checker Manager -------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Defines the Static Analyzer Checker Manager.
10 //
11 //===----------------------------------------------------------------------===//
12 
15 #include <memory>
16 
17 namespace clang {
18 namespace ento {
19 
21  ASTContext &Context, AnalyzerOptions &AOptions, const Preprocessor &PP,
22  ArrayRef<std::string> plugins,
23  ArrayRef<std::function<void(CheckerRegistry &)>> checkerRegistrationFns)
24  : Context(&Context), LangOpts(Context.getLangOpts()), AOptions(AOptions),
25  PP(&PP), Diags(Context.getDiagnostics()),
26  RegistryData(std::make_unique<CheckerRegistryData>()) {
27  CheckerRegistry Registry(*RegistryData, plugins, Context.getDiagnostics(),
28  AOptions, checkerRegistrationFns);
29  Registry.initializeRegistry(*this);
30  Registry.initializeManager(*this);
32 }
33 
35  const LangOptions &LangOpts,
36  DiagnosticsEngine &Diags,
37  ArrayRef<std::string> plugins)
38  : LangOpts(LangOpts), AOptions(AOptions), Diags(Diags),
39  RegistryData(std::make_unique<CheckerRegistryData>()) {
40  CheckerRegistry Registry(*RegistryData, plugins, Diags, AOptions, {});
41  Registry.initializeRegistry(*this);
42 }
43 
45  for (const auto &CheckerDtor : CheckerDtors)
46  CheckerDtor();
47 }
48 
49 } // namespace ento
50 } // namespace clang
clang::ento::CheckerRegistry::initializeRegistry
void initializeRegistry(const CheckerManager &Mgr)
Collects all enabled checkers in the field EnabledCheckers.
Definition: CheckerRegistry.cpp:206
clang::ento::CheckerRegistryData
Definition: CheckerRegistryData.h:193
clang::DiagnosticsEngine
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:191
clang::ento::CheckerManager::CheckerDtor
CheckerFn< void()> CheckerDtor
Definition: CheckerManager.h:193
CheckerManager.h
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:212
llvm::ArrayRef< std::string >
clang::AnalyzerOptions
Stores options for the analyzer from the command line.
Definition: AnalyzerOptions.h:163
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:58
std
Definition: Format.h:4125
clang
Definition: CalledOnceCheck.h:17
clang::ento::CheckerManager::CheckerManager
CheckerManager(ASTContext &Context, AnalyzerOptions &AOptions, const Preprocessor &PP, ArrayRef< std::string > plugins, ArrayRef< std::function< void(CheckerRegistry &)>> checkerRegistrationFns)
Definition: CreateCheckerManager.cpp:20
CheckerRegistry.h
clang::ento::CheckerManager::finishedCheckerRegistration
void finishedCheckerRegistration()
Definition: CheckerManager.cpp:53
clang::ast_matchers::dynamic::RegistryData
static llvm::ManagedStatic< RegistryMaps > RegistryData
Definition: Registry.cpp:594
clang::Preprocessor
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:130
clang::ento::CheckerManager::~CheckerManager
~CheckerManager()
Definition: CreateCheckerManager.cpp:44
clang::ento::CheckerRegistry
Manages a set of available checkers for running a static analysis.
Definition: CheckerRegistry.h:89
clang::ento::CheckerFn
Definition: CheckerManager.h:59