Add transfer function support for pointer arithmetic where the

increment/decrement operand is on the left side.

llvm-svn: 48144
This commit is contained in:
Ted Kremenek 2008-03-10 15:17:11 +00:00
parent b1de7a35f9
commit afa02ed5fb
1 changed files with 11 additions and 1 deletions

View File

@ -428,7 +428,17 @@ protected:
return TF->EvalBinOp(BasicVals, Op, cast<LVal>(L), cast<NonLVal>(R));
}
return TF->EvalBinOp(BasicVals, Op, cast<NonLVal>(L), cast<NonLVal>(R));
if (isa<LVal>(R)) {
// Support pointer arithmetic where the increment/decrement operand
// is on the left and the pointer on the right.
assert (Op == BinaryOperator::Add || Op == BinaryOperator::Sub);
// Commute the operands.
return TF->EvalBinOp(BasicVals, Op, cast<LVal>(R), cast<NonLVal>(L));
}
else
return TF->EvalBinOp(BasicVals, Op, cast<NonLVal>(L), cast<NonLVal>(R));
}
void EvalCall(NodeSet& Dst, CallExpr* CE, LVal L, NodeTy* Pred) {