[cfe-commits] r86932 - in /cfe/trunk: include/clang/Analysis/PathSensitive/Store.h lib/Analysis/ArrayBoundChecker.cpp lib/Analysis/RegionStore.cpp lib/Analysis/ReturnPointerRangeChecker.cpp
Zhongxing Xu
xuzhongxing at gmail.com
Wed Nov 11 18:48:32 PST 2009
Author: zhongxingxu
Date: Wed Nov 11 20:48:32 2009
New Revision: 86932
URL: http://llvm.org/viewvc/llvm-project?rev=86932&view=rev
Log:
Make StoreManager::getSizeInElements() always return DefinedOrUnknownSVal.
Modified:
cfe/trunk/include/clang/Analysis/PathSensitive/Store.h
cfe/trunk/lib/Analysis/ArrayBoundChecker.cpp
cfe/trunk/lib/Analysis/RegionStore.cpp
cfe/trunk/lib/Analysis/ReturnPointerRangeChecker.cpp
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/Store.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/Store.h?rev=86932&r1=86931&r2=86932&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/Store.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/Store.h Wed Nov 11 20:48:32 2009
@@ -102,7 +102,8 @@
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();
}
Modified: cfe/trunk/lib/Analysis/ArrayBoundChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ArrayBoundChecker.cpp?rev=86932&r1=86931&r2=86932&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ArrayBoundChecker.cpp (original)
+++ cfe/trunk/lib/Analysis/ArrayBoundChecker.cpp Wed Nov 11 20:48:32 2009
@@ -56,9 +56,8 @@
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);
Modified: cfe/trunk/lib/Analysis/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/RegionStore.cpp?rev=86932&r1=86931&r2=86932&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/RegionStore.cpp (original)
+++ cfe/trunk/lib/Analysis/RegionStore.cpp Wed Nov 11 20:48:32 2009
@@ -360,7 +360,8 @@
//===------------------------------------------------------------------===//
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 @@
// 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:
Modified: cfe/trunk/lib/Analysis/ReturnPointerRangeChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ReturnPointerRangeChecker.cpp?rev=86932&r1=86931&r2=86932&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ReturnPointerRangeChecker.cpp (original)
+++ cfe/trunk/lib/Analysis/ReturnPointerRangeChecker.cpp Wed Nov 11 20:48:32 2009
@@ -64,9 +64,8 @@
// 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);
More information about the cfe-commits
mailing list