================
@@ -15845,7 +15845,7 @@ static void diagnoseImplicitlyRetainedSelf(Sema &S) {
 }
 
 void Sema::CheckCoroutineWrapper(FunctionDecl *FD) {
-  if (!FD)
+  if (!FD || FD->hasSkippedBody())
----------------
ilya-biryukov wrote:

Suggestion: a comment would be appropriate here, e.g. `// if we skip function 
body, we can't tell if a function is a coroutine`.

More serious request is to move this check up the call stack where we inspect 
`FSI` and call `isCoroutine()`. `CheckCoroutineWrapper` does not even look if 
the function is a coroutine or not, it merely looks at an attribute, which is 
available even if we skip the function body.

It's the calling code that should make sure `CheckCoroutineWrapper` should not 
be called for coroutines, so it's caller's responsibility to ensure this 
function is not called when it can't tell if a function is a coroutine or not.


https://github.com/llvm/llvm-project/pull/76729
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to