clang 24.0.0git
CreateCheckerManager.cpp
Go to the documentation of this file.
1//===- CreateCheckerManager.cpp - Checker Manager constructor ---*- 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 constructors and the destructor of the Static Analyzer Checker
10// Manager which cannot be placed under 'Core' because they depend on the
11// CheckerRegistry.
12//
13//===----------------------------------------------------------------------===//
14
18#include "llvm/Support/TimeProfiler.h"
19#include <memory>
20
21namespace clang {
22namespace ento {
23
25 ASTContext &Context, AnalyzerOptions &AOptions, const Preprocessor &PP,
27 ArrayRef<std::function<void(CheckerRegistry &)>> checkerRegistrationFns)
28 : Context(&Context), LangOpts(Context.getLangOpts()), AOptions(AOptions),
29 PP(&PP), Diags(Context.getDiagnostics()),
30 RegistryData(std::make_unique<CheckerRegistryData>()),
31 TimeTraceEnabled(llvm::timeTraceProfilerEnabled()) {
32 CheckerRegistry Registry(*RegistryData, plugins, Context.getDiagnostics(),
33 AOptions, checkerRegistrationFns);
34 Registry.initializeRegistry(*this);
35 Registry.initializeManager(*this);
36}
37
39 const LangOptions &LangOpts,
40 DiagnosticsEngine &Diags,
42 : LangOpts(LangOpts), AOptions(AOptions), Diags(Diags),
43 RegistryData(std::make_unique<CheckerRegistryData>()),
44 TimeTraceEnabled(llvm::timeTraceProfilerEnabled()) {
45 CheckerRegistry Registry(*RegistryData, plugins, Diags, AOptions, {});
46 Registry.initializeRegistry(*this);
47}
48
49// This is declared here to ensure that the destructors of `CheckerBase` and
50// `CheckerRegistryData` are available.
52
53} // namespace ento
54} // namespace clang
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:245
Stores options for the analyzer from the command line.
Concrete class used by the front-end to report problems and issues.
Definition Diagnostic.h:240
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
DiagnosticsEngine & getDiagnostics() const
CheckerManager(ASTContext &Context, AnalyzerOptions &AOptions, const Preprocessor &PP, ArrayRef< std::string > plugins, ArrayRef< std::function< void(CheckerRegistry &)> > checkerRegistrationFns)
const LangOptions & getLangOpts() const
Manages a set of available checkers for running a static analysis.
void initializeRegistry(const CheckerManager &Mgr)
Collects all enabled checkers in the field EnabledCheckers.
Top level wrappers for InstallAPI frontend operations.
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30
int const char * function
Definition c++config.h:31