Commit Graph

676 Commits

Author SHA1 Message Date
Nico Weber
4ef3309d94 libcxx: Rename last two .hpp files in libcxx to .h
Differential Revision: https://reviews.llvm.org/D66544

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369597 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-21 22:38:38 +00:00
Nico Weber
28db4445e2 libcxx: Rename .hpp files in libcxx/test/support to .h
LLVM uses .h as its extension for header files.

Files renamed using:

    for f in libcxx/test/support/*.hpp; do git mv $f ${f%.hpp}.h; done

References to the files updated using:

    for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do
        a=$(basename $f);
        echo $a;
        rg -l $a libcxx | xargs sed -i '' "s/$a/${a%.hpp}.h/";
    done

HPP include guards updated manually using:

    for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do
      echo ${f%.hpp}.h ;
    done | xargs mvim

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369481 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-21 00:14:12 +00:00
Louis Dionne
4a3529492c [libc++] Implement LWG 3199
Summary:
The resolution of LWG 3199 makes sure that input-streaming into an empty bitset
does not set the failbit on the input stream.

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369422 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 18:21:06 +00:00
Louis Dionne
460deb67be [libc++] Precise XFAIL for AppleClang 11
This test doesn't fail on all patch levels of AppleClang 11

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369420 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 18:05:06 +00:00
Louis Dionne
534d2b1146 [libc++] Disable <chrono> ""d and ""y literal tests on AppleClang 10.0.0
In r368882, I enabled those tests for all AppleClang's above version 9.
However, it turns out that the feature is only supported starting with
AppleClang 10.0.1, not AppleClang 10.0.0. This commit fixes that hole.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369409 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 16:45:27 +00:00
Louis Dionne
c4fdc11d3a [libc++] Add XFAIL for is_base_of test on AppleClang 11
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369280 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-19 17:29:42 +00:00
Louis Dionne
5e6dc8fc98 [libc++] Mark <chrono> test as unsupported on AppleClang 9
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368914 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-14 20:27:56 +00:00
Louis Dionne
6dbf2b76ac [libc++] Mark std::tuple CTAD test as failing on AppleClang 9
Like CTAD for std::unordered_set, AppleClang 9's support for CTAD is
insufficient. I suspect the corresponding LLVM Clang is broken too,
but we don't seem to have testers using that Clang.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368911 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-14 20:17:18 +00:00
Louis Dionne
c31d5a4ef3 [libc++] Enable <chrono> ""d and ""y literals for AppleClang 10 and up
AppleClang supports those literals starting in version 10.0.1.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368882 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-14 17:04:31 +00:00
Louis Dionne
72109f5b3e [libc++] Mark two <chrono> tests as unsupported on AppleClang 11
The operator""y and operator""d will eventually be supported by
AppleClang, but no released version supports them at the moment.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368749 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-13 21:34:49 +00:00
Louis Dionne
77764d9c0b [libc++] Implement CTAD for std::tuple
Summary:
We were using implicit deduction guides instead of explicit ones,
however the implicit ones don't do work anymore when changing the
constructors.

This commit adds the actual guides specified in the Standard to make
libc++ (1) closer to the Standard and (2) more resistent to changes
in std::tuple's constructors.

Reviewers: Quuxplusone

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368599 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-12 18:30:31 +00:00
Marshall Clow
a6ac321f01 Implement hh_mm_ss from P1466R3. Reviewed as https://reviews.llvm.org/D65365.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368299 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-08 14:36:07 +00:00
Eric Fiselier
b255afb4ac Fix tests with modules enabled
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@367268 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-29 22:48:51 +00:00
Marshall Clow
4bd3f7d588 Fix a bug in std::chrono::abs where it would fail when the duration's period had not been reduced.s
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@367120 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-26 15:10:46 +00:00
Marshall Clow
ce2a5ab4c4 Implement change #4 of P1466: Change weekday to accept both 0 and 7 as Sunday. Add accessors 'c_encoding' and 'iso_encoding' to provide different interpretations of the weekday. Remove 'operator unsigned'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@366981 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-25 03:26:05 +00:00
Marshall Clow
fb20aaa0a0 Implement most of P1612R1: Relocate endian. Moves the std::endian functionality from 'type-traits' to 'bit'. No other change. The reason that this is 'partial' is that P1621 also recommends a feature-test macro, but I don't have the value for that one yet. In a month or so, I'll add that
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@366776 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-23 04:20:19 +00:00
Louis Dionne
56bc01df8f [libc++] Add C++17 deduction guides for std::function
Summary: http://llvm.org/PR39606

Reviewers: Quuxplusone

Subscribers: christof, dexonsmith, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@366484 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-18 19:50:56 +00:00
Eric Fiselier
3996cfb482 Add test for variant construction with duplicate types.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@366032 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-14 20:59:51 +00:00
Eric Fiselier
d13b2c9c44 Harden variant test added in r366022
The test was brittle since it only went boom for one specific type, when
really it should go boom for all of them.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@366025 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-14 18:30:34 +00:00
Eric Fiselier
301501fb78 Avoid eager template instantiation caused by the variant narrowing checks.
The standard disallows narrowing conversions when constructing a variant.
This is checked by attempting to perform braced initialization of the
destination type from the argument type. However, braced initialization
can force the compiler (mostly clang) to eagerly instantiate the
constructors of the destintation type -- which can lead to errors in
a non-immediate context.

However, as variant is currently specified, the narrowing checks only
observably apply when the destination type is arithmetic. Meaning we can
skip the check for class types. Hense avoiding the hard errors.

In order to cause fewer build breakages, this patch avoids the narrowing
check except when the destination type is arithmetic.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@366022 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-14 18:21:15 +00:00
Eric Fiselier
478bb094b5 Fix non-conformance it std::tuple.
Previously we implemented all one trillion tuple-like constructors using
a single generic overload. This worked fairly well, except that it
differed in behavior from the standard version because it didn't
consider both T&& and T const&. This was observable for certain
types.

This patch addresses that issue by splitting the generic constructor
in two. We now provide both T&& and T const& versions of the
tuple-like constructors (sort of).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@365973 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-12 23:01:48 +00:00
Eric Fiselier
6f5ab14489 Add option to disable variant narrowing conversion changes.
The paper P0608R3 - "A sane variant converting constructor" disallows
narrowing conversions in variant. It was meant to address this
surprising problem:

  std::variant<std::string, bool> v = "abc";
  assert(v.index() == 1); // constructs a bool.

However, it also disables every potentially narrowing conversion. For
example:

  variant<unsigned> v = 0; // ill-formed
  variant<string, double> v2 = 42; // ill-formed (int -> double narrows)

These latter changes break code. A lot of code. Within Google it broke
on the order of a hundred thousand target with thousands of root causes
responsible for the breakages.

Of the breakages related to the narrowing restrictions, none of them
exposed outstanding bugs. However, the breakages caused by boolean
conversions (~13 root causes), all but one of them were bugs.

For this reasons, I am adding a flag to disable the narrowing conversion
changes but not the boolean conversions one.

One purpose of this flag is to allow users to opt-out of breaking changes
in variant until the offending code can be cleaned up. For non-trivial
variant usages the amount of cleanup may be significant.

This flag is also required to support automated tooling, such as
clang-tidy, that can automatically fix code broken by this change.
In order for clang-tidy to know the correct alternative to construct,
it must know what alternative was being constructed previously, which
means running it over the old version of std::variant.

Because this change breaks so much code, I will be implementing the
aforementioned clang-tidy check in the very near future.

Additionally I'm plan present this new information to the committee so they can
re-consider if this is a breaking change we want to make.

I think libc++ should very seriously consider pulling this change
before the 9.0 release branch is cut. But that's a separate discussion
that I will start on the lists.

For now this is the minimal first step.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@365960 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-12 21:32:11 +00:00
Zoe Carver
5625778f5c This patch makes swap functions constexpr. Both swap overloads, swap_ranges and iter_swap are updated (with tests).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@365238 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-05 20:13:34 +00:00
Eric Fiselier
78af2bfb2f Fix tuple's conditionally explicit constructors for very weird user
types.

It seems some people like to write types that can explicitly convert
to anything, but cannot be used to explicitly construct anything.

This patch makes tuple tolerate such types, as is required
by the standard.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@365074 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-03 19:21:40 +00:00
Eric Fiselier
b87e5f52af Ensure bitset's string constructor doesn't poison the overload set.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@364842 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-01 19:59:34 +00:00
Marshall Clow
7779ab4a2d Add a missing '__uncvref_t' to the SFINAE constraints for optional's assignment operator. Fixes PR38638. Thanks to Jonathan Wakely for the report
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@364574 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-27 18:40:55 +00:00
Richard Smith
8b2d46d8a2 Fix test failures due to modified wording in Clang diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@364241 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-24 22:01:03 +00:00
Richard Smith
caf3bc5596 Fix test failures when using a custom ABI namespace.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@364239 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-24 21:46:05 +00:00
Eric Fiselier
20f2ecc862 Use C++11 implementation of unique_ptr in C++03.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@364161 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-23 20:47:21 +00:00
Marshall Clow
52f76364dc Implement P0340R3: Make 'underlying_type' SFINAE-friendly. Reviewed as https://reviews.llvm.org/D63574
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@364094 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-21 18:57:06 +00:00
Eric Fiselier
59c47a9425 Use rvalue references throughout the is_constructible traits.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@364065 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-21 15:35:33 +00:00
Eric Fiselier
3f10018902 Make move and forward work in C++03.
These functions are key to allowing the use of rvalues and variadics
in C++03 mode. Everything works the same as in C++11, except for one
tangentially related case:

struct T {
  T(T &&) = default;
};

In C++11, T has a deleted copy constructor. But in C++03 Clang gives
it both a move and a copy constructor. This seems reasonable enough
given the extensions it's using.

The other changes in this patch were the minimal set required
to keep the tests passing after the move/forward change. Most notably
the removal of the `__rv<unique_ptr>` hack that was present
in an attempt to make unique_ptr move only without language support.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@364063 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-21 15:20:55 +00:00
Eric Fiselier
3d80477aa2 Enable aligned_union in C++03
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@364058 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-21 14:45:08 +00:00
Eric Fiselier
3cb5e8693b Get is_convertible tests passing in C++03 (except the fallback).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@364057 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-21 14:43:15 +00:00
Eric Fiselier
b62bdff2b5 Make rvalue metaprogramming traits work in C++03.
The next step is to get move and forward working in C++03.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@364053 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-21 14:31:34 +00:00
Zhihao Yuan
b0473a5282 [libc++] Recommit r363692 to implement P0608R3
Re-apply the change which was reverted in r363764 as-is after
breakages being resolved.  Thanks Eric Fiselier for working
hard on this.

See also: https://bugs.llvm.org/show_bug.cgi?id=42330

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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@363993 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-20 22:09:40 +00:00
Zhihao Yuan
1d7f21ea6f [libc++] Revert r363692 which implements P0608R3
The change caused a large number of compiler failures in
Google's codebase.  People need time to evaluate the impact.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@363764 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-19 07:11:08 +00:00
Zhihao Yuan
f8f62ac93c [libc++] Implement P0608R3 - A sane variant converting constructor
Summary:
Prefer user-defined conversions over narrowing conversions and conversions to bool.

References:
 http://wg21.link/p0608

Reviewers: EricWF, mpark, mclow.lists

Reviewed By: mclow.lists

Subscribers: zoecarver, ldionne, libcxx-commits, cfe-commits, christof

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@363692 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-18 15:26:50 +00:00
Louis Dionne
8ea6252cec [libc++] Re-apply XFAIL to is_base_of test that was inadvertently reverted
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@363689 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-18 15:01:59 +00:00
Louis Dionne
11aae354b9 [libc++] Revert the addition of map/multimap CTAD
This was found to be broken on Clang trunk. This is a revert of the
following commits (the subsequent commits added XFAILs to the tests
that were missing from the original submission):

    r362986: Implement deduction guides for map/multimap.
    r363014: Add some XFAILs
    r363097: Add more XFAILs
    r363197: Add even more XFAILs

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@363688 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-18 14:40:15 +00:00
Marshall Clow
a5a011702c Add tests for LWG 3206. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@363589 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-17 18:06:30 +00:00
Eric Fiselier
704a388bb7 Move libc++ specific tests for std::function out of the std directory
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@363111 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-11 22:59:53 +00:00
Marshall Clow
88b46e4a16 XFAIL a couple of tests on apple-clang-9.1, which is a compiler that I didn't know existed
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@363097 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-11 20:14:07 +00:00
Marshall Clow
dbcfe75325 Add a test for is_base_of and incomplete types. Because this trait uses a compiler intrinsic which was broken in many clangs, have lots of XFAILs.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@363029 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-11 03:38:29 +00:00
Zhihao Yuan
5a466fcca7 [libc++] Fix leading zeros in std::to_chars
Summary:
It is a bugfix proposal for https://bugs.llvm.org/show_bug.cgi?id=42166.

`std::to_chars` appends leading zeros if input 64-bit value has 9, 10 or 11 digits.
According to documentation `std::to_chars` must not append leading zeros:
https://en.cppreference.com/w/cpp/utility/to_chars

Changeset should not affect `std::to_chars` performance:
http://quick-bench.com/CEpRs14xxA9WLvkXFtaJ3TWOVAg

Unit test that `std::from_chars` supports compatibility for both `std::to_chars` outputs (previous and fixed one) already exists:
1f60111b59/test/std/utilities/charconv/charconv.from.chars/integral.pass.cpp (L63)

Reviewers: lichray, mclow.lists, ldionne, EricWF

Reviewed By: lichray, mclow.lists

Subscribers: zoecarver, christof, dexonsmith, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@362967 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-10 17:11:46 +00:00
Eric Fiselier
5db0997bf6 Fix some incorrect std::function tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@362861 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-08 00:45:45 +00:00
Louis Dionne
0a3564fc0b [libcxx][test] Include test_workarounds.h where needed
Some tests require `TEST_WORKAROUND_CONSTEXPR_IMPLIES_NOEXCEPT`, but they
did not include the header that defines that macro.

Thanks to Michael Park for the patch.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@362660 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-05 21:54:34 +00:00
Marshall Clow
b6e011b18b Add include for 'test_macros.h' to all the tests that were missing them. Thanks to Zoe for the (big, but simple) patch. NFC intended.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@362252 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-31 18:35:30 +00:00
Marshall Clow
7cfbabcb84 Improve the test coverage for std::is_base_of
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@360911 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-16 15:56:26 +00:00
Marshall Clow
61ca0bbf14 Add a test for LWG#3204 and mark it as complete. Reviewed as https://reviews.llvm.org/D61829 Thanks to Zoe for the patch.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@360586 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-13 14:56:02 +00:00