From 0be968dcdac3922f1cc4660593782d15015fb4ff Mon Sep 17 00:00:00 2001 From: Gor Nishanov <GorNishanov@gmail.com> Date: Tue, 28 Mar 2017 02:51:45 +0000 Subject: [PATCH] Use BuildReturnStmt in SemaCoroutine to unbreak sanitizer tests. FIXME: ActOnReturnStmt expects a scope that is inside of the function, due to CheckJumpOutOfSEHFinally(*this, ReturnLoc, *CurScope->getFnParent()); S.getCurScope()->getFnParent() == nullptr at ActOnFinishFunctionBody when CoroutineBodyStmt is built. Figure it out and fix it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298893 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaCoroutine.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Sema/SemaCoroutine.cpp b/lib/Sema/SemaCoroutine.cpp index d8e7b9bb186..14dd7cb7118 100644 --- a/lib/Sema/SemaCoroutine.cpp +++ b/lib/Sema/SemaCoroutine.cpp @@ -830,8 +830,13 @@ bool SubStmtBuilder::makeReturnOnAllocFailure() { S.ActOnCallExpr(nullptr, DeclNameExpr.get(), Loc, {}, Loc); if (ReturnObjectOnAllocationFailure.isInvalid()) return false; - StmtResult ReturnStmt = S.ActOnReturnStmt( - Loc, ReturnObjectOnAllocationFailure.get(), S.getCurScope()); + // FIXME: ActOnReturnStmt expects a scope that is inside of the function, due + // to CheckJumpOutOfSEHFinally(*this, ReturnLoc, *CurScope->getFnParent()); + // S.getCurScope()->getFnParent() == nullptr at ActOnFinishFunctionBody when + // CoroutineBodyStmt is built. Figure it out and fix it. + // Use BuildReturnStmt here to unbreak sanitized tests. (Gor:3/27/2017) + StmtResult ReturnStmt = + S.BuildReturnStmt(Loc, ReturnObjectOnAllocationFailure.get()); if (ReturnStmt.isInvalid()) return false; this->ReturnStmtOnAllocFailure = ReturnStmt.get(); -- GitLab