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.
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.