Modified LiveVariables to perform all of its base initialization in the ctor,
and now we require a FunctionDecl* object so that we can also keep track of
all of the ParmDecls.

Modified clients of LiveVariables to conform to the new interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46490 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Analysis/GRConstants.cpp b/Analysis/GRConstants.cpp
index a0a58db..103e6a0 100644
--- a/Analysis/GRConstants.cpp
+++ b/Analysis/GRConstants.cpp
@@ -577,7 +577,7 @@
   
   /// Liveness - live-variables information the ValueDecl* and block-level
   ///  Expr* in the CFG.  Used to prune out dead state.
-  LiveVariables* Liveness;
+  LiveVariables Liveness;
 
   /// Builder - The current GRNodeBuilder which is used when building the nodes
   ///  for a given statement.
@@ -600,17 +600,14 @@
   ASTContext& getContext() const { return G.getContext(); }
   
 public:
-  GRConstants(GraphTy& g) : G(g), Liveness(NULL), Builder(NULL), 
-      ValMgr(G.getContext()), StmtEntryNode(NULL), CurrentStmt(NULL) {
+  GRConstants(GraphTy& g) : G(g), Liveness(G.getCFG(), G.getFunctionDecl()),
+      Builder(NULL), ValMgr(G.getContext()), StmtEntryNode(NULL),
+      CurrentStmt(NULL) {
     
     // Compute liveness information.
-    CFG& c = G.getCFG();
-    Liveness = new LiveVariables(c);
-    Liveness->runOnCFG(c);
-    Liveness->runOnAllBlocks(c, NULL, true);
+    Liveness.runOnCFG(G.getCFG());
+    Liveness.runOnAllBlocks(G.getCFG(), NULL, true);
   }
-    
-  ~GRConstants() { delete Liveness; }
   
   /// getCFG - Returns the CFG associated with this analysis.
   CFG& getCFG() { return G.getCFG(); }
@@ -843,14 +840,14 @@
 
   // Remove old bindings for subexpressions and "dead" block-level expressions.
   for (; I!=E && !I.getKey().isDecl(); ++I) {
-    if (I.getKey().isSubExpr() || !Liveness->isLive(Loc,cast<Stmt>(I.getKey())))
+    if (I.getKey().isSubExpr() || !Liveness.isLive(Loc,cast<Stmt>(I.getKey())))
       M = StateMgr.Remove(M, I.getKey());
   }
 
   // Remove bindings for "dead" decls.
   for (; I!=E && I.getKey().isDecl(); ++I)
     if (VarDecl* V = dyn_cast<VarDecl>(cast<ValueDecl>(I.getKey())))
-      if (!Liveness->isLive(Loc, V))
+      if (!Liveness.isLive(Loc, V))
         M = StateMgr.Remove(M, I.getKey());
 
   return M;