aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-03-15 03:27:30 +0000
committerTed Kremenek <kremenek@apple.com>2008-03-15 03:27:30 +0000
commit3b4a8ef9e5c97fbd4d1164b8b542cc8888c8b348 (patch)
treefa0031140194823f1391ea89119a2bfcd4f7c966
parent897781ac172d42817d225dc53b0ad31fdc34064e (diff)
Handle StmtExprs whose last contained statement is not an expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48388 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Analysis/GRExprEngine.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/Analysis/GRExprEngine.cpp b/Analysis/GRExprEngine.cpp
index fd8d0f5c1d..f1108df405 100644
--- a/Analysis/GRExprEngine.cpp
+++ b/Analysis/GRExprEngine.cpp
@@ -1421,9 +1421,17 @@ void GRExprEngine::Visit(Stmt* S, NodeTy* Pred, NodeSet& Dst) {
StmtExpr* SE = cast<StmtExpr>(S);
ValueState* St = GetState(Pred);
- Expr* LastExpr = cast<Expr>(*SE->getSubStmt()->body_rbegin());
- Nodify(Dst, SE, Pred, SetRVal(St, SE, GetRVal(St, LastExpr)));
- break;
+
+ // FIXME: Not certain if we can have empty StmtExprs. If so, we should
+ // probably just remove these from the CFG.
+ assert (!SE->getSubStmt()->body_empty());
+
+ if (Expr* LastExpr = dyn_cast<Expr>(*SE->getSubStmt()->body_rbegin()))
+ Nodify(Dst, SE, Pred, SetRVal(St, SE, GetRVal(St, LastExpr)));
+ else
+ Dst.Add(Pred);
+
+ break;
}
// FIXME: We may wish to always bind state to ReturnStmts so