diff --git a/contrib/llvm-project/libcxx/include/span b/contrib/llvm-project/libcxx/include/span index b8dbc7e01fd6..f33569031730 100644 --- a/contrib/llvm-project/libcxx/include/span +++ b/contrib/llvm-project/libcxx/include/span @@ -1,636 +1,642 @@ // -*- C++ -*- //===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===---------------------------------------------------------------------===// #ifndef _LIBCPP_SPAN #define _LIBCPP_SPAN /* span synopsis namespace std { // constants inline constexpr size_t dynamic_extent = numeric_limits::max(); // [views.span], class template span template class span; template inline constexpr bool ranges::enable_view> = true; template inline constexpr bool ranges::enable_borrowed_range> = true; // [span.objectrep], views of object representation template span as_bytes(span s) noexcept; template span< byte, ((Extent == dynamic_extent) ? dynamic_extent : (sizeof(ElementType) * Extent))> as_writable_bytes(span s) noexcept; template class span { public: // constants and types using element_type = ElementType; using value_type = remove_cv_t; using size_type = size_t; using difference_type = ptrdiff_t; using pointer = element_type*; using const_pointer = const element_type*; using reference = element_type&; using const_reference = const element_type&; using iterator = implementation-defined; using reverse_iterator = std::reverse_iterator; static constexpr size_type extent = Extent; // [span.cons], span constructors, copy, assignment, and destructor constexpr span() noexcept; template constexpr explicit(Extent != dynamic_extent) span(It first, size_type count); template constexpr explicit(Extent != dynamic_extent) span(It first, End last); template constexpr span(type_identity_t (&arr)[N]) noexcept; template constexpr span(array& arr) noexcept; template constexpr span(const array& arr) noexcept; template constexpr explicit(Extent != dynamic_extent) span(R&& r); constexpr span(const span& other) noexcept = default; template constexpr explicit(Extent != dynamic_extent) span(const span& s) noexcept; ~span() noexcept = default; constexpr span& operator=(const span& other) noexcept = default; // [span.sub], span subviews template constexpr span first() const; template constexpr span last() const; template constexpr span subspan() const; constexpr span first(size_type count) const; constexpr span last(size_type count) const; constexpr span subspan(size_type offset, size_type count = dynamic_extent) const; // [span.obs], span observers constexpr size_type size() const noexcept; constexpr size_type size_bytes() const noexcept; [[nodiscard]] constexpr bool empty() const noexcept; // [span.elem], span element access constexpr reference operator[](size_type idx) const; constexpr reference front() const; constexpr reference back() const; constexpr pointer data() const noexcept; // [span.iterators], span iterator support constexpr iterator begin() const noexcept; constexpr iterator end() const noexcept; constexpr reverse_iterator rbegin() const noexcept; constexpr reverse_iterator rend() const noexcept; private: pointer data_; // exposition only size_type size_; // exposition only }; template span(It, EndOrSize) -> span>>; template span(T (&)[N]) -> span; template span(array&) -> span; template span(const array&) -> span; template span(R&&) -> span>>; } // namespace std */ #include <__config> #include <__debug> #include <__iterator/concepts.h> #include <__iterator/wrap_iter.h> #include <__ranges/concepts.h> #include <__ranges/data.h> #include <__ranges/enable_borrowed_range.h> #include <__ranges/enable_view.h> #include <__ranges/size.h> #include // for array #include // for byte #include // for iterators #include #include // for remove_cv, etc #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif _LIBCPP_PUSH_MACROS #include <__undef_macros> _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER > 17 inline constexpr size_t dynamic_extent = numeric_limits::max(); template class span; template struct __is_std_array : false_type {}; template struct __is_std_array> : true_type {}; template struct __is_std_span : false_type {}; template struct __is_std_span> : true_type {}; #if defined(_LIBCPP_HAS_NO_CONCEPTS) || defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) // This is a temporary workaround until we ship -- we've unfortunately been // shipping before its API was finalized, and we used to provide a constructor // from container types that had the requirements below. To avoid breaking code that // has started relying on the range-based constructor until we ship all of , // we emulate the constructor requirements like this. template struct __span_compatible_range : false_type { }; template struct __span_compatible_range<_Range, _ElementType, void_t< enable_if_t>::value>, enable_if_t>::value>, enable_if_t>>, decltype(data(declval<_Range>())), decltype(size(declval<_Range>())), enable_if_t()))>(*)[], _ElementType(*)[]>> >> : true_type { }; #else template concept __span_compatible_range = ranges::contiguous_range<_Range> && ranges::sized_range<_Range> && (ranges::borrowed_range<_Range> || is_const_v<_ElementType>) && !__is_std_span>::value && !__is_std_array>::value && !is_array_v> && is_convertible_v>(*)[], _ElementType(*)[]>; #endif template class _LIBCPP_TEMPLATE_VIS span { public: // constants and types using element_type = _Tp; using value_type = remove_cv_t<_Tp>; using size_type = size_t; using difference_type = ptrdiff_t; using pointer = _Tp *; using const_pointer = const _Tp *; using reference = _Tp &; using const_reference = const _Tp &; #if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS) using iterator = pointer; #else using iterator = __wrap_iter; #endif using reverse_iterator = _VSTD::reverse_iterator; static constexpr size_type extent = _Extent; // [span.cons], span constructors, copy, assignment, and destructor template = nullptr> _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr} {} constexpr span (const span&) noexcept = default; constexpr span& operator=(const span&) noexcept = default; #if !defined(_LIBCPP_HAS_NO_CONCEPTS) template && is_convertible_v>(*)[], element_type (*)[]>, nullptr_t> = nullptr> _LIBCPP_INLINE_VISIBILITY constexpr explicit span(_It __first, size_type __count) : __data{_VSTD::to_address(__first)} { (void)__count; _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (iterator, len)"); } template < class _It, class _End, enable_if_t > (*)[], element_type (*)[]> && contiguous_iterator<_It> && sized_sentinel_for<_End, _It> && !is_convertible_v<_End, size_t>, nullptr_t> = nullptr> _LIBCPP_INLINE_VISIBILITY constexpr explicit span(_It __first, _End __last) : __data{_VSTD::to_address(__first)} { (void)__last; _LIBCPP_ASSERT((__last - __first >= 0), "invalid range in span's constructor (iterator, sentinel)"); _LIBCPP_ASSERT(__last - __first == _Extent, "invalid range in span's constructor (iterator, sentinel): last - first != extent"); } #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) _LIBCPP_INLINE_VISIBILITY constexpr span(type_identity_t (&__arr)[_Extent]) noexcept : __data{__arr} {} template , nullptr_t> = nullptr> _LIBCPP_INLINE_VISIBILITY constexpr span(array<_OtherElementType, _Extent>& __arr) noexcept : __data{__arr.data()} {} template , nullptr_t> = nullptr> _LIBCPP_INLINE_VISIBILITY constexpr span(const array<_OtherElementType, _Extent>& __arr) noexcept : __data{__arr.data()} {} #if defined(_LIBCPP_HAS_NO_CONCEPTS) || defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) template ::value >> _LIBCPP_INLINE_VISIBILITY constexpr explicit span(_Container& __c) : __data{std::data(__c)} { _LIBCPP_ASSERT(std::size(__c) == _Extent, "size mismatch in span's constructor (range)"); } template ::value >> _LIBCPP_INLINE_VISIBILITY constexpr explicit span(const _Container& __c) : __data{std::data(__c)} { _LIBCPP_ASSERT(std::size(__c) == _Extent, "size mismatch in span's constructor (range)"); } #else template <__span_compatible_range _Range> _LIBCPP_INLINE_VISIBILITY constexpr explicit span(_Range&& __r) : __data{ranges::data(__r)} { _LIBCPP_ASSERT(ranges::size(__r) == _Extent, "size mismatch in span's constructor (range)"); } #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) template _LIBCPP_INLINE_VISIBILITY constexpr span(const span<_OtherElementType, _Extent>& __other, enable_if_t< is_convertible_v<_OtherElementType(*)[], element_type (*)[]>, nullptr_t> = nullptr) : __data{__other.data()} {} template _LIBCPP_INLINE_VISIBILITY constexpr explicit span(const span<_OtherElementType, dynamic_extent>& __other, enable_if_t< is_convertible_v<_OtherElementType(*)[], element_type (*)[]>, nullptr_t> = nullptr) noexcept : __data{__other.data()} { _LIBCPP_ASSERT(_Extent == __other.size(), "size mismatch in span's constructor (other span)"); } // ~span() noexcept = default; template _LIBCPP_INLINE_VISIBILITY constexpr span first() const noexcept { static_assert(_Count <= _Extent, "Count out of range in span::first()"); return span{data(), _Count}; } template _LIBCPP_INLINE_VISIBILITY constexpr span last() const noexcept { static_assert(_Count <= _Extent, "Count out of range in span::last()"); return span{data() + size() - _Count, _Count}; } _LIBCPP_INLINE_VISIBILITY constexpr span first(size_type __count) const noexcept { _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)"); return {data(), __count}; } _LIBCPP_INLINE_VISIBILITY constexpr span last(size_type __count) const noexcept { _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)"); return {data() + size() - __count, __count}; } template _LIBCPP_INLINE_VISIBILITY constexpr auto subspan() const noexcept -> span { static_assert(_Offset <= _Extent, "Offset out of range in span::subspan()"); static_assert(_Count == dynamic_extent || _Count <= _Extent - _Offset, "Offset + count out of range in span::subspan()"); using _ReturnType = span; return _ReturnType{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count}; } _LIBCPP_INLINE_VISIBILITY constexpr span subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept { _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)"); _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "Count out of range in span::subspan(offset, count)"); if (__count == dynamic_extent) return {data() + __offset, size() - __offset}; _LIBCPP_ASSERT(__count <= size() - __offset, "Offset + count out of range in span::subspan(offset, count)"); return {data() + __offset, __count}; } _LIBCPP_INLINE_VISIBILITY constexpr size_type size() const noexcept { return _Extent; } _LIBCPP_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept { return _Extent * sizeof(element_type); } [[nodiscard]] _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return _Extent == 0; } _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept { _LIBCPP_ASSERT(__idx < size(), "span[] index out of bounds"); return __data[__idx]; } _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept { _LIBCPP_ASSERT(!empty(), "span::front() on empty span"); return __data[0]; } _LIBCPP_INLINE_VISIBILITY constexpr reference back() const noexcept { _LIBCPP_ASSERT(!empty(), "span::back() on empty span"); return __data[size()-1]; } _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; } // [span.iter], span iterator support _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { return iterator(data()); } _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { return iterator(data() + size()); } _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); } _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); } _LIBCPP_INLINE_VISIBILITY span __as_bytes() const noexcept { return span{reinterpret_cast(data()), size_bytes()}; } _LIBCPP_INLINE_VISIBILITY span __as_writable_bytes() const noexcept { return span{reinterpret_cast(data()), size_bytes()}; } private: pointer __data; }; template class _LIBCPP_TEMPLATE_VIS span<_Tp, dynamic_extent> { private: public: // constants and types using element_type = _Tp; using value_type = remove_cv_t<_Tp>; using size_type = size_t; using difference_type = ptrdiff_t; using pointer = _Tp *; using const_pointer = const _Tp *; using reference = _Tp &; using const_reference = const _Tp &; #if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS) using iterator = pointer; #else using iterator = __wrap_iter; #endif using reverse_iterator = _VSTD::reverse_iterator; static constexpr size_type extent = dynamic_extent; // [span.cons], span constructors, copy, assignment, and destructor _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}, __size{0} {} constexpr span (const span&) noexcept = default; constexpr span& operator=(const span&) noexcept = default; #if !defined(_LIBCPP_HAS_NO_CONCEPTS) template && is_convertible_v > (*)[], element_type (*)[]>, nullptr_t> = nullptr> _LIBCPP_INLINE_VISIBILITY constexpr span(_It __first, size_type __count) : __data{_VSTD::to_address(__first)}, __size{__count} {} template < class _It, class _End, enable_if_t > (*)[], element_type (*)[]> && contiguous_iterator<_It> && sized_sentinel_for<_End, _It> && !is_convertible_v<_End, size_t>, nullptr_t> = nullptr> _LIBCPP_INLINE_VISIBILITY constexpr span(_It __first, _End __last) : __data(_VSTD::to_address(__first)), __size(__last - __first) {} #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) template _LIBCPP_INLINE_VISIBILITY constexpr span(type_identity_t (&__arr)[_Sz]) noexcept : __data{__arr}, __size{_Sz} {} template , nullptr_t> = nullptr> _LIBCPP_INLINE_VISIBILITY constexpr span(array<_OtherElementType, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {} template , nullptr_t> = nullptr> _LIBCPP_INLINE_VISIBILITY constexpr span(const array<_OtherElementType, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {} #if defined(_LIBCPP_HAS_NO_CONCEPTS) || defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) template ::value >> _LIBCPP_INLINE_VISIBILITY constexpr span(_Container& __c) : __data(std::data(__c)), __size{std::size(__c)} {} template ::value >> _LIBCPP_INLINE_VISIBILITY constexpr span(const _Container& __c) : __data(std::data(__c)), __size{std::size(__c)} {} #else template <__span_compatible_range _Range> _LIBCPP_INLINE_VISIBILITY constexpr span(_Range&& __r) : __data(ranges::data(__r)), __size{ranges::size(__r)} {} #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) template _LIBCPP_INLINE_VISIBILITY constexpr span(const span<_OtherElementType, _OtherExtent>& __other, enable_if_t< is_convertible_v<_OtherElementType(*)[], element_type (*)[]>, nullptr_t> = nullptr) noexcept : __data{__other.data()}, __size{__other.size()} {} // ~span() noexcept = default; template _LIBCPP_INLINE_VISIBILITY constexpr span first() const noexcept { _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::first()"); return span{data(), _Count}; } template _LIBCPP_INLINE_VISIBILITY constexpr span last() const noexcept { _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::last()"); return span{data() + size() - _Count, _Count}; } _LIBCPP_INLINE_VISIBILITY constexpr span first(size_type __count) const noexcept { _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)"); return {data(), __count}; } _LIBCPP_INLINE_VISIBILITY constexpr span last (size_type __count) const noexcept { _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)"); return {data() + size() - __count, __count}; } template _LIBCPP_INLINE_VISIBILITY constexpr span subspan() const noexcept { _LIBCPP_ASSERT(_Offset <= size(), "Offset out of range in span::subspan()"); _LIBCPP_ASSERT(_Count == dynamic_extent || _Count <= size() - _Offset, "Offset + count out of range in span::subspan()"); return span{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count}; } constexpr span _LIBCPP_INLINE_VISIBILITY subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept { _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)"); _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "count out of range in span::subspan(offset, count)"); if (__count == dynamic_extent) return {data() + __offset, size() - __offset}; _LIBCPP_ASSERT(__count <= size() - __offset, "Offset + count out of range in span::subspan(offset, count)"); return {data() + __offset, __count}; } _LIBCPP_INLINE_VISIBILITY constexpr size_type size() const noexcept { return __size; } _LIBCPP_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept { return __size * sizeof(element_type); } [[nodiscard]] _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return __size == 0; } _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept { _LIBCPP_ASSERT(__idx < size(), "span[] index out of bounds"); return __data[__idx]; } _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept { _LIBCPP_ASSERT(!empty(), "span[].front() on empty span"); return __data[0]; } _LIBCPP_INLINE_VISIBILITY constexpr reference back() const noexcept { _LIBCPP_ASSERT(!empty(), "span[].back() on empty span"); return __data[size()-1]; } _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; } // [span.iter], span iterator support _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { return iterator(data()); } _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { return iterator(data() + size()); } _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); } _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); } _LIBCPP_INLINE_VISIBILITY span __as_bytes() const noexcept { return {reinterpret_cast(data()), size_bytes()}; } _LIBCPP_INLINE_VISIBILITY span __as_writable_bytes() const noexcept { return {reinterpret_cast(data()), size_bytes()}; } private: pointer __data; size_type __size; }; #if !defined(_LIBCPP_HAS_NO_CONCEPTS) template inline constexpr bool ranges::enable_borrowed_range > = true; template inline constexpr bool ranges::enable_view> = true; #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) // as_bytes & as_writable_bytes template _LIBCPP_INLINE_VISIBILITY auto as_bytes(span<_Tp, _Extent> __s) noexcept -> decltype(__s.__as_bytes()) { return __s.__as_bytes(); } template _LIBCPP_INLINE_VISIBILITY auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept -> enable_if_t, decltype(__s.__as_writable_bytes())> { return __s.__as_writable_bytes(); } #if !defined(_LIBCPP_HAS_NO_CONCEPTS) template span(_It, _EndOrSize) -> span>>; #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) template span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>; template span(array<_Tp, _Sz>&) -> span<_Tp, _Sz>; template span(const array<_Tp, _Sz>&) -> span; -#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#if defined(_LIBCPP_HAS_NO_CONCEPTS) || defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +template + span(_Container&) -> span; + +template + span(const _Container&) -> span; +#else template span(_Range&&) -> span>>; #endif #endif // _LIBCPP_STD_VER > 17 _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS #endif // _LIBCPP_SPAN diff --git a/lib/clang/include/VCSVersion.inc b/lib/clang/include/VCSVersion.inc index f5ca305f872e..bed489b0b0fb 100644 --- a/lib/clang/include/VCSVersion.inc +++ b/lib/clang/include/VCSVersion.inc @@ -1,10 +1,10 @@ // $FreeBSD$ -#define LLVM_REVISION "llvmorg-14.0.0-rc4-2-gadd3ab7f4c8a" +#define LLVM_REVISION "llvmorg-14.0.0-2-g3f43d803382d" #define LLVM_REPOSITORY "https://github.com/llvm/llvm-project.git" -#define CLANG_REVISION "llvmorg-14.0.0-rc4-2-gadd3ab7f4c8a" +#define CLANG_REVISION "llvmorg-14.0.0-2-g3f43d803382d" #define CLANG_REPOSITORY "https://github.com/llvm/llvm-project.git" -#define LLDB_REVISION "llvmorg-14.0.0-rc4-2-gadd3ab7f4c8a" +#define LLDB_REVISION "llvmorg-14.0.0-2-g3f43d803382d" #define LLDB_REPOSITORY "https://github.com/llvm/llvm-project.git" diff --git a/lib/clang/include/lld/Common/Version.inc b/lib/clang/include/lld/Common/Version.inc index 29771a0900ff..a469435359e8 100644 --- a/lib/clang/include/lld/Common/Version.inc +++ b/lib/clang/include/lld/Common/Version.inc @@ -1,4 +1,4 @@ // Local identifier in __FreeBSD_version style #define LLD_FREEBSD_VERSION 1400003 -#define LLD_VERSION_STRING "14.0.0 (FreeBSD llvmorg-14.0.0-rc4-2-gadd3ab7f4c8a-" __XSTRING(LLD_FREEBSD_VERSION) ")" +#define LLD_VERSION_STRING "14.0.0 (FreeBSD llvmorg-14.0.0-2-g3f43d803382d-" __XSTRING(LLD_FREEBSD_VERSION) ")" diff --git a/lib/clang/include/llvm/Support/VCSRevision.h b/lib/clang/include/llvm/Support/VCSRevision.h index fd42c33018a7..5a7906b88e4d 100644 --- a/lib/clang/include/llvm/Support/VCSRevision.h +++ b/lib/clang/include/llvm/Support/VCSRevision.h @@ -1,3 +1,3 @@ /* $FreeBSD$ */ -#define LLVM_REVISION "llvmorg-14.0.0-rc4-2-gadd3ab7f4c8a" +#define LLVM_REVISION "llvmorg-14.0.0-2-g3f43d803382d" #define LLVM_REPOSITORY "https://github.com/llvm/llvm-project.git"