[libcxx-commits] [PATCH] D91201: [libc++] Call allocator_traits construct() and destroy() in allocate_shared

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 10 12:25:41 PST 2020


ldionne created this revision.
ldionne added a reviewer: zoecarver.
Herald added subscribers: libcxx-commits, jkorous.
Herald added a project: libc++.
Herald added a reviewer: libc++.
ldionne requested review of this revision.

This patch updates `allocate_shared` to call `allocator_traits::construct`
when creating the shared_pointer, and `allocator_traits::destroy` when
destroying it.

This is another take on D62760 <https://reviews.llvm.org/D62760>, where I tried to make a simpler change.
I managed to keep everything working as in D62760 <https://reviews.llvm.org/D62760>, except for passing a
type with a private destructor. However, this should work if we get rid
of __compressed_pair in the implementation of __shared_ptr_emplace.

Fixes https://llvm.org/PR41900


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91201

Files:
  libcxx/include/memory
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_construct.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91201.304302.patch
Type: text/x-patch
Size: 8655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201110/4f3d9352/attachment-0001.bin>


More information about the libcxx-commits mailing list