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

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 13 05:21:59 PST 2023


================
@@ -11591,6 +11591,10 @@ def err_conflicting_aligned_options : Error <
 def err_coro_invalid_addr_of_label : Error<
   "the GNU address of label extension is not allowed in coroutines."
 >;
+def err_coroutine_return_type : Error<
+  "function returns a coroutine return type %0 but is neither a coroutine nor a coroutine wrapper; "
----------------
ilya-biryukov wrote:

NIT: should we mention the name of the `[[clang::coro_return_type]]` here?
'Coroutine return type' resembles the C++ standard a bit too too much, I am afraid this might cause confusion and people looking in the standard. Marking it clear this is an extension is probably useful here.

E.g. we could add a note that adds the context:
```note: class 'Gen' has been marked with [[clang::coro_return_type]] here```
or add this to an error message 
```error: function returns a type %0 marked with [[clang::coro_return_type]]```


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


More information about the cfe-commits mailing list