diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/Analysis/GRExprEngine.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/clang/Analysis/GRExprEngine.cpp b/clang/Analysis/GRExprEngine.cpp index fd8d0f5c1d6..f1108df4051 100644 --- a/clang/Analysis/GRExprEngine.cpp +++ b/clang/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 |