This revision was automatically updated to reflect the committed changes.
Closed by commit rL339258: [libunwind][include] Add SEH declarations to 
<unwind.h>. (authored by cdavis, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D50414?vs=159722&id=159728#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D50414

Files:
  libunwind/trunk/include/unwind.h


Index: libunwind/trunk/include/unwind.h
===================================================================
--- libunwind/trunk/include/unwind.h
+++ libunwind/trunk/include/unwind.h
@@ -19,6 +19,10 @@
 #include <stdint.h>
 #include <stddef.h>
 
+#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
+#include <windows.h>
+#endif
+
 #if defined(__APPLE__)
 #define LIBUNWIND_UNAVAIL __attribute__ (( unavailable ))
 #else
@@ -120,13 +124,17 @@
   uint64_t exception_class;
   void (*exception_cleanup)(_Unwind_Reason_Code reason,
                             _Unwind_Exception *exc);
+#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
+  uintptr_t private_[6];
+#else
   uintptr_t private_1; // non-zero means forced unwind
   uintptr_t private_2; // holds sp that phase1 found for phase2 to use
+#endif
 #if __SIZEOF_POINTER__ == 4
   // The implementation of _Unwind_Exception uses an attribute mode on the
   // above fields which has the side effect of causing this whole struct to
-  // round up to 32 bytes in size. To be more explicit, we add pad fields
-  // added for binary compatibility.
+  // round up to 32 bytes in size (48 with SEH). To be more explicit, we add
+  // pad fields added for binary compatibility.
   uint32_t reserved[3];
 #endif
   // The Itanium ABI requires that _Unwind_Exception objects are "double-word
@@ -369,6 +377,24 @@
 extern void *__deregister_frame_info_bases(const void *fde)
     LIBUNWIND_UNAVAIL;
 
+#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
+// This is the common wrapper for GCC-style personality functions with SEH.
+#ifdef __x86_64__
+// The DISPATCHER_CONTEXT struct is only defined on x64.
+extern EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD exc,
+                                                   PVOID frame,
+                                                   PCONTEXT ctx,
+                                                   PDISPATCHER_CONTEXT disp,
+                                                   _Unwind_Personality_Fn 
pers);
+#else
+extern EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD exc,
+                                                   PVOID frame,
+                                                   PCONTEXT ctx,
+                                                   PVOID disp,
+                                                   _Unwind_Personality_Fn 
pers);
+#endif
+#endif
+
 #ifdef __cplusplus
 }
 #endif


Index: libunwind/trunk/include/unwind.h
===================================================================
--- libunwind/trunk/include/unwind.h
+++ libunwind/trunk/include/unwind.h
@@ -19,6 +19,10 @@
 #include <stdint.h>
 #include <stddef.h>
 
+#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
+#include <windows.h>
+#endif
+
 #if defined(__APPLE__)
 #define LIBUNWIND_UNAVAIL __attribute__ (( unavailable ))
 #else
@@ -120,13 +124,17 @@
   uint64_t exception_class;
   void (*exception_cleanup)(_Unwind_Reason_Code reason,
                             _Unwind_Exception *exc);
+#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
+  uintptr_t private_[6];
+#else
   uintptr_t private_1; // non-zero means forced unwind
   uintptr_t private_2; // holds sp that phase1 found for phase2 to use
+#endif
 #if __SIZEOF_POINTER__ == 4
   // The implementation of _Unwind_Exception uses an attribute mode on the
   // above fields which has the side effect of causing this whole struct to
-  // round up to 32 bytes in size. To be more explicit, we add pad fields
-  // added for binary compatibility.
+  // round up to 32 bytes in size (48 with SEH). To be more explicit, we add
+  // pad fields added for binary compatibility.
   uint32_t reserved[3];
 #endif
   // The Itanium ABI requires that _Unwind_Exception objects are "double-word
@@ -369,6 +377,24 @@
 extern void *__deregister_frame_info_bases(const void *fde)
     LIBUNWIND_UNAVAIL;
 
+#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
+// This is the common wrapper for GCC-style personality functions with SEH.
+#ifdef __x86_64__
+// The DISPATCHER_CONTEXT struct is only defined on x64.
+extern EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD exc,
+                                                   PVOID frame,
+                                                   PCONTEXT ctx,
+                                                   PDISPATCHER_CONTEXT disp,
+                                                   _Unwind_Personality_Fn pers);
+#else
+extern EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD exc,
+                                                   PVOID frame,
+                                                   PCONTEXT ctx,
+                                                   PVOID disp,
+                                                   _Unwind_Personality_Fn pers);
+#endif
+#endif
+
 #ifdef __cplusplus
 }
 #endif
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to