[flang-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 flang-commits
flang-commits at lists.llvm.org
Mon Jan 15 13:16:59 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:
MinGW requires this: https://buildkite.com/llvm-project/libcxx-ci/builds/32388#018c84de-f231-43b4-839a-c9fe88f118fe/311-1557
This is how `__cxa_throw` (and `__cxa_init_primary_exception` as well) is defined: https://github.com/llvm/llvm-project/blob/2bb2a42fa261d728e32ba0b1f9cf27ba7991440f/libcxxabi/include/cxxabi.h#L48-L55
and `_LIBCXXABI_DTOR_FUNC` expands to `__thiscall` under win32: https://github.com/llvm/llvm-project/blob/2bb2a42fa261d728e32ba0b1f9cf27ba7991440f/libcxxabi/include/__cxxabi_config.h#L100-L101
https://github.com/llvm/llvm-project/pull/65534
More information about the flang-commits
mailing list