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
diff --git a/lib/Analysis/Store.cpp b/lib/Analysis/Store.cpp
index e9b8f6a..76437d2 100644
--- a/lib/Analysis/Store.cpp
+++ b/lib/Analysis/Store.cpp
@@ -68,7 +68,12 @@
// FIXME: We should have a standard query function to get the size
// of the array index.
SVal Idx = ValMgr.makeZeroVal(ValMgr.getContext().VoidPtrTy);
- ElementRegion* ER = MRMgr.getElementRegion(Pointee, Idx, TR);
+
+ // If the super region is an element region, strip it away.
+ // FIXME: Is this the right thing to do in all cases?
+ const TypedRegion *Base = isa<ElementRegion>(TR) ?
+ cast<TypedRegion>(TR->getSuperRegion()) : TR;
+ ElementRegion* ER = MRMgr.getElementRegion(Pointee, Idx, Base);
return CastResult(state, ER);
}
}