diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-01-18 00:40:21 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-01-18 00:40:21 +0000 |
commit | 05ecfddfc3f02027172c047f8fbe7e549faa867e (patch) | |
tree | eed2d7c6c746dc98de1934728a0a46b9d28cc214 /clang/Analysis/LiveVariables.cpp | |
parent | b716fbab44ce514c8071d7f6ce1ed7f714b0e105 (diff) | |
download | bcm5719-llvm-05ecfddfc3f02027172c047f8fbe7e549faa867e.tar.gz bcm5719-llvm-05ecfddfc3f02027172c047f8fbe7e549faa867e.zip |
Fixed bug in 'LiveVariables' analysis where we incorrectly marked a variable
dead at an assignment without taking into account if the variable was used in
the RHS of the assignment.
llvm-svn: 46153
Diffstat (limited to 'clang/Analysis/LiveVariables.cpp')
-rw-r--r-- | clang/Analysis/LiveVariables.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/Analysis/LiveVariables.cpp b/clang/Analysis/LiveVariables.cpp index 5bd72b42af4..b96f7fc4bb2 100644 --- a/clang/Analysis/LiveVariables.cpp +++ b/clang/Analysis/LiveVariables.cpp @@ -77,10 +77,9 @@ void TransferFuncs::Visit(Stmt *S) { if (AD.Observer) AD.Observer->ObserveStmt(S,AD,LiveState); - if (S == getCurrentBlkStmt()) { - StmtVisitor<TransferFuncs,void>::Visit(S); if (getCFG().isBlkExpr(S)) LiveState(S,AD) = Dead; + StmtVisitor<TransferFuncs,void>::Visit(S); } else if (!getCFG().isBlkExpr(S)) StmtVisitor<TransferFuncs,void>::Visit(S); @@ -199,6 +198,10 @@ bool LiveVariables::isLive(const Stmt* Loc, const Stmt* StmtVal) const { return getStmtData(Loc)(StmtVal,getAnalysisData()); } +bool LiveVariables::isLive(const Stmt* Loc, const VarDecl* D) const { + return getStmtData(Loc)(D,getAnalysisData()); +} + //===----------------------------------------------------------------------===// // printing liveness state for debugging // |