/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/StaticAnalyzer/Frontend/CreateCheckerManager.cpp
Line | Count | Source |
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 | | |
13 | | #include "clang/StaticAnalyzer/Core/CheckerManager.h" |
14 | | #include "clang/StaticAnalyzer/Frontend/CheckerRegistry.h" |
15 | | #include <memory> |
16 | | |
17 | | namespace clang { |
18 | | namespace ento { |
19 | | |
20 | | CheckerManager::CheckerManager( |
21 | | ASTContext &Context, AnalyzerOptions &AOptions, const Preprocessor &PP, |
22 | | ArrayRef<std::string> plugins, |
23 | | ArrayRef<std::function<void(CheckerRegistry &)>> checkerRegistrationFns) |
24 | 1.82k | : Context(&Context), LangOpts(Context.getLangOpts()), AOptions(AOptions), |
25 | 1.82k | PP(&PP), Diags(Context.getDiagnostics()), |
26 | 1.82k | RegistryData(std::make_unique<CheckerRegistryData>()) { |
27 | 1.82k | CheckerRegistry Registry(*RegistryData, plugins, Context.getDiagnostics(), |
28 | 1.82k | AOptions, checkerRegistrationFns); |
29 | 1.82k | Registry.initializeRegistry(*this); |
30 | 1.82k | Registry.initializeManager(*this); |
31 | 1.82k | finishedCheckerRegistration(); |
32 | 1.82k | } |
33 | | |
34 | | CheckerManager::CheckerManager(AnalyzerOptions &AOptions, |
35 | | const LangOptions &LangOpts, |
36 | | DiagnosticsEngine &Diags, |
37 | | ArrayRef<std::string> plugins) |
38 | 20 | : LangOpts(LangOpts), AOptions(AOptions), Diags(Diags), |
39 | 20 | RegistryData(std::make_unique<CheckerRegistryData>()) { |
40 | 20 | CheckerRegistry Registry(*RegistryData, plugins, Diags, AOptions, {}); |
41 | 20 | Registry.initializeRegistry(*this); |
42 | 20 | } |
43 | | |
44 | 1.84k | CheckerManager::~CheckerManager() { |
45 | 1.84k | for (const auto &CheckerDtor : CheckerDtors) |
46 | 27.5k | CheckerDtor(); |
47 | 1.84k | } |
48 | | |
49 | | } // namespace ento |
50 | | } // namespace clang |