]> granicus.if.org Git - clang/commitdiff
Limit the use of BindDefault().
authorZhongxing Xu <xuzhongxing@gmail.com>
Tue, 1 Jun 2010 04:49:26 +0000 (04:49 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Tue, 1 Jun 2010 04:49:26 +0000 (04:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105265 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Checker/RegionStore.cpp

index 1603cc81a5940b76afc1ec0f30f48264657ae0f4..d9ad02a35c4d9683531ce3763c0e801981fbadc0 100644 (file)
@@ -280,8 +280,12 @@ public: // Part of public interface to class.
 
   Store Bind(Store store, Loc LV, SVal V);
 
+  // BindDefault is only used to initialize a region with a default value.
   Store BindDefault(Store store, const MemRegion *R, SVal V) {
-    return Add(GetRegionBindings(store), R, BindingKey::Default, V).getRoot();
+    RegionBindings B = GetRegionBindings(store);
+    assert(!Lookup(B, R, BindingKey::Default));
+    assert(!Lookup(B, R, BindingKey::Direct));
+    return Add(B, R, BindingKey::Default, V).getRoot();
   }
 
   Store BindCompoundLiteral(Store store, const CompoundLiteralExpr* CL,