Date: Thu, 2 Aug 2018 17:33:34 +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: r337143 - in vendor/libc++/dist: include include/experimental include/support/newlib lib/abi src test/libcxx test/libcxx/language.support test/std/containers/associative/map/map.modifie... Message-ID: <201808021733.w72HXY3u029552@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Thu Aug 2 17:33:33 2018 New Revision: 337143 URL: https://svnweb.freebsd.org/changeset/base/337143 Log: Vendor import of libc++ trunk r338536: https://llvm.org/svn/llvm-project/libcxx/trunk@338536 Added: vendor/libc++/dist/include/__node_handle vendor/libc++/dist/include/charconv vendor/libc++/dist/src/charconv.cpp (contents, props changed) vendor/libc++/dist/test/libcxx/language.support/has_c11_features.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/associative/map/map.modifiers/extract_iterator.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/associative/map/map.modifiers/extract_key.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/associative/map/map.modifiers/insert_node_type.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/associative/map/map.modifiers/insert_node_type_hint.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/associative/multimap/multimap.modifiers/extract_iterator.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/associative/multimap/multimap.modifiers/extract_key.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type_hint.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/associative/multiset/extract_iterator.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/associative/multiset/extract_key.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/associative/multiset/insert_node_type.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/associative/multiset/insert_node_type_hint.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/associative/set/extract_iterator.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/associative/set/extract_key.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/associative/set/insert_node_type.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/associative/set/insert_node_type_hint.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/container.node/ vendor/libc++/dist/test/std/containers/container.node/node_handle.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/unord/unord.map/unord.map.modifiers/extract_iterator.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/unord/unord.map/unord.map.modifiers/extract_key.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/unord/unord.map/unord.map.modifiers/insert_node_type.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/unord/unord.map/unord.map.modifiers/insert_node_type_hint.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/extract_iterator.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/extract_key.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_node_type.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_node_type_hint.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/unord/unord.multiset/extract_iterator.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/unord/unord.multiset/extract_key.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/unord/unord.multiset/insert_node_type.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/unord/unord.multiset/insert_node_type_hint.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/unord/unord.set/extract_iterator.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/unord/unord.set/extract_key.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/unord/unord.set/insert_node_type.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/unord/unord.set/insert_node_type_hint.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/experimental/simd/simd.abi/ vendor/libc++/dist/test/std/experimental/simd/simd.abi/vector_extension.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/experimental/simd/simd.access/ vendor/libc++/dist/test/std/experimental/simd/simd.access/default.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/experimental/simd/simd.cons/default.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/experimental/simd/simd.cons/load.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/experimental/simd/simd.mem/ vendor/libc++/dist/test/std/experimental/simd/simd.mem/load.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/experimental/simd/simd.mem/store.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/utilities/charconv/ vendor/libc++/dist/test/std/utilities/charconv/charconv.from.chars/ vendor/libc++/dist/test/std/utilities/charconv/charconv.from.chars/integral.bool.fail.cpp (contents, props changed) vendor/libc++/dist/test/std/utilities/charconv/charconv.from.chars/integral.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/utilities/charconv/charconv.to.chars/ vendor/libc++/dist/test/std/utilities/charconv/charconv.to.chars/integral.bool.fail.cpp (contents, props changed) vendor/libc++/dist/test/std/utilities/charconv/charconv.to.chars/integral.pass.cpp (contents, props changed) vendor/libc++/dist/test/support/charconv_test_helpers.h (contents, props changed) Modified: vendor/libc++/dist/include/CMakeLists.txt vendor/libc++/dist/include/__config vendor/libc++/dist/include/__functional_base vendor/libc++/dist/include/__hash_table vendor/libc++/dist/include/__mutex_base vendor/libc++/dist/include/__tree vendor/libc++/dist/include/cfloat vendor/libc++/dist/include/ctime vendor/libc++/dist/include/experimental/__config vendor/libc++/dist/include/experimental/simd vendor/libc++/dist/include/float.h vendor/libc++/dist/include/functional vendor/libc++/dist/include/map vendor/libc++/dist/include/memory vendor/libc++/dist/include/module.modulemap vendor/libc++/dist/include/new vendor/libc++/dist/include/set vendor/libc++/dist/include/shared_mutex vendor/libc++/dist/include/support/newlib/xlocale.h vendor/libc++/dist/include/system_error vendor/libc++/dist/include/unordered_map vendor/libc++/dist/include/unordered_set vendor/libc++/dist/include/utility vendor/libc++/dist/lib/abi/x86_64-unknown-linux-gnu.v1.abilist vendor/libc++/dist/src/bind.cpp vendor/libc++/dist/src/future.cpp vendor/libc++/dist/src/memory.cpp vendor/libc++/dist/src/mutex.cpp vendor/libc++/dist/src/new.cpp vendor/libc++/dist/src/shared_mutex.cpp vendor/libc++/dist/src/system_error.cpp vendor/libc++/dist/src/utility.cpp vendor/libc++/dist/test/libcxx/double_include.sh.cpp vendor/libc++/dist/test/std/depr/depr.c.headers/float_h.pass.cpp vendor/libc++/dist/test/std/depr/depr.c.headers/stdlib_h.pass.cpp vendor/libc++/dist/test/std/experimental/simd/simd.casts/simd_cast.pass.cpp vendor/libc++/dist/test/std/experimental/simd/simd.casts/static_simd_cast.pass.cpp vendor/libc++/dist/test/std/experimental/simd/simd.cons/broadcast.pass.cpp vendor/libc++/dist/test/std/experimental/simd/simd.cons/generator.pass.cpp vendor/libc++/dist/test/std/experimental/simd/simd.traits/abi_for_size.pass.cpp vendor/libc++/dist/test/std/experimental/simd/simd.traits/is_abi_tag.pass.cpp vendor/libc++/dist/test/std/experimental/simd/simd.traits/is_simd.pass.cpp vendor/libc++/dist/test/std/experimental/simd/simd.traits/is_simd_flag_type.pass.cpp vendor/libc++/dist/test/std/experimental/simd/simd.traits/is_simd_mask.pass.cpp vendor/libc++/dist/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp vendor/libc++/dist/test/std/language.support/support.runtime/cstdlib.pass.cpp vendor/libc++/dist/test/std/language.support/support.runtime/ctime.pass.cpp vendor/libc++/dist/test/std/utilities/time/date.time/ctime.pass.cpp vendor/libc++/dist/test/support/Counter.h vendor/libc++/dist/test/support/test_macros.h vendor/libc++/dist/www/cxx1z_status.html Modified: vendor/libc++/dist/include/CMakeLists.txt ============================================================================== --- vendor/libc++/dist/include/CMakeLists.txt Thu Aug 2 17:33:29 2018 (r337142) +++ vendor/libc++/dist/include/CMakeLists.txt Thu Aug 2 17:33:33 2018 (r337143) @@ -11,6 +11,7 @@ set(files __libcpp_version __locale __mutex_base + __node_handle __nullptr __split_buffer __sso_allocator @@ -31,6 +32,7 @@ set(files cerrno cfenv cfloat + charconv chrono cinttypes ciso646 Modified: vendor/libc++/dist/include/__config ============================================================================== --- vendor/libc++/dist/include/__config Thu Aug 2 17:33:29 2018 (r337142) +++ vendor/libc++/dist/include/__config Thu Aug 2 17:33:33 2018 (r337143) @@ -510,7 +510,7 @@ namespace std { #define _LIBCPP_HAS_IS_BASE_OF #endif -#if !__EXCEPTIONS +#if !__EXCEPTIONS && !defined(_LIBCPP_NO_EXCEPTIONS) #define _LIBCPP_NO_EXCEPTIONS #endif @@ -620,6 +620,8 @@ namespace std { #define _LIBCPP_ALWAYS_INLINE __forceinline +#define _LIBCPP_HAS_NO_VECTOR_EXTENSION + #elif defined(_LIBCPP_COMPILER_IBM) #define _ALIGNAS(x) __attribute__((__aligned__(x))) @@ -651,6 +653,8 @@ namespace std { #define _LIBCPP_HAS_NO_ASAN #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) + +#define _LIBCPP_HAS_NO_VECTOR_EXTENSION #endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] Modified: vendor/libc++/dist/include/__functional_base ============================================================================== --- vendor/libc++/dist/include/__functional_base Thu Aug 2 17:33:29 2018 (r337142) +++ vendor/libc++/dist/include/__functional_base Thu Aug 2 17:33:33 2018 (r337143) @@ -561,7 +561,7 @@ struct __is_transparent<_Tp, _Up, struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { }; -#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_MEMORY) +#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) extern const allocator_arg_t allocator_arg; #else /* _LIBCPP_INLINE_VAR */ constexpr allocator_arg_t allocator_arg = allocator_arg_t(); Modified: vendor/libc++/dist/include/__hash_table ============================================================================== --- vendor/libc++/dist/include/__hash_table Thu Aug 2 17:33:29 2018 (r337142) +++ vendor/libc++/dist/include/__hash_table Thu Aug 2 17:33:33 2018 (r337143) @@ -859,7 +859,18 @@ class __hash_node_destructor (public) template <class> friend class __hash_map_node_destructor; }; +#if _LIBCPP_STD_VER > 14 +template <class _NodeType, class _Alloc> +struct __generic_container_node_destructor; +template <class _Tp, class _VoidPtr, class _Alloc> +struct __generic_container_node_destructor<__hash_node<_Tp, _VoidPtr>, _Alloc> + : __hash_node_destructor<_Alloc> +{ + using __hash_node_destructor<_Alloc>::__hash_node_destructor; +}; +#endif + #ifndef _LIBCPP_CXX03_LANG template <class _Key, class _Hash, class _Equal, class _Alloc> struct __diagnose_hash_table_helper { @@ -1151,6 +1162,30 @@ class __hash_table (public) return __emplace_unique_key_args(_NodeTypes::__get_key(__x), __x); } +#if _LIBCPP_STD_VER > 14 + template <class _NodeHandle, class _InsertReturnType> + _LIBCPP_INLINE_VISIBILITY + _InsertReturnType __node_handle_insert_unique(_NodeHandle&& __nh); + template <class _NodeHandle> + _LIBCPP_INLINE_VISIBILITY + iterator __node_handle_insert_unique(const_iterator __hint, + _NodeHandle&& __nh); + + template <class _NodeHandle> + _LIBCPP_INLINE_VISIBILITY + iterator __node_handle_insert_multi(_NodeHandle&& __nh); + template <class _NodeHandle> + _LIBCPP_INLINE_VISIBILITY + iterator __node_handle_insert_multi(const_iterator __hint, _NodeHandle&& __nh); + + template <class _NodeHandle> + _LIBCPP_INLINE_VISIBILITY + _NodeHandle __node_handle_extract(key_type const& __key); + template <class _NodeHandle> + _LIBCPP_INLINE_VISIBILITY + _NodeHandle __node_handle_extract(const_iterator __it); +#endif + void clear() _NOEXCEPT; void rehash(size_type __n); _LIBCPP_INLINE_VISIBILITY void reserve(size_type __n) @@ -2125,6 +2160,91 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_mul } #endif // _LIBCPP_CXX03_LANG + +#if _LIBCPP_STD_VER > 14 +template <class _Tp, class _Hash, class _Equal, class _Alloc> +template <class _NodeHandle, class _InsertReturnType> +_LIBCPP_INLINE_VISIBILITY +_InsertReturnType +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique( + _NodeHandle&& __nh) +{ + if (__nh.empty()) + return _InsertReturnType{end(), false, _NodeHandle()}; + pair<iterator, bool> __result = __node_insert_unique(__nh.__ptr_); + if (__result.second) + __nh.__release(); + return _InsertReturnType{__result.first, __result.second, _VSTD::move(__nh)}; +} + +template <class _Tp, class _Hash, class _Equal, class _Alloc> +template <class _NodeHandle> +_LIBCPP_INLINE_VISIBILITY +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique( + const_iterator, _NodeHandle&& __nh) +{ + if (__nh.empty()) + return end(); + pair<iterator, bool> __result = __node_insert_unique(__nh.__ptr_); + if (__result.second) + __nh.__release(); + return __result.first; +} + +template <class _Tp, class _Hash, class _Equal, class _Alloc> +template <class _NodeHandle> +_LIBCPP_INLINE_VISIBILITY +_NodeHandle +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_extract( + key_type const& __key) +{ + iterator __i = find(__key); + if (__i == end()) + return _NodeHandle(); + return __node_handle_extract<_NodeHandle>(__i); +} + +template <class _Tp, class _Hash, class _Equal, class _Alloc> +template <class _NodeHandle> +_LIBCPP_INLINE_VISIBILITY +_NodeHandle +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_extract( + const_iterator __p) +{ + allocator_type __alloc(__node_alloc()); + return _NodeHandle(remove(__p).release(), __alloc); +} + +template <class _Tp, class _Hash, class _Equal, class _Alloc> +template <class _NodeHandle> +_LIBCPP_INLINE_VISIBILITY +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi( + _NodeHandle&& __nh) +{ + if (__nh.empty()) + return end(); + iterator __result = __node_insert_multi(__nh.__ptr_); + __nh.__release(); + return __result; +} + +template <class _Tp, class _Hash, class _Equal, class _Alloc> +template <class _NodeHandle> +_LIBCPP_INLINE_VISIBILITY +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi( + const_iterator __hint, _NodeHandle&& __nh) +{ + if (__nh.empty()) + return end(); + iterator __result = __node_insert_multi(__hint, __nh.__ptr_); + __nh.__release(); + return __result; +} + +#endif // _LIBCPP_STD_VER > 14 template <class _Tp, class _Hash, class _Equal, class _Alloc> void Modified: vendor/libc++/dist/include/__mutex_base ============================================================================== --- vendor/libc++/dist/include/__mutex_base Thu Aug 2 17:33:29 2018 (r337142) +++ vendor/libc++/dist/include/__mutex_base Thu Aug 2 17:33:33 2018 (r337143) @@ -74,7 +74,7 @@ struct _LIBCPP_TYPE_VIS defer_lock_t {}; struct _LIBCPP_TYPE_VIS try_to_lock_t {}; struct _LIBCPP_TYPE_VIS adopt_lock_t {}; -#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_MUTEX) +#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) extern const defer_lock_t defer_lock; extern const try_to_lock_t try_to_lock; Added: vendor/libc++/dist/include/__node_handle ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libc++/dist/include/__node_handle Thu Aug 2 17:33:33 2018 (r337143) @@ -0,0 +1,212 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___NODE_HANDLE +#define _LIBCPP___NODE_HANDLE + +#include <__config> +#include <memory> +#include <optional> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 14 + +#define __cpp_lib_node_extract 201606L + +// Specialized in __tree & __hash_table for their _NodeType. +template <class _NodeType, class _Alloc> +struct __generic_container_node_destructor; + +template <class _NodeType, class _Alloc, + template <class, class> class _MapOrSetSpecifics> +class _LIBCPP_TEMPLATE_VIS __basic_node_handle + : public _MapOrSetSpecifics< + _NodeType, + __basic_node_handle<_NodeType, _Alloc, _MapOrSetSpecifics>> +{ + template <class _Tp, class _Compare, class _Allocator> + friend class __tree; + template <class _Tp, class _Hash, class _Equal, class _Allocator> + friend class __hash_table; + friend struct _MapOrSetSpecifics< + _NodeType, __basic_node_handle<_NodeType, _Alloc, _MapOrSetSpecifics>>; + + typedef allocator_traits<_Alloc> __alloc_traits; + typedef typename __rebind_pointer<typename __alloc_traits::void_pointer, + _NodeType>::type + __node_pointer_type; + +public: + typedef _Alloc allocator_type; + +private: + __node_pointer_type __ptr_ = nullptr; + optional<allocator_type> __alloc_; + + _LIBCPP_INLINE_VISIBILITY + void __release() + { + __ptr_ = nullptr; + __alloc_ = _VSTD::nullopt; + } + + _LIBCPP_INLINE_VISIBILITY + void __destroy_node_pointer() + { + if (__ptr_ != nullptr) + { + typedef typename __allocator_traits_rebind< + allocator_type, _NodeType>::type __node_alloc_type; + __node_alloc_type __alloc(*__alloc_); + __generic_container_node_destructor<_NodeType, __node_alloc_type>( + __alloc, true)(__ptr_); + __ptr_ = nullptr; + } + } + + _LIBCPP_INLINE_VISIBILITY + __basic_node_handle(__node_pointer_type __ptr, + allocator_type const& __alloc) + : __ptr_(__ptr), __alloc_(__alloc) + { + } + +public: + _LIBCPP_INLINE_VISIBILITY + __basic_node_handle() = default; + + _LIBCPP_INLINE_VISIBILITY + __basic_node_handle(__basic_node_handle&& __other) noexcept + : __ptr_(__other.__ptr_), + __alloc_(_VSTD::move(__other.__alloc_)) + { + __other.__ptr_ = nullptr; + __other.__alloc_ = _VSTD::nullopt; + } + + _LIBCPP_INLINE_VISIBILITY + __basic_node_handle& operator=(__basic_node_handle&& __other) + { + _LIBCPP_ASSERT( + __alloc_ == _VSTD::nullopt || + __alloc_traits::propagate_on_container_move_assignment::value || + __alloc_ == __other.__alloc_, + "node_type with incompatible allocator passed to " + "node_type::operator=(node_type&&)"); + + __destroy_node_pointer(); + __ptr_ = __other.__ptr_; + + if (__alloc_traits::propagate_on_container_move_assignment::value || + __alloc_ == _VSTD::nullopt) + __alloc_ = _VSTD::move(__other.__alloc_); + + __other.__ptr_ = nullptr; + __other.__alloc_ = _VSTD::nullopt; + + return *this; + } + + _LIBCPP_INLINE_VISIBILITY + allocator_type get_allocator() const { return *__alloc_; } + + _LIBCPP_INLINE_VISIBILITY + explicit operator bool() const { return __ptr_ != nullptr; } + + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + bool empty() const { return __ptr_ == nullptr; } + + _LIBCPP_INLINE_VISIBILITY + void swap(__basic_node_handle& __other) noexcept( + __alloc_traits::propagate_on_container_swap::value || + __alloc_traits::is_always_equal::value) + { + using _VSTD::swap; + swap(__ptr_, __other.__ptr_); + if (__alloc_traits::propagate_on_container_swap::value || + __alloc_ == _VSTD::nullopt || __other.__alloc_ == _VSTD::nullopt) + swap(__alloc_, __other.__alloc_); + } + + _LIBCPP_INLINE_VISIBILITY + friend void swap(__basic_node_handle& __a, __basic_node_handle& __b) + noexcept(noexcept(__a.swap(__b))) { __a.swap(__b); } + + _LIBCPP_INLINE_VISIBILITY + ~__basic_node_handle() + { + __destroy_node_pointer(); + } +}; + +template <class _NodeType, class _Derived> +struct __set_node_handle_specifics +{ + typedef typename _NodeType::__node_value_type value_type; + + _LIBCPP_INLINE_VISIBILITY + value_type& value() const + { + return static_cast<_Derived const*>(this)->__ptr_->__value_; + } +}; + +template <class _NodeType, class _Derived> +struct __map_node_handle_specifics +{ + typedef typename _NodeType::__node_value_type::key_type key_type; + typedef typename _NodeType::__node_value_type::mapped_type mapped_type; + + _LIBCPP_INLINE_VISIBILITY + key_type& key() const + { + return static_cast<_Derived const*>(this)-> + __ptr_->__value_.__ref().first; + } + + _LIBCPP_INLINE_VISIBILITY + mapped_type& mapped() const + { + return static_cast<_Derived const*>(this)-> + __ptr_->__value_.__ref().second; + } +}; + +template <class _NodeType, class _Alloc> +using __set_node_handle = + __basic_node_handle< _NodeType, _Alloc, __set_node_handle_specifics>; + +template <class _NodeType, class _Alloc> +using __map_node_handle = + __basic_node_handle< _NodeType, _Alloc, __map_node_handle_specifics>; + +template <class _Iterator, class _NodeType> +_LIBCPP_TEMPLATE_VIS +struct __insert_return_type +{ + _Iterator position; + bool inserted; + _NodeType node; +}; + +#endif // _LIBCPP_STD_VER > 14 + +_LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + +#endif Modified: vendor/libc++/dist/include/__tree ============================================================================== --- vendor/libc++/dist/include/__tree Thu Aug 2 17:33:29 2018 (r337142) +++ vendor/libc++/dist/include/__tree Thu Aug 2 17:33:33 2018 (r337143) @@ -796,6 +796,16 @@ class __tree_node_destructor (public) template <class> friend class __map_node_destructor; }; +#if _LIBCPP_STD_VER > 14 +template <class _NodeType, class _Alloc> +struct __generic_container_node_destructor; +template <class _Tp, class _VoidPtr, class _Alloc> +struct __generic_container_node_destructor<__tree_node<_Tp, _VoidPtr>, _Alloc> + : __tree_node_destructor<_Alloc> +{ + using __tree_node_destructor<_Alloc>::__tree_node_destructor; +}; +#endif template <class _Tp, class _NodePtr, class _DiffType> class _LIBCPP_TEMPLATE_VIS __tree_iterator @@ -1338,6 +1348,33 @@ class __tree (public) iterator __node_insert_multi(__node_pointer __nd); iterator __node_insert_multi(const_iterator __p, __node_pointer __nd); + + _LIBCPP_INLINE_VISIBILITY iterator __remove_node_pointer(__node_pointer); + +#if _LIBCPP_STD_VER > 14 + template <class _NodeHandle, class _InsertReturnType> + _LIBCPP_INLINE_VISIBILITY + _InsertReturnType __node_handle_insert_unique(_NodeHandle&&); + template <class _NodeHandle> + _LIBCPP_INLINE_VISIBILITY + iterator __node_handle_insert_unique(const_iterator, _NodeHandle&&); + + template <class _NodeHandle> + _LIBCPP_INLINE_VISIBILITY + iterator __node_handle_insert_multi(_NodeHandle&&); + template <class _NodeHandle> + _LIBCPP_INLINE_VISIBILITY + iterator __node_handle_insert_multi(const_iterator, _NodeHandle&&); + + + template <class _NodeHandle> + _LIBCPP_INLINE_VISIBILITY + _NodeHandle __node_handle_extract(key_type const&); + template <class _NodeHandle> + _LIBCPP_INLINE_VISIBILITY + _NodeHandle __node_handle_extract(const_iterator); +#endif + iterator erase(const_iterator __p); iterator erase(const_iterator __f, const_iterator __l); template <class _Key> @@ -2347,17 +2384,138 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_multi template <class _Tp, class _Compare, class _Allocator> typename __tree<_Tp, _Compare, _Allocator>::iterator -__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p) +__tree<_Tp, _Compare, _Allocator>::__remove_node_pointer(__node_pointer __ptr) { - __node_pointer __np = __p.__get_np(); - iterator __r(__p.__ptr_); + iterator __r(__ptr); ++__r; - if (__begin_node() == __p.__ptr_) + if (__begin_node() == __ptr) __begin_node() = __r.__ptr_; --size(); - __node_allocator& __na = __node_alloc(); __tree_remove(__end_node()->__left_, - static_cast<__node_base_pointer>(__np)); + static_cast<__node_base_pointer>(__ptr)); + return __r; +} + +#if _LIBCPP_STD_VER > 14 +template <class _Tp, class _Compare, class _Allocator> +template <class _NodeHandle, class _InsertReturnType> +_LIBCPP_INLINE_VISIBILITY +_InsertReturnType +__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique( + _NodeHandle&& __nh) +{ + if (__nh.empty()) + return _InsertReturnType{end(), false, _NodeHandle()}; + + __node_pointer __ptr = __nh.__ptr_; + __parent_pointer __parent; + __node_base_pointer& __child = __find_equal(__parent, + __ptr->__value_); + if (__child != nullptr) + return _InsertReturnType{ + iterator(static_cast<__node_pointer>(__child)), + false, _VSTD::move(__nh)}; + + __insert_node_at(__parent, __child, + static_cast<__node_base_pointer>(__ptr)); + __nh.__release(); + return _InsertReturnType{iterator(__ptr), true, _NodeHandle()}; +} + +template <class _Tp, class _Compare, class _Allocator> +template <class _NodeHandle> +_LIBCPP_INLINE_VISIBILITY +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique( + const_iterator __hint, _NodeHandle&& __nh) +{ + if (__nh.empty()) + return end(); + + __node_pointer __ptr = __nh.__ptr_; + __parent_pointer __parent; + __node_base_pointer __dummy; + __node_base_pointer& __child = __find_equal(__hint, __parent, __dummy, + __ptr->__value_); + __node_pointer __r = static_cast<__node_pointer>(__child); + if (__child == nullptr) + { + __insert_node_at(__parent, __child, + static_cast<__node_base_pointer>(__ptr)); + __r = __ptr; + __nh.__release(); + } + return iterator(__r); +} + +template <class _Tp, class _Compare, class _Allocator> +template <class _NodeHandle> +_LIBCPP_INLINE_VISIBILITY +_NodeHandle +__tree<_Tp, _Compare, _Allocator>::__node_handle_extract(key_type const& __key) +{ + iterator __it = find(__key); + if (__it == end()) + return _NodeHandle(); + return __node_handle_extract<_NodeHandle>(__it); +} + +template <class _Tp, class _Compare, class _Allocator> +template <class _NodeHandle> +_LIBCPP_INLINE_VISIBILITY +_NodeHandle +__tree<_Tp, _Compare, _Allocator>::__node_handle_extract(const_iterator __p) +{ + __node_pointer __np = __p.__get_np(); + __remove_node_pointer(__np); + return _NodeHandle(__np, __alloc()); +} + +template <class _Tp, class _Compare, class _Allocator> +template <class _NodeHandle> +_LIBCPP_INLINE_VISIBILITY +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(_NodeHandle&& __nh) +{ + if (__nh.empty()) + return end(); + __node_pointer __ptr = __nh.__ptr_; + __parent_pointer __parent; + __node_base_pointer& __child = __find_leaf_high( + __parent, _NodeTypes::__get_key(__ptr->__value_)); + __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr)); + __nh.__release(); + return iterator(__ptr); +} + +template <class _Tp, class _Compare, class _Allocator> +template <class _NodeHandle> +_LIBCPP_INLINE_VISIBILITY +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi( + const_iterator __hint, _NodeHandle&& __nh) +{ + if (__nh.empty()) + return end(); + + __node_pointer __ptr = __nh.__ptr_; + __parent_pointer __parent; + __node_base_pointer& __child = __find_leaf(__hint, __parent, + _NodeTypes::__get_key(__ptr->__value_)); + __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr)); + __nh.__release(); + return iterator(__ptr); +} + +#endif // _LIBCPP_STD_VER > 14 + +template <class _Tp, class _Compare, class _Allocator> +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p) +{ + __node_pointer __np = __p.__get_np(); + iterator __r = __remove_node_pointer(__np); + __node_allocator& __na = __node_alloc(); __node_traits::destroy(__na, _NodeTypes::__get_ptr( const_cast<__node_value_type&>(*__p))); __node_traits::deallocate(__na, __np, 1); Modified: vendor/libc++/dist/include/cfloat ============================================================================== --- vendor/libc++/dist/include/cfloat Thu Aug 2 17:33:29 2018 (r337142) +++ vendor/libc++/dist/include/cfloat Thu Aug 2 17:33:33 2018 (r337143) @@ -20,11 +20,18 @@ Macros: FLT_EVAL_METHOD // C99 FLT_RADIX + FLT_HAS_SUBNORM // C11 + DBL_HAS_SUBNORM // C11 + LDBL_HAS_SUBNORM // C11 + FLT_MANT_DIG DBL_MANT_DIG LDBL_MANT_DIG DECIMAL_DIG // C99 + FLT_DECIMAL_DIG // C11 + DBL_DECIMAL_DIG // C11 + LDBL_DECIMAL_DIG // C11 FLT_DIG DBL_DIG @@ -58,6 +65,9 @@ Macros: DBL_MIN LDBL_MIN + FLT_TRUE_MIN // C11 + DBL_TRUE_MIN // C11 + LDBL_TRUE_MIN // C11 */ #include <__config> Added: vendor/libc++/dist/include/charconv ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libc++/dist/include/charconv Thu Aug 2 17:33:33 2018 (r337143) @@ -0,0 +1,610 @@ +// -*- C++ -*- +//===------------------------------ charconv ------------------------------===// +// +// 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 _LIBCPP_CHARCONV +#define _LIBCPP_CHARCONV + +/* + charconv synopsis + +namespace std { + + // floating-point format for primitive numerical conversion + enum class chars_format { + scientific = unspecified, + fixed = unspecified, + hex = unspecified, + general = fixed | scientific + }; + + // 23.20.2, primitive numerical output conversion + struct to_chars_result { + char* ptr; + errc ec; + }; + + to_chars_result to_chars(char* first, char* last, see below value, + int base = 10); + + to_chars_result to_chars(char* first, char* last, float value); + to_chars_result to_chars(char* first, char* last, double value); + to_chars_result to_chars(char* first, char* last, long double value); + + to_chars_result to_chars(char* first, char* last, float value, + chars_format fmt); + to_chars_result to_chars(char* first, char* last, double value, + chars_format fmt); + to_chars_result to_chars(char* first, char* last, long double value, + chars_format fmt); + + to_chars_result to_chars(char* first, char* last, float value, + chars_format fmt, int precision); + to_chars_result to_chars(char* first, char* last, double value, + chars_format fmt, int precision); + to_chars_result to_chars(char* first, char* last, long double value, + chars_format fmt, int precision); + + // 23.20.3, primitive numerical input conversion + struct from_chars_result { + const char* ptr; + errc ec; + }; + + from_chars_result from_chars(const char* first, const char* last, + see below& value, int base = 10); + + from_chars_result from_chars(const char* first, const char* last, + float& value, + chars_format fmt = chars_format::general); + from_chars_result from_chars(const char* first, const char* last, + double& value, + chars_format fmt = chars_format::general); + from_chars_result from_chars(const char* first, const char* last, + long double& value, + chars_format fmt = chars_format::general); + +} // namespace std + +*/ + +#include <__errc> +#include <type_traits> +#include <limits> +#include <stdint.h> +#include <string.h> +#include <math.h> + +#include <__debug> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 11 + +enum class _LIBCPP_ENUM_VIS chars_format +{ + scientific = 0x1, + fixed = 0x2, + hex = 0x4, + general = fixed | scientific +}; + +struct _LIBCPP_TYPE_VIS to_chars_result +{ + char* ptr; + errc ec; +}; + +struct _LIBCPP_TYPE_VIS from_chars_result +{ + const char* ptr; + errc ec; +}; + +void to_chars(char*, char*, bool, int = 10) = delete; +void from_chars(const char*, const char*, bool, int = 10) = delete; + +namespace __itoa +{ + +static constexpr uint64_t __pow10_64[] = { + UINT64_C(0), + UINT64_C(10), + UINT64_C(100), + UINT64_C(1000), + UINT64_C(10000), + UINT64_C(100000), + UINT64_C(1000000), + UINT64_C(10000000), + UINT64_C(100000000), + UINT64_C(1000000000), + UINT64_C(10000000000), + UINT64_C(100000000000), + UINT64_C(1000000000000), + UINT64_C(10000000000000), + UINT64_C(100000000000000), + UINT64_C(1000000000000000), + UINT64_C(10000000000000000), + UINT64_C(100000000000000000), + UINT64_C(1000000000000000000), + UINT64_C(10000000000000000000), +}; + +static constexpr uint32_t __pow10_32[] = { + UINT32_C(0), UINT32_C(10), UINT32_C(100), + UINT32_C(1000), UINT32_C(10000), UINT32_C(100000), + UINT32_C(1000000), UINT32_C(10000000), UINT32_C(100000000), + UINT32_C(1000000000), +}; + +_LIBCPP_FUNC_VIS char* __u64toa(uint64_t __value, char* __buffer); +_LIBCPP_FUNC_VIS char* __u32toa(uint32_t __value, char* __buffer); + +template <typename _Tp, typename = void> +struct _LIBCPP_HIDDEN __traits_base +{ + using type = uint64_t; + +#if !defined(_LIBCPP_COMPILER_MSVC) + static _LIBCPP_INLINE_VISIBILITY int __width(_Tp __v) + { + auto __t = (64 - __builtin_clzll(__v | 1)) * 1233 >> 12; + return __t - (__v < __pow10_64[__t]) + 1; + } +#endif + + static _LIBCPP_INLINE_VISIBILITY char* __convert(_Tp __v, char* __p) + { + return __u64toa(__v, __p); + } + + static _LIBCPP_INLINE_VISIBILITY auto& __pow() { return __pow10_64; } +}; + +template <typename _Tp> +struct _LIBCPP_HIDDEN + __traits_base<_Tp, decltype(void(uint32_t{declval<_Tp>()}))> +{ + using type = uint32_t; + +#if !defined(_LIBCPP_COMPILER_MSVC) + static _LIBCPP_INLINE_VISIBILITY int __width(_Tp __v) + { + auto __t = (32 - __builtin_clz(__v | 1)) * 1233 >> 12; + return __t - (__v < __pow10_32[__t]) + 1; + } +#endif + + static _LIBCPP_INLINE_VISIBILITY char* __convert(_Tp __v, char* __p) + { + return __u32toa(__v, __p); + } + + static _LIBCPP_INLINE_VISIBILITY auto& __pow() { return __pow10_32; } +}; + +template <typename _Tp> +inline _LIBCPP_INLINE_VISIBILITY bool +__mul_overflowed(unsigned char __a, _Tp __b, unsigned char& __r) +{ + auto __c = __a * __b; + __r = __c; + return __c > (numeric_limits<unsigned char>::max)(); +} + +template <typename _Tp> +inline _LIBCPP_INLINE_VISIBILITY bool +__mul_overflowed(unsigned short __a, _Tp __b, unsigned short& __r) +{ + auto __c = __a * __b; + __r = __c; + return __c > (numeric_limits<unsigned short>::max)(); +} + +template <typename _Tp> +inline _LIBCPP_INLINE_VISIBILITY bool +__mul_overflowed(_Tp __a, _Tp __b, _Tp& __r) +{ + static_assert(is_unsigned<_Tp>::value, ""); +#if !defined(_LIBCPP_COMPILER_MSVC) + return __builtin_mul_overflow(__a, __b, &__r); +#else + bool __did = __b && ((numeric_limits<_Tp>::max)() / __b) < __a; + __r = __a * __b; + return __did; +#endif +} + +template <typename _Tp, typename _Up> +inline _LIBCPP_INLINE_VISIBILITY bool +__mul_overflowed(_Tp __a, _Up __b, _Tp& __r) +{ + return __mul_overflowed(__a, static_cast<_Tp>(__b), __r); +} + +template <typename _Tp> +struct _LIBCPP_HIDDEN __traits : __traits_base<_Tp> +{ + static constexpr int digits = numeric_limits<_Tp>::digits10 + 1; + using __traits_base<_Tp>::__pow; + using typename __traits_base<_Tp>::type; + + // precondition: at least one non-zero character available + static _LIBCPP_INLINE_VISIBILITY char const* + __read(char const* __p, char const* __ep, type& __a, type& __b) + { + type __cprod[digits]; + int __j = digits - 1; + int __i = digits; + do + { + if (!('0' <= *__p && *__p <= '9')) + break; + __cprod[--__i] = *__p++ - '0'; + } while (__p != __ep && __i != 0); + + __a = __inner_product(__cprod + __i + 1, __cprod + __j, __pow() + 1, + __cprod[__i]); + if (__mul_overflowed(__cprod[__j], __pow()[__j - __i], __b)) + --__p; + return __p; + } + + template <typename _It1, typename _It2, class _Up> + static _LIBCPP_INLINE_VISIBILITY _Up + __inner_product(_It1 __first1, _It1 __last1, _It2 __first2, _Up __init) + { + for (; __first1 < __last1; ++__first1, ++__first2) + __init = __init + *__first1 * *__first2; + return __init; + } +}; + +} // namespace __itoa + +template <typename _Tp> +inline _LIBCPP_INLINE_VISIBILITY _Tp +__complement(_Tp __x) +{ + static_assert(is_unsigned<_Tp>::value, "cast to unsigned first"); + return _Tp(~__x + 1); +} + +template <typename _Tp> +inline _LIBCPP_INLINE_VISIBILITY auto +__to_unsigned(_Tp __x) +{ + return static_cast<make_unsigned_t<_Tp>>(__x); +} + +template <typename _Tp> +inline _LIBCPP_INLINE_VISIBILITY to_chars_result +__to_chars_itoa(char* __first, char* __last, _Tp __value, true_type) +{ + auto __x = __to_unsigned(__value); + if (__value < 0 && __first != __last) + { + *__first++ = '-'; + __x = __complement(__x); + } + + return __to_chars_itoa(__first, __last, __x, false_type()); +} + +template <typename _Tp> +inline _LIBCPP_INLINE_VISIBILITY to_chars_result +__to_chars_itoa(char* __first, char* __last, _Tp __value, false_type) +{ + using __tx = __itoa::__traits<_Tp>; + auto __diff = __last - __first; + +#if !defined(_LIBCPP_COMPILER_MSVC) + if (__tx::digits <= __diff || __tx::__width(__value) <= __diff) + return {__tx::__convert(__value, __first), {}}; + else + return {__last, errc::value_too_large}; +#else + if (__tx::digits <= __diff) + return {__tx::__convert(__value, __first), {}}; + else + { + char __buf[__tx::digits]; + auto __p = __tx::__convert(__value, __buf); + auto __len = __p - __buf; + if (__len <= __diff) + { + memcpy(__first, __buf, __len); + return {__first + __len, {}}; + } + else + return {__last, errc::value_too_large}; + } +#endif +} + +template <typename _Tp> +inline _LIBCPP_INLINE_VISIBILITY to_chars_result +__to_chars_integral(char* __first, char* __last, _Tp __value, int __base, + true_type) +{ + auto __x = __to_unsigned(__value); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808021733.w72HXY3u029552>