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

Frederik Carlier via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 8 01:02:32 PST 2024


================
@@ -2210,7 +2219,12 @@ CGObjCGNU::CGObjCGNU(CodeGenModule &cgm, unsigned runtimeABIVersion,
 
   // void objc_exception_throw(id);
   ExceptionThrowFn.init(&CGM, "objc_exception_throw", VoidTy, IdTy);
-  ExceptionReThrowFn.init(&CGM, "objc_exception_throw", VoidTy, IdTy);
+  if ((CGM.getTarget().getTriple().isOSCygMing() &&
+       isRuntime(ObjCRuntime::GNUstep, 2))) {
+    ExceptionReThrowFn.init(&CGM, "objc_exception_rethrow", VoidTy, IdTy);
+  } else {
----------------
qmfrederik wrote:

On MinGW + objc2, `objc_exception_rethrow` is called; on other targets, `objc_exception_throw` is used (**re**throw vs throw).  I find it odd we were using `objc_exception_throw` to *re*throw an exception but decided to change it for MinGW+objc2 only.

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


More information about the cfe-commits mailing list