================
@@ -684,6 +684,18 @@ bool Sema::checkFinalSuspendNoThrow(const Stmt 
*FinalSuspend) {
   return ThrowingDecls.empty();
 }
 
+// [stmt.return.coroutine]p1:
+//   A coroutine shall not enclose a return statement ([stmt.return]).
+static void checkReturnStmtInCoroutine(Sema &S, FunctionScopeInfo *FSI) {
+  if (FSI && FSI->FirstReturnLoc.isValid()) {
+      assert(FSI->FirstCoroutineStmtLoc.isValid() &&
----------------
ilya-biryukov wrote:

NIT: we could move this assertion to the start of the function. As the name 
implies, the `checkReturnStmtInCoroutine` can only be called on coroutines, so 
validating this invariant is useful even if we don't report any diagnostics.

https://github.com/llvm/llvm-project/pull/100985
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to