Page MenuHomePhabricator

[libc++][PMR] Implement pmr::memory_resource
AbandonedPublic

Authored by philnik on Aug 27 2022, 12:57 PM.

Details

Reviewers
ldionne
Mordante
var-const
huixie90
Group Reviewers
Restricted Project

Diff Detail

Event Timeline

philnik created this revision.Aug 27 2022, 12:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2022, 12:57 PM
philnik requested review of this revision.Aug 27 2022, 12:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2022, 12:57 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante added inline comments.Sep 3 2022, 5:47 AM
libcxx/include/CMakeLists.txt
403

There are no changes to the module map.

libcxx/include/__memory_resource/memory_resource.h
13

Bit has been added in C++20.

27

please use size_t as in the Standard.

34

Please add some comment or a link to the documentation of this non-standard attribute.

38

As a side not in C++20 I would have preferred std::has_single_bit instead.

38

Can you add a test that triggers this _LIBCPP_ASSERT?

57
libcxx/include/memory_resource
9

Can you use /* ... */ like the other synosis do. That makes it easier to copy paste code from the Standard.

26

Please add the comparison operators too.

libcxx/src/memory_resource.cpp
14

What is the reason to put the destructor in the dylib?

When keeping it in the dylib it needs _AVAILABLITY_MACROS, grep for _LIBCPP_AVAILABILITY_FORMAT for an example.

libcxx/test/std/mem/mem.res/memory_resource.pass.cpp
89

Can you use the comparision_tests.h and validate the noexcept status and whether the function returns a bool.

huixie90 requested changes to this revision.Sep 5 2022, 2:42 AM
huixie90 added inline comments.
libcxx/include/__memory_resource/memory_resource.h
32

Question : can we inline the =default it in the header? Or is there an abi requirement that the vtable must exist in the library?

33

Is memory_resource& operator=(const memory_resource&) = default; missing?

56

missing noexcept

61

noexcept

This revision now requires changes to proceed.Sep 5 2022, 2:42 AM
jwakely added inline comments.
libcxx/include/__memory_resource/memory_resource.h
57

Why bother to use std::addressof? There is no memory_resource::operator& and it's not a template, so ADL isn't going to find operator& in any user namespaces. Is that a policy? It seems like unnecessary obfuscation.

libcxx/src/memory_resource.cpp
14

What is the reason to put the destructor in the dylib?

It's the key function, so the vtable will be generated where this function is defined. If it's inline, the vtable gets generated in every TU that uses memory_resource. Maybe that's OK though.

FWIW we are dropping this in favour of D89057. @philnik I think you should abandon to avoid confusion.

philnik abandoned this revision.Oct 1 2022, 6:04 AM