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
15#include "clang/StaticAnalyzer/Core/Checker.h"
16#include "clang/StaticAnalyzer/Core/CheckerManager.h"
17#include "clang/StaticAnalyzer/Frontend/CheckerRegistry.h"
18#include <memory>
19
20namespace clang {
21namespace ento {
22
23CheckerManager::CheckerManager(
24 ASTContext &Context, AnalyzerOptions &AOptions, const Preprocessor &PP,
25 ArrayRef<std::string> plugins,
26 ArrayRef<std::function<void(CheckerRegistry &)>> checkerRegistrationFns)
27 : Context(&Context), LangOpts(Context.getLangOpts()), AOptions(AOptions),
28 PP(&PP), Diags(Context.getDiagnostics()),
29 RegistryData(std::make_unique<CheckerRegistryData>()) {
30 CheckerRegistry Registry(*RegistryData, plugins, Context.getDiagnostics(),
31 AOptions, checkerRegistrationFns);
32 Registry.initializeRegistry(Mgr: *this);
33 Registry.initializeManager(CheckerMgr&: *this);
34}
35
36CheckerManager::CheckerManager(AnalyzerOptions &AOptions,
37 const LangOptions &LangOpts,
38 DiagnosticsEngine &Diags,
39 ArrayRef<std::string> plugins)
40 : LangOpts(LangOpts), AOptions(AOptions), Diags(Diags),
41 RegistryData(std::make_unique<CheckerRegistryData>()) {
42 CheckerRegistry Registry(*RegistryData, plugins, Diags, AOptions, {});
43 Registry.initializeRegistry(Mgr: *this);
44}
45
46// This is declared here to ensure that the destructors of `CheckerBase` and
47// `CheckerRegistryData` are available.
48CheckerManager::~CheckerManager() = default;
49
50} // namespace ento
51} // namespace clang
52

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

source code of clang/lib/StaticAnalyzer/Frontend/CreateCheckerManager.cpp