aboutsummaryrefslogtreecommitdiff
path: root/lib/Checker
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2010-08-03 06:34:25 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2010-08-03 06:34:25 +0000
commite3273e78da4716f9c999ae207f6898f376a6e1a4 (patch)
tree4a58854175e9a4f13f72ed567caa96ce3f8f0fa5 /lib/Checker
parente888233f6b115d3b0dd73bcb5f35e93794408542 (diff)
Allow offsets to be negative. Out-of-bound cases are checked elsewhere. We
shouldn't put restrictions in store manager. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110106 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker')
-rw-r--r--lib/Checker/FlatStore.cpp8
-rw-r--r--lib/Checker/MemRegion.cpp3
2 files changed, 5 insertions, 6 deletions
diff --git a/lib/Checker/FlatStore.cpp b/lib/Checker/FlatStore.cpp
index e1683e5009..9e7aa753ee 100644
--- a/lib/Checker/FlatStore.cpp
+++ b/lib/Checker/FlatStore.cpp
@@ -78,7 +78,7 @@ private:
public:
const MemRegion *R;
Interval I;
- RegionInterval(const MemRegion *r, uint64_t s, uint64_t e) : R(r), I(s, e){}
+ RegionInterval(const MemRegion *r, int64_t s, int64_t e) : R(r), I(s, e){}
};
RegionInterval RegionToInterval(const MemRegion *R);
@@ -186,7 +186,7 @@ FlatStoreManager::RegionToInterval(const MemRegion *R) {
switch (R->getKind()) {
case MemRegion::VarRegionKind: {
QualType T = cast<VarRegion>(R)->getValueType(Ctx);
- uint64_t Size = Ctx.getTypeSize(T);
+ int64_t Size = Ctx.getTypeSize(T);
return RegionInterval(R, 0, Size-1);
}
@@ -197,8 +197,8 @@ FlatStoreManager::RegionToInterval(const MemRegion *R) {
// with symbolic offsets.
if (!Offset.getRegion())
return RegionInterval(0, 0, 0);
- uint64_t Start = Offset.getOffset();
- uint64_t Size = Ctx.getTypeSize(cast<TypedRegion>(R)->getValueType(Ctx));
+ int64_t Start = Offset.getOffset();
+ int64_t Size = Ctx.getTypeSize(cast<TypedRegion>(R)->getValueType(Ctx));
return RegionInterval(Offset.getRegion(), Start, Start+Size);
}
diff --git a/lib/Checker/MemRegion.cpp b/lib/Checker/MemRegion.cpp
index 87eed2a287..58006708fa 100644
--- a/lib/Checker/MemRegion.cpp
+++ b/lib/Checker/MemRegion.cpp
@@ -830,7 +830,7 @@ RegionRawOffset ElementRegion::getAsArrayOffset() const {
RegionOffset MemRegion::getAsOffset() const {
const MemRegion *R = this;
- uint64_t Offset = 0;
+ int64_t Offset = 0;
while (1) {
switch (R->getKind()) {
@@ -854,7 +854,6 @@ RegionOffset MemRegion::getAsOffset() const {
SVal Index = ER->getIndex();
if (const nonloc::ConcreteInt *CI=dyn_cast<nonloc::ConcreteInt>(&Index)) {
int64_t i = CI->getValue().getSExtValue();
- assert(i >= 0);
CharUnits Size = getContext().getTypeSizeInChars(EleTy);
Offset += i * Size.getQuantity() * 8;
} else {