summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-08-05 19:09:24 +0000
committerTed Kremenek <kremenek@apple.com>2009-08-05 19:09:24 +0000
commit844a729d97cd0930926c642ab53a3da5af299027 (patch)
treedb812d5957dc17e7eeace945749dd9be2124c4fe /clang
parentdabf71f171aa98106cfbb16b1b4655d29cf9372b (diff)
downloadbcm5719-llvm-844a729d97cd0930926c642ab53a3da5af299027.tar.gz
bcm5719-llvm-844a729d97cd0930926c642ab53a3da5af299027.zip
Use feedback from RegionStoreSubRegionMap::add() to prune off adding a super
region to the worklist used to create the subregion map. llvm-svn: 78228
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Analysis/RegionStore.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/clang/lib/Analysis/RegionStore.cpp b/clang/lib/Analysis/RegionStore.cpp
index 70201759e10..398babc9d7f 100644
--- a/clang/lib/Analysis/RegionStore.cpp
+++ b/clang/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<SubRegion>(superR))
- WL.push_back(sr);
+ if (M->add(superR, R))
+ if (const SubRegion *sr = dyn_cast<SubRegion>(superR))
+ WL.push_back(sr);
}
return M;
OpenPOWER on IntegriCloud