summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/LiveVariables.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-07-03 22:25:27 +0000
committerTed Kremenek <kremenek@apple.com>2008-07-03 22:25:27 +0000
commit8044046efb8cb48c2de154e3781bf7de99d9ea38 (patch)
tree921c591077c4aef4d2f2d934d29725000237ac0c /clang/lib/Analysis/LiveVariables.cpp
parent9c75ea62d7721b83569e75406b0a80af473a6708 (diff)
downloadbcm5719-llvm-8044046efb8cb48c2de154e3781bf7de99d9ea38.tar.gz
bcm5719-llvm-8044046efb8cb48c2de154e3781bf7de99d9ea38.zip
Fix a bug in the dead stores checker reported in the following email:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-July/002157.html Essentially the observer mechanism in LiveVariables was observing block-level expressions multiple times, leading to a case where the dead store checker could see a value as dead when it was really live. llvm-svn: 53115
Diffstat (limited to 'clang/lib/Analysis/LiveVariables.cpp')
-rw-r--r--clang/lib/Analysis/LiveVariables.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/clang/lib/Analysis/LiveVariables.cpp b/clang/lib/Analysis/LiveVariables.cpp
index 54e2195a777..8f391dc5618 100644
--- a/clang/lib/Analysis/LiveVariables.cpp
+++ b/clang/lib/Analysis/LiveVariables.cpp
@@ -133,15 +133,23 @@ public:
};
void TransferFuncs::Visit(Stmt *S) {
- if (AD.Observer)
- AD.Observer->ObserveStmt(S,AD,LiveState);
if (S == getCurrentBlkStmt()) {
+
+ if (AD.Observer)
+ AD.Observer->ObserveStmt(S,AD,LiveState);
+
if (getCFG().isBlkExpr(S)) LiveState(S,AD) = Dead;
StmtVisitor<TransferFuncs,void>::Visit(S);
}
- else if (!getCFG().isBlkExpr(S))
+ else if (!getCFG().isBlkExpr(S)) {
+
+ if (AD.Observer)
+ AD.Observer->ObserveStmt(S,AD,LiveState);
+
StmtVisitor<TransferFuncs,void>::Visit(S);
+
+ }
else
// For block-level expressions, mark that they are live.
LiveState(S,AD) = Alive;
OpenPOWER on IntegriCloud