[PATCH] D46140: [coroutines] std::task type (WIP)

Lewis Baker via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 20 12:26:50 PDT 2018


lewissbaker updated this revision to Diff 156565.
lewissbaker added a comment.
Herald added subscribers: cfe-commits, ldionne, mgorny.

Many improvements:

- Remove move-assignment operator
- `task<T>::operator co_await()` now returns by value when awaiting `task<T>` rvalue.
- Explicitly scope calls to std-library functions that live in `_VSTD`.
- Make `__task_promise` ABI stable under exception/no-exception compilation modes.
- Moved `__aligned_allocation_size` to <experimental/__memory>
- Make `task<T>` have a default template parameter of void, allowing `task<>` to mean `task<void>`
- Allow `co_return { ... }` by adding overload of `return_value()` taking `T&&` and another taking `initializer_list<U>`.
- Implement optimisation that avoids storing the allocator in the coroutine frame if `allocator_traits<A>::is_always_equal` is true and the allocator is default constructible.
- Added unit-tests (currently failing some custom allocator tests under debug builds)


Repository:
  rCXX libc++

https://reviews.llvm.org/D46140

Files:
  include/CMakeLists.txt
  include/experimental/__memory
  include/experimental/memory_resource
  include/experimental/task
  include/module.modulemap
  test/std/experimental/task/awaitable_traits.hpp
  test/std/experimental/task/counted.hpp
  test/std/experimental/task/lit.local.cfg
  test/std/experimental/task/manual_reset_event.hpp
  test/std/experimental/task/sync_wait.hpp
  test/std/experimental/task/task.basic/task_custom_allocator.pass.cpp
  test/std/experimental/task/task.basic/task_of_value.pass.cpp
  test/std/experimental/task/task.basic/task_of_void.pass.cpp
  test/std/experimental/task/task.lifetime/task_parameter_lifetime.pass.cpp
  test/std/experimental/task/task.lifetime/task_return_value_lifetime.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46140.156565.patch
Type: text/x-patch
Size: 47359 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180720/10974cd4/attachment-0001.bin>


More information about the cfe-commits mailing list