[clang] [clang-tools-extra] [coroutines] Do not check coroutine wrappers for skipped function bodies (PR #76729)
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 2 08:17:30 PST 2024
================
@@ -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
More information about the cfe-commits
mailing list