From 8b2ba3195a6c6cffdbba05d9d1d809c9b808509f Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Wed, 1 Jul 2009 23:30:34 +0000 Subject: [PATCH] Minor code cleanup: pull variables into scope of 'if' statement, limiting their actual lifetime to their logical lifetime. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74665 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/RegionStore.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp index bc83d1636d..dc9a2be628 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -990,13 +990,11 @@ SVal RegionStoreManager::RetrieveField(const GRState* state, // 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(SuperR); - if (D) { + const MemRegion* superR = R->getSuperRegion(); + if (const SVal* D = state->get(superR)) { if (D->hasConjuredSymbol()) return ValMgr.getRegionValueSymbolVal(R); @@ -1389,19 +1387,19 @@ Store RegionStoreManager::RemoveDeadBindings(const GRState *state, Stmt* Loc, } else { // Get the super region for R. - const MemRegion* SuperR = cast(R)->getSuperRegion(); + const MemRegion* superR = cast(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(SuperR)) - IntermediateRoots.push_back(SuperR); + if (isa(superR)) + IntermediateRoots.push_back(superR); } } -- 2.40.0