[RFC] [Windows SEH] Local_Unwind (Jumping out of a _finally)

Hi,

Per Reid’s feedback, I have separated two SEH missing features.

This thread now is only focusing on _local_unwind(), Jumping out of _finally.

The design is documented in Wiki here: https://github.com/tentzen/llvm-project/wiki/Windows-SEH:-Local_Unwind-(aka:-Jumping-Out-of-_Finally)

The implementation can be seen here: https://github.com/tentzen/llvm-project/compare/SEH-LU-base…SEH-LU?expand=1

There are only 13 files changed that is much less complicated than previously when it’s combined with -EHa.

Major code is surrounding at SehTryStmt and _Finally in CGexception.cpp that is the place to house Windows SEH specific code anyways.

The implementation chose to lever Parser/Semantic phase (SemaStmt.cpp, JumpDiagnostics.cpp, scope.h, etc) to identify the right _Try scope for LU dispatching because that is the place “warn_jump_out_of_seh_finally” is diagnosed and reported. I feel this is the most robust approach.

Local_unwind is an important feature, broadly used in Windows Kernel for all architectures.

Without LU, Windows SEH is incomplete!

Thanks,

–Ten

Any more comment or concern?

Also +@Kaylor, Andrew and @pengfei.wang@intel.com

Thanks,

–Ten

Hi Ten,

I haven’t had a chance to fully digest your design, but I read through it and it sounds like a good direction. I’ll take a closer look next week and give you more specific feedback.

For now, I just wanted to say that I’m very happy to see some progress being made on this. Thanks for the RFC!

BTW, is there a reason you did not put the patch in Phabricator?

-Andy

Thank you for reading through it, Andrew.

I’m a new comer in LLVM world. I was told that a new feature (or new design) must go through RFC first.

With your request, Yes I will put this patch (and -EHa one) in Phabricator shortly.

Thanks,

–Ten