mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-08 19:25:47 +00:00
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
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
#include "llvm/Support/PointerLikeTypeTraits.h"
|
#include "llvm/Support/PointerLikeTypeTraits.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <cstring>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
@@ -160,6 +161,9 @@ public:
|
|||||||
P->second.~ValueT();
|
P->second.~ValueT();
|
||||||
P->first.~KeyT();
|
P->first.~KeyT();
|
||||||
}
|
}
|
||||||
|
#ifndef NDEBUG
|
||||||
|
memset(Buckets, 0x5a, sizeof(BucketT)*NumBuckets);
|
||||||
|
#endif
|
||||||
operator delete(Buckets);
|
operator delete(Buckets);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,8 +322,12 @@ private:
|
|||||||
NumEntries = other.NumEntries;
|
NumEntries = other.NumEntries;
|
||||||
NumTombstones = other.NumTombstones;
|
NumTombstones = other.NumTombstones;
|
||||||
|
|
||||||
if (NumBuckets)
|
if (NumBuckets) {
|
||||||
|
#ifndef NDEBUG
|
||||||
|
memset(Buckets, 0x5a, sizeof(BucketT)*NumBuckets);
|
||||||
|
#endif
|
||||||
operator delete(Buckets);
|
operator delete(Buckets);
|
||||||
|
}
|
||||||
Buckets = static_cast<BucketT*>(operator new(sizeof(BucketT) *
|
Buckets = static_cast<BucketT*>(operator new(sizeof(BucketT) *
|
||||||
other.NumBuckets));
|
other.NumBuckets));
|
||||||
|
|
||||||
@@ -465,6 +473,9 @@ private:
|
|||||||
B->first.~KeyT();
|
B->first.~KeyT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
memset(OldBuckets, 0x5a, sizeof(BucketT)*OldNumBuckets);
|
||||||
|
#endif
|
||||||
// Free the old table.
|
// Free the old table.
|
||||||
operator delete(OldBuckets);
|
operator delete(OldBuckets);
|
||||||
}
|
}
|
||||||
@@ -495,6 +506,9 @@ private:
|
|||||||
B->first.~KeyT();
|
B->first.~KeyT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
memset(OldBuckets, 0x5a, sizeof(BucketT)*OldNumBuckets);
|
||||||
|
#endif
|
||||||
// Free the old table.
|
// Free the old table.
|
||||||
operator delete(OldBuckets);
|
operator delete(OldBuckets);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user