mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
Fix llvm::BumpPtrAllocatorImpl::Reset()
BumpPtrAllocator's Reset wouldn't clear CustomSizedSlabs if Slabs.size() == 0. Patch by Kal <b17c0de@gmail.com>! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237588 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -61,6 +61,13 @@ TEST(AllocatorTest, ThreeSlabs) {
|
||||
// again.
|
||||
TEST(AllocatorTest, TestReset) {
|
||||
BumpPtrAllocator Alloc;
|
||||
|
||||
// Allocate something larger than the SizeThreshold=4096.
|
||||
(void)Alloc.Allocate(5000, 1);
|
||||
Alloc.Reset();
|
||||
// Calling Reset should free all CustomSizedSlabs.
|
||||
EXPECT_EQ(0u, Alloc.GetNumSlabs());
|
||||
|
||||
Alloc.Allocate(3000, 1);
|
||||
EXPECT_EQ(1U, Alloc.GetNumSlabs());
|
||||
Alloc.Allocate(3000, 1);
|
||||
|
Reference in New Issue
Block a user