]> granicus.if.org Git - clang/commitdiff
RegionStore: revert to the default value approach for array initialization.
authorZhongxing Xu <xuzhongxing@gmail.com>
Wed, 24 Jun 2009 00:56:31 +0000 (00:56 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Wed, 24 Jun 2009 00:56:31 +0000 (00:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74043 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/RegionStore.cpp

index 77f5b7cb39bbd9ffe3be163608d9177ed3fb452e..ab60ff32adaf1bfc14aa7b5bcd445b152dc6e855 100644 (file)
@@ -1127,15 +1127,12 @@ const GRState *RegionStoreManager::BindArray(const GRState *state,
       state = Bind(state, ValMgr.makeLoc(ER), *VI);
   }
 
-  // If the init list is shorter than the array length, bind the rest elements
-  // to 0.
-  if (ElementTy->isIntegerType()) {
-    while (i < Size) {
-      SVal Idx = ValMgr.makeIntVal(i);
-      ElementRegion* ER = MRMgr.getElementRegion(ElementTy, Idx,R,getContext());
+  // If the init list is shorter than the array length, set the array default
+  // value.
+  if (i < Size) {
+    if (ElementTy->isIntegerType()) {
       SVal V = ValMgr.makeZeroVal(ElementTy);
-      state = Bind(state, ValMgr.makeLoc(ER), V);
-      ++i;
+      state = setDefaultValue(state, R, V);
     }
   }