summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-04-17 07:08:56 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-04-17 07:08:56 +0000
commitd7eaf4f3253cdbf83389da4058bd78be381efac8 (patch)
tree6296521f9dabd6d68eff7daf08742463f97d71e1 /include
parent61070beae0596ce066b8826e605443ca44fd9bdd (diff)
downloadllvm-d7eaf4f3253cdbf83389da4058bd78be381efac8.tar.gz
llvm-d7eaf4f3253cdbf83389da4058bd78be381efac8.tar.bz2
llvm-d7eaf4f3253cdbf83389da4058bd78be381efac8.tar.xz
[Allocator] Make SpecificBumpPtrAllocator also movable and move
assignable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206448 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Support/Allocator.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/llvm/Support/Allocator.h b/include/llvm/Support/Allocator.h
index cc3675c938..cdd48e0ab0 100644
--- a/include/llvm/Support/Allocator.h
+++ b/include/llvm/Support/Allocator.h
@@ -365,9 +365,15 @@ template <typename T> class SpecificBumpPtrAllocator {
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