aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/RegionStore.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-09-29 03:34:03 +0000
committerTed Kremenek <kremenek@apple.com>2009-09-29 03:34:03 +0000
commita5971b3b18ee00f799c646644c7c04014b88fdcd (patch)
tree8702a3df777cdc7363137a7bb5126d24a157abac /lib/Analysis/RegionStore.cpp
parent69cff4e5deec39396f355ad7976d34d3f306a37d (diff)
Reapply most of r82939, but add a guard that FieldRegions and friends
are only specially treated by RegionStore::InvalidateRegion() when their super region is also invalidated. When this isn't the case, conjure a new symbol for a FieldRegion. Thanks to Zhongxing Xu and Daniel Dunbar for pointing out this issue. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83043 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/RegionStore.cpp')
-rw-r--r--lib/Analysis/RegionStore.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp
index da04d68dcf..3b27150baa 100644
--- a/lib/Analysis/RegionStore.cpp
+++ b/lib/Analysis/RegionStore.cpp
@@ -514,15 +514,20 @@ const GRState *RegionStoreManager::InvalidateRegion(const GRState *state,
continue;
}
- // FIXME: Special case FieldRegion/ElementRegion for more
- // efficient invalidation. We don't need to conjure symbols for
- // these regions in all cases.
-
// Get the old binding. Is it a region? If so, add it to the worklist.
if (const SVal *OldV = B.lookup(R)) {
if (const MemRegion *RV = OldV->getAsRegion())
WorkList.push_back(RV);
}
+
+ if ((isa<FieldRegion>(R)||isa<ElementRegion>(R)||isa<ObjCIvarRegion>(R))
+ && Visited[cast<SubRegion>(R)->getSuperRegion()]) {
+ // For fields and elements whose super region has also been invalidated,
+ // only remove the old binding. The super region will get set with a
+ // default value from which we can lazily derive a new symbolic value.
+ B = RBFactory.Remove(B, R);
+ continue;
+ }
// Invalidate the binding.
DefinedOrUnknownSVal V = ValMgr.getConjuredSymbolVal(R, Ex, T, Count);