]> granicus.if.org Git - clang/commitdiff
Fix crash in RegionStoreManager::Bind() by using 'getAs<PointerType>()' instead of...
authorTed Kremenek <kremenek@apple.com>
Thu, 24 Sep 2009 06:24:32 +0000 (06:24 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 24 Sep 2009 06:24:32 +0000 (06:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82686 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/RegionStore.cpp
test/Analysis/misc-ps-region-store.m

index 31f52a55b3d7d872cda63d621ff71172d0ab6e17..75907da55ecdf38680c62c01914468e469ac1597 100644 (file)
@@ -1322,7 +1322,7 @@ const GRState *RegionStoreManager::Bind(const GRState *state, Loc L, SVal V) {
     // Binding directly to a symbolic region should be treated as binding
     // to element 0.
     QualType T = SR->getSymbol()->getType(getContext());
-    T = cast<PointerType>(T)->getPointeeType();
+    T = T->getAs<PointerType>()->getPointeeType();
     R = GetElementZeroRegion(SR, T);
   }
 
index 569fc790d63ef42dcfcf3b9d12437ecc8fbee37b..c5be02c821f93f00eb2c4b223ebc3afe6741888b 100644 (file)
@@ -198,7 +198,8 @@ CGFloat rdar7242006_negative(CGFloat x) {
 // <rdar://problem/7249340> - Allow binding of values to symbolic regions.
 // This test case shows how RegionStore tracks the value bound to 'x'
 // after the assignment.
-void rdar_7249340(int *x) {
+typedef int* ptr_rdar_7249340;
+void rdar_7249340(ptr_rdar_7249340 x) {
   *x = 1;
   if (*x)
     return;