[PATCH] D97324: [NFC] Make TrailingObjects non-copyable/non-movable

Erich Keane via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 23 12:02:15 PST 2021


erichkeane created this revision.
erichkeane added reviewers: jyknight, jfb, hubert.reinterpretcast.
Herald added a subscriber: dexonsmith.
erichkeane requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This got me pretty recently... TrailingObjects cannot be copied or
moved, since they need to be pre-allocated. This patch deletes the copy
and move operations (plus re-adds the default ctor).


https://reviews.llvm.org/D97324

Files:
  llvm/include/llvm/Support/TrailingObjects.h


Index: llvm/include/llvm/Support/TrailingObjects.h
===================================================================
--- llvm/include/llvm/Support/TrailingObjects.h
+++ llvm/include/llvm/Support/TrailingObjects.h
@@ -345,6 +345,12 @@
     return sizeof(BaseTy) + ParentType::additionalSizeToAllocImpl(0, Counts...);
   }
 
+  TrailingObjects() = default;
+  TrailingObjects(const TrailingObjects &) = delete;
+  TrailingObjects(TrailingObjects &&) = delete;
+  TrailingObjects &operator=(const TrailingObjects &) = delete;
+  TrailingObjects &operator=(TrailingObjects &&) = delete;
+
   /// A type where its ::with_counts template member has a ::type member
   /// suitable for use as uninitialized storage for an object with the given
   /// trailing object counts. The template arguments are similar to those


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97324.325867.patch
Type: text/x-patch
Size: 814 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210223/1315bf0f/attachment.bin>


More information about the llvm-commits mailing list