[SEH] Fix regression with SEH in noexpect functions
authorOlivier Goffart <ogoffart@woboq.com>
Fri, 7 May 2021 20:23:53 +0000 (13:23 -0700)
committerReid Kleckner <rnk@google.com>
Fri, 7 May 2021 20:27:59 +0000 (13:27 -0700)
commitc4adc49a1c988e6ea8a340b6245525ef5599812c
treec22c0a1e059f7c2ba62c4f840373442a5c8fa0d5
parent337d7652823f59f4613552cebdf81292bf8f393d
[SEH] Fix regression with SEH in noexpect functions

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 instead
adjust the assert to check for a null CurCodeDecl.

Differential Revision: https://reviews.llvm.org/D102027
clang/lib/CodeGen/CGException.cpp
clang/lib/CodeGen/CGExpr.cpp
clang/test/CodeGenCXX/exceptions-seh.cpp