[clang] [Coroutines] Allow [[clang::coro_wrapper]] for class (PR #93268)
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 17 18:56:49 PDT 2025
ChuanqiXu9 wrote:
> @ChuanqiXu9, I just ran across this PR -- and I immediately wondered if it could be used to improve stack-use-after-free checks for `folly::result` (the short-circuiting coro you saw on my recent PR).
>
> Like the classes you mention in the PR description here, `folly::result` has many reasonable "coro" and "coro wrapper" uses, and it would be onerous to annotate every wrapper usage as `coro_wrapper`.
>
> What did you envision the effect of adding `coro_wrapper` to a class would be on lifetime checks?
>
> Can you walk me through your reasoning / expected usage?
I think it makes sense to add `coro_wrapper` to classes. The reasoning is, the behavior of coroutine is controlled by its promise_type. And generally in practice, we have the consistent promise_type for the same return type, which is the class I mentioned here. So given the coroutines have the same behavior, it should be helpful to add these attributes to the class. And of course, as I said, it is best to add this to the promise_type, but it is not conflicting.
https://github.com/llvm/llvm-project/pull/93268
More information about the cfe-commits
mailing list