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

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 15 19:00:32 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<
----------------
ChuanqiXu9 wrote:

The intention of `[[clang::coro_return_type]]`  (and ` [[clang::coro_wrapper]]`) is to allow analyzer to recognize coroutines from the function signature. And if the users are able to downgrade the erros to a silent warning, then result of analyzing is basically out of order. Then `[[clang::coro_return_type]]`  is basically meaningless.

On the other hand, from the perspective of library writers, if we announce a class as `[[clang::coro_return_type]]` , we will assume it is an error if the users don't use it for a coroutine.

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


More information about the cfe-commits mailing list