diff options
| author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-06-19 04:51:14 +0000 |
|---|---|---|
| committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-06-19 04:51:14 +0000 |
| commit | cc4576225324a683f446d2f0c60ed90fe34ee7a5 (patch) | |
| tree | aa3c22cd9c786e48cb36580931ca80dd4b89059d /clang/lib/Analysis/RegionStore.cpp | |
| parent | 707cbc41264e76bbc47a22ee7c54036e32b545d1 (diff) | |
| download | bcm5719-llvm-cc4576225324a683f446d2f0c60ed90fe34ee7a5.tar.gz bcm5719-llvm-cc4576225324a683f446d2f0c60ed90fe34ee7a5.zip | |
If the SymbolicRegion was cast to another type, use that type to create the
ElementRegion.
llvm-svn: 73754
Diffstat (limited to 'clang/lib/Analysis/RegionStore.cpp')
| -rw-r--r-- | clang/lib/Analysis/RegionStore.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/Analysis/RegionStore.cpp b/clang/lib/Analysis/RegionStore.cpp index af8c7c9a9b2..6f316c9c592 100644 --- a/clang/lib/Analysis/RegionStore.cpp +++ b/clang/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(); |

