aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/BasicStore.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-05-04 07:04:36 +0000
committerTed Kremenek <kremenek@apple.com>2009-05-04 07:04:36 +0000
commit20bd746306ecdc61125800d53ff7e07321704064 (patch)
treeb837c831f7d873aa342d48c68b300231a36a0ea5 /lib/Analysis/BasicStore.cpp
parentb84e8a670ad1d00c0a34295c42ac700cdde04815 (diff)
BasicStore: 'ElementRegion' is the new 'TypedViewRegion'.
StoreManager: Handle casts from one element region to another. Update test cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70836 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BasicStore.cpp')
-rw-r--r--lib/Analysis/BasicStore.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/Analysis/BasicStore.cpp b/lib/Analysis/BasicStore.cpp
index e4ac6b92a1..969e4c9654 100644
--- a/lib/Analysis/BasicStore.cpp
+++ b/lib/Analysis/BasicStore.cpp
@@ -217,7 +217,7 @@ SVal BasicStoreManager::getLValueElement(const GRState* St,
// char buf[100];
// char *q = &buf[1]; // p points to ElementRegion(buf,Unknown)
// &q[10]
- assert(cast<ElementRegion>(R)->getIndex().isUnknown());
+ //assert(cast<ElementRegion>(R)->getIndex().isUnknown());
return Base;
}
@@ -287,18 +287,18 @@ SVal BasicStoreManager::Retrieve(const GRState* state, Loc loc, QualType T) {
case loc::MemRegionKind: {
const MemRegion* R = cast<loc::MemRegionVal>(loc).getRegion();
- if (const TypedViewRegion *TR = dyn_cast<TypedViewRegion>(R)) {
+ if (const ElementRegion *ER = dyn_cast<ElementRegion>(R)) {
// Just support void**, void***, intptr_t*, intptr_t**, etc., for now.
// This is needed to handle OSCompareAndSwapPtr() and friends.
ASTContext &Ctx = StateMgr.getContext();
- QualType T = TR->getLValueType(Ctx);
+ QualType T = ER->getLValueType(Ctx);
if (!isHigherOrderRawPtr(T, Ctx))
return UnknownVal();
- // Otherwise, strip the views.
- // FIXME: Should we layer a TypedView on the result?
- R = TR->removeViews();
+ // FIXME: Should check for element 0.
+ // Otherwise, strip the element region.
+ R = ER->getSuperRegion();
}
if (!(isa<VarRegion>(R) || isa<ObjCIvarRegion>(R)))
@@ -333,11 +333,12 @@ Store BasicStoreManager::BindInternal(Store store, Loc loc, SVal V) {
// a cast to intXX_t*, void*, etc. This is needed to handle
// OSCompareAndSwap32Barrier/OSCompareAndSwap64Barrier.
if (isa<Loc>(V) || isa<nonloc::LocAsInteger>(V))
- if (const TypedViewRegion *TR = dyn_cast<TypedViewRegion>(R)) {
- QualType T = TR->getLValueType(C);
+ if (const ElementRegion *ER = dyn_cast<ElementRegion>(R)) {
+ // FIXME: Should check for index 0.
+ QualType T = ER->getLValueType(C);
if (isHigherOrderRawPtr(T, C))
- R = TR->removeViews();
+ R = ER->getSuperRegion();
}
if (!(isa<VarRegion>(R) || isa<ObjCIvarRegion>(R)))