[PATCH] D47090: Implement C++17 <memory_resource>.
Eric Fiselier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat May 19 03:23:33 PDT 2018
EricWF added a subscriber: dexonsmith.
EricWF added a comment.
================
Comment at: src/memory_resource.cpp:62
+
+namespace {
+
----------------
We certainly don't want a different definition of the global resources in each TU. See below.
================
Comment at: src/memory_resource.cpp:64
+
+union ResourceInitHelper {
+ struct {
----------------
This should go inside the library, so we're not emitting an initializer in each TU.
================
Comment at: src/memory_resource.cpp:83
+
+memory_resource * new_delete_resource() _NOEXCEPT {
+ return &res_init.resources.new_delete_res;
----------------
I think the global resources should be in the unversioned namespace `std::pmr` instead of `std::__v::pmr`. Like new/delete and exceptions I suspect we only want one definition of these in any given program. I'm considering every function from here up to and including `set_default_resource`.
@mclow.lists, @dexonsmith: what do you think?
================
Comment at: src/memory_resource.cpp:147
+
+template<class T>
+struct __mr_holder {
----------------
`_Tp`
================
Comment at: src/memory_resource.cpp:149
+struct __mr_holder {
+ memory_resource *res;
+ void *ptr;
----------------
`__res_`
`__ptr_`
`__size_`
`__align_`
================
Comment at: src/memory_resource.cpp:180
+struct __pool_resource_chunk {
+ size_t bytes;
+ size_t alignment;
----------------
`__bytes_`
`__alignment_` (or `__align_`)
`__allocation_`
`__next_`
Repository:
rCXX libc++
https://reviews.llvm.org/D47090
More information about the cfe-commits
mailing list