]> granicus.if.org Git - clang/commitdiff
[analyzer] Remove strip of ElementRegion in CallEvent::invalidateRegions.
authorJordan Rose <jordan_rose@apple.com>
Wed, 20 Mar 2013 20:35:48 +0000 (20:35 +0000)
committerJordan Rose <jordan_rose@apple.com>
Wed, 20 Mar 2013 20:35:48 +0000 (20:35 +0000)
This is a bit of old code trying to deal with the fact that functions that
take pointers often use them to access an entire array via pointer
arithmetic. However, RegionStore already conservatively assumes you can use
pointer arithmetic to access any part of a region.

Some day we may want to go back to handling this specifically for calls,
but we can do that in the future.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177569 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/CallEvent.cpp

index c482978ca29b65c54efae2bfc29a12fd29f45ecb..d7e1b1253ec2669d69370854542b265181d1a20e 100644 (file)
@@ -163,32 +163,6 @@ ProgramStateRef CallEvent::invalidateRegions(unsigned BlockCount,
       continue;
 
     if (const MemRegion *R = V.getAsRegion()) {
-      // Invalidate the value of the variable passed by reference.
-
-      // Are we dealing with an ElementRegion?  If the element type is
-      // a basic integer type (e.g., char, int) and the underlying region
-      // is a variable region then strip off the ElementRegion.
-      // FIXME: We really need to think about this for the general case
-      //   as sometimes we are reasoning about arrays and other times
-      //   about (char*), etc., is just a form of passing raw bytes.
-      //   e.g., void *p = alloca(); foo((char*)p);
-      if (const ElementRegion *ER = dyn_cast<ElementRegion>(R)) {
-        // Checking for 'integral type' is probably too promiscuous, but
-        // we'll leave it in for now until we have a systematic way of
-        // handling all of these cases.  Eventually we need to come up
-        // with an interface to StoreManager so that this logic can be
-        // appropriately 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()->isIntegralOrEnumerationType()) {
-          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?
-      }
-
       // Mark this region for invalidation.  We batch invalidate regions
       // below for efficiency.
       RegionsToInvalidate.push_back(R);