[llvm] 466678b - [CodeGen] Disable default copy ctor and copy assignment operator for class Array

Bing1 Yu via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 6 23:32:13 PDT 2023


Author: Bing1 Yu
Date: 2023-06-07T14:32:06+08:00
New Revision: 466678b5202052dcd38fdfc3f764fb5d5de7c34b

URL: https://github.com/llvm/llvm-project/commit/466678b5202052dcd38fdfc3f764fb5d5de7c34b
DIFF: https://github.com/llvm/llvm-project/commit/466678b5202052dcd38fdfc3f764fb5d5de7c34b.diff

LOG: [CodeGen] Disable default copy ctor and copy assignment operator for class Array

class Array manages resources such as dynamically allocated memory, it's generally a good practice to either implement a custom copy constructor or disable the default one.

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D152231

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 81003455da424..e68d64820a72c 100644
--- a/llvm/include/llvm/CodeGen/LiveIntervalUnion.h
+++ b/llvm/include/llvm/CodeGen/LiveIntervalUnion.h
@@ -174,6 +174,8 @@ class LiveIntervalUnion {
 
   public:
     Array() = default;
+    Array &operator=(const Array &other) = delete;
+    Array(const Array &other) = delete;
     ~Array() { clear(); }
 
     // Initialize the array to have Size entries.


        


More information about the llvm-commits mailing list