Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jul 2017 19:25:57 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r320963 - in vendor/libc++/dist: . cmake/Modules docs include lib src src/experimental/filesystem src/include test test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons t...
Message-ID:  <201707131925.v6DJPvt7036688@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Thu Jul 13 19:25:57 2017
New Revision: 320963
URL: https://svnweb.freebsd.org/changeset/base/320963

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

Added:
  vendor/libc++/dist/src/experimental/filesystem/filesystem_time_helper.h   (contents, props changed)
  vendor/libc++/dist/src/include/refstring.h   (contents, props changed)
  vendor/libc++/dist/test/libcxx/experimental/filesystem/convert_file_time.sh.cpp   (contents, props changed)
  vendor/libc++/dist/test/libcxx/numerics/c.math/fdelayed-template-parsing.sh.cpp   (contents, props changed)
Deleted:
  vendor/libc++/dist/include/__refstring
  vendor/libc++/dist/test/libcxx/utilities/optional/optional.object/special_member_gen.pass.cpp
Modified:
  vendor/libc++/dist/CMakeLists.txt
  vendor/libc++/dist/cmake/Modules/HandleLibCXXABI.cmake
  vendor/libc++/dist/docs/BuildingLibcxx.rst
  vendor/libc++/dist/include/CMakeLists.txt
  vendor/libc++/dist/include/cmath
  vendor/libc++/dist/include/complex
  vendor/libc++/dist/include/optional
  vendor/libc++/dist/include/regex
  vendor/libc++/dist/include/string
  vendor/libc++/dist/lib/CMakeLists.txt
  vendor/libc++/dist/src/experimental/filesystem/operations.cpp
  vendor/libc++/dist/src/stdexcept.cpp
  vendor/libc++/dist/test/CMakeLists.txt
  vendor/libc++/dist/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp
  vendor/libc++/dist/test/libcxx/numerics/c.math/constexpr-fns.pass.cpp
  vendor/libc++/dist/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp
  vendor/libc++/dist/test/std/experimental/filesystem/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp
  vendor/libc++/dist/test/std/re/re.iter/re.regiter/re.regiter.incr/post.pass.cpp
  vendor/libc++/dist/test/std/thread/futures/futures.task/futures.task.members/ctor2.fail.cpp
  vendor/libc++/dist/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp
  vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.assign/move.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/optional/optional.object/special_member_gen.pass.cpp
  vendor/libc++/dist/utils/libcxx/test/config.py
  vendor/libc++/dist/utils/libcxx/test/target_info.py
  vendor/libc++/dist/www/upcoming_meeting.html

Modified: vendor/libc++/dist/CMakeLists.txt
==============================================================================
--- vendor/libc++/dist/CMakeLists.txt	Thu Jul 13 19:25:54 2017	(r320962)
+++ vendor/libc++/dist/CMakeLists.txt	Thu Jul 13 19:25:57 2017	(r320963)
@@ -352,6 +352,13 @@ else()
 endif()
 file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")
 
+set(LIBCXX_INSTALL_PREFIX "" CACHE STRING
+    "Define libc++ destination prefix.")
+
+if (NOT LIBCXX_INSTALL_PREFIX MATCHES "^$|.*/")
+  message(FATAL_ERROR "LIBCXX_INSTALL_PREFIX has to end with \"/\".")
+endif()
+
 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})

Modified: vendor/libc++/dist/cmake/Modules/HandleLibCXXABI.cmake
==============================================================================
--- vendor/libc++/dist/cmake/Modules/HandleLibCXXABI.cmake	Thu Jul 13 19:25:54 2017	(r320962)
+++ vendor/libc++/dist/cmake/Modules/HandleLibCXXABI.cmake	Thu Jul 13 19:25:57 2017	(r320963)
@@ -55,7 +55,7 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs
           )
         if (LIBCXX_INSTALL_HEADERS)
           install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
-            DESTINATION include/c++/v1/${dstdir}
+            DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1/${dstdir}
             COMPONENT libcxx
             PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
             )

Modified: vendor/libc++/dist/docs/BuildingLibcxx.rst
==============================================================================
--- vendor/libc++/dist/docs/BuildingLibcxx.rst	Thu Jul 13 19:25:54 2017	(r320962)
+++ vendor/libc++/dist/docs/BuildingLibcxx.rst	Thu Jul 13 19:25:57 2017	(r320963)
@@ -216,6 +216,11 @@ libc++ specific options
   Extra suffix to append to the directory where libraries are to be installed.
   This option overrides `LLVM_LIBDIR_SUFFIX`.
 
+.. option:: LIBCXX_INSTALL_PREFIX:STRING
+
+  **Default**: ``""``
+
+  Define libc++ destination prefix.
 
 .. _libc++experimental options:
 

Modified: vendor/libc++/dist/include/CMakeLists.txt
==============================================================================
--- vendor/libc++/dist/include/CMakeLists.txt	Thu Jul 13 19:25:54 2017	(r320962)
+++ vendor/libc++/dist/include/CMakeLists.txt	Thu Jul 13 19:25:57 2017	(r320963)
@@ -20,7 +20,7 @@ endif()
 
 if (LIBCXX_INSTALL_HEADERS)
   install(DIRECTORY .
-    DESTINATION include/c++/v1
+    DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1
     COMPONENT cxx-headers
     FILES_MATCHING
     ${LIBCXX_HEADER_PATTERN}
@@ -44,7 +44,7 @@ if (LIBCXX_INSTALL_HEADERS)
     set(generated_config_deps generate_config_header)
     # Install the generated header as __config.
     install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
-      DESTINATION include/c++/v1
+      DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1
       PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
       RENAME __config
       COMPONENT cxx-headers)

Modified: vendor/libc++/dist/include/cmath
==============================================================================
--- vendor/libc++/dist/include/cmath	Thu Jul 13 19:25:54 2017	(r320962)
+++ vendor/libc++/dist/include/cmath	Thu Jul 13 19:25:57 2017	(r320963)
@@ -549,7 +549,7 @@ hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXC
 template <class _A1>
 _LIBCPP_ALWAYS_INLINE
 _LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
-__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
+__libcpp_isnan_or_builtin(_A1 __lcpp_x) _NOEXCEPT
 {
 #if __has_builtin(__builtin_isnan)
     return __builtin_isnan(__lcpp_x);
@@ -561,7 +561,7 @@ __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
 template <class _A1>
 _LIBCPP_ALWAYS_INLINE
 _LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
-__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
+__libcpp_isnan_or_builtin(_A1 __lcpp_x) _NOEXCEPT
 {
     return isnan(__lcpp_x);
 }
@@ -569,7 +569,7 @@ __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
 template <class _A1>
 _LIBCPP_ALWAYS_INLINE
 _LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
-__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
+__libcpp_isinf_or_builtin(_A1 __lcpp_x) _NOEXCEPT
 {
 #if __has_builtin(__builtin_isinf)
     return __builtin_isinf(__lcpp_x);
@@ -581,7 +581,7 @@ __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
 template <class _A1>
 _LIBCPP_ALWAYS_INLINE
 _LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
-__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
+__libcpp_isinf_or_builtin(_A1 __lcpp_x) _NOEXCEPT
 {
     return isinf(__lcpp_x);
 }
@@ -589,7 +589,7 @@ __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
 template <class _A1>
 _LIBCPP_ALWAYS_INLINE
 _LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
-__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
+__libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT
 {
 #if __has_builtin(__builtin_isfinite)
     return __builtin_isfinite(__lcpp_x);
@@ -601,7 +601,7 @@ __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
 template <class _A1>
 _LIBCPP_ALWAYS_INLINE
 _LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
-__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
+__libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT
 {
     return isfinite(__lcpp_x);
 }

Modified: vendor/libc++/dist/include/complex
==============================================================================
--- vendor/libc++/dist/include/complex	Thu Jul 13 19:25:54 2017	(r320962)
+++ vendor/libc++/dist/include/complex	Thu Jul 13 19:25:57 2017	(r320963)
@@ -599,39 +599,39 @@ operator*(const complex<_Tp>& __z, const complex<_Tp>&
     _Tp __bc = __b * __c;
     _Tp __x = __ac - __bd;
     _Tp __y = __ad + __bc;
-    if (__libcpp_isnan(__x) && __libcpp_isnan(__y))
+    if (__libcpp_isnan_or_builtin(__x) && __libcpp_isnan_or_builtin(__y))
     {
         bool __recalc = false;
-        if (__libcpp_isinf(__a) || __libcpp_isinf(__b))
+        if (__libcpp_isinf_or_builtin(__a) || __libcpp_isinf_or_builtin(__b))
         {
-            __a = copysign(__libcpp_isinf(__a) ? _Tp(1) : _Tp(0), __a);
-            __b = copysign(__libcpp_isinf(__b) ? _Tp(1) : _Tp(0), __b);
-            if (__libcpp_isnan(__c))
+            __a = copysign(__libcpp_isinf_or_builtin(__a) ? _Tp(1) : _Tp(0), __a);
+            __b = copysign(__libcpp_isinf_or_builtin(__b) ? _Tp(1) : _Tp(0), __b);
+            if (__libcpp_isnan_or_builtin(__c))
                 __c = copysign(_Tp(0), __c);
-            if (__libcpp_isnan(__d))
+            if (__libcpp_isnan_or_builtin(__d))
                 __d = copysign(_Tp(0), __d);
             __recalc = true;
         }
-        if (__libcpp_isinf(__c) || __libcpp_isinf(__d))
+        if (__libcpp_isinf_or_builtin(__c) || __libcpp_isinf_or_builtin(__d))
         {
-            __c = copysign(__libcpp_isinf(__c) ? _Tp(1) : _Tp(0), __c);
-            __d = copysign(__libcpp_isinf(__d) ? _Tp(1) : _Tp(0), __d);
-            if (__libcpp_isnan(__a))
+            __c = copysign(__libcpp_isinf_or_builtin(__c) ? _Tp(1) : _Tp(0), __c);
+            __d = copysign(__libcpp_isinf_or_builtin(__d) ? _Tp(1) : _Tp(0), __d);
+            if (__libcpp_isnan_or_builtin(__a))
                 __a = copysign(_Tp(0), __a);
-            if (__libcpp_isnan(__b))
+            if (__libcpp_isnan_or_builtin(__b))
                 __b = copysign(_Tp(0), __b);
             __recalc = true;
         }
-        if (!__recalc && (__libcpp_isinf(__ac) || __libcpp_isinf(__bd) ||
-                          __libcpp_isinf(__ad) || __libcpp_isinf(__bc)))
+        if (!__recalc && (__libcpp_isinf_or_builtin(__ac) || __libcpp_isinf_or_builtin(__bd) ||
+                          __libcpp_isinf_or_builtin(__ad) || __libcpp_isinf_or_builtin(__bc)))
         {
-            if (__libcpp_isnan(__a))
+            if (__libcpp_isnan_or_builtin(__a))
                 __a = copysign(_Tp(0), __a);
-            if (__libcpp_isnan(__b))
+            if (__libcpp_isnan_or_builtin(__b))
                 __b = copysign(_Tp(0), __b);
-            if (__libcpp_isnan(__c))
+            if (__libcpp_isnan_or_builtin(__c))
                 __c = copysign(_Tp(0), __c);
-            if (__libcpp_isnan(__d))
+            if (__libcpp_isnan_or_builtin(__d))
                 __d = copysign(_Tp(0), __d);
             __recalc = true;
         }
@@ -674,7 +674,7 @@ operator/(const complex<_Tp>& __z, const complex<_Tp>&
     _Tp __c = __w.real();
     _Tp __d = __w.imag();
     _Tp __logbw = logb(fmax(fabs(__c), fabs(__d)));
-    if (__libcpp_isfinite(__logbw))
+    if (__libcpp_isfinite_or_builtin(__logbw))
     {
         __ilogbw = static_cast<int>(__logbw);
         __c = scalbn(__c, -__ilogbw);
@@ -683,24 +683,24 @@ operator/(const complex<_Tp>& __z, const complex<_Tp>&
     _Tp __denom = __c * __c + __d * __d;
     _Tp __x = scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
     _Tp __y = scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
-    if (__libcpp_isnan(__x) && __libcpp_isnan(__y))
+    if (__libcpp_isnan_or_builtin(__x) && __libcpp_isnan_or_builtin(__y))
     {
-        if ((__denom == _Tp(0)) && (!__libcpp_isnan(__a) || !__libcpp_isnan(__b)))
+        if ((__denom == _Tp(0)) && (!__libcpp_isnan_or_builtin(__a) || !__libcpp_isnan_or_builtin(__b)))
         {
             __x = copysign(_Tp(INFINITY), __c) * __a;
             __y = copysign(_Tp(INFINITY), __c) * __b;
         }
-        else if ((__libcpp_isinf(__a) || __libcpp_isinf(__b)) && __libcpp_isfinite(__c) && __libcpp_isfinite(__d))
+        else if ((__libcpp_isinf_or_builtin(__a) || __libcpp_isinf_or_builtin(__b)) && __libcpp_isfinite_or_builtin(__c) && __libcpp_isfinite_or_builtin(__d))
         {
-            __a = copysign(__libcpp_isinf(__a) ? _Tp(1) : _Tp(0), __a);
-            __b = copysign(__libcpp_isinf(__b) ? _Tp(1) : _Tp(0), __b);
+            __a = copysign(__libcpp_isinf_or_builtin(__a) ? _Tp(1) : _Tp(0), __a);
+            __b = copysign(__libcpp_isinf_or_builtin(__b) ? _Tp(1) : _Tp(0), __b);
             __x = _Tp(INFINITY) * (__a * __c + __b * __d);
             __y = _Tp(INFINITY) * (__b * __c - __a * __d);
         }
-        else if (__libcpp_isinf(__logbw) && __logbw > _Tp(0) && __libcpp_isfinite(__a) && __libcpp_isfinite(__b))
+        else if (__libcpp_isinf_or_builtin(__logbw) && __logbw > _Tp(0) && __libcpp_isfinite_or_builtin(__a) && __libcpp_isfinite_or_builtin(__b))
         {
-            __c = copysign(__libcpp_isinf(__c) ? _Tp(1) : _Tp(0), __c);
-            __d = copysign(__libcpp_isinf(__d) ? _Tp(1) : _Tp(0), __d);
+            __c = copysign(__libcpp_isinf_or_builtin(__c) ? _Tp(1) : _Tp(0), __c);
+            __d = copysign(__libcpp_isinf_or_builtin(__d) ? _Tp(1) : _Tp(0), __d);
             __x = _Tp(0) * (__a * __c + __b * __d);
             __y = _Tp(0) * (__b * __c - __a * __d);
         }
@@ -910,9 +910,9 @@ inline _LIBCPP_INLINE_VISIBILITY
 _Tp
 norm(const complex<_Tp>& __c)
 {
-    if (__libcpp_isinf(__c.real()))
+    if (__libcpp_isinf_or_builtin(__c.real()))
         return abs(__c.real());
-    if (__libcpp_isinf(__c.imag()))
+    if (__libcpp_isinf_or_builtin(__c.imag()))
         return abs(__c.imag());
     return __c.real() * __c.real() + __c.imag() * __c.imag();
 }
@@ -955,7 +955,7 @@ complex<_Tp>
 proj(const complex<_Tp>& __c)
 {
     std::complex<_Tp> __r = __c;
-    if (__libcpp_isinf(__c.real()) || __libcpp_isinf(__c.imag()))
+    if (__libcpp_isinf_or_builtin(__c.real()) || __libcpp_isinf_or_builtin(__c.imag()))
         __r = complex<_Tp>(INFINITY, copysign(_Tp(0), __c.imag()));
     return __r;
 }
@@ -969,7 +969,7 @@ typename enable_if
 >::type
 proj(_Tp __re)
 {
-    if (__libcpp_isinf(__re))
+    if (__libcpp_isinf_or_builtin(__re))
         __re = abs(__re);
     return complex<_Tp>(__re);
 }
@@ -993,25 +993,25 @@ template<class _Tp>
 complex<_Tp>
 polar(const _Tp& __rho, const _Tp& __theta = _Tp(0))
 {
-    if (__libcpp_isnan(__rho) || signbit(__rho))
+    if (__libcpp_isnan_or_builtin(__rho) || signbit(__rho))
         return complex<_Tp>(_Tp(NAN), _Tp(NAN));
-    if (__libcpp_isnan(__theta))
+    if (__libcpp_isnan_or_builtin(__theta))
     {
-        if (__libcpp_isinf(__rho))
+        if (__libcpp_isinf_or_builtin(__rho))
             return complex<_Tp>(__rho, __theta);
         return complex<_Tp>(__theta, __theta);
     }
-    if (__libcpp_isinf(__theta))
+    if (__libcpp_isinf_or_builtin(__theta))
     {
-        if (__libcpp_isinf(__rho))
+        if (__libcpp_isinf_or_builtin(__rho))
             return complex<_Tp>(__rho, _Tp(NAN));
         return complex<_Tp>(_Tp(NAN), _Tp(NAN));
     }
     _Tp __x = __rho * cos(__theta);
-    if (__libcpp_isnan(__x))
+    if (__libcpp_isnan_or_builtin(__x))
         __x = 0;
     _Tp __y = __rho * sin(__theta);
-    if (__libcpp_isnan(__y))
+    if (__libcpp_isnan_or_builtin(__y))
         __y = 0;
     return complex<_Tp>(__x, __y);
 }
@@ -1042,13 +1042,13 @@ template<class _Tp>
 complex<_Tp>
 sqrt(const complex<_Tp>& __x)
 {
-    if (__libcpp_isinf(__x.imag()))
+    if (__libcpp_isinf_or_builtin(__x.imag()))
         return complex<_Tp>(_Tp(INFINITY), __x.imag());
-    if (__libcpp_isinf(__x.real()))
+    if (__libcpp_isinf_or_builtin(__x.real()))
     {
         if (__x.real() > _Tp(0))
-            return complex<_Tp>(__x.real(), __libcpp_isnan(__x.imag()) ? __x.imag() : copysign(_Tp(0), __x.imag()));
-        return complex<_Tp>(__libcpp_isnan(__x.imag()) ? __x.imag() : _Tp(0), copysign(__x.real(), __x.imag()));
+            return complex<_Tp>(__x.real(), __libcpp_isnan_or_builtin(__x.imag()) ? __x.imag() : copysign(_Tp(0), __x.imag()));
+        return complex<_Tp>(__libcpp_isnan_or_builtin(__x.imag()) ? __x.imag() : _Tp(0), copysign(__x.real(), __x.imag()));
     }
     return polar(sqrt(abs(__x)), arg(__x) / _Tp(2));
 }
@@ -1060,21 +1060,21 @@ complex<_Tp>
 exp(const complex<_Tp>& __x)
 {
     _Tp __i = __x.imag();
-    if (__libcpp_isinf(__x.real()))
+    if (__libcpp_isinf_or_builtin(__x.real()))
     {
         if (__x.real() < _Tp(0))
         {
-            if (!__libcpp_isfinite(__i))
+            if (!__libcpp_isfinite_or_builtin(__i))
                 __i = _Tp(1);
         }
-        else if (__i == 0 || !__libcpp_isfinite(__i))
+        else if (__i == 0 || !__libcpp_isfinite_or_builtin(__i))
         {
-            if (__libcpp_isinf(__i))
+            if (__libcpp_isinf_or_builtin(__i))
                 __i = _Tp(NAN);
             return complex<_Tp>(__x.real(), __i);
         }
     }
-    else if (__libcpp_isnan(__x.real()) && __x.imag() == 0)
+    else if (__libcpp_isnan_or_builtin(__x.real()) && __x.imag() == 0)
         return __x;
     _Tp __e = exp(__x.real());
     return complex<_Tp>(__e * cos(__i), __e * sin(__i));
@@ -1132,23 +1132,23 @@ complex<_Tp>
 asinh(const complex<_Tp>& __x)
 {
     const _Tp __pi(atan2(+0., -0.));
-    if (__libcpp_isinf(__x.real()))
+    if (__libcpp_isinf_or_builtin(__x.real()))
     {
-        if (__libcpp_isnan(__x.imag()))
+        if (__libcpp_isnan_or_builtin(__x.imag()))
             return __x;
-        if (__libcpp_isinf(__x.imag()))
+        if (__libcpp_isinf_or_builtin(__x.imag()))
             return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
         return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
     }
-    if (__libcpp_isnan(__x.real()))
+    if (__libcpp_isnan_or_builtin(__x.real()))
     {
-        if (__libcpp_isinf(__x.imag()))
+        if (__libcpp_isinf_or_builtin(__x.imag()))
             return complex<_Tp>(__x.imag(), __x.real());
         if (__x.imag() == 0)
             return __x;
         return complex<_Tp>(__x.real(), __x.real());
     }
-    if (__libcpp_isinf(__x.imag()))
+    if (__libcpp_isinf_or_builtin(__x.imag()))
         return complex<_Tp>(copysign(__x.imag(), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
     complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) + _Tp(1)));
     return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag()));
@@ -1161,11 +1161,11 @@ complex<_Tp>
 acosh(const complex<_Tp>& __x)
 {
     const _Tp __pi(atan2(+0., -0.));
-    if (__libcpp_isinf(__x.real()))
+    if (__libcpp_isinf_or_builtin(__x.real()))
     {
-        if (__libcpp_isnan(__x.imag()))
+        if (__libcpp_isnan_or_builtin(__x.imag()))
             return complex<_Tp>(abs(__x.real()), __x.imag());
-        if (__libcpp_isinf(__x.imag()))
+        if (__libcpp_isinf_or_builtin(__x.imag()))
         {
             if (__x.real() > 0)
                 return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
@@ -1176,13 +1176,13 @@ acosh(const complex<_Tp>& __x)
             return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
         return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
     }
-    if (__libcpp_isnan(__x.real()))
+    if (__libcpp_isnan_or_builtin(__x.real()))
     {
-        if (__libcpp_isinf(__x.imag()))
+        if (__libcpp_isinf_or_builtin(__x.imag()))
             return complex<_Tp>(abs(__x.imag()), __x.real());
         return complex<_Tp>(__x.real(), __x.real());
     }
-    if (__libcpp_isinf(__x.imag()))
+    if (__libcpp_isinf_or_builtin(__x.imag()))
         return complex<_Tp>(abs(__x.imag()), copysign(__pi/_Tp(2), __x.imag()));
     complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) - _Tp(1)));
     return complex<_Tp>(copysign(__z.real(), _Tp(0)), copysign(__z.imag(), __x.imag()));
@@ -1195,21 +1195,21 @@ complex<_Tp>
 atanh(const complex<_Tp>& __x)
 {
     const _Tp __pi(atan2(+0., -0.));
-    if (__libcpp_isinf(__x.imag()))
+    if (__libcpp_isinf_or_builtin(__x.imag()))
     {
         return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
     }
-    if (__libcpp_isnan(__x.imag()))
+    if (__libcpp_isnan_or_builtin(__x.imag()))
     {
-        if (__libcpp_isinf(__x.real()) || __x.real() == 0)
+        if (__libcpp_isinf_or_builtin(__x.real()) || __x.real() == 0)
             return complex<_Tp>(copysign(_Tp(0), __x.real()), __x.imag());
         return complex<_Tp>(__x.imag(), __x.imag());
     }
-    if (__libcpp_isnan(__x.real()))
+    if (__libcpp_isnan_or_builtin(__x.real()))
     {
         return complex<_Tp>(__x.real(), __x.real());
     }
-    if (__libcpp_isinf(__x.real()))
+    if (__libcpp_isinf_or_builtin(__x.real()))
     {
         return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
     }
@@ -1227,11 +1227,11 @@ template<class _Tp>
 complex<_Tp>
 sinh(const complex<_Tp>& __x)
 {
-    if (__libcpp_isinf(__x.real()) && !__libcpp_isfinite(__x.imag()))
+    if (__libcpp_isinf_or_builtin(__x.real()) && !__libcpp_isfinite_or_builtin(__x.imag()))
         return complex<_Tp>(__x.real(), _Tp(NAN));
-    if (__x.real() == 0 && !__libcpp_isfinite(__x.imag()))
+    if (__x.real() == 0 && !__libcpp_isfinite_or_builtin(__x.imag()))
         return complex<_Tp>(__x.real(), _Tp(NAN));
-    if (__x.imag() == 0 && !__libcpp_isfinite(__x.real()))
+    if (__x.imag() == 0 && !__libcpp_isfinite_or_builtin(__x.real()))
         return __x;
     return complex<_Tp>(sinh(__x.real()) * cos(__x.imag()), cosh(__x.real()) * sin(__x.imag()));
 }
@@ -1242,13 +1242,13 @@ template<class _Tp>
 complex<_Tp>
 cosh(const complex<_Tp>& __x)
 {
-    if (__libcpp_isinf(__x.real()) && !__libcpp_isfinite(__x.imag()))
+    if (__libcpp_isinf_or_builtin(__x.real()) && !__libcpp_isfinite_or_builtin(__x.imag()))
         return complex<_Tp>(abs(__x.real()), _Tp(NAN));
-    if (__x.real() == 0 && !__libcpp_isfinite(__x.imag()))
+    if (__x.real() == 0 && !__libcpp_isfinite_or_builtin(__x.imag()))
         return complex<_Tp>(_Tp(NAN), __x.real());
     if (__x.real() == 0 && __x.imag() == 0)
         return complex<_Tp>(_Tp(1), __x.imag());
-    if (__x.imag() == 0 && !__libcpp_isfinite(__x.real()))
+    if (__x.imag() == 0 && !__libcpp_isfinite_or_builtin(__x.real()))
         return complex<_Tp>(abs(__x.real()), __x.imag());
     return complex<_Tp>(cosh(__x.real()) * cos(__x.imag()), sinh(__x.real()) * sin(__x.imag()));
 }
@@ -1259,19 +1259,19 @@ template<class _Tp>
 complex<_Tp>
 tanh(const complex<_Tp>& __x)
 {
-    if (__libcpp_isinf(__x.real()))
+    if (__libcpp_isinf_or_builtin(__x.real()))
     {
-        if (!__libcpp_isfinite(__x.imag()))
+        if (!__libcpp_isfinite_or_builtin(__x.imag()))
             return complex<_Tp>(_Tp(1), _Tp(0));
         return complex<_Tp>(_Tp(1), copysign(_Tp(0), sin(_Tp(2) * __x.imag())));
     }
-    if (__libcpp_isnan(__x.real()) && __x.imag() == 0)
+    if (__libcpp_isnan_or_builtin(__x.real()) && __x.imag() == 0)
         return __x;
     _Tp __2r(_Tp(2) * __x.real());
     _Tp __2i(_Tp(2) * __x.imag());
     _Tp __d(cosh(__2r) + cos(__2i));
     _Tp __2rsh(sinh(__2r));
-    if (__libcpp_isinf(__2rsh) && __libcpp_isinf(__d))
+    if (__libcpp_isinf_or_builtin(__2rsh) && __libcpp_isinf_or_builtin(__d))
         return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
                             __2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
     return  complex<_Tp>(__2rsh/__d, sin(__2i)/__d);
@@ -1294,11 +1294,11 @@ complex<_Tp>
 acos(const complex<_Tp>& __x)
 {
     const _Tp __pi(atan2(+0., -0.));
-    if (__libcpp_isinf(__x.real()))
+    if (__libcpp_isinf_or_builtin(__x.real()))
     {
-        if (__libcpp_isnan(__x.imag()))
+        if (__libcpp_isnan_or_builtin(__x.imag()))
             return complex<_Tp>(__x.imag(), __x.real());
-        if (__libcpp_isinf(__x.imag()))
+        if (__libcpp_isinf_or_builtin(__x.imag()))
         {
             if (__x.real() < _Tp(0))
                 return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag());
@@ -1308,13 +1308,13 @@ acos(const complex<_Tp>& __x)
             return complex<_Tp>(__pi, signbit(__x.imag()) ? -__x.real() : __x.real());
         return complex<_Tp>(_Tp(0), signbit(__x.imag()) ? __x.real() : -__x.real());
     }
-    if (__libcpp_isnan(__x.real()))
+    if (__libcpp_isnan_or_builtin(__x.real()))
     {
-        if (__libcpp_isinf(__x.imag()))
+        if (__libcpp_isinf_or_builtin(__x.imag()))
             return complex<_Tp>(__x.real(), -__x.imag());
         return complex<_Tp>(__x.real(), __x.real());
     }
-    if (__libcpp_isinf(__x.imag()))
+    if (__libcpp_isinf_or_builtin(__x.imag()))
         return complex<_Tp>(__pi/_Tp(2), -__x.imag());
     if (__x.real() == 0 && (__x.imag() == 0 || isnan(__x.imag())))
         return complex<_Tp>(__pi/_Tp(2), -__x.imag());

Modified: vendor/libc++/dist/include/optional
==============================================================================
--- vendor/libc++/dist/include/optional	Thu Jul 13 19:25:54 2017	(r320962)
+++ vendor/libc++/dist/include/optional	Thu Jul 13 19:25:57 2017	(r320963)
@@ -439,46 +439,122 @@ struct __optional_storage_base<_Tp, true>
     }
 };
 
-template <class _Tp, bool = is_trivially_copyable<_Tp>::value>
-struct __optional_storage;
-
-template <class _Tp>
-struct __optional_storage<_Tp, true> : __optional_storage_base<_Tp>
+template <class _Tp, bool = is_trivially_copy_constructible<_Tp>::value>
+struct __optional_copy_base : __optional_storage_base<_Tp>
 {
     using __optional_storage_base<_Tp>::__optional_storage_base;
 };
 
 template <class _Tp>
-struct __optional_storage<_Tp, false> : __optional_storage_base<_Tp>
+struct __optional_copy_base<_Tp, false> : __optional_storage_base<_Tp>
 {
-    using value_type = _Tp;
     using __optional_storage_base<_Tp>::__optional_storage_base;
 
     _LIBCPP_INLINE_VISIBILITY
-    __optional_storage() = default;
+    __optional_copy_base() = default;
 
     _LIBCPP_INLINE_VISIBILITY
-    __optional_storage(const __optional_storage& __opt)
+    __optional_copy_base(const __optional_copy_base& __opt)
     {
         this->__construct_from(__opt);
     }
 
     _LIBCPP_INLINE_VISIBILITY
-    __optional_storage(__optional_storage&& __opt)
+    __optional_copy_base(__optional_copy_base&&) = default;
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_copy_base& operator=(const __optional_copy_base&) = default;
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_copy_base& operator=(__optional_copy_base&&) = default;
+};
+
+template <class _Tp, bool = is_trivially_move_constructible<_Tp>::value>
+struct __optional_move_base : __optional_copy_base<_Tp>
+{
+    using __optional_copy_base<_Tp>::__optional_copy_base;
+};
+
+template <class _Tp>
+struct __optional_move_base<_Tp, false> : __optional_copy_base<_Tp>
+{
+    using value_type = _Tp;
+    using __optional_copy_base<_Tp>::__optional_copy_base;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_move_base() = default;
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_move_base(const __optional_move_base&) = default;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_move_base(__optional_move_base&& __opt)
         noexcept(is_nothrow_move_constructible_v<value_type>)
     {
         this->__construct_from(_VSTD::move(__opt));
     }
 
     _LIBCPP_INLINE_VISIBILITY
-    __optional_storage& operator=(const __optional_storage& __opt)
+    __optional_move_base& operator=(const __optional_move_base&) = default;
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_move_base& operator=(__optional_move_base&&) = default;
+};
+
+template <class _Tp, bool =
+    is_trivially_destructible<_Tp>::value &&
+    is_trivially_copy_constructible<_Tp>::value &&
+    is_trivially_copy_assignable<_Tp>::value>
+struct __optional_copy_assign_base : __optional_move_base<_Tp>
+{
+    using __optional_move_base<_Tp>::__optional_move_base;
+};
+
+template <class _Tp>
+struct __optional_copy_assign_base<_Tp, false> : __optional_move_base<_Tp>
+{
+    using __optional_move_base<_Tp>::__optional_move_base;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_copy_assign_base() = default;
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_copy_assign_base(const __optional_copy_assign_base&) = default;
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_copy_assign_base(__optional_copy_assign_base&&) = default;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_copy_assign_base& operator=(const __optional_copy_assign_base& __opt)
     {
         this->__assign_from(__opt);
         return *this;
     }
 
     _LIBCPP_INLINE_VISIBILITY
-    __optional_storage& operator=(__optional_storage&& __opt)
+    __optional_copy_assign_base& operator=(__optional_copy_assign_base&&) = default;
+};
+
+template <class _Tp, bool =
+    is_trivially_destructible<_Tp>::value &&
+    is_trivially_move_constructible<_Tp>::value &&
+    is_trivially_move_assignable<_Tp>::value>
+struct __optional_move_assign_base : __optional_copy_assign_base<_Tp>
+{
+    using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
+};
+
+template <class _Tp>
+struct __optional_move_assign_base<_Tp, false> : __optional_copy_assign_base<_Tp>
+{
+    using value_type = _Tp;
+    using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_move_assign_base() = default;
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_move_assign_base(const __optional_move_assign_base& __opt) = default;
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_move_assign_base(__optional_move_assign_base&&) = default;
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_move_assign_base& operator=(const __optional_move_assign_base&) = default;
+
+    _LIBCPP_INLINE_VISIBILITY
+    __optional_move_assign_base& operator=(__optional_move_assign_base&& __opt)
         noexcept(is_nothrow_move_assignable_v<value_type> &&
                  is_nothrow_move_constructible_v<value_type>)
     {
@@ -501,11 +577,11 @@ using __optional_sfinae_assign_base_t = __sfinae_assig
 
 template <class _Tp>
 class optional
-    : private __optional_storage<_Tp>
+    : private __optional_move_assign_base<_Tp>
     , private __optional_sfinae_ctor_base_t<_Tp>
     , private __optional_sfinae_assign_base_t<_Tp>
 {
-    using __base = __optional_storage<_Tp>;
+    using __base = __optional_move_assign_base<_Tp>;
 public:
     using value_type = _Tp;
 

Modified: vendor/libc++/dist/include/regex
==============================================================================
--- vendor/libc++/dist/include/regex	Thu Jul 13 19:25:54 2017	(r320962)
+++ vendor/libc++/dist/include/regex	Thu Jul 13 19:25:57 2017	(r320963)
@@ -6142,7 +6142,7 @@ regex_iterator<_BidirectionalIterator, _CharT, _Traits
 {
     __flags_ |= regex_constants::__no_update_pos;
     _BidirectionalIterator __start = __match_[0].second;
-    if (__match_.empty())
+    if (__match_[0].first == __match_[0].second)
     {
         if (__start == __end_)
         {

Modified: vendor/libc++/dist/include/string
==============================================================================
--- vendor/libc++/dist/include/string	Thu Jul 13 19:25:54 2017	(r320962)
+++ vendor/libc++/dist/include/string	Thu Jul 13 19:25:57 2017	(r320963)
@@ -676,11 +676,11 @@ class _LIBCPP_TEMPLATE_VIS basic_string (private)
     };
 
 #if _LIBCPP_BIG_ENDIAN
-    enum {__short_mask = 0x01};
-    enum {__long_mask  = 0x1ul};
+    static const size_type __short_mask = 0x01;
+    static const size_type __long_mask  = 0x1ul;
 #else  // _LIBCPP_BIG_ENDIAN
-    enum {__short_mask = 0x80};
-    enum {__long_mask  = ~(size_type(~0) >> 1)};
+    static const size_type __short_mask = 0x80;
+    static const size_type __long_mask  = ~(size_type(~0) >> 1);
 #endif  // _LIBCPP_BIG_ENDIAN
 
     enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
@@ -706,11 +706,11 @@ class _LIBCPP_TEMPLATE_VIS basic_string (private)
     };
 
 #if _LIBCPP_BIG_ENDIAN
-    enum {__short_mask = 0x80};
-    enum {__long_mask  = ~(size_type(~0) >> 1)};
+    static const size_type __short_mask = 0x80;
+    static const size_type __long_mask  = ~(size_type(~0) >> 1);
 #else  // _LIBCPP_BIG_ENDIAN
-    enum {__short_mask = 0x01};
-    enum {__long_mask  = 0x1ul};
+    static const size_type __short_mask = 0x01;
+    static const size_type __long_mask  = 0x1ul;
 #endif  // _LIBCPP_BIG_ENDIAN
 
     enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?

Modified: vendor/libc++/dist/lib/CMakeLists.txt
==============================================================================
--- vendor/libc++/dist/lib/CMakeLists.txt	Thu Jul 13 19:25:54 2017	(r320962)
+++ vendor/libc++/dist/lib/CMakeLists.txt	Thu Jul 13 19:25:57 2017	(r320963)
@@ -355,8 +355,8 @@ if (LIBCXX_INSTALL_LIBRARY)
     set(experimental_lib cxx_experimental)
   endif()
   install(TARGETS ${LIBCXX_TARGETS} ${experimental_lib}
-    LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
-    ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
+    LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
+    ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
     )
   # NOTE: This install command must go after the cxx install command otherwise
   # it will not be executed after the library symlinks are installed.
@@ -364,7 +364,7 @@ if (LIBCXX_INSTALL_LIBRARY)
     # Replace the libc++ filename with $<TARGET_LINKER_FILE:cxx>
     # after we required CMake 3.0.
     install(FILES "${LIBCXX_LIBRARY_DIR}/libc++${CMAKE_SHARED_LIBRARY_SUFFIX}"
-      DESTINATION lib${LIBCXX_LIBDIR_SUFFIX}
+      DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX}
       COMPONENT libcxx)
   endif()
 endif()

Added: vendor/libc++/dist/src/experimental/filesystem/filesystem_time_helper.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/libc++/dist/src/experimental/filesystem/filesystem_time_helper.h	Thu Jul 13 19:25:57 2017	(r320963)
@@ -0,0 +1,173 @@
+//===----------------------------------------------------------------------===////
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===////
+
+#ifndef FILESYSTEM_TIME_HELPER_H
+#define FILESYSTEM_TIME_HELPER_H
+
+#include "experimental/__config"
+#include "chrono"
+#include "cstdlib"
+#include "climits"
+
+#include <unistd.h>
+#include <sys/stat.h>
+#if !defined(UTIME_OMIT)
+#include <sys/time.h> // for ::utimes as used in __last_write_time
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM
+
+namespace time_detail { namespace {
+
+using namespace chrono;
+
+template <class FileTimeT,
+          bool IsFloat = is_floating_point<typename FileTimeT::rep>::value>
+struct fs_time_util_base {
+  static constexpr auto max_seconds =
+      duration_cast<seconds>(FileTimeT::duration::max()).count();
+
+  static constexpr auto max_nsec =
+      duration_cast<nanoseconds>(FileTimeT::duration::max() -
+                                 seconds(max_seconds))
+          .count();
+
+  static constexpr auto min_seconds =
+      duration_cast<seconds>(FileTimeT::duration::min()).count();
+
+  static constexpr auto min_nsec_timespec =
+      duration_cast<nanoseconds>(
+          (FileTimeT::duration::min() - seconds(min_seconds)) + seconds(1))
+          .count();
+
+  // Static assert that these values properly round trip.
+  static_assert((seconds(min_seconds) +
+                 duration_cast<microseconds>(nanoseconds(min_nsec_timespec))) -
+                        duration_cast<microseconds>(seconds(1)) ==
+                    FileTimeT::duration::min(),
+                "");
+};
+
+template <class FileTimeT>
+struct fs_time_util_base<FileTimeT, true> {
+  static const long long max_seconds;
+  static const long long max_nsec;
+  static const long long min_seconds;
+  static const long long min_nsec_timespec;
+};
+
+template <class FileTimeT>
+const long long fs_time_util_base<FileTimeT, true>::max_seconds =
+    duration_cast<seconds>(FileTimeT::duration::max()).count();
+
+template <class FileTimeT>
+const long long fs_time_util_base<FileTimeT, true>::max_nsec =
+    duration_cast<nanoseconds>(FileTimeT::duration::max() -
+                               seconds(max_seconds))
+        .count();
+
+template <class FileTimeT>
+const long long fs_time_util_base<FileTimeT, true>::min_seconds =
+    duration_cast<seconds>(FileTimeT::duration::min()).count();
+
+template <class FileTimeT>
+const long long fs_time_util_base<FileTimeT, true>::min_nsec_timespec =
+    duration_cast<nanoseconds>((FileTimeT::duration::min() -
+                                seconds(min_seconds)) +
+                               seconds(1))
+        .count();
+
+template <class FileTimeT, class TimeT, class TimeSpecT>
+struct fs_time_util : fs_time_util_base<FileTimeT> {
+  using Base = fs_time_util_base<FileTimeT>;
+  using Base::max_nsec;
+  using Base::max_seconds;
+  using Base::min_nsec_timespec;
+  using Base::min_seconds;
+
+public:
+  template <class CType, class ChronoType>
+  static bool checked_set(CType* out, ChronoType time) {
+    using Lim = numeric_limits<CType>;
+    if (time > Lim::max() || time < Lim::min())
+      return false;
+    *out = static_cast<CType>(time);
+    return true;
+  }
+
+  static _LIBCPP_CONSTEXPR_AFTER_CXX11 bool is_representable(TimeSpecT tm) {
+    if (tm.tv_sec >= 0) {
+      return (tm.tv_sec < max_seconds) ||
+             (tm.tv_sec == max_seconds && tm.tv_nsec <= max_nsec);
+    } else if (tm.tv_sec == (min_seconds - 1)) {
+      return tm.tv_nsec >= min_nsec_timespec;
+    } else {
+      return (tm.tv_sec >= min_seconds);
+    }
+  }
+
+  static _LIBCPP_CONSTEXPR_AFTER_CXX11 bool is_representable(FileTimeT tm) {
+    auto secs = duration_cast<seconds>(tm.time_since_epoch());
+    auto nsecs = duration_cast<nanoseconds>(tm.time_since_epoch() - secs);
+    if (nsecs.count() < 0) {
+      secs = secs + seconds(1);
+      nsecs = nsecs + seconds(1);
+    }
+    using TLim = numeric_limits<TimeT>;
+    if (secs.count() >= 0)
+      return secs.count() <= TLim::max();
+    return secs.count() >= TLim::min();
+  }
+
+  static _LIBCPP_CONSTEXPR_AFTER_CXX11 FileTimeT
+  convert_timespec(TimeSpecT tm) {
+    auto adj_msec = duration_cast<microseconds>(nanoseconds(tm.tv_nsec));
+    if (tm.tv_sec >= 0) {
+      auto Dur = seconds(tm.tv_sec) + microseconds(adj_msec);
+      return FileTimeT(Dur);
+    } else if (duration_cast<microseconds>(nanoseconds(tm.tv_nsec)).count() ==
+               0) {
+      return FileTimeT(seconds(tm.tv_sec));
+    } else { // tm.tv_sec < 0
+      auto adj_subsec =
+          duration_cast<microseconds>(seconds(1) - nanoseconds(tm.tv_nsec));
+      auto Dur = seconds(tm.tv_sec + 1) - adj_subsec;
+      return FileTimeT(Dur);
+    }
+  }
+
+  template <class SubSecDurT, class SubSecT>
+  static bool set_times_checked(TimeT* sec_out, SubSecT* subsec_out,
+                                FileTimeT tp) {
+    using namespace chrono;
+    auto dur = tp.time_since_epoch();
+    auto sec_dur = duration_cast<seconds>(dur);
+    auto subsec_dur = duration_cast<SubSecDurT>(dur - sec_dur);
+    // The tv_nsec and tv_usec fields must not be negative so adjust accordingly
+    if (subsec_dur.count() < 0) {
+      if (sec_dur.count() > min_seconds) {
+        sec_dur -= seconds(1);
+        subsec_dur += seconds(1);
+      } else {
+        subsec_dur = SubSecDurT::zero();
+      }
+    }
+    return checked_set(sec_out, sec_dur.count()) &&
+           checked_set(subsec_out, subsec_dur.count());
+  }
+};
+
+} // end namespace
+} // end namespace time_detail
+
+using time_detail::fs_time_util;
+
+_LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM
+
+#endif // FILESYSTEM_TIME_HELPER_H

Modified: vendor/libc++/dist/src/experimental/filesystem/operations.cpp
==============================================================================
--- vendor/libc++/dist/src/experimental/filesystem/operations.cpp	Thu Jul 13 19:25:54 2017	(r320962)
+++ vendor/libc++/dist/src/experimental/filesystem/operations.cpp	Thu Jul 13 19:25:57 2017	(r320963)
@@ -15,6 +15,8 @@
 #include "cstdlib"
 #include "climits"
 
+#include "filesystem_time_helper.h"
+
 #include <unistd.h>
 #include <sys/stat.h>
 #include <sys/statvfs.h>
@@ -426,17 +428,20 @@ void __current_path(const path& p, std::error_code *ec
 
 bool __equivalent(const path& p1, const path& p2, std::error_code *ec)
 {
+    auto make_unsupported_error = [&]() {
+      set_or_throw(make_error_code(errc::not_supported), ec,
+                     "equivalent", p1, p2);
+      return false;
+    };
     std::error_code ec1, ec2;
     struct ::stat st1 = {};
     struct ::stat st2 = {};
     auto s1 = detail::posix_stat(p1.native(), st1, &ec1);
+    if (!exists(s1))
+      return make_unsupported_error();
     auto s2 = detail::posix_stat(p2.native(), st2, &ec2);
-
-    if ((!exists(s1) && !exists(s2)) || (is_other(s1) && is_other(s2))) {
-        set_or_throw(make_error_code(errc::not_supported), ec,
-                     "equivalent", p1, p2);
-        return false;
-    }
+    if (!exists(s2))
+      return make_unsupported_error();
     if (ec) ec->clear();
     return (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino);
 }
@@ -502,17 +507,6 @@ bool __fs_is_empty(const path& p, std::error_code *ec)
 
 namespace detail { namespace {
 
-using namespace std::chrono;
-
-template <class CType, class ChronoType>
-bool checked_set(CType* out, ChronoType time) {
-    using Lim = numeric_limits<CType>;
-    if (time > Lim::max() || time < Lim::min())
-        return false;
-    *out = static_cast<CType>(time);
-    return true;
-}
-
 using TimeSpec = struct timespec;
 using StatT =  struct stat;
 
@@ -525,137 +519,10 @@ __attribute__((unused)) // Suppress warning
 TimeSpec extract_atime(StatT const& st) { return st.st_atim; }
 #endif
 
-constexpr auto max_seconds = duration_cast<seconds>(
-    file_time_type::duration::max()).count();
-
-constexpr auto max_nsec = duration_cast<nanoseconds>(
-    file_time_type::duration::max() - seconds(max_seconds)).count();
-
-constexpr auto min_seconds = duration_cast<seconds>(
-    file_time_type::duration::min()).count();
-
-constexpr auto min_nsec_timespec = duration_cast<nanoseconds>(
-    (file_time_type::duration::min() - seconds(min_seconds)) + seconds(1)).count();
-
-// Static assert that these values properly round trip.
-static_assert((seconds(min_seconds) + duration_cast<microseconds>(nanoseconds(min_nsec_timespec)))
-                  - duration_cast<microseconds>(seconds(1))
-                  == file_time_type::duration::min(), "");
-
-constexpr auto max_time_t = numeric_limits<time_t>::max();
-constexpr auto min_time_t = numeric_limits<time_t>::min();
-
-#if !defined(__LP64__) && defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare"
-#endif
-
-_LIBCPP_CONSTEXPR_AFTER_CXX11
-bool is_representable(TimeSpec const& tm) {
-  if (tm.tv_sec >= 0) {
-    return (tm.tv_sec < max_seconds) ||
-        (tm.tv_sec == max_seconds && tm.tv_nsec <= max_nsec);
-  } else if (tm.tv_sec == (min_seconds - 1)) {
-     return tm.tv_nsec >= min_nsec_timespec;
-  } else {
-    return (tm.tv_sec >= min_seconds);
-  }
-}
-#ifndef _LIBCPP_HAS_NO_CXX14_CONSTEXPR
-#if defined(__LP64__)
-static_assert(is_representable({max_seconds, max_nsec}), "");
-static_assert(!is_representable({max_seconds + 1, 0}), "");
-static_assert(!is_representable({max_seconds, max_nsec + 1}), "");
-static_assert(!is_representable({max_time_t, 0}), "");
-static_assert(is_representable({min_seconds, 0}), "");

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707131925.v6DJPvt7036688>