Mark unimplemented copy constructors and copy assignment operators as LLVM_DELETED_FU...
authorCraig Topper <craig.topper@gmail.com>
Mon, 17 Sep 2012 06:31:17 +0000 (06:31 +0000)
committerCraig Topper <craig.topper@gmail.com>
Mon, 17 Sep 2012 06:31:17 +0000 (06:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164014 91177308-0d34-0410-b5e6-96231b3b80d8

12 files changed:
include/llvm/ADT/ImmutableList.h
include/llvm/ADT/ImmutableMap.h
include/llvm/ADT/ImmutableSet.h
include/llvm/ADT/OwningPtr.h
include/llvm/ADT/ScopedHashTable.h
include/llvm/ADT/SparseSet.h
include/llvm/ADT/ValueMap.h
include/llvm/ADT/ilist.h
include/llvm/Support/FileOutputBuffer.h
include/llvm/Support/MutexGuard.h
include/llvm/Support/Registry.h
include/llvm/Support/ValueHandle.h

index d7c0074a9f0827e83f5b9a07abd06a07ada6e095..20bdd903f7a544a570566d07d64c6a7471bdfbe0 100644 (file)
@@ -33,9 +33,8 @@ class ImmutableListImpl : public FoldingSetNode {
 
   friend class ImmutableListFactory<T>;
 
-  // Do not implement.
-  void operator=(const ImmutableListImpl&);
-  ImmutableListImpl(const ImmutableListImpl&);
+  void operator=(const ImmutableListImpl&) LLVM_DELETED_FUNCTION;
+  ImmutableListImpl(const ImmutableListImpl&) LLVM_DELETED_FUNCTION;
 
 public:
   const T& getHead() const { return Head; }
index 8346ffabff76a8cc2bd838dda0899f0904ac302f..4883c5ba0a6b0e2e56fcd3eb0601914127826aaf 100644 (file)
@@ -122,8 +122,8 @@ public:
     }
 
   private:
-    Factory(const Factory& RHS); // DO NOT IMPLEMENT
-    void operator=(const Factory& RHS); // DO NOT IMPLEMENT
+    Factory(const Factory& RHS) LLVM_DELETED_FUNCTION;
+    void operator=(const Factory& RHS) LLVM_DELETED_FUNCTION;
   };
 
   bool contains(key_type_ref K) const {
index 5877f272140a0d43f0adb627668fae56b716fab2..261d0494e2d6c5b185ed0a2acb45e218f0a2445f 100644 (file)
@@ -1007,8 +1007,8 @@ public:
     }
 
   private:
-    Factory(const Factory& RHS); // DO NOT IMPLEMENT
-    void operator=(const Factory& RHS); // DO NOT IMPLEMENT
+    Factory(const Factory& RHS) LLVM_DELETED_FUNCTION;
+    void operator=(const Factory& RHS) LLVM_DELETED_FUNCTION;
   };
 
   friend class Factory;
index 6d9c30597789365a6fd539b4c2ab3c2eb2d3e14a..ea9495d38693e6ddc2f90ef3c6265f685a1a95c4 100644 (file)
@@ -14,6 +14,7 @@
 #ifndef LLVM_ADT_OWNING_PTR_H
 #define LLVM_ADT_OWNING_PTR_H
 
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <cstddef>
 
@@ -25,8 +26,8 @@ namespace llvm {
 /// pointee object can be taken away from OwningPtr by using the take method.
 template<class T>
 class OwningPtr {
-  OwningPtr(OwningPtr const &);             // DO NOT IMPLEMENT
-  OwningPtr &operator=(OwningPtr const &);  // DO NOT IMPLEMENT
+  OwningPtr(OwningPtr const &) LLVM_DELETED_FUNCTION;
+  OwningPtr &operator=(OwningPtr const &) LLVM_DELETED_FUNCTION;
   T *Ptr;
 public:
   explicit OwningPtr(T *P = 0) : Ptr(P) {}
@@ -79,8 +80,8 @@ inline void swap(OwningPtr<T> &a, OwningPtr<T> &b) {
 ///  functionality as OwningPtr, except that it works for array types.
 template<class T>
 class OwningArrayPtr {
-  OwningArrayPtr(OwningArrayPtr const &);            // DO NOT IMPLEMENT
-  OwningArrayPtr &operator=(OwningArrayPtr const &); // DO NOT IMPLEMENT
+  OwningArrayPtr(OwningArrayPtr const &) LLVM_DELETED_FUNCTION;
+  OwningArrayPtr &operator=(OwningArrayPtr const &) LLVM_DELETED_FUNCTION;
   T *Ptr;
 public:
   explicit OwningArrayPtr(T *P = 0) : Ptr(P) {}
index a6803ee0eddf0f1ff9bcc564475822018107a76c..efddd9f9b857576af2f7df97e7778d6751c9f26f 100644 (file)
@@ -90,8 +90,8 @@ class ScopedHashTableScope {
   /// LastValInScope - This is the last value that was inserted for this scope
   /// or null if none have been inserted yet.
   ScopedHashTableVal<K, V> *LastValInScope;
-  void operator=(ScopedHashTableScope&);       // DO NOT IMPLEMENT
-  ScopedHashTableScope(ScopedHashTableScope&); // DO NOT IMPLEMENT
+  void operator=(ScopedHashTableScope&) LLVM_DELETED_FUNCTION;
+  ScopedHashTableScope(ScopedHashTableScope&) LLVM_DELETED_FUNCTION;
 public:
   ScopedHashTableScope(ScopedHashTable<K, V, KInfo, AllocatorTy> &HT);
   ~ScopedHashTableScope();
index dc3db4ce1f359fea1fbb8184d8aaa422d336b315..063c6755c680c67e882d7c0ac8293820e32f0afa 100644 (file)
@@ -128,8 +128,8 @@ class SparseSet {
 
   // Disable copy construction and assignment.
   // This data structure is not meant to be used that way.
-  SparseSet(const SparseSet&); // DO NOT IMPLEMENT.
-  SparseSet &operator=(const SparseSet&); // DO NOT IMPLEMENT.
+  SparseSet(const SparseSet&) LLVM_DELETED_FUNCTION;
+  SparseSet &operator=(const SparseSet&) LLVM_DELETED_FUNCTION;
 
 public:
   typedef ValueT value_type;
index f7e255181e2333d506fe59e6ea47bea7d50e25a9..d23fccf3e8cc1f18f8dc31f447c42288b6ee24c6 100644 (file)
@@ -80,8 +80,8 @@ class ValueMap {
   typedef typename Config::ExtraData ExtraData;
   MapT Map;
   ExtraData Data;
-  ValueMap(const ValueMap&); // DO NOT IMPLEMENT
-  ValueMap& operator=(const ValueMap&); // DO NOT IMPLEMENT
+  ValueMap(const ValueMap&) LLVM_DELETED_FUNCTION;
+  ValueMap& operator=(const ValueMap&) LLVM_DELETED_FUNCTION;
 public:
   typedef KeyT key_type;
   typedef ValueT mapped_type;
index ba9864a98a7e8d72ee1f0b4df6da69701c2e7f39..7f5cd171814201f15586c5cd8b1190c7a9d081d8 100644 (file)
@@ -38,6 +38,7 @@
 #ifndef LLVM_ADT_ILIST_H
 #define LLVM_ADT_ILIST_H
 
+#include "llvm/Support/Compiler.h"
 #include <algorithm>
 #include <cassert>
 #include <cstddef>
@@ -331,8 +332,8 @@ class iplist : public Traits {
 
   // No fundamental reason why iplist can't be copyable, but the default
   // copy/copy-assign won't do.
-  iplist(const iplist &);         // do not implement
-  void operator=(const iplist &); // do not implement
+  iplist(const iplist &) LLVM_DELETED_FUNCTION;
+  void operator=(const iplist &) LLVM_DELETED_FUNCTION;
 
 public:
   typedef NodeTy *pointer;
index 0f07164eb8ed021939d9b1a75c05b9c8f0f98df6..bcd35e3c1e1b6263cdb583d3747aaed44c88c0fd 100644 (file)
@@ -78,10 +78,11 @@ public:
   ~FileOutputBuffer();
 
   
+private:
+  FileOutputBuffer(const FileOutputBuffer &) LLVM_DELETED_FUNCTION;
+  FileOutputBuffer &operator=(const FileOutputBuffer &) LLVM_DELETED_FUNCTION;
 protected:
-  FileOutputBuffer(const FileOutputBuffer &); // DO NOT IMPLEMENT
-  FileOutputBuffer &operator=(const FileOutputBuffer &); // DO NOT IMPLEMENT
-  FileOutputBuffer(uint8_t *Start, uint8_t *End, 
+  FileOutputBuffer(uint8_t *Start, uint8_t *End,
                     StringRef Path, StringRef TempPath);
     
   uint8_t            *BufferStart;
index cd13bfe6eeb035a21ff4247790dc69414db74855..6bb162277e2b22118b298c34bf84ad5757e1cad6 100644 (file)
@@ -26,8 +26,8 @@ namespace llvm {
   /// @brief Guard a section of code with a Mutex.
   class MutexGuard {
     sys::Mutex &M;
-    MutexGuard(const MutexGuard &);    // DO NOT IMPLEMENT
-    void operator=(const MutexGuard &); // DO NOT IMPLEMENT
+    MutexGuard(const MutexGuard &) LLVM_DELETED_FUNCTION;
+    void operator=(const MutexGuard &) LLVM_DELETED_FUNCTION;
   public:
     MutexGuard(sys::Mutex &m) : M(m) { M.acquire(); }
     ~MutexGuard() { M.release(); }
index d141ddf3b5ad82b2e9bdd2969d6847a0a3db0715..29eafb63ca0ee777999c2642e1ed8e52acacd3bb 100644 (file)
@@ -37,7 +37,7 @@ namespace llvm {
   /// is necessary to define an alternate traits class.
   template <typename T>
   class RegistryTraits {
-    RegistryTraits(); // Do not implement.
+    RegistryTraits() LLVM_DELETED_FUNCTION;
 
   public:
     typedef SimpleRegistryEntry<T> entry;
@@ -63,7 +63,7 @@ namespace llvm {
     class iterator;
 
   private:
-    Registry(); // Do not implement.
+    Registry() LLVM_DELETED_FUNCTION;
 
     static void Announce(const entry &E) {
       for (listener *Cur = ListenerHead; Cur; Cur = Cur->Next)
index 61e21b86ead87a0b765ff884a16862a85ce2c57d..dbcf0fd11d19d8c3c5784fefdcdd82ca443248ab 100644 (file)
@@ -59,8 +59,8 @@ private:
   // pair. The 'setValPtrInt' and 'getValPtrInt' methods below give them this
   // access.
   PointerIntPair<Value*, 2> VP;
-  
-  explicit ValueHandleBase(const ValueHandleBase&); // DO NOT IMPLEMENT.
+
+  ValueHandleBase(const ValueHandleBase&) LLVM_DELETED_FUNCTION;
 public:
   explicit ValueHandleBase(HandleBaseKind Kind)
     : PrevPair(0, Kind), Next(0), VP(0, 0) {}