diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2022-04-12 16:48:31 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2022-04-12 22:38:31 +0100 |
commit | 7cf88759957a7006e1e1d0a82a1a4de3c4db109e (patch) | |
tree | b29b455818f1ac45dfd8f354e3f53d49e64db0b1 /ABOUT-NLS | |
parent | e48933f00d676658ad065d9691a1b61446745386 (diff) | |
download | gcc-7cf88759957a7006e1e1d0a82a1a4de3c4db109e.tar.gz |
libstdc++: Use allocator to construct std::stacktrace_entry objects
Because std::basic_stacktrace<A> is an allocator-aware container its
elements should be initialized using allocator_traits<A>::construct and
destroyed using allocator_traits<A>::destroy.
This adds new _M_clone and _M_assign helper functions to construct
elements correctly and uses those functions instead of calling
std::uninitialized_copy_n.
The _Impl::_M_destroy function needs to be passed an allocator to
destroy the elements correctly, so is replaced by _M_resize which can
also be used to trim the container to a smaller size.
Because destroying and creating std::stacktrace_entry objects is cheap,
the copy/move assignment operators can just destroy all existing
elements and use _Impl._M_clone or _Impl._M_assign to create new ones.
libstdc++-v3/ChangeLog:
* include/std/stacktrace (basic_stacktrace): Use _Impl::_M_clone
or _Impl::_M_assign to initialize elements in allocated storage.
(basic_stacktrace::_M_clear()): Use _Impl::_M_resize instead of
_Impl::_M_destroy.
(basic_stacktrace::_Impl::_M_destroy()): Replace with ...
(basic_stacktrace::_Impl::_M_resize(size_type, allocator&)): New
function.
(basic_stacktrace::_Impl::_M_push_back): Use _M_xclone. Construct
new element using allocator.
(basic_stacktrace::_Impl::_M_clone): New function.
(basic_stacktrace::_Impl::_M_xclone): New function.
(basic_stacktrace::_Impl::_M_assign): New function.
Diffstat (limited to 'ABOUT-NLS')
0 files changed, 0 insertions, 0 deletions