Minor tweaks in the transfer functions for pre- and post- ++/-- where
we falsely constructed an APInt to represent the constant '1' instead of
using an APSInt (which has a sign).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46317 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Analysis/GRConstants.cpp b/Analysis/GRConstants.cpp
index 2d1ba56..35758c6 100644
--- a/Analysis/GRConstants.cpp
+++ b/Analysis/GRConstants.cpp
@@ -829,9 +829,10 @@
         RValue R1 = cast<RValue>(GetValue(St, L1));
 
         QualType T = U->getType();
-        llvm::APInt One(getContext()->getTypeSize(T,U->getLocStart()), 1);
-        RValue R2 = RValue::GetRValue(ValMgr, One);        
-
+        unsigned bits = getContext()->getTypeSize(T, U->getLocStart());
+        llvm::APSInt One(llvm::APInt(bits, 1), T->isUnsignedIntegerType());
+        RValue R2 = RValue::GetRValue(ValMgr, One);
+        
         RValue Result = R1.EvalAdd(ValMgr, R2);
         Nodify(Dst, U, N1, SetValue(SetValue(St, U, R1), L1, Result));
         break;
@@ -842,8 +843,9 @@
         RValue R1 = cast<RValue>(GetValue(St, L1));
         
         QualType T = U->getType();
-        llvm::APInt One(getContext()->getTypeSize(T,U->getLocStart()), 1);
-        RValue R2 = RValue::GetRValue(ValMgr, One);        
+        unsigned bits = getContext()->getTypeSize(T, U->getLocStart());
+        llvm::APSInt One(llvm::APInt(bits, 1), T->isUnsignedIntegerType());
+        RValue R2 = RValue::GetRValue(ValMgr, One);
         
         RValue Result = R1.EvalSub(ValMgr, R2);
         Nodify(Dst, U, N1, SetValue(SetValue(St, U, R1), L1, Result));
@@ -855,7 +857,8 @@
         RValue R1 = cast<RValue>(GetValue(St, L1));
         
         QualType T = U->getType();
-        llvm::APInt One(getContext()->getTypeSize(T,U->getLocStart()), 1);
+        unsigned bits = getContext()->getTypeSize(T, U->getLocStart());
+        llvm::APSInt One(llvm::APInt(bits, 1), T->isUnsignedIntegerType());
         RValue R2 = RValue::GetRValue(ValMgr, One);        
         
         RValue Result = R1.EvalAdd(ValMgr, R2);
@@ -868,8 +871,9 @@
         RValue R1 = cast<RValue>(GetValue(St, L1));
         
         QualType T = U->getType();
-        llvm::APInt One(getContext()->getTypeSize(T,U->getLocStart()), 1);
-        RValue R2 = RValue::GetRValue(ValMgr, One);        
+        unsigned bits = getContext()->getTypeSize(T, U->getLocStart());
+        llvm::APSInt One(llvm::APInt(bits, 1), T->isUnsignedIntegerType());
+        RValue R2 = RValue::GetRValue(ValMgr, One);       
         
         RValue Result = R1.EvalSub(ValMgr, R2);
         Nodify(Dst, U, N1, SetValue(SetValue(St, U, Result), L1, Result));