[cfe-commits] r46732 - /cfe/trunk/Analysis/GRConstants.cpp

Ted Kremenek kremenek at apple.com
Mon Feb 4 16:43:43 PST 2008


Author: kremenek
Date: Mon Feb  4 18:43:43 2008
New Revision: 46732

URL: http://llvm.org/viewvc/llvm-project?rev=46732&view=rev
Log:
Simplified transfer functions 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=46732&r1=46731&r2=46732&view=diff

==============================================================================
--- cfe/trunk/Analysis/GRConstants.cpp (original)
+++ cfe/trunk/Analysis/GRConstants.cpp Mon Feb  4 18:43:43 2008
@@ -549,10 +549,7 @@
       case UnaryOperator::PostInc: {
         const LValue& L1 = GetLValue(St, U->getSubExpr());
         NonLValue R1 = cast<NonLValue>(GetValue(St, L1));
-        NonLValue R2 = NonLValue::GetValue(ValMgr, 1U, U->getType(),
-                                           U->getLocStart());
-        
-        NonLValue Result = R1.Add(ValMgr, R2);
+        NonLValue Result = R1.Add(ValMgr, GetRValueConstant(1U, U));
         Nodify(Dst, U, N1, SetValue(SetValue(St, U, R1), L1, Result));
         break;
       }
@@ -560,10 +557,7 @@
       case UnaryOperator::PostDec: {
         const LValue& L1 = GetLValue(St, U->getSubExpr());
         NonLValue R1 = cast<NonLValue>(GetValue(St, L1));
-        NonLValue R2 = NonLValue::GetValue(ValMgr, 1U, U->getType(),
-                                           U->getLocStart());
-        
-        NonLValue Result = R1.Sub(ValMgr, R2);
+        NonLValue Result = R1.Sub(ValMgr, GetRValueConstant(1U, U));
         Nodify(Dst, U, N1, SetValue(SetValue(St, U, R1), L1, Result));
         break;
       }
@@ -571,10 +565,7 @@
       case UnaryOperator::PreInc: {
         const LValue& L1 = GetLValue(St, U->getSubExpr());
         NonLValue R1 = cast<NonLValue>(GetValue(St, L1));
-        NonLValue R2 = NonLValue::GetValue(ValMgr, 1U, U->getType(),
-                                           U->getLocStart());        
-        
-        NonLValue Result = R1.Add(ValMgr, R2);
+        NonLValue Result = R1.Add(ValMgr, GetRValueConstant(1U, U));
         Nodify(Dst, U, N1, SetValue(SetValue(St, U, Result), L1, Result));
         break;
       }
@@ -582,10 +573,7 @@
       case UnaryOperator::PreDec: {
         const LValue& L1 = GetLValue(St, U->getSubExpr());
         NonLValue R1 = cast<NonLValue>(GetValue(St, L1));
-        NonLValue R2 = NonLValue::GetValue(ValMgr, 1U, U->getType(),
-                                           U->getLocStart());
-        
-        NonLValue Result = R1.Sub(ValMgr, R2);
+        NonLValue Result = R1.Sub(ValMgr, GetRValueConstant(1U, U));
         Nodify(Dst, U, N1, SetValue(SetValue(St, U, Result), L1, Result));
         break;
       }





More information about the cfe-commits mailing list