[libcxx-commits] [libunwind] [libcxx] [libcxxabi] [llvm] [lld] [flang] [clang] [clang-tools-extra] [libc] [compiler-rt] [libclc] [libc++] [libc++abi] Initialize exception directly in make_exception_ptr if __cxa_init_primary_exception is available in ABI-library (PR #65534)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 15 13:23:15 PST 2024


================
@@ -9,23 +9,57 @@
 #ifndef _LIBCPP___EXCEPTION_EXCEPTION_PTR_H
 #define _LIBCPP___EXCEPTION_EXCEPTION_PTR_H
 
+#include <__availability>
 #include <__config>
 #include <__exception/operations.h>
 #include <__memory/addressof.h>
+#include <__memory/construct_at.h>
+#include <__type_traits/decay.h>
+#include <__utility/unreachable.h>
 #include <cstddef>
 #include <cstdlib>
+#include <new>
+#include <typeinfo>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif
 
+#ifndef _LIBCPP_ABI_MICROSOFT
+
+namespace __cxxabiv1 {
+
+extern "C" {
+_LIBCPP_OVERRIDABLE_FUNC_VIS void* __cxa_allocate_exception(size_t) throw();
+_LIBCPP_OVERRIDABLE_FUNC_VIS void __cxa_free_exception(void*) throw();
+
+struct __cxa_exception;
+_LIBCPP_OVERRIDABLE_FUNC_VIS __cxa_exception* __cxa_init_primary_exception(
+    void*,
+    std::type_info*,
+    void(
+#  if defined(_WIN32)
+        __thiscall
----------------
itrofimow wrote:

P.S. `__USING_WASM_EXCEPTIONS__` usage here confuses me: it's not used consistently across the libcxxabi, and i'm not really sure what this is about and whether I should adjust the signature of `__cxa_init_primary_exception`.
I assume i should, right?

https://github.com/llvm/llvm-project/pull/65534


More information about the libcxx-commits mailing list