SVal FlatStoreManager::Retrieve(Store store, Loc L, QualType T) { // For access to concrete addresses, return UnknownVal. Checks // for null dereferences (and similar errors) are done by checkers, not // the Store. // FIXME: We can consider lazily symbolicating such memory, but we really // should defer this when we can reason easily about symbolicating arrays // of bytes. if (isa<loc::ConcreteInt>(L)) { return UnknownVal(); } if (!isa<loc::MemRegionVal>(L)) { return UnknownVal(); } const MemRegion *R = cast<loc::MemRegionVal>(L).getRegion(); RegionInterval RI = RegionToInterval(R); // FIXME: FlatStore should handle regions with unknown intervals. if (!RI.R) return UnknownVal(); RegionBindings B = getRegionBindings(store); const BindingVal *BV = B.lookup(RI.R); if (BV) { const SVal *V = BVFactory.lookup(*BV, RI.I); if (V) return *V; else return RetrieveRegionWithNoBinding(R, T); } return RetrieveRegionWithNoBinding(R, T); }
SVal FlatStoreManager::Retrieve(Store store, Loc L, QualType T) { const MemRegion *R = cast<loc::MemRegionVal>(L).getRegion(); Interval I = RegionToInterval(R); RegionBindings B = getRegionBindings(store); const BindingVal *BV = B.lookup(R); if (BV) { const SVal *V = BVFactory.Lookup(*BV, I); if (V) return *V; else return RetrieveRegionWithNoBinding(R, T); } return RetrieveRegionWithNoBinding(R, T); }
Store FlatStoreManager::Bind(Store store, Loc L, SVal val) { const MemRegion *R = cast<loc::MemRegionVal>(L).getRegion(); RegionBindings B = getRegionBindings(store); const BindingVal *V = B.lookup(R); BindingVal BV = BVFactory.GetEmptyMap(); if (V) BV = *V; Interval I = RegionToInterval(R); BV = BVFactory.Add(BV, I, val); B = RBFactory.Add(B, R, BV); return B.getRoot(); }
StoreRef FlatStoreManager::Bind(Store store, Loc L, SVal val) { const MemRegion *R = cast<loc::MemRegionVal>(L).getRegion(); RegionBindings B = getRegionBindings(store); const BindingVal *V = B.lookup(R); BindingVal BV = BVFactory.getEmptyMap(); if (V) BV = *V; RegionInterval RI = RegionToInterval(R); // FIXME: FlatStore should handle regions with unknown intervals. if (!RI.R) return StoreRef(B.getRoot(), *this); BV = BVFactory.add(BV, RI.I, val); B = RBFactory.add(B, RI.R, BV); return StoreRef(B.getRoot(), *this); }