From: Ted Kremenek Date: Wed, 5 Aug 2009 19:09:24 +0000 (+0000) Subject: Use feedback from RegionStoreSubRegionMap::add() to prune off adding a super X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d8c0192b0a4ef28b182a28486b02c3ab05aea76a;p=clang Use feedback from RegionStoreSubRegionMap::add() to prune off adding a super region to the worklist used to create the subregion map. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78228 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp index 70201759e1..398babc9d7 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -119,12 +119,16 @@ class VISIBILITY_HIDDEN RegionStoreSubRegionMap : public SubRegionMap { SetTy::Factory F; Map M; public: - void add(const MemRegion* Parent, const MemRegion* SubRegion) { + bool add(const MemRegion* Parent, const MemRegion* SubRegion) { Map::iterator I = M.find(Parent); - if (I == M.end()) + + if (I == M.end()) { M.insert(std::make_pair(Parent, F.Add(F.GetEmptySet(), SubRegion))); - else - I->second = F.Add(I->second, SubRegion); + return true; + } + + I->second = F.Add(I->second, SubRegion); + return false; } ~RegionStoreSubRegionMap() {} @@ -405,9 +409,9 @@ RegionStoreManager::getRegionStoreSubRegionMap(const GRState *state) { continue; const MemRegion *superR = R->getSuperRegion(); - M->add(superR, R); - if (const SubRegion *sr = dyn_cast(superR)) - WL.push_back(sr); + if (M->add(superR, R)) + if (const SubRegion *sr = dyn_cast(superR)) + WL.push_back(sr); } return M;