Skip to content

Commit 3b41e4d

Browse files
authored
[libc++] Annotate barrier functions that are defined in the dylib (#148542)
This can improve code gen slightly.
1 parent 116110e commit 3b41e4d

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

libcxx/include/barrier

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,21 @@ using __barrier_phase_t _LIBCPP_NODEBUG = uint8_t;
9797

9898
class __barrier_algorithm_base;
9999

100-
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base*
101-
__construct_barrier_algorithm_base(ptrdiff_t& __expected);
100+
[[__gnu__::__returns_nonnull__, __gnu__::__malloc__]] _LIBCPP_AVAILABILITY_SYNC
101+
_LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base*
102+
__construct_barrier_algorithm_base(ptrdiff_t& __expected);
102103

103104
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI bool
104-
__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) noexcept;
105+
__arrive_barrier_algorithm_base([[__gnu__::__nonnull__]] _LIBCPP_NOESCAPE __barrier_algorithm_base* __barrier,
106+
__barrier_phase_t __old_phase) noexcept;
105107

106-
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
107-
__destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier) noexcept;
108+
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __destroy_barrier_algorithm_base(
109+
[[__gnu__::__nonnull__]] _LIBCPP_NOESCAPE __barrier_algorithm_base* __barrier) noexcept;
108110

109111
template <class _CompletionF>
110112
class __barrier_base {
111113
ptrdiff_t __expected_;
112-
unique_ptr<__barrier_algorithm_base, void (*)(__barrier_algorithm_base*)> __base_;
114+
unique_ptr<__barrier_algorithm_base, void (*)(_LIBCPP_NOESCAPE __barrier_algorithm_base*)> __base_;
113115
atomic<ptrdiff_t> __expected_adjustment_;
114116
_CompletionF __completion_;
115117
atomic<__barrier_phase_t> __phase_;

libcxx/src/barrier.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,12 @@ class __barrier_algorithm_base {
6060
_LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base* __construct_barrier_algorithm_base(ptrdiff_t& __expected) {
6161
return new __barrier_algorithm_base(__expected);
6262
}
63-
_LIBCPP_EXPORTED_FROM_ABI bool
64-
__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) noexcept {
63+
_LIBCPP_EXPORTED_FROM_ABI bool __arrive_barrier_algorithm_base(
64+
_LIBCPP_NOESCAPE __barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) noexcept {
6565
return __barrier->__arrive(__old_phase);
6666
}
67-
_LIBCPP_EXPORTED_FROM_ABI void __destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier) noexcept {
67+
_LIBCPP_EXPORTED_FROM_ABI void
68+
__destroy_barrier_algorithm_base(_LIBCPP_NOESCAPE __barrier_algorithm_base* __barrier) noexcept {
6869
delete __barrier;
6970
}
7071

0 commit comments

Comments
 (0)