]> granicus.if.org Git - clang/commitdiff
Fixed bug in 'LiveVariables' analysis where we incorrectly marked a variable
authorTed Kremenek <kremenek@apple.com>
Fri, 18 Jan 2008 00:40:21 +0000 (00:40 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 18 Jan 2008 00:40:21 +0000 (00:40 +0000)
dead at an assignment without taking into account if the variable was used in
the RHS of the assignment.

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

Analysis/LiveVariables.cpp

index 5bd72b42af4232825d1f6453c8de911c8c7ff900..b96f7fc4bb2152bf2c299be44a4ae6eb98a6951a 100644 (file)
@@ -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
 //