summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2012-08-15 18:54:36 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2012-08-15 18:54:36 +0000
commitb9d565ac998fc857b20786bae08bb30719eb966b (patch)
treebcd76a3f8f5711ba927aa20cd05b011ca1dffff5
parent58aae3841cb054e909d6b5251399bfd7478653bc (diff)
downloadllvm-b9d565ac998fc857b20786bae08bb30719eb966b.tar.gz
llvm-b9d565ac998fc857b20786bae08bb30719eb966b.tar.bz2
llvm-b9d565ac998fc857b20786bae08bb30719eb966b.tar.xz
Add LLVM_DELETED_FUNCTION compatibility macro.
This should replace uses of: class A { A(const &A); // DO NOT IMPLEMENT public: ... }; git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161975 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Support/Compiler.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h
index f654f327a9..4469ae31de 100644
--- a/include/llvm/Support/Compiler.h
+++ b/include/llvm/Support/Compiler.h
@@ -38,6 +38,25 @@
#define llvm_move(value) (value)
#endif
+/// LLVM_DELETED_FUNCTION - Expands to = delete if the compiler supports it.
+/// Use to mark functions as uncallable. Member functions with this should
+/// be declared private so that some behaivor is kept in C++03 mode.
+///
+/// class DontCopy {
+/// private:
+/// DontCopy(const DontCopy&) LLVM_DELETED_FUNCTION;
+/// DontCopy &operator =(const DontCopy&) LLVM_DELETED_FUNCTION;
+/// public:
+/// ...
+/// };
+#if (__has_feature(cxx_deleted_functions) \
+ || defined(__GXX_EXPERIMENTAL_CXX0X__))
+ // No version of MSVC currently supports this.
+#define LLVM_DELETED_FUNCTION = delete
+#else
+#define LLVM_DELETED_FUNCTION
+#endif
+
/// LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked
/// into a shared library, then the class should be private to the library and
/// not accessible from outside it. Can also be used to mark variables and