forked from OSchip/llvm-project
Basic Store: Always convert a non::LocAsInteger to a Loc when storing to a pointer.
llvm-svn: 70564
This commit is contained in:
parent
0e3cc24e79
commit
a11c607312
|
@ -324,17 +324,26 @@ Store BasicStoreManager::BindInternal(Store store, Loc loc, SVal V) {
|
||||||
switch (loc.getSubKind()) {
|
switch (loc.getSubKind()) {
|
||||||
case loc::MemRegionKind: {
|
case loc::MemRegionKind: {
|
||||||
const MemRegion* R = cast<loc::MemRegionVal>(loc).getRegion();
|
const MemRegion* R = cast<loc::MemRegionVal>(loc).getRegion();
|
||||||
|
ASTContext &C = StateMgr.getContext();
|
||||||
|
|
||||||
// Special case: handle store of pointer values (Loc) to pointers via
|
// Special case: handle store of pointer values (Loc) to pointers via
|
||||||
// a cast to intXX_t*, void*, etc. This is needed to handle
|
// a cast to intXX_t*, void*, etc. This is needed to handle
|
||||||
// OSCompareAndSwap32Barrier/OSCompareAndSwap64Barrier.
|
// OSCompareAndSwap32Barrier/OSCompareAndSwap64Barrier.
|
||||||
if (isa<Loc>(V) || isa<nonloc::LocAsInteger>(V))
|
if (isa<Loc>(V) || isa<nonloc::LocAsInteger>(V))
|
||||||
if (const TypedViewRegion *TR = dyn_cast<TypedViewRegion>(R)) {
|
if (const TypedViewRegion *TR = dyn_cast<TypedViewRegion>(R)) {
|
||||||
ASTContext &C = StateMgr.getContext();
|
|
||||||
QualType T = TR->getLValueType(C);
|
QualType T = TR->getLValueType(C);
|
||||||
|
|
||||||
if (isHigherOrderRawPtr(T, C)) {
|
if (isHigherOrderRawPtr(T, C))
|
||||||
R = TR->removeViews();
|
R = TR->removeViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(isa<VarRegion>(R) || isa<ObjCIvarRegion>(R)))
|
||||||
|
return store;
|
||||||
|
|
||||||
|
// We only track bindings to self.ivar.
|
||||||
|
if (const ObjCIvarRegion *IVR = dyn_cast<ObjCIvarRegion>(R))
|
||||||
|
if (IVR->getSuperRegion() != SelfRegion)
|
||||||
|
return store;
|
||||||
|
|
||||||
if (nonloc::LocAsInteger *X = dyn_cast<nonloc::LocAsInteger>(&V)) {
|
if (nonloc::LocAsInteger *X = dyn_cast<nonloc::LocAsInteger>(&V)) {
|
||||||
// Only convert 'V' to a location iff the underlying region type
|
// Only convert 'V' to a location iff the underlying region type
|
||||||
|
@ -349,16 +358,6 @@ Store BasicStoreManager::BindInternal(Store store, Loc loc, SVal V) {
|
||||||
V = X->getLoc();
|
V = X->getLoc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(isa<VarRegion>(R) || isa<ObjCIvarRegion>(R)))
|
|
||||||
return store;
|
|
||||||
|
|
||||||
// We only track bindings to self.ivar.
|
|
||||||
if (const ObjCIvarRegion *IVR = dyn_cast<ObjCIvarRegion>(R))
|
|
||||||
if (IVR->getSuperRegion() != SelfRegion)
|
|
||||||
return store;
|
|
||||||
|
|
||||||
BindingsTy B = GetBindings(store);
|
BindingsTy B = GetBindings(store);
|
||||||
return V.isUnknown()
|
return V.isUnknown()
|
||||||
|
|
Loading…
Reference in New Issue