]> granicus.if.org Git - clang/commitdiff
Process array base expression of any type.
authorZhongxing Xu <xuzhongxing@gmail.com>
Thu, 13 Nov 2008 09:48:44 +0000 (09:48 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Thu, 13 Nov 2008 09:48:44 +0000 (09:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59240 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/RegionStore.cpp

index ec5acf57f4ea32d208dd5b3483a141efc224e58e..b09c49ec09350616a7bca2cb2c3cacd4618def1f 100644 (file)
@@ -186,6 +186,14 @@ SVal RegionStoreManager::getLValueElement(const GRState* St,
 
   loc::MemRegionVal& BaseL = cast<loc::MemRegionVal>(Base);
 
+  // Pointer of any type can be cast and used as array base. We do not support
+  // that case yet.
+  if (!isa<ElementRegion>(BaseL.getRegion())) {
+    // Record what we have seen in real code.
+    assert(isa<FieldRegion>(BaseL.getRegion()));
+    return UnknownVal();
+  }
+
   // We expect BaseR is an ElementRegion, not a base VarRegion.
 
   const ElementRegion* ElemR = cast<ElementRegion>(BaseL.getRegion());