Add configuration plumbing to enable static initializer branching in the CFG for the analyzer.

This setting still isn't enabled yet in the analyzer.  This is
just prep work.

llvm-svn: 178317
This commit is contained in:
Ted Kremenek
2013-03-29 00:09:22 +00:00
parent 311246c6d5
commit 233c1b0c77
5 changed files with 16 additions and 3 deletions

View File

@@ -410,7 +410,8 @@ public:
bool addImplicitDtors = false,
bool addInitializers = false,
bool addTemporaryDtors = false,
bool synthesizeBodies = false);
bool synthesizeBodies = false,
bool addStaticInitBranches = false);
~AnalysisDeclContextManager();

View File

@@ -313,6 +313,10 @@ public:
/// values "true" and "false".
bool shouldPrunePaths();
/// Returns true if 'static' initializers should be in conditional logic
/// in the CFG.
bool shouldConditionalizeStaticInitializers();
// Returns the size of the functions (in basic blocks), which should be
// considered to be small enough to always inline.
//

View File

@@ -66,13 +66,15 @@ AnalysisDeclContextManager::AnalysisDeclContextManager(bool useUnoptimizedCFG,
bool addImplicitDtors,
bool addInitializers,
bool addTemporaryDtors,
bool synthesizeBodies)
bool synthesizeBodies,
bool addStaticInitBranch)
: SynthesizeBodies(synthesizeBodies)
{
cfgBuildOptions.PruneTriviallyFalseEdges = !useUnoptimizedCFG;
cfgBuildOptions.AddImplicitDtors = addImplicitDtors;
cfgBuildOptions.AddInitializers = addInitializers;
cfgBuildOptions.AddTemporaryDtors = addTemporaryDtors;
cfgBuildOptions.AddStaticInitBranches = addStaticInitBranch;
}
void AnalysisDeclContextManager::clear() {

View File

@@ -25,7 +25,8 @@ AnalysisManager::AnalysisManager(ASTContext &ctx, DiagnosticsEngine &diags,
/*AddImplicitDtors=*/true,
/*AddInitializers=*/true,
Options.includeTemporaryDtorsInCFG(),
Options.shouldSynthesizeBodies()),
Options.shouldSynthesizeBodies(),
Options.shouldConditionalizeStaticInitializers()),
Ctx(ctx),
Diags(diags),
LangOpts(lang),

View File

@@ -236,3 +236,8 @@ bool AnalyzerOptions::shouldSynthesizeBodies() {
bool AnalyzerOptions::shouldPrunePaths() {
return getBooleanOption("prune-paths", true);
}
bool AnalyzerOptions::shouldConditionalizeStaticInitializers() {
return getBooleanOption("conditional-static-initializers", false);
}