r179555 - [analyzer] Be lazy about struct/array global invalidation too.

Jordan Rose jordan_rose at apple.com
Mon Apr 15 13:39:48 PDT 2013


Author: jrose
Date: Mon Apr 15 15:39:48 2013
New Revision: 179555

URL: http://llvm.org/viewvc/llvm-project?rev=179555&view=rev
Log:
[analyzer] Be lazy about struct/array global invalidation too.

Structs and arrays can take advantage of the single top-level global
symbol optimization (described in the previous commit) just as well
as scalars.

No intended behavioral change.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp?rev=179555&r1=179554&r2=179555&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp Mon Apr 15 15:39:48 2013
@@ -1040,7 +1040,13 @@ void invalidateRegionsWorker::VisitClust
   const TypedValueRegion *TR = cast<TypedValueRegion>(baseR);
   QualType T = TR->getValueType();
 
-    // Invalidate the binding.
+  if (isInitiallyIncludedGlobalRegion(baseR)) {
+    // If the region is a global and we are invalidating all globals,
+    // erasing the entry is good enough.  This causes all globals to be lazily
+    // symbolicated from the same base symbol.
+    return;
+  }
+
   if (T->isStructureOrClassType()) {
     // Invalidate the region by setting its default value to
     // conjured symbol. The type of the symbol is irrelavant.
@@ -1058,15 +1064,6 @@ void invalidateRegionsWorker::VisitClust
     B = B.addBinding(baseR, BindingKey::Default, V);
     return;
   }
-  
-  if (isInitiallyIncludedGlobalRegion(baseR)) {
-    // If the region is a global and we are invalidating all globals,
-    // just erase the entry.  This causes all globals to be lazily
-    // symbolicated from the same base symbol.
-    B = B.removeBinding(baseR);
-    return;
-  }
-  
 
   DefinedOrUnknownSVal V = svalBuilder.conjureSymbolVal(baseR, Ex, LCtx,
                                                         T,Count);





More information about the cfe-commits mailing list