[llvm-branch-commits] [llvm] [Support] Recycler: Implement move constructor (PR #120555)

Akshat Oke via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Dec 19 03:33:54 PST 2024


https://github.com/optimisan created https://github.com/llvm/llvm-project/pull/120555

None

>From 982ad41024bc268a0a20c2458402035ed4ef0045 Mon Sep 17 00:00:00 2001
From: Akshat Oke <Akshat.Oke at amd.com>
Date: Thu, 19 Dec 2024 06:57:46 +0000
Subject: [PATCH] [Support] Recycler: Implement move constructor

---
 llvm/include/llvm/Support/Recycler.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/llvm/include/llvm/Support/Recycler.h b/llvm/include/llvm/Support/Recycler.h
index bbd9ae321ae30c..693c6559ff2fdc 100644
--- a/llvm/include/llvm/Support/Recycler.h
+++ b/llvm/include/llvm/Support/Recycler.h
@@ -60,6 +60,10 @@ class Recycler {
     // clear() before deleting the Recycler.
     assert(!FreeList && "Non-empty recycler deleted!");
   }
+  Recycler(const Recycler &) = delete;
+  Recycler(Recycler &&Other)
+      : FreeList(std::exchange(Other.FreeList, nullptr)) {}
+  Recycler() = default;
 
   /// clear - Release all the tracked allocations to the allocator. The
   /// recycler must be free of any tracked allocations before being



More information about the llvm-branch-commits mailing list