diff options
author | 2024-04-12 02:03:25 -0700 | |
---|---|---|
committer | 2024-04-16 19:33:03 +0000 | |
commit | 366d45a8b5ccfe390258c5baf6a72a51aa0c7062 (patch) | |
tree | cab4e4d3be9f79e937d0dea7545dda9ddda5538d /compiler/linker/linker_patch.h | |
parent | 1f8f41b219eed63ed3532c25cd11efaa692b8478 (diff) |
TrackingAllocator and GcRootArenaAllocator: C++20 fixes
std::allocator<T> deprecates several member typedefs in C++17 and
removes them in C++20, so stop using them:
* pointer
* const_pointer
* reference
* const_reference
Reduce TrackingAllocatorImpl and GcRootArenaAllocator to what's
required by the Allocator requirements[1]:
* The only member typedef needed is value_type. All the others are
optional and were previously delegated to std::allocator<T>, so we
can rely on the default behavior.
* The hint parameter for allocate was supposed to be const void*, not
const T*. It's deprecated now, though.
* TrackingAllocatorImpl was inheriting from std::allocator<T>, and it
could have delegated allocate and deallocate to std::allocator<T>,
but instead it uses malloc/free, so just remove the base class
entirely.
* GcRootArenaAllocator: prefer delegation to
TrackingAllocator<T, kTag> over inheritance.
* rebind is non-optional because GcRootArenaAllocator and
TrackingAllocatorImpl's second template parameter is a value, not
a type (specifically, a value of type AllocatorTag).
* Remove explicit from the TrackingAllocatorImpl and
GcRootArenaAllocator copy constructors. The explicit on
TrackingAllocatorImpl caused a build error when I enabled
kEnableTrackingAllocator.
[1]: https://en.cppreference.com/w/cpp/named_req/Allocator
Bug: 311052584
Test: art_standalone_libartbase_tests
Test: art_standalone_runtime_tests
Test: remove cpp_std override and build Android
Change-Id: I4e6d4ee418c21fb24974a32129bc08d550a63b86
Diffstat (limited to 'compiler/linker/linker_patch.h')
0 files changed, 0 insertions, 0 deletions