aboutsummaryrefslogtreecommitdiff
path: root/Analysis/GRConstants.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-01-29 05:13:23 +0000
committerTed Kremenek <kremenek@apple.com>2008-01-29 05:13:23 +0000
commitbffaa831478baf584e74dfb7917861e865d99640 (patch)
tree928a7ac2c416b6677fed8a618cbc7df16a54c41d /Analysis/GRConstants.cpp
parentb3c2b88de6121800590673d2a6294b1151cc2e02 (diff)
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
Diffstat (limited to 'Analysis/GRConstants.cpp')
-rw-r--r--Analysis/GRConstants.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/Analysis/GRConstants.cpp b/Analysis/GRConstants.cpp
index a0a58db79a..103e6a0d74 100644
--- a/Analysis/GRConstants.cpp
+++ b/Analysis/GRConstants.cpp
@@ -577,7 +577,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;
/// Builder - The current GRNodeBuilder which is used when building the nodes
/// for a given statement.
@@ -600,17 +600,14 @@ protected:
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 @@ GRConstants::StateTy GRConstants::RemoveDeadBindings(Stmt* Loc, StateTy M) {
// 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;