[cfe-commits] r169622 - /cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp
Ted Kremenek
kremenek at apple.com
Fri Dec 7 10:32:08 PST 2012
Author: kremenek
Date: Fri Dec 7 12:32:08 2012
New Revision: 169622
URL: http://llvm.org/viewvc/llvm-project?rev=169622&view=rev
Log:
Add helper method to convert from a RegionStoreRefBindings to a Store.
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp?rev=169622&r1=169621&r2=169622&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp Fri Dec 7 12:32:08 2012
@@ -196,6 +196,11 @@
/// getDefaultBinding - Returns an SVal* representing an optional default
/// binding associated with a region and its subregions.
Optional<SVal> getDefaultBinding(const MemRegion *R);
+
+ /// Return the internal tree as a Store.
+ Store asStore() const {
+ return asImmutableMap().getRootWithoutRetain();
+ }
};
} // end anonymous namespace
@@ -860,7 +865,7 @@
// invalidate that region. This is because a block may capture
// a pointer value, but the thing pointed by that pointer may
// get invalidated.
- Store store = B.asImmutableMap().getRootWithoutRetain();
+ Store store = B.asStore();
SVal V = RM.getBinding(store, loc::MemRegionVal(VR));
if (const Loc *L = dyn_cast<Loc>(&V)) {
if (const MemRegion *LR = L->getAsRegion())
@@ -991,7 +996,7 @@
Ex, Count, LCtx, B, Invalidated);
}
- return StoreRef(B.asImmutableMap().getRootWithoutRetain(), *this);
+ return StoreRef(B.asStore(), *this);
}
//===----------------------------------------------------------------------===//
@@ -1623,7 +1628,7 @@
RegionBindingsRef B = getRegionBindings(store);
B = removeSubRegionBindings(B, cast<SubRegion>(R));
BindingKey Key = BindingKey::Make(R, BindingKey::Direct);
- return StoreRef(B.addBinding(Key, V).asImmutableMap().getRootWithoutRetain(),
+ return StoreRef(B.addBinding(Key, V).asStore(),
*this);
}
@@ -1660,7 +1665,7 @@
}
return StoreRef(B.addBinding(R, BindingKey::Default, V)
- .asImmutableMap().getRootWithoutRetain(), *this);
+ .asStore(), *this);
}
StoreRef RegionStoreManager::BindArray(Store store, const TypedValueRegion* R,
@@ -1818,7 +1823,7 @@
if (FI != FE) {
RegionBindingsRef B = getRegionBindings(newStore.getStore());
B = B.addBinding(R, BindingKey::Default, svalBuilder.makeIntVal(0, false));
- newStore = StoreRef(B.asImmutableMap().getRootWithoutRetain(), *this);
+ newStore = StoreRef(B.asStore(), *this);
}
return newStore;
@@ -1830,7 +1835,7 @@
// we will invalidate. Then add the new binding.
RegionBindingsRef B = getRegionBindings(store);
B = removeSubRegionBindings(B, R).addBinding(R, BindingKey::Default, Val);
- return StoreRef(B.asImmutableMap().getRootWithoutRetain(), *this);
+ return StoreRef(B.asStore(), *this);
}
//===----------------------------------------------------------------------===//
@@ -2015,7 +2020,7 @@
}
}
- return StoreRef(B.asImmutableMap().getRootWithoutRetain(), *this);
+ return StoreRef(B.asStore(), *this);
}
//===----------------------------------------------------------------------===//
@@ -2026,7 +2031,7 @@
const char* nl, const char *sep) {
RegionBindingsRef B = getRegionBindings(store);
OS << "Store (direct and default bindings), "
- << (void*) B.asImmutableMap().getRootWithoutRetain()
+ << B.asStore()
<< " :" << nl;
for (RegionBindingsRef::iterator I = B.begin(), E = B.end(); I != E; ++I) {
More information about the cfe-commits
mailing list