forked from OSchip/llvm-project
Fix SpecificBumpPtrAllocator iteration.
Need to start from (char*)(Slab+1), and not from (char*)Slab+1. This fixes crashes in Win64 debug mode. Thanks to Nicolas Capens! llvm-svn: 100184
This commit is contained in:
parent
92452b9e12
commit
3645e95c91
|
@ -200,7 +200,7 @@ public:
|
||||||
while (Slab) {
|
while (Slab) {
|
||||||
char *End = Slab == Allocator.CurSlab ? Allocator.CurPtr :
|
char *End = Slab == Allocator.CurSlab ? Allocator.CurPtr :
|
||||||
(char *)Slab + Slab->Size;
|
(char *)Slab + Slab->Size;
|
||||||
for (char *Ptr = (char*)Slab+1; Ptr < End; Ptr += sizeof(T)) {
|
for (char *Ptr = (char*)(Slab+1); Ptr < End; Ptr += sizeof(T)) {
|
||||||
Ptr = Allocator.AlignPtr(Ptr, alignof<T>());
|
Ptr = Allocator.AlignPtr(Ptr, alignof<T>());
|
||||||
if (Ptr + sizeof(T) <= End)
|
if (Ptr + sizeof(T) <= End)
|
||||||
reinterpret_cast<T*>(Ptr)->~T();
|
reinterpret_cast<T*>(Ptr)->~T();
|
||||||
|
|
Loading…
Reference in New Issue