Commit Graph

676 Commits

Author SHA1 Message Date
Marshall Clow
43d7c79aae Selectively import timespec_get into namespace std, since some C libraries don't have it. Reviewed as https://reviews.llvm.org/D50799
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339816 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 21:19:08 +00:00
Volodymyr Sapsai
6699cd385e [libcxx] Mark charconv tests as failing for previous libcxx versions.
<charconv> was added in r338479. Previous libcxx versions don't have
this functionality and corresponding tests should be failing.

Reviewers: mclow.lists, ldionne, EricWF

Reviewed By: ldionne

Subscribers: christof, dexonsmith, lichray, EricWF, cfe-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339451 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-10 17:03:47 +00:00
Billy Robert O'Neal III
d963dbfd40 [libcxx] [test] Remove asserts that <cstddef> and <stdexcept> are included by <bitset>
Reviewed as https://reviews.llvm.org/D50421

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339212 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-08 00:43:38 +00:00
Billy Robert O'Neal III
8989fab841 [libcxx] [test] Add missing <stdexcept> in several tests.
Reviewed as https://reviews.llvm.org/D50420

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339209 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-08 00:40:32 +00:00
Marshall Clow
de134800ae Mark LWG#2260 as complete. We already did the right thing, so I just added tests to ensure that we continue to DTRT.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@338936 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-03 23:28:48 +00:00
Marshall Clow
48282b6a2a Implement P0887: The identity metafunction
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@338666 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-02 01:56:02 +00:00
Zhihao Yuan
80f0ca024a [libc++] Fix build failures after merging <charconv>
Summary:
- fix a stupid unit test typo
- add <charconv> symbols to Linux abilist

Reviewers: EricWF

Subscribers: christof, ldionne, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@338486 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-01 05:21:26 +00:00
Zhihao Yuan
dc38e97601 [libc++][C++17] Elementary string conversions for integral types
Summary:
Major QoI considerations:

- The facility is backported to C++14, same as libstdc++.
- Efforts have been made to minimize the header dependencies.
- The design is friendly to the uses of MSVC intrinsics (`__emulu`, `_umul128`, `_BitScanForward`, `_BitScanForward64`) but not implemented; future contributions are welcome.

Thanks to Milo Yip for contributing the implementation of `__u64toa` and `__u32toa`.

References:
 https://wg21.link/p0067r5
 https://wg21.link/p0682r1

Reviewers: mclow.lists, EricWF

Reviewed By: mclow.lists

Subscribers: ldionne, Quuxplusone, christof, mgorny, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@338479 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-01 02:38:30 +00:00
Marshall Clow
8a16d40991 import timespec and timespec_get into namespace std if we're under c++17 or later AND the underlying C library has them. Fixes PR#38220, but doesn't implement all of P0063 yet.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@338419 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 19:25:00 +00:00
Casey Carter
8df0521f96 [test] two small cleanups:
* Remove unused type from is_assignable.pass.cpp

* Don't specialize `common_type<::X<float>>` in common_type.pass.cpp, which violates the requirements of [meta.trans.other]/5

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336618 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-09 23:45:09 +00:00
Stephan T. Lavavej
9165f9d181 [libcxx] [test] Strip trailing whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@334676 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-14 00:12:20 +00:00
JF Bastien
e4063adf19 Mark deduction guide tests as failing on apple-clang-9
As discussed here: http://lists.llvm.org/pipermail/cfe-dev/2018-May/058116.html
The tests fail on clang-5, as well as apple-clang-9. Mark them as such.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@333479 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29 23:28:04 +00:00
Marshall Clow
d1e11a1a6f Fix up the final bits of breakage due to clang v5 generating bad implicit template deduction guides - specifically for copy-ctors
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@333381 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-28 19:20:21 +00:00
JF Bastien
adf78877c9 Fix optional<char> test breakage
It seems GCC and clang disagree. Talked to mclow on IRC, disabling for now.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@333317 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-25 21:32:27 +00:00
JF Bastien
599bf43e56 Fix optional deduction guide test breakage
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@333308 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-25 20:43:57 +00:00
Marshall Clow
756163dbc1 Add one more test for optional
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@333252 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-25 02:22:54 +00:00
Marshall Clow
2fac2d790f Add deduction guides for optional
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@333251 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-25 02:08:49 +00:00
Volodymyr Sapsai
44a1ffc37a Update XFAIL so apple-clang-9.0 is the last version not implementing Core 2094.
The test is passing with apple-clang-9.1. rdar://problem/40222003


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@332282 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 19:45:24 +00:00
Eric Fiselier
0f328db1aa Fix failing test due to incorrect use of noexcept
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@332066 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-11 00:33:20 +00:00
Eric Fiselier
f307403485 Fix PR37407 - callable traits don't correctly check complete types.
Checking for complete types is really rather tricky when you consider
the amount of specializations required to check a function type. This
specifically caused PR37407 where we incorrectly diagnosed
noexcept function types as incomplete (but there were plenty of other
cases that would cause this).

This patch removes the complete type checking for now. I'm going
to look into adding a clang builtin to correctly do this for us.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@332040 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-10 20:59:35 +00:00
Volodymyr Sapsai
db0ba4480a [libcxx] func.wrap.func.con: Unset function before destroying anything
Be defensive against a reentrant std::function::operator=(nullptr_t), in case
the held function object has a non-trivial destructor.  Destroying the function
object in-place can lead to the destructor being called twice.

Patch by Duncan P. N. Exon Smith. C++03 support by Volodymyr Sapsai.

rdar://problem/32836603

Reviewers: EricWF, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits, arphaman

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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@330885 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-25 23:38:41 +00:00
Stephan T. Lavavej
c538ab0daa [libcxx] [test] Fix whitespace, NFC.
test/std almost always uses spaces; now it is entirely tab-free.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329978 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-12 23:56:22 +00:00
Stephan T. Lavavej
f18ee8f765 [libcxx] [test] Avoid MSVC truncation warnings.
MSVC emits "warning C4244: 'initializing': conversion from 'int'
to 'short', possible loss of data" when it sees pair<Whatever, short>
constructed from (whatever, 4), because int is being truncated to
short within pair's constructor. (The compiler doesn't take into
account the fact that 4 is a literal at the callsite; it generates
this warning when the constructor is instantiated, because it might
be called with a runtime-valued int that would actually truncate.)

Instead of static_cast<short>, we can simply change short to int
in these tests, without affecting the pair operations that they're
trying to test: move assignment, convert copy construction, and
convert move construction.

Fixes D45016.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329973 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-12 23:56:07 +00:00
Casey Carter
fcb84f3c11 [test] [NFC] cleanup aligned_storage test
* `s/"" )/"")/g`
* Don't redundantly test triviality for `TEST_STD_VER > 17`

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329618 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-09 20:41:45 +00:00
Roman Lebedev
862878bc38 [libcxx][test] Silence -Wself-assign diagnostics
Summary:
D44883 extends -Wself-assign to also work on C++ classes.
These new warnings pop up in the test suite, so they have to be silenced.

Please refer to the D45082 for disscussion on whether this is the right way to solve this.

Testing: `ninja check-libcxx check-libcxxabi` in stage-2 build.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: Quuxplusone, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329490 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-07 10:36:03 +00:00
Eric Fiselier
4e177b91d0 fix typo in align_const_pair_U_V.pass.cpp
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328760 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-29 03:44:01 +00:00
Eric Fiselier
3e005cc583 Move libc++ pair/tuple assign test to libcxx/ test directory.
Libc++ implements the pair& operator=(pair<U, V>) assignment operator
using a single template that handles assignment from all tuple-like types.

This patch moves the test for that to the libcxx test directory since
it's non-standard. It also adds additional tests to the std/.../pair
directory to test the standard behavior this template implements.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328758 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-29 03:30:00 +00:00
Eric Fiselier
85e9de93e2 avoid new/delete ellision in construct.pass.cpp
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328445 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-25 03:00:42 +00:00
Stephan T. Lavavej
111f042e6c [libcxx] [test] Strip trailing whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328264 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-22 22:59:02 +00:00
Eric Fiselier
493b609b27 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328261 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-22 22:32:55 +00:00
Eric Fiselier
b06c8f07b2 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328245 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-22 21:28:09 +00:00
Eric Fiselier
b7f27d421f Un-XFAIL a test under new GCC version; the GCC bug has been fixed
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328229 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-22 19:18:08 +00:00
Marshall Clow
e9e128b0a6 Fix improperly failing test - and the code it was testing. Thanks to Stephan Lavavej for the catch.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328225 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-22 18:27:28 +00:00
Eric Fiselier
a831287399 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328180 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-22 04:42:56 +00:00
Marshall Clow
256f187bc6 Implement LWG3034: P0767R1 breaks previously-standard-layout types
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328064 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-21 00:36:05 +00:00
Marshall Clow
dfeb9b2af7 Implement LWG3035: std::allocator's constructors should be constexpr.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328059 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-20 23:02:53 +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
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
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
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
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
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
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
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
Eric Fiselier
457d2c157b 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322810 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-18 03:41:06 +00:00
Stephan T. Lavavej
4ffbed58e9 [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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322144 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-10 00:39:46 +00:00
Marshall Clow
773a3a53f9 Apparently 'C++14' is different than 'c++14'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322034 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-08 22:16:30 +00:00
Marshall Clow
334063336b Add the C++17 extensions to std::search. Include the default searcher, but not the Boyer-Moore or Boyer-Moore-Horspool searcher (yet). BUT put the BM and BMH tests in place, marked to XFAIL. The other searchers will follow soon
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322019 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-08 19:18:00 +00:00