1 //===- CheckerManager.h - Static Analyzer Checker Manager -------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // Defines the Static Analyzer Checker Manager.
11 //===----------------------------------------------------------------------===//
13 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
14 #include "clang/StaticAnalyzer/Frontend/CheckerRegistry.h"
20 CheckerManager::CheckerManager(
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);
31 finishedCheckerRegistration();
34 CheckerManager::CheckerManager(AnalyzerOptions
&AOptions
,
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);
44 CheckerManager::~CheckerManager() {
45 for (const auto &CheckerDtor
: CheckerDtors
)