summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2015-12-14 18:02:23 +0000
committerMarshall Clow <mclow.lists@gmail.com>2015-12-14 18:02:23 +0000
commit25090a91bbd77a0bb169ff32e0551be32a7b4c27 (patch)
tree525420036f00d8a024fc541a6f0285555d87c90f
parent94b5bc4263609a620277d5678713f5e13efbb607 (diff)
downloadbcm5719-llvm-25090a91bbd77a0bb169ff32e0551be32a7b4c27.tar.gz
bcm5719-llvm-25090a91bbd77a0bb169ff32e0551be32a7b4c27.zip
Missed this on the previous (255517) commit
llvm-svn: 255518
-rw-r--r--libcxx/include/type_traits49
1 files changed, 49 insertions, 0 deletions
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index e29167f0e47..b7adfebceeb 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -396,6 +396,55 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY enable_if<true, _Tp> {typedef
template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type;
#endif
+// addressof
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp*
+addressof(_Tp& __x) _NOEXCEPT
+{
+ return (_Tp*)&reinterpret_cast<const volatile char&>(__x);
+}
+
+#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
+// Objective-C++ Automatic Reference Counting uses qualified pointers
+// that require special addressof() signatures. When
+// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
+// itself is providing these definitions. Otherwise, we provide them.
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__strong _Tp*
+addressof(__strong _Tp& __x) _NOEXCEPT
+{
+ return &__x;
+}
+
+#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__weak _Tp*
+addressof(__weak _Tp& __x) _NOEXCEPT
+{
+ return &__x;
+}
+#endif
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__autoreleasing _Tp*
+addressof(__autoreleasing _Tp& __x) _NOEXCEPT
+{
+ return &__x;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__unsafe_unretained _Tp*
+addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
+{
+ return &__x;
+}
+#endif
struct __two {char __lx[2];};
OpenPOWER on IntegriCloud