Commit Graph

3131 Commits

Author SHA1 Message Date
Marshall Clow
cc07c8937b Fix PR#35967: '<regex> syntax_option_type is not a proper bitmask' Sadly, this is an ABI break, so it's only available if you define either '_LIBCPP_ABI_VERSION > 2' or '_LIBCPP_ABI_UNSTABLE' or '_LIBCPP_ABI_REGEX_CONSTANTS_NONZERO' and rebuild your dylib.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357190 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-28 17:30:23 +00:00
Louis Dionne
4ff4db7f84 [libc++] Remove unnecessary <iostream> #includes in tests
Some tests #include <iostream> but they don't use anything from the
header. Those are probably artifacts of when the tests were developped.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357181 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-28 16:38:15 +00:00
Marshall Clow
9c5bb6e040 Reworked all the utilities/meta tests to use ASSERT_SAME_TYPE instead of 'static_assert( is_same<'. Much easier to read. I left two tests alone: is_same.pass.cpp, which should call 'is_same' directly, and common_type.pass.cpp, which Eric is working on. NFC intended
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357146 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-28 03:39:25 +00:00
Louis Dionne
a9b1043901 [libc++] Rename span's as_writeable_bytes to as_writable_bytes
Summary: The Standard says as_writable_bytes.

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357139 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-28 01:27:52 +00:00
Casey Carter
2fe3307e56 Fix occurrences of _LIBCPP_ASSERT in span tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357092 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-27 17:03:44 +00:00
Louis Dionne
d88714db16 [libc++] Add proper XFAILs for shared_mutex tests
Dylib support for shared_mutex was added in macOS 10.12, so the tests
should be XFAILed accordingly instead of being completely disabled
whenever availability is enabled.

rdar://problem/48769104

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357079 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-27 15:50:34 +00:00
Brian Gesiak
2c4b419ec4 Revert "[coroutines] Add std::experimental::task<T> type"
This revision is causing build and test failures, such as
http://lab.llvm.org:8011/builders/libcxx-libcxxabi-libunwind-armv8-linux/builds/648/steps/test.libcxx/logs/stdio,
so I'll revert it.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357023 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-26 19:50:46 +00:00
Brian Gesiak
e83c41a26a [coroutines] Add std::experimental::task<T> type
Summary:
Adds the coroutine `std::experimental::task<T>` type described in proposal P1056R0.
See https://wg21.link/P1056R0.

This implementation allows customization of the allocator used to allocate the
coroutine frame by passing std::allocator_arg as the first argument, followed by
the allocator to use.

This supports co_awaiting the same task multiple times. The second and
subsequent times it returns a reference to the already-computed value.

This diff also adds some implementations of other utilities that have potential for
standardization as helpers within the test/... area:
- `sync_wait(awaitable)` - See P1171R0
- `manual_reset_event`

Move the definition of the __aligned_allocation_size helper function
from <experimental/memory_resource> to <experimental/__memory>
so it can be more widely used without pulling in memory_resource.

Outstanding work:
- Use C++14 keywords directly rather than macro versions
  eg. use `noexcept` instead of `_NOEXCEPT`).
- Add support for overaligned coroutine frames.
  This may need wording in the Coroutines TS to support passing the extra `std::align_val_t`.
- Eliminate use of `if constexpr` if we want it to compile under C++14.

Patch by @lewissbaker (Lewis Baker).



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357010 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-26 17:46:06 +00:00
Marshall Clow
9d9372a34c Cleaup of requirements for optional. While researching LWG3196, I realized that optional did not reject 'const in_place_t' like it should. Added a test as well, and a check for arrays (which were already disallowed, but now we get a better error message). Should not affect anyone's code.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356918 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-25 16:35:59 +00:00
Marshall Clow
d36fc70220 Fix a minor bug with std::next and prev not and negative numbers. In particular, std::prev cannot require Bidirectional Iterators, because you might 'go back' -1 places, which goes forward. Thanks to Ville and Jonathan for the bug report.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356818 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-22 22:32:20 +00:00
Marshall Clow
4d774fe669 Fix a vector test to not use a local type as a template parameter. This causes a warning on C++03. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356726 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-22 00:49:41 +00:00
Louis Dionne
0ec48a9e30 [libc++] Remove too-stringent XFAILs for file_clock tests
Those tests actually pass because we don't use anything that's marked
as unavailable.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356719 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-21 21:07:33 +00:00
Louis Dionne
eba9009ffa [libc++] Mark bad_any_cast tests as unsupported when the dylib doesn't support bad_any_cast
With the latest compiler fix to availability, some availability failures
that didn't trigger before now trigger.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356678 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-21 15:37:11 +00:00
Eric Fiselier
d60e4a1030 Mark debug death tests as unsupported on Windows
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356639 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-21 02:07:55 +00:00
Billy Robert O'Neal III
3fd12d449b [libcxx] [test] Revert r356632 add (void) casts to operator new calls, to suppress warnings generated by [[nodiscard]]."
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356635 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-21 00:24:43 +00:00
Eric Fiselier
cdb3094601 Allow disabling of filesystem library.
Summary: Filesystem doesn't work on Windows, so we need a mechanism to turn it off for the time being.

Reviewers: ldionne, serge-sans-paille, EricWF

Reviewed By: EricWF

Subscribers: mstorsjo, mgorny, christof, jdoerfert, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356633 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-21 00:04:31 +00:00
Billy Robert O'Neal III
82e238eecb [libcxx] [test] Add (void) casts to operator new calls, to suppress warnings generated by [[nodiscard]].
This allows these tests to pass when compiled by MSVC++.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356632 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-20 23:58:46 +00:00
Louis Dionne
080f06df54 [libc++] Mark <filesystem> as unavailable on Apple platforms using pragmas
Summary:
Also add the corresponding XFAILs to tests that require filesystem.
The approach taken to mark <filesystem> as unavailable in this patch
is to mark all the header as unavailable using #pragma clang attribute.
Marking each declaration using the attribute is more intrusive and
does not provide a lot of value right now because pretty much everything
in <filesystem> requires dylib support, often transitively.

This is an alternative to https://reviews.llvm.org/D59093.
A similar (but partial) patch was already applied in r356558.

Reviewers: mclow.lists, EricWF, serge-sans-paille

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356616 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-20 21:18:14 +00:00
Marshall Clow
ce2670ada3 Mark <charconv> tests as unsupported for C++11 and C++14 if you're not testing libc++. Thanks to Louis for the suggestion.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356602 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-20 19:43:22 +00:00
Marshall Clow
2b866255ed Make to_chars/from_chars work back to C++11. This means that we can use them to implement to_string as well. Reviewed as https://reviews.llvm.org/D59598.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356585 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-20 18:13:23 +00:00
Louis Dionne
51ecd6cd07 [libc++] Mark <filesystem> tests as failing when the dylib doesn't support filesystem
This fixes CI for back-deployment testers on platforms that don't have
<filesystem> support in the dylib.

This is effectively half of https://reviews.llvm.org/D59224. The other
half requires fixes in Clang.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356558 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-20 14:34:00 +00:00
Louis Dionne
2fa9a05abf [libc++] Flag file_clock test as expected to fail with ASAN
This silences a known issue, as can be seen by looking at similar
tests for other clocks, like time.clock.steady/consistency.pass.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356528 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 21:53:32 +00:00
Louis Dionne
3b886a1ce8 [libc++] Build <filesystem> support as part of the dylib
Summary:
This patch treats <filesystem> as a first-class citizen of the dylib,
like all other sub-libraries (e.g. <chrono>). As such, it also removes
all special handling for installing the filesystem library separately
or disabling part of the test suite from the lit command line.

Unlike the previous attempt (r356500), this doesn't remove all the
filesystem tests.

Reviewers: mclow.lists, EricWF, serge-sans-paille

Subscribers: mgorny, christof, jkorous, dexonsmith, jfb, jdoerfert, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356518 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 20:56:13 +00:00
Louis Dionne
e76d13a487 Revert "[libc++] Build <filesystem> support as part of the dylib"
When I applied r356500 (https://reviews.llvm.org/D59152), I somehow
deleted all of filesystem's tests. I will revert r356500 and re-apply
it properly.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356505 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 19:27:29 +00:00
JF Bastien
6ba69cac26 Fix char.traits.specializations.char8_t main return
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356504 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 19:25:07 +00:00
Louis Dionne
582679a3fe [libc++] Build <filesystem> support as part of the dylib
Summary:
This patch treats <filesystem> as a first-class citizen of the dylib,
like all other sub-libraries (e.g. <chrono>). As such, it also removes
all special handling for installing the filesystem library separately
or disabling part of the test suite from the lit command line.

Reviewers: mclow.lists, EricWF, serge-sans-paille

Subscribers: mgorny, christof, jkorous, dexonsmith, jfb, jdoerfert, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356500 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 19:09:33 +00:00
JF Bastien
7dfcf562fe Fix fenv.pass.cpp signature for main
And make main return.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356493 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 18:24:11 +00:00
Marshall Clow
ddb1b0576a Mark 'front()' and 'back()' as noexcept for array/deque/string/string_view. These are just rebranded 'operator[]', and should be noexcept like it is.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356435 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 03:30:07 +00:00
Eric Fiselier
e7641c9db9 Remove unused try catch blocks from old debug tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356429 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 00:00:30 +00:00
Eric Fiselier
f7d368bb1f Fix test failures after debug mode changes
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356421 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-18 22:12:09 +00:00
Eric Fiselier
eb2e397396 Remove exception throwing debug mode handler support.
Summary:
The reason libc++ implemented a throwing debug mode handler was for ease of testing. Specifically,
I thought that if a debug violation aborted, we could only test one violation per file. This made
it impossible to test debug mode. Which throwing behavior we could test more!

However, the throwing approach didn't work either, since there are debug violations underneath noexcept
functions. This lead to the introduction of `_NOEXCEPT_DEBUG`, which was only noexcept when debug
mode was off.

Having thought more and having grown wiser, `_NOEXCEPT_DEBUG` was a horrible decision. It was
viral, it didn't cover all the cases it needed to, and it was observable to the user -- at worst
changing the behavior of their program.

  This patch removes the throwing debug handler, and rewrites the debug tests using 'fork-ing' style
  death tests.

Reviewers: mclow.lists, ldionne, thomasanderson

Reviewed By: ldionne

Subscribers: christof, arphaman, libcxx-commits, #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356417 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-18 21:50:12 +00:00
Louis Dionne
247cbe7327 [libc++] Add a test for PR40977
Even though the header makes the exact same check since https://llvm.org/D59063,
the headers could conceivably change in the future and introduce a bug.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356376 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-18 15:40:49 +00:00
Marshall Clow
527149c670 Update a deque test with more assertions. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356266 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-15 15:00:41 +00:00
Marshall Clow
9039043195 Mark vector::operator[] and front/back as noexcept. We already do this for string and string_view. This should give better codegen inside of noexcept functions. Add tests for op[]/front/back/at, because apparently we had none.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356224 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-15 00:29:35 +00:00
Marshall Clow
6c8cbbf49c XFAIL this debug-mode test that I just broke. Eric has a patch out for review (D59166) that rewrites this test completely, so I'm not going to bother fixing it.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356211 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 22:24:32 +00:00
Marshall Clow
fa199b9339 Add noexcept to operator[] for array and deque. This is an extension. We already do this for string and string_view. This should give better codegen inside of noexcept functions.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356209 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 21:56:57 +00:00
Marshall Clow
3f377ef16a Reorg the midpoint pointer test into runtime and constexpr tests; comment out the volatile constexpr tests for GCC because our experimental gcc bot barfs on them.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356177 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 17:43:41 +00:00
Marshall Clow
3166f3aa00 Fix two of the three bot failures for midpoint; the ones regarding the lack of '__int128_t'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356169 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 17:20:02 +00:00
Marshall Clow
5310aa3850 Add std::midpoint for integral and poiner types. Described in P0811, reviewed as D59099.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356162 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 16:25:55 +00:00
Eric Fiselier
a9efe90666 Properly constrain basic_string(Iter, Iter, Alloc = A())
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356140 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 12:31:10 +00:00
Louis Dionne
9807685d51 [libc++] Enable deprecation warnings by default
Summary:
In r342843, I added deprecation warnings to some facilities that were
deprectated in C++14 and C++17. However, those deprecation warnings
were not enabled by default.

After discussing this on IRC, we had finally gotten consensus to enable
those warnings by default, and I'm getting around to doing that only
now.

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, jdoerfert, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355961 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-12 20:10:06 +00:00
Eric Fiselier
2ab98fbcd4 Allow optional to tolerate being used with a nested class.
When Clang tries to complete a type containing `std::optional` it
considers the `in_place_t` constructor with no arguments which checks
if the value type is default constructible. If the value type is a
nested class type, then this check occurs too early and poisons the
is_default_constructible trait.

This patch makes optional deduce `in_place_t` so we can prevent
this early SFINAE evaluation. Technically this could break people
doing weird things with the in_place_t tag, but that seems less
important than making the nested class case work.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355877 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-11 22:55:21 +00:00
Eric Fiselier
975cb9a721 Fix PR41017 - Build failure with _LIBCPP_DEBUG=0 and non-const-ref
comparator for std::sort()

Our debug comparator assumed that the comparator it wraps would always
accepts the values by const ref. This isn't required by the standard.

This patch makes our __debug_less comparator forward the constness.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355752 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-08 22:58:59 +00:00
Thomas Anderson
9ae8fb4a3c [libc++] Fix use-after-free when building with _LIBCPP_DEBUG=1
The issue is the following code:

    __cn1->__add(*__ip);
    (*__ip)->__c_ = __cn1;

`__ip` points into the array of iterators for container `__cn2`.  This code adds
the iterator to the array of iterators for `__cn1`, and updates the iterator to
point to the new container.

This code works fine, except when `__cn1` and `__cn2` are the same container.
`__cn1->__add()` might need to grow the array of iterators, and when it does,
`__ip` becomes invalid, so the second line becomes a use-after-free error.

Simply swapping the order of the above two lines is not sufficient, because of
the memmove() below.  The easiest and most performant solution is just to skip
touching any iterators if the containers are the same.

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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355550 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-06 21:10:08 +00:00
Marshall Clow
526bce48cc Eradicate all the ptrdiff_ts in span left over from applying P1227. A couple of other minor cleanups. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355481 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-06 03:59:44 +00:00
Davide Italiano
a011222d74 Reinstate libc++ patches now that the lldb formatter has been updated.
"[libc++] Fix <atomic> failures on GCC"
"[libc++] Change memory_order to an enum class"
"[libc++] decoupling Freestanding atomic<T> from libatomic.a"

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355427 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-05 18:40:49 +00:00
Davide Italiano
3438c15d15 [libcxx] Revert set of atomic patches that broke lldb.
Revert "[libc++] Fix <atomic> failures on GCC"
Revert "[libc++] Change memory_order to an enum class"
Revert "[libc++] decoupling Freestanding atomic<T> from libatomic.a"

The lldb formatter nededs to be updated. Shafik and Louis will
coordinate to do so.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355417 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-05 17:38:33 +00:00
Louis Dionne
018402394d [libc++] Fix <atomic> failures on GCC
Summary:
In https://reviews.llvm.org/D58201, we turned memory_order into an enum
class in C++20 mode. However, we were not casting memory_order to its
underlying type correctly for the GCC implementation, which broke the
build bots. I also fixed a test that was failing in C++17 mode on GCC 5.

Reviewers: EricWF, jfb, mclow.lists

Subscribers: zoecarver

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355409 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-05 15:49:58 +00:00
Louis Dionne
1bf0d1eb64 [libc++] Change memory_order to an enum class
This implements P0439R0.

Thanks to Zoe Carver for the patch.
Differential Revision: https://reviews.llvm.org/D58201

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355403 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-05 14:50:25 +00:00
Eric Fiselier
1f820d84ec Fix -fsanitize=vptr badness in <__debug>
Summary:

This patch fixes a lifetime bug when inserting a new container into the debug database. It is
diagnosed by UBSAN when debug mode is enabled. This patch corrects how nodes are constructed
during insertion.

The fix requires unconditionally breaking the debug mode ABI. Users should not expect ABI
stability from debug mode.

Reviewers: ldionne, serge-sans-paille, EricWF

Reviewed By: EricWF

Subscribers: mclow.lists, christof, libcxx-commits

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355367 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-05 02:10:31 +00:00