llvm-project/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared
Louis Dionne 955dd7b7f3 [libc++] LWG2070: Use Allocator construction for objects created with allocate_shared
This patch updates `allocate_shared` to call `allocator_traits::construct`
when creating the object held inside the shared_pointer, and
`allocator_traits::destroy` when destroying it. This resolves
the part of P0674R1 that was originally filed as LWG2070.

This change is landed separately from the rest of P0674R1 because it is
incredibly tricky from an ABI perspective.

This is the reason why this change is so tricky is that we previously
used EBO in a compressed pair to store both the allocator and the object
type stored in the `shared_ptr`. However, starting in C++20, P0674
requires us to use Allocator construction for initializing the object type.
That requirement rules out the use of the EBO for the object type, since
using the EBO implies that the base will be initialized when the control
block is initialized (and hence we can't do it through Allocator construction).
Hence, supporting P0674 requires changing how we store the object type
inside the control block, which we do while being ABI compatible by using
some trickery with a properly aligned char buffer.

Fixes https://llvm.org/PR41900
Supersedes https://llvm.org/D62760

Differential Revision: https://reviews.llvm.org/D91201
2021-01-08 13:04:03 -05:00
..
util.smartptr.getdeleter [libc++] Rename the -fno-rtti Lit feature to just no-rtti 2020-09-29 16:29:44 -04:00
util.smartptr.shared.assign [libc++] NFC: Fix several GCC warnings in the test suite 2020-10-30 12:48:05 -04:00
util.smartptr.shared.cast [libc++] NFC: Fix several GCC warnings in the test suite 2020-10-30 12:48:05 -04:00
util.smartptr.shared.cmp Add include for 'test_macros.h' to all the tests that were missing them. Thanks to Zoe for the (big, but simple) patch. NFC intended. 2019-05-31 18:35:30 +00:00
util.smartptr.shared.const [libc++] NFC: Fix several GCC warnings in the test suite 2020-10-30 12:48:05 -04:00
util.smartptr.shared.create [libc++] LWG2070: Use Allocator construction for objects created with allocate_shared 2021-01-08 13:04:03 -05:00
util.smartptr.shared.dest Support tests in freestanding 2019-02-04 20:31:13 +00:00
util.smartptr.shared.io [libc++] Add a libc++ configuration that does not support localization 2020-10-27 14:56:30 -04:00
util.smartptr.shared.mod [libc++] NFC: Fix several GCC warnings in the test suite 2020-10-30 12:48:05 -04:00
util.smartptr.shared.obs [libc++] Fix failures when running the test suite without RTTI 2020-09-21 20:17:24 -04:00
util.smartptr.shared.spec Add include for 'test_macros.h' to all the tests that were missing them. Thanks to Zoe for the (big, but simple) patch. NFC intended. 2019-05-31 18:35:30 +00:00
libcxx.control_block_layout.pass.cpp [libc++] LWG2070: Use Allocator construction for objects created with allocate_shared 2021-01-08 13:04:03 -05:00
types.pass.cpp [libcxx] Re-commit: shared_ptr changes from library fundamentals (P0414R2). 2020-05-12 11:23:18 -07:00