]> granicus.if.org Git - clang/commitdiff
Use BuildReturnStmt in SemaCoroutine to unbreak sanitizer tests.
authorGor Nishanov <GorNishanov@gmail.com>
Tue, 28 Mar 2017 02:51:45 +0000 (02:51 +0000)
committerGor Nishanov <GorNishanov@gmail.com>
Tue, 28 Mar 2017 02:51:45 +0000 (02:51 +0000)
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

index d8e7b9bb18640658e2b5bc1b3b03081219c0a6a2..14dd7cb711851071d9067f135f739ba57a6f64e1 100644 (file)
@@ -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();