@@ -48,12 +48,11 @@ class _LIBCPP_EXPORTED_FROM_ABI basic_stacktrace : private __stacktrace::base {
48
48
friend struct hash <basic_stacktrace<_Allocator>>;
49
49
friend struct __stacktrace ::__to_string;
50
50
51
- using _ATraits _LIBCPP_NODEBUG = allocator_traits<_Allocator>;
52
- constexpr static bool __kPropOnCopyAssign = _ATraits::propagate_on_container_copy_assignment::value;
53
- constexpr static bool __kPropOnMoveAssign = _ATraits::propagate_on_container_move_assignment::value;
54
- constexpr static bool __kPropOnSwap = _ATraits::propagate_on_container_swap::value;
55
- constexpr static bool __kAlwaysEqual = _ATraits::is_always_equal::value;
56
- constexpr static bool __kNoThrowDflConstruct = is_nothrow_default_constructible_v<_Allocator>;
51
+ using _ATraits _LIBCPP_NODEBUG = allocator_traits<_Allocator>;
52
+ constexpr static bool __kPropOnCopyAssign = _ATraits::propagate_on_container_copy_assignment::value;
53
+ constexpr static bool __kPropOnMoveAssign = _ATraits::propagate_on_container_move_assignment::value;
54
+ constexpr static bool __kPropOnSwap = _ATraits::propagate_on_container_swap::value;
55
+ constexpr static bool __kAlwaysEqual = _ATraits::is_always_equal::value;
57
56
constexpr static bool __kNoThrowAlloc =
58
57
noexcept (noexcept (_Allocator().allocate(1 )) && noexcept (_Allocator().allocate_at_least(1 )));
59
58
@@ -115,42 +114,63 @@ class _LIBCPP_EXPORTED_FROM_ABI basic_stacktrace : private __stacktrace::base {
115
114
116
115
_LIBCPP_EXPORTED_FROM_ABI constexpr ~basic_stacktrace () = default ;
117
116
118
- _LIBCPP_EXPORTED_FROM_ABI basic_stacktrace () noexcept (__kNoThrowDflConstruct) : basic_stacktrace(allocator_type()) {}
119
-
120
- _LIBCPP_EXPORTED_FROM_ABI explicit basic_stacktrace (const allocator_type& __alloc) noexcept
121
- : base(__alloc), __entries_(__alloc_) {}
122
-
123
- _LIBCPP_EXPORTED_FROM_ABI basic_stacktrace (basic_stacktrace const & __other)
124
- : basic_stacktrace(__other, _ATraits::select_on_container_copy_construction(__other.__alloc_)) {}
125
-
126
- _LIBCPP_EXPORTED_FROM_ABI basic_stacktrace (basic_stacktrace&& __other) noexcept
127
- : __alloc_(std::move(__other.__alloc_)), __entries_(std::move(__other.__entries_)) {}
128
-
129
- _LIBCPP_EXPORTED_FROM_ABI basic_stacktrace (basic_stacktrace const & __other, allocator_type const & __alloc)
130
- : base(__alloc), __alloc_(__alloc), __entries_(__other.__entries_, __alloc) {}
131
-
132
- _LIBCPP_EXPORTED_FROM_ABI basic_stacktrace (basic_stacktrace&& __other, allocator_type const & __alloc)
133
- : base(__alloc) {
134
- __entries_ = {std::move (__other.__entries_ ), __alloc_};
135
- }
136
-
137
- _LIBCPP_EXPORTED_FROM_ABI basic_stacktrace& operator =(const basic_stacktrace& __other) {
138
- if (this != std::addressof (__other)) {
117
+ // clang-format off
118
+
119
+ _LIBCPP_EXPORTED_FROM_ABI explicit
120
+ basic_stacktrace (const allocator_type& __alloc) /* not noexcept */
121
+ : base(__alloc)
122
+ , __alloc_(__alloc)
123
+ , __entries_(__alloc_) {}
124
+
125
+ _LIBCPP_EXPORTED_FROM_ABI
126
+ basic_stacktrace (basic_stacktrace const & __other,
127
+ allocator_type const & __alloc) /* not noexcept */
128
+ : base(__alloc)
129
+ , __alloc_(__alloc)
130
+ , __entries_(__other.__entries_, __alloc) {}
131
+
132
+ _LIBCPP_EXPORTED_FROM_ABI
133
+ basic_stacktrace (basic_stacktrace&& __other,
134
+ allocator_type const & __alloc) /* not noexcept */
135
+ : base(__alloc)
136
+ , __alloc_(__alloc)
137
+ , __entries_{std::move (__other.__entries_ ), __alloc_} {}
138
+
139
+ _LIBCPP_EXPORTED_FROM_ABI
140
+ basic_stacktrace () noexcept (is_nothrow_default_constructible_v<allocator_type>)
141
+ : basic_stacktrace(allocator_type()) {}
142
+
143
+ _LIBCPP_EXPORTED_FROM_ABI
144
+ basic_stacktrace (basic_stacktrace const & __other) noexcept
145
+ : basic_stacktrace(__other,
146
+ _ATraits::select_on_container_copy_construction (__other.__alloc_)) {}
147
+
148
+ _LIBCPP_EXPORTED_FROM_ABI
149
+ basic_stacktrace (basic_stacktrace&& __other) noexcept
150
+ : basic_stacktrace(std::move(__other),
151
+ __other.__alloc_) {}
152
+
153
+ _LIBCPP_EXPORTED_FROM_ABI
154
+ basic_stacktrace& operator =(const basic_stacktrace& __other) /* not noexcept */ {
155
+ if (std::addressof (__other) != this ) {
139
156
if (__kPropOnCopyAssign) {
140
- __alloc_ = __other.__alloc_ ;
157
+ new (this ) basic_stacktrace (__other, __other.__alloc_ );
158
+ } else {
159
+ new (this ) basic_stacktrace (__other);
141
160
}
142
- __entries_ = {__other.__entries_ , __alloc_};
143
161
}
144
162
return *this ;
145
163
}
146
164
147
- _LIBCPP_EXPORTED_FROM_ABI basic_stacktrace&
148
- operator =(basic_stacktrace&& __other) noexcept (__kPropOnMoveAssign || __kAlwaysEqual) {
149
- if (this != std::addressof (__other)) {
165
+ _LIBCPP_EXPORTED_FROM_ABI
166
+ basic_stacktrace& operator =(basic_stacktrace&& __other)
167
+ noexcept (__kPropOnMoveAssign || __kAlwaysEqual) {
168
+ if (std::addressof (__other) != this ) {
150
169
if (__kPropOnMoveAssign) {
151
- __alloc_ = std::move (__other.__alloc_ );
170
+ new (this ) basic_stacktrace (std::move (__other), __other.__alloc_ );
171
+ } else {
172
+ new (this ) basic_stacktrace (std::move (__other));
152
173
}
153
- __entries_ = {std::move (__other.__entries_ ), __alloc_};
154
174
}
155
175
return *this ;
156
176
}
0 commit comments