[cfe-commits] r91572 - in /cfe/trunk: include/clang/Analysis/PathSensitive/MemRegion.h lib/Analysis/BasicStore.cpp lib/Analysis/MemRegion.cpp lib/Analysis/RegionStore.cpp lib/Analysis/Store.cpp

Ted Kremenek kremenek at apple.com
Wed Dec 16 15:53:37 PST 2009


Author: kremenek
Date: Wed Dec 16 17:53:37 2009
New Revision: 91572

URL: http://llvm.org/viewvc/llvm-project?rev=91572&view=rev
Log:
Completely remove ObjCObjectRegion (tests pass this time).

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h
    cfe/trunk/lib/Analysis/BasicStore.cpp
    cfe/trunk/lib/Analysis/MemRegion.cpp
    cfe/trunk/lib/Analysis/RegionStore.cpp
    cfe/trunk/lib/Analysis/Store.cpp

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h?rev=91572&r1=91571&r2=91572&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h Wed Dec 16 17:53:37 2009
@@ -72,7 +72,6 @@
     VarRegionKind = BEG_DECL_REGIONS,
     FieldRegionKind,
     ObjCIvarRegionKind,
-    ObjCObjectRegionKind,
     CXXObjectRegionKind,
     END_DECL_REGIONS = CXXObjectRegionKind,
     END_TYPED_REGIONS = END_DECL_REGIONS
@@ -663,33 +662,6 @@
   }
 };
 
-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 {
 
   friend class MemRegionManager;
@@ -890,11 +862,6 @@
     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
   ///   a specified Objective-c instance variable.  'superRegion' corresponds
   ///   to the containing region (which typically represents the Objective-C

Modified: cfe/trunk/lib/Analysis/BasicStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BasicStore.cpp?rev=91572&r1=91571&r2=91572&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/BasicStore.cpp (original)
+++ cfe/trunk/lib/Analysis/BasicStore.cpp Wed Dec 16 17:53:37 2009
@@ -479,15 +479,14 @@
       const Decl& CD = *InitLoc->getDecl();
       if (const ObjCMethodDecl* MD = dyn_cast<ObjCMethodDecl>(&CD)) {
         if (MD->getSelfDecl() == PD) {
-          // FIXME: Just use a symbolic region, and remove ObjCObjectRegion
-          // entirely.
-          const ObjCObjectRegion *SelfRegion =
-            MRMgr.getObjCObjectRegion(MD->getClassInterface(),
-                                      MRMgr.getHeapRegion());
-
-          St = BindInternal(St, ValMgr.makeLoc(MRMgr.getVarRegion(PD, InitLoc)),
-                            ValMgr.makeLoc(SelfRegion));
-
+          // FIXME: Add type constraints (when they become available) to
+          // SelfRegion?  (i.e., it implements MD->getClassInterface()).
+          const MemRegion *VR = MRMgr.getVarRegion(PD, InitLoc);
+          const MemRegion *SelfRegion =
+            ValMgr.getRegionValueSymbolVal(VR).getAsRegion();          
+          assert(SelfRegion);          
+          St = BindInternal(St, ValMgr.makeLoc(VR),
+                            loc::MemRegionVal(SelfRegion));
           // Scan the method for ivar references.  While this requires an
           // entire AST scan, the cost should not be high in practice.
           St = scanForIvars(MD->getBody(), PD, SelfRegion, St);

Modified: cfe/trunk/lib/Analysis/MemRegion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/MemRegion.cpp?rev=91572&r1=91571&r2=91572&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/MemRegion.cpp (original)
+++ cfe/trunk/lib/Analysis/MemRegion.cpp Wed Dec 16 17:53:37 2009
@@ -563,12 +563,6 @@
   return getSubRegion<ObjCIvarRegion>(d, superRegion);
 }
 
-const ObjCObjectRegion*
-MemRegionManager::getObjCObjectRegion(const ObjCInterfaceDecl* d,
-                                      const MemRegion* superRegion) {
-  return getSubRegion<ObjCObjectRegion>(d, superRegion);
-}
-
 const CXXObjectRegion *
 MemRegionManager::getCXXObjectRegion(QualType T) {
   return getSubRegion<CXXObjectRegion>(T, getUnknownRegion());

Modified: cfe/trunk/lib/Analysis/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/RegionStore.cpp?rev=91572&r1=91571&r2=91572&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/RegionStore.cpp (original)
+++ cfe/trunk/lib/Analysis/RegionStore.cpp Wed Dec 16 17:53:37 2009
@@ -539,8 +539,7 @@
     }
 
     // Handle the region itself.
-    if (isa<AllocaRegion>(R) || isa<SymbolicRegion>(R) ||
-        isa<ObjCObjectRegion>(R)) {
+    if (isa<AllocaRegion>(R) || isa<SymbolicRegion>(R)) {
       // Invalidate the region by setting its default value to
       // conjured symbol. The type of the symbol is irrelavant.
       DefinedOrUnknownSVal V = ValMgr.getConjuredSymbolVal(R, Ex, Ctx.IntTy,
@@ -744,7 +743,6 @@
     case MemRegion::ElementRegionKind:
     case MemRegion::FieldRegionKind:
     case MemRegion::ObjCIvarRegionKind:
-    case MemRegion::ObjCObjectRegionKind:
     case MemRegion::SymbolicRegionKind:
     case MemRegion::CXXObjectRegionKind:
       return UnknownVal();
@@ -868,7 +866,6 @@
     // Fall-through.
     case MemRegion::CompoundLiteralRegionKind:
     case MemRegion::FieldRegionKind:
-    case MemRegion::ObjCObjectRegionKind:
     case MemRegion::ObjCIvarRegionKind:
     case MemRegion::CXXObjectRegionKind:
       return UnknownVal();

Modified: cfe/trunk/lib/Analysis/Store.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/Store.cpp?rev=91572&r1=91571&r2=91572&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/Store.cpp (original)
+++ cfe/trunk/lib/Analysis/Store.cpp Wed Dec 16 17:53:37 2009
@@ -98,7 +98,6 @@
     }
 
     case MemRegion::StringRegionKind:
-    case MemRegion::ObjCObjectRegionKind:
       // FIXME: Need to handle arbitrary downcasts.
     case MemRegion::SymbolicRegionKind:
     case MemRegion::AllocaRegionKind:





More information about the cfe-commits mailing list