clang API Documentation

AnalysisManager.cpp
Go to the documentation of this file.
00001 //===-- AnalysisManager.cpp -------------------------------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
00011 
00012 using namespace clang;
00013 using namespace ento;
00014 
00015 void AnalysisManager::anchor() { }
00016 
00017 AnalysisManager::AnalysisManager(ASTContext &ctx, DiagnosticsEngine &diags,
00018                                  const LangOptions &lang,
00019                                  const PathDiagnosticConsumers &PDC,
00020                                  StoreManagerCreator storemgr,
00021                                  ConstraintManagerCreator constraintmgr, 
00022                                  CheckerManager *checkerMgr,
00023                                  AnalyzerOptions &Options,
00024                                  CodeInjector *injector)
00025   : AnaCtxMgr(Options.UnoptimizedCFG,
00026               /*AddImplicitDtors=*/true,
00027               /*AddInitializers=*/true,
00028               Options.includeTemporaryDtorsInCFG(),
00029               Options.shouldSynthesizeBodies(),
00030               Options.shouldConditionalizeStaticInitializers(),
00031               /*addCXXNewAllocator=*/true,
00032               injector),
00033     Ctx(ctx),
00034     Diags(diags),
00035     LangOpts(lang),
00036     PathConsumers(PDC),
00037     CreateStoreMgr(storemgr), CreateConstraintMgr(constraintmgr),
00038     CheckerMgr(checkerMgr),
00039     options(Options) {
00040   AnaCtxMgr.getCFGBuildOptions().setAllAlwaysAdd();
00041 }
00042 
00043 AnalysisManager::~AnalysisManager() {
00044   FlushDiagnostics();
00045   for (PathDiagnosticConsumers::iterator I = PathConsumers.begin(),
00046        E = PathConsumers.end(); I != E; ++I) {
00047     delete *I;
00048   }
00049 }
00050 
00051 void AnalysisManager::FlushDiagnostics() {
00052   PathDiagnosticConsumer::FilesMade filesMade;
00053   for (PathDiagnosticConsumers::iterator I = PathConsumers.begin(),
00054        E = PathConsumers.end();
00055        I != E; ++I) {
00056     (*I)->FlushDiagnostics(&filesMade);
00057   }
00058 }