return loc::MemRegionVal(MRMgr.getCompoundLiteralRegion(CL, LC));
}
- virtual SVal getLValueIvar(const ObjCIvarDecl* decl, SVal base) = 0;
+ virtual SVal getLValueIvar(const ObjCIvarDecl* decl, SVal base) {
+ return getLValueFieldOrIvar(decl, base);
+ }
- virtual SVal getLValueField(const FieldDecl* D, SVal Base) = 0;
+ virtual SVal getLValueField(const FieldDecl* D, SVal Base) {
+ return getLValueFieldOrIvar(D, Base);
+ }
virtual SVal getLValueElement(QualType elementType, SVal offset, SVal Base)=0;
/// as another region.
SVal CastRetrievedVal(SVal val, const TypedRegion *R, QualType castTy,
bool performTestOnly = true);
+
+private:
+ SVal getLValueFieldOrIvar(const Decl* D, SVal Base);
};
// FIXME: Do we still need this?
return store;
}
- SVal getLValueIvar(const ObjCIvarDecl* D, SVal Base);
- SVal getLValueField(const FieldDecl *D, SVal Base);
SVal getLValueElement(QualType elementType, SVal Offset, SVal Base);
/// ArrayToPointer - Used by GRExprEngine::VistCast to handle implicit
return new BasicStoreManager(StMgr);
}
-SVal BasicStoreManager::getLValueIvar(const ObjCIvarDecl* D, SVal Base) {
-
- if (Base.isUnknownOrUndef())
- return Base;
-
- Loc BaseL = cast<Loc>(Base);
-
- if (isa<loc::MemRegionVal>(BaseL)) {
- const MemRegion *BaseR = cast<loc::MemRegionVal>(BaseL).getRegion();
- return ValMgr.makeLoc(MRMgr.getObjCIvarRegion(D, BaseR));
- }
-
- return UnknownVal();
-}
-
-SVal BasicStoreManager::getLValueField(const FieldDecl* D, SVal Base) {
-
- if (Base.isUnknownOrUndef())
- return Base;
-
- Loc BaseL = cast<Loc>(Base);
- const MemRegion* BaseR = 0;
-
- switch(BaseL.getSubKind()) {
- case loc::GotoLabelKind:
- return UndefinedVal();
-
- case loc::MemRegionKind:
- BaseR = cast<loc::MemRegionVal>(BaseL).getRegion();
- break;
-
- case loc::ConcreteIntKind:
- // While these seem funny, this can happen through casts.
- // FIXME: What we should return is the field offset. For example,
- // add the field offset to the integer value. That way funny things
- // like this work properly: &(((struct foo *) 0xa)->f)
- return Base;
-
- default:
- assert ("Unhandled Base.");
- return Base;
- }
-
- return ValMgr.makeLoc(MRMgr.getFieldRegion(D, BaseR));
-}
-
SVal BasicStoreManager::getLValueElement(QualType elementType,
SVal Offset, SVal Base) {
return 0;
}
- SVal getLValueVar(const VarDecl *VD, const LocationContext *LC) {
- return loc::MemRegionVal(MRMgr.getVarRegion(VD, LC));
- }
-
- SVal getLValueString(const StringLiteral* sl);
- SVal getLValueIvar(const ObjCIvarDecl* decl, SVal base);
- SVal getLValueField(const FieldDecl* D, SVal Base);
SVal getLValueElement(QualType elementType, SVal offset, SVal Base);
SVal ArrayToPointer(Loc Array);
Store RemoveDeadBindings(Store store, Stmt* Loc, SymbolReaper& SymReaper,
return store;
}
-SVal FlatStoreManager::getLValueString(const StringLiteral* sl) {
- return UnknownVal();
-}
-
-SVal FlatStoreManager::getLValueIvar(const ObjCIvarDecl* decl, SVal base) {
- return UnknownVal();
-}
-
-SVal FlatStoreManager::getLValueField(const FieldDecl* D, SVal Base) {
- return UnknownVal();
-}
-
SVal FlatStoreManager::getLValueElement(QualType elementType, SVal offset,
SVal Base) {
return UnknownVal();
/// the value is not specified.
Store setImplicitDefaultValue(Store store, const MemRegion *R, QualType T);
- SVal getLValueIvar(const ObjCIvarDecl* D, SVal Base);
-
- SVal getLValueField(const FieldDecl* D, SVal Base);
-
- SVal getLValueFieldOrIvar(const Decl* D, SVal Base);
-
SVal getLValueElement(QualType elementType, SVal Offset, SVal Base);
StateMgr.getValueManager());
}
-
-//===----------------------------------------------------------------------===//
-// getLValueXXX methods.
-//===----------------------------------------------------------------------===//
-
-SVal RegionStoreManager::getLValueIvar(const ObjCIvarDecl* D, SVal Base) {
- return getLValueFieldOrIvar(D, Base);
-}
-
-SVal RegionStoreManager::getLValueField(const FieldDecl* D, SVal Base) {
- return getLValueFieldOrIvar(D, Base);
-}
-
-SVal RegionStoreManager::getLValueFieldOrIvar(const Decl* D, SVal Base) {
- if (Base.isUnknownOrUndef())
- return Base;
-
- Loc BaseL = cast<Loc>(Base);
- const MemRegion* BaseR = 0;
-
- switch (BaseL.getSubKind()) {
- case loc::MemRegionKind:
- BaseR = cast<loc::MemRegionVal>(BaseL).getRegion();
- break;
-
- case loc::GotoLabelKind:
- // These are anormal cases. Flag an undefined value.
- return UndefinedVal();
-
- case loc::ConcreteIntKind:
- // While these seem funny, this can happen through casts.
- // FIXME: What we should return is the field offset. For example,
- // add the field offset to the integer value. That way funny things
- // like this work properly: &(((struct foo *) 0xa)->f)
- return Base;
-
- default:
- assert(0 && "Unhandled Base.");
- return Base;
- }
-
- // NOTE: We must have this check first because ObjCIvarDecl is a subclass
- // of FieldDecl.
- if (const ObjCIvarDecl *ID = dyn_cast<ObjCIvarDecl>(D))
- return loc::MemRegionVal(MRMgr.getObjCIvarRegion(ID, BaseR));
-
- return loc::MemRegionVal(MRMgr.getFieldRegion(cast<FieldDecl>(D), BaseR));
-}
-
SVal RegionStoreManager::getLValueElement(QualType elementType, SVal Offset,
SVal Base) {
return store;
}
+
+SVal StoreManager::getLValueFieldOrIvar(const Decl* D, SVal Base) {
+ if (Base.isUnknownOrUndef())
+ return Base;
+
+ Loc BaseL = cast<Loc>(Base);
+ const MemRegion* BaseR = 0;
+
+ switch (BaseL.getSubKind()) {
+ case loc::MemRegionKind:
+ BaseR = cast<loc::MemRegionVal>(BaseL).getRegion();
+ break;
+
+ case loc::GotoLabelKind:
+ // These are anormal cases. Flag an undefined value.
+ return UndefinedVal();
+
+ case loc::ConcreteIntKind:
+ // While these seem funny, this can happen through casts.
+ // FIXME: What we should return is the field offset. For example,
+ // add the field offset to the integer value. That way funny things
+ // like this work properly: &(((struct foo *) 0xa)->f)
+ return Base;
+
+ default:
+ assert(0 && "Unhandled Base.");
+ return Base;
+ }
+
+ // NOTE: We must have this check first because ObjCIvarDecl is a subclass
+ // of FieldDecl.
+ if (const ObjCIvarDecl *ID = dyn_cast<ObjCIvarDecl>(D))
+ return loc::MemRegionVal(MRMgr.getObjCIvarRegion(ID, BaseR));
+
+ return loc::MemRegionVal(MRMgr.getFieldRegion(cast<FieldDecl>(D), BaseR));
+}