diff --git a/libcxx/include/barrier b/libcxx/include/barrier index 00e196963f11c..fb40757a73fb6 100644 --- a/libcxx/include/barrier +++ b/libcxx/include/barrier @@ -97,19 +97,21 @@ using __barrier_phase_t _LIBCPP_NODEBUG = uint8_t; class __barrier_algorithm_base; -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base* -__construct_barrier_algorithm_base(ptrdiff_t& __expected); +[[__gnu__::__returns_nonnull__, __gnu__::__malloc__]] _LIBCPP_AVAILABILITY_SYNC + _LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base* + __construct_barrier_algorithm_base(ptrdiff_t& __expected); _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI bool -__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) noexcept; +__arrive_barrier_algorithm_base([[__gnu__::__nonnull__]] _LIBCPP_NOESCAPE __barrier_algorithm_base* __barrier, + __barrier_phase_t __old_phase) noexcept; -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void -__destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier) noexcept; +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __destroy_barrier_algorithm_base( + [[__gnu__::__nonnull__]] _LIBCPP_NOESCAPE __barrier_algorithm_base* __barrier) noexcept; template class __barrier_base { ptrdiff_t __expected_; - unique_ptr<__barrier_algorithm_base, void (*)(__barrier_algorithm_base*)> __base_; + unique_ptr<__barrier_algorithm_base, void (*)(_LIBCPP_NOESCAPE __barrier_algorithm_base*)> __base_; atomic __expected_adjustment_; _CompletionF __completion_; atomic<__barrier_phase_t> __phase_; diff --git a/libcxx/src/barrier.cpp b/libcxx/src/barrier.cpp index 868f1bfbaffc2..72c29b49ada39 100644 --- a/libcxx/src/barrier.cpp +++ b/libcxx/src/barrier.cpp @@ -60,11 +60,12 @@ class __barrier_algorithm_base { _LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base* __construct_barrier_algorithm_base(ptrdiff_t& __expected) { return new __barrier_algorithm_base(__expected); } -_LIBCPP_EXPORTED_FROM_ABI bool -__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) noexcept { +_LIBCPP_EXPORTED_FROM_ABI bool __arrive_barrier_algorithm_base( + _LIBCPP_NOESCAPE __barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) noexcept { return __barrier->__arrive(__old_phase); } -_LIBCPP_EXPORTED_FROM_ABI void __destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier) noexcept { +_LIBCPP_EXPORTED_FROM_ABI void +__destroy_barrier_algorithm_base(_LIBCPP_NOESCAPE __barrier_algorithm_base* __barrier) noexcept { delete __barrier; }