[llvm] 1845d9d - [CGP] Disable default copy ctor and copy assignment operator for InstructionRemover

Bing1 Yu via llvm-commits llvm-commits at lists.llvm.org
Sat May 27 08:20:43 PDT 2023


Author: Bing1 Yu
Date: 2023-05-27T23:20:33+08:00
New Revision: 1845d9de187b726dfe074218377c3d77ce43277a

URL: https://github.com/llvm/llvm-project/commit/1845d9de187b726dfe074218377c3d77ce43277a
DIFF: https://github.com/llvm/llvm-project/commit/1845d9de187b726dfe074218377c3d77ce43277a.diff

LOG: [CGP] Disable default copy ctor and copy assignment operator for InstructionRemover

class InstructionRemover 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/D151543

Added: 
    

Modified: 
    llvm/lib/CodeGen/CodeGenPrepare.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index d806c7c3acfc..1f5a8d9f03e8 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -3062,6 +3062,9 @@ class TypePromotionTransaction {
 
     ~InstructionRemover() override { delete Replacer; }
 
+    InstructionRemover &operator=(const InstructionRemover &other) = delete;
+    InstructionRemover(const InstructionRemover &other) = delete;
+
     /// Resurrect the instruction and reassign it to the proper uses if
     /// new value was provided when build this action.
     void undo() override {


        


More information about the llvm-commits mailing list