[CGObjC] Open cleanup scope before SaveAndRestore CurrentFuncletPad and push CatchRet...
authorStefan Gränitz <stefan.graenitz@gmail.com>
Tue, 22 Nov 2022 09:13:33 +0000 (10:13 +0100)
committerStefan Gränitz <stefan.graenitz@gmail.com>
Tue, 22 Nov 2022 11:02:53 +0000 (12:02 +0100)
commit9a9d636caeea9ca9364b906364ac1aaba0869858
tree197e72afee3d05dc3c28a623514b018e13487d0d
parentde767db633f64d79b4d82cb6776680ce8e8a4004
[CGObjC] Open cleanup scope before SaveAndRestore CurrentFuncletPad and push CatchRetScope early

Pushing the `CatchRetScope` early causes cleanups for catch parameters to be emitted in the basic block of the catch handler instead of the `catchret.dest` block. This is important because the latter is not part of the catchpad and this caused code truncations due to ARC PreISel intrinsics in WinEHPrepare.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D137939
clang/lib/CodeGen/CGObjCRuntime.cpp
clang/test/CodeGenObjCXX/arc-exceptions-seh.mm