/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/StaticAnalyzer/Core/AnalysisManager.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | //===-- AnalysisManager.cpp -------------------------------------*- 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 | | #include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h" |
10 | | |
11 | | using namespace clang; |
12 | | using namespace ento; |
13 | | |
14 | 0 | void AnalysisManager::anchor() { } |
15 | | |
16 | | AnalysisManager::AnalysisManager(ASTContext &ASTCtx, Preprocessor &PP, |
17 | | const PathDiagnosticConsumers &PDC, |
18 | | StoreManagerCreator storemgr, |
19 | | ConstraintManagerCreator constraintmgr, |
20 | | CheckerManager *checkerMgr, |
21 | | AnalyzerOptions &Options, |
22 | | CodeInjector *injector) |
23 | | : AnaCtxMgr( |
24 | | ASTCtx, Options.UnoptimizedCFG, |
25 | | Options.ShouldIncludeImplicitDtorsInCFG, |
26 | | /*addInitializers=*/true, |
27 | | Options.ShouldIncludeTemporaryDtorsInCFG, |
28 | | Options.ShouldIncludeLifetimeInCFG, |
29 | | // Adding LoopExit elements to the CFG is a requirement for loop |
30 | | // unrolling. |
31 | | Options.ShouldIncludeLoopExitInCFG || |
32 | | Options.ShouldUnrollLoops, |
33 | | Options.ShouldIncludeScopesInCFG, |
34 | | Options.ShouldSynthesizeBodies, |
35 | | Options.ShouldConditionalizeStaticInitializers, |
36 | | /*addCXXNewAllocator=*/true, |
37 | | Options.ShouldIncludeRichConstructorsInCFG, |
38 | | Options.ShouldElideConstructors, |
39 | | /*addVirtualBaseBranches=*/true, |
40 | | injector), |
41 | | Ctx(ASTCtx), PP(PP), LangOpts(ASTCtx.getLangOpts()), |
42 | | PathConsumers(PDC), CreateStoreMgr(storemgr), |
43 | | CreateConstraintMgr(constraintmgr), CheckerMgr(checkerMgr), |
44 | 1.35k | options(Options) { |
45 | 1.35k | AnaCtxMgr.getCFGBuildOptions().setAllAlwaysAdd(); |
46 | 1.35k | AnaCtxMgr.getCFGBuildOptions().OmitImplicitValueInitializers = true; |
47 | 1.35k | AnaCtxMgr.getCFGBuildOptions().AddCXXDefaultInitExprInAggregates = |
48 | 1.35k | Options.ShouldIncludeDefaultInitForAggregates; |
49 | 1.35k | } |
50 | | |
51 | 1.35k | AnalysisManager::~AnalysisManager() { |
52 | 1.35k | FlushDiagnostics(); |
53 | 1.35k | for (PathDiagnosticConsumers::iterator I = PathConsumers.begin(), |
54 | 2.82k | E = PathConsumers.end(); I != E; ++I1.47k ) { |
55 | 1.47k | delete *I; |
56 | 1.47k | } |
57 | 1.35k | } |
58 | | |
59 | 1.35k | void AnalysisManager::FlushDiagnostics() { |
60 | 1.35k | PathDiagnosticConsumer::FilesMade filesMade; |
61 | 1.35k | for (PathDiagnosticConsumers::iterator I = PathConsumers.begin(), |
62 | 1.35k | E = PathConsumers.end(); |
63 | 2.82k | I != E; ++I1.47k ) { |
64 | 1.47k | (*I)->FlushDiagnostics(&filesMade); |
65 | 1.47k | } |
66 | 1.35k | } |