2705 Commits

Author SHA1 Message Date
Marshall Clow
98d4ace735 Implement P0972R0: <chrono> zero(), min(), and max() should be noexcept. Reviewed as https://reviews.llvm.org/D53828
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346766 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-13 17:22:41 +00:00
Louis Dionne
52ddb5e2b8 [libcxx] Implement http://wg21.link/p1006, constexpr in pointer_traits
Summary:
P1006 adds support for constexpr in the specialization of pointer_traits
for raw pointers. This is necessary in order to use pointer_traits in
the upcoming constexpr containers. We expect P1006 to be voted into the
working draft for C++20 at the San Diego meeting.

Reviewers: mclow.lists, EricWF

Subscribers: christof, dexonsmith, libcxx-commits

Differential Revision: https://reviews.llvm.org/D53867

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346764 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-13 17:04:05 +00:00
Eric Fiselier
16a8e7ec37 Add emplace tests for multiset/unordered_multiset.
This patch adds tests to ensure that multiset/unordered_multiset's emplace
method correctly constructs the elements without any intervening
constructions.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346743 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-13 06:30:36 +00:00
Marshall Clow
3870a97d86 Fix PR39619 - iterator_traits isn't SFINAE-friendly enough. Thanks to Eric for the report
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346738 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-13 05:33:31 +00:00
Louis Dionne
e754a7a9d2 [NFC] Reformat std::optional tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346630 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-12 01:38:30 +00:00
Dan Albert
73d2eccc78 Fix test assumption that Linux implies glibc.
Summary:
This fixes an regression when using bionic introduced in r345173.

I need to follow up and figure out what exactly is implied by
TEST_HAS_C11_FEATURES and see what the correct configuration is for
bionic (new versions should have everything the tests care about,
versions that predate C11 certainly don't), but this gets the tests
back to the old behavior.

Reviewers: EricWF

Reviewed By: EricWF

Subscribers: mclow.lists, christof, ldionne, libcxx-commits, cfe-commits

Differential Revision: https://reviews.llvm.org/D53956

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345900 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-01 22:35:51 +00:00
Louis Dionne
5dc37768e2 Revert "Bug 39129: Speeding up partition_point/lower_bound/upper_bound/ by using unsigned division by 2 when possible."
This reverts r345525. I'm reverting because that patch apparently caused
a regression on certain platforms (see https://reviews.llvm.org/D53994).
Since we don't fully understand the reasons for the regression, I'm
reverting until we can provide a fix we understand.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345893 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-01 21:24:32 +00:00
Louis Dionne
f10e0ac7b0 [libcxx] Fix usage of _C2, which is a "nasty macro" in some environments
The problem was pointed out in https://reviews.llvm.org/D48896#inline-475775.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345834 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-01 14:41:37 +00:00
Erik Pilkington
71ac96a43b Second half of C++17's splicing maps and sets
This commit adds a merge member function to all the map and set containers,
which splices nodes from the source container. This completes support for
P0083r3.

Differential revision: https://reviews.llvm.org/D48896

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345744 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-31 17:31:35 +00:00
Eric Fiselier
3238cbf311 XFAIL test on OS X availability
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345529 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-29 19:52:22 +00:00
Eric Fiselier
207b919735 Bug 39129: Speeding up partition_point/lower_bound/upper_bound/ by using unsigned division by 2 when possible.
Patch by Denis Yaroshevskiy (denis.yaroshevskij@gmail.com)

The rational and measurements can be found in the bug description: https://bugs.llvm.org/show_bug.cgi?id=39129

Reviewed as https://reviews.llvm.org/D52697


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345525 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-29 19:25:02 +00:00
Eric Fiselier
293b83d6e6 Fix PR39458 _LIBCPP_DEBUG breaks heterogeneous compare.
The types/comparators passed to std::upper_bound and std::lower_bound
are not required to provided to provide an operator</comp(...) which
accepts the arguments in reverse order. Nor are the ranges required
to have a strict weak ordering.

However, in debug mode we attempted to check the result of a comparison
with the arguments reversed, which may not compiler.

This patch removes the use of the debug comparator for upper_bound
and lower_bound.

equal_range et al still use debug comparators when they call
__upper_bound and __lower_bound.

See llvm.org/PR39458

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345434 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-26 22:54:46 +00:00
Eric Fiselier
924b8f34f6 Work around gcc.gnu.org/PR87766
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345425 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-26 20:20:12 +00:00
Eric Fiselier
6dcb34abc2 XFAIL sized deallocation test with GCC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345400 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-26 16:37:11 +00:00
Marshall Clow
5be216356b Run the min/max tests agaist the header <charconv>. Fix that header so it passes. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345352 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-26 01:00:56 +00:00
Eric Fiselier
e09f85bbe5 Implement sized deallocation for std::allocator and friends.
Summary:
C++14 sized deallocation is disabled by default due to ABI concerns. However, when a user manually enables it then libc++ should take advantage of it since sized deallocation can provide a significant performance win depending on the underlying malloc implementation. (Note that libc++'s definitions of sized delete don't do anything special yet, but users are free to provide their own).

This patch updates __libcpp_deallocate to selectively call sized operator delete when it's available. `__libcpp_deallocate_unsized` should be used when the size of the allocation is unknown.

On Apple this patch makes no attempt to determine if the sized operator delete is unavailable, only that the language feature is enabled. This could cause a compile error when using `std::allocator`, but the same compile error would occur whenever the user calls `new`, so I don't think it's a problem.

Reviewers: ldionne, mclow.lists

Reviewed By: ldionne

Subscribers: rsmith, ckennelly, libcxx-commits, christof

Differential Revision: https://reviews.llvm.org/D53120

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345281 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-25 17:21:30 +00:00
Eric Christopher
1b9ee84408 Temporarily Revert "Implement sized deallocation for std::allocator and friends."
This is breaking the bots here (and related): http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-asan/builds/1428

This reverts commit r345214.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345239 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-25 06:20:12 +00:00
Eric Fiselier
0cfdf55219 Implement sized deallocation for std::allocator and friends.
Summary:
C++14 sized deallocation is disabled by default due to ABI concerns. However, when a user manually enables it then libc++ should take advantage of it since sized deallocation can provide a significant performance win depending on the underlying malloc implementation. (Note that libc++'s definitions of sized delete don't do anything special yet, but users are free to provide their own).

This patch updates __libcpp_deallocate to selectively call sized operator delete when it's available. `__libcpp_deallocate_unsized` should be used when the size of the allocation is unknown.

On Apple this patch makes no attempt to determine if the sized operator delete is unavailable, only that the language feature is enabled. This could cause a compile error when using `std::allocator`, but the same compile error would occur whenever the user calls `new`, so I don't think it's a problem.

Reviewers: ldionne, mclow.lists

Reviewed By: ldionne

Subscribers: rsmith, ckennelly, libcxx-commits, christof

Differential Revision: https://reviews.llvm.org/D53120

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345214 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-24 22:44:01 +00:00
Petr Hosek
842383f69c Revert "Teach __libcpp_is_floating_point that __fp16 and _Float16 are"
This reverts commits r333103 and r333108. _Float16 and __fp16 are C11
extensions and compilers other than Clang don't define these for C++.

Differential Revision: https://reviews.llvm.org/D53670

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345199 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-24 21:29:15 +00:00
Eric Fiselier
005bb4c72c Fix use of libc++ specific macro in support/test_macros.h
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345173 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-24 18:37:42 +00:00
Mikhail Maltsev
0423faff95 Adjust unsupported C++ versions in some tests
Summary:
Some tests (mainly the new C++20 calendar library) fail when libc++ is
tested with '--param=std=c++98'. The failures happen because the tests
actually don't support C++98, but don't mention C++98 in the
'UNSUPPORTED:' line.

This change fixes the issue.

Reviewers: mclow.lists, ldionne

Reviewed By: ldionne

Subscribers: arphaman, michaelplatings, libcxx-commits

Differential Revision: https://reviews.llvm.org/D53640

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345148 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-24 15:09:08 +00:00
Marshall Clow
9678b5d267 Mark the move construct/move assign tests as unsupported on C++03
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345001 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-23 05:22:09 +00:00
Marshall Clow
374084fce8 Add tests for match_results copy/move assignment operators. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344998 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-23 02:51:26 +00:00
Marshall Clow
268b4d01c2 Remove a 'const' from the synopsis. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344997 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-23 02:31:11 +00:00
Marshall Clow
a894ebb441 Add tests for match_results copy/move construction. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344988 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-23 01:27:47 +00:00
Marshall Clow
9110b80a63 Update commnents to reflect the changes for LWG#3127. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344951 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-22 20:49:50 +00:00
Marshall Clow
3d1d9230d8 Update commnents to reflect the changes for LWG#3122. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344950 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-22 20:44:37 +00:00
Billy Robert O'Neal III
0a890c95ca [libcxx] [test] Don't detect Windows' UCRT with TEST_COMPILER_C1XX
The test is trying to avoid saying aligned_alloc on Windows' UCRT, which does not (and can not) implement aligned_alloc. However, it's testing for c1xx, meaning clang on Windows will fail this test when using the UCRT.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344829 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-20 03:35:45 +00:00
Billy Robert O'Neal III
87aef886f9 [libcxx] [test] Add missing <stdexcept> to map at tests.
Reviewed as https://reviews.llvm.org/D50551

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344821 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-19 23:49:15 +00:00
Billy Robert O'Neal III
22b685ebae Repair thread-unsafe modifications of n_alive in F.pass.cpp
In this example, the ctor of G runs in the main thread in the expression G(), and also in the copy ctor of G() in the DECAY_COPY inside std::thread. The main thread destroys the G() instance at the semicolon, and the started thread destroys the G() after it returns. Thus there is a race between the threads on the n_alive variable.

The fix is to join with the background thread before attempting to destroy the G in the main thread.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344820 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-19 23:45:45 +00:00
Louis Dionne
4104ebe22a [libcxx] Mark chrono literal unit tests as being unsupported on AppleClang 10
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344661 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-17 00:34:13 +00:00
Marshall Clow
cc5c12d9de Recommit <chrono> changes with a couple xtra tests marked to fail on apple's clang. Reviewed as D51762
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344627 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-16 17:27:54 +00:00
Artem Dergachev
93d0856471 Re-apply r344546 "Mark a couple of test cases as 'C++17-only'..."
Reverted too much in r344580.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344582 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-16 03:36:55 +00:00
Artem Dergachev
7f20dc6854 Revert r344529 "Implement the first part of the calendar support for C++20"
Revert r344535 "Wrap up the new chrono literals in an #ifdef..."
Revert r344546 "Mark a couple of test cases as 'C++17-only'..."

Some of the buildbot failures were masked by another error,
and this one was probably missed.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344580 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-16 02:40:42 +00:00
Marshall Clow
689f6cd77b Mark a couple of test cases as 'C++17-only' pending the resolution of PR#39232
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344546 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 19:46:03 +00:00
Marshall Clow
1b8e200470 Wrap up the new chrono literals in an #ifdef so that old versions of clang don't complain. I'm looking at you, clang 5.0.1
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344535 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 17:33:20 +00:00
Marshall Clow
fc25eebcac Implement the first part of the calendar support for C++20. This is still incomplete; there will be more patches coming. Reviewed as D51762
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344529 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 16:06:37 +00:00
Marshall Clow
fa1a3d5c91 One more local type warning removed from the tests. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344421 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-12 21:59:32 +00:00
Marshall Clow
8f07eceb27 Update the array tests to not use a local type; removes warnings in C++03. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344417 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-12 21:24:44 +00:00
Marshall Clow
477f04b9a2 Update all the max_size tests to eliminate signed/unsigned comparison warnings. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344416 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-12 21:22:15 +00:00
Marshall Clow
e436a759bf Add a test that shows what happens with throwing destructors. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344220 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-11 04:07:20 +00:00
Aaron Puchert
b5d4ffd60d Use TEST_STD_VER instead of __cplusplus [NFC]
While __cplusplus was only used a few dozen times, TEST_STD_VAR is used
more than 2000 times. So we replace the former by the latter for
consistency in the tests. There should be no functional change.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344194 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-10 22:35:24 +00:00
Aaron Puchert
c4edc5a912 Use std::scoped_lock only for C++17 and newer
This fixes a test failure caused by D53049.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344192 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-10 22:05:33 +00:00
Eric Fiselier
697faed467 Add test macros for always_inline and noinline
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344167 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-10 18:22:23 +00:00
Aaron Puchert
f7d5bd26cd Annotate scoped_lock as with scoped_lockable attribute
Summary:
Scoped capabilities need to be annotated as such, otherwise the thread
safety analysis won't work as intended.

Fixes PR39234.

Reviewers: ldionne

Reviewed By: ldionne

Subscribers: christof, libcxx-commits

Differential Revision: https://reviews.llvm.org/D53049

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344096 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-09 23:42:29 +00:00
Louis Dionne
385cc71138 [libcxx] Mark std::async race condition test as unsupported on Darwin
PR38682 added a test to check for a race condition in std::future.
Part of the fix is part of the dylib, but there is no released version
of mac OS X that ships a dylib containing the fix. Hence, this test can
(and sometimes does) when testing on OS X. This commit marks the test
as unsupported to avoid spurious failures.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344053 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-09 14:57:40 +00:00
Eric Fiselier
ea2334b94f Mork more tests as FLAKY
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343435 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-01 01:43:42 +00:00
Eric Fiselier
52a8692f86 Fix threaded test under no-threading configuration
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343432 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-01 01:05:51 +00:00
Louis Dionne
2495dabf93 [libcxx] Fix the binder deprecation tests on Clang 5.
Tested on Docker containers with Clang 4, 5 and 6.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342855 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-23 23:17:48 +00:00
Louis Dionne
58deb8a9c9 [libcxx] Fix buildbots on Debian
Debian build bots are running Clang 4, which apparently does not support
the "deprecated" attribute properly. Clang pretends to support the attribute,
but the attribute doesn't do anything.

(live example: https://wandbox.org/permlink/0De69aXns0t1D59r)

On a separate note, I'm not sure I understand why we're even running the
libc++ tests under Clang-4. Is this a configuration we support? I can
understand that libc++ should _build_ with Clang 4, but it's not clear
to me that new libc++ headers should be usable under older compilers
like that.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342854 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-23 22:16:35 +00:00