[Lldb-commits] Use explicit delete in DISALLOW_COPY_AND_ASSIGN

Daniel Austin Noland via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 27 18:21:19 PDT 2016


Explicit delete is preferable to declaring a method private when
your intention is to prevent that method from ever being used.
   
* better compiler error messages
* can't be bypassed by friendship
* clearer intent
   
This was discussed here:
http://lists.llvm.org/pipermail/lldb-dev/2016-September/011394.html

-------------- next part --------------
diff --git a/include/lldb/lldb-defines.h b/include/lldb/lldb-defines.h
index a8e6776..a1318f4 100644
--- a/include/lldb/lldb-defines.h
+++ b/include/lldb/lldb-defines.h
@@ -157,8 +157,8 @@
 ///     assignment operators in C++ classes.
 //----------------------------------------------------------------------
 #define DISALLOW_COPY_AND_ASSIGN(TypeName)                                     \
-  TypeName(const TypeName &);                                                  \
-  const TypeName &operator=(const TypeName &)
+  TypeName(const TypeName &) = delete;                                         \
+  const TypeName &operator=(const TypeName &) = delete
 
 #endif // #if defined(__cplusplus)
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160927/e174e7d2/attachment.sig>


More information about the lldb-commits mailing list