зеркало из https://github.com/microsoft/clang-1.git
Completely remove ObjCObjectRegion (tests pass this time).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91572 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
adcfab1ffc
Коммит
c410d4d2bb
|
@ -72,7 +72,6 @@ public:
|
||||||
VarRegionKind = BEG_DECL_REGIONS,
|
VarRegionKind = BEG_DECL_REGIONS,
|
||||||
FieldRegionKind,
|
FieldRegionKind,
|
||||||
ObjCIvarRegionKind,
|
ObjCIvarRegionKind,
|
||||||
ObjCObjectRegionKind,
|
|
||||||
CXXObjectRegionKind,
|
CXXObjectRegionKind,
|
||||||
END_DECL_REGIONS = CXXObjectRegionKind,
|
END_DECL_REGIONS = CXXObjectRegionKind,
|
||||||
END_TYPED_REGIONS = END_DECL_REGIONS
|
END_TYPED_REGIONS = END_DECL_REGIONS
|
||||||
|
@ -663,33 +662,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ObjCObjectRegion : public DeclRegion {
|
|
||||||
|
|
||||||
friend class MemRegionManager;
|
|
||||||
|
|
||||||
ObjCObjectRegion(const ObjCInterfaceDecl* ivd, const MemRegion* sReg)
|
|
||||||
: DeclRegion(ivd, sReg, ObjCObjectRegionKind) {}
|
|
||||||
|
|
||||||
static void ProfileRegion(llvm::FoldingSetNodeID& ID,
|
|
||||||
const ObjCInterfaceDecl* ivd,
|
|
||||||
const MemRegion* superRegion) {
|
|
||||||
DeclRegion::ProfileRegion(ID, ivd, superRegion, ObjCObjectRegionKind);
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
const ObjCInterfaceDecl* getInterface() const {
|
|
||||||
return cast<ObjCInterfaceDecl>(D);
|
|
||||||
}
|
|
||||||
|
|
||||||
QualType getValueType(ASTContext& C) const {
|
|
||||||
return C.getObjCInterfaceType(getInterface());
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool classof(const MemRegion* R) {
|
|
||||||
return R->getKind() == ObjCObjectRegionKind;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class ObjCIvarRegion : public DeclRegion {
|
class ObjCIvarRegion : public DeclRegion {
|
||||||
|
|
||||||
friend class MemRegionManager;
|
friend class MemRegionManager;
|
||||||
|
@ -890,11 +862,6 @@ public:
|
||||||
return getFieldRegion(FR->getDecl(), superRegion);
|
return getFieldRegion(FR->getDecl(), superRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getObjCObjectRegion - Retrieve or create the memory region associated with
|
|
||||||
/// the instance of a specified Objective-C class.
|
|
||||||
const ObjCObjectRegion* getObjCObjectRegion(const ObjCInterfaceDecl* ID,
|
|
||||||
const MemRegion* superRegion);
|
|
||||||
|
|
||||||
/// getObjCIvarRegion - Retrieve or create the memory region associated with
|
/// getObjCIvarRegion - Retrieve or create the memory region associated with
|
||||||
/// a specified Objective-c instance variable. 'superRegion' corresponds
|
/// a specified Objective-c instance variable. 'superRegion' corresponds
|
||||||
/// to the containing region (which typically represents the Objective-C
|
/// to the containing region (which typically represents the Objective-C
|
||||||
|
|
|
@ -479,15 +479,14 @@ Store BasicStoreManager::getInitialStore(const LocationContext *InitLoc) {
|
||||||
const Decl& CD = *InitLoc->getDecl();
|
const Decl& CD = *InitLoc->getDecl();
|
||||||
if (const ObjCMethodDecl* MD = dyn_cast<ObjCMethodDecl>(&CD)) {
|
if (const ObjCMethodDecl* MD = dyn_cast<ObjCMethodDecl>(&CD)) {
|
||||||
if (MD->getSelfDecl() == PD) {
|
if (MD->getSelfDecl() == PD) {
|
||||||
// FIXME: Just use a symbolic region, and remove ObjCObjectRegion
|
// FIXME: Add type constraints (when they become available) to
|
||||||
// entirely.
|
// SelfRegion? (i.e., it implements MD->getClassInterface()).
|
||||||
const ObjCObjectRegion *SelfRegion =
|
const MemRegion *VR = MRMgr.getVarRegion(PD, InitLoc);
|
||||||
MRMgr.getObjCObjectRegion(MD->getClassInterface(),
|
const MemRegion *SelfRegion =
|
||||||
MRMgr.getHeapRegion());
|
ValMgr.getRegionValueSymbolVal(VR).getAsRegion();
|
||||||
|
assert(SelfRegion);
|
||||||
St = BindInternal(St, ValMgr.makeLoc(MRMgr.getVarRegion(PD, InitLoc)),
|
St = BindInternal(St, ValMgr.makeLoc(VR),
|
||||||
ValMgr.makeLoc(SelfRegion));
|
loc::MemRegionVal(SelfRegion));
|
||||||
|
|
||||||
// Scan the method for ivar references. While this requires an
|
// Scan the method for ivar references. While this requires an
|
||||||
// entire AST scan, the cost should not be high in practice.
|
// entire AST scan, the cost should not be high in practice.
|
||||||
St = scanForIvars(MD->getBody(), PD, SelfRegion, St);
|
St = scanForIvars(MD->getBody(), PD, SelfRegion, St);
|
||||||
|
|
|
@ -563,12 +563,6 @@ MemRegionManager::getObjCIvarRegion(const ObjCIvarDecl* d,
|
||||||
return getSubRegion<ObjCIvarRegion>(d, superRegion);
|
return getSubRegion<ObjCIvarRegion>(d, superRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ObjCObjectRegion*
|
|
||||||
MemRegionManager::getObjCObjectRegion(const ObjCInterfaceDecl* d,
|
|
||||||
const MemRegion* superRegion) {
|
|
||||||
return getSubRegion<ObjCObjectRegion>(d, superRegion);
|
|
||||||
}
|
|
||||||
|
|
||||||
const CXXObjectRegion *
|
const CXXObjectRegion *
|
||||||
MemRegionManager::getCXXObjectRegion(QualType T) {
|
MemRegionManager::getCXXObjectRegion(QualType T) {
|
||||||
return getSubRegion<CXXObjectRegion>(T, getUnknownRegion());
|
return getSubRegion<CXXObjectRegion>(T, getUnknownRegion());
|
||||||
|
|
|
@ -539,8 +539,7 @@ const GRState *RegionStoreManager::InvalidateRegions(const GRState *state,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle the region itself.
|
// Handle the region itself.
|
||||||
if (isa<AllocaRegion>(R) || isa<SymbolicRegion>(R) ||
|
if (isa<AllocaRegion>(R) || isa<SymbolicRegion>(R)) {
|
||||||
isa<ObjCObjectRegion>(R)) {
|
|
||||||
// Invalidate the region by setting its default value to
|
// Invalidate the region by setting its default value to
|
||||||
// conjured symbol. The type of the symbol is irrelavant.
|
// conjured symbol. The type of the symbol is irrelavant.
|
||||||
DefinedOrUnknownSVal V = ValMgr.getConjuredSymbolVal(R, Ex, Ctx.IntTy,
|
DefinedOrUnknownSVal V = ValMgr.getConjuredSymbolVal(R, Ex, Ctx.IntTy,
|
||||||
|
@ -744,7 +743,6 @@ DefinedOrUnknownSVal RegionStoreManager::getSizeInElements(const GRState *state,
|
||||||
case MemRegion::ElementRegionKind:
|
case MemRegion::ElementRegionKind:
|
||||||
case MemRegion::FieldRegionKind:
|
case MemRegion::FieldRegionKind:
|
||||||
case MemRegion::ObjCIvarRegionKind:
|
case MemRegion::ObjCIvarRegionKind:
|
||||||
case MemRegion::ObjCObjectRegionKind:
|
|
||||||
case MemRegion::SymbolicRegionKind:
|
case MemRegion::SymbolicRegionKind:
|
||||||
case MemRegion::CXXObjectRegionKind:
|
case MemRegion::CXXObjectRegionKind:
|
||||||
return UnknownVal();
|
return UnknownVal();
|
||||||
|
@ -868,7 +866,6 @@ SVal RegionStoreManager::EvalBinOp(const GRState *state,
|
||||||
// Fall-through.
|
// Fall-through.
|
||||||
case MemRegion::CompoundLiteralRegionKind:
|
case MemRegion::CompoundLiteralRegionKind:
|
||||||
case MemRegion::FieldRegionKind:
|
case MemRegion::FieldRegionKind:
|
||||||
case MemRegion::ObjCObjectRegionKind:
|
|
||||||
case MemRegion::ObjCIvarRegionKind:
|
case MemRegion::ObjCIvarRegionKind:
|
||||||
case MemRegion::CXXObjectRegionKind:
|
case MemRegion::CXXObjectRegionKind:
|
||||||
return UnknownVal();
|
return UnknownVal();
|
||||||
|
|
|
@ -98,7 +98,6 @@ const MemRegion *StoreManager::CastRegion(const MemRegion *R, QualType CastToTy)
|
||||||
}
|
}
|
||||||
|
|
||||||
case MemRegion::StringRegionKind:
|
case MemRegion::StringRegionKind:
|
||||||
case MemRegion::ObjCObjectRegionKind:
|
|
||||||
// FIXME: Need to handle arbitrary downcasts.
|
// FIXME: Need to handle arbitrary downcasts.
|
||||||
case MemRegion::SymbolicRegionKind:
|
case MemRegion::SymbolicRegionKind:
|
||||||
case MemRegion::AllocaRegionKind:
|
case MemRegion::AllocaRegionKind:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче