[libcxx-commits] [PATCH] D57455: [libunwind] Provide inline placement new definition

Petr Hosek via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 30 08:43:27 PST 2019


phosek created this revision.
phosek added reviewers: ldionne, mstorsjo, mgorny.
Herald added subscribers: libcxx-commits, christof.

While Clang automatically generates the code for global placement new,
g++ doesn't do that so we need to provide our own definition.


Repository:
  rUNW libunwind

https://reviews.llvm.org/D57455

Files:
  libunwind/src/Unwind-seh.cpp
  libunwind/src/libunwind.cpp


Index: libunwind/src/libunwind.cpp
===================================================================
--- libunwind/src/libunwind.cpp
+++ libunwind/src/libunwind.cpp
@@ -24,8 +24,8 @@
 using namespace libunwind;
 
 // libunwind does not and should not depend on C++ library which means that we
-// need our own declaration of global placement new.
-void *operator new(size_t, void*);
+// need our own defition of inline placement new.
+inline void *operator new(size_t, void* p) { return p; }
 
 /// internal object to represent this processes address space
 LocalAddressSpace LocalAddressSpace::sThisAddressSpace;
Index: libunwind/src/Unwind-seh.cpp
===================================================================
--- libunwind/src/Unwind-seh.cpp
+++ libunwind/src/Unwind-seh.cpp
@@ -50,8 +50,8 @@
 static const uint64_t kSEHExceptionClass = 0x434C4E4753454800; // CLNGSEH\0
 
 // libunwind does not and should not depend on C++ library which means that we
-// need our own declaration of global placement new.
-void *operator new(size_t, void*);
+// need our own defition of inline placement new.
+inline void *operator new(size_t, void* p) { return p; }
 
 /// Exception cleanup routine used by \c _GCC_specific_handler to
 /// free foreign exceptions.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57455.184304.patch
Type: text/x-patch
Size: 1261 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190130/8a2199d3/attachment.bin>


More information about the libcxx-commits mailing list