When stripping element regions for invalidating region values, treat FieldRegions and ObjCIvarRegions as "base" regions in addition to VarRegions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71488 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 29a28c1..bc14007 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -2673,10 +2673,13 @@
             // approriately delegated to the respective StoreManagers while
             // still allowing us to do checker-specific logic (e.g.,
             // invalidating reference counts), probably via callbacks.            
-            if (ER->getElementType()->isIntegralType())
-              if (const VarRegion *superReg =
-                  dyn_cast<VarRegion>(ER->getSuperRegion()))
-                R = superReg;
+            if (ER->getElementType()->isIntegralType()) {
+              const MemRegion *superReg = ER->getSuperRegion();
+              if (isa<VarRegion>(superReg) || isa<FieldRegion>(superReg) ||
+                  isa<ObjCIvarRegion>(superReg))
+                R = cast<TypedRegion>(superReg);
+            }
+
             // FIXME: What about layers of ElementRegions?
           }