svn commit: r319146 - in vendor/libc++/dist: . cmake include include/experimental lib test/libcxx test/libcxx/experimental/language.support test/libcxx/experimental/language.support/support.corouti...

Dimitry Andric dim at FreeBSD.org
Mon May 29 16:26:13 UTC 2017


Author: dim
Date: Mon May 29 16:26:10 2017
New Revision: 319146
URL: https://svnweb.freebsd.org/changeset/base/319146

Log:
  Vendor import of libc++ trunk r304149:
  https://llvm.org/svn/llvm-project/libcxx/trunk@304149

Added:
  vendor/libc++/dist/include/experimental/coroutine
  vendor/libc++/dist/test/libcxx/experimental/language.support/
  vendor/libc++/dist/test/libcxx/experimental/language.support/support.coroutines/
  vendor/libc++/dist/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/libcxx/experimental/language.support/support.coroutines/version.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/
  vendor/libc++/dist/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/equal_comp.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/less_comp.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/assign.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/construct.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/void_handle.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.traits/
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.traits/promise_type.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_always.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_never.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/end.to.end/
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/end.to.end/await_result.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/end.to.end/expected.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/end.to.end/generator.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/end.to.end/go.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/end.to.end/multishot_func.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/includes.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/support/coroutine_types.h   (contents, props changed)
  vendor/libc++/dist/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp   (contents, props changed)
Deleted:
  vendor/libc++/dist/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/arrow.pass.cpp
  vendor/libc++/dist/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
Modified:
  vendor/libc++/dist/CMakeLists.txt
  vendor/libc++/dist/cmake/config-ix.cmake
  vendor/libc++/dist/include/__config
  vendor/libc++/dist/include/__threading_support
  vendor/libc++/dist/include/algorithm
  vendor/libc++/dist/include/experimental/__config
  vendor/libc++/dist/include/iterator
  vendor/libc++/dist/include/memory
  vendor/libc++/dist/include/module.modulemap
  vendor/libc++/dist/lib/CMakeLists.txt
  vendor/libc++/dist/test/libcxx/double_include.sh.cpp
  vendor/libc++/dist/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
  vendor/libc++/dist/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
  vendor/libc++/dist/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
  vendor/libc++/dist/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
  vendor/libc++/dist/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
  vendor/libc++/dist/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
  vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp
  vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp
  vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
  vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
  vendor/libc++/dist/test/support/poisoned_hash_helper.hpp
  vendor/libc++/dist/test/support/test_macros.h
  vendor/libc++/dist/test/support/test_workarounds.h
  vendor/libc++/dist/test/support/uses_alloc_types.hpp
  vendor/libc++/dist/utils/libcxx/test/config.py
  vendor/libc++/dist/www/cxx1z_status.html

Modified: vendor/libc++/dist/CMakeLists.txt
==============================================================================
--- vendor/libc++/dist/CMakeLists.txt	Mon May 29 16:26:06 2017	(r319145)
+++ vendor/libc++/dist/CMakeLists.txt	Mon May 29 16:26:10 2017	(r319146)
@@ -452,6 +452,11 @@ add_compile_flags_if_supported(-nostdinc
 # the dylib when get ODR used by another function.
 add_compile_flags_if_supported(-fvisibility-inlines-hidden)
 
+if (LIBCXX_CONFIGURE_IDE)
+  # This simply allows IDE to process <experimental/coroutine>
+  add_compile_flags_if_supported(-fcoroutines-ts)
+endif()
+
 # Let the library headers know they are currently being used to build the
 # library.
 add_definitions(-D_LIBCPP_BUILDING_LIBRARY)

Modified: vendor/libc++/dist/cmake/config-ix.cmake
==============================================================================
--- vendor/libc++/dist/cmake/config-ix.cmake	Mon May 29 16:26:06 2017	(r319145)
+++ vendor/libc++/dist/cmake/config-ix.cmake	Mon May 29 16:26:10 2017	(r319146)
@@ -41,7 +41,15 @@ if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
   if (MINGW)
     # Mingw64 requires quite a few "C" runtime libraries in order for basic
     # programs to link successfully with -nodefaultlibs.
-    list(APPEND CMAKE_REQUIRED_LIBRARIES mingw32 gcc gcc_eh mingwex msvcrt gcc)
+    if (LIBCXX_USE_COMPILER_RT)
+      set(MINGW_RUNTIME ${LIBCXX_BUILTINS_LIBRARY})
+    else ()
+      set(MINGW_RUNTIME gcc_s gcc)
+    endif()
+    set(MINGW_LIBRARIES mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt advapi32
+                        shell32 user32 kernel32 mingw32 ${MINGW_RUNTIME}
+                        moldname mingwex msvcrt)
+    list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES})
   endif()
   if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
     set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")

Modified: vendor/libc++/dist/include/__config
==============================================================================
--- vendor/libc++/dist/include/__config	Mon May 29 16:26:06 2017	(r319145)
+++ vendor/libc++/dist/include/__config	Mon May 29 16:26:10 2017	(r319146)
@@ -1126,6 +1126,10 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit
 # define _LIBCPP_HAS_NO_IS_AGGREGATE
 #endif
 
+#if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L
+# define _LIBCPP_HAS_NO_COROUTINES
+#endif
+
 #endif // __cplusplus
 
 // Decide whether to use availability macros.

Modified: vendor/libc++/dist/include/__threading_support
==============================================================================
--- vendor/libc++/dist/include/__threading_support	Mon May 29 16:26:06 2017	(r319145)
+++ vendor/libc++/dist/include/__threading_support	Mon May 29 16:26:10 2017	(r319146)
@@ -27,7 +27,7 @@
 # include <pthread.h>
 # include <sched.h>
 #elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
-#include <Windows.h>
+#include <windows.h>
 #include <process.h>
 #include <fibersapi.h>
 #include <__undef_min_max>

Modified: vendor/libc++/dist/include/algorithm
==============================================================================
--- vendor/libc++/dist/include/algorithm	Mon May 29 16:26:06 2017	(r319145)
+++ vendor/libc++/dist/include/algorithm	Mon May 29 16:26:10 2017	(r319146)
@@ -35,6 +35,9 @@ template <class InputIterator, class Fun
     Function
     for_each(InputIterator first, InputIterator last, Function f);
 
+template<class InputIterator, class Size, class Function>
+    InputIterator for_each_n(InputIterator first, Size n, Function f); // C++17
+
 template <class InputIterator, class T>
     InputIterator
     find(InputIterator first, InputIterator last, const T& value);
@@ -961,6 +964,26 @@ for_each(_InputIterator __first, _InputI
     return __f;
 }
 
+#if _LIBCPP_STD_VER > 14
+// for_each_n
+
+template <class _InputIterator, class _Size, class _Function>
+inline _LIBCPP_INLINE_VISIBILITY
+_InputIterator
+for_each_n(_InputIterator __first, _Size __orig_n, _Function __f)
+{
+    typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
+    _IntegralSize __n = __orig_n;
+    while (__n > 0)
+    {
+         __f(*__first);
+         ++__first;
+         --__n;
+    }
+    return __first;
+}
+#endif
+
 // find
 
 template <class _InputIterator, class _Tp>

Modified: vendor/libc++/dist/include/experimental/__config
==============================================================================
--- vendor/libc++/dist/include/experimental/__config	Mon May 29 16:26:06 2017	(r319145)
+++ vendor/libc++/dist/include/experimental/__config	Mon May 29 16:26:10 2017	(r319146)
@@ -44,6 +44,13 @@
 #define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM \
     } } _LIBCPP_END_NAMESPACE_EXPERIMENTAL
 
+#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_COROUTINES \
+  _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace coroutines_v1 {
+
+#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_COROUTINES \
+  } _LIBCPP_END_NAMESPACE_EXPERIMENTAL
+
+#define _VSTD_CORO _VSTD_EXPERIMENTAL::coroutines_v1
 
 #define _VSTD_FS ::std::experimental::filesystem::v1
 

Added: vendor/libc++/dist/include/experimental/coroutine
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/libc++/dist/include/experimental/coroutine	Mon May 29 16:26:10 2017	(r319146)
@@ -0,0 +1,270 @@
+// -*- C++ -*-
+//===----------------------------- coroutine -----------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_EXPERIMENTAL_COROUTINE
+#define _LIBCPP_EXPERIMENTAL_COROUTINE
+
+/**
+    experimental/coroutine synopsis
+
+// C++next
+
+namespace std {
+namespace experimental {
+inline namespace coroutines_v1 {
+
+  // 18.11.1 coroutine traits
+template <typename R, typename... ArgTypes>
+class coroutine_traits;
+// 18.11.2 coroutine handle
+template <typename Promise = void>
+class coroutine_handle;
+// 18.11.2.7 comparison operators:
+bool operator==(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
+bool operator!=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
+bool operator<(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
+bool operator<=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
+bool operator>=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
+bool operator>(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
+// 18.11.3 trivial awaitables
+struct suspend_never;
+struct suspend_always;
+// 18.11.2.8 hash support:
+template <class T> struct hash;
+template <class P> struct hash<coroutine_handle<P>>;
+
+} // namespace coroutines_v1
+} // namespace experimental
+} // namespace std
+
+ */
+
+#include <experimental/__config>
+#include <new>
+#include <type_traits>
+#include <functional>
+#include <memory> // for hash<T*>
+#include <cstddef>
+#include <cassert>
+#include <__debug>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#ifdef _LIBCPP_HAS_NO_COROUTINES
+# if defined(_LIBCPP_WARNING)
+    _LIBCPP_WARNING("<experimental/coroutine> cannot be used with this compiler")
+# else
+#   warning <experimental/coroutine> cannot be used with this compiler
+# endif
+#endif
+
+#ifndef _LIBCPP_HAS_NO_COROUTINES
+
+_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_COROUTINES
+
+template <class _Tp, class = void>
+struct __coroutine_traits_sfinae {};
+
+template <class _Tp>
+struct __coroutine_traits_sfinae<
+    _Tp, typename __void_t<typename _Tp::promise_type>::type>
+{
+  using promise_type = typename _Tp::promise_type;
+};
+
+template <typename _Ret, typename... _Args>
+struct _LIBCPP_TEMPLATE_VIS coroutine_traits
+    : public __coroutine_traits_sfinae<_Ret>
+{
+};
+
+template <typename _Promise = void>
+class _LIBCPP_TEMPLATE_VIS coroutine_handle;
+
+template <>
+class _LIBCPP_TEMPLATE_VIS coroutine_handle<void> {
+public:
+    _LIBCPP_ALWAYS_INLINE
+    _LIBCPP_CONSTEXPR coroutine_handle() _NOEXCEPT : __handle_(nullptr) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    _LIBCPP_CONSTEXPR coroutine_handle(nullptr_t) _NOEXCEPT : __handle_(nullptr) {}
+
+    _LIBCPP_ALWAYS_INLINE
+    coroutine_handle& operator=(nullptr_t) _NOEXCEPT {
+        __handle_ = nullptr;
+        return *this;
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    _LIBCPP_CONSTEXPR void* address() const _NOEXCEPT { return __handle_; }
+
+    _LIBCPP_ALWAYS_INLINE
+    _LIBCPP_CONSTEXPR explicit operator bool() const _NOEXCEPT { return __handle_; }
+
+    _LIBCPP_ALWAYS_INLINE
+    void operator()() { resume(); }
+
+    _LIBCPP_ALWAYS_INLINE
+    void resume() {
+      _LIBCPP_ASSERT(__is_suspended(),
+                     "resume() can only be called on suspended coroutines");
+      _LIBCPP_ASSERT(!done(),
+                "resume() has undefined behavior when the coroutine is done");
+      __builtin_coro_resume(__handle_);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    void destroy() {
+      _LIBCPP_ASSERT(__is_suspended(),
+                     "destroy() can only be called on suspended coroutines");
+      __builtin_coro_destroy(__handle_);
+    }
+
+    _LIBCPP_ALWAYS_INLINE
+    bool done() const {
+      _LIBCPP_ASSERT(__is_suspended(),
+                     "done() can only be called on suspended coroutines");
+      return __builtin_coro_done(__handle_);
+    }
+
+public:
+    _LIBCPP_ALWAYS_INLINE
+    static coroutine_handle from_address(void* __addr) _NOEXCEPT {
+        coroutine_handle __tmp;
+        __tmp.__handle_ = __addr;
+        return __tmp;
+    }
+
+private:
+  bool __is_suspended() const _NOEXCEPT  {
+    // FIXME actually implement a check for if the coro is suspended.
+    return __handle_;
+  }
+
+  template <class _PromiseT> friend class coroutine_handle;
+  void* __handle_;
+};
+
+// 18.11.2.7 comparison operators:
+inline _LIBCPP_ALWAYS_INLINE
+bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
+    return __x.address() == __y.address();
+}
+inline _LIBCPP_ALWAYS_INLINE
+bool operator!=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
+    return !(__x == __y);
+}
+inline _LIBCPP_ALWAYS_INLINE
+bool operator<(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
+    return less<void*>()(__x.address(), __y.address());
+}
+inline _LIBCPP_ALWAYS_INLINE
+bool operator>(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
+    return __y < __x;
+}
+inline _LIBCPP_ALWAYS_INLINE
+bool operator<=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
+    return !(__x > __y);
+}
+inline _LIBCPP_ALWAYS_INLINE
+bool operator>=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
+    return !(__x < __y);
+}
+
+template <typename _Promise>
+class _LIBCPP_TEMPLATE_VIS coroutine_handle : public coroutine_handle<> {
+    using _Base = coroutine_handle<>;
+public:
+#ifndef _LIBCPP_CXX03_LANG
+    // 18.11.2.1 construct/reset
+    using coroutine_handle<>::coroutine_handle;
+#else
+    _LIBCPP_ALWAYS_INLINE coroutine_handle() _NOEXCEPT : _Base() {}
+    _LIBCPP_ALWAYS_INLINE coroutine_handle(nullptr_t) _NOEXCEPT : _Base(nullptr) {}
+#endif
+    _LIBCPP_INLINE_VISIBILITY
+    coroutine_handle& operator=(nullptr_t) _NOEXCEPT {
+        _Base::operator=(nullptr);
+        return *this;
+    }
+
+    _LIBCPP_INLINE_VISIBILITY
+    _Promise& promise() const {
+        return *reinterpret_cast<_Promise*>(
+            __builtin_coro_promise(this->__handle_, __alignof(_Promise), false));
+    }
+
+public:
+    _LIBCPP_ALWAYS_INLINE
+    static coroutine_handle from_address(void* __addr) _NOEXCEPT {
+        coroutine_handle __tmp;
+        __tmp.__handle_ = __addr;
+        return __tmp;
+    }
+
+    // NOTE: this overload isn't required by the standard but is needed so
+    // the deleted _Promise* overload doesn't make from_address(nullptr)
+    // ambiguous.
+    // FIXME: should from_address work with nullptr?
+    _LIBCPP_ALWAYS_INLINE
+    static coroutine_handle from_address(nullptr_t) _NOEXCEPT {
+      return {};
+    }
+
+    // from_address cannot be used with the coroutines promise type.
+    static coroutine_handle from_address(_Promise*) = delete;
+
+    _LIBCPP_ALWAYS_INLINE
+    static coroutine_handle from_promise(_Promise& __promise) _NOEXCEPT {
+        coroutine_handle __tmp;
+        __tmp.__handle_ = __builtin_coro_promise(_VSTD::addressof(__promise),
+                                                 __alignof(_Promise), true);
+        return __tmp;
+    }
+};
+
+struct _LIBCPP_TYPE_VIS suspend_never {
+  _LIBCPP_ALWAYS_INLINE
+  bool await_ready() const _NOEXCEPT { return true; }
+  _LIBCPP_ALWAYS_INLINE
+  void await_suspend(coroutine_handle<>) const _NOEXCEPT {}
+  _LIBCPP_ALWAYS_INLINE
+  void await_resume() const _NOEXCEPT {}
+};
+
+struct _LIBCPP_TYPE_VIS suspend_always {
+  _LIBCPP_ALWAYS_INLINE
+  bool await_ready() const _NOEXCEPT { return false; }
+  _LIBCPP_ALWAYS_INLINE
+  void await_suspend(coroutine_handle<>) const _NOEXCEPT {}
+  _LIBCPP_ALWAYS_INLINE
+  void await_resume() const _NOEXCEPT {}
+};
+
+_LIBCPP_END_NAMESPACE_EXPERIMENTAL_COROUTINES
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp>
+struct hash<_VSTD_CORO::coroutine_handle<_Tp> > {
+    using __arg_type = _VSTD_CORO::coroutine_handle<_Tp>;
+    _LIBCPP_INLINE_VISIBILITY
+    size_t operator()(__arg_type const& __v) const _NOEXCEPT
+    {return hash<void*>()(__v.address());}
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // !defined(_LIBCPP_HAS_NO_COROUTINES)
+
+#endif /* _LIBCPP_EXPERIMENTAL_COROUTINE */

Modified: vendor/libc++/dist/include/iterator
==============================================================================
--- vendor/libc++/dist/include/iterator	Mon May 29 16:26:06 2017	(r319145)
+++ vendor/libc++/dist/include/iterator	Mon May 29 16:26:10 2017	(r319146)
@@ -990,7 +990,6 @@ public:
 
     _LIBCPP_INLINE_VISIBILITY char_type  operator*() const
         {return static_cast<char_type>(__sbuf_->sgetc());}
-    _LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;}
     _LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++()
         {
             __sbuf_->sbumpc();

Modified: vendor/libc++/dist/include/memory
==============================================================================
--- vendor/libc++/dist/include/memory	Mon May 29 16:26:06 2017	(r319145)
+++ vendor/libc++/dist/include/memory	Mon May 29 16:26:10 2017	(r319146)
@@ -2251,6 +2251,8 @@ void swap(__compressed_pair<_T1, _T2>& _
 
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS default_delete {
+    static_assert(!is_function<_Tp>::value,
+                  "default_delete cannot be instantiated for function types");
 #ifndef _LIBCPP_CXX03_LANG
   _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default;
 #else
@@ -3653,6 +3655,18 @@ __shared_ptr_emplace<_Tp, _Alloc>::__on_
     __a.deallocate(_PTraits::pointer_to(*this), 1);
 }
 
+struct __shared_ptr_dummy_rebind_allocator_type;
+template <>
+class _LIBCPP_TEMPLATE_VIS allocator<__shared_ptr_dummy_rebind_allocator_type>
+{
+public:
+    template <class _Other>
+    struct rebind
+    {
+        typedef allocator<_Other> other;
+    };
+};
+
 template<class _Tp> class _LIBCPP_TEMPLATE_VIS enable_shared_from_this;
 
 template<class _Tp>
@@ -3921,6 +3935,17 @@ public:
 #endif  // _LIBCPP_HAS_NO_VARIADICS
 
 private:
+    template <class _Yp, bool = is_function<_Yp>::value>
+        struct __shared_ptr_default_allocator
+        {
+            typedef allocator<_Yp> type;
+        };
+
+    template <class _Yp>
+        struct __shared_ptr_default_allocator<_Yp, true>
+        {
+            typedef allocator<__shared_ptr_dummy_rebind_allocator_type> type;
+        };
 
     template <class _Yp, class _OrigPtr>
         _LIBCPP_INLINE_VISIBILITY
@@ -3939,8 +3964,7 @@ private:
             }
         }
 
-    _LIBCPP_INLINE_VISIBILITY
-    void __enable_weak_this(const volatile void*, const volatile void*) _NOEXCEPT {}
+    _LIBCPP_INLINE_VISIBILITY void __enable_weak_this(...) _NOEXCEPT {}
 
     template <class _Up> friend class _LIBCPP_TEMPLATE_VIS shared_ptr;
     template <class _Up> friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
@@ -3972,8 +3996,9 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p,
     : __ptr_(__p)
 {
     unique_ptr<_Yp> __hold(__p);
-    typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk;
-    __cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), allocator<_Yp>());
+    typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+    typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, _AllocT > _CntrlBlk;
+    __cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), _AllocT());
     __hold.release();
     __enable_weak_this(__p, __p);
 }
@@ -3988,8 +4013,9 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, _D
     try
     {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-        typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
-        __cntrl_ = new _CntrlBlk(__p, __d, allocator<_Yp>());
+        typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+        typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk;
+        __cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
         __enable_weak_this(__p, __p);
 #ifndef _LIBCPP_NO_EXCEPTIONS
     }
@@ -4010,8 +4036,9 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t __
     try
     {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-        typedef __shared_ptr_pointer<nullptr_t, _Dp, allocator<_Tp> > _CntrlBlk;
-        __cntrl_ = new _CntrlBlk(__p, __d, allocator<_Tp>());
+        typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT;
+        typedef __shared_ptr_pointer<nullptr_t, _Dp, _AllocT > _CntrlBlk;
+        __cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
 #ifndef _LIBCPP_NO_EXCEPTIONS
     }
     catch (...)
@@ -4179,8 +4206,9 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_
     else
 #endif
     {
-        typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
-        __cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), allocator<_Yp>());
+        typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+        typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk;
+        __cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), _AllocT());
         __enable_weak_this(__r.get(), __r.get());
     }
     __r.release();
@@ -4208,10 +4236,11 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_
     else
 #endif
     {
+        typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
         typedef __shared_ptr_pointer<_Yp*,
                                      reference_wrapper<typename remove_reference<_Dp>::type>,
-                                     allocator<_Yp> > _CntrlBlk;
-        __cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), allocator<_Yp>());
+                                     _AllocT > _CntrlBlk;
+        __cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), _AllocT());
         __enable_weak_this(__r.get(), __r.get());
     }
     __r.release();

Modified: vendor/libc++/dist/include/module.modulemap
==============================================================================
--- vendor/libc++/dist/include/module.modulemap	Mon May 29 16:26:06 2017	(r319145)
+++ vendor/libc++/dist/include/module.modulemap	Mon May 29 16:26:10 2017	(r319146)
@@ -501,6 +501,10 @@ module std [system] {
       header "experimental/chrono"
       export *
     }
+     module coroutine {
+      header "experimental/coroutine"
+      export *
+    }
     module deque {
       header "experimental/deque"
       export *

Modified: vendor/libc++/dist/lib/CMakeLists.txt
==============================================================================
--- vendor/libc++/dist/lib/CMakeLists.txt	Mon May 29 16:26:06 2017	(r319145)
+++ vendor/libc++/dist/lib/CMakeLists.txt	Mon May 29 16:26:10 2017	(r319146)
@@ -242,14 +242,11 @@ endif()
 if (LIBCXX_ENABLE_STATIC)
   add_library(cxx_static STATIC $<TARGET_OBJECTS:cxx_objects>)
   target_link_libraries(cxx_static ${LIBCXX_LIBRARIES})
-  set(STATIC_OUTPUT_NAME "c++")
-  if (WIN32)
-    set(STATIC_OUTPUT_NAME "libc++")
-  endif()
+  set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
   set_target_properties(cxx_static
     PROPERTIES
       LINK_FLAGS    "${LIBCXX_LINK_FLAGS}"
-      OUTPUT_NAME   "${STATIC_OUTPUT_NAME}"
+      OUTPUT_NAME   "c++"
   )
 
   list(APPEND LIBCXX_TARGETS "cxx_static")

Modified: vendor/libc++/dist/test/libcxx/double_include.sh.cpp
==============================================================================
--- vendor/libc++/dist/test/libcxx/double_include.sh.cpp	Mon May 29 16:26:06 2017	(r319145)
+++ vendor/libc++/dist/test/libcxx/double_include.sh.cpp	Mon May 29 16:26:10 2017	(r319146)
@@ -137,6 +137,9 @@
 #include <experimental/algorithm>
 #include <experimental/any>
 #include <experimental/chrono>
+#if defined(__cpp_coroutines)
+#include <experimental/coroutine>
+#endif
 #include <experimental/deque>
 #include <experimental/dynarray>
 #include <experimental/filesystem>

Added: vendor/libc++/dist/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/libc++/dist/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp	Mon May 29 16:26:10 2017	(r319146)
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: fcoroutines-ts
+
+// RUN: %build -fcoroutines-ts
+// RUN: %run
+
+// A simple "breathing" test that checks that <experimental/coroutine>
+// can be parsed and used in all dialects, including C++03 in order to match
+// Clang's behavior.
+
+#include <experimental/coroutine>
+
+namespace coro = std::experimental::coroutines_v1;
+
+coro::suspend_always sa;
+coro::suspend_never sn;
+
+struct MyFuture {
+  struct promise_type {
+    typedef coro::coroutine_handle<promise_type> HandleT;
+    coro::suspend_never initial_suspend() { return sn; }
+    coro::suspend_always final_suspend() { return sa; }
+    coro::suspend_never yield_value(int) { return sn; }
+    MyFuture get_return_object() {
+      MyFuture f(HandleT::from_promise(*this));
+      return f;
+    }
+    void return_void() {}
+    void unhandled_exception() {}
+  };
+  typedef promise_type::HandleT HandleT;
+  MyFuture() : p() {}
+  MyFuture(HandleT h) : p(h) {}
+
+  coro::coroutine_handle<promise_type> p;
+};
+
+MyFuture test_coro() {
+  co_await sn;
+  co_yield 42;
+  co_return;
+}
+
+int main()
+{
+  MyFuture f = test_coro();
+  while (!f.p.done())
+    f.p.resume();
+  f.p.destroy();
+}

Added: vendor/libc++/dist/test/libcxx/experimental/language.support/support.coroutines/version.sh.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/libc++/dist/test/libcxx/experimental/language.support/support.coroutines/version.sh.cpp	Mon May 29 16:26:10 2017	(r319146)
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// REQUIRES: fcoroutines-ts
+
+// RUN: %build -fcoroutines-ts
+// RUN: %run
+
+#include <experimental/coroutine>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION must be defined
+#endif
+
+int main()
+{
+}

Added: vendor/libc++/dist/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/libc++/dist/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp	Mon May 29 16:26:10 2017	(r319146)
@@ -0,0 +1,44 @@
+// UNSUPPORTED: c++98, c++03
+
+#include <memory>
+
+template <int> struct Tag {};
+
+template <int ID>
+using SPtr = std::shared_ptr<void(Tag<ID>)>;
+
+template <int ID>
+using FnType = void(Tag<ID>);
+
+template <int ID>
+void TestFn(Tag<ID>) {}
+
+template <int ID>
+FnType<ID>* getFn() {
+  return &TestFn<ID>;
+}
+
+struct Deleter {
+  template <class Tp>
+  void operator()(Tp) const {
+    using RawT = typename std::remove_pointer<Tp>::type;
+    static_assert(std::is_function<RawT>::value ||
+                  std::is_same<typename std::remove_cv<RawT>::type,
+                               std::nullptr_t>::value,
+                  "");
+  }
+};
+
+int main() {
+  {
+    SPtr<0> s; // OK
+    SPtr<1> s1(nullptr); // OK
+    SPtr<2> s2(getFn<2>(), Deleter{}); // OK
+    SPtr<3> s3(nullptr, Deleter{}); // OK
+  }
+  // expected-error at memory:* 2 {{static_assert failed "default_delete cannot be instantiated for function types"}}
+  {
+    SPtr<4> s4(getFn<4>()); // expected-note {{requested here}}
+    SPtr<5> s5(getFn<5>(), std::default_delete<FnType<5>>{}); // expected-note {{requested here}}
+  }
+}

Added: vendor/libc++/dist/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/libc++/dist/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp	Mon May 29 16:26:10 2017	(r319146)
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// template<class InputIterator, class Size, class Function>
+//    InputIterator for_each_n(InputIterator first, Size n, Function f);
+
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+struct for_each_test
+{
+    for_each_test(int c) : count(c) {}
+    int count;
+    void operator()(int& i) {++i; ++count;}
+};
+
+int main()
+{
+    typedef input_iterator<int*> Iter;
+    int ia[] = {0, 1, 2, 3, 4, 5};
+    const unsigned s = sizeof(ia)/sizeof(ia[0]);
+
+    {
+    auto f = for_each_test(0);
+    Iter it = std::for_each_n(Iter(ia), 0, std::ref(f));
+    assert(it == Iter(ia));
+    assert(f.count == 0);    
+    }
+
+    {
+    auto f = for_each_test(0);
+    Iter it = std::for_each_n(Iter(ia), s, std::ref(f));
+    
+    assert(it == Iter(ia+s));
+    assert(f.count == s);    
+    for (unsigned i = 0; i < s; ++i)
+        assert(ia[i] == static_cast<int>(i+1));
+    }
+
+    {
+    auto f = for_each_test(0);
+    Iter it = std::for_each_n(Iter(ia), 1, std::ref(f));
+    
+    assert(it == Iter(ia+1));
+    assert(f.count == 1);    
+    for (unsigned i = 0; i < 1; ++i)
+        assert(ia[i] == static_cast<int>(i+2));
+    }
+}

Added: vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.sh.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.sh.cpp	Mon May 29 16:26:10 2017	(r319146)
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// REQUIRES: fcoroutines-ts
+
+// RUN: %build -fcoroutines-ts
+// RUN: %run
+
+// <experimental/coroutine>
+
+// template <class Promise = void>
+// struct coroutine_handle;
+
+// constexpr explicit operator bool() const noexcept
+
+#include <experimental/coroutine>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+namespace coro = std::experimental;
+
+template <class C>
+void do_test() {
+  static_assert(std::is_nothrow_constructible<bool, C>::value, "");
+  static_assert(!std::is_convertible<C, bool>::value, "");
+  {
+    constexpr C c; ((void)c);
+    static_assert(bool(c) == false, "");
+  }
+  { // null case
+    const C c = {}; ((void)c);
+    ASSERT_NOEXCEPT(bool(c));
+    if (c)
+      assert(false);
+    else
+      assert(true);
+    assert(c.address() == nullptr);
+    assert(bool(c) == false);
+  }
+  { // non-null case
+    char dummy = 42;
+    C c = C::from_address((void*)&dummy);
+    assert(c.address() == &dummy);
+    assert(bool(c) == true);
+  }
+}
+
+int main()
+{
+  do_test<coro::coroutine_handle<>>();
+  do_test<coro::coroutine_handle<int>>();
+}

Added: vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/equal_comp.sh.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/equal_comp.sh.cpp	Mon May 29 16:26:10 2017	(r319146)
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// REQUIRES: fcoroutines-ts
+
+// RUN: %build -fcoroutines-ts
+// RUN: %run
+
+// <experimental/coroutine>
+
+// template <class Promise = void>
+// struct coroutine_handle;
+
+// bool operator==(coroutine_handle<>, coroutine_handle<>) noexcept
+// bool operator!=(coroutine_handle<>, coroutine_handle<>) noexcept
+
+#include <experimental/coroutine>
+#include <type_traits>
+#include <utility>
+#include <cstdint>
+#include <cassert>
+
+#include "test_macros.h"
+
+namespace coro = std::experimental;
+
+template <class C>
+void do_test(uintptr_t LHSVal, uintptr_t RHSVal) {
+  const C LHS = C::from_address(reinterpret_cast<void*>(LHSVal));
+  const C RHS = C::from_address(reinterpret_cast<void*>(RHSVal));
+  const bool ExpectIsEqual = (LHSVal == RHSVal);
+  assert((LHS == RHS) == ExpectIsEqual);
+  assert((RHS == LHS) == ExpectIsEqual);
+  assert((LHS != RHS) == !ExpectIsEqual);
+  assert((RHS != LHS) == !ExpectIsEqual);
+  {
+    static_assert(noexcept(LHS == RHS), "");
+    static_assert(noexcept(LHS != RHS), "");
+    ASSERT_SAME_TYPE(decltype(LHS == RHS), bool);
+    ASSERT_SAME_TYPE(decltype(LHS != RHS), bool);
+  }
+}
+
+int main()
+{
+  std::pair<uintptr_t, uintptr_t> const TestCases[] = {
+      {0, 0},
+      {16, 16},
+      {0, 16},
+      {16, 0}
+  };
+  for (auto& TC : TestCases) {
+    do_test<coro::coroutine_handle<>>(TC.first, TC.second);
+    do_test<coro::coroutine_handle<int>>(TC.first, TC.second);
+  }
+}

Added: vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/less_comp.sh.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/less_comp.sh.cpp	Mon May 29 16:26:10 2017	(r319146)
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// REQUIRES: fcoroutines-ts
+
+// RUN: %build -fcoroutines-ts
+// RUN: %run
+
+// <experimental/coroutine>
+
+// template <class Promise = void>
+// struct coroutine_handle;
+
+// bool operator<(coroutine_handle<>, coroutine_handle<>) noexcept
+// bool operator>(coroutine_handle<>, coroutine_handle<>) noexcept
+// bool operator>=(coroutine_handle<>, coroutine_handle<>) noexcept
+// bool operator<=(coroutine_handle<>, coroutine_handle<>) noexcept
+
+#include <experimental/coroutine>
+#include <type_traits>
+#include <utility>
+#include <cstdint>
+#include <cassert>
+
+#include "test_macros.h"
+
+namespace coro = std::experimental;
+
+template <class C>
+void do_test(uintptr_t LHSVal, uintptr_t RHSVal) {
+  const C LHS = C::from_address(reinterpret_cast<void*>(LHSVal));
+  const C RHS = C::from_address(reinterpret_cast<void*>(RHSVal));
+  assert((LHS < RHS) == (LHSVal < RHSVal));
+  assert((RHS < LHS) == (RHSVal < LHSVal));
+  assert((LHS > RHS) == (LHSVal > RHSVal));
+  assert((RHS > LHS) == (RHSVal > LHSVal));
+  assert((LHS <= RHS) == (LHSVal <= RHSVal));
+  assert((RHS <= LHS) == (RHSVal <= LHSVal));
+  assert((LHS >= RHS) == (LHSVal >= RHSVal));
+  assert((RHS >= LHS) == (RHSVal >= LHSVal));
+  {
+    static_assert(noexcept(LHS < RHS), "");
+    static_assert(noexcept(LHS > RHS), "");
+    static_assert(noexcept(LHS <= RHS), "");
+    static_assert(noexcept(LHS >= RHS), "");
+    ASSERT_SAME_TYPE(decltype(LHS < RHS), bool);
+    ASSERT_SAME_TYPE(decltype(LHS > RHS), bool);
+    ASSERT_SAME_TYPE(decltype(LHS <= RHS), bool);
+    ASSERT_SAME_TYPE(decltype(LHS >= RHS), bool);
+  }
+}
+
+int main()
+{
+  std::pair<uintptr_t, uintptr_t> const TestCases[] = {
+      {0, 0},
+      {16, 16},
+      {0, 16},
+      {16, 0}
+  };
+  for (auto& TC : TestCases) {
+    do_test<coro::coroutine_handle<>>(TC.first, TC.second);
+    do_test<coro::coroutine_handle<int>>(TC.first, TC.second);
+  }
+}

Added: vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.sh.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.sh.cpp	Mon May 29 16:26:10 2017	(r319146)
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// REQUIRES: fcoroutines-ts
+
+// RUN: %build -fcoroutines-ts
+// RUN: %run
+
+// <experimental/coroutine>
+
+// template <class Promise = void>
+// struct coroutine_handle;
+
+// bool done() const
+
+#include <experimental/coroutine>
+#include <type_traits>
+#include <memory>
+#include <utility>
+#include <cstdint>
+#include <cassert>

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list