diff options
-rw-r--r-- | Analysis/LiveVariables.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Analysis/LiveVariables.cpp b/Analysis/LiveVariables.cpp index c14b463be1..eb1b56f37a 100644 --- a/Analysis/LiveVariables.cpp +++ b/Analysis/LiveVariables.cpp @@ -155,8 +155,13 @@ void TransferFuncs::VisitAssign(BinaryOperator* B) { void TransferFuncs::VisitDeclStmt(DeclStmt* DS) { // Declarations effectively "kill" a variable since they cannot // possibly be live before they are declared. - for (ScopedDecl* D = DS->getDecl(); D != NULL; D = D->getNextDeclarator()) + for (ScopedDecl* D = DS->getDecl(); D != NULL; D = D->getNextDeclarator()) { LiveState(D,AD) = Dead; + + if (VarDecl* VD = dyn_cast<VarDecl>(D)) + if (Expr* Init = VD->getInit()) + Visit(Init); + } } } // end anonymous namespace |