[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 00:35:24 PDT 2023

skan created this revision.
Herald added a subscriber: MatzeB.
Herald added a project: All.
skan requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

ScheduleDAG has derived classes ScheduleDAGVLIW and ScheduleDAGRRList,
which own resources that are freed in their destructors. Static analyzer
warns b/c they do not have user-written copy constructors.

According to the design of ScheduleDAG, it seems that it should always
be passed by reference. So I declare them as deleted in this patch.

  rG LLVM Github Monorepo



Index: llvm/include/llvm/CodeGen/ScheduleDAG.h
--- llvm/include/llvm/CodeGen/ScheduleDAG.h
+++ llvm/include/llvm/CodeGen/ScheduleDAG.h
@@ -568,6 +568,9 @@
     bool StressSched;
+    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.525969.patch
Type: text/x-patch
Size: 444 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230526/1cf089fe/attachment.bin>

More information about the llvm-commits mailing list