[libcxx-commits] [PATCH] D124990: [libcxxabi] Use the right calling convention for exception destructors on i386 Windows

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 5 13:21:55 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGaeb4907ed658: [libcxxabi] Use the right calling convention for exception destructors on i386… (authored by mstorsjo).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124990/new/

https://reviews.llvm.org/D124990

Files:
  libcxxabi/include/__cxxabi_config.h
  libcxxabi/include/cxxabi.h
  libcxxabi/src/cxa_exception.cpp
  libcxxabi/src/cxa_exception.h


Index: libcxxabi/src/cxa_exception.h
===================================================================
--- libcxxabi/src/cxa_exception.h
+++ libcxxabi/src/cxa_exception.h
@@ -43,7 +43,7 @@
 
     //  Manage the exception object itself.
     std::type_info *exceptionType;
-    void (*exceptionDestructor)(void *);
+    void (_LIBCXXABI_DTOR_FUNC *exceptionDestructor)(void *);
     std::unexpected_handler unexpectedHandler;
     std::terminate_handler  terminateHandler;
 
@@ -81,7 +81,7 @@
 #endif
 
     std::type_info *exceptionType;
-    void (*exceptionDestructor)(void *);
+    void (_LIBCXXABI_DTOR_FUNC *exceptionDestructor)(void *);
     std::unexpected_handler unexpectedHandler;
     std::terminate_handler terminateHandler;
 
Index: libcxxabi/src/cxa_exception.cpp
===================================================================
--- libcxxabi/src/cxa_exception.cpp
+++ libcxxabi/src/cxa_exception.cpp
@@ -254,7 +254,7 @@
 exception.
 */
 void
-__cxa_throw(void *thrown_object, std::type_info *tinfo, void (*dest)(void *)) {
+__cxa_throw(void *thrown_object, std::type_info *tinfo, void (_LIBCXXABI_DTOR_FUNC *dest)(void *)) {
     __cxa_eh_globals *globals = __cxa_get_globals();
     __cxa_exception* exception_header = cxa_exception_from_thrown_object(thrown_object);
 
Index: libcxxabi/include/cxxabi.h
===================================================================
--- libcxxabi/include/cxxabi.h
+++ libcxxabi/include/cxxabi.h
@@ -47,7 +47,7 @@
 // 2.4.3 Throwing the Exception Object
 extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void
 __cxa_throw(void *thrown_exception, std::type_info *tinfo,
-            void (*dest)(void *));
+            void (_LIBCXXABI_DTOR_FUNC *dest)(void *));
 
 // 2.5.3 Exception Handlers
 extern _LIBCXXABI_FUNC_VIS void *
Index: libcxxabi/include/__cxxabi_config.h
===================================================================
--- libcxxabi/include/__cxxabi_config.h
+++ libcxxabi/include/__cxxabi_config.h
@@ -97,4 +97,10 @@
 #  define _LIBCXXABI_NO_EXCEPTIONS
 #endif
 
+#if defined(_WIN32)
+#define _LIBCXXABI_DTOR_FUNC __thiscall
+#else
+#define _LIBCXXABI_DTOR_FUNC
+#endif
+
 #endif // ____CXXABI_CONFIG_H


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124990.427425.patch
Type: text/x-patch
Size: 2181 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220505/b5e4c9d0/attachment.bin>


More information about the libcxx-commits mailing list