[cfe-commits] r46708 - in /cfe/trunk/Analysis: GRConstants.cpp RValues.cpp RValues.h
Ted Kremenek
kremenek at apple.com
Mon Feb 4 08:58:31 PST 2008
Author: kremenek
Date: Mon Feb 4 10:58:30 2008
New Revision: 46708
URL: http://llvm.org/viewvc/llvm-project?rev=46708&view=rev
Log:
Implemented transfer function for unary '~'.
Modified:
cfe/trunk/Analysis/GRConstants.cpp
cfe/trunk/Analysis/RValues.cpp
cfe/trunk/Analysis/RValues.h
Modified: cfe/trunk/Analysis/GRConstants.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRConstants.cpp?rev=46708&r1=46707&r2=46708&view=diff
==============================================================================
--- cfe/trunk/Analysis/GRConstants.cpp (original)
+++ cfe/trunk/Analysis/GRConstants.cpp Mon Feb 4 10:58:30 2008
@@ -561,6 +561,12 @@
break;
}
+ case UnaryOperator::Not: {
+ const NonLValue& R1 = cast<NonLValue>(GetValue(St, U->getSubExpr()));
+ Nodify(Dst, U, N1, SetValue(St, U, R1.BitwiseComplement(ValMgr)));
+ break;
+ }
+
case UnaryOperator::AddrOf: {
const LValue& L1 = GetLValue(St, U->getSubExpr());
Nodify(Dst, U, N1, SetValue(St, U, L1));
Modified: cfe/trunk/Analysis/RValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/RValues.cpp?rev=46708&r1=46707&r2=46708&view=diff
==============================================================================
--- cfe/trunk/Analysis/RValues.cpp (original)
+++ cfe/trunk/Analysis/RValues.cpp Mon Feb 4 10:58:30 2008
@@ -138,6 +138,16 @@
}
}
+NonLValue NonLValue::BitwiseComplement(ValueManager& ValMgr) const {
+ switch (getSubKind()) {
+ case ConcreteIntKind:
+ return cast<ConcreteInt>(this)->BitwiseComplement(ValMgr);
+ default:
+ return cast<NonLValue>(InvalidValue());
+ }
+}
+
+
#define NONLVALUE_DISPATCH_CASE(k1,k2,Op)\
case (k1##Kind*NumNonLValueKind+k2##Kind):\
return cast<k1>(*this).Op(ValMgr,cast<k2>(RHS));
Modified: cfe/trunk/Analysis/RValues.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/RValues.h?rev=46708&r1=46707&r2=46708&view=diff
==============================================================================
--- cfe/trunk/Analysis/RValues.h (original)
+++ cfe/trunk/Analysis/RValues.h Mon Feb 4 10:58:30 2008
@@ -196,6 +196,7 @@
NonLValue Div(ValueManager& ValMgr, const NonLValue& RHS) const;
NonLValue Rem(ValueManager& ValMgr, const NonLValue& RHS) const;
NonLValue UnaryMinus(ValueManager& ValMgr, UnaryOperator* U) const;
+ NonLValue BitwiseComplement(ValueManager& ValMgr) const;
// Equality operators.
NonLValue EQ(ValueManager& ValMgr, const NonLValue& RHS) const;
@@ -295,6 +296,10 @@
return ValMgr.getValue(-getValue());
}
+ ConcreteInt BitwiseComplement(ValueManager& ValMgr) const {
+ return ValMgr.getValue(~getValue());
+ }
+
// Casting.
ConcreteInt Cast(ValueManager& ValMgr, Expr* CastExpr) const {
More information about the cfe-commits
mailing list