llvm-capstone/libcxx
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
..
benchmarks [runtimes] Revert the libc++ __config_site change 2020-10-23 09:41:48 -04:00
cmake [libc++] Add basic support for -std=c++2b. 2021-01-08 19:02:41 +01:00
docs [libc++] Add basic support for -std=c++2b. 2021-01-08 19:02:41 +01:00
include [libc++] LWG2070: Use Allocator construction for objects created with allocate_shared 2021-01-08 13:04:03 -05:00
lib [libc++] Use TARGET_FILE instead of TARGET_SONAME_FILE when generating ABI lists 2020-12-11 12:12:40 -05:00
src [libcxx] Handle backslash as path separator on windows 2021-01-07 10:02:47 +02:00
test [libc++] LWG2070: Use Allocator construction for objects created with allocate_shared 2021-01-08 13:04:03 -05:00
utils [libc++] Add basic support for -std=c++2b. 2021-01-08 19:02:41 +01:00
www [libc++] [docs] Migrate C++ status pages to RestructuredText (RST). 2020-11-26 10:01:09 +01:00
.clang-format
.gitignore [libcxx] Fix .gitignore to not exclude test directories 2020-03-25 17:52:23 -07:00
appveyor-reqs-install.cmd Attempt to upgrade compiler used by appveyor builds 2019-04-03 20:40:01 +00:00
appveyor.yml disable appveyor config for MSVC 2015 2019-04-03 20:36:51 +00:00
CMakeLists.txt [libc++] [libc++abi] Use C++20 standard. 2020-11-22 15:57:25 +01:00
CREDITS.TXT [libcxx] Adds [concept.same] 2020-04-08 18:00:13 -04:00
LICENSE.TXT Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
TODO.TXT [libc++][NFC] Remove outdated TODO item 2020-07-08 13:04:33 -04:00