Commit Graph

334 Commits

Author SHA1 Message Date
Marshall Clow
01a665a876 Apply D28248: 'Work around GCC PR37804'. Thanks to mdaniels for the patch
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351993 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-23 23:06:18 +00:00
Marshall Clow
b9b2b3f11e While reviewing D57058, Louis had some questions about the existing span constructor tests. They were not testing the stuff that they said they were. Updated the tests to test what they should have been doing
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351887 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-22 22:01:13 +00:00
Chandler Carruth
7c3769df62 Update more file headers across all of the LLVM projects in the monorepo
to reflect the new license. These used slightly different spellings that
defeated my regular expressions.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351648 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 10:56:40 +00:00
Eric Fiselier
272871b658 Move internal usages of alignof/__alignof to use _LIBCPP_ALIGNOF.
Summary:
Starting in Clang 8.0 and GCC 8.0, `alignof` and `__alignof` return different values in same cases. Specifically `alignof` and `_Alignof` return the minimum alignment for a type, where as `__alignof` returns the preferred alignment. libc++ currently uses `__alignof` but means to use `alignof`. See  llvm.org/PR39713

This patch introduces the macro `_LIBCPP_ALIGNOF` so we can control which spelling gets used.

This patch does not introduce any ABI guard to provide the old behavior with newer compilers. However, if we decide that is needed, this patch makes it trivial to implement.

I think we should commit this change immediately, and decide what we want to do about the ABI afterwards. 

Reviewers: ldionne, EricWF

Reviewed By: ldionne, EricWF

Subscribers: jyknight, christof, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351289 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-16 01:51:12 +00:00
JF Bastien
668faeab19 [NFC] Normalize some test 'main' signatures
There were 3 tests with 'int main(void)', and 6 with the return type on a different line. I'm about to send a patch for main in tests, and this NFC change is unrelated.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350770 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-09 22:56:45 +00:00
Volodymyr Sapsai
354589c472 [libcxx] Optimize vectors construction of trivial types from an iterator range with const-ness mismatch.
We already have a specialization that will use memcpy for construction
of trivial types from an iterator range like

    std::vector<int>(int *, int *);

But if we have const-ness mismatch like

    std::vector<int>(const int *, const int *);

we would use a slow path that copies each element individually. This change
enables the optimal specialization for const-ness mismatch. Fixes PR37574.

Contributions to the patch are made by Arthur O'Dwyer, Louis Dionne.

rdar://problem/40485845

Reviewers: mclow.lists, EricWF, ldionne, scanon

Reviewed By: ldionne

Subscribers: christof, ldionne, howard.hinnant, cfe-commits

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



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350583 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-08 00:03:16 +00:00
Louis Dionne
8daffdabc5 [libcxx] Fix order checking in unordered_multimap tests.
Some tests assume that iteration through an unordered multimap elements
will return them in the same order as at the container creation. This
assumption is not true since the container is unordered, so that no
specific order of elements is ever guaranteed for such container. This
patch introduces checks verifying that any iteration will return elements
exactly from a set of valid values and without repetition, but in no
particular order.

Reviewed as https://reviews.llvm.org/D54838.
Thanks to Andrey Maksimov for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349780 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-20 17:55:31 +00:00
Marshall Clow
9ff404deec Portability fix: add missing includes and static_casts. Reviewed as https://reviews.llvm.org/D55777. Thanks to Andrey Maksimov for the patch.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349566 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-18 23:19:00 +00:00
Eric Fiselier
8c36703b2b Fix static assert diagnostic checks in i386
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349252 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-15 05:18:56 +00:00
Eric Fiselier
01fac08922 Tolerate Clangs new static_assert messages
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349189 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-14 20:42:36 +00:00
Marshall Clow
f927635d87 Implement P1209 - Adopt Consistent Container Erasure from Library Fundamentals 2 for C++20. Reviewed as https://reviews.llvm.org/D55532
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349178 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-14 18:49:35 +00:00
Marshall Clow
49ad9aa8cb Update a couple of vector<bool> tests that were testing libc++-specific bahavior. Thanks to Andrey Maksimov for the catch.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@348660 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-07 22:16:26 +00:00
Louis Dionne
5b19b0bb3f [libcxx] Add checks for unique value of array<T, 0>.begin() and array<T, 0>.end()
The standard section [array.zero] requires the return value of begin()
and end() methods of a zero-sized array to be unique. Eric Fiselier
clarifies: "That unique value cannot be null, and must be properly aligned".
This patch adds checks for the first part of this clarification: unique
value returned by these methods cannot be null.

Reviewed as https://reviews.llvm.org/D55366.
Thanks to Andrey Maksimov for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@348509 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-06 18:24:39 +00:00
Louis Dionne
edfdc498b8 [libcxx] Make return value of array<T, 0>.data() checked only for libc++
The section array.zero says: "The return value of data() is unspecified".
This patch marks all checks of the array<T, 0>.data() return value as
libc++ specific.

Reviewed as https://reviews.llvm.org/D55364.
Thanks to Andrey Maksimov for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@348485 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-06 13:52:20 +00:00
Eric Fiselier
e3e576ae50 Revert "Move internal usages of alignof/__alignof to use _LIBCPP_ALIGNOF. "
This reverts commit 087f065cb0.

The tests were failing on 32 bit builds, and I don't have time
to clean them up right now. I'll recommit tomorrow with fixed tests.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347816 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-28 22:24:19 +00:00
Eric Fiselier
087f065cb0 Move internal usages of alignof/__alignof to use _LIBCPP_ALIGNOF.
Summary:
Starting in Clang 8.0 and GCC 8.0, `alignof` and `__alignof` return different values in same cases. Specifically `alignof` and `_Alignof` return the minimum alignment for a type, where as `__alignof` returns the preferred alignment. libc++ currently uses `__alignof` but means to use `alignof`. See  llvm.org/PR39713

This patch introduces the macro `_LIBCPP_ALIGNOF` so we can control which spelling gets used.

This patch does not introduce any ABI guard to provide the old behavior with newer compilers. However, if we decide that is needed, this patch makes it trivial to implement.

I think we should commit this change immediately, and decide what we want to do about the ABI afterwards. 

Reviewers: ldionne, EricWF

Reviewed By: EricWF

Subscribers: christof, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347787 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-28 18:16:02 +00:00
Marshall Clow
f4e307bd3c Implement P1085R2 - Should Span be Regular?. This consists entirely of deletions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347672 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-27 16:35:41 +00:00
Louis Dionne
5beaebf500 [libcxx] Fix incorrect iterator type in vector container test
The iterator types for different specializations of containers with the
same element type but different allocators are not required to be
convertible. This patch makes the test to take the iterator type from
the same container specialization as the created container.

Reviewed as https://reviews.llvm.org/D54806.
Thanks to Andrey Maksimov for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347423 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-21 20:53:07 +00:00
Louis Dionne
c8f785547c [libcxx] Fix incorrect #include for std::hash
Reviewed as https://reviews.llvm.org/D54705.
Thanks to Andrey Maksimov for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347233 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-19 17:40:16 +00:00
Louis Dionne
a320121c4c [libcxx] Add missing <cstddef> includes in tests
Some tests use type std::max_align_t, but don't include <cstddef> header
directly. As a result, these tests won't compile against some conformant
libraries.

Reviewed as https://reviews.llvm.org/D54645.
Thanks to Andrey Maksimov for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347232 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-19 17:39:50 +00:00
Louis Dionne
20c43d22bb [libcxx] Add missing includes in tests
A bunch of unordered containers tests call library functions but don't directly
include the corresponding header files:

- fabs() (defined in <cmath> which is not included);
- is_permutation() (defined in <algorithm> which is not included);
- next() (defined in <iterator> which is not included).
- As a result, these tests won't compile against some conformant libraries.

Reviewed as https://reviews.llvm.org/D54643.
Thanks to Andrey Maksimov for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347085 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-16 19:52:47 +00:00
Eric Fiselier
c2c6c1de6b Get tests compiling with -Wunused-local-typedef
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346914 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-15 00:11:02 +00:00
Stephan T. Lavavej
c6da5c57fe [libcxx] [test] Fix Clang -Wunused-local-typedef warnings.
C++11's [hash.requirements] never required these typedefs from users.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346912 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-14 23:23:55 +00:00
Stephan T. Lavavej
5d11d6e664 [libcxx] [test] Include <cassert> for assert().
This fixes compiler errors with MSVC's STL.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346911 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-14 23:23:51 +00:00
Stephan T. Lavavej
5e97ad3674 [libcxx] [test] Fix MSVC warning C4800.
This was implicitly converting [1, 3] to bool, which triggers
an MSVC warning. The test should just pass `true`, which is
simpler, has the same behavior, and avoids the warning. (This
is a library test, not a compiler test, and the conversion happens
before calling `push_back`, so passing [1, 3] isn't interesting
in any way. This resembles a previous change to stop passing
`1 == 1` in the `vector<bool>` tests.)

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346910 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-14 23:23:46 +00:00
Stephan T. Lavavej
439de45011 [libcxx] [test] Strip trailing whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346826 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-14 03:06:06 +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
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
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
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
699cb5b3b8 Remove unused include of "verbose_assert.h"
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342524 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-19 02:27:44 +00:00
Marshall Clow
1755c75e7e Mark LWG#3102 as complete. No code changes, but I updated a test or two
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342103 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-13 02:23:52 +00:00
Marshall Clow
c106dd615d mark LWG#2953 as complete. No code changes required, but added a couple of extra tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342070 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-12 18:51:12 +00:00
Marshall Clow
ec25143bbb Implement LWG #3017. list splice functions should use addressof
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342057 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-12 14:46:17 +00:00
Marshall Clow
4c90425692 Fix Bug 38644: multimap::clear() missing exception specifier. Add noexcept tests for all the containers that have clear().
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@340385 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-22 04:28:43 +00:00
Billy Robert O'Neal III
5428c6b9d6 [libcxx] [test] Avoid -Wunused-local-typedef in node_handle.pass.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339218 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-08 04:24:47 +00:00
Marshall Clow
3a225ef042 Update the changes to the array tests (that I committed yesterday) to use the test_comparison routines that I committed last week. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@338797 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-03 00:47:12 +00:00
Marshall Clow
88f5d7a38b Implement P1023: constexpr comparison operators for std::array
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@338668 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-02 02:11:06 +00:00
Erik Pilkington
36fc737189 First half of C++17's splicing maps and sets
This commit adds a node handle type, (located in __node_handle), and adds
extract() and insert() members to all map and set types, as well as their
implementations in __tree and __hash_table.

The second half of this feature is adding merge() members, which splice nodes
in bulk from one container into another. This will be committed in a follow-up.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@338472 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-01 01:33:38 +00:00
Marshall Clow
dfd0874465 Disable 'suggest braces' warnings for std::array in tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337808 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-24 03:41:36 +00:00
Marshall Clow
fbd3e84fa1 Implement <span>. Reviewed as https://reviews.llvm.org/D49338
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337804 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-24 03:01:02 +00:00
Marshall Clow
9765ed0367 Fix a couple of 'unused variable' warnings in a vector test. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337016 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-13 16:26:16 +00:00
Stephan T. Lavavej
9165f9d181 [libcxx] [test] Strip trailing whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@334676 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-14 00:12:20 +00:00
Eric Fiselier
d54a86893f Fix test failures after r334053.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@334056 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-06 00:13:49 +00:00
Eric Fiselier
301518c94e Fix PR37694 - std::vector doesn't correctly move construct allocators.
C++2a[container.requirements.general]p8 states that when move constructing
a container, the allocator is move constructed. Vector previously copy
constructed these allocators. This patch fixes that bug.

Additionally it cleans up some unnecessary allocator conversions
when copy constructing containers. Libc++ uses
__internal_allocator_traits::select_on_copy_construction to select
the correct allocator during copy construction, but it unnecessarily
converted the resulting allocator to the user specified allocator
type and back. After this patch list and forward_list no longer
do that.

Technically we're supposed to be using allocator_traits<allocator_type>::select_on_copy_construction,
but that should seemingly be addressed as a separate patch, if at all.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@334053 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-05 22:32:52 +00:00
JF Bastien
e4063adf19 Mark deduction guide tests as failing on apple-clang-9
As discussed here: http://lists.llvm.org/pipermail/cfe-dev/2018-May/058116.html
The tests fail on clang-5, as well as apple-clang-9. Mark them as such.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@333479 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29 23:28:04 +00:00
Marshall Clow
d1e11a1a6f Fix up the final bits of breakage due to clang v5 generating bad implicit template deduction guides - specifically for copy-ctors
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@333381 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-28 19:20:21 +00:00
Marshall Clow
afdadcd893 Mark the template deduction tests as UNSUPPORTED on clang 5, because it deduces the wrong type.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@333376 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-28 15:42:47 +00:00
JF Bastien
3dfc68d12a Fix array deduction guide test breakage
No matching constructor

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@333315 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-25 21:17:43 +00:00