This is an archive of the discontinued LLVM Phabricator instance.

[coroutines] Handle get_return_object_on_allocation_failure
ClosedPublic

Authored by GorNishanov on Mar 27 2017, 9:46 AM.

Details

Summary

If promise_type has get_return_object_on_allocation_failure defined,
check if an allocation function returns nullptr, and if so,
return the result of get_return_object_on_allocation_failure().

Diff Detail

Event Timeline

GorNishanov created this revision.Mar 27 2017, 9:46 AM
EricWF accepted this revision.Mar 27 2017, 12:40 PM

This LGTM minus inline comments.

lib/Sema/SemaCoroutine.cpp
793

Maybe add a test for this in SemaCXX/coroutines.cpp?

test/CodeGenCoroutines/coro-alloc.cpp
131

FYI this test doesn't merge with trunk seemingly due to whitespace issues.

This revision is now accepted and ready to land.Mar 27 2017, 12:40 PM

Added diagnostic test to SemaCXX/coroutines.cpp
Preparing to Land

This revision was automatically updated to reflect the committed changes.
GorNishanov marked an inline comment as done.

Woops. this patch also needed changes to TreeTransform.h. I'll add those tonight.