diff --git a/clang/Analysis/GRConstants.cpp b/clang/Analysis/GRConstants.cpp index 8bf7a2ff3d92..66a320b16d3d 100644 --- a/clang/Analysis/GRConstants.cpp +++ b/clang/Analysis/GRConstants.cpp @@ -917,8 +917,10 @@ void GRConstants::VisitBinaryOperator(BinaryOperator* B, const LValue& L1 = cast(V1); RValue Result = cast(UnknownVal()); - Op = (BinaryOperator::Opcode) - (((unsigned) Op) - ((unsigned) BinaryOperator::MulAssign)); + if (Op >= BinaryOperator::AndAssign) + ((int&) Op) -= (BinaryOperator::AndAssign - BinaryOperator::And); + else + ((int&) Op) -= BinaryOperator::MulAssign; if (isa(V2)) { // FIXME: Add support for Non-LValues on RHS. @@ -959,6 +961,12 @@ void GRConstants::Visit(Stmt* S, GRConstants::NodeTy* Pred, VisitLogicalExpr(cast(S), Pred, Dst); break; } + else if (cast(S)->getOpcode() == BinaryOperator::Comma) { + StateTy St = Pred->getState(); + Stmt* LastStmt = cast(S)->getRHS(); + Nodify(Dst, S, Pred, SetValue(St, S, GetValue(St, LastStmt))); + break; + } // Fall-through. @@ -966,6 +974,13 @@ void GRConstants::Visit(Stmt* S, GRConstants::NodeTy* Pred, VisitBinaryOperator(cast(S), Pred, Dst); break; + case Stmt::StmtExprClass: { + StateTy St = Pred->getState(); + Stmt* LastStmt = *(cast(S)->getSubStmt()->body_rbegin()); + Nodify(Dst, S, Pred, SetValue(St, S, GetValue(St, LastStmt))); + break; + } + case Stmt::UnaryOperatorClass: VisitUnaryOperator(cast(S), Pred, Dst); break;