[PATCH] D20007: Add <experimental/memory_resource>

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Fri May 6 14:30:48 PDT 2016


EricWF updated this revision to Diff 56464.
EricWF added a comment.

Address @mclows offline comments

1. I added the `polymorphic_allocator<T>::max_size()` function.
2. `polymorphic_allocator<T>::allocate(size)` now throws `bad_alloc` when `size > size_type(~0) / sizeof(T)`.
3. `polymorphic_allocator<T>::deallocate(ptr, size)` checks size is valid using `_LIBCPP_ASSERT`.
4. `resource_adaptor<A>::do_allocate(bytes)` now throws `bad_alloc` when `bytes > size_type(~0) - alignof(max_align_t)`.
5. `resource_adaptor<A>::do_deallocate(ptr, bytes)` checks that `bytes` is valid using `_LIBCPP_ASSERT`.


http://reviews.llvm.org/D20007

Files:
  include/experimental/__config
  include/experimental/__memory
  include/experimental/memory_resource
  src/experimental/memory_resource.cpp
  src/experimental/placeholder.cpp
  test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
  test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/db_deallocate.pass.cpp
  test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/max_size.pass.cpp
  test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp
  test/libcxx/experimental/memory/memory.resource.global/global_memory_resource_lifetime.pass.cpp
  test/libcxx/experimental/memory/memory.resource.global/new_delete_resource_lifetime.pass.cpp
  test/libcxx/experimental/memory/memory.resource.synop/version.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/assign.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/copy.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/default.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/memory_resource_convert.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/other_alloc.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/equal.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/not_equal.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/allocate.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/deallocate.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/destroy.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/resource.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/select_on_container_copy_construction.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.overview/nothing_to_do.pass.cpp
  test/std/experimental/memory/memory.polymorphic.allocator.class/nothing_to_do.pass.cpp
  test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.ctor/alloc_copy.pass.cpp
  test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.ctor/alloc_move.pass.cpp
  test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.ctor/default.pass.cpp
  test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/do_allocate_and_deallocate.pass.cpp
  test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/do_is_equal.pass.cpp
  test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.overview/overview.pass.cpp
  test/std/experimental/memory/memory.resource.global/default_resource.pass.cpp
  test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
  test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp
  test/std/experimental/memory/memory.resource.synop/nothing_to_do.pass.cpp
  test/std/experimental/memory/memory.resource/construct.fail.cpp
  test/std/experimental/memory/memory.resource/memory.resource.eq/equal.pass.cpp
  test/std/experimental/memory/memory.resource/memory.resource.eq/not_equal.pass.cpp
  test/std/experimental/memory/memory.resource/memory.resource.overview/nothing_to_do.pass.cpp
  test/std/experimental/memory/memory.resource/memory.resource.priv/protected_members.fail.cpp
  test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp
  test/std/experimental/memory/memory.resource/memory.resource.public/deallocate.pass.cpp
  test/std/experimental/memory/memory.resource/memory.resource.public/dtor.pass.cpp
  test/std/experimental/memory/memory.resource/memory.resource.public/is_equal.pass.cpp
  test/std/experimental/memory/nothing_to_do.pass.cpp
  test/support/test_memory_resource.hpp
  test/support/type_id.h
  test/support/uses_alloc_types.hpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20007.56464.patch
Type: text/x-patch
Size: 159671 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160506/3eb8f54f/attachment-0001.bin>


More information about the cfe-commits mailing list