Add support for calloc() in MallocChecker. Patch by Jordy Rose, with my
modification.
llvm-svn: 105264
diff --git a/clang/lib/Checker/RegionStore.cpp b/clang/lib/Checker/RegionStore.cpp
index ddcb7be..1603cc8 100644
--- a/clang/lib/Checker/RegionStore.cpp
+++ b/clang/lib/Checker/RegionStore.cpp
@@ -280,6 +280,10 @@
Store Bind(Store store, Loc LV, SVal V);
+ Store BindDefault(Store store, const MemRegion *R, SVal V) {
+ return Add(GetRegionBindings(store), R, BindingKey::Default, V).getRoot();
+ }
+
Store BindCompoundLiteral(Store store, const CompoundLiteralExpr* CL,
const LocationContext *LC, SVal V);
@@ -1233,7 +1237,7 @@
if (D->isZeroConstant())
return ValMgr.makeZeroVal(Ty);
- if (D->isUnknown())
+ if (D->isUnknownOrUndef())
return *D;
assert(0 && "Unknown default value");
@@ -1456,6 +1460,7 @@
V);
}
+
Store RegionStoreManager::setImplicitDefaultValue(Store store,
const MemRegion *R,
QualType T) {