Commit Graph

4605 Commits

Author SHA1 Message Date
Marshall Clow 655c4695cf Implement P0777: Treating unnecessay decay
llvm-svn: 324398
2018-02-06 20:56:55 +00:00
Nico Weber 6ef990e9ce Fix building libc++ with the macOS 10.13 SDK with -mmacosx-version-min=10.12 or lower.
The 10.13 SDK always defines utimensat() (with an availability(macosx=10.13) annotation)
and unconditionally defines UTIME_OMIT, so use the compile-time availability macros
on Apple platforms instead.

For people statically linking libc++, it might make sense to also provide an opt-in
option for using __builtin_available() to dynamically check for the OS version,
but for now let's do the smallest thing needed to unbreak the build.

Based on a patch by Eric Fiselier <eric@efcs.ca>: https://reviews.llvm.org/D34249
Fixes PR33469.

llvm-svn: 324385
2018-02-06 19:17:41 +00:00
Marshall Clow f951fc399f Fix misleading indentation; replace a couple of NULLs with nullptr. Resolves https://reviews.llvm.org/D42945 ; thanks to Bruce Mitchener for the patch.
llvm-svn: 324378
2018-02-06 18:58:05 +00:00
Marshall Clow cefa05d39f No, really this time mark 3034 as 'Patch Ready'
llvm-svn: 324312
2018-02-06 03:24:21 +00:00
Marshall Clow 4d170c801b Mark issue 3034 as 'Patch Ready'
llvm-svn: 324310
2018-02-06 03:23:16 +00:00
Nirav Dave 936ff58476 Revert "[libc++] Fix PR35491 - std::array of zero-size doesn't work with non-default constructible types."
Revert "Fix initialization of array<const T, 0> with GCC."
Revert "Make array<const T, 0> non-CopyAssignable and make swap and fill ill-formed."

This reverts commit r324182, r324185, and r324194 which were causing issues with zero-length std::arrays.

llvm-svn: 324309
2018-02-06 03:03:37 +00:00
Marshall Clow 0fc039df1e More patches ready
llvm-svn: 324307
2018-02-06 01:59:28 +00:00
Marshall Clow 50dd98cb2b Add issues in 'Review'
llvm-svn: 324292
2018-02-05 23:50:49 +00:00
Marshall Clow 372d4183cb Remove <experimental/string_view>; use <string_view> instead. See https://libcxx.llvm.org/TS_deprecation.html
llvm-svn: 324290
2018-02-05 23:43:34 +00:00
Eric Fiselier c6b3c7bb63 Fix initialization of array<const T, 0> with GCC.
Previously, when handling zero-sized array of const objects we
used a const version of aligned_storage_t, which is not an array type.
However, GCC complains about initialization of the form: array<const T, 0> arr = {};

This patch fixes that bug by making the dummy object used to represent
the zero-sized array an array itself. This avoids GCC's complaints
about the uninitialized const member.

llvm-svn: 324194
2018-02-04 08:02:35 +00:00
Eric Fiselier 4f0c85310d Mark LWG 3014 as complete. No code changes needed
llvm-svn: 324193
2018-02-04 07:37:09 +00:00
Eric Fiselier e3690ba586 Implement LWG 3014 - Fix more noexcept issues in filesystem.
This patch removes the noexcept declaration from filesystem
operations which require creating temporary paths or
creating a directory iterator. Either of these operations
can throw.

llvm-svn: 324192
2018-02-04 07:35:36 +00:00
Eric Fiselier 309f8b1168 Mark LWG 3013 as already complete. See r316941
llvm-svn: 324191
2018-02-04 07:29:53 +00:00
Eric Fiselier b96def4eb1 Remove debug println from rec.dir.itr.increment test
llvm-svn: 324190
2018-02-04 03:26:55 +00:00
Eric Fiselier be71d336bd Implement LWG2989: path's streaming operators allow everything under the sun.
Because path can be constructed from a ton of different types, including string
and wide strings, this caused it's streaming operators to suck up all sorts
of silly types via silly conversions. For example:

using namespace std::experimental::filesystem::v1;
std::wstring w(L"wide");
std::cout << w; // converts to path.

This patch tentatively adopts the resolution to LWG2989 and fixes the issue
by making the streaming operators friends of path.

llvm-svn: 324189
2018-02-04 03:10:53 +00:00
Eric Fiselier 21f2004991 Mark issue 2851 as complete
llvm-svn: 324188
2018-02-04 02:45:33 +00:00
Eric Fiselier 0f8c8f59df 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.

llvm-svn: 324187
2018-02-04 02:43:32 +00:00
Eric Fiselier e1c661f344 correct comment about C++03 assignment operators
llvm-svn: 324186
2018-02-04 02:22:33 +00:00
Eric Fiselier 192622dc49 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.

llvm-svn: 324185
2018-02-04 02:17:02 +00:00
Eric Fiselier afeda5c251 [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

llvm-svn: 324182
2018-02-04 01:03:08 +00:00
Eric Fiselier f892166a1d Work around GCC constexpr initialization bug
llvm-svn: 324165
2018-02-03 01:48:21 +00:00
Eric Fiselier 9b5ff7a6bc 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.

llvm-svn: 324164
2018-02-03 01:45:35 +00:00
Eric Fiselier bfbafa541a 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.

llvm-svn: 324153
2018-02-02 22:39:59 +00:00
Richard Smith c7ef5656ff Disable test in C++<11 mode due to use of alignas.
llvm-svn: 324033
2018-02-01 23:31:22 +00:00
Richard Smith 4e3195c9b3 Make std::get_temporary_buffer respect overaligned types when possible
Patch by Chris Kennelly!

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

llvm-svn: 324020
2018-02-01 22:24:45 +00:00
Marshall Clow b87adec4bd Put the exception classes for experimental::optional and experimental::any back in the dylib for binary compatibility
llvm-svn: 323989
2018-02-01 18:45:57 +00:00
Marshall Clow 14082fcc42 Remove std::experimental::sample; use std::sample instead. See https://libcxx.llvm.org/TS_deprecation.html
llvm-svn: 323979
2018-02-01 16:36:08 +00:00
Marshall Clow 91af9048b2 Remove <experimental/numeric>; use <numeric> instead. See https://libcxx.llvm.org/TS_deprecation.html
llvm-svn: 323975
2018-02-01 15:49:27 +00:00
Marshall Clow 5d8babe30d Remove <experimental/any>; use <any> instead. See https://libcxx.llvm.org/TS_deprecation.html
llvm-svn: 323972
2018-02-01 15:21:14 +00:00
Marshall Clow 040533215a Remove <experimental/optional>; use <optional> instead. See https://libcxx.llvm.org/TS_deprecation.html
llvm-svn: 323971
2018-02-01 14:54:25 +00:00
Marshall Clow 1a6493b4e0 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.
llvm-svn: 323945
2018-02-01 03:55:27 +00:00
Marshall Clow 0551d83ed5 Implement LWG2870: Default value of parameter theta of polar should be dependent
llvm-svn: 323918
2018-01-31 21:42:39 +00:00
Marshall Clow 9eb338c42e Add LWG3051
llvm-svn: 323822
2018-01-30 21:49:17 +00:00
Marshall Clow d0eb3092ac First cut at issue statuses for JAX
llvm-svn: 323720
2018-01-30 00:48:39 +00:00
Marshall Clow aafb3151a8 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
llvm-svn: 323719
2018-01-30 00:47:43 +00:00
Marshall Clow 6f73cf45df Minor updated to the main libcxx page; add a link to the deprecation page
llvm-svn: 323694
2018-01-29 21:28:46 +00:00
Don Hinton 88434fe05f LLVM_FOUND isn't always set, so just test if llvm_setup_rpath() is
available instead.

llvm-svn: 323599
2018-01-27 18:55:30 +00:00
Peter Collingbourne 939b16233b 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

llvm-svn: 323563
2018-01-26 21:23:27 +00:00
Don Hinton d21aeffc86 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

llvm-svn: 323492
2018-01-26 01:34:51 +00:00
Peter Collingbourne 1634c15e3c 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

llvm-svn: 323491
2018-01-26 01:22:17 +00:00
Peter Collingbourne 0aa71a4f86 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

llvm-svn: 323490
2018-01-26 01:19:23 +00:00
Marshall Clow 8abbc96c18 Mark 2903 as complete; we already do this
llvm-svn: 323479
2018-01-25 22:33:17 +00:00
Don Hinton 7e9453d583 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

llvm-svn: 323459
2018-01-25 19:22:23 +00:00
Don Hinton 7b4be6f9d8 [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

llvm-svn: 323453
2018-01-25 18:13:26 +00:00
Eric Fiselier d053b59730 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.

llvm-svn: 323390
2018-01-25 00:02:48 +00:00
Eric Fiselier b1539e0a0d Fix missing return in __tuple_leaf::__can_bind_reference when __reference_binds_to_temporary added in r323380.
llvm-svn: 323389
2018-01-24 23:10:02 +00:00
Marshall Clow e34f5ffe4b Implement LWG2783: stack::emplace() and queue::emplace() should return decltype(auto)
llvm-svn: 323385
2018-01-24 22:42:25 +00:00
Eric Fiselier 292617e700 [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

llvm-svn: 323380
2018-01-24 22:14:01 +00:00
Mikhail Maltsev 48c63d879b [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

llvm-svn: 323322
2018-01-24 12:45:18 +00:00
Marshall Clow ae21466138 include <cstdint> to get uint32_t
llvm-svn: 323306
2018-01-24 05:38:51 +00:00
Peter Collingbourne fcac3c9642 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

llvm-svn: 323300
2018-01-24 04:30:19 +00:00
Marshall Clow a277d024f7 Implement P0463R1: 'Endian just Endian'. Reviewed as https://reviews.llvm.org/D35472
llvm-svn: 323296
2018-01-24 01:53:24 +00:00
Peter Collingbourne 2f97aab6ea 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

llvm-svn: 323237
2018-01-23 18:53:33 +00:00
Don Hinton 66ddb50e44 [cmake] Always respect existing CMAKE_REQUIRED_FLAGS when adding additional ones.
* Previously part of https://reviews.llvm.org/D41622.

llvm-svn: 323171
2018-01-23 03:30:23 +00:00
Peter Collingbourne 4801624ee3 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

llvm-svn: 323170
2018-01-23 02:07:27 +00:00
Peter Collingbourne ac15ae6d6b 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

llvm-svn: 323169
2018-01-23 01:59:43 +00:00
Marshall Clow d161ac9ea6 Update cxx2a status
llvm-svn: 323160
2018-01-22 23:17:20 +00:00
Marshall Clow 8da1a487ae Last batch of P0202 constexpr additions: includes/set_intersection/exchange
llvm-svn: 323159
2018-01-22 23:10:40 +00:00
Marshall Clow e8ea8296fc 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
llvm-svn: 323152
2018-01-22 21:43:04 +00:00
Marshall Clow 1b9a4ffd6b Still more P0202 constexpr-ifying. This batch is: for_each/for_each_n/lexicographical_compare
llvm-svn: 323147
2018-01-22 20:44:33 +00:00
Don Hinton 98bb420559 [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

llvm-svn: 323143
2018-01-22 19:26:38 +00:00
Marshall Clow cbe768ec69 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.
llvm-svn: 323137
2018-01-22 18:38:18 +00:00
Marshall Clow ac471d6db2 Really comment out the constexpr tests.
llvm-svn: 323072
2018-01-22 01:51:49 +00:00
Marshall Clow 785ae3e8c0 Change a static_assert to check for is_trivial instead of is_pod, as is mandated by P0767.
llvm-svn: 323071
2018-01-22 00:17:48 +00:00
Marshall Clow 85642c2bea implement (but leave commented out) the constexpr tests from P0202 for std::merge. merge requires std::copy, which isn't constexpr yet.
llvm-svn: 323070
2018-01-22 00:11:44 +00:00
Marshall Clow 4bfb9313c1 More P0202 constexpr work. This commit adds fill/fill_n/generate/generate_n/unique/unique_copy. I removed a specialization of fill_n that recognized when we were dealing with raw pointers and 1 byte trivially-assignable types and did a memset, because the compiler will do that optimization for us.
llvm-svn: 323050
2018-01-20 20:14:32 +00:00
Marshall Clow 12c7423ff9 More P0202 constexpr-ifying in <algorithm>. This commit handles replace/replace_if/replace_copy/replace_copy_if.
llvm-svn: 322975
2018-01-19 18:07:29 +00:00
Marshall Clow 99894b61ba More P0202 constexpr-ifying in <algorithm>. This commit handles 'transform'.
llvm-svn: 322970
2018-01-19 17:45:39 +00:00
Marshall Clow c6b908d0bb Wrote my own version of is_permutation; that was dominating the timings
llvm-svn: 322920
2018-01-19 03:17:45 +00:00
Marshall Clow 1885052589 Add memory tracking
llvm-svn: 322872
2018-01-18 18:37:11 +00:00
Marshall Clow a9bf43b1fe Use high_resolution_clock instead of steady_clock. Also now builds with gcc 7.2 (for comparison purposes)
llvm-svn: 322864
2018-01-18 17:01:34 +00:00
Marshall Clow 4f0de28c77 A simple program for testing OSS-Fuzz test cases locally.
llvm-svn: 322863
2018-01-18 16:52:19 +00:00
Eric Fiselier 1903976d37 Update Google Benchmark library
llvm-svn: 322812
2018-01-18 04:23:01 +00:00
Eric Fiselier decf22e50f Fix most GCC test failures.
This patch fixes almost all currently failing tests when
using GCC ToT.

The specific changes are:

(A) Workaround gcc.gnu.org/PR83921 which rejects variables w/o initializers
in constexpr contexts -- even when the variable is an empty class. This
bug has been worked around at all callsites by adding an initializer.
Additionally a new test, constexpr_init.pass.cpp, has been added to
test that Clang doesn't suffer from these bugs.

(B) Fix streambuf.assign/swap.pass.cpp. This test was never actually
calling the swap method as intended. In fact, the swap function it
intended to call was ill-formed when instantiated. GCC diagnosed
this ill-formedness w/o needing an instantiation.

(C) size_delete11.pass.cpp was fixed by adding c++2a to the list of
unsupported dialects.

llvm-svn: 322810
2018-01-18 03:41:06 +00:00
Peter Collingbourne 5e27cce467 libcxx: Define set_unexpected, _get_unexpected and __uncaught_exceptions without dllimport.
It turns out that the MSVC headers define these functions without
dllimport even when compiling with /MD. This change fixes the resulting
compile-time error.

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

llvm-svn: 322794
2018-01-18 00:33:35 +00:00
Eric Fiselier 6b3e48b46a Fix nodiscard failure tests on compilers w/o -verify.
Previously .fail.cpp tests for nodiscard were run with -Wunused-result
being a warning, not an error, when the compiler didn't support -verify.

When -verify isn't enabled this change judiciously adds -Werror=unused-result
when to only the failure tests containing the // expected-error string for nodiscard.

As a drive-by change, this patch also adds a missing // UNSUPPORTED: c++2a to
a test which was only supposed to run in C++ <= 11.

llvm-svn: 322776
2018-01-17 22:48:09 +00:00
Peter Collingbourne b89956c812 libcxx: Disable CFI in function std::get_temporary_buffer.
The specification of this function mandates a cast to uninitialized
T*, which is forbidden under CFI.

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

llvm-svn: 322744
2018-01-17 19:32:35 +00:00
Peter Collingbourne 4bdb80faf2 libcxx: Stop using private MSVC macros in the exception implementation.
Inline the provided "fallback" definitions (which seem to always be
taken) that expand to __cdecl into users. The fallback definitions
for the *CRTIMP* macros were wrong in the case where the CRT is being
linked statically, so define our own macro as a replacement.

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

llvm-svn: 322617
2018-01-17 04:37:04 +00:00
Marshall Clow 12f0a77902 More constexpr algorithms from P0202. search/search_n
llvm-svn: 322566
2018-01-16 15:48:27 +00:00
Marshall Clow a58bdf9f69 Change an internal table of constants for the poisson distribution from
type 'result_type' to 'double'. The only thing that we ever do with
these numbers is to promote them to 'double' and use them in a division.
For small result_types, the values were getting truncated, skewing the
results. Thanks to James Nagurne for the suggestion.

llvm-svn: 322556
2018-01-16 14:54:36 +00:00
Marshall Clow d57c03ddca More constexpr algorithms from P0202: lower_bound, upper_bound, equal_range, binary_search
llvm-svn: 322529
2018-01-16 02:34:41 +00:00
Marshall Clow a38c495f22 Actually CALL the constexpr tests.
llvm-svn: 322528
2018-01-16 02:11:13 +00:00
Marshall Clow 6538e28d5d More constexpr (re P0202) - equal and mismatch
llvm-svn: 322527
2018-01-16 02:04:10 +00:00
Marshall Clow da97ec6c10 Fix constexpr failure on C++11-based buildbots.
llvm-svn: 322507
2018-01-15 19:59:09 +00:00
Marshall Clow 056f15e3c5 More constexpr from P0202. count and count_if. Also fix a comment that Morwenn noted.
llvm-svn: 322506
2018-01-15 19:40:34 +00:00
Marshall Clow 404ee020f0 Some of the tests from earlier today had 'int' as the return type when it should have been 'bool'. Fix that. It doesn't change the behavior of any of the tests, but it's more accurate.
llvm-svn: 322505
2018-01-15 19:32:32 +00:00
Marshall Clow 8694428e36 More P0202 constexpr-ifying. All the find_XXX algorithms in this commit.
llvm-svn: 322504
2018-01-15 19:26:05 +00:00
Marshall Clow 674f9128b7 partition_point gets the P0202 treatment
llvm-svn: 322493
2018-01-15 17:53:34 +00:00
Marshall Clow 706ffef713 More constexpr algorithms from P0202. any_of/all_of/none_of.
llvm-svn: 322492
2018-01-15 17:20:36 +00:00
Marshall Clow 49c7643c39 First part of P0202: Adding constexpr modifiers to functions in <algorithm> and <utility>. This commit is all the is_XXX algorithms.
llvm-svn: 322489
2018-01-15 16:16:32 +00:00
Ekaterina Vaartis b848122b5e Add error code handling to remove_all test
As mentioned by EricWF in revision D41830

llvm-svn: 322351
2018-01-12 05:02:06 +00:00
Volodymyr Sapsai a051024cac [libcxx] Make std::basic_istream::get 0-terminate input array in case of error.
It covers the cases when the sentry object returns false and when an exception
was thrown. Corresponding standard paragraph is C++14 [istream.unformatted]p9:
  [...] In any case, if n is greater than zero it then stores a null
  character into the next successive location of the array.

rdar://problem/35566567

Reviewers: EricWF, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 322326
2018-01-11 23:23:49 +00:00
Marshall Clow 0e22bf8cb9 Implement an _is_allocator type trait for use in deduction guides.
llvm-svn: 322306
2018-01-11 19:36:22 +00:00
Marshall Clow 31163f629b Fix some too-big local arrays. Thanks to dcdillon for the patch. Reviewed as D28217
llvm-svn: 322295
2018-01-11 17:16:52 +00:00
Ekaterina Vaartis e44cbaf704 Make std::experimental::filesystem::remove and remove_all return false or 0 if the file doesn't exist
Differential Revision: https://reviews.llvm.org/D41830

llvm-svn: 322293
2018-01-11 17:04:29 +00:00
Peter Collingbourne 4566d827a1 libcxx: Stop providing a definition of __GLIBC_PREREQ.
An application may determine whether the C standard library is glibc
by testing whether __GLIBC_PREREQ is defined. This breaks if libc++
provides its own definition. Instead, define our own macro in our
namespace with the desired semantics.

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

llvm-svn: 322201
2018-01-10 18:16:58 +00:00
Marshall Clow 6b40646bec Fix misspelled macro name - thanks to andrew@ispras.ru for the catch
llvm-svn: 322196
2018-01-10 16:25:04 +00:00
Stephan T. Lavavej 04576cc060 [libcxx] [test] Improve MSVC portability.
test/support/msvc_stdlib_force_include.hpp
When testing MSVC's STL with C1XX, simulate a couple more compiler feature-test macros.

When testing MSVC's STL, simulate a few library feature-test macros.

test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp
The vector_size attribute is a non-Standard extension that's supported by Clang and GCC,
but not C1XX. Therefore, guard this with `__has_attribute(vector_size)`.

Additionally, while these tests pass when MSVC's STL is compiled with Clang,
I don't consider this to be a supported scenario for our library,
so also guard this with defined(_LIBCPP_VERSION).

test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
N4713 23.14.10 [func.not_fn]/1 depicts only `call_wrapper(call_wrapper&&) = default;`
and `call_wrapper(const call_wrapper&) = default;`. According to
15.8.2 [class.copy.assign]/2 and /4, this makes call_wrapper non-assignable.
Therefore, guard the assignability tests as libc++ specific.

Add a (void) cast to tolerate not_fn() being marked as nodiscard.

Fixes D41213.

llvm-svn: 322144
2018-01-10 00:39:46 +00:00
Petr Hosek 0f03c79b6d [libcxx] Support the use of compiler-rt in lit tests
Don't link tests against libgcc when compiler-rt is being used.

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

llvm-svn: 322044
2018-01-08 23:36:53 +00:00
Dan Albert 553b09b515 Revert "Make rehash(0) work with ubsan's unsigned-integer-overflow."
Seems to have broken some tests since I first wrote this a while
back. Will reland after checking what went wrong with the tests.

This reverts commit 7023194c8d11a081fd01ed25308b3d60193c6a06.

llvm-svn: 322039
2018-01-08 22:57:12 +00:00