summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-08-02 04:12:53 +0000
committerTed Kremenek <kremenek@apple.com>2009-08-02 04:12:53 +0000
commit9419876e59258b10293ad6d3e11ad6d2f8ac81a4 (patch)
tree4de415689b478e018fdbc63c3eb03d0d6e4635ac /clang/lib/Analysis
parent2eaf396c41527a343ddab3b681b0920f51f6d5f4 (diff)
downloadbcm5719-llvm-9419876e59258b10293ad6d3e11ad6d2f8ac81a4.tar.gz
bcm5719-llvm-9419876e59258b10293ad6d3e11ad6d2f8ac81a4.zip
Fix regression in StoreManager::CastRegion() to always treat casts to
'void*' (or 'const void*') as an identity transformation. llvm-svn: 77860
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r--clang/lib/Analysis/Store.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Analysis/Store.cpp b/clang/lib/Analysis/Store.cpp
index bfcb0f41ca3..fca69e69cb3 100644
--- a/clang/lib/Analysis/Store.cpp
+++ b/clang/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);
}
OpenPOWER on IntegriCloud