diff options
author | Heejin Ahn <aheejin@gmail.com> | 2024-05-22 09:47:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-22 09:47:54 -0700 |
commit | 271eb0686b7b0f9d2e016751399b948ccbbe7925 (patch) | |
tree | e15c0d0413f220b967c262116ca29d5eb282bbdb /libcxx | |
parent | e8dd4df72bb5f63a235359d46d7825fe46761ed2 (diff) | |
download | llvm-271eb0686b7b0f9d2e016751399b948ccbbe7925.zip llvm-271eb0686b7b0f9d2e016751399b948ccbbe7925.tar.gz llvm-271eb0686b7b0f9d2e016751399b948ccbbe7925.tar.bz2 |
[WebAssembly] Upstream misc. EH changes (#92990)
This upstreams more recent, mostly EH changes from libcxx and libcxxabi:
- `__cxa_init_primary_exception`-related changes made when updating to
LLVM 18.1.2 (https://github.com/emscripten-core/emscripten/pull/21638)
- Removes ctype macros
(https://github.com/emscripten-core/emscripten/pull/20960)
- Guard destructor changes with `__wasm__`
(https://github.com/emscripten-core/emscripten/pull/21974)
Diffstat (limited to 'libcxx')
-rw-r--r-- | libcxx/include/__exception/exception_ptr.h | 17 | ||||
-rw-r--r-- | libcxx/include/__locale | 4 |
2 files changed, 16 insertions, 5 deletions
diff --git a/libcxx/include/__exception/exception_ptr.h b/libcxx/include/__exception/exception_ptr.h index c9027de..868fd7c 100644 --- a/libcxx/include/__exception/exception_ptr.h +++ b/libcxx/include/__exception/exception_ptr.h @@ -38,11 +38,14 @@ struct __cxa_exception; _LIBCPP_OVERRIDABLE_FUNC_VIS __cxa_exception* __cxa_init_primary_exception( void*, std::type_info*, - void( # if defined(_WIN32) - __thiscall + void(__thiscall*)(void*)) throw(); +# elif defined(__wasm__) + // In Wasm, a destructor returns its argument + void* (*)(void*)) throw(); +# else + void (*)(void*)) throw(); # endif - *)(void*)) throw(); } } // namespace __cxxabiv1 @@ -92,8 +95,16 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT { using _Ep2 = __decay_t<_Ep>; void* __ex = __cxxabiv1::__cxa_allocate_exception(sizeof(_Ep)); +# ifdef __wasm__ + // In Wasm, a destructor returns its argument + (void)__cxxabiv1::__cxa_init_primary_exception(__ex, const_cast<std::type_info*>(&typeid(_Ep)), [](void* __p) -> void* { +# else (void)__cxxabiv1::__cxa_init_primary_exception(__ex, const_cast<std::type_info*>(&typeid(_Ep)), [](void* __p) { +# endif std::__destroy_at(static_cast<_Ep2*>(__p)); +# ifdef __wasm__ + return __p; +# endif }); try { diff --git a/libcxx/include/__locale b/libcxx/include/__locale index 36ac099..1e97c75 100644 --- a/libcxx/include/__locale +++ b/libcxx/include/__locale @@ -343,12 +343,12 @@ public: static const mask __regex_word = 0x4000; // 0x8000 and 0x0100 and 0x00ff are used # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA -#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) +#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) # ifdef __APPLE__ typedef __uint32_t mask; # elif defined(__FreeBSD__) typedef unsigned long mask; -# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__) +# elif defined(__NetBSD__) typedef unsigned short mask; # endif static const mask space = _CTYPE_S; |