Commit Graph

4861 Commits

Author SHA1 Message Date
Mike Edwards
057ac7c9da 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327178 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-09 22:13:12 +00:00
Vedant Kumar
2b588cbf15 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327064 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-08 21:15:26 +00:00
Marshall Clow
46b8a51b49 Implement LWG#2518 - Non-member swap for propagate_const should call member swap
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327005 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-08 15:01:50 +00:00
Marshall Clow
66c652fe08 Include <system_error> since we use it. Thanks to Andrey Maksimov for the catch.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326958 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-07 22:51:16 +00:00
Marshall Clow
c80697556a One more test for P0767:
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326802 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-06 15:01:55 +00:00
Marshall Clow
06ac7cdfc7 Implement P0767R1 - Deprecate POD
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326801 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-06 15:01:19 +00:00
Marshall Clow
f31b30dc55 Added P0805 to the list of ready bits
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326485 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-01 21:16:07 +00:00
Volodymyr Sapsai
04dd960ff3 [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



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326383 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-28 23:27:40 +00:00
Stephan T. Lavavej
76c246434a [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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326120 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-26 20:47:46 +00:00
Logan Chien
7102892bf3 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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326027 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-24 07:57:32 +00:00
Alexander Richardson
9880456e8d 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325914 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-23 15:19:48 +00:00
Mikhail Maltsev
df7a35ce32 [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325760 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-22 09:34:08 +00:00
Marshall Clow
2c893111fc Add another test case to the deduction guide for basic_string.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325740 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-22 05:14:20 +00:00
Peter Collingbourne
61494b519c libcxx: Unbreak external thread library configuration.
Differential Revision: https://reviews.llvm.org/D42503

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325723 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-21 21:36:18 +00:00
Mikhail Maltsev
c4658abe60 [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325510 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-19 15:41:36 +00:00
Eric Fiselier
6878e852d1 Fix test failure on compilers w/o deduction guides
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325205 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-15 02:41:19 +00:00
Marshall Clow
078dd9752d Add a catch for std::length_error for the case where the string can't handle 2GB. (like say 32-bit big-endian)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325147 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-14 18:05:25 +00:00
Bruce Mitchener
26a02748eb Fix incorrect indentation.
Reviewers: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325087 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-14 00:29:38 +00:00
Dimitry Andric
e64dcb66c0 Make the ctype_byname::widen test cases pass on FreeBSD.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325028 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 17:43:24 +00:00
Dimitry Andric
52474820e4 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325027 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 17:40:59 +00:00
Bruce Mitchener
e89a34f66a Fix typos.
Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324989 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 08:12:00 +00:00
Stephan T. Lavavej
a2b7665eb2 [libcxx] [test] Strip trailing whitespace, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324959 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 22:54:35 +00:00
Marshall Clow
806a6ec645 Implement LWG 2835 - fix <tgmath.h>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324923 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 19:13:24 +00:00
Marshall Clow
f72f21907c Implement LWG#2908 - The less-than operator for shared pointers could do more, and mark 2878 as complete as well (we already do that)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324911 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 17:26:40 +00:00
Marshall Clow
b8cb776511 While implementing P0777 - preventing unnecessary decay, I found some non-public uses of decay that could be replaced by __uncvref. NFC intented
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324895 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 15:41:25 +00:00
Dimitry Andric
524afaedd1 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324855 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-11 22:31:05 +00:00
Eric Fiselier
22a291c94e 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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324853 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-11 22:00:19 +00:00
Eric Fiselier
0fc3d1264c Mark two issues as complete
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324852 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-11 21:57:25 +00:00
Marshall Clow
a8de063568 Fix a typo in the synopsis comment. NFC. Thanks to K-ballo for the catch
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324851 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-11 21:51:49 +00:00
Eric Fiselier
9e6ac074ee 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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324799 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-10 02:53:47 +00:00
Marshall Clow
5bfbd7dacc The apple versions of clang don't support deduction guides yet.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324640 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 19:33:03 +00:00
Marshall Clow
88ba9758ff Once more, with feeling. Spell 'clang-4.0' correctly this time
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324624 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 17:06:08 +00:00
Marshall Clow
0eec3e8b24 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
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324619 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 16:25:57 +00:00
Marshall Clow
1a2caf573f Update the status of removed components
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324609 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 14:51:22 +00:00
Mikhail Maltsev
171ed2198d [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324596 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 11:33:48 +00:00
Marshall Clow
4c153004af Temporarily comment out deduction guide tests while I figure out what to do with old bots
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324573 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 07:20:45 +00:00
Marshall Clow
5b1e87e52d Implement deduction guide for basic_string as described in P0433
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324569 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 06:34:03 +00:00
Marshall Clow
60020e6384 Improve a test. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324566 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 05:47:40 +00:00
Eric Fiselier
c0acd34e9a 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324545 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-07 23:50:25 +00:00
Dan Albert
73660f725a Stop using __strtonum_fallback on Android.
Fallback implementations are now provided by bionic when necessary,
which these may conflict with.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324534 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-07 21:58:48 +00:00
Marshall Clow
088e6015b2 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324531 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-07 21:30:17 +00:00
Eric Fiselier
2e1fa09f68 Fix -verify static assert messages for older Clang versions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324529 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-07 21:25:25 +00:00
Eric Fiselier
6cb35ede81 [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@324526 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-07 21:06:13 +00:00
Marshall Clow
f003d63c40 Comment on 'Review' issues
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324503 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-07 19:24:37 +00:00
Marshall Clow
31810d9c0b 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
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324423 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-06 23:13:48 +00:00
Marshall Clow
c387931db5 Mark P0777 as complete
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324399 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-06 21:00:58 +00:00
Marshall Clow
52f9ca28a3 Implement P0777: Treating unnecessay decay
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324398 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-06 20:56:55 +00:00
Nico Weber
68b20ca4d9 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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324385 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-06 19:17:41 +00:00
Marshall Clow
f477af5fda Fix misleading indentation; replace a couple of NULLs with nullptr. Resolves https://reviews.llvm.org/D42945 ; thanks to Bruce Mitchener for the patch.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324378 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-06 18:58:05 +00:00
Marshall Clow
46c8ec503e No, really this time mark 3034 as 'Patch Ready'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324312 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-06 03:24:21 +00:00