authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-07-19 16:55:59-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-07-19 16:55:59-04:00
log70e05c67ce6f044b5b99e01a5d972bbe92c38344
tree6f13ca6ee7147f053b88d33e62bfdd1e284d9019
parentdab0cf6428d96af540399563f2e2d5a79c3a7d5e
signaturelock-open Commit is signed but in an unrecognized format.

update libcxx to llvm9

upstream commit 1931d3cb20a00da732c5210b123656632982fde0

181 files changed, 5576 insertions(+), 4763 deletions(-)

lib/libcxx/include/__bit_reference+17-18
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------------------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -69,7 +68,7 @@ public:
6968
7069 _LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {*__seg_ ^= __mask_;}
7170 _LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, false> operator&() const _NOEXCEPT
72 {return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
71 {return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(__libcpp_ctz(__mask_)));}
7372private:
7473 _LIBCPP_INLINE_VISIBILITY
7574 __bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
......@@ -141,7 +140,7 @@ public:
141140 {return static_cast<bool>(*__seg_ & __mask_);}
142141
143142 _LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, true> operator&() const _NOEXCEPT
144 {return __bit_iterator<_Cp, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
143 {return __bit_iterator<_Cp, true>(__seg_, static_cast<unsigned>(__libcpp_ctz(__mask_)));}
145144private:
146145 _LIBCPP_INLINE_VISIBILITY
147146 _LIBCPP_CONSTEXPR
......@@ -168,7 +167,7 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
168167 __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
169168 __storage_type __b = *__first.__seg_ & __m;
170169 if (__b)
171 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
170 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__libcpp_ctz(__b)));
172171 if (__n == __dn)
173172 return __first + __n;
174173 __n -= __dn;
......@@ -177,14 +176,14 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
177176 // do middle whole words
178177 for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
179178 if (*__first.__seg_)
180 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(*__first.__seg_)));
179 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__libcpp_ctz(*__first.__seg_)));
181180 // do last partial word
182181 if (__n > 0)
183182 {
184183 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
185184 __storage_type __b = *__first.__seg_ & __m;
186185 if (__b)
187 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
186 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__libcpp_ctz(__b)));
188187 }
189188 return _It(__first.__seg_, static_cast<unsigned>(__n));
190189}
......@@ -204,7 +203,7 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
204203 __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
205204 __storage_type __b = ~*__first.__seg_ & __m;
206205 if (__b)
207 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
206 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__libcpp_ctz(__b)));
208207 if (__n == __dn)
209208 return __first + __n;
210209 __n -= __dn;
......@@ -215,7 +214,7 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
215214 {
216215 __storage_type __b = ~*__first.__seg_;
217216 if (__b)
218 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
217 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__libcpp_ctz(__b)));
219218 }
220219 // do last partial word
221220 if (__n > 0)
......@@ -223,7 +222,7 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
223222 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
224223 __storage_type __b = ~*__first.__seg_ & __m;
225224 if (__b)
226 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
225 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__libcpp_ctz(__b)));
227226 }
228227 return _It(__first.__seg_, static_cast<unsigned>(__n));
229228}
......@@ -255,18 +254,18 @@ __count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
255254 __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
256255 __storage_type __dn = _VSTD::min(__clz_f, __n);
257256 __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
258 __r = _VSTD::__popcount(*__first.__seg_ & __m);
257 __r = _VSTD::__libcpp_popcount(*__first.__seg_ & __m);
259258 __n -= __dn;
260259 ++__first.__seg_;
261260 }
262261 // do middle whole words
263262 for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
264 __r += _VSTD::__popcount(*__first.__seg_);
263 __r += _VSTD::__libcpp_popcount(*__first.__seg_);
265264 // do last partial word
266265 if (__n > 0)
267266 {
268267 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
269 __r += _VSTD::__popcount(*__first.__seg_ & __m);
268 __r += _VSTD::__libcpp_popcount(*__first.__seg_ & __m);
270269 }
271270 return __r;
272271}
......@@ -286,18 +285,18 @@ __count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_typ
286285 __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
287286 __storage_type __dn = _VSTD::min(__clz_f, __n);
288287 __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
289 __r = _VSTD::__popcount(~*__first.__seg_ & __m);
288 __r = _VSTD::__libcpp_popcount(~*__first.__seg_ & __m);
290289 __n -= __dn;
291290 ++__first.__seg_;
292291 }
293292 // do middle whole words
294293 for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
295 __r += _VSTD::__popcount(~*__first.__seg_);
294 __r += _VSTD::__libcpp_popcount(~*__first.__seg_);
296295 // do last partial word
297296 if (__n > 0)
298297 {
299298 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
300 __r += _VSTD::__popcount(~*__first.__seg_ & __m);
299 __r += _VSTD::__libcpp_popcount(~*__first.__seg_ & __m);
301300 }
302301 return __r;
303302}
lib/libcxx/include/__bsd_locale_defaults.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------- __bsd_locale_defaults.h -----------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109// The BSDs have lots of *_l functions. We don't want to define those symbols
lib/libcxx/include/__bsd_locale_fallbacks.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------- __bsd_locale_fallbacks.h ----------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109// The BSDs have lots of *_l functions. This file provides reimplementations
lib/libcxx/include/__config+130-157
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- __config ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -33,12 +32,16 @@
3332# define _GNUC_VER_NEW 0
3433#endif
3534
36#define _LIBCPP_VERSION 8000
35#define _LIBCPP_VERSION 9000
3736
3837#ifndef _LIBCPP_ABI_VERSION
3938# define _LIBCPP_ABI_VERSION 1
4039#endif
4140
41#ifndef __STDC_HOSTED__
42# define _LIBCPP_FREESTANDING
43#endif
44
4245#ifndef _LIBCPP_STD_VER
4346# if __cplusplus <= 201103L
4447# define _LIBCPP_STD_VER 11
......@@ -93,10 +96,12 @@
9396// Enable optimized version of __do_get_(un)signed which avoids redundant copies.
9497# define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
9598// Use the smallest possible integer type to represent the index of the variant.
96// Previously libc++ used "unsigned int" exclusivly.
99// Previously libc++ used "unsigned int" exclusively.
97100# define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
98101// Unstable attempt to provide a more optimized std::function
99102# define _LIBCPP_ABI_OPTIMIZED_FUNCTION
103// All the regex constants must be distinct and nonzero.
104# define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
100105#elif _LIBCPP_ABI_VERSION == 1
101106# if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
102107// Enable compiling copies of now inline methods into the dylib to support
......@@ -182,6 +187,10 @@
182187#define _LIBCPP_CLANG_VER 0
183188#endif
184189
190#if defined(_LIBCPP_COMPILER_GCC) && __cplusplus < 201103L
191#error "libc++ does not support using GCC with C++03. Please enable C++11"
192#endif
193
185194// FIXME: ABI detection should be done via compiler builtin macros. This
186195// is just a placeholder until Clang implements such macros. For now assume
187196// that Windows compilers pretending to be MSVC++ target the Microsoft ABI,
......@@ -201,6 +210,10 @@
201210# endif
202211#endif
203212
213#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)
214# define _LIBCPP_ABI_VCRUNTIME
215#endif
216
204217// Need to detect which libc we're using if we're on Linux.
205218#if defined(__linux__)
206219# include <features.h>
......@@ -257,7 +270,7 @@
257270# define _LIBCPP_WIN32API
258271# define _LIBCPP_LITTLE_ENDIAN
259272# define _LIBCPP_SHORT_WCHAR 1
260// Both MinGW and native MSVC provide a "MSVC"-like enviroment
273// Both MinGW and native MSVC provide a "MSVC"-like environment
261274# define _LIBCPP_MSVCRT_LIKE
262275// If mingw not explicitly detected, assume using MS C runtime only if
263276// a MS compatibility version is specified.
......@@ -298,7 +311,7 @@
298311 // random data even when using sandboxing mechanisms such as chroots,
299312 // Capsicum, etc.
300313# define _LIBCPP_USING_ARC4_RANDOM
301#elif defined(__Fuchsia__)
314#elif defined(__Fuchsia__) || defined(__wasi__)
302315# define _LIBCPP_USING_GETENTROPY
303316#elif defined(__native_client__)
304317 // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
......@@ -332,7 +345,7 @@
332345# if defined(__FreeBSD__)
333346# define _LIBCPP_HAS_QUICK_EXIT
334347# define _LIBCPP_HAS_C11_FEATURES
335# elif defined(__Fuchsia__)
348# elif defined(__Fuchsia__) || defined(__wasi__)
336349# define _LIBCPP_HAS_QUICK_EXIT
337350# define _LIBCPP_HAS_TIMESPEC_GET
338351# define _LIBCPP_HAS_C11_FEATURES
......@@ -400,10 +413,6 @@ typedef __char32_t char32_t;
400413#define _LIBCPP_HAS_NO_STRONG_ENUMS
401414#endif
402415
403#if !(__has_feature(cxx_decltype))
404#define _LIBCPP_HAS_NO_DECLTYPE
405#endif
406
407416#if __has_feature(cxx_attributes)
408417# define _LIBCPP_NORETURN [[noreturn]]
409418#else
......@@ -434,18 +443,6 @@ typedef __char32_t char32_t;
434443#define _LIBCPP_HAS_NO_VARIADICS
435444#endif
436445
437#if !(__has_feature(cxx_generalized_initializers))
438#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
439#endif
440
441#if __has_feature(is_base_of)
442#define _LIBCPP_HAS_IS_BASE_OF
443#endif
444
445#if __has_feature(is_final)
446#define _LIBCPP_HAS_IS_FINAL
447#endif
448
449446// Objective-C++ features (opt-in)
450447#if __has_feature(objc_arc)
451448#define _LIBCPP_HAS_OBJC_ARC
......@@ -455,10 +452,6 @@ typedef __char32_t char32_t;
455452#define _LIBCPP_HAS_OBJC_ARC_WEAK
456453#endif
457454
458#if !(__has_feature(cxx_constexpr))
459#define _LIBCPP_HAS_NO_CONSTEXPR
460#endif
461
462455#if !(__has_feature(cxx_relaxed_constexpr))
463456#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
464457#endif
......@@ -471,14 +464,6 @@ typedef __char32_t char32_t;
471464#define _LIBCPP_HAS_NO_NOEXCEPT
472465#endif
473466
474#if __has_feature(underlying_type)
475#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
476#endif
477
478#if __has_feature(is_literal)
479#define _LIBCPP_IS_LITERAL(T) __is_literal(T)
480#endif
481
482467#if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
483468#define _LIBCPP_HAS_NO_ASAN
484469#endif
......@@ -510,69 +495,20 @@ typedef __char32_t char32_t;
510495
511496#define _LIBCPP_NORETURN __attribute__((noreturn))
512497
513#if _GNUC_VER >= 407
514#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
515#define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
516#define _LIBCPP_HAS_IS_FINAL
517#endif
518
519#if defined(__GNUC__) && _GNUC_VER >= 403
520#define _LIBCPP_HAS_IS_BASE_OF
521#endif
522
523498#if !__EXCEPTIONS && !defined(_LIBCPP_NO_EXCEPTIONS)
524499#define _LIBCPP_NO_EXCEPTIONS
525500#endif
526501
527// constexpr was added to GCC in 4.6.
528#if _GNUC_VER < 406
529# define _LIBCPP_HAS_NO_CONSTEXPR
530// Can only use constexpr in c++11 mode.
531#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
532# define _LIBCPP_HAS_NO_CONSTEXPR
533#endif
534
535502// Determine if GCC supports relaxed constexpr
536503#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
537504#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
538505#endif
539506
540// GCC 5 will support variable templates
507// GCC 5 supports variable templates
541508#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
542509#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
543510#endif
544511
545#ifndef __GXX_EXPERIMENTAL_CXX0X__
546
547#define _LIBCPP_HAS_NO_DECLTYPE
548#define _LIBCPP_HAS_NO_NULLPTR
549#define _LIBCPP_HAS_NO_UNICODE_CHARS
550#define _LIBCPP_HAS_NO_VARIADICS
551#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
552#define _LIBCPP_HAS_NO_STRONG_ENUMS
553#define _LIBCPP_HAS_NO_NOEXCEPT
554
555#else // __GXX_EXPERIMENTAL_CXX0X__
556
557#if _GNUC_VER < 403
558#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
559#endif
560
561
562#if _GNUC_VER < 404
563#define _LIBCPP_HAS_NO_DECLTYPE
564#define _LIBCPP_HAS_NO_UNICODE_CHARS
565#define _LIBCPP_HAS_NO_VARIADICS
566#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
567#endif // _GNUC_VER < 404
568
569#if _GNUC_VER < 406
570#define _LIBCPP_HAS_NO_NOEXCEPT
571#define _LIBCPP_HAS_NO_NULLPTR
572#endif
573
574#endif // __GXX_EXPERIMENTAL_CXX0X__
575
576512#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
577513#define _LIBCPP_HAS_NO_ASAN
578514#endif
......@@ -597,16 +533,12 @@ typedef __char32_t char32_t;
597533#error "MSVC versions prior to Visual Studio 2015 are not supported"
598534#endif
599535
600#define _LIBCPP_HAS_IS_BASE_OF
601#define _LIBCPP_HAS_NO_CONSTEXPR
602536#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
603537#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
604#define _LIBCPP_HAS_NO_NOEXCEPT
605538#define __alignof__ __alignof
606539#define _LIBCPP_NORETURN __declspec(noreturn)
607540#define _ALIGNAS(x) __declspec(align(x))
608541#define _ALIGNAS_TYPE(x) alignas(x)
609#define _LIBCPP_HAS_NO_VARIADICS
610542
611543#define _LIBCPP_WEAK
612544
......@@ -623,12 +555,7 @@ typedef __char32_t char32_t;
623555#define _ATTRIBUTE(x) __attribute__((x))
624556#define _LIBCPP_NORETURN __attribute__((noreturn))
625557
626#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
627#define _LIBCPP_HAS_NO_NOEXCEPT
628#define _LIBCPP_HAS_NO_NULLPTR
629558#define _LIBCPP_HAS_NO_UNICODE_CHARS
630#define _LIBCPP_HAS_IS_BASE_OF
631#define _LIBCPP_HAS_IS_FINAL
632559#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
633560
634561#if defined(_AIX)
......@@ -659,8 +586,13 @@ typedef __char32_t char32_t;
659586# define _LIBCPP_EXPORTED_FROM_ABI
660587#elif defined(_LIBCPP_BUILDING_LIBRARY)
661588# define _LIBCPP_DLL_VIS __declspec(dllexport)
662# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
663# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS
589# if defined(__MINGW32__)
590# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS
591# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
592# else
593# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
594# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS
595# endif
664596# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS
665597# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport)
666598#else
......@@ -777,7 +709,7 @@ typedef __char32_t char32_t;
777709#else
778710 // Try to approximate the effect of exclude_from_explicit_instantiation
779711 // (which is that entities are not assumed to be provided by explicit
780 // template instantitations in the dylib) by always inlining those entities.
712 // template instantiations in the dylib) by always inlining those entities.
781713# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE
782714#endif
783715
......@@ -789,6 +721,16 @@ typedef __char32_t char32_t;
789721# endif
790722#endif
791723
724#ifndef _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT
725# ifdef _LIBCPP_OBJECT_FORMAT_COFF // Windows binaries can't merge typeinfos.
726# define _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT 0
727#else
728// TODO: This isn't strictly correct on ELF platforms due to llvm.org/PR37398
729// And we should consider defaulting to OFF.
730# define _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT 1
731#endif
732#endif
733
792734#ifndef _LIBCPP_HIDE_FROM_ABI
793735# if _LIBCPP_HIDE_FROM_ABI_PER_TU
794736# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE
......@@ -843,22 +785,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
843785# define _NOEXCEPT_(x)
844786#endif
845787
846#if defined(_LIBCPP_DEBUG_USE_EXCEPTIONS)
847# if !defined(_LIBCPP_DEBUG)
848# error cannot use _LIBCPP_DEBUG_USE_EXCEPTIONS unless _LIBCPP_DEBUG is defined
849# endif
850# ifdef _LIBCPP_HAS_NO_NOEXCEPT
851# define _NOEXCEPT_DEBUG
852# define _NOEXCEPT_DEBUG_(x)
853# else
854# define _NOEXCEPT_DEBUG noexcept(false)
855# define _NOEXCEPT_DEBUG_(x) noexcept(false)
856# endif
857#else
858# define _NOEXCEPT_DEBUG _NOEXCEPT
859# define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x)
860#endif
861
862788#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
863789typedef unsigned short char16_t;
864790typedef unsigned int char32_t;
......@@ -869,30 +795,11 @@ typedef unsigned int char32_t;
869795#endif
870796
871797#ifdef _LIBCPP_CXX03_LANG
872# if __has_extension(c_static_assert)
873# define static_assert(__b, __m) _Static_assert(__b, __m)
874# else
875extern "C++" {
876template <bool> struct __static_assert_test;
877template <> struct __static_assert_test<true> {};
878template <unsigned> struct __static_assert_check {};
879}
880# define static_assert(__b, __m) \
881 typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
882 _LIBCPP_CONCAT(__t, __LINE__)
883# endif // __has_extension(c_static_assert)
798# define static_assert(...) _Static_assert(__VA_ARGS__)
799# define decltype(...) __decltype(__VA_ARGS__)
884800#endif // _LIBCPP_CXX03_LANG
885801
886#ifdef _LIBCPP_HAS_NO_DECLTYPE
887// GCC 4.6 provides __decltype in all standard modes.
888# if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406
889# define decltype(__x) __decltype(__x)
890# else
891# define decltype(__x) __typeof__(__x)
892# endif
893#endif
894
895#ifdef _LIBCPP_HAS_NO_CONSTEXPR
802#ifdef _LIBCPP_CXX03_LANG
896803# define _LIBCPP_CONSTEXPR
897804#else
898805# define _LIBCPP_CONSTEXPR constexpr
......@@ -911,9 +818,9 @@ template <unsigned> struct __static_assert_check {};
911818#endif
912819
913820#ifdef __GNUC__
914# define _NOALIAS __attribute__((__malloc__))
821# define _LIBCPP_NOALIAS __attribute__((__malloc__))
915822#else
916# define _NOALIAS
823# define _LIBCPP_NOALIAS
917824#endif
918825
919826#if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__) || \
......@@ -966,10 +873,6 @@ template <unsigned> struct __static_assert_check {};
966873#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
967874#endif
968875
969#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
970#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
971#endif
972
973876#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || \
974877 defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
975878#define _LIBCPP_LOCALE__L_EXTENSIONS 1
......@@ -990,13 +893,10 @@ template <unsigned> struct __static_assert_check {};
990893// for align_val_t were added in 19.12, aka VS 2017 version 15.3.
991894#if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912
992895# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
993#elif defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)
994# define _LIBCPP_DEFER_NEW_TO_VCRUNTIME
995# if !defined(__cpp_aligned_new)
996 // We're defering to Microsoft's STL to provide aligned new et al. We don't
997 // have it unless the language feature test macro is defined.
998# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
999# endif
896#elif defined(_LIBCPP_ABI_VCRUNTIME) && !defined(__cpp_aligned_new)
897 // We're deferring to Microsoft's STL to provide aligned new et al. We don't
898 // have it unless the language feature test macro is defined.
899# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
1000900#endif
1001901
1002902#if defined(__APPLE__)
......@@ -1025,8 +925,10 @@ template <unsigned> struct __static_assert_check {};
1025925#endif
1026926
1027927// Deprecation macros.
1028// Deprecations warnings are only enabled when _LIBCPP_ENABLE_DEPRECATION_WARNINGS is defined.
1029#if defined(_LIBCPP_ENABLE_DEPRECATION_WARNINGS)
928//
929// Deprecations warnings are always enabled, except when users explicitly opt-out
930// by defining _LIBCPP_DISABLE_DEPRECATION_WARNINGS.
931#if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS)
1030932# if __has_attribute(deprecated)
1031933# define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
1032934# elif _LIBCPP_STD_VER > 11
......@@ -1128,6 +1030,12 @@ template <unsigned> struct __static_assert_check {};
11281030#endif
11291031#endif
11301032
1033#if __has_attribute(no_destroy)
1034# define _LIBCPP_NO_DESTROY __attribute__((__no_destroy__))
1035#else
1036# define _LIBCPP_NO_DESTROY
1037#endif
1038
11311039#ifndef _LIBCPP_HAS_NO_ASAN
11321040_LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
11331041 const void *, const void *, const void *, const void *);
......@@ -1158,6 +1066,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
11581066 !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
11591067# if defined(__FreeBSD__) || \
11601068 defined(__Fuchsia__) || \
1069 defined(__wasi__) || \
11611070 defined(__NetBSD__) || \
11621071 defined(__linux__) || \
11631072 defined(__GNU__) || \
......@@ -1188,6 +1097,23 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
11881097 _LIBCPP_HAS_NO_THREADS is defined.
11891098#endif
11901099
1100// The Apple, glibc, and Bionic implementation of pthreads implements
1101// pthread_mutex_destroy as nop for regular mutexes. Additionally, Win32
1102// mutexes have no destroy mechanism.
1103// TODO(EricWF): Enable this optimization on Apple and Bionic platforms after
1104// speaking to their respective stakeholders.
1105#if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) \
1106 || defined(_LIBCPP_HAS_THREAD_API_WIN32)
1107# define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION
1108#endif
1109
1110// Destroying a condvar is a nop on Windows.
1111// TODO(EricWF): This is potentially true for some pthread implementations
1112// as well.
1113#if defined(_LIBCPP_HAS_THREAD_API_WIN32)
1114# define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION
1115#endif
1116
11911117// Systems that use capability-based security (FreeBSD with Capsicum,
11921118// Nuxi CloudABI) may only provide local filesystem access (using *at()).
11931119// Functions like open(), rename(), unlink() and stat() should not be
......@@ -1204,7 +1130,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
12041130#endif
12051131
12061132#if defined(__BIONIC__) || defined(__CloudABI__) || \
1207 defined(__Fuchsia__) || defined(_LIBCPP_HAS_MUSL_LIBC)
1133 defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC)
12081134#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
12091135#endif
12101136
......@@ -1216,13 +1142,22 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
12161142
12171143#if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)
12181144# define _LIBCPP_HAS_C_ATOMIC_IMP
1219#elif _GNUC_VER > 407
1145#elif defined(_LIBCPP_COMPILER_GCC)
12201146# define _LIBCPP_HAS_GCC_ATOMIC_IMP
12211147#endif
12221148
1223#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
1149#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && \
1150 !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) && \
1151 !defined(_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP)) \
12241152 || defined(_LIBCPP_HAS_NO_THREADS)
1225#define _LIBCPP_HAS_NO_ATOMIC_HEADER
1153# define _LIBCPP_HAS_NO_ATOMIC_HEADER
1154#else
1155# ifndef _LIBCPP_ATOMIC_FLAG_TYPE
1156# define _LIBCPP_ATOMIC_FLAG_TYPE bool
1157# endif
1158# ifdef _LIBCPP_FREESTANDING
1159# define _LIBCPP_ATOMIC_ONLY_USE_BUILTINS
1160# endif
12261161#endif
12271162
12281163#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
......@@ -1250,6 +1185,10 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
12501185#define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
12511186#endif
12521187
1188#if !__has_builtin(__builtin_is_constant_evaluated) && _GNUC_VER < 900
1189#define _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
1190#endif
1191
12531192#if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
12541193# if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION)
12551194# define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS
......@@ -1277,6 +1216,21 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
12771216# define _LIBCPP_FALLTHROUGH() ((void)0)
12781217#endif
12791218
1219#if __has_attribute(__nodebug__)
1220#define _LIBCPP_NODEBUG __attribute__((__nodebug__))
1221#else
1222#define _LIBCPP_NODEBUG
1223#endif
1224
1225#ifndef _LIBCPP_NODEBUG_TYPE
1226#if __has_attribute(__nodebug__) && \
1227 (defined(_LIBCPP_COMPILER_CLANG) && _LIBCPP_CLANG_VER >= 900)
1228#define _LIBCPP_NODEBUG_TYPE __attribute__((nodebug))
1229#else
1230#define _LIBCPP_NODEBUG_TYPE
1231#endif
1232#endif // !defined(_LIBCPP_NODEBUG_TYPE)
1233
12801234#if defined(_LIBCPP_ABI_MICROSOFT) && \
12811235 (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))
12821236# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
......@@ -1312,7 +1266,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
13121266#if !defined(_LIBCPP_BUILDING_LIBRARY) && \
13131267 !defined(_LIBCPP_DISABLE_AVAILABILITY) && \
13141268 __has_feature(attribute_availability_with_strict) && \
1315 __has_feature(attribute_availability_in_templates)
1269 __has_feature(attribute_availability_in_templates) && \
1270 __has_extension(pragma_clang_attribute_external_declaration)
13161271# ifdef __APPLE__
13171272# define _LIBCPP_USE_AVAILABILITY_APPLE
13181273# endif
......@@ -1355,6 +1310,21 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
13551310# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \
13561311 __attribute__((availability(macosx,strict,introduced=10.9))) \
13571312 __attribute__((availability(ios,strict,introduced=7.0)))
1313# define _LIBCPP_AVAILABILITY_FILESYSTEM \
1314 __attribute__((availability(macosx,strict,introduced=10.15))) \
1315 __attribute__((availability(ios,strict,introduced=13.0))) \
1316 __attribute__((availability(tvos,strict,introduced=13.0))) \
1317 __attribute__((availability(watchos,strict,introduced=6.0)))
1318# define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH \
1319 _Pragma("clang attribute push(__attribute__((availability(macosx,strict,introduced=10.15))), apply_to=any(function,record))") \
1320 _Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \
1321 _Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \
1322 _Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))")
1323# define _LIBCPP_AVAILABILITY_FILESYSTEM_POP \
1324 _Pragma("clang attribute pop") \
1325 _Pragma("clang attribute pop") \
1326 _Pragma("clang attribute pop") \
1327 _Pragma("clang attribute pop")
13581328#else
13591329# define _LIBCPP_AVAILABILITY_SHARED_MUTEX
13601330# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
......@@ -1366,6 +1336,9 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
13661336# define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
13671337# define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
13681338# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
1339# define _LIBCPP_AVAILABILITY_FILESYSTEM
1340# define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
1341# define _LIBCPP_AVAILABILITY_FILESYSTEM_POP
13691342#endif
13701343
13711344// Define availability that depends on _LIBCPP_NO_EXCEPTIONS.
lib/libcxx/include/__config_site.in+4-4
......@@ -1,9 +1,8 @@
11//===----------------------------------------------------------------------===//
22//
3// The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76//
87//===----------------------------------------------------------------------===//
98
......@@ -28,6 +27,7 @@
2827#cmakedefine _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL
2928#cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
3029#cmakedefine _LIBCPP_NO_VCRUNTIME
30#cmakedefine01 _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT
3131#cmakedefine _LIBCPP_ABI_NAMESPACE @_LIBCPP_ABI_NAMESPACE@
3232
3333@_LIBCPP_ABI_DEFINES@
lib/libcxx/include/__debug+16-39
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- __debug ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -12,6 +11,7 @@
1211#define _LIBCPP_DEBUG_H
1312
1413#include <__config>
14#include <iosfwd>
1515
1616#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1717#pragma GCC system_header
......@@ -25,7 +25,6 @@
2525# include <cstdlib>
2626# include <cstdio>
2727# include <cstddef>
28# include <exception>
2928#endif
3029
3130#if _LIBCPP_DEBUG_LEVEL >= 1 && !defined(_LIBCPP_ASSERT)
......@@ -50,10 +49,6 @@
5049#define _LIBCPP_DEBUG_MODE(...) ((void)0)
5150#endif
5251
53#if _LIBCPP_DEBUG_LEVEL < 1
54class _LIBCPP_EXCEPTION_ABI __libcpp_debug_exception;
55#endif
56
5752_LIBCPP_BEGIN_NAMESPACE_STD
5853
5954struct _LIBCPP_TEMPLATE_VIS __libcpp_debug_info {
......@@ -63,6 +58,9 @@ struct _LIBCPP_TEMPLATE_VIS __libcpp_debug_info {
6358 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
6459 __libcpp_debug_info(const char* __f, int __l, const char* __p, const char* __m)
6560 : __file_(__f), __line_(__l), __pred_(__p), __msg_(__m) {}
61
62 _LIBCPP_FUNC_VIS std::string what() const;
63
6664 const char* __file_;
6765 int __line_;
6866 const char* __pred_;
......@@ -80,38 +78,11 @@ extern _LIBCPP_EXPORTED_FROM_ABI __libcpp_debug_function_type __libcpp_debug_fun
8078_LIBCPP_NORETURN _LIBCPP_FUNC_VIS
8179void __libcpp_abort_debug_function(__libcpp_debug_info const&);
8280
83/// __libcpp_throw_debug_function - A debug handler that throws
84/// an instance of __libcpp_debug_exception when called.
85 _LIBCPP_NORETURN _LIBCPP_FUNC_VIS
86void __libcpp_throw_debug_function(__libcpp_debug_info const&);
87
8881/// __libcpp_set_debug_function - Set the debug handler to the specified
8982/// function.
9083_LIBCPP_FUNC_VIS
9184bool __libcpp_set_debug_function(__libcpp_debug_function_type __func);
9285
93// Setup the throwing debug handler during dynamic initialization.
94#if _LIBCPP_DEBUG_LEVEL >= 1 && defined(_LIBCPP_DEBUG_USE_EXCEPTIONS)
95# if defined(_LIBCPP_NO_EXCEPTIONS)
96# error _LIBCPP_DEBUG_USE_EXCEPTIONS cannot be used when exceptions are disabled.
97# endif
98static bool __init_dummy = __libcpp_set_debug_function(__libcpp_throw_debug_function);
99#endif
100
101#if _LIBCPP_DEBUG_LEVEL >= 1 || defined(_LIBCPP_BUILDING_LIBRARY)
102class _LIBCPP_EXCEPTION_ABI __libcpp_debug_exception : public exception {
103public:
104 __libcpp_debug_exception() _NOEXCEPT;
105 explicit __libcpp_debug_exception(__libcpp_debug_info const& __i);
106 __libcpp_debug_exception(__libcpp_debug_exception const&);
107 ~__libcpp_debug_exception() _NOEXCEPT;
108 const char* what() const _NOEXCEPT;
109private:
110 struct __libcpp_debug_exception_imp;
111 __libcpp_debug_exception_imp *__imp_;
112};
113#endif
114
11586#if _LIBCPP_DEBUG_LEVEL >= 2 || defined(_LIBCPP_BUILDING_LIBRARY)
11687
11788struct _LIBCPP_TYPE_VIS __c_node;
......@@ -251,16 +222,22 @@ public:
251222 __db_c_const_iterator __c_end() const;
252223 __db_i_const_iterator __i_end() const;
253224
225 typedef __c_node*(_InsertConstruct)(void*, void*, __c_node*);
226
227 template <class _Cont>
228 _LIBCPP_INLINE_VISIBILITY static __c_node* __create_C_node(void *__mem, void *__c, __c_node *__next) {
229 return ::new(__mem) _C_node<_Cont>(__c, __next);
230 }
231
254232 template <class _Cont>
255233 _LIBCPP_INLINE_VISIBILITY
256234 void __insert_c(_Cont* __c)
257235 {
258 __c_node* __n = __insert_c(static_cast<void*>(__c));
259 ::new(__n) _C_node<_Cont>(__n->__c_, __n->__next_);
236 __insert_c(static_cast<void*>(__c), &__create_C_node<_Cont>);
260237 }
261238
262239 void __insert_i(void* __i);
263 __c_node* __insert_c(void* __c);
240 void __insert_c(void* __c, _InsertConstruct* __fn);
264241 void __erase_c(void* __c);
265242
266243 void __insert_ic(void* __i, const void* __c);
lib/libcxx/include/__errc+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- __errc ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/__functional_03+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------------------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/__functional_base+8-9
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------------------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -126,7 +125,7 @@ struct __weak_result_type_imp // bool is true
126125 : public __maybe_derive_from_unary_function<_Tp>,
127126 public __maybe_derive_from_binary_function<_Tp>
128127{
129 typedef typename _Tp::result_type result_type;
128 typedef _LIBCPP_NODEBUG_TYPE typename _Tp::result_type result_type;
130129};
131130
132131template <class _Tp>
......@@ -147,19 +146,19 @@ struct __weak_result_type
147146template <class _Rp>
148147struct __weak_result_type<_Rp ()>
149148{
150 typedef _Rp result_type;
149 typedef _LIBCPP_NODEBUG_TYPE _Rp result_type;
151150};
152151
153152template <class _Rp>
154153struct __weak_result_type<_Rp (&)()>
155154{
156 typedef _Rp result_type;
155 typedef _LIBCPP_NODEBUG_TYPE _Rp result_type;
157156};
158157
159158template <class _Rp>
160159struct __weak_result_type<_Rp (*)()>
161160{
162 typedef _Rp result_type;
161 typedef _LIBCPP_NODEBUG_TYPE _Rp result_type;
163162};
164163
165164// 1 argument case
......@@ -611,7 +610,7 @@ _LIBCPP_INLINE_VAR constexpr size_t uses_allocator_v = uses_allocator<_Tp, _Allo
611610template <class _Tp, class _Alloc, class ..._Args>
612611struct __uses_alloc_ctor_imp
613612{
614 typedef typename __uncvref<_Alloc>::type _RawAlloc;
613 typedef _LIBCPP_NODEBUG_TYPE typename __uncvref<_Alloc>::type _RawAlloc;
615614 static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value;
616615 static const bool __ic =
617616 is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
lib/libcxx/include/__functional_base_03+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------------------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/__hash_table+15-15
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------------------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -123,7 +122,7 @@ inline _LIBCPP_INLINE_VISIBILITY
123122size_t
124123__next_hash_pow2(size_t __n)
125124{
126 return __n < 2 ? __n : (size_t(1) << (std::numeric_limits<size_t>::digits - __clz(__n-1)));
125 return __n < 2 ? __n : (size_t(1) << (std::numeric_limits<size_t>::digits - __libcpp_clz(__n-1)));
127126}
128127
129128
......@@ -876,9 +875,9 @@ struct __enforce_unordered_container_requirements {
876875template <class _Key, class _Hash, class _Equal>
877876#ifndef _LIBCPP_CXX03_LANG
878877 _LIBCPP_DIAGNOSE_WARNING(!__invokable<_Equal const&, _Key const&, _Key const&>::value,
879 "the specified comparator type does not provide a const call operator")
878 "the specified comparator type does not provide a viable const call operator")
880879 _LIBCPP_DIAGNOSE_WARNING(!__invokable<_Hash const&, _Key const&>::value,
881 "the specified hash functor does not provide a const call operator")
880 "the specified hash functor does not provide a viable const call operator")
882881#endif
883882typename __enforce_unordered_container_requirements<_Key, _Hash, _Equal>::type
884883__diagnose_unordered_container_requirements(int);
......@@ -1261,7 +1260,7 @@ public:
12611260
12621261 void swap(__hash_table& __u)
12631262#if _LIBCPP_STD_VER <= 11
1264 _NOEXCEPT_DEBUG_(
1263 _NOEXCEPT_(
12651264 __is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
12661265 && (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
12671266 || __is_nothrow_swappable<__pointer_allocator>::value)
......@@ -1269,7 +1268,7 @@ public:
12691268 || __is_nothrow_swappable<__node_allocator>::value)
12701269 );
12711270#else
1272 _NOEXCEPT_DEBUG_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value);
1271 _NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value);
12731272#endif
12741273
12751274 _LIBCPP_INLINE_VISIBILITY
......@@ -2249,7 +2248,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique(
22492248 return _InsertReturnType{end(), false, _NodeHandle()};
22502249 pair<iterator, bool> __result = __node_insert_unique(__nh.__ptr_);
22512250 if (__result.second)
2252 __nh.__release();
2251 __nh.__release_ptr();
22532252 return _InsertReturnType{__result.first, __result.second, _VSTD::move(__nh)};
22542253}
22552254
......@@ -2264,7 +2263,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique(
22642263 return end();
22652264 pair<iterator, bool> __result = __node_insert_unique(__nh.__ptr_);
22662265 if (__result.second)
2267 __nh.__release();
2266 __nh.__release_ptr();
22682267 return __result.first;
22692268}
22702269
......@@ -2328,7 +2327,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi(
23282327 if (__nh.empty())
23292328 return end();
23302329 iterator __result = __node_insert_multi(__nh.__ptr_);
2331 __nh.__release();
2330 __nh.__release_ptr();
23322331 return __result;
23332332}
23342333
......@@ -2342,7 +2341,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi(
23422341 if (__nh.empty())
23432342 return end();
23442343 iterator __result = __node_insert_multi(__hint, __nh.__ptr_);
2345 __nh.__release();
2344 __nh.__release_ptr();
23462345 return __result;
23472346}
23482347
......@@ -2372,6 +2371,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_merge_multi(
23722371template <class _Tp, class _Hash, class _Equal, class _Alloc>
23732372void
23742373__hash_table<_Tp, _Hash, _Equal, _Alloc>::rehash(size_type __n)
2374_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
23752375{
23762376 if (__n == 1)
23772377 __n = 2;
......@@ -2807,7 +2807,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
28072807void
28082808__hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
28092809#if _LIBCPP_STD_VER <= 11
2810 _NOEXCEPT_DEBUG_(
2810 _NOEXCEPT_(
28112811 __is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
28122812 && (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
28132813 || __is_nothrow_swappable<__pointer_allocator>::value)
......@@ -2815,7 +2815,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
28152815 || __is_nothrow_swappable<__node_allocator>::value)
28162816 )
28172817#else
2818 _NOEXCEPT_DEBUG_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value)
2818 _NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value)
28192819#endif
28202820{
28212821 _LIBCPP_ASSERT(__node_traits::propagate_on_container_swap::value ||
lib/libcxx/include/__libcpp_version+1-1
......@@ -1 +1 @@
18000
19000
lib/libcxx/include/__locale+55-25
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------------------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -20,6 +19,7 @@
2019#include <cctype>
2120#include <locale.h>
2221#if defined(_LIBCPP_MSVCRT_LIKE)
22# include <cstring>
2323# include <support/win32/locale_win32.h>
2424#elif defined(_AIX)
2525# include <support/ibm/xlocale.h>
......@@ -35,6 +35,9 @@
3535# include <xlocale.h>
3636#elif defined(__Fuchsia__)
3737# include <support/fuchsia/xlocale.h>
38#elif defined(__wasi__)
39// WASI libc uses musl's locales support.
40# include <support/musl/xlocale.h>
3841#elif defined(_LIBCPP_HAS_MUSL_LIBC)
3942# include <support/musl/xlocale.h>
4043#endif
......@@ -64,28 +67,41 @@ private:
6467#elif defined(_LIBCPP_MSVCRT_LIKE)
6568struct __libcpp_locale_guard {
6669 __libcpp_locale_guard(locale_t __l) :
67 __status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)),
68 __locale_collate(setlocale(LC_COLLATE, __l.__get_locale())),
69 __locale_ctype(setlocale(LC_CTYPE, __l.__get_locale())),
70 __locale_monetary(setlocale(LC_MONETARY, __l.__get_locale())),
71 __locale_numeric(setlocale(LC_NUMERIC, __l.__get_locale())),
72 __locale_time(setlocale(LC_TIME, __l.__get_locale()))
73 // LC_MESSAGES is not supported on Windows.
74 {}
70 __status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)) {
71 // Setting the locale can be expensive even when the locale given is
72 // already the current locale, so do an explicit check to see if the
73 // current locale is already the one we want.
74 const char* __lc = __setlocale(nullptr);
75 // If every category is the same, the locale string will simply be the
76 // locale name, otherwise it will be a semicolon-separated string listing
77 // each category. In the second case, we know at least one category won't
78 // be what we want, so we only have to check the first case.
79 if (strcmp(__l.__get_locale(), __lc) != 0) {
80 __locale_all = _strdup(__lc);
81 if (__locale_all == nullptr)
82 __throw_bad_alloc();
83 __setlocale(__l.__get_locale());
84 }
85 }
7586 ~__libcpp_locale_guard() {
76 setlocale(LC_COLLATE, __locale_collate);
77 setlocale(LC_CTYPE, __locale_ctype);
78 setlocale(LC_MONETARY, __locale_monetary);
79 setlocale(LC_NUMERIC, __locale_numeric);
80 setlocale(LC_TIME, __locale_time);
81 _configthreadlocale(__status);
87 // The CRT documentation doesn't explicitly say, but setlocale() does the
88 // right thing when given a semicolon-separated list of locale settings
89 // for the different categories in the same format as returned by
90 // setlocale(LC_ALL, nullptr).
91 if (__locale_all != nullptr) {
92 __setlocale(__locale_all);
93 free(__locale_all);
94 }
95 _configthreadlocale(__status);
96 }
97 static const char* __setlocale(const char* __locale) {
98 const char* __new_locale = setlocale(LC_ALL, __locale);
99 if (__new_locale == nullptr)
100 __throw_bad_alloc();
101 return __new_locale;
82102 }
83103 int __status;
84 char* __locale_collate;
85 char* __locale_ctype;
86 char* __locale_monetary;
87 char* __locale_numeric;
88 char* __locale_time;
104 char* __locale_all = nullptr;
89105};
90106#endif
91107
......@@ -255,7 +271,10 @@ public:
255271 return do_compare(__lo1, __hi1, __lo2, __hi2);
256272 }
257273
274 // FIXME(EricWF): The _LIBCPP_ALWAYS_INLINE is needed on Windows to work
275 // around a dllimport bug that expects an external instantiation.
258276 _LIBCPP_INLINE_VISIBILITY
277 _LIBCPP_ALWAYS_INLINE
259278 string_type transform(const char_type* __lo, const char_type* __hi) const
260279 {
261280 return do_transform(__lo, __hi);
......@@ -389,6 +408,11 @@ public:
389408 static const mask punct = _ISpunct;
390409 static const mask xdigit = _ISxdigit;
391410 static const mask blank = _ISblank;
411#if defined(__mips__)
412 static const mask __regex_word = static_cast<char_class_type>(_ISbit(15));
413#else
414 static const mask __regex_word = 0x80;
415#endif
392416#elif defined(_LIBCPP_MSVCRT_LIKE)
393417 typedef unsigned short mask;
394418 static const mask space = _SPACE;
......@@ -401,6 +425,7 @@ public:
401425 static const mask punct = _PUNCT;
402426 static const mask xdigit = _HEX;
403427 static const mask blank = _BLANK;
428 static const mask __regex_word = 0x80;
404429# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
405430#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
406431# ifdef __APPLE__
......@@ -422,8 +447,12 @@ public:
422447
423448# if defined(__NetBSD__)
424449 static const mask blank = _CTYPE_BL;
450 // NetBSD defines classes up to 0x2000
451 // see sys/ctype_bits.h, _CTYPE_Q
452 static const mask __regex_word = 0x8000;
425453# else
426454 static const mask blank = _CTYPE_B;
455 static const mask __regex_word = 0x80;
427456# endif
428457#elif defined(__sun__) || defined(_AIX)
429458 typedef unsigned int mask;
......@@ -437,6 +466,7 @@ public:
437466 static const mask punct = _ISPUNCT;
438467 static const mask xdigit = _ISXDIGIT;
439468 static const mask blank = _ISBLANK;
469 static const mask __regex_word = 0x80;
440470#elif defined(_NEWLIB_VERSION)
441471 // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
442472 typedef char mask;
......@@ -450,6 +480,7 @@ public:
450480 static const mask punct = _P;
451481 static const mask xdigit = _X | _N;
452482 static const mask blank = _B;
483 static const mask __regex_word = 0x80;
453484# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
454485# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
455486# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
......@@ -465,6 +496,7 @@ public:
465496 static const mask punct = 1<<7;
466497 static const mask xdigit = 1<<8;
467498 static const mask blank = 1<<9;
499 static const mask __regex_word = 1<<10;
468500#endif
469501 static const mask alnum = alpha | digit;
470502 static const mask graph = alnum | punct;
......@@ -1230,8 +1262,6 @@ _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<w
12301262_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>)
12311263_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>)
12321264
1233_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
1234
12351265template <size_t _Np>
12361266struct __narrow_to_utf8
12371267{
lib/libcxx/include/__mutex_base+19-30
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------------------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -37,28 +36,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3736# endif
3837#endif // _LIBCPP_THREAD_SAFETY_ANNOTATION
3938
39
4040class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex
4141{
42#ifndef _LIBCPP_CXX03_LANG
4342 __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER;
44#else
45 __libcpp_mutex_t __m_;
46#endif
4743
4844public:
4945 _LIBCPP_INLINE_VISIBILITY
50#ifndef _LIBCPP_CXX03_LANG
51 constexpr mutex() = default;
46 _LIBCPP_CONSTEXPR mutex() = default;
47
48 mutex(const mutex&) = delete;
49 mutex& operator=(const mutex&) = delete;
50
51#if defined(_LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION)
52 ~mutex() = default;
5253#else
53 mutex() _NOEXCEPT {__m_ = (__libcpp_mutex_t)_LIBCPP_MUTEX_INITIALIZER;}
54 ~mutex() _NOEXCEPT;
5455#endif
55 ~mutex();
5656
57private:
58 mutex(const mutex&);// = delete;
59 mutex& operator=(const mutex&);// = delete;
60
61public:
6257 void lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability());
6358 bool try_lock() _NOEXCEPT _LIBCPP_THREAD_SAFETY_ANNOTATION(try_acquire_capability(true));
6459 void unlock() _NOEXCEPT _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability());
......@@ -287,26 +282,20 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status)
287282
288283class _LIBCPP_TYPE_VIS condition_variable
289284{
290#ifndef _LIBCPP_CXX03_LANG
291285 __libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER;
292#else
293 __libcpp_condvar_t __cv_;
294#endif
295
296286public:
297287 _LIBCPP_INLINE_VISIBILITY
298#ifndef _LIBCPP_CXX03_LANG
299 constexpr condition_variable() _NOEXCEPT = default;
288 _LIBCPP_CONSTEXPR condition_variable() _NOEXCEPT = default;
289
290#ifdef _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION
291 ~condition_variable() = default;
300292#else
301 condition_variable() _NOEXCEPT {__cv_ = (__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;}
302#endif
303293 ~condition_variable();
294#endif
304295
305private:
306 condition_variable(const condition_variable&); // = delete;
307 condition_variable& operator=(const condition_variable&); // = delete;
296 condition_variable(const condition_variable&) = delete;
297 condition_variable& operator=(const condition_variable&) = delete;
308298
309public:
310299 void notify_one() _NOEXCEPT;
311300 void notify_all() _NOEXCEPT;
312301
lib/libcxx/include/__node_handle+5-7
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------------------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -57,7 +56,7 @@ private:
5756 optional<allocator_type> __alloc_;
5857
5958 _LIBCPP_INLINE_VISIBILITY
60 void __release()
59 void __release_ptr()
6160 {
6261 __ptr_ = nullptr;
6362 __alloc_ = _VSTD::nullopt;
......@@ -194,8 +193,7 @@ using __map_node_handle =
194193 __basic_node_handle< _NodeType, _Alloc, __map_node_handle_specifics>;
195194
196195template <class _Iterator, class _NodeType>
197_LIBCPP_TEMPLATE_VIS
198struct __insert_return_type
196struct _LIBCPP_TEMPLATE_VIS __insert_return_type
199197{
200198 _Iterator position;
201199 bool inserted;
lib/libcxx/include/__nullptr+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- __nullptr --------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/__sso_allocator+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------------------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/__std_stream+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------------------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/__string+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- __string ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/__threading_support+10-9
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------------------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -23,6 +22,8 @@
2322# include <__external_threading>
2423#elif !defined(_LIBCPP_HAS_NO_THREADS)
2524
25typedef ::timespec __libcpp_timespec_t;
26
2627#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
2728# include <pthread.h>
2829# include <sched.h>
......@@ -149,7 +150,7 @@ int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m);
149150
150151_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
151152int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
152 timespec *__ts);
153 __libcpp_timespec_t *__ts);
153154
154155_LIBCPP_THREAD_ABI_VISIBILITY
155156int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv);
......@@ -157,7 +158,7 @@ int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv);
157158// Execute once
158159_LIBCPP_THREAD_ABI_VISIBILITY
159160int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
160 void (*init_routine)(void));
161 void (*init_routine)());
161162
162163// Thread id
163164_LIBCPP_THREAD_ABI_VISIBILITY
......@@ -288,7 +289,7 @@ int __libcpp_condvar_wait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m)
288289}
289290
290291int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
291 timespec *__ts)
292 __libcpp_timespec_t *__ts)
292293{
293294 return pthread_cond_timedwait(__cv, __m, __ts);
294295}
......@@ -300,7 +301,7 @@ int __libcpp_condvar_destroy(__libcpp_condvar_t *__cv)
300301
301302// Execute once
302303int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
303 void (*init_routine)(void)) {
304 void (*init_routine)()) {
304305 return pthread_once(flag, init_routine);
305306}
306307
......@@ -357,7 +358,7 @@ void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
357358{
358359 using namespace chrono;
359360 seconds __s = duration_cast<seconds>(__ns);
360 timespec __ts;
361 __libcpp_timespec_t __ts;
361362 typedef decltype(__ts.tv_sec) ts_sec;
362363 _LIBCPP_CONSTEXPR ts_sec __ts_sec_max = numeric_limits<ts_sec>::max();
363364
lib/libcxx/include/__tree+91-127
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------------------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -27,6 +26,13 @@ _LIBCPP_PUSH_MACROS
2726
2827_LIBCPP_BEGIN_NAMESPACE_STD
2928
29#if defined(__GNUC__) && !defined(__clang__) // gcc.gnu.org/PR37804
30template <class, class, class, class> class _LIBCPP_TEMPLATE_VIS map;
31template <class, class, class, class> class _LIBCPP_TEMPLATE_VIS multimap;
32template <class, class, class> class _LIBCPP_TEMPLATE_VIS set;
33template <class, class, class> class _LIBCPP_TEMPLATE_VIS multiset;
34#endif
35
3036template <class _Tp, class _Compare, class _Allocator> class __tree;
3137template <class _Tp, class _NodePtr, class _DiffType>
3238 class _LIBCPP_TEMPLATE_VIS __tree_iterator;
......@@ -965,7 +971,7 @@ private:
965971template<class _Tp, class _Compare>
966972#ifndef _LIBCPP_CXX03_LANG
967973 _LIBCPP_DIAGNOSE_WARNING(!std::__invokable<_Compare const&, _Tp const&, _Tp const&>::value,
968 "the specified comparator type does not provide a const call operator")
974 "the specified comparator type does not provide a viable const call operator")
969975#endif
970976int __diagnose_non_const_comparator();
971977
......@@ -1090,8 +1096,8 @@ public:
10901096 __tree(const value_compare& __comp, const allocator_type& __a);
10911097 __tree(const __tree& __t);
10921098 __tree& operator=(const __tree& __t);
1093 template <class _InputIterator>
1094 void __assign_unique(_InputIterator __first, _InputIterator __last);
1099 template <class _ForwardIterator>
1100 void __assign_unique(_ForwardIterator __first, _ForwardIterator __last);
10951101 template <class _InputIterator>
10961102 void __assign_multi(_InputIterator __first, _InputIterator __last);
10971103#ifndef _LIBCPP_CXX03_LANG
......@@ -1326,10 +1332,7 @@ public:
13261332#endif // !_LIBCPP_CXX03_LANG
13271333
13281334 _LIBCPP_INLINE_VISIBILITY
1329 pair<iterator, bool> __node_insert_unique(__node_pointer __nd);
1330 _LIBCPP_INLINE_VISIBILITY
1331 iterator __node_insert_unique(const_iterator __p,
1332 __node_pointer __nd);
1335 pair<iterator, bool> __node_assign_unique(const __container_value_type& __v, __node_pointer __dest);
13331336
13341337 _LIBCPP_INLINE_VISIBILITY
13351338 iterator __node_insert_multi(__node_pointer __nd);
......@@ -1509,8 +1512,50 @@ private:
15091512 _LIBCPP_INLINE_VISIBILITY
15101513 void __move_assign_alloc(__tree&, false_type) _NOEXCEPT {}
15111514
1512 __node_pointer __detach();
1513 static __node_pointer __detach(__node_pointer);
1515 struct _DetachedTreeCache {
1516 _LIBCPP_INLINE_VISIBILITY
1517 explicit _DetachedTreeCache(__tree *__t) _NOEXCEPT : __t_(__t),
1518 __cache_root_(__detach_from_tree(__t)) {
1519 __advance();
1520 }
1521
1522 _LIBCPP_INLINE_VISIBILITY
1523 __node_pointer __get() const _NOEXCEPT {
1524 return __cache_elem_;
1525 }
1526
1527 _LIBCPP_INLINE_VISIBILITY
1528 void __advance() _NOEXCEPT {
1529 __cache_elem_ = __cache_root_;
1530 if (__cache_root_) {
1531 __cache_root_ = __detach_next(__cache_root_);
1532 }
1533 }
1534
1535 _LIBCPP_INLINE_VISIBILITY
1536 ~_DetachedTreeCache() {
1537 __t_->destroy(__cache_elem_);
1538 if (__cache_root_) {
1539 while (__cache_root_->__parent_ != nullptr)
1540 __cache_root_ = static_cast<__node_pointer>(__cache_root_->__parent_);
1541 __t_->destroy(__cache_root_);
1542 }
1543 }
1544
1545 _DetachedTreeCache(_DetachedTreeCache const&) = delete;
1546 _DetachedTreeCache& operator=(_DetachedTreeCache const&) = delete;
1547
1548 private:
1549 _LIBCPP_INLINE_VISIBILITY
1550 static __node_pointer __detach_from_tree(__tree *__t) _NOEXCEPT;
1551 _LIBCPP_INLINE_VISIBILITY
1552 static __node_pointer __detach_next(__node_pointer) _NOEXCEPT;
1553
1554 __tree *__t_;
1555 __node_pointer __cache_root_;
1556 __node_pointer __cache_elem_;
1557 };
1558
15141559
15151560 template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS map;
15161561 template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS multimap;
......@@ -1548,13 +1593,13 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
15481593// Precondition: size() != 0
15491594template <class _Tp, class _Compare, class _Allocator>
15501595typename __tree<_Tp, _Compare, _Allocator>::__node_pointer
1551__tree<_Tp, _Compare, _Allocator>::__detach()
1596__tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_from_tree(__tree *__t) _NOEXCEPT
15521597{
1553 __node_pointer __cache = static_cast<__node_pointer>(__begin_node());
1554 __begin_node() = __end_node();
1555 __end_node()->__left_->__parent_ = nullptr;
1556 __end_node()->__left_ = nullptr;
1557 size() = 0;
1598 __node_pointer __cache = static_cast<__node_pointer>(__t->__begin_node());
1599 __t->__begin_node() = __t->__end_node();
1600 __t->__end_node()->__left_->__parent_ = nullptr;
1601 __t->__end_node()->__left_ = nullptr;
1602 __t->size() = 0;
15581603 // __cache->__left_ == nullptr
15591604 if (__cache->__right_ != nullptr)
15601605 __cache = static_cast<__node_pointer>(__cache->__right_);
......@@ -1569,7 +1614,7 @@ __tree<_Tp, _Compare, _Allocator>::__detach()
15691614// This is no longer a red-black tree
15701615template <class _Tp, class _Compare, class _Allocator>
15711616typename __tree<_Tp, _Compare, _Allocator>::__node_pointer
1572__tree<_Tp, _Compare, _Allocator>::__detach(__node_pointer __cache)
1617__tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_next(__node_pointer __cache) _NOEXCEPT
15731618{
15741619 if (__cache->__parent_ == nullptr)
15751620 return nullptr;
......@@ -1603,45 +1648,23 @@ __tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t)
16031648}
16041649
16051650template <class _Tp, class _Compare, class _Allocator>
1606template <class _InputIterator>
1651template <class _ForwardIterator>
16071652void
1608__tree<_Tp, _Compare, _Allocator>::__assign_unique(_InputIterator __first, _InputIterator __last)
1653__tree<_Tp, _Compare, _Allocator>::__assign_unique(_ForwardIterator __first, _ForwardIterator __last)
16091654{
1610 typedef iterator_traits<_InputIterator> _ITraits;
1655 typedef iterator_traits<_ForwardIterator> _ITraits;
16111656 typedef typename _ITraits::value_type _ItValueType;
16121657 static_assert((is_same<_ItValueType, __container_value_type>::value),
16131658 "__assign_unique may only be called with the containers value type");
1614
1659 static_assert(__is_forward_iterator<_ForwardIterator>::value,
1660 "__assign_unique requires a forward iterator");
16151661 if (size() != 0)
16161662 {
1617 __node_pointer __cache = __detach();
1618#ifndef _LIBCPP_NO_EXCEPTIONS
1619 try
1620 {
1621#endif // _LIBCPP_NO_EXCEPTIONS
1622 for (; __cache != nullptr && __first != __last; ++__first)
1623 {
1624 __cache->__value_ = *__first;
1625 __node_pointer __next = __detach(__cache);
1626 __node_insert_unique(__cache);
1627 __cache = __next;
1663 _DetachedTreeCache __cache(this);
1664 for (; __cache.__get() != nullptr && __first != __last; ++__first) {
1665 if (__node_assign_unique(*__first, __cache.__get()).second)
1666 __cache.__advance();
16281667 }
1629#ifndef _LIBCPP_NO_EXCEPTIONS
1630 }
1631 catch (...)
1632 {
1633 while (__cache->__parent_ != nullptr)
1634 __cache = static_cast<__node_pointer>(__cache->__parent_);
1635 destroy(__cache);
1636 throw;
1637 }
1638#endif // _LIBCPP_NO_EXCEPTIONS
1639 if (__cache != nullptr)
1640 {
1641 while (__cache->__parent_ != nullptr)
1642 __cache = static_cast<__node_pointer>(__cache->__parent_);
1643 destroy(__cache);
1644 }
16451668 }
16461669 for (; __first != __last; ++__first)
16471670 __insert_unique(*__first);
......@@ -1660,33 +1683,11 @@ __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _Input
16601683 " or the nodes value type");
16611684 if (size() != 0)
16621685 {
1663 __node_pointer __cache = __detach();
1664#ifndef _LIBCPP_NO_EXCEPTIONS
1665 try
1666 {
1667#endif // _LIBCPP_NO_EXCEPTIONS
1668 for (; __cache != nullptr && __first != __last; ++__first)
1669 {
1670 __cache->__value_ = *__first;
1671 __node_pointer __next = __detach(__cache);
1672 __node_insert_multi(__cache);
1673 __cache = __next;
1674 }
1675#ifndef _LIBCPP_NO_EXCEPTIONS
1676 }
1677 catch (...)
1678 {
1679 while (__cache->__parent_ != nullptr)
1680 __cache = static_cast<__node_pointer>(__cache->__parent_);
1681 destroy(__cache);
1682 throw;
1683 }
1684#endif // _LIBCPP_NO_EXCEPTIONS
1685 if (__cache != nullptr)
1686 {
1687 while (__cache->__parent_ != nullptr)
1688 __cache = static_cast<__node_pointer>(__cache->__parent_);
1689 destroy(__cache);
1686 _DetachedTreeCache __cache(this);
1687 for (; __cache.__get() && __first != __last; ++__first) {
1688 __cache.__get()->__value_ = *__first;
1689 __node_insert_multi(__cache.__get());
1690 __cache.__advance();
16901691 }
16911692 }
16921693 for (; __first != __last; ++__first)
......@@ -1784,33 +1785,11 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
17841785 const_iterator __e = end();
17851786 if (size() != 0)
17861787 {
1787 __node_pointer __cache = __detach();
1788#ifndef _LIBCPP_NO_EXCEPTIONS
1789 try
1790 {
1791#endif // _LIBCPP_NO_EXCEPTIONS
1792 while (__cache != nullptr && __t.size() != 0)
1793 {
1794 __cache->__value_ = _VSTD::move(__t.remove(__t.begin())->__value_);
1795 __node_pointer __next = __detach(__cache);
1796 __node_insert_multi(__cache);
1797 __cache = __next;
1798 }
1799#ifndef _LIBCPP_NO_EXCEPTIONS
1800 }
1801 catch (...)
1802 {
1803 while (__cache->__parent_ != nullptr)
1804 __cache = static_cast<__node_pointer>(__cache->__parent_);
1805 destroy(__cache);
1806 throw;
1807 }
1808#endif // _LIBCPP_NO_EXCEPTIONS
1809 if (__cache != nullptr)
1810 {
1811 while (__cache->__parent_ != nullptr)
1812 __cache = static_cast<__node_pointer>(__cache->__parent_);
1813 destroy(__cache);
1788 _DetachedTreeCache __cache(this);
1789 while (__cache.__get() != nullptr && __t.size() != 0) {
1790 __cache.__get()->__value_ = _VSTD::move(__t.remove(__t.begin())->__value_);
1791 __node_insert_multi(__cache.__get());
1792 __cache.__advance();
18141793 }
18151794 }
18161795 while (__t.size() != 0)
......@@ -2319,14 +2298,15 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, const __co
23192298
23202299template <class _Tp, class _Compare, class _Allocator>
23212300pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
2322__tree<_Tp, _Compare, _Allocator>::__node_insert_unique(__node_pointer __nd)
2301__tree<_Tp, _Compare, _Allocator>::__node_assign_unique(const __container_value_type& __v, __node_pointer __nd)
23232302{
23242303 __parent_pointer __parent;
2325 __node_base_pointer& __child = __find_equal(__parent, __nd->__value_);
2304 __node_base_pointer& __child = __find_equal(__parent, _NodeTypes::__get_key(__v));
23262305 __node_pointer __r = static_cast<__node_pointer>(__child);
23272306 bool __inserted = false;
23282307 if (__child == nullptr)
23292308 {
2309 __nd->__value_ = __v;
23302310 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
23312311 __r = __nd;
23322312 __inserted = true;
......@@ -2334,22 +2314,6 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_unique(__node_pointer __nd)
23342314 return pair<iterator, bool>(iterator(__r), __inserted);
23352315}
23362316
2337template <class _Tp, class _Compare, class _Allocator>
2338typename __tree<_Tp, _Compare, _Allocator>::iterator
2339__tree<_Tp, _Compare, _Allocator>::__node_insert_unique(const_iterator __p,
2340 __node_pointer __nd)
2341{
2342 __parent_pointer __parent;
2343 __node_base_pointer __dummy;
2344 __node_base_pointer& __child = __find_equal(__p, __parent, __nd->__value_);
2345 __node_pointer __r = static_cast<__node_pointer>(__child);
2346 if (__child == nullptr)
2347 {
2348 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
2349 __r = __nd;
2350 }
2351 return iterator(__r);
2352}
23532317
23542318template <class _Tp, class _Compare, class _Allocator>
23552319typename __tree<_Tp, _Compare, _Allocator>::iterator
......@@ -2408,7 +2372,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(
24082372
24092373 __insert_node_at(__parent, __child,
24102374 static_cast<__node_base_pointer>(__ptr));
2411 __nh.__release();
2375 __nh.__release_ptr();
24122376 return _InsertReturnType{iterator(__ptr), true, _NodeHandle()};
24132377}
24142378
......@@ -2433,7 +2397,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(
24332397 __insert_node_at(__parent, __child,
24342398 static_cast<__node_base_pointer>(__ptr));
24352399 __r = __ptr;
2436 __nh.__release();
2400 __nh.__release_ptr();
24372401 }
24382402 return iterator(__r);
24392403}
......@@ -2498,7 +2462,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(_NodeHandle&& __nh
24982462 __node_base_pointer& __child = __find_leaf_high(
24992463 __parent, _NodeTypes::__get_key(__ptr->__value_));
25002464 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
2501 __nh.__release();
2465 __nh.__release_ptr();
25022466 return iterator(__ptr);
25032467}
25042468
......@@ -2517,7 +2481,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(
25172481 __node_base_pointer& __child = __find_leaf(__hint, __parent,
25182482 _NodeTypes::__get_key(__ptr->__value_));
25192483 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
2520 __nh.__release();
2484 __nh.__release_ptr();
25212485 return iterator(__ptr);
25222486}
25232487
lib/libcxx/include/__tuple+31-37
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------------------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -54,27 +53,24 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<volatile _Tp> : publ
5453template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<const volatile _Tp> : public tuple_size<_Tp> {};
5554#endif
5655
57template <size_t _Ip, class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_element;
56template <size_t _Ip, class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_element;
5857
5958template <size_t _Ip, class _Tp>
60class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const _Tp>
59struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const _Tp>
6160{
62public:
63 typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
61 typedef _LIBCPP_NODEBUG_TYPE typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
6462};
6563
6664template <size_t _Ip, class _Tp>
67class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, volatile _Tp>
65struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, volatile _Tp>
6866{
69public:
70 typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
67 typedef _LIBCPP_NODEBUG_TYPE typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
7168};
7269
7370template <size_t _Ip, class _Tp>
74class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp>
71struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp>
7572{
76public:
77 typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
73 typedef _LIBCPP_NODEBUG_TYPE typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
7874};
7975
8076template <class _Tp> struct __tuple_like : false_type {};
......@@ -103,7 +99,7 @@ namespace __detail {
10399
104100template<typename _Tp, size_t ..._Extra> struct __repeat;
105101template<typename _Tp, _Tp ..._Np, size_t ..._Extra> struct __repeat<__integer_sequence<_Tp, _Np...>, _Extra...> {
106 typedef __integer_sequence<_Tp,
102 typedef _LIBCPP_NODEBUG_TYPE __integer_sequence<_Tp,
107103 _Np...,
108104 sizeof...(_Np) + _Np...,
109105 2 * sizeof...(_Np) + _Np...,
......@@ -257,7 +253,7 @@ template <class ..._Tp> struct __tuple_types {};
257253namespace __indexer_detail {
258254
259255template <size_t _Idx, class _Tp>
260struct __indexed { using type = _Tp; };
256struct __indexed { using type _LIBCPP_NODEBUG_TYPE = _Tp; };
261257
262258template <class _Types, class _Indexes> struct __indexer;
263259
......@@ -272,7 +268,7 @@ __indexed<_Idx, _Tp> __at_index(__indexed<_Idx, _Tp> const&);
272268} // namespace __indexer_detail
273269
274270template <size_t _Idx, class ..._Types>
275using __type_pack_element = typename decltype(
271using __type_pack_element _LIBCPP_NODEBUG_TYPE = typename decltype(
276272 __indexer_detail::__at_index<_Idx>(
277273 __indexer_detail::__indexer<
278274 __tuple_types<_Types...>,
......@@ -282,11 +278,10 @@ using __type_pack_element = typename decltype(
282278#endif
283279
284280template <size_t _Ip, class ..._Types>
285class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...>>
281struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...>>
286282{
287public:
288283 static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range");
289 typedef __type_pack_element<_Ip, _Types...> type;
284 typedef _LIBCPP_NODEBUG_TYPE __type_pack_element<_Ip, _Types...> type;
290285};
291286
292287
......@@ -306,34 +301,34 @@ struct __apply_cv_mf<false, false, false> {
306301};
307302template <>
308303struct __apply_cv_mf<false, true, false> {
309 template <class _Tp> using __apply = const _Tp;
304 template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = const _Tp;
310305};
311306template <>
312307struct __apply_cv_mf<false, false, true> {
313 template <class _Tp> using __apply = volatile _Tp;
308 template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = volatile _Tp;
314309};
315310template <>
316311struct __apply_cv_mf<false, true, true> {
317 template <class _Tp> using __apply = const volatile _Tp;
312 template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = const volatile _Tp;
318313};
319314template <>
320315struct __apply_cv_mf<true, false, false> {
321 template <class _Tp> using __apply = _Tp&;
316 template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = _Tp&;
322317};
323318template <>
324319struct __apply_cv_mf<true, true, false> {
325 template <class _Tp> using __apply = const _Tp&;
320 template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = const _Tp&;
326321};
327322template <>
328323struct __apply_cv_mf<true, false, true> {
329 template <class _Tp> using __apply = volatile _Tp&;
324 template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = volatile _Tp&;
330325};
331326template <>
332327struct __apply_cv_mf<true, true, true> {
333 template <class _Tp> using __apply = const volatile _Tp&;
328 template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = const volatile _Tp&;
334329};
335330template <class _Tp, class _RawTp = typename remove_reference<_Tp>::type>
336using __apply_cv_t = __apply_cv_mf<
331using __apply_cv_t _LIBCPP_NODEBUG_TYPE = __apply_cv_mf<
337332 is_lvalue_reference<_Tp>::value,
338333 is_const<_RawTp>::value,
339334 is_volatile<_RawTp>::value>;
......@@ -352,7 +347,7 @@ template <template <class...> class _Tuple, class ..._Types, size_t ..._Idx>
352347struct __make_tuple_types_flat<_Tuple<_Types...>, __tuple_indices<_Idx...>> {
353348 // Specialization for pair, tuple, and __tuple_types
354349 template <class _Tp, class _ApplyFn = __apply_cv_t<_Tp>>
355 using __apply_quals = __tuple_types<
350 using __apply_quals _LIBCPP_NODEBUG_TYPE = __tuple_types<
356351 typename _ApplyFn::template __apply<__type_pack_element<_Idx, _Types...>>...
357352 >;
358353};
......@@ -380,19 +375,19 @@ struct __make_tuple_types
380375
381376template <class ..._Types, size_t _Ep>
382377struct __make_tuple_types<tuple<_Types...>, _Ep, 0, true> {
383 typedef __tuple_types<_Types...> type;
378 typedef _LIBCPP_NODEBUG_TYPE __tuple_types<_Types...> type;
384379};
385380
386381template <class ..._Types, size_t _Ep>
387382struct __make_tuple_types<__tuple_types<_Types...>, _Ep, 0, true> {
388 typedef __tuple_types<_Types...> type;
383 typedef _LIBCPP_NODEBUG_TYPE __tuple_types<_Types...> type;
389384};
390385
391386template <bool ..._Preds>
392387struct __all_dummy;
393388
394389template <bool ..._Pred>
395using __all = is_same<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...>>;
390using __all = _IsSame<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...>>;
396391
397392struct __tuple_sfinae_base {
398393 template <template <class, class...> class _Trait,
......@@ -457,15 +452,14 @@ struct __tuple_assignable<_Tp, _Up, true, true>
457452
458453
459454template <size_t _Ip, class ..._Tp>
460class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, tuple<_Tp...> >
455struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, tuple<_Tp...> >
461456{
462public:
463 typedef typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
457 typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
464458};
465459
466460#if _LIBCPP_STD_VER > 11
467461template <size_t _Ip, class ..._Tp>
468using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type;
462using tuple_element_t _LIBCPP_NODEBUG_TYPE = typename tuple_element <_Ip, _Tp...>::type;
469463#endif
470464
471465template <bool _IsTuple, class _SizeTrait, size_t _Expected>
......@@ -477,7 +471,7 @@ struct __tuple_like_with_size_imp<true, _SizeTrait, _Expected>
477471
478472template <class _Tuple, size_t _ExpectedSize,
479473 class _RawTuple = typename __uncvref<_Tuple>::type>
480using __tuple_like_with_size = __tuple_like_with_size_imp<
474using __tuple_like_with_size _LIBCPP_NODEBUG_TYPE = __tuple_like_with_size_imp<
481475 __tuple_like<_RawTuple>::value,
482476 tuple_size<_RawTuple>, _ExpectedSize
483477 >;
lib/libcxx/include/__undef_macros+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------ __undef_macros ------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/algorithm+215-244
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- algorithm ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -781,11 +780,23 @@ __half_positive(_Tp __value)
781780template <class _Compare>
782781struct __debug_less
783782{
784 _Compare __comp_;
783 _Compare &__comp_;
784 _LIBCPP_CONSTEXPR_AFTER_CXX17
785785 __debug_less(_Compare& __c) : __comp_(__c) {}
786786
787787 template <class _Tp, class _Up>
788 bool operator()(const _Tp& __x, const _Up& __y)
788 _LIBCPP_CONSTEXPR_AFTER_CXX17
789 bool operator()(const _Tp& __x, const _Up& __y)
790 {
791 bool __r = __comp_(__x, __y);
792 if (__r)
793 __do_compare_assert(0, __y, __x);
794 return __r;
795 }
796
797 template <class _Tp, class _Up>
798 _LIBCPP_CONSTEXPR_AFTER_CXX17
799 bool operator()(_Tp& __x, _Up& __y)
789800 {
790801 bool __r = __comp_(__x, __y);
791802 if (__r)
......@@ -794,25 +805,39 @@ struct __debug_less
794805 }
795806
796807 template <class _LHS, class _RHS>
808 _LIBCPP_CONSTEXPR_AFTER_CXX17
797809 inline _LIBCPP_INLINE_VISIBILITY
798810 decltype((void)_VSTD::declval<_Compare&>()(
799 _VSTD::declval<_LHS const&>(), _VSTD::declval<_RHS const&>()))
800 __do_compare_assert(int, _LHS const& __l, _RHS const& __r) {
811 _VSTD::declval<_LHS &>(), _VSTD::declval<_RHS &>()))
812 __do_compare_assert(int, _LHS & __l, _RHS & __r) {
801813 _LIBCPP_ASSERT(!__comp_(__l, __r),
802814 "Comparator does not induce a strict weak ordering");
803815 }
804816
805817 template <class _LHS, class _RHS>
818 _LIBCPP_CONSTEXPR_AFTER_CXX17
806819 inline _LIBCPP_INLINE_VISIBILITY
807 void __do_compare_assert(long, _LHS const&, _RHS const&) {}
820 void __do_compare_assert(long, _LHS &, _RHS &) {}
808821};
809822
810#endif // _LIBCPP_DEBUG
823#endif // _LIBCPP_DEBUG
824
825template <class _Comp>
826struct __comp_ref_type {
827 // Pass the comparator by lvalue reference. Or in debug mode, using a
828 // debugging wrapper that stores a reference.
829#ifndef _LIBCPP_DEBUG
830 typedef typename add_lvalue_reference<_Comp>::type type;
831#else
832 typedef __debug_less<_Comp> type;
833#endif
834};
811835
812836// all_of
813837
814838template <class _InputIterator, class _Predicate>
815inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
839_LIBCPP_NODISCARD_EXT inline
840_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
816841bool
817842all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
818843{
......@@ -825,7 +850,8 @@ all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
825850// any_of
826851
827852template <class _InputIterator, class _Predicate>
828inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
853_LIBCPP_NODISCARD_EXT inline
854_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
829855bool
830856any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
831857{
......@@ -838,7 +864,8 @@ any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
838864// none_of
839865
840866template <class _InputIterator, class _Predicate>
841inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
867_LIBCPP_NODISCARD_EXT inline
868_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
842869bool
843870none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
844871{
......@@ -883,7 +910,8 @@ for_each_n(_InputIterator __first, _Size __orig_n, _Function __f)
883910// find
884911
885912template <class _InputIterator, class _Tp>
886inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
913_LIBCPP_NODISCARD_EXT inline
914_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
887915_InputIterator
888916find(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
889917{
......@@ -896,7 +924,8 @@ find(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
896924// find_if
897925
898926template <class _InputIterator, class _Predicate>
899inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
927_LIBCPP_NODISCARD_EXT inline
928_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
900929_InputIterator
901930find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
902931{
......@@ -909,7 +938,8 @@ find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
909938// find_if_not
910939
911940template<class _InputIterator, class _Predicate>
912inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
941_LIBCPP_NODISCARD_EXT inline
942_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
913943_InputIterator
914944find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred)
915945{
......@@ -1044,7 +1074,8 @@ __find_end(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
10441074}
10451075
10461076template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
1047inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1077_LIBCPP_NODISCARD_EXT inline
1078_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
10481079_ForwardIterator1
10491080find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
10501081 _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
......@@ -1056,7 +1087,8 @@ find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
10561087}
10571088
10581089template <class _ForwardIterator1, class _ForwardIterator2>
1059inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1090_LIBCPP_NODISCARD_EXT inline
1091_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
10601092_ForwardIterator1
10611093find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
10621094 _ForwardIterator2 __first2, _ForwardIterator2 __last2)
......@@ -1082,7 +1114,8 @@ __find_first_of_ce(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
10821114
10831115
10841116template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
1085inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1117_LIBCPP_NODISCARD_EXT inline
1118_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
10861119_ForwardIterator1
10871120find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
10881121 _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
......@@ -1091,7 +1124,8 @@ find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
10911124}
10921125
10931126template <class _ForwardIterator1, class _ForwardIterator2>
1094inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1127_LIBCPP_NODISCARD_EXT inline
1128_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
10951129_ForwardIterator1
10961130find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
10971131 _ForwardIterator2 __first2, _ForwardIterator2 __last2)
......@@ -1104,7 +1138,8 @@ find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
11041138// adjacent_find
11051139
11061140template <class _ForwardIterator, class _BinaryPredicate>
1107inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1141_LIBCPP_NODISCARD_EXT inline
1142_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
11081143_ForwardIterator
11091144adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred)
11101145{
......@@ -1122,7 +1157,8 @@ adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicat
11221157}
11231158
11241159template <class _ForwardIterator>
1125inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1160_LIBCPP_NODISCARD_EXT inline
1161_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
11261162_ForwardIterator
11271163adjacent_find(_ForwardIterator __first, _ForwardIterator __last)
11281164{
......@@ -1133,7 +1169,8 @@ adjacent_find(_ForwardIterator __first, _ForwardIterator __last)
11331169// count
11341170
11351171template <class _InputIterator, class _Tp>
1136inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1172_LIBCPP_NODISCARD_EXT inline
1173_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
11371174typename iterator_traits<_InputIterator>::difference_type
11381175count(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
11391176{
......@@ -1147,7 +1184,8 @@ count(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
11471184// count_if
11481185
11491186template <class _InputIterator, class _Predicate>
1150inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1187_LIBCPP_NODISCARD_EXT inline
1188_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
11511189typename iterator_traits<_InputIterator>::difference_type
11521190count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
11531191{
......@@ -1161,7 +1199,8 @@ count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
11611199// mismatch
11621200
11631201template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
1164inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1202_LIBCPP_NODISCARD_EXT inline
1203_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
11651204pair<_InputIterator1, _InputIterator2>
11661205mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
11671206 _InputIterator2 __first2, _BinaryPredicate __pred)
......@@ -1173,7 +1212,8 @@ mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
11731212}
11741213
11751214template <class _InputIterator1, class _InputIterator2>
1176inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1215_LIBCPP_NODISCARD_EXT inline
1216_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
11771217pair<_InputIterator1, _InputIterator2>
11781218mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2)
11791219{
......@@ -1184,7 +1224,8 @@ mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __fi
11841224
11851225#if _LIBCPP_STD_VER > 11
11861226template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
1187inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1227_LIBCPP_NODISCARD_EXT inline
1228_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
11881229pair<_InputIterator1, _InputIterator2>
11891230mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
11901231 _InputIterator2 __first2, _InputIterator2 __last2,
......@@ -1197,7 +1238,8 @@ mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
11971238}
11981239
11991240template <class _InputIterator1, class _InputIterator2>
1200inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1241_LIBCPP_NODISCARD_EXT inline
1242_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
12011243pair<_InputIterator1, _InputIterator2>
12021244mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
12031245 _InputIterator2 __first2, _InputIterator2 __last2)
......@@ -1211,7 +1253,8 @@ mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
12111253// equal
12121254
12131255template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
1214inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1256_LIBCPP_NODISCARD_EXT inline
1257_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
12151258bool
12161259equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred)
12171260{
......@@ -1222,7 +1265,8 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first
12221265}
12231266
12241267template <class _InputIterator1, class _InputIterator2>
1225inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1268_LIBCPP_NODISCARD_EXT inline
1269_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
12261270bool
12271271equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2)
12281272{
......@@ -1260,7 +1304,8 @@ __equal(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
12601304}
12611305
12621306template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
1263inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1307_LIBCPP_NODISCARD_EXT inline
1308_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
12641309bool
12651310equal(_InputIterator1 __first1, _InputIterator1 __last1,
12661311 _InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred )
......@@ -1272,7 +1317,8 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1,
12721317}
12731318
12741319template <class _InputIterator1, class _InputIterator2>
1275inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1320_LIBCPP_NODISCARD_EXT inline
1321_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
12761322bool
12771323equal(_InputIterator1 __first1, _InputIterator1 __last1,
12781324 _InputIterator2 __first2, _InputIterator2 __last2)
......@@ -1288,7 +1334,7 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1,
12881334// is_permutation
12891335
12901336template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
1291_LIBCPP_CONSTEXPR_AFTER_CXX17 bool
1337_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
12921338is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
12931339 _ForwardIterator2 __first2, _BinaryPredicate __pred)
12941340{
......@@ -1335,7 +1381,8 @@ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
13351381}
13361382
13371383template<class _ForwardIterator1, class _ForwardIterator2>
1338inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1384_LIBCPP_NODISCARD_EXT inline
1385_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
13391386bool
13401387is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
13411388 _ForwardIterator2 __first2)
......@@ -1414,7 +1461,8 @@ __is_permutation(_RandomAccessIterator1 __first1, _RandomAccessIterator2 __last1
14141461}
14151462
14161463template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
1417inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1464_LIBCPP_NODISCARD_EXT inline
1465_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
14181466bool
14191467is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
14201468 _ForwardIterator2 __first2, _ForwardIterator2 __last2,
......@@ -1427,7 +1475,8 @@ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
14271475}
14281476
14291477template<class _ForwardIterator1, class _ForwardIterator2>
1430inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1478_LIBCPP_NODISCARD_EXT inline
1479_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
14311480bool
14321481is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
14331482 _ForwardIterator2 __first2, _ForwardIterator2 __last2)
......@@ -1445,7 +1494,8 @@ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
14451494// __search is in <functional>
14461495
14471496template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
1448inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1497_LIBCPP_NODISCARD_EXT inline
1498_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
14491499_ForwardIterator1
14501500search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
14511501 _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
......@@ -1458,7 +1508,8 @@ search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
14581508}
14591509
14601510template <class _ForwardIterator1, class _ForwardIterator2>
1461inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1511_LIBCPP_NODISCARD_EXT inline
1512_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
14621513_ForwardIterator1
14631514search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
14641515 _ForwardIterator2 __first2, _ForwardIterator2 __last2)
......@@ -1471,7 +1522,7 @@ search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
14711522
14721523#if _LIBCPP_STD_VER > 14
14731524template <class _ForwardIterator, class _Searcher>
1474_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1525_LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
14751526_ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s)
14761527{ return __s(__f, __l).first; }
14771528#endif
......@@ -1556,7 +1607,8 @@ __search_n(_RandomAccessIterator __first, _RandomAccessIterator __last,
15561607}
15571608
15581609template <class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate>
1559inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1610_LIBCPP_NODISCARD_EXT inline
1611_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
15601612_ForwardIterator
15611613search_n(_ForwardIterator __first, _ForwardIterator __last,
15621614 _Size __count, const _Tp& __value_, _BinaryPredicate __pred)
......@@ -1567,7 +1619,8 @@ search_n(_ForwardIterator __first, _ForwardIterator __last,
15671619}
15681620
15691621template <class _ForwardIterator, class _Size, class _Tp>
1570inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1622_LIBCPP_NODISCARD_EXT inline
1623_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
15711624_ForwardIterator
15721625search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_)
15731626{
......@@ -1611,6 +1664,18 @@ __unwrap_iter(__wrap_iter<_Tp*> __i)
16111664 return __i.base();
16121665}
16131666
1667template <class _Tp>
1668inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1669typename enable_if
1670<
1671 is_trivially_copy_assignable<_Tp>::value,
1672 const _Tp*
1673>::type
1674__unwrap_iter(__wrap_iter<const _Tp*> __i)
1675{
1676 return __i.base();
1677}
1678
16141679#else
16151680
16161681template <class _Tp>
......@@ -1984,7 +2049,7 @@ generate(_ForwardIterator __first, _ForwardIterator __last, _Generator __gen)
19842049// generate_n
19852050
19862051template <class _OutputIterator, class _Size, class _Generator>
1987inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
2052inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
19882053_OutputIterator
19892054generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen)
19902055{
......@@ -1998,7 +2063,7 @@ generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen)
19982063// remove
19992064
20002065template <class _ForwardIterator, class _Tp>
2001_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
2066_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
20022067remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
20032068{
20042069 __first = _VSTD::find(__first, __last, __value_);
......@@ -2020,7 +2085,7 @@ remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
20202085// remove_if
20212086
20222087template <class _ForwardIterator, class _Predicate>
2023_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
2088_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
20242089remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
20252090{
20262091 __first = _VSTD::find_if<_ForwardIterator, typename add_lvalue_reference<_Predicate>::type>
......@@ -2079,7 +2144,7 @@ remove_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __
20792144// unique
20802145
20812146template <class _ForwardIterator, class _BinaryPredicate>
2082_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
2147_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
20832148unique(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred)
20842149{
20852150 __first = _VSTD::adjacent_find<_ForwardIterator, typename add_lvalue_reference<_BinaryPredicate>::type>
......@@ -2098,7 +2163,8 @@ unique(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pre
20982163}
20992164
21002165template <class _ForwardIterator>
2101inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
2166_LIBCPP_NODISCARD_EXT inline
2167_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
21022168_ForwardIterator
21032169unique(_ForwardIterator __first, _ForwardIterator __last)
21042170{
......@@ -2421,7 +2487,8 @@ rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterato
24212487// min_element
24222488
24232489template <class _ForwardIterator, class _Compare>
2424inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2490_LIBCPP_NODISCARD_EXT inline
2491_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
24252492_ForwardIterator
24262493min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
24272494{
......@@ -2438,7 +2505,8 @@ min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
24382505}
24392506
24402507template <class _ForwardIterator>
2441inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2508_LIBCPP_NODISCARD_EXT inline
2509_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
24422510_ForwardIterator
24432511min_element(_ForwardIterator __first, _ForwardIterator __last)
24442512{
......@@ -2449,7 +2517,8 @@ min_element(_ForwardIterator __first, _ForwardIterator __last)
24492517// min
24502518
24512519template <class _Tp, class _Compare>
2452inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2520_LIBCPP_NODISCARD_EXT inline
2521_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
24532522const _Tp&
24542523min(const _Tp& __a, const _Tp& __b, _Compare __comp)
24552524{
......@@ -2457,7 +2526,8 @@ min(const _Tp& __a, const _Tp& __b, _Compare __comp)
24572526}
24582527
24592528template <class _Tp>
2460inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2529_LIBCPP_NODISCARD_EXT inline
2530_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
24612531const _Tp&
24622532min(const _Tp& __a, const _Tp& __b)
24632533{
......@@ -2467,7 +2537,8 @@ min(const _Tp& __a, const _Tp& __b)
24672537#ifndef _LIBCPP_CXX03_LANG
24682538
24692539template<class _Tp, class _Compare>
2470inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2540_LIBCPP_NODISCARD_EXT inline
2541_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
24712542_Tp
24722543min(initializer_list<_Tp> __t, _Compare __comp)
24732544{
......@@ -2475,7 +2546,8 @@ min(initializer_list<_Tp> __t, _Compare __comp)
24752546}
24762547
24772548template<class _Tp>
2478inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2549_LIBCPP_NODISCARD_EXT inline
2550_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
24792551_Tp
24802552min(initializer_list<_Tp> __t)
24812553{
......@@ -2487,7 +2559,8 @@ min(initializer_list<_Tp> __t)
24872559// max_element
24882560
24892561template <class _ForwardIterator, class _Compare>
2490inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2562_LIBCPP_NODISCARD_EXT inline
2563_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
24912564_ForwardIterator
24922565max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
24932566{
......@@ -2505,7 +2578,8 @@ max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
25052578
25062579
25072580template <class _ForwardIterator>
2508inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2581_LIBCPP_NODISCARD_EXT inline
2582_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
25092583_ForwardIterator
25102584max_element(_ForwardIterator __first, _ForwardIterator __last)
25112585{
......@@ -2516,7 +2590,8 @@ max_element(_ForwardIterator __first, _ForwardIterator __last)
25162590// max
25172591
25182592template <class _Tp, class _Compare>
2519inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2593_LIBCPP_NODISCARD_EXT inline
2594_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
25202595const _Tp&
25212596max(const _Tp& __a, const _Tp& __b, _Compare __comp)
25222597{
......@@ -2524,7 +2599,8 @@ max(const _Tp& __a, const _Tp& __b, _Compare __comp)
25242599}
25252600
25262601template <class _Tp>
2527inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2602_LIBCPP_NODISCARD_EXT inline
2603_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
25282604const _Tp&
25292605max(const _Tp& __a, const _Tp& __b)
25302606{
......@@ -2534,7 +2610,8 @@ max(const _Tp& __a, const _Tp& __b)
25342610#ifndef _LIBCPP_CXX03_LANG
25352611
25362612template<class _Tp, class _Compare>
2537inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2613_LIBCPP_NODISCARD_EXT inline
2614_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
25382615_Tp
25392616max(initializer_list<_Tp> __t, _Compare __comp)
25402617{
......@@ -2542,7 +2619,8 @@ max(initializer_list<_Tp> __t, _Compare __comp)
25422619}
25432620
25442621template<class _Tp>
2545inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2622_LIBCPP_NODISCARD_EXT inline
2623_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
25462624_Tp
25472625max(initializer_list<_Tp> __t)
25482626{
......@@ -2554,7 +2632,8 @@ max(initializer_list<_Tp> __t)
25542632#if _LIBCPP_STD_VER > 14
25552633// clamp
25562634template<class _Tp, class _Compare>
2557inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
2635_LIBCPP_NODISCARD_EXT inline
2636_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
25582637const _Tp&
25592638clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi, _Compare __comp)
25602639{
......@@ -2564,7 +2643,8 @@ clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi, _Compare __comp)
25642643}
25652644
25662645template<class _Tp>
2567inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
2646_LIBCPP_NODISCARD_EXT inline
2647_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
25682648const _Tp&
25692649clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi)
25702650{
......@@ -2575,7 +2655,7 @@ clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi)
25752655// minmax_element
25762656
25772657template <class _ForwardIterator, class _Compare>
2578_LIBCPP_CONSTEXPR_AFTER_CXX11
2658_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX11
25792659std::pair<_ForwardIterator, _ForwardIterator>
25802660minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
25812661{
......@@ -2625,7 +2705,8 @@ minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __com
26252705}
26262706
26272707template <class _ForwardIterator>
2628inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2708_LIBCPP_NODISCARD_EXT inline
2709_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
26292710std::pair<_ForwardIterator, _ForwardIterator>
26302711minmax_element(_ForwardIterator __first, _ForwardIterator __last)
26312712{
......@@ -2636,7 +2717,8 @@ minmax_element(_ForwardIterator __first, _ForwardIterator __last)
26362717// minmax
26372718
26382719template<class _Tp, class _Compare>
2639inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2720_LIBCPP_NODISCARD_EXT inline
2721_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
26402722pair<const _Tp&, const _Tp&>
26412723minmax(const _Tp& __a, const _Tp& __b, _Compare __comp)
26422724{
......@@ -2645,7 +2727,8 @@ minmax(const _Tp& __a, const _Tp& __b, _Compare __comp)
26452727}
26462728
26472729template<class _Tp>
2648inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2730_LIBCPP_NODISCARD_EXT inline
2731_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
26492732pair<const _Tp&, const _Tp&>
26502733minmax(const _Tp& __a, const _Tp& __b)
26512734{
......@@ -2655,7 +2738,8 @@ minmax(const _Tp& __a, const _Tp& __b)
26552738#ifndef _LIBCPP_CXX03_LANG
26562739
26572740template<class _Tp, class _Compare>
2658inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2741_LIBCPP_NODISCARD_EXT inline
2742_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
26592743pair<_Tp, _Tp>
26602744minmax(initializer_list<_Tp> __t, _Compare __comp)
26612745{
......@@ -2692,7 +2776,8 @@ minmax(initializer_list<_Tp> __t, _Compare __comp)
26922776}
26932777
26942778template<class _Tp>
2695inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2779_LIBCPP_NODISCARD_EXT inline
2780_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
26962781pair<_Tp, _Tp>
26972782minmax(initializer_list<_Tp> __t)
26982783{
......@@ -2936,7 +3021,7 @@ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
29363021 typedef __independent_bits_engine<_URNG, _UIntType> _Eng;
29373022 if (_Rp == 0)
29383023 return static_cast<result_type>(_Eng(__g, _Dt)());
2939 size_t __w = _Dt - __clz(_Rp) - 1;
3024 size_t __w = _Dt - __libcpp_clz(_Rp) - 1;
29403025 if ((_Rp & (std::numeric_limits<_UIntType>::max() >> (_Dt - __w))) != 0)
29413026 ++__w;
29423027 _Eng __e(__g, __w);
......@@ -2990,7 +3075,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
29903075 {
29913076 _Dp __uid;
29923077 __rs_default __g = __rs_get();
2993 for (--__last, --__d; __first < __last; ++__first, --__d)
3078 for (--__last, (void) --__d; __first < __last; ++__first, (void) --__d)
29943079 {
29953080 difference_type __i = __uid(__g, _Pp(0, __d));
29963081 if (__i != difference_type(0))
......@@ -3012,7 +3097,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
30123097 difference_type __d = __last - __first;
30133098 if (__d > 1)
30143099 {
3015 for (--__last; __first < __last; ++__first, --__d)
3100 for (--__last; __first < __last; ++__first, (void) --__d)
30163101 {
30173102 difference_type __i = __rand(__d);
30183103 if (__i != difference_type(0))
......@@ -3096,11 +3181,7 @@ _SampleIterator sample(_PopulationIterator __first,
30963181
30973182template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
30983183 void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
3099#ifndef _LIBCPP_CXX03_LANG
31003184 _UniformRandomNumberGenerator&& __g)
3101#else
3102 _UniformRandomNumberGenerator& __g)
3103#endif
31043185{
31053186 typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
31063187 typedef uniform_int_distribution<ptrdiff_t> _Dp;
......@@ -3119,7 +3200,7 @@ template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
31193200}
31203201
31213202template <class _InputIterator, class _Predicate>
3122_LIBCPP_CONSTEXPR_AFTER_CXX17 bool
3203_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
31233204is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred)
31243205{
31253206 for (; __first != __last; ++__first)
......@@ -3527,7 +3608,7 @@ stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate _
35273608// is_sorted_until
35283609
35293610template <class _ForwardIterator, class _Compare>
3530_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
3611_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
35313612is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
35323613{
35333614 if (__first != __last)
......@@ -3544,7 +3625,8 @@ is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __co
35443625}
35453626
35463627template<class _ForwardIterator>
3547inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
3628_LIBCPP_NODISCARD_EXT inline
3629_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
35483630_ForwardIterator
35493631is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)
35503632{
......@@ -3554,7 +3636,8 @@ is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)
35543636// is_sorted
35553637
35563638template <class _ForwardIterator, class _Compare>
3557inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
3639_LIBCPP_NODISCARD_EXT inline
3640_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
35583641bool
35593642is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
35603643{
......@@ -3562,7 +3645,8 @@ is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
35623645}
35633646
35643647template<class _ForwardIterator>
3565inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
3648_LIBCPP_NODISCARD_EXT inline
3649_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
35663650bool
35673651is_sorted(_ForwardIterator __first, _ForwardIterator __last)
35683652{
......@@ -4009,14 +4093,8 @@ inline _LIBCPP_INLINE_VISIBILITY
40094093void
40104094sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
40114095{
4012#ifdef _LIBCPP_DEBUG
4013 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4014 __debug_less<_Compare> __c(__comp);
4015 __sort<_Comp_ref>(__first, __last, __c);
4016#else // _LIBCPP_DEBUG
4017 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4018 __sort<_Comp_ref>(__first, __last, __comp);
4019#endif // _LIBCPP_DEBUG
4096 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
4097 _VSTD::__sort<_Comp_ref>(__first, __last, _Comp_ref(__comp));
40204098}
40214099
40224100template <class _RandomAccessIterator>
......@@ -4111,7 +4189,8 @@ __lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
41114189}
41124190
41134191template <class _ForwardIterator, class _Tp, class _Compare>
4114inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4192_LIBCPP_NODISCARD_EXT inline
4193_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
41154194_ForwardIterator
41164195lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
41174196{
......@@ -4120,7 +4199,8 @@ lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu
41204199}
41214200
41224201template <class _ForwardIterator, class _Tp>
4123inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4202_LIBCPP_NODISCARD_EXT inline
4203_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
41244204_ForwardIterator
41254205lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
41264206{
......@@ -4153,7 +4233,8 @@ __upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
41534233}
41544234
41554235template <class _ForwardIterator, class _Tp, class _Compare>
4156inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4236_LIBCPP_NODISCARD_EXT inline
4237_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
41574238_ForwardIterator
41584239upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
41594240{
......@@ -4162,7 +4243,8 @@ upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu
41624243}
41634244
41644245template <class _ForwardIterator, class _Tp>
4165inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4246_LIBCPP_NODISCARD_EXT inline
4247_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
41664248_ForwardIterator
41674249upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
41684250{
......@@ -4207,22 +4289,18 @@ __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
42074289}
42084290
42094291template <class _ForwardIterator, class _Tp, class _Compare>
4210inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4292_LIBCPP_NODISCARD_EXT inline
4293_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
42114294pair<_ForwardIterator, _ForwardIterator>
42124295equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
42134296{
4214#ifdef _LIBCPP_DEBUG
4215 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4216 __debug_less<_Compare> __c(__comp);
4217 return __equal_range<_Comp_ref>(__first, __last, __value_, __c);
4218#else // _LIBCPP_DEBUG
4219 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4297 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
42204298 return __equal_range<_Comp_ref>(__first, __last, __value_, __comp);
4221#endif // _LIBCPP_DEBUG
42224299}
42234300
42244301template <class _ForwardIterator, class _Tp>
4225inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4302_LIBCPP_NODISCARD_EXT inline
4303_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
42264304pair<_ForwardIterator, _ForwardIterator>
42274305equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
42284306{
......@@ -4242,22 +4320,18 @@ __binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __
42424320}
42434321
42444322template <class _ForwardIterator, class _Tp, class _Compare>
4245inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4323_LIBCPP_NODISCARD_EXT inline
4324_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
42464325bool
42474326binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
42484327{
4249#ifdef _LIBCPP_DEBUG
4250 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4251 __debug_less<_Compare> __c(__comp);
4252 return __binary_search<_Comp_ref>(__first, __last, __value_, __c);
4253#else // _LIBCPP_DEBUG
4254 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4328 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
42554329 return __binary_search<_Comp_ref>(__first, __last, __value_, __comp);
4256#endif // _LIBCPP_DEBUG
42574330}
42584331
42594332template <class _ForwardIterator, class _Tp>
4260inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4333_LIBCPP_NODISCARD_EXT inline
4334_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
42614335bool
42624336binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
42634337{
......@@ -4296,14 +4370,8 @@ _OutputIterator
42964370merge(_InputIterator1 __first1, _InputIterator1 __last1,
42974371 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
42984372{
4299#ifdef _LIBCPP_DEBUG
4300 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4301 __debug_less<_Compare> __c(__comp);
4302 return _VSTD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
4303#else // _LIBCPP_DEBUG
4304 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4373 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
43054374 return _VSTD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
4306#endif // _LIBCPP_DEBUG
43074375}
43084376
43094377template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
......@@ -4478,17 +4546,9 @@ inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _
44784546 difference_type __buf_size = _VSTD::min(__len1, __len2);
44794547 pair<value_type*, ptrdiff_t> __buf = _VSTD::get_temporary_buffer<value_type>(__buf_size);
44804548 unique_ptr<value_type, __return_temporary_buffer> __h(__buf.first);
4481
4482#ifdef _LIBCPP_DEBUG
4483 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4484 __debug_less<_Compare> __c(__comp);
4485 return _VSTD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __c, __len1, __len2,
4486 __buf.first, __buf.second);
4487#else // _LIBCPP_DEBUG
4488 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4549 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
44894550 return _VSTD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __comp, __len1, __len2,
44904551 __buf.first, __buf.second);
4491#endif // _LIBCPP_DEBUG
44924552}
44934553
44944554template <class _BidirectionalIterator>
......@@ -4690,14 +4750,8 @@ stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compar
46904750 __buf = _VSTD::get_temporary_buffer<value_type>(__len);
46914751 __h.reset(__buf.first);
46924752 }
4693#ifdef _LIBCPP_DEBUG
4694 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4695 __debug_less<_Compare> __c(__comp);
4696 __stable_sort<_Comp_ref>(__first, __last, __c, __len, __buf.first, __buf.second);
4697#else // _LIBCPP_DEBUG
4698 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4753 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
46994754 __stable_sort<_Comp_ref>(__first, __last, __comp, __len, __buf.first, __buf.second);
4700#endif // _LIBCPP_DEBUG
47014755}
47024756
47034757template <class _RandomAccessIterator>
......@@ -4711,7 +4765,7 @@ stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
47114765// is_heap_until
47124766
47134767template <class _RandomAccessIterator, class _Compare>
4714_LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator
4768_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator
47154769is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
47164770{
47174771 typedef typename _VSTD::iterator_traits<_RandomAccessIterator>::difference_type difference_type;
......@@ -4738,7 +4792,8 @@ is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp
47384792}
47394793
47404794template<class _RandomAccessIterator>
4741inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4795_LIBCPP_NODISCARD_EXT inline
4796_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
47424797_RandomAccessIterator
47434798is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)
47444799{
......@@ -4748,7 +4803,8 @@ is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)
47484803// is_heap
47494804
47504805template <class _RandomAccessIterator, class _Compare>
4751inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4806_LIBCPP_NODISCARD_EXT inline
4807_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
47524808bool
47534809is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
47544810{
......@@ -4756,7 +4812,8 @@ is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __
47564812}
47574813
47584814template<class _RandomAccessIterator>
4759inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4815_LIBCPP_NODISCARD_EXT inline
4816_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
47604817bool
47614818is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
47624819{
......@@ -4797,14 +4854,8 @@ inline _LIBCPP_INLINE_VISIBILITY
47974854void
47984855push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
47994856{
4800#ifdef _LIBCPP_DEBUG
4801 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4802 __debug_less<_Compare> __c(__comp);
4803 __sift_up<_Comp_ref>(__first, __last, __c, __last - __first);
4804#else // _LIBCPP_DEBUG
4805 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4857 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
48064858 __sift_up<_Comp_ref>(__first, __last, __comp, __last - __first);
4807#endif // _LIBCPP_DEBUG
48084859}
48094860
48104861template <class _RandomAccessIterator>
......@@ -4890,14 +4941,8 @@ inline _LIBCPP_INLINE_VISIBILITY
48904941void
48914942pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
48924943{
4893#ifdef _LIBCPP_DEBUG
4894 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4895 __debug_less<_Compare> __c(__comp);
4896 __pop_heap<_Comp_ref>(__first, __last, __c, __last - __first);
4897#else // _LIBCPP_DEBUG
4898 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4944 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
48994945 __pop_heap<_Comp_ref>(__first, __last, __comp, __last - __first);
4900#endif // _LIBCPP_DEBUG
49014946}
49024947
49034948template <class _RandomAccessIterator>
......@@ -4931,14 +4976,8 @@ inline _LIBCPP_INLINE_VISIBILITY
49314976void
49324977make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
49334978{
4934#ifdef _LIBCPP_DEBUG
4935 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4936 __debug_less<_Compare> __c(__comp);
4937 __make_heap<_Comp_ref>(__first, __last, __c);
4938#else // _LIBCPP_DEBUG
4939 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4979 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
49404980 __make_heap<_Comp_ref>(__first, __last, __comp);
4941#endif // _LIBCPP_DEBUG
49424981}
49434982
49444983template <class _RandomAccessIterator>
......@@ -4965,14 +5004,8 @@ inline _LIBCPP_INLINE_VISIBILITY
49655004void
49665005sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
49675006{
4968#ifdef _LIBCPP_DEBUG
4969 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4970 __debug_less<_Compare> __c(__comp);
4971 __sort_heap<_Comp_ref>(__first, __last, __c);
4972#else // _LIBCPP_DEBUG
4973 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5007 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
49745008 __sort_heap<_Comp_ref>(__first, __last, __comp);
4975#endif // _LIBCPP_DEBUG
49765009}
49775010
49785011template <class _RandomAccessIterator>
......@@ -5009,14 +5042,8 @@ void
50095042partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
50105043 _Compare __comp)
50115044{
5012#ifdef _LIBCPP_DEBUG
5013 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5014 __debug_less<_Compare> __c(__comp);
5015 __partial_sort<_Comp_ref>(__first, __middle, __last, __c);
5016#else // _LIBCPP_DEBUG
5017 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5045 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
50185046 __partial_sort<_Comp_ref>(__first, __middle, __last, __comp);
5019#endif // _LIBCPP_DEBUG
50205047}
50215048
50225049template <class _RandomAccessIterator>
......@@ -5059,14 +5086,8 @@ _RandomAccessIterator
50595086partial_sort_copy(_InputIterator __first, _InputIterator __last,
50605087 _RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp)
50615088{
5062#ifdef _LIBCPP_DEBUG
5063 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5064 __debug_less<_Compare> __c(__comp);
5065 return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __c);
5066#else // _LIBCPP_DEBUG
5067 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5089 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
50685090 return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __comp);
5069#endif // _LIBCPP_DEBUG
50705091}
50715092
50725093template <class _InputIterator, class _RandomAccessIterator>
......@@ -5273,14 +5294,8 @@ inline _LIBCPP_INLINE_VISIBILITY
52735294void
52745295nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp)
52755296{
5276#ifdef _LIBCPP_DEBUG
5277 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5278 __debug_less<_Compare> __c(__comp);
5279 __nth_element<_Comp_ref>(__first, __nth, __last, __c);
5280#else // _LIBCPP_DEBUG
5281 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5297 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
52825298 __nth_element<_Comp_ref>(__first, __nth, __last, __comp);
5283#endif // _LIBCPP_DEBUG
52845299}
52855300
52865301template <class _RandomAccessIterator>
......@@ -5309,23 +5324,19 @@ __includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __
53095324}
53105325
53115326template <class _InputIterator1, class _InputIterator2, class _Compare>
5312inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
5327_LIBCPP_NODISCARD_EXT inline
5328_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
53135329bool
53145330includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
53155331 _Compare __comp)
53165332{
5317#ifdef _LIBCPP_DEBUG
5318 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5319 __debug_less<_Compare> __c(__comp);
5320 return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __c);
5321#else // _LIBCPP_DEBUG
5322 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5333 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
53235334 return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);
5324#endif // _LIBCPP_DEBUG
53255335}
53265336
53275337template <class _InputIterator1, class _InputIterator2>
5328inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
5338_LIBCPP_NODISCARD_EXT inline
5339_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
53295340bool
53305341includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2)
53315342{
......@@ -5367,14 +5378,8 @@ _OutputIterator
53675378set_union(_InputIterator1 __first1, _InputIterator1 __last1,
53685379 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
53695380{
5370#ifdef _LIBCPP_DEBUG
5371 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5372 __debug_less<_Compare> __c(__comp);
5373 return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
5374#else // _LIBCPP_DEBUG
5375 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5381 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
53765382 return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
5377#endif // _LIBCPP_DEBUG
53785383}
53795384
53805385template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
......@@ -5419,14 +5424,8 @@ _OutputIterator
54195424set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
54205425 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
54215426{
5422#ifdef _LIBCPP_DEBUG
5423 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5424 __debug_less<_Compare> __c(__comp);
5425 return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
5426#else // _LIBCPP_DEBUG
5427 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5427 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
54285428 return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
5429#endif // _LIBCPP_DEBUG
54305429}
54315430
54325431template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
......@@ -5473,14 +5472,8 @@ _OutputIterator
54735472set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
54745473 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
54755474{
5476#ifdef _LIBCPP_DEBUG
5477 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5478 __debug_less<_Compare> __c(__comp);
5479 return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
5480#else // _LIBCPP_DEBUG
5481 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5475 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
54825476 return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
5483#endif // _LIBCPP_DEBUG
54845477}
54855478
54865479template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
......@@ -5532,14 +5525,8 @@ _OutputIterator
55325525set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
55335526 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
55345527{
5535#ifdef _LIBCPP_DEBUG
5536 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5537 __debug_less<_Compare> __c(__comp);
5538 return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
5539#else // _LIBCPP_DEBUG
5540 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5528 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
55415529 return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
5542#endif // _LIBCPP_DEBUG
55435530}
55445531
55455532template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
......@@ -5571,23 +5558,19 @@ __lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
55715558}
55725559
55735560template <class _InputIterator1, class _InputIterator2, class _Compare>
5574inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
5561_LIBCPP_NODISCARD_EXT inline
5562_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
55755563bool
55765564lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
55775565 _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
55785566{
5579#ifdef _LIBCPP_DEBUG
5580 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5581 __debug_less<_Compare> __c(__comp);
5582 return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __c);
5583#else // _LIBCPP_DEBUG
5584 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5567 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
55855568 return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);
5586#endif // _LIBCPP_DEBUG
55875569}
55885570
55895571template <class _InputIterator1, class _InputIterator2>
5590inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
5572_LIBCPP_NODISCARD_EXT inline
5573_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
55915574bool
55925575lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
55935576 _InputIterator2 __first2, _InputIterator2 __last2)
......@@ -5631,14 +5614,8 @@ inline _LIBCPP_INLINE_VISIBILITY
56315614bool
56325615next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
56335616{
5634#ifdef _LIBCPP_DEBUG
5635 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5636 __debug_less<_Compare> __c(__comp);
5637 return __next_permutation<_Comp_ref>(__first, __last, __c);
5638#else // _LIBCPP_DEBUG
5639 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5617 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
56405618 return __next_permutation<_Comp_ref>(__first, __last, __comp);
5641#endif // _LIBCPP_DEBUG
56425619}
56435620
56445621template <class _BidirectionalIterator>
......@@ -5684,14 +5661,8 @@ inline _LIBCPP_INLINE_VISIBILITY
56845661bool
56855662prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
56865663{
5687#ifdef _LIBCPP_DEBUG
5688 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5689 __debug_less<_Compare> __c(__comp);
5690 return __prev_permutation<_Comp_ref>(__first, __last, __c);
5691#else // _LIBCPP_DEBUG
5692 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5664 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
56935665 return __prev_permutation<_Comp_ref>(__first, __last, __comp);
5694#endif // _LIBCPP_DEBUG
56955666}
56965667
56975668template <class _BidirectionalIterator>
lib/libcxx/include/any+4-5
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------------ any -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -508,7 +507,7 @@ any::any(_ValueType && __v) : __h(nullptr)
508507template <class _ValueType, class ..._Args, class _Tp, class>
509508any::any(in_place_type_t<_ValueType>, _Args&&... __args) {
510509 __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_Args>(__args)...);
511};
510}
512511
513512template <class _ValueType, class _Up, class ..._Args, class _Tp, class>
514513any::any(in_place_type_t<_ValueType>, initializer_list<_Up> __il, _Args&&... __args) {
lib/libcxx/include/array+17-19
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- array -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -92,7 +91,7 @@ template <class T, size_t N >
9291 void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y))); // C++17
9392
9493template <class T> struct tuple_size;
95template <size_t I, class T> class tuple_element;
94template <size_t I, class T> struct tuple_element;
9695template <class T, size_t N> struct tuple_size<array<T, N>>;
9796template <size_t I, class T, size_t N> struct tuple_element<I, array<T, N>>;
9897template <size_t I, class T, size_t N> T& get(array<T, N>&) noexcept; // constexpr in C++14
......@@ -191,17 +190,17 @@ struct _LIBCPP_TEMPLATE_VIS array
191190
192191 // element access:
193192 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
194 reference operator[](size_type __n) {return __elems_[__n];}
193 reference operator[](size_type __n) _NOEXCEPT {return __elems_[__n];}
195194 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
196 const_reference operator[](size_type __n) const {return __elems_[__n];}
195 const_reference operator[](size_type __n) const _NOEXCEPT {return __elems_[__n];}
197196
198197 _LIBCPP_CONSTEXPR_AFTER_CXX14 reference at(size_type __n);
199198 _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const;
200199
201 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference front() {return __elems_[0];}
202 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const {return __elems_[0];}
203 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference back() {return __elems_[_Size - 1];}
204 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const {return __elems_[_Size - 1];}
200 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference front() _NOEXCEPT {return __elems_[0];}
201 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const _NOEXCEPT {return __elems_[0];}
202 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference back() _NOEXCEPT {return __elems_[_Size - 1];}
203 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const _NOEXCEPT {return __elems_[_Size - 1];}
205204
206205 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
207206 value_type* data() _NOEXCEPT {return __elems_;}
......@@ -304,13 +303,13 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0>
304303
305304 // element access:
306305 _LIBCPP_INLINE_VISIBILITY
307 reference operator[](size_type) {
306 reference operator[](size_type) _NOEXCEPT {
308307 _LIBCPP_ASSERT(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
309308 _LIBCPP_UNREACHABLE();
310309 }
311310
312311 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
313 const_reference operator[](size_type) const {
312 const_reference operator[](size_type) const _NOEXCEPT {
314313 _LIBCPP_ASSERT(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
315314 _LIBCPP_UNREACHABLE();
316315 }
......@@ -328,25 +327,25 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0>
328327 }
329328
330329 _LIBCPP_INLINE_VISIBILITY
331 reference front() {
330 reference front() _NOEXCEPT {
332331 _LIBCPP_ASSERT(false, "cannot call array<T, 0>::front() on a zero-sized array");
333332 _LIBCPP_UNREACHABLE();
334333 }
335334
336335 _LIBCPP_INLINE_VISIBILITY
337 const_reference front() const {
336 const_reference front() const _NOEXCEPT {
338337 _LIBCPP_ASSERT(false, "cannot call array<T, 0>::front() on a zero-sized array");
339338 _LIBCPP_UNREACHABLE();
340339 }
341340
342341 _LIBCPP_INLINE_VISIBILITY
343 reference back() {
342 reference back() _NOEXCEPT {
344343 _LIBCPP_ASSERT(false, "cannot call array<T, 0>::back() on a zero-sized array");
345344 _LIBCPP_UNREACHABLE();
346345 }
347346
348347 _LIBCPP_INLINE_VISIBILITY
349 const_reference back() const {
348 const_reference back() const _NOEXCEPT {
350349 _LIBCPP_ASSERT(false, "cannot call array<T, 0>::back() on a zero-sized array");
351350 _LIBCPP_UNREACHABLE();
352351 }
......@@ -434,10 +433,9 @@ struct _LIBCPP_TEMPLATE_VIS tuple_size<array<_Tp, _Size> >
434433 : public integral_constant<size_t, _Size> {};
435434
436435template <size_t _Ip, class _Tp, size_t _Size>
437class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> >
436struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> >
438437{
439438 static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::array)");
440public:
441439 typedef _Tp type;
442440};
443441
lib/libcxx/include/atomic+811-257
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- atomic -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -21,17 +20,24 @@ namespace std
2120
2221#define __cpp_lib_atomic_is_always_lock_free // as specified by SG10
2322
24// order and consistency
25
26typedef enum memory_order
27{
28 memory_order_relaxed,
29 memory_order_consume, // load-consume
30 memory_order_acquire, // load-acquire
31 memory_order_release, // store-release
32 memory_order_acq_rel, // store-release load-acquire
33 memory_order_seq_cst // store-release load-acquire
34} memory_order;
23 // order and consistency
24
25 enum memory_order: unspecified // enum class in C++20
26 {
27 relaxed,
28 consume, // load-consume
29 acquire, // load-acquire
30 release, // store-release
31 acq_rel, // store-release load-acquire
32 seq_cst // store-release load-acquire
33 };
34
35 inline constexpr auto memory_order_relaxed = memory_order::relaxed;
36 inline constexpr auto memory_order_consume = memory_order::consume;
37 inline constexpr auto memory_order_acquire = memory_order::acquire;
38 inline constexpr auto memory_order_release = memory_order::release;
39 inline constexpr auto memory_order_acq_rel = memory_order::acq_rel;
40 inline constexpr auto memory_order_seq_cst = memory_order::seq_cst;
3541
3642template <class T> T kill_dependency(T y) noexcept;
3743
......@@ -551,13 +557,13 @@ void atomic_signal_fence(memory_order m) noexcept;
551557#endif
552558
553559#ifdef _LIBCPP_HAS_NO_THREADS
554#error <atomic> is not supported on this single threaded system
560# error <atomic> is not supported on this single threaded system
555561#endif
556#if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
557#error <atomic> is not implemented
562#ifdef _LIBCPP_HAS_NO_ATOMIC_HEADER
563# error <atomic> is not implemented
558564#endif
559565#ifdef kill_dependency
560#error C++ standard library is incompatible with <stdatomic.h>
566# error C++ standard library is incompatible with <stdatomic.h>
561567#endif
562568
563569#define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \
......@@ -578,49 +584,94 @@ void atomic_signal_fence(memory_order m) noexcept;
578584
579585_LIBCPP_BEGIN_NAMESPACE_STD
580586
581typedef enum memory_order
582{
583 memory_order_relaxed, memory_order_consume, memory_order_acquire,
584 memory_order_release, memory_order_acq_rel, memory_order_seq_cst
587// Figure out what the underlying type for `memory_order` would be if it were
588// declared as an unscoped enum (accounting for -fshort-enums). Use this result
589// to pin the underlying type in C++20.
590enum __legacy_memory_order {
591 __mo_relaxed,
592 __mo_consume,
593 __mo_acquire,
594 __mo_release,
595 __mo_acq_rel,
596 __mo_seq_cst
597};
598
599typedef underlying_type<__legacy_memory_order>::type __memory_order_underlying_t;
600
601#if _LIBCPP_STD_VER > 17
602
603enum class memory_order : __memory_order_underlying_t {
604 relaxed = __mo_relaxed,
605 consume = __mo_consume,
606 acquire = __mo_acquire,
607 release = __mo_release,
608 acq_rel = __mo_acq_rel,
609 seq_cst = __mo_seq_cst
610};
611
612inline constexpr auto memory_order_relaxed = memory_order::relaxed;
613inline constexpr auto memory_order_consume = memory_order::consume;
614inline constexpr auto memory_order_acquire = memory_order::acquire;
615inline constexpr auto memory_order_release = memory_order::release;
616inline constexpr auto memory_order_acq_rel = memory_order::acq_rel;
617inline constexpr auto memory_order_seq_cst = memory_order::seq_cst;
618
619#else
620
621typedef enum memory_order {
622 memory_order_relaxed = __mo_relaxed,
623 memory_order_consume = __mo_consume,
624 memory_order_acquire = __mo_acquire,
625 memory_order_release = __mo_release,
626 memory_order_acq_rel = __mo_acq_rel,
627 memory_order_seq_cst = __mo_seq_cst,
585628} memory_order;
586629
587#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
588namespace __gcc_atomic {
589template <typename _Tp>
590struct __gcc_atomic_t {
630#endif // _LIBCPP_STD_VER > 17
631
632static_assert((is_same<underlying_type<memory_order>::type, __memory_order_underlying_t>::value),
633 "unexpected underlying type for std::memory_order");
634
635#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) || \
636 defined(_LIBCPP_ATOMIC_ONLY_USE_BUILTINS)
637
638// [atomics.types.generic]p1 guarantees _Tp is trivially copyable. Because
639// the default operator= in an object is not volatile, a byte-by-byte copy
640// is required.
641template <typename _Tp, typename _Tv> _LIBCPP_INLINE_VISIBILITY
642typename enable_if<is_assignable<_Tp&, _Tv>::value>::type
643__cxx_atomic_assign_volatile(_Tp& __a_value, _Tv const& __val) {
644 __a_value = __val;
645}
646template <typename _Tp, typename _Tv> _LIBCPP_INLINE_VISIBILITY
647typename enable_if<is_assignable<_Tp&, _Tv>::value>::type
648__cxx_atomic_assign_volatile(_Tp volatile& __a_value, _Tv volatile const& __val) {
649 volatile char* __to = reinterpret_cast<volatile char*>(&__a_value);
650 volatile char* __end = __to + sizeof(_Tp);
651 volatile const char* __from = reinterpret_cast<volatile const char*>(&__val);
652 while (__to != __end)
653 *__to++ = *__from++;
654}
591655
592#if _GNUC_VER >= 501
593 static_assert(is_trivially_copyable<_Tp>::value,
594 "std::atomic<Tp> requires that 'Tp' be a trivially copyable type");
595656#endif
596657
658#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
659
660template <typename _Tp>
661struct __cxx_atomic_base_impl {
662
597663 _LIBCPP_INLINE_VISIBILITY
598664#ifndef _LIBCPP_CXX03_LANG
599 __gcc_atomic_t() _NOEXCEPT = default;
665 __cxx_atomic_base_impl() _NOEXCEPT = default;
600666#else
601 __gcc_atomic_t() _NOEXCEPT : __a_value() {}
667 __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {}
602668#endif // _LIBCPP_CXX03_LANG
603 _LIBCPP_CONSTEXPR explicit __gcc_atomic_t(_Tp value) _NOEXCEPT
669 _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT
604670 : __a_value(value) {}
605671 _Tp __a_value;
606672};
607#define _Atomic(x) __gcc_atomic::__gcc_atomic_t<x>
608
609template <typename _Tp> _Tp __create();
610
611template <typename _Tp, typename _Td>
612typename enable_if<sizeof(_Tp()->__a_value = __create<_Td>()), char>::type
613 __test_atomic_assignable(int);
614template <typename _Tp, typename _Up>
615__two __test_atomic_assignable(...);
616
617template <typename _Tp, typename _Td>
618struct __can_assign {
619 static const bool value =
620 sizeof(__test_atomic_assignable<_Tp, _Td>(1)) == sizeof(char);
621};
622673
623static inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) {
674_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) {
624675 // Avoid switch statement to make this a constexpr.
625676 return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
626677 (__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
......@@ -630,7 +681,7 @@ static inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) {
630681 __ATOMIC_CONSUME))));
631682}
632683
633static inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) {
684_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) {
634685 // Avoid switch statement to make this a constexpr.
635686 return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
636687 (__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
......@@ -640,133 +691,125 @@ static inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order)
640691 __ATOMIC_CONSUME))));
641692}
642693
643} // namespace __gcc_atomic
644
645template <typename _Tp>
646static inline
647typename enable_if<
648 __gcc_atomic::__can_assign<volatile _Atomic(_Tp)*, _Tp>::value>::type
649__c11_atomic_init(volatile _Atomic(_Tp)* __a, _Tp __val) {
650 __a->__a_value = __val;
651}
652
653694template <typename _Tp>
654static inline
655typename enable_if<
656 !__gcc_atomic::__can_assign<volatile _Atomic(_Tp)*, _Tp>::value &&
657 __gcc_atomic::__can_assign< _Atomic(_Tp)*, _Tp>::value>::type
658__c11_atomic_init(volatile _Atomic(_Tp)* __a, _Tp __val) {
659 // [atomics.types.generic]p1 guarantees _Tp is trivially copyable. Because
660 // the default operator= in an object is not volatile, a byte-by-byte copy
661 // is required.
662 volatile char* to = reinterpret_cast<volatile char*>(&__a->__a_value);
663 volatile char* end = to + sizeof(_Tp);
664 char* from = reinterpret_cast<char*>(&__val);
665 while (to != end) {
666 *to++ = *from++;
667 }
695_LIBCPP_INLINE_VISIBILITY
696void __cxx_atomic_init(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __val) {
697 __cxx_atomic_assign_volatile(__a->__a_value, __val);
668698}
669699
670700template <typename _Tp>
671static inline void __c11_atomic_init(_Atomic(_Tp)* __a, _Tp __val) {
701_LIBCPP_INLINE_VISIBILITY
702void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val) {
672703 __a->__a_value = __val;
673704}
674705
675static inline void __c11_atomic_thread_fence(memory_order __order) {
676 __atomic_thread_fence(__gcc_atomic::__to_gcc_order(__order));
706_LIBCPP_INLINE_VISIBILITY inline
707void __cxx_atomic_thread_fence(memory_order __order) {
708 __atomic_thread_fence(__to_gcc_order(__order));
677709}
678710
679static inline void __c11_atomic_signal_fence(memory_order __order) {
680 __atomic_signal_fence(__gcc_atomic::__to_gcc_order(__order));
711_LIBCPP_INLINE_VISIBILITY inline
712void __cxx_atomic_signal_fence(memory_order __order) {
713 __atomic_signal_fence(__to_gcc_order(__order));
681714}
682715
683716template <typename _Tp>
684static inline void __c11_atomic_store(volatile _Atomic(_Tp)* __a, _Tp __val,
685 memory_order __order) {
686 return __atomic_store(&__a->__a_value, &__val,
687 __gcc_atomic::__to_gcc_order(__order));
717_LIBCPP_INLINE_VISIBILITY
718void __cxx_atomic_store(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __val,
719 memory_order __order) {
720 __atomic_store(&__a->__a_value, &__val,
721 __to_gcc_order(__order));
688722}
689723
690724template <typename _Tp>
691static inline void __c11_atomic_store(_Atomic(_Tp)* __a, _Tp __val,
692 memory_order __order) {
725_LIBCPP_INLINE_VISIBILITY
726void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val,
727 memory_order __order) {
693728 __atomic_store(&__a->__a_value, &__val,
694 __gcc_atomic::__to_gcc_order(__order));
729 __to_gcc_order(__order));
695730}
696731
697732template <typename _Tp>
698static inline _Tp __c11_atomic_load(const volatile _Atomic(_Tp)* __a,
699 memory_order __order) {
733_LIBCPP_INLINE_VISIBILITY
734_Tp __cxx_atomic_load(const volatile __cxx_atomic_base_impl<_Tp>* __a,
735 memory_order __order) {
700736 _Tp __ret;
701737 __atomic_load(&__a->__a_value, &__ret,
702 __gcc_atomic::__to_gcc_order(__order));
738 __to_gcc_order(__order));
703739 return __ret;
704740}
705741
706742template <typename _Tp>
707static inline _Tp __c11_atomic_load(const _Atomic(_Tp)* __a, memory_order __order) {
743_LIBCPP_INLINE_VISIBILITY
744_Tp __cxx_atomic_load(const __cxx_atomic_base_impl<_Tp>* __a, memory_order __order) {
708745 _Tp __ret;
709746 __atomic_load(&__a->__a_value, &__ret,
710 __gcc_atomic::__to_gcc_order(__order));
747 __to_gcc_order(__order));
711748 return __ret;
712749}
713750
714751template <typename _Tp>
715static inline _Tp __c11_atomic_exchange(volatile _Atomic(_Tp)* __a,
716 _Tp __value, memory_order __order) {
752_LIBCPP_INLINE_VISIBILITY
753_Tp __cxx_atomic_exchange(volatile __cxx_atomic_base_impl<_Tp>* __a,
754 _Tp __value, memory_order __order) {
717755 _Tp __ret;
718756 __atomic_exchange(&__a->__a_value, &__value, &__ret,
719 __gcc_atomic::__to_gcc_order(__order));
757 __to_gcc_order(__order));
720758 return __ret;
721759}
722760
723761template <typename _Tp>
724static inline _Tp __c11_atomic_exchange(_Atomic(_Tp)* __a, _Tp __value,
725 memory_order __order) {
762_LIBCPP_INLINE_VISIBILITY
763_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp>* __a, _Tp __value,
764 memory_order __order) {
726765 _Tp __ret;
727766 __atomic_exchange(&__a->__a_value, &__value, &__ret,
728 __gcc_atomic::__to_gcc_order(__order));
767 __to_gcc_order(__order));
729768 return __ret;
730769}
731770
732771template <typename _Tp>
733static inline bool __c11_atomic_compare_exchange_strong(
734 volatile _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value,
772_LIBCPP_INLINE_VISIBILITY
773bool __cxx_atomic_compare_exchange_strong(
774 volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value,
735775 memory_order __success, memory_order __failure) {
736776 return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
737777 false,
738 __gcc_atomic::__to_gcc_order(__success),
739 __gcc_atomic::__to_gcc_failure_order(__failure));
778 __to_gcc_order(__success),
779 __to_gcc_failure_order(__failure));
740780}
741781
742782template <typename _Tp>
743static inline bool __c11_atomic_compare_exchange_strong(
744 _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, memory_order __success,
783_LIBCPP_INLINE_VISIBILITY
784bool __cxx_atomic_compare_exchange_strong(
785 __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success,
745786 memory_order __failure) {
746787 return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
747788 false,
748 __gcc_atomic::__to_gcc_order(__success),
749 __gcc_atomic::__to_gcc_failure_order(__failure));
789 __to_gcc_order(__success),
790 __to_gcc_failure_order(__failure));
750791}
751792
752793template <typename _Tp>
753static inline bool __c11_atomic_compare_exchange_weak(
754 volatile _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value,
794_LIBCPP_INLINE_VISIBILITY
795bool __cxx_atomic_compare_exchange_weak(
796 volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value,
755797 memory_order __success, memory_order __failure) {
756798 return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
757799 true,
758 __gcc_atomic::__to_gcc_order(__success),
759 __gcc_atomic::__to_gcc_failure_order(__failure));
800 __to_gcc_order(__success),
801 __to_gcc_failure_order(__failure));
760802}
761803
762804template <typename _Tp>
763static inline bool __c11_atomic_compare_exchange_weak(
764 _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, memory_order __success,
805_LIBCPP_INLINE_VISIBILITY
806bool __cxx_atomic_compare_exchange_weak(
807 __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success,
765808 memory_order __failure) {
766809 return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
767810 true,
768 __gcc_atomic::__to_gcc_order(__success),
769 __gcc_atomic::__to_gcc_failure_order(__failure));
811 __to_gcc_order(__success),
812 __to_gcc_failure_order(__failure));
770813}
771814
772815template <typename _Tp>
......@@ -783,80 +826,264 @@ template <typename _Tp, int n>
783826struct __skip_amt<_Tp[n]> { };
784827
785828template <typename _Tp, typename _Td>
786static inline _Tp __c11_atomic_fetch_add(volatile _Atomic(_Tp)* __a,
787 _Td __delta, memory_order __order) {
829_LIBCPP_INLINE_VISIBILITY
830_Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_base_impl<_Tp>* __a,
831 _Td __delta, memory_order __order) {
788832 return __atomic_fetch_add(&__a->__a_value, __delta * __skip_amt<_Tp>::value,
789 __gcc_atomic::__to_gcc_order(__order));
833 __to_gcc_order(__order));
790834}
791835
792836template <typename _Tp, typename _Td>
793static inline _Tp __c11_atomic_fetch_add(_Atomic(_Tp)* __a, _Td __delta,
794 memory_order __order) {
837_LIBCPP_INLINE_VISIBILITY
838_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp>* __a, _Td __delta,
839 memory_order __order) {
795840 return __atomic_fetch_add(&__a->__a_value, __delta * __skip_amt<_Tp>::value,
796 __gcc_atomic::__to_gcc_order(__order));
841 __to_gcc_order(__order));
797842}
798843
799844template <typename _Tp, typename _Td>
800static inline _Tp __c11_atomic_fetch_sub(volatile _Atomic(_Tp)* __a,
801 _Td __delta, memory_order __order) {
845_LIBCPP_INLINE_VISIBILITY
846_Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_base_impl<_Tp>* __a,
847 _Td __delta, memory_order __order) {
802848 return __atomic_fetch_sub(&__a->__a_value, __delta * __skip_amt<_Tp>::value,
803 __gcc_atomic::__to_gcc_order(__order));
849 __to_gcc_order(__order));
804850}
805851
806852template <typename _Tp, typename _Td>
807static inline _Tp __c11_atomic_fetch_sub(_Atomic(_Tp)* __a, _Td __delta,
808 memory_order __order) {
853_LIBCPP_INLINE_VISIBILITY
854_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp>* __a, _Td __delta,
855 memory_order __order) {
809856 return __atomic_fetch_sub(&__a->__a_value, __delta * __skip_amt<_Tp>::value,
810 __gcc_atomic::__to_gcc_order(__order));
857 __to_gcc_order(__order));
811858}
812859
813860template <typename _Tp>
814static inline _Tp __c11_atomic_fetch_and(volatile _Atomic(_Tp)* __a,
815 _Tp __pattern, memory_order __order) {
861_LIBCPP_INLINE_VISIBILITY
862_Tp __cxx_atomic_fetch_and(volatile __cxx_atomic_base_impl<_Tp>* __a,
863 _Tp __pattern, memory_order __order) {
816864 return __atomic_fetch_and(&__a->__a_value, __pattern,
817 __gcc_atomic::__to_gcc_order(__order));
865 __to_gcc_order(__order));
818866}
819867
820868template <typename _Tp>
821static inline _Tp __c11_atomic_fetch_and(_Atomic(_Tp)* __a,
822 _Tp __pattern, memory_order __order) {
869_LIBCPP_INLINE_VISIBILITY
870_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp>* __a,
871 _Tp __pattern, memory_order __order) {
823872 return __atomic_fetch_and(&__a->__a_value, __pattern,
824 __gcc_atomic::__to_gcc_order(__order));
873 __to_gcc_order(__order));
825874}
826875
827876template <typename _Tp>
828static inline _Tp __c11_atomic_fetch_or(volatile _Atomic(_Tp)* __a,
829 _Tp __pattern, memory_order __order) {
877_LIBCPP_INLINE_VISIBILITY
878_Tp __cxx_atomic_fetch_or(volatile __cxx_atomic_base_impl<_Tp>* __a,
879 _Tp __pattern, memory_order __order) {
830880 return __atomic_fetch_or(&__a->__a_value, __pattern,
831 __gcc_atomic::__to_gcc_order(__order));
881 __to_gcc_order(__order));
832882}
833883
834884template <typename _Tp>
835static inline _Tp __c11_atomic_fetch_or(_Atomic(_Tp)* __a, _Tp __pattern,
836 memory_order __order) {
885_LIBCPP_INLINE_VISIBILITY
886_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern,
887 memory_order __order) {
837888 return __atomic_fetch_or(&__a->__a_value, __pattern,
838 __gcc_atomic::__to_gcc_order(__order));
889 __to_gcc_order(__order));
839890}
840891
841892template <typename _Tp>
842static inline _Tp __c11_atomic_fetch_xor(volatile _Atomic(_Tp)* __a,
843 _Tp __pattern, memory_order __order) {
893_LIBCPP_INLINE_VISIBILITY
894_Tp __cxx_atomic_fetch_xor(volatile __cxx_atomic_base_impl<_Tp>* __a,
895 _Tp __pattern, memory_order __order) {
844896 return __atomic_fetch_xor(&__a->__a_value, __pattern,
845 __gcc_atomic::__to_gcc_order(__order));
897 __to_gcc_order(__order));
846898}
847899
848900template <typename _Tp>
849static inline _Tp __c11_atomic_fetch_xor(_Atomic(_Tp)* __a, _Tp __pattern,
850 memory_order __order) {
901_LIBCPP_INLINE_VISIBILITY
902_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern,
903 memory_order __order) {
851904 return __atomic_fetch_xor(&__a->__a_value, __pattern,
852 __gcc_atomic::__to_gcc_order(__order));
905 __to_gcc_order(__order));
906}
907
908#define __cxx_atomic_is_lock_free(__s) __atomic_is_lock_free(__s, 0)
909
910#elif defined(_LIBCPP_HAS_C_ATOMIC_IMP)
911
912template <typename _Tp>
913struct __cxx_atomic_base_impl {
914
915 _LIBCPP_INLINE_VISIBILITY
916#ifndef _LIBCPP_CXX03_LANG
917 __cxx_atomic_base_impl() _NOEXCEPT = default;
918#else
919 __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {}
920#endif // _LIBCPP_CXX03_LANG
921 _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT
922 : __a_value(value) {}
923 _Atomic(_Tp) __a_value;
924};
925
926#define __cxx_atomic_is_lock_free(__s) __c11_atomic_is_lock_free(__s)
927
928_LIBCPP_INLINE_VISIBILITY inline
929void __cxx_atomic_thread_fence(memory_order __order) _NOEXCEPT {
930 __c11_atomic_thread_fence(static_cast<__memory_order_underlying_t>(__order));
931}
932
933_LIBCPP_INLINE_VISIBILITY inline
934void __cxx_atomic_signal_fence(memory_order __order) _NOEXCEPT {
935 __c11_atomic_signal_fence(static_cast<__memory_order_underlying_t>(__order));
936}
937
938template<class _Tp>
939_LIBCPP_INLINE_VISIBILITY
940void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val) _NOEXCEPT {
941 __c11_atomic_init(&__a->__a_value, __val);
942}
943template<class _Tp>
944_LIBCPP_INLINE_VISIBILITY
945void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp> * __a, _Tp __val) _NOEXCEPT {
946 __c11_atomic_init(&__a->__a_value, __val);
947}
948
949template<class _Tp>
950_LIBCPP_INLINE_VISIBILITY
951void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val, memory_order __order) _NOEXCEPT {
952 __c11_atomic_store(&__a->__a_value, __val, static_cast<__memory_order_underlying_t>(__order));
953}
954template<class _Tp>
955_LIBCPP_INLINE_VISIBILITY
956void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp> * __a, _Tp __val, memory_order __order) _NOEXCEPT {
957 __c11_atomic_store(&__a->__a_value, __val, static_cast<__memory_order_underlying_t>(__order));
958}
959
960template<class _Tp>
961_LIBCPP_INLINE_VISIBILITY
962_Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const volatile* __a, memory_order __order) _NOEXCEPT {
963 using __ptr_type = typename remove_const<decltype(__a->__a_value)>::type*;
964 return __c11_atomic_load(const_cast<__ptr_type>(&__a->__a_value), static_cast<__memory_order_underlying_t>(__order));
965}
966template<class _Tp>
967_LIBCPP_INLINE_VISIBILITY
968_Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const* __a, memory_order __order) _NOEXCEPT {
969 using __ptr_type = typename remove_const<decltype(__a->__a_value)>::type*;
970 return __c11_atomic_load(const_cast<__ptr_type>(&__a->__a_value), static_cast<__memory_order_underlying_t>(__order));
971}
972
973template<class _Tp>
974_LIBCPP_INLINE_VISIBILITY
975_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __value, memory_order __order) _NOEXCEPT {
976 return __c11_atomic_exchange(&__a->__a_value, __value, static_cast<__memory_order_underlying_t>(__order));
977}
978template<class _Tp>
979_LIBCPP_INLINE_VISIBILITY
980_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> * __a, _Tp __value, memory_order __order) _NOEXCEPT {
981 return __c11_atomic_exchange(&__a->__a_value, __value, static_cast<__memory_order_underlying_t>(__order));
982}
983
984template<class _Tp>
985_LIBCPP_INLINE_VISIBILITY
986bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
987 return __c11_atomic_compare_exchange_strong(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__failure));
988}
989template<class _Tp>
990_LIBCPP_INLINE_VISIBILITY
991bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> * __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
992 return __c11_atomic_compare_exchange_strong(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__failure));
993}
994
995template<class _Tp>
996_LIBCPP_INLINE_VISIBILITY
997bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
998 return __c11_atomic_compare_exchange_weak(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__failure));
999}
1000template<class _Tp>
1001_LIBCPP_INLINE_VISIBILITY
1002bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> * __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
1003 return __c11_atomic_compare_exchange_weak(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__failure));
1004}
1005
1006template<class _Tp>
1007_LIBCPP_INLINE_VISIBILITY
1008_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) _NOEXCEPT {
1009 return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
1010}
1011template<class _Tp>
1012_LIBCPP_INLINE_VISIBILITY
1013_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp> * __a, _Tp __delta, memory_order __order) _NOEXCEPT {
1014 return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
1015}
1016
1017template<class _Tp>
1018_LIBCPP_INLINE_VISIBILITY
1019_Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
1020 return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
8531021}
854#endif // _LIBCPP_HAS_GCC_ATOMIC_IMP
1022template<class _Tp>
1023_LIBCPP_INLINE_VISIBILITY
1024_Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
1025 return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
1026}
1027
1028template<class _Tp>
1029_LIBCPP_INLINE_VISIBILITY
1030_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) _NOEXCEPT {
1031 return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
1032}
1033template<class _Tp>
1034_LIBCPP_INLINE_VISIBILITY
1035_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp> * __a, _Tp __delta, memory_order __order) _NOEXCEPT {
1036 return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
1037}
1038template<class _Tp>
1039_LIBCPP_INLINE_VISIBILITY
1040_Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
1041 return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
1042}
1043template<class _Tp>
1044_LIBCPP_INLINE_VISIBILITY
1045_Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
1046 return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
1047}
1048
1049template<class _Tp>
1050_LIBCPP_INLINE_VISIBILITY
1051_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
1052 return __c11_atomic_fetch_and(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order));
1053}
1054template<class _Tp>
1055_LIBCPP_INLINE_VISIBILITY
1056_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
1057 return __c11_atomic_fetch_and(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order));
1058}
1059
1060template<class _Tp>
1061_LIBCPP_INLINE_VISIBILITY
1062_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
1063 return __c11_atomic_fetch_or(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order));
1064}
1065template<class _Tp>
1066_LIBCPP_INLINE_VISIBILITY
1067_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
1068 return __c11_atomic_fetch_or(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order));
1069}
1070
1071template<class _Tp>
1072_LIBCPP_INLINE_VISIBILITY
1073_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
1074 return __c11_atomic_fetch_xor(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order));
1075}
1076template<class _Tp>
1077_LIBCPP_INLINE_VISIBILITY
1078_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
1079 return __c11_atomic_fetch_xor(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order));
1080}
1081
1082#endif // _LIBCPP_HAS_GCC_ATOMIC_IMP, _LIBCPP_HAS_C_ATOMIC_IMP
8551083
8561084template <class _Tp>
857inline _LIBCPP_INLINE_VISIBILITY
858_Tp
859kill_dependency(_Tp __y) _NOEXCEPT
1085_LIBCPP_INLINE_VISIBILITY
1086_Tp kill_dependency(_Tp __y) _NOEXCEPT
8601087{
8611088 return __y;
8621089}
......@@ -872,7 +1099,7 @@ kill_dependency(_Tp __y) _NOEXCEPT
8721099# define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE
8731100# define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE
8741101# define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE
875#else
1102#elif defined(__GCC_ATOMIC_BOOL_LOCK_FREE)
8761103# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
8771104# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
8781105# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
......@@ -885,12 +1112,352 @@ kill_dependency(_Tp __y) _NOEXCEPT
8851112# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
8861113#endif
8871114
1115#ifdef _LIBCPP_ATOMIC_ONLY_USE_BUILTINS
1116
1117template<typename _Tp>
1118struct __cxx_atomic_lock_impl {
1119
1120 _LIBCPP_INLINE_VISIBILITY
1121 __cxx_atomic_lock_impl() _NOEXCEPT
1122 : __a_value(), __a_lock(0) {}
1123 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR explicit
1124 __cxx_atomic_lock_impl(_Tp value) _NOEXCEPT
1125 : __a_value(value), __a_lock(0) {}
1126
1127 _Tp __a_value;
1128 mutable __cxx_atomic_base_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_lock;
1129
1130 _LIBCPP_INLINE_VISIBILITY void __lock() const volatile {
1131 while(1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire))
1132 /*spin*/;
1133 }
1134 _LIBCPP_INLINE_VISIBILITY void __lock() const {
1135 while(1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire))
1136 /*spin*/;
1137 }
1138 _LIBCPP_INLINE_VISIBILITY void __unlock() const volatile {
1139 __cxx_atomic_store(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(false), memory_order_release);
1140 }
1141 _LIBCPP_INLINE_VISIBILITY void __unlock() const {
1142 __cxx_atomic_store(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(false), memory_order_release);
1143 }
1144 _LIBCPP_INLINE_VISIBILITY _Tp __read() const volatile {
1145 __lock();
1146 _Tp __old;
1147 __cxx_atomic_assign_volatile(__old, __a_value);
1148 __unlock();
1149 return __old;
1150 }
1151 _LIBCPP_INLINE_VISIBILITY _Tp __read() const {
1152 __lock();
1153 _Tp __old = __a_value;
1154 __unlock();
1155 return __old;
1156 }
1157};
1158
1159template <typename _Tp>
1160_LIBCPP_INLINE_VISIBILITY
1161void __cxx_atomic_init(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __val) {
1162 __cxx_atomic_assign_volatile(__a->__a_value, __val);
1163}
1164template <typename _Tp>
1165_LIBCPP_INLINE_VISIBILITY
1166void __cxx_atomic_init(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __val) {
1167 __a->__a_value = __val;
1168}
1169
1170template <typename _Tp>
1171_LIBCPP_INLINE_VISIBILITY
1172void __cxx_atomic_store(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __val, memory_order) {
1173 __a->__lock();
1174 __cxx_atomic_assign_volatile(__a->__a_value, __val);
1175 __a->__unlock();
1176}
1177template <typename _Tp>
1178_LIBCPP_INLINE_VISIBILITY
1179void __cxx_atomic_store(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __val, memory_order) {
1180 __a->__lock();
1181 __a->__a_value = __val;
1182 __a->__unlock();
1183}
1184
1185template <typename _Tp>
1186_LIBCPP_INLINE_VISIBILITY
1187_Tp __cxx_atomic_load(const volatile __cxx_atomic_lock_impl<_Tp>* __a, memory_order) {
1188 return __a->__read();
1189}
1190template <typename _Tp>
1191_LIBCPP_INLINE_VISIBILITY
1192_Tp __cxx_atomic_load(const __cxx_atomic_lock_impl<_Tp>* __a, memory_order) {
1193 return __a->__read();
1194}
1195
1196template <typename _Tp>
1197_LIBCPP_INLINE_VISIBILITY
1198_Tp __cxx_atomic_exchange(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) {
1199 __a->__lock();
1200 _Tp __old;
1201 __cxx_atomic_assign_volatile(__old, __a->__a_value);
1202 __cxx_atomic_assign_volatile(__a->__a_value, __value);
1203 __a->__unlock();
1204 return __old;
1205}
1206template <typename _Tp>
1207_LIBCPP_INLINE_VISIBILITY
1208_Tp __cxx_atomic_exchange(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) {
1209 __a->__lock();
1210 _Tp __old = __a->__a_value;
1211 __a->__a_value = __value;
1212 __a->__unlock();
1213 return __old;
1214}
1215
1216template <typename _Tp>
1217_LIBCPP_INLINE_VISIBILITY
1218bool __cxx_atomic_compare_exchange_strong(volatile __cxx_atomic_lock_impl<_Tp>* __a,
1219 _Tp* __expected, _Tp __value, memory_order, memory_order) {
1220 __a->__lock();
1221 _Tp temp;
1222 __cxx_atomic_assign_volatile(temp, __a->__a_value);
1223 bool __ret = temp == *__expected;
1224 if(__ret)
1225 __cxx_atomic_assign_volatile(__a->__a_value, __value);
1226 else
1227 __cxx_atomic_assign_volatile(*__expected, __a->__a_value);
1228 __a->__unlock();
1229 return __ret;
1230}
1231template <typename _Tp>
1232_LIBCPP_INLINE_VISIBILITY
1233bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_lock_impl<_Tp>* __a,
1234 _Tp* __expected, _Tp __value, memory_order, memory_order) {
1235 __a->__lock();
1236 bool __ret = __a->__a_value == *__expected;
1237 if(__ret)
1238 __a->__a_value = __value;
1239 else
1240 *__expected = __a->__a_value;
1241 __a->__unlock();
1242 return __ret;
1243}
1244
1245template <typename _Tp>
1246_LIBCPP_INLINE_VISIBILITY
1247bool __cxx_atomic_compare_exchange_weak(volatile __cxx_atomic_lock_impl<_Tp>* __a,
1248 _Tp* __expected, _Tp __value, memory_order, memory_order) {
1249 __a->__lock();
1250 _Tp temp;
1251 __cxx_atomic_assign_volatile(temp, __a->__a_value);
1252 bool __ret = temp == *__expected;
1253 if(__ret)
1254 __cxx_atomic_assign_volatile(__a->__a_value, __value);
1255 else
1256 __cxx_atomic_assign_volatile(*__expected, __a->__a_value);
1257 __a->__unlock();
1258 return __ret;
1259}
1260template <typename _Tp>
1261_LIBCPP_INLINE_VISIBILITY
1262bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_lock_impl<_Tp>* __a,
1263 _Tp* __expected, _Tp __value, memory_order, memory_order) {
1264 __a->__lock();
1265 bool __ret = __a->__a_value == *__expected;
1266 if(__ret)
1267 __a->__a_value = __value;
1268 else
1269 *__expected = __a->__a_value;
1270 __a->__unlock();
1271 return __ret;
1272}
1273
1274template <typename _Tp, typename _Td>
1275_LIBCPP_INLINE_VISIBILITY
1276_Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp>* __a,
1277 _Td __delta, memory_order) {
1278 __a->__lock();
1279 _Tp __old;
1280 __cxx_atomic_assign_volatile(__old, __a->__a_value);
1281 __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old + __delta));
1282 __a->__unlock();
1283 return __old;
1284}
1285template <typename _Tp, typename _Td>
1286_LIBCPP_INLINE_VISIBILITY
1287_Tp __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp>* __a,
1288 _Td __delta, memory_order) {
1289 __a->__lock();
1290 _Tp __old = __a->__a_value;
1291 __a->__a_value += __delta;
1292 __a->__unlock();
1293 return __old;
1294}
1295
1296template <typename _Tp, typename _Td>
1297_LIBCPP_INLINE_VISIBILITY
1298_Tp* __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp*>* __a,
1299 ptrdiff_t __delta, memory_order) {
1300 __a->__lock();
1301 _Tp* __old;
1302 __cxx_atomic_assign_volatile(__old, __a->__a_value);
1303 __cxx_atomic_assign_volatile(__a->__a_value, __old + __delta);
1304 __a->__unlock();
1305 return __old;
1306}
1307template <typename _Tp, typename _Td>
1308_LIBCPP_INLINE_VISIBILITY
1309_Tp* __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp*>* __a,
1310 ptrdiff_t __delta, memory_order) {
1311 __a->__lock();
1312 _Tp* __old = __a->__a_value;
1313 __a->__a_value += __delta;
1314 __a->__unlock();
1315 return __old;
1316}
1317
1318template <typename _Tp, typename _Td>
1319_LIBCPP_INLINE_VISIBILITY
1320_Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_lock_impl<_Tp>* __a,
1321 _Td __delta, memory_order) {
1322 __a->__lock();
1323 _Tp __old;
1324 __cxx_atomic_assign_volatile(__old, __a->__a_value);
1325 __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old - __delta));
1326 __a->__unlock();
1327 return __old;
1328}
1329template <typename _Tp, typename _Td>
1330_LIBCPP_INLINE_VISIBILITY
1331_Tp __cxx_atomic_fetch_sub(__cxx_atomic_lock_impl<_Tp>* __a,
1332 _Td __delta, memory_order) {
1333 __a->__lock();
1334 _Tp __old = __a->__a_value;
1335 __a->__a_value -= __delta;
1336 __a->__unlock();
1337 return __old;
1338}
1339
1340template <typename _Tp>
1341_LIBCPP_INLINE_VISIBILITY
1342_Tp __cxx_atomic_fetch_and(volatile __cxx_atomic_lock_impl<_Tp>* __a,
1343 _Tp __pattern, memory_order) {
1344 __a->__lock();
1345 _Tp __old;
1346 __cxx_atomic_assign_volatile(__old, __a->__a_value);
1347 __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old & __pattern));
1348 __a->__unlock();
1349 return __old;
1350}
1351template <typename _Tp>
1352_LIBCPP_INLINE_VISIBILITY
1353_Tp __cxx_atomic_fetch_and(__cxx_atomic_lock_impl<_Tp>* __a,
1354 _Tp __pattern, memory_order) {
1355 __a->__lock();
1356 _Tp __old = __a->__a_value;
1357 __a->__a_value &= __pattern;
1358 __a->__unlock();
1359 return __old;
1360}
1361
1362template <typename _Tp>
1363_LIBCPP_INLINE_VISIBILITY
1364_Tp __cxx_atomic_fetch_or(volatile __cxx_atomic_lock_impl<_Tp>* __a,
1365 _Tp __pattern, memory_order) {
1366 __a->__lock();
1367 _Tp __old;
1368 __cxx_atomic_assign_volatile(__old, __a->__a_value);
1369 __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old | __pattern));
1370 __a->__unlock();
1371 return __old;
1372}
1373template <typename _Tp>
1374_LIBCPP_INLINE_VISIBILITY
1375_Tp __cxx_atomic_fetch_or(__cxx_atomic_lock_impl<_Tp>* __a,
1376 _Tp __pattern, memory_order) {
1377 __a->__lock();
1378 _Tp __old = __a->__a_value;
1379 __a->__a_value |= __pattern;
1380 __a->__unlock();
1381 return __old;
1382}
1383
1384template <typename _Tp>
1385_LIBCPP_INLINE_VISIBILITY
1386_Tp __cxx_atomic_fetch_xor(volatile __cxx_atomic_lock_impl<_Tp>* __a,
1387 _Tp __pattern, memory_order) {
1388 __a->__lock();
1389 _Tp __old;
1390 __cxx_atomic_assign_volatile(__old, __a->__a_value);
1391 __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old ^ __pattern));
1392 __a->__unlock();
1393 return __old;
1394}
1395template <typename _Tp>
1396_LIBCPP_INLINE_VISIBILITY
1397_Tp __cxx_atomic_fetch_xor(__cxx_atomic_lock_impl<_Tp>* __a,
1398 _Tp __pattern, memory_order) {
1399 __a->__lock();
1400 _Tp __old = __a->__a_value;
1401 __a->__a_value ^= __pattern;
1402 __a->__unlock();
1403 return __old;
1404}
1405
1406#ifdef __cpp_lib_atomic_is_always_lock_free
1407
1408template<typename _Tp> struct __cxx_is_always_lock_free {
1409 enum { __value = __atomic_always_lock_free(sizeof(_Tp), 0) }; };
1410
1411#else
1412
1413template<typename _Tp> struct __cxx_is_always_lock_free { enum { __value = false }; };
1414// Implementations must match the C ATOMIC_*_LOCK_FREE macro values.
1415template<> struct __cxx_is_always_lock_free<bool> { enum { __value = 2 == ATOMIC_BOOL_LOCK_FREE }; };
1416template<> struct __cxx_is_always_lock_free<char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
1417template<> struct __cxx_is_always_lock_free<signed char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
1418template<> struct __cxx_is_always_lock_free<unsigned char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
1419template<> struct __cxx_is_always_lock_free<char16_t> { enum { __value = 2 == ATOMIC_CHAR16_T_LOCK_FREE }; };
1420template<> struct __cxx_is_always_lock_free<char32_t> { enum { __value = 2 == ATOMIC_CHAR32_T_LOCK_FREE }; };
1421template<> struct __cxx_is_always_lock_free<wchar_t> { enum { __value = 2 == ATOMIC_WCHAR_T_LOCK_FREE }; };
1422template<> struct __cxx_is_always_lock_free<short> { enum { __value = 2 == ATOMIC_SHORT_LOCK_FREE }; };
1423template<> struct __cxx_is_always_lock_free<unsigned short> { enum { __value = 2 == ATOMIC_SHORT_LOCK_FREE }; };
1424template<> struct __cxx_is_always_lock_free<int> { enum { __value = 2 == ATOMIC_INT_LOCK_FREE }; };
1425template<> struct __cxx_is_always_lock_free<unsigned int> { enum { __value = 2 == ATOMIC_INT_LOCK_FREE }; };
1426template<> struct __cxx_is_always_lock_free<long> { enum { __value = 2 == ATOMIC_LONG_LOCK_FREE }; };
1427template<> struct __cxx_is_always_lock_free<unsigned long> { enum { __value = 2 == ATOMIC_LONG_LOCK_FREE }; };
1428template<> struct __cxx_is_always_lock_free<long long> { enum { __value = 2 == ATOMIC_LLONG_LOCK_FREE }; };
1429template<> struct __cxx_is_always_lock_free<unsigned long long> { enum { __value = 2 == ATOMIC_LLONG_LOCK_FREE }; };
1430template<typename _Tp> struct __cxx_is_always_lock_free<_Tp*> { enum { __value = 2 == ATOMIC_POINTER_LOCK_FREE }; };
1431template<> struct __cxx_is_always_lock_free<std::nullptr_t> { enum { __value = 2 == ATOMIC_POINTER_LOCK_FREE }; };
1432
1433#endif //__cpp_lib_atomic_is_always_lock_free
1434
1435template <typename _Tp,
1436 typename _Base = typename conditional<__cxx_is_always_lock_free<_Tp>::__value,
1437 __cxx_atomic_base_impl<_Tp>,
1438 __cxx_atomic_lock_impl<_Tp> >::type>
1439#else
1440template <typename _Tp,
1441 typename _Base = __cxx_atomic_base_impl<_Tp> >
1442#endif //_LIBCPP_ATOMIC_ONLY_USE_BUILTINS
1443struct __cxx_atomic_impl : public _Base {
1444
1445#if _GNUC_VER >= 501
1446 static_assert(is_trivially_copyable<_Tp>::value,
1447 "std::atomic<Tp> requires that 'Tp' be a trivially copyable type");
1448#endif
1449
1450 _LIBCPP_INLINE_VISIBILITY __cxx_atomic_impl() _NOEXCEPT _LIBCPP_DEFAULT
1451 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR explicit __cxx_atomic_impl(_Tp value) _NOEXCEPT
1452 : _Base(value) {}
1453};
1454
8881455// general atomic<T>
8891456
8901457template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value>
8911458struct __atomic_base // false
8921459{
893 mutable _Atomic(_Tp) __a_;
1460 mutable __cxx_atomic_impl<_Tp> __a_;
8941461
8951462#if defined(__cpp_lib_atomic_is_always_lock_free)
8961463 static _LIBCPP_CONSTEXPR bool is_always_lock_free = __atomic_always_lock_free(sizeof(__a_), 0);
......@@ -898,88 +1465,79 @@ struct __atomic_base // false
8981465
8991466 _LIBCPP_INLINE_VISIBILITY
9001467 bool is_lock_free() const volatile _NOEXCEPT
901 {
902#if defined(_LIBCPP_HAS_C_ATOMIC_IMP)
903 return __c11_atomic_is_lock_free(sizeof(_Tp));
904#else
905 return __atomic_is_lock_free(sizeof(_Tp), 0);
906#endif
907 }
1468 {return __cxx_atomic_is_lock_free(sizeof(_Tp));}
9081469 _LIBCPP_INLINE_VISIBILITY
9091470 bool is_lock_free() const _NOEXCEPT
9101471 {return static_cast<__atomic_base const volatile*>(this)->is_lock_free();}
9111472 _LIBCPP_INLINE_VISIBILITY
9121473 void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
9131474 _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
914 {__c11_atomic_store(&__a_, __d, __m);}
1475 {__cxx_atomic_store(&__a_, __d, __m);}
9151476 _LIBCPP_INLINE_VISIBILITY
9161477 void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT
9171478 _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
918 {__c11_atomic_store(&__a_, __d, __m);}
1479 {__cxx_atomic_store(&__a_, __d, __m);}
9191480 _LIBCPP_INLINE_VISIBILITY
9201481 _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
9211482 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
922 {return __c11_atomic_load(&__a_, __m);}
1483 {return __cxx_atomic_load(&__a_, __m);}
9231484 _LIBCPP_INLINE_VISIBILITY
9241485 _Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT
9251486 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
926 {return __c11_atomic_load(&__a_, __m);}
1487 {return __cxx_atomic_load(&__a_, __m);}
9271488 _LIBCPP_INLINE_VISIBILITY
9281489 operator _Tp() const volatile _NOEXCEPT {return load();}
9291490 _LIBCPP_INLINE_VISIBILITY
9301491 operator _Tp() const _NOEXCEPT {return load();}
9311492 _LIBCPP_INLINE_VISIBILITY
9321493 _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
933 {return __c11_atomic_exchange(&__a_, __d, __m);}
1494 {return __cxx_atomic_exchange(&__a_, __d, __m);}
9341495 _LIBCPP_INLINE_VISIBILITY
9351496 _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT
936 {return __c11_atomic_exchange(&__a_, __d, __m);}
1497 {return __cxx_atomic_exchange(&__a_, __d, __m);}
9371498 _LIBCPP_INLINE_VISIBILITY
9381499 bool compare_exchange_weak(_Tp& __e, _Tp __d,
9391500 memory_order __s, memory_order __f) volatile _NOEXCEPT
9401501 _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
941 {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
1502 {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
9421503 _LIBCPP_INLINE_VISIBILITY
9431504 bool compare_exchange_weak(_Tp& __e, _Tp __d,
9441505 memory_order __s, memory_order __f) _NOEXCEPT
9451506 _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
946 {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
1507 {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
9471508 _LIBCPP_INLINE_VISIBILITY
9481509 bool compare_exchange_strong(_Tp& __e, _Tp __d,
9491510 memory_order __s, memory_order __f) volatile _NOEXCEPT
9501511 _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
951 {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
1512 {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
9521513 _LIBCPP_INLINE_VISIBILITY
9531514 bool compare_exchange_strong(_Tp& __e, _Tp __d,
9541515 memory_order __s, memory_order __f) _NOEXCEPT
9551516 _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
956 {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
1517 {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
9571518 _LIBCPP_INLINE_VISIBILITY
9581519 bool compare_exchange_weak(_Tp& __e, _Tp __d,
9591520 memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
960 {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}
1521 {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}
9611522 _LIBCPP_INLINE_VISIBILITY
9621523 bool compare_exchange_weak(_Tp& __e, _Tp __d,
9631524 memory_order __m = memory_order_seq_cst) _NOEXCEPT
964 {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}
1525 {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}
9651526 _LIBCPP_INLINE_VISIBILITY
9661527 bool compare_exchange_strong(_Tp& __e, _Tp __d,
9671528 memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
968 {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}
1529 {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}
9691530 _LIBCPP_INLINE_VISIBILITY
9701531 bool compare_exchange_strong(_Tp& __e, _Tp __d,
9711532 memory_order __m = memory_order_seq_cst) _NOEXCEPT
972 {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}
1533 {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}
9731534
9741535 _LIBCPP_INLINE_VISIBILITY
975#ifndef _LIBCPP_CXX03_LANG
976 __atomic_base() _NOEXCEPT = default;
977#else
978 __atomic_base() _NOEXCEPT : __a_() {}
979#endif // _LIBCPP_CXX03_LANG
1536 __atomic_base() _NOEXCEPT _LIBCPP_DEFAULT
1537
1538 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
1539 __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {}
9801540
981 _LIBCPP_INLINE_VISIBILITY
982 _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {}
9831541#ifndef _LIBCPP_CXX03_LANG
9841542 __atomic_base(const __atomic_base&) = delete;
9851543 __atomic_base& operator=(const __atomic_base&) = delete;
......@@ -1011,34 +1569,34 @@ struct __atomic_base<_Tp, true>
10111569
10121570 _LIBCPP_INLINE_VISIBILITY
10131571 _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
1014 {return __c11_atomic_fetch_add(&this->__a_, __op, __m);}
1572 {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);}
10151573 _LIBCPP_INLINE_VISIBILITY
10161574 _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
1017 {return __c11_atomic_fetch_add(&this->__a_, __op, __m);}
1575 {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);}
10181576 _LIBCPP_INLINE_VISIBILITY
10191577 _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
1020 {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);}
1578 {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);}
10211579 _LIBCPP_INLINE_VISIBILITY
10221580 _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
1023 {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);}
1581 {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);}
10241582 _LIBCPP_INLINE_VISIBILITY
10251583 _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
1026 {return __c11_atomic_fetch_and(&this->__a_, __op, __m);}
1584 {return __cxx_atomic_fetch_and(&this->__a_, __op, __m);}
10271585 _LIBCPP_INLINE_VISIBILITY
10281586 _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
1029 {return __c11_atomic_fetch_and(&this->__a_, __op, __m);}
1587 {return __cxx_atomic_fetch_and(&this->__a_, __op, __m);}
10301588 _LIBCPP_INLINE_VISIBILITY
10311589 _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
1032 {return __c11_atomic_fetch_or(&this->__a_, __op, __m);}
1590 {return __cxx_atomic_fetch_or(&this->__a_, __op, __m);}
10331591 _LIBCPP_INLINE_VISIBILITY
10341592 _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
1035 {return __c11_atomic_fetch_or(&this->__a_, __op, __m);}
1593 {return __cxx_atomic_fetch_or(&this->__a_, __op, __m);}
10361594 _LIBCPP_INLINE_VISIBILITY
10371595 _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
1038 {return __c11_atomic_fetch_xor(&this->__a_, __op, __m);}
1596 {return __cxx_atomic_fetch_xor(&this->__a_, __op, __m);}
10391597 _LIBCPP_INLINE_VISIBILITY
10401598 _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
1041 {return __c11_atomic_fetch_xor(&this->__a_, __op, __m);}
1599 {return __cxx_atomic_fetch_xor(&this->__a_, __op, __m);}
10421600
10431601 _LIBCPP_INLINE_VISIBILITY
10441602 _Tp operator++(int) volatile _NOEXCEPT {return fetch_add(_Tp(1));}
......@@ -1120,17 +1678,17 @@ struct atomic<_Tp*>
11201678 _LIBCPP_INLINE_VISIBILITY
11211679 _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst)
11221680 volatile _NOEXCEPT
1123 {return __c11_atomic_fetch_add(&this->__a_, __op, __m);}
1681 {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);}
11241682 _LIBCPP_INLINE_VISIBILITY
11251683 _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
1126 {return __c11_atomic_fetch_add(&this->__a_, __op, __m);}
1684 {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);}
11271685 _LIBCPP_INLINE_VISIBILITY
11281686 _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst)
11291687 volatile _NOEXCEPT
1130 {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);}
1688 {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);}
11311689 _LIBCPP_INLINE_VISIBILITY
11321690 _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
1133 {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);}
1691 {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);}
11341692
11351693 _LIBCPP_INLINE_VISIBILITY
11361694 _Tp* operator++(int) volatile _NOEXCEPT {return fetch_add(1);}
......@@ -1161,7 +1719,7 @@ struct atomic<_Tp*>
11611719// atomic_is_lock_free
11621720
11631721template <class _Tp>
1164inline _LIBCPP_INLINE_VISIBILITY
1722_LIBCPP_INLINE_VISIBILITY
11651723bool
11661724atomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT
11671725{
......@@ -1169,7 +1727,7 @@ atomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT
11691727}
11701728
11711729template <class _Tp>
1172inline _LIBCPP_INLINE_VISIBILITY
1730_LIBCPP_INLINE_VISIBILITY
11731731bool
11741732atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT
11751733{
......@@ -1179,25 +1737,25 @@ atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT
11791737// atomic_init
11801738
11811739template <class _Tp>
1182inline _LIBCPP_INLINE_VISIBILITY
1740_LIBCPP_INLINE_VISIBILITY
11831741void
11841742atomic_init(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
11851743{
1186 __c11_atomic_init(&__o->__a_, __d);
1744 __cxx_atomic_init(&__o->__a_, __d);
11871745}
11881746
11891747template <class _Tp>
1190inline _LIBCPP_INLINE_VISIBILITY
1748_LIBCPP_INLINE_VISIBILITY
11911749void
11921750atomic_init(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
11931751{
1194 __c11_atomic_init(&__o->__a_, __d);
1752 __cxx_atomic_init(&__o->__a_, __d);
11951753}
11961754
11971755// atomic_store
11981756
11991757template <class _Tp>
1200inline _LIBCPP_INLINE_VISIBILITY
1758_LIBCPP_INLINE_VISIBILITY
12011759void
12021760atomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
12031761{
......@@ -1205,7 +1763,7 @@ atomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
12051763}
12061764
12071765template <class _Tp>
1208inline _LIBCPP_INLINE_VISIBILITY
1766_LIBCPP_INLINE_VISIBILITY
12091767void
12101768atomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
12111769{
......@@ -1215,7 +1773,7 @@ atomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
12151773// atomic_store_explicit
12161774
12171775template <class _Tp>
1218inline _LIBCPP_INLINE_VISIBILITY
1776_LIBCPP_INLINE_VISIBILITY
12191777void
12201778atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
12211779 _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
......@@ -1224,7 +1782,7 @@ atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOE
12241782}
12251783
12261784template <class _Tp>
1227inline _LIBCPP_INLINE_VISIBILITY
1785_LIBCPP_INLINE_VISIBILITY
12281786void
12291787atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
12301788 _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
......@@ -1235,7 +1793,7 @@ atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
12351793// atomic_load
12361794
12371795template <class _Tp>
1238inline _LIBCPP_INLINE_VISIBILITY
1796_LIBCPP_INLINE_VISIBILITY
12391797_Tp
12401798atomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT
12411799{
......@@ -1243,7 +1801,7 @@ atomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT
12431801}
12441802
12451803template <class _Tp>
1246inline _LIBCPP_INLINE_VISIBILITY
1804_LIBCPP_INLINE_VISIBILITY
12471805_Tp
12481806atomic_load(const atomic<_Tp>* __o) _NOEXCEPT
12491807{
......@@ -1253,7 +1811,7 @@ atomic_load(const atomic<_Tp>* __o) _NOEXCEPT
12531811// atomic_load_explicit
12541812
12551813template <class _Tp>
1256inline _LIBCPP_INLINE_VISIBILITY
1814_LIBCPP_INLINE_VISIBILITY
12571815_Tp
12581816atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
12591817 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
......@@ -1262,7 +1820,7 @@ atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEP
12621820}
12631821
12641822template <class _Tp>
1265inline _LIBCPP_INLINE_VISIBILITY
1823_LIBCPP_INLINE_VISIBILITY
12661824_Tp
12671825atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
12681826 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
......@@ -1273,7 +1831,7 @@ atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
12731831// atomic_exchange
12741832
12751833template <class _Tp>
1276inline _LIBCPP_INLINE_VISIBILITY
1834_LIBCPP_INLINE_VISIBILITY
12771835_Tp
12781836atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
12791837{
......@@ -1281,7 +1839,7 @@ atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
12811839}
12821840
12831841template <class _Tp>
1284inline _LIBCPP_INLINE_VISIBILITY
1842_LIBCPP_INLINE_VISIBILITY
12851843_Tp
12861844atomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
12871845{
......@@ -1291,7 +1849,7 @@ atomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
12911849// atomic_exchange_explicit
12921850
12931851template <class _Tp>
1294inline _LIBCPP_INLINE_VISIBILITY
1852_LIBCPP_INLINE_VISIBILITY
12951853_Tp
12961854atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
12971855{
......@@ -1299,7 +1857,7 @@ atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _
12991857}
13001858
13011859template <class _Tp>
1302inline _LIBCPP_INLINE_VISIBILITY
1860_LIBCPP_INLINE_VISIBILITY
13031861_Tp
13041862atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
13051863{
......@@ -1309,7 +1867,7 @@ atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
13091867// atomic_compare_exchange_weak
13101868
13111869template <class _Tp>
1312inline _LIBCPP_INLINE_VISIBILITY
1870_LIBCPP_INLINE_VISIBILITY
13131871bool
13141872atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
13151873{
......@@ -1317,7 +1875,7 @@ atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEX
13171875}
13181876
13191877template <class _Tp>
1320inline _LIBCPP_INLINE_VISIBILITY
1878_LIBCPP_INLINE_VISIBILITY
13211879bool
13221880atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
13231881{
......@@ -1327,7 +1885,7 @@ atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
13271885// atomic_compare_exchange_strong
13281886
13291887template <class _Tp>
1330inline _LIBCPP_INLINE_VISIBILITY
1888_LIBCPP_INLINE_VISIBILITY
13311889bool
13321890atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
13331891{
......@@ -1335,7 +1893,7 @@ atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NO
13351893}
13361894
13371895template <class _Tp>
1338inline _LIBCPP_INLINE_VISIBILITY
1896_LIBCPP_INLINE_VISIBILITY
13391897bool
13401898atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
13411899{
......@@ -1345,7 +1903,7 @@ atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
13451903// atomic_compare_exchange_weak_explicit
13461904
13471905template <class _Tp>
1348inline _LIBCPP_INLINE_VISIBILITY
1906_LIBCPP_INLINE_VISIBILITY
13491907bool
13501908atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e,
13511909 _Tp __d,
......@@ -1356,7 +1914,7 @@ atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e,
13561914}
13571915
13581916template <class _Tp>
1359inline _LIBCPP_INLINE_VISIBILITY
1917_LIBCPP_INLINE_VISIBILITY
13601918bool
13611919atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d,
13621920 memory_order __s, memory_order __f) _NOEXCEPT
......@@ -1368,7 +1926,7 @@ atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d,
13681926// atomic_compare_exchange_strong_explicit
13691927
13701928template <class _Tp>
1371inline _LIBCPP_INLINE_VISIBILITY
1929_LIBCPP_INLINE_VISIBILITY
13721930bool
13731931atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,
13741932 _Tp* __e, _Tp __d,
......@@ -1379,7 +1937,7 @@ atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,
13791937}
13801938
13811939template <class _Tp>
1382inline _LIBCPP_INLINE_VISIBILITY
1940_LIBCPP_INLINE_VISIBILITY
13831941bool
13841942atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e,
13851943 _Tp __d,
......@@ -1392,7 +1950,7 @@ atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e,
13921950// atomic_fetch_add
13931951
13941952template <class _Tp>
1395inline _LIBCPP_INLINE_VISIBILITY
1953_LIBCPP_INLINE_VISIBILITY
13961954typename enable_if
13971955<
13981956 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1404,7 +1962,7 @@ atomic_fetch_add(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
14041962}
14051963
14061964template <class _Tp>
1407inline _LIBCPP_INLINE_VISIBILITY
1965_LIBCPP_INLINE_VISIBILITY
14081966typename enable_if
14091967<
14101968 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1416,7 +1974,7 @@ atomic_fetch_add(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
14161974}
14171975
14181976template <class _Tp>
1419inline _LIBCPP_INLINE_VISIBILITY
1977_LIBCPP_INLINE_VISIBILITY
14201978_Tp*
14211979atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
14221980{
......@@ -1424,7 +1982,7 @@ atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
14241982}
14251983
14261984template <class _Tp>
1427inline _LIBCPP_INLINE_VISIBILITY
1985_LIBCPP_INLINE_VISIBILITY
14281986_Tp*
14291987atomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
14301988{
......@@ -1434,7 +1992,7 @@ atomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
14341992// atomic_fetch_add_explicit
14351993
14361994template <class _Tp>
1437inline _LIBCPP_INLINE_VISIBILITY
1995_LIBCPP_INLINE_VISIBILITY
14381996typename enable_if
14391997<
14401998 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1446,7 +2004,7 @@ atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)
14462004}
14472005
14482006template <class _Tp>
1449inline _LIBCPP_INLINE_VISIBILITY
2007_LIBCPP_INLINE_VISIBILITY
14502008typename enable_if
14512009<
14522010 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1458,7 +2016,7 @@ atomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP
14582016}
14592017
14602018template <class _Tp>
1461inline _LIBCPP_INLINE_VISIBILITY
2019_LIBCPP_INLINE_VISIBILITY
14622020_Tp*
14632021atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
14642022 memory_order __m) _NOEXCEPT
......@@ -1467,7 +2025,7 @@ atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
14672025}
14682026
14692027template <class _Tp>
1470inline _LIBCPP_INLINE_VISIBILITY
2028_LIBCPP_INLINE_VISIBILITY
14712029_Tp*
14722030atomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT
14732031{
......@@ -1477,7 +2035,7 @@ atomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _
14772035// atomic_fetch_sub
14782036
14792037template <class _Tp>
1480inline _LIBCPP_INLINE_VISIBILITY
2038_LIBCPP_INLINE_VISIBILITY
14812039typename enable_if
14822040<
14832041 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1489,7 +2047,7 @@ atomic_fetch_sub(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
14892047}
14902048
14912049template <class _Tp>
1492inline _LIBCPP_INLINE_VISIBILITY
2050_LIBCPP_INLINE_VISIBILITY
14932051typename enable_if
14942052<
14952053 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1501,7 +2059,7 @@ atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
15012059}
15022060
15032061template <class _Tp>
1504inline _LIBCPP_INLINE_VISIBILITY
2062_LIBCPP_INLINE_VISIBILITY
15052063_Tp*
15062064atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
15072065{
......@@ -1509,7 +2067,7 @@ atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
15092067}
15102068
15112069template <class _Tp>
1512inline _LIBCPP_INLINE_VISIBILITY
2070_LIBCPP_INLINE_VISIBILITY
15132071_Tp*
15142072atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
15152073{
......@@ -1519,7 +2077,7 @@ atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
15192077// atomic_fetch_sub_explicit
15202078
15212079template <class _Tp>
1522inline _LIBCPP_INLINE_VISIBILITY
2080_LIBCPP_INLINE_VISIBILITY
15232081typename enable_if
15242082<
15252083 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1531,7 +2089,7 @@ atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)
15312089}
15322090
15332091template <class _Tp>
1534inline _LIBCPP_INLINE_VISIBILITY
2092_LIBCPP_INLINE_VISIBILITY
15352093typename enable_if
15362094<
15372095 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1543,7 +2101,7 @@ atomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP
15432101}
15442102
15452103template <class _Tp>
1546inline _LIBCPP_INLINE_VISIBILITY
2104_LIBCPP_INLINE_VISIBILITY
15472105_Tp*
15482106atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
15492107 memory_order __m) _NOEXCEPT
......@@ -1552,7 +2110,7 @@ atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
15522110}
15532111
15542112template <class _Tp>
1555inline _LIBCPP_INLINE_VISIBILITY
2113_LIBCPP_INLINE_VISIBILITY
15562114_Tp*
15572115atomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT
15582116{
......@@ -1562,7 +2120,7 @@ atomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _
15622120// atomic_fetch_and
15632121
15642122template <class _Tp>
1565inline _LIBCPP_INLINE_VISIBILITY
2123_LIBCPP_INLINE_VISIBILITY
15662124typename enable_if
15672125<
15682126 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1574,7 +2132,7 @@ atomic_fetch_and(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
15742132}
15752133
15762134template <class _Tp>
1577inline _LIBCPP_INLINE_VISIBILITY
2135_LIBCPP_INLINE_VISIBILITY
15782136typename enable_if
15792137<
15802138 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1588,7 +2146,7 @@ atomic_fetch_and(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
15882146// atomic_fetch_and_explicit
15892147
15902148template <class _Tp>
1591inline _LIBCPP_INLINE_VISIBILITY
2149_LIBCPP_INLINE_VISIBILITY
15922150typename enable_if
15932151<
15942152 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1600,7 +2158,7 @@ atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)
16002158}
16012159
16022160template <class _Tp>
1603inline _LIBCPP_INLINE_VISIBILITY
2161_LIBCPP_INLINE_VISIBILITY
16042162typename enable_if
16052163<
16062164 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1614,7 +2172,7 @@ atomic_fetch_and_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP
16142172// atomic_fetch_or
16152173
16162174template <class _Tp>
1617inline _LIBCPP_INLINE_VISIBILITY
2175_LIBCPP_INLINE_VISIBILITY
16182176typename enable_if
16192177<
16202178 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1626,7 +2184,7 @@ atomic_fetch_or(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
16262184}
16272185
16282186template <class _Tp>
1629inline _LIBCPP_INLINE_VISIBILITY
2187_LIBCPP_INLINE_VISIBILITY
16302188typename enable_if
16312189<
16322190 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1640,7 +2198,7 @@ atomic_fetch_or(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
16402198// atomic_fetch_or_explicit
16412199
16422200template <class _Tp>
1643inline _LIBCPP_INLINE_VISIBILITY
2201_LIBCPP_INLINE_VISIBILITY
16442202typename enable_if
16452203<
16462204 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1652,7 +2210,7 @@ atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)
16522210}
16532211
16542212template <class _Tp>
1655inline _LIBCPP_INLINE_VISIBILITY
2213_LIBCPP_INLINE_VISIBILITY
16562214typename enable_if
16572215<
16582216 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1666,7 +2224,7 @@ atomic_fetch_or_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
16662224// atomic_fetch_xor
16672225
16682226template <class _Tp>
1669inline _LIBCPP_INLINE_VISIBILITY
2227_LIBCPP_INLINE_VISIBILITY
16702228typename enable_if
16712229<
16722230 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1678,7 +2236,7 @@ atomic_fetch_xor(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
16782236}
16792237
16802238template <class _Tp>
1681inline _LIBCPP_INLINE_VISIBILITY
2239_LIBCPP_INLINE_VISIBILITY
16822240typename enable_if
16832241<
16842242 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1692,7 +2250,7 @@ atomic_fetch_xor(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
16922250// atomic_fetch_xor_explicit
16932251
16942252template <class _Tp>
1695inline _LIBCPP_INLINE_VISIBILITY
2253_LIBCPP_INLINE_VISIBILITY
16962254typename enable_if
16972255<
16982256 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1704,7 +2262,7 @@ atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)
17042262}
17052263
17062264template <class _Tp>
1707inline _LIBCPP_INLINE_VISIBILITY
2265_LIBCPP_INLINE_VISIBILITY
17082266typename enable_if
17092267<
17102268 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
......@@ -1719,27 +2277,23 @@ atomic_fetch_xor_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP
17192277
17202278typedef struct atomic_flag
17212279{
1722 _Atomic(bool) __a_;
2280 __cxx_atomic_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_;
17232281
17242282 _LIBCPP_INLINE_VISIBILITY
17252283 bool test_and_set(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
1726 {return __c11_atomic_exchange(&__a_, true, __m);}
2284 {return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);}
17272285 _LIBCPP_INLINE_VISIBILITY
17282286 bool test_and_set(memory_order __m = memory_order_seq_cst) _NOEXCEPT
1729 {return __c11_atomic_exchange(&__a_, true, __m);}
2287 {return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);}
17302288 _LIBCPP_INLINE_VISIBILITY
17312289 void clear(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
1732 {__c11_atomic_store(&__a_, false, __m);}
2290 {__cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);}
17332291 _LIBCPP_INLINE_VISIBILITY
17342292 void clear(memory_order __m = memory_order_seq_cst) _NOEXCEPT
1735 {__c11_atomic_store(&__a_, false, __m);}
2293 {__cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);}
17362294
17372295 _LIBCPP_INLINE_VISIBILITY
1738#ifndef _LIBCPP_CXX03_LANG
1739 atomic_flag() _NOEXCEPT = default;
1740#else
1741 atomic_flag() _NOEXCEPT : __a_() {}
1742#endif // _LIBCPP_CXX03_LANG
2296 atomic_flag() _NOEXCEPT _LIBCPP_DEFAULT
17432297
17442298 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
17452299 atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION
......@@ -1818,14 +2372,14 @@ inline _LIBCPP_INLINE_VISIBILITY
18182372void
18192373atomic_thread_fence(memory_order __m) _NOEXCEPT
18202374{
1821 __c11_atomic_thread_fence(__m);
2375 __cxx_atomic_thread_fence(__m);
18222376}
18232377
18242378inline _LIBCPP_INLINE_VISIBILITY
18252379void
18262380atomic_signal_fence(memory_order __m) _NOEXCEPT
18272381{
1828 __c11_atomic_signal_fence(__m);
2382 __cxx_atomic_signal_fence(__m);
18292383}
18302384
18312385// Atomics for standard typedef types
lib/libcxx/include/bit+339-32
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------------ bit ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===---------------------------------------------------------------------===//
109
......@@ -16,12 +15,42 @@
1615
1716namespace std {
1817
18 template <class T>
19 constexpr bool ispow2(T x) noexcept; // C++20
20 template <class T>
21 constexpr T ceil2(T x); // C++20
22 template <class T>
23 constexpr T floor2(T x) noexcept; // C++20
24 template <class T>
25 constexpr T log2p1(T x) noexcept; // C++20
26
27 // 23.20.2, rotating
28 template<class T>
29 constexpr T rotl(T x, unsigned int s) noexcept; // C++20
30 template<class T>
31 constexpr T rotr(T x, unsigned int s) noexcept; // C++20
32
33 // 23.20.3, counting
34 template<class T>
35 constexpr int countl_zero(T x) noexcept; // C++20
36 template<class T>
37 constexpr int countl_one(T x) noexcept; // C++20
38 template<class T>
39 constexpr int countr_zero(T x) noexcept; // C++20
40 template<class T>
41 constexpr int countr_one(T x) noexcept; // C++20
42 template<class T>
43 constexpr int popcount(T x) noexcept; // C++20
44
1945} // namespace std
2046
2147*/
2248
2349#include <__config>
50#include <limits>
51#include <type_traits>
2452#include <version>
53#include <__debug>
2554
2655#if defined(__IBMCPP__)
2756#include "support/ibm/support.h"
......@@ -34,44 +63,47 @@ namespace std {
3463#pragma GCC system_header
3564#endif
3665
66_LIBCPP_PUSH_MACROS
67#include <__undef_macros>
68
3769_LIBCPP_BEGIN_NAMESPACE_STD
3870
3971#ifndef _LIBCPP_COMPILER_MSVC
4072
41inline _LIBCPP_INLINE_VISIBILITY
42int __ctz(unsigned __x) { return __builtin_ctz(__x); }
73inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
74int __libcpp_ctz(unsigned __x) _NOEXCEPT { return __builtin_ctz(__x); }
4375
44inline _LIBCPP_INLINE_VISIBILITY
45int __ctz(unsigned long __x) { return __builtin_ctzl(__x); }
76inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
77int __libcpp_ctz(unsigned long __x) _NOEXCEPT { return __builtin_ctzl(__x); }
4678
47inline _LIBCPP_INLINE_VISIBILITY
48int __ctz(unsigned long long __x) { return __builtin_ctzll(__x); }
79inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
80int __libcpp_ctz(unsigned long long __x) _NOEXCEPT { return __builtin_ctzll(__x); }
4981
5082
51inline _LIBCPP_INLINE_VISIBILITY
52int __clz(unsigned __x) { return __builtin_clz(__x); }
83inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
84int __libcpp_clz(unsigned __x) _NOEXCEPT { return __builtin_clz(__x); }
5385
54inline _LIBCPP_INLINE_VISIBILITY
55int __clz(unsigned long __x) { return __builtin_clzl(__x); }
86inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
87int __libcpp_clz(unsigned long __x) _NOEXCEPT { return __builtin_clzl(__x); }
5688
57inline _LIBCPP_INLINE_VISIBILITY
58int __clz(unsigned long long __x) { return __builtin_clzll(__x); }
89inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
90int __libcpp_clz(unsigned long long __x) _NOEXCEPT { return __builtin_clzll(__x); }
5991
6092
61inline _LIBCPP_INLINE_VISIBILITY
62int __popcount(unsigned __x) { return __builtin_popcount(__x); }
93inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
94int __libcpp_popcount(unsigned __x) _NOEXCEPT { return __builtin_popcount(__x); }
6395
64inline _LIBCPP_INLINE_VISIBILITY
65int __popcount(unsigned long __x) { return __builtin_popcountl(__x); }
96inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
97int __libcpp_popcount(unsigned long __x) _NOEXCEPT { return __builtin_popcountl(__x); }
6698
67inline _LIBCPP_INLINE_VISIBILITY
68int __popcount(unsigned long long __x) { return __builtin_popcountll(__x); }
99inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
100int __libcpp_popcount(unsigned long long __x) _NOEXCEPT { return __builtin_popcountll(__x); }
69101
70102#else // _LIBCPP_COMPILER_MSVC
71103
72104// Precondition: __x != 0
73105inline _LIBCPP_INLINE_VISIBILITY
74int __ctz(unsigned __x) {
106int __libcpp_ctz(unsigned __x) {
75107 static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
76108 static_assert(sizeof(unsigned long) == 4, "");
77109 unsigned long __where;
......@@ -81,13 +113,13 @@ int __ctz(unsigned __x) {
81113}
82114
83115inline _LIBCPP_INLINE_VISIBILITY
84int __ctz(unsigned long __x) {
116int __libcpp_ctz(unsigned long __x) {
85117 static_assert(sizeof(unsigned long) == sizeof(unsigned), "");
86118 return __ctz(static_cast<unsigned>(__x));
87119}
88120
89121inline _LIBCPP_INLINE_VISIBILITY
90int __ctz(unsigned long long __x) {
122int __libcpp_ctz(unsigned long long __x) {
91123 unsigned long __where;
92124#if defined(_LIBCPP_HAS_BITSCAN64)
93125 (defined(_M_AMD64) || defined(__x86_64__))
......@@ -105,7 +137,7 @@ int __ctz(unsigned long long __x) {
105137
106138// Precondition: __x != 0
107139inline _LIBCPP_INLINE_VISIBILITY
108int __clz(unsigned __x) {
140int __libcpp_clz(unsigned __x) {
109141 static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
110142 static_assert(sizeof(unsigned long) == 4, "");
111143 unsigned long __where;
......@@ -115,13 +147,13 @@ int __clz(unsigned __x) {
115147}
116148
117149inline _LIBCPP_INLINE_VISIBILITY
118int __clz(unsigned long __x) {
150int __libcpp_clz(unsigned long __x) {
119151 static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
120 return __clz(static_cast<unsigned>(__x));
152 return __libcpp_clz(static_cast<unsigned>(__x));
121153}
122154
123155inline _LIBCPP_INLINE_VISIBILITY
124int __clz(unsigned long long __x) {
156int __libcpp_clz(unsigned long long __x) {
125157 unsigned long __where;
126158#if defined(_LIBCPP_HAS_BITSCAN64)
127159 if (_BitScanReverse64(&__where, __x))
......@@ -136,23 +168,298 @@ int __clz(unsigned long long __x) {
136168 return 64; // Undefined Behavior.
137169}
138170
139inline _LIBCPP_INLINE_VISIBILITY int __popcount(unsigned __x) {
171inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned __x) {
140172 static_assert(sizeof(unsigned) == 4, "");
141173 return __popcnt(__x);
142174}
143175
144inline _LIBCPP_INLINE_VISIBILITY int __popcount(unsigned long __x) {
176inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long __x) {
145177 static_assert(sizeof(unsigned long) == 4, "");
146178 return __popcnt(__x);
147179}
148180
149inline _LIBCPP_INLINE_VISIBILITY int __popcount(unsigned long long __x) {
181inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long long __x) {
150182 static_assert(sizeof(unsigned long long) == 8, "");
151183 return __popcnt64(__x);
152184}
153185
154186#endif // _LIBCPP_COMPILER_MSVC
155187
188template <class _Tp>
189using __bitop_unsigned_integer _LIBCPP_NODEBUG_TYPE = integral_constant<bool,
190 is_integral<_Tp>::value &&
191 is_unsigned<_Tp>::value &&
192 _IsNotSame<typename remove_cv<_Tp>::type, bool>::value &&
193 _IsNotSame<typename remove_cv<_Tp>::type, signed char>::value &&
194 _IsNotSame<typename remove_cv<_Tp>::type, wchar_t>::value &&
195 _IsNotSame<typename remove_cv<_Tp>::type, char16_t>::value &&
196 _IsNotSame<typename remove_cv<_Tp>::type, char32_t>::value
197 >;
198
199
200template<class _Tp>
201_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
202_Tp __rotl(_Tp __t, unsigned int __cnt) _NOEXCEPT
203{
204 static_assert(__bitop_unsigned_integer<_Tp>::value, "__rotl requires unsigned");
205 const unsigned int __dig = numeric_limits<_Tp>::digits;
206 if ((__cnt % __dig) == 0)
207 return __t;
208 return (__t << (__cnt % __dig)) | (__t >> (__dig - (__cnt % __dig)));
209}
210
211
212template<class _Tp>
213_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
214_Tp __rotr(_Tp __t, unsigned int __cnt) _NOEXCEPT
215{
216 static_assert(__bitop_unsigned_integer<_Tp>::value, "__rotr requires unsigned");
217 const unsigned int __dig = numeric_limits<_Tp>::digits;
218 if ((__cnt % __dig) == 0)
219 return __t;
220 return (__t >> (__cnt % __dig)) | (__t << (__dig - (__cnt % __dig)));
221}
222
223
224
225template<class _Tp>
226_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
227int __countr_zero(_Tp __t) _NOEXCEPT
228{
229 static_assert(__bitop_unsigned_integer<_Tp>::value, "__countr_zero requires unsigned");
230 if (__t == 0)
231 return numeric_limits<_Tp>::digits;
232
233 if (sizeof(_Tp) <= sizeof(unsigned int))
234 return __libcpp_ctz(static_cast<unsigned int>(__t));
235 else if (sizeof(_Tp) <= sizeof(unsigned long))
236 return __libcpp_ctz(static_cast<unsigned long>(__t));
237 else if (sizeof(_Tp) <= sizeof(unsigned long long))
238 return __libcpp_ctz(static_cast<unsigned long long>(__t));
239 else
240 {
241 int __ret = 0;
242 int __iter = 0;
243 const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits;
244 while ((__iter = __libcpp_ctz(static_cast<unsigned long long>(__t))) == __ulldigits)
245 {
246 __ret += __iter;
247 __t >>= __ulldigits;
248 }
249 return __ret + __iter;
250 }
251}
252
253template<class _Tp>
254_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
255int __countl_zero(_Tp __t) _NOEXCEPT
256{
257 static_assert(__bitop_unsigned_integer<_Tp>::value, "__countl_zero requires unsigned");
258 if (__t == 0)
259 return numeric_limits<_Tp>::digits;
260
261 if (sizeof(_Tp) <= sizeof(unsigned int))
262 return __libcpp_clz(static_cast<unsigned int>(__t))
263 - (numeric_limits<unsigned int>::digits - numeric_limits<_Tp>::digits);
264 else if (sizeof(_Tp) <= sizeof(unsigned long))
265 return __libcpp_clz(static_cast<unsigned long>(__t))
266 - (numeric_limits<unsigned long>::digits - numeric_limits<_Tp>::digits);
267 else if (sizeof(_Tp) <= sizeof(unsigned long long))
268 return __libcpp_clz(static_cast<unsigned long long>(__t))
269 - (numeric_limits<unsigned long long>::digits - numeric_limits<_Tp>::digits);
270 else
271 {
272 int __ret = 0;
273 int __iter = 0;
274 const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits;
275 while (true) {
276 __t = __rotr(__t, __ulldigits);
277 if ((__iter = __countl_zero(static_cast<unsigned long long>(__t))) != __ulldigits)
278 break;
279 __ret += __iter;
280 }
281 return __ret + __iter;
282 }
283}
284
285template<class _Tp>
286_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
287int __countl_one(_Tp __t) _NOEXCEPT
288{
289 static_assert(__bitop_unsigned_integer<_Tp>::value, "__countl_one requires unsigned");
290 return __t != numeric_limits<_Tp>::max()
291 ? __countl_zero(static_cast<_Tp>(~__t))
292 : numeric_limits<_Tp>::digits;
293}
294
295
296template<class _Tp>
297_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
298int __countr_one(_Tp __t) _NOEXCEPT
299{
300 static_assert(__bitop_unsigned_integer<_Tp>::value, "__countr_one requires unsigned");
301 return __t != numeric_limits<_Tp>::max()
302 ? __countr_zero(static_cast<_Tp>(~__t))
303 : numeric_limits<_Tp>::digits;
304}
305
306
307template<class _Tp>
308_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
309int
310__popcount(_Tp __t) _NOEXCEPT
311{
312 static_assert(__bitop_unsigned_integer<_Tp>::value, "__libcpp_popcount requires unsigned");
313 if (sizeof(_Tp) <= sizeof(unsigned int))
314 return __libcpp_popcount(static_cast<unsigned int>(__t));
315 else if (sizeof(_Tp) <= sizeof(unsigned long))
316 return __libcpp_popcount(static_cast<unsigned long>(__t));
317 else if (sizeof(_Tp) <= sizeof(unsigned long long))
318 return __libcpp_popcount(static_cast<unsigned long long>(__t));
319 else
320 {
321 int __ret = 0;
322 while (__t != 0)
323 {
324 __ret += __libcpp_popcount(static_cast<unsigned long long>(__t));
325 __t >>= numeric_limits<unsigned long long>::digits;
326 }
327 return __ret;
328 }
329}
330
331
332// integral log base 2
333template<class _Tp>
334_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
335unsigned __bit_log2(_Tp __t) _NOEXCEPT
336{
337 static_assert(__bitop_unsigned_integer<_Tp>::value, "__bit_log2 requires unsigned");
338 return std::numeric_limits<_Tp>::digits - 1 - __countl_zero(__t);
339}
340
341template <class _Tp>
342_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
343bool __ispow2(_Tp __t) _NOEXCEPT
344{
345 static_assert(__bitop_unsigned_integer<_Tp>::value, "__ispow2 requires unsigned");
346 return __t != 0 && (((__t & (__t - 1)) == 0));
347}
348
349
350#if _LIBCPP_STD_VER > 17
351
352template<class _Tp>
353_LIBCPP_INLINE_VISIBILITY constexpr
354enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
355rotl(_Tp __t, unsigned int __cnt) noexcept
356{
357 return __rotl(__t, __cnt);
358}
359
360
361// rotr
362template<class _Tp>
363_LIBCPP_INLINE_VISIBILITY constexpr
364enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
365rotr(_Tp __t, unsigned int __cnt) noexcept
366{
367 return __rotr(__t, __cnt);
368}
369
370
371template<class _Tp>
372_LIBCPP_INLINE_VISIBILITY constexpr
373enable_if_t<__bitop_unsigned_integer<_Tp>::value, int>
374countl_zero(_Tp __t) noexcept
375{
376 return __countl_zero(__t);
377}
378
379
380template<class _Tp>
381_LIBCPP_INLINE_VISIBILITY constexpr
382enable_if_t<__bitop_unsigned_integer<_Tp>::value, int>
383countl_one(_Tp __t) noexcept
384{
385 return __countl_one(__t);
386}
387
388
389template<class _Tp>
390_LIBCPP_INLINE_VISIBILITY constexpr
391enable_if_t<__bitop_unsigned_integer<_Tp>::value, int>
392countr_zero(_Tp __t) noexcept
393{
394 return __countr_zero(__t);
395}
396
397
398template<class _Tp>
399_LIBCPP_INLINE_VISIBILITY constexpr
400enable_if_t<__bitop_unsigned_integer<_Tp>::value, int>
401countr_one(_Tp __t) noexcept
402{
403 return __countr_one(__t);
404}
405
406
407template<class _Tp>
408_LIBCPP_INLINE_VISIBILITY constexpr
409enable_if_t<__bitop_unsigned_integer<_Tp>::value, int>
410popcount(_Tp __t) noexcept
411{
412 return __popcount(__t);
413}
414
415
416template <class _Tp>
417_LIBCPP_INLINE_VISIBILITY constexpr
418enable_if_t<__bitop_unsigned_integer<_Tp>::value, bool>
419ispow2(_Tp __t) noexcept
420{
421 return __ispow2(__t);
422}
423
424template <class _Tp>
425_LIBCPP_INLINE_VISIBILITY constexpr
426enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
427floor2(_Tp __t) noexcept
428{
429 return __t == 0 ? 0 : _Tp{1} << __bit_log2(__t);
430}
431
432template <class _Tp>
433_LIBCPP_INLINE_VISIBILITY constexpr
434enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
435ceil2(_Tp __t) noexcept
436{
437 if (__t < 2) return 1;
438 const unsigned __n = numeric_limits<_Tp>::digits - countl_zero((_Tp)(__t - 1u));
439 _LIBCPP_DEBUG_ASSERT(__libcpp_is_constant_evaluated() || __n != numeric_limits<_Tp>::digits, "Bad input to ceil2");
440
441 if constexpr (sizeof(_Tp) >= sizeof(unsigned))
442 return _Tp{1} << __n;
443 else
444 {
445 const unsigned __extra = numeric_limits<unsigned>::digits - numeric_limits<_Tp>::digits;
446 const unsigned __retVal = 1u << (__n + __extra);
447 return (_Tp) (__retVal >> __extra);
448 }
449}
450
451template <class _Tp>
452_LIBCPP_INLINE_VISIBILITY constexpr
453enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
454log2p1(_Tp __t) noexcept
455{
456 return __t == 0 ? 0 : __bit_log2(__t) + 1;
457}
458
459#endif // _LIBCPP_STD_VER > 17
460
156461_LIBCPP_END_NAMESPACE_STD
157462
463_LIBCPP_POP_MACROS
464
158465#endif // _LIBCPP_BIT
lib/libcxx/include/bitset+5-6
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- bitset ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -680,7 +679,7 @@ public:
680679 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {}
681680 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
682681 bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
683 template<class _CharT>
682 template<class _CharT, class = _EnableIf<_IsCharLikeType<_CharT>::value> >
684683 explicit bitset(const _CharT* __str,
685684 typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
686685 _CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
......@@ -761,7 +760,7 @@ private:
761760};
762761
763762template <size_t _Size>
764template<class _CharT>
763template<class _CharT, class>
765764bitset<_Size>::bitset(const _CharT* __str,
766765 typename basic_string<_CharT>::size_type __n,
767766 _CharT __zero, _CharT __one)
lib/libcxx/include/cassert+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- cassert -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/ccomplex+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- ccomplex ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cctype+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- cctype ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cerrno+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- cerrno ------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cfenv+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- cfenv -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cfloat+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- cfloat -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/charconv+21-22
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------------ charconv ------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -97,7 +96,7 @@ _LIBCPP_FUNC_VIS char* __u64toa(uint64_t __value, char* __buffer);
9796_LIBCPP_FUNC_VIS char* __u32toa(uint32_t __value, char* __buffer);
9897}
9998
100#if _LIBCPP_STD_VER > 11
99#ifndef _LIBCPP_CXX03_LANG
101100
102101enum class _LIBCPP_ENUM_VIS chars_format
103102{
......@@ -125,7 +124,7 @@ void from_chars(const char*, const char*, bool, int = 10) = delete;
125124namespace __itoa
126125{
127126
128static constexpr uint64_t __pow10_64[] = {
127static _LIBCPP_CONSTEXPR uint64_t __pow10_64[] = {
129128 UINT64_C(0),
130129 UINT64_C(10),
131130 UINT64_C(100),
......@@ -148,7 +147,7 @@ static constexpr uint64_t __pow10_64[] = {
148147 UINT64_C(10000000000000000000),
149148};
150149
151static constexpr uint32_t __pow10_32[] = {
150static _LIBCPP_CONSTEXPR uint32_t __pow10_32[] = {
152151 UINT32_C(0), UINT32_C(10), UINT32_C(100),
153152 UINT32_C(1000), UINT32_C(10000), UINT32_C(100000),
154153 UINT32_C(1000000), UINT32_C(10000000), UINT32_C(100000000),
......@@ -173,7 +172,7 @@ struct _LIBCPP_HIDDEN __traits_base
173172 return __u64toa(__v, __p);
174173 }
175174
176 static _LIBCPP_INLINE_VISIBILITY auto& __pow() { return __pow10_64; }
175 static _LIBCPP_INLINE_VISIBILITY decltype(__pow10_64)& __pow() { return __pow10_64; }
177176};
178177
179178template <typename _Tp>
......@@ -195,7 +194,7 @@ struct _LIBCPP_HIDDEN
195194 return __u32toa(__v, __p);
196195 }
197196
198 static _LIBCPP_INLINE_VISIBILITY auto& __pow() { return __pow10_32; }
197 static _LIBCPP_INLINE_VISIBILITY decltype(__pow10_32)& __pow() { return __pow10_32; }
199198};
200199
201200template <typename _Tp>
......@@ -240,7 +239,7 @@ __mul_overflowed(_Tp __a, _Up __b, _Tp& __r)
240239template <typename _Tp>
241240struct _LIBCPP_HIDDEN __traits : __traits_base<_Tp>
242241{
243 static constexpr int digits = numeric_limits<_Tp>::digits10 + 1;
242 static _LIBCPP_CONSTEXPR int digits = numeric_limits<_Tp>::digits10 + 1;
244243 using __traits_base<_Tp>::__pow;
245244 using typename __traits_base<_Tp>::type;
246245
......@@ -286,10 +285,10 @@ __complement(_Tp __x)
286285}
287286
288287template <typename _Tp>
289inline _LIBCPP_INLINE_VISIBILITY auto
288inline _LIBCPP_INLINE_VISIBILITY typename make_unsigned<_Tp>::type
290289__to_unsigned(_Tp __x)
291290{
292 return static_cast<make_unsigned_t<_Tp>>(__x);
291 return static_cast<typename make_unsigned<_Tp>::type>(__x);
293292}
294293
295294template <typename _Tp>
......@@ -315,7 +314,7 @@ __to_chars_itoa(char* __first, char* __last, _Tp __value, false_type)
315314
316315#if !defined(_LIBCPP_COMPILER_MSVC)
317316 if (__tx::digits <= __diff || __tx::__width(__value) <= __diff)
318 return {__tx::__convert(__value, __first), {}};
317 return {__tx::__convert(__value, __first), errc(0)};
319318 else
320319 return {__last, errc::value_too_large};
321320#else
......@@ -380,14 +379,14 @@ __to_chars_integral(char* __first, char* __last, _Tp __value, int __base,
380379 }
381380}
382381
383template <typename _Tp, enable_if_t<is_integral<_Tp>::value, int> = 0>
382template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
384383inline _LIBCPP_INLINE_VISIBILITY to_chars_result
385384to_chars(char* __first, char* __last, _Tp __value)
386385{
387386 return __to_chars_itoa(__first, __last, __value, is_signed<_Tp>());
388387}
389388
390template <typename _Tp, enable_if_t<is_integral<_Tp>::value, int> = 0>
389template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
391390inline _LIBCPP_INLINE_VISIBILITY to_chars_result
392391to_chars(char* __first, char* __last, _Tp __value, int __base)
393392{
......@@ -502,7 +501,7 @@ __subject_seq_combinator(_It __first, _It __last, _Tp& __value, _Fn __f,
502501 return __r;
503502}
504503
505template <typename _Tp, enable_if_t<is_unsigned<_Tp>::value, int> = 0>
504template <typename _Tp, typename enable_if<is_unsigned<_Tp>::value, int>::type = 0>
506505inline _LIBCPP_INLINE_VISIBILITY from_chars_result
507506__from_chars_atoi(const char* __first, const char* __last, _Tp& __value)
508507{
......@@ -528,7 +527,7 @@ __from_chars_atoi(const char* __first, const char* __last, _Tp& __value)
528527 });
529528}
530529
531template <typename _Tp, enable_if_t<is_signed<_Tp>::value, int> = 0>
530template <typename _Tp, typename enable_if<is_signed<_Tp>::value, int>::type = 0>
532531inline _LIBCPP_INLINE_VISIBILITY from_chars_result
533532__from_chars_atoi(const char* __first, const char* __last, _Tp& __value)
534533{
......@@ -536,7 +535,7 @@ __from_chars_atoi(const char* __first, const char* __last, _Tp& __value)
536535 return __sign_combinator(__first, __last, __value, __from_chars_atoi<__t>);
537536}
538537
539template <typename _Tp, enable_if_t<is_unsigned<_Tp>::value, int> = 0>
538template <typename _Tp, typename enable_if<is_unsigned<_Tp>::value, int>::type = 0>
540539inline _LIBCPP_INLINE_VISIBILITY from_chars_result
541540__from_chars_integral(const char* __first, const char* __last, _Tp& __value,
542541 int __base)
......@@ -583,7 +582,7 @@ __from_chars_integral(const char* __first, const char* __last, _Tp& __value,
583582 __base);
584583}
585584
586template <typename _Tp, enable_if_t<is_signed<_Tp>::value, int> = 0>
585template <typename _Tp, typename enable_if<is_signed<_Tp>::value, int>::type = 0>
587586inline _LIBCPP_INLINE_VISIBILITY from_chars_result
588587__from_chars_integral(const char* __first, const char* __last, _Tp& __value,
589588 int __base)
......@@ -593,14 +592,14 @@ __from_chars_integral(const char* __first, const char* __last, _Tp& __value,
593592 __from_chars_integral<__t>, __base);
594593}
595594
596template <typename _Tp, enable_if_t<is_integral<_Tp>::value, int> = 0>
595template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
597596inline _LIBCPP_INLINE_VISIBILITY from_chars_result
598597from_chars(const char* __first, const char* __last, _Tp& __value)
599598{
600599 return __from_chars_atoi(__first, __last, __value);
601600}
602601
603template <typename _Tp, enable_if_t<is_integral<_Tp>::value, int> = 0>
602template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
604603inline _LIBCPP_INLINE_VISIBILITY from_chars_result
605604from_chars(const char* __first, const char* __last, _Tp& __value, int __base)
606605{
......@@ -608,7 +607,7 @@ from_chars(const char* __first, const char* __last, _Tp& __value, int __base)
608607 return __from_chars_integral(__first, __last, __value, __base);
609608}
610609
611#endif // _LIBCPP_STD_VER > 11
610#endif // _LIBCPP_CXX03_LANG
612611
613612_LIBCPP_END_NAMESPACE_STD
614613
lib/libcxx/include/chrono+47-62
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- chrono ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -1263,34 +1262,15 @@ operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d)
12631262
12641263// Duration /
12651264
1266template <class _Duration, class _Rep, bool = __is_duration<_Rep>::value>
1267struct __duration_divide_result
1268{
1269};
1270
1271template <class _Duration, class _Rep2,
1272 bool = is_convertible<_Rep2,
1273 typename common_type<typename _Duration::rep, _Rep2>::type>::value>
1274struct __duration_divide_imp
1275{
1276};
1277
1278template <class _Rep1, class _Period, class _Rep2>
1279struct __duration_divide_imp<duration<_Rep1, _Period>, _Rep2, true>
1280{
1281 typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period> type;
1282};
1283
1284template <class _Rep1, class _Period, class _Rep2>
1285struct __duration_divide_result<duration<_Rep1, _Period>, _Rep2, false>
1286 : __duration_divide_imp<duration<_Rep1, _Period>, _Rep2>
1287{
1288};
1289
12901265template <class _Rep1, class _Period, class _Rep2>
12911266inline _LIBCPP_INLINE_VISIBILITY
12921267_LIBCPP_CONSTEXPR
1293typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
1268typename enable_if
1269<
1270 !__is_duration<_Rep2>::value &&
1271 is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
1272 duration<typename common_type<_Rep1, _Rep2>::type, _Period>
1273>::type
12941274operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
12951275{
12961276 typedef typename common_type<_Rep1, _Rep2>::type _Cr;
......@@ -1313,7 +1293,12 @@ operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
13131293template <class _Rep1, class _Period, class _Rep2>
13141294inline _LIBCPP_INLINE_VISIBILITY
13151295_LIBCPP_CONSTEXPR
1316typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
1296typename enable_if
1297<
1298 !__is_duration<_Rep2>::value &&
1299 is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
1300 duration<typename common_type<_Rep1, _Rep2>::type, _Period>
1301>::type
13171302operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
13181303{
13191304 typedef typename common_type<_Rep1, _Rep2>::type _Cr;
......@@ -1605,9 +1590,9 @@ using local_seconds = local_time<seconds>;
16051590using local_days = local_time<days>;
16061591
16071592
1608struct _LIBCPP_TYPE_VIS last_spec { explicit last_spec() = default; };
1593struct last_spec { explicit last_spec() = default; };
16091594
1610class _LIBCPP_TYPE_VIS day {
1595class day {
16111596private:
16121597 unsigned char __d;
16131598public:
......@@ -1672,7 +1657,7 @@ inline constexpr day& day::operator-=(const days& __dd) noexcept
16721657{ *this = *this - __dd; return *this; }
16731658
16741659
1675class _LIBCPP_TYPE_VIS month {
1660class month {
16761661private:
16771662 unsigned char __m;
16781663public:
......@@ -1743,21 +1728,21 @@ inline constexpr month& month::operator-=(const months& __dm) noexcept
17431728{ *this = *this - __dm; return *this; }
17441729
17451730
1746class _LIBCPP_TYPE_VIS year {
1731class year {
17471732private:
17481733 short __y;
17491734public:
17501735 year() = default;
17511736 explicit inline constexpr year(int __val) noexcept : __y(static_cast<short>(__val)) {}
17521737
1753 inline constexpr year& operator++() noexcept { ++__y; return *this; };
1754 inline constexpr year operator++(int) noexcept { year __tmp = *this; ++(*this); return __tmp; };
1755 inline constexpr year& operator--() noexcept { --__y; return *this; };
1756 inline constexpr year operator--(int) noexcept { year __tmp = *this; --(*this); return __tmp; };
1738 inline constexpr year& operator++() noexcept { ++__y; return *this; }
1739 inline constexpr year operator++(int) noexcept { year __tmp = *this; ++(*this); return __tmp; }
1740 inline constexpr year& operator--() noexcept { --__y; return *this; }
1741 inline constexpr year operator--(int) noexcept { year __tmp = *this; --(*this); return __tmp; }
17571742 constexpr year& operator+=(const years& __dy) noexcept;
17581743 constexpr year& operator-=(const years& __dy) noexcept;
17591744 inline constexpr year operator+() const noexcept { return *this; }
1760 inline constexpr year operator-() const noexcept { return year{-__y}; };
1745 inline constexpr year operator-() const noexcept { return year{-__y}; }
17611746
17621747 inline constexpr bool is_leap() const noexcept { return __y % 4 == 0 && (__y % 100 != 0 || __y % 400 == 0); }
17631748 explicit inline constexpr operator int() const noexcept { return __y; }
......@@ -1817,10 +1802,10 @@ inline constexpr year& year::operator-=(const years& __dy) noexcept
18171802inline constexpr bool year::ok() const noexcept
18181803{ return static_cast<int>(min()) <= __y && __y <= static_cast<int>(max()); }
18191804
1820class _LIBCPP_TYPE_VIS weekday_indexed;
1821class _LIBCPP_TYPE_VIS weekday_last;
1805class weekday_indexed;
1806class weekday_last;
18221807
1823class _LIBCPP_TYPE_VIS weekday {
1808class weekday {
18241809private:
18251810 unsigned char __wd;
18261811public:
......@@ -1906,7 +1891,7 @@ inline constexpr weekday& weekday::operator-=(const days& __dd) noexcept
19061891{ *this = *this - __dd; return *this; }
19071892
19081893
1909class _LIBCPP_TYPE_VIS weekday_indexed {
1894class weekday_indexed {
19101895private:
19111896 _VSTD::chrono::weekday __wd;
19121897 unsigned char __idx;
......@@ -1928,7 +1913,7 @@ bool operator!=(const weekday_indexed& __lhs, const weekday_indexed& __rhs) noex
19281913{ return !(__lhs == __rhs); }
19291914
19301915
1931class _LIBCPP_TYPE_VIS weekday_last {
1916class weekday_last {
19321917private:
19331918 _VSTD::chrono::weekday __wd;
19341919public:
......@@ -1949,7 +1934,7 @@ bool operator!=(const weekday_last& __lhs, const weekday_last& __rhs) noexcept
19491934inline constexpr
19501935weekday_indexed weekday::operator[](unsigned __index) const noexcept { return weekday_indexed{*this, __index}; }
19511936
1952inline constexpr
1937inline constexpr
19531938weekday_last weekday::operator[](last_spec) const noexcept { return weekday_last{*this}; }
19541939
19551940
......@@ -1976,7 +1961,7 @@ inline constexpr month November{11};
19761961inline constexpr month December{12};
19771962
19781963
1979class _LIBCPP_TYPE_VIS month_day {
1964class month_day {
19801965private:
19811966 chrono::month __m;
19821967 chrono::day __d;
......@@ -2051,7 +2036,7 @@ bool operator>=(const month_day& __lhs, const month_day& __rhs) noexcept
20512036
20522037
20532038
2054class _LIBCPP_TYPE_VIS month_day_last {
2039class month_day_last {
20552040private:
20562041 chrono::month __m;
20572042public:
......@@ -2102,7 +2087,7 @@ month_day_last operator/(last_spec, int __rhs) noexcept
21022087{ return month_day_last{month(__rhs)}; }
21032088
21042089
2105class _LIBCPP_TYPE_VIS month_weekday {
2090class month_weekday {
21062091private:
21072092 chrono::month __m;
21082093 chrono::weekday_indexed __wdi;
......@@ -2140,7 +2125,7 @@ month_weekday operator/(const weekday_indexed& __lhs, int __rhs) noexcept
21402125{ return month_weekday{month(__rhs), __lhs}; }
21412126
21422127
2143class _LIBCPP_TYPE_VIS month_weekday_last {
2128class month_weekday_last {
21442129 chrono::month __m;
21452130 chrono::weekday_last __wdl;
21462131 public:
......@@ -2177,7 +2162,7 @@ month_weekday_last operator/(const weekday_last& __lhs, int __rhs) noexcept
21772162{ return month_weekday_last{month(__rhs), __lhs}; }
21782163
21792164
2180class _LIBCPP_TYPE_VIS year_month {
2165class year_month {
21812166 chrono::year __y;
21822167 chrono::month __m;
21832168public:
......@@ -2251,7 +2236,7 @@ constexpr year_month operator-(const year_month& __lhs, const years& __rhs) noex
22512236
22522237class year_month_day_last;
22532238
2254class _LIBCPP_TYPE_VIS year_month_day {
2239class year_month_day {
22552240private:
22562241 chrono::year __y;
22572242 chrono::month __m;
......@@ -2260,7 +2245,7 @@ public:
22602245 year_month_day() = default;
22612246 inline constexpr year_month_day(
22622247 const chrono::year& __yval, const chrono::month& __mval, const chrono::day& __dval) noexcept
2263 : __y{__yval}, __m{__mval}, __d{__dval} {}
2248 : __y{__yval}, __m{__mval}, __d{__dval} {}
22642249 constexpr year_month_day(const year_month_day_last& __ymdl) noexcept;
22652250 inline constexpr year_month_day(const sys_days& __sysd) noexcept
22662251 : year_month_day(__from_days(__sysd.time_since_epoch())) {}
......@@ -2405,7 +2390,7 @@ inline constexpr year_month_day& year_month_day::operator-=(const months& __dm)
24052390inline constexpr year_month_day& year_month_day::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; }
24062391inline constexpr year_month_day& year_month_day::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }
24072392
2408class _LIBCPP_TYPE_VIS year_month_day_last {
2393class year_month_day_last {
24092394private:
24102395 chrono::year __y;
24112396 chrono::month_day_last __mdl;
......@@ -2515,7 +2500,7 @@ inline constexpr year_month_day_last& year_month_day_last::operator+=(const year
25152500inline constexpr year_month_day_last& year_month_day_last::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }
25162501
25172502inline constexpr year_month_day::year_month_day(const year_month_day_last& __ymdl) noexcept
2518 : __y{__ymdl.year()}, __m{__ymdl.month()}, __d{__ymdl.day()} {}
2503 : __y{__ymdl.year()}, __m{__ymdl.month()}, __d{__ymdl.day()} {}
25192504
25202505inline constexpr bool year_month_day::ok() const noexcept
25212506{
......@@ -2523,7 +2508,7 @@ inline constexpr bool year_month_day::ok() const noexcept
25232508 return chrono::day{1} <= __d && __d <= (__y / __m / last).day();
25242509}
25252510
2526class _LIBCPP_TYPE_VIS year_month_weekday {
2511class year_month_weekday {
25272512 chrono::year __y;
25282513 chrono::month __m;
25292514 chrono::weekday_indexed __wdi;
......@@ -2566,7 +2551,7 @@ year_month_weekday year_month_weekday::__from_days(days __d) noexcept
25662551 const sys_days __sysd{__d};
25672552 const chrono::weekday __wd = chrono::weekday(__sysd);
25682553 const year_month_day __ymd = year_month_day(__sysd);
2569 return year_month_weekday{__ymd.year(), __ymd.month(),
2554 return year_month_weekday{__ymd.year(), __ymd.month(),
25702555 __wd[(static_cast<unsigned>(__ymd.day())-1)/7+1]};
25712556}
25722557
......@@ -2637,7 +2622,7 @@ inline constexpr year_month_weekday& year_month_weekday::operator-=(const months
26372622inline constexpr year_month_weekday& year_month_weekday::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; }
26382623inline constexpr year_month_weekday& year_month_weekday::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }
26392624
2640class _LIBCPP_TYPE_VIS year_month_weekday_last {
2625class year_month_weekday_last {
26412626private:
26422627 chrono::year __y;
26432628 chrono::month __m;
......@@ -2658,9 +2643,9 @@ public:
26582643 inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
26592644 inline explicit constexpr operator local_days() const noexcept { return local_days{__to_days()}; }
26602645 inline constexpr bool ok() const noexcept { return __y.ok() && __m.ok() && __wdl.ok(); }
2661
2646
26622647 constexpr days __to_days() const noexcept;
2663
2648
26642649};
26652650
26662651inline constexpr
......@@ -2698,7 +2683,7 @@ year_month_weekday_last operator/(const month_weekday_last& __lhs, const year& _
26982683
26992684inline constexpr
27002685year_month_weekday_last operator/(const month_weekday_last& __lhs, int __rhs) noexcept
2701{ return year(__rhs) / __lhs; }
2686{ return year(__rhs) / __lhs; }
27022687
27032688
27042689inline constexpr
......@@ -2810,7 +2795,7 @@ inline namespace literals
28102795 {
28112796 return chrono::day(static_cast<unsigned>(__d));
28122797 }
2813
2798
28142799 constexpr chrono::year operator ""y(unsigned long long __y) noexcept
28152800 {
28162801 return chrono::year(static_cast<int>(__y));
......@@ -2842,7 +2827,7 @@ struct _FilesystemClock {
28422827
28432828 static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false;
28442829
2845 _LIBCPP_FUNC_VIS static time_point now() noexcept;
2830 _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS static time_point now() noexcept;
28462831
28472832 _LIBCPP_INLINE_VISIBILITY
28482833 static time_t to_time_t(const time_point& __t) noexcept {
lib/libcxx/include/cinttypes+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- cinttypes --------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/ciso646+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- ciso646 ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/climits+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- climits ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/clocale+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- clocale ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cmath+30-5
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- cmath -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -530,7 +529,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double hypot( long double x, long double y
530529
531530template <class _A1, class _A2, class _A3>
532531inline _LIBCPP_INLINE_VISIBILITY
533typename __lazy_enable_if
532typename _EnableIf
534533<
535534 is_arithmetic<_A1>::value &&
536535 is_arithmetic<_A2>::value &&
......@@ -607,6 +606,32 @@ __libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT
607606 return isfinite(__lcpp_x);
608607}
609608
609#if _LIBCPP_STD_VER > 17
610template <typename _Fp>
611constexpr
612_Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept {
613 if ((__a <= 0 && __b >= 0) || (__a >= 0 && __b <= 0))
614 return __t * __b + (1 - __t) * __a;
615
616 if (__t == 1) return __b;
617 const _Fp __x = __a + __t * (__b - __a);
618 if (__t > 1 == __b > __a)
619 return __b < __x ? __x : __b;
620 else
621 return __x < __b ? __x : __b;
622}
623
624constexpr float
625lerp(float __a, float __b, float __t) _NOEXCEPT { return __lerp(__a, __b, __t); }
626
627constexpr double
628lerp(double __a, double __b, double __t) _NOEXCEPT { return __lerp(__a, __b, __t); }
629
630constexpr long double
631lerp(long double __a, long double __b, long double __t) _NOEXCEPT { return __lerp(__a, __b, __t); }
632
633#endif // _LIBCPP_STD_VER > 17
634
610635_LIBCPP_END_NAMESPACE_STD
611636
612637#endif // _LIBCPP_CMATH
lib/libcxx/include/codecvt+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- codecvt -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/compare+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- compare -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/complex+5-6
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- complex ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -1450,10 +1449,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
14501449 return __os << __s.str();
14511450}
14521451
1453#if _LIBCPP_STD_VER > 11
1452#if _LIBCPP_STD_VER > 11
14541453// Literal suffix for complex number literals [complex.literals]
14551454inline namespace literals
1456{
1455{
14571456 inline namespace complex_literals
14581457 {
14591458 constexpr complex<long double> operator""il(long double __im)
lib/libcxx/include/complex.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- complex.h --------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/condition_variable+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------- condition_variable ----------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/csetjmp+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- csetjmp ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/csignal+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- csignal ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cstdarg+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- cstdarg ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cstdbool+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- cstdbool ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cstddef+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- cstddef ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cstdint+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- cstdint ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cstdio+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- cstdio ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cstdlib+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- cstdlib ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cstring+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- cstring ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/ctgmath+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- ctgmath -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/ctime+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- ctime -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/ctype.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- ctype.h ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cwchar+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- cwchar -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cwctype+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- cwctype ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/deque+15-16
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- deque -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -1331,21 +1330,21 @@ public:
13311330
13321331 // element access:
13331332 _LIBCPP_INLINE_VISIBILITY
1334 reference operator[](size_type __i);
1333 reference operator[](size_type __i) _NOEXCEPT;
13351334 _LIBCPP_INLINE_VISIBILITY
1336 const_reference operator[](size_type __i) const;
1335 const_reference operator[](size_type __i) const _NOEXCEPT;
13371336 _LIBCPP_INLINE_VISIBILITY
13381337 reference at(size_type __i);
13391338 _LIBCPP_INLINE_VISIBILITY
13401339 const_reference at(size_type __i) const;
13411340 _LIBCPP_INLINE_VISIBILITY
1342 reference front();
1341 reference front() _NOEXCEPT;
13431342 _LIBCPP_INLINE_VISIBILITY
1344 const_reference front() const;
1343 const_reference front() const _NOEXCEPT;
13451344 _LIBCPP_INLINE_VISIBILITY
1346 reference back();
1345 reference back() _NOEXCEPT;
13471346 _LIBCPP_INLINE_VISIBILITY
1348 const_reference back() const;
1347 const_reference back() const _NOEXCEPT;
13491348
13501349 // 23.2.2.3 modifiers:
13511350 void push_front(const value_type& __v);
......@@ -1746,7 +1745,7 @@ deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
17461745template <class _Tp, class _Allocator>
17471746inline
17481747typename deque<_Tp, _Allocator>::reference
1749deque<_Tp, _Allocator>::operator[](size_type __i)
1748deque<_Tp, _Allocator>::operator[](size_type __i) _NOEXCEPT
17501749{
17511750 size_type __p = __base::__start_ + __i;
17521751 return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
......@@ -1755,7 +1754,7 @@ deque<_Tp, _Allocator>::operator[](size_type __i)
17551754template <class _Tp, class _Allocator>
17561755inline
17571756typename deque<_Tp, _Allocator>::const_reference
1758deque<_Tp, _Allocator>::operator[](size_type __i) const
1757deque<_Tp, _Allocator>::operator[](size_type __i) const _NOEXCEPT
17591758{
17601759 size_type __p = __base::__start_ + __i;
17611760 return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
......@@ -1786,7 +1785,7 @@ deque<_Tp, _Allocator>::at(size_type __i) const
17861785template <class _Tp, class _Allocator>
17871786inline
17881787typename deque<_Tp, _Allocator>::reference
1789deque<_Tp, _Allocator>::front()
1788deque<_Tp, _Allocator>::front() _NOEXCEPT
17901789{
17911790 return *(*(__base::__map_.begin() + __base::__start_ / __base::__block_size)
17921791 + __base::__start_ % __base::__block_size);
......@@ -1795,7 +1794,7 @@ deque<_Tp, _Allocator>::front()
17951794template <class _Tp, class _Allocator>
17961795inline
17971796typename deque<_Tp, _Allocator>::const_reference
1798deque<_Tp, _Allocator>::front() const
1797deque<_Tp, _Allocator>::front() const _NOEXCEPT
17991798{
18001799 return *(*(__base::__map_.begin() + __base::__start_ / __base::__block_size)
18011800 + __base::__start_ % __base::__block_size);
......@@ -1804,7 +1803,7 @@ deque<_Tp, _Allocator>::front() const
18041803template <class _Tp, class _Allocator>
18051804inline
18061805typename deque<_Tp, _Allocator>::reference
1807deque<_Tp, _Allocator>::back()
1806deque<_Tp, _Allocator>::back() _NOEXCEPT
18081807{
18091808 size_type __p = __base::size() + __base::__start_ - 1;
18101809 return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
......@@ -1813,7 +1812,7 @@ deque<_Tp, _Allocator>::back()
18131812template <class _Tp, class _Allocator>
18141813inline
18151814typename deque<_Tp, _Allocator>::const_reference
1816deque<_Tp, _Allocator>::back() const
1815deque<_Tp, _Allocator>::back() const _NOEXCEPT
18171816{
18181817 size_type __p = __base::size() + __base::__start_ - 1;
18191818 return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
lib/libcxx/include/errno.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- errno.h -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/exception+6-15
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- exception ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -83,7 +82,7 @@ template <class E> void rethrow_if_nested(const E& e);
8382#include <type_traits>
8483#include <version>
8584
86#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)
85#if defined(_LIBCPP_ABI_VCRUNTIME)
8786#include <vcruntime_exception.h>
8887#endif
8988
......@@ -94,7 +93,7 @@ template <class E> void rethrow_if_nested(const E& e);
9493namespace std // purposefully not using versioning namespace
9594{
9695
97#if !defined(_LIBCPP_ABI_MICROSOFT) || defined(_LIBCPP_NO_VCRUNTIME)
96#if !defined(_LIBCPP_ABI_VCRUNTIME)
9897class _LIBCPP_EXCEPTION_ABI exception
9998{
10099public:
......@@ -111,7 +110,7 @@ public:
111110 virtual ~bad_exception() _NOEXCEPT;
112111 virtual const char* what() const _NOEXCEPT;
113112};
114#endif // !_LIBCPP_ABI_MICROSOFT || _LIBCPP_NO_VCRUNTIME
113#endif // !_LIBCPP_ABI_VCRUNTIME
115114
116115#if _LIBCPP_STD_VER <= 14 \
117116 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) \
......@@ -261,11 +260,7 @@ struct __throw_with_nested;
261260template <class _Tp, class _Up>
262261struct __throw_with_nested<_Tp, _Up, true> {
263262 _LIBCPP_NORETURN static inline _LIBCPP_INLINE_VISIBILITY void
264#ifndef _LIBCPP_CXX03_LANG
265263 __do_throw(_Tp&& __t)
266#else
267 __do_throw (_Tp& __t)
268#endif // _LIBCPP_CXX03_LANG
269264 {
270265 throw __nested<_Up>(_VSTD::forward<_Tp>(__t));
271266 }
......@@ -288,11 +283,7 @@ struct __throw_with_nested<_Tp, _Up, false> {
288283template <class _Tp>
289284_LIBCPP_NORETURN
290285void
291#ifndef _LIBCPP_CXX03_LANG
292286throw_with_nested(_Tp&& __t)
293#else
294throw_with_nested (_Tp& __t)
295#endif // _LIBCPP_CXX03_LANG
296287{
297288#ifndef _LIBCPP_NO_EXCEPTIONS
298289 typedef typename decay<_Tp>::type _Up;
lib/libcxx/include/experimental/__config+10-5
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- __config ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -37,8 +36,14 @@
3736 namespace chrono { namespace experimental { inline namespace fundamentals_v1 {
3837#define _LIBCPP_END_NAMESPACE_CHRONO_LFTS _LIBCPP_END_NAMESPACE_STD } } }
3938
39#if defined(_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_FILESYSTEM)
40# define _LIBCPP_DEPRECATED_EXPERIMENTAL_FILESYSTEM /* nothing */
41#else
42# define _LIBCPP_DEPRECATED_EXPERIMENTAL_FILESYSTEM __attribute__((deprecated("std::experimental::filesystem has now been deprecated in favor of C++17's std::filesystem. Please stop using it and start using std::filesystem. This experimental version will be removed in LLVM 11. You can remove this warning by defining the _LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_FILESYSTEM macro.")))
43#endif
44
4045#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM \
41 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL namespace filesystem { \
46 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL namespace filesystem _LIBCPP_DEPRECATED_EXPERIMENTAL_FILESYSTEM { \
4247 inline namespace v1 {
4348
4449#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM \
lib/libcxx/include/experimental/__memory+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------------------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/algorithm+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- algorithm ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/any deleted-21
......@@ -1,21 +0,0 @@
1// -*- C++ -*-
2//===------------------------------- any ----------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_EXPERIMENTAL_ANY
11#define _LIBCPP_EXPERIMENTAL_ANY
12
13#include <__config>
14
15#ifdef _LIBCPP_WARNING
16_LIBCPP_WARNING("<experimental/any> has been removed. Use <any> instead.")
17#else
18# warning "<experimental/any> has been removed. Use <any> instead."
19#endif
20
21#endif // _LIBCPP_EXPERIMENTAL_ANY
lib/libcxx/include/experimental/chrono deleted-21
......@@ -1,21 +0,0 @@
1// -*- C++ -*-
2//===---------------------------- chrono ----------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_EXPERIMENTAL_CHRONO
11#define _LIBCPP_EXPERIMENTAL_CHRONO
12
13#include <__config>
14
15#ifdef _LIBCPP_WARNING
16_LIBCPP_WARNING("<experimental/chrono> has been removed. Use <chrono> instead.")
17#else
18# warning "<experimental/chrono> has been removed. Use <chrono> instead."
19#endif
20
21#endif // _LIBCPP_EXPERIMENTAL_CHRONO
lib/libcxx/include/experimental/coroutine+6-7
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------- coroutine -----------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -82,7 +81,7 @@ struct __coroutine_traits_sfinae<
8281};
8382
8483template <typename _Ret, typename... _Args>
85struct _LIBCPP_TEMPLATE_VIS coroutine_traits
84struct coroutine_traits
8685 : public __coroutine_traits_sfinae<_Ret>
8786{
8887};
......@@ -299,7 +298,7 @@ noop_coroutine_handle noop_coroutine() _NOEXCEPT {
299298}
300299#endif // __has_builtin(__builtin_coro_noop)
301300
302struct _LIBCPP_TYPE_VIS suspend_never {
301struct suspend_never {
303302 _LIBCPP_INLINE_VISIBILITY
304303 bool await_ready() const _NOEXCEPT { return true; }
305304 _LIBCPP_INLINE_VISIBILITY
......@@ -308,7 +307,7 @@ struct _LIBCPP_TYPE_VIS suspend_never {
308307 void await_resume() const _NOEXCEPT {}
309308};
310309
311struct _LIBCPP_TYPE_VIS suspend_always {
310struct suspend_always {
312311 _LIBCPP_INLINE_VISIBILITY
313312 bool await_ready() const _NOEXCEPT { return false; }
314313 _LIBCPP_INLINE_VISIBILITY
lib/libcxx/include/experimental/deque+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- deque ------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/filesystem+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- filesystem -------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109#ifndef _LIBCPP_EXPERIMENTAL_FILESYSTEM
lib/libcxx/include/experimental/forward_list+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- forward_list -----------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/functional+6-10
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- functional --------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -110,8 +109,7 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS
110109#if _LIBCPP_STD_VER > 11
111110// default searcher
112111template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
113_LIBCPP_TYPE_VIS
114class default_searcher {
112class _LIBCPP_TYPE_VIS default_searcher {
115113public:
116114 _LIBCPP_INLINE_VISIBILITY
117115 default_searcher(_ForwardIterator __f, _ForwardIterator __l,
......@@ -209,8 +207,7 @@ public:
209207template <class _RandomAccessIterator1,
210208 class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
211209 class _BinaryPredicate = equal_to<>>
212_LIBCPP_TYPE_VIS
213class boyer_moore_searcher {
210class _LIBCPP_TYPE_VIS boyer_moore_searcher {
214211private:
215212 typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type;
216213 typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type;
......@@ -361,8 +358,7 @@ make_boyer_moore_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,
361358template <class _RandomAccessIterator1,
362359 class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
363360 class _BinaryPredicate = equal_to<>>
364_LIBCPP_TYPE_VIS
365class boyer_moore_horspool_searcher {
361class _LIBCPP_TYPE_VIS boyer_moore_horspool_searcher {
366362private:
367363 typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type;
368364 typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type;
lib/libcxx/include/experimental/iterator+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------- iterator -------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/list+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- list ------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/map+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------- map ------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/memory_resource+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------ memory_resource -----------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/numeric deleted-21
......@@ -1,21 +0,0 @@
1// -*- C++ -*-
2//===--------------------------- numeric ----------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_EXPERIMENTAL_NUMERIC
11#define _LIBCPP_EXPERIMENTAL_NUMERIC
12
13#include <__config>
14
15#ifdef _LIBCPP_WARNING
16_LIBCPP_WARNING("<experimental/numeric> has been removed. Use <numeric> instead.")
17#else
18# warning "<experimental/numeric> has been removed. Use <numeric> instead."
19#endif
20
21#endif // _LIBCPP_EXPERIMENTAL_NUMERIC
lib/libcxx/include/experimental/optional deleted-21
......@@ -1,21 +0,0 @@
1// -*- C++ -*-
2//===-------------------------- optional ----------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_EXPERIMENTAL_OPTIONAL
11#define _LIBCPP_EXPERIMENTAL_OPTIONAL
12
13#include <__config>
14
15#ifdef _LIBCPP_WARNING
16_LIBCPP_WARNING("<experimental/optional> has been removed. Use <optional> instead.")
17#else
18# warning "<experimental/optional> has been removed. Use <optional> instead."
19#endif
20
21#endif // _LIBCPP_EXPERIMENTAL_OPTIONAL
lib/libcxx/include/experimental/propagate_const+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------ propagate_const -----------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/ratio deleted-21
......@@ -1,21 +0,0 @@
1// -*- C++ -*-
2//===----------------------------- ratio ----------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_EXPERIMENTAL_RATIO
11#define _LIBCPP_EXPERIMENTAL_RATIO
12
13#include <__config>
14
15#ifdef _LIBCPP_WARNING
16_LIBCPP_WARNING("<experimental/ratio> has been removed. Use <ratio> instead.")
17#else
18# warning "<experimental/ratio> has been removed. Use <ratio> instead."
19#endif
20
21#endif // _LIBCPP_EXPERIMENTAL_RATIO
lib/libcxx/include/experimental/regex+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------- regex ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/set+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- list ------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/simd+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------------- simd ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109#ifndef _LIBCPP_EXPERIMENTAL_SIMD
lib/libcxx/include/experimental/string+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- string ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/string_view deleted-21
......@@ -1,21 +0,0 @@
1// -*- C++ -*-
2//===------------------------ string_view ---------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_EXPERIMENTAL_STRING_VIEW
11#define _LIBCPP_EXPERIMENTAL_STRING_VIEW
12
13#include <__config>
14
15#ifdef _LIBCPP_WARNING
16_LIBCPP_WARNING("<experimental/string_view> has been removed. Use <string_view> instead.")
17#else
18# warning "<experimental/string_view> has been removed. Use <string_view> instead."
19#endif
20
21#endif // _LIBCPP_EXPERIMENTAL_STRING_VIEW
lib/libcxx/include/experimental/system_error deleted-21
......@@ -1,21 +0,0 @@
1// -*- C++ -*-
2//===-------------------------- system_error ------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR
11#define _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR
12
13#include <__config>
14
15#ifdef _LIBCPP_WARNING
16_LIBCPP_WARNING("<experimental/system_error> has been removed. Use <system_error> instead.")
17#else
18# warning "<experimental/system_error> has been removed. Use <system_error> instead."
19#endif
20
21#endif // _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR
lib/libcxx/include/experimental/tuple deleted-21
......@@ -1,21 +0,0 @@
1// -*- C++ -*-
2//===----------------------------- tuple ----------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_EXPERIMENTAL_TUPLE
11#define _LIBCPP_EXPERIMENTAL_TUPLE
12
13#include <__config>
14
15#ifdef _LIBCPP_WARNING
16_LIBCPP_WARNING("<experimental/tuple> has been removed. Use <tuple> instead.")
17#else
18# warning "<experimental/tuple> has been removed. Use <tuple> instead."
19#endif
20
21#endif // _LIBCPP_EXPERIMENTAL_TUPLE
lib/libcxx/include/experimental/type_traits+8-9
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- type_traits -------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -73,6 +72,7 @@ inline namespace fundamentals_v1 {
7372
7473#if _LIBCPP_STD_VER > 11
7574
75#include <initializer_list>
7676#include <type_traits>
7777
7878#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -105,11 +105,10 @@ using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type;
105105// 3.3.4, Detection idiom
106106template <class...> using void_t = void;
107107
108struct nonesuch {
109 nonesuch() = delete;
110 ~nonesuch() = delete;
111 nonesuch (nonesuch const&) = delete;
112 void operator=(nonesuch const&) = delete;
108struct nonesuch : private _VSTD::__nat { // make nonesuch "not an aggregate"
109 ~nonesuch() = delete;
110 nonesuch (nonesuch const&) = delete;
111 void operator=(nonesuch const&) = delete;
113112 };
114113
115114template <class _Default, class _AlwaysVoid, template <class...> class _Op, class... _Args>
lib/libcxx/include/experimental/unordered_map+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------- unordered_map ------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/unordered_set+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------- unordered_set ------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/utility+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- utility ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/vector+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- vector ------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/ext/__hash+16-18
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------- hash_set ------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -17,32 +16,31 @@
1716#include <cstring>
1817
1918namespace __gnu_cxx {
20using namespace std;
2119
2220template <typename _Tp> struct _LIBCPP_TEMPLATE_VIS hash { };
2321
2422template <> struct _LIBCPP_TEMPLATE_VIS hash<const char*>
25 : public unary_function<const char*, size_t>
23 : public std::unary_function<const char*, size_t>
2624{
2725 _LIBCPP_INLINE_VISIBILITY
2826 size_t operator()(const char *__c) const _NOEXCEPT
2927 {
30 return __do_string_hash(__c, __c + strlen(__c));
28 return std::__do_string_hash(__c, __c + strlen(__c));
3129 }
3230};
3331
3432template <> struct _LIBCPP_TEMPLATE_VIS hash<char *>
35 : public unary_function<char*, size_t>
33 : public std::unary_function<char*, size_t>
3634{
3735 _LIBCPP_INLINE_VISIBILITY
3836 size_t operator()(char *__c) const _NOEXCEPT
3937 {
40 return __do_string_hash<const char *>(__c, __c + strlen(__c));
38 return std::__do_string_hash<const char *>(__c, __c + strlen(__c));
4139 }
4240};
4341
4442template <> struct _LIBCPP_TEMPLATE_VIS hash<char>
45 : public unary_function<char, size_t>
43 : public std::unary_function<char, size_t>
4644{
4745 _LIBCPP_INLINE_VISIBILITY
4846 size_t operator()(char __c) const _NOEXCEPT
......@@ -52,7 +50,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<char>
5250};
5351
5452template <> struct _LIBCPP_TEMPLATE_VIS hash<signed char>
55 : public unary_function<signed char, size_t>
53 : public std::unary_function<signed char, size_t>
5654{
5755 _LIBCPP_INLINE_VISIBILITY
5856 size_t operator()(signed char __c) const _NOEXCEPT
......@@ -62,7 +60,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<signed char>
6260};
6361
6462template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
65 : public unary_function<unsigned char, size_t>
63 : public std::unary_function<unsigned char, size_t>
6664{
6765 _LIBCPP_INLINE_VISIBILITY
6866 size_t operator()(unsigned char __c) const _NOEXCEPT
......@@ -72,7 +70,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
7270};
7371
7472template <> struct _LIBCPP_TEMPLATE_VIS hash<short>
75 : public unary_function<short, size_t>
73 : public std::unary_function<short, size_t>
7674{
7775 _LIBCPP_INLINE_VISIBILITY
7876 size_t operator()(short __c) const _NOEXCEPT
......@@ -82,7 +80,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<short>
8280};
8381
8482template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
85 : public unary_function<unsigned short, size_t>
83 : public std::unary_function<unsigned short, size_t>
8684{
8785 _LIBCPP_INLINE_VISIBILITY
8886 size_t operator()(unsigned short __c) const _NOEXCEPT
......@@ -92,7 +90,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
9290};
9391
9492template <> struct _LIBCPP_TEMPLATE_VIS hash<int>
95 : public unary_function<int, size_t>
93 : public std::unary_function<int, size_t>
9694{
9795 _LIBCPP_INLINE_VISIBILITY
9896 size_t operator()(int __c) const _NOEXCEPT
......@@ -102,7 +100,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<int>
102100};
103101
104102template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
105 : public unary_function<unsigned int, size_t>
103 : public std::unary_function<unsigned int, size_t>
106104{
107105 _LIBCPP_INLINE_VISIBILITY
108106 size_t operator()(unsigned int __c) const _NOEXCEPT
......@@ -112,7 +110,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
112110};
113111
114112template <> struct _LIBCPP_TEMPLATE_VIS hash<long>
115 : public unary_function<long, size_t>
113 : public std::unary_function<long, size_t>
116114{
117115 _LIBCPP_INLINE_VISIBILITY
118116 size_t operator()(long __c) const _NOEXCEPT
......@@ -122,7 +120,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<long>
122120};
123121
124122template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned long>
125 : public unary_function<unsigned long, size_t>
123 : public std::unary_function<unsigned long, size_t>
126124{
127125 _LIBCPP_INLINE_VISIBILITY
128126 size_t operator()(unsigned long __c) const _NOEXCEPT
lib/libcxx/include/ext/hash_map+38-40
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- hash_map ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -220,10 +219,8 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
220219
221220namespace __gnu_cxx {
222221
223using namespace std;
224
225222template <class _Tp, class _Hash,
226 bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value
223 bool = std::is_empty<_Hash>::value && !std::__libcpp_is_final<_Hash>::value
227224 >
228225class __hash_map_hasher
229226 : private _Hash
......@@ -257,7 +254,7 @@ public:
257254};
258255
259256template <class _Tp, class _Pred,
260 bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value
257 bool = std::is_empty<_Pred>::value && !std::__libcpp_is_final<_Pred>::value
261258 >
262259class __hash_map_equal
263260 : private _Pred
......@@ -308,7 +305,7 @@ template <class _Alloc>
308305class __hash_map_node_destructor
309306{
310307 typedef _Alloc allocator_type;
311 typedef allocator_traits<allocator_type> __alloc_traits;
308 typedef std::allocator_traits<allocator_type> __alloc_traits;
312309 typedef typename __alloc_traits::value_type::__node_value_type value_type;
313310public:
314311 typedef typename __alloc_traits::pointer pointer;
......@@ -333,7 +330,7 @@ public:
333330
334331#ifndef _LIBCPP_CXX03_LANG
335332 _LIBCPP_INLINE_VISIBILITY
336 __hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
333 __hash_map_node_destructor(std::__hash_node_destructor<allocator_type>&& __x)
337334 : __na_(__x.__na_),
338335 __first_constructed(__x.__value_constructed),
339336 __second_constructed(__x.__value_constructed)
......@@ -342,7 +339,7 @@ public:
342339 }
343340#else // _LIBCPP_CXX03_LANG
344341 _LIBCPP_INLINE_VISIBILITY
345 __hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
342 __hash_map_node_destructor(const std::__hash_node_destructor<allocator_type>& __x)
346343 : __na_(__x.__na_),
347344 __first_constructed(__x.__value_constructed),
348345 __second_constructed(__x.__value_constructed)
......@@ -371,11 +368,11 @@ class _LIBCPP_TEMPLATE_VIS __hash_map_iterator
371368 typedef const typename _HashIterator::value_type::first_type key_type;
372369 typedef typename _HashIterator::value_type::second_type mapped_type;
373370public:
374 typedef forward_iterator_tag iterator_category;
375 typedef pair<key_type, mapped_type> value_type;
371 typedef std::forward_iterator_tag iterator_category;
372 typedef std::pair<key_type, mapped_type> value_type;
376373 typedef typename _HashIterator::difference_type difference_type;
377374 typedef value_type& reference;
378 typedef typename __rebind_pointer<typename _HashIterator::pointer, value_type>::type
375 typedef typename std::__rebind_pointer<typename _HashIterator::pointer, value_type>::type
379376 pointer;
380377
381378 _LIBCPP_INLINE_VISIBILITY __hash_map_iterator() {}
......@@ -416,11 +413,11 @@ class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator
416413 typedef const typename _HashIterator::value_type::first_type key_type;
417414 typedef typename _HashIterator::value_type::second_type mapped_type;
418415public:
419 typedef forward_iterator_tag iterator_category;
420 typedef pair<key_type, mapped_type> value_type;
416 typedef std::forward_iterator_tag iterator_category;
417 typedef std::pair<key_type, mapped_type> value_type;
421418 typedef typename _HashIterator::difference_type difference_type;
422419 typedef const value_type& reference;
423 typedef typename __rebind_pointer<typename _HashIterator::pointer, const value_type>::type
420 typedef typename std::__rebind_pointer<typename _HashIterator::pointer, const value_type>::type
424421 pointer;
425422
426423 _LIBCPP_INLINE_VISIBILITY __hash_map_const_iterator() {}
......@@ -460,8 +457,8 @@ public:
460457 template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
461458};
462459
463template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
464 class _Alloc = allocator<pair<const _Key, _Tp> > >
460template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = std::equal_to<_Key>,
461 class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
465462class _LIBCPP_TEMPLATE_VIS hash_map
466463{
467464public:
......@@ -472,17 +469,18 @@ public:
472469 typedef _Hash hasher;
473470 typedef _Pred key_equal;
474471 typedef _Alloc allocator_type;
475 typedef pair<const key_type, mapped_type> value_type;
472 typedef std::pair<const key_type, mapped_type> value_type;
476473 typedef value_type& reference;
477474 typedef const value_type& const_reference;
478475
479476private:
480 typedef pair<key_type, mapped_type> __value_type;
477 typedef std::pair<key_type, mapped_type> __value_type;
481478 typedef __hash_map_hasher<__value_type, hasher> __hasher;
482479 typedef __hash_map_equal<__value_type, key_equal> __key_equal;
483 typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type;
480 typedef typename std::__rebind_alloc_helper<
481 std::allocator_traits<allocator_type>, __value_type>::type __allocator_type;
484482
485 typedef __hash_table<__value_type, __hasher,
483 typedef std::__hash_table<__value_type, __hasher,
486484 __key_equal, __allocator_type> __table;
487485
488486 __table __table_;
......@@ -493,8 +491,8 @@ private:
493491 typedef typename __table::__node_allocator __node_allocator;
494492 typedef typename __table::__node __node;
495493 typedef __hash_map_node_destructor<__node_allocator> _Dp;
496 typedef unique_ptr<__node, _Dp> __node_holder;
497 typedef allocator_traits<allocator_type> __alloc_traits;
494 typedef std::unique_ptr<__node, _Dp> __node_holder;
495 typedef std::allocator_traits<allocator_type> __alloc_traits;
498496public:
499497 typedef typename __alloc_traits::pointer pointer;
500498 typedef typename __alloc_traits::const_pointer const_pointer;
......@@ -544,7 +542,7 @@ public:
544542 const_iterator end() const {return __table_.end();}
545543
546544 _LIBCPP_INLINE_VISIBILITY
547 pair<iterator, bool> insert(const value_type& __x)
545 std::pair<iterator, bool> insert(const value_type& __x)
548546 {return __table_.__insert_unique(__x);}
549547 _LIBCPP_INLINE_VISIBILITY
550548 iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
......@@ -579,10 +577,10 @@ public:
579577 _LIBCPP_INLINE_VISIBILITY
580578 size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
581579 _LIBCPP_INLINE_VISIBILITY
582 pair<iterator, iterator> equal_range(const key_type& __k)
580 std::pair<iterator, iterator> equal_range(const key_type& __k)
583581 {return __table_.__equal_range_unique(__k);}
584582 _LIBCPP_INLINE_VISIBILITY
585 pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
583 std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
586584 {return __table_.__equal_range_unique(__k);}
587585
588586 mapped_type& operator[](const key_type& __k);
......@@ -692,7 +690,7 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
692690 if (__i != end())
693691 return __i->second;
694692 __node_holder __h = __construct_node(__k);
695 pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
693 std::pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
696694 __h.release();
697695 return __r.first->second;
698696}
......@@ -734,8 +732,8 @@ operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
734732 return !(__x == __y);
735733}
736734
737template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
738 class _Alloc = allocator<pair<const _Key, _Tp> > >
735template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = std::equal_to<_Key>,
736 class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
739737class _LIBCPP_TEMPLATE_VIS hash_multimap
740738{
741739public:
......@@ -746,17 +744,17 @@ public:
746744 typedef _Hash hasher;
747745 typedef _Pred key_equal;
748746 typedef _Alloc allocator_type;
749 typedef pair<const key_type, mapped_type> value_type;
747 typedef std::pair<const key_type, mapped_type> value_type;
750748 typedef value_type& reference;
751749 typedef const value_type& const_reference;
752750
753751private:
754 typedef pair<key_type, mapped_type> __value_type;
752 typedef std::pair<key_type, mapped_type> __value_type;
755753 typedef __hash_map_hasher<__value_type, hasher> __hasher;
756754 typedef __hash_map_equal<__value_type, key_equal> __key_equal;
757 typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type;
755 typedef typename std::__rebind_alloc_helper<std::allocator_traits<allocator_type>, __value_type>::type __allocator_type;
758756
759 typedef __hash_table<__value_type, __hasher,
757 typedef std::__hash_table<__value_type, __hasher,
760758 __key_equal, __allocator_type> __table;
761759
762760 __table __table_;
......@@ -765,8 +763,8 @@ private:
765763 typedef typename __table::__node_allocator __node_allocator;
766764 typedef typename __table::__node __node;
767765 typedef __hash_map_node_destructor<__node_allocator> _Dp;
768 typedef unique_ptr<__node, _Dp> __node_holder;
769 typedef allocator_traits<allocator_type> __alloc_traits;
766 typedef std::unique_ptr<__node, _Dp> __node_holder;
767 typedef std::allocator_traits<allocator_type> __alloc_traits;
770768public:
771769 typedef typename __alloc_traits::pointer pointer;
772770 typedef typename __alloc_traits::const_pointer const_pointer;
......@@ -851,10 +849,10 @@ public:
851849 _LIBCPP_INLINE_VISIBILITY
852850 size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
853851 _LIBCPP_INLINE_VISIBILITY
854 pair<iterator, iterator> equal_range(const key_type& __k)
852 std::pair<iterator, iterator> equal_range(const key_type& __k)
855853 {return __table_.__equal_range_multi(__k);}
856854 _LIBCPP_INLINE_VISIBILITY
857 pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
855 std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
858856 {return __table_.__equal_range_multi(__k);}
859857
860858 _LIBCPP_INLINE_VISIBILITY
......@@ -956,7 +954,7 @@ operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
956954 return false;
957955 typedef typename hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
958956 const_iterator;
959 typedef pair<const_iterator, const_iterator> _EqRng;
957 typedef std::pair<const_iterator, const_iterator> _EqRng;
960958 for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
961959 {
962960 _EqRng __xeq = __x.equal_range(__i->first);
lib/libcxx/include/ext/hash_set+16-18
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------- hash_set ------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -208,10 +207,9 @@ template <class Value, class Hash, class Pred, class Alloc>
208207
209208namespace __gnu_cxx {
210209
211using namespace std;
212210
213template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
214 class _Alloc = allocator<_Value> >
211template <class _Value, class _Hash = hash<_Value>, class _Pred = std::equal_to<_Value>,
212 class _Alloc = std::allocator<_Value> >
215213class _LIBCPP_TEMPLATE_VIS hash_set
216214{
217215public:
......@@ -225,7 +223,7 @@ public:
225223 typedef const value_type& const_reference;
226224
227225private:
228 typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
226 typedef std::__hash_table<value_type, hasher, key_equal, allocator_type> __table;
229227
230228 __table __table_;
231229
......@@ -277,7 +275,7 @@ public:
277275 const_iterator end() const {return __table_.end();}
278276
279277 _LIBCPP_INLINE_VISIBILITY
280 pair<iterator, bool> insert(const value_type& __x)
278 std::pair<iterator, bool> insert(const value_type& __x)
281279 {return __table_.__insert_unique(__x);}
282280 _LIBCPP_INLINE_VISIBILITY
283281 iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
......@@ -310,10 +308,10 @@ public:
310308 _LIBCPP_INLINE_VISIBILITY
311309 size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
312310 _LIBCPP_INLINE_VISIBILITY
313 pair<iterator, iterator> equal_range(const key_type& __k)
311 std::pair<iterator, iterator> equal_range(const key_type& __k)
314312 {return __table_.__equal_range_unique(__k);}
315313 _LIBCPP_INLINE_VISIBILITY
316 pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
314 std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
317315 {return __table_.__equal_range_unique(__k);}
318316
319317 _LIBCPP_INLINE_VISIBILITY
......@@ -432,8 +430,8 @@ operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
432430 return !(__x == __y);
433431}
434432
435template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
436 class _Alloc = allocator<_Value> >
433template <class _Value, class _Hash = hash<_Value>, class _Pred = std::equal_to<_Value>,
434 class _Alloc = std::allocator<_Value> >
437435class _LIBCPP_TEMPLATE_VIS hash_multiset
438436{
439437public:
......@@ -447,7 +445,7 @@ public:
447445 typedef const value_type& const_reference;
448446
449447private:
450 typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
448 typedef std::__hash_table<value_type, hasher, key_equal, allocator_type> __table;
451449
452450 __table __table_;
453451
......@@ -531,10 +529,10 @@ public:
531529 _LIBCPP_INLINE_VISIBILITY
532530 size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
533531 _LIBCPP_INLINE_VISIBILITY
534 pair<iterator, iterator> equal_range(const key_type& __k)
532 std::pair<iterator, iterator> equal_range(const key_type& __k)
535533 {return __table_.__equal_range_multi(__k);}
536534 _LIBCPP_INLINE_VISIBILITY
537 pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
535 std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
538536 {return __table_.__equal_range_multi(__k);}
539537
540538 _LIBCPP_INLINE_VISIBILITY
......@@ -611,7 +609,7 @@ template <class _InputIterator>
611609inline
612610void
613611hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
614 _InputIterator __last)
612 _InputIterator __last)
615613{
616614 for (; __first != __last; ++__first)
617615 __table_.__insert_multi(*__first);
......@@ -635,7 +633,7 @@ operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
635633 return false;
636634 typedef typename hash_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator
637635 const_iterator;
638 typedef pair<const_iterator, const_iterator> _EqRng;
636 typedef std::pair<const_iterator, const_iterator> _EqRng;
639637 for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
640638 {
641639 _EqRng __xeq = __x.equal_range(*__i);
lib/libcxx/include/fenv.h created+116
......@@ -0,0 +1,116 @@
1// -*- C++ -*-
2//===---------------------------- math.h ----------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_FENV_H
11#define _LIBCPP_FENV_H
12
13
14/*
15 fenv.h synopsis
16
17This entire header is C99 / C++0X
18
19Macros:
20
21 FE_DIVBYZERO
22 FE_INEXACT
23 FE_INVALID
24 FE_OVERFLOW
25 FE_UNDERFLOW
26 FE_ALL_EXCEPT
27 FE_DOWNWARD
28 FE_TONEAREST
29 FE_TOWARDZERO
30 FE_UPWARD
31 FE_DFL_ENV
32
33Types:
34
35 fenv_t
36 fexcept_t
37
38int feclearexcept(int excepts);
39int fegetexceptflag(fexcept_t* flagp, int excepts);
40int feraiseexcept(int excepts);
41int fesetexceptflag(const fexcept_t* flagp, int excepts);
42int fetestexcept(int excepts);
43int fegetround();
44int fesetround(int round);
45int fegetenv(fenv_t* envp);
46int feholdexcept(fenv_t* envp);
47int fesetenv(const fenv_t* envp);
48int feupdateenv(const fenv_t* envp);
49
50
51*/
52
53#include <__config>
54
55#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
56#pragma GCC system_header
57#endif
58
59#include_next <fenv.h>
60
61#ifdef __cplusplus
62
63extern "C++" {
64
65#ifdef feclearexcept
66#undef feclearexcept
67#endif
68
69#ifdef fegetexceptflag
70#undef fegetexceptflag
71#endif
72
73
74#ifdef feraiseexcept
75#undef feraiseexcept
76#endif
77
78#ifdef fesetexceptflag
79#undef fesetexceptflag
80#endif
81
82
83#ifdef fetestexcept
84#undef fetestexcept
85#endif
86
87#ifdef fegetround
88#undef fegetround
89#endif
90
91#ifdef fesetround
92#undef fesetround
93#endif
94
95#ifdef fegetenv
96#undef fegetenv
97#endif
98
99#ifdef feholdexcept
100#undef feholdexcept
101#endif
102
103
104#ifdef fesetenv
105#undef fesetenv
106#endif
107
108#ifdef feupdateenv
109#undef feupdateenv
110#endif
111
112} // extern "C++"
113
114#endif // defined(__cplusplus)
115
116#endif // _LIBCPP_FENV_H
lib/libcxx/include/filesystem+19-13
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- filesystem -------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109#ifndef _LIBCPP_FILESYSTEM
......@@ -259,6 +258,8 @@ _LIBCPP_PUSH_MACROS
259258
260259_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
261260
261_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
262
262263typedef chrono::time_point<_FilesystemClock> file_time_type;
263264
264265struct _LIBCPP_TYPE_VIS space_info {
......@@ -1311,7 +1312,11 @@ inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const path::iterator& __lhs,
13111312 return !(__lhs == __rhs);
13121313}
13131314
1314class _LIBCPP_EXCEPTION_ABI filesystem_error : public system_error {
1315// TODO(ldionne): We need to pop the pragma and push it again after
1316// filesystem_error to work around PR41078.
1317_LIBCPP_AVAILABILITY_FILESYSTEM_POP
1318
1319class _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_EXCEPTION_ABI filesystem_error : public system_error {
13151320public:
13161321 _LIBCPP_INLINE_VISIBILITY
13171322 filesystem_error(const string& __what, error_code __ec)
......@@ -1348,11 +1353,10 @@ public:
13481353 return __storage_->__what_.c_str();
13491354 }
13501355
1351 _LIBCPP_FUNC_VIS
13521356 void __create_what(int __num_paths);
13531357
13541358private:
1355 struct _Storage {
1359 struct _LIBCPP_HIDDEN _Storage {
13561360 _LIBCPP_INLINE_VISIBILITY
13571361 _Storage(const path& __p1, const path& __p2) : __p1_(__p1), __p2_(__p2) {}
13581362
......@@ -1363,16 +1367,16 @@ private:
13631367 shared_ptr<_Storage> __storage_;
13641368};
13651369
1370_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
1371
13661372template <class... _Args>
13671373_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
13681374#ifndef _LIBCPP_NO_EXCEPTIONS
1369 void
1370 __throw_filesystem_error(_Args&&... __args) {
1375void __throw_filesystem_error(_Args&&... __args) {
13711376 throw filesystem_error(std::forward<_Args>(__args)...);
13721377}
13731378#else
1374 void
1375 __throw_filesystem_error(_Args&&...) {
1379void __throw_filesystem_error(_Args&&...) {
13761380 _VSTD::abort();
13771381}
13781382#endif
......@@ -1938,7 +1942,7 @@ inline _LIBCPP_INLINE_VISIBILITY path weakly_canonical(path const& __p,
19381942
19391943class directory_iterator;
19401944class recursive_directory_iterator;
1941class __dir_stream;
1945class _LIBCPP_HIDDEN __dir_stream;
19421946
19431947class directory_entry {
19441948 typedef _VSTD_FS::path _Path;
......@@ -2601,7 +2605,7 @@ private:
26012605 operator==(const recursive_directory_iterator&,
26022606 const recursive_directory_iterator&) noexcept;
26032607
2604 struct __shared_imp;
2608 struct _LIBCPP_HIDDEN __shared_imp;
26052609 shared_ptr<__shared_imp> __imp_;
26062610 bool __rec_;
26072611}; // class recursive_directory_iterator
......@@ -2628,6 +2632,8 @@ end(const recursive_directory_iterator&) noexcept {
26282632 return recursive_directory_iterator();
26292633}
26302634
2635_LIBCPP_AVAILABILITY_FILESYSTEM_POP
2636
26312637_LIBCPP_END_NAMESPACE_FILESYSTEM
26322638
26332639#endif // !_LIBCPP_CXX03_LANG
lib/libcxx/include/float.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- float.h ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/forward_list+45-32
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------- forward_list ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -121,10 +120,12 @@ public:
121120 const_iterator first, const_iterator last);
122121 void splice_after(const_iterator p, forward_list&& x,
123122 const_iterator first, const_iterator last);
124 void remove(const value_type& v);
125 template <class Predicate> void remove_if(Predicate pred);
126 void unique();
127 template <class BinaryPredicate> void unique(BinaryPredicate binary_pred);
123 size_type remove(const value_type& v); // void before C++20
124 template <class Predicate>
125 size_type remove_if(Predicate pred); // void before C++20
126 size_type unique(); // void before C++20
127 template <class BinaryPredicate>
128 size_type unique(BinaryPredicate binary_pred); // void before C++20
128129 void merge(forward_list& x);
129130 void merge(forward_list&& x);
130131 template <class Compare> void merge(forward_list& x, Compare comp);
......@@ -531,7 +532,7 @@ public:
531532#if _LIBCPP_STD_VER >= 14
532533 _NOEXCEPT;
533534#else
534 _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
535 _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
535536 __is_nothrow_swappable<__node_allocator>::value);
536537#endif
537538protected:
......@@ -596,11 +597,11 @@ __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
596597#if _LIBCPP_STD_VER >= 14
597598 _NOEXCEPT
598599#else
599 _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
600 _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
600601 __is_nothrow_swappable<__node_allocator>::value)
601602#endif
602603{
603 __swap_allocator(__alloc(), __x.__alloc(),
604 __swap_allocator(__alloc(), __x.__alloc(),
604605 integral_constant<bool, __node_traits::propagate_on_container_swap::value>());
605606 using _VSTD::swap;
606607 swap(__before_begin()->__next_, __x.__before_begin()->__next_);
......@@ -648,6 +649,11 @@ public:
648649
649650 typedef typename base::iterator iterator;
650651 typedef typename base::const_iterator const_iterator;
652#if _LIBCPP_STD_VER > 17
653 typedef size_type __remove_return_type;
654#else
655 typedef void __remove_return_type;
656#endif
651657
652658 _LIBCPP_INLINE_VISIBILITY
653659 forward_list()
......@@ -809,7 +815,6 @@ public:
809815 _LIBCPP_INLINE_VISIBILITY
810816 void clear() _NOEXCEPT {base::clear();}
811817
812#ifndef _LIBCPP_CXX03_LANG
813818 _LIBCPP_INLINE_VISIBILITY
814819 void splice_after(const_iterator __p, forward_list&& __x);
815820 _LIBCPP_INLINE_VISIBILITY
......@@ -817,16 +822,15 @@ public:
817822 _LIBCPP_INLINE_VISIBILITY
818823 void splice_after(const_iterator __p, forward_list&& __x,
819824 const_iterator __f, const_iterator __l);
820#endif // _LIBCPP_CXX03_LANG
821825 void splice_after(const_iterator __p, forward_list& __x);
822826 void splice_after(const_iterator __p, forward_list& __x, const_iterator __i);
823827 void splice_after(const_iterator __p, forward_list& __x,
824828 const_iterator __f, const_iterator __l);
825 void remove(const value_type& __v);
826 template <class _Predicate> void remove_if(_Predicate __pred);
829 __remove_return_type remove(const value_type& __v);
830 template <class _Predicate> __remove_return_type remove_if(_Predicate __pred);
827831 _LIBCPP_INLINE_VISIBILITY
828 void unique() {unique(__equal_to<value_type>());}
829 template <class _BinaryPredicate> void unique(_BinaryPredicate __binary_pred);
832 __remove_return_type unique() {return unique(__equal_to<value_type>());}
833 template <class _BinaryPredicate> __remove_return_type unique(_BinaryPredicate __binary_pred);
830834#ifndef _LIBCPP_CXX03_LANG
831835 _LIBCPP_INLINE_VISIBILITY
832836 void merge(forward_list&& __x) {merge(__x, __less<value_type>());}
......@@ -1469,8 +1473,6 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
14691473 }
14701474}
14711475
1472#ifndef _LIBCPP_CXX03_LANG
1473
14741476template <class _Tp, class _Alloc>
14751477inline _LIBCPP_INLINE_VISIBILITY
14761478void
......@@ -1500,21 +1502,21 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
15001502 splice_after(__p, __x, __f, __l);
15011503}
15021504
1503#endif // _LIBCPP_CXX03_LANG
1504
15051505template <class _Tp, class _Alloc>
1506void
1506typename forward_list<_Tp, _Alloc>::__remove_return_type
15071507forward_list<_Tp, _Alloc>::remove(const value_type& __v)
15081508{
1509 forward_list<_Tp, _Alloc> __deleted_nodes; // collect the nodes we're removing
1510 iterator __e = end();
1509 forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
1510 typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
1511 const iterator __e = end();
15111512 for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;)
15121513 {
15131514 if (__i.__get_begin()->__next_->__value_ == __v)
15141515 {
1516 ++__count_removed;
15151517 iterator __j = _VSTD::next(__i, 2);
15161518 for (; __j != __e && *__j == __v; ++__j)
1517 ;
1519 ++__count_removed;
15181520 __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
15191521 if (__j == __e)
15201522 break;
......@@ -1523,22 +1525,27 @@ forward_list<_Tp, _Alloc>::remove(const value_type& __v)
15231525 else
15241526 ++__i;
15251527 }
1528
1529 return (__remove_return_type) __count_removed;
15261530}
15271531
15281532template <class _Tp, class _Alloc>
15291533template <class _Predicate>
1530void
1534typename forward_list<_Tp, _Alloc>::__remove_return_type
15311535forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
15321536{
1533 iterator __e = end();
1537 forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
1538 typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
1539 const iterator __e = end();
15341540 for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;)
15351541 {
15361542 if (__pred(__i.__get_begin()->__next_->__value_))
15371543 {
1544 ++__count_removed;
15381545 iterator __j = _VSTD::next(__i, 2);
15391546 for (; __j != __e && __pred(*__j); ++__j)
1540 ;
1541 erase_after(__i, __j);
1547 ++__count_removed;
1548 __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
15421549 if (__j == __e)
15431550 break;
15441551 __i = __j;
......@@ -1546,22 +1553,28 @@ forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
15461553 else
15471554 ++__i;
15481555 }
1556
1557 return (__remove_return_type) __count_removed;
15491558}
15501559
15511560template <class _Tp, class _Alloc>
15521561template <class _BinaryPredicate>
1553void
1562typename forward_list<_Tp, _Alloc>::__remove_return_type
15541563forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
15551564{
1565 forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
1566 typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
15561567 for (iterator __i = begin(), __e = end(); __i != __e;)
15571568 {
15581569 iterator __j = _VSTD::next(__i);
15591570 for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
1560 ;
1571 ++__count_removed;
15611572 if (__i.__get_begin()->__next_ != __j.__get_unsafe_node_pointer())
1562 erase_after(__i, __j);
1573 __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
15631574 __i = __j;
15641575 }
1576
1577 return (__remove_return_type) __count_removed;
15651578}
15661579
15671580template <class _Tp, class _Alloc>
lib/libcxx/include/fstream+11-12
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------- fstream ------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -236,7 +235,7 @@ public:
236235 basic_filebuf* open(const string& __s, ios_base::openmode __mode);
237236
238237#if _LIBCPP_STD_VER >= 17
239 _LIBCPP_INLINE_VISIBILITY
238 _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
240239 basic_filebuf* open(const _VSTD_FS::path& __p, ios_base::openmode __mode) {
241240 return open(__p.c_str(), __mode);
242241 }
......@@ -758,7 +757,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
758757 this->eback() + __ibs_, __inext);
759758 if (__r == codecvt_base::noconv)
760759 {
761 this->setg((char_type*)__extbuf_, (char_type*)__extbuf_,
760 this->setg((char_type*)__extbuf_, (char_type*)__extbuf_,
762761 (char_type*)const_cast<char *>(__extbufend_));
763762 __c = traits_type::to_int_type(*this->gptr());
764763 }
......@@ -1152,7 +1151,7 @@ public:
11521151 _LIBCPP_INLINE_VISIBILITY
11531152 explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
11541153#if _LIBCPP_STD_VER >= 17
1155 _LIBCPP_INLINE_VISIBILITY
1154 _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
11561155 explicit basic_ifstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in)
11571156 : basic_ifstream(__p.c_str(), __mode) {}
11581157#endif // _LIBCPP_STD_VER >= 17
......@@ -1178,7 +1177,7 @@ public:
11781177#endif
11791178 void open(const string& __s, ios_base::openmode __mode = ios_base::in);
11801179#if _LIBCPP_STD_VER >= 17
1181 _LIBCPP_INLINE_VISIBILITY
1180 _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
11821181 void open(const filesystem::path& __p,
11831182 ios_base::openmode __mode = ios_base::in) {
11841183 return open(__p.c_str(), __mode);
......@@ -1366,7 +1365,7 @@ public:
13661365 explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out);
13671366
13681367#if _LIBCPP_STD_VER >= 17
1369 _LIBCPP_INLINE_VISIBILITY
1368 _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
13701369 explicit basic_ofstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)
13711370 : basic_ofstream(__p.c_str(), __mode) {}
13721371#endif // _LIBCPP_STD_VER >= 17
......@@ -1393,7 +1392,7 @@ public:
13931392 void open(const string& __s, ios_base::openmode __mode = ios_base::out);
13941393
13951394#if _LIBCPP_STD_VER >= 17
1396 _LIBCPP_INLINE_VISIBILITY
1395 _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
13971396 void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)
13981397 { return open(__p.c_str(), __mode); }
13991398#endif // _LIBCPP_STD_VER >= 17
......@@ -1580,7 +1579,7 @@ public:
15801579 explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
15811580
15821581#if _LIBCPP_STD_VER >= 17
1583 _LIBCPP_INLINE_VISIBILITY
1582 _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
15841583 explicit basic_fstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in | ios_base::out)
15851584 : basic_fstream(__p.c_str(), __mode) {}
15861585#endif // _LIBCPP_STD_VER >= 17
......@@ -1608,7 +1607,7 @@ public:
16081607 void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
16091608
16101609#if _LIBCPP_STD_VER >= 17
1611 _LIBCPP_INLINE_VISIBILITY
1610 _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
16121611 void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in|ios_base::out)
16131612 { return open(__p.c_str(), __mode); }
16141613#endif // _LIBCPP_STD_VER >= 17
lib/libcxx/include/functional+106-34
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------ functional ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -231,6 +230,10 @@ template<class Fn, class... BoundArgs>
231230template<class R, class Fn, class... BoundArgs>
232231 unspecified bind(Fn&&, BoundArgs&&...);
233232
233template<class F, class... Args>
234 invoke_result_t<F, Args...> invoke(F&& f, Args&&... args) // C++17
235 noexcept(is_nothrow_invocable_v<F, Args...>);
236
234237namespace placeholders {
235238 // M is the implementation-defined number of placeholders
236239 extern unspecified _1;
......@@ -1476,6 +1479,8 @@ namespace __function {
14761479// __alloc_func holds a functor and an allocator.
14771480
14781481template <class _Fp, class _Ap, class _FB> class __alloc_func;
1482template <class _Fp, class _FB>
1483class __default_alloc_func;
14791484
14801485template <class _Fp, class _Ap, class _Rp, class... _ArgTypes>
14811486class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)>
......@@ -1483,14 +1488,15 @@ class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)>
14831488 __compressed_pair<_Fp, _Ap> __f_;
14841489
14851490 public:
1486 typedef _Fp _Target;
1487 typedef _Ap _Alloc;
1491 typedef _LIBCPP_NODEBUG_TYPE _Fp _Target;
1492 typedef _LIBCPP_NODEBUG_TYPE _Ap _Alloc;
14881493
14891494 _LIBCPP_INLINE_VISIBILITY
14901495 const _Target& __target() const { return __f_.first(); }
14911496
1497 // WIN32 APIs may define __allocator, so use __get_allocator instead.
14921498 _LIBCPP_INLINE_VISIBILITY
1493 const _Alloc& __allocator() const { return __f_.second(); }
1499 const _Alloc& __get_allocator() const { return __f_.second(); }
14941500
14951501 _LIBCPP_INLINE_VISIBILITY
14961502 explicit __alloc_func(_Target&& __f)
......@@ -1544,6 +1550,56 @@ class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)>
15441550
15451551 _LIBCPP_INLINE_VISIBILITY
15461552 void destroy() _NOEXCEPT { __f_.~__compressed_pair<_Target, _Alloc>(); }
1553
1554 static void __destroy_and_delete(__alloc_func* __f) {
1555 typedef allocator_traits<_Alloc> __alloc_traits;
1556 typedef typename __rebind_alloc_helper<__alloc_traits, __alloc_func>::type
1557 _FunAlloc;
1558 _FunAlloc __a(__f->__get_allocator());
1559 __f->destroy();
1560 __a.deallocate(__f, 1);
1561 }
1562};
1563
1564template <class _Fp, class _Rp, class... _ArgTypes>
1565class __default_alloc_func<_Fp, _Rp(_ArgTypes...)> {
1566 _Fp __f_;
1567
1568public:
1569 typedef _LIBCPP_NODEBUG_TYPE _Fp _Target;
1570
1571 _LIBCPP_INLINE_VISIBILITY
1572 const _Target& __target() const { return __f_; }
1573
1574 _LIBCPP_INLINE_VISIBILITY
1575 explicit __default_alloc_func(_Target&& __f) : __f_(std::move(__f)) {}
1576
1577 _LIBCPP_INLINE_VISIBILITY
1578 explicit __default_alloc_func(const _Target& __f) : __f_(__f) {}
1579
1580 _LIBCPP_INLINE_VISIBILITY
1581 _Rp operator()(_ArgTypes&&... __arg) {
1582 typedef __invoke_void_return_wrapper<_Rp> _Invoker;
1583 return _Invoker::__call(__f_, _VSTD::forward<_ArgTypes>(__arg)...);
1584 }
1585
1586 _LIBCPP_INLINE_VISIBILITY
1587 __default_alloc_func* __clone() const {
1588 __builtin_new_allocator::__holder_t __hold =
1589 __builtin_new_allocator::__allocate_type<__default_alloc_func>(1);
1590 __default_alloc_func* __res =
1591 ::new (__hold.get()) __default_alloc_func(__f_);
1592 (void)__hold.release();
1593 return __res;
1594 }
1595
1596 _LIBCPP_INLINE_VISIBILITY
1597 void destroy() _NOEXCEPT { __f_.~_Target(); }
1598
1599 static void __destroy_and_delete(__default_alloc_func* __f) {
1600 __f->destroy();
1601 __builtin_new_allocator::__deallocate_type<__default_alloc_func>(__f, 1);
1602 }
15471603};
15481604
15491605// __base provides an abstract interface for copyable functors.
......@@ -1612,7 +1668,7 @@ __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone() const
16121668{
16131669 typedef allocator_traits<_Alloc> __alloc_traits;
16141670 typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
1615 _Ap __a(__f_.__allocator());
1671 _Ap __a(__f_.__get_allocator());
16161672 typedef __allocator_destructor<_Ap> _Dp;
16171673 unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
16181674 ::new ((void*)__hold.get()) __func(__f_.__target(), _Alloc(__a));
......@@ -1623,7 +1679,7 @@ template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
16231679void
16241680__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone(__base<_Rp(_ArgTypes...)>* __p) const
16251681{
1626 ::new (__p) __func(__f_.__target(), __f_.__allocator());
1682 ::new (__p) __func(__f_.__target(), __f_.__get_allocator());
16271683}
16281684
16291685template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
......@@ -1639,7 +1695,7 @@ __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() _NOEXCEPT
16391695{
16401696 typedef allocator_traits<_Alloc> __alloc_traits;
16411697 typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
1642 _Ap __a(__f_.__allocator());
1698 _Ap __a(__f_.__get_allocator());
16431699 __f_.destroy();
16441700 __a.deallocate(this, 1);
16451701}
......@@ -1692,7 +1748,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
16921748 __value_func() _NOEXCEPT : __f_(0) {}
16931749
16941750 template <class _Fp, class _Alloc>
1695 _LIBCPP_INLINE_VISIBILITY __value_func(_Fp&& __f, const _Alloc __a)
1751 _LIBCPP_INLINE_VISIBILITY __value_func(_Fp&& __f, const _Alloc& __a)
16961752 : __f_(0)
16971753 {
16981754 typedef allocator_traits<_Alloc> __alloc_traits;
......@@ -1720,6 +1776,11 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
17201776 }
17211777 }
17221778
1779 template <class _Fp,
1780 class = typename enable_if<!is_same<typename decay<_Fp>::type, __value_func>::value>::type>
1781 _LIBCPP_INLINE_VISIBILITY explicit __value_func(_Fp&& __f)
1782 : __value_func(std::forward<_Fp>(__f), allocator<_Fp>()) {}
1783
17231784 _LIBCPP_INLINE_VISIBILITY
17241785 __value_func(const __value_func& __f)
17251786 {
......@@ -1919,29 +1980,22 @@ struct __policy
19191980 return __f->__clone();
19201981 }
19211982
1922 template <typename _Fun> static void __large_destroy(void* __s)
1923 {
1924 typedef allocator_traits<typename _Fun::_Alloc> __alloc_traits;
1925 typedef typename __rebind_alloc_helper<__alloc_traits, _Fun>::type
1926 _FunAlloc;
1927 _Fun* __f = static_cast<_Fun*>(__s);
1928 _FunAlloc __a(__f->__allocator());
1929 __f->destroy();
1930 __a.deallocate(__f, 1);
1983 template <typename _Fun>
1984 static void __large_destroy(void* __s) {
1985 _Fun::__destroy_and_delete(static_cast<_Fun*>(__s));
19311986 }
19321987
19331988 template <typename _Fun>
19341989 _LIBCPP_INLINE_VISIBILITY static const __policy*
1935 __choose_policy(/* is_small = */ false_type)
1936 {
1937 static const _LIBCPP_CONSTEXPR __policy __policy_ = {
1938 &__large_clone<_Fun>, &__large_destroy<_Fun>, false,
1990 __choose_policy(/* is_small = */ false_type) {
1991 static const _LIBCPP_CONSTEXPR __policy __policy_ = {
1992 &__large_clone<_Fun>, &__large_destroy<_Fun>, false,
19391993#ifndef _LIBCPP_NO_RTTI
1940 &typeid(typename _Fun::_Target)
1994 &typeid(typename _Fun::_Target)
19411995#else
1942 nullptr
1996 nullptr
19431997#endif
1944 };
1998 };
19451999 return &__policy_;
19462000 }
19472001
......@@ -2066,6 +2120,25 @@ template <class _Rp, class... _ArgTypes> class __policy_func<_Rp(_ArgTypes...)>
20662120 }
20672121 }
20682122
2123 template <class _Fp, class = typename enable_if<!is_same<typename decay<_Fp>::type, __policy_func>::value>::type>
2124 _LIBCPP_INLINE_VISIBILITY explicit __policy_func(_Fp&& __f)
2125 : __policy_(__policy::__create_empty()) {
2126 typedef __default_alloc_func<_Fp, _Rp(_ArgTypes...)> _Fun;
2127
2128 if (__function::__not_null(__f)) {
2129 __invoker_ = __invoker::template __create<_Fun>();
2130 __policy_ = __policy::__create<_Fun>();
2131 if (__use_small_storage<_Fun>()) {
2132 ::new ((void*)&__buf_.__small) _Fun(_VSTD::move(__f));
2133 } else {
2134 __builtin_new_allocator::__holder_t __hold =
2135 __builtin_new_allocator::__allocate_type<_Fun>(1);
2136 __buf_.__large = ::new (__hold.get()) _Fun(_VSTD::move(__f));
2137 (void)__hold.release();
2138 }
2139 }
2140 }
2141
20692142 _LIBCPP_INLINE_VISIBILITY
20702143 __policy_func(const __policy_func& __f)
20712144 : __buf_(__f.__buf_), __invoker_(__f.__invoker_),
......@@ -2173,8 +2246,8 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
21732246
21742247 __func __f_;
21752248
2176 template <class _Fp, bool = __lazy_and<
2177 integral_constant<bool, !is_same<__uncvref_t<_Fp>, function>::value>,
2249 template <class _Fp, bool = _And<
2250 _IsNotSame<__uncvref_t<_Fp>, function>,
21782251 __invokable<_Fp&, _ArgTypes...>
21792252 >::value>
21802253 struct __callable;
......@@ -2286,8 +2359,7 @@ function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
22862359
22872360template <class _Rp, class... _ArgTypes>
22882361template <class _Fp, class>
2289function<_Rp(_ArgTypes...)>::function(_Fp __f)
2290 : __f_(_VSTD::move(__f), allocator<_Fp>()) {}
2362function<_Rp(_ArgTypes...)>::function(_Fp __f) : __f_(_VSTD::move(__f)) {}
22912363
22922364#if _LIBCPP_STD_VER <= 14
22932365template <class _Rp, class... _ArgTypes>
......@@ -2484,7 +2556,7 @@ __mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>)
24842556
24852557template <class _Ti, class ..._Uj>
24862558inline _LIBCPP_INLINE_VISIBILITY
2487typename __lazy_enable_if
2559typename _EnableIf
24882560<
24892561 is_bind_expression<_Ti>::value,
24902562 __invoke_of<_Ti&, _Uj...>
......@@ -2769,9 +2841,9 @@ bind(_Fp&& __f, _BoundArgs&&... __bound_args)
27692841#if _LIBCPP_STD_VER > 14
27702842
27712843template <class _Fn, class ..._Args>
2772result_of_t<_Fn&&(_Args&&...)>
2844invoke_result_t<_Fn, _Args...>
27732845invoke(_Fn&& __f, _Args&&... __args)
2774 noexcept(noexcept(_VSTD::__invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...)))
2846 noexcept(is_nothrow_invocable_v<_Fn, _Args...>)
27752847{
27762848 return _VSTD::__invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...);
27772849}
lib/libcxx/include/future+8-13
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- future -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -409,11 +408,7 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch)
409408
410409#ifndef _LIBCPP_HAS_NO_STRONG_ENUMS
411410
412#ifdef _LIBCPP_UNDERLYING_TYPE
413411typedef underlying_type<launch>::type __launch_underlying_type;
414#else
415typedef int __launch_underlying_type;
416#endif
417412
418413inline _LIBCPP_INLINE_VISIBILITY
419414_LIBCPP_CONSTEXPR
......@@ -2016,7 +2011,7 @@ public:
20162011 class = typename enable_if
20172012 <
20182013 !is_same<
2019 typename __uncvref<_Fp>::type,
2014 typename __uncvref<_Fp>::type,
20202015 packaged_task
20212016 >::value
20222017 >::type
......@@ -2027,7 +2022,7 @@ public:
20272022 class = typename enable_if
20282023 <
20292024 !is_same<
2030 typename __uncvref<_Fp>::type,
2025 typename __uncvref<_Fp>::type,
20312026 packaged_task
20322027 >::value
20332028 >::type
......@@ -2145,7 +2140,7 @@ public:
21452140 class = typename enable_if
21462141 <
21472142 !is_same<
2148 typename __uncvref<_Fp>::type,
2143 typename __uncvref<_Fp>::type,
21492144 packaged_task
21502145 >::value
21512146 >::type
......@@ -2156,11 +2151,11 @@ public:
21562151 class = typename enable_if
21572152 <
21582153 !is_same<
2159 typename __uncvref<_Fp>::type,
2154 typename __uncvref<_Fp>::type,
21602155 packaged_task
21612156 >::value
21622157 >::type
2163 >
2158 >
21642159 _LIBCPP_INLINE_VISIBILITY
21652160 packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
21662161 : __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)),
lib/libcxx/include/initializer_list+4-5
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------- initializer_list -----------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -83,7 +82,7 @@ public:
8382 _LIBCPP_INLINE_VISIBILITY
8483 _LIBCPP_CONSTEXPR_AFTER_CXX11
8584 size_t size() const _NOEXCEPT {return __size_;}
86
85
8786 _LIBCPP_INLINE_VISIBILITY
8887 _LIBCPP_CONSTEXPR_AFTER_CXX11
8988 const _Ep* begin() const _NOEXCEPT {return __begin_;}
lib/libcxx/include/inttypes.h+8-4
......@@ -1,15 +1,19 @@
11// -*- C++ -*-
22//===--------------------------- inttypes.h -------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
1110#ifndef _LIBCPP_INTTYPES_H
11// AIX system headers need inttypes.h to be re-enterable while _STD_TYPES_T
12// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
13// case the header guard macro is defined.
14#if !defined(_AIX) || !defined(_STD_TYPES_T)
1215#define _LIBCPP_INTTYPES_H
16#endif // _STD_TYPES_T
1317
1418/*
1519 inttypes.h synopsis
lib/libcxx/include/iomanip+8-9
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- iomanip ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -516,7 +515,7 @@ put_time(const tm* __tm, const _CharT* __fmt)
516515
517516template <class _CharT, class _Traits, class _ForwardIterator>
518517std::basic_ostream<_CharT, _Traits> &
519__quoted_output ( basic_ostream<_CharT, _Traits> &__os,
518__quoted_output ( basic_ostream<_CharT, _Traits> &__os,
520519 _ForwardIterator __first, _ForwardIterator __last, _CharT __delim, _CharT __escape )
521520{
522521 _VSTD::basic_string<_CharT, _Traits> __str;
......@@ -571,7 +570,7 @@ __quoted_input ( basic_istream<_CharT, _Traits> &__is, _String & __string, _Char
571570
572571template <class _CharT, class _Traits, class _Iter>
573572basic_ostream<_CharT, _Traits>& operator<<(
574 basic_ostream<_CharT, _Traits>& __os,
573 basic_ostream<_CharT, _Traits>& __os,
575574 const __quoted_output_proxy<_CharT, _Iter, _Traits> & __proxy)
576575{
577576 return __quoted_output (__os, __proxy.__first, __proxy.__last, __proxy.__delim, __proxy.__escape);
......@@ -591,7 +590,7 @@ struct __quoted_proxy
591590template <class _CharT, class _Traits, class _Allocator>
592591_LIBCPP_INLINE_VISIBILITY
593592basic_ostream<_CharT, _Traits>& operator<<(
594 basic_ostream<_CharT, _Traits>& __os,
593 basic_ostream<_CharT, _Traits>& __os,
595594 const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)
596595{
597596 return __quoted_output (__os, __proxy.__string.cbegin (), __proxy.__string.cend (), __proxy.__delim, __proxy.__escape);
......@@ -601,7 +600,7 @@ basic_ostream<_CharT, _Traits>& operator<<(
601600template <class _CharT, class _Traits, class _Allocator>
602601_LIBCPP_INLINE_VISIBILITY
603602basic_istream<_CharT, _Traits>& operator>>(
604 basic_istream<_CharT, _Traits>& __is,
603 basic_istream<_CharT, _Traits>& __is,
605604 const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)
606605{
607606 return __quoted_input ( __is, __proxy.__string, __proxy.__delim, __proxy.__escape );
......@@ -661,7 +660,7 @@ __quoted_output_proxy<_CharT, const _CharT *, _Traits>
661660quoted (basic_string_view <_CharT, _Traits> __sv,
662661 _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
663662{
664 return __quoted_output_proxy<_CharT, const _CharT *, _Traits>
663 return __quoted_output_proxy<_CharT, const _CharT *, _Traits>
665664 ( __sv.data(), __sv.data() + __sv.size(), __delim, __escape );
666665}
667666#endif
lib/libcxx/include/ios+37-19
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- ios -------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -203,8 +202,8 @@ enum class io_errc
203202};
204203
205204concept_map ErrorCodeEnum<io_errc> { };
206error_code make_error_code(io_errc e) noexcept;
207error_condition make_error_condition(io_errc e) noexcept;
205error_code make_error_code(io_errc e) noexcept;
206error_condition make_error_condition(io_errc e) noexcept;
208207storage-class-specifier const error_category& iostream_category() noexcept;
209208
210209} // std
......@@ -331,6 +330,15 @@ public:
331330 void __set_badbit_and_consider_rethrow();
332331 void __set_failbit_and_consider_rethrow();
333332
333 _LIBCPP_INLINE_VISIBILITY
334 void __setstate_nothrow(iostate __state)
335 {
336 if (__rdbuf_)
337 __rdstate_ |= __state;
338 else
339 __rdstate_ |= __state | ios_base::badbit;
340 }
341
334342protected:
335343 _LIBCPP_INLINE_VISIBILITY
336344 ios_base() {// purposefully does no initialization
......@@ -426,6 +434,16 @@ public:
426434 virtual ~failure() throw();
427435};
428436
437_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
438void __throw_failure(char const* __msg) {
439#ifndef _LIBCPP_NO_EXCEPTIONS
440 throw ios_base::failure(__msg);
441#else
442 ((void)__msg);
443 _VSTD::abort();
444#endif
445}
446
429447class _LIBCPP_TYPE_VIS ios_base::Init
430448{
431449public:
......@@ -626,47 +644,47 @@ public:
626644 virtual ~basic_ios();
627645
628646 // 27.5.4.2 Members:
629 _LIBCPP_INLINE_VISIBILITY
647 _LIBCPP_INLINE_VISIBILITY
630648 basic_ostream<char_type, traits_type>* tie() const;
631 _LIBCPP_INLINE_VISIBILITY
649 _LIBCPP_INLINE_VISIBILITY
632650 basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
633651
634 _LIBCPP_INLINE_VISIBILITY
652 _LIBCPP_INLINE_VISIBILITY
635653 basic_streambuf<char_type, traits_type>* rdbuf() const;
636 _LIBCPP_INLINE_VISIBILITY
654 _LIBCPP_INLINE_VISIBILITY
637655 basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
638656
639657 basic_ios& copyfmt(const basic_ios& __rhs);
640658
641 _LIBCPP_INLINE_VISIBILITY
659 _LIBCPP_INLINE_VISIBILITY
642660 char_type fill() const;
643 _LIBCPP_INLINE_VISIBILITY
661 _LIBCPP_INLINE_VISIBILITY
644662 char_type fill(char_type __ch);
645663
646 _LIBCPP_INLINE_VISIBILITY
664 _LIBCPP_INLINE_VISIBILITY
647665 locale imbue(const locale& __loc);
648666
649 _LIBCPP_INLINE_VISIBILITY
667 _LIBCPP_INLINE_VISIBILITY
650668 char narrow(char_type __c, char __dfault) const;
651 _LIBCPP_INLINE_VISIBILITY
669 _LIBCPP_INLINE_VISIBILITY
652670 char_type widen(char __c) const;
653671
654672protected:
655673 _LIBCPP_INLINE_VISIBILITY
656674 basic_ios() {// purposefully does no initialization
657675 }
658 _LIBCPP_INLINE_VISIBILITY
676 _LIBCPP_INLINE_VISIBILITY
659677 void init(basic_streambuf<char_type, traits_type>* __sb);
660678
661 _LIBCPP_INLINE_VISIBILITY
679 _LIBCPP_INLINE_VISIBILITY
662680 void move(basic_ios& __rhs);
663681#ifndef _LIBCPP_CXX03_LANG
664682 _LIBCPP_INLINE_VISIBILITY
665683 void move(basic_ios&& __rhs) {move(__rhs);}
666684#endif
667 _LIBCPP_INLINE_VISIBILITY
685 _LIBCPP_INLINE_VISIBILITY
668686 void swap(basic_ios& __rhs) _NOEXCEPT;
669 _LIBCPP_INLINE_VISIBILITY
687 _LIBCPP_INLINE_VISIBILITY
670688 void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
671689private:
672690 basic_ostream<char_type, traits_type>* __tie_;
lib/libcxx/include/iosfwd+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- iosfwd -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/iostream+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- iostream ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/istream+514-381
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- istream ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -363,26 +362,31 @@ template <class _Tp, class _CharT, class _Traits>
363362_LIBCPP_INLINE_VISIBILITY
364363basic_istream<_CharT, _Traits>&
365364__input_arithmetic(basic_istream<_CharT, _Traits>& __is, _Tp& __n) {
366#ifndef _LIBCPP_NO_EXCEPTIONS
367 try
365 ios_base::iostate __state = ios_base::goodbit;
366 typename basic_istream<_CharT, _Traits>::sentry __s(__is);
367 if (__s)
368368 {
369#endif // _LIBCPP_NO_EXCEPTIONS
370 typename basic_istream<_CharT, _Traits>::sentry __s(__is);
371 if (__s)
369#ifndef _LIBCPP_NO_EXCEPTIONS
370 try
372371 {
372#endif // _LIBCPP_NO_EXCEPTIONS
373373 typedef istreambuf_iterator<_CharT, _Traits> _Ip;
374374 typedef num_get<_CharT, _Ip> _Fp;
375 ios_base::iostate __err = ios_base::goodbit;
376 use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __err, __n);
377 __is.setstate(__err);
378 }
375 use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __n);
379376#ifndef _LIBCPP_NO_EXCEPTIONS
377 }
378 catch (...)
379 {
380 __state |= ios_base::badbit;
381 __is.__setstate_nothrow(__state);
382 if (__is.exceptions() & ios_base::badbit)
383 {
384 throw;
385 }
386 }
387#endif
388 __is.setstate(__state);
380389 }
381 catch (...)
382 {
383 __is.__set_badbit_and_consider_rethrow();
384 }
385#endif // _LIBCPP_NO_EXCEPTIONS
386390 return __is;
387391}
388392
......@@ -467,39 +471,46 @@ template <class _Tp, class _CharT, class _Traits>
467471_LIBCPP_INLINE_VISIBILITY
468472basic_istream<_CharT, _Traits>&
469473__input_arithmetic_with_numeric_limits(basic_istream<_CharT, _Traits>& __is, _Tp& __n) {
470#ifndef _LIBCPP_NO_EXCEPTIONS
471 try
474 ios_base::iostate __state = ios_base::goodbit;
475 typename basic_istream<_CharT, _Traits>::sentry __s(__is);
476 if (__s)
472477 {
473#endif // _LIBCPP_NO_EXCEPTIONS
474 typename basic_istream<_CharT, _Traits>::sentry __s(__is);
475 if (__s)
478#ifndef _LIBCPP_NO_EXCEPTIONS
479 try
476480 {
481#endif // _LIBCPP_NO_EXCEPTIONS
477482 typedef istreambuf_iterator<_CharT, _Traits> _Ip;
478483 typedef num_get<_CharT, _Ip> _Fp;
479 ios_base::iostate __err = ios_base::goodbit;
480484 long __temp;
481 use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __err, __temp);
485 use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __temp);
482486 if (__temp < numeric_limits<_Tp>::min())
483487 {
484 __err |= ios_base::failbit;
488 __state |= ios_base::failbit;
485489 __n = numeric_limits<_Tp>::min();
486490 }
487491 else if (__temp > numeric_limits<_Tp>::max())
488492 {
489 __err |= ios_base::failbit;
493 __state |= ios_base::failbit;
490494 __n = numeric_limits<_Tp>::max();
491495 }
492496 else
497 {
493498 __n = static_cast<_Tp>(__temp);
494 __is.setstate(__err);
495 }
499 }
496500#ifndef _LIBCPP_NO_EXCEPTIONS
497 }
498 catch (...)
499 {
500 __is.__set_badbit_and_consider_rethrow();
501 }
501 }
502 catch (...)
503 {
504 __state |= ios_base::badbit;
505 __is.__setstate_nothrow(__state);
506 if (__is.exceptions() & ios_base::badbit)
507 {
508 throw;
509 }
510 }
502511#endif // _LIBCPP_NO_EXCEPTIONS
512 __is.setstate(__state);
513 }
503514 return __is;
504515}
505516
......@@ -522,22 +533,22 @@ _LIBCPP_INLINE_VISIBILITY
522533basic_istream<_CharT, _Traits>&
523534__input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n)
524535{
525#ifndef _LIBCPP_NO_EXCEPTIONS
526 try
536 ios_base::iostate __state = ios_base::goodbit;
537 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
538 if (__sen)
527539 {
528#endif // _LIBCPP_NO_EXCEPTIONS
529 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
530 if (__sen)
540#ifndef _LIBCPP_NO_EXCEPTIONS
541 try
531542 {
532 auto __s = __p;
543#endif
544 _CharT* __s = __p;
533545 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
534 ios_base::iostate __err = ios_base::goodbit;
535546 while (__s != __p + (__n-1))
536547 {
537548 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
538549 if (_Traits::eq_int_type(__i, _Traits::eof()))
539550 {
540 __err |= ios_base::eofbit;
551 __state |= ios_base::eofbit;
541552 break;
542553 }
543554 _CharT __ch = _Traits::to_char_type(__i);
......@@ -549,16 +560,21 @@ __input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n)
549560 *__s = _CharT();
550561 __is.width(0);
551562 if (__s == __p)
552 __err |= ios_base::failbit;
553 __is.setstate(__err);
554 }
563 __state |= ios_base::failbit;
555564#ifndef _LIBCPP_NO_EXCEPTIONS
565 }
566 catch (...)
567 {
568 __state |= ios_base::badbit;
569 __is.__setstate_nothrow(__state);
570 if (__is.exceptions() & ios_base::badbit)
571 {
572 throw;
573 }
574 }
575#endif
576 __is.setstate(__state);
556577 }
557 catch (...)
558 {
559 __is.__set_badbit_and_consider_rethrow();
560 }
561#endif // _LIBCPP_NO_EXCEPTIONS
562578 return __is;
563579}
564580
......@@ -569,7 +585,7 @@ inline _LIBCPP_INLINE_VISIBILITY
569585basic_istream<_CharT, _Traits>&
570586operator>>(basic_istream<_CharT, _Traits>& __is, _CharT (&__buf)[_Np])
571587{
572 auto __n = _Np;
588 size_t __n = _Np;
573589 if (__is.width() > 0)
574590 __n = _VSTD::min(size_t(__is.width()), _Np);
575591 return _VSTD::__input_c_string(__is, __buf, __n);
......@@ -626,26 +642,33 @@ template<class _CharT, class _Traits>
626642basic_istream<_CharT, _Traits>&
627643operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
628644{
629#ifndef _LIBCPP_NO_EXCEPTIONS
630 try
645 ios_base::iostate __state = ios_base::goodbit;
646 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
647 if (__sen)
631648 {
632#endif // _LIBCPP_NO_EXCEPTIONS
633 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
634 if (__sen)
649#ifndef _LIBCPP_NO_EXCEPTIONS
650 try
635651 {
652#endif
636653 typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
637654 if (_Traits::eq_int_type(__i, _Traits::eof()))
638 __is.setstate(ios_base::eofbit | ios_base::failbit);
655 __state |= ios_base::eofbit | ios_base::failbit;
639656 else
640657 __c = _Traits::to_char_type(__i);
641 }
642658#ifndef _LIBCPP_NO_EXCEPTIONS
659 }
660 catch (...)
661 {
662 __state |= ios_base::badbit;
663 __is.__setstate_nothrow(__state);
664 if (__is.exceptions() & ios_base::badbit)
665 {
666 throw;
667 }
668 }
669#endif
670 __is.setstate(__state);
643671 }
644 catch (...)
645 {
646 __is.__set_badbit_and_consider_rethrow();
647 }
648#endif // _LIBCPP_NO_EXCEPTIONS
649672 return __is;
650673}
651674
......@@ -669,58 +692,56 @@ template<class _CharT, class _Traits>
669692basic_istream<_CharT, _Traits>&
670693basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_type>* __sb)
671694{
695 ios_base::iostate __state = ios_base::goodbit;
672696 __gc_ = 0;
673#ifndef _LIBCPP_NO_EXCEPTIONS
674 try
697 sentry __s(*this, true);
698 if (__s)
675699 {
676#endif // _LIBCPP_NO_EXCEPTIONS
677 sentry __s(*this, true);
678 if (__s)
700 if (__sb)
679701 {
680 if (__sb)
681 {
682702#ifndef _LIBCPP_NO_EXCEPTIONS
683 try
703 try
704 {
705#endif // _LIBCPP_NO_EXCEPTIONS
706 while (true)
684707 {
685#endif // _LIBCPP_NO_EXCEPTIONS
686 ios_base::iostate __err = ios_base::goodbit;
687 while (true)
708 typename traits_type::int_type __i = this->rdbuf()->sgetc();
709 if (traits_type::eq_int_type(__i, _Traits::eof()))
688710 {
689 typename traits_type::int_type __i = this->rdbuf()->sgetc();
690 if (traits_type::eq_int_type(__i, _Traits::eof()))
691 {
692 __err |= ios_base::eofbit;
693 break;
694 }
695 if (traits_type::eq_int_type(
696 __sb->sputc(traits_type::to_char_type(__i)),
697 traits_type::eof()))
698 break;
699 ++__gc_;
700 this->rdbuf()->sbumpc();
711 __state |= ios_base::eofbit;
712 break;
701713 }
702 if (__gc_ == 0)
703 __err |= ios_base::failbit;
704 this->setstate(__err);
705#ifndef _LIBCPP_NO_EXCEPTIONS
714 if (traits_type::eq_int_type(
715 __sb->sputc(traits_type::to_char_type(__i)),
716 traits_type::eof()))
717 break;
718 ++__gc_;
719 this->rdbuf()->sbumpc();
706720 }
707 catch (...)
721 if (__gc_ == 0)
722 __state |= ios_base::failbit;
723#ifndef _LIBCPP_NO_EXCEPTIONS
724 }
725 catch (...)
726 {
727 __state |= ios_base::badbit;
728 if (__gc_ == 0)
729 __state |= ios_base::failbit;
730
731 this->__setstate_nothrow(__state);
732 if (this->exceptions() & ios_base::failbit || this->exceptions() & ios_base::badbit)
708733 {
709 if (__gc_ == 0)
710 this->__set_failbit_and_consider_rethrow();
734 throw;
711735 }
712#endif // _LIBCPP_NO_EXCEPTIONS
713736 }
714 else
715 this->setstate(ios_base::failbit);
737#endif // _LIBCPP_NO_EXCEPTIONS
716738 }
717#ifndef _LIBCPP_NO_EXCEPTIONS
718 }
719 catch (...)
720 {
721 this->__set_badbit_and_consider_rethrow();
739 else
740 {
741 __state |= ios_base::failbit;
742 }
743 this->setstate(__state);
722744 }
723#endif // _LIBCPP_NO_EXCEPTIONS
724745 return *this;
725746}
726747
......@@ -728,28 +749,34 @@ template<class _CharT, class _Traits>
728749typename basic_istream<_CharT, _Traits>::int_type
729750basic_istream<_CharT, _Traits>::get()
730751{
752 ios_base::iostate __state = ios_base::goodbit;
731753 __gc_ = 0;
732754 int_type __r = traits_type::eof();
733#ifndef _LIBCPP_NO_EXCEPTIONS
734 try
755 sentry __s(*this, true);
756 if (__s)
735757 {
736#endif // _LIBCPP_NO_EXCEPTIONS
737 sentry __s(*this, true);
738 if (__s)
758#ifndef _LIBCPP_NO_EXCEPTIONS
759 try
739760 {
761#endif
740762 __r = this->rdbuf()->sbumpc();
741763 if (traits_type::eq_int_type(__r, traits_type::eof()))
742 this->setstate(ios_base::failbit | ios_base::eofbit);
764 __state |= ios_base::failbit | ios_base::eofbit;
743765 else
744766 __gc_ = 1;
745 }
746767#ifndef _LIBCPP_NO_EXCEPTIONS
768 }
769 catch (...)
770 {
771 this->__setstate_nothrow(this->rdstate() | ios_base::badbit);
772 if (this->exceptions() & ios_base::badbit)
773 {
774 throw;
775 }
776 }
777#endif
778 this->setstate(__state);
747779 }
748 catch (...)
749 {
750 this->__set_badbit_and_consider_rethrow();
751 }
752#endif // _LIBCPP_NO_EXCEPTIONS
753780 return __r;
754781}
755782
......@@ -757,23 +784,23 @@ template<class _CharT, class _Traits>
757784basic_istream<_CharT, _Traits>&
758785basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __dlm)
759786{
787 ios_base::iostate __state = ios_base::goodbit;
760788 __gc_ = 0;
761#ifndef _LIBCPP_NO_EXCEPTIONS
762 try
789 sentry __sen(*this, true);
790 if (__sen)
763791 {
764#endif // _LIBCPP_NO_EXCEPTIONS
765 sentry __sen(*this, true);
766 if (__sen)
792 if (__n > 0)
767793 {
768 if (__n > 0)
794#ifndef _LIBCPP_NO_EXCEPTIONS
795 try
769796 {
770 ios_base::iostate __err = ios_base::goodbit;
797#endif
771798 while (__gc_ < __n-1)
772799 {
773800 int_type __i = this->rdbuf()->sgetc();
774801 if (traits_type::eq_int_type(__i, traits_type::eof()))
775802 {
776 __err |= ios_base::eofbit;
803 __state |= ios_base::eofbit;
777804 break;
778805 }
779806 char_type __ch = traits_type::to_char_type(__i);
......@@ -784,23 +811,33 @@ basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __
784811 this->rdbuf()->sbumpc();
785812 }
786813 if (__gc_ == 0)
787 __err |= ios_base::failbit;
788 this->setstate(__err);
814 __state |= ios_base::failbit;
815#ifndef _LIBCPP_NO_EXCEPTIONS
789816 }
790 else
791 this->setstate(ios_base::failbit);
817 catch (...)
818 {
819 __state |= ios_base::badbit;
820 this->__setstate_nothrow(__state);
821 if (this->exceptions() & ios_base::badbit)
822 {
823 if (__n > 0)
824 *__s = char_type();
825 throw;
826 }
827 }
828#endif
792829 }
830 else
831 {
832 __state |= ios_base::failbit;
833 }
834
793835 if (__n > 0)
794836 *__s = char_type();
795#ifndef _LIBCPP_NO_EXCEPTIONS
796 }
797 catch (...)
798 {
799 if (__n > 0)
800 *__s = char_type();
801 this->__set_badbit_and_consider_rethrow();
837 this->setstate(__state);
802838 }
803#endif // _LIBCPP_NO_EXCEPTIONS
839 if (__n > 0)
840 *__s = char_type();
804841 return *this;
805842}
806843
......@@ -809,52 +846,43 @@ basic_istream<_CharT, _Traits>&
809846basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __sb,
810847 char_type __dlm)
811848{
849 ios_base::iostate __state = ios_base::goodbit;
812850 __gc_ = 0;
813#ifndef _LIBCPP_NO_EXCEPTIONS
814 try
851 sentry __sen(*this, true);
852 if (__sen)
815853 {
816#endif // _LIBCPP_NO_EXCEPTIONS
817 sentry __sen(*this, true);
818 if (__sen)
819 {
820 ios_base::iostate __err = ios_base::goodbit;
821854#ifndef _LIBCPP_NO_EXCEPTIONS
822 try
823 {
855 try
856 {
824857#endif // _LIBCPP_NO_EXCEPTIONS
825 while (true)
858 while (true)
859 {
860 typename traits_type::int_type __i = this->rdbuf()->sgetc();
861 if (traits_type::eq_int_type(__i, traits_type::eof()))
826862 {
827 typename traits_type::int_type __i = this->rdbuf()->sgetc();
828 if (traits_type::eq_int_type(__i, traits_type::eof()))
829 {
830 __err |= ios_base::eofbit;
831 break;
832 }
833 char_type __ch = traits_type::to_char_type(__i);
834 if (traits_type::eq(__ch, __dlm))
835 break;
836 if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
837 break;
838 ++__gc_;
839 this->rdbuf()->sbumpc();
863 __state |= ios_base::eofbit;
864 break;
840865 }
841#ifndef _LIBCPP_NO_EXCEPTIONS
842 }
843 catch (...)
844 {
866 char_type __ch = traits_type::to_char_type(__i);
867 if (traits_type::eq(__ch, __dlm))
868 break;
869 if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
870 break;
871 ++__gc_;
872 this->rdbuf()->sbumpc();
845873 }
846#endif // _LIBCPP_NO_EXCEPTIONS
847 if (__gc_ == 0)
848 __err |= ios_base::failbit;
849 this->setstate(__err);
850 }
851874#ifndef _LIBCPP_NO_EXCEPTIONS
852 }
853 catch (...)
854 {
855 this->__set_badbit_and_consider_rethrow();
856 }
875 }
876 catch (...)
877 {
878 __state |= ios_base::badbit;
879 // according to the spec, exceptions here are caught but not rethrown
880 }
857881#endif // _LIBCPP_NO_EXCEPTIONS
882 if (__gc_ == 0)
883 __state |= ios_base::failbit;
884 this->setstate(__state);
885 }
858886 return *this;
859887}
860888
......@@ -862,21 +890,21 @@ template<class _CharT, class _Traits>
862890basic_istream<_CharT, _Traits>&
863891basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_type __dlm)
864892{
893 ios_base::iostate __state = ios_base::goodbit;
865894 __gc_ = 0;
866#ifndef _LIBCPP_NO_EXCEPTIONS
867 try
895 sentry __sen(*this, true);
896 if (__sen)
868897 {
869#endif // _LIBCPP_NO_EXCEPTIONS
870 sentry __sen(*this, true);
871 if (__sen)
898#ifndef _LIBCPP_NO_EXCEPTIONS
899 try
872900 {
873 ios_base::iostate __err = ios_base::goodbit;
901#endif // _LIBCPP_NO_EXCEPTIONS
874902 while (true)
875903 {
876904 typename traits_type::int_type __i = this->rdbuf()->sgetc();
877905 if (traits_type::eq_int_type(__i, traits_type::eof()))
878906 {
879 __err |= ios_base::eofbit;
907 __state |= ios_base::eofbit;
880908 break;
881909 }
882910 char_type __ch = traits_type::to_char_type(__i);
......@@ -888,28 +916,35 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ
888916 }
889917 if (__gc_ >= __n-1)
890918 {
891 __err |= ios_base::failbit;
919 __state |= ios_base::failbit;
892920 break;
893921 }
894922 *__s++ = __ch;
895923 this->rdbuf()->sbumpc();
896924 ++__gc_;
897925 }
898 if (__gc_ == 0)
899 __err |= ios_base::failbit;
900 this->setstate(__err);
901 }
902 if (__n > 0)
903 *__s = char_type();
904926#ifndef _LIBCPP_NO_EXCEPTIONS
905 }
906 catch (...)
907 {
908 if (__n > 0)
909 *__s = char_type();
910 this->__set_badbit_and_consider_rethrow();
911 }
927 }
928 catch (...)
929 {
930 __state |= ios_base::badbit;
931 this->__setstate_nothrow(__state);
932 if (this->exceptions() & ios_base::badbit)
933 {
934 if (__n > 0)
935 *__s = char_type();
936 if (__gc_ == 0)
937 __state |= ios_base::failbit;
938 throw;
939 }
940 }
912941#endif // _LIBCPP_NO_EXCEPTIONS
942 }
943 if (__n > 0)
944 *__s = char_type();
945 if (__gc_ == 0)
946 __state |= ios_base::failbit;
947 this->setstate(__state);
913948 return *this;
914949}
915950
......@@ -917,15 +952,15 @@ template<class _CharT, class _Traits>
917952basic_istream<_CharT, _Traits>&
918953basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
919954{
955 ios_base::iostate __state = ios_base::goodbit;
920956 __gc_ = 0;
921#ifndef _LIBCPP_NO_EXCEPTIONS
922 try
957 sentry __sen(*this, true);
958 if (__sen)
923959 {
924#endif // _LIBCPP_NO_EXCEPTIONS
925 sentry __sen(*this, true);
926 if (__sen)
960#ifndef _LIBCPP_NO_EXCEPTIONS
961 try
927962 {
928 ios_base::iostate __err = ios_base::goodbit;
963#endif // _LIBCPP_NO_EXCEPTIONS
929964 if (__n == numeric_limits<streamsize>::max())
930965 {
931966 while (true)
......@@ -933,7 +968,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
933968 typename traits_type::int_type __i = this->rdbuf()->sbumpc();
934969 if (traits_type::eq_int_type(__i, traits_type::eof()))
935970 {
936 __err |= ios_base::eofbit;
971 __state |= ios_base::eofbit;
937972 break;
938973 }
939974 ++__gc_;
......@@ -948,7 +983,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
948983 typename traits_type::int_type __i = this->rdbuf()->sbumpc();
949984 if (traits_type::eq_int_type(__i, traits_type::eof()))
950985 {
951 __err |= ios_base::eofbit;
986 __state |= ios_base::eofbit;
952987 break;
953988 }
954989 ++__gc_;
......@@ -956,15 +991,20 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
956991 break;
957992 }
958993 }
959 this->setstate(__err);
960 }
961994#ifndef _LIBCPP_NO_EXCEPTIONS
962 }
963 catch (...)
964 {
965 this->__set_badbit_and_consider_rethrow();
966 }
995 }
996 catch (...)
997 {
998 __state |= ios_base::badbit;
999 this->__setstate_nothrow(__state);
1000 if (this->exceptions() & ios_base::badbit)
1001 {
1002 throw;
1003 }
1004 }
9671005#endif // _LIBCPP_NO_EXCEPTIONS
1006 this->setstate(__state);
1007 }
9681008 return *this;
9691009}
9701010
......@@ -972,26 +1012,33 @@ template<class _CharT, class _Traits>
9721012typename basic_istream<_CharT, _Traits>::int_type
9731013basic_istream<_CharT, _Traits>::peek()
9741014{
1015 ios_base::iostate __state = ios_base::goodbit;
9751016 __gc_ = 0;
9761017 int_type __r = traits_type::eof();
977#ifndef _LIBCPP_NO_EXCEPTIONS
978 try
1018 sentry __sen(*this, true);
1019 if (__sen)
9791020 {
980#endif // _LIBCPP_NO_EXCEPTIONS
981 sentry __sen(*this, true);
982 if (__sen)
1021#ifndef _LIBCPP_NO_EXCEPTIONS
1022 try
9831023 {
1024#endif // _LIBCPP_NO_EXCEPTIONS
9841025 __r = this->rdbuf()->sgetc();
9851026 if (traits_type::eq_int_type(__r, traits_type::eof()))
986 this->setstate(ios_base::eofbit);
987 }
1027 __state |= ios_base::eofbit;
9881028#ifndef _LIBCPP_NO_EXCEPTIONS
989 }
990 catch (...)
991 {
992 this->__set_badbit_and_consider_rethrow();
993 }
1029 }
1030 catch (...)
1031 {
1032 __state |= ios_base::badbit;
1033 this->__setstate_nothrow(__state);
1034 if (this->exceptions() & ios_base::badbit)
1035 {
1036 throw;
1037 }
1038 }
9941039#endif // _LIBCPP_NO_EXCEPTIONS
1040 this->setstate(__state);
1041 }
9951042 return __r;
9961043}
9971044
......@@ -999,27 +1046,36 @@ template<class _CharT, class _Traits>
9991046basic_istream<_CharT, _Traits>&
10001047basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
10011048{
1049 ios_base::iostate __state = ios_base::goodbit;
10021050 __gc_ = 0;
1003#ifndef _LIBCPP_NO_EXCEPTIONS
1004 try
1051 sentry __sen(*this, true);
1052 if (__sen)
10051053 {
1006#endif // _LIBCPP_NO_EXCEPTIONS
1007 sentry __sen(*this, true);
1008 if (__sen)
1054#ifndef _LIBCPP_NO_EXCEPTIONS
1055 try
10091056 {
1057#endif // _LIBCPP_NO_EXCEPTIONS
10101058 __gc_ = this->rdbuf()->sgetn(__s, __n);
10111059 if (__gc_ != __n)
1012 this->setstate(ios_base::failbit | ios_base::eofbit);
1013 }
1014 else
1015 this->setstate(ios_base::failbit);
1060 __state |= ios_base::failbit | ios_base::eofbit;
10161061#ifndef _LIBCPP_NO_EXCEPTIONS
1062 }
1063 catch (...)
1064 {
1065 __state |= ios_base::badbit;
1066 this->__setstate_nothrow(__state);
1067 if (this->exceptions() & ios_base::badbit)
1068 {
1069 throw;
1070 }
1071 }
1072#endif // _LIBCPP_NO_EXCEPTIONS
10171073 }
1018 catch (...)
1074 else
10191075 {
1020 this->__set_badbit_and_consider_rethrow();
1076 __state |= ios_base::failbit;
10211077 }
1022#endif // _LIBCPP_NO_EXCEPTIONS
1078 this->setstate(__state);
10231079 return *this;
10241080}
10251081
......@@ -1027,36 +1083,48 @@ template<class _CharT, class _Traits>
10271083streamsize
10281084basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
10291085{
1086 ios_base::iostate __state = ios_base::goodbit;
10301087 __gc_ = 0;
1031#ifndef _LIBCPP_NO_EXCEPTIONS
1032 try
1088 sentry __sen(*this, true);
1089 if (__sen)
10331090 {
1034#endif // _LIBCPP_NO_EXCEPTIONS
1035 sentry __sen(*this, true);
1036 if (__sen)
1091#ifndef _LIBCPP_NO_EXCEPTIONS
1092 try
10371093 {
1094#endif // _LIBCPP_NO_EXCEPTIONS
10381095 streamsize __c = this->rdbuf()->in_avail();
10391096 switch (__c)
10401097 {
10411098 case -1:
1042 this->setstate(ios_base::eofbit);
1099 __state |= ios_base::eofbit;
10431100 break;
10441101 case 0:
10451102 break;
10461103 default:
1047 read(__s, _VSTD::min(__c, __n));
1104 __n = _VSTD::min(__c, __n);
1105 __gc_ = this->rdbuf()->sgetn(__s, __n);
1106 if (__gc_ != __n)
1107 __state |= ios_base::failbit | ios_base::eofbit;
10481108 break;
10491109 }
1050 }
1051 else
1052 this->setstate(ios_base::failbit);
10531110#ifndef _LIBCPP_NO_EXCEPTIONS
1111 }
1112 catch (...)
1113 {
1114 __state |= ios_base::badbit;
1115 this->__setstate_nothrow(__state);
1116 if (this->exceptions() & ios_base::badbit)
1117 {
1118 throw;
1119 }
1120 }
1121#endif // _LIBCPP_NO_EXCEPTIONS
10541122 }
1055 catch (...)
1123 else
10561124 {
1057 this->__set_badbit_and_consider_rethrow();
1125 __state |= ios_base::failbit;
10581126 }
1059#endif // _LIBCPP_NO_EXCEPTIONS
1127 this->setstate(__state);
10601128 return __gc_;
10611129}
10621130
......@@ -1064,27 +1132,36 @@ template<class _CharT, class _Traits>
10641132basic_istream<_CharT, _Traits>&
10651133basic_istream<_CharT, _Traits>::putback(char_type __c)
10661134{
1135 ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
10671136 __gc_ = 0;
1068#ifndef _LIBCPP_NO_EXCEPTIONS
1069 try
1137 this->clear(__state);
1138 sentry __sen(*this, true);
1139 if (__sen)
10701140 {
1071#endif // _LIBCPP_NO_EXCEPTIONS
1072 this->clear(this->rdstate() & ~ios_base::eofbit);
1073 sentry __sen(*this, true);
1074 if (__sen)
1141#ifndef _LIBCPP_NO_EXCEPTIONS
1142 try
10751143 {
1144#endif // _LIBCPP_NO_EXCEPTIONS
10761145 if (this->rdbuf() == 0 || this->rdbuf()->sputbackc(__c) == traits_type::eof())
1077 this->setstate(ios_base::badbit);
1078 }
1079 else
1080 this->setstate(ios_base::failbit);
1146 __state |= ios_base::badbit;
10811147#ifndef _LIBCPP_NO_EXCEPTIONS
1148 }
1149 catch (...)
1150 {
1151 __state |= ios_base::badbit;
1152 this->__setstate_nothrow(__state);
1153 if (this->exceptions() & ios_base::badbit)
1154 {
1155 throw;
1156 }
1157 }
1158#endif // _LIBCPP_NO_EXCEPTIONS
10821159 }
1083 catch (...)
1160 else
10841161 {
1085 this->__set_badbit_and_consider_rethrow();
1162 __state |= ios_base::failbit;
10861163 }
1087#endif // _LIBCPP_NO_EXCEPTIONS
1164 this->setstate(__state);
10881165 return *this;
10891166}
10901167
......@@ -1092,27 +1169,36 @@ template<class _CharT, class _Traits>
10921169basic_istream<_CharT, _Traits>&
10931170basic_istream<_CharT, _Traits>::unget()
10941171{
1172 ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
10951173 __gc_ = 0;
1096#ifndef _LIBCPP_NO_EXCEPTIONS
1097 try
1174 this->clear(__state);
1175 sentry __sen(*this, true);
1176 if (__sen)
10981177 {
1099#endif // _LIBCPP_NO_EXCEPTIONS
1100 this->clear(this->rdstate() & ~ios_base::eofbit);
1101 sentry __sen(*this, true);
1102 if (__sen)
1178#ifndef _LIBCPP_NO_EXCEPTIONS
1179 try
11031180 {
1181#endif // _LIBCPP_NO_EXCEPTIONS
11041182 if (this->rdbuf() == 0 || this->rdbuf()->sungetc() == traits_type::eof())
1105 this->setstate(ios_base::badbit);
1106 }
1107 else
1108 this->setstate(ios_base::failbit);
1183 __state |= ios_base::badbit;
11091184#ifndef _LIBCPP_NO_EXCEPTIONS
1185 }
1186 catch (...)
1187 {
1188 __state |= ios_base::badbit;
1189 this->__setstate_nothrow(__state);
1190 if (this->exceptions() & ios_base::badbit)
1191 {
1192 throw;
1193 }
1194 }
1195#endif // _LIBCPP_NO_EXCEPTIONS
11101196 }
1111 catch (...)
1197 else
11121198 {
1113 this->__set_badbit_and_consider_rethrow();
1199 __state |= ios_base::failbit;
11141200 }
1115#endif // _LIBCPP_NO_EXCEPTIONS
1201 this->setstate(__state);
11161202 return *this;
11171203}
11181204
......@@ -1120,29 +1206,36 @@ template<class _CharT, class _Traits>
11201206int
11211207basic_istream<_CharT, _Traits>::sync()
11221208{
1209 ios_base::iostate __state = ios_base::goodbit;
11231210 int __r = 0;
1124#ifndef _LIBCPP_NO_EXCEPTIONS
1125 try
1211 sentry __sen(*this, true);
1212 if (__sen)
11261213 {
1127#endif // _LIBCPP_NO_EXCEPTIONS
1128 sentry __sen(*this, true);
1129 if (__sen)
1214#ifndef _LIBCPP_NO_EXCEPTIONS
1215 try
11301216 {
1217#endif // _LIBCPP_NO_EXCEPTIONS
11311218 if (this->rdbuf() == 0)
11321219 return -1;
11331220 if (this->rdbuf()->pubsync() == -1)
11341221 {
1135 this->setstate(ios_base::badbit);
1222 __state |= ios_base::badbit;
11361223 return -1;
11371224 }
1138 }
11391225#ifndef _LIBCPP_NO_EXCEPTIONS
1140 }
1141 catch (...)
1142 {
1143 this->__set_badbit_and_consider_rethrow();
1144 }
1226 }
1227 catch (...)
1228 {
1229 __state |= ios_base::badbit;
1230 this->__setstate_nothrow(__state);
1231 if (this->exceptions() & ios_base::badbit)
1232 {
1233 throw;
1234 }
1235 }
11451236#endif // _LIBCPP_NO_EXCEPTIONS
1237 this->setstate(__state);
1238 }
11461239 return __r;
11471240}
11481241
......@@ -1150,21 +1243,30 @@ template<class _CharT, class _Traits>
11501243typename basic_istream<_CharT, _Traits>::pos_type
11511244basic_istream<_CharT, _Traits>::tellg()
11521245{
1246 ios_base::iostate __state = ios_base::goodbit;
11531247 pos_type __r(-1);
1154#ifndef _LIBCPP_NO_EXCEPTIONS
1155 try
1248 sentry __sen(*this, true);
1249 if (__sen)
11561250 {
1251#ifndef _LIBCPP_NO_EXCEPTIONS
1252 try
1253 {
11571254#endif // _LIBCPP_NO_EXCEPTIONS
1158 sentry __sen(*this, true);
1159 if (__sen)
1160 __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
1255 __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
11611256#ifndef _LIBCPP_NO_EXCEPTIONS
1162 }
1163 catch (...)
1164 {
1165 this->__set_badbit_and_consider_rethrow();
1166 }
1257 }
1258 catch (...)
1259 {
1260 __state |= ios_base::badbit;
1261 this->__setstate_nothrow(__state);
1262 if (this->exceptions() & ios_base::badbit)
1263 {
1264 throw;
1265 }
1266 }
11671267#endif // _LIBCPP_NO_EXCEPTIONS
1268 this->setstate(__state);
1269 }
11681270 return __r;
11691271}
11701272
......@@ -1172,24 +1274,31 @@ template<class _CharT, class _Traits>
11721274basic_istream<_CharT, _Traits>&
11731275basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
11741276{
1175#ifndef _LIBCPP_NO_EXCEPTIONS
1176 try
1277 ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
1278 this->clear(__state);
1279 sentry __sen(*this, true);
1280 if (__sen)
11771281 {
1178#endif // _LIBCPP_NO_EXCEPTIONS
1179 this->clear(this->rdstate() & ~ios_base::eofbit);
1180 sentry __sen(*this, true);
1181 if (__sen)
1282#ifndef _LIBCPP_NO_EXCEPTIONS
1283 try
11821284 {
1285#endif // _LIBCPP_NO_EXCEPTIONS
11831286 if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
1184 this->setstate(ios_base::failbit);
1185 }
1287 __state |= ios_base::failbit;
11861288#ifndef _LIBCPP_NO_EXCEPTIONS
1187 }
1188 catch (...)
1189 {
1190 this->__set_badbit_and_consider_rethrow();
1191 }
1289 }
1290 catch (...)
1291 {
1292 __state |= ios_base::badbit;
1293 this->__setstate_nothrow(__state);
1294 if (this->exceptions() & ios_base::badbit)
1295 {
1296 throw;
1297 }
1298 }
11921299#endif // _LIBCPP_NO_EXCEPTIONS
1300 this->setstate(__state);
1301 }
11931302 return *this;
11941303}
11951304
......@@ -1197,24 +1306,31 @@ template<class _CharT, class _Traits>
11971306basic_istream<_CharT, _Traits>&
11981307basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
11991308{
1200#ifndef _LIBCPP_NO_EXCEPTIONS
1201 try
1309 ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
1310 this->clear(__state);
1311 sentry __sen(*this, true);
1312 if (__sen)
12021313 {
1203#endif // _LIBCPP_NO_EXCEPTIONS
1204 this->clear(this->rdstate() & ~ios_base::eofbit);
1205 sentry __sen(*this, true);
1206 if (__sen)
1314#ifndef _LIBCPP_NO_EXCEPTIONS
1315 try
12071316 {
1317#endif // _LIBCPP_NO_EXCEPTIONS
12081318 if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1))
1209 this->setstate(ios_base::failbit);
1210 }
1319 __state |= ios_base::failbit;
12111320#ifndef _LIBCPP_NO_EXCEPTIONS
1212 }
1213 catch (...)
1214 {
1215 this->__set_badbit_and_consider_rethrow();
1216 }
1321 }
1322 catch (...)
1323 {
1324 __state |= ios_base::badbit;
1325 this->__setstate_nothrow(__state);
1326 if (this->exceptions() & ios_base::badbit)
1327 {
1328 throw;
1329 }
1330 }
12171331#endif // _LIBCPP_NO_EXCEPTIONS
1332 this->setstate(__state);
1333 }
12181334 return *this;
12191335}
12201336
......@@ -1222,34 +1338,41 @@ template <class _CharT, class _Traits>
12221338basic_istream<_CharT, _Traits>&
12231339ws(basic_istream<_CharT, _Traits>& __is)
12241340{
1225#ifndef _LIBCPP_NO_EXCEPTIONS
1226 try
1341 ios_base::iostate __state = ios_base::goodbit;
1342 typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
1343 if (__sen)
12271344 {
1228#endif // _LIBCPP_NO_EXCEPTIONS
1229 typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
1230 if (__sen)
1345#ifndef _LIBCPP_NO_EXCEPTIONS
1346 try
12311347 {
1348#endif // _LIBCPP_NO_EXCEPTIONS
12321349 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
12331350 while (true)
12341351 {
12351352 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
12361353 if (_Traits::eq_int_type(__i, _Traits::eof()))
12371354 {
1238 __is.setstate(ios_base::eofbit);
1355 __state |= ios_base::eofbit;
12391356 break;
12401357 }
12411358 if (!__ct.is(__ct.space, _Traits::to_char_type(__i)))
12421359 break;
12431360 __is.rdbuf()->sbumpc();
12441361 }
1245 }
12461362#ifndef _LIBCPP_NO_EXCEPTIONS
1247 }
1248 catch (...)
1249 {
1250 __is.__set_badbit_and_consider_rethrow();
1251 }
1363 }
1364 catch (...)
1365 {
1366 __state |= ios_base::badbit;
1367 __is.__setstate_nothrow(__state);
1368 if (__is.exceptions() & ios_base::badbit)
1369 {
1370 throw;
1371 }
1372 }
12521373#endif // _LIBCPP_NO_EXCEPTIONS
1374 __is.setstate(__state);
1375 }
12531376 return __is;
12541377}
12551378
......@@ -1298,7 +1421,6 @@ protected:
12981421 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
12991422 void swap(basic_iostream& __rhs)
13001423 { basic_istream<char_type, traits_type>::swap(__rhs); }
1301public:
13021424};
13031425
13041426#ifndef _LIBCPP_CXX03_LANG
......@@ -1329,13 +1451,14 @@ basic_istream<_CharT, _Traits>&
13291451operator>>(basic_istream<_CharT, _Traits>& __is,
13301452 basic_string<_CharT, _Traits, _Allocator>& __str)
13311453{
1332#ifndef _LIBCPP_NO_EXCEPTIONS
1333 try
1454 ios_base::iostate __state = ios_base::goodbit;
1455 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
1456 if (__sen)
13341457 {
1335#endif // _LIBCPP_NO_EXCEPTIONS
1336 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
1337 if (__sen)
1458#ifndef _LIBCPP_NO_EXCEPTIONS
1459 try
13381460 {
1461#endif
13391462 __str.clear();
13401463 streamsize __n = __is.width();
13411464 if (__n <= 0)
......@@ -1344,13 +1467,12 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
13441467 __n = numeric_limits<streamsize>::max();
13451468 streamsize __c = 0;
13461469 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
1347 ios_base::iostate __err = ios_base::goodbit;
13481470 while (__c < __n)
13491471 {
13501472 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
13511473 if (_Traits::eq_int_type(__i, _Traits::eof()))
13521474 {
1353 __err |= ios_base::eofbit;
1475 __state |= ios_base::eofbit;
13541476 break;
13551477 }
13561478 _CharT __ch = _Traits::to_char_type(__i);
......@@ -1362,18 +1484,21 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
13621484 }
13631485 __is.width(0);
13641486 if (__c == 0)
1365 __err |= ios_base::failbit;
1366 __is.setstate(__err);
1367 }
1368 else
1369 __is.setstate(ios_base::failbit);
1487 __state |= ios_base::failbit;
13701488#ifndef _LIBCPP_NO_EXCEPTIONS
1489 }
1490 catch (...)
1491 {
1492 __state |= ios_base::badbit;
1493 __is.__setstate_nothrow(__state);
1494 if (__is.exceptions() & ios_base::badbit)
1495 {
1496 throw;
1497 }
1498 }
1499#endif
1500 __is.setstate(__state);
13711501 }
1372 catch (...)
1373 {
1374 __is.__set_badbit_and_consider_rethrow();
1375 }
1376#endif // _LIBCPP_NO_EXCEPTIONS
13771502 return __is;
13781503}
13791504
......@@ -1382,22 +1507,22 @@ basic_istream<_CharT, _Traits>&
13821507getline(basic_istream<_CharT, _Traits>& __is,
13831508 basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
13841509{
1385#ifndef _LIBCPP_NO_EXCEPTIONS
1386 try
1510 ios_base::iostate __state = ios_base::goodbit;
1511 typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
1512 if (__sen)
13871513 {
1388#endif // _LIBCPP_NO_EXCEPTIONS
1389 typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
1390 if (__sen)
1514#ifndef _LIBCPP_NO_EXCEPTIONS
1515 try
13911516 {
1517#endif
13921518 __str.clear();
1393 ios_base::iostate __err = ios_base::goodbit;
13941519 streamsize __extr = 0;
13951520 while (true)
13961521 {
13971522 typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
13981523 if (_Traits::eq_int_type(__i, _Traits::eof()))
13991524 {
1400 __err |= ios_base::eofbit;
1525 __state |= ios_base::eofbit;
14011526 break;
14021527 }
14031528 ++__extr;
......@@ -1407,21 +1532,26 @@ getline(basic_istream<_CharT, _Traits>& __is,
14071532 __str.push_back(__ch);
14081533 if (__str.size() == __str.max_size())
14091534 {
1410 __err |= ios_base::failbit;
1535 __state |= ios_base::failbit;
14111536 break;
14121537 }
14131538 }
14141539 if (__extr == 0)
1415 __err |= ios_base::failbit;
1416 __is.setstate(__err);
1417 }
1540 __state |= ios_base::failbit;
14181541#ifndef _LIBCPP_NO_EXCEPTIONS
1542 }
1543 catch (...)
1544 {
1545 __state |= ios_base::badbit;
1546 __is.__setstate_nothrow(__state);
1547 if (__is.exceptions() & ios_base::badbit)
1548 {
1549 throw;
1550 }
1551 }
1552#endif
1553 __is.setstate(__state);
14191554 }
1420 catch (...)
1421 {
1422 __is.__set_badbit_and_consider_rethrow();
1423 }
1424#endif // _LIBCPP_NO_EXCEPTIONS
14251555 return __is;
14261556}
14271557
......@@ -1460,17 +1590,17 @@ template <class _CharT, class _Traits, size_t _Size>
14601590basic_istream<_CharT, _Traits>&
14611591operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
14621592{
1463#ifndef _LIBCPP_NO_EXCEPTIONS
1464 try
1593 ios_base::iostate __state = ios_base::goodbit;
1594 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
1595 if (__sen)
14651596 {
1466#endif // _LIBCPP_NO_EXCEPTIONS
1467 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
1468 if (__sen)
1597#ifndef _LIBCPP_NO_EXCEPTIONS
1598 try
14691599 {
1600#endif
14701601 basic_string<_CharT, _Traits> __str;
14711602 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
14721603 size_t __c = 0;
1473 ios_base::iostate __err = ios_base::goodbit;
14741604 _CharT __zero = __ct.widen('0');
14751605 _CharT __one = __ct.widen('1');
14761606 while (__c < _Size)
......@@ -1478,7 +1608,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
14781608 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
14791609 if (_Traits::eq_int_type(__i, _Traits::eof()))
14801610 {
1481 __err |= ios_base::eofbit;
1611 __state |= ios_base::eofbit;
14821612 break;
14831613 }
14841614 _CharT __ch = _Traits::to_char_type(__i);
......@@ -1490,18 +1620,21 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
14901620 }
14911621 __x = bitset<_Size>(__str);
14921622 if (__c == 0)
1493 __err |= ios_base::failbit;
1494 __is.setstate(__err);
1495 }
1496 else
1497 __is.setstate(ios_base::failbit);
1623 __state |= ios_base::failbit;
14981624#ifndef _LIBCPP_NO_EXCEPTIONS
1625 }
1626 catch (...)
1627 {
1628 __state |= ios_base::badbit;
1629 __is.__setstate_nothrow(__state);
1630 if (__is.exceptions() & ios_base::badbit)
1631 {
1632 throw;
1633 }
1634 }
1635#endif
1636 __is.setstate(__state);
14991637 }
1500 catch (...)
1501 {
1502 __is.__set_badbit_and_consider_rethrow();
1503 }
1504#endif // _LIBCPP_NO_EXCEPTIONS
15051638 return __is;
15061639}
15071640
lib/libcxx/include/iterator+141-106
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- iterator ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -70,7 +69,7 @@ typename iterator_traits<InputIterator>::difference_type n = 1);
7069
7170template <class BidirectionalIterator> // constexpr in C++17
7271 constexpr BidirectionalIterator prev(BidirectionalIterator x,
73 typename iterator_traits<BidirectionalIterator>::difference_type n = 1);
72 typename iterator_traits<BidirectionalIterator>::difference_type n = 1);
7473
7574template <class Iterator>
7675class reverse_iterator
......@@ -137,7 +136,7 @@ operator-(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2
137136
138137template <class Iterator>
139138constexpr reverse_iterator<Iterator>
140operator+(typename reverse_iterator<Iterator>::difference_type n,
139operator+(typename reverse_iterator<Iterator>::difference_type n,
141140 const reverse_iterator<Iterator>& x); // constexpr in C++17
142141
143142template <class Iterator>
......@@ -217,7 +216,7 @@ public:
217216 typedef typename iterator_traits<Iterator>::value_type value_type;
218217 typedef typename iterator_traits<Iterator>::iterator_category iterator_category;
219218 typedef value_type&& reference;
220
219
221220 constexpr move_iterator(); // all the constexprs are in C++17
222221 constexpr explicit move_iterator(Iterator i);
223222 template <class U>
......@@ -231,10 +230,10 @@ public:
231230 constexpr move_iterator operator++(int);
232231 constexpr move_iterator& operator--();
233232 constexpr move_iterator operator--(int);
234 constexpr move_iterator operator+(difference_type n) const;
235 constexpr move_iterator& operator+=(difference_type n);
236 constexpr move_iterator operator-(difference_type n) const;
237 constexpr move_iterator& operator-=(difference_type n);
233 constexpr move_iterator operator+(difference_type n) const;
234 constexpr move_iterator& operator+=(difference_type n);
235 constexpr move_iterator operator-(difference_type n) const;
236 constexpr move_iterator& operator-=(difference_type n);
238237 constexpr unspecified operator[](difference_type n) const;
239238private:
240239 Iterator current; // exposition only
......@@ -271,7 +270,7 @@ operator-(const move_iterator<Iterator1>& x,
271270
272271template <class Iterator>
273272constexpr move_iterator<Iterator> operator+( // constexpr in C++17
274 typename move_iterator<Iterator>::difference_type n,
273 typename move_iterator<Iterator>::difference_type n,
275274 const move_iterator<Iterator>& x);
276275
277276template <class Iterator> // constexpr in C++17
......@@ -400,6 +399,11 @@ template <class C> constexpr auto crend(const C& c) -> decltype(std::rend(c));
400399// 24.8, container access:
401400template <class C> constexpr auto size(const C& c) -> decltype(c.size()); // C++17
402401template <class T, size_t N> constexpr size_t size(const T (&array)[N]) noexcept; // C++17
402
403template <class C> constexpr auto ssize(const C& c)
404 -> common_type_t<ptrdiff_t, make_signed_t<decltype(c.size())>>; // C++20
405template <class T, ptrdiff_t> constexpr ptrdiff_t ssize(const T (&array)[N]) noexcept; // C++20
406
403407template <class C> constexpr auto empty(const C& c) -> decltype(c.empty()); // C++17
404408template <class T, size_t N> constexpr bool empty(const T (&array)[N]) noexcept; // C++17
405409template <class E> constexpr bool empty(initializer_list<E> il) noexcept; // C++17
......@@ -530,10 +534,26 @@ struct __is_random_access_iterator : public __has_iterator_category_convertible_
530534
531535template <class _Tp>
532536struct __is_exactly_input_iterator
533 : public integral_constant<bool,
534 __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value &&
537 : public integral_constant<bool,
538 __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value &&
535539 !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value> {};
536540
541#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
542template<class _InputIterator>
543using __iter_value_type = typename iterator_traits<_InputIterator>::value_type;
544
545template<class _InputIterator>
546using __iter_key_type = remove_const_t<typename iterator_traits<_InputIterator>::value_type::first_type>;
547
548template<class _InputIterator>
549using __iter_mapped_type = typename iterator_traits<_InputIterator>::value_type::second_type;
550
551template<class _InputIterator>
552using __iter_to_alloc_type = pair<
553 add_const_t<typename iterator_traits<_InputIterator>::value_type::first_type>,
554 typename iterator_traits<_InputIterator>::value_type::second_type>;
555#endif
556
537557template<class _Category, class _Tp, class _Distance = ptrdiff_t,
538558 class _Pointer = _Tp*, class _Reference = _Tp&>
539559struct _LIBCPP_TEMPLATE_VIS iterator
......@@ -580,6 +600,8 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
580600void advance(_InputIter& __i,
581601 typename iterator_traits<_InputIter>::difference_type __n)
582602{
603 _LIBCPP_ASSERT(__n >= 0 || __is_bidirectional_iterator<_InputIter>::value,
604 "Attempt to advance(it, -n) on a non-bidi iterator");
583605 __advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category());
584606}
585607
......@@ -614,26 +636,31 @@ template <class _InputIter>
614636inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
615637typename enable_if
616638<
617 __is_input_iterator<_InputIter>::value,
639 __is_input_iterator<_InputIter>::value,
618640 _InputIter
619641>::type
620642next(_InputIter __x,
621643 typename iterator_traits<_InputIter>::difference_type __n = 1)
622644{
645 _LIBCPP_ASSERT(__n >= 0 || __is_bidirectional_iterator<_InputIter>::value,
646 "Attempt to next(it, -n) on a non-bidi iterator");
647
623648 _VSTD::advance(__x, __n);
624649 return __x;
625650}
626651
627template <class _BidirectionalIter>
652template <class _InputIter>
628653inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
629654typename enable_if
630655<
631 __is_bidirectional_iterator<_BidirectionalIter>::value,
632 _BidirectionalIter
656 __is_input_iterator<_InputIter>::value,
657 _InputIter
633658>::type
634prev(_BidirectionalIter __x,
635 typename iterator_traits<_BidirectionalIter>::difference_type __n = 1)
659prev(_InputIter __x,
660 typename iterator_traits<_InputIter>::difference_type __n = 1)
636661{
662 _LIBCPP_ASSERT(__n <= 0 || __is_bidirectional_iterator<_InputIter>::value,
663 "Attempt to prev(it, +n) on a non-bidi iterator");
637664 _VSTD::advance(__x, -__n);
638665 return __x;
639666}
......@@ -1079,10 +1106,6 @@ public:
10791106 _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;}
10801107 _LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;}
10811108
1082#if !defined(__APPLE__) || \
1083 (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \
1084 (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0)
1085
10861109 template <class _Ch, class _Tr>
10871110 friend
10881111 _LIBCPP_HIDDEN
......@@ -1090,7 +1113,6 @@ public:
10901113 __pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s,
10911114 const _Ch* __ob, const _Ch* __op, const _Ch* __oe,
10921115 ios_base& __iob, _Ch __fl);
1093#endif
10941116};
10951117
10961118template <class _Iter>
......@@ -1123,7 +1145,7 @@ public:
11231145 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
11241146 move_iterator(const move_iterator<_Up>& __u) : __i(__u.base()) {}
11251147 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 _Iter base() const {return __i;}
1126 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1148 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
11271149 reference operator*() const { return static_cast<reference>(*__i); }
11281150 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
11291151 pointer operator->() const { return __i;}
......@@ -1237,50 +1259,50 @@ template <class _Iter> class __wrap_iter;
12371259template <class _Iter1, class _Iter2>
12381260_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
12391261bool
1240operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
1262operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
12411263
12421264template <class _Iter1, class _Iter2>
12431265_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
12441266bool
1245operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
1267operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
12461268
12471269template <class _Iter1, class _Iter2>
12481270_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
12491271bool
1250operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
1272operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
12511273
12521274template <class _Iter1, class _Iter2>
12531275_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
12541276bool
1255operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
1277operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
12561278
12571279template <class _Iter1, class _Iter2>
12581280_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
12591281bool
1260operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
1282operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
12611283
12621284template <class _Iter1, class _Iter2>
12631285_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
12641286bool
1265operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
1287operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
12661288
12671289#ifndef _LIBCPP_CXX03_LANG
12681290template <class _Iter1, class _Iter2>
12691291_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
12701292auto
1271operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
1293operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
12721294-> decltype(__x.base() - __y.base());
12731295#else
12741296template <class _Iter1, class _Iter2>
12751297_LIBCPP_INLINE_VISIBILITY
12761298typename __wrap_iter<_Iter1>::difference_type
1277operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
1299operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
12781300#endif
12791301
12801302template <class _Iter>
12811303_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
12821304__wrap_iter<_Iter>
1283operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT_DEBUG;
1305operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT;
12841306
12851307template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op);
12861308template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2);
......@@ -1324,7 +1346,7 @@ public:
13241346private:
13251347 iterator_type __i;
13261348public:
1327 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter() _NOEXCEPT_DEBUG
1349 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter() _NOEXCEPT
13281350#if _LIBCPP_STD_VER > 11
13291351 : __i{}
13301352#endif
......@@ -1335,7 +1357,7 @@ public:
13351357 }
13361358 template <class _Up> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
13371359 __wrap_iter(const __wrap_iter<_Up>& __u,
1338 typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT_DEBUG
1360 typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT
13391361 : __i(__u.base())
13401362 {
13411363#if _LIBCPP_DEBUG_LEVEL >= 2
......@@ -1365,7 +1387,7 @@ public:
13651387 __get_db()->__erase_i(this);
13661388 }
13671389#endif
1368 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator*() const _NOEXCEPT_DEBUG
1390 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator*() const _NOEXCEPT
13691391 {
13701392#if _LIBCPP_DEBUG_LEVEL >= 2
13711393 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
......@@ -1373,7 +1395,7 @@ public:
13731395#endif
13741396 return *__i;
13751397 }
1376 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG pointer operator->() const _NOEXCEPT_DEBUG
1398 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG pointer operator->() const _NOEXCEPT
13771399 {
13781400#if _LIBCPP_DEBUG_LEVEL >= 2
13791401 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
......@@ -1381,7 +1403,7 @@ public:
13811403#endif
13821404 return (pointer)_VSTD::addressof(*__i);
13831405 }
1384 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator++() _NOEXCEPT_DEBUG
1406 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator++() _NOEXCEPT
13851407 {
13861408#if _LIBCPP_DEBUG_LEVEL >= 2
13871409 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
......@@ -1390,10 +1412,10 @@ public:
13901412 ++__i;
13911413 return *this;
13921414 }
1393 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator++(int) _NOEXCEPT_DEBUG
1415 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator++(int) _NOEXCEPT
13941416 {__wrap_iter __tmp(*this); ++(*this); return __tmp;}
13951417
1396 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator--() _NOEXCEPT_DEBUG
1418 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator--() _NOEXCEPT
13971419 {
13981420#if _LIBCPP_DEBUG_LEVEL >= 2
13991421 _LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
......@@ -1402,11 +1424,11 @@ public:
14021424 --__i;
14031425 return *this;
14041426 }
1405 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator--(int) _NOEXCEPT_DEBUG
1427 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator--(int) _NOEXCEPT
14061428 {__wrap_iter __tmp(*this); --(*this); return __tmp;}
1407 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator+ (difference_type __n) const _NOEXCEPT_DEBUG
1429 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator+ (difference_type __n) const _NOEXCEPT
14081430 {__wrap_iter __w(*this); __w += __n; return __w;}
1409 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator+=(difference_type __n) _NOEXCEPT_DEBUG
1431 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator+=(difference_type __n) _NOEXCEPT
14101432 {
14111433#if _LIBCPP_DEBUG_LEVEL >= 2
14121434 _LIBCPP_ASSERT(__get_const_db()->__addable(this, __n),
......@@ -1415,11 +1437,11 @@ public:
14151437 __i += __n;
14161438 return *this;
14171439 }
1418 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator- (difference_type __n) const _NOEXCEPT_DEBUG
1440 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator- (difference_type __n) const _NOEXCEPT
14191441 {return *this + (-__n);}
1420 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator-=(difference_type __n) _NOEXCEPT_DEBUG
1442 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator-=(difference_type __n) _NOEXCEPT
14211443 {*this += -__n; return *this;}
1422 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator[](difference_type __n) const _NOEXCEPT_DEBUG
1444 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator[](difference_type __n) const _NOEXCEPT
14231445 {
14241446#if _LIBCPP_DEBUG_LEVEL >= 2
14251447 _LIBCPP_ASSERT(__get_const_db()->__subscriptable(this, __n),
......@@ -1428,7 +1450,7 @@ public:
14281450 return __i[__n];
14291451 }
14301452
1431 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG iterator_type base() const _NOEXCEPT_DEBUG {return __i;}
1453 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG iterator_type base() const _NOEXCEPT {return __i;}
14321454
14331455private:
14341456#if _LIBCPP_DEBUG_LEVEL >= 2
......@@ -1437,61 +1459,61 @@ private:
14371459 __get_db()->__insert_ic(this, __p);
14381460 }
14391461#else
1440 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter(iterator_type __x) _NOEXCEPT_DEBUG : __i(__x) {}
1462 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
14411463#endif
14421464
14431465 template <class _Up> friend class __wrap_iter;
14441466 template <class _CharT, class _Traits, class _Alloc> friend class basic_string;
14451467 template <class _Tp, class _Alloc> friend class _LIBCPP_TEMPLATE_VIS vector;
1446 template <class _Tp, ptrdiff_t> friend class _LIBCPP_TEMPLATE_VIS span;
1468 template <class _Tp, size_t> friend class _LIBCPP_TEMPLATE_VIS span;
14471469
14481470 template <class _Iter1, class _Iter2>
14491471 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
14501472 bool
1451 operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
1473 operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
14521474
14531475 template <class _Iter1, class _Iter2>
14541476 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
14551477 bool
1456 operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
1478 operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
14571479
14581480 template <class _Iter1, class _Iter2>
14591481 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
14601482 bool
1461 operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
1483 operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
14621484
14631485 template <class _Iter1, class _Iter2>
14641486 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
14651487 bool
1466 operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
1488 operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
14671489
14681490 template <class _Iter1, class _Iter2>
14691491 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
14701492 bool
1471 operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
1493 operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
14721494
14731495 template <class _Iter1, class _Iter2>
14741496 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
14751497 bool
1476 operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
1498 operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
14771499
14781500#ifndef _LIBCPP_CXX03_LANG
14791501 template <class _Iter1, class _Iter2>
14801502 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
14811503 auto
1482 operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
1504 operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
14831505 -> decltype(__x.base() - __y.base());
14841506#else
14851507 template <class _Iter1, class _Iter2>
14861508 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
14871509 typename __wrap_iter<_Iter1>::difference_type
1488 operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
1510 operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
14891511#endif
14901512
14911513 template <class _Iter1>
14921514 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
14931515 __wrap_iter<_Iter1>
1494 operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT_DEBUG;
1516 operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT;
14951517
14961518 template <class _Ip, class _Op> friend _Op copy(_Ip, _Ip, _Op);
14971519 template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2);
......@@ -1522,7 +1544,7 @@ private:
15221544template <class _Iter1, class _Iter2>
15231545inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
15241546bool
1525operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
1547operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
15261548{
15271549 return __x.base() == __y.base();
15281550}
......@@ -1530,7 +1552,7 @@ operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
15301552template <class _Iter1, class _Iter2>
15311553inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
15321554bool
1533operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
1555operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
15341556{
15351557#if _LIBCPP_DEBUG_LEVEL >= 2
15361558 _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),
......@@ -1542,7 +1564,7 @@ operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC
15421564template <class _Iter1, class _Iter2>
15431565inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
15441566bool
1545operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
1567operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
15461568{
15471569 return !(__x == __y);
15481570}
......@@ -1550,7 +1572,7 @@ operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
15501572template <class _Iter1, class _Iter2>
15511573inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
15521574bool
1553operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
1575operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
15541576{
15551577 return __y < __x;
15561578}
......@@ -1558,7 +1580,7 @@ operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC
15581580template <class _Iter1, class _Iter2>
15591581inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
15601582bool
1561operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
1583operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
15621584{
15631585 return !(__x < __y);
15641586}
......@@ -1566,7 +1588,7 @@ operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
15661588template <class _Iter1, class _Iter2>
15671589inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
15681590bool
1569operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
1591operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
15701592{
15711593 return !(__y < __x);
15721594}
......@@ -1574,7 +1596,7 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
15741596template <class _Iter1>
15751597inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
15761598bool
1577operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG
1599operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
15781600{
15791601 return !(__x == __y);
15801602}
......@@ -1582,7 +1604,7 @@ operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEX
15821604template <class _Iter1>
15831605inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
15841606bool
1585operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG
1607operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
15861608{
15871609 return __y < __x;
15881610}
......@@ -1590,7 +1612,7 @@ operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXC
15901612template <class _Iter1>
15911613inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
15921614bool
1593operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG
1615operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
15941616{
15951617 return !(__x < __y);
15961618}
......@@ -1598,7 +1620,7 @@ operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEX
15981620template <class _Iter1>
15991621inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
16001622bool
1601operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG
1623operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
16021624{
16031625 return !(__y < __x);
16041626}
......@@ -1607,7 +1629,7 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEX
16071629template <class _Iter1, class _Iter2>
16081630inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
16091631auto
1610operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
1632operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
16111633-> decltype(__x.base() - __y.base())
16121634{
16131635#if _LIBCPP_DEBUG_LEVEL >= 2
......@@ -1620,7 +1642,7 @@ operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC
16201642template <class _Iter1, class _Iter2>
16211643inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
16221644typename __wrap_iter<_Iter1>::difference_type
1623operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
1645operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
16241646{
16251647#if _LIBCPP_DEBUG_LEVEL >= 2
16261648 _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),
......@@ -1634,7 +1656,7 @@ template <class _Iter>
16341656inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
16351657__wrap_iter<_Iter>
16361658operator+(typename __wrap_iter<_Iter>::difference_type __n,
1637 __wrap_iter<_Iter> __x) _NOEXCEPT_DEBUG
1659 __wrap_iter<_Iter> __x) _NOEXCEPT
16381660{
16391661 __x += __n;
16401662 return __x;
......@@ -1643,7 +1665,7 @@ operator+(typename __wrap_iter<_Iter>::difference_type __n,
16431665template <class _Iter>
16441666struct __libcpp_is_trivial_iterator
16451667 : public _LIBCPP_BOOL_CONSTANT(is_pointer<_Iter>::value) {};
1646
1668
16471669template <class _Iter>
16481670struct __libcpp_is_trivial_iterator<move_iterator<_Iter> >
16491671 : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {};
......@@ -1658,7 +1680,7 @@ struct __libcpp_is_trivial_iterator<__wrap_iter<_Iter> >
16581680
16591681
16601682template <class _Tp, size_t _Np>
1661inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
1683_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
16621684_Tp*
16631685begin(_Tp (&__array)[_Np])
16641686{
......@@ -1666,7 +1688,7 @@ begin(_Tp (&__array)[_Np])
16661688}
16671689
16681690template <class _Tp, size_t _Np>
1669inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
1691_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
16701692_Tp*
16711693end(_Tp (&__array)[_Np])
16721694{
......@@ -1676,7 +1698,7 @@ end(_Tp (&__array)[_Np])
16761698#if !defined(_LIBCPP_CXX03_LANG)
16771699
16781700template <class _Cp>
1679inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1701_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
16801702auto
16811703begin(_Cp& __c) -> decltype(__c.begin())
16821704{
......@@ -1684,7 +1706,7 @@ begin(_Cp& __c) -> decltype(__c.begin())
16841706}
16851707
16861708template <class _Cp>
1687inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1709_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
16881710auto
16891711begin(const _Cp& __c) -> decltype(__c.begin())
16901712{
......@@ -1692,7 +1714,7 @@ begin(const _Cp& __c) -> decltype(__c.begin())
16921714}
16931715
16941716template <class _Cp>
1695inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1717_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
16961718auto
16971719end(_Cp& __c) -> decltype(__c.end())
16981720{
......@@ -1700,7 +1722,7 @@ end(_Cp& __c) -> decltype(__c.end())
17001722}
17011723
17021724template <class _Cp>
1703inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1725_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
17041726auto
17051727end(const _Cp& __c) -> decltype(__c.end())
17061728{
......@@ -1710,84 +1732,84 @@ end(const _Cp& __c) -> decltype(__c.end())
17101732#if _LIBCPP_STD_VER > 11
17111733
17121734template <class _Tp, size_t _Np>
1713inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1735_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
17141736reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np])
17151737{
17161738 return reverse_iterator<_Tp*>(__array + _Np);
17171739}
17181740
17191741template <class _Tp, size_t _Np>
1720inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1742_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
17211743reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np])
17221744{
17231745 return reverse_iterator<_Tp*>(__array);
17241746}
17251747
17261748template <class _Ep>
1727inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1749_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
17281750reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il)
17291751{
17301752 return reverse_iterator<const _Ep*>(__il.end());
17311753}
17321754
17331755template <class _Ep>
1734inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1756_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
17351757reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il)
17361758{
17371759 return reverse_iterator<const _Ep*>(__il.begin());
17381760}
17391761
17401762template <class _Cp>
1741inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
1763_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
17421764auto cbegin(const _Cp& __c) -> decltype(_VSTD::begin(__c))
17431765{
17441766 return _VSTD::begin(__c);
17451767}
17461768
17471769template <class _Cp>
1748inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
1770_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
17491771auto cend(const _Cp& __c) -> decltype(_VSTD::end(__c))
17501772{
17511773 return _VSTD::end(__c);
17521774}
17531775
17541776template <class _Cp>
1755inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1777_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
17561778auto rbegin(_Cp& __c) -> decltype(__c.rbegin())
17571779{
17581780 return __c.rbegin();
17591781}
17601782
17611783template <class _Cp>
1762inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1784_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
17631785auto rbegin(const _Cp& __c) -> decltype(__c.rbegin())
17641786{
17651787 return __c.rbegin();
17661788}
17671789
17681790template <class _Cp>
1769inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1791_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
17701792auto rend(_Cp& __c) -> decltype(__c.rend())
17711793{
17721794 return __c.rend();
17731795}
17741796
17751797template <class _Cp>
1776inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1798_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
17771799auto rend(const _Cp& __c) -> decltype(__c.rend())
17781800{
17791801 return __c.rend();
17801802}
17811803
17821804template <class _Cp>
1783inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1805_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
17841806auto crbegin(const _Cp& __c) -> decltype(_VSTD::rbegin(__c))
17851807{
17861808 return _VSTD::rbegin(__c);
17871809}
17881810
17891811template <class _Cp>
1790inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1812_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
17911813auto crend(const _Cp& __c) -> decltype(_VSTD::rend(__c))
17921814{
17931815 return _VSTD::rend(__c);
......@@ -1799,7 +1821,7 @@ auto crend(const _Cp& __c) -> decltype(_VSTD::rend(__c))
17991821#else // defined(_LIBCPP_CXX03_LANG)
18001822
18011823template <class _Cp>
1802inline _LIBCPP_INLINE_VISIBILITY
1824_LIBCPP_INLINE_VISIBILITY
18031825typename _Cp::iterator
18041826begin(_Cp& __c)
18051827{
......@@ -1807,7 +1829,7 @@ begin(_Cp& __c)
18071829}
18081830
18091831template <class _Cp>
1810inline _LIBCPP_INLINE_VISIBILITY
1832_LIBCPP_INLINE_VISIBILITY
18111833typename _Cp::const_iterator
18121834begin(const _Cp& __c)
18131835{
......@@ -1815,7 +1837,7 @@ begin(const _Cp& __c)
18151837}
18161838
18171839template <class _Cp>
1818inline _LIBCPP_INLINE_VISIBILITY
1840_LIBCPP_INLINE_VISIBILITY
18191841typename _Cp::iterator
18201842end(_Cp& __c)
18211843{
......@@ -1823,7 +1845,7 @@ end(_Cp& __c)
18231845}
18241846
18251847template <class _Cp>
1826inline _LIBCPP_INLINE_VISIBILITY
1848_LIBCPP_INLINE_VISIBILITY
18271849typename _Cp::const_iterator
18281850end(const _Cp& __c)
18291851{
......@@ -1849,51 +1871,64 @@ end(const _Cp& __c)
18491871// #endif
18501872
18511873template <class _Cont>
1852inline _LIBCPP_INLINE_VISIBILITY
1874_LIBCPP_INLINE_VISIBILITY
18531875constexpr auto size(const _Cont& __c)
18541876_NOEXCEPT_(noexcept(__c.size()))
18551877-> decltype (__c.size())
18561878{ return __c.size(); }
18571879
18581880template <class _Tp, size_t _Sz>
1859inline _LIBCPP_INLINE_VISIBILITY
1881_LIBCPP_INLINE_VISIBILITY
18601882constexpr size_t size(const _Tp (&)[_Sz]) noexcept { return _Sz; }
18611883
1884#if _LIBCPP_STD_VER > 17
18621885template <class _Cont>
1863_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY
1886_LIBCPP_INLINE_VISIBILITY
1887constexpr auto ssize(const _Cont& __c)
1888_NOEXCEPT_(noexcept(static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size())))
1889-> common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>
1890{ return static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size()); }
1891
1892template <class _Tp, ptrdiff_t _Sz>
1893_LIBCPP_INLINE_VISIBILITY
1894constexpr ptrdiff_t ssize(const _Tp (&)[_Sz]) noexcept { return _Sz; }
1895#endif
1896
1897template <class _Cont>
1898_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
18641899constexpr auto empty(const _Cont& __c)
18651900_NOEXCEPT_(noexcept(__c.empty()))
18661901-> decltype (__c.empty())
18671902{ return __c.empty(); }
18681903
18691904template <class _Tp, size_t _Sz>
1870_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY
1905_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
18711906constexpr bool empty(const _Tp (&)[_Sz]) noexcept { return false; }
18721907
18731908template <class _Ep>
1874_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY
1909_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
18751910constexpr bool empty(initializer_list<_Ep> __il) noexcept { return __il.size() == 0; }
18761911
18771912template <class _Cont> constexpr
1878inline _LIBCPP_INLINE_VISIBILITY
1913_LIBCPP_INLINE_VISIBILITY
18791914auto data(_Cont& __c)
18801915_NOEXCEPT_(noexcept(__c.data()))
18811916-> decltype (__c.data())
18821917{ return __c.data(); }
18831918
18841919template <class _Cont> constexpr
1885inline _LIBCPP_INLINE_VISIBILITY
1920_LIBCPP_INLINE_VISIBILITY
18861921auto data(const _Cont& __c)
18871922_NOEXCEPT_(noexcept(__c.data()))
1888-> decltype (__c.data())
1923-> decltype (__c.data())
18891924{ return __c.data(); }
18901925
18911926template <class _Tp, size_t _Sz>
1892inline _LIBCPP_INLINE_VISIBILITY
1927_LIBCPP_INLINE_VISIBILITY
18931928constexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept { return __array; }
18941929
18951930template <class _Ep>
1896inline _LIBCPP_INLINE_VISIBILITY
1931_LIBCPP_INLINE_VISIBILITY
18971932constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept { return __il.begin(); }
18981933#endif
18991934
lib/libcxx/include/limits+4-5
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- limits ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -410,7 +409,7 @@ protected:
410409 static _LIBCPP_CONSTEXPR const bool is_exact = false;
411410 static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
412411 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;}
413 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5;}
412 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5L;}
414413
415414 static _LIBCPP_CONSTEXPR const int min_exponent = __LDBL_MIN_EXP__;
416415 static _LIBCPP_CONSTEXPR const int min_exponent10 = __LDBL_MIN_10_EXP__;
lib/libcxx/include/limits.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- limits.h ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/list+86-72
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- list ------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -130,11 +129,12 @@ public:
130129 void splice(const_iterator position, list&& x, const_iterator first,
131130 const_iterator last);
132131
133 void remove(const value_type& value);
134 template <class Pred> void remove_if(Pred pred);
135 void unique();
132 size_type remove(const value_type& value); // void before C++20
133 template <class Pred>
134 size_type remove_if(Pred pred); // void before C++20
135 size_type unique(); // void before C++20
136136 template <class BinaryPredicate>
137 void unique(BinaryPredicate binary_pred);
137 size_type unique(BinaryPredicate binary_pred); // void before C++20
138138 void merge(list& x);
139139 void merge(list&& x);
140140 template <class Compare>
......@@ -648,9 +648,9 @@ protected:
648648
649649 void swap(__list_imp& __c)
650650#if _LIBCPP_STD_VER >= 14
651 _NOEXCEPT_DEBUG;
651 _NOEXCEPT;
652652#else
653 _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||
653 _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
654654 __is_nothrow_swappable<allocator_type>::value);
655655#endif
656656
......@@ -770,9 +770,9 @@ template <class _Tp, class _Alloc>
770770void
771771__list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
772772#if _LIBCPP_STD_VER >= 14
773 _NOEXCEPT_DEBUG
773 _NOEXCEPT
774774#else
775 _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||
775 _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
776776 __is_nothrow_swappable<allocator_type>::value)
777777#endif
778778{
......@@ -858,6 +858,11 @@ public:
858858 typedef typename base::const_iterator const_iterator;
859859 typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
860860 typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
861#if _LIBCPP_STD_VER > 17
862 typedef size_type __remove_return_type;
863#else
864 typedef void __remove_return_type;
865#endif
861866
862867 _LIBCPP_INLINE_VISIBILITY
863868 list()
......@@ -1039,9 +1044,9 @@ public:
10391044 _LIBCPP_INLINE_VISIBILITY
10401045 void swap(list& __c)
10411046#if _LIBCPP_STD_VER >= 14
1042 _NOEXCEPT_DEBUG
1047 _NOEXCEPT
10431048#else
1044 _NOEXCEPT_DEBUG_(!__node_alloc_traits::propagate_on_container_swap::value ||
1049 _NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value ||
10451050 __is_nothrow_swappable<__node_allocator>::value)
10461051#endif
10471052 {base::swap(__c);}
......@@ -1071,12 +1076,12 @@ public:
10711076 void splice(const_iterator __p, list& __c, const_iterator __i);
10721077 void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l);
10731078
1074 void remove(const value_type& __x);
1075 template <class _Pred> void remove_if(_Pred __pred);
1079 __remove_return_type remove(const value_type& __x);
1080 template <class _Pred> __remove_return_type remove_if(_Pred __pred);
10761081 _LIBCPP_INLINE_VISIBILITY
1077 void unique();
1082 __remove_return_type unique() { return unique(__equal_to<value_type>()); }
10781083 template <class _BinaryPred>
1079 void unique(_BinaryPred __binary_pred);
1084 __remove_return_type unique(_BinaryPred __binary_pred);
10801085 _LIBCPP_INLINE_VISIBILITY
10811086 void merge(list& __c);
10821087#ifndef _LIBCPP_CXX03_LANG
......@@ -2014,22 +2019,24 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
20142019 base::__sz() += __c.__sz();
20152020 __c.__sz() = 0;
20162021#if _LIBCPP_DEBUG_LEVEL >= 2
2017 __libcpp_db* __db = __get_db();
2018 __c_node* __cn1 = __db->__find_c_and_lock(this);
2019 __c_node* __cn2 = __db->__find_c(&__c);
2020 for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
2021 {
2022 --__ip;
2023 iterator* __i = static_cast<iterator*>((*__ip)->__i_);
2024 if (__i->__ptr_ != __c.__end_as_link())
2022 if (&__c != this) {
2023 __libcpp_db* __db = __get_db();
2024 __c_node* __cn1 = __db->__find_c_and_lock(this);
2025 __c_node* __cn2 = __db->__find_c(&__c);
2026 for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
20252027 {
2026 __cn1->__add(*__ip);
2027 (*__ip)->__c_ = __cn1;
2028 if (--__cn2->end_ != __ip)
2029 memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
2028 --__ip;
2029 iterator* __i = static_cast<iterator*>((*__ip)->__i_);
2030 if (__i->__ptr_ != __c.__end_as_link())
2031 {
2032 __cn1->__add(*__ip);
2033 (*__ip)->__c_ = __cn1;
2034 if (--__cn2->end_ != __ip)
2035 memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
2036 }
20302037 }
2038 __db->unlock();
20312039 }
2032 __db->unlock();
20332040#endif
20342041 }
20352042}
......@@ -2057,22 +2064,24 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
20572064 --__c.__sz();
20582065 ++base::__sz();
20592066#if _LIBCPP_DEBUG_LEVEL >= 2
2060 __libcpp_db* __db = __get_db();
2061 __c_node* __cn1 = __db->__find_c_and_lock(this);
2062 __c_node* __cn2 = __db->__find_c(&__c);
2063 for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
2064 {
2065 --__ip;
2066 iterator* __j = static_cast<iterator*>((*__ip)->__i_);
2067 if (__j->__ptr_ == __f)
2067 if (&__c != this) {
2068 __libcpp_db* __db = __get_db();
2069 __c_node* __cn1 = __db->__find_c_and_lock(this);
2070 __c_node* __cn2 = __db->__find_c(&__c);
2071 for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
20682072 {
2069 __cn1->__add(*__ip);
2070 (*__ip)->__c_ = __cn1;
2071 if (--__cn2->end_ != __ip)
2072 memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
2073 --__ip;
2074 iterator* __j = static_cast<iterator*>((*__ip)->__i_);
2075 if (__j->__ptr_ == __f)
2076 {
2077 __cn1->__add(*__ip);
2078 (*__ip)->__c_ = __cn1;
2079 if (--__cn2->end_ != __ip)
2080 memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
2081 }
20732082 }
2083 __db->unlock();
20742084 }
2075 __db->unlock();
20762085#endif
20772086 }
20782087}
......@@ -2111,32 +2120,34 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con
21112120 base::__unlink_nodes(__first, __last);
21122121 __link_nodes(__p.__ptr_, __first, __last);
21132122#if _LIBCPP_DEBUG_LEVEL >= 2
2114 __libcpp_db* __db = __get_db();
2115 __c_node* __cn1 = __db->__find_c_and_lock(this);
2116 __c_node* __cn2 = __db->__find_c(&__c);
2117 for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
2118 {
2119 --__ip;
2120 iterator* __j = static_cast<iterator*>((*__ip)->__i_);
2121 for (__link_pointer __k = __f.__ptr_;
2122 __k != __l.__ptr_; __k = __k->__next_)
2123 if (&__c != this) {
2124 __libcpp_db* __db = __get_db();
2125 __c_node* __cn1 = __db->__find_c_and_lock(this);
2126 __c_node* __cn2 = __db->__find_c(&__c);
2127 for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
21232128 {
2124 if (__j->__ptr_ == __k)
2129 --__ip;
2130 iterator* __j = static_cast<iterator*>((*__ip)->__i_);
2131 for (__link_pointer __k = __f.__ptr_;
2132 __k != __l.__ptr_; __k = __k->__next_)
21252133 {
2126 __cn1->__add(*__ip);
2127 (*__ip)->__c_ = __cn1;
2128 if (--__cn2->end_ != __ip)
2129 memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
2134 if (__j->__ptr_ == __k)
2135 {
2136 __cn1->__add(*__ip);
2137 (*__ip)->__c_ = __cn1;
2138 if (--__cn2->end_ != __ip)
2139 memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
2140 }
21302141 }
21312142 }
2143 __db->unlock();
21322144 }
2133 __db->unlock();
21342145#endif
21352146 }
21362147}
21372148
21382149template <class _Tp, class _Alloc>
2139void
2150typename list<_Tp, _Alloc>::__remove_return_type
21402151list<_Tp, _Alloc>::remove(const value_type& __x)
21412152{
21422153 list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
......@@ -2155,13 +2166,16 @@ list<_Tp, _Alloc>::remove(const value_type& __x)
21552166 else
21562167 ++__i;
21572168 }
2169
2170 return (__remove_return_type) __deleted_nodes.size();
21582171}
21592172
21602173template <class _Tp, class _Alloc>
21612174template <class _Pred>
2162void
2175typename list<_Tp, _Alloc>::__remove_return_type
21632176list<_Tp, _Alloc>::remove_if(_Pred __pred)
21642177{
2178 list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
21652179 for (iterator __i = begin(), __e = end(); __i != __e;)
21662180 {
21672181 if (__pred(*__i))
......@@ -2169,36 +2183,36 @@ list<_Tp, _Alloc>::remove_if(_Pred __pred)
21692183 iterator __j = _VSTD::next(__i);
21702184 for (; __j != __e && __pred(*__j); ++__j)
21712185 ;
2172 __i = erase(__i, __j);
2186 __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
2187 __i = __j;
21732188 if (__i != __e)
21742189 ++__i;
21752190 }
21762191 else
21772192 ++__i;
21782193 }
2179}
21802194
2181template <class _Tp, class _Alloc>
2182inline
2183void
2184list<_Tp, _Alloc>::unique()
2185{
2186 unique(__equal_to<value_type>());
2195 return (__remove_return_type) __deleted_nodes.size();
21872196}
21882197
21892198template <class _Tp, class _Alloc>
21902199template <class _BinaryPred>
2191void
2200typename list<_Tp, _Alloc>::__remove_return_type
21922201list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)
21932202{
2203 list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
21942204 for (iterator __i = begin(), __e = end(); __i != __e;)
21952205 {
21962206 iterator __j = _VSTD::next(__i);
21972207 for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
21982208 ;
2199 if (++__i != __j)
2200 __i = erase(__i, __j);
2209 if (++__i != __j) {
2210 __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
2211 __i = __j;
2212 }
22012213 }
2214
2215 return (__remove_return_type) __deleted_nodes.size();
22022216}
22032217
22042218template <class _Tp, class _Alloc>
lib/libcxx/include/locale+7-14
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- locale ------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -127,7 +126,7 @@ public:
127126 wbuffer_convert(const wbuffer_convert&) = delete; // C++14
128127 wbuffer_convert & operator=(const wbuffer_convert &) = delete; // C++14
129128 ~wbuffer_convert(); // C++14
130
129
131130 streambuf* rdbuf() const;
132131 streambuf* rdbuf(streambuf* bytebuf);
133132
......@@ -547,7 +546,7 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex
547546 __exp = 'P';
548547 else if ((__x & 0x5F) == __exp)
549548 {
550 __exp |= 0x80;
549 __exp |= (char) 0x80;
551550 if (__in_units)
552551 {
553552 __in_units = false;
......@@ -1373,10 +1372,6 @@ __pad_and_output(_OutputIterator __s,
13731372 return __s;
13741373}
13751374
1376#if !defined(__APPLE__) || \
1377 (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \
1378 (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0)
1379
13801375template <class _CharT, class _Traits>
13811376_LIBCPP_HIDDEN
13821377ostreambuf_iterator<_CharT, _Traits>
......@@ -1423,8 +1418,6 @@ __pad_and_output(ostreambuf_iterator<_CharT, _Traits> __s,
14231418 return __s;
14241419}
14251420
1426#endif
1427
14281421template <class _CharT, class _OutputIterator>
14291422_OutputIterator
14301423num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
......@@ -3930,7 +3923,7 @@ private:
39303923 wbuffer_convert(const wbuffer_convert&);
39313924 wbuffer_convert& operator=(const wbuffer_convert&);
39323925public:
3933 _LIBCPP_EXPLICIT_AFTER_CXX11 wbuffer_convert(streambuf* __bytebuf = 0,
3926 _LIBCPP_EXPLICIT_AFTER_CXX11 wbuffer_convert(streambuf* __bytebuf = 0,
39343927 _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type());
39353928 ~wbuffer_convert();
39363929
......@@ -4045,7 +4038,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()
40454038 this->egptr(), __inext);
40464039 if (__r == codecvt_base::noconv)
40474040 {
4048 this->setg((char_type*)__extbuf_, (char_type*)__extbuf_,
4041 this->setg((char_type*)__extbuf_, (char_type*)__extbuf_,
40494042 (char_type*) const_cast<char *>(__extbufend_));
40504043 __c = *this->gptr();
40514044 }
lib/libcxx/include/locale.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- locale.h --------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/map+86-18
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------- map ------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -194,8 +193,8 @@ public:
194193 const_iterator find(const K& x) const; // C++14
195194 template<typename K>
196195 size_type count(const K& x) const; // C++14
197
198196 size_type count(const key_type& k) const;
197 bool contains(const key_type& x) const; // C++20
199198 iterator lower_bound(const key_type& k);
200199 const_iterator lower_bound(const key_type& k) const;
201200 template<typename K>
......@@ -408,8 +407,8 @@ public:
408407 const_iterator find(const K& x) const; // C++14
409408 template<typename K>
410409 size_type count(const K& x) const; // C++14
411
412410 size_type count(const key_type& k) const;
411 bool contains(const key_type& x) const; // C++20
413412 iterator lower_bound(const key_type& k);
414413 const_iterator lower_bound(const key_type& k) const;
415414 template<typename K>
......@@ -903,12 +902,11 @@ public:
903902 typedef _Key key_type;
904903 typedef _Tp mapped_type;
905904 typedef pair<const key_type, mapped_type> value_type;
906 typedef _Compare key_compare;
907 typedef _Allocator allocator_type;
905 typedef typename __identity<_Compare>::type key_compare;
906 typedef typename __identity<_Allocator>::type allocator_type;
908907 typedef value_type& reference;
909908 typedef const value_type& const_reference;
910909
911 static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
912910 static_assert((is_same<typename allocator_type::value_type, value_type>::value),
913911 "Allocator::value_type must be same type as value_type");
914912
......@@ -1086,6 +1084,11 @@ public:
10861084 insert(__m.begin(), __m.end());
10871085 }
10881086
1087 _LIBCPP_INLINE_VISIBILITY
1088 ~map() {
1089 static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
1090 }
1091
10891092 _LIBCPP_INLINE_VISIBILITY
10901093 iterator begin() _NOEXCEPT {return __tree_.begin();}
10911094 _LIBCPP_INLINE_VISIBILITY
......@@ -1395,6 +1398,12 @@ public:
13951398 typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
13961399 count(const _K2& __k) const {return __tree_.__count_multi(__k);}
13971400#endif
1401
1402#if _LIBCPP_STD_VER > 17
1403 _LIBCPP_INLINE_VISIBILITY
1404 bool contains(const key_type& __k) const {return find(__k) != end();}
1405#endif // _LIBCPP_STD_VER > 17
1406
13981407 _LIBCPP_INLINE_VISIBILITY
13991408 iterator lower_bound(const key_type& __k)
14001409 {return __tree_.lower_bound(__k);}
......@@ -1462,6 +1471,32 @@ private:
14621471#endif
14631472};
14641473
1474#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
1475template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>,
1476 class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
1477 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
1478 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1479map(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
1480 -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
1481
1482template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>,
1483 class _Allocator = allocator<pair<const _Key, _Tp>>,
1484 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
1485 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1486map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
1487 -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
1488
1489template<class _InputIterator, class _Allocator,
1490 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1491map(_InputIterator, _InputIterator, _Allocator)
1492 -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
1493 less<__iter_key_type<_InputIterator>>, _Allocator>;
1494
1495template<class _Key, class _Tp, class _Allocator,
1496 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1497map(initializer_list<pair<_Key, _Tp>>, _Allocator)
1498 -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
1499#endif
14651500
14661501#ifndef _LIBCPP_CXX03_LANG
14671502template <class _Key, class _Tp, class _Compare, class _Allocator>
......@@ -1536,10 +1571,8 @@ map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k)
15361571{
15371572 __parent_pointer __parent;
15381573 __node_base_pointer& __child = __tree_.__find_equal(__parent, __k);
1539#ifndef _LIBCPP_NO_EXCEPTIONS
15401574 if (__child == nullptr)
1541 throw out_of_range("map::at: key not found");
1542#endif // _LIBCPP_NO_EXCEPTIONS
1575 __throw_out_of_range("map::at: key not found");
15431576 return static_cast<__node_pointer>(__child)->__value_.__get_value().second;
15441577}
15451578
......@@ -1549,10 +1582,8 @@ map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const
15491582{
15501583 __parent_pointer __parent;
15511584 __node_base_pointer __child = __tree_.__find_equal(__parent, __k);
1552#ifndef _LIBCPP_NO_EXCEPTIONS
15531585 if (__child == nullptr)
1554 throw out_of_range("map::at: key not found");
1555#endif // _LIBCPP_NO_EXCEPTIONS
1586 __throw_out_of_range("map::at: key not found");
15561587 return static_cast<__node_pointer>(__child)->__value_.__get_value().second;
15571588}
15581589
......@@ -1638,12 +1669,11 @@ public:
16381669 typedef _Key key_type;
16391670 typedef _Tp mapped_type;
16401671 typedef pair<const key_type, mapped_type> value_type;
1641 typedef _Compare key_compare;
1642 typedef _Allocator allocator_type;
1672 typedef typename __identity<_Compare>::type key_compare;
1673 typedef typename __identity<_Allocator>::type allocator_type;
16431674 typedef value_type& reference;
16441675 typedef const value_type& const_reference;
16451676
1646 static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
16471677 static_assert((is_same<typename allocator_type::value_type, value_type>::value),
16481678 "Allocator::value_type must be same type as value_type");
16491679
......@@ -1822,6 +1852,11 @@ public:
18221852 insert(__m.begin(), __m.end());
18231853 }
18241854
1855 _LIBCPP_INLINE_VISIBILITY
1856 ~multimap() {
1857 static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
1858 }
1859
18251860 _LIBCPP_INLINE_VISIBILITY
18261861 iterator begin() _NOEXCEPT {return __tree_.begin();}
18271862 _LIBCPP_INLINE_VISIBILITY
......@@ -2026,6 +2061,12 @@ public:
20262061 typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
20272062 count(const _K2& __k) const {return __tree_.__count_multi(__k);}
20282063#endif
2064
2065#if _LIBCPP_STD_VER > 17
2066 _LIBCPP_INLINE_VISIBILITY
2067 bool contains(const key_type& __k) const {return find(__k) != end();}
2068#endif // _LIBCPP_STD_VER > 17
2069
20292070 _LIBCPP_INLINE_VISIBILITY
20302071 iterator lower_bound(const key_type& __k)
20312072 {return __tree_.lower_bound(__k);}
......@@ -2087,6 +2128,33 @@ private:
20872128 typedef unique_ptr<__node, _Dp> __node_holder;
20882129};
20892130
2131#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
2132template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>,
2133 class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
2134 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
2135 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
2136multimap(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
2137 -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
2138
2139template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>,
2140 class _Allocator = allocator<pair<const _Key, _Tp>>,
2141 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
2142 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
2143multimap(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
2144 -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
2145
2146template<class _InputIterator, class _Allocator,
2147 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
2148multimap(_InputIterator, _InputIterator, _Allocator)
2149 -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
2150 less<__iter_key_type<_InputIterator>>, _Allocator>;
2151
2152template<class _Key, class _Tp, class _Allocator,
2153 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
2154multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
2155 -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
2156#endif
2157
20902158#ifndef _LIBCPP_CXX03_LANG
20912159template <class _Key, class _Tp, class _Compare, class _Allocator>
20922160multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const allocator_type& __a)
lib/libcxx/include/math.h+93-50
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- math.h ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -298,6 +297,9 @@ long double truncl(long double x);
298297#pragma GCC system_header
299298#endif
300299
300#define _LIBCPP_STDLIB_INCLUDE_NEXT
301#include <stdlib.h>
302
301303#include_next <math.h>
302304
303305#ifdef __cplusplus
......@@ -755,20 +757,61 @@ isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
755757
756758// abs
757759
760#undef abs
761#undef labs
762#ifndef _LIBCPP_HAS_NO_LONG_LONG
763#undef llabs
764#endif
765
766// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
767#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
768inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {
769 return ::labs(__x);
770}
771#ifndef _LIBCPP_HAS_NO_LONG_LONG
772inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {
773 return ::llabs(__x);
774}
775#endif // _LIBCPP_HAS_NO_LONG_LONG
776#endif // !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
777
778
758779#if !(defined(_AIX) || defined(__sun__))
759inline _LIBCPP_INLINE_VISIBILITY
760float
761abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
780inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT {
781 return ::fabsf(__lcpp_x);
782}
762783
763inline _LIBCPP_INLINE_VISIBILITY
764double
765abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
784inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT {
785 return ::fabs(__lcpp_x);
786}
766787
767inline _LIBCPP_INLINE_VISIBILITY
768long double
769abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
788inline _LIBCPP_INLINE_VISIBILITY long double
789abs(long double __lcpp_x) _NOEXCEPT {
790 return ::fabsl(__lcpp_x);
791}
770792#endif // !(defined(_AIX) || defined(__sun__))
771793
794// div
795
796#undef div
797#undef ldiv
798#ifndef _LIBCPP_HAS_NO_LONG_LONG
799#undef lldiv
800#endif
801
802// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
803#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
804inline _LIBCPP_INLINE_VISIBILITY ldiv_t div(long __x, long __y) _NOEXCEPT {
805 return ::ldiv(__x, __y);
806}
807#ifndef _LIBCPP_HAS_NO_LONG_LONG
808inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x,
809 long long __y) _NOEXCEPT {
810 return ::lldiv(__x, __y);
811}
812#endif // _LIBCPP_HAS_NO_LONG_LONG
813#endif // _LIBCPP_MSVCRT / __sun__ / _AIX
814
772815// acos
773816
774817#if !(defined(_AIX) || defined(__sun__))
......@@ -814,7 +857,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long do
814857
815858template <class _A1, class _A2>
816859inline _LIBCPP_INLINE_VISIBILITY
817typename std::__lazy_enable_if
860typename std::_EnableIf
818861<
819862 std::is_arithmetic<_A1>::value &&
820863 std::is_arithmetic<_A2>::value,
......@@ -823,8 +866,8 @@ typename std::__lazy_enable_if
823866atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
824867{
825868 typedef typename std::__promote<_A1, _A2>::type __result_type;
826 static_assert((!(std::is_same<_A1, __result_type>::value &&
827 std::is_same<_A2, __result_type>::value)), "");
869 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
870 std::_IsSame<_A2, __result_type>::value)), "");
828871 return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
829872}
830873
......@@ -909,7 +952,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long dou
909952
910953template <class _A1, class _A2>
911954inline _LIBCPP_INLINE_VISIBILITY
912typename std::__lazy_enable_if
955typename std::_EnableIf
913956<
914957 std::is_arithmetic<_A1>::value &&
915958 std::is_arithmetic<_A2>::value,
......@@ -918,8 +961,8 @@ typename std::__lazy_enable_if
918961fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
919962{
920963 typedef typename std::__promote<_A1, _A2>::type __result_type;
921 static_assert((!(std::is_same<_A1, __result_type>::value &&
922 std::is_same<_A2, __result_type>::value)), "");
964 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
965 std::_IsSame<_A2, __result_type>::value)), "");
923966 return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
924967}
925968
......@@ -987,7 +1030,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long doub
9871030
9881031template <class _A1, class _A2>
9891032inline _LIBCPP_INLINE_VISIBILITY
990typename std::__lazy_enable_if
1033typename std::_EnableIf
9911034<
9921035 std::is_arithmetic<_A1>::value &&
9931036 std::is_arithmetic<_A2>::value,
......@@ -996,8 +1039,8 @@ typename std::__lazy_enable_if
9961039pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
9971040{
9981041 typedef typename std::__promote<_A1, _A2>::type __result_type;
999 static_assert((!(std::is_same<_A1, __result_type>::value &&
1000 std::is_same<_A2, __result_type>::value)), "");
1042 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1043 std::_IsSame<_A2, __result_type>::value)), "");
10011044 return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
10021045}
10031046
......@@ -1114,7 +1157,7 @@ copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
11141157
11151158template <class _A1, class _A2>
11161159inline _LIBCPP_INLINE_VISIBILITY
1117typename std::__lazy_enable_if
1160typename std::_EnableIf
11181161<
11191162 std::is_arithmetic<_A1>::value &&
11201163 std::is_arithmetic<_A2>::value,
......@@ -1123,8 +1166,8 @@ typename std::__lazy_enable_if
11231166copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
11241167{
11251168 typedef typename std::__promote<_A1, _A2>::type __result_type;
1126 static_assert((!(std::is_same<_A1, __result_type>::value &&
1127 std::is_same<_A2, __result_type>::value)), "");
1169 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1170 std::_IsSame<_A2, __result_type>::value)), "");
11281171 return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
11291172}
11301173
......@@ -1175,7 +1218,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long dou
11751218
11761219template <class _A1, class _A2>
11771220inline _LIBCPP_INLINE_VISIBILITY
1178typename std::__lazy_enable_if
1221typename std::_EnableIf
11791222<
11801223 std::is_arithmetic<_A1>::value &&
11811224 std::is_arithmetic<_A2>::value,
......@@ -1184,8 +1227,8 @@ typename std::__lazy_enable_if
11841227fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
11851228{
11861229 typedef typename std::__promote<_A1, _A2>::type __result_type;
1187 static_assert((!(std::is_same<_A1, __result_type>::value &&
1188 std::is_same<_A2, __result_type>::value)), "");
1230 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1231 std::_IsSame<_A2, __result_type>::value)), "");
11891232 return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
11901233}
11911234
......@@ -1196,7 +1239,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long doub
11961239
11971240template <class _A1, class _A2, class _A3>
11981241inline _LIBCPP_INLINE_VISIBILITY
1199typename std::__lazy_enable_if
1242typename std::_EnableIf
12001243<
12011244 std::is_arithmetic<_A1>::value &&
12021245 std::is_arithmetic<_A2>::value &&
......@@ -1206,9 +1249,9 @@ typename std::__lazy_enable_if
12061249fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
12071250{
12081251 typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;
1209 static_assert((!(std::is_same<_A1, __result_type>::value &&
1210 std::is_same<_A2, __result_type>::value &&
1211 std::is_same<_A3, __result_type>::value)), "");
1252 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1253 std::_IsSame<_A2, __result_type>::value &&
1254 std::_IsSame<_A3, __result_type>::value)), "");
12121255 return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
12131256}
12141257
......@@ -1219,7 +1262,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long dou
12191262
12201263template <class _A1, class _A2>
12211264inline _LIBCPP_INLINE_VISIBILITY
1222typename std::__lazy_enable_if
1265typename std::_EnableIf
12231266<
12241267 std::is_arithmetic<_A1>::value &&
12251268 std::is_arithmetic<_A2>::value,
......@@ -1228,8 +1271,8 @@ typename std::__lazy_enable_if
12281271fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
12291272{
12301273 typedef typename std::__promote<_A1, _A2>::type __result_type;
1231 static_assert((!(std::is_same<_A1, __result_type>::value &&
1232 std::is_same<_A2, __result_type>::value)), "");
1274 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1275 std::_IsSame<_A2, __result_type>::value)), "");
12331276 return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
12341277}
12351278
......@@ -1240,7 +1283,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long dou
12401283
12411284template <class _A1, class _A2>
12421285inline _LIBCPP_INLINE_VISIBILITY
1243typename std::__lazy_enable_if
1286typename std::_EnableIf
12441287<
12451288 std::is_arithmetic<_A1>::value &&
12461289 std::is_arithmetic<_A2>::value,
......@@ -1249,8 +1292,8 @@ typename std::__lazy_enable_if
12491292fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
12501293{
12511294 typedef typename std::__promote<_A1, _A2>::type __result_type;
1252 static_assert((!(std::is_same<_A1, __result_type>::value &&
1253 std::is_same<_A2, __result_type>::value)), "");
1295 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1296 std::_IsSame<_A2, __result_type>::value)), "");
12541297 return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
12551298}
12561299
......@@ -1261,7 +1304,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long do
12611304
12621305template <class _A1, class _A2>
12631306inline _LIBCPP_INLINE_VISIBILITY
1264typename std::__lazy_enable_if
1307typename std::_EnableIf
12651308<
12661309 std::is_arithmetic<_A1>::value &&
12671310 std::is_arithmetic<_A2>::value,
......@@ -1270,8 +1313,8 @@ typename std::__lazy_enable_if
12701313hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
12711314{
12721315 typedef typename std::__promote<_A1, _A2>::type __result_type;
1273 static_assert((!(std::is_same<_A1, __result_type>::value &&
1274 std::is_same<_A2, __result_type>::value)), "");
1316 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1317 std::_IsSame<_A2, __result_type>::value)), "");
12751318 return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
12761319}
12771320
......@@ -1384,7 +1427,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, lon
13841427
13851428template <class _A1, class _A2>
13861429inline _LIBCPP_INLINE_VISIBILITY
1387typename std::__lazy_enable_if
1430typename std::_EnableIf
13881431<
13891432 std::is_arithmetic<_A1>::value &&
13901433 std::is_arithmetic<_A2>::value,
......@@ -1393,8 +1436,8 @@ typename std::__lazy_enable_if
13931436nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
13941437{
13951438 typedef typename std::__promote<_A1, _A2>::type __result_type;
1396 static_assert((!(std::is_same<_A1, __result_type>::value &&
1397 std::is_same<_A2, __result_type>::value)), "");
1439 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1440 std::_IsSame<_A2, __result_type>::value)), "");
13981441 return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
13991442}
14001443
......@@ -1415,7 +1458,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, lon
14151458
14161459template <class _A1, class _A2>
14171460inline _LIBCPP_INLINE_VISIBILITY
1418typename std::__lazy_enable_if
1461typename std::_EnableIf
14191462<
14201463 std::is_arithmetic<_A1>::value &&
14211464 std::is_arithmetic<_A2>::value,
......@@ -1424,8 +1467,8 @@ typename std::__lazy_enable_if
14241467remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
14251468{
14261469 typedef typename std::__promote<_A1, _A2>::type __result_type;
1427 static_assert((!(std::is_same<_A1, __result_type>::value &&
1428 std::is_same<_A2, __result_type>::value)), "");
1470 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1471 std::_IsSame<_A2, __result_type>::value)), "");
14291472 return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
14301473}
14311474
......@@ -1436,7 +1479,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long d
14361479
14371480template <class _A1, class _A2>
14381481inline _LIBCPP_INLINE_VISIBILITY
1439typename std::__lazy_enable_if
1482typename std::_EnableIf
14401483<
14411484 std::is_arithmetic<_A1>::value &&
14421485 std::is_arithmetic<_A2>::value,
......@@ -1445,8 +1488,8 @@ typename std::__lazy_enable_if
14451488remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
14461489{
14471490 typedef typename std::__promote<_A1, _A2>::type __result_type;
1448 static_assert((!(std::is_same<_A1, __result_type>::value &&
1449 std::is_same<_A2, __result_type>::value)), "");
1491 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1492 std::_IsSame<_A2, __result_type>::value)), "");
14501493 return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
14511494}
14521495
lib/libcxx/include/memory+160-243
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- memory ------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -549,7 +548,7 @@ template<class T> void swap(weak_ptr<T>& a, weak_ptr<T>& b) noexcept;
549548template<class T> struct owner_less;
550549
551550template<class T>
552struct owner_less<shared_ptr<T>>
551struct owner_less<shared_ptr<T> >
553552 : binary_function<shared_ptr<T>, shared_ptr<T>, bool>
554553{
555554 typedef bool result_type;
......@@ -559,7 +558,7 @@ struct owner_less<shared_ptr<T>>
559558};
560559
561560template<class T>
562struct owner_less<weak_ptr<T>>
561struct owner_less<weak_ptr<T> >
563562 : binary_function<weak_ptr<T>, weak_ptr<T>, bool>
564563{
565564 typedef bool result_type;
......@@ -684,7 +683,7 @@ inline _LIBCPP_INLINE_VISIBILITY
684683_ValueType __libcpp_relaxed_load(_ValueType const* __value) {
685684#if !defined(_LIBCPP_HAS_NO_THREADS) && \
686685 defined(__ATOMIC_RELAXED) && \
687 (__has_builtin(__atomic_load_n) || _GNUC_VER >= 407)
686 (__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC))
688687 return __atomic_load_n(__value, __ATOMIC_RELAXED);
689688#else
690689 return *__value;
......@@ -696,7 +695,7 @@ inline _LIBCPP_INLINE_VISIBILITY
696695_ValueType __libcpp_acquire_load(_ValueType const* __value) {
697696#if !defined(_LIBCPP_HAS_NO_THREADS) && \
698697 defined(__ATOMIC_ACQUIRE) && \
699 (__has_builtin(__atomic_load_n) || _GNUC_VER >= 407)
698 (__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC))
700699 return __atomic_load_n(__value, __ATOMIC_ACQUIRE);
701700#else
702701 return *__value;
......@@ -744,7 +743,7 @@ struct __pointer_traits_element_type;
744743template <class _Ptr>
745744struct __pointer_traits_element_type<_Ptr, true>
746745{
747 typedef typename _Ptr::element_type type;
746 typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::element_type type;
748747};
749748
750749#ifndef _LIBCPP_HAS_NO_VARIADICS
......@@ -752,13 +751,13 @@ struct __pointer_traits_element_type<_Ptr, true>
752751template <template <class, class...> class _Sp, class _Tp, class ..._Args>
753752struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true>
754753{
755 typedef typename _Sp<_Tp, _Args...>::element_type type;
754 typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::element_type type;
756755};
757756
758757template <template <class, class...> class _Sp, class _Tp, class ..._Args>
759758struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false>
760759{
761 typedef _Tp type;
760 typedef _LIBCPP_NODEBUG_TYPE _Tp type;
762761};
763762
764763#else // _LIBCPP_HAS_NO_VARIADICS
......@@ -825,13 +824,13 @@ struct __has_difference_type<_Tp,
825824template <class _Ptr, bool = __has_difference_type<_Ptr>::value>
826825struct __pointer_traits_difference_type
827826{
828 typedef ptrdiff_t type;
827 typedef _LIBCPP_NODEBUG_TYPE ptrdiff_t type;
829828};
830829
831830template <class _Ptr>
832831struct __pointer_traits_difference_type<_Ptr, true>
833832{
834 typedef typename _Ptr::difference_type type;
833 typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::difference_type type;
835834};
836835
837836template <class _Tp, class _Up>
......@@ -849,9 +848,9 @@ template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
849848struct __pointer_traits_rebind
850849{
851850#ifndef _LIBCPP_CXX03_LANG
852 typedef typename _Tp::template rebind<_Up> type;
851 typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up> type;
853852#else
854 typedef typename _Tp::template rebind<_Up>::other type;
853 typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type;
855854#endif
856855};
857856
......@@ -861,9 +860,9 @@ template <template <class, class...> class _Sp, class _Tp, class ..._Args, class
861860struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true>
862861{
863862#ifndef _LIBCPP_CXX03_LANG
864 typedef typename _Sp<_Tp, _Args...>::template rebind<_Up> type;
863 typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::template rebind<_Up> type;
865864#else
866 typedef typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type;
865 typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type;
867866#endif
868867};
869868
......@@ -1014,13 +1013,13 @@ namespace __pointer_type_imp
10141013template <class _Tp, class _Dp, bool = __has_pointer_type<_Dp>::value>
10151014struct __pointer_type
10161015{
1017 typedef typename _Dp::pointer type;
1016 typedef _LIBCPP_NODEBUG_TYPE typename _Dp::pointer type;
10181017};
10191018
10201019template <class _Tp, class _Dp>
10211020struct __pointer_type<_Tp, _Dp, false>
10221021{
1023 typedef _Tp* type;
1022 typedef _LIBCPP_NODEBUG_TYPE _Tp* type;
10241023};
10251024
10261025} // __pointer_type_imp
......@@ -1028,7 +1027,7 @@ struct __pointer_type<_Tp, _Dp, false>
10281027template <class _Tp, class _Dp>
10291028struct __pointer_type
10301029{
1031 typedef typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type;
1030 typedef _LIBCPP_NODEBUG_TYPE typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type;
10321031};
10331032
10341033template <class _Tp, class = void>
......@@ -1041,14 +1040,14 @@ struct __has_const_pointer<_Tp,
10411040template <class _Tp, class _Ptr, class _Alloc, bool = __has_const_pointer<_Alloc>::value>
10421041struct __const_pointer
10431042{
1044 typedef typename _Alloc::const_pointer type;
1043 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_pointer type;
10451044};
10461045
10471046template <class _Tp, class _Ptr, class _Alloc>
10481047struct __const_pointer<_Tp, _Ptr, _Alloc, false>
10491048{
10501049#ifndef _LIBCPP_CXX03_LANG
1051 typedef typename pointer_traits<_Ptr>::template rebind<const _Tp> type;
1050 typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const _Tp> type;
10521051#else
10531052 typedef typename pointer_traits<_Ptr>::template rebind<const _Tp>::other type;
10541053#endif
......@@ -1064,16 +1063,16 @@ struct __has_void_pointer<_Tp,
10641063template <class _Ptr, class _Alloc, bool = __has_void_pointer<_Alloc>::value>
10651064struct __void_pointer
10661065{
1067 typedef typename _Alloc::void_pointer type;
1066 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::void_pointer type;
10681067};
10691068
10701069template <class _Ptr, class _Alloc>
10711070struct __void_pointer<_Ptr, _Alloc, false>
10721071{
10731072#ifndef _LIBCPP_CXX03_LANG
1074 typedef typename pointer_traits<_Ptr>::template rebind<void> type;
1073 typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<void> type;
10751074#else
1076 typedef typename pointer_traits<_Ptr>::template rebind<void>::other type;
1075 typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<void>::other type;
10771076#endif
10781077};
10791078
......@@ -1087,16 +1086,16 @@ struct __has_const_void_pointer<_Tp,
10871086template <class _Ptr, class _Alloc, bool = __has_const_void_pointer<_Alloc>::value>
10881087struct __const_void_pointer
10891088{
1090 typedef typename _Alloc::const_void_pointer type;
1089 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_void_pointer type;
10911090};
10921091
10931092template <class _Ptr, class _Alloc>
10941093struct __const_void_pointer<_Ptr, _Alloc, false>
10951094{
10961095#ifndef _LIBCPP_CXX03_LANG
1097 typedef typename pointer_traits<_Ptr>::template rebind<const void> type;
1096 typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const void> type;
10981097#else
1099 typedef typename pointer_traits<_Ptr>::template rebind<const void>::other type;
1098 typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const void>::other type;
11001099#endif
11011100};
11021101
......@@ -1162,13 +1161,13 @@ struct __has_size_type<_Tp,
11621161template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value>
11631162struct __size_type
11641163{
1165 typedef typename make_unsigned<_DiffType>::type type;
1164 typedef _LIBCPP_NODEBUG_TYPE typename make_unsigned<_DiffType>::type type;
11661165};
11671166
11681167template <class _Alloc, class _DiffType>
11691168struct __size_type<_Alloc, _DiffType, true>
11701169{
1171 typedef typename _Alloc::size_type type;
1170 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::size_type type;
11721171};
11731172
11741173template <class _Tp, class = void>
......@@ -1182,13 +1181,13 @@ struct __has_propagate_on_container_copy_assignment<_Tp,
11821181template <class _Alloc, bool = __has_propagate_on_container_copy_assignment<_Alloc>::value>
11831182struct __propagate_on_container_copy_assignment
11841183{
1185 typedef false_type type;
1184 typedef _LIBCPP_NODEBUG_TYPE false_type type;
11861185};
11871186
11881187template <class _Alloc>
11891188struct __propagate_on_container_copy_assignment<_Alloc, true>
11901189{
1191 typedef typename _Alloc::propagate_on_container_copy_assignment type;
1190 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_copy_assignment type;
11921191};
11931192
11941193template <class _Tp, class = void>
......@@ -1208,7 +1207,7 @@ struct __propagate_on_container_move_assignment
12081207template <class _Alloc>
12091208struct __propagate_on_container_move_assignment<_Alloc, true>
12101209{
1211 typedef typename _Alloc::propagate_on_container_move_assignment type;
1210 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_move_assignment type;
12121211};
12131212
12141213template <class _Tp, class = void>
......@@ -1228,7 +1227,7 @@ struct __propagate_on_container_swap
12281227template <class _Alloc>
12291228struct __propagate_on_container_swap<_Alloc, true>
12301229{
1231 typedef typename _Alloc::propagate_on_container_swap type;
1230 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_swap type;
12321231};
12331232
12341233template <class _Tp, class = void>
......@@ -1242,13 +1241,13 @@ struct __has_is_always_equal<_Tp,
12421241template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value>
12431242struct __is_always_equal
12441243{
1245 typedef typename _VSTD::is_empty<_Alloc>::type type;
1244 typedef _LIBCPP_NODEBUG_TYPE typename _VSTD::is_empty<_Alloc>::type type;
12461245};
12471246
12481247template <class _Alloc>
12491248struct __is_always_equal<_Alloc, true>
12501249{
1251 typedef typename _Alloc::is_always_equal type;
1250 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::is_always_equal type;
12521251};
12531252
12541253template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
......@@ -1271,7 +1270,7 @@ struct __has_rebind_other<_Tp, _Up, false>
12711270template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value>
12721271struct __allocator_traits_rebind
12731272{
1274 typedef typename _Tp::template rebind<_Up>::other type;
1273 typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type;
12751274};
12761275
12771276#ifndef _LIBCPP_HAS_NO_VARIADICS
......@@ -1279,13 +1278,13 @@ struct __allocator_traits_rebind
12791278template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
12801279struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, true>
12811280{
1282 typedef typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other type;
1281 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other type;
12831282};
12841283
12851284template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
12861285struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false>
12871286{
1288 typedef _Alloc<_Up, _Args...> type;
1287 typedef _LIBCPP_NODEBUG_TYPE _Alloc<_Up, _Args...> type;
12891288};
12901289
12911290#else // _LIBCPP_HAS_NO_VARIADICS
......@@ -1493,13 +1492,13 @@ struct __has_select_on_container_copy_construction
14931492template <class _Alloc, class _Ptr, bool = __has_difference_type<_Alloc>::value>
14941493struct __alloc_traits_difference_type
14951494{
1496 typedef typename pointer_traits<_Ptr>::difference_type type;
1495 typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::difference_type type;
14971496};
14981497
14991498template <class _Alloc, class _Ptr>
15001499struct __alloc_traits_difference_type<_Alloc, _Ptr, true>
15011500{
1502 typedef typename _Alloc::difference_type type;
1501 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::difference_type type;
15031502};
15041503
15051504template <class _Tp>
......@@ -1534,7 +1533,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits
15341533#ifndef _LIBCPP_CXX03_LANG
15351534 template <class _Tp> using rebind_alloc =
15361535 typename __allocator_traits_rebind<allocator_type, _Tp>::type;
1537 template <class _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp>>;
1536 template <class _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp> >;
15381537#else // _LIBCPP_CXX03_LANG
15391538 template <class _Tp> struct rebind_alloc
15401539 {typedef typename __allocator_traits_rebind<allocator_type, _Tp>::type other;};
......@@ -1769,7 +1768,7 @@ template <class _Traits, class _Tp>
17691768struct __rebind_alloc_helper
17701769{
17711770#ifndef _LIBCPP_CXX03_LANG
1772 typedef typename _Traits::template rebind_alloc<_Tp> type;
1771 typedef _LIBCPP_NODEBUG_TYPE typename _Traits::template rebind_alloc<_Tp> type;
17731772#else
17741773 typedef typename _Traits::template rebind_alloc<_Tp>::other type;
17751774#endif
......@@ -2210,8 +2209,8 @@ struct __second_tag {};
22102209template <class _T1, class _T2>
22112210class __compressed_pair : private __compressed_pair_elem<_T1, 0>,
22122211 private __compressed_pair_elem<_T2, 1> {
2213 typedef __compressed_pair_elem<_T1, 0> _Base1;
2214 typedef __compressed_pair_elem<_T2, 1> _Base2;
2212 typedef _LIBCPP_NODEBUG_TYPE __compressed_pair_elem<_T1, 0> _Base1;
2213 typedef _LIBCPP_NODEBUG_TYPE __compressed_pair_elem<_T2, 1> _Base2;
22152214
22162215 // NOTE: This static assert should never fire because __compressed_pair
22172216 // is *almost never* used in a scenario where it's possible for T1 == T2.
......@@ -2321,7 +2320,7 @@ struct _LIBCPP_TEMPLATE_VIS default_delete {
23212320 static_assert(!is_function<_Tp>::value,
23222321 "default_delete cannot be instantiated for function types");
23232322#ifndef _LIBCPP_CXX03_LANG
2324 _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default;
2323 _LIBCPP_INLINE_VISIBILITY constexpr default_delete() _NOEXCEPT = default;
23252324#else
23262325 _LIBCPP_INLINE_VISIBILITY default_delete() {}
23272326#endif
......@@ -2349,7 +2348,7 @@ private:
23492348
23502349public:
23512350#ifndef _LIBCPP_CXX03_LANG
2352 _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default;
2351 _LIBCPP_INLINE_VISIBILITY constexpr default_delete() _NOEXCEPT = default;
23532352#else
23542353 _LIBCPP_INLINE_VISIBILITY default_delete() {}
23552354#endif
......@@ -2371,9 +2370,6 @@ public:
23712370 }
23722371};
23732372
2374
2375
2376#ifndef _LIBCPP_CXX03_LANG
23772373template <class _Deleter>
23782374struct __unique_ptr_deleter_sfinae {
23792375 static_assert(!is_reference<_Deleter>::value, "incorrect specialization");
......@@ -2395,14 +2391,13 @@ struct __unique_ptr_deleter_sfinae<_Deleter&> {
23952391 typedef _Deleter&& __bad_rval_ref_type;
23962392 typedef false_type __enable_rval_overload;
23972393};
2398#endif // !defined(_LIBCPP_CXX03_LANG)
23992394
24002395template <class _Tp, class _Dp = default_delete<_Tp> >
24012396class _LIBCPP_TEMPLATE_VIS unique_ptr {
24022397public:
24032398 typedef _Tp element_type;
24042399 typedef _Dp deleter_type;
2405 typedef typename __pointer_type<_Tp, deleter_type>::type pointer;
2400 typedef _LIBCPP_NODEBUG_TYPE typename __pointer_type<_Tp, deleter_type>::type pointer;
24062401
24072402 static_assert(!is_rvalue_reference<deleter_type>::value,
24082403 "the specified deleter type cannot be an rvalue reference");
......@@ -2412,39 +2407,38 @@ private:
24122407
24132408 struct __nat { int __for_bool_; };
24142409
2415#ifndef _LIBCPP_CXX03_LANG
2416 typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
2410 typedef _LIBCPP_NODEBUG_TYPE __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
24172411
24182412 template <bool _Dummy>
2419 using _LValRefType =
2413 using _LValRefType _LIBCPP_NODEBUG_TYPE =
24202414 typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
24212415
24222416 template <bool _Dummy>
2423 using _GoodRValRefType =
2417 using _GoodRValRefType _LIBCPP_NODEBUG_TYPE =
24242418 typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
24252419
24262420 template <bool _Dummy>
2427 using _BadRValRefType =
2421 using _BadRValRefType _LIBCPP_NODEBUG_TYPE =
24282422 typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
24292423
24302424 template <bool _Dummy, class _Deleter = typename __dependent_type<
24312425 __identity<deleter_type>, _Dummy>::type>
2432 using _EnableIfDeleterDefaultConstructible =
2426 using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG_TYPE =
24332427 typename enable_if<is_default_constructible<_Deleter>::value &&
24342428 !is_pointer<_Deleter>::value>::type;
24352429
24362430 template <class _ArgType>
2437 using _EnableIfDeleterConstructible =
2431 using _EnableIfDeleterConstructible _LIBCPP_NODEBUG_TYPE =
24382432 typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type;
24392433
24402434 template <class _UPtr, class _Up>
2441 using _EnableIfMoveConvertible = typename enable_if<
2435 using _EnableIfMoveConvertible _LIBCPP_NODEBUG_TYPE = typename enable_if<
24422436 is_convertible<typename _UPtr::pointer, pointer>::value &&
24432437 !is_array<_Up>::value
24442438 >::type;
24452439
24462440 template <class _UDel>
2447 using _EnableIfDeleterConvertible = typename enable_if<
2441 using _EnableIfDeleterConvertible _LIBCPP_NODEBUG_TYPE = typename enable_if<
24482442 (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||
24492443 (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value)
24502444 >::type;
......@@ -2456,42 +2450,42 @@ private:
24562450
24572451public:
24582452 template <bool _Dummy = true,
2459 class = _EnableIfDeleterDefaultConstructible<_Dummy>>
2453 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
24602454 _LIBCPP_INLINE_VISIBILITY
2461 constexpr unique_ptr() noexcept : __ptr_(pointer()) {}
2455 _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer()) {}
24622456
24632457 template <bool _Dummy = true,
2464 class = _EnableIfDeleterDefaultConstructible<_Dummy>>
2458 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
24652459 _LIBCPP_INLINE_VISIBILITY
2466 constexpr unique_ptr(nullptr_t) noexcept : __ptr_(pointer()) {}
2460 _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer()) {}
24672461
24682462 template <bool _Dummy = true,
2469 class = _EnableIfDeleterDefaultConstructible<_Dummy>>
2463 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
24702464 _LIBCPP_INLINE_VISIBILITY
2471 explicit unique_ptr(pointer __p) noexcept : __ptr_(__p) {}
2465 explicit unique_ptr(pointer __p) _NOEXCEPT : __ptr_(__p) {}
24722466
24732467 template <bool _Dummy = true,
2474 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy>>>
2468 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > >
24752469 _LIBCPP_INLINE_VISIBILITY
2476 unique_ptr(pointer __p, _LValRefType<_Dummy> __d) noexcept
2470 unique_ptr(pointer __p, _LValRefType<_Dummy> __d) _NOEXCEPT
24772471 : __ptr_(__p, __d) {}
24782472
24792473 template <bool _Dummy = true,
2480 class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy>>>
2474 class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > >
24812475 _LIBCPP_INLINE_VISIBILITY
2482 unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) noexcept
2476 unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT
24832477 : __ptr_(__p, _VSTD::move(__d)) {
24842478 static_assert(!is_reference<deleter_type>::value,
24852479 "rvalue deleter bound to reference");
24862480 }
24872481
24882482 template <bool _Dummy = true,
2489 class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy>>>
2483 class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> > >
24902484 _LIBCPP_INLINE_VISIBILITY
24912485 unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete;
24922486
24932487 _LIBCPP_INLINE_VISIBILITY
2494 unique_ptr(unique_ptr&& __u) noexcept
2488 unique_ptr(unique_ptr&& __u) _NOEXCEPT
24952489 : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {
24962490 }
24972491
......@@ -2508,7 +2502,7 @@ public:
25082502 _LIBCPP_INLINE_VISIBILITY
25092503 unique_ptr(auto_ptr<_Up>&& __p,
25102504 typename enable_if<is_convertible<_Up*, _Tp*>::value &&
2511 is_same<_Dp, default_delete<_Tp>>::value,
2505 is_same<_Dp, default_delete<_Tp> >::value,
25122506 __nat>::type = __nat()) _NOEXCEPT
25132507 : __ptr_(__p.release()) {}
25142508#endif
......@@ -2531,65 +2525,6 @@ public:
25312525 return *this;
25322526 }
25332527
2534#else // _LIBCPP_CXX03_LANG
2535private:
2536 unique_ptr(unique_ptr&);
2537 template <class _Up, class _Ep> unique_ptr(unique_ptr<_Up, _Ep>&);
2538
2539 unique_ptr& operator=(unique_ptr&);
2540 template <class _Up, class _Ep> unique_ptr& operator=(unique_ptr<_Up, _Ep>&);
2541
2542public:
2543 _LIBCPP_INLINE_VISIBILITY
2544 unique_ptr() : __ptr_(pointer())
2545 {
2546 static_assert(!is_pointer<deleter_type>::value,
2547 "unique_ptr constructed with null function pointer deleter");
2548 static_assert(is_default_constructible<deleter_type>::value,
2549 "unique_ptr::deleter_type is not default constructible");
2550 }
2551 _LIBCPP_INLINE_VISIBILITY
2552 unique_ptr(nullptr_t) : __ptr_(pointer())
2553 {
2554 static_assert(!is_pointer<deleter_type>::value,
2555 "unique_ptr constructed with null function pointer deleter");
2556 }
2557 _LIBCPP_INLINE_VISIBILITY
2558 explicit unique_ptr(pointer __p)
2559 : __ptr_(_VSTD::move(__p)) {
2560 static_assert(!is_pointer<deleter_type>::value,
2561 "unique_ptr constructed with null function pointer deleter");
2562 }
2563
2564 _LIBCPP_INLINE_VISIBILITY
2565 operator __rv<unique_ptr>() {
2566 return __rv<unique_ptr>(*this);
2567 }
2568
2569 _LIBCPP_INLINE_VISIBILITY
2570 unique_ptr(__rv<unique_ptr> __u)
2571 : __ptr_(__u->release(),
2572 _VSTD::forward<deleter_type>(__u->get_deleter())) {}
2573
2574 template <class _Up, class _Ep>
2575 _LIBCPP_INLINE_VISIBILITY
2576 typename enable_if<
2577 !is_array<_Up>::value &&
2578 is_convertible<typename unique_ptr<_Up, _Ep>::pointer,
2579 pointer>::value &&
2580 is_assignable<deleter_type&, _Ep&>::value,
2581 unique_ptr&>::type
2582 operator=(unique_ptr<_Up, _Ep> __u) {
2583 reset(__u.release());
2584 __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
2585 return *this;
2586 }
2587
2588 _LIBCPP_INLINE_VISIBILITY
2589 unique_ptr(pointer __p, deleter_type __d)
2590 : __ptr_(_VSTD::move(__p), _VSTD::move(__d)) {}
2591#endif // _LIBCPP_CXX03_LANG
2592
25932528#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
25942529 template <class _Up>
25952530 _LIBCPP_INLINE_VISIBILITY
......@@ -2602,6 +2537,12 @@ public:
26022537 }
26032538#endif
26042539
2540#ifdef _LIBCPP_CXX03_LANG
2541 unique_ptr(unique_ptr const&) = delete;
2542 unique_ptr& operator=(unique_ptr const&) = delete;
2543#endif
2544
2545
26052546 _LIBCPP_INLINE_VISIBILITY
26062547 ~unique_ptr() { reset(); }
26072548
......@@ -2681,39 +2622,38 @@ private:
26812622 >
26822623 {};
26832624
2684#ifndef _LIBCPP_CXX03_LANG
26852625 typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
26862626
26872627 template <bool _Dummy>
2688 using _LValRefType =
2628 using _LValRefType _LIBCPP_NODEBUG_TYPE =
26892629 typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
26902630
26912631 template <bool _Dummy>
2692 using _GoodRValRefType =
2632 using _GoodRValRefType _LIBCPP_NODEBUG_TYPE =
26932633 typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
26942634
26952635 template <bool _Dummy>
2696 using _BadRValRefType =
2636 using _BadRValRefType _LIBCPP_NODEBUG_TYPE =
26972637 typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
26982638
26992639 template <bool _Dummy, class _Deleter = typename __dependent_type<
27002640 __identity<deleter_type>, _Dummy>::type>
2701 using _EnableIfDeleterDefaultConstructible =
2641 using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG_TYPE =
27022642 typename enable_if<is_default_constructible<_Deleter>::value &&
27032643 !is_pointer<_Deleter>::value>::type;
27042644
27052645 template <class _ArgType>
2706 using _EnableIfDeleterConstructible =
2646 using _EnableIfDeleterConstructible _LIBCPP_NODEBUG_TYPE =
27072647 typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type;
27082648
27092649 template <class _Pp>
2710 using _EnableIfPointerConvertible = typename enable_if<
2650 using _EnableIfPointerConvertible _LIBCPP_NODEBUG_TYPE = typename enable_if<
27112651 _CheckArrayPointerConversion<_Pp>::value
27122652 >::type;
27132653
27142654 template <class _UPtr, class _Up,
27152655 class _ElemT = typename _UPtr::element_type>
2716 using _EnableIfMoveConvertible = typename enable_if<
2656 using _EnableIfMoveConvertible _LIBCPP_NODEBUG_TYPE = typename enable_if<
27172657 is_array<_Up>::value &&
27182658 is_same<pointer, element_type*>::value &&
27192659 is_same<typename _UPtr::pointer, _ElemT*>::value &&
......@@ -2721,79 +2661,79 @@ private:
27212661 >::type;
27222662
27232663 template <class _UDel>
2724 using _EnableIfDeleterConvertible = typename enable_if<
2664 using _EnableIfDeleterConvertible _LIBCPP_NODEBUG_TYPE = typename enable_if<
27252665 (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||
27262666 (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value)
27272667 >::type;
27282668
27292669 template <class _UDel>
2730 using _EnableIfDeleterAssignable = typename enable_if<
2670 using _EnableIfDeleterAssignable _LIBCPP_NODEBUG_TYPE = typename enable_if<
27312671 is_assignable<_Dp&, _UDel&&>::value
27322672 >::type;
27332673
27342674public:
27352675 template <bool _Dummy = true,
2736 class = _EnableIfDeleterDefaultConstructible<_Dummy>>
2676 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
27372677 _LIBCPP_INLINE_VISIBILITY
2738 constexpr unique_ptr() noexcept : __ptr_(pointer()) {}
2678 _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer()) {}
27392679
27402680 template <bool _Dummy = true,
2741 class = _EnableIfDeleterDefaultConstructible<_Dummy>>
2681 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
27422682 _LIBCPP_INLINE_VISIBILITY
2743 constexpr unique_ptr(nullptr_t) noexcept : __ptr_(pointer()) {}
2683 _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer()) {}
27442684
27452685 template <class _Pp, bool _Dummy = true,
27462686 class = _EnableIfDeleterDefaultConstructible<_Dummy>,
2747 class = _EnableIfPointerConvertible<_Pp>>
2687 class = _EnableIfPointerConvertible<_Pp> >
27482688 _LIBCPP_INLINE_VISIBILITY
2749 explicit unique_ptr(_Pp __p) noexcept
2689 explicit unique_ptr(_Pp __p) _NOEXCEPT
27502690 : __ptr_(__p) {}
27512691
27522692 template <class _Pp, bool _Dummy = true,
2753 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy>>,
2754 class = _EnableIfPointerConvertible<_Pp>>
2693 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> >,
2694 class = _EnableIfPointerConvertible<_Pp> >
27552695 _LIBCPP_INLINE_VISIBILITY
2756 unique_ptr(_Pp __p, _LValRefType<_Dummy> __d) noexcept
2696 unique_ptr(_Pp __p, _LValRefType<_Dummy> __d) _NOEXCEPT
27572697 : __ptr_(__p, __d) {}
27582698
27592699 template <bool _Dummy = true,
2760 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy>>>
2700 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > >
27612701 _LIBCPP_INLINE_VISIBILITY
2762 unique_ptr(nullptr_t, _LValRefType<_Dummy> __d) noexcept
2702 unique_ptr(nullptr_t, _LValRefType<_Dummy> __d) _NOEXCEPT
27632703 : __ptr_(nullptr, __d) {}
27642704
27652705 template <class _Pp, bool _Dummy = true,
2766 class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy>>,
2767 class = _EnableIfPointerConvertible<_Pp>>
2706 class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> >,
2707 class = _EnableIfPointerConvertible<_Pp> >
27682708 _LIBCPP_INLINE_VISIBILITY
2769 unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) noexcept
2709 unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT
27702710 : __ptr_(__p, _VSTD::move(__d)) {
27712711 static_assert(!is_reference<deleter_type>::value,
27722712 "rvalue deleter bound to reference");
27732713 }
27742714
27752715 template <bool _Dummy = true,
2776 class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy>>>
2716 class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > >
27772717 _LIBCPP_INLINE_VISIBILITY
2778 unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) noexcept
2718 unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) _NOEXCEPT
27792719 : __ptr_(nullptr, _VSTD::move(__d)) {
27802720 static_assert(!is_reference<deleter_type>::value,
27812721 "rvalue deleter bound to reference");
27822722 }
27832723
27842724 template <class _Pp, bool _Dummy = true,
2785 class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy>>,
2786 class = _EnableIfPointerConvertible<_Pp>>
2725 class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> >,
2726 class = _EnableIfPointerConvertible<_Pp> >
27872727 _LIBCPP_INLINE_VISIBILITY
27882728 unique_ptr(_Pp __p, _BadRValRefType<_Dummy> __d) = delete;
27892729
27902730 _LIBCPP_INLINE_VISIBILITY
2791 unique_ptr(unique_ptr&& __u) noexcept
2731 unique_ptr(unique_ptr&& __u) _NOEXCEPT
27922732 : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {
27932733 }
27942734
27952735 _LIBCPP_INLINE_VISIBILITY
2796 unique_ptr& operator=(unique_ptr&& __u) noexcept {
2736 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT {
27972737 reset(__u.release());
27982738 __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter());
27992739 return *this;
......@@ -2804,7 +2744,7 @@ public:
28042744 class = _EnableIfDeleterConvertible<_Ep>
28052745 >
28062746 _LIBCPP_INLINE_VISIBILITY
2807 unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept
2747 unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT
28082748 : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) {
28092749 }
28102750
......@@ -2814,73 +2754,16 @@ public:
28142754 >
28152755 _LIBCPP_INLINE_VISIBILITY
28162756 unique_ptr&
2817 operator=(unique_ptr<_Up, _Ep>&& __u) noexcept {
2757 operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT {
28182758 reset(__u.release());
28192759 __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
28202760 return *this;
28212761 }
28222762
2823#else // _LIBCPP_CXX03_LANG
2824private:
2825 template <class _Up> explicit unique_ptr(_Up);
2826
2827 unique_ptr(unique_ptr&);
2828 template <class _Up> unique_ptr(unique_ptr<_Up>&);
2829
2830 unique_ptr& operator=(unique_ptr&);
2831 template <class _Up> unique_ptr& operator=(unique_ptr<_Up>&);
2832
2833 template <class _Up>
2834 unique_ptr(_Up __u,
2835 typename conditional<
2836 is_reference<deleter_type>::value, deleter_type,
2837 typename add_lvalue_reference<const deleter_type>::type>::type,
2838 typename enable_if<is_convertible<_Up, pointer>::value,
2839 __nat>::type = __nat());
2840public:
2841 _LIBCPP_INLINE_VISIBILITY
2842 unique_ptr() : __ptr_(pointer()) {
2843 static_assert(!is_pointer<deleter_type>::value,
2844 "unique_ptr constructed with null function pointer deleter");
2845 }
2846 _LIBCPP_INLINE_VISIBILITY
2847 unique_ptr(nullptr_t) : __ptr_(pointer()) {
2848 static_assert(!is_pointer<deleter_type>::value,
2849 "unique_ptr constructed with null function pointer deleter");
2850 }
2851
2852 _LIBCPP_INLINE_VISIBILITY
2853 explicit unique_ptr(pointer __p) : __ptr_(__p) {
2854 static_assert(!is_pointer<deleter_type>::value,
2855 "unique_ptr constructed with null function pointer deleter");
2856 }
2857
2858 _LIBCPP_INLINE_VISIBILITY
2859 unique_ptr(pointer __p, deleter_type __d)
2860 : __ptr_(__p, _VSTD::forward<deleter_type>(__d)) {}
2861
2862 _LIBCPP_INLINE_VISIBILITY
2863 unique_ptr(nullptr_t, deleter_type __d)
2864 : __ptr_(pointer(), _VSTD::forward<deleter_type>(__d)) {}
2865
2866 _LIBCPP_INLINE_VISIBILITY
2867 operator __rv<unique_ptr>() {
2868 return __rv<unique_ptr>(*this);
2869 }
2870
2871 _LIBCPP_INLINE_VISIBILITY
2872 unique_ptr(__rv<unique_ptr> __u)
2873 : __ptr_(__u->release(),
2874 _VSTD::forward<deleter_type>(__u->get_deleter())) {}
2875
2876 _LIBCPP_INLINE_VISIBILITY
2877 unique_ptr& operator=(__rv<unique_ptr> __u) {
2878 reset(__u->release());
2879 __ptr_.second() = _VSTD::forward<deleter_type>(__u->get_deleter());
2880 return *this;
2881 }
2882
2883#endif // _LIBCPP_CXX03_LANG
2763#ifdef _LIBCPP_CXX03_LANG
2764 unique_ptr(unique_ptr const&) = delete;
2765 unique_ptr& operator=(unique_ptr const&) = delete;
2766#endif
28842767
28852768public:
28862769 _LIBCPP_INLINE_VISIBILITY
......@@ -3092,18 +2975,6 @@ operator>=(nullptr_t, const unique_ptr<_T1, _D1>& __x)
30922975 return !(nullptr < __x);
30932976}
30942977
3095#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3096
3097template <class _Tp, class _Dp>
3098inline _LIBCPP_INLINE_VISIBILITY
3099unique_ptr<_Tp, _Dp>
3100move(unique_ptr<_Tp, _Dp>& __t)
3101{
3102 return unique_ptr<_Tp, _Dp>(__rv<unique_ptr<_Tp, _Dp> >(__t));
3103}
3104
3105#endif
3106
31072978#if _LIBCPP_STD_VER > 11
31082979
31092980template<class _Tp>
......@@ -3152,7 +3023,7 @@ template <class _Tp, class _Dp>
31523023struct _LIBCPP_TEMPLATE_VIS hash<unique_ptr<_Tp, _Dp> >
31533024#else
31543025struct _LIBCPP_TEMPLATE_VIS hash<__enable_hash_helper<
3155 unique_ptr<_Tp, _Dp>, typename unique_ptr<_Tp, _Dp>::pointer>>
3026 unique_ptr<_Tp, _Dp>, typename unique_ptr<_Tp, _Dp>::pointer> >
31563027#endif
31573028{
31583029 typedef unique_ptr<_Tp, _Dp> argument_type;
......@@ -3207,10 +3078,10 @@ public:
32073078template <class _Alloc>
32083079class __allocator_destructor
32093080{
3210 typedef allocator_traits<_Alloc> __alloc_traits;
3081 typedef _LIBCPP_NODEBUG_TYPE allocator_traits<_Alloc> __alloc_traits;
32113082public:
3212 typedef typename __alloc_traits::pointer pointer;
3213 typedef typename __alloc_traits::size_type size_type;
3083 typedef _LIBCPP_NODEBUG_TYPE typename __alloc_traits::pointer pointer;
3084 typedef _LIBCPP_NODEBUG_TYPE typename __alloc_traits::size_type size_type;
32143085private:
32153086 _Alloc& __alloc_;
32163087 size_type __s_;
......@@ -3467,7 +3338,7 @@ uninitialized_move_n(_InputIt __first, _Size __n, _ForwardIt __first_res) {
34673338 && defined(__ATOMIC_RELAXED) \
34683339 && defined(__ATOMIC_ACQ_REL)
34693340# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
3470#elif !defined(__clang__) && defined(_GNUC_VER) && _GNUC_VER >= 407
3341#elif defined(_LIBCPP_COMPILER_GCC)
34713342# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
34723343#endif
34733344
......@@ -5669,6 +5540,52 @@ struct __is_allocator<_Alloc,
56695540 >
56705541 : true_type {};
56715542
5543// __builtin_new_allocator -- A non-templated helper for allocating and
5544// deallocating memory using __builtin_operator_new and
5545// __builtin_operator_delete. It should be used in preference to
5546// `std::allocator<T>` to avoid additional instantiations.
5547struct __builtin_new_allocator {
5548 struct __builtin_new_deleter {
5549 typedef void* pointer_type;
5550
5551 _LIBCPP_CONSTEXPR explicit __builtin_new_deleter(size_t __size, size_t __align)
5552 : __size_(__size), __align_(__align) {}
5553
5554 void operator()(void* p) const _NOEXCEPT {
5555 std::__libcpp_deallocate(p, __size_, __align_);
5556 }
5557
5558 private:
5559 size_t __size_;
5560 size_t __align_;
5561 };
5562
5563 typedef unique_ptr<void, __builtin_new_deleter> __holder_t;
5564
5565 static __holder_t __allocate_bytes(size_t __s, size_t __align) {
5566 return __holder_t(std::__libcpp_allocate(__s, __align),
5567 __builtin_new_deleter(__s, __align));
5568 }
5569
5570 static void __deallocate_bytes(void* __p, size_t __s,
5571 size_t __align) _NOEXCEPT {
5572 std::__libcpp_deallocate(__p, __s, __align);
5573 }
5574
5575 template <class _Tp>
5576 _LIBCPP_NODEBUG _LIBCPP_ALWAYS_INLINE
5577 static __holder_t __allocate_type(size_t __n) {
5578 return __allocate_bytes(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
5579 }
5580
5581 template <class _Tp>
5582 _LIBCPP_NODEBUG _LIBCPP_ALWAYS_INLINE
5583 static void __deallocate_type(void* __p, size_t __n) _NOEXCEPT {
5584 __deallocate_bytes(__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
5585 }
5586};
5587
5588
56725589_LIBCPP_END_NAMESPACE_STD
56735590
56745591_LIBCPP_POP_MACROS
lib/libcxx/include/module.modulemap+4-1
......@@ -24,7 +24,10 @@ module std [system] {
2424 header "errno.h"
2525 export *
2626 }
27 // <fenv.h> provided by C library.
27 module fenv_h {
28 header "fenv.h"
29 export *
30 }
2831 // <float.h> provided by compiler or C library.
2932 module inttypes_h {
3033 header "inttypes.h"
lib/libcxx/include/mutex+17-9
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- mutex ------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -189,6 +188,7 @@ template<class Callable, class ...Args>
189188
190189#include <__config>
191190#include <__mutex_base>
191#include <cstdint>
192192#include <functional>
193193#include <memory>
194194#ifndef _LIBCPP_CXX03_LANG
......@@ -576,11 +576,18 @@ struct _LIBCPP_TEMPLATE_VIS once_flag
576576 _LIBCPP_CONSTEXPR
577577 once_flag() _NOEXCEPT : __state_(0) {}
578578
579#if defined(_LIBCPP_ABI_MICROSOFT)
580 typedef uintptr_t _State_type;
581#else
582 typedef unsigned long _State_type;
583#endif
584
585
579586private:
580587 once_flag(const once_flag&); // = delete;
581588 once_flag& operator=(const once_flag&); // = delete;
582589
583 unsigned long __state_;
590 _State_type __state_;
584591
585592#ifndef _LIBCPP_CXX03_LANG
586593 template<class _Callable, class... _Args>
......@@ -650,7 +657,8 @@ __call_once_proxy(void* __vp)
650657 (*__p)();
651658}
652659
653_LIBCPP_FUNC_VIS void __call_once(volatile unsigned long&, void*, void(*)(void*));
660_LIBCPP_FUNC_VIS void __call_once(volatile once_flag::_State_type&, void*,
661 void (*)(void*));
654662
655663#ifndef _LIBCPP_CXX03_LANG
656664
......@@ -659,7 +667,7 @@ inline _LIBCPP_INLINE_VISIBILITY
659667void
660668call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
661669{
662 if (__libcpp_acquire_load(&__flag.__state_) != ~0ul)
670 if (__libcpp_acquire_load(&__flag.__state_) != ~once_flag::_State_type(0))
663671 {
664672 typedef tuple<_Callable&&, _Args&&...> _Gp;
665673 _Gp __f(_VSTD::forward<_Callable>(__func), _VSTD::forward<_Args>(__args)...);
......@@ -675,7 +683,7 @@ inline _LIBCPP_INLINE_VISIBILITY
675683void
676684call_once(once_flag& __flag, _Callable& __func)
677685{
678 if (__libcpp_acquire_load(&__flag.__state_) != ~0ul)
686 if (__libcpp_acquire_load(&__flag.__state_) != ~once_flag::_State_type(0))
679687 {
680688 __call_once_param<_Callable> __p(__func);
681689 __call_once(__flag.__state_, &__p, &__call_once_proxy<_Callable>);
......@@ -687,7 +695,7 @@ inline _LIBCPP_INLINE_VISIBILITY
687695void
688696call_once(once_flag& __flag, const _Callable& __func)
689697{
690 if (__libcpp_acquire_load(&__flag.__state_) != ~0ul)
698 if (__libcpp_acquire_load(&__flag.__state_) != ~once_flag::_State_type(0))
691699 {
692700 __call_once_param<const _Callable> __p(__func);
693701 __call_once(__flag.__state_, &__p, &__call_once_proxy<const _Callable>);
lib/libcxx/include/new+28-14
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------------- new ------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -34,6 +33,12 @@ public:
3433};
3534
3635enum class align_val_t : size_t {}; // C++17
36
37struct destroying_delete_t { // C++20
38 explicit destroying_delete_t() = default;
39};
40inline constexpr destroying_delete_t destroying_delete{}; // C++20
41
3742struct nothrow_t {};
3843extern const nothrow_t nothrow;
3944typedef void (*new_handler)();
......@@ -90,7 +95,7 @@ void operator delete[](void* ptr, void*) noexcept;
9095#include <cstdlib>
9196#endif
9297
93#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)
98#if defined(_LIBCPP_ABI_VCRUNTIME)
9499#include <new.h>
95100#endif
96101
......@@ -120,7 +125,7 @@ void operator delete[](void* ptr, void*) noexcept;
120125namespace std // purposefully not using versioning namespace
121126{
122127
123#if !defined(_LIBCPP_ABI_MICROSOFT) || defined(_LIBCPP_NO_VCRUNTIME)
128#if !defined(_LIBCPP_ABI_VCRUNTIME)
124129struct _LIBCPP_TYPE_VIS nothrow_t {};
125130extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
126131
......@@ -146,12 +151,12 @@ typedef void (*new_handler)();
146151_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;
147152_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
148153
149#endif // !_LIBCPP_ABI_MICROSOFT || _LIBCPP_NO_VCRUNTIME
154#endif // !_LIBCPP_ABI_VCRUNTIME
150155
151156_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec
152157
153158#if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) && \
154 !defined(_LIBCPP_DEFER_NEW_TO_VCRUNTIME)
159 !defined(_LIBCPP_ABI_VCRUNTIME)
155160#ifndef _LIBCPP_CXX03_LANG
156161enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };
157162#else
......@@ -159,6 +164,15 @@ enum align_val_t { __zero = 0, __max = (size_t)-1 };
159164#endif
160165#endif
161166
167#if _LIBCPP_STD_VER > 17
168// Enable the declaration even if the compiler doesn't support the language
169// feature.
170struct destroying_delete_t {
171 explicit destroying_delete_t() = default;
172};
173_LIBCPP_INLINE_VAR constexpr destroying_delete_t destroying_delete{};
174#endif // _LIBCPP_STD_VER > 17
175
162176} // std
163177
164178#if defined(_LIBCPP_CXX03_LANG)
......@@ -167,10 +181,10 @@ enum align_val_t { __zero = 0, __max = (size_t)-1 };
167181#define _THROW_BAD_ALLOC
168182#endif
169183
170#if !defined(_LIBCPP_DEFER_NEW_TO_VCRUNTIME)
184#if !defined(_LIBCPP_ABI_VCRUNTIME)
171185
172186_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC;
173_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
187_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
174188_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
175189_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
176190#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
......@@ -178,7 +192,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operato
178192#endif
179193
180194_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC;
181_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
195_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
182196_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT;
183197_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
184198#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
......@@ -187,7 +201,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operato
187201
188202#ifndef _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
189203_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
190_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
204_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
191205_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT;
192206_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
193207#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
......@@ -195,7 +209,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operato
195209#endif
196210
197211_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
198_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
212_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
199213_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT;
200214_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
201215#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
......@@ -208,7 +222,7 @@ _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator ne
208222inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
209223inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT {}
210224
211#endif // !_LIBCPP_DEFER_NEW_TO_VCRUNTIME
225#endif // !_LIBCPP_ABI_VCRUNTIME
212226
213227_LIBCPP_BEGIN_NAMESPACE_STD
214228
lib/libcxx/include/numeric+73-11
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- numeric ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -134,6 +133,10 @@ template <class M, class N>
134133template <class M, class N>
135134 constexpr common_type_t<M,N> lcm(M m, N n); // C++17
136135
136integer midpoint(integer a, integer b); // C++20
137pointer midpoint(pointer a, pointer b); // C++20
138floating_point midpoint(floating_point a, floating_point b); // C++20
139
137140} // std
138141
139142*/
......@@ -142,6 +145,7 @@ template <class M, class N>
142145#include <iterator>
143146#include <limits> // for numeric_limits
144147#include <functional>
148#include <cmath> // for isnormal
145149#include <version>
146150
147151#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -456,10 +460,10 @@ iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_)
456460
457461
458462#if _LIBCPP_STD_VER > 14
459template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __abs;
463template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __ct_abs;
460464
461465template <typename _Result, typename _Source>
462struct __abs<_Result, _Source, true> {
466struct __ct_abs<_Result, _Source, true> {
463467 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
464468 _Result operator()(_Source __t) const noexcept
465469 {
......@@ -470,7 +474,7 @@ struct __abs<_Result, _Source, true> {
470474};
471475
472476template <typename _Result, typename _Source>
473struct __abs<_Result, _Source, false> {
477struct __ct_abs<_Result, _Source, false> {
474478 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
475479 _Result operator()(_Source __t) const noexcept { return __t; }
476480};
......@@ -496,8 +500,8 @@ gcd(_Tp __m, _Up __n)
496500 using _Rp = common_type_t<_Tp,_Up>;
497501 using _Wp = make_unsigned_t<_Rp>;
498502 return static_cast<_Rp>(_VSTD::__gcd(
499 static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)),
500 static_cast<_Wp>(__abs<_Rp, _Up>()(__n))));
503 static_cast<_Wp>(__ct_abs<_Rp, _Tp>()(__m)),
504 static_cast<_Wp>(__ct_abs<_Rp, _Up>()(__n))));
501505}
502506
503507template<class _Tp, class _Up>
......@@ -512,14 +516,72 @@ lcm(_Tp __m, _Up __n)
512516 return 0;
513517
514518 using _Rp = common_type_t<_Tp,_Up>;
515 _Rp __val1 = __abs<_Rp, _Tp>()(__m) / _VSTD::gcd(__m, __n);
516 _Rp __val2 = __abs<_Rp, _Up>()(__n);
519 _Rp __val1 = __ct_abs<_Rp, _Tp>()(__m) / _VSTD::gcd(__m, __n);
520 _Rp __val2 = __ct_abs<_Rp, _Up>()(__n);
517521 _LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");
518522 return __val1 * __val2;
519523}
520524
521525#endif /* _LIBCPP_STD_VER > 14 */
522526
527#if _LIBCPP_STD_VER > 17
528template <class _Tp>
529_LIBCPP_INLINE_VISIBILITY constexpr
530enable_if_t<is_integral_v<_Tp> && !is_same_v<bool, _Tp> && !is_null_pointer_v<_Tp>, _Tp>
531midpoint(_Tp __a, _Tp __b) noexcept
532_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
533{
534 using _Up = std::make_unsigned_t<_Tp>;
535
536 int __sign = 1;
537 _Up __m = __a;
538 _Up __M = __b;
539 if (__a > __b)
540 {
541 __sign = -1;
542 __m = __b;
543 __M = __a;
544 }
545 return __a + __sign * _Tp(_Up(__M-__m) >> 1);
546}
547
548
549template <class _TPtr>
550_LIBCPP_INLINE_VISIBILITY constexpr
551enable_if_t<is_pointer_v<_TPtr>
552 && is_object_v<remove_pointer_t<_TPtr>>
553 && ! is_void_v<remove_pointer_t<_TPtr>>
554 && (sizeof(remove_pointer_t<_TPtr>) > 0), _TPtr>
555midpoint(_TPtr __a, _TPtr __b) noexcept
556{
557 return __a + _VSTD::midpoint(ptrdiff_t(0), __b - __a);
558}
559
560
561template <typename _Tp>
562constexpr int __sign(_Tp __val) {
563 return (_Tp(0) < __val) - (__val < _Tp(0));
564}
565
566template <typename _Fp>
567constexpr _Fp __fp_abs(_Fp __f) { return __f >= 0 ? __f : -__f; }
568
569template <class _Fp>
570_LIBCPP_INLINE_VISIBILITY constexpr
571enable_if_t<is_floating_point_v<_Fp>, _Fp>
572midpoint(_Fp __a, _Fp __b) noexcept
573{
574 constexpr _Fp __lo = numeric_limits<_Fp>::min()*2;
575 constexpr _Fp __hi = numeric_limits<_Fp>::max()/2;
576 return __fp_abs(__a) <= __hi && __fp_abs(__b) <= __hi ? // typical case: overflow is impossible
577 (__a + __b)/2 : // always correctly rounded
578 __fp_abs(__a) < __lo ? __a + __b/2 : // not safe to halve a
579 __fp_abs(__a) < __lo ? __a/2 + __b : // not safe to halve b
580 __a/2 + __b/2; // otherwise correctly rounded
581}
582
583#endif // _LIBCPP_STD_VER > 17
584
523585_LIBCPP_END_NAMESPACE_STD
524586
525587_LIBCPP_POP_MACROS
lib/libcxx/include/optional+60-54
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- optional ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -593,7 +592,7 @@ public:
593592
594593private:
595594 // Disable the reference extension using this static assert.
596 static_assert(!is_same_v<value_type, in_place_t>,
595 static_assert(!is_same_v<__uncvref_t<value_type>, in_place_t>,
597596 "instantiation of optional with in_place_t is ill-formed");
598597 static_assert(!is_same_v<__uncvref_t<value_type>, nullopt_t>,
599598 "instantiation of optional with nullopt_t is ill-formed");
......@@ -601,6 +600,8 @@ private:
601600 "instantiation of optional with a reference type is ill-formed");
602601 static_assert(is_destructible_v<value_type>,
603602 "instantiation of optional with a non-destructible type is ill-formed");
603 static_assert(!is_array_v<value_type>,
604 "instantiation of optional with an array type is ill-formed");
604605
605606 // LWG2756: conditionally explicit conversion from _Up
606607 struct _CheckOptionalArgsConstructor {
......@@ -617,16 +618,16 @@ private:
617618 }
618619 };
619620 template <class _Up>
620 using _CheckOptionalArgsCtor = conditional_t<
621 !is_same_v<__uncvref_t<_Up>, in_place_t> &&
622 !is_same_v<__uncvref_t<_Up>, optional>,
621 using _CheckOptionalArgsCtor = _If<
622 _IsNotSame<__uncvref_t<_Up>, in_place_t>::value &&
623 _IsNotSame<__uncvref_t<_Up>, optional>::value,
623624 _CheckOptionalArgsConstructor,
624625 __check_tuple_constructor_fail
625626 >;
626627 template <class _QualUp>
627628 struct _CheckOptionalLikeConstructor {
628629 template <class _Up, class _Opt = optional<_Up>>
629 using __check_constructible_from_opt = __lazy_or<
630 using __check_constructible_from_opt = _Or<
630631 is_constructible<_Tp, _Opt&>,
631632 is_constructible<_Tp, _Opt const&>,
632633 is_constructible<_Tp, _Opt&&>,
......@@ -637,7 +638,7 @@ private:
637638 is_convertible<_Opt const&&, _Tp>
638639 >;
639640 template <class _Up, class _Opt = optional<_Up>>
640 using __check_assignable_from_opt = __lazy_or<
641 using __check_assignable_from_opt = _Or<
641642 is_assignable<_Tp&, _Opt&>,
642643 is_assignable<_Tp&, _Opt const&>,
643644 is_assignable<_Tp&, _Opt&&>,
......@@ -663,18 +664,18 @@ private:
663664 };
664665
665666 template <class _Up, class _QualUp>
666 using _CheckOptionalLikeCtor = conditional_t<
667 __lazy_and<
668 __lazy_not<is_same<_Up, _Tp>>,
667 using _CheckOptionalLikeCtor = _If<
668 _And<
669 _IsNotSame<_Up, _Tp>,
669670 is_constructible<_Tp, _QualUp>
670671 >::value,
671672 _CheckOptionalLikeConstructor<_QualUp>,
672673 __check_tuple_constructor_fail
673674 >;
674675 template <class _Up, class _QualUp>
675 using _CheckOptionalLikeAssign = conditional_t<
676 __lazy_and<
677 __lazy_not<is_same<_Up, _Tp>>,
676 using _CheckOptionalLikeAssign = _If<
677 _And<
678 _IsNotSame<_Up, _Tp>,
678679 is_constructible<_Tp, _QualUp>,
679680 is_assignable<_Tp&, _QualUp>
680681 >::value,
......@@ -688,28 +689,32 @@ public:
688689 _LIBCPP_INLINE_VISIBILITY constexpr optional(optional&&) = default;
689690 _LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {}
690691
691 template <class... _Args, class = enable_if_t<
692 is_constructible_v<value_type, _Args...>>
692 template <class _InPlaceT, class... _Args, class = _EnableIf<
693 _And<
694 _IsSame<_InPlaceT, in_place_t>,
695 is_constructible<value_type, _Args...>
696 >::value
697 >
693698 >
694699 _LIBCPP_INLINE_VISIBILITY
695 constexpr explicit optional(in_place_t, _Args&&... __args)
700 constexpr explicit optional(_InPlaceT, _Args&&... __args)
696701 : __base(in_place, _VSTD::forward<_Args>(__args)...) {}
697702
698 template <class _Up, class... _Args, class = enable_if_t<
703 template <class _Up, class... _Args, class = _EnableIf<
699704 is_constructible_v<value_type, initializer_list<_Up>&, _Args...>>
700705 >
701706 _LIBCPP_INLINE_VISIBILITY
702707 constexpr explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
703708 : __base(in_place, __il, _VSTD::forward<_Args>(__args)...) {}
704709
705 template <class _Up = value_type, enable_if_t<
710 template <class _Up = value_type, _EnableIf<
706711 _CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>()
707712 , int> = 0>
708713 _LIBCPP_INLINE_VISIBILITY
709714 constexpr optional(_Up&& __v)
710715 : __base(in_place, _VSTD::forward<_Up>(__v)) {}
711716
712 template <class _Up, enable_if_t<
717 template <class _Up, _EnableIf<
713718 _CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>()
714719 , int> = 0>
715720 _LIBCPP_INLINE_VISIBILITY
......@@ -717,7 +722,7 @@ public:
717722 : __base(in_place, _VSTD::forward<_Up>(__v)) {}
718723
719724 // LWG2756: conditionally explicit conversion from const optional<_Up>&
720 template <class _Up, enable_if_t<
725 template <class _Up, _EnableIf<
721726 _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>()
722727 , int> = 0>
723728 _LIBCPP_INLINE_VISIBILITY
......@@ -725,7 +730,7 @@ public:
725730 {
726731 this->__construct_from(__v);
727732 }
728 template <class _Up, enable_if_t<
733 template <class _Up, _EnableIf<
729734 _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>()
730735 , int> = 0>
731736 _LIBCPP_INLINE_VISIBILITY
......@@ -735,7 +740,7 @@ public:
735740 }
736741
737742 // LWG2756: conditionally explicit conversion from optional<_Up>&&
738 template <class _Up, enable_if_t<
743 template <class _Up, _EnableIf<
739744 _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_implicit<_Up>()
740745 , int> = 0>
741746 _LIBCPP_INLINE_VISIBILITY
......@@ -743,7 +748,7 @@ public:
743748 {
744749 this->__construct_from(_VSTD::move(__v));
745750 }
746 template <class _Up, enable_if_t<
751 template <class _Up, _EnableIf<
747752 _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_explicit<_Up>()
748753 , int> = 0>
749754 _LIBCPP_INLINE_VISIBILITY
......@@ -764,11 +769,12 @@ public:
764769
765770 // LWG2756
766771 template <class _Up = value_type,
767 class = enable_if_t
768 <__lazy_and<
769 integral_constant<bool,
770 !is_same_v<__uncvref_t<_Up>, optional> &&
771 !(is_same_v<_Up, value_type> && is_scalar_v<value_type>)
772 class = _EnableIf<
773 _And<
774 _IsNotSame<__uncvref_t<_Up>, optional>,
775 _Or<
776 _IsNotSame<__uncvref_t<_Up>, value_type>,
777 _Not<is_scalar<value_type>>
772778 >,
773779 is_constructible<value_type, _Up>,
774780 is_assignable<value_type&, _Up>
......@@ -786,7 +792,7 @@ public:
786792 }
787793
788794 // LWG2756
789 template <class _Up, enable_if_t<
795 template <class _Up, _EnableIf<
790796 _CheckOptionalLikeAssign<_Up, _Up const&>::template __enable_assign<_Up>()
791797 , int> = 0>
792798 _LIBCPP_INLINE_VISIBILITY
......@@ -798,7 +804,7 @@ public:
798804 }
799805
800806 // LWG2756
801 template <class _Up, enable_if_t<
807 template <class _Up, _EnableIf<
802808 _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_assign<_Up>()
803809 , int> = 0>
804810 _LIBCPP_INLINE_VISIBILITY
......@@ -810,7 +816,7 @@ public:
810816 }
811817
812818 template <class... _Args,
813 class = enable_if_t
819 class = _EnableIf
814820 <
815821 is_constructible_v<value_type, _Args...>
816822 >
......@@ -825,7 +831,7 @@ public:
825831 }
826832
827833 template <class _Up, class... _Args,
828 class = enable_if_t
834 class = _EnableIf
829835 <
830836 is_constructible_v<value_type, initializer_list<_Up>&, _Args...>
831837 >
......@@ -1021,7 +1027,7 @@ template<class T>
10211027// Comparisons between optionals
10221028template <class _Tp, class _Up>
10231029_LIBCPP_INLINE_VISIBILITY constexpr
1024enable_if_t<
1030_EnableIf<
10251031 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() ==
10261032 _VSTD::declval<const _Up&>()), bool>,
10271033 bool
......@@ -1037,7 +1043,7 @@ operator==(const optional<_Tp>& __x, const optional<_Up>& __y)
10371043
10381044template <class _Tp, class _Up>
10391045_LIBCPP_INLINE_VISIBILITY constexpr
1040enable_if_t<
1046_EnableIf<
10411047 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() !=
10421048 _VSTD::declval<const _Up&>()), bool>,
10431049 bool
......@@ -1053,7 +1059,7 @@ operator!=(const optional<_Tp>& __x, const optional<_Up>& __y)
10531059
10541060template <class _Tp, class _Up>
10551061_LIBCPP_INLINE_VISIBILITY constexpr
1056enable_if_t<
1062_EnableIf<
10571063 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <
10581064 _VSTD::declval<const _Up&>()), bool>,
10591065 bool
......@@ -1069,7 +1075,7 @@ operator<(const optional<_Tp>& __x, const optional<_Up>& __y)
10691075
10701076template <class _Tp, class _Up>
10711077_LIBCPP_INLINE_VISIBILITY constexpr
1072enable_if_t<
1078_EnableIf<
10731079 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >
10741080 _VSTD::declval<const _Up&>()), bool>,
10751081 bool
......@@ -1085,7 +1091,7 @@ operator>(const optional<_Tp>& __x, const optional<_Up>& __y)
10851091
10861092template <class _Tp, class _Up>
10871093_LIBCPP_INLINE_VISIBILITY constexpr
1088enable_if_t<
1094_EnableIf<
10891095 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <=
10901096 _VSTD::declval<const _Up&>()), bool>,
10911097 bool
......@@ -1101,7 +1107,7 @@ operator<=(const optional<_Tp>& __x, const optional<_Up>& __y)
11011107
11021108template <class _Tp, class _Up>
11031109_LIBCPP_INLINE_VISIBILITY constexpr
1104enable_if_t<
1110_EnableIf<
11051111 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >=
11061112 _VSTD::declval<const _Up&>()), bool>,
11071113 bool
......@@ -1215,7 +1221,7 @@ operator>=(nullopt_t, const optional<_Tp>& __x) noexcept
12151221// Comparisons with T
12161222template <class _Tp, class _Up>
12171223_LIBCPP_INLINE_VISIBILITY constexpr
1218enable_if_t<
1224_EnableIf<
12191225 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() ==
12201226 _VSTD::declval<const _Up&>()), bool>,
12211227 bool
......@@ -1227,7 +1233,7 @@ operator==(const optional<_Tp>& __x, const _Up& __v)
12271233
12281234template <class _Tp, class _Up>
12291235_LIBCPP_INLINE_VISIBILITY constexpr
1230enable_if_t<
1236_EnableIf<
12311237 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() ==
12321238 _VSTD::declval<const _Up&>()), bool>,
12331239 bool
......@@ -1239,7 +1245,7 @@ operator==(const _Tp& __v, const optional<_Up>& __x)
12391245
12401246template <class _Tp, class _Up>
12411247_LIBCPP_INLINE_VISIBILITY constexpr
1242enable_if_t<
1248_EnableIf<
12431249 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() !=
12441250 _VSTD::declval<const _Up&>()), bool>,
12451251 bool
......@@ -1251,7 +1257,7 @@ operator!=(const optional<_Tp>& __x, const _Up& __v)
12511257
12521258template <class _Tp, class _Up>
12531259_LIBCPP_INLINE_VISIBILITY constexpr
1254enable_if_t<
1260_EnableIf<
12551261 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() !=
12561262 _VSTD::declval<const _Up&>()), bool>,
12571263 bool
......@@ -1263,7 +1269,7 @@ operator!=(const _Tp& __v, const optional<_Up>& __x)
12631269
12641270template <class _Tp, class _Up>
12651271_LIBCPP_INLINE_VISIBILITY constexpr
1266enable_if_t<
1272_EnableIf<
12671273 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <
12681274 _VSTD::declval<const _Up&>()), bool>,
12691275 bool
......@@ -1275,7 +1281,7 @@ operator<(const optional<_Tp>& __x, const _Up& __v)
12751281
12761282template <class _Tp, class _Up>
12771283_LIBCPP_INLINE_VISIBILITY constexpr
1278enable_if_t<
1284_EnableIf<
12791285 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <
12801286 _VSTD::declval<const _Up&>()), bool>,
12811287 bool
......@@ -1287,7 +1293,7 @@ operator<(const _Tp& __v, const optional<_Up>& __x)
12871293
12881294template <class _Tp, class _Up>
12891295_LIBCPP_INLINE_VISIBILITY constexpr
1290enable_if_t<
1296_EnableIf<
12911297 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <=
12921298 _VSTD::declval<const _Up&>()), bool>,
12931299 bool
......@@ -1299,7 +1305,7 @@ operator<=(const optional<_Tp>& __x, const _Up& __v)
12991305
13001306template <class _Tp, class _Up>
13011307_LIBCPP_INLINE_VISIBILITY constexpr
1302enable_if_t<
1308_EnableIf<
13031309 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <=
13041310 _VSTD::declval<const _Up&>()), bool>,
13051311 bool
......@@ -1311,7 +1317,7 @@ operator<=(const _Tp& __v, const optional<_Up>& __x)
13111317
13121318template <class _Tp, class _Up>
13131319_LIBCPP_INLINE_VISIBILITY constexpr
1314enable_if_t<
1320_EnableIf<
13151321 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >
13161322 _VSTD::declval<const _Up&>()), bool>,
13171323 bool
......@@ -1323,7 +1329,7 @@ operator>(const optional<_Tp>& __x, const _Up& __v)
13231329
13241330template <class _Tp, class _Up>
13251331_LIBCPP_INLINE_VISIBILITY constexpr
1326enable_if_t<
1332_EnableIf<
13271333 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >
13281334 _VSTD::declval<const _Up&>()), bool>,
13291335 bool
......@@ -1335,7 +1341,7 @@ operator>(const _Tp& __v, const optional<_Up>& __x)
13351341
13361342template <class _Tp, class _Up>
13371343_LIBCPP_INLINE_VISIBILITY constexpr
1338enable_if_t<
1344_EnableIf<
13391345 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >=
13401346 _VSTD::declval<const _Up&>()), bool>,
13411347 bool
......@@ -1347,7 +1353,7 @@ operator>=(const optional<_Tp>& __x, const _Up& __v)
13471353
13481354template <class _Tp, class _Up>
13491355_LIBCPP_INLINE_VISIBILITY constexpr
1350enable_if_t<
1356_EnableIf<
13511357 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >=
13521358 _VSTD::declval<const _Up&>()), bool>,
13531359 bool
......@@ -1360,7 +1366,7 @@ operator>=(const _Tp& __v, const optional<_Up>& __x)
13601366
13611367template <class _Tp>
13621368inline _LIBCPP_INLINE_VISIBILITY
1363enable_if_t<
1369_EnableIf<
13641370 is_move_constructible_v<_Tp> && is_swappable_v<_Tp>,
13651371 void
13661372>
lib/libcxx/include/ostream+8-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- ostream -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -57,6 +56,7 @@ public:
5756 basic_ostream& operator<<(long double f);
5857 basic_ostream& operator<<(const void* p);
5958 basic_ostream& operator<<(basic_streambuf<char_type,traits>* sb);
59 basic_ostream& operator<<(nullptr_t);
6060
6161 // 27.7.2.7 Unformatted output:
6262 basic_ostream& put(char_type c);
......@@ -219,6 +219,10 @@ public:
219219 basic_ostream& operator<<(const void* __p);
220220 basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb);
221221
222 _LIBCPP_INLINE_VISIBILITY
223 basic_ostream& operator<<(nullptr_t)
224 { return *this << "nullptr"; }
225
222226 // 27.7.2.7 Unformatted output:
223227 basic_ostream& put(char_type __c);
224228 basic_ostream& write(const char_type* __s, streamsize __n);
lib/libcxx/include/queue+13-14
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- queue ------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -71,8 +70,8 @@ public:
7170
7271template<class Container>
7372 queue(Container) -> queue<typename Container::value_type, Container>; // C++17
74
75template<class Container, class Allocator>
73
74template<class Container, class Allocator>
7675 queue(Container, Allocator) -> queue<typename Container::value_type, Container>; // C++17
7776
7877template <class T, class Container>
......@@ -166,13 +165,13 @@ public:
166165template <class Compare, class Container>
167166priority_queue(Compare, Container)
168167 -> priority_queue<typename Container::value_type, Container, Compare>; // C++17
169
170template<class InputIterator,
168
169template<class InputIterator,
171170 class Compare = less<typename iterator_traits<InputIterator>::value_type>,
172171 class Container = vector<typename iterator_traits<InputIterator>::value_type>>
173172priority_queue(InputIterator, InputIterator, Compare = Compare(), Container = Container())
174173 -> priority_queue<typename iterator_traits<InputIterator>::value_type, Container, Compare>; // C++17
175
174
176175template<class Compare, class Container, class Allocator>
177176priority_queue(Compare, Container, Allocator)
178177 -> priority_queue<typename Container::value_type, Container, Compare>; // C++17
......@@ -347,7 +346,7 @@ template<class _Container,
347346>
348347queue(_Container)
349348 -> queue<typename _Container::value_type, _Container>;
350
349
351350template<class _Container,
352351 class _Alloc,
353352 class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type,
......@@ -559,8 +558,8 @@ template <class _Compare,
559558>
560559priority_queue(_Compare, _Container)
561560 -> priority_queue<typename _Container::value_type, _Container, _Compare>;
562
563template<class _InputIterator,
561
562template<class _InputIterator,
564563 class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,
565564 class _Container = vector<typename iterator_traits<_InputIterator>::value_type>,
566565 class = typename enable_if< __is_input_iterator<_InputIterator>::value, nullptr_t>::type,
......@@ -569,8 +568,8 @@ template<class _InputIterator,
569568>
570569priority_queue(_InputIterator, _InputIterator, _Compare = _Compare(), _Container = _Container())
571570 -> priority_queue<typename iterator_traits<_InputIterator>::value_type, _Container, _Compare>;
572
573template<class _Compare,
571
572template<class _Compare,
574573 class _Container,
575574 class _Alloc,
576575 class = typename enable_if<!__is_allocator<_Compare>::value, nullptr_t>::type,
lib/libcxx/include/random+11-12
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- random -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -2227,19 +2226,19 @@ template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
22272226template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
22282227 _UIntType __a, size_t __u, _UIntType __d, size_t __s,
22292228 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
2230 _LIBCPP_CONSTEXPR const size_t
2229 _LIBCPP_CONSTEXPR const size_t
22312230 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::state_size;
22322231
22332232template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
22342233 _UIntType __a, size_t __u, _UIntType __d, size_t __s,
22352234 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
2236 _LIBCPP_CONSTEXPR const size_t
2235 _LIBCPP_CONSTEXPR const size_t
22372236 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::shift_size;
22382237
22392238template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
22402239 _UIntType __a, size_t __u, _UIntType __d, size_t __s,
22412240 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
2242 _LIBCPP_CONSTEXPR const size_t
2241 _LIBCPP_CONSTEXPR const size_t
22432242 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::mask_bits;
22442243
22452244template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
......@@ -2251,7 +2250,7 @@ template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
22512250template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
22522251 _UIntType __a, size_t __u, _UIntType __d, size_t __s,
22532252 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
2254 _LIBCPP_CONSTEXPR const size_t
2253 _LIBCPP_CONSTEXPR const size_t
22552254 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_u;
22562255
22572256template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
......@@ -2263,7 +2262,7 @@ template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
22632262template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
22642263 _UIntType __a, size_t __u, _UIntType __d, size_t __s,
22652264 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
2266 _LIBCPP_CONSTEXPR const size_t
2265 _LIBCPP_CONSTEXPR const size_t
22672266 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_s;
22682267
22692268template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
......@@ -2275,7 +2274,7 @@ template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
22752274template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
22762275 _UIntType __a, size_t __u, _UIntType __d, size_t __s,
22772276 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
2278 _LIBCPP_CONSTEXPR const size_t
2277 _LIBCPP_CONSTEXPR const size_t
22792278 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_t;
22802279
22812280template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
......@@ -2287,7 +2286,7 @@ template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
22872286template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
22882287 _UIntType __a, size_t __u, _UIntType __d, size_t __s,
22892288 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
2290 _LIBCPP_CONSTEXPR const size_t
2289 _LIBCPP_CONSTEXPR const size_t
22912290 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_l;
22922291
22932292template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
......@@ -6427,7 +6426,7 @@ public:
64276426 param_type(size_t __nw, result_type __xmin, result_type __xmax,
64286427 _UnaryOperation __fw);
64296428 param_type & operator=(const param_type& __rhs);
6430
6429
64316430 _LIBCPP_INLINE_VISIBILITY
64326431 vector<result_type> intervals() const {return __b_;}
64336432 _LIBCPP_INLINE_VISIBILITY
lib/libcxx/include/ratio+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- ratio -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/regex+89-46
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- regex ------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -678,7 +677,7 @@ public:
678677 regex_constants::match_flag_type m = regex_constants::match_default);
679678 regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
680679 const regex_type&& __re,
681 regex_constants::match_flag_type __m
680 regex_constants::match_flag_type __m
682681 = regex_constants::match_default) = delete; // C++14
683682 regex_iterator(const regex_iterator&);
684683 regex_iterator& operator=(const regex_iterator&);
......@@ -794,7 +793,11 @@ enum syntax_option_type
794793 nosubs = 1 << 1,
795794 optimize = 1 << 2,
796795 collate = 1 << 3,
796#ifdef _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
797 ECMAScript = 1 << 9,
798#else
797799 ECMAScript = 0,
800#endif
798801 basic = 1 << 4,
799802 extended = 1 << 5,
800803 awk = 1 << 6,
......@@ -802,6 +805,16 @@ enum syntax_option_type
802805 egrep = 1 << 8
803806};
804807
808inline _LIBCPP_CONSTEXPR
809syntax_option_type __get_grammar(syntax_option_type __g)
810{
811#ifdef _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
812 return static_cast<syntax_option_type>(__g & 0x3F0);
813#else
814 return static_cast<syntax_option_type>(__g & 0x1F0);
815#endif
816}
817
805818inline _LIBCPP_INLINE_VISIBILITY
806819_LIBCPP_CONSTEXPR
807820syntax_option_type
......@@ -988,16 +1001,7 @@ public:
9881001 typedef locale locale_type;
9891002 typedef ctype_base::mask char_class_type;
9901003
991#if defined(__mips__) && defined(__GLIBC__)
992 static const char_class_type __regex_word = static_cast<char_class_type>(_ISbit(15));
993#elif defined(__NetBSD__)
994 // NetBSD defines classes up to 0x2000
995 // see sys/ctype_bits.h, _CTYPE_Q
996 static const char_class_type __regex_word = 0x8000;
997#else
998 static const char_class_type __regex_word = 0x80;
999#endif
1000
1004 static const char_class_type __regex_word = ctype_base::__regex_word;
10011005private:
10021006 locale __loc_;
10031007 const ctype<char_type>* __ct_;
......@@ -2293,7 +2297,7 @@ public:
22932297 else
22942298 {
22952299 if (__b.size() != 1 || __e.size() != 1)
2296 __throw_regex_error<regex_constants::error_collate>();
2300 __throw_regex_error<regex_constants::error_range>();
22972301 if (__icase_)
22982302 {
22992303 __b[0] = __traits_.translate_nocase(__b[0]);
......@@ -2527,19 +2531,27 @@ public:
25272531 // construct/copy/destroy:
25282532 _LIBCPP_INLINE_VISIBILITY
25292533 basic_regex()
2530 : __flags_(), __marked_count_(0), __loop_count_(0), __open_count_(0),
2534 : __flags_(regex_constants::ECMAScript), __marked_count_(0), __loop_count_(0), __open_count_(0),
25312535 __end_(0)
25322536 {}
25332537 _LIBCPP_INLINE_VISIBILITY
25342538 explicit basic_regex(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
25352539 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
25362540 __end_(0)
2537 {__parse(__p, __p + __traits_.length(__p));}
2541 {
2542 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
2543 __parse(__p, __p + __traits_.length(__p));
2544 }
2545
25382546 _LIBCPP_INLINE_VISIBILITY
25392547 basic_regex(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript)
25402548 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
25412549 __end_(0)
2542 {__parse(__p, __p + __len);}
2550 {
2551 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
2552 __parse(__p, __p + __len);
2553 }
2554
25432555// basic_regex(const basic_regex&) = default;
25442556// basic_regex(basic_regex&&) = default;
25452557 template <class _ST, class _SA>
......@@ -2548,21 +2560,31 @@ public:
25482560 flag_type __f = regex_constants::ECMAScript)
25492561 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
25502562 __end_(0)
2551 {__parse(__p.begin(), __p.end());}
2563 {
2564 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
2565 __parse(__p.begin(), __p.end());
2566 }
2567
25522568 template <class _ForwardIterator>
25532569 _LIBCPP_INLINE_VISIBILITY
25542570 basic_regex(_ForwardIterator __first, _ForwardIterator __last,
25552571 flag_type __f = regex_constants::ECMAScript)
25562572 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
25572573 __end_(0)
2558 {__parse(__first, __last);}
2574 {
2575 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
2576 __parse(__first, __last);
2577 }
25592578#ifndef _LIBCPP_CXX03_LANG
25602579 _LIBCPP_INLINE_VISIBILITY
25612580 basic_regex(initializer_list<value_type> __il,
25622581 flag_type __f = regex_constants::ECMAScript)
25632582 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
25642583 __end_(0)
2565 {__parse(__il.begin(), __il.end());}
2584 {
2585 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
2586 __parse(__il.begin(), __il.end());
2587 }
25662588#endif // _LIBCPP_CXX03_LANG
25672589
25682590// ~basic_regex() = default;
......@@ -3044,7 +3066,7 @@ basic_regex<_CharT, _Traits>::__parse(_ForwardIterator __first,
30443066 __h.release();
30453067 __end_ = __start_.get();
30463068 }
3047 switch (__flags_ & 0x1F0)
3069 switch (__get_grammar(__flags_))
30483070 {
30493071 case ECMAScript:
30503072 __first = __parse_ecma_exp(__first, __last);
......@@ -3379,7 +3401,7 @@ basic_regex<_CharT, _Traits>::__parse_BACKREF(_ForwardIterator __first,
33793401 if (__temp != __last)
33803402 {
33813403 if (*__first == '\\')
3382 {
3404 {
33833405 int __val = __traits_.value(*__temp, 10);
33843406 if (__val >= 1 && __val <= 9)
33853407 {
......@@ -3513,7 +3535,7 @@ basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR_ERE(_ForwardIterator __first,
35133535 __first = ++__temp;
35143536 break;
35153537 default:
3516 if ((__flags_ & 0x1F0) == awk)
3538 if (__get_grammar(__flags_) == awk)
35173539 __first = __parse_awk_escape(++__first, __last);
35183540 break;
35193541 }
......@@ -3597,7 +3619,7 @@ basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(_ForwardIterator __first,
35973619{
35983620 if (__first != __last)
35993621 {
3600 unsigned __grammar = __flags_ & 0x1F0;
3622 unsigned __grammar = __get_grammar(__flags_);
36013623 switch (*__first)
36023624 {
36033625 case '*':
......@@ -3718,7 +3740,7 @@ basic_regex<_CharT, _Traits>::__parse_bracket_expression(_ForwardIterator __firs
37183740 // __ml owned by *this
37193741 if (__first == __last)
37203742 __throw_regex_error<regex_constants::error_brack>();
3721 if ((__flags_ & 0x1F0) != ECMAScript && *__first == ']')
3743 if (__get_grammar(__flags_) != ECMAScript && *__first == ']')
37223744 {
37233745 __ml->__add_char(']');
37243746 ++__first;
......@@ -3779,7 +3801,7 @@ basic_regex<_CharT, _Traits>::__parse_expression_term(_ForwardIterator __first,
37793801 else if (*__temp == '.')
37803802 __first = __parse_collating_symbol(++__temp, __last, __start_range);
37813803 }
3782 unsigned __grammar = __flags_ & 0x1F0;
3804 unsigned __grammar = __get_grammar(__flags_);
37833805 if (__start_range.empty())
37843806 {
37853807 if ((__grammar == ECMAScript || __grammar == awk) && *__first == '\\')
......@@ -4076,7 +4098,7 @@ basic_regex<_CharT, _Traits>::__parse_DUP_COUNT(_ForwardIterator __first,
40764098 if ( __val != -1 )
40774099 {
40784100 __c = __val;
4079 for (++__first;
4101 for (++__first;
40804102 __first != __last && ( __val = __traits_.value(*__first, 10)) != -1;
40814103 ++__first)
40824104 {
......@@ -4456,7 +4478,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
44564478 case 'c':
44574479 if ((__t = _VSTD::next(__first)) != __last)
44584480 {
4459 if (('A' <= *__t && *__t <= 'Z') ||
4481 if (('A' <= *__t && *__t <= 'Z') ||
44604482 ('a' <= *__t && *__t <= 'z'))
44614483 {
44624484 if (__str)
......@@ -4465,7 +4487,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
44654487 __push_char(_CharT(*__t % 32));
44664488 __first = ++__t;
44674489 }
4468 else
4490 else
44694491 __throw_regex_error<regex_constants::error_escape>();
44704492 }
44714493 else
......@@ -5265,21 +5287,41 @@ public:
52655287 // element access:
52665288 _LIBCPP_INLINE_VISIBILITY
52675289 difference_type length(size_type __sub = 0) const
5268 {return (*this)[__sub].length();}
5290 {
5291 _LIBCPP_ASSERT(ready(), "match_results::length() called when not ready");
5292 return (*this)[__sub].length();
5293 }
52695294 _LIBCPP_INLINE_VISIBILITY
52705295 difference_type position(size_type __sub = 0) const
5271 {return _VSTD::distance(__position_start_, (*this)[__sub].first);}
5296 {
5297 _LIBCPP_ASSERT(ready(), "match_results::position() called when not ready");
5298 return _VSTD::distance(__position_start_, (*this)[__sub].first);
5299 }
52725300 _LIBCPP_INLINE_VISIBILITY
52735301 string_type str(size_type __sub = 0) const
5274 {return (*this)[__sub].str();}
5302 {
5303 _LIBCPP_ASSERT(ready(), "match_results::str() called when not ready");
5304 return (*this)[__sub].str();
5305 }
52755306 _LIBCPP_INLINE_VISIBILITY
52765307 const_reference operator[](size_type __n) const
5277 {return __n < __matches_.size() ? __matches_[__n] : __unmatched_;}
5308 {
5309 _LIBCPP_ASSERT(ready(), "match_results::operator[]() called when not ready");
5310 return __n < __matches_.size() ? __matches_[__n] : __unmatched_;
5311 }
52785312
52795313 _LIBCPP_INLINE_VISIBILITY
5280 const_reference prefix() const {return __prefix_;}
5314 const_reference prefix() const
5315 {
5316 _LIBCPP_ASSERT(ready(), "match_results::prefix() called when not ready");
5317 return __prefix_;
5318 }
52815319 _LIBCPP_INLINE_VISIBILITY
5282 const_reference suffix() const {return __suffix_;}
5320 const_reference suffix() const
5321 {
5322 _LIBCPP_ASSERT(ready(), "match_results::suffix() called when not ready");
5323 return __suffix_;
5324 }
52835325
52845326 _LIBCPP_INLINE_VISIBILITY
52855327 const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin();}
......@@ -5417,6 +5459,7 @@ match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __output_i
54175459 const char_type* __fmt_first, const char_type* __fmt_last,
54185460 regex_constants::match_flag_type __flags) const
54195461{
5462 _LIBCPP_ASSERT(ready(), "match_results::format() called when not ready");
54205463 if (__flags & regex_constants::format_sed)
54215464 {
54225465 for (; __fmt_first != __fmt_last; ++__fmt_first)
......@@ -5849,7 +5892,7 @@ basic_regex<_CharT, _Traits>::__match_at_start(
58495892 match_results<const _CharT*, _Allocator>& __m,
58505893 regex_constants::match_flag_type __flags, bool __at_first) const
58515894{
5852 if ((__flags_ & 0x1F0) == ECMAScript)
5895 if (__get_grammar(__flags_) == ECMAScript)
58535896 return __match_at_start_ecma(__first, __last, __m, __flags, __at_first);
58545897 if (mark_count() == 0)
58555898 return __match_at_start_posix_nosubs(__first, __last, __m, __flags, __at_first);
......@@ -5866,7 +5909,7 @@ basic_regex<_CharT, _Traits>::__search(
58665909{
58675910 __m.__init(1 + mark_count(), __first, __last,
58685911 __flags & regex_constants::__no_update_pos);
5869 if (__match_at_start(__first, __last, __m, __flags,
5912 if (__match_at_start(__first, __last, __m, __flags,
58705913 !(__flags & regex_constants::__no_update_pos)))
58715914 {
58725915 __m.__prefix_.second = __m[0].first;
......@@ -6012,7 +6055,7 @@ bool
60126055regex_search(const basic_string<_Cp, _ST, _SA>&& __s,
60136056 match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,
60146057 const basic_regex<_Cp, _Tp>& __e,
6015 regex_constants::match_flag_type __flags = regex_constants::match_default) = delete;
6058 regex_constants::match_flag_type __flags = regex_constants::match_default) = delete;
60166059#endif
60176060
60186061// regex_match
......@@ -6076,7 +6119,7 @@ bool
60766119regex_match(const basic_string<_CharT, _ST, _SA>&& __s,
60776120 match_results<typename basic_string<_CharT, _ST, _SA>::const_iterator, _Allocator>& __m,
60786121 const basic_regex<_CharT, _Traits>& __e,
6079 regex_constants::match_flag_type __flags = regex_constants::match_default) = delete;
6122 regex_constants::match_flag_type __flags = regex_constants::match_default) = delete;
60806123#endif
60816124
60826125template <class _CharT, class _Traits>
......@@ -6129,7 +6172,7 @@ public:
61296172#if _LIBCPP_STD_VER > 11
61306173 regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
61316174 const regex_type&& __re,
6132 regex_constants::match_flag_type __m
6175 regex_constants::match_flag_type __m
61336176 = regex_constants::match_default) = delete;
61346177#endif
61356178
......@@ -6140,7 +6183,7 @@ public:
61406183 _LIBCPP_INLINE_VISIBILITY
61416184 reference operator*() const {return __match_;}
61426185 _LIBCPP_INLINE_VISIBILITY
6143 pointer operator->() const {return &__match_;}
6186 pointer operator->() const {return _VSTD::addressof(__match_);}
61446187
61456188 regex_iterator& operator++();
61466189 _LIBCPP_INLINE_VISIBILITY
......@@ -6164,7 +6207,7 @@ regex_iterator<_BidirectionalIterator, _CharT, _Traits>::
61646207 const regex_type& __re, regex_constants::match_flag_type __m)
61656208 : __begin_(__a),
61666209 __end_(__b),
6167 __pregex_(&__re),
6210 __pregex_(_VSTD::addressof(__re)),
61686211 __flags_(__m)
61696212{
61706213 _VSTD::regex_search(__begin_, __end_, __match_, *__pregex_, __flags_);
......@@ -6325,7 +6368,7 @@ private:
63256368 __result_ = &__position_->prefix();
63266369 else
63276370 __result_ = &(*__position_)[__subs_[__n_]];
6328 }
6371 }
63296372};
63306373
63316374template <class _BidirectionalIterator, class _CharT, class _Traits>
......@@ -6405,7 +6448,7 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
64056448 regex_constants::match_flag_type __m)
64066449 : __position_(__a, __b, __re, __m),
64076450 __n_(0),
6408 __subs_(__submatches, __submatches + _Np)
6451 __subs_(begin(__submatches), end(__submatches))
64096452{
64106453 __init(__a, __b);
64116454}
lib/libcxx/include/scoped_allocator+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- scoped_allocator --------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/set+87-11
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- set -------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -156,9 +155,9 @@ public:
156155 template<typename K>
157156 const_iterator find(const K& x) const; // C++14
158157 template<typename K>
159 size_type count(const K& x) const; // C++14
160
158 size_type count(const K& x) const; // C++14
161159 size_type count(const key_type& k) const;
160 bool contains(const key_type& x) const; // C++20
162161 iterator lower_bound(const key_type& k);
163162 const_iterator lower_bound(const key_type& k) const;
164163 template<typename K>
......@@ -355,8 +354,10 @@ public:
355354 iterator find(const K& x);
356355 template<typename K>
357356 const_iterator find(const K& x) const; // C++14
358
357 template<typename K>
358 size_type count(const K& x) const; // C++14
359359 size_type count(const key_type& k) const;
360 bool contains(const key_type& x) const; // C++20
360361 iterator lower_bound(const key_type& k);
361362 const_iterator lower_bound(const key_type& k) const;
362363 template<typename K>
......@@ -447,11 +448,10 @@ public:
447448 typedef key_type value_type;
448449 typedef _Compare key_compare;
449450 typedef key_compare value_compare;
450 typedef _Allocator allocator_type;
451 typedef typename __identity<_Allocator>::type allocator_type;
451452 typedef value_type& reference;
452453 typedef const value_type& const_reference;
453454
454 static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
455455 static_assert((is_same<typename allocator_type::value_type, value_type>::value),
456456 "Allocator::value_type must be same type as value_type");
457457
......@@ -597,6 +597,11 @@ public:
597597 }
598598#endif // _LIBCPP_CXX03_LANG
599599
600 _LIBCPP_INLINE_VISIBILITY
601 ~set() {
602 static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
603 }
604
600605 _LIBCPP_INLINE_VISIBILITY
601606 iterator begin() _NOEXCEPT {return __tree_.begin();}
602607 _LIBCPP_INLINE_VISIBILITY
......@@ -784,6 +789,12 @@ public:
784789 typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
785790 count(const _K2& __k) const {return __tree_.__count_multi(__k);}
786791#endif
792
793#if _LIBCPP_STD_VER > 17
794 _LIBCPP_INLINE_VISIBILITY
795 bool contains(const key_type& __k) const {return find(__k) != end();}
796#endif // _LIBCPP_STD_VER > 17
797
787798 _LIBCPP_INLINE_VISIBILITY
788799 iterator lower_bound(const key_type& __k)
789800 {return __tree_.lower_bound(__k);}
......@@ -837,6 +848,34 @@ public:
837848#endif
838849};
839850
851#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
852template<class _InputIterator,
853 class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,
854 class _Allocator = allocator<typename iterator_traits<_InputIterator>::value_type>,
855 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,
856 class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>
857set(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
858 -> set<typename iterator_traits<_InputIterator>::value_type, _Compare, _Allocator>;
859
860template<class _Key, class _Compare = less<_Key>,
861 class _Allocator = allocator<_Key>,
862 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,
863 class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>
864set(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
865 -> set<_Key, _Compare, _Allocator>;
866
867template<class _InputIterator, class _Allocator,
868 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>
869set(_InputIterator, _InputIterator, _Allocator)
870 -> set<typename iterator_traits<_InputIterator>::value_type,
871 less<typename iterator_traits<_InputIterator>::value_type>, _Allocator>;
872
873template<class _Key, class _Allocator,
874 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>
875set(initializer_list<_Key>, _Allocator)
876 -> set<_Key, less<_Key>, _Allocator>;
877#endif
878
840879#ifndef _LIBCPP_CXX03_LANG
841880
842881template <class _Key, class _Compare, class _Allocator>
......@@ -935,11 +974,10 @@ public:
935974 typedef key_type value_type;
936975 typedef _Compare key_compare;
937976 typedef key_compare value_compare;
938 typedef _Allocator allocator_type;
977 typedef typename __identity<_Allocator>::type allocator_type;
939978 typedef value_type& reference;
940979 typedef const value_type& const_reference;
941980
942 static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
943981 static_assert((is_same<typename allocator_type::value_type, value_type>::value),
944982 "Allocator::value_type must be same type as value_type");
945983
......@@ -1084,6 +1122,11 @@ public:
10841122 }
10851123#endif // _LIBCPP_CXX03_LANG
10861124
1125 _LIBCPP_INLINE_VISIBILITY
1126 ~multiset() {
1127 static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
1128 }
1129
10871130 _LIBCPP_INLINE_VISIBILITY
10881131 iterator begin() _NOEXCEPT {return __tree_.begin();}
10891132 _LIBCPP_INLINE_VISIBILITY
......@@ -1272,6 +1315,11 @@ public:
12721315 count(const _K2& __k) const {return __tree_.__count_multi(__k);}
12731316#endif
12741317
1318#if _LIBCPP_STD_VER > 17
1319 _LIBCPP_INLINE_VISIBILITY
1320 bool contains(const key_type& __k) const {return find(__k) != end();}
1321#endif // _LIBCPP_STD_VER > 17
1322
12751323 _LIBCPP_INLINE_VISIBILITY
12761324 iterator lower_bound(const key_type& __k)
12771325 {return __tree_.lower_bound(__k);}
......@@ -1325,6 +1373,34 @@ public:
13251373#endif
13261374};
13271375
1376#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
1377template<class _InputIterator,
1378 class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,
1379 class _Allocator = allocator<typename iterator_traits<_InputIterator>::value_type>,
1380 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,
1381 class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>
1382multiset(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
1383 -> multiset<typename iterator_traits<_InputIterator>::value_type, _Compare, _Allocator>;
1384
1385template<class _Key, class _Compare = less<_Key>,
1386 class _Allocator = allocator<_Key>,
1387 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,
1388 class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>
1389multiset(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
1390 -> multiset<_Key, _Compare, _Allocator>;
1391
1392template<class _InputIterator, class _Allocator,
1393 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>
1394multiset(_InputIterator, _InputIterator, _Allocator)
1395 -> multiset<typename iterator_traits<_InputIterator>::value_type,
1396 less<typename iterator_traits<_InputIterator>::value_type>, _Allocator>;
1397
1398template<class _Key, class _Allocator,
1399 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>
1400multiset(initializer_list<_Key>, _Allocator)
1401 -> multiset<_Key, less<_Key>, _Allocator>;
1402#endif
1403
13281404#ifndef _LIBCPP_CXX03_LANG
13291405
13301406template <class _Key, class _Compare, class _Allocator>
lib/libcxx/include/setjmp.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- setjmp.h ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/shared_mutex+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------ shared_mutex --------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/span+139-112
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------------ span ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===---------------------------------------------------------------------===//
109
......@@ -17,33 +16,35 @@
1716namespace std {
1817
1918// constants
20inline constexpr ptrdiff_t dynamic_extent = -1;
19inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
2120
2221// [views.span], class template span
23template <class ElementType, ptrdiff_t Extent = dynamic_extent>
22template <class ElementType, size_t Extent = dynamic_extent>
2423 class span;
2524
2625// [span.objectrep], views of object representation
27template <class ElementType, ptrdiff_t Extent>
26template <class ElementType, size_t Extent>
2827 span<const byte, ((Extent == dynamic_extent) ? dynamic_extent :
29 (static_cast<ptrdiff_t>(sizeof(ElementType)) * Extent))> as_bytes(span<ElementType, Extent> s) noexcept;
28 (sizeof(ElementType) * Extent))> as_bytes(span<ElementType, Extent> s) noexcept;
3029
31template <class ElementType, ptrdiff_t Extent>
30template <class ElementType, size_t Extent>
3231 span< byte, ((Extent == dynamic_extent) ? dynamic_extent :
33 (static_cast<ptrdiff_t>(sizeof(ElementType)) * Extent))> as_writable_bytes(span<ElementType, Extent> s) noexcept;
32 (sizeof(ElementType) * Extent))> as_writable_bytes(span<ElementType, Extent> s) noexcept;
3433
3534
3635namespace std {
37template <class ElementType, ptrdiff_t Extent = dynamic_extent>
36template <class ElementType, size_t Extent = dynamic_extent>
3837class span {
3938public:
4039 // constants and types
4140 using element_type = ElementType;
4241 using value_type = remove_cv_t<ElementType>;
43 using index_type = ptrdiff_t;
42 using index_type = size_t;
4443 using difference_type = ptrdiff_t;
4544 using pointer = element_type*;
45 using const_pointer = const element_type*;
4646 using reference = element_type&;
47 using const_reference = const element_type&;
4748 using iterator = implementation-defined;
4849 using const_iterator = implementation-defined;
4950 using reverse_iterator = std::reverse_iterator<iterator>;
......@@ -65,17 +66,17 @@ public:
6566 template <class Container>
6667 constexpr span(const Container& cont);
6768 constexpr span(const span& other) noexcept = default;
68 template <class OtherElementType, ptrdiff_t OtherExtent>
69 template <class OtherElementType, size_t OtherExtent>
6970 constexpr span(const span<OtherElementType, OtherExtent>& s) noexcept;
7071 ~span() noexcept = default;
7172 constexpr span& operator=(const span& other) noexcept = default;
7273
7374 // [span.sub], span subviews
74 template <ptrdiff_t Count>
75 template <size_t Count>
7576 constexpr span<element_type, Count> first() const;
76 template <ptrdiff_t Count>
77 template <size_t Count>
7778 constexpr span<element_type, Count> last() const;
78 template <ptrdiff_t Offset, ptrdiff_t Count = dynamic_extent>
79 template <size_t Offset, size_t Count = dynamic_extent>
7980 constexpr span<element_type, see below> subspan() const;
8081
8182 constexpr span<element_type, dynamic_extent> first(index_type count) const;
......@@ -89,7 +90,8 @@ public:
8990
9091 // [span.elem], span element access
9192 constexpr reference operator[](index_type idx) const;
92 constexpr reference operator()(index_type idx) const;
93 constexpr reference front() const;
94 constexpr reference back() const;
9395 constexpr pointer data() const noexcept;
9496
9597 // [span.iterators], span iterator support
......@@ -141,14 +143,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD
141143
142144#if _LIBCPP_STD_VER > 17
143145
144inline constexpr ptrdiff_t dynamic_extent = -1;
145template <typename _Tp, ptrdiff_t _Extent = dynamic_extent> class span;
146inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
147template <typename _Tp, size_t _Extent = dynamic_extent> class span;
146148
147149
148150template <class _Tp>
149151struct __is_span_impl : public false_type {};
150152
151template <class _Tp, ptrdiff_t _Extent>
153template <class _Tp, size_t _Extent>
152154struct __is_span_impl<span<_Tp, _Extent>> : public true_type {};
153155
154156template <class _Tp>
......@@ -187,25 +189,24 @@ struct __is_span_compatible_container<_Tp, _ElementType,
187189 : public true_type {};
188190
189191
190template <typename _Tp, ptrdiff_t _Extent>
192template <typename _Tp, size_t _Extent>
191193class _LIBCPP_TEMPLATE_VIS span {
192194public:
193195// constants and types
194196 using element_type = _Tp;
195197 using value_type = remove_cv_t<_Tp>;
196 using index_type = ptrdiff_t;
198 using index_type = size_t;
197199 using difference_type = ptrdiff_t;
198200 using pointer = _Tp *;
199 using const_pointer = const _Tp *; // not in standard
201 using const_pointer = const _Tp *;
200202 using reference = _Tp &;
201 using const_reference = const _Tp &; // not in standard
203 using const_reference = const _Tp &;
202204 using iterator = __wrap_iter<pointer>;
203205 using const_iterator = __wrap_iter<const_pointer>;
204206 using reverse_iterator = _VSTD::reverse_iterator<iterator>;
205207 using const_reverse_iterator = _VSTD::reverse_iterator<const_iterator>;
206208
207209 static constexpr index_type extent = _Extent;
208 static_assert (_Extent >= 0, "Can't have a span with an extent < 0");
209210
210211// [span.cons], span constructors, copy, assignment, and destructor
211212 _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}
......@@ -223,22 +224,8 @@ public:
223224 _LIBCPP_INLINE_VISIBILITY constexpr span( array<value_type, _Extent>& __arr) noexcept : __data{__arr.data()} {}
224225 _LIBCPP_INLINE_VISIBILITY constexpr span(const array<value_type, _Extent>& __arr) noexcept : __data{__arr.data()} {}
225226
226 template <class _Container>
227 inline _LIBCPP_INLINE_VISIBILITY
228 constexpr span( _Container& __c,
229 enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr)
230 : __data{_VSTD::data(__c)}
231 { _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (container)"); }
232
233 template <class _Container>
234 inline _LIBCPP_INLINE_VISIBILITY
235 constexpr span(const _Container& __c,
236 enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr)
237 : __data{_VSTD::data(__c)}
238 { _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (const container)"); }
239
240227 template <class _OtherElementType>
241 inline _LIBCPP_INLINE_VISIBILITY
228 _LIBCPP_INLINE_VISIBILITY
242229 constexpr span(const span<_OtherElementType, _Extent>& __other,
243230 enable_if_t<
244231 is_convertible_v<_OtherElementType(*)[], element_type (*)[]>,
......@@ -246,7 +233,7 @@ public:
246233 : __data{__other.data()} {}
247234
248235 template <class _OtherElementType>
249 inline _LIBCPP_INLINE_VISIBILITY
236 _LIBCPP_INLINE_VISIBILITY
250237 constexpr span(const span<_OtherElementType, dynamic_extent>& __other,
251238 enable_if_t<
252239 is_convertible_v<_OtherElementType(*)[], element_type (*)[]>,
......@@ -256,20 +243,18 @@ public:
256243
257244// ~span() noexcept = default;
258245
259 template <ptrdiff_t _Count>
260 inline _LIBCPP_INLINE_VISIBILITY
261 constexpr span<element_type, _Count> first() const noexcept
246 template <size_t _Count>
247 _LIBCPP_INLINE_VISIBILITY
248 constexpr span<element_type, _Count> first() const noexcept
262249 {
263 static_assert(_Count >= 0, "Count must be >= 0 in span::first()");
264250 static_assert(_Count <= _Extent, "Count out of range in span::first()");
265251 return {data(), _Count};
266252 }
267253
268 template <ptrdiff_t _Count>
269 inline _LIBCPP_INLINE_VISIBILITY
270 constexpr span<element_type, _Count> last() const noexcept
254 template <size_t _Count>
255 _LIBCPP_INLINE_VISIBILITY
256 constexpr span<element_type, _Count> last() const noexcept
271257 {
272 static_assert(_Count >= 0, "Count must be >= 0 in span::last()");
273258 static_assert(_Count <= _Extent, "Count out of range in span::last()");
274259 return {data() + size() - _Count, _Count};
275260 }
......@@ -277,36 +262,36 @@ public:
277262 _LIBCPP_INLINE_VISIBILITY
278263 constexpr span<element_type, dynamic_extent> first(index_type __count) const noexcept
279264 {
280 _LIBCPP_ASSERT(__count >= 0 && __count <= size(), "Count out of range in span::first(count)");
265 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)");
281266 return {data(), __count};
282267 }
283268
284269 _LIBCPP_INLINE_VISIBILITY
285270 constexpr span<element_type, dynamic_extent> last(index_type __count) const noexcept
286271 {
287 _LIBCPP_ASSERT(__count >= 0 && __count <= size(), "Count out of range in span::last(count)");
272 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)");
288273 return {data() + size() - __count, __count};
289274 }
290275
291 template <ptrdiff_t _Offset, ptrdiff_t _Count = dynamic_extent>
292 inline _LIBCPP_INLINE_VISIBILITY
293 constexpr auto subspan() const noexcept
276 template <size_t _Offset, size_t _Count = dynamic_extent>
277 _LIBCPP_INLINE_VISIBILITY
278 constexpr auto subspan() const noexcept
294279 -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>
295280 {
296 _LIBCPP_ASSERT(_Offset >= 0 && _Offset <= size(), "Offset out of range in span::subspan()");
281 static_assert(_Offset <= _Extent, "Offset out of range in span::subspan()");
297282 return {data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
298283 }
299284
300285
301 inline _LIBCPP_INLINE_VISIBILITY
286 _LIBCPP_INLINE_VISIBILITY
302287 constexpr span<element_type, dynamic_extent>
303288 subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept
304289 {
305 _LIBCPP_ASSERT( __offset >= 0 && __offset <= size(), "Offset out of range in span::subspan(offset, count)");
306 _LIBCPP_ASSERT((__count >= 0 && __count <= size()) || __count == dynamic_extent, "Count out of range in span::subspan(offset, count)");
290 _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)");
291 _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "Count out of range in span::subspan(offset, count)");
307292 if (__count == dynamic_extent)
308293 return {data() + __offset, size() - __offset};
309 _LIBCPP_ASSERT(__offset + __count <= size(), "count + offset out of range in span::subspan(offset, count)");
294 _LIBCPP_ASSERT(__offset <= size() - __count, "count + offset out of range in span::subspan(offset, count)");
310295 return {data() + __offset, __count};
311296 }
312297
......@@ -320,10 +305,16 @@ public:
320305 return __data[__idx];
321306 }
322307
323 _LIBCPP_INLINE_VISIBILITY constexpr reference operator()(index_type __idx) const noexcept
308 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
324309 {
325 _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T,N>() index out of bounds");
326 return __data[__idx];
310 static_assert(_Extent > 0, "span<T,N>[].front() on empty span");
311 return __data[0];
312 }
313
314 _LIBCPP_INLINE_VISIBILITY constexpr reference back() const noexcept
315 {
316 static_assert(_Extent > 0, "span<T,N>[].back() on empty span");
317 return __data[size()-1];
327318 }
328319
329320 _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; }
......@@ -348,7 +339,7 @@ public:
348339 _LIBCPP_INLINE_VISIBILITY span<const byte, _Extent * sizeof(element_type)> __as_bytes() const noexcept
349340 { return {reinterpret_cast<const byte *>(data()), size_bytes()}; }
350341
351 _LIBCPP_INLINE_VISIBILITY span<byte, _Extent * sizeof(element_type)> __as_writeable_bytes() const noexcept
342 _LIBCPP_INLINE_VISIBILITY span<byte, _Extent * sizeof(element_type)> __as_writable_bytes() const noexcept
352343 { return {reinterpret_cast<byte *>(data()), size_bytes()}; }
353344
354345private:
......@@ -365,12 +356,12 @@ public:
365356// constants and types
366357 using element_type = _Tp;
367358 using value_type = remove_cv_t<_Tp>;
368 using index_type = ptrdiff_t;
359 using index_type = size_t;
369360 using difference_type = ptrdiff_t;
370361 using pointer = _Tp *;
371 using const_pointer = const _Tp *; // not in standard
362 using const_pointer = const _Tp *;
372363 using reference = _Tp &;
373 using const_reference = const _Tp &; // not in standard
364 using const_reference = const _Tp &;
374365 using iterator = __wrap_iter<pointer>;
375366 using const_iterator = __wrap_iter<const_pointer>;
376367 using reverse_iterator = _VSTD::reverse_iterator<iterator>;
......@@ -385,35 +376,35 @@ public:
385376 constexpr span& operator=(const span&) noexcept = default;
386377
387378 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, index_type __count) : __data{__ptr}, __size{__count} {}
388 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}, __size{distance(__f, __l)} {}
379 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}, __size{static_cast<size_t>(distance(__f, __l))} {}
389380
390381 template <size_t _Sz>
391 inline _LIBCPP_INLINE_VISIBILITY
392 constexpr span(element_type (&__arr)[_Sz]) noexcept : __data{__arr}, __size{_Sz} {}
382 _LIBCPP_INLINE_VISIBILITY
383 constexpr span(element_type (&__arr)[_Sz]) noexcept : __data{__arr}, __size{_Sz} {}
393384
394385 template <size_t _Sz>
395 inline _LIBCPP_INLINE_VISIBILITY
396 constexpr span(array<value_type, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {}
386 _LIBCPP_INLINE_VISIBILITY
387 constexpr span(array<value_type, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {}
397388
398389 template <size_t _Sz>
399 inline _LIBCPP_INLINE_VISIBILITY
400 constexpr span(const array<value_type, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {}
390 _LIBCPP_INLINE_VISIBILITY
391 constexpr span(const array<value_type, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {}
401392
402393 template <class _Container>
403 inline _LIBCPP_INLINE_VISIBILITY
394 _LIBCPP_INLINE_VISIBILITY
404395 constexpr span( _Container& __c,
405396 enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr)
406397 : __data{_VSTD::data(__c)}, __size{(index_type) _VSTD::size(__c)} {}
407398
408399 template <class _Container>
409 inline _LIBCPP_INLINE_VISIBILITY
400 _LIBCPP_INLINE_VISIBILITY
410401 constexpr span(const _Container& __c,
411402 enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr)
412403 : __data{_VSTD::data(__c)}, __size{(index_type) _VSTD::size(__c)} {}
413404
414405
415 template <class _OtherElementType, ptrdiff_t _OtherExtent>
416 inline _LIBCPP_INLINE_VISIBILITY
406 template <class _OtherElementType, size_t _OtherExtent>
407 _LIBCPP_INLINE_VISIBILITY
417408 constexpr span(const span<_OtherElementType, _OtherExtent>& __other,
418409 enable_if_t<
419410 is_convertible_v<_OtherElementType(*)[], element_type (*)[]>,
......@@ -422,20 +413,18 @@ public:
422413
423414// ~span() noexcept = default;
424415
425 template <ptrdiff_t _Count>
426 inline _LIBCPP_INLINE_VISIBILITY
427 constexpr span<element_type, _Count> first() const noexcept
416 template <size_t _Count>
417 _LIBCPP_INLINE_VISIBILITY
418 constexpr span<element_type, _Count> first() const noexcept
428419 {
429 static_assert(_Count >= 0, "Count must be >= 0 in span::first()");
430420 _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::first()");
431421 return {data(), _Count};
432422 }
433423
434 template <ptrdiff_t _Count>
435 inline _LIBCPP_INLINE_VISIBILITY
436 constexpr span<element_type, _Count> last() const noexcept
424 template <size_t _Count>
425 _LIBCPP_INLINE_VISIBILITY
426 constexpr span<element_type, _Count> last() const noexcept
437427 {
438 static_assert(_Count >= 0, "Count must be >= 0 in span::last()");
439428 _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::last()");
440429 return {data() + size() - _Count, _Count};
441430 }
......@@ -443,35 +432,35 @@ public:
443432 _LIBCPP_INLINE_VISIBILITY
444433 constexpr span<element_type, dynamic_extent> first(index_type __count) const noexcept
445434 {
446 _LIBCPP_ASSERT(__count >= 0 && __count <= size(), "Count out of range in span::first(count)");
435 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)");
447436 return {data(), __count};
448437 }
449438
450439 _LIBCPP_INLINE_VISIBILITY
451440 constexpr span<element_type, dynamic_extent> last (index_type __count) const noexcept
452441 {
453 _LIBCPP_ASSERT(__count >= 0 && __count <= size(), "Count out of range in span::last(count)");
442 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)");
454443 return {data() + size() - __count, __count};
455444 }
456445
457 template <ptrdiff_t _Offset, ptrdiff_t _Count = dynamic_extent>
458 inline _LIBCPP_INLINE_VISIBILITY
459 constexpr span<_Tp, dynamic_extent> subspan() const noexcept
446 template <size_t _Offset, size_t _Count = dynamic_extent>
447 _LIBCPP_INLINE_VISIBILITY
448 constexpr span<_Tp, dynamic_extent> subspan() const noexcept
460449 {
461 _LIBCPP_ASSERT(_Offset >= 0 && _Offset <= size(), "Offset out of range in span::subspan()");
450 _LIBCPP_ASSERT(_Offset <= size(), "Offset out of range in span::subspan()");
462451 _LIBCPP_ASSERT(_Count == dynamic_extent || _Offset + _Count <= size(), "Count out of range in span::subspan()");
463452 return {data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
464453 }
465454
466455 constexpr span<element_type, dynamic_extent>
467 inline _LIBCPP_INLINE_VISIBILITY
468 subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept
456 _LIBCPP_INLINE_VISIBILITY
457 subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept
469458 {
470 _LIBCPP_ASSERT( __offset >= 0 && __offset <= size(), "Offset out of range in span::subspan(offset, count)");
471 _LIBCPP_ASSERT((__count >= 0 && __count <= size()) || __count == dynamic_extent, "count out of range in span::subspan(offset, count)");
459 _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)");
460 _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "count out of range in span::subspan(offset, count)");
472461 if (__count == dynamic_extent)
473462 return {data() + __offset, size() - __offset};
474 _LIBCPP_ASSERT(__offset + __count <= size(), "Offset + count out of range in span::subspan(offset, count)");
463 _LIBCPP_ASSERT(__offset <= size() - __count, "Offset + count out of range in span::subspan(offset, count)");
475464 return {data() + __offset, __count};
476465 }
477466
......@@ -485,12 +474,19 @@ public:
485474 return __data[__idx];
486475 }
487476
488 _LIBCPP_INLINE_VISIBILITY constexpr reference operator()(index_type __idx) const noexcept
477 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
489478 {
490 _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T>() index out of bounds");
491 return __data[__idx];
479 _LIBCPP_ASSERT(!empty(), "span<T>[].front() on empty span");
480 return __data[0];
492481 }
493482
483 _LIBCPP_INLINE_VISIBILITY constexpr reference back() const noexcept
484 {
485 _LIBCPP_ASSERT(!empty(), "span<T>[].back() on empty span");
486 return __data[size()-1];
487 }
488
489
494490 _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; }
495491
496492// [span.iter], span iterator support
......@@ -517,7 +513,7 @@ public:
517513 _LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> __as_bytes() const noexcept
518514 { return {reinterpret_cast<const byte *>(data()), size_bytes()}; }
519515
520 _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> __as_writeable_bytes() const noexcept
516 _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> __as_writable_bytes() const noexcept
521517 { return {reinterpret_cast<byte *>(data()), size_bytes()}; }
522518
523519private:
......@@ -525,20 +521,51 @@ private:
525521 index_type __size;
526522};
527523
528// as_bytes & as_writeable_bytes
529template <class _Tp, ptrdiff_t _Extent>
530 auto as_bytes(span<_Tp, _Extent> __s) noexcept
531 -> decltype(__s.__as_bytes())
532 { return __s.__as_bytes(); }
524// tuple interface
525template <class _Tp, size_t _Size>
526struct _LIBCPP_TEMPLATE_VIS tuple_size<span<_Tp, _Size>>
527 : public integral_constant<size_t, _Size> {};
533528
534template <class _Tp, ptrdiff_t _Extent>
535 auto as_writeable_bytes(span<_Tp, _Extent> __s) noexcept
536 -> typename enable_if<!is_const_v<_Tp>, decltype(__s.__as_writeable_bytes())>::type
537 { return __s.__as_writeable_bytes(); }
529template <class _Tp>
530struct _LIBCPP_TEMPLATE_VIS tuple_size<span<_Tp, dynamic_extent>>; // declared but not defined
531
532
533template <size_t _Ip, class _Tp, size_t _Size>
534struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, span<_Tp, _Size>>
535{
536 static_assert( dynamic_extent != _Size, "std::tuple_element<> not supported for std::span<T, dynamic_extent>");
537 static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::span)");
538 typedef _Tp type;
539};
538540
539template <class _Tp, ptrdiff_t _Extent>
540 constexpr void swap(span<_Tp, _Extent> &__lhs, span<_Tp, _Extent> &__rhs) noexcept
541 { __lhs.swap(__rhs); }
541template <size_t _Ip, class _Tp, size_t _Size>
542_LIBCPP_INLINE_VISIBILITY constexpr
543_Tp&
544get(span<_Tp, _Size> __s) noexcept
545{
546 static_assert( dynamic_extent != _Size, "std::get<> not supported for std::span<T, dynamic_extent>");
547 static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::span)");
548 return __s[_Ip];
549}
550
551
552// as_bytes & as_writable_bytes
553template <class _Tp, size_t _Extent>
554_LIBCPP_INLINE_VISIBILITY
555auto as_bytes(span<_Tp, _Extent> __s) noexcept
556-> decltype(__s.__as_bytes())
557{ return __s.__as_bytes(); }
558
559template <class _Tp, size_t _Extent>
560_LIBCPP_INLINE_VISIBILITY
561auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept
562-> enable_if_t<!is_const_v<_Tp>, decltype(__s.__as_writable_bytes())>
563{ return __s.__as_writable_bytes(); }
564
565template <class _Tp, size_t _Extent>
566_LIBCPP_INLINE_VISIBILITY
567constexpr void swap(span<_Tp, _Extent> &__lhs, span<_Tp, _Extent> &__rhs) noexcept
568{ __lhs.swap(__rhs); }
542569
543570
544571// Deduction guides
lib/libcxx/include/sstream+4-5
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- sstream ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -559,7 +558,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
559558 char_type* __p = const_cast<char_type*>(__str_.data());
560559 this->setg(__p, __p + __ninp, __hm_);
561560 }
562 return this->sputc(__c);
561 return this->sputc(traits_type::to_char_type(__c));
563562 }
564563 return traits_type::not_eof(__c);
565564}
lib/libcxx/include/stack+8-9
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- stack -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -63,8 +62,8 @@ public:
6362
6463template<class Container>
6564 stack(Container) -> stack<typename Container::value_type, Container>; // C++17
66
67template<class Container, class Allocator>
65
66template<class Container, class Allocator>
6867 stack(Container, Allocator) -> stack<typename Container::value_type, Container>; // C++17
6968
7069template <class T, class Container>
......@@ -119,7 +118,7 @@ public:
119118 typedef typename container_type::const_reference const_reference;
120119 typedef typename container_type::size_type size_type;
121120 static_assert((is_same<_Tp, value_type>::value), "" );
122
121
123122protected:
124123 container_type c;
125124
......@@ -241,12 +240,12 @@ template<class _Container,
241240>
242241stack(_Container)
243242 -> stack<typename _Container::value_type, _Container>;
244
243
245244template<class _Container,
246245 class _Alloc,
247246 class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type,
248247 class = typename enable_if< __is_allocator<_Alloc>::value, nullptr_t>::type
249 >
248 >
250249stack(_Container, _Alloc)
251250 -> stack<typename _Container::value_type, _Container>;
252251#endif
lib/libcxx/include/stdbool.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- stdbool.h --------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109#ifndef _LIBCPP_STDBOOL_H
lib/libcxx/include/stddef.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- stddef.h ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/stdexcept+31-5
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- stdexcept --------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -55,6 +54,7 @@ public:
5554
5655_LIBCPP_BEGIN_NAMESPACE_STD
5756
57#ifndef _LIBCPP_ABI_VCRUNTIME
5858class _LIBCPP_HIDDEN __libcpp_refstring
5959{
6060 const char* __imp_;
......@@ -68,6 +68,7 @@ public:
6868
6969 const char* c_str() const _NOEXCEPT {return __imp_;}
7070};
71#endif // !_LIBCPP_ABI_VCRUNTIME
7172
7273_LIBCPP_END_NAMESPACE_STD
7374
......@@ -77,6 +78,7 @@ namespace std // purposefully not using versioning namespace
7778class _LIBCPP_EXCEPTION_ABI logic_error
7879 : public exception
7980{
81#ifndef _LIBCPP_ABI_VCRUNTIME
8082private:
8183 _VSTD::__libcpp_refstring __imp_;
8284public:
......@@ -89,11 +91,17 @@ public:
8991 virtual ~logic_error() _NOEXCEPT;
9092
9193 virtual const char* what() const _NOEXCEPT;
94#else
95public:
96 explicit logic_error(const _VSTD::string&); // Symbol uses versioned std::string
97 _LIBCPP_INLINE_VISIBILITY explicit logic_error(const char* __s) : exception(__s) {}
98#endif
9299};
93100
94101class _LIBCPP_EXCEPTION_ABI runtime_error
95102 : public exception
96103{
104#ifndef _LIBCPP_ABI_VCRUNTIME
97105private:
98106 _VSTD::__libcpp_refstring __imp_;
99107public:
......@@ -106,6 +114,11 @@ public:
106114 virtual ~runtime_error() _NOEXCEPT;
107115
108116 virtual const char* what() const _NOEXCEPT;
117#else
118public:
119 explicit runtime_error(const _VSTD::string&); // Symbol uses versioned std::string
120 _LIBCPP_INLINE_VISIBILITY explicit runtime_error(const char* __s) : exception(__s) {}
121#endif // _LIBCPP_ABI_VCRUNTIME
109122};
110123
111124class _LIBCPP_EXCEPTION_ABI domain_error
......@@ -115,7 +128,9 @@ public:
115128 _LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {}
116129 _LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s) : logic_error(__s) {}
117130
131#ifndef _LIBCPP_ABI_VCRUNTIME
118132 virtual ~domain_error() _NOEXCEPT;
133#endif
119134};
120135
121136class _LIBCPP_EXCEPTION_ABI invalid_argument
......@@ -125,7 +140,9 @@ public:
125140 _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {}
126141 _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s) : logic_error(__s) {}
127142
143#ifndef _LIBCPP_ABI_VCRUNTIME
128144 virtual ~invalid_argument() _NOEXCEPT;
145#endif
129146};
130147
131148class _LIBCPP_EXCEPTION_ABI length_error
......@@ -134,8 +151,9 @@ class _LIBCPP_EXCEPTION_ABI length_error
134151public:
135152 _LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {}
136153 _LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s) : logic_error(__s) {}
137
154#ifndef _LIBCPP_ABI_VCRUNTIME
138155 virtual ~length_error() _NOEXCEPT;
156#endif
139157};
140158
141159class _LIBCPP_EXCEPTION_ABI out_of_range
......@@ -145,7 +163,9 @@ public:
145163 _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {}
146164 _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s) : logic_error(__s) {}
147165
166#ifndef _LIBCPP_ABI_VCRUNTIME
148167 virtual ~out_of_range() _NOEXCEPT;
168#endif
149169};
150170
151171class _LIBCPP_EXCEPTION_ABI range_error
......@@ -155,7 +175,9 @@ public:
155175 _LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {}
156176 _LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s) : runtime_error(__s) {}
157177
178#ifndef _LIBCPP_ABI_VCRUNTIME
158179 virtual ~range_error() _NOEXCEPT;
180#endif
159181};
160182
161183class _LIBCPP_EXCEPTION_ABI overflow_error
......@@ -165,7 +187,9 @@ public:
165187 _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {}
166188 _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s) : runtime_error(__s) {}
167189
190#ifndef _LIBCPP_ABI_VCRUNTIME
168191 virtual ~overflow_error() _NOEXCEPT;
192#endif
169193};
170194
171195class _LIBCPP_EXCEPTION_ABI underflow_error
......@@ -175,7 +199,9 @@ public:
175199 _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {}
176200 _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s) : runtime_error(__s) {}
177201
202#ifndef _LIBCPP_ABI_VCRUNTIME
178203 virtual ~underflow_error() _NOEXCEPT;
204#endif
179205};
180206
181207} // std
lib/libcxx/include/stdint.h+8-4
......@@ -1,15 +1,19 @@
11// -*- C++ -*-
22//===---------------------------- stdint.h --------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
1110#ifndef _LIBCPP_STDINT_H
11// AIX system headers need stdint.h to be re-enterable while _STD_TYPES_T
12// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
13// case the header guard macro is defined.
14#if !defined(_AIX) || !defined(_STD_TYPES_T)
1215#define _LIBCPP_STDINT_H
16#endif // _STD_TYPES_T
1317
1418/*
1519 stdint.h synopsis
lib/libcxx/include/stdio.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- stdio.h ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/stdlib.h+9-32
......@@ -1,19 +1,22 @@
11// -*- C++ -*-
22//===--------------------------- stdlib.h ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
11#if defined(__need_malloc_and_calloc)
10#if defined(__need_malloc_and_calloc) || defined(_LIBCPP_STDLIB_INCLUDE_NEXT)
1211
1312#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1413#pragma GCC system_header
1514#endif
1615
16#if defined(_LIBCPP_STDLIB_INCLUDE_NEXT)
17#undef _LIBCPP_STDLIB_INCLUDE_NEXT
18#endif
19
1720#include_next <stdlib.h>
1821
1922#elif !defined(_LIBCPP_STDLIB_H)
......@@ -94,33 +97,7 @@ void *aligned_alloc(size_t alignment, size_t size); // C11
9497#include_next <stdlib.h>
9598
9699#ifdef __cplusplus
97
98extern "C++" {
99
100#undef abs
101#undef div
102#undef labs
103#undef ldiv
104#ifndef _LIBCPP_HAS_NO_LONG_LONG
105#undef llabs
106#undef lldiv
107#endif
108
109// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
110#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
111inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
112#ifndef _LIBCPP_HAS_NO_LONG_LONG
113inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
114#endif // _LIBCPP_HAS_NO_LONG_LONG
115
116inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);}
117#ifndef _LIBCPP_HAS_NO_LONG_LONG
118inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
119#endif // _LIBCPP_HAS_NO_LONG_LONG
120#endif // _LIBCPP_MSVCRT / __sun__ / _AIX
121
122} // extern "C++"
123
100#include <math.h>
124101#endif // __cplusplus
125102
126103#endif // _LIBCPP_STDLIB_H
lib/libcxx/include/streambuf+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------- streambuf ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/string+36-41
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- string -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -628,13 +627,13 @@ struct __libcpp_string_gets_noexcept_iterator_impl : public false_type {};
628627#else
629628template <class _Iter, bool = __is_forward_iterator<_Iter>::value>
630629struct __libcpp_string_gets_noexcept_iterator_impl : public _LIBCPP_BOOL_CONSTANT((
631 noexcept(++(declval<_Iter&>())) &&
632 is_nothrow_assignable<_Iter&, _Iter>::value &&
633 noexcept(declval<_Iter>() == declval<_Iter>()) &&
630 noexcept(++(declval<_Iter&>())) &&
631 is_nothrow_assignable<_Iter&, _Iter>::value &&
632 noexcept(declval<_Iter>() == declval<_Iter>()) &&
634633 noexcept(*declval<_Iter>())
635634)) {};
636635
637template <class _Iter>
636template <class _Iter>
638637struct __libcpp_string_gets_noexcept_iterator_impl<_Iter, false> : public false_type {};
639638#endif
640639
......@@ -863,10 +862,10 @@ public:
863862 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
864863 explicit basic_string(const _Tp& __t, const allocator_type& __a);
865864
866 template<class _InputIterator>
865 template<class _InputIterator, class = typename enable_if<__is_input_iterator<_InputIterator>::value>::type>
867866 _LIBCPP_INLINE_VISIBILITY
868867 basic_string(_InputIterator __first, _InputIterator __last);
869 template<class _InputIterator>
868 template<class _InputIterator, class = typename enable_if<__is_input_iterator<_InputIterator>::value>::type>
870869 _LIBCPP_INLINE_VISIBILITY
871870 basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
872871#ifndef _LIBCPP_CXX03_LANG
......@@ -1061,10 +1060,10 @@ public:
10611060 void push_back(value_type __c);
10621061 _LIBCPP_INLINE_VISIBILITY
10631062 void pop_back();
1064 _LIBCPP_INLINE_VISIBILITY reference front();
1065 _LIBCPP_INLINE_VISIBILITY const_reference front() const;
1066 _LIBCPP_INLINE_VISIBILITY reference back();
1067 _LIBCPP_INLINE_VISIBILITY const_reference back() const;
1063 _LIBCPP_INLINE_VISIBILITY reference front() _NOEXCEPT;
1064 _LIBCPP_INLINE_VISIBILITY const_reference front() const _NOEXCEPT;
1065 _LIBCPP_INLINE_VISIBILITY reference back() _NOEXCEPT;
1066 _LIBCPP_INLINE_VISIBILITY const_reference back() const _NOEXCEPT;
10681067
10691068 template <class _Tp>
10701069 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
......@@ -1237,9 +1236,9 @@ public:
12371236 _LIBCPP_INLINE_VISIBILITY
12381237 void swap(basic_string& __str)
12391238#if _LIBCPP_STD_VER >= 14
1240 _NOEXCEPT_DEBUG;
1239 _NOEXCEPT;
12411240#else
1242 _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||
1241 _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
12431242 __is_nothrow_swappable<allocator_type>::value);
12441243#endif
12451244
......@@ -1421,7 +1420,7 @@ public:
14211420 _LIBCPP_INLINE_VISIBILITY bool __invariants() const;
14221421
14231422 _LIBCPP_INLINE_VISIBILITY void __clear_and_shrink() _NOEXCEPT;
1424
1423
14251424 _LIBCPP_INLINE_VISIBILITY
14261425 bool __is_long() const _NOEXCEPT
14271426 {return bool(__r_.first().__s.__size_ & __short_mask);}
......@@ -1683,7 +1682,7 @@ basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& = _
16831682 -> basic_string<_CharT, _Traits, _Allocator>;
16841683#endif
16851684
1686
1685
16871686template <class _CharT, class _Traits, class _Allocator>
16881687inline
16891688void
......@@ -2078,7 +2077,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _For
20782077}
20792078
20802079template <class _CharT, class _Traits, class _Allocator>
2081template<class _InputIterator>
2080template<class _InputIterator, class>
20822081inline
20832082basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last)
20842083{
......@@ -2089,7 +2088,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first,
20892088}
20902089
20912090template <class _CharT, class _Traits, class _Allocator>
2092template<class _InputIterator>
2091template<class _InputIterator, class>
20932092inline
20942093basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last,
20952094 const allocator_type& __a)
......@@ -2526,7 +2525,7 @@ basic_string<_CharT, _Traits, _Allocator>::__append_forward_unsafe(
25262525 const basic_string __temp (__first, __last, __alloc());
25272526 append(__temp.data(), __temp.size());
25282527 }
2529 else
2528 else
25302529 {
25312530 if (__cap - __sz < __n)
25322531 __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);
......@@ -3238,7 +3237,7 @@ basic_string<_CharT, _Traits, _Allocator>::at(size_type __n)
32383237template <class _CharT, class _Traits, class _Allocator>
32393238inline
32403239typename basic_string<_CharT, _Traits, _Allocator>::reference
3241basic_string<_CharT, _Traits, _Allocator>::front()
3240basic_string<_CharT, _Traits, _Allocator>::front() _NOEXCEPT
32423241{
32433242 _LIBCPP_ASSERT(!empty(), "string::front(): string is empty");
32443243 return *__get_pointer();
......@@ -3247,7 +3246,7 @@ basic_string<_CharT, _Traits, _Allocator>::front()
32473246template <class _CharT, class _Traits, class _Allocator>
32483247inline
32493248typename basic_string<_CharT, _Traits, _Allocator>::const_reference
3250basic_string<_CharT, _Traits, _Allocator>::front() const
3249basic_string<_CharT, _Traits, _Allocator>::front() const _NOEXCEPT
32513250{
32523251 _LIBCPP_ASSERT(!empty(), "string::front(): string is empty");
32533252 return *data();
......@@ -3256,7 +3255,7 @@ basic_string<_CharT, _Traits, _Allocator>::front() const
32563255template <class _CharT, class _Traits, class _Allocator>
32573256inline
32583257typename basic_string<_CharT, _Traits, _Allocator>::reference
3259basic_string<_CharT, _Traits, _Allocator>::back()
3258basic_string<_CharT, _Traits, _Allocator>::back() _NOEXCEPT
32603259{
32613260 _LIBCPP_ASSERT(!empty(), "string::back(): string is empty");
32623261 return *(__get_pointer() + size() - 1);
......@@ -3265,7 +3264,7 @@ basic_string<_CharT, _Traits, _Allocator>::back()
32653264template <class _CharT, class _Traits, class _Allocator>
32663265inline
32673266typename basic_string<_CharT, _Traits, _Allocator>::const_reference
3268basic_string<_CharT, _Traits, _Allocator>::back() const
3267basic_string<_CharT, _Traits, _Allocator>::back() const _NOEXCEPT
32693268{
32703269 _LIBCPP_ASSERT(!empty(), "string::back(): string is empty");
32713270 return *(data() + size() - 1);
......@@ -3296,9 +3295,9 @@ inline
32963295void
32973296basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
32983297#if _LIBCPP_STD_VER >= 14
3299 _NOEXCEPT_DEBUG
3298 _NOEXCEPT
33003299#else
3301 _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||
3300 _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
33023301 __is_nothrow_swappable<allocator_type>::value)
33033302#endif
33043303{
......@@ -3825,7 +3824,7 @@ basic_string<_CharT, _Traits, _Allocator>::__invariants() const
38253824
38263825template<class _CharT, class _Traits, class _Allocator>
38273826inline
3828void
3827void
38293828basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT
38303829{
38313830 clear();
......@@ -3835,7 +3834,7 @@ basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT
38353834 __set_long_cap(0);
38363835 __set_short_size(0);
38373836 }
3838}
3837}
38393838
38403839// operator==
38413840
......@@ -4228,21 +4227,17 @@ template<class _CharT, class _Traits, class _Allocator>
42284227 const typename basic_string<_CharT, _Traits, _Allocator>::size_type
42294228 basic_string<_CharT, _Traits, _Allocator>::npos;
42304229
4231template<class _CharT, class _Traits, class _Allocator>
4232struct _LIBCPP_TEMPLATE_VIS hash<basic_string<_CharT, _Traits, _Allocator> >
4233 : public unary_function<basic_string<_CharT, _Traits, _Allocator>, size_t>
4230template <class _CharT, class _Allocator>
4231struct _LIBCPP_TEMPLATE_VIS
4232 hash<basic_string<_CharT, char_traits<_CharT>, _Allocator> >
4233 : public unary_function<
4234 basic_string<_CharT, char_traits<_CharT>, _Allocator>, size_t>
42344235{
42354236 size_t
4236 operator()(const basic_string<_CharT, _Traits, _Allocator>& __val) const _NOEXCEPT;
4237 operator()(const basic_string<_CharT, char_traits<_CharT>, _Allocator>& __val) const _NOEXCEPT
4238 { return __do_string_hash(__val.data(), __val.data() + __val.size()); }
42374239};
42384240
4239template<class _CharT, class _Traits, class _Allocator>
4240size_t
4241hash<basic_string<_CharT, _Traits, _Allocator> >::operator()(
4242 const basic_string<_CharT, _Traits, _Allocator>& __val) const _NOEXCEPT
4243{
4244 return __do_string_hash(__val.data(), __val.data() + __val.size());
4245}
42464241
42474242template<class _CharT, class _Traits, class _Allocator>
42484243basic_ostream<_CharT, _Traits>&
......@@ -4332,7 +4327,7 @@ basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator*
43324327_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<char>)
43334328_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<wchar_t>)
43344329
4335#if _LIBCPP_STD_VER > 11
4330#if _LIBCPP_STD_VER > 11
43364331// Literal suffixes for basic_string [basic.string.literals]
43374332inline namespace literals
43384333{
lib/libcxx/include/string.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- string.h ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/string_view+20-21
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------ string_view ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -229,9 +228,9 @@ public:
229228 basic_string_view(const _CharT* __s, size_type __len) _NOEXCEPT
230229 : __data(__s), __size(__len)
231230 {
232// #if _LIBCPP_STD_VER > 11
233// _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): received nullptr");
234// #endif
231#if _LIBCPP_STD_VER > 11
232 _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): received nullptr");
233#endif
235234 }
236235
237236 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
......@@ -289,13 +288,13 @@ public:
289288 }
290289
291290 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
292 const_reference front() const
291 const_reference front() const _NOEXCEPT
293292 {
294293 return _LIBCPP_ASSERT(!empty(), "string_view::front(): string is empty"), __data[0];
295294 }
296295
297296 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
298 const_reference back() const
297 const_reference back() const _NOEXCEPT
299298 {
300299 return _LIBCPP_ASSERT(!empty(), "string_view::back(): string is empty"), __data[__size-1];
301300 }
......@@ -365,7 +364,7 @@ public:
365364 }
366365
367366 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
368 int compare( size_type __pos1, size_type __n1,
367 int compare( size_type __pos1, size_type __n1,
369368 basic_string_view __sv, size_type __pos2, size_type __n2) const
370369 {
371370 return substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
......@@ -629,7 +628,7 @@ bool operator==(basic_string_view<_CharT, _Traits> __lhs,
629628
630629template<class _CharT, class _Traits>
631630_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
632bool operator==(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
631bool operator==(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
633632 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
634633{
635634 if ( __lhs.size() != __rhs.size()) return false;
......@@ -659,7 +658,7 @@ bool operator!=(basic_string_view<_CharT, _Traits> __lhs,
659658
660659template<class _CharT, class _Traits>
661660_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
662bool operator!=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
661bool operator!=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
663662 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
664663{
665664 if ( __lhs.size() != __rhs.size())
......@@ -686,7 +685,7 @@ bool operator<(basic_string_view<_CharT, _Traits> __lhs,
686685
687686template<class _CharT, class _Traits>
688687_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
689bool operator<(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
688bool operator<(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
690689 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
691690{
692691 return __lhs.compare(__rhs) < 0;
......@@ -711,7 +710,7 @@ bool operator>(basic_string_view<_CharT, _Traits> __lhs,
711710
712711template<class _CharT, class _Traits>
713712_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
714bool operator>(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
713bool operator>(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
715714 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
716715{
717716 return __lhs.compare(__rhs) > 0;
......@@ -736,7 +735,7 @@ bool operator<=(basic_string_view<_CharT, _Traits> __lhs,
736735
737736template<class _CharT, class _Traits>
738737_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
739bool operator<=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
738bool operator<=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
740739 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
741740{
742741 return __lhs.compare(__rhs) <= 0;
......@@ -762,7 +761,7 @@ bool operator>=(basic_string_view<_CharT, _Traits> __lhs,
762761
763762template<class _CharT, class _Traits>
764763_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
765bool operator>=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
764bool operator>=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
766765 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
767766{
768767 return __lhs.compare(__rhs) >= 0;
......@@ -777,18 +776,18 @@ typedef basic_string_view<char32_t> u32string_view;
777776typedef basic_string_view<wchar_t> wstring_view;
778777
779778// [string.view.hash]
780template<class _CharT, class _Traits>
781struct _LIBCPP_TEMPLATE_VIS hash<basic_string_view<_CharT, _Traits> >
782 : public unary_function<basic_string_view<_CharT, _Traits>, size_t>
779template<class _CharT>
780struct _LIBCPP_TEMPLATE_VIS hash<basic_string_view<_CharT, char_traits<_CharT> > >
781 : public unary_function<basic_string_view<_CharT, char_traits<_CharT> >, size_t>
783782{
784783 _LIBCPP_INLINE_VISIBILITY
785 size_t operator()(const basic_string_view<_CharT, _Traits> __val) const _NOEXCEPT {
784 size_t operator()(const basic_string_view<_CharT, char_traits<_CharT> > __val) const _NOEXCEPT {
786785 return __do_string_hash(__val.data(), __val.data() + __val.size());
787786 }
788787};
789788
790789
791#if _LIBCPP_STD_VER > 11
790#if _LIBCPP_STD_VER > 11
792791inline namespace literals
793792{
794793 inline namespace string_view_literals
lib/libcxx/include/strstream+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- strstream --------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/android/locale_bionic.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------- support/android/locale_bionic.h ------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/fuchsia/xlocale.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------- support/fuchsia/xlocale.h ------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/ibm/limits.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------- support/ibm/limits.h ---------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/ibm/locale_mgmt_aix.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------- support/ibm/locale_mgmt_aix.h --------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/ibm/support.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===----------------------- support/ibm/support.h ----------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/ibm/xlocale.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------- support/ibm/xlocale.h -------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/musl/xlocale.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------- support/musl/xlocale.h ------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109// This adds support for the extended locale functions that are currently
lib/libcxx/include/support/newlib/xlocale.h+3-4
......@@ -1,9 +1,8 @@
11//===----------------------------------------------------------------------===//
22//
3// The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76//
87//===----------------------------------------------------------------------===//
98
lib/libcxx/include/support/solaris/floatingpoint.h+3-4
......@@ -1,9 +1,8 @@
11//===----------------------------------------------------------------------===//
22//
3// The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76//
87//===----------------------------------------------------------------------===//
98
lib/libcxx/include/support/solaris/wchar.h+3-4
......@@ -1,9 +1,8 @@
11//===----------------------------------------------------------------------===//
22//
3// The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76//
87//===----------------------------------------------------------------------===//
98
lib/libcxx/include/support/solaris/xlocale.h+3-4
......@@ -1,9 +1,8 @@
11//===----------------------------------------------------------------------===//
22//
3// The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76//
87//===----------------------------------------------------------------------===//
98
lib/libcxx/include/support/win32/limits_msvc_win32.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------ support/win32/limits_msvc_win32.h -----------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/win32/locale_win32.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------- support/win32/locale_win32.h -------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/xlocale/__nop_locale_mgmt.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------ support/xlocale/__nop_locale_mgmt.h -----------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/xlocale/__posix_l_fallback.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------- support/xlocale/__posix_l_fallback.h -----------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109// These are reimplementations of some extended locale functions ( *_l ) that
lib/libcxx/include/support/xlocale/__strtonum_fallback.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------- support/xlocale/__strtonum_fallback.h -----------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109// These are reimplementations of some extended locale functions ( *_l ) that
lib/libcxx/include/support/xlocale/xlocale.h deleted
lib/libcxx/include/system_error+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===---------------------------- system_error ----------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/tgmath.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- tgmath.h ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/thread+8-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- thread -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -435,7 +434,12 @@ sleep_for(const chrono::duration<_Rep, _Period>& __d)
435434 using namespace chrono;
436435 if (__d > duration<_Rep, _Period>::zero())
437436 {
437#if defined(_LIBCPP_COMPILER_GCC) && (__powerpc__ || __POWERPC__)
438 // GCC's long double const folding is incomplete for IBM128 long doubles.
438439 _LIBCPP_CONSTEXPR duration<long double> _Max = nanoseconds::max();
440#else
441 _LIBCPP_CONSTEXPR duration<long double> _Max = duration<long double>(ULLONG_MAX/1000000000ULL) ;
442#endif
439443 nanoseconds __ns;
440444 if (__d < _Max)
441445 {
lib/libcxx/include/tuple+87-68
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- tuple ------------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -88,8 +87,8 @@ template <class T> struct tuple_size; // undefined
8887template <class... T> struct tuple_size<tuple<T...>>;
8988template <class T>
9089 inline constexpr size_t tuple_size_v = tuple_size<T>::value; // C++17
91template <size_t I, class T> class tuple_element; // undefined
92template <size_t I, class... T> class tuple_element<I, tuple<T...>>;
90template <size_t I, class T> struct tuple_element; // undefined
91template <size_t I, class... T> struct tuple_element<I, tuple<T...>>;
9392template <size_t I, class T>
9493 using tuple_element_t = typename tuple_element <I, T>::type; // C++14
9594
......@@ -210,12 +209,12 @@ public:
210209 "Attempted to default construct a reference element in a tuple");}
211210
212211 template <class _Tp,
213 class = typename enable_if<
214 __lazy_and<
215 __lazy_not<is_same<typename __uncvref<_Tp>::type, __tuple_leaf>>
216 , is_constructible<_Hp, _Tp>
212 class = _EnableIf<
213 _And<
214 _IsNotSame<__uncvref_t<_Tp>, __tuple_leaf>,
215 is_constructible<_Hp, _Tp>
217216 >::value
218 >::type
217 >
219218 >
220219 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
221220 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
......@@ -292,12 +291,12 @@ public:
292291 : _Hp(__a) {}
293292
294293 template <class _Tp,
295 class = typename enable_if<
296 __lazy_and<
297 __lazy_not<is_same<typename __uncvref<_Tp>::type, __tuple_leaf>>
298 , is_constructible<_Hp, _Tp>
299 >::value
300 >::type
294 class = _EnableIf<
295 _And<
296 _IsNotSame<__uncvref_t<_Tp>, __tuple_leaf>,
297 is_constructible<_Hp, _Tp>
298 >::value
299 >
301300 >
302301 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
303302 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
......@@ -346,9 +345,6 @@ template <class ..._Tp>
346345_LIBCPP_INLINE_VISIBILITY
347346void __swallow(_Tp&&...) _NOEXCEPT {}
348347
349template <class ..._Tp>
350struct __lazy_all : __all<_Tp::value...> {};
351
352348template <class _Tp>
353349struct __all_default_constructible;
354350
......@@ -525,6 +521,13 @@ class _LIBCPP_TEMPLATE_VIS tuple
525521 template <class ..._Args>
526522 static constexpr bool __enable_implicit() {
527523 return
524 __tuple_constructible<
525 tuple<_Args...>,
526 typename __make_tuple_types<tuple,
527 sizeof...(_Args) < sizeof...(_Tp) ?
528 sizeof...(_Args) :
529 sizeof...(_Tp)>::type
530 >::value &&
528531 __tuple_convertible<
529532 tuple<_Args...>,
530533 typename __make_tuple_types<tuple,
......@@ -551,7 +554,8 @@ class _LIBCPP_TEMPLATE_VIS tuple
551554 {
552555 template <class _Tuple>
553556 static constexpr bool __enable_implicit() {
554 return __tuple_convertible<_Tuple, tuple>::value;
557 return __tuple_constructible<_Tuple, tuple>::value
558 && __tuple_convertible<_Tuple, tuple>::value;
555559 }
556560
557561 template <class _Tuple>
......@@ -568,19 +572,20 @@ class _LIBCPP_TEMPLATE_VIS tuple
568572 // the UTypes... constructor should be selected instead.
569573 // See LWG issue #2549.
570574 template <class _Tuple>
571 using _PreferTupleLikeConstructor = __lazy_or<
575 using _PreferTupleLikeConstructor = _Or<
572576 // Don't attempt the two checks below if the tuple we are given
573577 // has the same type as this tuple.
574 is_same<typename __uncvref<_Tuple>::type, tuple>,
575 __lazy_and<
576 __lazy_not<is_constructible<_Tp..., _Tuple>>,
577 __lazy_not<is_convertible<_Tuple, _Tp...>>
578 _IsSame<__uncvref_t<_Tuple>, tuple>,
579 _Lazy<_And,
580 _Not<is_constructible<_Tp..., _Tuple>>,
581 _Not<is_convertible<_Tuple, _Tp...>>
578582 >
579583 >;
580584
581585 template <class _Tuple>
582586 static constexpr bool __enable_implicit() {
583 return __lazy_and<
587 return _And<
588 __tuple_constructible<_Tuple, tuple>,
584589 __tuple_convertible<_Tuple, tuple>,
585590 _PreferTupleLikeConstructor<_Tuple>
586591 >::value;
......@@ -588,14 +593,33 @@ class _LIBCPP_TEMPLATE_VIS tuple
588593
589594 template <class _Tuple>
590595 static constexpr bool __enable_explicit() {
591 return __lazy_and<
596 return _And<
592597 __tuple_constructible<_Tuple, tuple>,
593598 _PreferTupleLikeConstructor<_Tuple>,
594 __lazy_not<__tuple_convertible<_Tuple, tuple>>
599 _Not<__tuple_convertible<_Tuple, tuple>>
595600 >::value;
596601 }
597602 };
598603
604 template <class _Tuple, bool _DisableIfLValue>
605 using _EnableImplicitTupleLikeConstructor = _EnableIf<
606 _CheckTupleLikeConstructor<
607 __tuple_like_with_size<_Tuple, sizeof...(_Tp)>::value
608 && !_PackExpandsToThisTuple<_Tuple>::value
609 && (!is_lvalue_reference<_Tuple>::value || !_DisableIfLValue)
610 >::template __enable_implicit<_Tuple>(),
611 bool
612 >;
613
614 template <class _Tuple, bool _DisableIfLValue>
615 using _EnableExplicitTupleLikeConstructor = _EnableIf<
616 _CheckTupleLikeConstructor<
617 __tuple_like_with_size<_Tuple, sizeof...(_Tp)>::value
618 && !_PackExpandsToThisTuple<_Tuple>::value
619 && (!is_lvalue_reference<_Tuple>::value || !_DisableIfLValue)
620 >::template __enable_explicit<_Tuple>(),
621 bool
622 >;
599623 template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
600624 typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;
601625 template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
......@@ -616,12 +640,13 @@ public:
616640 tuple(tuple const&) = default;
617641 tuple(tuple&&) = default;
618642
619 template <class _AllocArgT, class _Alloc, bool _Dummy = true, class = typename enable_if<
620 __lazy_and<
621 is_same<allocator_arg_t, _AllocArgT>,
622 __lazy_all<__dependent_type<is_default_constructible<_Tp>, _Dummy>...>
643 template <class _AllocArgT, class _Alloc, bool _Dummy = true, class = _EnableIf<
644 _And<
645 _IsSame<allocator_arg_t, _AllocArgT>,
646 __dependent_type<is_default_constructible<_Tp>, _Dummy>...
623647 >::value
624 >::type>
648 >
649 >
625650 _LIBCPP_INLINE_VISIBILITY
626651 tuple(_AllocArgT, _Alloc const& __a)
627652 : __base_(allocator_arg_t(), __a,
......@@ -809,35 +834,27 @@ public:
809834 typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
810835 _VSTD::forward<_Up>(__u)...) {}
811836
812 template <class _Tuple,
813 typename enable_if
814 <
815 _CheckTupleLikeConstructor<
816 __tuple_like_with_size<_Tuple, sizeof...(_Tp)>::value
817 && !_PackExpandsToThisTuple<_Tuple>::value
818 >::template __enable_implicit<_Tuple>(),
819 bool
820 >::type = false
821 >
837 template <class _Tuple, _EnableImplicitTupleLikeConstructor<_Tuple, true> = false>
822838 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
823839 tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value))
824840 : __base_(_VSTD::forward<_Tuple>(__t)) {}
825841
826 template <class _Tuple,
827 typename enable_if
828 <
829 _CheckTupleLikeConstructor<
830 __tuple_like_with_size<_Tuple, sizeof...(_Tp)>::value
831 && !_PackExpandsToThisTuple<_Tuple>::value
832 >::template __enable_explicit<_Tuple>(),
833 bool
834 >::type = false
835 >
842 template <class _Tuple, _EnableImplicitTupleLikeConstructor<const _Tuple&, false> = false>
843 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
844 tuple(const _Tuple& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, const _Tuple&>::value))
845 : __base_(__t) {}
846 template <class _Tuple, _EnableExplicitTupleLikeConstructor<_Tuple, true> = false>
836847 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
837848 explicit
838849 tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value))
839850 : __base_(_VSTD::forward<_Tuple>(__t)) {}
840851
852 template <class _Tuple, _EnableExplicitTupleLikeConstructor<const _Tuple&, false> = false>
853 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
854 explicit
855 tuple(const _Tuple& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, const _Tuple&>::value))
856 : __base_(__t) {}
857
841858 template <class _Alloc, class _Tuple,
842859 typename enable_if
843860 <
......@@ -908,7 +925,7 @@ class _LIBCPP_TEMPLATE_VIS tuple<>
908925{
909926public:
910927 _LIBCPP_INLINE_VISIBILITY
911 _LIBCPP_CONSTEXPR tuple() _NOEXCEPT {}
928 _LIBCPP_CONSTEXPR tuple() _NOEXCEPT = default;
912929 template <class _Alloc>
913930 _LIBCPP_INLINE_VISIBILITY
914931 tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
......@@ -953,7 +970,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
953970typename tuple_element<_Ip, tuple<_Tp...> >::type&
954971get(tuple<_Tp...>& __t) _NOEXCEPT
955972{
956 typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
973 typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, tuple<_Tp...> >::type type;
957974 return static_cast<__tuple_leaf<_Ip, type>&>(__t.__base_).get();
958975}
959976
......@@ -962,7 +979,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
962979const typename tuple_element<_Ip, tuple<_Tp...> >::type&
963980get(const tuple<_Tp...>& __t) _NOEXCEPT
964981{
965 typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
982 typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, tuple<_Tp...> >::type type;
966983 return static_cast<const __tuple_leaf<_Ip, type>&>(__t.__base_).get();
967984}
968985
......@@ -971,7 +988,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
971988typename tuple_element<_Ip, tuple<_Tp...> >::type&&
972989get(tuple<_Tp...>&& __t) _NOEXCEPT
973990{
974 typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
991 typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, tuple<_Tp...> >::type type;
975992 return static_cast<type&&>(
976993 static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get());
977994}
......@@ -981,7 +998,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
981998const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
982999get(const tuple<_Tp...>&& __t) _NOEXCEPT
9831000{
984 typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
1001 typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, tuple<_Tp...> >::type type;
9851002 return static_cast<const type&&>(
9861003 static_cast<const __tuple_leaf<_Ip, type>&&>(__t.__base_).get());
9871004}
......@@ -1121,6 +1138,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
11211138bool
11221139operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
11231140{
1141 static_assert (sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes");
11241142 return __tuple_equal<sizeof...(_Tp)>()(__x, __y);
11251143}
11261144
......@@ -1164,6 +1182,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
11641182bool
11651183operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
11661184{
1185 static_assert (sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes");
11671186 return __tuple_less<sizeof...(_Tp)>()(__x, __y);
11681187}
11691188
......@@ -1198,7 +1217,7 @@ template <class _Tp, class _Up> struct __tuple_cat_type;
11981217template <class ..._Ttypes, class ..._Utypes>
11991218struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> >
12001219{
1201 typedef tuple<_Ttypes..., _Utypes...> type;
1220 typedef _LIBCPP_NODEBUG_TYPE tuple<_Ttypes..., _Utypes...> type;
12021221};
12031222
12041223template <class _ResultTuple, bool _Is_Tuple0TupleLike, class ..._Tuples>
......@@ -1209,8 +1228,8 @@ struct __tuple_cat_return_1
12091228template <class ..._Types, class _Tuple0>
12101229struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0>
12111230{
1212 typedef typename __tuple_cat_type<tuple<_Types...>,
1213 typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type>::type
1231 typedef _LIBCPP_NODEBUG_TYPE typename __tuple_cat_type<tuple<_Types...>,
1232 typename __make_tuple_types<typename __uncvref<_Tuple0>::type>::type>::type
12141233 type;
12151234};
12161235
......@@ -1219,7 +1238,7 @@ struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples...
12191238 : public __tuple_cat_return_1<
12201239 typename __tuple_cat_type<
12211240 tuple<_Types...>,
1222 typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type
1241 typename __make_tuple_types<typename __uncvref<_Tuple0>::type>::type
12231242 >::type,
12241243 __tuple_like<typename remove_reference<_Tuple1>::type>::value,
12251244 _Tuple1, _Tuples...>
......@@ -1239,7 +1258,7 @@ struct __tuple_cat_return<_Tuple0, _Tuples...>
12391258template <>
12401259struct __tuple_cat_return<>
12411260{
1242 typedef tuple<> type;
1261 typedef _LIBCPP_NODEBUG_TYPE tuple<> type;
12431262};
12441263
12451264inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
......@@ -1255,7 +1274,7 @@ struct __tuple_cat_return_ref_imp;
12551274template <class ..._Types, size_t ..._I0, class _Tuple0>
12561275struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0>
12571276{
1258 typedef typename remove_reference<_Tuple0>::type _T0;
1277 typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple0>::type _T0;
12591278 typedef tuple<_Types..., typename __apply_cv<_Tuple0,
12601279 typename tuple_element<_I0, _T0>::type>::type&&...> type;
12611280};
......@@ -1302,8 +1321,8 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J
13021321 typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
13031322 operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls)
13041323 {
1305 typedef typename remove_reference<_Tuple0>::type _T0;
1306 typedef typename remove_reference<_Tuple1>::type _T1;
1324 typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple0>::type _T0;
1325 typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple1>::type _T1;
13071326 return __tuple_cat<
13081327 tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>,
13091328 typename __make_tuple_indices<sizeof ...(_Types) + tuple_size<_T0>::value>::type,
......@@ -1322,7 +1341,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
13221341typename __tuple_cat_return<_Tuple0, _Tuples...>::type
13231342tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls)
13241343{
1325 typedef typename remove_reference<_Tuple0>::type _T0;
1344 typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple0>::type _T0;
13261345 return __tuple_cat<tuple<>, __tuple_indices<>,
13271346 typename __make_tuple_indices<tuple_size<_T0>::value>::type>()
13281347 (tuple<>(), _VSTD::forward<_Tuple0>(__t0),
lib/libcxx/include/type_traits+431-1240
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------ type_traits ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -91,6 +90,9 @@ namespace std
9190 template <class T> struct remove_extent;
9291 template <class T> struct remove_all_extents;
9392
93 template <class T> struct is_bounded_array; // C++20
94 template <class T> struct is_unbounded_array; // C++20
95
9496 // Member introspection:
9597 template <class T> struct is_pod;
9698 template <class T> struct is_trivial;
......@@ -141,7 +143,10 @@ namespace std
141143 // Relationships between types:
142144 template <class T, class U> struct is_same;
143145 template <class Base, class Derived> struct is_base_of;
146
144147 template <class From, class To> struct is_convertible;
148 template <typename From, typename To> struct is_nothrow_convertible; // C++20
149 template <typename From, typename To> inline constexpr bool is_nothrow_convertible_v; // C++20
145150
146151 template <class Fn, class... ArgTypes> struct is_invocable;
147152 template <class R, class Fn, class... ArgTypes> struct is_invocable_r;
......@@ -197,6 +202,12 @@ namespace std
197202 template <class T>
198203 using remove_all_extents_t = typename remove_all_extents<T>::type; // C++14
199204
205 template <class T>
206 inline constexpr bool is_bounded_array_v
207 = is_bounded_array<T>::value; // C++20
208 inline constexpr bool is_unbounded_array_v
209 = is_unbounded_array<T>::value; // C++20
210
200211 // pointer modifications:
201212 template <class T>
202213 using remove_pointer_t = typename remove_pointer<T>::type; // C++14
......@@ -416,6 +427,96 @@ template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS pair;
416427template <class _Tp> class _LIBCPP_TEMPLATE_VIS reference_wrapper;
417428template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
418429
430
431template <class _Tp, _Tp __v>
432struct _LIBCPP_TEMPLATE_VIS integral_constant
433{
434 static _LIBCPP_CONSTEXPR const _Tp value = __v;
435 typedef _Tp value_type;
436 typedef integral_constant type;
437 _LIBCPP_INLINE_VISIBILITY
438 _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT {return value;}
439#if _LIBCPP_STD_VER > 11
440 _LIBCPP_INLINE_VISIBILITY
441 constexpr value_type operator ()() const _NOEXCEPT {return value;}
442#endif
443};
444
445template <class _Tp, _Tp __v>
446_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;
447
448#if _LIBCPP_STD_VER > 14
449template <bool __b>
450using bool_constant = integral_constant<bool, __b>;
451#define _LIBCPP_BOOL_CONSTANT(__b) bool_constant<(__b)>
452#else
453#define _LIBCPP_BOOL_CONSTANT(__b) integral_constant<bool,(__b)>
454#endif
455
456typedef _LIBCPP_BOOL_CONSTANT(true) true_type;
457typedef _LIBCPP_BOOL_CONSTANT(false) false_type;
458
459template <bool _Val>
460using _BoolConstant _LIBCPP_NODEBUG_TYPE = integral_constant<bool, _Val>;
461
462template <bool> struct _MetaBase;
463template <>
464struct _MetaBase<true> {
465 template <class _Tp, class _Up>
466 using _SelectImpl _LIBCPP_NODEBUG_TYPE = _Tp;
467 template <template <class...> class _FirstFn, template <class...> class, class ..._Args>
468 using _SelectApplyImpl _LIBCPP_NODEBUG_TYPE = _FirstFn<_Args...>;
469 template <class _First, class...>
470 using _FirstImpl _LIBCPP_NODEBUG_TYPE = _First;
471 template <class, class _Second, class...>
472 using _SecondImpl _LIBCPP_NODEBUG_TYPE = _Second;
473 template <class _Tp = void>
474 using _EnableIfImpl _LIBCPP_NODEBUG_TYPE = _Tp;
475 template <class _Result, class _First, class ..._Rest>
476 using _OrImpl _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_First::value != true && sizeof...(_Rest) != 0>::template _OrImpl<_First, _Rest...>;
477 template <class _Result, class _First, class ..._Rest>
478 using _AndImpl _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_First::value == true && sizeof...(_Rest) != 0>::template _AndImpl<_First, _Rest...>;
479};
480
481template <>
482struct _MetaBase<false> {
483 template <class _Tp, class _Up>
484 using _SelectImpl _LIBCPP_NODEBUG_TYPE = _Up;
485 template <template <class...> class, template <class...> class _SecondFn, class ..._Args>
486 using _SelectApplyImpl _LIBCPP_NODEBUG_TYPE = _SecondFn<_Args...>;
487 template <class _Result, class ...>
488 using _OrImpl _LIBCPP_NODEBUG_TYPE = _Result;
489 template <class _Result, class ...>
490 using _AndImpl _LIBCPP_NODEBUG_TYPE = _Result;
491};
492template <bool _Cond, class _Ret = void>
493using _EnableIf _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_Cond>::template _EnableIfImpl<_Ret>;
494template <bool _Cond, class _IfRes, class _ElseRes>
495using _If _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_Cond>::template _SelectImpl<_IfRes, _ElseRes>;
496template <class ..._Rest>
497using _Or _LIBCPP_NODEBUG_TYPE = typename _MetaBase< sizeof...(_Rest) != 0 >::template _OrImpl<false_type, _Rest...>;
498template <class ..._Rest>
499using _And _LIBCPP_NODEBUG_TYPE = typename _MetaBase< sizeof...(_Rest) != 0 >::template _AndImpl<true_type, _Rest...>;
500template <class _Pred>
501struct _Not : _BoolConstant<!_Pred::value> {};
502template <class ..._Args>
503using _FirstType _LIBCPP_NODEBUG_TYPE = typename _MetaBase<(sizeof...(_Args) >= 1)>::template _FirstImpl<_Args...>;
504template <class ..._Args>
505using _SecondType _LIBCPP_NODEBUG_TYPE = typename _MetaBase<(sizeof...(_Args) >= 2)>::template _SecondImpl<_Args...>;
506
507template <template <class...> class _Func, class ..._Args>
508struct _Lazy : _Func<_Args...> {};
509
510// Member detector base
511
512template <template <class...> class _Templ, class ..._Args>
513true_type __sfinae_test_impl(_FirstType<int, _Templ<_Args...> >);
514template <template <class...> class, class ...>
515false_type __sfinae_test_impl(...);
516
517template <template <class ...> class _Templ, class ..._Args>
518using _IsValidExpansion _LIBCPP_NODEBUG_TYPE = decltype(std::__sfinae_test_impl<_Templ, _Args...>(0));
519
419520template <class>
420521struct __void_t { typedef void type; };
421522
......@@ -434,9 +535,6 @@ template <class _If, class _Then>
434535template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type;
435536#endif
436537
437template <bool, class _Tp> struct _LIBCPP_TEMPLATE_VIS __lazy_enable_if {};
438template <class _Tp> struct _LIBCPP_TEMPLATE_VIS __lazy_enable_if<true, _Tp> {typedef typename _Tp::type type;};
439
440538template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
441539template <class _Tp> struct _LIBCPP_TEMPLATE_VIS enable_if<true, _Tp> {typedef _Tp type;};
442540
......@@ -444,6 +542,34 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS enable_if<true, _Tp> {typedef _
444542template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type;
445543#endif
446544
545// is_same
546
547template <class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS is_same : public false_type {};
548template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_same<_Tp, _Tp> : public true_type {};
549
550#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
551template <class _Tp, class _Up>
552_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_same_v
553 = is_same<_Tp, _Up>::value;
554#endif
555
556template <class _Tp, class _Up>
557using _IsSame = _BoolConstant<
558#ifdef __clang__
559 __is_same(_Tp, _Up)
560#else
561 _VSTD::is_same<_Tp, _Up>::value
562#endif
563>;
564
565template <class _Tp, class _Up>
566using _IsNotSame = _BoolConstant<
567#ifdef __clang__
568 !__is_same(_Tp, _Up)
569#else
570 !_VSTD::is_same<_Tp, _Up>::value
571#endif
572>;
447573// addressof
448574#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
449575
......@@ -517,111 +643,6 @@ struct __two {char __lx[2];};
517643
518644// helper class:
519645
520template <class _Tp, _Tp __v>
521struct _LIBCPP_TEMPLATE_VIS integral_constant
522{
523 static _LIBCPP_CONSTEXPR const _Tp value = __v;
524 typedef _Tp value_type;
525 typedef integral_constant type;
526 _LIBCPP_INLINE_VISIBILITY
527 _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT {return value;}
528#if _LIBCPP_STD_VER > 11
529 _LIBCPP_INLINE_VISIBILITY
530 constexpr value_type operator ()() const _NOEXCEPT {return value;}
531#endif
532};
533
534template <class _Tp, _Tp __v>
535_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;
536
537#if _LIBCPP_STD_VER > 14
538template <bool __b>
539using bool_constant = integral_constant<bool, __b>;
540#define _LIBCPP_BOOL_CONSTANT(__b) bool_constant<(__b)>
541#else
542#define _LIBCPP_BOOL_CONSTANT(__b) integral_constant<bool,(__b)>
543#endif
544
545typedef _LIBCPP_BOOL_CONSTANT(true) true_type;
546typedef _LIBCPP_BOOL_CONSTANT(false) false_type;
547
548#if !defined(_LIBCPP_CXX03_LANG)
549
550// __lazy_and
551
552template <bool _Last, class ..._Preds>
553struct __lazy_and_impl;
554
555template <class ..._Preds>
556struct __lazy_and_impl<false, _Preds...> : false_type {};
557
558template <>
559struct __lazy_and_impl<true> : true_type {};
560
561template <class _Pred>
562struct __lazy_and_impl<true, _Pred> : integral_constant<bool, _Pred::type::value> {};
563
564template <class _Hp, class ..._Tp>
565struct __lazy_and_impl<true, _Hp, _Tp...> : __lazy_and_impl<_Hp::type::value, _Tp...> {};
566
567template <class _P1, class ..._Pr>
568struct __lazy_and : __lazy_and_impl<_P1::type::value, _Pr...> {};
569
570// __lazy_or
571
572template <bool _List, class ..._Preds>
573struct __lazy_or_impl;
574
575template <class ..._Preds>
576struct __lazy_or_impl<true, _Preds...> : true_type {};
577
578template <>
579struct __lazy_or_impl<false> : false_type {};
580
581template <class _Hp, class ..._Tp>
582struct __lazy_or_impl<false, _Hp, _Tp...>
583 : __lazy_or_impl<_Hp::type::value, _Tp...> {};
584
585template <class _P1, class ..._Pr>
586struct __lazy_or : __lazy_or_impl<_P1::type::value, _Pr...> {};
587
588// __lazy_not
589
590template <class _Pred>
591struct __lazy_not : integral_constant<bool, !_Pred::type::value> {};
592
593// __and_
594template<class...> struct __and_;
595template<> struct __and_<> : true_type {};
596
597template<class _B0> struct __and_<_B0> : _B0 {};
598
599template<class _B0, class _B1>
600struct __and_<_B0, _B1> : conditional<_B0::value, _B1, _B0>::type {};
601
602template<class _B0, class _B1, class _B2, class... _Bn>
603struct __and_<_B0, _B1, _B2, _Bn...>
604 : conditional<_B0::value, __and_<_B1, _B2, _Bn...>, _B0>::type {};
605
606// __or_
607template<class...> struct __or_;
608template<> struct __or_<> : false_type {};
609
610template<class _B0> struct __or_<_B0> : _B0 {};
611
612template<class _B0, class _B1>
613struct __or_<_B0, _B1> : conditional<_B0::value, _B0, _B1>::type {};
614
615template<class _B0, class _B1, class _B2, class... _Bn>
616struct __or_<_B0, _B1, _B2, _Bn...>
617 : conditional<_B0::value, _B0, __or_<_B1, _B2, _Bn...> >::type {};
618
619// __not_
620template<class _Tp>
621struct __not_ : conditional<_Tp::value, false_type, true_type>::type {};
622
623#endif // !defined(_LIBCPP_CXX03_LANG)
624
625646// is_const
626647
627648template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const : public false_type {};
......@@ -774,8 +795,16 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_array_v
774795template <class _Tp> struct __libcpp_is_pointer : public false_type {};
775796template <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {};
776797
798template <class _Tp> struct __libcpp_remove_objc_qualifiers { typedef _Tp type; };
799#if defined(_LIBCPP_HAS_OBJC_ARC)
800template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __strong> { typedef _Tp type; };
801template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __weak> { typedef _Tp type; };
802template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __autoreleasing> { typedef _Tp type; };
803template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __unsafe_unretained> { typedef _Tp type; };
804#endif
805
777806template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pointer
778 : public __libcpp_is_pointer<typename remove_cv<_Tp>::type> {};
807 : public __libcpp_is_pointer<typename __libcpp_remove_objc_qualifiers<typename remove_cv<_Tp>::type>::type> {};
779808
780809#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
781810template <class _Tp>
......@@ -789,15 +818,11 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : pub
789818template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference<_Tp&> : public true_type {};
790819
791820template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : public false_type {};
792#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
793821template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference<_Tp&&> : public true_type {};
794#endif
795822
796823template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference : public false_type {};
797824template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&> : public true_type {};
798#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
799825template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&&> : public true_type {};
800#endif
801826
802827#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
803828template <class _Tp>
......@@ -814,7 +839,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_rvalue_reference_v
814839#endif
815840// is_union
816841
817#if __has_feature(is_union) || (_GNUC_VER >= 403)
842#if __has_feature(is_union) || defined(_LIBCPP_COMPILER_GCC)
818843
819844template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_union
820845 : public integral_constant<bool, __is_union(_Tp)> {};
......@@ -835,7 +860,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_union_v
835860
836861// is_class
837862
838#if __has_feature(is_class) || (_GNUC_VER >= 403)
863#if __has_feature(is_class) || defined(_LIBCPP_COMPILER_GCC)
839864
840865template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_class
841866 : public integral_constant<bool, __is_class(_Tp)> {};
......@@ -859,17 +884,6 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_class_v
859884 = is_class<_Tp>::value;
860885#endif
861886
862// is_same
863
864template <class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS is_same : public false_type {};
865template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_same<_Tp, _Tp> : public true_type {};
866
867#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
868template <class _Tp, class _Up>
869_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_same_v
870 = is_same<_Tp, _Up>::value;
871#endif
872
873887// is_function
874888
875889namespace __libcpp_is_function_imp
......@@ -957,7 +971,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_object_pointer_v
957971
958972// is_enum
959973
960#if __has_feature(is_enum) || (_GNUC_VER >= 403)
974#if __has_feature(is_enum) || defined(_LIBCPP_COMPILER_GCC)
961975
962976template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_enum
963977 : public integral_constant<bool, __is_enum(_Tp)> {};
......@@ -1061,7 +1075,7 @@ struct __is_referenceable_impl {
10611075
10621076template <class _Tp>
10631077struct __is_referenceable : integral_constant<bool,
1064 !is_same<decltype(__is_referenceable_impl::__test<_Tp>(0)), __two>::value> {};
1078 _IsNotSame<decltype(__is_referenceable_impl::__test<_Tp>(0)), __two>::value> {};
10651079
10661080
10671081// add_const
......@@ -1069,13 +1083,13 @@ struct __is_referenceable : integral_constant<bool,
10691083template <class _Tp, bool = is_reference<_Tp>::value ||
10701084 is_function<_Tp>::value ||
10711085 is_const<_Tp>::value >
1072struct __add_const {typedef _Tp type;};
1086struct __add_const {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
10731087
10741088template <class _Tp>
1075struct __add_const<_Tp, false> {typedef const _Tp type;};
1089struct __add_const<_Tp, false> {typedef _LIBCPP_NODEBUG_TYPE const _Tp type;};
10761090
10771091template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_const
1078 {typedef typename __add_const<_Tp>::type type;};
1092 {typedef _LIBCPP_NODEBUG_TYPE typename __add_const<_Tp>::type type;};
10791093
10801094#if _LIBCPP_STD_VER > 11
10811095template <class _Tp> using add_const_t = typename add_const<_Tp>::type;
......@@ -1092,7 +1106,7 @@ template <class _Tp>
10921106struct __add_volatile<_Tp, false> {typedef volatile _Tp type;};
10931107
10941108template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_volatile
1095 {typedef typename __add_volatile<_Tp>::type type;};
1109 {typedef _LIBCPP_NODEBUG_TYPE typename __add_volatile<_Tp>::type type;};
10961110
10971111#if _LIBCPP_STD_VER > 11
10981112template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type;
......@@ -1101,7 +1115,7 @@ template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type;
11011115// add_cv
11021116
11031117template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_cv
1104 {typedef typename add_const<typename add_volatile<_Tp>::type>::type type;};
1118 {typedef _LIBCPP_NODEBUG_TYPE typename add_const<typename add_volatile<_Tp>::type>::type type;};
11051119
11061120#if _LIBCPP_STD_VER > 11
11071121template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type;
......@@ -1109,11 +1123,9 @@ template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type;
11091123
11101124// remove_reference
11111125
1112template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _Tp type;};
1113template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&> {typedef _Tp type;};
1114#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1115template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&&> {typedef _Tp type;};
1116#endif
1126template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
1127template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
1128template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&&> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
11171129
11181130#if _LIBCPP_STD_VER > 11
11191131template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type;
......@@ -1121,32 +1133,26 @@ template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::
11211133
11221134// add_lvalue_reference
11231135
1124template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_lvalue_reference_impl { typedef _Tp type; };
1125template <class _Tp > struct __add_lvalue_reference_impl<_Tp, true> { typedef _Tp& type; };
1136template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_lvalue_reference_impl { typedef _LIBCPP_NODEBUG_TYPE _Tp type; };
1137template <class _Tp > struct __add_lvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG_TYPE _Tp& type; };
11261138
11271139template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_lvalue_reference
1128{typedef typename __add_lvalue_reference_impl<_Tp>::type type;};
1140{typedef _LIBCPP_NODEBUG_TYPE typename __add_lvalue_reference_impl<_Tp>::type type;};
11291141
11301142#if _LIBCPP_STD_VER > 11
11311143template <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type;
11321144#endif
11331145
1134#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1135
1136template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_rvalue_reference_impl { typedef _Tp type; };
1137template <class _Tp > struct __add_rvalue_reference_impl<_Tp, true> { typedef _Tp&& type; };
1146template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_rvalue_reference_impl { typedef _LIBCPP_NODEBUG_TYPE _Tp type; };
1147template <class _Tp > struct __add_rvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG_TYPE _Tp&& type; };
11381148
11391149template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_rvalue_reference
1140{typedef typename __add_rvalue_reference_impl<_Tp>::type type;};
1150{typedef _LIBCPP_NODEBUG_TYPE typename __add_rvalue_reference_impl<_Tp>::type type;};
11411151
11421152#if _LIBCPP_STD_VER > 11
11431153template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type;
11441154#endif
11451155
1146#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1147
1148#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1149
11501156template <class _Tp> _Tp&& __declval(int);
11511157template <class _Tp> _Tp __declval(long);
11521158
......@@ -1154,35 +1160,27 @@ template <class _Tp>
11541160decltype(_VSTD::__declval<_Tp>(0))
11551161declval() _NOEXCEPT;
11561162
1157#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1158
1159template <class _Tp>
1160typename add_lvalue_reference<_Tp>::type
1161declval();
1162
1163#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1164
11651163// __uncvref
11661164
11671165template <class _Tp>
11681166struct __uncvref {
1169 typedef typename remove_cv<typename remove_reference<_Tp>::type>::type type;
1167 typedef _LIBCPP_NODEBUG_TYPE typename remove_cv<typename remove_reference<_Tp>::type>::type type;
11701168};
11711169
11721170template <class _Tp>
11731171struct __unconstref {
1174 typedef typename remove_const<typename remove_reference<_Tp>::type>::type type;
1172 typedef _LIBCPP_NODEBUG_TYPE typename remove_const<typename remove_reference<_Tp>::type>::type type;
11751173};
11761174
11771175#ifndef _LIBCPP_CXX03_LANG
11781176template <class _Tp>
1179using __uncvref_t = typename __uncvref<_Tp>::type;
1177using __uncvref_t _LIBCPP_NODEBUG_TYPE = typename __uncvref<_Tp>::type;
11801178#endif
11811179
11821180// __is_same_uncvref
11831181
11841182template <class _Tp, class _Up>
1185struct __is_same_uncvref : is_same<typename __uncvref<_Tp>::type,
1183struct __is_same_uncvref : _IsSame<typename __uncvref<_Tp>::type,
11861184 typename __uncvref<_Up>::type> {};
11871185
11881186#if _LIBCPP_STD_VER > 17
......@@ -1201,11 +1199,11 @@ struct __any
12011199
12021200// remove_pointer
12031201
1204template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer {typedef _Tp type;};
1205template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp*> {typedef _Tp type;};
1206template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const> {typedef _Tp type;};
1207template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* volatile> {typedef _Tp type;};
1208template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const volatile> {typedef _Tp type;};
1202template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
1203template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp*> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
1204template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
1205template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* volatile> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
1206template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const volatile> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
12091207
12101208#if _LIBCPP_STD_VER > 11
12111209template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type;
......@@ -1215,14 +1213,14 @@ template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type
12151213
12161214template <class _Tp,
12171215 bool = __is_referenceable<_Tp>::value ||
1218 is_same<typename remove_cv<_Tp>::type, void>::value>
1216 _IsSame<typename remove_cv<_Tp>::type, void>::value>
12191217struct __add_pointer_impl
1220 {typedef typename remove_reference<_Tp>::type* type;};
1218 {typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tp>::type* type;};
12211219template <class _Tp> struct __add_pointer_impl<_Tp, false>
1222 {typedef _Tp type;};
1220 {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
12231221
12241222template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_pointer
1225 {typedef typename __add_pointer_impl<_Tp>::type type;};
1223 {typedef _LIBCPP_NODEBUG_TYPE typename __add_pointer_impl<_Tp>::type type;};
12261224
12271225#if _LIBCPP_STD_VER > 11
12281226template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type;
......@@ -1336,17 +1334,37 @@ template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS remove_all_extents<
13361334template <class _Tp> using remove_all_extents_t = typename remove_all_extents<_Tp>::type;
13371335#endif
13381336
1337#if _LIBCPP_STD_VER > 17
1338// is_bounded_array
1339
1340template <class> struct _LIBCPP_TEMPLATE_VIS is_bounded_array : false_type {};
1341template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS is_bounded_array<_Tp[_Np]> : true_type {};
1342
1343template <class _Tp>
1344_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR
1345bool is_bounded_array_v = is_bounded_array<_Tp>::value;
1346
1347// is_unbounded_array
1348
1349template <class> struct _LIBCPP_TEMPLATE_VIS is_unbounded_array : false_type {};
1350template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_unbounded_array<_Tp[]> : true_type {};
1351
1352template <class _Tp>
1353_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR
1354bool is_unbounded_array_v = is_unbounded_array<_Tp>::value;
1355#endif
1356
13391357// decay
13401358
13411359template <class _Up, bool>
13421360struct __decay {
1343 typedef typename remove_cv<_Up>::type type;
1361 typedef _LIBCPP_NODEBUG_TYPE typename remove_cv<_Up>::type type;
13441362};
13451363
13461364template <class _Up>
13471365struct __decay<_Up, true> {
13481366public:
1349 typedef typename conditional
1367 typedef _LIBCPP_NODEBUG_TYPE typename conditional
13501368 <
13511369 is_array<_Up>::value,
13521370 typename remove_extent<_Up>::type*,
......@@ -1363,9 +1381,9 @@ template <class _Tp>
13631381struct _LIBCPP_TEMPLATE_VIS decay
13641382{
13651383private:
1366 typedef typename remove_reference<_Tp>::type _Up;
1384 typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tp>::type _Up;
13671385public:
1368 typedef typename __decay<_Up, __is_referenceable<_Up>::value>::type type;
1386 typedef _LIBCPP_NODEBUG_TYPE typename __decay<_Up, __is_referenceable<_Up>::value>::type type;
13691387};
13701388
13711389#if _LIBCPP_STD_VER > 11
......@@ -1385,15 +1403,10 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_abstract_v
13851403
13861404// is_final
13871405
1388#if defined(_LIBCPP_HAS_IS_FINAL)
13891406template <class _Tp> struct _LIBCPP_TEMPLATE_VIS
13901407__libcpp_is_final : public integral_constant<bool, __is_final(_Tp)> {};
1391#else
1392template <class _Tp> struct _LIBCPP_TEMPLATE_VIS
1393__libcpp_is_final : public false_type {};
1394#endif
13951408
1396#if defined(_LIBCPP_HAS_IS_FINAL) && _LIBCPP_STD_VER > 11
1409#if _LIBCPP_STD_VER > 11
13971410template <class _Tp> struct _LIBCPP_TEMPLATE_VIS
13981411is_final : public integral_constant<bool, __is_final(_Tp)> {};
13991412#endif
......@@ -1420,39 +1433,10 @@ _LIBCPP_INLINE_VAR constexpr bool is_aggregate_v
14201433
14211434// is_base_of
14221435
1423#ifdef _LIBCPP_HAS_IS_BASE_OF
1424
14251436template <class _Bp, class _Dp>
14261437struct _LIBCPP_TEMPLATE_VIS is_base_of
14271438 : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};
14281439
1429#else // _LIBCPP_HAS_IS_BASE_OF
1430
1431namespace __is_base_of_imp
1432{
1433template <class _Tp>
1434struct _Dst
1435{
1436 _Dst(const volatile _Tp &);
1437};
1438template <class _Tp>
1439struct _Src
1440{
1441 operator const volatile _Tp &();
1442 template <class _Up> operator const _Dst<_Up> &();
1443};
1444template <size_t> struct __one { typedef char type; };
1445template <class _Bp, class _Dp> typename __one<sizeof(_Dst<_Bp>(declval<_Src<_Dp> >()))>::type __test(int);
1446template <class _Bp, class _Dp> __two __test(...);
1447}
1448
1449template <class _Bp, class _Dp>
1450struct _LIBCPP_TEMPLATE_VIS is_base_of
1451 : public integral_constant<bool, is_class<_Bp>::value &&
1452 sizeof(__is_base_of_imp::__test<_Bp, _Dp>(0)) == 2> {};
1453
1454#endif // _LIBCPP_HAS_IS_BASE_OF
1455
14561440#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
14571441template <class _Bp, class _Dp>
14581442_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_base_of_v
......@@ -1509,14 +1493,6 @@ template <class _T1, class _T2,
15091493struct __is_convertible
15101494 : public integral_constant<bool,
15111495 __is_convertible_imp::__is_convertible_test<_T1, _T2>::value
1512#if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
1513 && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value
1514 && (!is_const<typename remove_reference<_T2>::type>::value
1515 || is_volatile<typename remove_reference<_T2>::type>::value)
1516 && (is_same<typename remove_cv<_T1>::type,
1517 typename remove_cv<typename remove_reference<_T2>::type>::type>::value
1518 || is_base_of<typename remove_reference<_T2>::type, _T1>::value))
1519#endif
15201496 >
15211497{};
15221498
......@@ -1550,9 +1526,35 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_convertible_v
15501526 = is_convertible<_From, _To>::value;
15511527#endif
15521528
1529// is_nothrow_convertible
1530
1531#if _LIBCPP_STD_VER > 17
1532
1533template <typename _Tp>
1534static void __test_noexcept(_Tp) noexcept;
1535
1536template<typename _Fm, typename _To>
1537static bool_constant<noexcept(__test_noexcept<_To>(declval<_Fm>()))>
1538__is_nothrow_convertible_test();
1539
1540template <typename _Fm, typename _To>
1541struct __is_nothrow_convertible_helper: decltype(__is_nothrow_convertible_test<_Fm, _To>())
1542{ };
1543
1544template <typename _Fm, typename _To>
1545struct is_nothrow_convertible : _Or<
1546 _And<is_void<_To>, is_void<_Fm>>,
1547 _Lazy<_And, is_convertible<_Fm, _To>, __is_nothrow_convertible_helper<_Fm, _To>>
1548>::type { };
1549
1550template <typename _Fm, typename _To>
1551inline constexpr bool is_nothrow_convertible_v = is_nothrow_convertible<_Fm, _To>::value;
1552
1553#endif // _LIBCPP_STD_VER > 17
1554
15531555// is_empty
15541556
1555#if __has_feature(is_empty) || (_GNUC_VER >= 407)
1557#if __has_feature(is_empty) || defined(_LIBCPP_COMPILER_GCC)
15561558
15571559template <class _Tp>
15581560struct _LIBCPP_TEMPLATE_VIS is_empty
......@@ -1615,7 +1617,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_polymorphic_v
16151617
16161618// has_virtual_destructor
16171619
1618#if __has_feature(has_virtual_destructor) || (_GNUC_VER >= 403)
1620#if __has_feature(has_virtual_destructor) || defined(_LIBCPP_COMPILER_GCC)
16191621
16201622template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor
16211623 : public integral_constant<bool, __has_virtual_destructor(_Tp)> {};
......@@ -1703,6 +1705,9 @@ typedef
17031705 __nat
17041706 > > > > > > > > > > __all_types;
17051707
1708template <size_t _Align>
1709struct _ALIGNAS(_Align) __fallback_overaligned {};
1710
17061711template <class _TL, size_t _Align> struct __find_pod;
17071712
17081713template <class _Hp, size_t _Align>
......@@ -1711,7 +1716,7 @@ struct __find_pod<__type_list<_Hp, __nat>, _Align>
17111716 typedef typename conditional<
17121717 _Align == _Hp::value,
17131718 typename _Hp::type,
1714 void
1719 __fallback_overaligned<_Align>
17151720 >::type type;
17161721};
17171722
......@@ -1748,7 +1753,6 @@ template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::valu
17481753struct _LIBCPP_TEMPLATE_VIS aligned_storage
17491754{
17501755 typedef typename __find_pod<__all_types, _Align>::type _Aligner;
1751 static_assert(!is_void<_Aligner>::value, "");
17521756 union type
17531757 {
17541758 _Aligner __align;
......@@ -1792,7 +1796,6 @@ _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000);
17921796
17931797#undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION
17941798
1795#ifndef _LIBCPP_HAS_NO_VARIADICS
17961799
17971800// aligned_union
17981801
......@@ -1826,8 +1829,6 @@ struct aligned_union
18261829template <size_t _Len, class ..._Types> using aligned_union_t = typename aligned_union<_Len, _Types...>::type;
18271830#endif
18281831
1829#endif // _LIBCPP_HAS_NO_VARIADICS
1830
18311832template <class _Tp>
18321833struct __numeric_type
18331834{
......@@ -1844,7 +1845,7 @@ struct __numeric_type
18441845 static long double __test(long double);
18451846
18461847 typedef decltype(__test(declval<_Tp>())) type;
1847 static const bool value = !is_same<type, void>::value;
1848 static const bool value = _IsNotSame<type, void>::value;
18481849};
18491850
18501851template <>
......@@ -1936,26 +1937,26 @@ template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeLi
19361937template <class _Hp, class _Tp, size_t _Size>
19371938struct __find_first<__type_list<_Hp, _Tp>, _Size, true>
19381939{
1939 typedef _Hp type;
1940 typedef _LIBCPP_NODEBUG_TYPE _Hp type;
19401941};
19411942
19421943template <class _Hp, class _Tp, size_t _Size>
19431944struct __find_first<__type_list<_Hp, _Tp>, _Size, false>
19441945{
1945 typedef typename __find_first<_Tp, _Size>::type type;
1946 typedef _LIBCPP_NODEBUG_TYPE typename __find_first<_Tp, _Size>::type type;
19461947};
19471948
19481949template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value,
19491950 bool = is_volatile<typename remove_reference<_Tp>::type>::value>
19501951struct __apply_cv
19511952{
1952 typedef _Up type;
1953 typedef _LIBCPP_NODEBUG_TYPE _Up type;
19531954};
19541955
19551956template <class _Tp, class _Up>
19561957struct __apply_cv<_Tp, _Up, true, false>
19571958{
1958 typedef const _Up type;
1959 typedef _LIBCPP_NODEBUG_TYPE const _Up type;
19591960};
19601961
19611962template <class _Tp, class _Up>
......@@ -2060,43 +2061,63 @@ struct _LIBCPP_TEMPLATE_VIS make_unsigned
20602061template <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type;
20612062#endif
20622063
2063#ifdef _LIBCPP_HAS_NO_VARIADICS
2064template <class _Tp, class _Up, class = void>
2065struct __common_type2_imp {};
20642066
2065template <class _Tp, class _Up = void, class _Vp = void>
2066struct _LIBCPP_TEMPLATE_VIS common_type
2067template <class _Tp, class _Up>
2068struct __common_type2_imp<_Tp, _Up,
2069 typename __void_t<decltype(
2070 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>()
2071 )>::type>
20672072{
2068public:
2069 typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp>::type type;
2073 typedef _LIBCPP_NODEBUG_TYPE typename decay<decltype(
2074 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>()
2075 )>::type type;
20702076};
20712077
2072template <>
2073struct _LIBCPP_TEMPLATE_VIS common_type<void, void, void>
2074{
2075public:
2076 typedef void type;
2077};
2078template <class, class = void>
2079struct __common_type_impl {};
20782080
2079template <class _Tp>
2080struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, void, void>
2081{
2082public:
2083 typedef typename common_type<_Tp, _Tp>::type type;
2084};
2081// Clang provides variadic templates in C++03 as an extension.
2082#if !defined(_LIBCPP_CXX03_LANG) || defined(__clang__)
2083# define _LIBCPP_OPTIONAL_PACK(...) , __VA_ARGS__
2084template <class... Tp>
2085struct __common_types;
2086template <class... _Tp>
2087struct _LIBCPP_TEMPLATE_VIS common_type;
2088#else
2089# define _LIBCPP_OPTIONAL_PACK(...)
2090struct __no_arg;
2091template <class _Tp, class _Up, class = __no_arg>
2092struct __common_types;
2093template <class _Tp = __no_arg, class _Up = __no_arg, class _Vp = __no_arg,
2094 class _Unused = __no_arg>
2095struct common_type {
2096 static_assert(sizeof(_Unused) == 0,
2097 "common_type accepts at most 3 arguments in C++03");
2098};
2099#endif // _LIBCPP_CXX03_LANG
20852100
20862101template <class _Tp, class _Up>
2087struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, _Up, void>
2102struct __common_type_impl<
2103 __common_types<_Tp, _Up>,
2104 typename __void_t<typename common_type<_Tp, _Up>::type>::type>
20882105{
2089 typedef typename decay<decltype(
2090 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>()
2091 )>::type type;
2106 typedef typename common_type<_Tp, _Up>::type type;
20922107};
20932108
2094#else // _LIBCPP_HAS_NO_VARIADICS
2109template <class _Tp, class _Up, class _Vp _LIBCPP_OPTIONAL_PACK(class... _Rest)>
2110struct __common_type_impl<
2111 __common_types<_Tp, _Up, _Vp _LIBCPP_OPTIONAL_PACK(_Rest...)>,
2112 typename __void_t<typename common_type<_Tp, _Up>::type>::type>
2113 : __common_type_impl<__common_types<typename common_type<_Tp, _Up>::type,
2114 _Vp _LIBCPP_OPTIONAL_PACK(_Rest...)> > {
2115};
20952116
20962117// bullet 1 - sizeof...(Tp) == 0
20972118
2098template <class ..._Tp>
2099struct _LIBCPP_TEMPLATE_VIS common_type {};
2119template <>
2120struct _LIBCPP_TEMPLATE_VIS common_type<> {};
21002121
21012122// bullet 2 - sizeof...(Tp) == 1
21022123
......@@ -2106,71 +2127,32 @@ struct _LIBCPP_TEMPLATE_VIS common_type<_Tp>
21062127
21072128// bullet 3 - sizeof...(Tp) == 2
21082129
2109template <class _Tp, class _Up, class = void>
2110struct __common_type2_imp {};
2111
2112template <class _Tp, class _Up>
2113struct __common_type2_imp<_Tp, _Up,
2114 typename __void_t<decltype(
2115 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>()
2116 )>::type>
2117{
2118 typedef typename decay<decltype(
2119 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>()
2120 )>::type type;
2121};
2122
2123template <class _Tp, class _Up,
2124 class _DTp = typename decay<_Tp>::type,
2125 class _DUp = typename decay<_Up>::type>
2126using __common_type2 =
2127 typename conditional<
2128 is_same<_Tp, _DTp>::value && is_same<_Up, _DUp>::value,
2129 __common_type2_imp<_Tp, _Up>,
2130 common_type<_DTp, _DUp>
2131 >::type;
2132
21332130template <class _Tp, class _Up>
21342131struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, _Up>
2135 : __common_type2<_Tp, _Up> {};
2132 : conditional<
2133 _IsSame<_Tp, typename decay<_Tp>::type>::value && _IsSame<_Up, typename decay<_Up>::type>::value,
2134 __common_type2_imp<_Tp, _Up>,
2135 common_type<typename decay<_Tp>::type, typename decay<_Up>::type>
2136 >::type
2137{};
21362138
21372139// bullet 4 - sizeof...(Tp) > 2
21382140
2139template <class ...Tp> struct __common_types;
2140
2141template <class, class = void>
2142struct __common_type_impl {};
2143
2144template <class _Tp, class _Up>
2145struct __common_type_impl<
2146 __common_types<_Tp, _Up>,
2147 typename __void_t<typename common_type<_Tp, _Up>::type>::type>
2148{
2149 typedef typename common_type<_Tp, _Up>::type type;
2150};
2151
2152template <class _Tp, class _Up, class ..._Vp>
2153struct __common_type_impl<__common_types<_Tp, _Up, _Vp...>,
2154 typename __void_t<typename common_type<_Tp, _Up>::type>::type>
2155 : __common_type_impl<
2156 __common_types<typename common_type<_Tp, _Up>::type, _Vp...> >
2157{
2158
2159};
2141template <class _Tp, class _Up, class _Vp _LIBCPP_OPTIONAL_PACK(class... _Rest)>
2142struct _LIBCPP_TEMPLATE_VIS
2143 common_type<_Tp, _Up, _Vp _LIBCPP_OPTIONAL_PACK(_Rest...)>
2144 : __common_type_impl<
2145 __common_types<_Tp, _Up, _Vp _LIBCPP_OPTIONAL_PACK(_Rest...)> > {};
21602146
2161template <class _Tp, class _Up, class ..._Vp>
2162struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, _Up, _Vp...>
2163 : __common_type_impl<__common_types<_Tp, _Up, _Vp...> > {};
2147#undef _LIBCPP_OPTIONAL_PACK
21642148
21652149#if _LIBCPP_STD_VER > 11
21662150template <class ..._Tp> using common_type_t = typename common_type<_Tp...>::type;
21672151#endif
21682152
2169#endif // _LIBCPP_HAS_NO_VARIADICS
2170
21712153// is_assignable
21722154
2173template<typename, typename _Tp> struct __select_2nd { typedef _Tp type; };
2155template<typename, typename _Tp> struct __select_2nd { typedef _LIBCPP_NODEBUG_TYPE _Tp type; };
21742156
21752157template <class _Tp, class _Arg>
21762158typename __select_2nd<decltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>())), true_type>::type
......@@ -2215,12 +2197,8 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_copy_assignable_v
22152197// is_move_assignable
22162198
22172199template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_move_assignable
2218#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
22192200 : public is_assignable<typename add_lvalue_reference<_Tp>::type,
22202201 typename add_rvalue_reference<_Tp>::type> {};
2221#else
2222 : public is_copy_assignable<_Tp> {};
2223#endif
22242202
22252203#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
22262204template <class _Tp>
......@@ -2294,14 +2272,12 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_destructible_v
22942272
22952273// move
22962274
2297#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2298
22992275template <class _Tp>
23002276inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
23012277typename remove_reference<_Tp>::type&&
23022278move(_Tp&& __t) _NOEXCEPT
23032279{
2304 typedef typename remove_reference<_Tp>::type _Up;
2280 typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tp>::type _Up;
23052281 return static_cast<_Up&&>(__t);
23062282}
23072283
......@@ -2323,81 +2299,24 @@ forward(typename remove_reference<_Tp>::type&& __t) _NOEXCEPT
23232299 return static_cast<_Tp&&>(__t);
23242300}
23252301
2326#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2327
23282302template <class _Tp>
23292303inline _LIBCPP_INLINE_VISIBILITY
2330_Tp&
2331move(_Tp& __t)
2304typename decay<_Tp>::type
2305__decay_copy(_Tp&& __t)
23322306{
2333 return __t;
2307 return _VSTD::forward<_Tp>(__t);
23342308}
23352309
2336template <class _Tp>
2337inline _LIBCPP_INLINE_VISIBILITY
2338const _Tp&
2339move(const _Tp& __t)
2310template <class _Rp, class _Class, class ..._Param>
2311struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
23402312{
2341 return __t;
2342}
2313 typedef _Class _ClassType;
2314 typedef _Rp _ReturnType;
2315 typedef _Rp (_FnType) (_Param...);
2316};
23432317
2344template <class _Tp>
2345inline _LIBCPP_INLINE_VISIBILITY
2346_Tp&
2347forward(typename remove_reference<_Tp>::type& __t) _NOEXCEPT
2348{
2349 return __t;
2350}
2351
2352
2353template <class _Tp>
2354class __rv
2355{
2356 typedef typename remove_reference<_Tp>::type _Trr;
2357 _Trr& t_;
2358public:
2359 _LIBCPP_INLINE_VISIBILITY
2360 _Trr* operator->() {return &t_;}
2361 _LIBCPP_INLINE_VISIBILITY
2362 explicit __rv(_Trr& __t) : t_(__t) {}
2363};
2364
2365#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2366
2367#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2368
2369template <class _Tp>
2370inline _LIBCPP_INLINE_VISIBILITY
2371typename decay<_Tp>::type
2372__decay_copy(_Tp&& __t)
2373{
2374 return _VSTD::forward<_Tp>(__t);
2375}
2376
2377#else
2378
2379template <class _Tp>
2380inline _LIBCPP_INLINE_VISIBILITY
2381typename decay<_Tp>::type
2382__decay_copy(const _Tp& __t)
2383{
2384 return _VSTD::forward<_Tp>(__t);
2385}
2386
2387#endif
2388
2389#ifndef _LIBCPP_HAS_NO_VARIADICS
2390
2391template <class _Rp, class _Class, class ..._Param>
2392struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
2393{
2394 typedef _Class _ClassType;
2395 typedef _Rp _ReturnType;
2396 typedef _Rp (_FnType) (_Param...);
2397};
2398
2399template <class _Rp, class _Class, class ..._Param>
2400struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false>
2318template <class _Rp, class _Class, class ..._Param>
2319struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false>
24012320{
24022321 typedef _Class _ClassType;
24032322 typedef _Rp _ReturnType;
......@@ -2452,8 +2371,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatil
24522371 typedef _Rp (_FnType) (_Param..., ...);
24532372};
24542373
2455#if __has_feature(cxx_reference_qualified_functions) || \
2456 (defined(_GNUC_VER) && _GNUC_VER >= 409)
2374#if __has_feature(cxx_reference_qualified_functions) || defined(_LIBCPP_COMPILER_GCC)
24572375
24582376template <class _Rp, class _Class, class ..._Param>
24592377struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false>
......@@ -2583,267 +2501,8 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatil
25832501 typedef _Rp (_FnType) (_Param..., ...);
25842502};
25852503
2586#endif // __has_feature(cxx_reference_qualified_functions) || _GNUC_VER >= 409
2587
2588#else // _LIBCPP_HAS_NO_VARIADICS
2589
2590template <class _Rp, class _Class>
2591struct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false>
2592{
2593 typedef _Class _ClassType;
2594 typedef _Rp _ReturnType;
2595 typedef _Rp (_FnType) ();
2596};
2597
2598template <class _Rp, class _Class>
2599struct __member_pointer_traits_imp<_Rp (_Class::*)(...), true, false>
2600{
2601 typedef _Class _ClassType;
2602 typedef _Rp _ReturnType;
2603 typedef _Rp (_FnType) (...);
2604};
2605
2606template <class _Rp, class _Class, class _P0>
2607struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false>
2608{
2609 typedef _Class _ClassType;
2610 typedef _Rp _ReturnType;
2611 typedef _Rp (_FnType) (_P0);
2612};
2613
2614template <class _Rp, class _Class, class _P0>
2615struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...), true, false>
2616{
2617 typedef _Class _ClassType;
2618 typedef _Rp _ReturnType;
2619 typedef _Rp (_FnType) (_P0, ...);
2620};
2621
2622template <class _Rp, class _Class, class _P0, class _P1>
2623struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false>
2624{
2625 typedef _Class _ClassType;
2626 typedef _Rp _ReturnType;
2627 typedef _Rp (_FnType) (_P0, _P1);
2628};
2629
2630template <class _Rp, class _Class, class _P0, class _P1>
2631struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...), true, false>
2632{
2633 typedef _Class _ClassType;
2634 typedef _Rp _ReturnType;
2635 typedef _Rp (_FnType) (_P0, _P1, ...);
2636};
2637
2638template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2639struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false>
2640{
2641 typedef _Class _ClassType;
2642 typedef _Rp _ReturnType;
2643 typedef _Rp (_FnType) (_P0, _P1, _P2);
2644};
2645
2646template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2647struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...), true, false>
2648{
2649 typedef _Class _ClassType;
2650 typedef _Rp _ReturnType;
2651 typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
2652};
2653
2654template <class _Rp, class _Class>
2655struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false>
2656{
2657 typedef _Class const _ClassType;
2658 typedef _Rp _ReturnType;
2659 typedef _Rp (_FnType) ();
2660};
2661
2662template <class _Rp, class _Class>
2663struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const, true, false>
2664{
2665 typedef _Class const _ClassType;
2666 typedef _Rp _ReturnType;
2667 typedef _Rp (_FnType) (...);
2668};
2669
2670template <class _Rp, class _Class, class _P0>
2671struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false>
2672{
2673 typedef _Class const _ClassType;
2674 typedef _Rp _ReturnType;
2675 typedef _Rp (_FnType) (_P0);
2676};
2677
2678template <class _Rp, class _Class, class _P0>
2679struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const, true, false>
2680{
2681 typedef _Class const _ClassType;
2682 typedef _Rp _ReturnType;
2683 typedef _Rp (_FnType) (_P0, ...);
2684};
2685
2686template <class _Rp, class _Class, class _P0, class _P1>
2687struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false>
2688{
2689 typedef _Class const _ClassType;
2690 typedef _Rp _ReturnType;
2691 typedef _Rp (_FnType) (_P0, _P1);
2692};
2693
2694template <class _Rp, class _Class, class _P0, class _P1>
2695struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const, true, false>
2696{
2697 typedef _Class const _ClassType;
2698 typedef _Rp _ReturnType;
2699 typedef _Rp (_FnType) (_P0, _P1, ...);
2700};
2701
2702template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2703struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false>
2704{
2705 typedef _Class const _ClassType;
2706 typedef _Rp _ReturnType;
2707 typedef _Rp (_FnType) (_P0, _P1, _P2);
2708};
2709
2710template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2711struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const, true, false>
2712{
2713 typedef _Class const _ClassType;
2714 typedef _Rp _ReturnType;
2715 typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
2716};
2717
2718template <class _Rp, class _Class>
2719struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false>
2720{
2721 typedef _Class volatile _ClassType;
2722 typedef _Rp _ReturnType;
2723 typedef _Rp (_FnType) ();
2724};
2725
2726template <class _Rp, class _Class>
2727struct __member_pointer_traits_imp<_Rp (_Class::*)(...) volatile, true, false>
2728{
2729 typedef _Class volatile _ClassType;
2730 typedef _Rp _ReturnType;
2731 typedef _Rp (_FnType) (...);
2732};
2733
2734template <class _Rp, class _Class, class _P0>
2735struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false>
2736{
2737 typedef _Class volatile _ClassType;
2738 typedef _Rp _ReturnType;
2739 typedef _Rp (_FnType) (_P0);
2740};
2741
2742template <class _Rp, class _Class, class _P0>
2743struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) volatile, true, false>
2744{
2745 typedef _Class volatile _ClassType;
2746 typedef _Rp _ReturnType;
2747 typedef _Rp (_FnType) (_P0, ...);
2748};
2749
2750template <class _Rp, class _Class, class _P0, class _P1>
2751struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false>
2752{
2753 typedef _Class volatile _ClassType;
2754 typedef _Rp _ReturnType;
2755 typedef _Rp (_FnType) (_P0, _P1);
2756};
2757
2758template <class _Rp, class _Class, class _P0, class _P1>
2759struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) volatile, true, false>
2760{
2761 typedef _Class volatile _ClassType;
2762 typedef _Rp _ReturnType;
2763 typedef _Rp (_FnType) (_P0, _P1, ...);
2764};
2765
2766template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2767struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false>
2768{
2769 typedef _Class volatile _ClassType;
2770 typedef _Rp _ReturnType;
2771 typedef _Rp (_FnType) (_P0, _P1, _P2);
2772};
2773
2774template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2775struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) volatile, true, false>
2776{
2777 typedef _Class volatile _ClassType;
2778 typedef _Rp _ReturnType;
2779 typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
2780};
2781
2782template <class _Rp, class _Class>
2783struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false>
2784{
2785 typedef _Class const volatile _ClassType;
2786 typedef _Rp _ReturnType;
2787 typedef _Rp (_FnType) ();
2788};
2789
2790template <class _Rp, class _Class>
2791struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const volatile, true, false>
2792{
2793 typedef _Class const volatile _ClassType;
2794 typedef _Rp _ReturnType;
2795 typedef _Rp (_FnType) (...);
2796};
2797
2798template <class _Rp, class _Class, class _P0>
2799struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false>
2800{
2801 typedef _Class const volatile _ClassType;
2802 typedef _Rp _ReturnType;
2803 typedef _Rp (_FnType) (_P0);
2804};
2805
2806template <class _Rp, class _Class, class _P0>
2807struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const volatile, true, false>
2808{
2809 typedef _Class const volatile _ClassType;
2810 typedef _Rp _ReturnType;
2811 typedef _Rp (_FnType) (_P0, ...);
2812};
2813
2814template <class _Rp, class _Class, class _P0, class _P1>
2815struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false>
2816{
2817 typedef _Class const volatile _ClassType;
2818 typedef _Rp _ReturnType;
2819 typedef _Rp (_FnType) (_P0, _P1);
2820};
2821
2822template <class _Rp, class _Class, class _P0, class _P1>
2823struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const volatile, true, false>
2824{
2825 typedef _Class const volatile _ClassType;
2826 typedef _Rp _ReturnType;
2827 typedef _Rp (_FnType) (_P0, _P1, ...);
2828};
2829
2830template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2831struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false>
2832{
2833 typedef _Class const volatile _ClassType;
2834 typedef _Rp _ReturnType;
2835 typedef _Rp (_FnType) (_P0, _P1, _P2);
2836};
2837
2838template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2839struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const volatile, true, false>
2840{
2841 typedef _Class const volatile _ClassType;
2842 typedef _Rp _ReturnType;
2843 typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
2844};
2504#endif // __has_feature(cxx_reference_qualified_functions) || defined(_LIBCPP_COMPILER_GCC)
28452505
2846#endif // _LIBCPP_HAS_NO_VARIADICS
28472506
28482507template <class _Rp, class _Class>
28492508struct __member_pointer_traits_imp<_Rp _Class::*, false, true>
......@@ -3042,10 +2701,10 @@ struct __is_invalid_base_to_derived_cast {
30422701 static_assert(is_reference<_To>::value, "Wrong specialization");
30432702 using _RawFrom = __uncvref_t<_From>;
30442703 using _RawTo = __uncvref_t<_To>;
3045 static const bool value = __lazy_and<
3046 __lazy_not<is_same<_RawFrom, _RawTo>>,
2704 static const bool value = _And<
2705 _IsNotSame<_RawFrom, _RawTo>,
30472706 is_base_of<_RawFrom, _RawTo>,
3048 __lazy_not<__libcpp_is_constructible<_RawTo, _From>>
2707 _Not<__libcpp_is_constructible<_RawTo, _From>>
30492708 >::value;
30502709};
30512710
......@@ -3058,10 +2717,10 @@ template <class _ToRef, class _FromRef>
30582717struct __is_invalid_lvalue_to_rvalue_cast<_ToRef&&, _FromRef&> {
30592718 using _RawFrom = __uncvref_t<_FromRef>;
30602719 using _RawTo = __uncvref_t<_ToRef>;
3061 static const bool value = __lazy_and<
3062 __lazy_not<is_function<_RawTo>>,
3063 __lazy_or<
3064 is_same<_RawFrom, _RawTo>,
2720 static const bool value = _And<
2721 _Not<is_function<_RawTo>>,
2722 _Or<
2723 _IsSame<_RawFrom, _RawTo>,
30652724 is_base_of<_RawTo, _RawFrom>>
30662725 >::value;
30672726};
......@@ -3117,276 +2776,48 @@ template <class _Tp, size_t _Nx>
31172776struct __is_default_constructible<_Tp[_Nx], false>
31182777 : __is_default_constructible<typename remove_all_extents<_Tp>::type> {};
31192778
3120template <class _Tp, class... _Args>
3121struct __libcpp_is_constructible
3122{
3123 static_assert(sizeof...(_Args) > 1, "Wrong specialization");
3124 typedef decltype(__is_constructible_helper::__test_nary<_Tp, _Args...>(0))
3125 type;
3126};
3127
3128template <class _Tp>
3129struct __libcpp_is_constructible<_Tp> : __is_default_constructible<_Tp> {};
3130
3131template <class _Tp, class _A0>
3132struct __libcpp_is_constructible<_Tp, _A0>
3133 : public decltype(__is_constructible_helper::__test_unary<_Tp, _A0>(0))
3134{};
3135
3136template <class _Tp, class _A0>
3137struct __libcpp_is_constructible<_Tp&, _A0>
3138 : public decltype(__is_constructible_helper::
3139 __test_cast<_Tp&, _A0>(0))
3140{};
3141
3142template <class _Tp, class _A0>
3143struct __libcpp_is_constructible<_Tp&&, _A0>
3144 : public decltype(__is_constructible_helper::
3145 __test_cast<_Tp&&, _A0>(0))
3146{};
3147
3148#endif
3149
3150#if __has_feature(is_constructible)
3151template <class _Tp, class ..._Args>
3152struct _LIBCPP_TEMPLATE_VIS is_constructible
3153 : public integral_constant<bool, __is_constructible(_Tp, _Args...)>
3154 {};
3155#elif !defined(_LIBCPP_CXX03_LANG)
3156template <class _Tp, class... _Args>
3157struct _LIBCPP_TEMPLATE_VIS is_constructible
3158 : public __libcpp_is_constructible<_Tp, _Args...>::type {};
3159#else
3160// template <class T> struct is_constructible0;
3161
3162// main is_constructible0 test
3163
3164template <class _Tp>
3165decltype((_Tp(), true_type()))
3166__is_constructible0_test(_Tp&);
3167
3168false_type
3169__is_constructible0_test(__any);
3170
3171template <class _Tp, class _A0>
3172decltype((_Tp(_VSTD::declval<_A0>()), true_type()))
3173__is_constructible1_test(_Tp&, _A0&);
3174
3175template <class _A0>
3176false_type
3177__is_constructible1_test(__any, _A0&);
3178
3179template <class _Tp, class _A0, class _A1>
3180decltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>()), true_type()))
3181__is_constructible2_test(_Tp&, _A0&, _A1&);
3182
3183template <class _A0, class _A1>
3184false_type
3185__is_constructible2_test(__any, _A0&, _A1&);
3186
3187template <class _Tp, class _A0, class _A1, class _A2>
3188decltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>(), _VSTD::declval<_A2>()), true_type()))
3189__is_constructible3_test(_Tp&, _A0&, _A1&, _A2&);
3190
3191template <class _A0, class _A1, class _A2>
3192false_type
3193__is_constructible3_test(__any, _A0&, _A1&, _A2&);
3194
3195template <bool, class _Tp>
3196struct __is_constructible0_imp // false, _Tp is not a scalar
3197 : public common_type
3198 <
3199 decltype(__is_constructible0_test(declval<_Tp&>()))
3200 >::type
3201 {};
3202
3203template <bool, class _Tp, class _A0>
3204struct __is_constructible1_imp // false, _Tp is not a scalar
3205 : public common_type
3206 <
3207 decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>()))
3208 >::type
3209 {};
3210
3211template <bool, class _Tp, class _A0, class _A1>
3212struct __is_constructible2_imp // false, _Tp is not a scalar
3213 : public common_type
3214 <
3215 decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>()))
3216 >::type
3217 {};
3218
3219template <bool, class _Tp, class _A0, class _A1, class _A2>
3220struct __is_constructible3_imp // false, _Tp is not a scalar
3221 : public common_type
3222 <
3223 decltype(__is_constructible3_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>(), declval<_A2>()))
3224 >::type
3225 {};
3226
3227// handle scalars and reference types
3228
3229// Scalars are default constructible, references are not
3230
3231template <class _Tp>
3232struct __is_constructible0_imp<true, _Tp>
3233 : public is_scalar<_Tp>
3234 {};
3235
3236template <class _Tp, class _A0>
3237struct __is_constructible1_imp<true, _Tp, _A0>
3238 : public is_convertible<_A0, _Tp>
3239 {};
3240
3241template <class _Tp, class _A0, class _A1>
3242struct __is_constructible2_imp<true, _Tp, _A0, _A1>
3243 : public false_type
3244 {};
3245
3246template <class _Tp, class _A0, class _A1, class _A2>
3247struct __is_constructible3_imp<true, _Tp, _A0, _A1, _A2>
3248 : public false_type
3249 {};
3250
3251// Treat scalars and reference types separately
3252
3253template <bool, class _Tp>
3254struct __is_constructible0_void_check
3255 : public __is_constructible0_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
3256 _Tp>
3257 {};
3258
3259template <bool, class _Tp, class _A0>
3260struct __is_constructible1_void_check
3261 : public __is_constructible1_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
3262 _Tp, _A0>
3263 {};
3264
3265template <bool, class _Tp, class _A0, class _A1>
3266struct __is_constructible2_void_check
3267 : public __is_constructible2_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
3268 _Tp, _A0, _A1>
3269 {};
3270
3271template <bool, class _Tp, class _A0, class _A1, class _A2>
3272struct __is_constructible3_void_check
3273 : public __is_constructible3_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
3274 _Tp, _A0, _A1, _A2>
3275 {};
3276
3277// If any of T or Args is void, is_constructible should be false
3278
3279template <class _Tp>
3280struct __is_constructible0_void_check<true, _Tp>
3281 : public false_type
3282 {};
3283
3284template <class _Tp, class _A0>
3285struct __is_constructible1_void_check<true, _Tp, _A0>
3286 : public false_type
3287 {};
3288
3289template <class _Tp, class _A0, class _A1>
3290struct __is_constructible2_void_check<true, _Tp, _A0, _A1>
3291 : public false_type
3292 {};
3293
3294template <class _Tp, class _A0, class _A1, class _A2>
3295struct __is_constructible3_void_check<true, _Tp, _A0, _A1, _A2>
3296 : public false_type
3297 {};
3298
3299// is_constructible entry point
3300
3301template <class _Tp, class _A0 = __is_construct::__nat,
3302 class _A1 = __is_construct::__nat,
3303 class _A2 = __is_construct::__nat>
3304struct _LIBCPP_TEMPLATE_VIS is_constructible
3305 : public __is_constructible3_void_check<is_void<_Tp>::value
3306 || is_abstract<_Tp>::value
3307 || is_function<_Tp>::value
3308 || is_void<_A0>::value
3309 || is_void<_A1>::value
3310 || is_void<_A2>::value,
3311 _Tp, _A0, _A1, _A2>
3312 {};
3313
3314template <class _Tp>
3315struct _LIBCPP_TEMPLATE_VIS is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat>
3316 : public __is_constructible0_void_check<is_void<_Tp>::value
3317 || is_abstract<_Tp>::value
3318 || is_function<_Tp>::value,
3319 _Tp>
3320 {};
3321
3322template <class _Tp, class _A0>
3323struct _LIBCPP_TEMPLATE_VIS is_constructible<_Tp, _A0, __is_construct::__nat>
3324 : public __is_constructible1_void_check<is_void<_Tp>::value
3325 || is_abstract<_Tp>::value
3326 || is_function<_Tp>::value
3327 || is_void<_A0>::value,
3328 _Tp, _A0>
3329 {};
3330
3331template <class _Tp, class _A0, class _A1>
3332struct _LIBCPP_TEMPLATE_VIS is_constructible<_Tp, _A0, _A1, __is_construct::__nat>
3333 : public __is_constructible2_void_check<is_void<_Tp>::value
3334 || is_abstract<_Tp>::value
3335 || is_function<_Tp>::value
3336 || is_void<_A0>::value
3337 || is_void<_A1>::value,
3338 _Tp, _A0, _A1>
3339 {};
3340
3341// Array types are default constructible if their element type
3342// is default constructible
3343
3344template <class _Ap, size_t _Np>
3345struct __is_constructible0_imp<false, _Ap[_Np]>
3346 : public is_constructible<typename remove_all_extents<_Ap>::type>
3347 {};
3348
3349template <class _Ap, size_t _Np, class _A0>
3350struct __is_constructible1_imp<false, _Ap[_Np], _A0>
3351 : public false_type
3352 {};
3353
3354template <class _Ap, size_t _Np, class _A0, class _A1>
3355struct __is_constructible2_imp<false, _Ap[_Np], _A0, _A1>
3356 : public false_type
3357 {};
2779template <class _Tp, class... _Args>
2780struct __libcpp_is_constructible
2781{
2782 static_assert(sizeof...(_Args) > 1, "Wrong specialization");
2783 typedef decltype(__is_constructible_helper::__test_nary<_Tp, _Args...>(0))
2784 type;
2785};
33582786
3359template <class _Ap, size_t _Np, class _A0, class _A1, class _A2>
3360struct __is_constructible3_imp<false, _Ap[_Np], _A0, _A1, _A2>
3361 : public false_type
3362 {};
2787template <class _Tp>
2788struct __libcpp_is_constructible<_Tp> : __is_default_constructible<_Tp> {};
33632789
3364// Incomplete array types are not constructible
2790template <class _Tp, class _A0>
2791struct __libcpp_is_constructible<_Tp, _A0>
2792 : public decltype(__is_constructible_helper::__test_unary<_Tp, _A0>(0))
2793{};
33652794
3366template <class _Ap>
3367struct __is_constructible0_imp<false, _Ap[]>
3368 : public false_type
3369 {};
2795template <class _Tp, class _A0>
2796struct __libcpp_is_constructible<_Tp&, _A0>
2797 : public decltype(__is_constructible_helper::
2798 __test_cast<_Tp&, _A0>(0))
2799{};
33702800
3371template <class _Ap, class _A0>
3372struct __is_constructible1_imp<false, _Ap[], _A0>
3373 : public false_type
3374 {};
2801template <class _Tp, class _A0>
2802struct __libcpp_is_constructible<_Tp&&, _A0>
2803 : public decltype(__is_constructible_helper::
2804 __test_cast<_Tp&&, _A0>(0))
2805{};
33752806
3376template <class _Ap, class _A0, class _A1>
3377struct __is_constructible2_imp<false, _Ap[], _A0, _A1>
3378 : public false_type
3379 {};
2807#endif
33802808
3381template <class _Ap, class _A0, class _A1, class _A2>
3382struct __is_constructible3_imp<false, _Ap[], _A0, _A1, _A2>
3383 : public false_type
2809#if __has_feature(is_constructible)
2810template <class _Tp, class ..._Args>
2811struct _LIBCPP_TEMPLATE_VIS is_constructible
2812 : public integral_constant<bool, __is_constructible(_Tp, _Args...)>
33842813 {};
2814#else
2815template <class _Tp, class... _Args>
2816struct _LIBCPP_TEMPLATE_VIS is_constructible
2817 : public __libcpp_is_constructible<_Tp, _Args...>::type {};
2818#endif
33852819
3386#endif // __has_feature(is_constructible)
3387
3388
3389#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
2820#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
33902821template <class _Tp, class ..._Args>
33912822_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_constructible_v
33922823 = is_constructible<_Tp, _Args...>::value;
......@@ -3422,11 +2853,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_copy_constructible_v
34222853
34232854template <class _Tp>
34242855struct _LIBCPP_TEMPLATE_VIS is_move_constructible
3425#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
34262856 : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
3427#else
3428 : public is_copy_constructible<_Tp>
3429#endif
34302857 {};
34312858
34322859#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
......@@ -3437,8 +2864,6 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_move_constructible_v
34372864
34382865// is_trivially_constructible
34392866
3440#ifndef _LIBCPP_HAS_NO_VARIADICS
3441
34422867#if __has_feature(is_trivially_constructible) || _GNUC_VER >= 501
34432868
34442869template <class _Tp, class... _Args>
......@@ -3457,7 +2882,7 @@ struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible
34572882
34582883template <class _Tp>
34592884struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp>
3460#if __has_feature(has_trivial_constructor) || (_GNUC_VER >= 403)
2885#if __has_feature(has_trivial_constructor) || defined(_LIBCPP_COMPILER_GCC)
34612886 : integral_constant<bool, __has_trivial_constructor(_Tp)>
34622887#else
34632888 : integral_constant<bool, is_scalar<_Tp>::value>
......@@ -3466,11 +2891,7 @@ struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp>
34662891};
34672892
34682893template <class _Tp>
3469#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
34702894struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp&&>
3471#else
3472struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp>
3473#endif
34742895 : integral_constant<bool, is_scalar<_Tp>::value>
34752896{
34762897};
......@@ -3489,80 +2910,8 @@ struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp&>
34892910
34902911#endif // !__has_feature(is_trivially_constructible)
34912912
3492#else // _LIBCPP_HAS_NO_VARIADICS
3493
3494template <class _Tp, class _A0 = __is_construct::__nat,
3495 class _A1 = __is_construct::__nat>
3496struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible
3497 : false_type
3498{
3499};
3500
3501#if __has_feature(is_trivially_constructible) || _GNUC_VER >= 501
3502
3503template <class _Tp>
3504struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, __is_construct::__nat,
3505 __is_construct::__nat>
3506 : integral_constant<bool, __is_trivially_constructible(_Tp)>
3507{
3508};
3509
3510template <class _Tp>
3511struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp,
3512 __is_construct::__nat>
3513 : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp)>
3514{
3515};
3516
3517template <class _Tp>
3518struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, const _Tp&,
3519 __is_construct::__nat>
3520 : integral_constant<bool, __is_trivially_constructible(_Tp, const _Tp&)>
3521{
3522};
3523
3524template <class _Tp>
3525struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp&,
3526 __is_construct::__nat>
3527 : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp&)>
3528{
3529};
3530
3531#else // !__has_feature(is_trivially_constructible)
3532
3533template <class _Tp>
3534struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, __is_construct::__nat,
3535 __is_construct::__nat>
3536 : integral_constant<bool, is_scalar<_Tp>::value>
3537{
3538};
3539
3540template <class _Tp>
3541struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp,
3542 __is_construct::__nat>
3543 : integral_constant<bool, is_scalar<_Tp>::value>
3544{
3545};
3546
3547template <class _Tp>
3548struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, const _Tp&,
3549 __is_construct::__nat>
3550 : integral_constant<bool, is_scalar<_Tp>::value>
3551{
3552};
3553
3554template <class _Tp>
3555struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp&,
3556 __is_construct::__nat>
3557 : integral_constant<bool, is_scalar<_Tp>::value>
3558{
3559};
3560
3561#endif // !__has_feature(is_trivially_constructible)
3562
3563#endif // _LIBCPP_HAS_NO_VARIADICS
35642913
3565#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
2914#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
35662915template <class _Tp, class... _Args>
35672916_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_constructible_v
35682917 = is_trivially_constructible<_Tp, _Args...>::value;
......@@ -3595,11 +2944,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_copy_constructible_v
35952944// is_trivially_move_constructible
35962945
35972946template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_constructible
3598#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
35992947 : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
3600#else
3601 : public is_trivially_copy_constructible<_Tp>
3602#endif
36032948 {};
36042949
36052950#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
......@@ -3636,14 +2981,10 @@ template <class _Tp>
36362981struct is_trivially_assignable<_Tp&, const _Tp&>
36372982 : integral_constant<bool, is_scalar<_Tp>::value> {};
36382983
3639#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3640
36412984template <class _Tp>
36422985struct is_trivially_assignable<_Tp&, _Tp&&>
36432986 : integral_constant<bool, is_scalar<_Tp>::value> {};
36442987
3645#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
3646
36472988#endif // !__has_feature(is_trivially_assignable)
36482989
36492990#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
......@@ -3668,11 +3009,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_copy_assignable_v
36683009
36693010template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_assignable
36703011 : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,
3671#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
36723012 typename add_rvalue_reference<_Tp>::type>
3673#else
3674 typename add_lvalue_reference<_Tp>::type>
3675#endif
36763013 {};
36773014
36783015#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
......@@ -3683,7 +3020,12 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_move_assignable_v
36833020
36843021// is_trivially_destructible
36853022
3686#if __has_feature(has_trivial_destructor) || (_GNUC_VER >= 403)
3023#if __has_keyword(__is_trivially_destructible)
3024
3025template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible
3026 : public integral_constant<bool, __is_trivially_destructible(_Tp)> {};
3027
3028#elif __has_feature(has_trivial_destructor) || defined(_LIBCPP_COMPILER_GCC)
36873029
36883030template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible
36893031 : public integral_constant<bool, is_destructible<_Tp>::value && __has_trivial_destructor(_Tp)> {};
......@@ -3710,19 +3052,14 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_destructible_v
37103052
37113053// is_nothrow_constructible
37123054
3713#if 0
3055#if __has_keyword(__is_nothrow_constructible)
3056
37143057template <class _Tp, class... _Args>
37153058struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible
3716 : public integral_constant<bool, __is_nothrow_constructible(_Tp(_Args...))>
3717{
3718};
3059 : public integral_constant<bool, __is_nothrow_constructible(_Tp, _Args...)> {};
37193060
37203061#else
37213062
3722#ifndef _LIBCPP_HAS_NO_VARIADICS
3723
3724#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
3725
37263063template <bool, bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible;
37273064
37283065template <class _Tp, class... _Args>
......@@ -3758,117 +3095,10 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp[_Ns]>
37583095{
37593096};
37603097
3761#else // __has_feature(cxx_noexcept)
3762
3763template <class _Tp, class... _Args>
3764struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible
3765 : false_type
3766{
3767};
3768
3769template <class _Tp>
3770struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp>
3771#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403)
3772 : integral_constant<bool, __has_nothrow_constructor(_Tp)>
3773#else
3774 : integral_constant<bool, is_scalar<_Tp>::value>
3775#endif
3776{
3777};
3778
3779template <class _Tp>
3780#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3781struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp&&>
3782#else
3783struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp>
3784#endif
3785#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
3786 : integral_constant<bool, __has_nothrow_copy(_Tp)>
3787#else
3788 : integral_constant<bool, is_scalar<_Tp>::value>
3789#endif
3790{
3791};
3792
3793template <class _Tp>
3794struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, const _Tp&>
3795#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
3796 : integral_constant<bool, __has_nothrow_copy(_Tp)>
3797#else
3798 : integral_constant<bool, is_scalar<_Tp>::value>
3799#endif
3800{
3801};
3802
3803template <class _Tp>
3804struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp&>
3805#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
3806 : integral_constant<bool, __has_nothrow_copy(_Tp)>
3807#else
3808 : integral_constant<bool, is_scalar<_Tp>::value>
3809#endif
3810{
3811};
3812
3813#endif // __has_feature(cxx_noexcept)
3814
3815#else // _LIBCPP_HAS_NO_VARIADICS
3816
3817template <class _Tp, class _A0 = __is_construct::__nat,
3818 class _A1 = __is_construct::__nat>
3819struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible
3820 : false_type
3821{
3822};
3823
3824template <class _Tp>
3825struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, __is_construct::__nat,
3826 __is_construct::__nat>
3827#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403)
3828 : integral_constant<bool, __has_nothrow_constructor(_Tp)>
3829#else
3830 : integral_constant<bool, is_scalar<_Tp>::value>
3831#endif
3832{
3833};
3834
3835template <class _Tp>
3836struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp,
3837 __is_construct::__nat>
3838#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
3839 : integral_constant<bool, __has_nothrow_copy(_Tp)>
3840#else
3841 : integral_constant<bool, is_scalar<_Tp>::value>
3842#endif
3843{
3844};
3845
3846template <class _Tp>
3847struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, const _Tp&,
3848 __is_construct::__nat>
3849#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
3850 : integral_constant<bool, __has_nothrow_copy(_Tp)>
3851#else
3852 : integral_constant<bool, is_scalar<_Tp>::value>
3853#endif
3854{
3855};
3856
3857template <class _Tp>
3858struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp&,
3859 __is_construct::__nat>
3860#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
3861 : integral_constant<bool, __has_nothrow_copy(_Tp)>
3862#else
3863 : integral_constant<bool, is_scalar<_Tp>::value>
3864#endif
3865{
3866};
3098#endif // _LIBCPP_HAS_NO_NOEXCEPT
38673099
3868#endif // _LIBCPP_HAS_NO_VARIADICS
3869#endif // __has_feature(is_nothrow_constructible)
38703100
3871#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
3101#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
38723102template <class _Tp, class ..._Args>
38733103_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_constructible_v
38743104 = is_nothrow_constructible<_Tp, _Args...>::value;
......@@ -3901,11 +3131,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_copy_constructible_v
39013131// is_nothrow_move_constructible
39023132
39033133template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible
3904#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
39053134 : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
3906#else
3907 : public is_nothrow_copy_constructible<_Tp>
3908#endif
39093135 {};
39103136
39113137#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
......@@ -3916,7 +3142,13 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_move_constructible_v
39163142
39173143// is_nothrow_assignable
39183144
3919#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
3145#if __has_keyword(__is_nothrow_assignable)
3146
3147template <class _Tp, class _Arg>
3148struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable
3149 : public integral_constant<bool, __is_nothrow_assignable(_Tp, _Arg)> {};
3150
3151#else
39203152
39213153template <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable;
39223154
......@@ -3938,49 +3170,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable
39383170{
39393171};
39403172
3941#else // __has_feature(cxx_noexcept)
3942
3943template <class _Tp, class _Arg>
3944struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable
3945 : public false_type {};
3946
3947template <class _Tp>
3948struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, _Tp>
3949#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
3950 : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
3951#else
3952 : integral_constant<bool, is_scalar<_Tp>::value> {};
3953#endif
3954
3955template <class _Tp>
3956struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, _Tp&>
3957#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
3958 : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
3959#else
3960 : integral_constant<bool, is_scalar<_Tp>::value> {};
3961#endif
3962
3963template <class _Tp>
3964struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, const _Tp&>
3965#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
3966 : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
3967#else
3968 : integral_constant<bool, is_scalar<_Tp>::value> {};
3969#endif
3970
3971#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3972
3973template <class _Tp>
3974struct is_nothrow_assignable<_Tp&, _Tp&&>
3975#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
3976 : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
3977#else
3978 : integral_constant<bool, is_scalar<_Tp>::value> {};
3979#endif
3980
3981#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
3982
3983#endif // __has_feature(cxx_noexcept)
3173#endif // _LIBCPP_HAS_NO_NOEXCEPT
39843174
39853175#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
39863176template <class _Tp, class _Arg>
......@@ -4004,11 +3194,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v
40043194
40053195template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_assignable
40063196 : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
4007#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
40083197 typename add_rvalue_reference<_Tp>::type>
4009#else
4010 typename add_lvalue_reference<_Tp>::type>
4011#endif
40123198 {};
40133199
40143200#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
......@@ -4019,7 +3205,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v
40193205
40203206// is_nothrow_destructible
40213207
4022#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
3208#if !defined(_LIBCPP_CXX03_LANG)
40233209
40243210template <bool, class _Tp> struct __libcpp_is_nothrow_destructible;
40253211
......@@ -4053,16 +3239,12 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&>
40533239{
40543240};
40553241
4056#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
4057
40583242template <class _Tp>
40593243struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&&>
40603244 : public true_type
40613245{
40623246};
40633247
4064#endif
4065
40663248#else
40673249
40683250template <class _Tp> struct __libcpp_nothrow_destructor
......@@ -4086,7 +3268,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_destructible_v
40863268
40873269// is_pod
40883270
4089#if __has_feature(is_pod) || (_GNUC_VER >= 403)
3271#if __has_feature(is_pod) || defined(_LIBCPP_COMPILER_GCC)
40903272
40913273template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod
40923274 : public integral_constant<bool, __is_pod(_Tp)> {};
......@@ -4110,12 +3292,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_pod_v
41103292// is_literal_type;
41113293
41123294template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_literal_type
4113#ifdef _LIBCPP_IS_LITERAL
4114 : public integral_constant<bool, _LIBCPP_IS_LITERAL(_Tp)>
4115#else
4116 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value ||
4117 is_reference<typename remove_all_extents<_Tp>::type>::value>
4118#endif
3295 : public integral_constant<bool, __is_literal_type(_Tp)>
41193296 {};
41203297
41213298#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
......@@ -4127,7 +3304,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_literal_type_v
41273304// is_standard_layout;
41283305
41293306template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_standard_layout
4130#if __has_feature(is_standard_layout) || (_GNUC_VER >= 407)
3307#if __has_feature(is_standard_layout) || defined(_LIBCPP_COMPILER_GCC)
41313308 : public integral_constant<bool, __is_standard_layout(_Tp)>
41323309#else
41333310 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
......@@ -4161,7 +3338,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_copyable_v
41613338// is_trivial;
41623339
41633340template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivial
4164#if __has_feature(is_trivial) || _GNUC_VER >= 407
3341#if __has_feature(is_trivial) || defined(_LIBCPP_COMPILER_GCC)
41653342 : public integral_constant<bool, __is_trivial(_Tp)>
41663343#else
41673344 : integral_constant<bool, is_trivially_copyable<_Tp>::value &&
......@@ -4361,28 +3538,31 @@ _LIBCPP_INVOKE_RETURN(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)
43613538#undef _LIBCPP_INVOKE_RETURN
43623539
43633540// __invokable
4364
43653541template <class _Ret, class _Fp, class ..._Args>
43663542struct __invokable_r
43673543{
4368 // FIXME: Check that _Ret, _Fp, and _Args... are all complete types, cv void,
4369 // or incomplete array types as required by the standard.
4370 using _Result = decltype(
4371 _VSTD::__invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...));
3544 template <class _XFp, class ..._XArgs>
3545 static auto __try_call(int) -> decltype(
3546 _VSTD::__invoke(_VSTD::declval<_XFp>(), _VSTD::declval<_XArgs>()...));
3547 template <class _XFp, class ..._XArgs>
3548 static __nat __try_call(...);
43723549
4373 using type =
4374 typename conditional<
4375 !is_same<_Result, __nat>::value,
4376 typename conditional<
4377 is_void<_Ret>::value,
4378 true_type,
4379 is_convertible<_Result, _Ret>
4380 >::type,
4381 false_type
4382 >::type;
4383 static const bool value = type::value;
4384};
3550 // FIXME: Check that _Ret, _Fp, and _Args... are all complete types, cv void,
3551 // or incomplete array types as required by the standard.
3552 using _Result = decltype(__try_call<_Fp, _Args...>(0));
43853553
3554 using type =
3555 typename conditional<
3556 _IsNotSame<_Result, __nat>::value,
3557 typename conditional<
3558 is_void<_Ret>::value,
3559 true_type,
3560 is_convertible<_Result, _Ret>
3561 >::type,
3562 false_type
3563 >::type;
3564 static const bool value = type::value;
3565};
43863566template <class _Fp, class ..._Args>
43873567using __invokable = __invokable_r<void, _Fp, _Args...>;
43883568
......@@ -4512,6 +3692,7 @@ typename enable_if
45123692#else
45133693void
45143694#endif
3695_LIBCPP_CONSTEXPR_AFTER_CXX17
45153696swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value &&
45163697 is_nothrow_move_assignable<_Tp>::value)
45173698{
......@@ -4521,14 +3702,14 @@ swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value &&
45213702}
45223703
45233704template<class _Tp, size_t _Np>
4524inline _LIBCPP_INLINE_VISIBILITY
3705inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
45253706typename enable_if<
45263707 __is_swappable<_Tp>::value
45273708>::type
45283709swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value);
45293710
45303711template <class _ForwardIterator1, class _ForwardIterator2>
4531inline _LIBCPP_INLINE_VISIBILITY
3712inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
45323713void
45333714iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
45343715 // _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b)))
......@@ -4558,8 +3739,8 @@ struct __swappable_with
45583739 typedef decltype((__test_swap<_Tp, _Up>(0))) __swap1;
45593740 typedef decltype((__test_swap<_Up, _Tp>(0))) __swap2;
45603741
4561 static const bool value = !is_same<__swap1, __nat>::value
4562 && !is_same<__swap2, __nat>::value;
3742 static const bool value = _IsNotSame<__swap1, __nat>::value
3743 && _IsNotSame<__swap2, __nat>::value;
45633744};
45643745
45653746template <class _Tp, class _Up>
......@@ -4649,30 +3830,24 @@ _LIBCPP_INLINE_VAR constexpr bool is_nothrow_swappable_v
46493830
46503831#endif // _LIBCPP_STD_VER > 14
46513832
4652#ifdef _LIBCPP_UNDERLYING_TYPE
3833template <class _Tp, bool = is_enum<_Tp>::value> struct __underlying_type_impl;
3834
3835template <class _Tp>
3836struct __underlying_type_impl<_Tp, false> {};
46533837
46543838template <class _Tp>
4655struct underlying_type
3839struct __underlying_type_impl<_Tp, true>
46563840{
4657 typedef _LIBCPP_UNDERLYING_TYPE(_Tp) type;
3841 typedef __underlying_type(_Tp) type;
46583842};
46593843
3844template <class _Tp>
3845struct underlying_type : __underlying_type_impl<_Tp, is_enum<_Tp>::value> {};
3846
46603847#if _LIBCPP_STD_VER > 11
46613848template <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type;
46623849#endif
46633850
4664#else // _LIBCPP_UNDERLYING_TYPE
4665
4666template <class _Tp, bool _Support = false>
4667struct underlying_type
4668{
4669 static_assert(_Support, "The underyling_type trait requires compiler "
4670 "support. Either no such support exists or "
4671 "libc++ does not know how to use it.");
4672};
4673
4674#endif // _LIBCPP_UNDERLYING_TYPE
4675
46763851
46773852template <class _Tp, bool = is_enum<_Tp>::value>
46783853struct __sfinae_underlying_type
......@@ -4758,25 +3933,23 @@ struct __has_operator_addressof
47583933
47593934template <class...> using void_t = void;
47603935
4761# ifndef _LIBCPP_HAS_NO_VARIADICS
47623936template <class... _Args>
4763struct conjunction : __and_<_Args...> {};
3937struct conjunction : _And<_Args...> {};
47643938template<class... _Args>
47653939_LIBCPP_INLINE_VAR constexpr bool conjunction_v
47663940 = conjunction<_Args...>::value;
47673941
47683942template <class... _Args>
4769struct disjunction : __or_<_Args...> {};
3943struct disjunction : _Or<_Args...> {};
47703944template<class... _Args>
47713945_LIBCPP_INLINE_VAR constexpr bool disjunction_v
47723946 = disjunction<_Args...>::value;
47733947
47743948template <class _Tp>
4775struct negation : __not_<_Tp> {};
3949struct negation : _Not<_Tp> {};
47763950template<class _Tp>
47773951_LIBCPP_INLINE_VAR constexpr bool negation_v
47783952 = negation<_Tp>::value;
4779# endif // _LIBCPP_HAS_NO_VARIADICS
47803953#endif // _LIBCPP_STD_VER > 14
47813954
47823955// These traits are used in __tree and __hash_table
......@@ -4788,12 +3961,12 @@ struct __extract_key_first_tag {};
47883961template <class _ValTy, class _Key,
47893962 class _RawValTy = typename __unconstref<_ValTy>::type>
47903963struct __can_extract_key
4791 : conditional<is_same<_RawValTy, _Key>::value, __extract_key_self_tag,
3964 : conditional<_IsSame<_RawValTy, _Key>::value, __extract_key_self_tag,
47923965 __extract_key_fail_tag>::type {};
47933966
47943967template <class _Pair, class _Key, class _First, class _Second>
47953968struct __can_extract_key<_Pair, _Key, pair<_First, _Second>>
4796 : conditional<is_same<typename remove_const<_First>::type, _Key>::value,
3969 : conditional<_IsSame<typename remove_const<_First>::type, _Key>::value,
47973970 __extract_key_first_tag, __extract_key_fail_tag>::type {};
47983971
47993972// __can_extract_map_key uses true_type/false_type instead of the tags.
......@@ -4802,7 +3975,7 @@ struct __can_extract_key<_Pair, _Key, pair<_First, _Second>>
48023975template <class _ValTy, class _Key, class _ContainerValueTy,
48033976 class _RawValTy = typename __unconstref<_ValTy>::type>
48043977struct __can_extract_map_key
4805 : integral_constant<bool, is_same<_RawValTy, _Key>::value> {};
3978 : integral_constant<bool, _IsSame<_RawValTy, _Key>::value> {};
48063979
48073980// This specialization returns __extract_key_fail_tag for non-map containers
48083981// because _Key == _ContainerValueTy
......@@ -4827,6 +4000,24 @@ enum class endian
48274000};
48284001#endif
48294002
4003#ifndef _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
4004#if _LIBCPP_STD_VER > 17
4005_LIBCPP_INLINE_VISIBILITY
4006inline constexpr bool is_constant_evaluated() noexcept {
4007 return __builtin_is_constant_evaluated();
4008}
4009#endif
4010
4011inline _LIBCPP_CONSTEXPR
4012bool __libcpp_is_constant_evaluated() _NOEXCEPT { return __builtin_is_constant_evaluated(); }
4013#else
4014inline _LIBCPP_CONSTEXPR
4015bool __libcpp_is_constant_evaluated() _NOEXCEPT { return false; }
4016#endif
4017
4018template <class _CharT>
4019using _IsCharLikeType = _And<is_standard_layout<_CharT>, is_trivial<_CharT> >;
4020
48304021_LIBCPP_END_NAMESPACE_STD
48314022
48324023#if _LIBCPP_STD_VER > 14
lib/libcxx/include/typeindex+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- typeindex ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/typeinfo+190-76
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- typeinfo ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -69,59 +68,32 @@ public:
6968#pragma GCC system_header
7069#endif
7170
72#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)
71#if defined(_LIBCPP_ABI_VCRUNTIME)
7372#include <vcruntime_typeinfo.h>
7473#else
7574
76#if defined(_LIBCPP_NONUNIQUE_RTTI_BIT) && !defined(_LIBCPP_ABI_MICROSOFT)
77# define _LIBCPP_HAS_NONUNIQUE_TYPEINFO
78#endif
79
8075namespace std // purposefully not using versioning namespace
8176{
8277
78
79#if defined(_LIBCPP_ABI_MICROSOFT)
80
8381class _LIBCPP_EXCEPTION_ABI type_info
8482{
8583 type_info& operator=(const type_info&);
8684 type_info(const type_info&);
8785
88#if defined(_LIBCPP_HAS_NONUNIQUE_TYPEINFO)
89 _LIBCPP_INLINE_VISIBILITY
90 int __compare_nonunique_names(const type_info &__arg) const _NOEXCEPT
91 { return __builtin_strcmp(name(), __arg.name()); }
92#endif
93
94#if defined(_LIBCPP_ABI_MICROSOFT)
9586 mutable struct {
9687 const char *__undecorated_name;
9788 const char __decorated_name[1];
9889 } __data;
9990
10091 int __compare(const type_info &__rhs) const _NOEXCEPT;
101#endif // _LIBCPP_ABI_MICROSOFT
102
103protected:
104#if !defined(_LIBCPP_ABI_MICROSOFT)
105#if defined(_LIBCPP_HAS_NONUNIQUE_TYPEINFO)
106 // A const char* with the non-unique RTTI bit possibly set.
107 uintptr_t __type_name;
108
109 _LIBCPP_INLINE_VISIBILITY
110 explicit type_info(const char* __n)
111 : __type_name(reinterpret_cast<uintptr_t>(__n)) {}
112#else
113 const char *__type_name;
114
115 _LIBCPP_INLINE_VISIBILITY
116 explicit type_info(const char* __n) : __type_name(__n) {}
117#endif
118#endif // ! _LIBCPP_ABI_MICROSOFT
11992
12093public:
12194 _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
12295 virtual ~type_info();
12396
124#if defined(_LIBCPP_ABI_MICROSOFT)
12597 const char *name() const _NOEXCEPT;
12698
12799 _LIBCPP_INLINE_VISIBILITY
......@@ -135,91 +107,233 @@ public:
135107 bool operator==(const type_info& __arg) const _NOEXCEPT {
136108 return __compare(__arg) == 0;
137109 }
138#else
139#if defined(_LIBCPP_HAS_NONUNIQUE_TYPEINFO)
140 _LIBCPP_INLINE_VISIBILITY
141 const char* name() const _NOEXCEPT
142 {
143 return reinterpret_cast<const char*>(__type_name &
144 ~_LIBCPP_NONUNIQUE_RTTI_BIT);
145 }
146110
147111 _LIBCPP_INLINE_VISIBILITY
148 bool before(const type_info& __arg) const _NOEXCEPT
149 {
150 if (!((__type_name & __arg.__type_name) & _LIBCPP_NONUNIQUE_RTTI_BIT))
151 return __type_name < __arg.__type_name;
152 return __compare_nonunique_names(__arg) < 0;
112 bool operator!=(const type_info& __arg) const _NOEXCEPT
113 { return !operator==(__arg); }
114};
115
116#else // !defined(_LIBCPP_ABI_MICROSOFT)
117
118// ========================================================================== //
119// Implementations
120// ========================================================================== //
121// ------------------------------------------------------------------------- //
122// Unique
123// ------------------------------------------------------------------------- //
124// This implementation of type_info assumes a unique copy of the RTTI for a
125// given type inside a program. This is a valid assumption when abiding to
126// Itanium ABI (http://itanium-cxx-abi.github.io/cxx-abi/abi.html#vtable-components).
127// Under this assumption, we can always compare the addresses of the type names
128// to implement equality-comparison of type_infos instead of having to perform
129// a deep string comparison.
130// -------------------------------------------------------------------------- //
131// NonUnique
132// -------------------------------------------------------------------------- //
133// This implementation of type_info does not assume there is always a unique
134// copy of the RTTI for a given type inside a program. For various reasons
135// the linker may have failed to merge every copy of a types RTTI
136// (For example: -Bsymbolic or llvm.org/PR37398). Under this assumption, two
137// type_infos are equal if their addresses are equal or if a deep string
138// comparison is equal.
139// -------------------------------------------------------------------------- //
140// NonUniqueARMRTTIBit
141// -------------------------------------------------------------------------- //
142// This implementation of type_info does not assume always a unique copy of
143// the RTTI for a given type inside a program. It packs the pointer to the
144// type name into a uintptr_t and reserves the high bit of that pointer (which
145// is assumed to be free for use under the ABI in use) to represent whether
146// that specific copy of the RTTI can be assumed unique inside the program.
147// To implement equality-comparison of type_infos, we check whether BOTH
148// type_infos are guaranteed unique, and if so, we simply compare the addresses
149// of their type names instead of doing a deep string comparison, which is
150// faster. If at least one of the type_infos can't guarantee uniqueness, we
151// have no choice but to fall back to a deep string comparison.
152//
153// This implementation is specific to ARM64 on Apple platforms.
154//
155// Note that the compiler is the one setting (or unsetting) the high bit of
156// the pointer when it constructs the type_info, depending on whether it can
157// guarantee uniqueness for that specific type_info.
158
159struct __type_info_implementations {
160 struct __string_impl_base {
161 typedef const char* __type_name_t;
162 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
163 _LIBCPP_CONSTEXPR static const char* __type_name_to_string(__type_name_t __v) _NOEXCEPT {
164 return __v;
153165 }
166 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
167 _LIBCPP_CONSTEXPR static __type_name_t __string_to_type_name(const char* __v) _NOEXCEPT {
168 return __v;
169 }
170 };
154171
155 _LIBCPP_INLINE_VISIBILITY
156 size_t hash_code() const _NOEXCEPT
157 {
158 if (!(__type_name & _LIBCPP_NONUNIQUE_RTTI_BIT))
159 return __type_name;
172 struct __unique_impl : __string_impl_base {
173 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
174 static size_t __hash(__type_name_t __v) _NOEXCEPT {
175 return reinterpret_cast<size_t>(__v);
176 }
177 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
178 static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
179 return __lhs == __rhs;
180 }
181 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
182 static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
183 return __lhs < __rhs;
184 }
185 };
160186
161 const char* __ptr = name();
187 struct __non_unique_impl : __string_impl_base {
188 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
189 static size_t __hash(__type_name_t __ptr) _NOEXCEPT {
162190 size_t __hash = 5381;
163191 while (unsigned char __c = static_cast<unsigned char>(*__ptr++))
164192 __hash = (__hash * 33) ^ __c;
165193 return __hash;
166194 }
195 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
196 static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
197 return __lhs == __rhs || __builtin_strcmp(__lhs, __rhs) == 0;
198 }
199 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
200 static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
201 return __builtin_strcmp(__lhs, __rhs) < 0;
202 }
203 };
167204
168 _LIBCPP_INLINE_VISIBILITY
169 bool operator==(const type_info& __arg) const _NOEXCEPT
170 {
171 if (__type_name == __arg.__type_name)
172 return true;
205 struct __non_unique_arm_rtti_bit_impl {
206 typedef uintptr_t __type_name_t;
207
208 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
209 static const char* __type_name_to_string(__type_name_t __v) _NOEXCEPT {
210 return reinterpret_cast<const char*>(__v &
211 ~__non_unique_rtti_bit::value);
212 }
213 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
214 static __type_name_t __string_to_type_name(const char* __v) _NOEXCEPT {
215 return reinterpret_cast<__type_name_t>(__v);
216 }
173217
174 if (!((__type_name & __arg.__type_name) & _LIBCPP_NONUNIQUE_RTTI_BIT))
218 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
219 static size_t __hash(__type_name_t __v) _NOEXCEPT {
220 if (__is_type_name_unique(__v))
221 return reinterpret_cast<size_t>(__v);
222 return __non_unique_impl::__hash(__type_name_to_string(__v));
223 }
224 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
225 static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
226 if (__lhs == __rhs)
227 return true;
228 if (__is_type_name_unique(__lhs, __rhs))
175229 return false;
176 return __compare_nonunique_names(__arg) == 0;
230 return __builtin_strcmp(__type_name_to_string(__lhs), __type_name_to_string(__rhs)) == 0;
231 }
232 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
233 static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
234 if (__is_type_name_unique(__lhs, __rhs))
235 return __lhs < __rhs;
236 return __builtin_strcmp(__type_name_to_string(__lhs), __type_name_to_string(__rhs)) < 0;
177237 }
238
239 private:
240 // The unique bit is the top bit. It is expected that __type_name_t is 64 bits when
241 // this implementation is actually used.
242 typedef std::integral_constant<__type_name_t,
243 (1ULL << ((__CHAR_BIT__ * sizeof(__type_name_t)) - 1))> __non_unique_rtti_bit;
244
245 _LIBCPP_INLINE_VISIBILITY
246 static bool __is_type_name_unique(__type_name_t __lhs) _NOEXCEPT {
247 return !(__lhs & __non_unique_rtti_bit::value);
248 }
249 _LIBCPP_INLINE_VISIBILITY
250 static bool __is_type_name_unique(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
251 return !((__lhs & __rhs) & __non_unique_rtti_bit::value);
252 }
253 };
254
255 typedef
256#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
257 __non_unique_arm_rtti_bit_impl
258#elif _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT == 0
259 __non_unique_impl
260#elif _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT == 1
261 __unique_impl
178262#else
263# error invalid configuration for _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT
264#endif
265 __impl;
266};
267
268class _LIBCPP_EXCEPTION_ABI type_info
269{
270 type_info& operator=(const type_info&);
271 type_info(const type_info&);
272
273 protected:
274 typedef __type_info_implementations::__impl __impl;
275
276 __impl::__type_name_t __type_name;
277
278 _LIBCPP_INLINE_VISIBILITY
279 explicit type_info(const char* __n)
280 : __type_name(__impl::__string_to_type_name(__n)) {}
281
282public:
283 _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
284 virtual ~type_info();
285
179286 _LIBCPP_INLINE_VISIBILITY
180287 const char* name() const _NOEXCEPT
181 { return __type_name; }
288 {
289 return __impl::__type_name_to_string(__type_name);
290 }
182291
183292 _LIBCPP_INLINE_VISIBILITY
184293 bool before(const type_info& __arg) const _NOEXCEPT
185 { return __type_name < __arg.__type_name; }
294 {
295 return __impl::__lt(__type_name, __arg.__type_name);
296 }
186297
187298 _LIBCPP_INLINE_VISIBILITY
188299 size_t hash_code() const _NOEXCEPT
189 { return reinterpret_cast<size_t>(__type_name); }
300 {
301 return __impl::__hash(__type_name);
302 }
190303
191304 _LIBCPP_INLINE_VISIBILITY
192305 bool operator==(const type_info& __arg) const _NOEXCEPT
193 { return __type_name == __arg.__type_name; }
194#endif
195#endif // _LIBCPP_ABI_MICROSOFT
306 {
307 return __impl::__eq(__type_name, __arg.__type_name);
308 }
196309
197310 _LIBCPP_INLINE_VISIBILITY
198311 bool operator!=(const type_info& __arg) const _NOEXCEPT
199312 { return !operator==(__arg); }
200313};
314#endif // defined(_LIBCPP_ABI_MICROSOFT)
201315
202316class _LIBCPP_EXCEPTION_ABI bad_cast
203317 : public exception
204318{
205public:
206 bad_cast() _NOEXCEPT;
207 virtual ~bad_cast() _NOEXCEPT;
208 virtual const char* what() const _NOEXCEPT;
319 public:
320 bad_cast() _NOEXCEPT;
321 virtual ~bad_cast() _NOEXCEPT;
322 virtual const char* what() const _NOEXCEPT;
209323};
210324
211325class _LIBCPP_EXCEPTION_ABI bad_typeid
212326 : public exception
213327{
214public:
215 bad_typeid() _NOEXCEPT;
216 virtual ~bad_typeid() _NOEXCEPT;
217 virtual const char* what() const _NOEXCEPT;
328 public:
329 bad_typeid() _NOEXCEPT;
330 virtual ~bad_typeid() _NOEXCEPT;
331 virtual const char* what() const _NOEXCEPT;
218332};
219333
220334} // std
221335
222#endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)
336#endif // defined(_LIBCPP_ABI_VCRUNTIME)
223337
224338_LIBCPP_BEGIN_NAMESPACE_STD
225339_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
lib/libcxx/include/unordered_map+173-28
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- unordered_map -----------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -80,12 +79,12 @@ public:
8079 unordered_map(InputIterator f, InputIterator l, size_type n, const allocator_type& a)
8180 : unordered_map(f, l, n, hasher(), key_equal(), a) {} // C++14
8281 template <class InputIterator>
83 unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf,
82 unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf,
8483 const allocator_type& a)
8584 : unordered_map(f, l, n, hf, key_equal(), a) {} // C++14
8685 unordered_map(initializer_list<value_type> il, size_type n, const allocator_type& a)
8786 : unordered_map(il, n, hasher(), key_equal(), a) {} // C++14
88 unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf,
87 unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf,
8988 const allocator_type& a)
9089 : unordered_map(il, n, hf, key_equal(), a) {} // C++14
9190 ~unordered_map();
......@@ -175,6 +174,7 @@ public:
175174 iterator find(const key_type& k);
176175 const_iterator find(const key_type& k) const;
177176 size_type count(const key_type& k) const;
177 bool contains(const key_type& k) const; // C++20
178178 pair<iterator, iterator> equal_range(const key_type& k);
179179 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
180180
......@@ -278,12 +278,12 @@ public:
278278 unordered_multimap(InputIterator f, InputIterator l, size_type n, const allocator_type& a)
279279 : unordered_multimap(f, l, n, hasher(), key_equal(), a) {} // C++14
280280 template <class InputIterator>
281 unordered_multimap(InputIterator f, InputIterator l, size_type n, const hasher& hf,
281 unordered_multimap(InputIterator f, InputIterator l, size_type n, const hasher& hf,
282282 const allocator_type& a)
283283 : unordered_multimap(f, l, n, hf, key_equal(), a) {} // C++14
284284 unordered_multimap(initializer_list<value_type> il, size_type n, const allocator_type& a)
285285 : unordered_multimap(il, n, hasher(), key_equal(), a) {} // C++14
286 unordered_multimap(initializer_list<value_type> il, size_type n, const hasher& hf,
286 unordered_multimap(initializer_list<value_type> il, size_type n, const hasher& hf,
287287 const allocator_type& a)
288288 : unordered_multimap(il, n, hf, key_equal(), a) {} // C++14
289289 ~unordered_multimap();
......@@ -356,6 +356,7 @@ public:
356356 iterator find(const key_type& k);
357357 const_iterator find(const key_type& k) const;
358358 size_type count(const key_type& k) const;
359 bool contains(const key_type& k) const; // C++20
359360 pair<iterator, iterator> equal_range(const key_type& k);
360361 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
361362
......@@ -845,15 +846,14 @@ public:
845846 // types
846847 typedef _Key key_type;
847848 typedef _Tp mapped_type;
848 typedef _Hash hasher;
849 typedef _Pred key_equal;
850 typedef _Alloc allocator_type;
849 typedef typename __identity<_Hash>::type hasher;
850 typedef typename __identity<_Pred>::type key_equal;
851 typedef typename __identity<_Alloc>::type allocator_type;
851852 typedef pair<const key_type, mapped_type> value_type;
852853 typedef value_type& reference;
853854 typedef const value_type& const_reference;
854855 static_assert((is_same<value_type, typename allocator_type::value_type>::value),
855856 "Invalid allocator::value_type");
856 static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
857857
858858private:
859859 typedef __hash_value_type<key_type, mapped_type> __value_type;
......@@ -953,18 +953,22 @@ public:
953953 : unordered_map(__first, __last, __n, hasher(), key_equal(), __a) {}
954954 template <class _InputIterator>
955955 _LIBCPP_INLINE_VISIBILITY
956 unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf,
956 unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf,
957957 const allocator_type& __a)
958958 : unordered_map(__first, __last, __n, __hf, key_equal(), __a) {}
959959 _LIBCPP_INLINE_VISIBILITY
960960 unordered_map(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
961961 : unordered_map(__il, __n, hasher(), key_equal(), __a) {}
962962 _LIBCPP_INLINE_VISIBILITY
963 unordered_map(initializer_list<value_type> __il, size_type __n, const hasher& __hf,
963 unordered_map(initializer_list<value_type> __il, size_type __n, const hasher& __hf,
964964 const allocator_type& __a)
965965 : unordered_map(__il, __n, __hf, key_equal(), __a) {}
966966#endif
967 // ~unordered_map() = default;
967 _LIBCPP_INLINE_VISIBILITY
968 ~unordered_map() {
969 static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
970 }
971
968972 _LIBCPP_INLINE_VISIBILITY
969973 unordered_map& operator=(const unordered_map& __u)
970974 {
......@@ -1276,6 +1280,10 @@ public:
12761280 const_iterator find(const key_type& __k) const {return __table_.find(__k);}
12771281 _LIBCPP_INLINE_VISIBILITY
12781282 size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
1283 #if _LIBCPP_STD_VER > 17
1284 _LIBCPP_INLINE_VISIBILITY
1285 bool contains(const key_type& __k) const {return find(__k) != end();}
1286 #endif // _LIBCPP_STD_VER > 17
12791287 _LIBCPP_INLINE_VISIBILITY
12801288 pair<iterator, iterator> equal_range(const key_type& __k)
12811289 {return __table_.__equal_range_unique(__k);}
......@@ -1346,6 +1354,73 @@ private:
13461354#endif
13471355};
13481356
1357#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
1358template<class _InputIterator,
1359 class _Hash = hash<__iter_key_type<_InputIterator>>,
1360 class _Pred = equal_to<__iter_key_type<_InputIterator>>,
1361 class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
1362 class = _EnableIf<!__is_allocator<_Hash>::value>,
1363 class = _EnableIf<!is_integral<_Hash>::value>,
1364 class = _EnableIf<!__is_allocator<_Pred>::value>,
1365 class = _EnableIf<__is_allocator<_Allocator>::value>>
1366unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
1367 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
1368 -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, _Pred, _Allocator>;
1369
1370template<class _Key, class _Tp, class _Hash = hash<remove_const_t<_Key>>,
1371 class _Pred = equal_to<remove_const_t<_Key>>,
1372 class _Allocator = allocator<pair<const _Key, _Tp>>,
1373 class = _EnableIf<!__is_allocator<_Hash>::value>,
1374 class = _EnableIf<!is_integral<_Hash>::value>,
1375 class = _EnableIf<!__is_allocator<_Pred>::value>,
1376 class = _EnableIf<__is_allocator<_Allocator>::value>>
1377unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type = 0,
1378 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
1379 -> unordered_map<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
1380
1381template<class _InputIterator, class _Allocator,
1382 class = _EnableIf<__is_allocator<_Allocator>::value>>
1383unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
1384 -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
1385 hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
1386
1387template<class _InputIterator, class _Allocator,
1388 class = _EnableIf<__is_allocator<_Allocator>::value>>
1389unordered_map(_InputIterator, _InputIterator, _Allocator)
1390 -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
1391 hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
1392
1393template<class _InputIterator, class _Hash, class _Allocator,
1394 class = _EnableIf<!__is_allocator<_Hash>::value>,
1395 class = _EnableIf<!is_integral<_Hash>::value>,
1396 class = _EnableIf<__is_allocator<_Allocator>::value>>
1397unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
1398 -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
1399 _Hash, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
1400
1401template<class _Key, class _Tp, class _Allocator,
1402 class = _EnableIf<__is_allocator<_Allocator>::value>>
1403unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Allocator)
1404 -> unordered_map<remove_const_t<_Key>, _Tp,
1405 hash<remove_const_t<_Key>>,
1406 equal_to<remove_const_t<_Key>>, _Allocator>;
1407
1408template<class _Key, class _Tp, class _Allocator,
1409 class = _EnableIf<__is_allocator<_Allocator>::value>>
1410unordered_map(initializer_list<pair<_Key, _Tp>>, _Allocator)
1411 -> unordered_map<remove_const_t<_Key>, _Tp,
1412 hash<remove_const_t<_Key>>,
1413 equal_to<remove_const_t<_Key>>, _Allocator>;
1414
1415template<class _Key, class _Tp, class _Hash, class _Allocator,
1416 class = _EnableIf<!__is_allocator<_Hash>::value>,
1417 class = _EnableIf<!is_integral<_Hash>::value>,
1418 class = _EnableIf<__is_allocator<_Allocator>::value>>
1419unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
1420 -> unordered_map<remove_const_t<_Key>, _Tp, _Hash,
1421 equal_to<remove_const_t<_Key>>, _Allocator>;
1422#endif
1423
13491424template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
13501425unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
13511426 size_type __n, const hasher& __hf, const key_equal& __eql)
......@@ -1603,10 +1678,8 @@ _Tp&
16031678unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k)
16041679{
16051680 iterator __i = find(__k);
1606#ifndef _LIBCPP_NO_EXCEPTIONS
16071681 if (__i == end())
1608 throw out_of_range("unordered_map::at: key not found");
1609#endif // _LIBCPP_NO_EXCEPTIONS
1682 __throw_out_of_range("unordered_map::at: key not found");
16101683 return __i->second;
16111684}
16121685
......@@ -1615,10 +1688,8 @@ const _Tp&
16151688unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) const
16161689{
16171690 const_iterator __i = find(__k);
1618#ifndef _LIBCPP_NO_EXCEPTIONS
16191691 if (__i == end())
1620 throw out_of_range("unordered_map::at: key not found");
1621#endif // _LIBCPP_NO_EXCEPTIONS
1692 __throw_out_of_range("unordered_map::at: key not found");
16221693 return __i->second;
16231694}
16241695
......@@ -1675,15 +1746,14 @@ public:
16751746 // types
16761747 typedef _Key key_type;
16771748 typedef _Tp mapped_type;
1678 typedef _Hash hasher;
1679 typedef _Pred key_equal;
1680 typedef _Alloc allocator_type;
1749 typedef typename __identity<_Hash>::type hasher;
1750 typedef typename __identity<_Pred>::type key_equal;
1751 typedef typename __identity<_Alloc>::type allocator_type;
16811752 typedef pair<const key_type, mapped_type> value_type;
16821753 typedef value_type& reference;
16831754 typedef const value_type& const_reference;
16841755 static_assert((is_same<value_type, typename allocator_type::value_type>::value),
16851756 "Invalid allocator::value_type");
1686 static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
16871757
16881758private:
16891759 typedef __hash_value_type<key_type, mapped_type> __value_type;
......@@ -1781,18 +1851,22 @@ public:
17811851 : unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) {}
17821852 template <class _InputIterator>
17831853 _LIBCPP_INLINE_VISIBILITY
1784 unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf,
1854 unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf,
17851855 const allocator_type& __a)
17861856 : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) {}
17871857 _LIBCPP_INLINE_VISIBILITY
17881858 unordered_multimap(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
17891859 : unordered_multimap(__il, __n, hasher(), key_equal(), __a) {}
17901860 _LIBCPP_INLINE_VISIBILITY
1791 unordered_multimap(initializer_list<value_type> __il, size_type __n, const hasher& __hf,
1861 unordered_multimap(initializer_list<value_type> __il, size_type __n, const hasher& __hf,
17921862 const allocator_type& __a)
17931863 : unordered_multimap(__il, __n, __hf, key_equal(), __a) {}
17941864#endif
1795 // ~unordered_multimap() = default;
1865 _LIBCPP_INLINE_VISIBILITY
1866 ~unordered_multimap() {
1867 static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
1868 }
1869
17961870 _LIBCPP_INLINE_VISIBILITY
17971871 unordered_multimap& operator=(const unordered_multimap& __u)
17981872 {
......@@ -1981,6 +2055,10 @@ public:
19812055 const_iterator find(const key_type& __k) const {return __table_.find(__k);}
19822056 _LIBCPP_INLINE_VISIBILITY
19832057 size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
2058 #if _LIBCPP_STD_VER > 17
2059 _LIBCPP_INLINE_VISIBILITY
2060 bool contains(const key_type& __k) const {return find(__k) != end();}
2061 #endif // _LIBCPP_STD_VER > 17
19842062 _LIBCPP_INLINE_VISIBILITY
19852063 pair<iterator, iterator> equal_range(const key_type& __k)
19862064 {return __table_.__equal_range_multi(__k);}
......@@ -2040,6 +2118,73 @@ public:
20402118
20412119};
20422120
2121#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
2122template<class _InputIterator,
2123 class _Hash = hash<__iter_key_type<_InputIterator>>,
2124 class _Pred = equal_to<__iter_key_type<_InputIterator>>,
2125 class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
2126 class = _EnableIf<!__is_allocator<_Hash>::value>,
2127 class = _EnableIf<!is_integral<_Hash>::value>,
2128 class = _EnableIf<!__is_allocator<_Pred>::value>,
2129 class = _EnableIf<__is_allocator<_Allocator>::value>>
2130unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
2131 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
2132 -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, _Pred, _Allocator>;
2133
2134template<class _Key, class _Tp, class _Hash = hash<remove_const_t<_Key>>,
2135 class _Pred = equal_to<remove_const_t<_Key>>,
2136 class _Allocator = allocator<pair<const _Key, _Tp>>,
2137 class = _EnableIf<!__is_allocator<_Hash>::value>,
2138 class = _EnableIf<!is_integral<_Hash>::value>,
2139 class = _EnableIf<!__is_allocator<_Pred>::value>,
2140 class = _EnableIf<__is_allocator<_Allocator>::value>>
2141unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type = 0,
2142 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
2143 -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
2144
2145template<class _InputIterator, class _Allocator,
2146 class = _EnableIf<__is_allocator<_Allocator>::value>>
2147unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
2148 -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
2149 hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
2150
2151template<class _InputIterator, class _Allocator,
2152 class = _EnableIf<__is_allocator<_Allocator>::value>>
2153unordered_multimap(_InputIterator, _InputIterator, _Allocator)
2154 -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
2155 hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
2156
2157template<class _InputIterator, class _Hash, class _Allocator,
2158 class = _EnableIf<!__is_allocator<_Hash>::value>,
2159 class = _EnableIf<!is_integral<_Hash>::value>,
2160 class = _EnableIf<__is_allocator<_Allocator>::value>>
2161unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
2162 -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
2163 _Hash, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
2164
2165template<class _Key, class _Tp, class _Allocator,
2166 class = _EnableIf<__is_allocator<_Allocator>::value>>
2167unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Allocator)
2168 -> unordered_multimap<remove_const_t<_Key>, _Tp,
2169 hash<remove_const_t<_Key>>,
2170 equal_to<remove_const_t<_Key>>, _Allocator>;
2171
2172template<class _Key, class _Tp, class _Allocator,
2173 class = _EnableIf<__is_allocator<_Allocator>::value>>
2174unordered_multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
2175 -> unordered_multimap<remove_const_t<_Key>, _Tp,
2176 hash<remove_const_t<_Key>>,
2177 equal_to<remove_const_t<_Key>>, _Allocator>;
2178
2179template<class _Key, class _Tp, class _Hash, class _Allocator,
2180 class = _EnableIf<!__is_allocator<_Hash>::value>,
2181 class = _EnableIf<!is_integral<_Hash>::value>,
2182 class = _EnableIf<__is_allocator<_Allocator>::value>>
2183unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
2184 -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash,
2185 equal_to<remove_const_t<_Key>>, _Allocator>;
2186#endif
2187
20432188template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
20442189unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
20452190 size_type __n, const hasher& __hf, const key_equal& __eql)
lib/libcxx/include/unordered_set+145-20
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- unordered_set -----------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -76,7 +75,7 @@ public:
7675 template <class InputIterator>
7776 unordered_set(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14
7877 template <class InputIterator>
79 unordered_set(InputIterator f, InputIterator l, size_type n,
78 unordered_set(InputIterator f, InputIterator l, size_type n,
8079 const hasher& hf, const allocator_type& a); // C++14
8180 unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14
8281 unordered_set(initializer_list<value_type> il, size_type n,
......@@ -147,6 +146,7 @@ public:
147146 iterator find(const key_type& k);
148147 const_iterator find(const key_type& k) const;
149148 size_type count(const key_type& k) const;
149 bool contains(const key_type& k) const; // C++20
150150 pair<iterator, iterator> equal_range(const key_type& k);
151151 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
152152
......@@ -243,7 +243,7 @@ public:
243243 unordered_multiset(InputIterator f, InputIterator l, size_type n,
244244 const hasher& hf, const allocator_type& a); // C++14
245245 unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14
246 unordered_multiset(initializer_list<value_type> il, size_type n,
246 unordered_multiset(initializer_list<value_type> il, size_type n,
247247 const hasher& hf, const allocator_type& a); // C++14
248248 ~unordered_multiset();
249249 unordered_multiset& operator=(const unordered_multiset&);
......@@ -311,6 +311,7 @@ public:
311311 iterator find(const key_type& k);
312312 const_iterator find(const key_type& k) const;
313313 size_type count(const key_type& k) const;
314 bool contains(const key_type& k) const; // C++20
314315 pair<iterator, iterator> equal_range(const key_type& k);
315316 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
316317
......@@ -384,14 +385,13 @@ public:
384385 // types
385386 typedef _Value key_type;
386387 typedef key_type value_type;
387 typedef _Hash hasher;
388 typedef _Pred key_equal;
389 typedef _Alloc allocator_type;
388 typedef typename __identity<_Hash>::type hasher;
389 typedef typename __identity<_Pred>::type key_equal;
390 typedef typename __identity<_Alloc>::type allocator_type;
390391 typedef value_type& reference;
391392 typedef const value_type& const_reference;
392393 static_assert((is_same<value_type, typename allocator_type::value_type>::value),
393394 "Invalid allocator::value_type");
394 static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
395395
396396private:
397397 typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
......@@ -452,11 +452,11 @@ public:
452452#if _LIBCPP_STD_VER > 11
453453 template <class _InputIterator>
454454 inline _LIBCPP_INLINE_VISIBILITY
455 unordered_set(_InputIterator __first, _InputIterator __last,
455 unordered_set(_InputIterator __first, _InputIterator __last,
456456 size_type __n, const allocator_type& __a)
457457 : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) {}
458458 template <class _InputIterator>
459 unordered_set(_InputIterator __first, _InputIterator __last,
459 unordered_set(_InputIterator __first, _InputIterator __last,
460460 size_type __n, const hasher& __hf, const allocator_type& __a)
461461 : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {}
462462#endif
......@@ -482,12 +482,16 @@ public:
482482 const allocator_type& __a)
483483 : unordered_set(__il, __n, hasher(), key_equal(), __a) {}
484484 inline _LIBCPP_INLINE_VISIBILITY
485 unordered_set(initializer_list<value_type> __il, size_type __n,
485 unordered_set(initializer_list<value_type> __il, size_type __n,
486486 const hasher& __hf, const allocator_type& __a)
487487 : unordered_set(__il, __n, __hf, key_equal(), __a) {}
488488#endif
489489#endif // _LIBCPP_CXX03_LANG
490 // ~unordered_set() = default;
490 _LIBCPP_INLINE_VISIBILITY
491 ~unordered_set() {
492 static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
493 }
494
491495 _LIBCPP_INLINE_VISIBILITY
492496 unordered_set& operator=(const unordered_set& __u)
493497 {
......@@ -675,6 +679,10 @@ public:
675679 const_iterator find(const key_type& __k) const {return __table_.find(__k);}
676680 _LIBCPP_INLINE_VISIBILITY
677681 size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
682 #if _LIBCPP_STD_VER > 17
683 _LIBCPP_INLINE_VISIBILITY
684 bool contains(const key_type& __k) const {return find(__k) != end();}
685 #endif // _LIBCPP_STD_VER > 17
678686 _LIBCPP_INLINE_VISIBILITY
679687 pair<iterator, iterator> equal_range(const key_type& __k)
680688 {return __table_.__equal_range_unique(__k);}
......@@ -731,6 +739,62 @@ public:
731739
732740};
733741
742#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
743template<class _InputIterator,
744 class _Hash = hash<__iter_value_type<_InputIterator>>,
745 class _Pred = equal_to<__iter_value_type<_InputIterator>>,
746 class _Allocator = allocator<__iter_value_type<_InputIterator>>,
747 class = _EnableIf<!__is_allocator<_Hash>::value>,
748 class = _EnableIf<!is_integral<_Hash>::value>,
749 class = _EnableIf<!__is_allocator<_Pred>::value>,
750 class = _EnableIf<__is_allocator<_Allocator>::value>>
751unordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
752 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
753 -> unordered_set<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
754
755template<class _Tp, class _Hash = hash<_Tp>,
756 class _Pred = equal_to<_Tp>,
757 class _Allocator = allocator<_Tp>,
758 class = _EnableIf<!__is_allocator<_Hash>::value>,
759 class = _EnableIf<!is_integral<_Hash>::value>,
760 class = _EnableIf<!__is_allocator<_Pred>::value>,
761 class = _EnableIf<__is_allocator<_Allocator>::value>>
762unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0,
763 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
764 -> unordered_set<_Tp, _Hash, _Pred, _Allocator>;
765
766template<class _InputIterator, class _Allocator,
767 class = _EnableIf<__is_allocator<_Allocator>::value>>
768unordered_set(_InputIterator, _InputIterator,
769 typename allocator_traits<_Allocator>::size_type, _Allocator)
770 -> unordered_set<__iter_value_type<_InputIterator>,
771 hash<__iter_value_type<_InputIterator>>,
772 equal_to<__iter_value_type<_InputIterator>>,
773 _Allocator>;
774
775template<class _InputIterator, class _Hash, class _Allocator,
776 class = _EnableIf<!__is_allocator<_Hash>::value>,
777 class = _EnableIf<!is_integral<_Hash>::value>,
778 class = _EnableIf<__is_allocator<_Allocator>::value>>
779unordered_set(_InputIterator, _InputIterator,
780 typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
781 -> unordered_set<__iter_value_type<_InputIterator>, _Hash,
782 equal_to<__iter_value_type<_InputIterator>>,
783 _Allocator>;
784
785template<class _Tp, class _Allocator,
786 class = _EnableIf<__is_allocator<_Allocator>::value>>
787unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator)
788 -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
789
790template<class _Tp, class _Hash, class _Allocator,
791 class = _EnableIf<!__is_allocator<_Hash>::value>,
792 class = _EnableIf<!is_integral<_Hash>::value>,
793 class = _EnableIf<__is_allocator<_Allocator>::value>>
794unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
795 -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
796#endif
797
734798template <class _Value, class _Hash, class _Pred, class _Alloc>
735799unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
736800 const hasher& __hf, const key_equal& __eql)
......@@ -984,14 +1048,13 @@ public:
9841048 // types
9851049 typedef _Value key_type;
9861050 typedef key_type value_type;
987 typedef _Hash hasher;
988 typedef _Pred key_equal;
989 typedef _Alloc allocator_type;
1051 typedef typename __identity<_Hash>::type hasher;
1052 typedef typename __identity<_Pred>::type key_equal;
1053 typedef typename __identity<_Alloc>::type allocator_type;
9901054 typedef value_type& reference;
9911055 typedef const value_type& const_reference;
9921056 static_assert((is_same<value_type, typename allocator_type::value_type>::value),
9931057 "Invalid allocator::value_type");
994 static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
9951058
9961059private:
9971060 typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
......@@ -1051,7 +1114,7 @@ public:
10511114#if _LIBCPP_STD_VER > 11
10521115 template <class _InputIterator>
10531116 inline _LIBCPP_INLINE_VISIBILITY
1054 unordered_multiset(_InputIterator __first, _InputIterator __last,
1117 unordered_multiset(_InputIterator __first, _InputIterator __last,
10551118 size_type __n, const allocator_type& __a)
10561119 : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) {}
10571120 template <class _InputIterator>
......@@ -1085,7 +1148,11 @@ public:
10851148 : unordered_multiset(__il, __n, __hf, key_equal(), __a) {}
10861149#endif
10871150#endif // _LIBCPP_CXX03_LANG
1088 // ~unordered_multiset() = default;
1151 _LIBCPP_INLINE_VISIBILITY
1152 ~unordered_multiset() {
1153 static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
1154 }
1155
10891156 _LIBCPP_INLINE_VISIBILITY
10901157 unordered_multiset& operator=(const unordered_multiset& __u)
10911158 {
......@@ -1243,6 +1310,10 @@ public:
12431310 const_iterator find(const key_type& __k) const {return __table_.find(__k);}
12441311 _LIBCPP_INLINE_VISIBILITY
12451312 size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
1313 #if _LIBCPP_STD_VER > 17
1314 _LIBCPP_INLINE_VISIBILITY
1315 bool contains(const key_type& __k) const {return find(__k) != end();}
1316 #endif // _LIBCPP_STD_VER > 17
12461317 _LIBCPP_INLINE_VISIBILITY
12471318 pair<iterator, iterator> equal_range(const key_type& __k)
12481319 {return __table_.__equal_range_multi(__k);}
......@@ -1299,6 +1370,60 @@ public:
12991370
13001371};
13011372
1373#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
1374template<class _InputIterator,
1375 class _Hash = hash<__iter_value_type<_InputIterator>>,
1376 class _Pred = equal_to<__iter_value_type<_InputIterator>>,
1377 class _Allocator = allocator<__iter_value_type<_InputIterator>>,
1378 class = _EnableIf<!__is_allocator<_Hash>::value>,
1379 class = _EnableIf<!is_integral<_Hash>::value>,
1380 class = _EnableIf<!__is_allocator<_Pred>::value>,
1381 class = _EnableIf<__is_allocator<_Allocator>::value>>
1382unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
1383 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
1384 -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
1385
1386template<class _Tp, class _Hash = hash<_Tp>,
1387 class _Pred = equal_to<_Tp>, class _Allocator = allocator<_Tp>,
1388 class = _EnableIf<!__is_allocator<_Hash>::value>,
1389 class = _EnableIf<!is_integral<_Hash>::value>,
1390 class = _EnableIf<!__is_allocator<_Pred>::value>,
1391 class = _EnableIf<__is_allocator<_Allocator>::value>>
1392unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0,
1393 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
1394 -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>;
1395
1396template<class _InputIterator, class _Allocator,
1397 class = _EnableIf<__is_allocator<_Allocator>::value>>
1398unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
1399 -> unordered_multiset<__iter_value_type<_InputIterator>,
1400 hash<__iter_value_type<_InputIterator>>,
1401 equal_to<__iter_value_type<_InputIterator>>,
1402 _Allocator>;
1403
1404template<class _InputIterator, class _Hash, class _Allocator,
1405 class = _EnableIf<!__is_allocator<_Hash>::value>,
1406 class = _EnableIf<!is_integral<_Hash>::value>,
1407 class = _EnableIf<__is_allocator<_Allocator>::value>>
1408unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type,
1409 _Hash, _Allocator)
1410 -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash,
1411 equal_to<__iter_value_type<_InputIterator>>,
1412 _Allocator>;
1413
1414template<class _Tp, class _Allocator,
1415 class = _EnableIf<__is_allocator<_Allocator>::value>>
1416unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator)
1417 -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
1418
1419template<class _Tp, class _Hash, class _Allocator,
1420 class = _EnableIf<!__is_allocator<_Hash>::value>,
1421 class = _EnableIf<!is_integral<_Hash>::value>,
1422 class = _EnableIf<__is_allocator<_Allocator>::value>>
1423unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
1424 -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
1425#endif
1426
13021427template <class _Value, class _Hash, class _Pred, class _Alloc>
13031428unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
13041429 size_type __n, const hasher& __hf, const key_equal& __eql)
lib/libcxx/include/utility+27-30
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- utility -----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -104,7 +103,7 @@ struct piecewise_construct_t { };
104103inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
105104
106105template <class T> struct tuple_size;
107template <size_t I, class T> class tuple_element;
106template <size_t I, class T> struct tuple_element;
108107
109108template <class T1, class T2> struct tuple_size<pair<T1, T2> >;
110109template <class T1, class T2> struct tuple_element<0, pair<T1, T2> >;
......@@ -253,7 +252,7 @@ operator>=(const _Tp& __x, const _Tp& __y)
253252
254253
255254template <class _ForwardIterator1, class _ForwardIterator2>
256inline _LIBCPP_INLINE_VISIBILITY
255inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
257256_ForwardIterator2
258257swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2)
259258{
......@@ -264,7 +263,7 @@ swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardItera
264263
265264// forward declared in <type_traits>
266265template<class _Tp, size_t _Np>
267inline _LIBCPP_INLINE_VISIBILITY
266inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
268267typename enable_if<
269268 __is_swappable<_Tp>::value
270269>::type
......@@ -350,7 +349,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
350349 }
351350#else
352351 template <bool _Val>
353 using _EnableB = typename enable_if<_Val, bool>::type;
352 using _EnableB _LIBCPP_NODEBUG_TYPE = typename enable_if<_Val, bool>::type;
354353
355354 struct _CheckArgs {
356355 template <class _U1, class _U2>
......@@ -377,7 +376,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
377376 };
378377
379378 template <bool _MaybeEnable>
380 using _CheckArgsDep = typename conditional<
379 using _CheckArgsDep _LIBCPP_NODEBUG_TYPE = typename conditional<
381380 _MaybeEnable, _CheckArgs, __check_tuple_constructor_fail>::type;
382381
383382 struct _CheckTupleLikeConstructor {
......@@ -399,7 +398,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
399398 };
400399
401400 template <class _Tuple>
402 using _CheckTLC = typename conditional<
401 using _CheckTLC _LIBCPP_NODEBUG_TYPE = typename conditional<
403402 __tuple_like_with_size<_Tuple, 2>::value
404403 && !is_same<typename decay<_Tuple>::type, pair>::value,
405404 _CheckTupleLikeConstructor,
......@@ -638,10 +637,10 @@ swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
638637}
639638
640639template <class _Tp>
641struct __unwrap_reference { typedef _Tp type; };
640struct __unwrap_reference { typedef _LIBCPP_NODEBUG_TYPE _Tp type; };
642641
643642template <class _Tp>
644struct __unwrap_reference<reference_wrapper<_Tp> > { typedef _Tp& type; };
643struct __unwrap_reference<reference_wrapper<_Tp> > { typedef _LIBCPP_NODEBUG_TYPE _Tp& type; };
645644
646645#if _LIBCPP_STD_VER > 17
647646template <class _Tp>
......@@ -688,23 +687,21 @@ template <class _T1, class _T2>
688687 : public integral_constant<size_t, 2> {};
689688
690689template <size_t _Ip, class _T1, class _T2>
691class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, pair<_T1, _T2> >
690struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, pair<_T1, _T2> >
692691{
693692 static_assert(_Ip < 2, "Index out of bounds in std::tuple_element<std::pair<T1, T2>>");
694693};
695694
696695template <class _T1, class _T2>
697class _LIBCPP_TEMPLATE_VIS tuple_element<0, pair<_T1, _T2> >
696struct _LIBCPP_TEMPLATE_VIS tuple_element<0, pair<_T1, _T2> >
698697{
699public:
700 typedef _T1 type;
698 typedef _LIBCPP_NODEBUG_TYPE _T1 type;
701699};
702700
703701template <class _T1, class _T2>
704class _LIBCPP_TEMPLATE_VIS tuple_element<1, pair<_T1, _T2> >
702struct _LIBCPP_TEMPLATE_VIS tuple_element<1, pair<_T1, _T2> >
705703{
706public:
707 typedef _T2 type;
704 typedef _LIBCPP_NODEBUG_TYPE _T2 type;
708705};
709706
710707template <size_t _Ip> struct __get_pair;
......@@ -883,11 +880,11 @@ template<size_t... _Ip>
883880#if __has_builtin(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE)
884881
885882template <class _Tp, _Tp _Ep>
886using __make_integer_sequence = __make_integer_seq<integer_sequence, _Tp, _Ep>;
883using __make_integer_sequence _LIBCPP_NODEBUG_TYPE = __make_integer_seq<integer_sequence, _Tp, _Ep>;
887884
888885#else
889886
890template<typename _Tp, _Tp _Np> using __make_integer_sequence_unchecked =
887template<typename _Tp, _Tp _Np> using __make_integer_sequence_unchecked _LIBCPP_NODEBUG_TYPE =
891888 typename __detail::__make<_Np>::type::template __convert<integer_sequence, _Tp>;
892889
893890template <class _Tp, _Tp _Ep>
......@@ -898,11 +895,11 @@ struct __make_integer_sequence_checked
898895 static_assert(0 <= _Ep, "std::make_integer_sequence must have a non-negative sequence length");
899896 // Workaround GCC bug by preventing bad installations when 0 <= _Ep
900897 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68929
901 typedef __make_integer_sequence_unchecked<_Tp, 0 <= _Ep ? _Ep : 0> type;
898 typedef _LIBCPP_NODEBUG_TYPE __make_integer_sequence_unchecked<_Tp, 0 <= _Ep ? _Ep : 0> type;
902899};
903900
904901template <class _Tp, _Tp _Ep>
905using __make_integer_sequence = typename __make_integer_sequence_checked<_Tp, _Ep>::type;
902using __make_integer_sequence _LIBCPP_NODEBUG_TYPE = typename __make_integer_sequence_checked<_Tp, _Ep>::type;
906903
907904#endif
908905
......@@ -1482,7 +1479,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<float>
14821479 size_t operator()(float __v) const _NOEXCEPT
14831480 {
14841481 // -0.0 and 0.0 should return same hash
1485 if (__v == 0.0)
1482 if (__v == 0.0f)
14861483 return 0;
14871484 return __scalar_hash<float>::operator()(__v);
14881485 }
......@@ -1510,7 +1507,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<long double>
15101507 size_t operator()(long double __v) const _NOEXCEPT
15111508 {
15121509 // -0.0 and 0.0 should return same hash
1513 if (__v == 0.0)
1510 if (__v == 0.0L)
15141511 return 0;
15151512#if defined(__i386__)
15161513 // Zero out padding bits
......@@ -1593,29 +1590,29 @@ struct _LIBCPP_TEMPLATE_VIS hash<nullptr_t>
15931590
15941591#ifndef _LIBCPP_CXX03_LANG
15951592template <class _Key, class _Hash>
1596using __check_hash_requirements = integral_constant<bool,
1593using __check_hash_requirements _LIBCPP_NODEBUG_TYPE = integral_constant<bool,
15971594 is_copy_constructible<_Hash>::value &&
15981595 is_move_constructible<_Hash>::value &&
15991596 __invokable_r<size_t, _Hash, _Key const&>::value
16001597>;
16011598
16021599template <class _Key, class _Hash = std::hash<_Key> >
1603using __has_enabled_hash = integral_constant<bool,
1600using __has_enabled_hash _LIBCPP_NODEBUG_TYPE = integral_constant<bool,
16041601 __check_hash_requirements<_Key, _Hash>::value &&
16051602 is_default_constructible<_Hash>::value
16061603>;
16071604
16081605#if _LIBCPP_STD_VER > 14
16091606template <class _Type, class>
1610using __enable_hash_helper_imp = _Type;
1607using __enable_hash_helper_imp _LIBCPP_NODEBUG_TYPE = _Type;
16111608
16121609template <class _Type, class ..._Keys>
1613using __enable_hash_helper = __enable_hash_helper_imp<_Type,
1610using __enable_hash_helper _LIBCPP_NODEBUG_TYPE = __enable_hash_helper_imp<_Type,
16141611 typename enable_if<__all<__has_enabled_hash<_Keys>::value...>::value>::type
16151612>;
16161613#else
16171614template <class _Type, class ...>
1618using __enable_hash_helper = _Type;
1615using __enable_hash_helper _LIBCPP_NODEBUG_TYPE = _Type;
16191616#endif
16201617
16211618#endif // !_LIBCPP_CXX03_LANG
lib/libcxx/include/valarray+22-10
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===-------------------------- valarray ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -674,6 +673,7 @@ public:
674673 _LIBCPP_INLINE_VISIBILITY
675674 size_t size() const {return __size_;}
676675
676 template <class> friend class __val_expr;
677677 template <class> friend class _LIBCPP_TEMPLATE_VIS valarray;
678678};
679679
......@@ -1059,8 +1059,6 @@ private:
10591059 valarray& __assign_range(const value_type* __f, const value_type* __l);
10601060};
10611061
1062_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::valarray(size_t))
1063_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::~valarray())
10641062_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void valarray<size_t>::resize(size_t, size_t))
10651063
10661064template <class _Op, class _Tp>
......@@ -2222,6 +2220,7 @@ public:
22222220 _LIBCPP_INLINE_VISIBILITY
22232221 size_t size() const {return __1d_.size();}
22242222
2223 template <class> friend class __val_expr;
22252224 template <class> friend class valarray;
22262225};
22272226
......@@ -2592,6 +2591,7 @@ public:
25922591 _LIBCPP_INLINE_VISIBILITY
25932592 size_t size() const {return __1d_.size();}
25942593
2594 template <class> friend class __val_expr;
25952595 template <class> friend class _LIBCPP_TEMPLATE_VIS valarray;
25962596};
25972597
......@@ -2614,19 +2614,31 @@ public:
26142614
26152615 _LIBCPP_INLINE_VISIBILITY
26162616 __val_expr<__slice_expr<_ValExpr> > operator[](slice __s) const
2617 {return __val_expr<__slice_expr<_ValExpr> >(__expr_, __s);}
2617 {
2618 typedef __slice_expr<_ValExpr> _NewExpr;
2619 return __val_expr< _NewExpr >(_NewExpr(__s, __expr_));
2620 }
26182621
26192622 _LIBCPP_INLINE_VISIBILITY
26202623 __val_expr<__indirect_expr<_ValExpr> > operator[](const gslice& __gs) const
2621 {return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __gs.__1d_);}
2624 {
2625 typedef __indirect_expr<_ValExpr> _NewExpr;
2626 return __val_expr<_NewExpr >(_NewExpr(__gs.__1d_, __expr_));
2627 }
26222628
26232629 _LIBCPP_INLINE_VISIBILITY
26242630 __val_expr<__mask_expr<_ValExpr> > operator[](const valarray<bool>& __vb) const
2625 {return __val_expr<__mask_expr<_ValExpr> >(__expr_, __vb);}
2631 {
2632 typedef __mask_expr<_ValExpr> _NewExpr;
2633 return __val_expr< _NewExpr >( _NewExpr(__vb, __expr_));
2634 }
26262635
26272636 _LIBCPP_INLINE_VISIBILITY
26282637 __val_expr<__indirect_expr<_ValExpr> > operator[](const valarray<size_t>& __vs) const
2629 {return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __vs);}
2638 {
2639 typedef __indirect_expr<_ValExpr> _NewExpr;
2640 return __val_expr< _NewExpr >(_NewExpr(__vs, __expr_));
2641 }
26302642
26312643 _LIBCPP_INLINE_VISIBILITY
26322644 __val_expr<_UnaryOp<__unary_plus<value_type>, _ValExpr> >
lib/libcxx/include/variant+65-13
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------------ variant -------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -1090,20 +1089,73 @@ private:
10901089 }
10911090};
10921091
1093template <class... _Types>
1094struct __overload;
1092struct __no_narrowing_check {
1093 template <class _Dest, class _Source>
1094 using _Apply = __identity<_Dest>;
1095};
10951096
1096template <>
1097struct __overload<> { void operator()() const; };
1097struct __narrowing_check {
1098 template <class _Dest>
1099 static auto __test_impl(_Dest (&&)[1]) -> __identity<_Dest>;
1100 template <class _Dest, class _Source>
1101 using _Apply _LIBCPP_NODEBUG_TYPE = decltype(__test_impl<_Dest>({std::declval<_Source>()}));
1102};
10981103
1099template <class _Tp, class... _Types>
1100struct __overload<_Tp, _Types...> : __overload<_Types...> {
1101 using __overload<_Types...>::operator();
1102 __identity<_Tp> operator()(_Tp) const;
1104template <class _Dest, class _Source>
1105using __check_for_narrowing _LIBCPP_NODEBUG_TYPE =
1106 typename _If<
1107#ifdef _LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT
1108 false &&
1109#endif
1110 is_arithmetic<_Dest>::value,
1111 __narrowing_check,
1112 __no_narrowing_check
1113 >::template _Apply<_Dest, _Source>;
1114
1115template <class _Tp, size_t _Idx>
1116struct __overload {
1117 template <class _Up>
1118 auto operator()(_Tp, _Up&&) const -> __check_for_narrowing<_Tp, _Up>;
11031119};
11041120
1121template <class _Tp, size_t>
1122struct __overload_bool {
1123 template <class _Up, class _Ap = __uncvref_t<_Up>>
1124 auto operator()(bool, _Up&&) const
1125 -> enable_if_t<is_same_v<_Ap, bool>, __identity<_Tp>>;
1126};
1127
1128template <size_t _Idx>
1129struct __overload<bool, _Idx> : __overload_bool<bool, _Idx> {};
1130template <size_t _Idx>
1131struct __overload<bool const, _Idx> : __overload_bool<bool const, _Idx> {};
1132template <size_t _Idx>
1133struct __overload<bool volatile, _Idx> : __overload_bool<bool volatile, _Idx> {};
1134template <size_t _Idx>
1135struct __overload<bool const volatile, _Idx> : __overload_bool<bool const volatile, _Idx> {};
1136
1137template <class ..._Bases>
1138struct __all_overloads : _Bases... {
1139 void operator()() const;
1140 using _Bases::operator()...;
1141};
1142
1143template <class IdxSeq>
1144struct __make_overloads_imp;
1145
1146template <size_t ..._Idx>
1147struct __make_overloads_imp<__tuple_indices<_Idx...> > {
1148 template <class ..._Types>
1149 using _Apply _LIBCPP_NODEBUG_TYPE = __all_overloads<__overload<_Types, _Idx>...>;
1150};
1151
1152template <class ..._Types>
1153using _MakeOverloads _LIBCPP_NODEBUG_TYPE = typename __make_overloads_imp<
1154 __make_indices_imp<sizeof...(_Types), 0> >::template _Apply<_Types...>;
1155
11051156template <class _Tp, class... _Types>
1106using __best_match_t = typename result_of_t<__overload<_Types...>(_Tp&&)>::type;
1157using __best_match_t =
1158 typename invoke_result_t<_MakeOverloads<_Types...>, _Tp, _Tp>::type;
11071159
11081160} // __variant_detail
11091161
lib/libcxx/include/vector+23-19
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===------------------------------ vector --------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -665,27 +664,27 @@ public:
665664 void reserve(size_type __n);
666665 void shrink_to_fit() _NOEXCEPT;
667666
668 _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n);
669 _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const;
667 _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) _NOEXCEPT;
668 _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const _NOEXCEPT;
670669 reference at(size_type __n);
671670 const_reference at(size_type __n) const;
672671
673 _LIBCPP_INLINE_VISIBILITY reference front()
672 _LIBCPP_INLINE_VISIBILITY reference front() _NOEXCEPT
674673 {
675674 _LIBCPP_ASSERT(!empty(), "front() called for empty vector");
676675 return *this->__begin_;
677676 }
678 _LIBCPP_INLINE_VISIBILITY const_reference front() const
677 _LIBCPP_INLINE_VISIBILITY const_reference front() const _NOEXCEPT
679678 {
680679 _LIBCPP_ASSERT(!empty(), "front() called for empty vector");
681680 return *this->__begin_;
682681 }
683 _LIBCPP_INLINE_VISIBILITY reference back()
682 _LIBCPP_INLINE_VISIBILITY reference back() _NOEXCEPT
684683 {
685684 _LIBCPP_ASSERT(!empty(), "back() called for empty vector");
686685 return *(this->__end_ - 1);
687686 }
688 _LIBCPP_INLINE_VISIBILITY const_reference back() const
687 _LIBCPP_INLINE_VISIBILITY const_reference back() const _NOEXCEPT
689688 {
690689 _LIBCPP_ASSERT(!empty(), "back() called for empty vector");
691690 return *(this->__end_ - 1);
......@@ -780,9 +779,9 @@ public:
780779
781780 void swap(vector&)
782781#if _LIBCPP_STD_VER >= 14
783 _NOEXCEPT_DEBUG;
782 _NOEXCEPT;
784783#else
785 _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||
784 _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
786785 __is_nothrow_swappable<allocator_type>::value);
787786#endif
788787
......@@ -836,12 +835,17 @@ private:
836835 }
837836
838837#ifndef _LIBCPP_CXX03_LANG
839 template <class _Up> void __push_back_slow_path(_Up&& __x);
838 template <class _Up>
839 _LIBCPP_INLINE_VISIBILITY
840 inline void __push_back_slow_path(_Up&& __x);
840841
841842 template <class... _Args>
842 void __emplace_back_slow_path(_Args&&... __args);
843 _LIBCPP_INLINE_VISIBILITY
844 inline void __emplace_back_slow_path(_Args&&... __args);
843845#else
844 template <class _Up> void __push_back_slow_path(_Up& __x);
846 template <class _Up>
847 _LIBCPP_INLINE_VISIBILITY
848 inline void __push_back_slow_path(_Up& __x);
845849#endif
846850
847851 // The following functions are no-ops outside of AddressSanitizer mode.
......@@ -1538,7 +1542,7 @@ vector<_Tp, _Allocator>::end() const _NOEXCEPT
15381542template <class _Tp, class _Allocator>
15391543inline _LIBCPP_INLINE_VISIBILITY
15401544typename vector<_Tp, _Allocator>::reference
1541vector<_Tp, _Allocator>::operator[](size_type __n)
1545vector<_Tp, _Allocator>::operator[](size_type __n) _NOEXCEPT
15421546{
15431547 _LIBCPP_ASSERT(__n < size(), "vector[] index out of bounds");
15441548 return this->__begin_[__n];
......@@ -1547,7 +1551,7 @@ vector<_Tp, _Allocator>::operator[](size_type __n)
15471551template <class _Tp, class _Allocator>
15481552inline _LIBCPP_INLINE_VISIBILITY
15491553typename vector<_Tp, _Allocator>::const_reference
1550vector<_Tp, _Allocator>::operator[](size_type __n) const
1554vector<_Tp, _Allocator>::operator[](size_type __n) const _NOEXCEPT
15511555{
15521556 _LIBCPP_ASSERT(__n < size(), "vector[] index out of bounds");
15531557 return this->__begin_[__n];
......@@ -2065,9 +2069,9 @@ template <class _Tp, class _Allocator>
20652069void
20662070vector<_Tp, _Allocator>::swap(vector& __x)
20672071#if _LIBCPP_STD_VER >= 14
2068 _NOEXCEPT_DEBUG
2072 _NOEXCEPT
20692073#else
2070 _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||
2074 _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
20712075 __is_nothrow_swappable<allocator_type>::value)
20722076#endif
20732077{
lib/libcxx/include/version+11-6
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- version ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
......@@ -59,6 +58,7 @@ __cpp_lib_hypot 201603L <cmath>
5958__cpp_lib_incomplete_container_elements 201505L <forward_list> <list> <vector>
6059__cpp_lib_integer_sequence 201304L <utility>
6160__cpp_lib_integral_constant_callable 201304L <type_traits>
61__cpp_lib_interpolate 201902L <numeric>
6262__cpp_lib_invoke 201411L <functional>
6363__cpp_lib_is_aggregate 201703L <type_traits>
6464__cpp_lib_is_constant_evaluated 201811L <type_traits>
......@@ -220,10 +220,15 @@ __cpp_lib_void_t 201411L <type_traits>
220220// # define __cpp_lib_concepts 201806L
221221// # define __cpp_lib_constexpr_misc 201811L
222222// # define __cpp_lib_constexpr_swap_algorithms 201806L
223// # define __cpp_lib_destroying_delete 201806L
223# if _LIBCPP_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L
224# define __cpp_lib_destroying_delete 201806L
225# endif
224226# define __cpp_lib_erase_if 201811L
225227// # define __cpp_lib_generic_unordered_lookup 201811L
226// # define __cpp_lib_is_constant_evaluated 201811L
228# define __cpp_lib_interpolate 201902L
229# if !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
230# define __cpp_lib_is_constant_evaluated 201811L
231# endif
227232// # define __cpp_lib_list_remove_return_type 201806L
228233// # define __cpp_lib_ranges 201811L
229234// # define __cpp_lib_three_way_comparison 201711L
lib/libcxx/include/wchar.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- wchar.h ----------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109
lib/libcxx/include/wctype.h+3-4
......@@ -1,10 +1,9 @@
11// -*- C++ -*-
22//===--------------------------- wctype.h ---------------------------------===//
33//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
87//
98//===----------------------------------------------------------------------===//
109