]> granicus.if.org Git - clang/commitdiff
GRExprEngine now expects the LiveVariables information to be provided by its creator.
authorTed Kremenek <kremenek@apple.com>
Wed, 2 Jul 2008 20:13:38 +0000 (20:13 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 2 Jul 2008 20:13:38 +0000 (20:13 +0000)
This allows an optimization in AnalysisConsumer where the same LiveVariables information is used between multiple analyses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53046 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/AnalysisConsumer.cpp
include/clang/Analysis/PathSensitive/GRExprEngine.h
lib/Analysis/GRExprEngine.cpp

index 1e33ae168aebedc1ca2f956e8db6f10d4dffcb02..65a3dae507d4fe3210db4110d496b7d9faf1bdff 100644 (file)
@@ -154,6 +154,7 @@ namespace {
       if (!liveness) {
         liveness.reset(new LiveVariables(*getCFG()));
         liveness->runOnCFG(*getCFG());
+        liveness->runOnAllBlocks(*getCFG(), 0, true);
       }
       return liveness.get();
     }
@@ -284,7 +285,8 @@ static void ActionGRExprEngine(AnalysisManager& mgr, GRTransferFuncs* tf) {
     mgr.DisplayFunction();
   
   // Construct the analysis engine.
-  GRExprEngine Eng(*mgr.getCFG(), *mgr.getCodeDecl(), mgr.getContext());  
+  GRExprEngine Eng(*mgr.getCFG(), *mgr.getCodeDecl(), mgr.getContext(),
+                   *mgr.getLiveVariables());  
   Eng.setTransferFunctions(tf);
   
   // Execute the worklist algorithm.
index c9d1676c2d115255cc0a107eb7d7ed37a65716c4..34118f487201de442a98a60b70ef15d7e1705e72 100644 (file)
@@ -57,7 +57,7 @@ protected:
   
   /// Liveness - live-variables information the ValueDecl* and block-level
   ///  Expr* in the CFG.  Used to prune out dead state.
-  LiveVariables Liveness;
+  LiveVariables& Liveness;
   
   /// DeadSymbols - A scratch set used to record the set of symbols that
   ///  were just marked dead by a call to ValueStateManager::RemoveDeadBindings.
@@ -180,7 +180,7 @@ protected:
   UndefArgsTy MsgExprUndefArgs;
   
 public:
-  GRExprEngine(CFG& cfg, Decl& CD, ASTContext& Ctx);
+  GRExprEngine(CFG& cfg, Decl& CD, ASTContext& Ctx, LiveVariables& L);
   ~GRExprEngine();
   
   void ExecuteWorkList(unsigned Steps = 150000) {
index 9abfe6f79f38a0b1bdcd15c32c7d67888cf516f0..c9ab8097baceae0bf9329d4e54bb1ca4591a4bf5 100644 (file)
@@ -39,11 +39,12 @@ static inline Selector GetNullarySelector(const char* name, ASTContext& Ctx) {
 }
 
 
-GRExprEngine::GRExprEngine(CFG& cfg, Decl& CD, ASTContext& Ctx)
+GRExprEngine::GRExprEngine(CFG& cfg, Decl& CD, ASTContext& Ctx,
+                           LiveVariables& L)
   : CoreEngine(cfg, CD, Ctx, *this), 
     G(CoreEngine.getGraph()),
     Parents(0),
-    Liveness(G.getCFG()),
+    Liveness(L),
     Builder(NULL),
     StateMgr(G.getContext(), G.getAllocator()),
     BasicVals(StateMgr.getBasicValueFactory()),
@@ -51,12 +52,7 @@ GRExprEngine::GRExprEngine(CFG& cfg, Decl& CD, ASTContext& Ctx)
     SymMgr(StateMgr.getSymbolManager()),
     CurrentStmt(NULL),
   NSExceptionII(NULL), NSExceptionInstanceRaiseSelectors(NULL),
-  RaiseSel(GetNullarySelector("raise", G.getContext())) {
-  
-  // Compute liveness information.
-  Liveness.runOnCFG(G.getCFG());
-  Liveness.runOnAllBlocks(G.getCFG(), NULL, true);
-}
+  RaiseSel(GetNullarySelector("raise", G.getContext())) {}
 
 GRExprEngine::~GRExprEngine() {    
   for (BugTypeSet::iterator I = BugTypes.begin(), E = BugTypes.end(); I!=E; ++I)