[clang] Objective C: use C++ exceptions on MinGW+GNUstep (PR #77255)

Frederik Carlier via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 9 01:29:22 PST 2024


================
@@ -819,10 +819,19 @@ class CGObjCGNUstep : public CGObjCGNU {
       SlotLookupSuperFn.init(&CGM, "objc_slot_lookup_super", SlotTy,
                              PtrToObjCSuperTy, SelectorTy);
       // If we're in ObjC++ mode, then we want to make
-      if (usesSEHExceptions) {
-          llvm::Type *VoidTy = llvm::Type::getVoidTy(VMContext);
-          // void objc_exception_rethrow(void)
-          ExceptionReThrowFn.init(&CGM, "objc_exception_rethrow", VoidTy);
+      if (CGM.getTarget().getTriple().isOSCygMing() &&
+          isRuntime(ObjCRuntime::GNUstep, 2)) {
+        llvm::Type *VoidTy = llvm::Type::getVoidTy(VMContext);
+        // void *__cxa_begin_catch(void *e)
+        EnterCatchFn.init(&CGM, "__cxa_begin_catch", PtrTy, PtrTy);
+        // void __cxa_end_catch(void)
+        ExitCatchFn.init(&CGM, "__cxa_end_catch", VoidTy);
+        // void objc_exception_rethrow(void*)
+        ExceptionReThrowFn.init(&CGM, "__cxa_rethrow", PtrTy);
+      } else if (usesSEHExceptions) {
+        llvm::Type *VoidTy = llvm::Type::getVoidTy(VMContext);
----------------
qmfrederik wrote:

Good remark, thanks.  Fixed this.

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


More information about the cfe-commits mailing list