[llvm] r206448 - [Allocator] Make SpecificBumpPtrAllocator also movable and move
Chandler Carruth
chandlerc at gmail.com
Thu Apr 17 00:08:57 PDT 2014
Author: chandlerc
Date: Thu Apr 17 02:08:56 2014
New Revision: 206448
URL: http://llvm.org/viewvc/llvm-project?rev=206448&view=rev
Log:
[Allocator] Make SpecificBumpPtrAllocator also movable and move
assignable.
Modified:
llvm/trunk/include/llvm/Support/Allocator.h
Modified: llvm/trunk/include/llvm/Support/Allocator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Allocator.h?rev=206448&r1=206447&r2=206448&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Allocator.h (original)
+++ llvm/trunk/include/llvm/Support/Allocator.h Thu Apr 17 02:08:56 2014
@@ -365,9 +365,15 @@ template <typename T> class SpecificBump
public:
SpecificBumpPtrAllocator() : Allocator() {}
-
+ SpecificBumpPtrAllocator(SpecificBumpPtrAllocator &&Old)
+ : Allocator(std::move(Old.Allocator)) {}
~SpecificBumpPtrAllocator() { DestroyAll(); }
+ SpecificBumpPtrAllocator &operator=(SpecificBumpPtrAllocator &&RHS) {
+ Allocator = RHS.Allocator;
+ return *this;
+ }
+
/// Call the destructor of each allocated object and deallocate all but the
/// current slab and reset the current pointer to the beginning of it, freeing
/// all memory allocated so far.
@@ -400,8 +406,6 @@ public:
/// \brief Allocate space for an array of objects without constructing them.
T *Allocate(size_t num = 1) { return Allocator.Allocate<T>(num); }
-
-private:
};
} // end namespace llvm
More information about the llvm-commits
mailing list