diff options
author | Hans Wennborg <hans@hanshq.net> | 2015-05-18 16:54:17 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2015-05-18 16:54:17 +0000 |
commit | da5ddff74af0d5693771b027aa179d8983a0d6b4 (patch) | |
tree | 4cec0c04cfdd33d420403e8f4bdfeb8a850ecdb6 /llvm/unittests/Support/AllocatorTest.cpp | |
parent | 715b27f0588747f38ef4932ce1e54dc42c5962e4 (diff) | |
download | bcm5719-llvm-da5ddff74af0d5693771b027aa179d8983a0d6b4.tar.gz bcm5719-llvm-da5ddff74af0d5693771b027aa179d8983a0d6b4.zip |
Fix llvm::BumpPtrAllocatorImpl::Reset()
BumpPtrAllocator's Reset wouldn't clear CustomSizedSlabs if Slabs.size() == 0.
Patch by Kal <b17c0de@gmail.com>!
llvm-svn: 237588
Diffstat (limited to 'llvm/unittests/Support/AllocatorTest.cpp')
-rw-r--r-- | llvm/unittests/Support/AllocatorTest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/unittests/Support/AllocatorTest.cpp b/llvm/unittests/Support/AllocatorTest.cpp index 7f15776d6f0..38c7fcba8af 100644 --- a/llvm/unittests/Support/AllocatorTest.cpp +++ b/llvm/unittests/Support/AllocatorTest.cpp @@ -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); |