r298893 - Use BuildReturnStmt in SemaCoroutine to unbreak sanitizer tests.

Gor Nishanov via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 27 19:51:46 PDT 2017


Author: gornishanov
Date: Mon Mar 27 21:51:45 2017
New Revision: 298893

URL: http://llvm.org/viewvc/llvm-project?rev=298893&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Sema/SemaCoroutine.cpp

Modified: cfe/trunk/lib/Sema/SemaCoroutine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCoroutine.cpp?rev=298893&r1=298892&r2=298893&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCoroutine.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCoroutine.cpp Mon Mar 27 21:51:45 2017
@@ -830,8 +830,13 @@ bool SubStmtBuilder::makeReturnOnAllocFa
       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();




More information about the cfe-commits mailing list