diff --git a/include/__exception/exception_ptr.h b/include/__exception/exception_ptr.h index 868fd7c..bcc8768 100644 --- a/include/__exception/exception_ptr.h +++ b/include/__exception/exception_ptr.h @@ -56,8 +56,6 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS __cxa_exception* __cxa_init_primary_exception( namespace std { // purposefully not using versioning namespace -#ifndef _LIBCPP_ABI_MICROSOFT - class _LIBCPP_EXPORTED_FROM_ABI exception_ptr { void* __ptr_; @@ -84,10 +82,18 @@ public: return !(__x == __y); } + friend _LIBCPP_HIDE_FROM_ABI void swap(exception_ptr& __x, exception_ptr& __y) _NOEXCEPT { + void* __tmp = __x.__ptr_; + __x.__ptr_ = __y.__ptr_; + __y.__ptr_ = __tmp; + } + friend _LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT; friend _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr); }; +#ifndef _LIBCPP_ABI_MICROSOFT + template _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT { # ifndef _LIBCPP_HAS_NO_EXCEPTIONS @@ -129,34 +135,7 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT { #else // _LIBCPP_ABI_MICROSOFT -class _LIBCPP_EXPORTED_FROM_ABI exception_ptr { - _LIBCPP_DIAGNOSTIC_PUSH - _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wunused-private-field") - void* __ptr1_; - void* __ptr2_; - _LIBCPP_DIAGNOSTIC_POP - -public: - exception_ptr() _NOEXCEPT; - exception_ptr(nullptr_t) _NOEXCEPT; - exception_ptr(const exception_ptr& __other) _NOEXCEPT; - exception_ptr& operator=(const exception_ptr& __other) _NOEXCEPT; - exception_ptr& operator=(nullptr_t) _NOEXCEPT; - ~exception_ptr() _NOEXCEPT; - explicit operator bool() const _NOEXCEPT; -}; - -_LIBCPP_EXPORTED_FROM_ABI bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT; - -inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT { - return !(__x == __y); -} - -_LIBCPP_EXPORTED_FROM_ABI void swap(exception_ptr&, exception_ptr&) _NOEXCEPT; - -_LIBCPP_EXPORTED_FROM_ABI exception_ptr __copy_exception_ptr(void* __except, const void* __ptr); -_LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT; -_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr); +_LIBCPP_HIDE_FROM_ABI exception_ptr __copy_exception_ptr(void* __exception, const void* __ptr); // This is a built-in template function which automagically extracts the required // information. @@ -164,7 +143,7 @@ template void* __GetExceptionInfo(_E); template -_LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT { +exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT { return __copy_exception_ptr(std::addressof(__e), __GetExceptionInfo(__e)); }