[cfe-commits] r46317 - /cfe/trunk/Analysis/GRConstants.cpp
Ted Kremenek
kremenek at apple.com
Thu Jan 24 11:01:01 PST 2008
Author: kremenek
Date: Thu Jan 24 13:00:57 2008
New Revision: 46317
URL: http://llvm.org/viewvc/llvm-project?rev=46317&view=rev
Log:
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).
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=46317&r1=46316&r2=46317&view=diff
==============================================================================
--- cfe/trunk/Analysis/GRConstants.cpp (original)
+++ cfe/trunk/Analysis/GRConstants.cpp Thu Jan 24 13:00:57 2008
@@ -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));
More information about the cfe-commits
mailing list