Commit Graph

4673 Commits

Author SHA1 Message Date
Eric Fiselier 19aae8fe2f Make filesystem tests generic between experimental and std versions.
As I move towards implementing std::filesystem, there is a need to
make the existing tests run against both the std and experimental versions.
Additionally, it's helpful to allow running the tests against other
implementations of filesystem.

This patch converts the test to easily target either. First, it
adds a filesystem_include.hpp header which is soley responsible
for selecting and including the correct implementation. Second,
it converts existing tests to use this header instead of including
filesystem directly.

llvm-svn: 328475
2018-03-26 05:46:57 +00:00
Eric Fiselier 98acdde59a avoid new/delete ellision in construct.pass.cpp
llvm-svn: 328445
2018-03-25 03:00:42 +00:00
Eric Fiselier cd5e6a35bf Partially Revert "Workaround GCC bug PR78489 - SFINAE order is not respected."
This partially reverts commit r328261. The GCC bug has been fixed in
trunk and has never existed in a released version. Therefore the changes
to variant are unneeded.

However, the additional tests have been left in place.

llvm-svn: 328388
2018-03-23 23:42:30 +00:00
Eric Fiselier 561e75738b Add temporary printouts to test to help debug failures.
Some debian libc++ bots started having failures in the locale
tests due to what I assume is a change in the locale data for fr_FR
in glibc.

This change prints the actual value from the test to help debugging.
It should be reverted once the bots cycle.

llvm-svn: 328268
2018-03-22 23:14:20 +00:00
Eric Fiselier 5bdf02f4fc Avoid Clang error about throwing _LIBCPP_ASSERT in noexcept function.
This fixes a couple of tests which produced a warning that a 'throw'
occurred in a noexcept function (by way of _LIBCPP_ASSERT). It does
so by hiding the 'throw' across an opaque function boundary.

This fix isn't ideal, since we still have _LIBCPP_ASSERT's in functions
marked noexcept -- and this problem should be addressed in the future.
However, throwing _LIBCPP_ASSERT is really only meant to allow testing
of the assertions, and is not yet ready for general use.

llvm-svn: 328265
2018-03-22 23:01:08 +00:00
Stephan T. Lavavej d0eba7f2a5 [libcxx] [test] Strip trailing whitespace. NFC.
llvm-svn: 328264
2018-03-22 22:59:02 +00:00
Eric Fiselier a595456731 Workaround GCC bug PR78489 - SFINAE order is not respected.
This patch works around variant test failures which are new to
GCC 8. GCC 8 either doesn't perform SFINAE in lexical order, or
it doesn't halt after encountering the first failure. This
causes hard error to occur instead of substitution failure.

See gcc.gnu.org/PR78489

llvm-svn: 328261
2018-03-22 22:32:55 +00:00
Eric Fiselier 107d6d6845 Use DoNotOptimize to prevent new/delete elision.
The new/delete tests, in particular those which test replacement
functions, often fail when the optimizer is enabled because the
calls to new/delete may be optimized away, regardless of their side-effects.

This patch converts the tests to use DoNotOptimize in order to prevent
the elision.

llvm-svn: 328245
2018-03-22 21:28:09 +00:00
Eric Fiselier 6f14127eed Un-XFAIL a test under new GCC version; the GCC bug has been fixed
llvm-svn: 328229
2018-03-22 19:18:08 +00:00
Marshall Clow a4122be549 Fix improperly failing test - and the code it was testing. Thanks to Stephan Lavavej for the catch.
llvm-svn: 328225
2018-03-22 18:27:28 +00:00
Eric Fiselier 843a3caa71 commit temporary workaround for new Clang exception warning
llvm-svn: 328186
2018-03-22 07:53:47 +00:00
Eric Fiselier 5d4624983d Correct TEST_HAS_NO_ALIGNED_ALLOCATION macro definition
llvm-svn: 328185
2018-03-22 06:21:07 +00:00
Eric Fiselier deb7e4e009 Fix dynarray test failures after changing __libcpp_allocate/deallocate
llvm-svn: 328182
2018-03-22 05:44:48 +00:00
Eric Fiselier f2918d1c24 Fix PR22634 - std::allocator doesn't respect over-aligned types.
This patch fixes std::allocator, and more specifically, all users
of __libcpp_allocate and __libcpp_deallocate, to support over-aligned
types.

__libcpp_allocate/deallocate now take an alignment parameter, and when
the specified alignment is greater than that supported by malloc/new,
the aligned version of operator new is called (assuming it's available).

When aligned new isn't available, the old behavior has been kept, and the
alignment parameter is ignored.

This patch depends on recent changes to __builtin_operator_new/delete which
allow them to be used to call any regular new/delete operator. By using
__builtin_operator_new/delete when possible, the new/delete erasure optimization
is maintained.

llvm-svn: 328180
2018-03-22 04:42:56 +00:00
Marshall Clow 4a6f3c4710 Implement LWG3034: P0767R1 breaks previously-standard-layout types
llvm-svn: 328064
2018-03-21 00:36:05 +00:00
Marshall Clow e0742c4abf Implement LWG3035: std::allocator's constructors should be constexpr.
llvm-svn: 328059
2018-03-20 23:02:53 +00:00
Marshall Clow 69f1072ba2 Implement LWG 3039 and 3041 - 'Treating Unnecessary decay'.
llvm-svn: 328054
2018-03-20 22:37:37 +00:00
Marshall Clow c8faf3a93c Updated C++2a status with changes from Jacksonville WG21 meeting
llvm-svn: 327806
2018-03-18 19:29:21 +00:00
Mike Edwards 8e94aeb5f8 [libcxx][test] Adding apple-clang-9 to UNSUPPORTED in iter_alloc_deduction.fail.cpp.
After two failed attempts last week to make this work I am
going back to a known good method of making this test pass on
macOS...adding the current apple-clang version to the
UNSUPPORTED list.

During a previous patch review (https://reviews.llvm.org/D44103)
it was suggested to just XFAIL libcpp-no-deduction-guides
as was done to iter_alloc_deduction.pass.cpp. However
this caused a an unexpected pass on:
http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc-tot-latest-std/builds/214

I then attempted to just mark libcpp-no-deduction-guides
as UNSUPPORTED, however this caused an additional bot
failure.  So I reverted everything (https://reviews.llvm.org/rCXX327191).

To solve this and get work unblocked I am adding
apple-clang-9 to the original UNSUPPORTED list.

llvm-svn: 327304
2018-03-12 18:06:37 +00:00
Petr Hosek aaabea0636 [CMake] Copy the generated __config header into build directory
When the generated __config file is being used, it is currently only
copied during installation process. However, that means that the file
that gets copied into LLVM build directory is the vanilla __config file,
and any parts of the build that depend on the just built toolchain like
sanitizers will get that instead of the generated version. To avoid this
issue, we need to copy the generated header into the LLVM build
directory as well.

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

llvm-svn: 327194
2018-03-10 01:20:11 +00:00
Mike Edwards b9abf3d299 [libcxx][test] Reverting r327178 and r327190.
Reverting changes made to iter_alloc_deduction.fail.cpp
as my changes seem to be making several Linux bots angry.

llvm-svn: 327191
2018-03-10 00:53:05 +00:00
Mike Edwards 231e19ce52 [libcxx][test] Marking libcpp-no-deduction-guides unsupported.
This fixes linux bot failures with r327178.

llvm-svn: 327190
2018-03-10 00:19:25 +00:00
Mike Edwards d0f595d77c XFAIL: libcpp-no-deduction-guides in libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp
Summary: Refactor the previous version method of marking each apple-clang version as UNSUPPORTED and just XFAIL'ing the libcpp-no-deduction-guides instead.  This brings this test inline with the same style as iter_alloc_deduction.pass.cpp

Reviewers: EricWF, dexonsmith

Reviewed By: EricWF

Subscribers: EricWF, vsapsai, vsk, cfe-commits

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

llvm-svn: 327178
2018-03-09 22:13:12 +00:00
Vedant Kumar fb36d079e5 Low-hanging fruit optimization in string::__move_assign().
shrink_to_fit() ends up doing a lot work to get information that we
already know since we just called clear(). This change seems concise
enough to be worth the couple extra lines and my benchmarks show that it
is indeed a pretty decent win. It looks like the same thing is going on
twice in __copy_assign_alloc(), but I didn't want to go overboard since
this is my first contribution to llvm/libc++.

Patch by Timothy VanSlyke!

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

llvm-svn: 327064
2018-03-08 21:15:26 +00:00
Marshall Clow 6d1aec1260 Implement LWG#2518 - Non-member swap for propagate_const should call member swap
llvm-svn: 327005
2018-03-08 15:01:50 +00:00
Marshall Clow 4fe52c7178 Include <system_error> since we use it. Thanks to Andrey Maksimov for the catch.
llvm-svn: 326958
2018-03-07 22:51:16 +00:00
Marshall Clow a9daa969c1 One more test for P0767:
llvm-svn: 326802
2018-03-06 15:01:55 +00:00
Marshall Clow 042f07eed8 Implement P0767R1 - Deprecate POD
llvm-svn: 326801
2018-03-06 15:01:19 +00:00
Marshall Clow aadaabe649 Added P0805 to the list of ready bits
llvm-svn: 326485
2018-03-01 21:16:07 +00:00
Volodymyr Sapsai ff9595a002 [libcxx] Fix last_write_time test for filesystems that don't support very small times.
APFS minimum supported file write time is -2^63 nanoseconds, which doesn't go
as far as `file_time_type::min()` that is equal to -2^63 microseconds on macOS.

This change doesn't affect filesystems that support `file_time_type` range only
for in-memory file time representation but not for on-disk representation. Such
filesystems are considered as `SupportsMinTime`.

rdar://problem/35865151

Reviewers: EricWF, Hahnfeld

Subscribers: jkorous-apple, mclow.lists, cfe-commits, christof

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

llvm-svn: 326383
2018-02-28 23:27:40 +00:00
Stephan T. Lavavej c1fcd97ede [libcxx] [test] Fix MSVC warnings and errors.
test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp
test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp
test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp
test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp
test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp
test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp
test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp
test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp
Fix MSVC x64 truncation warnings.
warning C4267: conversion from 'size_t' to 'int', possible loss of data

test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
Fix MSVC uninitialized memory warning.
warning C6001: Using uninitialized memory 'vl'.

test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp
Include <cassert> for the assert() macro.

Fixes D43273.

llvm-svn: 326120
2018-02-26 20:47:46 +00:00
Logan Chien 2b772b930e Cleanup __config indention NFC
This commit indents each level by two space characters, e.g.

#if defined(CONDITION)
#  define _LIBCPP_NAME VALUE
#else
#  define _LIBCPP_NAME VALUE
#endif

The simple #ifndef, #define, and #endif sequences are not indented, e.g.

#ifndef _LIBCPP_NAME
#define _LIBCPP_NAME ...
#endif

llvm-svn: 326027
2018-02-24 07:57:32 +00:00
Alexander Richardson 504d23551e Allow passing additional compiler/linker flags for the tests
Summary:
These flags can be specified using the CMake variables
LIBCXX_TEST_LINKER_FLAGS and LIBCXX_TEST_COMPILER_FLAGS.
When building the tests for CHERI I need to pass additional
flags (such as -mabi=n64 or -mabi=purecap) to the compiler
for our test configurations

Reviewers: EricWF

Reviewed By: EricWF

Subscribers: christof, mgorny, cfe-commits

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

llvm-svn: 325914
2018-02-23 15:19:48 +00:00
Mikhail Maltsev 61ccaf6ddd [libcxx] Do not include the C math.h header before __config
Summary:
Certain C libraries require configuration macros defined in __config
to provide the correct functionality for libc++. This patch ensures
that the C header math.h is always included after the __config
header. It also adds a Windows-specific #if guard for the case when
the C math.h file is included the second time, as suggested by
Marshall in https://reviews.llvm.org/rL323490.

Fixes PR36382.

Reviewers: mclow.lists, EricWF

Reviewed By: mclow.lists

Subscribers: cfe-commits, pcc, christof, rogfer01

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

llvm-svn: 325760
2018-02-22 09:34:08 +00:00
Marshall Clow 3c83937370 Add another test case to the deduction guide for basic_string.
llvm-svn: 325740
2018-02-22 05:14:20 +00:00
Peter Collingbourne 2a129dc31b libcxx: Unbreak external thread library configuration.
Differential Revision: https://reviews.llvm.org/D42503

llvm-svn: 325723
2018-02-21 21:36:18 +00:00
Mikhail Maltsev 477b5f688c [libcxx] Improve accuracy of complex asinh and acosh
Summary:
Currently std::asinh and std::acosh use std::pow to compute x^2. This
results in a significant error when computing e.g. asinh(i) or
acosh(-1).

This patch expresses x^2 directly via x.real() and x.imag(), like it
is done in libstdc++/glibc, and adds tests that checks the accuracy.

Reviewers: EricWF, mclow.lists

Reviewed By: mclow.lists

Subscribers: christof, cfe-commits

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

llvm-svn: 325510
2018-02-19 15:41:36 +00:00
Eric Fiselier 9491643c4b Fix test failure on compilers w/o deduction guides
llvm-svn: 325205
2018-02-15 02:41:19 +00:00
Marshall Clow 36c4862a37 Add a catch for std::length_error for the case where the string can't handle 2GB. (like say 32-bit big-endian)
llvm-svn: 325147
2018-02-14 18:05:25 +00:00
Bruce Mitchener 56f6352354 Fix incorrect indentation.
Reviewers: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 325087
2018-02-14 00:29:38 +00:00
Dimitry Andric 267e0f4d5f Make the ctype_byname::widen test cases pass on FreeBSD.
llvm-svn: 325028
2018-02-13 17:43:24 +00:00
Dimitry Andric 1b1b80f45f Put type attributes after class keyword
Summary:
Compiling `<functional>` in C++17 or higher mode results in:

```
functional:2500:1: warning: attribute '__visibility__' is ignored, place it after "class" to apply attribute to type declaration [-Wignored-attributes]
_LIBCPP_TYPE_VIS
^
__config:701:46: note: expanded from macro '_LIBCPP_TYPE_VIS'
#    define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
                                             ^
1 warning generated.
```

Fix it by putting the attribute after the `class` keyword.

Reviewers: EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: cfe-commits

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

llvm-svn: 325027
2018-02-13 17:40:59 +00:00
Bruce Mitchener f684c9c83c Fix typos.
Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 324989
2018-02-13 08:12:00 +00:00
Stephan T. Lavavej 6b1ae9b854 [libcxx] [test] Strip trailing whitespace, NFC.
llvm-svn: 324959
2018-02-12 22:54:35 +00:00
Marshall Clow 5012793e05 Implement LWG 2835 - fix <tgmath.h>
llvm-svn: 324923
2018-02-12 19:13:24 +00:00
Marshall Clow c0db07299e Implement LWG#2908 - The less-than operator for shared pointers could do more, and mark 2878 as complete as well (we already do that)
llvm-svn: 324911
2018-02-12 17:26:40 +00:00
Marshall Clow 8ea7ede725 While implementing P0777 - preventing unnecessary decay, I found some non-public uses of decay that could be replaced by __uncvref. NFC intented
llvm-svn: 324895
2018-02-12 15:41:25 +00:00
Dimitry Andric 35479ffb12 Add default C++ ABI libname and include paths for FreeBSD
Summary:
As noted in a discussion about testing the LLVM 6.0.0 release candidates
(with libc++) for FreeBSD, many tests turned out to fail with
"exception_ptr not yet implemented".  This was because libc++ did not
choose the correct C++ ABI library, and therefore it fell back to the
`exception_fallback.ipp` header.

Since FreeBSD 10.x, we have been using libcxxrt as our C++ ABI library,
and its headers have always been installed in /usr/include/c++/v1,
together with the (system) libc++ headers.  (Older versions of FreeBSD
used GNU libsupc++ by default, but these are now unsupported.)

Therefore, if we are building libc++ for FreeBSD, set:
* `LIBCXX_CXX_ABI_LIBNAME` to "libcxxrt"
* `LIBCXX_CXX_ABI_INCLUDE_PATHS` to "/usr/include/c++/v1"
by default.

Reviewers: emaste, EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: mgorny, cfe-commits, krytarowski

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

llvm-svn: 324855
2018-02-11 22:31:05 +00:00
Eric Fiselier 2328c589f1 Fix libcxx MSVC C++17 redefinition of 'align_val_t'
Patch from 	charlieio@outlook.com

Reviewed as https://reviews.llvm.org/D42354

When the following command is used:

> clang-cl -std:c++17 -Iinclude\c++\v1 hello.cc c++.lib

An error occurred:

In file included from hello.cc:1:
In file included from include\c++\v1\iostream:38:
In file included from include\c++\v1\ios:216:
In file included from include\c++\v1\__locale:15:
In file included from include\c++\v1\string:477:
In file included from include\c++\v1\string_view:176:
In file included from include\c++\v1\__string:56:
In file included from include\c++\v1\algorithm:643:
In file included from include\c++\v1\memory:656:
include\c++\v1\new(165,29):  error: redefinition of 'align_val_t'
enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };
                            ^
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\vcruntime_new.h(43,16):  note:
      previous definition is here
    enum class align_val_t : size_t {};
               ^
1 error generated.
vcruntime_new.h has defined align_val_t, libcxx need hide align_val_t.

This patch fixes that error.

llvm-svn: 324853
2018-02-11 22:00:19 +00:00
Eric Fiselier 6808a59244 Mark two issues as complete
llvm-svn: 324852
2018-02-11 21:57:25 +00:00
Marshall Clow 026b75f209 Fix a typo in the synopsis comment. NFC. Thanks to K-ballo for the catch
llvm-svn: 324851
2018-02-11 21:51:49 +00:00
Eric Fiselier 9bfdb770cc Use multi-key tree search for {map, set}::{count, equal_range}
Patch from ngolovliov@gmail.com
Reviewed as: https://reviews.llvm.org/D42344

As described in llvm.org/PR30959, the current
implementation of std::{map, key}::{count, equal_range} in libcxx is
non-conforming. Quoting the C++14 standard [associative.reqmts]p3

> The phrase “equivalence of keys” means the equivalence relation imposed by
> the comparison and not the operator== on keys. That is, two keys k1 and k2 are
> considered to be equivalent if for the comparison object comp,
> comp(k1, k2) == false && comp(k2, k1) == false.

In the same section, the requirements table states the following:

> a.equal_range(k) equivalent to make_pair(a.lower_bound(k), a.upper_bound(k))
> a.count(k) returns the number of elements with key equivalent to k

The behaviour of libstdc++ seems to conform to the standard here.

llvm-svn: 324799
2018-02-10 02:53:47 +00:00
Marshall Clow 7f7891c427 The apple versions of clang don't support deduction guides yet.
llvm-svn: 324640
2018-02-08 19:33:03 +00:00
Marshall Clow 6aafc8b308 Once more, with feeling. Spell 'clang-4.0' correctly this time
llvm-svn: 324624
2018-02-08 17:06:08 +00:00
Marshall Clow 2a81d30471 Clean up string's deduction guides tests. Mark old versions of clang as unsupported, b/c they don't have deduction guides, even in C++17 mode
llvm-svn: 324619
2018-02-08 16:25:57 +00:00
Marshall Clow 2583976e81 Update the status of removed components
llvm-svn: 324609
2018-02-08 14:51:22 +00:00
Mikhail Maltsev 2b20304def [libcxx] Avoid spurious construction of valarray elements
Summary:
Currently libc++ implements some operations on valarray by using the
resize method. This method has a parameter with a default value.
Because of this, valarray may spuriously construct and destruct
objects of valarray's element type.
    
This patch fixes this issue and adds corresponding test cases.


Reviewers: EricWF, mclow.lists

Reviewed By: mclow.lists

Subscribers: rogfer01, cfe-commits

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

llvm-svn: 324596
2018-02-08 11:33:48 +00:00
Marshall Clow b0c4bb74a8 Temporarily comment out deduction guide tests while I figure out what to do with old bots
llvm-svn: 324573
2018-02-08 07:20:45 +00:00
Marshall Clow 6d9f750dec Implement deduction guide for basic_string as described in P0433
llvm-svn: 324569
2018-02-08 06:34:03 +00:00
Marshall Clow a217e505c3 Improve a test. NFC
llvm-svn: 324566
2018-02-08 05:47:40 +00:00
Eric Fiselier 1a78ae3c89 Fix size and alignment of array<T, 0>.
An array T[1] isn't necessarily the same say when it's
a member of a struct. This patch addresses that problem and corrects
the tests to deal with it.

llvm-svn: 324545
2018-02-07 23:50:25 +00:00
Dan Albert 9bc04e98c5 Stop using __strtonum_fallback on Android.
Fallback implementations are now provided by bionic when necessary,
which these may conflict with.

llvm-svn: 324534
2018-02-07 21:58:48 +00:00
Marshall Clow fc940277cb Fix PR#31454 - 'basic_string<T>::push_back() crashes if sizeof(T)>sizeof(long long)'. We were mishandling the small-string optimization calculations for very large 'characters'. This may be an ABI change (change the size of) strings of very large 'characters', but since they never worked, I'm not too concerned.
llvm-svn: 324531
2018-02-07 21:30:17 +00:00
Eric Fiselier ebf8a0985f Fix -verify static assert messages for older Clang versions
llvm-svn: 324529
2018-02-07 21:25:25 +00:00
Eric Fiselier 59cdf90ac8 [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: 324526
2018-02-07 21:06:13 +00:00
Marshall Clow 1d4546c0ad Comment on 'Review' issues
llvm-svn: 324503
2018-02-07 19:24:37 +00:00
Marshall Clow a3d37f0716 Remove more of the std::experimental bits that are now in std::. All the _v type aliases, conjunction/disjunction, apply, etc. See https://libcxx.llvm.org/TS_deprecation.html
llvm-svn: 324423
2018-02-06 23:13:48 +00:00
Marshall Clow f9ab87e9cc Mark P0777 as complete
llvm-svn: 324399
2018-02-06 21:00:58 +00:00
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