[cfe-commits] r46288 - /cfe/trunk/Analysis/GRConstants.cpp
Ted Kremenek
kremenek at apple.com
Wed Jan 23 15:38:01 PST 2008
Author: kremenek
Date: Wed Jan 23 17:38:00 2008
New Revision: 46288
URL: http://llvm.org/viewvc/llvm-project?rev=46288&view=rev
Log:
Implemented value tracking support for '+=' and '-='.
Modified:
cfe/trunk/Analysis/GRConstants.cpp
Modified: cfe/trunk/Analysis/GRConstants.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRConstants.cpp?rev=46288&r1=46287&r2=46288&view=diff
==============================================================================
--- cfe/trunk/Analysis/GRConstants.cpp (original)
+++ cfe/trunk/Analysis/GRConstants.cpp Wed Jan 23 17:38:00 2008
@@ -664,7 +664,6 @@
case BinaryOperator::Sub: {
const RValue& R1 = cast<RValue>(V1);
const RValue& R2 = cast<RValue>(V2);
-
Nodify(Dst, B, N2, SetValue(St, B, R1.Sub(ValMgr, R2)));
break;
}
@@ -672,10 +671,25 @@
case BinaryOperator::Assign: {
const LValue& L1 = cast<LValue>(V1);
const RValue& R2 = cast<RValue>(V2);
-
Nodify(Dst, B, N2, SetValue(SetValue(St, B, R2), L1, R2));
break;
}
+
+ case BinaryOperator::AddAssign: {
+ const LValue& L1 = cast<LValue>(V1);
+ RValue R1 = cast<RValue>(GetValue(N1->getState(), L1));
+ RValue Result = R1.Add(ValMgr, cast<RValue>(V2));
+ Nodify(Dst, B, N2, SetValue(SetValue(St, B, Result), L1, Result));
+ break;
+ }
+
+ case BinaryOperator::SubAssign: {
+ const LValue& L1 = cast<LValue>(V1);
+ RValue R1 = cast<RValue>(GetValue(N1->getState(), L1));
+ RValue Result = R1.Sub(ValMgr, cast<RValue>(V2));
+ Nodify(Dst, B, N2, SetValue(SetValue(St, B, Result), L1, Result));
+ break;
+ }
default:
Dst.Add(N2);
@@ -700,6 +714,7 @@
switch (S->getStmtClass()) {
case Stmt::BinaryOperatorClass:
+ case Stmt::CompoundAssignOperatorClass:
VisitBinaryOperator(cast<BinaryOperator>(S), Pred, Dst);
break;
More information about the cfe-commits
mailing list