aboutsummaryrefslogtreecommitdiff
path: root/lib/libcxxabi/src/cxa_exception.cpp
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-08-23 02:31:37 +0200
committerAndrew Kelley <andrew@ziglang.org>2024-09-19 18:20:21 -0700
commitd13bc04cb4c4c2f0806b9d9c676cb013ea888828 (patch)
treefce89240022df2234865aac80c53030bee741932 /lib/libcxxabi/src/cxa_exception.cpp
parent70a1805e46b66955b52ba5ac46914f212d99d19c (diff)
downloadzig-d13bc04cb4c4c2f0806b9d9c676cb013ea888828.tar.gz
zig-d13bc04cb4c4c2f0806b9d9c676cb013ea888828.zip
libcxxabi: Update to LLVM 19.
Diffstat (limited to 'lib/libcxxabi/src/cxa_exception.cpp')
-rw-r--r--lib/libcxxabi/src/cxa_exception.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/libcxxabi/src/cxa_exception.cpp b/lib/libcxxabi/src/cxa_exception.cpp
index 65e9f4504d..92901a83bf 100644
--- a/lib/libcxxabi/src/cxa_exception.cpp
+++ b/lib/libcxxabi/src/cxa_exception.cpp
@@ -207,7 +207,12 @@ void __cxa_free_exception(void *thrown_object) throw() {
}
__cxa_exception* __cxa_init_primary_exception(void* object, std::type_info* tinfo,
+#ifdef __wasm__
+// In Wasm, a destructor returns its argument
+ void *(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw() {
+#else
void(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw() {
+#endif
__cxa_exception* exception_header = cxa_exception_from_thrown_object(object);
exception_header->referenceCount = 0;
exception_header->unexpectedHandler = std::get_unexpected();
@@ -267,7 +272,7 @@ will call terminate, assuming that there was no handler for the
exception.
*/
void
-#ifdef __USING_WASM_EXCEPTIONS__
+#ifdef __wasm__
// In Wasm, a destructor returns its argument
__cxa_throw(void *thrown_object, std::type_info *tinfo, void *(_LIBCXXABI_DTOR_FUNC *dest)(void *)) {
#else
@@ -584,6 +589,11 @@ void __cxa_end_catch() {
}
}
+void __cxa_call_terminate(void* unwind_arg) throw() {
+ __cxa_begin_catch(unwind_arg);
+ std::terminate();
+}
+
// Note: exception_header may be masquerading as a __cxa_dependent_exception
// and that's ok. exceptionType is there too.
// However watch out for foreign exceptions. Return null for them.