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;
// 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();
}

View File

@ -56,9 +56,8 @@ void ArrayBoundChecker::VisitLocation(CheckerContext &C, const Stmt *S, SVal l){
const GRState *state = C.getState();
// Get the size of the array.
SVal NumVal = C.getStoreManager().getSizeInElements(state,
ER->getSuperRegion());
DefinedOrUnknownSVal &NumElements = cast<DefinedOrUnknownSVal>(NumVal);
DefinedOrUnknownSVal NumElements
= C.getStoreManager().getSizeInElements(state, ER->getSuperRegion());
const GRState *StInBound = state->AssumeInBound(Idx, NumElements, true);
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);
SVal getSizeInElements(const GRState *state, const MemRegion* R);
DefinedOrUnknownSVal getSizeInElements(const GRState *state,
const MemRegion* R);
//===------------------------------------------------------------------===//
// Utility methods.
@ -696,8 +697,8 @@ SVal RegionStoreManager::getLValueElement(QualType elementType, SVal Offset,
// Extents for regions.
//===----------------------------------------------------------------------===//
SVal RegionStoreManager::getSizeInElements(const GRState *state,
const MemRegion *R) {
DefinedOrUnknownSVal RegionStoreManager::getSizeInElements(const GRState *state,
const MemRegion *R) {
switch (R->getKind()) {
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
// into a common place.
SVal NumVal = C.getStoreManager().getSizeInElements(state,
ER->getSuperRegion());
DefinedOrUnknownSVal &NumElements = cast<DefinedOrUnknownSVal>(NumVal);
DefinedOrUnknownSVal NumElements
= C.getStoreManager().getSizeInElements(state, ER->getSuperRegion());
const GRState *StInBound = state->AssumeInBound(Idx, NumElements, true);
const GRState *StOutBound = state->AssumeInBound(Idx, NumElements, false);