[llvm] af4451e - [NFC] Make TrailingObjects non-copyable/non-movable

Erich Keane via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 23 16:30:20 PST 2021


Author: Erich Keane
Date: 2021-02-23T16:30:13-08:00
New Revision: af4451eb4f38ce492ca38add91c8378f32b93eca

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

LOG: [NFC] Make TrailingObjects non-copyable/non-movable

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).

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/TrailingObjects.h b/llvm/include/llvm/Support/TrailingObjects.h
index 0d9c4503aa9b..aaee0c4a3fc0 100644
--- a/llvm/include/llvm/Support/TrailingObjects.h
+++ b/llvm/include/llvm/Support/TrailingObjects.h
@@ -345,6 +345,12 @@ class TrailingObjects : private trailing_objects_internal::TrailingObjectsImpl<
     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


        


More information about the llvm-commits mailing list