Skip to content

Commit ae20c84

Browse files
authored
Update libcxx to llvm-12 (#14249)
Fixes: #14244
1 parent 015940f commit ae20c84

File tree

151 files changed

+10747
-6483
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+10747
-6483
lines changed

ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ See docs/process.md for more on how version tagging works.
2020

2121
2.0.23
2222
------
23+
- libcxx updated to llvm-12. (#14249)
24+
- compiler-rt updated to llvm-12. (#14280)
2325

2426
2.0.22 - 05/25/2021
2527
-------------------

system/lib/libcxx/CREDITS.TXT

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ N: Jonathan B Coe
4141
4242
D: Implementation of propagate_const.
4343

44+
N: Christopher Di Bella
45+
46+
47+
D: Library concepts.
48+
4449
N: Glen Joseph Fernandes
4550
4651
D: Implementation of to_address.
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
// -*- C++ -*-
2+
//===----------------------------------------------------------------------===//
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___AVAILABILITY
11+
#define _LIBCPP___AVAILABILITY
12+
13+
#include <__config>
14+
15+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16+
# pragma GCC system_header
17+
#endif
18+
19+
// Libc++ is shipped by various vendors. In particular, it is used as a system
20+
// library on macOS, iOS and other Apple platforms. In order for users to be
21+
// able to compile a binary that is intended to be deployed to an older version
22+
// of a platform, Clang provides availability attributes [1]. These attributes
23+
// can be placed on declarations and are used to describe the life cycle of a
24+
// symbol in the library.
25+
//
26+
// The main goal is to ensure a compile-time error if a symbol that hasn't been
27+
// introduced in a previously released library is used in a program that targets
28+
// that previously released library. Normally, this would be a load-time error
29+
// when one tries to launch the program against the older library.
30+
//
31+
// For example, the filesystem library was introduced in the dylib in macOS 10.15.
32+
// If a user compiles on a macOS 10.15 host but targets macOS 10.13 with their
33+
// program, the compiler would normally not complain (because the required
34+
// declarations are in the headers), but the dynamic loader would fail to find
35+
// the symbols when actually trying to launch the program on macOS 10.13. To
36+
// turn this into a compile-time issue instead, declarations are annotated with
37+
// when they were introduced, and the compiler can produce a diagnostic if the
38+
// program references something that isn't available on the deployment target.
39+
//
40+
// This mechanism is general in nature, and any vendor can add their markup to
41+
// the library (see below). Whenever a new feature is added that requires support
42+
// in the shared library, a macro should be added below to mark this feature
43+
// as unavailable. When vendors decide to ship the feature as part of their
44+
// shared library, they can update the markup appropriately.
45+
//
46+
// Note that this mechanism is disabled by default in the "upstream" libc++.
47+
// Availability annotations are only meaningful when shipping libc++ inside
48+
// a platform (i.e. as a system library), and so vendors that want them should
49+
// turn those annotations on at CMake configuration time.
50+
//
51+
// [1]: https://clang.llvm.org/docs/AttributeReference.html#availability
52+
53+
54+
// For backwards compatibility, allow users to define _LIBCPP_DISABLE_AVAILABILITY
55+
// for a while.
56+
#if defined(_LIBCPP_DISABLE_AVAILABILITY)
57+
# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
58+
# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
59+
# endif
60+
#endif
61+
62+
// Availability markup is disabled when building the library, or when the compiler
63+
// doesn't support the proper attributes.
64+
#if defined(_LIBCPP_BUILDING_LIBRARY) || \
65+
defined(_LIBCXXABI_BUILDING_LIBRARY) || \
66+
!__has_feature(attribute_availability_with_strict) || \
67+
!__has_feature(attribute_availability_in_templates) || \
68+
!__has_extension(pragma_clang_attribute_external_declaration)
69+
# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
70+
# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
71+
# endif
72+
#endif
73+
74+
#if defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
75+
76+
// This controls the availability of std::shared_mutex and std::shared_timed_mutex,
77+
// which were added to the dylib later.
78+
# define _LIBCPP_AVAILABILITY_SHARED_MUTEX
79+
80+
// These macros control the availability of std::bad_optional_access and
81+
// other exception types. These were put in the shared library to prevent
82+
// code bloat from every user program defining the vtable for these exception
83+
// types.
84+
# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
85+
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
86+
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST
87+
88+
// This controls the availability of std::uncaught_exceptions().
89+
# define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS
90+
91+
// This controls the availability of the sized version of ::operator delete,
92+
// which was added to the dylib later.
93+
# define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE
94+
95+
// This controls the availability of the std::future_error exception.
96+
# define _LIBCPP_AVAILABILITY_FUTURE_ERROR
97+
98+
// This controls the availability of std::type_info's vtable.
99+
// I can't imagine how using std::type_info can work at all if
100+
// this isn't supported.
101+
# define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
102+
103+
// This controls the availability of std::locale::category members
104+
// (e.g. std::locale::collate), which are defined in the dylib.
105+
# define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
106+
107+
// This controls the availability of atomic operations on std::shared_ptr
108+
// (e.g. `std::atomic_store(std::shared_ptr)`), which require a shared
109+
// lock table located in the dylib.
110+
# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
111+
112+
// These macros control the availability of all parts of <filesystem> that
113+
// depend on something in the dylib.
114+
# define _LIBCPP_AVAILABILITY_FILESYSTEM
115+
# define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
116+
# define _LIBCPP_AVAILABILITY_FILESYSTEM_POP
117+
118+
// This controls the availability of std::to_chars.
119+
# define _LIBCPP_AVAILABILITY_TO_CHARS
120+
121+
// This controls the availability of the C++20 synchronization library,
122+
// which requires shared library support for various operations
123+
// (see libcxx/src/atomic.cpp).
124+
# define _LIBCPP_AVAILABILITY_SYNC
125+
126+
#elif defined(__APPLE__)
127+
128+
# define _LIBCPP_AVAILABILITY_SHARED_MUTEX \
129+
__attribute__((availability(macosx,strict,introduced=10.12))) \
130+
__attribute__((availability(ios,strict,introduced=10.0))) \
131+
__attribute__((availability(tvos,strict,introduced=10.0))) \
132+
__attribute__((availability(watchos,strict,introduced=3.0)))
133+
# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS \
134+
__attribute__((availability(macosx,strict,introduced=10.13))) \
135+
__attribute__((availability(ios,strict,introduced=11.0))) \
136+
__attribute__((availability(tvos,strict,introduced=11.0))) \
137+
__attribute__((availability(watchos,strict,introduced=4.0)))
138+
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS \
139+
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
140+
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST \
141+
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
142+
# define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \
143+
__attribute__((availability(macosx,strict,introduced=10.12))) \
144+
__attribute__((availability(ios,strict,introduced=10.0))) \
145+
__attribute__((availability(tvos,strict,introduced=10.0))) \
146+
__attribute__((availability(watchos,strict,introduced=3.0)))
147+
# define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \
148+
__attribute__((availability(macosx,strict,introduced=10.12))) \
149+
__attribute__((availability(ios,strict,introduced=10.0))) \
150+
__attribute__((availability(tvos,strict,introduced=10.0))) \
151+
__attribute__((availability(watchos,strict,introduced=3.0)))
152+
# define _LIBCPP_AVAILABILITY_FUTURE_ERROR \
153+
__attribute__((availability(ios,strict,introduced=6.0)))
154+
# define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \
155+
__attribute__((availability(macosx,strict,introduced=10.9))) \
156+
__attribute__((availability(ios,strict,introduced=7.0)))
157+
# define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \
158+
__attribute__((availability(macosx,strict,introduced=10.9))) \
159+
__attribute__((availability(ios,strict,introduced=7.0)))
160+
# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \
161+
__attribute__((availability(macosx,strict,introduced=10.9))) \
162+
__attribute__((availability(ios,strict,introduced=7.0)))
163+
# define _LIBCPP_AVAILABILITY_FILESYSTEM \
164+
__attribute__((availability(macosx,strict,introduced=10.15))) \
165+
__attribute__((availability(ios,strict,introduced=13.0))) \
166+
__attribute__((availability(tvos,strict,introduced=13.0))) \
167+
__attribute__((availability(watchos,strict,introduced=6.0)))
168+
# define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH \
169+
_Pragma("clang attribute push(__attribute__((availability(macosx,strict,introduced=10.15))), apply_to=any(function,record))") \
170+
_Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \
171+
_Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \
172+
_Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))")
173+
# define _LIBCPP_AVAILABILITY_FILESYSTEM_POP \
174+
_Pragma("clang attribute pop") \
175+
_Pragma("clang attribute pop") \
176+
_Pragma("clang attribute pop") \
177+
_Pragma("clang attribute pop")
178+
# define _LIBCPP_AVAILABILITY_TO_CHARS \
179+
_LIBCPP_AVAILABILITY_FILESYSTEM
180+
# define _LIBCPP_AVAILABILITY_SYNC \
181+
__attribute__((unavailable))
182+
183+
#else
184+
185+
// ...New vendors can add availability markup here...
186+
187+
# error "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!"
188+
189+
#endif
190+
191+
// Define availability attributes that depend on _LIBCPP_NO_EXCEPTIONS.
192+
// Those are defined in terms of the availability attributes above, and
193+
// should not be vendor-specific.
194+
#if defined(_LIBCPP_NO_EXCEPTIONS)
195+
# define _LIBCPP_AVAILABILITY_FUTURE
196+
# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
197+
# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
198+
# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
199+
#else
200+
# define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR
201+
# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST
202+
# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
203+
# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
204+
#endif
205+
206+
#endif // _LIBCPP___AVAILABILITY

system/lib/libcxx/include/__bit_reference

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define _LIBCPP___BIT_REFERENCE
1212

1313
#include <__config>
14-
#include <bit>
14+
#include <__bits>
1515
#include <algorithm>
1616

1717
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -239,8 +239,8 @@ __bit_iterator<_Cp, _IsConst>
239239
find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
240240
{
241241
if (static_cast<bool>(__value_))
242-
return __find_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
243-
return __find_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
242+
return _VSTD::__find_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
243+
return _VSTD::__find_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
244244
}
245245

246246
// count
@@ -313,8 +313,8 @@ typename __bit_iterator<_Cp, _IsConst>::difference_type
313313
count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
314314
{
315315
if (static_cast<bool>(__value_))
316-
return __count_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
317-
return __count_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
316+
return _VSTD::__count_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
317+
return _VSTD::__count_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
318318
}
319319

320320
// fill_n
@@ -387,9 +387,9 @@ fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __v
387387
if (__n > 0)
388388
{
389389
if (__value_)
390-
__fill_n_true(__first, __n);
390+
_VSTD::__fill_n_true(__first, __n);
391391
else
392-
__fill_n_false(__first, __n);
392+
_VSTD::__fill_n_false(__first, __n);
393393
}
394394
}
395395

@@ -538,8 +538,8 @@ __bit_iterator<_Cp, false>
538538
copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
539539
{
540540
if (__first.__ctz_ == __result.__ctz_)
541-
return __copy_aligned(__first, __last, __result);
542-
return __copy_unaligned(__first, __last, __result);
541+
return _VSTD::__copy_aligned(__first, __last, __result);
542+
return _VSTD::__copy_unaligned(__first, __last, __result);
543543
}
544544

545545
// copy_backward
@@ -685,8 +685,8 @@ __bit_iterator<_Cp, false>
685685
copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
686686
{
687687
if (__last.__ctz_ == __result.__ctz_)
688-
return __copy_backward_aligned(__first, __last, __result);
689-
return __copy_backward_unaligned(__first, __last, __result);
688+
return _VSTD::__copy_backward_aligned(__first, __last, __result);
689+
return _VSTD::__copy_backward_unaligned(__first, __last, __result);
690690
}
691691

692692
// move
@@ -868,8 +868,8 @@ swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __
868868
__bit_iterator<__C2, false> __first2)
869869
{
870870
if (__first1.__ctz_ == __first2.__ctz_)
871-
return __swap_ranges_aligned(__first1, __last1, __first2);
872-
return __swap_ranges_unaligned(__first1, __last1, __first2);
871+
return _VSTD::__swap_ranges_aligned(__first1, __last1, __first2);
872+
return _VSTD::__swap_ranges_unaligned(__first1, __last1, __first2);
873873
}
874874

875875
// rotate
@@ -1083,8 +1083,8 @@ bool
10831083
equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __bit_iterator<_Cp, _IC2> __first2)
10841084
{
10851085
if (__first1.__ctz_ == __first2.__ctz_)
1086-
return __equal_aligned(__first1, __last1, __first2);
1087-
return __equal_unaligned(__first1, __last1, __first2);
1086+
return _VSTD::__equal_aligned(__first1, __last1, __first2);
1087+
return _VSTD::__equal_unaligned(__first1, __last1, __first2);
10881088
}
10891089

10901090
template <class _Cp, bool _IsConst,

0 commit comments

Comments
 (0)