Implemented transfer functions for Statement-Expressions and Commas.

Fixed bug in dispatching to the correct transfer function for |=, &=, and ^|.

llvm-svn: 46880
This commit is contained in:
Ted Kremenek 2008-02-08 07:05:39 +00:00
parent 2dc30a5ac8
commit 707b07ccf9
1 changed files with 17 additions and 2 deletions

View File

@ -917,8 +917,10 @@ void GRConstants::VisitBinaryOperator(BinaryOperator* B,
const LValue& L1 = cast<LValue>(V1);
RValue Result = cast<NonLValue>(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<LValue>(V2)) {
// FIXME: Add support for Non-LValues on RHS.
@ -959,6 +961,12 @@ void GRConstants::Visit(Stmt* S, GRConstants::NodeTy* Pred,
VisitLogicalExpr(cast<BinaryOperator>(S), Pred, Dst);
break;
}
else if (cast<BinaryOperator>(S)->getOpcode() == BinaryOperator::Comma) {
StateTy St = Pred->getState();
Stmt* LastStmt = cast<BinaryOperator>(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<BinaryOperator>(S), Pred, Dst);
break;
case Stmt::StmtExprClass: {
StateTy St = Pred->getState();
Stmt* LastStmt = *(cast<StmtExpr>(S)->getSubStmt()->body_rbegin());
Nodify(Dst, S, Pred, SetValue(St, S, GetValue(St, LastStmt)));
break;
}
case Stmt::UnaryOperatorClass:
VisitUnaryOperator(cast<UnaryOperator>(S), Pred, Dst);
break;