Browse Source

Update libc++ to 429a717e (20 Jan 2022).

Notable changes:
* use _LIBCPP_DEBUG_ASSERT in unordered_map and vector headers
* use reserved identifiers for template parameters
* fix category of fs::path::iterator
* introduce __debug_db_insert_i() for debug checks to support compile-time evaluation
* add specializations of basic_common_reference and common_type for tuple
* fix std::lognormal_distribution::param_type
* add _LIBCPP_HIDE_FROM_ABI to in_in_result conversion operators
* replace _LIBCPP_INLINE_VISIBILITY with _LIBCPP_HIDE_FROM_ABI in move_iterator.h
* fix __simple_view concept in std::ranges
* add some ASCII/EBCDIC support for z/OS

ref:b0e68cbe142a3f06a8804f247119b5eb0a455a39
Andrey Khalyavin 2 years ago
parent
commit
ddddb65b4f

+ 1 - 1
build/ymake.core.conf

@@ -9,7 +9,7 @@
 FAKEID=3141592653
 
 SANDBOX_FAKEID=${FAKEID}.7600000
-CPP_FAKEID=9355536
+CPP_FAKEID=9362383
 GO_FAKEID=9336945
 ANDROID_FAKEID=8821472
 CLANG_TIDY_FAKEID=8625699

+ 1 - 1
contrib/libs/cxxsupp/libcxx/import

@@ -1,6 +1,6 @@
 #!/bin/sh -e
 
-rev=5726e559
+rev=429a717e
 output_dir="libcxx-r$rev"
 if [ -z $1 ] ; then
     git clone https://github.com/llvm/llvm-project.git --no-checkout "$output_dir/tmp"

+ 4 - 2
contrib/libs/cxxsupp/libcxx/include/__algorithm/in_in_result.h

@@ -26,13 +26,15 @@ struct in_in_result {
 
   template <class _II1, class _II2>
     requires convertible_to<const _I1&, _II1> && convertible_to<const _I2&, _II2>
-  constexpr operator in_in_result<_II1, _II2>() const & {
+   _LIBCPP_HIDE_FROM_ABI constexpr
+   operator in_in_result<_II1, _II2>() const & {
     return {in1, in2};
   }
 
   template <class _II1, class _II2>
     requires convertible_to<_I1, _II1> && convertible_to<_I2, _II2>
-    constexpr operator in_in_result<_II1, _II2>() && { return {_VSTD::move(in1), _VSTD::move(in2)}; }
+  _LIBCPP_HIDE_FROM_ABI constexpr
+  operator in_in_result<_II1, _II2>() && { return {_VSTD::move(in1), _VSTD::move(in2)}; }
 };
 } // namespace ranges
 

+ 55 - 0
contrib/libs/cxxsupp/libcxx/include/__chrono/convert_to_timespec.h

@@ -0,0 +1,55 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#ifndef _LIBCPP___CHRONO_CONVERT_TO_TIMESPEC_H
+#define _LIBCPP___CHRONO_CONVERT_TO_TIMESPEC_H
+
+#include <__chrono/duration.h>
+#include <__config>
+#include <limits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// Convert a nanoseconds duration to the given TimeSpec type, which must have
+// the same properties as std::timespec.
+template <class _TimeSpec>
+_LIBCPP_HIDE_FROM_ABI inline
+_TimeSpec __convert_to_timespec(const chrono::nanoseconds& __ns)
+{
+  using namespace chrono;
+  seconds __s = duration_cast<seconds>(__ns);
+  _TimeSpec __ts;
+  typedef decltype(__ts.tv_sec) __ts_sec;
+  const __ts_sec __ts_sec_max = numeric_limits<__ts_sec>::max();
+
+  if (__s.count() < __ts_sec_max)
+  {
+    __ts.tv_sec = static_cast<__ts_sec>(__s.count());
+    __ts.tv_nsec = static_cast<decltype(__ts.tv_nsec)>((__ns - __s).count());
+  }
+  else
+  {
+    __ts.tv_sec = __ts_sec_max;
+    __ts.tv_nsec = 999999999; // (10^9 - 1)
+  }
+
+  return __ts;
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___CHRONO_CONVERT_TO_TIMESPEC_H

+ 7 - 3
contrib/libs/cxxsupp/libcxx/include/__config

@@ -269,6 +269,10 @@
 #  endif // defined(__GLIBC_PREREQ)
 #endif // defined(__linux__)
 
+#if defined(__MVS__)
+#  include <features.h> // for __NATIVE_ASCII_F
+#endif
+
 #ifdef __LITTLE_ENDIAN__
 #  if __LITTLE_ENDIAN__
 #    define _LIBCPP_LITTLE_ENDIAN
@@ -1268,9 +1272,9 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
 #   define _LIBCPP_C_HAS_NO_GETS
 #endif
 
-#if defined(__BIONIC__) || defined(__NuttX__) ||      \
-    defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC) || \
-    defined(__MVS__) || defined(__OpenBSD__)
+#if defined(__BIONIC__) || defined(__NuttX__) ||           \
+    defined(__Fuchsia__) || defined(__wasi__) ||           \
+    defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__)
 #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
 #endif
 

+ 10 - 0
contrib/libs/cxxsupp/libcxx/include/__debug

@@ -279,6 +279,16 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_inser
 #endif
 }
 
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_insert_i(_Tp* __i) {
+#if _LIBCPP_DEBUG_LEVEL == 2
+    if (!__libcpp_is_constant_evaluated())
+        __get_db()->__insert_i(__i);
+#else
+    (void)(__i);
+#endif
+}
+
 _LIBCPP_END_NAMESPACE_STD
 
 #endif // _LIBCPP_DEBUG_H

+ 3 - 5
contrib/libs/cxxsupp/libcxx/include/__filesystem/path_iterator.h

@@ -38,15 +38,13 @@ public:
   };
 
 public:
-  typedef bidirectional_iterator_tag iterator_category;
+  typedef input_iterator_tag iterator_category;
+  typedef bidirectional_iterator_tag iterator_concept;
 
   typedef path value_type;
   typedef ptrdiff_t difference_type;
   typedef const path* pointer;
-  typedef const path& reference;
-
-  typedef void
-      __stashing_iterator_tag; // See reverse_iterator and __is_stashing_iterator
+  typedef path reference;
 
 public:
   _LIBCPP_INLINE_VISIBILITY

+ 4 - 12
contrib/libs/cxxsupp/libcxx/include/__hash_table

@@ -295,9 +295,7 @@ public:
     typedef typename _NodeTypes::__node_value_type_pointer pointer;
 
     _LIBCPP_INLINE_VISIBILITY __hash_iterator() _NOEXCEPT : __node_(nullptr) {
-#if _LIBCPP_DEBUG_LEVEL == 2
-        __get_db()->__insert_i(this);
-#endif
+        _VSTD::__debug_db_insert_i(this);
     }
 
 #if _LIBCPP_DEBUG_LEVEL == 2
@@ -407,9 +405,7 @@ public:
 
 
     _LIBCPP_INLINE_VISIBILITY __hash_const_iterator() _NOEXCEPT : __node_(nullptr) {
-#if _LIBCPP_DEBUG_LEVEL == 2
-        __get_db()->__insert_i(this);
-#endif
+        _VSTD::__debug_db_insert_i(this);
     }
 
     _LIBCPP_INLINE_VISIBILITY
@@ -524,9 +520,7 @@ public:
     typedef typename _NodeTypes::__node_value_type_pointer      pointer;
 
     _LIBCPP_INLINE_VISIBILITY __hash_local_iterator() _NOEXCEPT : __node_(nullptr) {
-#if _LIBCPP_DEBUG_LEVEL == 2
-        __get_db()->__insert_i(this);
-#endif
+        _VSTD::__debug_db_insert_i(this);
     }
 
 #if _LIBCPP_DEBUG_LEVEL == 2
@@ -658,9 +652,7 @@ public:
 
 
     _LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() _NOEXCEPT : __node_(nullptr) {
-#if _LIBCPP_DEBUG_LEVEL == 2
-        __get_db()->__insert_i(this);
-#endif
+        _VSTD::__debug_db_insert_i(this);
     }
 
     _LIBCPP_INLINE_VISIBILITY

+ 72 - 72
contrib/libs/cxxsupp/libcxx/include/__iterator/move_iterator.h

@@ -23,19 +23,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template <class _Iter>
 class _LIBCPP_TEMPLATE_VIS move_iterator
 {
-private:
-    _Iter __i;
 public:
-    typedef _Iter                                            iterator_type;
+#if _LIBCPP_STD_VER > 17
+    typedef input_iterator_tag iterator_concept;
+#endif
+
+    typedef _Iter iterator_type;
+    typedef _If<
+        __is_cpp17_random_access_iterator<_Iter>::value,
+        random_access_iterator_tag,
+        typename iterator_traits<_Iter>::iterator_category
+    >  iterator_category;
     typedef typename iterator_traits<iterator_type>::value_type value_type;
     typedef typename iterator_traits<iterator_type>::difference_type difference_type;
     typedef iterator_type pointer;
-    typedef _If<__is_cpp17_random_access_iterator<_Iter>::value,
-        random_access_iterator_tag,
-        typename iterator_traits<_Iter>::iterator_category>  iterator_category;
-#if _LIBCPP_STD_VER > 17
-    typedef input_iterator_tag                               iterator_concept;
-#endif
 
 #ifndef _LIBCPP_CXX03_LANG
     typedef typename iterator_traits<iterator_type>::reference __reference;
@@ -48,114 +49,113 @@ public:
     typedef typename iterator_traits<iterator_type>::reference reference;
 #endif
 
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-    move_iterator() : __i() {}
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+    move_iterator() : __current_() {}
 
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-    explicit move_iterator(_Iter __x) : __i(__x) {}
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+    explicit move_iterator(_Iter __i) : __current_(__i) {}
 
     template <class _Up, class = __enable_if_t<
-        !is_same<_Up, _Iter>::value && is_convertible<_Up const&, _Iter>::value
+        !is_same<_Up, _Iter>::value && is_convertible<const _Up&, _Iter>::value
     > >
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-    move_iterator(const move_iterator<_Up>& __u) : __i(__u.base()) {}
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+    move_iterator(const move_iterator<_Up>& __u) : __current_(__u.base()) {}
 
     template <class _Up, class = __enable_if_t<
         !is_same<_Up, _Iter>::value &&
-        is_convertible<_Up const&, _Iter>::value &&
-        is_assignable<_Iter&, _Up const&>::value
+        is_convertible<const _Up&, _Iter>::value &&
+        is_assignable<_Iter&, const _Up&>::value
     > >
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
     move_iterator& operator=(const move_iterator<_Up>& __u) {
-        __i = __u.base();
+        __current_ = __u.base();
         return *this;
     }
 
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 _Iter base() const {return __i;}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-    reference operator*() const { return static_cast<reference>(*__i); }
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-    pointer  operator->() const { return __i;}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-    move_iterator& operator++() {++__i; return *this;}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-    move_iterator  operator++(int) {move_iterator __tmp(*this); ++__i; return __tmp;}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-    move_iterator& operator--() {--__i; return *this;}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-    move_iterator  operator--(int) {move_iterator __tmp(*this); --__i; return __tmp;}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-    move_iterator  operator+ (difference_type __n) const {return move_iterator(__i + __n);}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-    move_iterator& operator+=(difference_type __n) {__i += __n; return *this;}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-    move_iterator  operator- (difference_type __n) const {return move_iterator(__i - __n);}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-    move_iterator& operator-=(difference_type __n) {__i -= __n; return *this;}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-    reference operator[](difference_type __n) const { return static_cast<reference>(__i[__n]); }
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+    _Iter base() const { return __current_; }
+
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+    reference operator*() const { return static_cast<reference>(*__current_); }
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+    pointer operator->() const { return __current_; }
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+    reference operator[](difference_type __n) const { return static_cast<reference>(__current_[__n]); }
+
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+    move_iterator& operator++() { ++__current_; return *this; }
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+    move_iterator operator++(int) { move_iterator __tmp(*this); ++__current_; return __tmp; }
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+    move_iterator& operator--() { --__current_; return *this; }
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+    move_iterator operator--(int) { move_iterator __tmp(*this); --__current_; return __tmp; }
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+    move_iterator operator+(difference_type __n) const { return move_iterator(__current_ + __n); }
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+    move_iterator& operator+=(difference_type __n) { __current_ += __n; return *this; }
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+    move_iterator operator-(difference_type __n) const { return move_iterator(__current_ - __n); }
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+    move_iterator& operator-=(difference_type __n) { __current_ -= __n; return *this; }
+
+private:
+    _Iter __current_;
 };
 
 template <class _Iter1, class _Iter2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-bool
-operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+bool operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
 {
     return __x.base() == __y.base();
 }
 
 template <class _Iter1, class _Iter2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-bool
-operator<(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+bool operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
 {
-    return __x.base() < __y.base();
+    return __x.base() != __y.base();
 }
 
 template <class _Iter1, class _Iter2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-bool
-operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+bool operator<(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
 {
-    return __x.base() != __y.base();
+    return __x.base() < __y.base();
 }
 
 template <class _Iter1, class _Iter2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-bool
-operator>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+bool operator>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
 {
     return __x.base() > __y.base();
 }
 
 template <class _Iter1, class _Iter2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-bool
-operator>=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+bool operator<=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
 {
-    return __x.base() >= __y.base();
+    return __x.base() <= __y.base();
 }
 
 template <class _Iter1, class _Iter2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-bool
-operator<=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+bool operator>=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
 {
-    return __x.base() <= __y.base();
+    return __x.base() >= __y.base();
 }
 
 #ifndef _LIBCPP_CXX03_LANG
 template <class _Iter1, class _Iter2>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
-auto
-operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
--> decltype(__x.base() - __y.base())
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
+auto operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
+    -> decltype(__x.base() - __y.base())
 {
     return __x.base() - __y.base();
 }
 #else
 template <class _Iter1, class _Iter2>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_HIDE_FROM_ABI
 typename move_iterator<_Iter1>::difference_type
 operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
 {
@@ -164,7 +164,7 @@ operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
 #endif
 
 template <class _Iter>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
 move_iterator<_Iter>
 operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterator<_Iter>& __x)
 {
@@ -172,7 +172,7 @@ operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterato
 }
 
 template <class _Iter>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
 move_iterator<_Iter>
 make_move_iterator(_Iter __i)
 {

+ 0 - 11
contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h

@@ -24,13 +24,6 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-template <class _Tp, class = void>
-struct __is_stashing_iterator : false_type {};
-
-template <class _Tp>
-struct __is_stashing_iterator<_Tp, typename __void_t<typename _Tp::__stashing_iterator_tag>::type>
-  : true_type {};
-
 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Iter>
 class _LIBCPP_TEMPLATE_VIS reverse_iterator
@@ -48,10 +41,6 @@ private:
     _Iter __t; // no longer used as of LWG #2360, not removed due to ABI break
 #endif
 
-    static_assert(!__is_stashing_iterator<_Iter>::value,
-      "The specified iterator type cannot be used with reverse_iterator; "
-      "Using stashing iterators with reverse_iterator causes undefined behavior");
-
 protected:
     _Iter current;
 public:

Some files were not shown because too many files changed in this diff