This is an archive of the discontinued LLVM Phabricator instance.

[SEH] Fix regression with SEH in noexpect functions
ClosedPublic

Authored by ogoffart on May 6 2021, 2:17 PM.

Details

Summary

Commit 5baea0560160a693b19022c5d0ba637b6b46b2d8 set the CurCodeDecl
because it was needed to pass the assert in CodeGenFunction::EmitLValueForLambdaField,
But this was not right to do as CodeGenFunction::FinishFunction passes it to EmitEndEHSpec
and cause corruption of the EHStack.

Revert the part of the commit that changes the CurCodeDecl, and just change the assert
to allow more conditions.

Diff Detail

Event Timeline

ogoffart requested review of this revision.May 6 2021, 2:17 PM
ogoffart created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMay 6 2021, 2:17 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
This revision was not accepted when it landed; it landed in state Needs Review.May 7 2021, 1:28 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
rnk added a comment.May 7 2021, 1:29 PM

I went ahead and implemented my suggested changes and pushed this with attribution. Thanks for the fix!

clang/lib/CodeGen/CGException.cpp
1966

I think passing GlobalDecl() here is intentional, there must have been some reason to have the helper CGF have a null function. This noexcept thing seems like one such example.

clang/lib/CodeGen/CGExpr.cpp
4188

Other uses of CurCodeDecl check it for null, so I think it makes sense to go ahead and do the same here.