Commit Graph

4550 Commits

Author SHA1 Message Date
Eric Fiselier
cc7688a719 Mark issue 2851 as complete
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324188 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-04 02:45:33 +00:00
Eric Fiselier
af1fd7c75f Address LWG 2849 and fix missing failure condition in copy_file.
Previously copy_file didn't handle the case where the input and
output were the same file.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324187 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-04 02:43:32 +00:00
Eric Fiselier
7d251c57ac correct comment about C++03 assignment operators
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324186 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-04 02:22:33 +00:00
Eric Fiselier
122c064a76 Make array<const T, 0> non-CopyAssignable and make swap and fill ill-formed.
The standard isn't exactly clear how std::array should handle zero-sized arrays
with const element types. In particular W.R.T. copy assignment, swap, and fill.

This patch takes the position that those operations should be ill-formed,
and makes changes to libc++ to make it so.

This follows up on commit r324182.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324185 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-04 02:17:02 +00:00
Eric Fiselier
f3224ac007 [libc++] Fix PR35491 - std::array of zero-size doesn't work with non-default constructible types.
Summary:
This patch fixes llvm.org/PR35491 and LWG2157  (https://cplusplus.github.io/LWG/issue2157)

The fix attempts to maintain ABI compatibility by replacing the array with a instance of `aligned_storage`.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: lichray, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324182 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-04 01:03:08 +00:00
Eric Fiselier
b173b26b9e Work around GCC constexpr initialization bug
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324165 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-03 01:48:21 +00:00
Eric Fiselier
b232793189 Work around Clang bug introduced in r324062
When Clang encounters an already invalid class declaration, it can
emit incorrect diagnostics about the exception specification on
some of its members. This patch temporarily works around that
incorrect diagnostic.

The clang bug was introduced in r324062.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324164 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-03 01:45:35 +00:00
Eric Fiselier
d33aaa939c Fix has_unique_object_representation after Clang commit r324134.
Clang previously reported an empty union as having a unique object
representation. This was incorrect and was fixed in a recent Clang commit.

This patch fixes the libc++ tests.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324153 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-02 22:39:59 +00:00
Richard Smith
b2189c01fa Disable test in C++<11 mode due to use of alignas.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324033 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-01 23:31:22 +00:00
Richard Smith
dfb1351077 Make std::get_temporary_buffer respect overaligned types when possible
Patch by Chris Kennelly!

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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324020 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-01 22:24:45 +00:00
Marshall Clow
fd34566e5a Put the exception classes for experimental::optional and experimental::any back in the dylib for binary compatibility
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323989 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-01 18:45:57 +00:00
Marshall Clow
b21316f66c Remove std::experimental::sample; use std::sample instead. See https://libcxx.llvm.org/TS_deprecation.html
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323979 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-01 16:36:08 +00:00
Marshall Clow
14698bce22 Remove <experimental/numeric>; use <numeric> instead. See https://libcxx.llvm.org/TS_deprecation.html
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323975 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-01 15:49:27 +00:00
Marshall Clow
f8d223fe63 Remove <experimental/any>; use <any> instead. See https://libcxx.llvm.org/TS_deprecation.html
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323972 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-01 15:21:14 +00:00
Marshall Clow
95db3d2871 Remove <experimental/optional>; use <optional> instead. See https://libcxx.llvm.org/TS_deprecation.html
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323971 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-01 14:54:25 +00:00
Marshall Clow
75075c6be0 Add static_asserts to basic_ios and basic_stream_buf to ensure that that the traits match the character type. This is a requirement on the user - now we get consistent failures at compile time instead of incomprehensible error messages or runtime failures. This is also LWG#2994 - not yet adopted.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323945 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-01 03:55:27 +00:00
Marshall Clow
37e4c9b159 Implement LWG2870: Default value of parameter theta of polar should be dependent
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323918 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-31 21:42:39 +00:00
Marshall Clow
65c4c248c2 Add LWG3051
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323822 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-30 21:49:17 +00:00
Marshall Clow
64aa1c1b75 First cut at issue statuses for JAX
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323720 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-30 00:48:39 +00:00
Marshall Clow
4bbcce7ef8 Add tests to make sure that <string_view> provides std::size/data/empty in C++17 mode. This is LWG#3009, coming up for a vote in JAX - but we already do it, just don't have tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323719 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-30 00:47:43 +00:00
Marshall Clow
6f79a901d1 Minor updated to the main libcxx page; add a link to the deprecation page
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323694 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-29 21:28:46 +00:00
Don Hinton
1dfee5b4d4 LLVM_FOUND isn't always set, so just test if llvm_setup_rpath() is
available instead.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323599 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-27 18:55:30 +00:00
Peter Collingbourne
27c341db41 Fix the BinaryPredicate form of std::is_permutation to not rely on operator==
According to [1], forms 2 and 4 of std::is_permutation should use the passed in
binary predicate to compare elements. operator== should only be used for forms
1 and 3 which do not take a binary predicate.

This CL fixes forms 2 and 4 which relied on operator== for some comparisons.

[1] http://en.cppreference.com/w/cpp/algorithm/is_permutation

Patch by Thomas Anderson!

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323563 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-26 21:23:27 +00:00
Don Hinton
44aacb7850 Reland: [cmake] [libcxx] Call llvm_setup_rpath() when adding shared libraries.
Clang and llvm already use llvm_setup_rpath(), so this change will
help standarize rpath usage across all projects.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323492 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-26 01:34:51 +00:00
Peter Collingbourne
2b64fcb946 libcxx: Use vcruntime declarations for typeinfo on Windows.
We need to use the vcruntime declarations on Windows to avoid an
ODR violation involving rtti.obj, which provides the definition of
the runtime function implementing dynamic_cast and depends on the
vcruntime implementations of bad_cast and bad_typeid.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323491 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-26 01:22:17 +00:00
Peter Collingbourne
6b5c08ab34 libcxx: Move #include_next <math.h> out of header guard in wrapper header.
Code on Windows expects to be able to do:

 #define _USE_MATH_DEFINES
 #include <math.h>

and receive the definitions of mathematical constants, even if <math.h>
has previously been included. To support this scenario, re-include
<math.h> every time the wrapper header is included.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323490 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-26 01:19:23 +00:00
Marshall Clow
e686a8dec0 Mark 2903 as complete; we already do this
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323479 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-25 22:33:17 +00:00
Don Hinton
e0c8dbec38 Revert [libcxx] r323453 - [cmake] [libcxx] Call llvm_setup_rpath() when adding shared libraries.
Shoaib Meenai pointed out this will break standalone builds when built without llvm.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323459 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-25 19:22:23 +00:00
Don Hinton
102b0a11f0 [cmake] [libcxx] Call llvm_setup_rpath() when adding shared libraries.
Clang and llvm already use llvm_setup_rpath(), so this change will
help standarize rpath usage across all projects.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323453 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-25 18:13:26 +00:00
Eric Fiselier
8864da5e78 Fix PR35564 - std::list splice/erase incorrectly throw in debug mode.
There was a bug in the implementation of splice where the container
sizes were updated before decrementing one of the iterators. Afterwards,
the result of decrementing the iterator was flagged as UB by the debug
implementation because the container was reported to be empty.

This patch fixes that bug by delaying the updating of the container
sizes until after the iterators have been correctly constructed.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323390 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-25 00:02:48 +00:00
Eric Fiselier
8592d0abce Fix missing return in __tuple_leaf::__can_bind_reference when __reference_binds_to_temporary added in r323380.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323389 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-24 23:10:02 +00:00
Marshall Clow
cc7048888e Implement LWG2783: stack::emplace() and queue::emplace() should return decltype(auto)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323385 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-24 22:42:25 +00:00
Eric Fiselier
8286acce44 [libc++] Fix PR20855 -- libc++ incorrectly diagnoses illegal reference binding in std::tuple.
Summary:
See https://bugs.llvm.org/show_bug.cgi?id=20855

Libc++ goes out of it's way to diagnose `std::tuple` constructions which are UB due to lifetime bugs caused by reference creation. For example:

```
// The 'const std::string&' is created *inside* the tuple constructor, and its lifetime is over before the end of the constructor call.
std::tuple<int, const std::string&> t(std::make_tuple(42, "abc"));
```

However, we are over-aggressive and we incorrectly diagnose cases such as:

```
void foo(std::tuple<int const&, int const&> const&);
foo(std::make_tuple(42, 42));
```

This patch fixes the incorrectly diagnosed cases, as well as converting the diagnostic to use the newly added Clang trait `__reference_binds_to_temporary`. The new trait allows us to diagnose cases we previously couldn't such as:

```
std::tuple<int, const std::string&> t(42, "abc");
```

Reviewers: rsmith, mclow.lists

Reviewed By: rsmith

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323380 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-24 22:14:01 +00:00
Mikhail Maltsev
e54a22f809 [libcxx] Correctly handle invalid regex character class names
Summary:
Currently when a regular expression contains an invalid character
class name std::regex constructors throw an std::regex_error with
std::regex_constants::error_brack code.

This patch changes the code to std::regex_constants::error_ctype and
adds a test.

Reviewers: EricWF, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323322 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-24 12:45:18 +00:00
Marshall Clow
a351d793ab include <cstdint> to get uint32_t
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323306 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-24 05:38:51 +00:00
Peter Collingbourne
1cadd88562 libcxx: Allow auto-linking to be disabled with a macro.
Some users may have a custom build system which gives a different
name to the libc++ archive (or does not create an archive at all,
instead passing the object files directly to the linker). Give those
users a way to disable auto-linking.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323300 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-24 04:30:19 +00:00
Marshall Clow
a11e68f83b Implement P0463R1: 'Endian just Endian'. Reviewed as https://reviews.llvm.org/D35472
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323296 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-24 01:53:24 +00:00
Peter Collingbourne
087c5abbe4 libcxx: Rename vasprintf function to __libcpp_vasprintf.
The language standard does not define a function with this name,
so it is part of the user's namespace. This change fixes a duplicate
symbol error that occurs when a user attempts to define a function
with this name.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323237 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-23 18:53:33 +00:00
Don Hinton
c0a476159d [cmake] Always respect existing CMAKE_REQUIRED_FLAGS when adding additional ones.
* Previously part of https://reviews.llvm.org/D41622.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323171 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-23 03:30:23 +00:00
Peter Collingbourne
f493c2fed6 libcxx: Provide overloads for basic_filebuf::open() et al that take wchar_t* filenames on Windows.
This is an MSVC standard library extension. It seems like a reasonable
enough extension to me because wchar_t* is the native format for
filenames on that platform.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323170 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-23 02:07:27 +00:00
Peter Collingbourne
59f2389874 libcxx: Move Windows threading support into a .cpp file.
This allows us to avoid polluting the namespace of users of <thread>
with the definitions in windows.h.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323169 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-23 01:59:43 +00:00
Marshall Clow
e2341acabb Update cxx2a status
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323160 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-22 23:17:20 +00:00
Marshall Clow
5b12e3bdb4 Last batch of P0202 constexpr additions: includes/set_intersection/exchange
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323159 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-22 23:10:40 +00:00
Marshall Clow
63be4189d8 Another batch of P0202 constepr algirithms. remove/remove_if/remove_copy/remove_copy_if/reverse_copy, and tests (commented out) for rotate_copy, because that depends on std::copy
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323152 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-22 21:43:04 +00:00
Marshall Clow
a15161a030 Still more P0202 constexpr-ifying. This batch is: for_each/for_each_n/lexicographical_compare
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323147 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-22 20:44:33 +00:00
Don Hinton
65d4ee3df0 [cmake] [libcxx] Fix find_path() problems when cross compiling.
When CMAKE_SYSROOT or CMAKE_FIND_ROOT_PATH is set, cmake
recommends setting CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
globally which means find_path() always prepends CMAKE_SYSROOT or
CMAKE_FIND_ROOT_PATH to all paths used in the search.

However, this find_path() invocation is looking for a path in the
libcxxabi project on the host system, not the target system,
which can be done by passing NO_CMAKE_FIND_ROOT_PATH.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323143 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-22 19:26:38 +00:00
Marshall Clow
c84b496981 Add (commented out) constexpr tests for copy/copy_backwards/copy_if/copy_n. These will be enabled when that part of P0202 is implemented. NFC at this time.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323137 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-22 18:38:18 +00:00
Marshall Clow
27ae75c894 Really comment out the constexpr tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323072 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-22 01:51:49 +00:00
Marshall Clow
46ea17ee62 Change a static_assert to check for is_trivial instead of is_pod, as is mandated by P0767.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323071 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-22 00:17:48 +00:00
Marshall Clow
f7e345ab81 implement (but leave commented out) the constexpr tests from P0202 for std::merge. merge requires std::copy, which isn't constexpr yet.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323070 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-22 00:11:44 +00:00