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
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