[clang] [CodeGen] Implement Objective-C WebAssembly exception handling support (PR #215562)
David Chisnall via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 14 02:33:10 PDT 2026
Hendrik =?utf-8?q?Hübner?= <hhuebner at hhuebnerMacBookPro.local>,
Hendrik =?utf-8?q?Hübner?= <hhuebner at hhuebnerMacBookPro.local>,
Hendrik =?utf-8?q?Hübner?= <hhuebner at MacBookPro.lan>,
Hendrik =?utf-8?q?Hübner?= <hhuebner at MacBookPro.lan>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/215562 at github.com>
================
@@ -148,12 +151,22 @@ void CGObjCRuntime::EmitTryCatchStmt(CodeGenFunction &CGF,
Cont = CGF.getJumpDestInCurrentScope("eh.cont");
bool useFunclets = EHPersonality::get(CGF).usesFuncletPads();
+ bool IsWasm = EHPersonality::get(CGF).isWasmPersonality();
+ bool IsMSVC = EHPersonality::get(CGF).isMSVCPersonality();
CodeGenFunction::FinallyInfo FinallyInfo;
- if (!useFunclets)
- if (const ObjCAtFinallyStmt *Finally = S.getFinallyStmt())
- FinallyInfo.enter(CGF, Finally->getFinallyBody(),
- beginCatchFn, endCatchFn, exceptionRethrowFn);
+ if (const ObjCAtFinallyStmt *Finally = S.getFinallyStmt()) {
+ if (!useFunclets) {
+ // The finally statement is executed as a cleanup for the normal and
+ // exceptional control flow out of a try-catch block. This is all
+ // implemented in FinallyInfo. Here we enter a new EHCatchScope.
+ FinallyInfo.enter(CGF, Finally->getFinallyBody(), beginCatchFn,
+ endCatchFn, exceptionRethrowFn);
+ } else if (IsWasm) {
+ CGF.ErrorUnsupported(Finally,
+ "@finally is not implemented for WebAssembly");
----------------
davidchisnall wrote:
For an initial version, lowering finally to a catchall and a rethrow is close enough that it is unlikely anyone will notice the difference.
https://github.com/llvm/llvm-project/pull/215562
More information about the cfe-commits
mailing list