This is an archive of the discontinued LLVM Phabricator instance.

[Coroutines] Warning if the return type of coroutine_handle::address is not void*
ClosedPublic

Authored by ChuanqiXu on Jun 24 2020, 2:09 AM.

Details

Summary

User can own a version of coroutine_handle::address() whose return type is not void* by using template specialization for coroutine_handle<> for some promise_type.
In this case, the codes may violate the capability with existing async C APIs that accepted a void* data parameter which was then passed back to the user-provided callback.

Diff Detail

Event Timeline

ChuanqiXu created this revision.Jun 24 2020, 2:09 AM
ChuanqiXu updated this revision to Diff 273921.Jun 28 2020, 5:05 AM

Because of D82029, the promise_type::final_suspend() should declare with noexcept specifier .

This generally looks good to me. I'll accept this if others do not have different ideas about this. Thanks!

ChuanqiXu updated this revision to Diff 273926.Jun 28 2020, 5:30 AM

re-upload the patch due to previous misuse of Phabricator , sorry..

This comment was removed by ChuanqiXu.

Hi @modocache ,may I ask for your option about this patch?

junparser accepted this revision.Jul 5 2020, 8:43 PM
This revision is now accepted and ready to land.Jul 5 2020, 8:43 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2020, 10:47 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
riccibruno added inline comments.
clang/include/clang/Basic/DiagnosticSemaKinds.td
10521

Should this be something like [...] for compatibility with existing async C APIs instead?