aboutsummaryrefslogtreecommitdiff
path: root/Analysis/LiveVariables.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-02-25 22:28:54 +0000
committerTed Kremenek <kremenek@apple.com>2008-02-25 22:28:54 +0000
commitdcc48100ef7c224cecf5b9ccdd5c0d39e476468a (patch)
tree059ad90676feeceb78c7fb346b1a4322073402ed /Analysis/LiveVariables.cpp
parent56cd7e3848c2d59ca2ec3b72d0834192edf0bcdf (diff)
Minor bug fix in LiveVariables: don't "kill" decls referenced by a DeclStmt
that aren't VarDecls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47572 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Analysis/LiveVariables.cpp')
-rw-r--r--Analysis/LiveVariables.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Analysis/LiveVariables.cpp b/Analysis/LiveVariables.cpp
index 1201eb021d..52f7f4d19b 100644
--- a/Analysis/LiveVariables.cpp
+++ b/Analysis/LiveVariables.cpp
@@ -156,13 +156,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()) {
- LiveState(D,AD) = Dead;
-
- if (VarDecl* VD = dyn_cast<VarDecl>(D))
+ for (ScopedDecl* D = DS->getDecl(); D != NULL; D = D->getNextDeclarator())
+ if (VarDecl* VD = dyn_cast<VarDecl>(D)) {
+ LiveState(D,AD) = Dead;
+
if (Expr* Init = VD->getInit())
Visit(Init);
- }
+ }
}
} // end anonymous namespace