[PATCH] D47090: Implement C++17 <memory_resource>.

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 18 15:22:02 PDT 2018


Quuxplusone created this revision.
Quuxplusone added reviewers: EricWF, mclow.lists.
Herald added subscribers: cfe-commits, christof.
Quuxplusone edited the summary of this revision.

This is a complete but partly silly implementation of C++17 `<memory_resource>`.

Preliminary pieces of this patch are already filed as https://reviews.llvm.org/D46806 and https://reviews.llvm.org/D46807. If those get merged I'll rebase this one. I myself do not have commit privileges.

Potential issues with this patch:

1. monotonic_buffer_resource is complete and IMHO well tested, but I bet someone can find suboptimal things in its design.

2. unsynchronized_pool_resource is trivial; it ignores the pool_options and just passes everything through to the upstream, which is conforming but I'm sure someone has a better idea.

3. unsynchronized_pool_resource is "code complete" but untested.

I feel guilty about (3) and will fix it eventually. I'm willing to take a stab at (2) if anyone can explain in English what the _intended_ implementation is. On (1) I hope there will be only easy nits.

https://github.com/Quuxplusone/libcxx/compare/master...memory-resource-header


Repository:
  rCXX libc++

https://reviews.llvm.org/D47090

Files:
  include/__functional_base
  include/__memory_resource_base
  include/deque
  include/forward_list
  include/list
  include/map
  include/memory_resource
  include/module.modulemap
  include/regex
  include/set
  include/string
  include/unordered_map
  include/unordered_set
  include/vector
  src/memory_resource.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.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.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.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_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.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.global/default_resource.pass.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.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/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.ctor/assign.pass.cpp
  test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.ctor/copy.pass.cpp
  test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.ctor/default.pass.cpp
  test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.ctor/memory_resource_convert.pass.cpp
  test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.ctor/other_alloc.pass.cpp
  test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.eq/equal.pass.cpp
  test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.eq/not_equal.pass.cpp
  test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/allocate.pass.cpp
  test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/construct_pair.pass.cpp
  test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp
  test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/construct_pair_rvalue.pass.cpp
  test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/construct_pair_values.pass.cpp
  test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/construct_piecewise_pair.pass.cpp
  test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/construct_piecewise_pair_evil.pass.cpp
  test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/construct_types.pass.cpp
  test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/deallocate.pass.cpp
  test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/destroy.pass.cpp
  test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/resource.pass.cpp
  test/std/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/select_on_container_copy_construction.pass.cpp
  test/std/utilities/utility/mem.res/mem.res.aliases/header_deque_synop.pass.cpp
  test/std/utilities/utility/mem.res/mem.res.aliases/header_forward_list_synop.pass.cpp
  test/std/utilities/utility/mem.res/mem.res.aliases/header_list_synop.pass.cpp
  test/std/utilities/utility/mem.res/mem.res.aliases/header_list_synop2.pass.cpp
  test/std/utilities/utility/mem.res/mem.res.aliases/header_map_synop.pass.cpp
  test/std/utilities/utility/mem.res/mem.res.aliases/header_regex_synop.pass.cpp
  test/std/utilities/utility/mem.res/mem.res.aliases/header_set_synop.pass.cpp
  test/std/utilities/utility/mem.res/mem.res.aliases/header_string_synop.pass.cpp
  test/std/utilities/utility/mem.res/mem.res.aliases/header_string_synop2.pass.cpp
  test/std/utilities/utility/mem.res/mem.res.aliases/header_unordered_map_synop.pass.cpp
  test/std/utilities/utility/mem.res/mem.res.aliases/header_unordered_set_synop.pass.cpp
  test/std/utilities/utility/mem.res/mem.res.aliases/header_vector_synop.pass.cpp
  test/std/utilities/utility/mem.res/mem.res.global/default_resource.pass.cpp
  test/std/utilities/utility/mem.res/mem.res.global/new_delete_resource.pass.cpp
  test/std/utilities/utility/mem.res/mem.res.global/null_memory_resource.pass.cpp
  test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/monotonic_buffer.pass.cpp
  test/std/utilities/utility/mem.res/mem.res/construct.fail.cpp
  test/std/utilities/utility/mem.res/mem.res/mem.res.eq/equal.pass.cpp
  test/std/utilities/utility/mem.res/mem.res/mem.res.eq/not_equal.pass.cpp
  test/std/utilities/utility/mem.res/mem.res/mem.res.private/private_members.fail.cpp
  test/std/utilities/utility/mem.res/mem.res/mem.res.private/protected_members.fail.cpp
  test/std/utilities/utility/mem.res/mem.res/mem.res.public/allocate.pass.cpp
  test/std/utilities/utility/mem.res/mem.res/mem.res.public/deallocate.pass.cpp
  test/std/utilities/utility/mem.res/mem.res/mem.res.public/dtor.pass.cpp
  test/std/utilities/utility/mem.res/mem.res/mem.res.public/is_equal.pass.cpp
  test/std/utilities/utility/mem.res/nothing_to_do.pass.cpp
  test/support/test_experimental_memory_resource.hpp
  test/support/test_memory_resource.hpp
  test/support/uses_alloc_types.hpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47090.147599.patch
Type: text/x-patch
Size: 186779 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180518/a7028f5a/attachment-0001.bin>


More information about the cfe-commits mailing list