| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The use of the `&& ...` fold expression in std::array's deduction guides
recursively builds a set of binary operator expressions of depth N where
`N` is the number of elements in the initializer.
This is problematic because arrays may be large, and instantiation
depth is limited.
This patch addresses the issue by flattening the SFINAE using
the existing `__all` type trait.
(cherry picked from commit c6eb584c64872fbb779df14acd31c1f3947f6e52)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The libc++ __bit_iterator type has weird ABI calling conventions as a
quirk
of the implementation. The const bit iterator is trivial, but the
non-const
bit iterator is not because it declares a user-defined copy constructor.
Changing this now is an ABI break, so this test ensures that each type
is trivial/non-trivial as expected.
The definition of 'non-trivial for the purposes of calls':
A type is considered non-trivial for the purposes of calls if:
* it has a non-trivial copy constructor, move constructor, or
destructor, or
* all of its copy and move constructors are deleted.
(cherry picked from commit a829443cc7359ecf0f2de8f82519f511795675ec)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes using non-default locales, which currently can crash when
e.g. formatting numbers.
Within the localeconv_l function, the per-thread locale is temporarily
changed with __libcpp_locale_guard, then localeconv() is called,
returning an lconv * struct pointer.
When localeconv_l returns, the __libcpp_locale_guard dtor restores
the per-thread locale back to the original. This invalidates the
contents of the earlier returned lconv struct, and all C strings
that are pointed to within it are also invalidated.
Thus, to have an actually working localeconv_l function, the
function needs to allocate some sort of storage for the returned
contents, that stays valid for as long as the caller needs to use
the returned struct.
Extend the libcxx/win32 specific locale_t class with storage for
a deep copy of a lconv struct, and change localeconv_l to take
a reference to the locale_t, to allow it to store the returned
lconv struct there.
This works fine for libcxx itself, but wouldn't necessarily be right
for a caller that uses libcxx's localeconv_l function.
This fixes around 11 of libcxx's currently failing tests on windows.
Differential Revision: https://reviews.llvm.org/D69505
(cherry picked from commit 7db4f2c6945a24a7d81dad3362700353e2ec369e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
FreeBSD got `timespec_get` support somewhere in the 12.x timeframe, but
the C++ version check in its system headers was written incorrectly.
This has now been fixed for both FreeBSD 13 and 12.
Add checks for the corresponding `__FreeBSD_version` values, to define
`_LIBCPP_HAS_TIMESPEC_GET` when the function is supported.
Reviewers: emaste, EricWF, ldionne, mclow.lists
Reviewed By: ldionne
Subscribers: arichardson, krytarowski, christof, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D71522
(cherry picked from commit 5e416ba943b7c737deb8eca62756f7b4fa925845)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The libcxx test suite auto-detects spaceship operator, but __config does not. This means that the libcxx test suite has been broken for over a month when using top-of-tree clang. This also really ought to be fixed before 10.0.
See: bc633a42dd409dbeb456263e3388b8caa4680aa0
Reviewers: chandlerc, mclow.lists, EricWF, ldionne, CaseyCarter
Reviewed By: EricWF
Subscribers: broadwaylamb, hans, dexonsmith, tstellar, llvm-commits, libcxx-commits
Tags: #libc, #llvm
Differential Revision: https://reviews.llvm.org/D72980
(cherry picked from commit 5dda92fcb0ce9206f831aa7cddf24421dcf044d7)
|
|
|
|
|
|
|
|
|
| |
The C11 API specifies that to initialize a recursive mutex,
mtx_plain | mtx_recursive should be used with mtx_init.
Differential Revision: https://reviews.llvm.org/D72809
(cherry picked from commit 3481e5d7ed08d068a4e3427cb1afcd8bf2acafdc)
|
|
|
|
|
|
|
|
|
|
|
| |
On Fuchsia, pthread API is emulated on top of C11 thread API. Using C11
thread API directly is more efficient.
While this implementation is only used by Fuchsia at the moment, it's
not Fuchsia specific, and could be used by other platforms that use C11
threads rather than pthreads in the future.
Differential Revision: https://reviews.llvm.org/D64378
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
with msvcrt.dll
This also makes this function consistent with the rest of the
libc++ provided fallbacks.
The locale support in msvcrt.dll is very limited anyway; it can
only be configured processwide, not per thread, and it only seems
to support the locales "C" and "" (the user set locale), so it's
hard to make any meaningful automatic test for it. But manually tested,
this change does make time formatting locale code in libc++ output
times in the user requested format, when using locale "".
Differential Revision: https://reviews.llvm.org/D69554
|
|
|
|
|
|
|
| |
This is causing failures for multiple buildbots and bootstrap builds,
details at https://reviews.llvm.org/rG61bd1920.
This reverts commit 61bd19206f61ace4b007838a2ff8884a13ec0374.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The external instantiation of std::string is a problem for libc++.
Additions and removals of inline functions in string can cause ABI
breakages, including introducing new symbols.
This patch aims to:
(1) Make clear which functions are explicitly instatiated.
(2) Prevent new functions from being accidentally instantiated.
(3) Allow a migration path for adding or removing functions from the
explicit instantiation over time.
Although this new formulation is uglier, it is preferable from a
maintainability and readability standpoint because it explicitly
enumerates the functions we've chosen to expose in our ABI. Changing
this list is non-trivial and requires thought and planning.
(3) is achieved by making it possible to control the extern template declaration
separately from it's definition. Meaning we could add a new definition to
the dylib, wait for it to roll out, then add the extern template
declaration to the header. Similarly, we could remove existing extern
template declarations while still keeping the definition to prevent ABI
breakages.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
`__has_attribute(fallthough)` -> `__has_attribute(fallthrough)`
This is a follow-up of https://reviews.llvm.org/D72287
Reviewers: EricWF, mclow.lists, Jim
Reviewed By: Jim
Subscribers: christof, ldionne, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D72314
|
|
|
|
|
|
| |
Reviewed By: mclow.lists
Differential Revision: https://reviews.llvm.org/D71525
|
|
|
|
|
|
|
|
|
| |
Add NetBSD to the same feature list as Fuchsia since it matches
in available features, effectively enabling aligned_alloc(),
timespec_get() and C11 features. Remove now-duplicate declaration
of quick_exit() support.
Differential Revision: https://reviews.llvm.org/D71511
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This removes unneeded zero initialization of string data.
For example, given the below code:
void Init(void *mem) {
new (mem) std::string("Hello World");
}
Assembly before:
Init(void*):
xorps xmm0, xmm0
movups xmmword ptr [rdi], xmm0
mov qword ptr [rdi + 16], 0
mov byte ptr [rdi], 22
movabs rax, 8022916924116329800
mov qword ptr [rdi + 1], rax
mov dword ptr [rdi + 8], 1684828783
mov byte ptr [rdi + 12], 0
ret
Assembly after:
Init():
mov byte ptr [rdi], 22
movabs rax, 8022916924116329800
mov qword ptr [rdi + 1], rax
mov dword ptr [rdi + 8], 1684828783
mov byte ptr [rdi + 12], 0
ret
Patch by Martijn Vels (mvels@google.com)
Reviewed as https://reviews.llvm.org/D70621
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch de-duplicates most compressed pair constructors
to use the same code in C++11 and C++03.
Part of doing that is deleting the "__second_tag()" and replacing
it with a "__value_init_tag()" which has the same effect, but
allows for the removal of the special "one-arg" first element
constructor.
This patch is intended to have no semantic change.
|
|
|
|
|
|
|
|
|
|
| |
This change introduces the __default_init_tag to memory, and a corresponding
element constructor to allow for default initialization of either of the pair
values. This is useful for classes such as std::string where most (all)
constructors explicitly initialize the values in the constructor.
Patch by Martijn Vels (mvels@google.com)
Reviewed as https://reviews.llvm.org/D70617
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Too many warnings are being disabled too quickly. Warnings are
important to keeping libc++ correct. This patch re-enables two
warnings: -Wconstant-evaluated and -Wdeprecated-copy.
In future, all warnings disabled for the test suite should require
an attached bug. The bug should state the plan for re-enabling that
warning, or a strong case why it should remain disabled.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since C++11, [depr.impldec]:
The implicit definition of a copy constructor as defaulted is deprecated
if the class has a user-declared copy assignment operator or a
user-declared destructor.
At clang HEAD, -Wdeprecated-copy (included by -Wextra) will warn on such instances.
Reviewed By: EricWF
Differential Revision: https://reviews.llvm.org/D71096
|
|
|
|
|
|
| |
as it's causing test failures due to mismatched visibility.
This reverts commit 02bb20223bda5add729402962c70d0ebd0d98af2.
|
|
|
|
|
|
|
|
| |
Add a couple of default copy constructors to fix the warning.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D71395
|
|
|
|
|
| |
Otherwise, weak symbols leak into user programs when using `async` with
non-internal types.
|
|
|
|
| |
https://reviews.llvm.org/D68623. Thanks to mvels for the patch.
|
|
|
|
|
|
|
| |
Android API level 21 and above have all these functions available, so we
don't need to include our fallback definitions.
Differential Revision: https://reviews.llvm.org/D69983
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Android added quick_exit()/at_quick_exit() in API level 21,
aligned_alloc() in API level 28, and timespec_get() in API level 29,
but has the other C11 features at all API levels (since they're basically
just coming from clang directly).
_LIBCPP_HAS_QUICK_EXIT and _LIBCPP_HAS_TIMESPEC_GET already existed,
so we can reuse them. (And use _LIBCPP_HAS_TIMESPEC_GET in a few more
places where _LIBCPP_HAS_C11_FEATURES has been used as a proxy. This
isn't correct for Android.)
_LIBCPP_HAS_ALIGNED_ALLOC is added, to cover aligned_alloc() (obviously).
Add a missing std:: before aligned_alloc in a cstdlib test, and remove a
couple of !defined(_WIN32)s now that we're explicitly testing
TEST_HAS_ALIGNED_ALLOC rather than TEST_HAS_C11_FEATURES.
Reviewers: danalbert, EricWF, mclow.lists
Reviewed By: danalbert
Subscribers: srhines, christof, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D69929
|
|
|
|
|
|
|
|
|
| |
With the upcoming introduction of iterator concepts in ranges,
the meaning of "__is_contiguous_iterator" changes drastically.
Currently we intend it to mean "does it have this iterator category",
but it could now also mean "does it meet the requirements of this
concept", and these can be different.
|
|
|
|
|
|
| |
These traits are currently unused because we don't implement ranges.
However, their addition is part of ongoing work to allow libc++
to optimize on user-provided contiguous iterators.
|
|
|
|
|
| |
This work is part of an ongoing effort to allow libc++ to
optimize user provided contiguous iterators.
|
|
|
|
|
|
|
| |
This function has the same behavior as the now-standand std::to_address.
Re-using the name makes the behavior more clear, and in the future it
will allow us to correctly get the raw pointer for user provided pointer
types.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: ldionne, EricWF, mclow.lists
Reviewed By: mclow.lists
Subscribers: christof, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D70282
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: This allows std::isnan to be fully inlined, instead of generating calls.
Reviewers: EricWF
Reviewed By: EricWF
Subscribers: christof, ldionne
Differential Revision: https://reviews.llvm.org/D69806
|
|
|
|
|
|
| |
Thanks to Marek Kurdej for the patch.
Differential Revision: https://reviews.llvm.org/D70206
|
|
|
|
|
|
| |
Thanks to Marek Kurdej for the patch.
Differential Revision: https://reviews.llvm.org/D70221
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
constexpr.
Reviewers: ldionne, EricWF, mclow.lists
Reviewed By: ldionne
Subscribers: christof, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D68840
|
|
|
|
|
|
|
|
|
| |
We effectively never want to export that function, which is an
implementation detail of libc++. This was previously tried in
603715c66b6b and then reverted in 8335dd314f36 because it caused
linker warnings. These linker warnings should go away now that we
use internal_linkage instead of always_inline to implement per-TU
insulation.
|
|
|
|
|
|
|
| |
This change would have warned about the bug found in D62451.
No unit tests since the exception should never throw.
Differential Revision: https://reviews.llvm.org/D62452
|
|
|
|
|
| |
See details in the original Chromium bug report:
https://bugs.chromium.org/p/chromium/issues/detail?id=994957
|
|
|
|
|
|
| |
is_constant_evaluated.
Differential Revision: https://reviews.llvm.org/D69940
|
|
|
|
|
|
| |
Thanks to Michael Park for the patch.
Differential Revision: https://reviews.llvm.org/D68837
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Same idea as the current algorithm, that is, add (half of the difference between a and b) to a.
But we use a different technique for computing the difference: we compute b - a into a pair of integers that are named "sign_bit" and "diff". We have to use a pair because subtracting two 32-bit integers produces a 33-bit result.
Computing half of that is a simple matter of shifting diff right by 1, and adding sign_bit shifted left by 31. llvm knows how to do that with one instruction: shld.
The only tricky part is that if the difference is odd and negative, then shifting it by one isn't the same as dividing it by two - shifting a negative one produces a negative one, for example. So there's one more adjustment: if the sign bit and the low bit of diff are one, we add one.
For a demonstration of the codegen difference, see https://godbolt.org/z/7ar3K9 , which also has a built-in test.
Differential Revision: https://reviews.llvm.org/D69459
|
|
|
|
|
|
|
|
| |
PR13592 was caused by a problem in how to compiler implemented the
__is_convertible_to intrinsic. That problem, reported as PR13591,
was fixed back in 2012. We don't support such old versions of Clang
anyway, so we don't need the library workaround that had been added
to solve PR13592 (while waiting for the compiler fix).
|
| |
|
| |
|
| |
|
|
|
|
| |
Testing git commit access.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: This patch removes `shared_ptr::make_shared` as it is not part of the standard. This patch also adds __create_with_cntrl_block, which is a help function that can be used in std::allocate_shared and std::make_shared. This is the third patch (out of 4) from D66178.
Reviewers: EricWF, mclow.lists, ldionne
Subscribers: christof, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D68805
llvm-svn: 375504
|
|
|
|
| |
llvm-svn: 375469
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
In D67316 we added `_LIBCPP_C_HAS_NO_GETS` to signal that the C library
does not provide `gets()`, and added a test for FreeBSD 13 or higher,
using the compiler-defined `__FreeBSD__` macro.
Unfortunately this did not work that well for FreeBSD's own CI process,
since the gcc compilers used for some architectures define `__FreeBSD__`
to match the build host, not the target.
Instead, we should use the `__FreeBSD_version` macro from the userland
header `<osreldate.h>`, which is more fine-grained. See also
<https://reviews.freebsd.org/D22034>.
Reviewers: EricWF, mclow.lists, emaste, ldionne
Reviewed By: emaste, ldionne
Subscribers: dexonsmith, bsdjhb, krytarowski, christof, ldionne, libcxx-commits
Differential Revision: https://reviews.llvm.org/D69174
llvm-svn: 375340
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
is_invocable that would internally conjure up a deprecated function type.
Summary: The implementation of P1152R4 in Clang has resulted in some deprecation warnings appearing in the libc++ and libc++abi test suite. Fix or suppress these warnings.
Reviewers: mclow.lists, EricWF
Subscribers: christof, ldionne, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D68879
llvm-svn: 375307
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Patch by Martijn Vels (mvels@google.com)
Reviewed as https://reviews.llvm.org/D68276
This is a non trivial win for externally templated assignment operator.
x86 without tail call (current libc++)
0000000000000000 <std::string::operator=(std::string const&)>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: 53 push %rbx
5: 50 push %rax
6: 48 89 fb mov %rdi,%rbx
9: 48 39 f7 cmp %rsi,%rdi
c: 74 17 je 25 <std::string::operator=(std::string const&)+0x25>
e: 0f b6 56 17 movzbl 0x17(%rsi),%edx
12: 84 d2 test %dl,%dl
14: 79 07 jns 1d <std::string::operator=(std::string const&)+0x1d>
16: 48 8b 56 08 mov 0x8(%rsi),%rdx
1a: 48 8b 36 mov (%rsi),%rsi
1d: 48 89 df mov %rbx,%rdi
20: e8 00 00 00 00 callq 25 <std::string::operator=(std::string const&)+0x25>
25: 48 89 d8 mov %rbx,%rax
28: 48 83 c4 08 add $0x8,%rsp
2c: 5b pop %rbx
2d: 5d pop %rbp
2e: c3 retq
After:
0000000000000000 <std::string::operator=(std::string const&)>:
0: 48 39 f7 cmp %rsi,%rdi
3: 74 14 je 19 <std::string::operator=(std::string const&)+0x19>
5: 0f b6 56 17 movzbl 0x17(%rsi),%edx
9: 84 d2 test %dl,%dl
b: 79 07 jns 14 <std::string::operator=(std::string const&)+0x14>
d: 48 8b 56 08 mov 0x8(%rsi),%rdx
11: 48 8b 36 mov (%rsi),%rsi
14: e9 00 00 00 00 jmpq 19 <std::string::operator=(std::string const&)+0x19>
19: 48 89 f8 mov %rdi,%rax
1c: c3 retq
Benchmark (pending per https://reviews.llvm.org/D67667)
```
BM_StringAssignStr_Empty_Opaque 6.23ns ± 0% 5.19ns ± 0% -16.70% (p=0.016 n=5+4)
BM_StringAssignStr_Empty_Transparent 5.86ns ± 0% 5.14ns ± 0% -12.24% (p=0.008 n=5+5)
BM_StringAssignStr_Small_Opaque 8.79ns ± 1% 7.69ns ± 0% -12.53% (p=0.008 n=5+5)
BM_StringAssignStr_Small_Transparent 9.44ns ± 0% 8.00ns ± 0% -15.26% (p=0.008 n=5+5)
BM_StringAssignStr_Large_Opaque 25.2ns ± 0% 24.3ns ± 0% -3.50% (p=0.008 n=5+5)
BM_StringAssignStr_Large_Transparent 23.6ns ± 0% 22.5ns ± 0% -4.76% (p=0.008 n=5+5)
BM_StringAssignStr_Huge_Opaque 319ns ± 5% 317ns ± 5% ~ (p=0.690 n=5+5)
BM_StringAssignStr_Huge_Transparent 319ns ± 5% 317ns ± 5% ~ (p=0.421 n=5+5)
BM_StringAssignAsciiz_Empty_Opaque 7.41ns ± 0% 7.77ns ± 0% +4.89% (p=0.008 n=5+5)
BM_StringAssignAsciiz_Empty_Transparent 7.54ns ± 3% 7.30ns ± 0% -3.24% (p=0.008 n=5+5)
BM_StringAssignAsciiz_Small_Opaque 9.87ns ± 0% 10.24ns ± 1% +3.76% (p=0.008 n=5+5)
BM_StringAssignAsciiz_Small_Transparent 10.4ns ± 1% 9.8ns ± 2% -5.78% (p=0.008 n=5+5)
BM_StringAssignAsciiz_Large_Opaque 30.1ns ± 0% 30.1ns ± 0% ~ (p=0.167 n=5+5)
BM_StringAssignAsciiz_Large_Transparent 27.1ns ± 0% 27.4ns ± 0% +0.92% (p=0.016 n=4+5)
BM_StringAssignAsciiz_Huge_Opaque 383ns ± 4% 382ns ± 4% ~ (p=0.548 n=5+5)
BM_StringAssignAsciiz_Huge_Transparent 375ns ± 0% 380ns ± 0% +1.37% (p=0.029 n=4+4)
BM_StringAssignAsciizMix_Opaque 14.0ns ± 0% 14.0ns ± 0% ~ (p=0.881 n=5+5)
BM_StringAssignAsciizMix_Transparent 13.7ns ± 1% 13.8ns ± 0% ~ (p=0.056 n=5+5)
```
llvm-svn: 374137
|