summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTorok Edwin <edwintorok@gmail.com>2009-07-21 18:01:37 +0000
committerTorok Edwin <edwintorok@gmail.com>2009-07-21 18:01:37 +0000
commitd06c59821a1ca0191ea8a326a18509808a02ed03 (patch)
tree91ba893767424d504886418055d476c15bbb6679 /include
parente4d8408c572a3667e49d32b95c31b455bcec4a45 (diff)
downloadexternal_llvm-d06c59821a1ca0191ea8a326a18509808a02ed03.zip
external_llvm-d06c59821a1ca0191ea8a326a18509808a02ed03.tar.gz
external_llvm-d06c59821a1ca0191ea8a326a18509808a02ed03.tar.bz2
Add freed memory poisoning in !NDEBUG mode for DenseMap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76597 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ADT/DenseMap.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h
index e18be89..c8a90eb 100644
--- a/include/llvm/ADT/DenseMap.h
+++ b/include/llvm/ADT/DenseMap.h
@@ -17,6 +17,7 @@
#include "llvm/Support/PointerLikeTypeTraits.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>
+#include <cstring>
#include <utility>
#include <new>
@@ -160,6 +161,9 @@ public:
P->second.~ValueT();
P->first.~KeyT();
}
+#ifndef NDEBUG
+ memset(Buckets, 0x5a, sizeof(BucketT)*NumBuckets);
+#endif
operator delete(Buckets);
}
@@ -318,8 +322,12 @@ private:
NumEntries = other.NumEntries;
NumTombstones = other.NumTombstones;
- if (NumBuckets)
+ if (NumBuckets) {
+#ifndef NDEBUG
+ memset(Buckets, 0x5a, sizeof(BucketT)*NumBuckets);
+#endif
operator delete(Buckets);
+ }
Buckets = static_cast<BucketT*>(operator new(sizeof(BucketT) *
other.NumBuckets));
@@ -465,6 +473,9 @@ private:
B->first.~KeyT();
}
+#ifndef NDEBUG
+ memset(OldBuckets, 0x5a, sizeof(BucketT)*OldNumBuckets);
+#endif
// Free the old table.
operator delete(OldBuckets);
}
@@ -495,6 +506,9 @@ private:
B->first.~KeyT();
}
+#ifndef NDEBUG
+ memset(OldBuckets, 0x5a, sizeof(BucketT)*OldNumBuckets);
+#endif
// Free the old table.
operator delete(OldBuckets);