[llvm] 75ec65e - [CodeGen] LiveIntervalUnions::Array Implement move constructor (#111357)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 02:54:02 PDT 2024


Author: Akshat Oke
Date: 2024-10-22T15:23:58+05:30
New Revision: 75ec65e384d73d97bab2f1a4e273df4b622af4c4

URL: https://github.com/llvm/llvm-project/commit/75ec65e384d73d97bab2f1a4e273df4b622af4c4
DIFF: https://github.com/llvm/llvm-project/commit/75ec65e384d73d97bab2f1a4e273df4b622af4c4.diff

LOG: [CodeGen] LiveIntervalUnions::Array  Implement move constructor (#111357)

Solves the double free error.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/LiveIntervalUnion.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/LiveIntervalUnion.h b/llvm/include/llvm/CodeGen/LiveIntervalUnion.h
index 81003455da4241..cc0f2a45bb182c 100644
--- a/llvm/include/llvm/CodeGen/LiveIntervalUnion.h
+++ b/llvm/include/llvm/CodeGen/LiveIntervalUnion.h
@@ -176,6 +176,13 @@ class LiveIntervalUnion {
     Array() = default;
     ~Array() { clear(); }
 
+    Array(Array &&Other) : Size(Other.Size), LIUs(Other.LIUs) {
+      Other.Size = 0;
+      Other.LIUs = nullptr;
+    }
+
+    Array(const Array &) = delete;
+
     // Initialize the array to have Size entries.
     // Reuse an existing allocation if the size matches.
     void init(LiveIntervalUnion::Allocator&, unsigned Size);


        


More information about the llvm-commits mailing list