forked from OSchip/llvm-project
[SEH] Fix regression with SEH in noexpect functions
Commit 5baea05601
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
This commit is contained in:
parent
337d765282
commit
c4adc49a1c
|
@ -1966,7 +1966,6 @@ void CodeGenFunction::startOutlinedSEHHelper(CodeGenFunction &ParentCGF,
|
||||||
StartFunction(GlobalDecl(), RetTy, Fn, FnInfo, Args,
|
StartFunction(GlobalDecl(), RetTy, Fn, FnInfo, Args,
|
||||||
OutlinedStmt->getBeginLoc(), OutlinedStmt->getBeginLoc());
|
OutlinedStmt->getBeginLoc(), OutlinedStmt->getBeginLoc());
|
||||||
CurSEHParent = ParentCGF.CurSEHParent;
|
CurSEHParent = ParentCGF.CurSEHParent;
|
||||||
CurCodeDecl = ParentCGF.CurCodeDecl;
|
|
||||||
|
|
||||||
CGM.SetInternalFunctionAttributes(GlobalDecl(), CurFn, FnInfo);
|
CGM.SetInternalFunctionAttributes(GlobalDecl(), CurFn, FnInfo);
|
||||||
EmitCapturedLocals(ParentCGF, OutlinedStmt, IsFilter);
|
EmitCapturedLocals(ParentCGF, OutlinedStmt, IsFilter);
|
||||||
|
|
|
@ -4185,8 +4185,10 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
|
||||||
/// Given that we are currently emitting a lambda, emit an l-value for
|
/// Given that we are currently emitting a lambda, emit an l-value for
|
||||||
/// one of its members.
|
/// one of its members.
|
||||||
LValue CodeGenFunction::EmitLValueForLambdaField(const FieldDecl *Field) {
|
LValue CodeGenFunction::EmitLValueForLambdaField(const FieldDecl *Field) {
|
||||||
assert(cast<CXXMethodDecl>(CurCodeDecl)->getParent()->isLambda());
|
if (CurCodeDecl) {
|
||||||
assert(cast<CXXMethodDecl>(CurCodeDecl)->getParent() == Field->getParent());
|
assert(cast<CXXMethodDecl>(CurCodeDecl)->getParent()->isLambda());
|
||||||
|
assert(cast<CXXMethodDecl>(CurCodeDecl)->getParent() == Field->getParent());
|
||||||
|
}
|
||||||
QualType LambdaTagType =
|
QualType LambdaTagType =
|
||||||
getContext().getTagDeclType(Field->getParent());
|
getContext().getTagDeclType(Field->getParent());
|
||||||
LValue LambdaLV = MakeNaturalAlignAddrLValue(CXXABIThisValue, LambdaTagType);
|
LValue LambdaLV = MakeNaturalAlignAddrLValue(CXXABIThisValue, LambdaTagType);
|
||||||
|
|
|
@ -164,3 +164,5 @@ void use_inline() {
|
||||||
// CHECK: store i32 1234, i32* @my_unique_global
|
// CHECK: store i32 1234, i32* @my_unique_global
|
||||||
|
|
||||||
// CHECK: attributes #[[NOINLINE]] = { {{.*noinline.*}} }
|
// CHECK: attributes #[[NOINLINE]] = { {{.*noinline.*}} }
|
||||||
|
|
||||||
|
void seh_in_noexcept() noexcept { __try {} __finally {} }
|
||||||
|
|
Loading…
Reference in New Issue