diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-03-15 03:27:30 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-03-15 03:27:30 +0000 |
commit | 02e24b69760256e17d6f944246b72fda5cd1b133 (patch) | |
tree | b2a03c346c9d51db6ea6a55260b6af7d05150953 /clang | |
parent | 88ba750f7448f39e54d66c0bee6c05dc47b1d667 (diff) | |
download | bcm5719-llvm-02e24b69760256e17d6f944246b72fda5cd1b133.tar.gz bcm5719-llvm-02e24b69760256e17d6f944246b72fda5cd1b133.zip |
Handle StmtExprs whose last contained statement is not an expression.
llvm-svn: 48388
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 |