[PATCH] D116204: [C++20] [Coroutines] Allow promise_type to not define return_void or return_value

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 23 04:09:54 PST 2021


ChuanqiXu marked 2 inline comments as done.
ChuanqiXu added inline comments.


================
Comment at: clang/lib/Sema/SemaCoroutine.cpp:1431-1432
+    //
+    // Then AnalysisBasedWarning would emit a warning about `foo()` lacks a
+    // co_return statements.
+    Fallthrough = S.ActOnNullStmt(PromiseRecordDecl->getLocation());
----------------
urnathan wrote:
> Your testcase doesnt show such a warning.  This seems unhelpful.  
Oh, I need emphasize in the comment that the warning is not correct. I want to say that if we don't set `FallThrough`, the compiler would emit incorrect warning. And in this revision, we set `FallThrough` so that we could avoid the warning. The edited test case could  address this.


================
Comment at: clang/lib/Sema/SemaCoroutine.cpp:1437-1440
     // If the unqualified-id return_void is found, flowing off the end of a
     // coroutine is equivalent to a co_return with no operand. Otherwise,
     // flowing off the end of a coroutine results in undefined behavior.
     Fallthrough = S.BuildCoreturnStmt(FD.getLocation(), nullptr,
----------------
urnathan wrote:
> there's some repetition in the comments.  Perhaps a bloc comment before the if-else sequence?
Yeah, would do.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116204/new/

https://reviews.llvm.org/D116204



More information about the cfe-commits mailing list