summaryrefslogtreecommitdiffstats
path: root/src/Unwind-seh.cpp
diff options
context:
space:
mode:
authorPetr Hosek <phosek@chromium.org>2019-02-02 21:15:49 +0000
committerPetr Hosek <phosek@chromium.org>2019-02-02 21:15:49 +0000
commit57c06d628fd8ff0ab1ef688492ce669145ad6657 (patch)
tree0ae2b1572e72e2c788c869659e964c34da2cfbe8 /src/Unwind-seh.cpp
parent007947db31faa42a66575319353f7de91a79aaad (diff)
downloadplatform_external_libunwind_llvm-57c06d628fd8ff0ab1ef688492ce669145ad6657.tar.gz
platform_external_libunwind_llvm-57c06d628fd8ff0ab1ef688492ce669145ad6657.tar.bz2
platform_external_libunwind_llvm-57c06d628fd8ff0ab1ef688492ce669145ad6657.zip
[libunwind] Provide placement new definition
While Clang automatically generates the code for placement new, g++ doesn't do that so we need to provide our own definition. Differential Revision: https://reviews.llvm.org/D57455 git-svn-id: https://llvm.org/svn/llvm-project/libunwind/trunk@352966 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'src/Unwind-seh.cpp')
-rw-r--r--src/Unwind-seh.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/Unwind-seh.cpp b/src/Unwind-seh.cpp
index 26eb0ef..8b4b7d5 100644
--- a/src/Unwind-seh.cpp
+++ b/src/Unwind-seh.cpp
@@ -49,10 +49,6 @@ using namespace libunwind;
/// Class of foreign exceptions based on unrecognized SEH exceptions.
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*);
-
/// Exception cleanup routine used by \c _GCC_specific_handler to
/// free foreign exceptions.
static void seh_exc_cleanup(_Unwind_Reason_Code urc, _Unwind_Exception *exc) {
@@ -452,20 +448,23 @@ _Unwind_GetRegionStart(struct _Unwind_Context *context) {
static int
_unw_init_seh(unw_cursor_t *cursor, CONTEXT *context) {
#ifdef _LIBUNWIND_TARGET_X86_64
- new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_x86_64>(
- context, LocalAddressSpace::sThisAddressSpace);
+ new (reinterpret_cast<UnwindCursor<LocalAddressSpace, Registers_x86_64> *>(cursor))
+ UnwindCursor<LocalAddressSpace, Registers_x86_64>(
+ context, LocalAddressSpace::sThisAddressSpace);
auto *co = reinterpret_cast<AbstractUnwindCursor *>(cursor);
co->setInfoBasedOnIPRegister();
return UNW_ESUCCESS;
#elif defined(_LIBUNWIND_TARGET_ARM)
- new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_arm>(
- context, LocalAddressSpace::sThisAddressSpace);
+ new (reinterpret_cast<UnwindCursor<LocalAddressSpace, Registers_arm> *>(cursor))
+ UnwindCursor<LocalAddressSpace, Registers_arm>(
+ context, LocalAddressSpace::sThisAddressSpace);
auto *co = reinterpret_cast<AbstractUnwindCursor *>(cursor);
co->setInfoBasedOnIPRegister();
return UNW_ESUCCESS;
#elif defined(_LIBUNWIND_TARGET_AARCH64)
- new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_arm64>(
- context, LocalAddressSpace::sThisAddressSpace);
+ new (reinterpret_cast<UnwindCursor<LocalAddressSpace, Registers_arm64> *>(cursor))
+ UnwindCursor<LocalAddressSpace, Registers_arm64>(
+ context, LocalAddressSpace::sThisAddressSpace);
auto *co = reinterpret_cast<AbstractUnwindCursor *>(cursor);
co->setInfoBasedOnIPRegister();
return UNW_ESUCCESS;