summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit75f2ca47877ee1ad07e8709ecd55186609082c57 (patch)
tree8288d8837775a8436de4516dfc50b8cba52c9495 /llvm/include
parent0a9bf4c0c501c5885f5a87aabe09f16ecf79a29d (diff)
downloadbcm5719-llvm-75f2ca47877ee1ad07e8709ecd55186609082c57.tar.gz
bcm5719-llvm-75f2ca47877ee1ad07e8709ecd55186609082c57.zip
[Allocator] Make SpecificBumpPtrAllocator also movable and move
assignable. llvm-svn: 206448
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Support/Allocator.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/include/llvm/Support/Allocator.h b/llvm/include/llvm/Support/Allocator.h
index cc3675c9380..cdd48e0ab03 100644
--- a/llvm/include/llvm/Support/Allocator.h
+++ b/llvm/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
OpenPOWER on IntegriCloud