[PATCH] D151538: [CodeGen][NFC] Declare copy constructor & copy assignment as deleted for ScheduleDAG

Kan Shengchen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 26 03:51:07 PDT 2023


skan updated this revision to Diff 526015.
skan added a comment.

Address review comments: Add comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151538/new/

https://reviews.llvm.org/D151538

Files:
  llvm/include/llvm/CodeGen/ScheduleDAG.h


Index: llvm/include/llvm/CodeGen/ScheduleDAG.h
===================================================================
--- llvm/include/llvm/CodeGen/ScheduleDAG.h
+++ llvm/include/llvm/CodeGen/ScheduleDAG.h
@@ -568,6 +568,15 @@
     bool StressSched;
 #endif
 
+    // This class is designed to be passed by reference only. Copy constructor
+    // is declared as deleted here to make the derived classes have deleted
+    // implicit-declared copy constructor, which suppresses the warnings from
+    // static analyzer when the derived classes own resources that are freed in
+    // their destructors, but don't have user-written copy constructors (rule
+    // of three).
+    ScheduleDAG(const ScheduleDAG &) = delete;
+    ScheduleDAG &operator=(const ScheduleDAG &) = delete;
+
     explicit ScheduleDAG(MachineFunction &mf);
 
     virtual ~ScheduleDAG();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151538.526015.patch
Type: text/x-patch
Size: 860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230526/22b76d54/attachment.bin>


More information about the llvm-commits mailing list