clang  14.0.0git
AnalysisManager.cpp
Go to the documentation of this file.
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 
10 
11 using namespace clang;
12 using namespace ento;
13 
14 void AnalysisManager::anchor() { }
15 
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  options(Options) {
45  AnaCtxMgr.getCFGBuildOptions().setAllAlwaysAdd();
48  Options.ShouldIncludeDefaultInitForAggregates;
49 }
50 
53  for (PathDiagnosticConsumers::iterator I = PathConsumers.begin(),
54  E = PathConsumers.end(); I != E; ++I) {
55  delete *I;
56  }
57 }
58 
61  for (PathDiagnosticConsumers::iterator I = PathConsumers.begin(),
62  E = PathConsumers.end();
63  I != E; ++I) {
64  (*I)->FlushDiagnostics(&filesMade);
65  }
66 }
clang::CFG::BuildOptions::AddCXXDefaultInitExprInAggregates
bool AddCXXDefaultInitExprInAggregates
Definition: CFG.h:1250
clang::ento::AnalysisManager::FlushDiagnostics
void FlushDiagnostics()
Definition: AnalysisManager.cpp:59
clang::ento::StoreManagerCreator
std::unique_ptr< StoreManager >(* StoreManagerCreator)(ProgramStateManager &)
Definition: ProgramState.h:43
clang::CFG::BuildOptions::setAllAlwaysAdd
BuildOptions & setAllAlwaysAdd()
Definition: CFG.h:1267
clang::CFG::BuildOptions::OmitImplicitValueInitializers
bool OmitImplicitValueInitializers
Definition: CFG.h:1254
clang::ento::PathDiagnosticConsumer::FilesMade
Definition: PathDiagnostic.h:112
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:212
clang::ento::AnalysisManager::AnalysisManager
AnalysisManager(ASTContext &ctx, Preprocessor &PP, const PathDiagnosticConsumers &Consumers, StoreManagerCreator storemgr, ConstraintManagerCreator constraintmgr, CheckerManager *checkerMgr, AnalyzerOptions &Options, CodeInjector *injector=nullptr)
Definition: AnalysisManager.cpp:16
clang::AnalyzerOptions
Stores options for the analyzer from the command line.
Definition: AnalyzerOptions.h:163
clang::ento::CheckerManager
Definition: CheckerManager.h:127
clang::ento::PathDiagnosticConsumers
std::vector< PathDiagnosticConsumer * > PathDiagnosticConsumers
Definition: PathDiagnosticConsumers.h:33
clang
Definition: CalledOnceCheck.h:17
clang::CodeInjector
CodeInjector is an interface which is responsible for injecting AST of function definitions that may ...
Definition: CodeInjector.h:35
true
#define true
Definition: stdbool.h:16
clang::ento::ConstraintManagerCreator
std::unique_ptr< ConstraintManager >(* ConstraintManagerCreator)(ProgramStateManager &, ExprEngine *)
Definition: ProgramState.h:41
clang::Preprocessor
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:130
AnalysisManager.h
clang::ento::AnalysisManager::~AnalysisManager
~AnalysisManager() override
Definition: AnalysisManager.cpp:51
clang::AnalysisDeclContextManager::getCFGBuildOptions
CFG::BuildOptions & getCFGBuildOptions()
Definition: AnalysisDeclContext.h:458