aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/RegionStore.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-07-14 20:48:22 +0000
committerTed Kremenek <kremenek@apple.com>2009-07-14 20:48:22 +0000
commit60fbe8f79838bff41fe9f5ed506ea9bc89d5d1df (patch)
treebe1cc0c2871a95df585e23f46ce0f854af43487c /lib/Analysis/RegionStore.cpp
parent03eacc746c90b7cfa8d8cd992c67f5c2659d4822 (diff)
Enhance RegionStoreManager to handle 'Retrieve's from SymbolicRegions. We do this by silently wrapping the region with an ElementRegion. This fixes the failures in misc-ps-region-store.m.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75679 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/RegionStore.cpp')
-rw-r--r--lib/Analysis/RegionStore.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp
index 577ace306b..4e83720f9f 100644
--- a/lib/Analysis/RegionStore.cpp
+++ b/lib/Analysis/RegionStore.cpp
@@ -799,9 +799,15 @@ SVal RegionStoreManager::Retrieve(const GRState *state, Loc L, QualType T) {
// char* p = alloca();
// read(p);
// c = *p;
- if (isa<SymbolicRegion>(MR) || isa<AllocaRegion>(MR))
+ if (isa<AllocaRegion>(MR))
return UnknownVal();
-
+
+ if (isa<SymbolicRegion>(MR)) {
+ ASTContext &Ctx = getContext();
+ SVal idx = ValMgr.makeIntVal(0, Ctx.IntTy);
+ MR = MRMgr.getElementRegion(T, idx, MR, Ctx);
+ }
+
// FIXME: Perhaps this method should just take a 'const MemRegion*' argument
// instead of 'Loc', and have the other Loc cases handled at a higher level.
const TypedRegion *R = cast<TypedRegion>(MR);