[cfe-commits] r74665 - /cfe/trunk/lib/Analysis/RegionStore.cpp

Ted Kremenek kremenek at apple.com
Wed Jul 1 16:30:34 PDT 2009


Author: kremenek
Date: Wed Jul  1 18:30:34 2009
New Revision: 74665

URL: http://llvm.org/viewvc/llvm-project?rev=74665&view=rev
Log:
Minor code cleanup: pull variables into scope of 'if' statement, limiting their
actual lifetime to their logical lifetime.

Modified:
    cfe/trunk/lib/Analysis/RegionStore.cpp

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

==============================================================================
--- cfe/trunk/lib/Analysis/RegionStore.cpp (original)
+++ cfe/trunk/lib/Analysis/RegionStore.cpp Wed Jul  1 18:30:34 2009
@@ -990,13 +990,11 @@
 
   // Check if the region has a binding.
   RegionBindingsTy B = GetRegionBindings(state->getStore());
-  const SVal* V = B.lookup(R);
-  if (V)
+  if (const SVal* V = B.lookup(R))
     return *V;
 
-  const MemRegion* SuperR = R->getSuperRegion();
-  const SVal* D = state->get<RegionDefaultValue>(SuperR);
-  if (D) {
+  const MemRegion* superR = R->getSuperRegion();
+  if (const SVal* D = state->get<RegionDefaultValue>(superR)) {
     if (D->hasConjuredSymbol())
       return ValMgr.getRegionValueSymbolVal(R);
 
@@ -1389,19 +1387,19 @@
     }
     else {
       // Get the super region for R.
-      const MemRegion* SuperR = cast<SubRegion>(R)->getSuperRegion();
+      const MemRegion* superR = cast<SubRegion>(R)->getSuperRegion();
       
       // Get the current set of subregions for SuperR.
-      const SubRegionsTy* SRptr = SubRegMap.lookup(SuperR);
+      const SubRegionsTy* SRptr = SubRegMap.lookup(superR);
       SubRegionsTy SRs = SRptr ? *SRptr : SubRegF.GetEmptySet();
       
       // Add R to the subregions of SuperR.
-      SubRegMap = SubRegMapF.Add(SubRegMap, SuperR, SubRegF.Add(SRs, R));
+      SubRegMap = SubRegMapF.Add(SubRegMap, superR, SubRegF.Add(SRs, R));
       
       // Super region may be VarRegion or subregion of another VarRegion. Add it
       // to the work list.
-      if (isa<SubRegion>(SuperR))
-        IntermediateRoots.push_back(SuperR);
+      if (isa<SubRegion>(superR))
+        IntermediateRoots.push_back(superR);
     }
   }
   





More information about the cfe-commits mailing list