<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 24 May 2017 at 21:36, Eric Fiselier via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: ericwf<br>
Date: Wed May 24 23:36:24 2017<br>
New Revision: 303836<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=303836&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=303836&view=rev</a><br>
Log:<br>
Add <experimental/coroutine><br>
<br>
This patch adds the library portions of the coroutines PDTS,<br>
which should now be supported by Clang.<br>
<br>
Added:<br>
    libcxx/trunk/include/<wbr>experimental/coroutine<br>
    libcxx/trunk/test/libcxx/<wbr>experimental/language.support/<br>
    libcxx/trunk/test/libcxx/<wbr>experimental/language.support/<wbr>support.coroutines/<br>
    libcxx/trunk/test/libcxx/<wbr>experimental/language.support/<wbr>support.coroutines/version.sh.<wbr>cpp<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>capacity/<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>capacity/operator_bool.sh.cpp<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>compare/<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>compare/equal_comp.sh.cpp<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>compare/less_comp.sh.cpp<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>completion/<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>completion/done.sh.cpp<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.con/<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.con/<wbr>assign.sh.cpp<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.con/<wbr>construct.sh.cpp<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>export/<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>export/address.sh.cpp<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>export/from_address.sh.cpp<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.hash/<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.hash/<wbr>hash.sh.cpp<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.prom/<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.prom/<wbr>promise.sh.cpp<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>resumption/<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>resumption/destroy.sh.cpp<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>resumption/resume.sh.cpp<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/void_handle.sh.cpp<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>traits/<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>traits/promise_type.sh.cpp<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>trivial.awaitables/<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>trivial.awaitables/suspend_<wbr>always.sh.cpp<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>trivial.awaitables/suspend_<wbr>never.sh.cpp<br>
    libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/includes.<wbr>sh.cpp<br>
Modified:<br>
    libcxx/trunk/CMakeLists.txt<br>
    libcxx/trunk/include/<wbr>experimental/__config<br>
    libcxx/trunk/include/module.<wbr>modulemap<br>
    libcxx/trunk/test/libcxx/<wbr>double_include.sh.cpp<br>
    libcxx/trunk/test/support/<wbr>test_macros.h<br>
    libcxx/trunk/utils/libcxx/<wbr>test/config.py<br>
<br>
Modified: libcxx/trunk/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=303836&r1=303835&r2=303836&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/<wbr>CMakeLists.txt?rev=303836&r1=<wbr>303835&r2=303836&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/CMakeLists.txt (original)<br>
+++ libcxx/trunk/CMakeLists.txt Wed May 24 23:36:24 2017<br>
@@ -452,6 +452,11 @@ add_compile_flags_if_<wbr>supported(-nostdinc<br>
 # the dylib when get ODR used by another function.<br>
 add_compile_flags_if_<wbr>supported(-fvisibility-<wbr>inlines-hidden)<br>
<br>
+if (LIBCXX_CONFIGURE_IDE)<br>
+  # This simply allows IDE to process <experimental/coroutine><br>
+  add_compile_flags_if_<wbr>supported(-fcoroutines-ts)<br>
+endif()<br>
+<br>
 # Let the library headers know they are currently being used to build the<br>
 # library.<br>
 add_definitions(-D_LIBCPP_<wbr>BUILDING_LIBRARY)<br>
<br>
Modified: libcxx/trunk/include/<wbr>experimental/__config<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/__config?rev=303836&r1=303835&r2=303836&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/include/<wbr>experimental/__config?rev=<wbr>303836&r1=303835&r2=303836&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/include/<wbr>experimental/__config (original)<br>
+++ libcxx/trunk/include/<wbr>experimental/__config Wed May 24 23:36:24 2017<br>
@@ -44,6 +44,13 @@<br>
 #define _LIBCPP_END_NAMESPACE_<wbr>EXPERIMENTAL_FILESYSTEM \<br>
     } } _LIBCPP_END_NAMESPACE_<wbr>EXPERIMENTAL<br>
<br>
+#define _LIBCPP_BEGIN_NAMESPACE_<wbr>EXPERIMENTAL_COROUTINES \<br>
+  _LIBCPP_BEGIN_NAMESPACE_<wbr>EXPERIMENTAL inline namespace coroutines_v1 {<br>
+<br>
+#define _LIBCPP_END_NAMESPACE_<wbr>EXPERIMENTAL_COROUTINES \<br>
+  } _LIBCPP_END_NAMESPACE_<wbr>EXPERIMENTAL<br>
+<br>
+#define _VSTD_CORO _VSTD_EXPERIMENTAL::<wbr>coroutines_v1<br>
<br>
 #define _VSTD_FS ::std::experimental::<wbr>filesystem::v1<br>
<br>
<br>
Added: libcxx/trunk/include/<wbr>experimental/coroutine<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/coroutine?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/include/<wbr>experimental/coroutine?rev=<wbr>303836&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/include/<wbr>experimental/coroutine (added)<br>
+++ libcxx/trunk/include/<wbr>experimental/coroutine Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,260 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>----- coroutine -----------------------------=<wbr>==//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+#ifndef _LIBCPP_EXPERIMENTAL_COROUTINE<br>
+#define _LIBCPP_EXPERIMENTAL_COROUTINE<br>
+<br>
+/**<br>
+    experimental/coroutine synopsis<br>
+<br>
+// C++next<br>
+<br>
+namespace std {<br>
+namespace experimental {<br>
+inline namespace coroutines_v1 {<br>
+<br>
+  // 18.11.1 coroutine traits<br>
+template <typename R, typename... ArgTypes><br>
+class coroutine_traits;<br>
+// 18.11.2 coroutine handle<br>
+template <typename Promise = void><br>
+class coroutine_handle;<br>
+// 18.11.2.7 comparison operators:<br>
+bool operator==(coroutine_handle<> x, coroutine_handle<> y) noexcept;<br>
+bool operator!=(coroutine_handle<> x, coroutine_handle<> y) noexcept;<br>
+bool operator<(coroutine_handle<> x, coroutine_handle<> y) noexcept;<br>
+bool operator<=(coroutine_handle<> x, coroutine_handle<> y) noexcept;<br>
+bool operator>=(coroutine_handle<> x, coroutine_handle<> y) noexcept;<br>
+bool operator>(coroutine_handle<> x, coroutine_handle<> y) noexcept;<br>
+// 18.11.3 trivial awaitables<br>
+struct suspend_never;<br>
+struct suspend_always;<br>
+// 18.11.2.8 hash support:<br>
+template <class T> struct hash;<br>
+template <class P> struct hash<coroutine_handle<P>>;<br>
+<br>
+} // namespace coroutines_v1<br>
+} // namespace experimental<br>
+} // namespace std<br>
+<br>
+ */<br>
+<br>
+#include <experimental/__config><br>
+#include <new><br>
+#include <type_traits><br>
+#include <functional><br>
+#include <memory> // for hash<T*><br>
+#include <cstddef><br>
+#include <cassert><br>
+#include <__debug><br>
+<br>
+#if !defined(_LIBCPP_HAS_NO_<wbr>PRAGMA_SYSTEM_HEADER)<br>
+#pragma GCC system_header<br>
+#endif<br>
+<br>
+#ifndef __cpp_coroutines<br>
+# if defined(_LIBCPP_WARNING)<br>
+    _LIBCPP_WARNING("<<wbr>experimental/coroutine> cannot be used with this compiler")<br>
+# else<br>
+#   warning <experimental/coroutine> cannot be used with this compiler<br>
+# endif<br>
+#endif<br>
+<br>
+_LIBCPP_BEGIN_NAMESPACE_<wbr>EXPERIMENTAL_COROUTINES<br>
+<br>
+template <class _Tp, class = void><br>
+struct __coroutine_traits_sfinae {};<br>
+<br>
+template <class _Tp><br>
+struct __coroutine_traits_sfinae<<br>
+    _Tp, typename __void_t<typename _Tp::promise_type>::type><br>
+{<br>
+  using promise_type = typename _Tp::promise_type;<br>
+};<br>
+<br>
+template <typename _Ret, typename... _Args><br>
+struct _LIBCPP_TEMPLATE_VIS coroutine_traits<br>
+    : public __coroutine_traits_sfinae<_<wbr>Ret><br>
+{<br>
+};<br>
+<br>
+template <typename Promise = void><br></blockquote><div><br></div><div>This Promise needs more _Uglifying.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+class _LIBCPP_TEMPLATE_VIS coroutine_handle;<br>
+<br>
+#if defined(__cpp_coroutines)<br>
+<br>
+template <><br>
+class _LIBCPP_TEMPLATE_VIS coroutine_handle<void> {<br>
+public:<br>
+    _LIBCPP_ALWAYS_INLINE<br>
+    constexpr coroutine_handle() noexcept : __handle_(nullptr) {}<br>
+<br>
+    _LIBCPP_ALWAYS_INLINE<br>
+    constexpr coroutine_handle(nullptr_t) noexcept : __handle_(nullptr) {}<br>
+<br>
+    _LIBCPP_ALWAYS_INLINE<br>
+    coroutine_handle& operator=(nullptr_t) noexcept {<br>
+        __handle_ = nullptr;<br>
+        return *this;<br>
+    }<br>
+<br>
+    _LIBCPP_ALWAYS_INLINE<br>
+    constexpr void* address() const noexcept { return __handle_; }<br>
+<br>
+    _LIBCPP_ALWAYS_INLINE<br>
+    constexpr explicit operator bool() const noexcept { return __handle_; }<br>
+<br>
+    _LIBCPP_ALWAYS_INLINE<br>
+    void operator()() const { resume(); }<br>
+<br>
+    _LIBCPP_ALWAYS_INLINE<br>
+    void resume() const {<br>
+      _LIBCPP_ASSERT(__is_suspended(<wbr>),<br>
+                     "resume() can only be called on suspended coroutines");<br>
+      _LIBCPP_ASSERT(!done(),<br>
+                "resume() has undefined behavior when the coroutine is done");<br>
+      __builtin_coro_resume(__<wbr>handle_);<br>
+    }<br>
+<br>
+    _LIBCPP_ALWAYS_INLINE<br>
+    void destroy() const {<br>
+      _LIBCPP_ASSERT(__is_suspended(<wbr>),<br>
+                     "destroy() can only be called on suspended coroutines");<br>
+      __builtin_coro_destroy(__<wbr>handle_);<br>
+    }<br>
+<br>
+    _LIBCPP_ALWAYS_INLINE<br>
+    bool done() const {<br>
+      _LIBCPP_ASSERT(__is_suspended(<wbr>),<br>
+                     "done() can only be called on suspended coroutines");<br>
+      return __builtin_coro_done(__handle_)<wbr>;<br>
+    }<br>
+<br>
+public:<br>
+    _LIBCPP_ALWAYS_INLINE<br>
+    static coroutine_handle from_address(void* __addr) noexcept {<br>
+        coroutine_handle __tmp;<br>
+        __tmp.__handle_ = __addr;<br>
+        return __tmp;<br>
+    }<br>
+<br>
+private:<br>
+  bool __is_suspended() const noexcept  {<br>
+    // FIXME actually implement a check for if the coro is suspended.<br>
+    return __handle_;<br>
+  }<br>
+<br>
+  template <class _PromiseT> friend class coroutine_handle;<br>
+  void* __handle_;<br>
+};<br>
+<br>
+// 18.11.2.7 comparison operators:<br>
+inline _LIBCPP_ALWAYS_INLINE<br>
+bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {<br>
+    return __x.address() == __y.address();<br>
+}<br>
+inline _LIBCPP_ALWAYS_INLINE<br>
+bool operator!=(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {<br>
+    return !(__x == __y);<br>
+}<br>
+inline _LIBCPP_ALWAYS_INLINE<br>
+bool operator<(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {<br>
+    return less<void*>()(__x.address(), __y.address());<br>
+}<br>
+inline _LIBCPP_ALWAYS_INLINE<br>
+bool operator>(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {<br>
+    return __y < __x;<br>
+}<br>
+inline _LIBCPP_ALWAYS_INLINE<br>
+bool operator<=(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {<br>
+    return !(__x > __y);<br>
+}<br>
+inline _LIBCPP_ALWAYS_INLINE<br>
+bool operator>=(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {<br>
+    return !(__x < __y);<br>
+}<br>
+<br>
+template <typename _Promise><br>
+class _LIBCPP_TEMPLATE_VIS coroutine_handle : public coroutine_handle<> {<br>
+    using _Base = coroutine_handle<>;<br>
+public:<br>
+    // 18.11.2.1 construct/reset<br>
+    using coroutine_handle<>::coroutine_<wbr>handle;<br>
+<br>
+    _LIBCPP_INLINE_VISIBILITY<br>
+    coroutine_handle& operator=(nullptr_t) noexcept {<br>
+        _Base::operator=(nullptr);<br>
+        return *this;<br>
+    }<br>
+<br>
+  _LIBCPP_INLINE_VISIBILITY<br>
+    _Promise& promise() {<br>
+        return *reinterpret_cast<_Promise*>(<br>
+            __builtin_coro_promise(this->_<wbr>_handle_, alignof(_Promise), false));<br>
+    }<br>
+<br>
+    _LIBCPP_INLINE_VISIBILITY<br>
+    _Promise const& promise() const {<br>
+        return *reinterpret_cast<_Promise const*>(<br>
+            __builtin_coro_promise(this->_<wbr>_handle_, alignof(_Promise), false));<br>
+    }<br>
+<br>
+public:<br>
+    _LIBCPP_ALWAYS_INLINE<br>
+    static coroutine_handle from_address(void* __addr) noexcept {<br>
+        coroutine_handle __tmp;<br>
+        __tmp.__handle_ = __addr;<br>
+        return __tmp;<br>
+    }<br>
+<br>
+    _LIBCPP_ALWAYS_INLINE<br>
+    static coroutine_handle from_promise(_Promise& __promise) noexcept {<br>
+        coroutine_handle __tmp;<br>
+        __tmp.__handle_ = __builtin_coro_promise(_VSTD::<wbr>addressof(__promise),<br>
+                                                 alignof(_Promise), true);<br>
+        return __tmp;<br>
+    }<br>
+};<br>
+<br>
+#endif // defined(__cpp_coroutines)<br>
+<br>
+struct _LIBCPP_TYPE_VIS suspend_never {<br>
+  _LIBCPP_ALWAYS_INLINE<br>
+  bool await_ready() const noexcept { return true; }<br>
+  _LIBCPP_ALWAYS_INLINE<br>
+  void await_suspend(coroutine_<wbr>handle<>) const noexcept {}<br>
+  _LIBCPP_ALWAYS_INLINE<br>
+  void await_resume() const noexcept {}<br>
+};<br>
+<br>
+struct _LIBCPP_TYPE_VIS suspend_always {<br>
+  _LIBCPP_ALWAYS_INLINE<br>
+  bool await_ready() const noexcept { return false; }<br>
+  _LIBCPP_ALWAYS_INLINE<br>
+  void await_suspend(coroutine_<wbr>handle<>) const noexcept {}<br>
+  _LIBCPP_ALWAYS_INLINE<br>
+  void await_resume() const noexcept {}<br>
+};<br>
+<br>
+_LIBCPP_END_NAMESPACE_<wbr>EXPERIMENTAL_COROUTINES<br>
+<br>
+_LIBCPP_BEGIN_NAMESPACE_STD<br>
+<br>
+template <class _Tp><br>
+struct hash<_VSTD_CORO::coroutine_<wbr>handle<_Tp> > {<br>
+    using __arg_type = _VSTD_CORO::coroutine_handle<_<wbr>Tp>;<br>
+    _LIBCPP_INLINE_VISIBILITY<br>
+    size_t operator()(__arg_type const& __v) const noexcept<br>
+    {return hash<void*>{}(__v.address());}<br>
+};<br>
+<br>
+_LIBCPP_END_NAMESPACE_STD<br>
+<br>
+#endif /* _LIBCPP_EXPERIMENTAL_COROUTINE */<br>
<br>
Modified: libcxx/trunk/include/module.<wbr>modulemap<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/module.modulemap?rev=303836&r1=303835&r2=303836&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/include/<wbr>module.modulemap?rev=303836&<wbr>r1=303835&r2=303836&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/include/module.<wbr>modulemap (original)<br>
+++ libcxx/trunk/include/module.<wbr>modulemap Wed May 24 23:36:24 2017<br>
@@ -501,6 +501,10 @@ module std [system] {<br>
       header "experimental/chrono"<br>
       export *<br>
     }<br>
+    module coroutine {<br>
+      header "experimental/coroutine"<br>
+      export *<br>
+    }<br>
     module deque {<br>
       header "experimental/deque"<br>
       export *<br>
<br>
Modified: libcxx/trunk/test/libcxx/<wbr>double_include.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/double_include.sh.cpp?rev=303836&r1=303835&r2=303836&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/<wbr>libcxx/double_include.sh.cpp?<wbr>rev=303836&r1=303835&r2=<wbr>303836&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/libcxx/<wbr>double_include.sh.cpp (original)<br>
+++ libcxx/trunk/test/libcxx/<wbr>double_include.sh.cpp Wed May 24 23:36:24 2017<br>
@@ -137,6 +137,9 @@<br>
 #include <experimental/algorithm><br>
 #include <experimental/any><br>
 #include <experimental/chrono><br>
+#if defined(__cpp_coroutines)<br>
+#include <experimental/coroutine><br>
+#endif<br>
 #include <experimental/deque><br>
 #include <experimental/dynarray><br>
 #include <experimental/filesystem><br>
<br>
Added: libcxx/trunk/test/libcxx/<wbr>experimental/language.support/<wbr>support.coroutines/version.sh.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/experimental/language.support/support.coroutines/version.sh.cpp?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/<wbr>libcxx/experimental/language.<wbr>support/support.coroutines/<wbr>version.sh.cpp?rev=303836&<wbr>view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/libcxx/<wbr>experimental/language.support/<wbr>support.coroutines/version.sh.<wbr>cpp (added)<br>
+++ libcxx/trunk/test/libcxx/<wbr>experimental/language.support/<wbr>support.coroutines/version.sh.<wbr>cpp Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,25 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03, c++11<br>
+// REQUIRES: fcoroutines-ts<br>
+<br>
+// RUN: %build -fcoroutines-ts<br>
+// RUN: %run<br>
+<br>
+#include <experimental/coroutine><br>
+<br>
+#ifndef _LIBCPP_VERSION<br>
+#error _LIBCPP_VERSION must be defined<br>
+#endif<br>
+<br>
+int main()<br>
+{<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>capacity/operator_bool.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.sh.cpp?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>capacity/operator_bool.sh.cpp?<wbr>rev=303836&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>capacity/operator_bool.sh.cpp (added)<br>
+++ libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>capacity/operator_bool.sh.cpp Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,62 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03, c++11<br>
+// REQUIRES: fcoroutines-ts<br>
+<br>
+// RUN: %build -fcoroutines-ts<br>
+// RUN: %run<br>
+<br>
+// <experimental/coroutine><br>
+<br>
+// template <class Promise = void><br>
+// struct coroutine_handle;<br>
+<br>
+// constexpr explicit operator bool() const noexcept<br>
+<br>
+#include <experimental/coroutine><br>
+#include <type_traits><br>
+#include <cassert><br>
+<br>
+#include "test_macros.h"<br>
+<br>
+namespace coro = std::experimental;<br>
+<br>
+template <class C><br>
+void do_test() {<br>
+  static_assert(std::is_nothrow_<wbr>constructible<bool, C>::value, "");<br>
+  static_assert(!std::is_<wbr>convertible<C, bool>::value, "");<br>
+  {<br>
+    constexpr C c; ((void)c);<br>
+    static_assert(bool(c) == false, "");<br>
+  }<br>
+  { // null case<br>
+    const C c = {}; ((void)c);<br>
+    ASSERT_NOEXCEPT(bool(c));<br>
+    if (c)<br>
+      assert(false);<br>
+    else<br>
+      assert(true);<br>
+    assert(c.address() == nullptr);<br>
+    assert(bool(c) == false);<br>
+  }<br>
+  { // non-null case<br>
+    int dummy = 42;<br>
+    C c = C::from_address(&dummy);<br>
+    assert(c.address() == &dummy);<br>
+    assert(bool(c) == true);<br>
+  }<br>
+}<br>
+<br>
+int main()<br>
+{<br>
+  do_test<coro::coroutine_<wbr>handle<>>();<br>
+  do_test<coro::coroutine_<wbr>handle<int>>();<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>compare/equal_comp.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/equal_comp.sh.cpp?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>compare/equal_comp.sh.cpp?rev=<wbr>303836&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>compare/equal_comp.sh.cpp (added)<br>
+++ libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>compare/equal_comp.sh.cpp Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,64 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03, c++11<br>
+// REQUIRES: fcoroutines-ts<br>
+<br>
+// RUN: %build -fcoroutines-ts<br>
+// RUN: %run<br>
+<br>
+// <experimental/coroutine><br>
+<br>
+// template <class Promise = void><br>
+// struct coroutine_handle;<br>
+<br>
+// bool operator==(coroutine_handle<>, coroutine_handle<>) noexcept<br>
+// bool operator!=(coroutine_handle<>, coroutine_handle<>) noexcept<br>
+<br>
+#include <experimental/coroutine><br>
+#include <type_traits><br>
+#include <utility><br>
+#include <cstdint><br>
+#include <cassert><br>
+<br>
+#include "test_macros.h"<br>
+<br>
+namespace coro = std::experimental;<br>
+<br>
+template <class C><br>
+void do_test(uintptr_t LHSVal, uintptr_t RHSVal) {<br>
+  const C LHS = C::from_address(reinterpret_<wbr>cast<void*>(LHSVal));<br>
+  const C RHS = C::from_address(reinterpret_<wbr>cast<void*>(RHSVal));<br>
+  const bool ExpectIsEqual = (LHSVal == RHSVal);<br>
+  assert((LHS == RHS) == ExpectIsEqual);<br>
+  assert((RHS == LHS) == ExpectIsEqual);<br>
+  assert((LHS != RHS) == !ExpectIsEqual);<br>
+  assert((RHS != LHS) == !ExpectIsEqual);<br>
+  {<br>
+    static_assert(noexcept(LHS == RHS), "");<br>
+    static_assert(noexcept(LHS != RHS), "");<br>
+    ASSERT_SAME_TYPE(decltype(LHS == RHS), bool);<br>
+    ASSERT_SAME_TYPE(decltype(LHS != RHS), bool);<br>
+  }<br>
+}<br>
+<br>
+int main()<br>
+{<br>
+  std::pair<uintptr_t, uintptr_t> const TestCases[] = {<br>
+      {0, 0},<br>
+      {16, 16},<br>
+      {0, 16},<br>
+      {16, 0}<br>
+  };<br>
+  for (auto& TC : TestCases) {<br>
+    do_test<coro::coroutine_<wbr>handle<>>(TC.first, TC.second);<br>
+    do_test<coro::coroutine_<wbr>handle<int>>(TC.first, TC.second);<br>
+  }<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>compare/less_comp.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/less_comp.sh.cpp?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>compare/less_comp.sh.cpp?rev=<wbr>303836&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>compare/less_comp.sh.cpp (added)<br>
+++ libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>compare/less_comp.sh.cpp Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,73 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03, c++11<br>
+// REQUIRES: fcoroutines-ts<br>
+<br>
+// RUN: %build -fcoroutines-ts<br>
+// RUN: %run<br>
+<br>
+// <experimental/coroutine><br>
+<br>
+// template <class Promise = void><br>
+// struct coroutine_handle;<br>
+<br>
+// bool operator<(coroutine_handle<>, coroutine_handle<>) noexcept<br>
+// bool operator>(coroutine_handle<>, coroutine_handle<>) noexcept<br>
+// bool operator>=(coroutine_handle<>, coroutine_handle<>) noexcept<br>
+// bool operator<=(coroutine_handle<>, coroutine_handle<>) noexcept<br>
+<br>
+#include <experimental/coroutine><br>
+#include <type_traits><br>
+#include <utility><br>
+#include <cstdint><br>
+#include <cassert><br>
+<br>
+#include "test_macros.h"<br>
+<br>
+namespace coro = std::experimental;<br>
+<br>
+template <class C><br>
+void do_test(uintptr_t LHSVal, uintptr_t RHSVal) {<br>
+  const C LHS = C::from_address(reinterpret_<wbr>cast<void*>(LHSVal));<br>
+  const C RHS = C::from_address(reinterpret_<wbr>cast<void*>(RHSVal));<br>
+  assert((LHS < RHS) == (LHSVal < RHSVal));<br>
+  assert((RHS < LHS) == (RHSVal < LHSVal));<br>
+  assert((LHS > RHS) == (LHSVal > RHSVal));<br>
+  assert((RHS > LHS) == (RHSVal > LHSVal));<br>
+  assert((LHS <= RHS) == (LHSVal <= RHSVal));<br>
+  assert((RHS <= LHS) == (RHSVal <= LHSVal));<br>
+  assert((LHS >= RHS) == (LHSVal >= RHSVal));<br>
+  assert((RHS >= LHS) == (RHSVal >= LHSVal));<br>
+  {<br>
+    static_assert(noexcept(LHS < RHS), "");<br>
+    static_assert(noexcept(LHS > RHS), "");<br>
+    static_assert(noexcept(LHS <= RHS), "");<br>
+    static_assert(noexcept(LHS >= RHS), "");<br>
+    ASSERT_SAME_TYPE(decltype(LHS < RHS), bool);<br>
+    ASSERT_SAME_TYPE(decltype(LHS > RHS), bool);<br>
+    ASSERT_SAME_TYPE(decltype(LHS <= RHS), bool);<br>
+    ASSERT_SAME_TYPE(decltype(LHS >= RHS), bool);<br>
+  }<br>
+}<br>
+<br>
+int main()<br>
+{<br>
+  std::pair<uintptr_t, uintptr_t> const TestCases[] = {<br>
+      {0, 0},<br>
+      {16, 16},<br>
+      {0, 16},<br>
+      {16, 0}<br>
+  };<br>
+  for (auto& TC : TestCases) {<br>
+    do_test<coro::coroutine_<wbr>handle<>>(TC.first, TC.second);<br>
+    do_test<coro::coroutine_<wbr>handle<int>>(TC.first, TC.second);<br>
+  }<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>completion/done.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.sh.cpp?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>completion/done.sh.cpp?rev=<wbr>303836&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>completion/done.sh.cpp (added)<br>
+++ libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>completion/done.sh.cpp Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,48 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03, c++11<br>
+// REQUIRES: fcoroutines-ts<br>
+<br>
+// RUN: %build -fcoroutines-ts<br>
+// RUN: %run<br>
+<br>
+// <experimental/coroutine><br>
+<br>
+// template <class Promise = void><br>
+// struct coroutine_handle;<br>
+<br>
+// bool done() const<br>
+<br>
+#include <experimental/coroutine><br>
+#include <type_traits><br>
+#include <memory><br>
+#include <utility><br>
+#include <cstdint><br>
+#include <cassert><br>
+<br>
+#include "test_macros.h"<br>
+<br>
+namespace coro = std::experimental;<br>
+<br>
+template <class Promise><br>
+void do_test(coro::coroutine_<wbr>handle<Promise> const& H) {<br>
+  // FIXME Add a runtime test<br>
+  {<br>
+    ASSERT_SAME_TYPE(decltype(H.<wbr>done()), bool);<br>
+    ASSERT_NOT_NOEXCEPT(H.done());<br>
+  }<br>
+}<br>
+<br>
+int main()<br>
+{<br>
+  do_test(coro::coroutine_<wbr>handle<>{});<br>
+  do_test(coro::coroutine_<wbr>handle<int>{});<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.con/<wbr>assign.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/assign.sh.cpp?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.con/<wbr>assign.sh.cpp?rev=303836&view=<wbr>auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.con/<wbr>assign.sh.cpp (added)<br>
+++ libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.con/<wbr>assign.sh.cpp Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,58 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03, c++11<br>
+// REQUIRES: fcoroutines-ts<br>
+<br>
+// RUN: %build -fcoroutines-ts<br>
+// RUN: %run<br>
+<br>
+// <experimental/coroutine><br>
+<br>
+// template <class Promise = void><br>
+// struct coroutine_handle;<br>
+<br>
+// coroutine_handle& operator=(nullptr_t) noexcept<br>
+<br>
+#include <experimental/coroutine><br>
+#include <type_traits><br>
+#include <cassert><br>
+<br>
+namespace coro = std::experimental;<br>
+<br>
+template <class C><br>
+void do_test() {<br>
+  int dummy = 42;<br>
+  void* dummy_h = &dummy;<br>
+  {<br>
+    C c; ((void)c);<br>
+    static_assert(std::is_nothrow_<wbr>assignable<C&, std::nullptr_t>::value, "");<br>
+    static_assert(!std::is_<wbr>assignable<C&, void*>::value, "");<br>
+  }<br>
+  {<br>
+    C c = C::from_address(dummy_h);<br>
+    assert(c.address() == &dummy);<br>
+    c = nullptr;<br>
+    assert(c.address() == nullptr);<br>
+    c = nullptr;<br>
+    assert(c.address() == nullptr);<br>
+  }<br>
+  {<br>
+    C c;<br>
+    C& cr = (c = nullptr);<br>
+    assert(&c == &cr);<br>
+  }<br>
+}<br>
+<br>
+int main()<br>
+{<br>
+  do_test<coro::coroutine_<wbr>handle<>>();<br>
+  do_test<coro::coroutine_<wbr>handle<int>>();<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.con/<wbr>construct.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/construct.sh.cpp?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.con/<wbr>construct.sh.cpp?rev=303836&<wbr>view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.con/<wbr>construct.sh.cpp (added)<br>
+++ libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.con/<wbr>construct.sh.cpp Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,57 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03, c++11<br>
+// REQUIRES: fcoroutines-ts<br>
+<br>
+// RUN: %build -fcoroutines-ts<br>
+// RUN: %run<br>
+<br>
+// <experimental/coroutine><br>
+<br>
+// template <class Promise = void><br>
+// struct coroutine_handle;<br>
+<br>
+// constexpr coroutine_handle() noexcept<br>
+// constexpr coroutine_handle(nullptr_t) noexcept<br>
+<br>
+#include <experimental/coroutine><br>
+#include <type_traits><br>
+#include <cassert><br>
+<br>
+namespace coro = std::experimental;<br>
+<br>
+template <class C><br>
+void do_test() {<br>
+  {<br>
+    constexpr C c;<br>
+    static_assert(std::is_nothrow_<wbr>default_constructible<C>::<wbr>value, "");<br>
+    static_assert(c.address() == nullptr, "");<br>
+  }<br>
+  {<br>
+    constexpr C c(nullptr);<br>
+    static_assert(std::is_nothrow_<wbr>constructible<C, std::nullptr_t>::value, "");<br>
+    static_assert(c.address() == nullptr, "");<br>
+  }<br>
+  {<br>
+    C c;<br>
+    assert(c.address() == nullptr);<br>
+  }<br>
+  {<br>
+    C c(nullptr);<br>
+    assert(c.address() == nullptr);<br>
+  }<br>
+}<br>
+<br>
+int main()<br>
+{<br>
+  do_test<coro::coroutine_<wbr>handle<>>();<br>
+  do_test<coro::coroutine_<wbr>handle<int>>();<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>export/address.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.sh.cpp?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>export/address.sh.cpp?rev=<wbr>303836&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>export/address.sh.cpp (added)<br>
+++ libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>export/address.sh.cpp Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,55 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03, c++11<br>
+// REQUIRES: fcoroutines-ts<br>
+<br>
+// RUN: %build -fcoroutines-ts<br>
+// RUN: %run<br>
+<br>
+// <experimental/coroutine><br>
+<br>
+// template <class Promise = void><br>
+// struct coroutine_handle;<br>
+<br>
+// constexpr void* address() const noexcept<br>
+<br>
+#include <experimental/coroutine><br>
+#include <type_traits><br>
+#include <cassert><br>
+<br>
+#include "test_macros.h"<br>
+<br>
+namespace coro = std::experimental;<br>
+<br>
+template <class C><br>
+void do_test() {<br>
+  {<br>
+    constexpr C c; ((void)c);<br>
+    static_assert(c.address() == nullptr, "");<br>
+  }<br>
+  {<br>
+    const C c = {}; ((void)c);<br>
+    ASSERT_NOEXCEPT(c.address());<br>
+    ASSERT_SAME_TYPE(decltype(c.<wbr>address()), void*);<br>
+    assert(c.address() == nullptr);<br>
+  }<br>
+  {<br>
+    int dummy = 42;<br>
+    C c = C::from_address(&dummy);<br>
+    assert(c.address() == &dummy);<br>
+  }<br>
+}<br>
+<br>
+int main()<br>
+{<br>
+  do_test<coro::coroutine_<wbr>handle<>>();<br>
+  do_test<coro::coroutine_<wbr>handle<int>>();<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>export/from_address.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.sh.cpp?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>export/from_address.sh.cpp?<wbr>rev=303836&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>export/from_address.sh.cpp (added)<br>
+++ libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>export/from_address.sh.cpp Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,50 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03, c++11<br>
+// REQUIRES: fcoroutines-ts<br>
+<br>
+// RUN: %build -fcoroutines-ts<br>
+// RUN: %run<br>
+<br>
+// <experimental/coroutine><br>
+<br>
+// template <class Promise = void><br>
+// struct coroutine_handle;<br>
+<br>
+// static coroutine_handle from_address(void*) noexcept<br>
+<br>
+#include <experimental/coroutine><br>
+#include <type_traits><br>
+#include <cassert><br>
+<br>
+namespace coro = std::experimental;<br>
+<br>
+template <class C><br>
+void do_test() {<br>
+  {<br>
+    C c = C::from_address(nullptr);<br>
+    static_assert(noexcept(C::<wbr>from_address(nullptr)), "");<br>
+    // FIXME: Should the return type not be 'C'?<br>
+    static_assert(std::is_same<<wbr>decltype(C::from_address(<wbr>nullptr)), C>::value, "");<br>
+    assert(c.address() == nullptr);<br>
+  }<br>
+  {<br>
+    int dummy = 42;<br>
+    C c = C::from_address(&dummy);<br>
+    assert(c.address() == &dummy);<br>
+  }<br>
+}<br>
+<br>
+int main()<br>
+{<br>
+  do_test<coro::coroutine_<wbr>handle<>>();<br>
+  do_test<coro::coroutine_<wbr>handle<int>>();<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.hash/<wbr>hash.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.sh.cpp?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.hash/<wbr>hash.sh.cpp?rev=303836&view=<wbr>auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.hash/<wbr>hash.sh.cpp (added)<br>
+++ libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.hash/<wbr>hash.sh.cpp Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,67 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03, c++11<br>
+// REQUIRES: fcoroutines-ts<br>
+<br>
+// RUN: %build -fcoroutines-ts<br>
+// RUN: %run<br>
+<br>
+// <experimental/coroutine><br>
+<br>
+// template <class Promise = void><br>
+// struct coroutine_handle;<br>
+<br>
+// namespace std {<br>
+//  template <class P> struct hash<experimental::coroutine_<wbr>handle<P>>;<br>
+// }<br>
+<br>
+#include <experimental/coroutine><br>
+#include <type_traits><br>
+#include <memory><br>
+#include <utility><br>
+#include <cstdint><br>
+#include <cassert><br>
+<br>
+#include "test_macros.h"<br>
+<br>
+namespace coro = std::experimental;<br>
+<br>
+template <class C><br>
+void do_test(uintptr_t LHSVal, uintptr_t RHSVal) {<br>
+  const size_t ExpectLHS = std::hash<void*>{}(<wbr>reinterpret_cast<void*>(<wbr>LHSVal));<br>
+  const size_t ExpectRHS = std::hash<void*>{}(<wbr>reinterpret_cast<void*>(<wbr>RHSVal));<br>
+  const C LHS = C::from_address(reinterpret_<wbr>cast<void*>(LHSVal));<br>
+  const C RHS = C::from_address(reinterpret_<wbr>cast<void*>(RHSVal));<br>
+  const std::hash<C> h;<br>
+  // FIXME: libc++'s implementation hash's the result of LHS.address(), so we<br>
+  // expect that value. However this is not required.<br>
+  assert(h(LHS) == ExpectLHS);<br>
+  assert(h(RHS) == ExpectRHS);<br>
+  assert((h(LHS) == h(RHS)) == (LHSVal == RHSVal));<br>
+  {<br>
+    ASSERT_SAME_TYPE(decltype(h(<wbr>LHS)), size_t);<br>
+    ASSERT_NOEXCEPT(std::hash<C>{}<wbr>(LHS));<br>
+  }<br>
+}<br>
+<br>
+int main()<br>
+{<br>
+  std::pair<uintptr_t, uintptr_t> const TestCases[] = {<br>
+      {0, 0},<br>
+      {0, 8},<br>
+      {8, 8},<br>
+      {8, 16}<br>
+  };<br>
+  for (auto& TC : TestCases) {<br>
+    do_test<coro::coroutine_<wbr>handle<>>(TC.first, TC.second);<br>
+    do_test<coro::coroutine_<wbr>handle<int>>(TC.first, TC.second);<br>
+  }<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.prom/<wbr>promise.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.prom/<wbr>promise.sh.cpp?rev=303836&<wbr>view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.prom/<wbr>promise.sh.cpp (added)<br>
+++ libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.prom/<wbr>promise.sh.cpp Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,54 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03, c++11<br>
+// REQUIRES: fcoroutines-ts<br>
+<br>
+// RUN: %build -fcoroutines-ts<br>
+// RUN: %run<br>
+<br>
+// <experimental/coroutine><br>
+<br>
+// template <class Promise><br>
+// struct coroutine_handle<Promise>;<br>
+<br>
+// Promise& promise()<br>
+// Promise const& promise() const<br>
+<br>
+#include <experimental/coroutine><br>
+#include <type_traits><br>
+#include <memory><br>
+#include <utility><br>
+#include <cstdint><br>
+#include <cassert><br>
+<br>
+#include "test_macros.h"<br>
+<br>
+namespace coro = std::experimental;<br>
+<br>
+template <class Promise><br>
+void do_test(coro::coroutine_<wbr>handle<Promise>&& H) {<br>
+<br>
+  // FIXME Add a runtime test<br>
+  {<br>
+    ASSERT_SAME_TYPE(decltype(H.<wbr>promise()), Promise&);<br>
+    ASSERT_NOT_NOEXCEPT(H.promise(<wbr>));<br>
+  }<br>
+  {<br>
+    auto const& CH = H;<br>
+    ASSERT_SAME_TYPE(decltype(CH.<wbr>promise()), Promise const&);<br>
+    ASSERT_NOT_NOEXCEPT(CH.<wbr>promise());<br>
+  }<br>
+}<br>
+<br>
+int main()<br>
+{<br>
+  do_test(coro::coroutine_<wbr>handle<int>{});<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>resumption/destroy.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.sh.cpp?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>resumption/destroy.sh.cpp?rev=<wbr>303836&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>resumption/destroy.sh.cpp (added)<br>
+++ libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>resumption/destroy.sh.cpp Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,48 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03, c++11<br>
+// REQUIRES: fcoroutines-ts<br>
+<br>
+// RUN: %build -fcoroutines-ts<br>
+// RUN: %run<br>
+<br>
+// <experimental/coroutine><br>
+<br>
+// template <class Promise = void><br>
+// struct coroutine_handle;<br>
+<br>
+// void destroy() const<br>
+<br>
+#include <experimental/coroutine><br>
+#include <type_traits><br>
+#include <memory><br>
+#include <utility><br>
+#include <cstdint><br>
+#include <cassert><br>
+<br>
+#include "test_macros.h"<br>
+<br>
+namespace coro = std::experimental;<br>
+<br>
+template <class Promise><br>
+void do_test(coro::coroutine_<wbr>handle<Promise> const& H) {<br>
+  // FIXME Add a runtime test<br>
+  {<br>
+    ASSERT_SAME_TYPE(decltype(H.<wbr>destroy()), void);<br>
+    ASSERT_NOT_NOEXCEPT(H.destroy(<wbr>));<br>
+  }<br>
+}<br>
+<br>
+int main()<br>
+{<br>
+  do_test(coro::coroutine_<wbr>handle<>{});<br>
+  do_test(coro::coroutine_<wbr>handle<int>{});<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>resumption/resume.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.sh.cpp?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>resumption/resume.sh.cpp?rev=<wbr>303836&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>resumption/resume.sh.cpp (added)<br>
+++ libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/coroutine.handle.<wbr>resumption/resume.sh.cpp Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,51 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03, c++11<br>
+// REQUIRES: fcoroutines-ts<br>
+<br>
+// RUN: %build -fcoroutines-ts<br>
+// RUN: %run<br>
+<br>
+// <experimental/coroutine><br>
+<br>
+// template <class Promise = void><br>
+// struct coroutine_handle;<br>
+<br>
+// void operator()() const<br>
+// void resume() const<br>
+<br>
+#include <experimental/coroutine><br>
+#include <type_traits><br>
+#include <memory><br>
+#include <utility><br>
+#include <cstdint><br>
+#include <cassert><br>
+<br>
+#include "test_macros.h"<br>
+<br>
+namespace coro = std::experimental;<br>
+<br>
+template <class Promise><br>
+void do_test(coro::coroutine_<wbr>handle<Promise> const& H) {<br>
+  // FIXME Add a runtime test<br>
+  {<br>
+    ASSERT_SAME_TYPE(decltype(H.<wbr>resume()), void);<br>
+    ASSERT_SAME_TYPE(decltype(H())<wbr>, void);<br>
+    ASSERT_NOT_NOEXCEPT(H.resume()<wbr>);<br>
+    ASSERT_NOT_NOEXCEPT(H());<br>
+  }<br>
+}<br>
+<br>
+int main()<br>
+{<br>
+  do_test(coro::coroutine_<wbr>handle<>{});<br>
+  do_test(coro::coroutine_<wbr>handle<int>{});<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/void_handle.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/void_handle.sh.cpp?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/void_handle.sh.cpp?rev=<wbr>303836&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/void_handle.sh.cpp (added)<br>
+++ libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>handle/void_handle.sh.cpp Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,55 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03, c++11<br>
+// REQUIRES: fcoroutines-ts<br>
+<br>
+// RUN: %build -fcoroutines-ts<br>
+// RUN: %run<br>
+<br>
+#include <experimental/coroutine><br>
+<br>
+namespace coro = std::experimental;<br>
+<br>
+struct A {<br>
+  using promise_type = A*;<br>
+};<br>
+<br>
+struct B {};<br>
+struct C {};<br>
+<br>
+namespace std { namespace experimental {<br>
+  template <><br>
+  struct coroutine_traits<::A, int> {<br>
+    using promise_type = int*;<br>
+  };<br>
+  template <class ...Args><br>
+  struct coroutine_traits<::B, Args...> {<br>
+    using promise_type = B*;<br>
+  };<br>
+  template <><br>
+  struct coroutine_traits<::C> {<br>
+    using promise_type = void;<br>
+  };<br>
+}}<br>
+<br>
+template <class Expect, class T, class ...Args><br>
+void check_type() {<br>
+  using P = typename coro::coroutine_traits<T, Args...>::promise_type ;<br>
+  static_assert(std::is_same<P, Expect>::value, "");<br>
+};<br>
+<br>
+int main()<br>
+{<br>
+  check_type<A*, A>();<br>
+  check_type<int*, A, int>();<br>
+  check_type<B*, B>();<br>
+  check_type<void, C>();<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>traits/promise_type.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.traits/promise_type.sh.cpp?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>traits/promise_type.sh.cpp?<wbr>rev=303836&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>traits/promise_type.sh.cpp (added)<br>
+++ libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>traits/promise_type.sh.cpp Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,81 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03, c++11<br>
+// REQUIRES: fcoroutines-ts<br>
+<br>
+// RUN: %build -fcoroutines-ts<br>
+// RUN: %run<br>
+<br>
+#include <experimental/coroutine><br>
+<br>
+namespace coro = std::experimental;<br>
+<br>
+template <class T, class = typename T::promise_type><br>
+constexpr bool has_promise_type(int) { return true; }<br>
+template <class><br>
+constexpr bool has_promise_type(long) { return false; }<br>
+template <class T><br>
+constexpr bool has_promise_type() { return has_promise_type<T>(0); }<br>
+<br>
+struct A {<br>
+  using promise_type = A*;<br>
+};<br>
+<br>
+struct B {};<br>
+struct C {};<br>
+struct D {<br>
+private:<br>
+  using promise_type = void;<br>
+};<br>
+struct E {};<br>
+<br>
+namespace std { namespace experimental {<br>
+  template <><br>
+  struct coroutine_traits<::A, int> {<br>
+    using promise_type = int*;<br>
+  };<br>
+  template <class ...Args><br>
+  struct coroutine_traits<::B, Args...> {<br>
+    using promise_type = B*;<br>
+  };<br>
+  template <><br>
+  struct coroutine_traits<::C> {<br>
+    using promise_type = void;<br>
+  };<br>
+}}<br>
+<br>
+template <class Expect, class T, class ...Args><br>
+void check_type() {<br>
+  using Traits = coro::coroutine_traits<T, Args...>;<br>
+  static_assert(has_promise_<wbr>type<Traits>(), "");<br>
+  static_assert(std::is_same<<wbr>typename Traits::promise_type, Expect>::value, "");<br>
+}<br>
+<br>
+template <class T, class ...Args><br>
+void check_no_type() {<br>
+  using Traits = coro::coroutine_traits<T, Args...>;<br>
+  static_assert(!has_promise_<wbr>type<Traits>(), "");<br>
+}<br>
+<br>
+int main()<br>
+{<br>
+  {<br>
+    check_type<A*, A>();<br>
+    check_type<int*, A, int>();<br>
+    check_type<B*, B>();<br>
+    check_type<void, C>();<br>
+  }<br>
+  {<br>
+    check_no_type<D>();<br>
+    check_no_type<E>();<br>
+    check_no_type<C, int>();<br>
+  }<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>trivial.awaitables/suspend_<wbr>always.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_always.sh.cpp?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>trivial.awaitables/suspend_<wbr>always.sh.cpp?rev=303836&view=<wbr>auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>trivial.awaitables/suspend_<wbr>always.sh.cpp (added)<br>
+++ libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>trivial.awaitables/suspend_<wbr>always.sh.cpp Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,73 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03, c++11<br>
+// REQUIRES: fcoroutines-ts<br>
+<br>
+// RUN: %build -fcoroutines-ts<br>
+// RUN: %run<br>
+<br>
+#include <experimental/coroutine><br>
+#include <type_traits><br>
+#include <cassert><br>
+<br>
+#include "test_macros.h"<br>
+<br>
+namespace coro = std::experimental;<br>
+<br>
+using SuspendT = std::experimental::coroutines_<wbr>v1::suspend_always;<br>
+<br>
+TEST_SAFE_STATIC SuspendT safe_sa;<br>
+constexpr SuspendT constexpr_sa;<br>
+<br>
+constexpr bool check_suspend_constexpr() {<br>
+  SuspendT s{};<br>
+  const SuspendT scopy(s); ((void)scopy);<br>
+  SuspendT smove(std::move(s)); ((void)smove);<br>
+  s = scopy;<br>
+  s = std::move(smove);<br>
+  return true;<br>
+}<br>
+<br>
+int main()<br>
+{<br>
+  using H = coro::coroutine_handle<>;<br>
+  using S = SuspendT;<br>
+  H h{};<br>
+  S s{};<br>
+  S const& cs = s;<br>
+  {<br>
+    LIBCPP_STATIC_ASSERT(noexcept(<wbr>s.await_ready()), "");<br>
+    static_assert(std::is_same<<wbr>decltype(s.await_ready()), bool>::value, "");<br>
+    assert(s.await_ready() == false);<br>
+    assert(cs.await_ready() == false);<br>
+  }<br>
+  {<br>
+    LIBCPP_STATIC_ASSERT(noexcept(<wbr>s.await_suspend(h)), "");<br>
+    static_assert(std::is_same<<wbr>decltype(s.await_suspend(h)), void>::value, "");<br>
+    s.await_suspend(h);<br>
+    cs.await_suspend(h);<br>
+  }<br>
+  {<br>
+    LIBCPP_STATIC_ASSERT(noexcept(<wbr>s.await_resume()), "");<br>
+    static_assert(std::is_same<<wbr>decltype(s.await_resume()), void>::value, "");<br>
+    s.await_resume();<br>
+    cs.await_resume();<br>
+  }<br>
+  {<br>
+    static_assert(std::is_nothrow_<wbr>default_constructible<S>::<wbr>value, "");<br>
+    static_assert(std::is_nothrow_<wbr>copy_constructible<S>::value, "");<br>
+    static_assert(std::is_nothrow_<wbr>move_constructible<S>::value, "");<br>
+    static_assert(std::is_nothrow_<wbr>copy_assignable<S>::value, "");<br>
+    static_assert(std::is_nothrow_<wbr>move_assignable<S>::value, "");<br>
+    static_assert(std::is_<wbr>trivially_copyable<S>::value, "");<br>
+    static_assert(check_suspend_<wbr>constexpr(), "");<br>
+  }<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>trivial.awaitables/suspend_<wbr>never.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_never.sh.cpp?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>trivial.awaitables/suspend_<wbr>never.sh.cpp?rev=303836&view=<wbr>auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>trivial.awaitables/suspend_<wbr>never.sh.cpp (added)<br>
+++ libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/coroutine.<wbr>trivial.awaitables/suspend_<wbr>never.sh.cpp Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,75 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03, c++11<br>
+// REQUIRES: fcoroutines-ts<br>
+<br>
+// RUN: %build -fcoroutines-ts<br>
+// RUN: %run<br>
+<br>
+#include <experimental/coroutine><br>
+#include <type_traits><br>
+#include <cassert><br>
+<br>
+#include "test_macros.h"<br>
+<br>
+namespace coro = std::experimental;<br>
+<br>
+// Test that the type is in the correct namespace<br>
+using SuspendT = std::experimental::coroutines_<wbr>v1::suspend_never;<br>
+<br>
+TEST_SAFE_STATIC SuspendT safe_sn;<br>
+constexpr SuspendT constexpr_sn;<br>
+<br>
+constexpr bool check_suspend_constexpr() {<br>
+  SuspendT s{};<br>
+  const SuspendT scopy(s); ((void)scopy);<br>
+  SuspendT smove(std::move(s)); ((void)smove);<br>
+  s = scopy;<br>
+  s = std::move(smove);<br>
+  return true;<br>
+}<br>
+<br>
+<br>
+int main()<br>
+{<br>
+  using H = coro::coroutine_handle<>;<br>
+  using S = SuspendT;<br>
+  H h{};<br>
+  S s{};<br>
+  S const& cs = s;<br>
+  {<br>
+    LIBCPP_STATIC_ASSERT(noexcept(<wbr>s.await_ready()), "");<br>
+    static_assert(std::is_same<<wbr>decltype(s.await_ready()), bool>::value, "");<br>
+    assert(s.await_ready() == true);<br>
+    assert(cs.await_ready() == true);<br>
+  }<br>
+  {<br>
+    LIBCPP_STATIC_ASSERT(noexcept(<wbr>s.await_suspend(h)), "");<br>
+    static_assert(std::is_same<<wbr>decltype(s.await_suspend(h)), void>::value, "");<br>
+    s.await_suspend(h);<br>
+    cs.await_suspend(h);<br>
+  }<br>
+  {<br>
+    LIBCPP_STATIC_ASSERT(noexcept(<wbr>s.await_resume()), "");<br>
+    static_assert(std::is_same<<wbr>decltype(s.await_resume()), void>::value, "");<br>
+    s.await_resume();<br>
+    cs.await_resume();<br>
+  }<br>
+  {<br>
+    static_assert(std::is_nothrow_<wbr>default_constructible<S>::<wbr>value, "");<br>
+    static_assert(std::is_nothrow_<wbr>copy_constructible<S>::value, "");<br>
+    static_assert(std::is_nothrow_<wbr>move_constructible<S>::value, "");<br>
+    static_assert(std::is_nothrow_<wbr>copy_assignable<S>::value, "");<br>
+    static_assert(std::is_nothrow_<wbr>move_assignable<S>::value, "");<br>
+    static_assert(std::is_<wbr>trivially_copyable<S>::value, "");<br>
+    static_assert(check_suspend_<wbr>constexpr(), "");<br>
+  }<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/includes.<wbr>sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/includes.sh.cpp?rev=303836&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/includes.<wbr>sh.cpp?rev=303836&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/includes.<wbr>sh.cpp (added)<br>
+++ libcxx/trunk/test/std/<wbr>experimental/language.support/<wbr>support.coroutines/includes.<wbr>sh.cpp Wed May 24 23:36:24 2017<br>
@@ -0,0 +1,31 @@<br>
+// -*- C++ -*-<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03, c++11<br>
+// REQUIRES: fcoroutines-ts<br>
+<br>
+// RUN: %build -fcoroutines-ts<br>
+// RUN: %run<br>
+<br>
+// <experimental/coroutine><br>
+<br>
+// Test that <experimental/coroutine> includes <new><br>
+<br>
+#include <experimental/coroutine><br>
+<br>
+<br>
+<br>
+int main(){<br>
+  // std::nothrow is not implicitly defined by the compiler when the include is<br>
+  // missing, unlike other parts of <new>. Therefore we use std::nothrow to<br>
+  // test for #include <new><br>
+  (void)std::nothrow;<br>
+<br>
+}<br>
<br>
Modified: libcxx/trunk/test/support/<wbr>test_macros.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_macros.h?rev=303836&r1=303835&r2=303836&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/<wbr>support/test_macros.h?rev=<wbr>303836&r1=303835&r2=303836&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/support/<wbr>test_macros.h (original)<br>
+++ libcxx/trunk/test/support/<wbr>test_macros.h Wed May 24 23:36:24 2017<br>
@@ -154,6 +154,12 @@<br>
 #define TEST_NORETURN [[noreturn]]<br>
 #endif<br>
<br>
+#if defined(_LIBCPP_SAFE_STATIC)<br>
+#define TEST_SAFE_STATIC _LIBCPP_SAFE_STATIC<br>
+#else<br>
+#define TEST_SAFE_STATIC<br>
+#endif<br>
+<br>
 #if TEST_STD_VER < 11<br>
 #define ASSERT_NOEXCEPT(...)<br>
 #define ASSERT_NOT_NOEXCEPT(...)<br>
<br>
Modified: libcxx/trunk/utils/libcxx/<wbr>test/config.py<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/test/config.py?rev=303836&r1=303835&r2=303836&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/utils/<wbr>libcxx/test/config.py?rev=<wbr>303836&r1=303835&r2=303836&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/utils/libcxx/<wbr>test/config.py (original)<br>
+++ libcxx/trunk/utils/libcxx/<wbr>test/config.py Wed May 24 23:36:24 2017<br>
@@ -142,6 +142,7 @@ class Configuration(object):<br>
         self.configure_sanitizer()<br>
         self.configure_coverage()<br>
         self.configure_modules()<br>
+        self.configure_coroutines()<br>
         self.configure_substitutions()<br>
         self.configure_features()<br>
<br>
@@ -954,6 +955,10 @@ class Configuration(object):<br>
             self.cxx.flags += ['-g', '--coverage']<br>
             self.cxx.compile_flags += ['-O0']<br>
<br>
+    def configure_coroutines(self):<br>
+        if self.cxx.hasCompileFlag('-<wbr>fcoroutines-ts'):<br>
+            self.config.available_<wbr>features.add('fcoroutines-ts')<br>
+<br>
     def configure_modules(self):<br>
         modules_flags = ['-fmodules']<br>
         if platform.system() != 'Darwin':<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>