[clang] [coroutines] Introduce [[clang::coro_return_type]] and [[clang::coro_wrapper]] (PR #71945)

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 17 06:08:48 PST 2023


================
@@ -15811,6 +15813,20 @@ static void diagnoseImplicitlyRetainedSelf(Sema &S) {
           << FixItHint::CreateInsertion(P.first, "self->");
 }
 
+void Sema::CheckCoroutineWrapper(FunctionDecl *FD) {
+  if (!FD || getCurFunction()->isCoroutine())
----------------
ilya-biryukov wrote:

It's not clear at all from the code now that `FD` and `getCurFunction()` must correspond to the code.
As we chatted offline, moving the check `getCurFunction()->isCoroutine()` into the callers and checking only the attributes in this function would make it much easier to understand the code.

Let's do that?

Alternatively, we could add some assertion that checks the `getCurFunction()` and `FD` correspond to the same function.

https://github.com/llvm/llvm-project/pull/71945


More information about the cfe-commits mailing list