================ @@ -15811,6 +15813,32 @@ static void diagnoseImplicitlyRetainedSelf(Sema &S) { << FixItHint::CreateInsertion(P.first, "self->"); } +// Return whether FD is `promise_type::get_return_object`. +bool isGetReturnObject(FunctionDecl *FD) { + if (!FD->getDeclName().isIdentifier() || + !FD->getName().equals("get_return_object") || !FD->param_empty()) + return false; + CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD); + if (!MD || !MD->isCXXInstanceMember()) + return false; + RecordDecl *PromiseType = MD->getParent(); + return PromiseType && PromiseType->getDeclName().isIdentifier() && + PromiseType->getName().equals("promise_type"); +} + +void Sema::CheckCoroutineWrapper(FunctionDecl *FD) { + if (!getLangOpts().Coroutines || !FD || getCurFunction()->isCoroutine()) ---------------- ilya-biryukov wrote:
NIT: I believe we could skip a check for `getLangOpts().Coroutines`. It's safe to assume a low-level function like this is not called when coroutines are disabled, it's ok to make it the responsibility of the callers to ensure that. https://github.com/llvm/llvm-project/pull/71945 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits