Commit Graph

5945 Commits

Author SHA1 Message Date
Louis Dionne
40f365f4c4 [libc++] Use __extension__ in a portable manner
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@370889 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-04 12:44:19 +00:00
Louis Dionne
958c9be283 [libc++] Mark usage of _Atomic with __extension__
An upcoming change in Clang will flag _Atomic as being a C11 extension.
To avoid generating this warning in libc++, this commit marks the only
use of _Atomic with the __extension__ extension, which suppresses such
warnings.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@370796 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-03 17:52:18 +00:00
Nico Weber
9213acafbc [libc++] Fix directory_iterator compilation on Win32
This patch fixes some typos and other small errors in
directory_iterator.cpp that prevented this file from being compiled for
Win32.

Patch by Stefan Schmidt <thrimbor.github@gmail.com>!

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@370599 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-31 23:17:38 +00:00
Sterling Augustine
1cdafefbbc Revert "Add gdb pretty printers for a wide variety of libc++ data structures."
This reverts commit d8c9f2f572fe06a34ccfc28ee9223b64d7d275d3.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@370553 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-31 00:00:34 +00:00
Sterling Augustine
025042504e Add gdb pretty printers for a wide variety of libc++ data structures.
Summary: Also add a test suite.

Reviewers: EricWF

Subscribers: christof, llvm-commits

Tags: #llvm

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

Run a pep8 formatter.

Run pep8 formatter.

Convert to PEP8, address other comments from code review.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@370551 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-30 23:43:34 +00:00
Eric Fiselier
9b0e06fbba Make vector unconditionally move elements when exceptions are disabled.
Summary:
`std::vector<T>` is free choose between using copy or move operations when it needs to resize. The standard only candidates that the correct exception safety guarantees are provided. When exceptions are disabled these guarantees are trivially satisfied. Meaning vector is free to optimize it's implementation by moving instead of copying.

This patch makes `std::vector` unconditionally move elements when exceptions are disabled.

This optimization is conforming according to the current standard wording.

There are concerns that moving in `-fno-noexceptions`mode will be a surprise to users. For example, a user may be surprised to find their code is slower with exceptions enabled than it is disabled. I'm sympathetic to this surprised, but I don't think it should block this optimization.


Reviewers: mclow.lists, ldionne, rsmith

Reviewed By: ldionne

Subscribers: zoecarver, christof, dexonsmith, libcxx-commits

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@370502 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-30 19:01:03 +00:00
Louis Dionne
228efd5ca3 [libc++] Fix visibility of __vector_base_common on GCC
Since we build the library with -fvisibility=hidden, the shared object
wouldn't contain __vector_base_common<true>::__throw_length_error()
and __vector_base_common<true>::__throw_out_of_range(), leading to
link errors. This only happened on GCC for some reason.

https://llvm.org/PR43140

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@370240 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-28 18:10:39 +00:00
Louis Dionne
11985b4787 [libc++] Add yet another test for inverted character classes
This was reported as part of a bug report that ended up being a
duplicate for r340609, but I'm adding the test case since it's
ever so slightly different from what we had before.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@370109 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-27 20:39:10 +00:00
Louis Dionne
78af550193 [libc++] Fix typo in documentation for LIBCXX_HERMETIC_STATIC_LIBRARY
Thanks to Yichen Yan for the patch.
Differential Revision: https://reviews.llvm.org/D66675

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369800 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-23 19:42:09 +00:00
Louis Dionne
ba34f51708 [libc++] Improve Python 3 compatibility for merge_archives.py
Popen.communicate() method in Python 2 returns a pair of strings, and in
Python 3 it returns a pair of byte-like objects unless universal_newlines
is set to True. This led to an error when using Python 3. With this patch,
merge_archives.py works fine with Python 3.

Thanks to Sergej Jaskiewicz for the patch.
Differential Revision: https://reviews.llvm.org/D66649

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369764 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-23 15:05:54 +00:00
Nico Weber
90c8cee2d0 libcxx: Make gen_link_script.py print contents only in --dryrun mode
The build should generally be quiet if there are no errors,
and this script has been around long enough that we can remove
the log output. If we ever need to debug something with this script,
we can put back the logging then.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369757 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-23 13:40:54 +00:00
Louis Dionne
7b663de096 [libc++] Fix broken <random> test
In r369429, I hoisted a floating point computation to a variable in order
to remove a warning. However, it turns out this doesn't play well with
floating point arithmetic. This commit reverts r369429 and instead casts
the result of the floating point computation to remove the warning.

Whether hoisting the computaiton to a variable should give the same
result can be investigated independently.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369693 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-22 19:35:46 +00:00
Louis Dionne
c8e19578f2 [libc++] Mark lock_guard nodiscard test as unsupported in C++03
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369672 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-22 17:24:24 +00:00
Nico Weber
4ef3309d94 libcxx: Rename last two .hpp files in libcxx to .h
Differential Revision: https://reviews.llvm.org/D66544

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369597 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-21 22:38:38 +00:00
David Spickett
2b0de5a74d [libcxx] Only declare contents of threading API when
_LIBCPP_HAS_THREAD_API_EXTERNAL is not defined.

When it is defined they will be declared by the
__external_threading header instead.

Differential revision: https://reviews.llvm.org/D66518

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369537 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-21 15:38:24 +00:00
Nico Weber
630780b320 libcxx: Rename .hpp files in libcxx/benchmarks to .h
LLVM uses .h as its extension for header files.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369487 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-21 01:59:12 +00:00
Eric Fiselier
2d8b51bed3 Fix missing __muloti4 function with UBSAN
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369483 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-21 00:16:33 +00:00
Eric Fiselier
41cdb89ec7 Attempt to fix MSAN failures in benchmarks
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369482 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-21 00:14:48 +00:00
Nico Weber
28db4445e2 libcxx: Rename .hpp files in libcxx/test/support to .h
LLVM uses .h as its extension for header files.

Files renamed using:

    for f in libcxx/test/support/*.hpp; do git mv $f ${f%.hpp}.h; done

References to the files updated using:

    for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do
        a=$(basename $f);
        echo $a;
        rg -l $a libcxx | xargs sed -i '' "s/$a/${a%.hpp}.h/";
    done

HPP include guards updated manually using:

    for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do
      echo ${f%.hpp}.h ;
    done | xargs mvim

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369481 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-21 00:14:12 +00:00
Marshall Clow
4dde9ccef5 Add a missing _VSTD:: before a call to merge. Fixes PR43034. Checked the rest of 'algorithm' looking for unqualified calls. Didn't find any.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369463 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 22:23:35 +00:00
Marshall Clow
b9f7426583 Fix a couple of unguarded operator, calls in algorithm. Fixes PR#43063. Updated all the heap tests to check this.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369448 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 21:31:51 +00:00
Zoe Carver
e44fcf8346 [libc++] Fix std::abs tests
On systems where sizeof(long) == sizeof(int)
the current tests failed. This commit updates
those tests to work on all systems.
std::abs has specific long specializations
which can be used instead.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369437 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 20:44:59 +00:00
Louis Dionne
76dbc2cb72 [libc++] Avoid implicit conversion warning in a <random> test
By stashing the computation of `E::max() - E::min()` in a variable, we
avoid the warning introduced in r367497. Note that we use `auto` to
avoid having to deduce the type of the computation, which is not a
problem since Clang provides `auto` as an extension even in C++03 (and
we disable warnings related to using C++11 extensions in the test suite).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369429 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 19:28:26 +00:00
Eric Fiselier
61563aa43f fix buildbot start script to no longer hang
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369428 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 19:06:23 +00:00
Louis Dionne
4a3529492c [libc++] Implement LWG 3199
Summary:
The resolution of LWG 3199 makes sure that input-streaming into an empty bitset
does not set the failbit on the input stream.

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369422 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 18:21:06 +00:00
Louis Dionne
460deb67be [libc++] Precise XFAIL for AppleClang 11
This test doesn't fail on all patch levels of AppleClang 11

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369420 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 18:05:06 +00:00
Eric Fiselier
3b71d7ba1f bump lld version used by buildbots
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369416 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 17:43:00 +00:00
Zoe Carver
3eb5fd97e1 [libc++] fix test for unsigned char
On some systems char is unsigned.
If that is the case, we will now
test signed char twice in std::abs.
NFC. Fixes the build bots.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369413 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 17:09:00 +00:00
Louis Dionne
534d2b1146 [libc++] Disable <chrono> ""d and ""y literal tests on AppleClang 10.0.0
In r368882, I enabled those tests for all AppleClang's above version 9.
However, it turns out that the feature is only supported starting with
AppleClang 10.0.1, not AppleClang 10.0.0. This commit fixes that hole.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369409 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 16:45:27 +00:00
Louis Dionne
969fd81491 [libc++] Populate a lit feature including the compiler patch level
If the compiler is (for example) AppleClang 10.0.1, we would previously
populate the following lit features:

    apple-clang
    apple-clang-10
    apple-clang-10.0

This patch additionally populates a feature called 'apple-clang-10.0.1',
which allows more precise enabling/disabling of tests.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369406 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 16:41:38 +00:00
Marshall Clow
e746afcf01 Fix availability of __thread_id on builds with external threading. Reviewed as https://reviews.llvm.org/D66480
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369399 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 16:16:23 +00:00
Zoe Carver
8ed9ff748f [libc++] std::abs should not return double
Implement LWG Issue 2735 by adding std::abs
tests for several types and checking their
return value. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369394 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 15:43:25 +00:00
Louis Dionne
f6e8515214 [libc++] Explicitly cast in generate_canonical
A new clang warning introduced in r367497 was complaining about
the change in value.

Thanks to Brian Cain for the patch.
Differential Revision: https://reviews.llvm.org/D66422

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369393 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 15:39:20 +00:00
Mikhail Maltsev
381f2497df [libcxx] Fix build breakage on mips
Fixes https://bugs.llvm.org/show_bug.cgi?id=43011 caused by
https://reviews.llvm.org/D63284.

Committing as obvious.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369364 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 10:19:55 +00:00
Louis Dionne
66130ef70f Provide a meaningful diagnostic when LLVM_PATH doesn't point to a directory
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369312 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-19 23:51:26 +00:00
Louis Dionne
c4fdc11d3a [libc++] Add XFAIL for is_base_of test on AppleClang 11
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369280 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-19 17:29:42 +00:00
Zoe Carver
41b71cbb05 [libc++] reverts commit a5f5aad568bb7a91ceee47641f3076ac339ef8c7.
The commit being reverted caused segfaults when building
with libc++ and GCC (and possibly other configurations).

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369270 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-19 15:47:16 +00:00
Marshall Clow
52ba46bf85 Fix thread comparison by making sure we never pass our special 'not a thread' value to the underlying implementation. Fixes PR#42918.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368916 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-14 20:54:56 +00:00
Louis Dionne
5e6dc8fc98 [libc++] Mark <chrono> test as unsupported on AppleClang 9
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368914 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-14 20:27:56 +00:00
Louis Dionne
6dbf2b76ac [libc++] Mark std::tuple CTAD test as failing on AppleClang 9
Like CTAD for std::unordered_set, AppleClang 9's support for CTAD is
insufficient. I suspect the corresponding LLVM Clang is broken too,
but we don't seem to have testers using that Clang.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368911 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-14 20:17:18 +00:00
Zoe Carver
2e9bd4cf8c This commit removes std::shared_ptr::make_shared and std::shared_ptr::allocate_shared as they are not part of the standard. This commit also adds the helper function "__create_with_cntrl_block" which std::allocate_shared and std::make_shared have been updated to use.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368885 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-14 17:19:25 +00:00
Louis Dionne
c31d5a4ef3 [libc++] Enable <chrono> ""d and ""y literals for AppleClang 10 and up
AppleClang supports those literals starting in version 10.0.1.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368882 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-14 17:04:31 +00:00
Louis Dionne
757c2e9bf3 [libc++] Do not define _LIBCPP_CLANG_VER for non-LLVM Clang
In r292833, we started defining _LIBCPP_CLANG_VER to 0 for Apple Clang.
The result is that AppleClang is detected as being a very old version
of LLVM Clang (version 0), which is obviously incorrect.

I believe this was added so that we don't have to check whether
_LIBCPP_CLANG_VER is defined prior to comparing it with a number
(which can trigger a warning). This commit also fixes the two
places that use the macro correspondingly.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368880 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-14 17:01:08 +00:00
Marshall Clow
734e77fb2b Rework recursive_timed_mutex so that it uses __thread_id instead of using the lower-level __libcpp_thread_id. This is prep for fixing PR42918. Reviewed as https://reviews.llvm.org/D65895
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368867 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-14 16:21:27 +00:00
Louis Dionne
72109f5b3e [libc++] Mark two <chrono> tests as unsupported on AppleClang 11
The operator""y and operator""d will eventually be supported by
AppleClang, but no released version supports them at the moment.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368749 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-13 21:34:49 +00:00
Andrew Hyatt
48706becdc
Allow i386 or x86_64 only builds 2019-08-13 14:08:54 -04:00
Louis Dionne
9feb945a66 [libc++] Always build with -fvisibility=hidden
Summary:
This avoids symbols being accidentally exported from the dylib when they
shouldn't. The next step is to use a pragma to apply hidden visibility
to all declarations (unless otherwise specified), which will allow us
to drop the per-declaration hidden visibility attributes we currently
have.

This also has the nice side effect of making sure the dylib exports the
same symbols regardless of the optimization level.

PR38138

Reviewers: EricWF, mclow.lists

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

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368703 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-13 15:02:53 +00:00
Louis Dionne
e1c08e781c [libc++] Fix incorrect UNSUPPORTED annotation
The test was marked as UNSUPPORTED for clang-6 and clang-6, instead of
clang-6 and clang-7.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368666 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-13 11:25:16 +00:00
Louis Dionne
22eff1a94a [libc++] Use [[nodiscard]] for lock_guard, as an extension
Summary:
D64914 added support for applying [[nodiscard]] to constructors. This
commit uses that capability to flag incorrect uses of std::lock_guard
where one forgets to actually create a variable for the lock_guard.

rdar://45790820

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits, Quuxplusone, lebedev.ri

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368664 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-13 11:12:28 +00:00
Louis Dionne
77764d9c0b [libc++] Implement CTAD for std::tuple
Summary:
We were using implicit deduction guides instead of explicit ones,
however the implicit ones don't do work anymore when changing the
constructors.

This commit adds the actual guides specified in the Standard to make
libc++ (1) closer to the Standard and (2) more resistent to changes
in std::tuple's constructors.

Reviewers: Quuxplusone

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368599 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-12 18:30:31 +00:00