aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/Store.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-07-14 01:12:46 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-07-14 01:12:46 +0000
commit8203725f37fbb45ded343e4378247fee3389c0da (patch)
tree9747d8904df212fa9d678be2227c404d433fa1ff /lib/Analysis/Store.cpp
parent66ad201eb59147fb47816ce961430f05b28203b2 (diff)
Instead of recovering from a wrong invalidation, this patch aims to
invalidate the region correctly. It uses the cast-to type to invalidate the region when available. To avoid invalid cast-to type like 'void*' or 'id', region store now only records non-generic casts of regions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75580 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/Store.cpp')
-rw-r--r--lib/Analysis/Store.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Analysis/Store.cpp b/lib/Analysis/Store.cpp
index 7101b34477..50d0767f61 100644
--- a/lib/Analysis/Store.cpp
+++ b/lib/Analysis/Store.cpp
@@ -235,7 +235,14 @@ const GRState *StoreManager::InvalidateRegion(const GRState *state,
const TypedRegion *TR = cast<TypedRegion>(R);
- QualType T = TR->getValueType(Ctx);
+ QualType T;
+
+ // If the region is cast to another type, use that type.
+ if (const QualType *CastTy = getCastType(state, R)) {
+ assert(!(*CastTy)->isObjCObjectPointerType());
+ T = (*CastTy)->getAsPointerType()->getPointeeType();
+ } else
+ T = TR->getValueType(Ctx);
if (Loc::IsLocType(T) || (T->isIntegerType() && T->isScalarType())) {
SVal V = ValMgr.getConjuredSymbolVal(E, T, Count);