diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-08-02 04:12:53 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-08-02 04:12:53 +0000 |
commit | 9a108eb88f93c524dfa5fb2c3fea3896b1eb6525 (patch) | |
tree | d8181e605582ff800e8de0d0da56cb962a5226c7 /lib | |
parent | 5a23264452fbf8ad3c65e0869fa902f7a0e918a1 (diff) |
Fix regression in StoreManager::CastRegion() to always treat casts to
'void*' (or 'const void*') as an identity transformation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77860 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/Store.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Analysis/Store.cpp b/lib/Analysis/Store.cpp index bfcb0f41ca..fca69e69cb 100644 --- a/lib/Analysis/Store.cpp +++ b/lib/Analysis/Store.cpp @@ -71,13 +71,17 @@ StoreManager::CastRegion(const GRState *state, const MemRegion* R, // Now assume we are casting from pointer to pointer. Other cases should // already be handled. QualType PointeeTy = CastToTy->getAs<PointerType>()->getPointeeType(); + QualType CanonPointeeTy = Ctx.getCanonicalType(PointeeTy); + + // Handle casts to void*. We just pass the region through. + if (CanonPointeeTy.getUnqualifiedType() == Ctx.VoidTy) + return CastResult(state, R); - // Handle casts from compatible types or to void*. + // Handle casts from compatible types. if (R->isBoundable()) if (const TypedRegion *TR = dyn_cast<TypedRegion>(R)) { QualType ObjTy = Ctx.getCanonicalType(TR->getValueType(Ctx)); - QualType CanonPointeeTy = Ctx.getCanonicalType(PointeeTy); - if (CanonPointeeTy == ObjTy || CanonPointeeTy == Ctx.VoidTy) + if (CanonPointeeTy == ObjTy) return CastResult(state, R); } |