[libcxx] r187959 - Revert r187927.

Arnold Schwaighofer aschwaighofer at apple.com
Wed Aug 7 20:06:24 PDT 2013


Author: arnolds
Date: Wed Aug  7 22:06:24 2013
New Revision: 187959

URL: http://llvm.org/viewvc/llvm-project?rev=187959&view=rev
Log:
Revert r187927.

Zhihao Yuan: Replace operator& with addressof in reference_wrapper constructor.

It breaks a clang bootstrap.


Modified:
    libcxx/trunk/include/__functional_base
    libcxx/trunk/include/memory

Modified: libcxx/trunk/include/__functional_base
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__functional_base?rev=187959&r1=187958&r2=187959&view=diff
==============================================================================
--- libcxx/trunk/include/__functional_base (original)
+++ libcxx/trunk/include/__functional_base Wed Aug  7 22:06:24 2013
@@ -365,56 +365,6 @@ struct __invoke_return
     typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
 };
 
-// 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
-
 template <class _Tp>
 class _LIBCPP_TYPE_VIS reference_wrapper
     : public __weak_result_type<_Tp>
@@ -427,8 +377,7 @@ private:
 
 public:
     // construct/copy/destroy
-    _LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT
-        : __f_(_VSTD::addressof(__f)) {}
+    _LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT : __f_(&__f) {}
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
 #endif

Modified: libcxx/trunk/include/memory
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=187959&r1=187958&r2=187959&view=diff
==============================================================================
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Wed Aug  7 22:06:24 2013
@@ -618,7 +618,55 @@ void* align(size_t alignment, size_t siz
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-// addressof moved to <__functional_base>
+// 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
 
 template <class _Tp> class allocator;
 





More information about the cfe-commits mailing list