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 | 61176897bac13ed98d566b1cc0f8d0451ec3926b (patch) | |
| tree | 8980644b0cae7352c6161401ae238b368a56d42d /clang/lib/Checker/RegionStore.cpp | |
| parent | fb6f22f010904322f580a7513f6a80e88338ecb4 (diff) | |
| download | bcm5719-llvm-61176897bac13ed98d566b1cc0f8d0451ec3926b.tar.gz bcm5719-llvm-61176897bac13ed98d566b1cc0f8d0451ec3926b.zip | |
Pointer comparisons (and pointer-pointer subtraction). Basically filling in SimpleSValuator::EvalBinOpLL().
llvm-svn: 106992
Diffstat (limited to 'clang/lib/Checker/RegionStore.cpp')
| -rw-r--r-- | clang/lib/Checker/RegionStore.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Checker/RegionStore.cpp b/clang/lib/Checker/RegionStore.cpp index 6b5e5e33f2d..336d3925adc 100644 --- a/clang/lib/Checker/RegionStore.cpp +++ b/clang/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; |

