Use corutine function arguments to initialize a promise type, but only
if the promise type defines a constructor that takes those arguments.
Otherwise, fall back to the default constructor.
Test Plan: check-clang
Paths
| Differential D41820
[coroutines] Pass coro func args to promise ctor ClosedPublic Authored by modocache on Jan 8 2018, 6:15 AM.
Details Summary Use corutine function arguments to initialize a promise type, but only Test Plan: check-clang
Diff Detail
Event TimelineComment Actions Thank you for doing this change!
This revision now requires changes to proceed.Jan 10 2018, 4:51 PM Comment Actions Is this behavior specified somewhere? Or are we simply adding an extension to Clang? If so I would really prefer to add my co_promise solution (but I need to write a paper in favor of it first). Comment Actions
It is not specified anywhere yet but Gor has promised a paper for Jacksonville.
I have no problem with you making a separate proposal. I don't consider this an either/or thing. Comment Actions
Before bringing the language change proposal, it makes sense to implement the feature and test it out on real examples. MSVC compiler implemented a number of coroutine features to do sanity testing and put in the customers hands before a feature was proposed. Since this is a non-breaking change, I think it makes sense to put it in and play with it. This particular approach was talked about since 2014, but, no formal proposal was made. I am bringing the paper to upcoming Jacksonville meeting and would like to make sure that we have both implementation and usage experience for the feature. Comment Actions Thanks for the great review, @GorNishanov! You were exactly right, I had to remove the assert. I've taken all of your other suggestions as well. Let me know if anything else stands out at you. Also, thanks for the question, @EricWF, I added some comments to make it clear that this is an implementation of an experimental feature that has yet to be formally proposed. This revision is now accepted and ready to land.Jan 23 2018, 3:59 PM Closed by commit rL323381: [coroutines] Pass coro func args to promise ctor (authored by modocache). · Explain WhyJan 24 2018, 2:19 PM This revision was automatically updated to reflect the committed changes. Closed by commit rC323381: [coroutines] Pass coro func args to promise ctor (authored by modocache). · Explain WhyJan 24 2018, 2:19 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 131351 include/clang/Sema/ScopeInfo.h
include/clang/Sema/Sema.h
lib/Sema/CoroutineStmtBuilder.h
lib/Sema/ScopeInfo.cpp
lib/Sema/SemaCoroutine.cpp
lib/Sema/TreeTransform.h
test/CodeGenCoroutines/coro-params.cpp
test/SemaCXX/coroutines.cpp
|
I would keep this block of functions in their original place. (Or move them here as a separate NFC) commit.
Easier to review what was changed and what was simply moved.