Commit Graph

2907 Commits

Author SHA1 Message Date
Eric Fiselier
d3b3b1f4a1 Add TEST_NOEXCEPT_FALSE to support D31738
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300191 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 10:17:23 +00:00
Eric Fiselier
0301092a7b Cleanup any_cast failure test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300175 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 05:27:55 +00:00
Eric Fiselier
e4b267b262 Fix template >> within C++03 code
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300165 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 02:56:03 +00:00
Eric Fiselier
706e2c7374 Diagnose when reverse_iterator is used on path::iterator.
path::iterator isn't a strictly conforming iterator. Specifically
it stashes the current element inside the iterator. This leads to
UB when used with reverse_iterator since it requires the element
to outlive the lifetime of the iterator.

This patch adds a static_assert inside reverse_iterator to disallow
"stashing iterator types", and it tags path::iterator as such a type.

Additionally this patch removes all uses of reverse_iterator<path::iterator>
within the tests.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300164 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 02:54:13 +00:00
Eric Fiselier
dd5982633c Fix C++03 test failures
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300159 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 01:13:58 +00:00
Eric Fiselier
0cb22a2fb4 Add tests that std::unique_ptr's default constructor is constexpr.
std::unique_ptr's default constructor must be constexpr in order
to allow constant initialization to take place for static objects;
Even though we can never have a constexpr unique_ptr variable since
it's not a literal type.

This patch adds tests that constant initialization takes place by
using the __attribute__((require_constant_initialization)) macro.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300158 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 01:11:58 +00:00
Eric Fiselier
3b7f79609f Update tests -verify error messages after r300140.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300156 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 01:03:41 +00:00
Eric Fiselier
161ccc1a72 Fix most failures caused by r300140
r300140 introduced a bunch of failures by changing the internal
interface provided by __compressed_pair. This patch fixes all of
the failures caused by the new interface by changing the existing
code to use it.

In addition to those changes this patch also fixes two separate
issues causing test failures:

1) Fix the member swap definition for __map_value_compare. Previously
   the swap was incorrectly configured to swap the comparator as const.

2) Fix an assertion failure in futures.task.members/ctor_func_alloc.pass.cpp
that incorrectly expected a move to take place when a single copy is sufficient.

There is one remaining failure regarding make_shared. I'll commit a fix for that
shortly.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300148 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 00:34:24 +00:00
Eric Fiselier
db14bcc51c [libcxx] Fix __compressed_pair so it doesn't copy the argument multiple times, and add constexpr.
Summary:
__compressed_pair takes and passes it's constructor arguments by value. This causes arguments to be moved 3 times instead of once. This patch addresses that issue and fixes `constexpr` on the constructors.

I would rather have this fix than D27564, and I'm fairly confident it's not ABI breaking but I'm not 100% sure.

I prefer this solution because it removes a lot of code and makes the implementation *much* smaller.

Reviewers: mclow.lists, K-ballo

Reviewed By: K-ballo

Subscribers: K-ballo, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300140 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 23:45:53 +00:00
Eric Fiselier
87fd9b2370 Fix test failures with older Clang versions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300132 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 23:17:17 +00:00
Eric Fiselier
7b41c797ba [libc++] Implement LWG 2911 - add an is_aggregate type-trait
Summary:
This patch implements http://cplusplus.github.io/LWG/lwg-defects.html#2911.

I'm putting this up for review until __is_aggregate is added to clang (See D31513)

Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300126 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 23:08:46 +00:00
Marshall Clow
9bd669bd90 Additional test file for r300123
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300124 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 22:51:56 +00:00
Marshall Clow
22381ddf4f Implement part of LWG#2857 - any/optional. Still to do - variant. Reviewed as https://reviews.llvm.org/D31956
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300123 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 22:51:27 +00:00
Eric Fiselier
39683f1377 Fix incorrectly qualified return type from unique_ptr::get_deleter().
For reference deleter types the const qualifier on the return type
of get_deleter() should be ignored, and a non-const deleter should
be returned.

This patch fixes a bug where "const deleter_type&" is incorrectly
formed.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300121 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 22:43:49 +00:00
Stephan T. Lavavej
00f804a0a5 [libcxx] [test] Avoid Clang's -Wunused-const-variable in is_constructible.pass.cpp.
This happens when using Clang with MSVC's STL, so there are no actual uses of this variable.

Fixes D31966.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300079 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 17:16:38 +00:00
Marshall Clow
a98a45148f Add some FAIL constexpr tests for optional's copy/move ctors.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300009 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 00:07:29 +00:00
Marshall Clow
01208afbd6 Implement LWG#2873: 'Add noexcept to several shared_ptr related functions' This issue missed a couple, so I added those as well (see LWG#2942)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299963 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 17:08:53 +00:00
Marshall Clow
f4f8803751 Fix a C++03 failure
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299909 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 01:54:48 +00:00
Marshall Clow
726efd8dfd Remove some trigraphs that GCC was complaining about
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299907 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 00:18:28 +00:00
Marshall Clow
a43fe06888 Fix PR#32605: common_type<T> is not SFINAE-friendly
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299901 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 23:47:47 +00:00
Marshall Clow
c50c6b79c3 Fix PR#32606: std::decay mishandles abominable function types
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299894 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 22:51:07 +00:00
Akira Hatanaka
733ab2f9f0 Revert "Allow a standard library to implement conditional noexcept for optional and unique_ptr hash functions."
This reverts commit r299734.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299744 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-07 05:55:28 +00:00
Billy Robert O'Neal III
0bdae913c3 Add noexcept(false) to more strongly indicate that not being noexcept is important for hash tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299735 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 23:50:33 +00:00
Billy Robert O'Neal III
2889d45aaa Allow a standard library to implement conditional noexcept for optional and unique_ptr hash functions.
These tests were unconditionally asserting that optional and unique_ptr declare throwing hashes, but MSVC++ implements conditional noexcept forwarding that of the underlying hash function. As a result we were failing these tests but there's nothing forbidding strengthening noexcept in that way.

Changed the ASSERT_NOT_NOEXCEPT asserts to use types which themselves have non-noexcept hash functions.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299734 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 23:50:21 +00:00
Marshall Clow
abdcc5c29c Some of Eric's buildbots don't like this test. Disable it while I figure out why.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299686 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 18:54:37 +00:00
Marshall Clow
e7a5f18b1c Recommit awk tests with warnings removed. Initial commit r299652, reverted r299656.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299680 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 18:34:36 +00:00
Mehdi Amini
4cbff19346 Revert "Restore Missing awk regex tests. Thanks to dexonsmith for noticing, and proposing this as https://reviews.llvm.org/D16541"
This reverts commit r299652, 32bits MacOS is broken.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299656 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 15:56:55 +00:00
Marshall Clow
de4f6cbb5e Restore Missing awk regex tests. Thanks to dexonsmith for noticing, and proposing this as https://reviews.llvm.org/D16541
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299652 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 14:32:42 +00:00
Eric Fiselier
607e0c71ec Fix more -Wshadow warnings introduced by recent Clang change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299411 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-04 02:54:27 +00:00
Eric Fiselier
2b3c1c4d9b Fix LWG 2934 - optional<const T> doesn't compare with T
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299105 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30 20:06:52 +00:00
Eric Fiselier
5612bd42dc Implement LWG 2842 - optional(U&&) needs to SFINAE on decay_t<in_place_t>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299100 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30 19:43:50 +00:00
Marshall Clow
0b148779b3 Mark *pass tests as UNUSUPPORTED instead of XFAIL on old compilers
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298839 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-27 10:44:33 +00:00
Marshall Clow
76c1482e7c Mark *fail tests as UNUSUPPORTED instead of XFAIL on old compilers
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298832 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-27 06:31:58 +00:00
Marshall Clow
5048b1e092 XFAIL the std::byte tests on a bunch of old clang versions, because they don't like 'std::byte b1{1}'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298706 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-24 16:17:20 +00:00
Marshall Clow
21ae16e203 Implement P0298R3: 'std::byte'. Reviewed as https://reviews.llvm.org/D31022
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298689 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-24 05:45:39 +00:00
Marshall Clow
59bcc879ab Implement Pp0156r2: 'Variadic Lock Guard, version 5' Reviewed as https://reviews.llvm.org/D31163.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298681 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-24 03:40:36 +00:00
Marshall Clow
50e32f569c Update the algorithm tests to not use the (deprecated) function binders. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298618 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 16:13:50 +00:00
Bruce Mitchener
50145cc3e9 [libcxx] Improve code generation for vector::clear().
Summary:
By manipulating a local variable in the loop, when the loop can
be optimized away (due to no non-trivial destructors), this lets
it be fully optimized away and we modify the __end_ separately.

This results in a substantial improvement in the generated code.

Prior to this change, this would be generated (on x86_64):

    movq    (%rdi), %rdx
    movq    8(%rdi), %rcx
    cmpq    %rdx, %rcx
    je    LBB2_2
    leaq    -12(%rcx), %rax
    subq    %rdx, %rax
    movabsq    $-6148914691236517205, %rdx ## imm = 0xAAAAAAAAAAAAAAAB
    mulq    %rdx
    shrq    $3, %rdx
    notq    %rdx
    leaq    (%rdx,%rdx,2), %rax
    leaq    (%rcx,%rax,4), %rax
    movq    %rax, 8(%rdi)

And after:

    movq    (%rdi), %rax
    movq    %rax, 8(%rdi)

This brings this in line with what other implementations do.

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298601 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 14:39:23 +00:00
Marshall Clow
699c414d73 Use 'REQUIRES: c++98 || c++03 || c++11 || c++14' instead of the deprecated 'REQUIRES-ANY: c++98, c++03, c++11, c++14'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298600 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 14:20:43 +00:00
Marshall Clow
03b862f6ea Remove random_shuffle in C++17. Please use shuffle instead. If you have to, you cant get it back by defining _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE before including any libc++ headers.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298597 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 13:43:37 +00:00
Marshall Clow
46da6b8295 Silence a couple of 'unused variable' warnings in c++03 tests. No functional change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298582 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 06:25:26 +00:00
Michael Park
ad3680b23e Worked around GCC bug 56480. Explicit specialization in a different namespace.
Summary: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480

Reviewers: EricWF

Reviewed By: EricWF

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298581 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 06:21:24 +00:00
Marshall Clow
570f32c8dd Can't test for noexcept on C++03; std::hash<nullptr_t> isn't available until C++17
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298580 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 06:20:18 +00:00
Marshall Clow
af552ba05a Implement P0599: 'noexcept for hash functions'. Fix a couple of hash functions (optional<T> and unique_ptr<T>) which were mistakenly marked as 'noexcept'. Reviewed as https://reviews.llvm.org/D31234
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298573 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 02:40:28 +00:00
Eric Fiselier
03096267d6 Address post-commit review comments regarding test_workarounds.h
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298566 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 00:48:59 +00:00
Eric Fiselier
0da4cb892b [libc++] Work around C1XX bug which breaks poisoned hash tests.
Summary: This is my attempt to work around the C1XX bug described to me by @BillyONeal.

Reviewers: BillyONeal, STL_MSFT, CaseyCarter

Reviewed By: BillyONeal

Subscribers: cfe-commits, BillyONeal

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298554 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 22:41:41 +00:00
Marshall Clow
6b6874c8e2 Fix a couple of 'C++11'-isms from the last checkin, which broke the '03 bot.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298422 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 19:12:21 +00:00
Marshall Clow
6ccca38d07 Add a bit more to one of the chrono tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298418 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 18:40:46 +00:00
Marshall Clow
cf6e0db0b9 Implement P0548: 'common_type and duration' This involves a subtle change in the return type of the unary +/- operators for std::chrono::duration, though I expect that no one will notice.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298416 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 18:38:57 +00:00
Marshall Clow
2d4c3fa48a Implement LWG#2761: 'basic_string should require that charT match traits::char_type'. Tests for string_view, too
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@297872 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 18:41:11 +00:00