aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/RegionStore.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-05-08 21:49:54 +0000
committerTed Kremenek <kremenek@apple.com>2012-05-08 21:49:54 +0000
commit4213e389d6f8fa96ab30eec0d932e4e3eee32997 (patch)
tree75c94047d7f897e9880a5adaaa1114a52dab6148 /lib/StaticAnalyzer/Core/RegionStore.cpp
parent7dbbc2178fb487f3a8bff03a2c9e87f727bf2b98 (diff)
Having RegionStore lower field bindings to raw offsets, just like ElementRegions. This is a bit
disruptive, but it allows RegionStore to better "see" through casts that reinterpret arrays of values as structs. Fixes <rdar://problem/11405978>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156428 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/RegionStore.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/RegionStore.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/StaticAnalyzer/Core/RegionStore.cpp b/lib/StaticAnalyzer/Core/RegionStore.cpp
index bf79b9da0b..8b1371d28f 100644
--- a/lib/StaticAnalyzer/Core/RegionStore.cpp
+++ b/lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -81,14 +81,9 @@ public:
} // end anonymous namespace
BindingKey BindingKey::Make(const MemRegion *R, Kind k) {
- if (const ElementRegion *ER = dyn_cast<ElementRegion>(R)) {
- const RegionRawOffset &O = ER->getAsArrayOffset();
-
- // FIXME: There are some ElementRegions for which we cannot compute
- // raw offsets yet, including regions with symbolic offsets. These will be
- // ignored by the store.
- return BindingKey(O.getRegion(), O.getOffset().getQuantity(), k);
- }
+ const RegionOffset &RO = R->getAsOffset();
+ if (RO.getRegion())
+ return BindingKey(RO.getRegion(), RO.getOffset(), k);
return BindingKey(R, 0, k);
}
@@ -648,7 +643,7 @@ void invalidateRegionsWorker::VisitBinding(SVal V) {
for (RegionBindings::iterator RI = B.begin(), RE = B.end(); RI != RE; ++RI){
const SubRegion *baseR = dyn_cast<SubRegion>(RI.getKey().getRegion());
- if (baseR && baseR->isSubRegionOf(LazyR))
+ if (baseR && (baseR == LazyR || baseR->isSubRegionOf(LazyR)))
VisitBinding(RI.getData());
}