[libcxx-commits] [PATCH] D136196: [libc++][PMR] Move the pmr::memory_resource destructor into the dylib

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 18 12:44:45 PDT 2022


philnik created this revision.
philnik added reviewers: ldionne, Mordante, var-const.
Herald added a project: All.
philnik requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

This avoids emitting the VTable of `pmr::memory_resource` in every TU.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136196

Files:
  libcxx/include/__memory_resource/memory_resource.h
  libcxx/src/memory_resource.cpp


Index: libcxx/src/memory_resource.cpp
===================================================================
--- libcxx/src/memory_resource.cpp
+++ libcxx/src/memory_resource.cpp
@@ -24,7 +24,7 @@
 
 // memory_resource
 
-//memory_resource::~memory_resource() {}
+memory_resource::~memory_resource() = default;
 
 // new_delete_resource()
 
Index: libcxx/include/__memory_resource/memory_resource.h
===================================================================
--- libcxx/include/__memory_resource/memory_resource.h
+++ libcxx/include/__memory_resource/memory_resource.h
@@ -24,13 +24,11 @@
 
 // [mem.res.class]
 
-_LIBCPP_DIAGNOSTIC_PUSH
-_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables") // TODO: move destructor into the dylib
 class _LIBCPP_TYPE_VIS memory_resource {
   static const size_t __max_align = alignof(max_align_t);
 
 public:
-  virtual ~memory_resource() = default;
+  virtual ~memory_resource();
 
   [[using __gnu__: __returns_nonnull__, __alloc_size__(2), __alloc_align__(3)]] _LIBCPP_HIDE_FROM_ABI void*
   allocate(size_t __bytes, size_t __align = __max_align) {
@@ -49,7 +47,6 @@
   virtual void do_deallocate(void*, size_t, size_t)               = 0;
   virtual bool do_is_equal(memory_resource const&) const noexcept = 0;
 };
-_LIBCPP_DIAGNOSTIC_POP
 
 // [mem.res.eq]
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136196.468669.patch
Type: text/x-patch
Size: 1301 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20221018/40454594/attachment-0001.bin>


More information about the libcxx-commits mailing list