/// conversions between arrays and pointers.
virtual SVal ArrayToPointer(SVal Array) = 0;
- virtual const GRState* CastRegion(const GRState* St, SVal VoidPtr,
- QualType CastToTy, Stmt* CastE) = 0;
+ virtual std::pair<const GRState*, SVal>
+ CastRegion(const GRState* St, SVal VoidPtr, QualType CastToTy, Stmt* CastE)=0;
/// getSelfRegion - Returns the region for the 'self' (Objective-C) or
/// 'this' object (C++). When used when analyzing a normal function this
/// conversions between arrays and pointers.
SVal ArrayToPointer(SVal Array) { return Array; }
- const GRState* CastRegion(const GRState* St, SVal VoidPtr, QualType CastToTy,
- Stmt* CastE) {
- return St;
+ std::pair<const GRState*, SVal>
+ CastRegion(const GRState* St, SVal VoidPtr, QualType CastToTy, Stmt* CastE) {
+ return std::pair<const GRState*, SVal>(St, UnknownVal());
}
assert(Loc::IsLocType(ExTy));
// Delegate to store manager.
- const GRState* NewSt = getStoreManager().CastRegion(St, V, T, CastE);
+ std::pair<const GRState*, SVal> Res =
+ getStoreManager().CastRegion(St, V, T, CastE);
+
+ const GRState* NewSt = Res.first;
+ SVal NewPtr = Res.second;
// If no new region is created, fall through to the default case.
if (NewSt != St) {
- MakeNode(Dst, CastE, N, NewSt);
+ MakeNode(Dst, CastE, N, BindExpr(NewSt, CastE, NewPtr));
continue;
}
}
SVal ArrayToPointer(SVal Array);
- const GRState* CastRegion(const GRState* St, SVal VoidPtr,
- QualType CastToTy, Stmt* CastE);
+ std::pair<const GRState*, SVal>
+ CastRegion(const GRState* St, SVal VoidPtr, QualType CastToTy, Stmt* CastE);
SVal Retrieve(Store S, Loc L, QualType T = QualType());
return loc::MemRegionVal(ER);
}
-const GRState* RegionStoreManager::CastRegion(const GRState* St,
- SVal VoidPtr,
- QualType CastToTy,
- Stmt* CastE) {
+std::pair<const GRState*, SVal>
+RegionStoreManager::CastRegion(const GRState* St, SVal VoidPtr,
+ QualType CastToTy, Stmt* CastE) {
if (const AllocaRegion* AR =
dyn_cast<AllocaRegion>(cast<loc::MemRegionVal>(VoidPtr).getRegion())) {
nonloc::ConcreteInt Idx(getBasicVals().getZeroWithPtrWidth(false));
const ElementRegion* ER = MRMgr.getElementRegion(Idx, TR);
- St = StateMgr.BindExpr(St, CastE, loc::MemRegionVal(ER));
-
// Add a RegionView to base region.
- return AddRegionView(St, TR, AR);
+ return std::pair<const GRState*, SVal>(AddRegionView(St, TR, AR),
+ loc::MemRegionVal(ER));
}
// Default case.
- return St;
+ return std::pair<const GRState*, SVal>(St, UnknownVal());
}
SVal RegionStoreManager::Retrieve(Store S, Loc L, QualType T) {