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

Ted Kremenek kremenek at apple.com
Thu Mar 28 17:09:23 PDT 2013


Author: kremenek
Date: Thu Mar 28 19:09:22 2013
New Revision: 178317

URL: http://llvm.org/viewvc/llvm-project?rev=178317&view=rev
Log:
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.

Modified:
    cfe/trunk/include/clang/Analysis/AnalysisContext.h
    cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
    cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp
    cfe/trunk/lib/StaticAnalyzer/Core/AnalysisManager.cpp
    cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp

Modified: cfe/trunk/include/clang/Analysis/AnalysisContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/AnalysisContext.h?rev=178317&r1=178316&r2=178317&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/AnalysisContext.h (original)
+++ cfe/trunk/include/clang/Analysis/AnalysisContext.h Thu Mar 28 19:09:22 2013
@@ -410,7 +410,8 @@ public:
                              bool addImplicitDtors = false,
                              bool addInitializers = false,
                              bool addTemporaryDtors = false,
-                             bool synthesizeBodies = false);
+                             bool synthesizeBodies = false,
+                             bool addStaticInitBranches = false);
 
   ~AnalysisDeclContextManager();
 

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h?rev=178317&r1=178316&r2=178317&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h Thu Mar 28 19:09:22 2013
@@ -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.
   //

Modified: cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp?rev=178317&r1=178316&r2=178317&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp (original)
+++ cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp Thu Mar 28 19:09:22 2013
@@ -66,13 +66,15 @@ AnalysisDeclContextManager::AnalysisDecl
                                                        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() {

Modified: cfe/trunk/lib/StaticAnalyzer/Core/AnalysisManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/AnalysisManager.cpp?rev=178317&r1=178316&r2=178317&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/AnalysisManager.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/AnalysisManager.cpp Thu Mar 28 19:09:22 2013
@@ -25,7 +25,8 @@ AnalysisManager::AnalysisManager(ASTCont
               /*AddImplicitDtors=*/true,
               /*AddInitializers=*/true,
               Options.includeTemporaryDtorsInCFG(),
-              Options.shouldSynthesizeBodies()),
+              Options.shouldSynthesizeBodies(),
+              Options.shouldConditionalizeStaticInitializers()),
     Ctx(ctx),
     Diags(diags),
     LangOpts(lang),

Modified: cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp?rev=178317&r1=178316&r2=178317&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp Thu Mar 28 19:09:22 2013
@@ -236,3 +236,8 @@ bool AnalyzerOptions::shouldSynthesizeBo
 bool AnalyzerOptions::shouldPrunePaths() {
   return getBooleanOption("prune-paths", true);
 }
+
+bool AnalyzerOptions::shouldConditionalizeStaticInitializers() {
+  return getBooleanOption("conditional-static-initializers", false);
+}
+





More information about the cfe-commits mailing list