================
@@ -182,61 +196,122 @@ void CGObjCRuntime::EmitTryCatchStmt(CodeGenFunction
&CGF,
Handler.TypeInfo = GetEHType(CatchDecl->getType());
}
+ // Create a new catch scope
EHCatchScope *Catch = CGF.EHStack.pushCatch(Handlers.size());
for (unsigned I = 0, E = Handlers.size(); I != E; ++I)
Catch->setHandler(I, { Handlers[I].TypeInfo, Handlers[I].Flags },
Handlers[I].Block);
}
- if (useFunclets)
+ if (IsMSVC) {
if (const ObjCAtFinallyStmt *Finally = S.getFinallyStmt()) {
- CodeGenFunction HelperCGF(CGM, /*suppressNewContext=*/true);
- if (!CGF.CurSEHParent)
- CGF.CurSEHParent = cast<NamedDecl>(CGF.CurFuncDecl);
- // Outline the finally block.
- const Stmt *FinallyBlock = Finally->getFinallyBody();
- HelperCGF.startOutlinedSEHHelper(CGF, /*isFilter*/false, FinallyBlock);
+ CodeGenFunction HelperCGF(CGM, /*suppressNewContext=*/true);
+ if (!CGF.CurSEHParent)
+ CGF.CurSEHParent = cast<NamedDecl>(CGF.CurFuncDecl);
+ // Outline the finally block.
+ const Stmt *FinallyBlock = Finally->getFinallyBody();
+ HelperCGF.startOutlinedSEHHelper(CGF, /*isFilter*/ false, FinallyBlock);
- // Emit the original filter expression, convert to i32, and return.
- HelperCGF.EmitStmt(FinallyBlock);
+ // Emit the original filter expression, convert to i32, and return.
+ HelperCGF.EmitStmt(FinallyBlock);
- HelperCGF.FinishFunction(FinallyBlock->getEndLoc());
+ HelperCGF.FinishFunction(FinallyBlock->getEndLoc());
- llvm::Function *FinallyFunc = HelperCGF.CurFn;
+ llvm::Function *FinallyFunc = HelperCGF.CurFn;
-
- // Push a cleanup for __finally blocks.
- CGF.pushSEHCleanup(NormalAndEHCleanup, FinallyFunc);
+ // Push a cleanup for __finally blocks.
+ CGF.pushSEHCleanup(NormalAndEHCleanup, FinallyFunc);
}
-
+ }
// Emit the try body.
CGF.EmitStmt(S.getTryBody());
+ // lpad or catch.dispatch (the dispatch block) has now been emitted
----------------
HendrikHuebner wrote:
I took these comments from the original PR. Maybe they are a bit too verbose? I
can add the examples to the PR description so they can be found using `git
blame`.
https://github.com/llvm/llvm-project/pull/215562
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits