diff options
author | Jordy Rose <jediknil@belkadan.com> | 2010-06-28 08:26:15 +0000 |
---|---|---|
committer | Jordy Rose <jediknil@belkadan.com> | 2010-06-28 08:26:15 +0000 |
commit | eac4a00e1d93aa963903031ed76425c231f0f0b9 (patch) | |
tree | 03da5c154b85c5eacb817824daeb7192980ab102 /lib/Checker/RegionStore.cpp | |
parent | 2389324eb73a1c99d5dfc1dc9eed047ddc96a7b4 (diff) |
Pointer comparisons (and pointer-pointer subtraction). Basically filling in SimpleSValuator::EvalBinOpLL().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106992 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker/RegionStore.cpp')
-rw-r--r-- | lib/Checker/RegionStore.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Checker/RegionStore.cpp b/lib/Checker/RegionStore.cpp index 6b5e5e33f2..336d3925ad 100644 --- a/lib/Checker/RegionStore.cpp +++ b/lib/Checker/RegionStore.cpp @@ -867,6 +867,19 @@ SVal RegionStoreManager::EvalBinOp(BinaryOperator::Opcode Op, Loc L, NonLoc R, if (!isa<loc::MemRegionVal>(L)) return UnknownVal(); + // Special case for zero RHS. + if (R.isZeroConstant()) { + switch (Op) { + default: + // Handle it normally. + break; + case BinaryOperator::Add: + case BinaryOperator::Sub: + // FIXME: does this need to be casted to match resultTy? + return L; + } + } + const MemRegion* MR = cast<loc::MemRegionVal>(L).getRegion(); const ElementRegion *ER = 0; |