[cfe-commits] r46837 - /cfe/trunk/Analysis/LiveVariables.cpp
Ted Kremenek
kremenek at apple.com
Wed Feb 6 18:38:55 PST 2008
Author: kremenek
Date: Wed Feb 6 20:38:55 2008
New Revision: 46837
URL: http://llvm.org/viewvc/llvm-project?rev=46837&view=rev
Log:
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.
Modified:
cfe/trunk/Analysis/LiveVariables.cpp
Modified: cfe/trunk/Analysis/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/LiveVariables.cpp?rev=46837&r1=46836&r2=46837&view=diff
==============================================================================
--- cfe/trunk/Analysis/LiveVariables.cpp (original)
+++ cfe/trunk/Analysis/LiveVariables.cpp Wed Feb 6 20:38:55 2008
@@ -155,8 +155,13 @@
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
More information about the cfe-commits
mailing list