r180181 - [analyzer] Refactoring + explanatory comment.

Anton Yartsev anton.yartsev at gmail.com
Wed Apr 24 03:24:38 PDT 2013


Author: ayartsev
Date: Wed Apr 24 05:24:38 2013
New Revision: 180181

URL: http://llvm.org/viewvc/llvm-project?rev=180181&view=rev
Log:
[analyzer] Refactoring + explanatory comment.

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=180181&r1=180180&r2=180181&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp Wed Apr 24 05:24:38 2013
@@ -1011,6 +1011,7 @@ void invalidateRegionsWorker::VisitClust
     for (ClusterBindings::iterator I = C->begin(), E = C->end(); I != E; ++I)
       VisitBinding(I.getData());
 
+    // Invalidate the contents of a non-const base region.
     if (!IsConst)
       B = B.remove(baseR);
   }
@@ -1043,18 +1044,19 @@ void invalidateRegionsWorker::VisitClust
   }
 
   // Symbolic region?
-  SymbolRef RegionSym = 0;
-  if (const SymbolicRegion *SR = dyn_cast<SymbolicRegion>(baseR))
-    RegionSym = SR->getSymbol();
+  if (const SymbolicRegion *SR = dyn_cast<SymbolicRegion>(baseR)) {
+    SymbolRef RegionSym = SR->getSymbol();
 
-  if (IsConst) {
     // Mark that symbol touched by the invalidation.
-    ConstIS.insert(RegionSym);
-    return;
+    if (IsConst)
+      ConstIS.insert(RegionSym);
+    else
+      IS.insert(RegionSym);
   }
-  
-  // Mark that symbol touched by the invalidation.
-  IS.insert(RegionSym);
+
+  // Nothing else should be done for a const region.
+  if (IsConst)
+    return;
 
   // Otherwise, we have a normal data region. Record that we touched the region.
   if (Regions)





More information about the cfe-commits mailing list