[clang] [WinEH] Fix try scopes leaking to caller on inline (PR #167176)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 12 07:31:31 PST 2025
MuellerMP wrote:
Okay so I just realized how I can reduce this fix to 32 lines basically and resolve the issues I had with WinEHPrepare.
`PopCleanupBlock` already provides the mechanism for try scope termination if we have a cleanup scope for e.g. a destructor call.
If we do not have any cleanup scope available the scope termination mechanism is never called though.
So the best fix I can think of now is to just push a noop `TerminateTryScope` cleanup on the EHStack.
Since we can push this even after the Catch this resolved my issues with WinEHPrepare, since the state handling algorithm now also traverses the scope end in the correct order.
So I deleted my backend test and fixes in WinEhPrepare and fixed up my frontend tests to be executed without opt passes.
This also resolves the FIXME in the windows-seh-EHa-CppCatchReturn.cpp test.
https://github.com/llvm/llvm-project/pull/167176
More information about the cfe-commits
mailing list