brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 5d5049a Raw
52 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8//9// Defines the constructors and the destructor of the Static Analyzer Checker10// Manager which cannot be placed under 'Core' because they depend on the11// 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(*this);33  Registry.initializeManager(*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(*this);44}45 46// This is declared here to ensure that the destructors of `CheckerBase` and47// `CheckerRegistryData` are available.48CheckerManager::~CheckerManager() = default;49 50} // namespace ento51} // namespace clang52