From: Gor Nishanov Date: Tue, 28 Mar 2017 02:51:45 +0000 (+0000) Subject: Use BuildReturnStmt in SemaCoroutine to unbreak sanitizer tests. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0be968dcdac3922f1cc4660593782d15015fb4ff;p=clang 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 --- diff --git a/lib/Sema/SemaCoroutine.cpp b/lib/Sema/SemaCoroutine.cpp index d8e7b9bb18..14dd7cb711 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();