[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:22:01 PST 2023
================
@@ -7482,3 +7482,51 @@ generation of the other destruction cases, optimizing the above `foo.destroy` to
}];
}
+
+
+def CoroReturnTypeAndWrapperDoc : Documentation {
+ let Category = DocCatDecl;
+ let Content = [{
+The ``coro_return_type`` attribute should be marked on a C++ class to mark it as
----------------
ilya-biryukov wrote:
I think it would be useful to clearly spell out what enforcement this attribute provides and why it's important.
In particular, I propose saying something like:
```
Clang will enforce that all functions that return a CRT are either coroutines or marked with `[[clang::coro_wrapper]]`. This allows to avoid a common class of issues with lifetimes of temporaries.
```
https://github.com/llvm/llvm-project/pull/71945
More information about the cfe-commits
mailing list