aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/RegionStore.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-06-19 04:51:14 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-06-19 04:51:14 +0000
commit005f07b874ae559047f6189e2f770739695f6779 (patch)
treedd5b9662912ec1660d6286b32e9915ec522ffaba /lib/Analysis/RegionStore.cpp
parent11e51106329c550d008fad2c657c053d81611ea8 (diff)
If the SymbolicRegion was cast to another type, use that type to create the
ElementRegion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73754 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/RegionStore.cpp')
-rw-r--r--lib/Analysis/RegionStore.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp
index af8c7c9a9b..6f316c9c59 100644
--- a/lib/Analysis/RegionStore.cpp
+++ b/lib/Analysis/RegionStore.cpp
@@ -749,9 +749,15 @@ SVal RegionStoreManager::EvalBinOp(const GRState *state,
// If the operand is a symbolic or alloca region, create the first element
// region on it.
if (const SymbolicRegion *SR = dyn_cast<SymbolicRegion>(MR)) {
- // Get symbol's type. It should be a pointer type.
- SymbolRef Sym = SR->getSymbol();
- QualType T = Sym->getType(getContext());
+ QualType T;
+ // If the SymbolicRegion was cast to another type, use that type.
+ if (const QualType *t = state->get<RegionCasts>(SR)) {
+ T = *t;
+ } else {
+ // Otherwise use the symbol's type.
+ SymbolRef Sym = SR->getSymbol();
+ T = Sym->getType(getContext());
+ }
QualType EleTy = T->getAsPointerType()->getPointeeType();
SVal ZeroIdx = ValMgr.makeZeroArrayIndex();