[cfe-commits] r47147 - in /cfe/trunk: Analysis/GRExprEngine.cpp Analysis/GRSimpleVals.cpp Analysis/GRSimpleVals.h include/clang/Analysis/PathSensitive/GRExprEngine.h include/clang/Analysis/PathSensitive/GRTransferFuncs.h
Ted Kremenek
kremenek at apple.com
Thu Feb 14 16:52:26 PST 2008
Author: kremenek
Date: Thu Feb 14 18:52:26 2008
New Revision: 47147
URL: http://llvm.org/viewvc/llvm-project?rev=47147&view=rev
Log:
Added boilerplate transfer function support for pointer arithmetic operations.
Modified:
cfe/trunk/Analysis/GRExprEngine.cpp
cfe/trunk/Analysis/GRSimpleVals.cpp
cfe/trunk/Analysis/GRSimpleVals.h
cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h
cfe/trunk/include/clang/Analysis/PathSensitive/GRTransferFuncs.h
Modified: cfe/trunk/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRExprEngine.cpp?rev=47147&r1=47146&r2=47147&view=diff
==============================================================================
--- cfe/trunk/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/Analysis/GRExprEngine.cpp Thu Feb 14 18:52:26 2008
@@ -706,9 +706,17 @@
if (isa<LValue>(V1)) {
// FIXME: Add support for RHS being a non-lvalue.
const LValue& L1 = cast<LValue>(V1);
- const LValue& L2 = cast<LValue>(V2);
- Nodify(Dst, B, N2, SetValue(St, B, EvalBinaryOp(ValMgr, Op, L1, L2)));
+ if (isa<LValue>(V2)) {
+ const LValue& L2 = cast<LValue>(V2);
+ Nodify(Dst, B, N2, SetValue(St, B,
+ EvalBinaryOp(ValMgr, Op, L1, L2)));
+ }
+ else {
+ const NonLValue& R2 = cast<NonLValue>(V2);
+ Nodify(Dst, B, N2, SetValue(St, B,
+ EvalBinaryOp(ValMgr, Op, L1, R2)));
+ }
}
else {
const NonLValue& R1 = cast<NonLValue>(V1);
Modified: cfe/trunk/Analysis/GRSimpleVals.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRSimpleVals.cpp?rev=47147&r1=47146&r2=47147&view=diff
==============================================================================
--- cfe/trunk/Analysis/GRSimpleVals.cpp (original)
+++ cfe/trunk/Analysis/GRSimpleVals.cpp Thu Feb 14 18:52:26 2008
@@ -162,6 +162,15 @@
}
}
+
+// Pointer arithmetic.
+
+LValue GRSimpleVals::EvalBinaryOp(ValueManager& ValMgr,
+ BinaryOperator::Opcode Op,
+ LValue LHS, NonLValue RHS) {
+ return cast<LValue>(UnknownVal());
+}
+
// Equality operators for LValues.
Modified: cfe/trunk/Analysis/GRSimpleVals.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRSimpleVals.h?rev=47147&r1=47146&r2=47147&view=diff
==============================================================================
--- cfe/trunk/Analysis/GRSimpleVals.h (original)
+++ cfe/trunk/Analysis/GRSimpleVals.h Thu Feb 14 18:52:26 2008
@@ -44,6 +44,11 @@
BinaryOperator::Opcode Op,
NonLValue LHS, NonLValue RHS);
+ // Pointer arithmetic.
+
+ virtual LValue EvalBinaryOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
+ LValue LHS, NonLValue RHS);
+
// Equality operators for LValues.
virtual NonLValue EvalEQ(ValueManager& ValMgr, LValue LHS, LValue RHS);
virtual NonLValue EvalNE(ValueManager& ValMgr, LValue LHS, LValue RHS);
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h?rev=47147&r1=47146&r2=47147&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h Thu Feb 14 18:52:26 2008
@@ -330,5 +330,10 @@
LValue LHS, LValue RHS) {
return TF->EvalBinaryOp(ValMgr, Op, LHS, RHS);
}
+
+ inline RValue EvalBinaryOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
+ LValue LHS, NonLValue RHS) {
+ return TF->EvalBinaryOp(ValMgr, Op, LHS, RHS);
+ }
};
} // end clang namespace
\ No newline at end of file
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/GRTransferFuncs.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/GRTransferFuncs.h?rev=47147&r1=47146&r2=47147&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GRTransferFuncs.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GRTransferFuncs.h Thu Feb 14 18:52:26 2008
@@ -47,6 +47,12 @@
BinaryOperator::Opcode Op,
LValue LHS, LValue RHS);
+
+ // Pointer arithmetic.
+
+ virtual LValue EvalBinaryOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
+ LValue LHS, NonLValue RHS) = 0;
+
// Equality operators for LValues.
virtual NonLValue EvalEQ(ValueManager& ValMgr, LValue LHS, LValue RHS) = 0;
virtual NonLValue EvalNE(ValueManager& ValMgr, LValue LHS, LValue RHS) = 0;
More information about the cfe-commits
mailing list