[llvm-commits] [llvm] r101138 - /llvm/trunk/lib/Support/Allocator.cpp

Benjamin Kramer benny.kra at googlemail.com
Tue Apr 13 09:38:07 PDT 2010


Author: d0k
Date: Tue Apr 13 11:38:06 2010
New Revision: 101138

URL: http://llvm.org/viewvc/llvm-project?rev=101138&view=rev
Log:
BumpPtrAllocator::Reset() doesn't need to allocate anything. (Thanks, Jakob)

Modified:
    llvm/trunk/lib/Support/Allocator.cpp

Modified: llvm/trunk/lib/Support/Allocator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Allocator.cpp?rev=101138&r1=101137&r2=101138&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Allocator.cpp (original)
+++ llvm/trunk/lib/Support/Allocator.cpp Tue Apr 13 11:38:06 2010
@@ -70,8 +70,8 @@
 /// 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);





More information about the llvm-commits mailing list