diff options
| author | Ted Kremenek <kremenek@apple.com> | 2008-01-23 23:38:00 +0000 | 
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2008-01-23 23:38:00 +0000 | 
| commit | 5e02dc1b465a8012a04dff6c1bbe1ec98ea81504 (patch) | |
| tree | fee337d298606ebc6c2d33b7be1de4d62612f4d6 /clang/Analysis/GRConstants.cpp | |
| parent | 2dd606839d3131de510ef56eaaf722f7b3e3b2c3 (diff) | |
| download | bcm5719-llvm-5e02dc1b465a8012a04dff6c1bbe1ec98ea81504.tar.gz bcm5719-llvm-5e02dc1b465a8012a04dff6c1bbe1ec98ea81504.zip | |
Implemented value tracking support for '+=' and '-='.
llvm-svn: 46288
Diffstat (limited to 'clang/Analysis/GRConstants.cpp')
| -rw-r--r-- | clang/Analysis/GRConstants.cpp | 19 | 
1 files changed, 17 insertions, 2 deletions
| diff --git a/clang/Analysis/GRConstants.cpp b/clang/Analysis/GRConstants.cpp index 84a8f048a8a..84cc200d11d 100644 --- a/clang/Analysis/GRConstants.cpp +++ b/clang/Analysis/GRConstants.cpp @@ -664,7 +664,6 @@ void GRConstants::VisitBinaryOperator(BinaryOperator* B,          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 @@ void GRConstants::VisitBinaryOperator(BinaryOperator* B,          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 @@ void GRConstants::Visit(Stmt* S, GRConstants::NodeTy* Pred,    switch (S->getStmtClass()) {      case Stmt::BinaryOperatorClass: +    case Stmt::CompoundAssignOperatorClass:        VisitBinaryOperator(cast<BinaryOperator>(S), Pred, Dst);        break; | 

