Make StoreManager::getSizeInElements() always return DefinedOrUnknownSVal.

llvm-svn: 86932
This commit is contained in:
Zhongxing Xu 2009-11-12 02:48:32 +00:00
parent 495922cb6a
commit 383c273966
4 changed files with 10 additions and 10 deletions

View File

@ -102,7 +102,8 @@ public:
virtual SVal getLValueElement(QualType elementType, SVal offset, SVal Base)=0; virtual SVal getLValueElement(QualType elementType, SVal offset, SVal Base)=0;
// FIXME: Make out-of-line. // FIXME: Make out-of-line.
virtual SVal getSizeInElements(const GRState *state, const MemRegion *region){ virtual DefinedOrUnknownSVal getSizeInElements(const GRState *state,
const MemRegion *region) {
return UnknownVal(); return UnknownVal();
} }

View File

@ -56,9 +56,8 @@ void ArrayBoundChecker::VisitLocation(CheckerContext &C, const Stmt *S, SVal l){
const GRState *state = C.getState(); const GRState *state = C.getState();
// Get the size of the array. // Get the size of the array.
SVal NumVal = C.getStoreManager().getSizeInElements(state, DefinedOrUnknownSVal NumElements
ER->getSuperRegion()); = C.getStoreManager().getSizeInElements(state, ER->getSuperRegion());
DefinedOrUnknownSVal &NumElements = cast<DefinedOrUnknownSVal>(NumVal);
const GRState *StInBound = state->AssumeInBound(Idx, NumElements, true); const GRState *StInBound = state->AssumeInBound(Idx, NumElements, true);
const GRState *StOutBound = state->AssumeInBound(Idx, NumElements, false); const GRState *StOutBound = state->AssumeInBound(Idx, NumElements, false);

View File

@ -360,7 +360,8 @@ public:
//===------------------------------------------------------------------===// //===------------------------------------------------------------------===//
const GRState *setExtent(const GRState *state, const MemRegion* R, SVal Extent); const GRState *setExtent(const GRState *state, const MemRegion* R, SVal Extent);
SVal getSizeInElements(const GRState *state, const MemRegion* R); DefinedOrUnknownSVal getSizeInElements(const GRState *state,
const MemRegion* R);
//===------------------------------------------------------------------===// //===------------------------------------------------------------------===//
// Utility methods. // Utility methods.
@ -696,8 +697,8 @@ SVal RegionStoreManager::getLValueElement(QualType elementType, SVal Offset,
// Extents for regions. // Extents for regions.
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
SVal RegionStoreManager::getSizeInElements(const GRState *state, DefinedOrUnknownSVal RegionStoreManager::getSizeInElements(const GRState *state,
const MemRegion *R) { const MemRegion *R) {
switch (R->getKind()) { switch (R->getKind()) {
case MemRegion::MemSpaceRegionKind: case MemRegion::MemSpaceRegionKind:

View File

@ -64,9 +64,8 @@ void ReturnPointerRangeChecker::PreVisitReturnStmt(CheckerContext &C,
// FIXME: All of this out-of-bounds checking should eventually be refactored // FIXME: All of this out-of-bounds checking should eventually be refactored
// into a common place. // into a common place.
SVal NumVal = C.getStoreManager().getSizeInElements(state, DefinedOrUnknownSVal NumElements
ER->getSuperRegion()); = C.getStoreManager().getSizeInElements(state, ER->getSuperRegion());
DefinedOrUnknownSVal &NumElements = cast<DefinedOrUnknownSVal>(NumVal);
const GRState *StInBound = state->AssumeInBound(Idx, NumElements, true); const GRState *StInBound = state->AssumeInBound(Idx, NumElements, true);
const GRState *StOutBound = state->AssumeInBound(Idx, NumElements, false); const GRState *StOutBound = state->AssumeInBound(Idx, NumElements, false);