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
12 using namespace clang;
13 using namespace ento;
14
anchor()15 void AnalysisManager::anchor() { }
16
AnalysisManager(ASTContext & ctx,DiagnosticsEngine & diags,const LangOptions & lang,const PathDiagnosticConsumers & PDC,StoreManagerCreator storemgr,ConstraintManagerCreator constraintmgr,CheckerManager * checkerMgr,const AnalyzerOptions & Options)17 AnalysisManager::AnalysisManager(ASTContext &ctx, DiagnosticsEngine &diags,
18 const LangOptions &lang,
19 const PathDiagnosticConsumers &PDC,
20 StoreManagerCreator storemgr,
21 ConstraintManagerCreator constraintmgr,
22 CheckerManager *checkerMgr,
23 const AnalyzerOptions &Options)
24 : AnaCtxMgr(Options.UnoptimizedCFG,
25 /*AddImplicitDtors=*/true,
26 /*AddInitializers=*/true,
27 Options.includeTemporaryDtorsInCFG()),
28 Ctx(ctx),
29 Diags(diags),
30 LangOpts(lang),
31 PathConsumers(PDC),
32 CreateStoreMgr(storemgr), CreateConstraintMgr(constraintmgr),
33 CheckerMgr(checkerMgr),
34 options(Options) {
35 AnaCtxMgr.getCFGBuildOptions().setAllAlwaysAdd();
36 }
37
~AnalysisManager()38 AnalysisManager::~AnalysisManager() {
39 FlushDiagnostics();
40 for (PathDiagnosticConsumers::iterator I = PathConsumers.begin(),
41 E = PathConsumers.end(); I != E; ++I) {
42 delete *I;
43 }
44 }
45
FlushDiagnostics()46 void AnalysisManager::FlushDiagnostics() {
47 PathDiagnosticConsumer::FilesMade filesMade;
48 for (PathDiagnosticConsumers::iterator I = PathConsumers.begin(),
49 E = PathConsumers.end();
50 I != E; ++I) {
51 (*I)->FlushDiagnostics(&filesMade);
52 }
53 }
54