svn commit: r357035 - in projects/clang1000-import/contrib/llvm-project/libcxx: include include/experimental include/ext src src/experimental src/filesystem
Dimitry Andric
dim at FreeBSD.org
Thu Jan 23 07:06:21 UTC 2020
Author: dim
Date: Thu Jan 23 07:06:18 2020
New Revision: 357035
URL: https://svnweb.freebsd.org/changeset/base/357035
Log:
Merge ^/vendor/libc++/dist up to its last change, and resolve conflicts.
Added:
projects/clang1000-import/contrib/llvm-project/libcxx/include/execution
- copied unchanged from r357034, vendor/libc++/dist/include/execution
Modified:
projects/clang1000-import/contrib/llvm-project/libcxx/include/__config
projects/clang1000-import/contrib/llvm-project/libcxx/include/__functional_base
projects/clang1000-import/contrib/llvm-project/libcxx/include/__libcpp_version
projects/clang1000-import/contrib/llvm-project/libcxx/include/__mutex_base
projects/clang1000-import/contrib/llvm-project/libcxx/include/__split_buffer
projects/clang1000-import/contrib/llvm-project/libcxx/include/__string
projects/clang1000-import/contrib/llvm-project/libcxx/include/__tuple
projects/clang1000-import/contrib/llvm-project/libcxx/include/algorithm
projects/clang1000-import/contrib/llvm-project/libcxx/include/atomic
projects/clang1000-import/contrib/llvm-project/libcxx/include/bit
projects/clang1000-import/contrib/llvm-project/libcxx/include/chrono
projects/clang1000-import/contrib/llvm-project/libcxx/include/deque
projects/clang1000-import/contrib/llvm-project/libcxx/include/experimental/coroutine
projects/clang1000-import/contrib/llvm-project/libcxx/include/ext/hash_map
projects/clang1000-import/contrib/llvm-project/libcxx/include/ext/hash_set
projects/clang1000-import/contrib/llvm-project/libcxx/include/filesystem
projects/clang1000-import/contrib/llvm-project/libcxx/include/fstream
projects/clang1000-import/contrib/llvm-project/libcxx/include/functional
projects/clang1000-import/contrib/llvm-project/libcxx/include/istream
projects/clang1000-import/contrib/llvm-project/libcxx/include/map
projects/clang1000-import/contrib/llvm-project/libcxx/include/memory
projects/clang1000-import/contrib/llvm-project/libcxx/include/module.modulemap
projects/clang1000-import/contrib/llvm-project/libcxx/include/mutex
projects/clang1000-import/contrib/llvm-project/libcxx/include/new
projects/clang1000-import/contrib/llvm-project/libcxx/include/numeric
projects/clang1000-import/contrib/llvm-project/libcxx/include/ostream
projects/clang1000-import/contrib/llvm-project/libcxx/include/random
projects/clang1000-import/contrib/llvm-project/libcxx/include/regex
projects/clang1000-import/contrib/llvm-project/libcxx/include/set
projects/clang1000-import/contrib/llvm-project/libcxx/include/string
projects/clang1000-import/contrib/llvm-project/libcxx/include/string_view
projects/clang1000-import/contrib/llvm-project/libcxx/include/thread
projects/clang1000-import/contrib/llvm-project/libcxx/include/tuple
projects/clang1000-import/contrib/llvm-project/libcxx/include/type_traits
projects/clang1000-import/contrib/llvm-project/libcxx/include/utility
projects/clang1000-import/contrib/llvm-project/libcxx/include/vector
projects/clang1000-import/contrib/llvm-project/libcxx/src/CMakeLists.txt
projects/clang1000-import/contrib/llvm-project/libcxx/src/algorithm.cpp
projects/clang1000-import/contrib/llvm-project/libcxx/src/chrono.cpp
projects/clang1000-import/contrib/llvm-project/libcxx/src/condition_variable.cpp
projects/clang1000-import/contrib/llvm-project/libcxx/src/debug.cpp
projects/clang1000-import/contrib/llvm-project/libcxx/src/experimental/memory_resource.cpp
projects/clang1000-import/contrib/llvm-project/libcxx/src/filesystem/directory_iterator.cpp
projects/clang1000-import/contrib/llvm-project/libcxx/src/filesystem/int128_builtins.cpp
projects/clang1000-import/contrib/llvm-project/libcxx/src/filesystem/operations.cpp
projects/clang1000-import/contrib/llvm-project/libcxx/src/iostream.cpp
projects/clang1000-import/contrib/llvm-project/libcxx/src/memory.cpp
projects/clang1000-import/contrib/llvm-project/libcxx/src/mutex.cpp
projects/clang1000-import/contrib/llvm-project/libcxx/src/shared_mutex.cpp
projects/clang1000-import/contrib/llvm-project/libcxx/src/thread.cpp
projects/clang1000-import/contrib/llvm-project/libcxx/src/utility.cpp
projects/clang1000-import/contrib/llvm-project/libcxx/src/valarray.cpp
Directory Properties:
projects/clang1000-import/contrib/llvm-project/libcxx/ (props changed)
Modified: projects/clang1000-import/contrib/llvm-project/libcxx/include/__config
==============================================================================
--- projects/clang1000-import/contrib/llvm-project/libcxx/include/__config Thu Jan 23 06:24:11 2020 (r357034)
+++ projects/clang1000-import/contrib/llvm-project/libcxx/include/__config Thu Jan 23 07:06:18 2020 (r357035)
@@ -32,7 +32,7 @@
# define _GNUC_VER_NEW 0
#endif
-#define _LIBCPP_VERSION 9000
+#define _LIBCPP_VERSION 10000
#ifndef _LIBCPP_ABI_VERSION
# define _LIBCPP_ABI_VERSION 1
@@ -183,10 +183,6 @@
# define _LIBCPP_COMPILER_IBM
#endif
-#ifndef _LIBCPP_CLANG_VER
-#define _LIBCPP_CLANG_VER 0
-#endif
-
#if defined(_LIBCPP_COMPILER_GCC) && __cplusplus < 201103L
#error "libc++ does not support using GCC with C++03. Please enable C++11"
#endif
@@ -484,11 +480,14 @@ typedef __char32_t char32_t;
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
-// No apple compilers support ""d and ""y at this time.
-#if _LIBCPP_CLANG_VER < 800 || defined(__apple_build_version__)
-#define _LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS
+// Literal operators ""d and ""y are supported starting with LLVM Clang 8 and AppleClang 10.0.1
+#if (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 800) || \
+ (defined(__apple_build_version__) && __apple_build_version__ < 10010000)
+#define _LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS
#endif
+#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
+
#elif defined(_LIBCPP_COMPILER_GCC)
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
@@ -524,6 +523,8 @@ typedef __char32_t char32_t;
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
+#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
+
#elif defined(_LIBCPP_COMPILER_MSVC)
#define _LIBCPP_TOSTRING2(x) #x
@@ -549,6 +550,8 @@ typedef __char32_t char32_t;
#define _LIBCPP_HAS_NO_VECTOR_EXTENSION
+#define _LIBCPP_DISABLE_EXTENSION_WARNING
+
#elif defined(_LIBCPP_COMPILER_IBM)
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
@@ -569,6 +572,8 @@ typedef __char32_t char32_t;
#define _LIBCPP_HAS_NO_VECTOR_EXTENSION
+#define _LIBCPP_DISABLE_EXTENSION_WARNING
+
#endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
#if defined(_LIBCPP_OBJECT_FORMAT_COFF)
@@ -959,6 +964,20 @@ typedef unsigned int char32_t;
# define _LIBCPP_DEPRECATED_IN_CXX17
#endif
+// Macros to enter and leave a state where deprecation warnings are suppressed.
+#if !defined(_LIBCPP_SUPPRESS_DEPRECATED_PUSH) && \
+ (defined(_LIBCPP_COMPILER_CLANG) || defined(_LIBCPP_COMPILER_GCC))
+# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wdeprecated\"")
+# define _LIBCPP_SUPPRESS_DEPRECATED_POP \
+ _Pragma("GCC diagnostic pop")
+#endif
+#if !defined(_LIBCPP_SUPPRESS_DEPRECATED_PUSH)
+# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+# define _LIBCPP_SUPPRESS_DEPRECATED_POP
+#endif
+
#if _LIBCPP_STD_VER <= 11
# define _LIBCPP_EXPLICIT_AFTER_CXX11
#else
@@ -1083,6 +1102,16 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_
# endif // _LIBCPP_HAS_THREAD_API
#endif // _LIBCPP_HAS_NO_THREADS
+#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
+#if defined(__ANDROID__) && __ANDROID_API__ >= 30
+#define _LIBCPP_HAS_COND_CLOCKWAIT
+#elif defined(_LIBCPP_GLIBC_PREREQ)
+#if _LIBCPP_GLIBC_PREREQ(2, 30)
+#define _LIBCPP_HAS_COND_CLOCKWAIT
+#endif
+#endif
+#endif
+
#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
#error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \
_LIBCPP_HAS_NO_THREADS is not defined.
@@ -1098,17 +1127,35 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_
_LIBCPP_HAS_NO_THREADS is defined.
#endif
-// The Apple, glibc, and Bionic implementation of pthreads implements
+#if defined(__STDCPP_THREADS__) && defined(_LIBCPP_HAS_NO_THREADS)
+#error _LIBCPP_HAS_NO_THREADS cannot be set when __STDCPP_THREADS__ is set.
+#endif
+
+#if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__)
+#define __STDCPP_THREADS__ 1
+#endif
+
+// The glibc and Bionic implementation of pthreads implements
// pthread_mutex_destroy as nop for regular mutexes. Additionally, Win32
// mutexes have no destroy mechanism.
-// TODO(EricWF): Enable this optimization on Apple and Bionic platforms after
-// speaking to their respective stakeholders.
+//
+// This optimization can't be performed on Apple platforms, where
+// pthread_mutex_destroy can allow the kernel to release resources.
+// See https://llvm.org/D64298 for details.
+//
+// TODO(EricWF): Enable this optimization on Bionic after speaking to their
+// respective stakeholders.
#if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) \
|| defined(_LIBCPP_HAS_THREAD_API_WIN32)
# define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION
#endif
// Destroying a condvar is a nop on Windows.
+//
+// This optimization can't be performed on Apple platforms, where
+// pthread_cond_destroy can allow the kernel to release resources.
+// See https://llvm.org/D64298 for details.
+//
// TODO(EricWF): This is potentially true for some pthread implementations
// as well.
#if defined(_LIBCPP_HAS_THREAD_API_WIN32)
@@ -1133,7 +1180,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_
// Some systems do not provide gets() in their C library, for security reasons.
#ifndef _LIBCPP_C_HAS_NO_GETS
# if defined(_LIBCPP_MSVCRT) || \
- (defined(__FreeBSD__) && __FreeBSD_version >= 1300043)
+ (defined(__FreeBSD_version) && __FreeBSD_version >= 1300043)
# define _LIBCPP_C_HAS_NO_GETS
# endif
#endif
@@ -1233,7 +1280,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_
#ifndef _LIBCPP_NODEBUG_TYPE
#if __has_attribute(__nodebug__) && \
- (defined(_LIBCPP_COMPILER_CLANG) && _LIBCPP_CLANG_VER >= 900)
+ (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 900)
#define _LIBCPP_NODEBUG_TYPE __attribute__((nodebug))
#else
#define _LIBCPP_NODEBUG_TYPE
@@ -1419,6 +1466,17 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_
#endif // _LIBCPP_NO_AUTO_LINK
#define _LIBCPP_UNUSED_VAR(x) ((void)(x))
+
+// Configures the fopen close-on-exec mode character, if any. This string will
+// be appended to any mode string used by fstream for fopen/fdopen.
+//
+// Not all platforms support this, but it helps avoid fd-leaks on platforms that
+// do.
+#if defined(__BIONIC__)
+# define _LIBCPP_FOPEN_CLOEXEC_MODE "e"
+#else
+# define _LIBCPP_FOPEN_CLOEXEC_MODE
+#endif
#endif // __cplusplus
Modified: projects/clang1000-import/contrib/llvm-project/libcxx/include/__functional_base
==============================================================================
--- projects/clang1000-import/contrib/llvm-project/libcxx/include/__functional_base Thu Jan 23 06:24:11 2020 (r357034)
+++ projects/clang1000-import/contrib/llvm-project/libcxx/include/__functional_base Thu Jan 23 07:06:18 2020 (r357035)
@@ -558,7 +558,7 @@ struct __is_transparent<_Tp, _Up,
// allocator_arg_t
-struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { };
+struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { explicit allocator_arg_t() = default; };
#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY)
extern _LIBCPP_EXPORTED_FROM_ABI const allocator_arg_t allocator_arg;
Modified: projects/clang1000-import/contrib/llvm-project/libcxx/include/__libcpp_version
==============================================================================
--- projects/clang1000-import/contrib/llvm-project/libcxx/include/__libcpp_version Thu Jan 23 06:24:11 2020 (r357034)
+++ projects/clang1000-import/contrib/llvm-project/libcxx/include/__libcpp_version Thu Jan 23 07:06:18 2020 (r357035)
@@ -1 +1 @@
-9000
+10000
Modified: projects/clang1000-import/contrib/llvm-project/libcxx/include/__mutex_base
==============================================================================
--- projects/clang1000-import/contrib/llvm-project/libcxx/include/__mutex_base Thu Jan 23 06:24:11 2020 (r357034)
+++ projects/clang1000-import/contrib/llvm-project/libcxx/include/__mutex_base Thu Jan 23 07:06:18 2020 (r357035)
@@ -15,6 +15,7 @@
#include <system_error>
#include <__threading_support>
+#include <time.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -65,9 +66,9 @@ class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATIO
static_assert(is_nothrow_default_constructible<mutex>::value,
"the default constructor for std::mutex must be nothrow");
-struct _LIBCPP_TYPE_VIS defer_lock_t {};
-struct _LIBCPP_TYPE_VIS try_to_lock_t {};
-struct _LIBCPP_TYPE_VIS adopt_lock_t {};
+struct _LIBCPP_TYPE_VIS defer_lock_t { explicit defer_lock_t() = default; };
+struct _LIBCPP_TYPE_VIS try_to_lock_t { explicit try_to_lock_t() = default; };
+struct _LIBCPP_TYPE_VIS adopt_lock_t { explicit adopt_lock_t() = default; };
#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY)
@@ -94,10 +95,11 @@ lock_guard (private)
mutex_type& __m_;
public:
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY
explicit lock_guard(mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m))
: __m_(__m) {__m_.lock();}
- _LIBCPP_INLINE_VISIBILITY
+
+ _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY
lock_guard(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m))
: __m_(__m) {}
_LIBCPP_INLINE_VISIBILITY
@@ -336,25 +338,77 @@ class _LIBCPP_TYPE_VIS condition_variable (public)
private:
void __do_timed_wait(unique_lock<mutex>& __lk,
chrono::time_point<chrono::system_clock, chrono::nanoseconds>) _NOEXCEPT;
+#if defined(_LIBCPP_HAS_COND_CLOCKWAIT)
+ void __do_timed_wait(unique_lock<mutex>& __lk,
+ chrono::time_point<chrono::steady_clock, chrono::nanoseconds>) _NOEXCEPT;
+#endif
+ template <class _Clock>
+ void __do_timed_wait(unique_lock<mutex>& __lk,
+ chrono::time_point<_Clock, chrono::nanoseconds>) _NOEXCEPT;
};
#endif // !_LIBCPP_HAS_NO_THREADS
-template <class _To, class _Rep, class _Period>
+template <class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- chrono::__is_duration<_To>::value,
- _To
+ is_floating_point<_Rep>::value,
+ chrono::nanoseconds
>::type
-__ceil(chrono::duration<_Rep, _Period> __d)
+__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d)
{
using namespace chrono;
- _To __r = duration_cast<_To>(__d);
- if (__r < __d)
- ++__r;
- return __r;
+ using __ratio = ratio_divide<_Period, nano>;
+ using __ns_rep = nanoseconds::rep;
+ _Rep __result_float = __d.count() * __ratio::num / __ratio::den;
+
+ _Rep __result_max = numeric_limits<__ns_rep>::max();
+ if (__result_float >= __result_max) {
+ return nanoseconds::max();
+ }
+
+ _Rep __result_min = numeric_limits<__ns_rep>::min();
+ if (__result_float <= __result_min) {
+ return nanoseconds::min();
+ }
+
+ return nanoseconds(static_cast<__ns_rep>(__result_float));
}
+template <class _Rep, class _Period>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+ !is_floating_point<_Rep>::value,
+ chrono::nanoseconds
+>::type
+__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d)
+{
+ using namespace chrono;
+ if (__d.count() == 0) {
+ return nanoseconds(0);
+ }
+
+ using __ratio = ratio_divide<_Period, nano>;
+ using __ns_rep = nanoseconds::rep;
+ __ns_rep __result_max = std::numeric_limits<__ns_rep>::max();
+ if (__d.count() > 0 && __d.count() > __result_max / __ratio::num) {
+ return nanoseconds::max();
+ }
+
+ __ns_rep __result_min = std::numeric_limits<__ns_rep>::min();
+ if (__d.count() < 0 && __d.count() < __result_min / __ratio::num) {
+ return nanoseconds::min();
+ }
+
+ __ns_rep __result = __d.count() * __ratio::num / __ratio::den;
+ if (__result == 0) {
+ return nanoseconds(1);
+ }
+
+ return nanoseconds(__result);
+}
+
#ifndef _LIBCPP_HAS_NO_THREADS
template <class _Predicate>
void
@@ -370,7 +424,15 @@ condition_variable::wait_until(unique_lock<mutex>& __l
const chrono::time_point<_Clock, _Duration>& __t)
{
using namespace chrono;
- wait_for(__lk, __t - _Clock::now());
+ using __clock_tp_ns = time_point<_Clock, nanoseconds>;
+
+ typename _Clock::time_point __now = _Clock::now();
+ if (__t <= __now)
+ return cv_status::timeout;
+
+ __clock_tp_ns __t_ns = __clock_tp_ns(__safe_nanosecond_cast(__t.time_since_epoch()));
+
+ __do_timed_wait(__lk, __t_ns);
return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
}
@@ -396,15 +458,25 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
using namespace chrono;
if (__d <= __d.zero())
return cv_status::timeout;
- typedef time_point<system_clock, duration<long double, nano> > __sys_tpf;
- typedef time_point<system_clock, nanoseconds> __sys_tpi;
- __sys_tpf _Max = __sys_tpi::max();
+ using __ns_rep = nanoseconds::rep;
steady_clock::time_point __c_now = steady_clock::now();
- system_clock::time_point __s_now = system_clock::now();
- if (_Max - __d > __s_now)
- __do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
- else
- __do_timed_wait(__lk, __sys_tpi::max());
+
+#if defined(_LIBCPP_HAS_COND_CLOCKWAIT)
+ using __clock_tp_ns = time_point<steady_clock, nanoseconds>;
+ __ns_rep __now_count_ns = __safe_nanosecond_cast(__c_now.time_since_epoch()).count();
+#else
+ using __clock_tp_ns = time_point<system_clock, nanoseconds>;
+ __ns_rep __now_count_ns = __safe_nanosecond_cast(system_clock::now().time_since_epoch()).count();
+#endif
+
+ __ns_rep __d_ns_count = __safe_nanosecond_cast(__d).count();
+
+ if (__now_count_ns > numeric_limits<__ns_rep>::max() - __d_ns_count) {
+ __do_timed_wait(__lk, __clock_tp_ns::max());
+ } else {
+ __do_timed_wait(__lk, __clock_tp_ns(nanoseconds(__now_count_ns + __d_ns_count)));
+ }
+
return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
cv_status::timeout;
}
@@ -418,6 +490,46 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
{
return wait_until(__lk, chrono::steady_clock::now() + __d,
_VSTD::move(__pred));
+}
+
+#if defined(_LIBCPP_HAS_COND_CLOCKWAIT)
+inline
+void
+condition_variable::__do_timed_wait(unique_lock<mutex>& __lk,
+ chrono::time_point<chrono::steady_clock, chrono::nanoseconds> __tp) _NOEXCEPT
+{
+ using namespace chrono;
+ if (!__lk.owns_lock())
+ __throw_system_error(EPERM,
+ "condition_variable::timed wait: mutex not locked");
+ nanoseconds __d = __tp.time_since_epoch();
+ timespec __ts;
+ seconds __s = duration_cast<seconds>(__d);
+ using __ts_sec = decltype(__ts.tv_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 = (__d - __s).count();
+ }
+ else
+ {
+ __ts.tv_sec = __ts_sec_max;
+ __ts.tv_nsec = giga::num - 1;
+ }
+ int __ec = pthread_cond_clockwait(&__cv_, __lk.mutex()->native_handle(), CLOCK_MONOTONIC, &__ts);
+ if (__ec != 0 && __ec != ETIMEDOUT)
+ __throw_system_error(__ec, "condition_variable timed_wait failed");
+}
+#endif // _LIBCPP_HAS_COND_CLOCKWAIT
+
+template <class _Clock>
+inline
+void
+condition_variable::__do_timed_wait(unique_lock<mutex>& __lk,
+ chrono::time_point<_Clock, chrono::nanoseconds> __tp) _NOEXCEPT
+{
+ wait_for(__lk, __tp - _Clock::now());
}
#endif // !_LIBCPP_HAS_NO_THREADS
Modified: projects/clang1000-import/contrib/llvm-project/libcxx/include/__split_buffer
==============================================================================
--- projects/clang1000-import/contrib/llvm-project/libcxx/include/__split_buffer Thu Jan 23 06:24:11 2020 (r357034)
+++ projects/clang1000-import/contrib/llvm-project/libcxx/include/__split_buffer Thu Jan 23 07:06:18 2020 (r357035)
@@ -161,6 +161,19 @@ struct __split_buffer (private)
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT
{}
+
+ struct _ConstructTransaction {
+ explicit _ConstructTransaction(pointer* __p, size_type __n) _NOEXCEPT
+ : __pos_(*__p), __end_(*__p + __n), __dest_(__p) {
+ }
+ ~_ConstructTransaction() {
+ *__dest_ = __pos_;
+ }
+ pointer __pos_;
+ const pointer __end_;
+ private:
+ pointer *__dest_;
+ };
};
template <class _Tp, class _Allocator>
@@ -197,13 +210,10 @@ template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
{
- __alloc_rr& __a = this->__alloc();
- do
- {
- __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
- ++this->__end_;
- --__n;
- } while (__n > 0);
+ _ConstructTransaction __tx(&this->__end_, __n);
+ for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
+ __alloc_traits::construct(this->__alloc(), _VSTD::__to_raw_pointer(__tx.__pos_));
+ }
}
// Copy constructs __n objects starting at __end_ from __x
@@ -216,13 +226,11 @@ template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
{
- __alloc_rr& __a = this->__alloc();
- do
- {
- __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);
- ++this->__end_;
- --__n;
- } while (__n > 0);
+ _ConstructTransaction __tx(&this->__end_, __n);
+ for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
+ __alloc_traits::construct(this->__alloc(),
+ _VSTD::__to_raw_pointer(__tx.__pos_), __x);
+ }
}
template <class _Tp, class _Allocator>
@@ -262,11 +270,10 @@ typename enable_if
>::type
__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
{
- __alloc_rr& __a = this->__alloc();
- for (; __first != __last; ++__first)
- {
- __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
- ++this->__end_;
+ _ConstructTransaction __tx(&this->__end_, std::distance(__first, __last));
+ for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, ++__first) {
+ __alloc_traits::construct(this->__alloc(),
+ _VSTD::__to_raw_pointer(__tx.__pos_), *__first);
}
}
Modified: projects/clang1000-import/contrib/llvm-project/libcxx/include/__string
==============================================================================
--- projects/clang1000-import/contrib/llvm-project/libcxx/include/__string Thu Jan 23 06:24:11 2020 (r357034)
+++ projects/clang1000-import/contrib/llvm-project/libcxx/include/__string Thu Jan 23 07:06:18 2020 (r357035)
@@ -351,6 +351,18 @@ char_traits<wchar_t>::compare(const char_type* __s1, c
#endif
}
+
+template <class _Traits>
+_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+inline size_t __char_traits_length_checked(const typename _Traits::char_type* __s) _NOEXCEPT {
+#if _LIBCPP_DEBUG_LEVEL >= 1
+ return __s ? _Traits::length(__s) : (_VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, "p == nullptr", "null pointer pass to non-null argument of char_traits<...>::length")), 0);
+#else
+ return _Traits::length(__s);
+#endif
+}
+
inline _LIBCPP_CONSTEXPR_AFTER_CXX14
size_t
char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT
Modified: projects/clang1000-import/contrib/llvm-project/libcxx/include/__tuple
==============================================================================
--- projects/clang1000-import/contrib/llvm-project/libcxx/include/__tuple Thu Jan 23 06:24:11 2020 (r357034)
+++ projects/clang1000-import/contrib/llvm-project/libcxx/include/__tuple Thu Jan 23 07:06:18 2020 (r357035)
@@ -477,8 +477,9 @@ using __tuple_like_with_size _LIBCPP_NODEBUG_TYPE = __
>;
struct _LIBCPP_TYPE_VIS __check_tuple_constructor_fail {
- template <class ...>
- static constexpr bool __enable_default() { return false; }
+
+ static constexpr bool __enable_explicit_default() { return false; }
+ static constexpr bool __enable_implicit_default() { return false; }
template <class ...>
static constexpr bool __enable_explicit() { return false; }
template <class ...>
Modified: projects/clang1000-import/contrib/llvm-project/libcxx/include/algorithm
==============================================================================
--- projects/clang1000-import/contrib/llvm-project/libcxx/include/algorithm Thu Jan 23 06:24:11 2020 (r357034)
+++ projects/clang1000-import/contrib/llvm-project/libcxx/include/algorithm Thu Jan 23 07:06:18 2020 (r357035)
@@ -3117,10 +3117,10 @@ _SampleIterator __sample(_PopulationIterator __first,
input_iterator_tag) {
_Distance __k = 0;
- for (; __first != __last && __k < __n; ++__first, (void)++__k)
+ for (; __first != __last && __k < __n; ++__first, (void) ++__k)
__output_iter[__k] = *__first;
_Distance __sz = __k;
- for (; __first != __last; ++__first, (void)++__k) {
+ for (; __first != __last; ++__first, (void) ++__k) {
_Distance __r = _VSTD::uniform_int_distribution<_Distance>(0, __k)(__g);
if (__r < __sz)
__output_iter[__r] = *__first;
@@ -3190,7 +3190,7 @@ template<class _RandomAccessIterator, class _UniformRa
if (__d > 1)
{
_Dp __uid;
- for (--__last, --__d; __first < __last; ++__first, --__d)
+ for (--__last, (void) --__d; __first < __last; ++__first, (void) --__d)
{
difference_type __i = __uid(__g, _Pp(0, __d));
if (__i != difference_type(0))
@@ -3373,7 +3373,7 @@ __stable_partition(_ForwardIterator __first, _ForwardI
// All trues now at start of range, all falses in buffer
// Move falses back into range, but don't mess up __first which points to first false
__i = __first;
- for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, ++__i)
+ for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i)
*__i = _VSTD::move(*__t2);
// __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
return __first;
@@ -3505,7 +3505,7 @@ __stable_partition(_BidirectionalIterator __first, _Bi
__i = ++__first;
// All trues now at start of range, all falses in buffer
// Move falses back into range, but don't mess up __first which points to first false
- for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, ++__i)
+ for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i)
*__i = _VSTD::move(*__t2);
// __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
return __first;
@@ -4382,7 +4382,7 @@ merge(_InputIterator1 __first1, _InputIterator1 __last
{
typedef typename iterator_traits<_InputIterator1>::value_type __v1;
typedef typename iterator_traits<_InputIterator2>::value_type __v2;
- return merge(__first1, __last1, __first2, __last2, __result, __less<__v1, __v2>());
+ return _VSTD::merge(__first1, __last1, __first2, __last2, __result, __less<__v1, __v2>());
}
// inplace_merge
@@ -4428,14 +4428,14 @@ __buffered_inplace_merge(_BidirectionalIterator __firs
if (__len1 <= __len2)
{
value_type* __p = __buff;
- for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), (void) ++__i, ++__p)
+ for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), (void) ++__i, (void) ++__p)
::new(__p) value_type(_VSTD::move(*__i));
__half_inplace_merge(__buff, __p, __middle, __last, __first, __comp);
}
else
{
value_type* __p = __buff;
- for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), (void) ++__i, ++__p)
+ for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), (void) ++__i, (void) ++__p)
::new(__p) value_type(_VSTD::move(*__i));
typedef reverse_iterator<_BidirectionalIterator> _RBi;
typedef reverse_iterator<value_type*> _Rv;
@@ -4575,14 +4575,14 @@ __merge_move_construct(_InputIterator1 __first1, _Inpu
{
if (__first1 == __last1)
{
- for (; __first2 != __last2; ++__first2, ++__result, __d.__incr((value_type*)0))
+ for (; __first2 != __last2; ++__first2, ++__result, (void) __d.__incr((value_type*)0))
::new (__result) value_type(_VSTD::move(*__first2));
__h.release();
return;
}
if (__first2 == __last2)
{
- for (; __first1 != __last1; ++__first1, ++__result, __d.__incr((value_type*)0))
+ for (; __first1 != __last1; ++__first1, ++__result, (void) __d.__incr((value_type*)0))
::new (__result) value_type(_VSTD::move(*__first1));
__h.release();
return;
@@ -4612,7 +4612,7 @@ __merge_move_assign(_InputIterator1 __first1, _InputIt
{
if (__first2 == __last2)
{
- for (; __first1 != __last1; ++__first1, ++__result)
+ for (; __first1 != __last1; ++__first1, (void) ++__result)
*__result = _VSTD::move(*__first1);
return;
}
@@ -4627,7 +4627,7 @@ __merge_move_assign(_InputIterator1 __first1, _InputIt
++__first1;
}
}
- for (; __first2 != __last2; ++__first2, ++__result)
+ for (; __first2 != __last2; ++__first2, (void) ++__result)
*__result = _VSTD::move(*__first2);
}
@@ -4995,7 +4995,7 @@ void
__sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
{
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- for (difference_type __n = __last - __first; __n > 1; --__last, --__n)
+ for (difference_type __n = __last - __first; __n > 1; --__last, (void) --__n)
__pop_heap<_Compare>(__first, __last, __comp, __n);
}
@@ -5065,7 +5065,7 @@ __partial_sort_copy(_InputIterator __first, _InputIter
_RandomAccessIterator __r = __result_first;
if (__r != __result_last)
{
- for (; __first != __last && __r != __result_last; (void) ++__first, ++__r)
+ for (; __first != __last && __r != __result_last; ++__first, (void) ++__r)
*__r = *__first;
__make_heap<_Compare>(__result_first, __r, __comp);
typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first;
@@ -5677,5 +5677,9 @@ prev_permutation(_BidirectionalIterator __first, _Bidi
_LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+
+#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
+# include <__pstl_algorithm>
+#endif
#endif // _LIBCPP_ALGORITHM
Modified: projects/clang1000-import/contrib/llvm-project/libcxx/include/atomic
==============================================================================
--- projects/clang1000-import/contrib/llvm-project/libcxx/include/atomic Thu Jan 23 06:24:11 2020 (r357034)
+++ projects/clang1000-import/contrib/llvm-project/libcxx/include/atomic Thu Jan 23 07:06:18 2020 (r357035)
@@ -920,7 +920,7 @@ struct __cxx_atomic_base_impl {
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT
: __a_value(value) {}
- _Atomic(_Tp) __a_value;
+ _LIBCPP_DISABLE_EXTENSION_WARNING _Atomic(_Tp) __a_value;
};
#define __cxx_atomic_is_lock_free(__s) __c11_atomic_is_lock_free(__s)
Modified: projects/clang1000-import/contrib/llvm-project/libcxx/include/bit
==============================================================================
--- projects/clang1000-import/contrib/llvm-project/libcxx/include/bit Thu Jan 23 06:24:11 2020 (r357034)
+++ projects/clang1000-import/contrib/llvm-project/libcxx/include/bit Thu Jan 23 07:06:18 2020 (r357035)
@@ -42,6 +42,13 @@ namespace std {
template<class T>
constexpr int popcount(T x) noexcept; // C++20
+ // 20.15.9, endian
+ enum class endian {
+ little = see below, // C++20
+ big = see below, // C++20
+ native = see below // C++20
+};
+
} // namespace std
*/
@@ -455,6 +462,20 @@ log2p1(_Tp __t) noexcept
{
return __t == 0 ? 0 : __bit_log2(__t) + 1;
}
+
+
+enum class endian
+{
+ little = 0xDEAD,
+ big = 0xFACE,
+#if defined(_LIBCPP_LITTLE_ENDIAN)
+ native = little
+#elif defined(_LIBCPP_BIG_ENDIAN)
+ native = big
+#else
+ native = 0xCAFE
+#endif
+};
#endif // _LIBCPP_STD_VER > 17
Modified: projects/clang1000-import/contrib/llvm-project/libcxx/include/chrono
==============================================================================
--- projects/clang1000-import/contrib/llvm-project/libcxx/include/chrono Thu Jan 23 06:24:11 2020 (r357034)
+++ projects/clang1000-import/contrib/llvm-project/libcxx/include/chrono Thu Jan 23 07:06:18 2020 (r357035)
@@ -612,14 +612,44 @@ constexpr year_month_weekday_last
constexpr year_month_weekday_last
operator/(const month_weekday_last& mwdl, int y) noexcept;
-// 25.9, class template time_of_day // C++20
-template<class Duration> class time_of_day;
+// 26.9, class template hh_mm_ss
+template <class Duration>
+class hh_mm_ss
+{
+ bool is_neg; // exposition only
+ chrono::hours h; // exposition only
+ chrono::minutes m; // exposition only
+ chrono::seconds s; // exposition only
+ precision ss; // exposition only
-template<> class time_of_day<hours>;
-template<> class time_of_day<minutes>;
-template<> class time_of_day<seconds>;
-template<class Rep, class Period> class time_of_day<duration<Rep, Period>>;
+public:
+ static unsigned constexpr fractional_width = see below;
+ using precision = see below;
+ constexpr hh_mm_ss() noexcept : hh_mm_ss{Duration::zero()} {}
+ constexpr explicit hh_mm_ss(Duration d) noexcept;
+
+ constexpr bool is_negative() const noexcept;
+ constexpr chrono::hours hours() const noexcept;
+ constexpr chrono::minutes minutes() const noexcept;
+ constexpr chrono::seconds seconds() const noexcept;
+ constexpr precision subseconds() const noexcept;
+
+ constexpr explicit operator precision() const noexcept;
+ constexpr precision to_duration() const noexcept;
+};
+
+template <class charT, class traits, class Duration>
+ basic_ostream<charT, traits>&
+ operator<<(basic_ostream<charT, traits>& os, hh_mm_ss<Duration> const& hms);
+
+// 26.10, 12/24 hour functions
+constexpr bool is_am(hours const& h) noexcept;
+constexpr bool is_pm(hours const& h) noexcept;
+constexpr hours make12(const hours& h) noexcept;
+constexpr hours make24(const hours& h, bool is_pm) noexcept;
+
+
// 25.10.2, time zone database // C++20
struct tzdb;
class tzdb_list;
@@ -1428,7 +1458,7 @@ typename enable_if
>::type
abs(duration<_Rep, _Period> __d)
{
- return __d >= __d.zero() ? __d : -__d;
+ return __d >= __d.zero() ? +__d : -__d;
}
#endif
@@ -1810,7 +1840,7 @@ class weekday { (private)
unsigned char __wd;
public:
weekday() = default;
- inline explicit constexpr weekday(unsigned __val) noexcept : __wd(static_cast<unsigned char>(__val)) {}
+ inline explicit constexpr weekday(unsigned __val) noexcept : __wd(static_cast<unsigned char>(__val == 7 ? 0 : __val)) {}
inline constexpr weekday(const sys_days& __sysd) noexcept
: __wd(__weekday_from_days(__sysd.time_since_epoch().count())) {}
inline explicit constexpr weekday(const local_days& __locd) noexcept
@@ -1822,7 +1852,8 @@ class weekday { (private)
inline constexpr weekday operator--(int) noexcept { weekday __tmp = *this; --(*this); return __tmp; }
constexpr weekday& operator+=(const days& __dd) noexcept;
constexpr weekday& operator-=(const days& __dd) noexcept;
- inline explicit constexpr operator unsigned() const noexcept { return __wd; }
+ inline constexpr unsigned c_encoding() const noexcept { return __wd; }
+ inline constexpr unsigned iso_encoding() const noexcept { return __wd == 0u ? 7 : __wd; }
inline constexpr bool ok() const noexcept { return __wd <= 6; }
constexpr weekday_indexed operator[](unsigned __index) const noexcept;
constexpr weekday_last operator[](last_spec) const noexcept;
@@ -1842,7 +1873,7 @@ unsigned char weekday::__weekday_from_days(int __days)
inline constexpr
bool operator==(const weekday& __lhs, const weekday& __rhs) noexcept
-{ return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs); }
+{ return __lhs.c_encoding() == __rhs.c_encoding(); }
inline constexpr
bool operator!=(const weekday& __lhs, const weekday& __rhs) noexcept
@@ -1850,7 +1881,7 @@ bool operator!=(const weekday& __lhs, const weekday& _
inline constexpr
bool operator< (const weekday& __lhs, const weekday& __rhs) noexcept
-{ return static_cast<unsigned>(__lhs) < static_cast<unsigned>(__rhs); }
+{ return __lhs.c_encoding() < __rhs.c_encoding(); }
inline constexpr
bool operator> (const weekday& __lhs, const weekday& __rhs) noexcept
@@ -1866,7 +1897,7 @@ bool operator>=(const weekday& __lhs, const weekday& _
constexpr weekday operator+(const weekday& __lhs, const days& __rhs) noexcept
{
- auto const __mu = static_cast<long long>(static_cast<unsigned>(__lhs)) + __rhs.count();
+ auto const __mu = static_cast<long long>(__lhs.c_encoding()) + __rhs.count();
auto const __yr = (__mu >= 0 ? __mu : __mu - 6) / 7;
return weekday{static_cast<unsigned>(__mu - __yr * 7)};
}
@@ -1879,7 +1910,7 @@ constexpr weekday operator-(const weekday& __lhs, cons
constexpr days operator-(const weekday& __lhs, const weekday& __rhs) noexcept
{
- const int __wdu = static_cast<unsigned>(__lhs) - static_cast<unsigned>(__rhs);
+ const int __wdu = __lhs.c_encoding() - __rhs.c_encoding();
const int __wk = (__wdu >= 0 ? __wdu : __wdu-6) / 7;
return days{__wdu - __wk * 7};
}
@@ -2715,6 +2746,84 @@ inline constexpr year_month_weekday_last& year_month_w
inline constexpr year_month_weekday_last& year_month_weekday_last::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; }
inline constexpr year_month_weekday_last& year_month_weekday_last::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }
+
+template <class _Duration>
+class hh_mm_ss
+{
+private:
+ static_assert(__is_duration<_Duration>::value, "template parameter of hh_mm_ss must be a std::chrono::duration");
+ using __CommonType = common_type_t<_Duration, chrono::seconds>;
+
+ static constexpr uint64_t __pow10(unsigned __exp)
+ {
+ uint64_t __ret = 1;
+ for (unsigned __i = 0; __i < __exp; ++__i)
+ __ret *= 10U;
+ return __ret;
+ }
+
+ static constexpr unsigned __width(uint64_t __n, uint64_t __d = 10, unsigned __w = 0)
+ {
+ if (__n >= 2 && __d != 0 && __w < 19)
+ return 1 + __width(__n, __d % __n * 10, __w+1);
+ return 0;
+ }
+
+public:
+ static unsigned constexpr fractional_width = __width(__CommonType::period::den) < 19 ?
+ __width(__CommonType::period::den) : 6u;
+ using precision = duration<typename __CommonType::rep, ratio<1, __pow10(fractional_width)>>;
+
+ constexpr hh_mm_ss() noexcept : hh_mm_ss{_Duration::zero()} {}
+
+ constexpr explicit hh_mm_ss(_Duration __d) noexcept :
+ __is_neg(__d < _Duration(0)),
+ __h(duration_cast<chrono::hours> (abs(__d))),
+ __m(duration_cast<chrono::minutes>(abs(__d) - hours())),
+ __s(duration_cast<chrono::seconds>(abs(__d) - hours() - minutes())),
+ __f(duration_cast<precision> (abs(__d) - hours() - minutes() - seconds()))
+ {}
+
+ constexpr bool is_negative() const noexcept { return __is_neg; }
+ constexpr chrono::hours hours() const noexcept { return __h; }
+ constexpr chrono::minutes minutes() const noexcept { return __m; }
+ constexpr chrono::seconds seconds() const noexcept { return __s; }
+ constexpr precision subseconds() const noexcept { return __f; }
+
+ constexpr precision to_duration() const noexcept
+ {
+ auto __dur = __h + __m + __s + __f;
+ return __is_neg ? -__dur : __dur;
+ }
+
+ constexpr explicit operator precision() const noexcept { return to_duration(); }
+
+private:
+ bool __is_neg;
+ chrono::hours __h;
+ chrono::minutes __m;
+ chrono::seconds __s;
+ precision __f;
+};
+
+constexpr bool is_am(const hours& __h) noexcept { return __h >= hours( 0) && __h < hours(12); }
+constexpr bool is_pm(const hours& __h) noexcept { return __h >= hours(12) && __h < hours(24); }
+
+constexpr hours make12(const hours& __h) noexcept
+{
+ if (__h == hours( 0)) return hours(12);
+ else if (__h <= hours(12)) return __h;
+ else return __h - hours(12);
+}
+
+constexpr hours make24(const hours& __h, bool __is_pm) noexcept
+{
+ if (__is_pm)
+ return __h == hours(12) ? __h : __h + hours(12);
+ else
+ return __h == hours(12) ? hours(0) : __h;
+}
+
#endif // _LIBCPP_STD_VER > 17
} // chrono
@@ -2825,6 +2934,7 @@ struct _FilesystemClock {
typedef chrono::duration<rep, period> duration;
typedef chrono::time_point<_FilesystemClock> time_point;
+ _LIBCPP_EXPORTED_FROM_ABI
static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false;
_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS static time_point now() noexcept;
Modified: projects/clang1000-import/contrib/llvm-project/libcxx/include/deque
==============================================================================
--- projects/clang1000-import/contrib/llvm-project/libcxx/include/deque Thu Jan 23 06:24:11 2020 (r357034)
+++ projects/clang1000-import/contrib/llvm-project/libcxx/include/deque Thu Jan 23 07:06:18 2020 (r357035)
@@ -934,7 +934,7 @@ class __deque_base (public)
typedef _Allocator allocator_type;
typedef allocator_traits<allocator_type> __alloc_traits;
typedef typename __alloc_traits::size_type size_type;
-protected:
+
typedef _Tp value_type;
typedef value_type& reference;
typedef const value_type& const_reference;
@@ -956,6 +956,74 @@ class __deque_base (public)
typedef __deque_iterator<value_type, const_pointer, const_reference, __map_const_pointer,
difference_type> const_iterator;
+ struct __deque_block_range {
+ explicit __deque_block_range(pointer __b, pointer __e) _NOEXCEPT : __begin_(__b), __end_(__e) {}
+ const pointer __begin_;
+ const pointer __end_;
+ };
+
+ struct __deque_range {
+ iterator __pos_;
+ const iterator __end_;
+
+ __deque_range(iterator __pos, iterator __e) _NOEXCEPT
+ : __pos_(__pos), __end_(__e) {}
+
+ explicit operator bool() const _NOEXCEPT {
+ return __pos_ != __end_;
+ }
+
+ __deque_range begin() const {
+ return *this;
+ }
+
+ __deque_range end() const {
+ return __deque_range(__end_, __end_);
+ }
+ __deque_block_range operator*() const _NOEXCEPT {
+ if (__pos_.__m_iter_ == __end_.__m_iter_) {
+ return __deque_block_range(__pos_.__ptr_, __end_.__ptr_);
+ }
+ return __deque_block_range(__pos_.__ptr_, *__pos_.__m_iter_ + __block_size);
+ }
+
+ __deque_range& operator++() _NOEXCEPT {
+ if (__pos_.__m_iter_ == __end_.__m_iter_) {
+ __pos_ = __end_;
+ } else {
+ ++__pos_.__m_iter_;
+ __pos_.__ptr_ = *__pos_.__m_iter_;
+ }
+ return *this;
+ }
+
+
+ friend bool operator==(__deque_range const& __lhs, __deque_range const& __rhs) {
+ return __lhs.__pos_ == __rhs.__pos_;
+ }
+ friend bool operator!=(__deque_range const& __lhs, __deque_range const& __rhs) {
+ return !(__lhs == __rhs);
+ }
+ };
+
+
+
+ struct _ConstructTransaction {
+ _ConstructTransaction(__deque_base* __db, __deque_block_range& __r)
+ : __pos_(__r.__begin_), __end_(__r.__end_), __begin_(__r.__begin_), __base_(__db) {}
+
+
+ ~_ConstructTransaction() {
+ __base_->size() += (__pos_ - __begin_);
+ }
+
+ pointer __pos_;
+ const pointer __end_;
+ private:
+ const pointer __begin_;
+ __deque_base * const __base_;
+ };
+
protected:
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-projects
mailing list