aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-02-05 00:43:43 +0000
committerTed Kremenek <kremenek@apple.com>2008-02-05 00:43:43 +0000
commit0ff9a4d9bf0fa98e8074da6d4b468a92bf832bed (patch)
tree6ad29e6eeb2bbd1b7da540a1884848d6669e0e63
parentf233d48cfc513b045e2c2cfca5c175220fbd0a82 (diff)
Simplified transfer functions for '++' and '--'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46732 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Analysis/GRConstants.cpp20
1 files changed, 4 insertions, 16 deletions
diff --git a/Analysis/GRConstants.cpp b/Analysis/GRConstants.cpp
index 78d7b39cd9..4c678914ef 100644
--- a/Analysis/GRConstants.cpp
+++ b/Analysis/GRConstants.cpp
@@ -549,10 +549,7 @@ void GRConstants::VisitUnaryOperator(UnaryOperator* U,
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 @@ void GRConstants::VisitUnaryOperator(UnaryOperator* U,
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 @@ void GRConstants::VisitUnaryOperator(UnaryOperator* U,
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 @@ void GRConstants::VisitUnaryOperator(UnaryOperator* U,
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;
}