Author: Louis Dionne Date: 2020-12-14T17:46:09-05:00 New Revision: 3b7280f5e4aec935c7debf68e792c1aad2f7c5a7
URL: https://github.com/llvm/llvm-project/commit/3b7280f5e4aec935c7debf68e792c1aad2f7c5a7 DIFF: https://github.com/llvm/llvm-project/commit/3b7280f5e4aec935c7debf68e792c1aad2f7c5a7.diff LOG: [libc++] NFCI: Return pointer instead of reference from __shared_ptr_emplace helper method This makes __get_alloc consistent with __get_elem, and will reduce the diff required to implement P0674R1. Added: Modified: libcxx/include/memory Removed: ################################################################################ diff --git a/libcxx/include/memory b/libcxx/include/memory index 24ad9e567b99..c676cd01c0f5 100644 --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -2594,7 +2594,7 @@ struct __shared_ptr_emplace _Tp* __get_elem() _NOEXCEPT { return _VSTD::addressof(__data_.second()); } _LIBCPP_HIDE_FROM_ABI - _Alloc& __get_alloc() _NOEXCEPT { return __data_.first(); } + _Alloc* __get_alloc() _NOEXCEPT { return _VSTD::addressof(__data_.first()); } private: virtual void __on_zero_shared() _NOEXCEPT { @@ -2604,8 +2604,8 @@ private: virtual void __on_zero_shared_weak() _NOEXCEPT { using _ControlBlockAlloc = typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type; using _ControlBlockPointer = typename allocator_traits<_ControlBlockAlloc>::pointer; - _ControlBlockAlloc __tmp(__get_alloc()); - __get_alloc().~_Alloc(); + _ControlBlockAlloc __tmp(*__get_alloc()); + __get_alloc()->~_Alloc(); allocator_traits<_ControlBlockAlloc>::deallocate(__tmp, pointer_traits<_ControlBlockPointer>::pointer_to(*this), 1); } _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits