[clang] [CodeGen][ObjC] Try/Catch support for WebAssembly (PR #171038)

Hendrik Hübner via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 7 05:49:41 PST 2025


================
@@ -207,36 +215,59 @@ void CGObjCRuntime::EmitTryCatchStmt(CodeGenFunction &CGF,
         // Push a cleanup for __finally blocks.
         CGF.pushSEHCleanup(NormalAndEHCleanup, FinallyFunc);
     }
+  }
 
 
   // Emit the try body.
   CGF.EmitStmt(S.getTryBody());
 
   // Leave the try.
+  llvm::BasicBlock* dispatchBlock{};
   if (S.getNumCatchStmts())
-    CGF.popCatchScope();
+    dispatchBlock = CGF.popCatchScope();
 
   // Remember where we were.
   CGBuilderTy::InsertPoint SavedIP = CGF.Builder.saveAndClearIP();
 
+  // Wasm uses Windows-style EH instructions, but merges all catch clauses into
----------------
HendrikHuebner wrote:

TODO: This is taken from `CGException.cpp`, we may want to refactor it into a shared helper.

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


More information about the cfe-commits mailing list