aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-04-13 16:38:06 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-04-13 16:38:06 +0000
commitb0322e6ddfb7f56cb7e8a770ec307fdb00cd5437 (patch)
treeb3388d8e9fb22b8900aec30bcdb8ae958e380f89 /lib/Support
parentf3a3b0fc0e6be9c45add0aa6624f0cb900548dcc (diff)
downloadexternal_llvm-b0322e6ddfb7f56cb7e8a770ec307fdb00cd5437.zip
external_llvm-b0322e6ddfb7f56cb7e8a770ec307fdb00cd5437.tar.gz
external_llvm-b0322e6ddfb7f56cb7e8a770ec307fdb00cd5437.tar.bz2
BumpPtrAllocator::Reset() doesn't need to allocate anything. (Thanks, Jakob)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101138 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r--lib/Support/Allocator.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Support/Allocator.cpp b/lib/Support/Allocator.cpp
index ef40e47..90df262 100644
--- a/lib/Support/Allocator.cpp
+++ b/lib/Support/Allocator.cpp
@@ -70,8 +70,8 @@ void BumpPtrAllocator::DeallocateSlabs(MemSlab *Slab) {
/// Reset - Deallocate all but the current slab and reset the current pointer
/// to the beginning of it, freeing all memory allocated so far.
void BumpPtrAllocator::Reset() {
- if (!CurSlab) // Start a new slab if we didn't allocate one already.
- StartNewSlab();
+ if (!CurSlab)
+ return;
DeallocateSlabs(CurSlab->NextPtr);
CurSlab->NextPtr = 0;
CurPtr = (char*)(CurSlab + 1);