diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-02-07 02:38:55 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-02-07 02:38:55 +0000 |
commit | 2bca5e4e39b0c0b2377a1a09eb0de5e099ecf9de (patch) | |
tree | 752f79ac31dbe8122309c4d562fa48e6810ec2f7 | |
parent | 5b6dc2d72bf1bcf2b61fe5dbcd57bfa4aee76b29 (diff) |
Fixed bug in LiveVariables analysis where Block-level exprs appearing
as the initializers for DeclStmts were not being registered as being
live at the start of the DeclStmt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46837 91177308-0d34-0410-b5e6-96231b3b80d8
-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 |