Nodify(Dst, S, Pred,
SetValue(Pred->getState(), S,
- NonLValue::GetValue(ValMgr, size, getContext().IntTy, L)));
+ NonLValue::GetValue(ValMgr, size, S->getType(), L)));
}
Nodify(Dst, U, N1,
SetValue(St, U, NonLValue::GetValue(ValMgr, size,
- getContext().IntTy, L)));
+ U->getType(), L)));
break;
}
Result = EvalBinaryOp(ValMgr, Op, L1, L2);
}
else {
+ QualType T1 = B->getLHS()->getType();
+ QualType T2 = B->getRHS()->getType();
+
// An operation between two variables of a non-lvalue type.
Result =
EvalBinaryOp(ValMgr, Op,
- cast<NonLValue>(GetValue(N1->getState(), L1)),
- cast<NonLValue>(GetValue(N2->getState(), L2)));
+ cast<NonLValue>(GetValue(N1->getState(), L1, &T1)),
+ cast<NonLValue>(GetValue(N2->getState(), L2, &T2)));
}
}
else { // Any other operation between two Non-LValues.
- const NonLValue& R1 = cast<NonLValue>(GetValue(N1->getState(), L1));
+ QualType T = B->getLHS()->getType();
+ const NonLValue& R1 = cast<NonLValue>(GetValue(N1->getState(),
+ L1, &T));
const NonLValue& R2 = cast<NonLValue>(V2);
Result = EvalBinaryOp(ValMgr, Op, R1, R2);
}
}
+// Binary Operators (except assignments and comma).
+
+RValue GRSimpleVals::EvalBinaryOp(ValueManager& ValMgr,
+ BinaryOperator::Opcode Op,
+ LValue LHS, LValue RHS) {
+
+ switch (Op) {
+ default:
+ return UnknownVal();
+
+ case BinaryOperator::EQ:
+ return EvalEQ(ValMgr, LHS, RHS);
+
+ case BinaryOperator::NE:
+ return EvalNE(ValMgr, LHS, RHS);
+ }
+}
+
// Pointer arithmetic.
LValue GRSimpleVals::EvalBinaryOp(ValueManager& ValMgr,
BinaryOperator::Opcode Op,
NonLValue LHS, NonLValue RHS);
+ virtual RValue EvalBinaryOp(ValueManager& ValMgr,
+ BinaryOperator::Opcode Op,
+ LValue LHS, LValue RHS);
+
// Pointer arithmetic.
virtual LValue EvalBinaryOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
LValue LHS, NonLValue RHS);
+protected:
// Equality operators for LValues.
- virtual NonLValue EvalEQ(ValueManager& ValMgr, LValue LHS, LValue RHS);
- virtual NonLValue EvalNE(ValueManager& ValMgr, LValue LHS, LValue RHS);
+ NonLValue EvalEQ(ValueManager& ValMgr, LValue LHS, LValue RHS);
+ NonLValue EvalNE(ValueManager& ValMgr, LValue LHS, LValue RHS);
};
return X;
}
-
-// Binary Operators (except assignments and comma).
-
-RValue GRTransferFuncs::EvalBinaryOp(ValueManager& ValMgr,
- BinaryOperator::Opcode Op,
- LValue LHS, LValue RHS) {
-
- switch (Op) {
- default:
- assert (false && "Not yet implemented.");
-
- case BinaryOperator::EQ:
- return EvalEQ(ValMgr, LHS, RHS);
-
- case BinaryOperator::NE:
- return EvalNE(ValMgr, LHS, RHS);
- }
-}
\ No newline at end of file
BinaryOperator::Opcode Op,
NonLValue LHS, NonLValue RHS) = 0;
- RValue EvalBinaryOp(ValueManager& ValMgr,
- BinaryOperator::Opcode Op,
- LValue LHS, LValue RHS);
+ virtual RValue EvalBinaryOp(ValueManager& ValMgr,
+ BinaryOperator::Opcode Op,
+ LValue LHS, LValue RHS) = 0;
// Pointer arithmetic.
else
return EvalBinaryOp(ValMgr, Op, cast<NonLValue>(L), cast<NonLValue>(R));
}
-
-
- // Equality operators for LValues.
- virtual NonLValue EvalEQ(ValueManager& ValMgr, LValue LHS, LValue RHS) = 0;
- virtual NonLValue EvalNE(ValueManager& ValMgr, LValue LHS, LValue RHS) = 0;
};
} // end clang namespace