[cfe-commits] r48144 - /cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h
Ted Kremenek
kremenek at apple.com
Mon Mar 10 08:17:12 PDT 2008
Author: kremenek
Date: Mon Mar 10 10:17:11 2008
New Revision: 48144
URL: http://llvm.org/viewvc/llvm-project?rev=48144&view=rev
Log:
Add transfer function support for pointer arithmetic where the
increment/decrement operand is on the left side.
Modified:
cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h
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=48144&r1=48143&r2=48144&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h Mon Mar 10 10:17:11 2008
@@ -428,7 +428,17 @@
return TF->EvalBinOp(BasicVals, Op, cast<LVal>(L), cast<NonLVal>(R));
}
- return TF->EvalBinOp(BasicVals, Op, cast<NonLVal>(L), cast<NonLVal>(R));
+ if (isa<LVal>(R)) {
+ // Support pointer arithmetic where the increment/decrement operand
+ // is on the left and the pointer on the right.
+
+ assert (Op == BinaryOperator::Add || Op == BinaryOperator::Sub);
+
+ // Commute the operands.
+ return TF->EvalBinOp(BasicVals, Op, cast<LVal>(R), cast<NonLVal>(L));
+ }
+ else
+ return TF->EvalBinOp(BasicVals, Op, cast<NonLVal>(L), cast<NonLVal>(R));
}
void EvalCall(NodeSet& Dst, CallExpr* CE, LVal L, NodeTy* Pred) {
More information about the cfe-commits
mailing list