summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/LiveVariables.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-15 04:39:08 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-15 04:39:08 +0000
commit8adeebb274a3f281687e813b9163e76528c3a02b (patch)
tree87edf06c1aa15cf51fe79c66da9f01fa1f614d22 /clang/lib/Analysis/LiveVariables.cpp
parent66279073f78bc5546ab7ed9b157a80767a8c741b (diff)
downloadbcm5719-llvm-8adeebb274a3f281687e813b9163e76528c3a02b.tar.gz
bcm5719-llvm-8adeebb274a3f281687e813b9163e76528c3a02b.zip
Added initial support into the flow-sensitive dataflow solver to visit the Block-level expression
in a block's terminator. This expression is visited within a block, but it is accessed by the terminator. This is important to observe because for live-variables analysis the block-level expression is live between the terminator and where the expression occurs in the block. So far this hasn't been an issue to not observe this because the block-level expression used in the terminator is always the last one in the block, and we have never queried the liveness information about this point (but before the terminator). llvm-svn: 49709
Diffstat (limited to 'clang/lib/Analysis/LiveVariables.cpp')
-rw-r--r--clang/lib/Analysis/LiveVariables.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/clang/lib/Analysis/LiveVariables.cpp b/clang/lib/Analysis/LiveVariables.cpp
index b704b2d8267..4cef30cab82 100644
--- a/clang/lib/Analysis/LiveVariables.cpp
+++ b/clang/lib/Analysis/LiveVariables.cpp
@@ -73,7 +73,8 @@ public:
void VisitAssign(BinaryOperator* B);
void VisitDeclStmt(DeclStmt* DS);
void VisitUnaryOperator(UnaryOperator* U);
- void Visit(Stmt *S);
+ void Visit(Stmt *S);
+ void VisitTerminator(Stmt* S);
};
void TransferFuncs::Visit(Stmt *S) {
@@ -90,6 +91,23 @@ void TransferFuncs::Visit(Stmt *S) {
// For block-level expressions, mark that they are live.
LiveState(S,AD) = Alive;
}
+
+void TransferFuncs::VisitTerminator(Stmt* S) {
+ return;
+
+ for (Stmt::child_iterator I = S->child_begin(), E = S->child_end();
+ I != E; ++I) {
+
+ Stmt* Child = *I;
+ if (!Child) continue;
+
+ if (getCFG().isBlkExpr(Child)) {
+ LiveState(Child, AD) = Alive;
+ return; // Only one "condition" expression.
+ }
+ }
+}
+
void TransferFuncs::VisitDeclRefExpr(DeclRefExpr* DR) {
if (VarDecl* V = dyn_cast<VarDecl>(DR->getDecl()))
OpenPOWER on IntegriCloud