[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 05:16:16 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())
+ return;
+ RecordDecl *RD = FD->getReturnType()->getAsRecordDecl();
+ if (!RD || !RD->getUnderlyingDecl()->hasAttr<CoroReturnTypeAttr>())
+ return;
+ // Allow `get_return_object()`.
----------------
ilya-biryukov wrote:
NIT: you might want to add a mention in documentation that `PromiseType::get_return_object` are exempt of this analysis as it is a necessary implementation detail of any coroutine library.
https://github.com/llvm/llvm-project/pull/71945
More information about the cfe-commits
mailing list