Commit Graph

2907 Commits

Author SHA1 Message Date
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
Louis Dionne
d386d7e49a [libc++] Fix forgotten fclose() in unit test
Thanks to Andrey Maksimov for the patch.
Differential Revision: https://reviews.llvm.org/D58732

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355162 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-01 01:32:44 +00:00
Louis Dionne
f1546581e5 [libc++] Increase portability of xalloc test
Do not assume that xalloc() starts at 0, which is not specified by the
Standard.

Thanks to Andrey Maksimov for the patch.
Differential Revision: https://reviews.llvm.org/D58299

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355160 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-01 00:51:54 +00:00
Louis Dionne
aeeba70ab1 [libc++] Add is_nothrow_convertible from P0758R1
Reviewed as https://reviews.llvm.org/D58019.
Thanks to Zoe Carver for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355010 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 17:57:38 +00:00
Marshall Clow
ae4afd034b Implment the last part of P1024: tuple-like interface to span. Reviewed as https://reviews.llvm.org/D58706.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354988 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 15:41:37 +00:00
Marshall Clow
dd2ae1242f Implement the second part of P1227R2 - Signed ssize() functions. Reviewed as https://reviews.llvm.org/D58642
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354950 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 02:58:56 +00:00
Marshall Clow
680a56e1aa Fix an ambiguity in the tests that gcc-tot complained about.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354944 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 01:29:52 +00:00
Louis Dionne
a4bb2d075d [libc++] Add a test for PR14074
PR14074 was fixed in r165884, but no tests were added.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354943 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 01:29:09 +00:00
Louis Dionne
21c042e77e [libc++] Mark several tests as XFAIL on macosx10.7
Those tests fail when linking against a new dylib but running against
macosx10.7. I believe this is caused by a duplicate definition of the
RTTI for exception classes in libc++.dylib and libc++abi.dylib, but
this matter still needs some investigation.

This issue was not caught previously because all the tests always linked
against the same dylib used for running (because LIT made it impossible
to do otherwise before r349171).

rdar://problem/46809586

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354940 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 00:57:57 +00:00
Marshall Clow
b3c66aa0ab First part of P1227R2 - change span over to use 'size_t' instead of 'ptrdiff_t'. Reviewed as https://reviews.llvm.org/D58639.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354936 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 00:32:16 +00:00
Louis Dionne
b71643a4c0 [libc++] Add <filesystem> to the min-mac macro header test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354932 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-26 23:14:58 +00:00
Marshall Clow
452149ea33 Implement P1357: Traits for [Un]bounded Arrays; adopted in Kona
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354891 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-26 16:07:03 +00:00
Marshall Clow
a333218455 LWG3101 - span's Container constructors need another constraint. Reviewed as https://reviews.llvm.org/D57058.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354805 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-25 18:32:57 +00:00
Marshall Clow
c67930bd74 Commit LWG3144 - span does not have a const_pointer typedef. Reviewed as D57039.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354802 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-25 17:58:03 +00:00
Marshall Clow
e5cb744bf1 First part of P1024: Usability Enhancements for std::span. Remove operator() for indexing, and add 'front' and 'back' calls.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354801 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-25 17:54:08 +00:00
Louis Dionne
98173dc3c4 [libcxx] Make sure all experimental tests are disabled when enable_experimental=False
Summary:
Previously, we'd run some experimental tests even when enable_experimental=False
was used with lit.

Reviewers: EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits, mclow.lists

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354725 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-23 11:24:03 +00:00
Louis Dionne
06dd101a65 [NFC] Fix incorrect comment in std::function test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354537 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-21 00:53:26 +00:00
Louis Dionne
712d476de3 [libcxx] Do not assume the number of elements in a moved-from associative container
Reviewed as https://reviews.llvm.org/D57903.
Thanks to Andrey Maksimov for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353955 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-13 16:43:44 +00:00
Louis Dionne
af15bb4cdf [libc++] Avoid UB in the no-exceptions mode in a few places
Summary:
A few places in the library seem to behave unexpectedly when the library
is compiled or used with exceptions disabled. For example, not throwing
an exception when a pointer is NULL can lead us to dereference the pointer
later on, which is UB. This patch fixes such occurences.

It's hard to tell whether there are other places where the no-exceptions
mode misbehaves like this, because the replacement for throwing an
exception does not always seem to be abort()ing, but at least this
patch will improve the situation somewhat.

See http://lists.llvm.org/pipermail/libcxx-dev/2019-January/000172.html

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353850 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-12 16:06:02 +00:00
Eric Fiselier
ecc2c089fd Add fenv.h header
Summary:
Some implementations of fenv.h use macros to define the functions they provide. This can cause problems when `std::fegetround()` is spelled in source.

This patch adds a `fenv.h` header to libc++ for the sole purpose of turning those macros into real functions.

Reviewers: rsmith, mclow.lists, ldionne

Reviewed By: rsmith

Subscribers: mgorny, christof, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353767 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11 23:47:19 +00:00
Chandler Carruth
b20da37b6b Update some newly added files that mistakenly used the old file header
to the new one.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353668 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11 08:39:14 +00:00
Kamil Rytarowski
e4dbc70699 Mark another test as flaky
Reported on the NetBSD buildbot.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353622 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-09 18:39:07 +00:00
Louis Dionne
5569a5e69c [libc++] Fix XFAILs when exceptions are disabled
It turns out that I un-XFAILed too many tests in r353210: some tests
actually fail whether exceptions are enabled or not because they use
types that are marked as unavailable even when exceptions are disabled.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353215 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 20:55:23 +00:00
Louis Dionne
4806bce5a8 [libc++] Fix XFAILs on macOS when exceptions are disabled
Some tests are marked as failing on platforms where the dylib does not
provide the required exception classes. However, when testing with
exceptions disabled, those tests shouldn't be marked as failing.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353210 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 20:11:58 +00:00
Petr Hosek
fbc4ec4cc5 [CMake] Support compiler-rt builtins library in tests
We're building tests with -nostdlib which means that we need to
explicitly include the builtins library. When using libgcc (default)
we can simply include -lgcc_s on the link line, but when using
compiler-rt builtins we need a complete path to the builtins library.

This path is already available in CMake as <PROJECT>_BUILTINS_LIBRARY,
so we just need to pass that path to lit and if config.compiler_rt is
true, link it to the test.

Prior to this patch, running tests when compiler-rt is being used as
the builtins library was broken as all tests would fail to link, but
with this change running tests when compiler-rt bultins library is
being used should be supported.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353208 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 19:50:47 +00:00