1//===-- AnalysisManager.cpp -------------------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h" 11 12using namespace clang; 13using namespace ento; 14 15void AnalysisManager::anchor() { } 16 17AnalysisManager::AnalysisManager(ASTContext &ctx, DiagnosticsEngine &diags, 18 const LangOptions &lang, 19 const PathDiagnosticConsumers &PDC, 20 StoreManagerCreator storemgr, 21 ConstraintManagerCreator constraintmgr, 22 CheckerManager *checkerMgr, 23 AnalyzerOptions &Options) 24 : AnaCtxMgr(Options.UnoptimizedCFG, 25 /*AddImplicitDtors=*/true, 26 /*AddInitializers=*/true, 27 Options.includeTemporaryDtorsInCFG(), 28 Options.shouldSynthesizeBodies(), 29 Options.shouldConditionalizeStaticInitializers()), 30 Ctx(ctx), 31 Diags(diags), 32 LangOpts(lang), 33 PathConsumers(PDC), 34 CreateStoreMgr(storemgr), CreateConstraintMgr(constraintmgr), 35 CheckerMgr(checkerMgr), 36 options(Options) { 37 AnaCtxMgr.getCFGBuildOptions().setAllAlwaysAdd(); 38} 39 40AnalysisManager::~AnalysisManager() { 41 FlushDiagnostics(); 42 for (PathDiagnosticConsumers::iterator I = PathConsumers.begin(), 43 E = PathConsumers.end(); I != E; ++I) { 44 delete *I; 45 } 46} 47 48void AnalysisManager::FlushDiagnostics() { 49 PathDiagnosticConsumer::FilesMade filesMade; 50 for (PathDiagnosticConsumers::iterator I = PathConsumers.begin(), 51 E = PathConsumers.end(); 52 I != E; ++I) { 53 (*I)->FlushDiagnostics(&filesMade); 54 } 55} 56