aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/RegionStore.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-04-21 21:51:34 +0000
committerTed Kremenek <kremenek@apple.com>2009-04-21 21:51:34 +0000
commitc62abc1012feb0b15eff091b02c176649766a347 (patch)
tree61bd1482a0292fac61add423346827b1efdf564d /lib/Analysis/RegionStore.cpp
parent293b4d6a4394174e46d0b3faf6353ed98203792d (diff)
Refactor 'BasicStoreManager::CastRegion' and 'RegionStoreManager::CastRegion'
into StoreManager::CastRegion. Both methods were practically identical, and this is core logic that is common to all StoreManagers since it defines the basic invariants of the abstract memory model. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69730 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/RegionStore.cpp')
-rw-r--r--lib/Analysis/RegionStore.cpp36
1 files changed, 2 insertions, 34 deletions
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp
index 40f7c48131..7a78036ec0 100644
--- a/lib/Analysis/RegionStore.cpp
+++ b/lib/Analysis/RegionStore.cpp
@@ -142,16 +142,15 @@ class VISIBILITY_HIDDEN RegionStoreManager : public StoreManager {
RegionBindingsTy::Factory RBFactory;
RegionViews::Factory RVFactory;
- GRStateManager& StateMgr;
const MemRegion* SelfRegion;
const ImplicitParamDecl *SelfDecl;
public:
RegionStoreManager(GRStateManager& mgr)
- : StoreManager(mgr.getValueManager()),
+ : StoreManager(mgr),
RBFactory(mgr.getAllocator()),
RVFactory(mgr.getAllocator()),
- StateMgr(mgr), SelfRegion(0), SelfDecl(0) {
+ SelfRegion(0), SelfDecl(0) {
if (const ObjCMethodDecl* MD =
dyn_cast<ObjCMethodDecl>(&StateMgr.getCodeDecl()))
SelfDecl = MD->getSelfDecl();
@@ -199,12 +198,6 @@ public:
/// casts from arrays to pointers.
SVal ArrayToPointer(Loc Array);
- /// CastRegion - Used by GRExprEngine::VisitCast to handle casts from
- /// a MemRegion* to a specific location type. 'R' is the region being
- /// casted and 'CastToTy' the result type of the cast.
- CastResult CastRegion(const GRState* state, const MemRegion* R,
- QualType CastToTy);
-
SVal EvalBinOp(BinaryOperator::Opcode Op, Loc L, NonLoc R);
/// The high level logic for this method is this:
@@ -579,31 +572,6 @@ SVal RegionStoreManager::ArrayToPointer(Loc Array) {
return loc::MemRegionVal(ER);
}
-StoreManager::CastResult
-RegionStoreManager::CastRegion(const GRState* state, const MemRegion* R,
- QualType CastToTy) {
-
- // Return the same region if the region types are compatible.
- if (const TypedRegion* TR = dyn_cast<TypedRegion>(R)) {
- ASTContext& Ctx = StateMgr.getContext();
- QualType Ta = Ctx.getCanonicalType(TR->getLValueType(Ctx));
- QualType Tb = Ctx.getCanonicalType(CastToTy);
-
- if (Ta == Tb)
- return CastResult(state, R);
- }
-
- // FIXME: We should handle the case when we are casting *back* to a
- // previous type. For example:
- //
- // void* x = ...;
- // char* y = (char*) x;
- // void* z = (void*) y; // <-- we should get the same region that is
- // bound to 'x'
- const MemRegion* ViewR = MRMgr.getTypedViewRegion(CastToTy, R);
- return CastResult(AddRegionView(state, ViewR, R), ViewR);
-}
-
SVal RegionStoreManager::EvalBinOp(BinaryOperator::Opcode Op, Loc L, NonLoc R) {
// Assume the base location is MemRegionVal(ElementRegion).
if (!isa<loc::MemRegionVal>(L))