Commit Graph

6072 Commits

Author SHA1 Message Date
Dimitry Andric 5bd4a4806a Remove ::gets for FreeBSD 13 and later
Summary:
In https://svnweb.freebsd.org/changeset/base/351659 @emaste removed gets() from
FreeBSD 13's libc, and our copies of libc++ and libstdc++.  In that change, the
declarations were simply deleted, but I would like to propose this conditional
test instead.

Reviewers: EricWF, mclow.lists, emaste

Reviewed By: mclow.lists

Subscribers: krytarowski, christof, ldionne, emaste, libcxx-commits

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

llvm-svn: 371324
2019-09-07 22:18:20 +00:00
Sterling Augustine 3270941f1e Add gdb pretty printers for a wide variety of libc++ data structures (take 2).
Summary:
This patch is an exact duplicate of https://reviews.llvm.org/D65609, except
that it uses the newly introduced testing framework to detect if gdb is present
so that the tests won't fail on machines without gdb.

Reviewers: echristo, EricWF

Subscribers: christof, ldionne, llvm-commits

Tags: #llvm

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

llvm-svn: 371131
2019-09-05 21:35:05 +00:00
Sterling Augustine a127795617 Don't assume libcxx_gdb is always set.
libc++abi also uses this file, but doesn't use the same CMakeLists.txt.

llvm-svn: 371130
2019-09-05 21:34:54 +00:00
Vedant Kumar 1261f1b980 [libcxx] Codesign test executables if necessary
If LLVM_CODESIGNING_IDENTITY is set, test executables need to be
codesigned.

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

llvm-svn: 371126
2019-09-05 21:24:23 +00:00
Sterling Augustine bf7602b261 Add testing infrastructure to check if gdb is available for testing.
Reviewers: echristo, EricWF

Subscribers: mgorny, christof, llvm-commits

Tags: #llvm

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

llvm-svn: 371120
2019-09-05 20:44:08 +00:00
Louis Dionne b370e7691a [libc++] Revert "Make `vector` unconditionally move elements when exceptions are disabled."
This reverts r370502, which broke the use case of a copy-only T (with a
deleted move constructor) when exceptions are disabled. Until we figure
out the right behavior, I'm reverting the commit.

llvm-svn: 371068
2019-09-05 13:50:28 +00:00
Louis Dionne f1b4eba66f [libc++] Add a test for resizing of a vector with copy-only elements
See https://reviews.llvm.org/D62228#1658620

llvm-svn: 371067
2019-09-05 13:50:18 +00:00
Marshall Clow b7ebdbdb35 Reformat the beginning of the testing doc to make clear how to run all the tests.
llvm-svn: 371001
2019-09-05 00:38:36 +00:00
Louis Dionne 5afc5a6c1b [libc++] Only build with -fvisibility=hidden on Clang
The visibility annotations in libc++ are not quite right for GCC, which
results in symbols not being exported when -fvisibility=hidden is used.
To fix the GCC build bots, this commit reverts to the previous state of
not building with hidden visibility on GCC.

In the future, we can build with hidden visibility all the time and
export symbols explicitly using a list. See https://llvm.org/D66970
for one take at this.

llvm-svn: 370926
2019-09-04 16:41:31 +00:00
Louis Dionne b92deded87 [libc++] Move __clamp_to_integral to <cmath>, and harden against min()/max() macros
llvm-svn: 370900
2019-09-04 13:35:03 +00:00
Louis Dionne e8316372b9 [libc++] Add `__truncating_cast` for safely casting float types to integers
This is needed anytime we need to clamp an arbitrary floating point
value to an integer type.

Thanks to Eric Fiselier for the patch.

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

llvm-svn: 370891
2019-09-04 12:48:32 +00:00
Louis Dionne 801f6a495c [libc++] Use __extension__ in a portable manner
llvm-svn: 370889
2019-09-04 12:44:19 +00:00
Louis Dionne 79b476150b [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.

llvm-svn: 370796
2019-09-03 17:52:18 +00:00
Nico Weber a627bd3a02 [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

llvm-svn: 370599
2019-08-31 23:17:38 +00:00
Sterling Augustine 33e17db591 Revert "Add gdb pretty printers for a wide variety of libc++ data structures."
This reverts commit d8c9f2f572fe06a34ccfc28ee9223b64d7d275d3.

llvm-svn: 370553
2019-08-31 00:00:34 +00:00
Sterling Augustine d21a3e41a4 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.

llvm-svn: 370551
2019-08-30 23:43:34 +00:00
Eric Fiselier 2dd37a31ce 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

llvm-svn: 370502
2019-08-30 19:01:03 +00:00
Louis Dionne f7a544bca8 [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

llvm-svn: 370240
2019-08-28 18:10:39 +00:00
Louis Dionne b5aefed40a [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.

llvm-svn: 370109
2019-08-27 20:39:10 +00:00
Louis Dionne 236f8012c9 [libc++] Fix typo in documentation for LIBCXX_HERMETIC_STATIC_LIBRARY
Thanks to Yichen Yan for the patch.
Differential Revision: https://reviews.llvm.org/D66675

llvm-svn: 369800
2019-08-23 19:42:09 +00:00
Louis Dionne 344eee9227 [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

llvm-svn: 369764
2019-08-23 15:05:54 +00:00
Nico Weber 01d7fe7605 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

llvm-svn: 369757
2019-08-23 13:40:54 +00:00
Louis Dionne b43923da5b [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.

llvm-svn: 369693
2019-08-22 19:35:46 +00:00
Louis Dionne 347c7d682e [libc++] Mark lock_guard nodiscard test as unsupported in C++03
llvm-svn: 369672
2019-08-22 17:24:24 +00:00
Nico Weber 0f3efc4aab libcxx: Rename last two .hpp files in libcxx to .h
Differential Revision: https://reviews.llvm.org/D66544

llvm-svn: 369597
2019-08-21 22:38:38 +00:00
David Spickett e2b200b7bf [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

llvm-svn: 369537
2019-08-21 15:38:24 +00:00
Nico Weber f938755a33 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

llvm-svn: 369487
2019-08-21 01:59:12 +00:00
Eric Fiselier 5b59295011 Fix missing __muloti4 function with UBSAN
llvm-svn: 369483
2019-08-21 00:16:33 +00:00
Eric Fiselier a6edef3563 Attempt to fix MSAN failures in benchmarks
llvm-svn: 369482
2019-08-21 00:14:48 +00:00
Nico Weber cc89063bff 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

llvm-svn: 369481
2019-08-21 00:14:12 +00:00
Marshall Clow 4f41779cca Add a missing _VSTD:: before a call to merge. Fixes PR43034. Checked the rest of 'algorithm' looking for unqualified calls. Didn't find any.
llvm-svn: 369463
2019-08-20 22:23:35 +00:00
Marshall Clow 7fa6865392 Fix a couple of unguarded operator, calls in algorithm. Fixes PR#43063. Updated all the heap tests to check this.
llvm-svn: 369448
2019-08-20 21:31:51 +00:00
Zoe Carver 80ddfcb5b8 [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.

llvm-svn: 369437
2019-08-20 20:44:59 +00:00
Louis Dionne c310e5a7ab [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).

llvm-svn: 369429
2019-08-20 19:28:26 +00:00
Eric Fiselier bc2f425377 fix buildbot start script to no longer hang
llvm-svn: 369428
2019-08-20 19:06:23 +00:00
Louis Dionne fc4486c247 [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

llvm-svn: 369422
2019-08-20 18:21:06 +00:00
Louis Dionne 958987bfdd [libc++] Precise XFAIL for AppleClang 11
This test doesn't fail on all patch levels of AppleClang 11

llvm-svn: 369420
2019-08-20 18:05:06 +00:00
Eric Fiselier 1d37ec1fda bump lld version used by buildbots
llvm-svn: 369416
2019-08-20 17:43:00 +00:00
Zoe Carver 86d560ff1b [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.

llvm-svn: 369413
2019-08-20 17:09:00 +00:00
Louis Dionne cb93f650b6 [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.

llvm-svn: 369409
2019-08-20 16:45:27 +00:00
Louis Dionne ab50b830d0 [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.

llvm-svn: 369406
2019-08-20 16:41:38 +00:00
Marshall Clow 696630eaf2 Fix availability of __thread_id on builds with external threading. Reviewed as https://reviews.llvm.org/D66480
llvm-svn: 369399
2019-08-20 16:16:23 +00:00
Zoe Carver 6585f018ad [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.

llvm-svn: 369394
2019-08-20 15:43:25 +00:00
Louis Dionne a47ca1ea6d [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

llvm-svn: 369393
2019-08-20 15:39:20 +00:00
Mikhail Maltsev a83220c6f2 [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.

llvm-svn: 369364
2019-08-20 10:19:55 +00:00
Louis Dionne 5a14c17221 Provide a meaningful diagnostic when LLVM_PATH doesn't point to a directory
llvm-svn: 369312
2019-08-19 23:51:26 +00:00
Louis Dionne 296757c07c [libc++] Add XFAIL for is_base_of test on AppleClang 11
llvm-svn: 369280
2019-08-19 17:29:42 +00:00
Zoe Carver 471bbb6e72 [libc++] reverts commit a5f5aad568.
The commit being reverted caused segfaults when building
with libc++ and GCC (and possibly other configurations).

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

llvm-svn: 369270
2019-08-19 15:47:16 +00:00
Marshall Clow 2e80d01fa7 Fix thread comparison by making sure we never pass our special 'not a thread' value to the underlying implementation. Fixes PR#42918.
llvm-svn: 368916
2019-08-14 20:54:56 +00:00
Louis Dionne 3f274d4a55 [libc++] Mark <chrono> test as unsupported on AppleClang 9
llvm-svn: 368914
2019-08-14 20:27:56 +00:00
Louis Dionne b4aebff4f1 [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.

llvm-svn: 368911
2019-08-14 20:17:18 +00:00
Zoe Carver a5f5aad568 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.
llvm-svn: 368885
2019-08-14 17:19:25 +00:00
Louis Dionne 619172a818 [libc++] Enable <chrono> ""d and ""y literals for AppleClang 10 and up
AppleClang supports those literals starting in version 10.0.1.

llvm-svn: 368882
2019-08-14 17:04:31 +00:00
Louis Dionne 3555af7120 [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.

llvm-svn: 368880
2019-08-14 17:01:08 +00:00
Marshall Clow 2b1d42541f 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
llvm-svn: 368867
2019-08-14 16:21:27 +00:00
Louis Dionne 10f0668b57 [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.

llvm-svn: 368749
2019-08-13 21:34:49 +00:00
Louis Dionne 8a033a9e3f [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

llvm-svn: 368703
2019-08-13 15:02:53 +00:00
Louis Dionne fa8cb90e6f [libc++] Fix incorrect UNSUPPORTED annotation
The test was marked as UNSUPPORTED for clang-6 and clang-6, instead of
clang-6 and clang-7.

llvm-svn: 368666
2019-08-13 11:25:16 +00:00
Louis Dionne 86dd28a547 [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

llvm-svn: 368664
2019-08-13 11:12:28 +00:00
Louis Dionne 1308011e1b [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

llvm-svn: 368599
2019-08-12 18:30:31 +00:00
Eric Fiselier b0945e1bd2 Improve codegen for deque.
This patch rewrites a few loops in deque and split_buffer to better
optimize the codegen. For constructors like
`deque<unsigned char> d(500000, 0);` this patch results in a 2x speedup.

The patch improves the codegen  in roughly three ways:

1. Changes do { ... } while (...) loops into more typical for loops.
  The optimizer can reason about normal looking loops better.

2. Split the iteration over a range into (A) iteration over the blocks,
then (B) iteration within the block. This nested structure helps LLVM
lower the inner loop to `memset`.

3. Do fewer things each iteration. Some of these loops were incrementing
  or changing 4-5 variables every loop (in addition to the
  construction). Previously most loops would increment the end pointer,
  the size, and decrement the count of remaining items to construct.
  Now we only increment a single pointer for most iterations.

llvm-svn: 368547
2019-08-12 07:51:05 +00:00
Louis Dionne 5f92cb7014 [libc++] Fix environment variable passing in libc++'s `SSHExecutor` `lit` utility
Summary:
Quote the value of environment variables when passing them to the SSH
client in SSHExecutor in libc++'s lit utilities. Without the quotes,
an environment variable like FOO="buzz bar" gets passed incorrectly
like this, ssh env FOO=buzz bar, which causes bar to be treated as a
command to run, not part of the environment variable value.

We ran into this when using SSHExecutor to do bringup of our CUDA
libcu++ port on an embedded aarch64 system.

Patch by Bryce Adelstein Lelbach.

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

llvm-svn: 368317
2019-08-08 17:33:35 +00:00
Marshall Clow fde236b1f7 Implement hh_mm_ss from P1466R3. Reviewed as https://reviews.llvm.org/D65365.
llvm-svn: 368299
2019-08-08 14:36:07 +00:00
Louis Dionne bf4808439f [pstl] Add a __pstl_config_site header to record the CMake configuration
This commit adds a __pstl_config_site header that contains the value of
macros specified at CMake configuration time. It works similarly to
libc++'s __config_site header, except we always include it as a separate
file instead of concatenating it to the main configuration header.

It is necessary to thread the includes for that header into libc++'s
lit configuration, otherwise we'd be requiring an installation step
prior to running the test suite.

llvm-svn: 368284
2019-08-08 12:43:04 +00:00
Louis Dionne 80ef2f05d8 Revert "[libc++] Take 3: Do not cleverly link against libc++abi just because it happens to be there"
This also reverts "[libc++] Remove temporary hack for D63883".
Clearly, I don't understand how the Linux build bots are configured.

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

llvm-svn: 368238
2019-08-08 00:28:06 +00:00
Louis Dionne 127af283ab [libc++] Remove temporary hack for D63883
This should fix the build bots, who now specify explicitly that they're
building against libc++abi.

llvm-svn: 368216
2019-08-07 21:51:01 +00:00
Louis Dionne e0eed65e06 [libc++] Take 3: Do not cleverly link against libc++abi just because it happens to be there
Summary:
Otherwise, when libcxxabi is not an enabled project in the monorepo, we
get a link error because we try to link against non-existent cxxabi_shared.

More generally, we shouldn't change the behavior of the build based on
implicit things like whether a file happens to be at a specific path or
not.

This is a re-application of r365222 that had been reverted in r365233
and then r365359 because it broke the build bots. The build bots
should now specify explicitly what ABI library they want to use
(libc++abi), so this commit should now be OK to merge. It takes a while
for build bots to pick up configuration changes, which is why this failed
the last time around.

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

llvm-svn: 368213
2019-08-07 21:36:03 +00:00
Louis Dionne 956892433f [pstl][libc++] Provide uglified header names for interface headers
For the few (currently four) headers that make up the PSTL's interface
to other Standard Libraries, provide a stable uglified header file that
can be included by those Standard Libraries.

We can then more easily change the internal organization of the PSTL
without having to change the integration with Standard Libraries.

llvm-svn: 368088
2019-08-06 21:11:24 +00:00
Louis Dionne 53e9c2d76b [libc++] Use the monorepo for the back-deployment testing scripts
llvm-svn: 368077
2019-08-06 20:01:28 +00:00
Louis Dionne 8442252c49 [libc++] Use the monorepo in the macos-trunk CI script
llvm-svn: 368051
2019-08-06 15:28:34 +00:00
Louis Dionne d131713307 [libc++] Accept any non-zero return for .fail.cpp tests
llvm-svn: 367930
2019-08-05 21:26:50 +00:00
Louis Dionne 0a06eb911b [libc++] Take 2: Integrate the PSTL into libc++
Summary:
This commit allows specifying LIBCXX_ENABLE_PARALLEL_ALGORITHMS when
configuring libc++ in CMake. When that option is enabled, libc++ will
assume that the PSTL can be found somewhere on the CMake module path,
and it will provide the C++17 parallel algorithms based on the PSTL
(that is assumed to be available).

The commit also adds support for running the PSTL tests as part of
the libc++ test suite.

The first attempt to commit this failed because it exposed a bug in the
tests for modules. Now that this has been fixed, it should be safe to
commit this.

Reviewers: EricWF

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

Tags: #libc

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

llvm-svn: 367903
2019-08-05 18:29:14 +00:00
Eric Fiselier 278d593014 Revert "Suppress -Wctad-maybe-unsupported on types w/o deduction guides."
Some modules builds are issuing buggy diagnostics. The cause of which is
TBD.

This reverts commit r@367770.

llvm-svn: 367777
2019-08-04 07:13:43 +00:00
Eric Fiselier fcd549a7d8 Suppress -Wctad-maybe-unsupported on types w/o deduction guides.
There are a handful of standard library types that are intended
to support CTAD but don't need any explicit deduction guides to
do so.

This patch adds a dummy deduction guide to those types to suppress
-Wctad-maybe-unsupported (which gets emitted in user code).

llvm-svn: 367770
2019-08-03 23:54:29 +00:00
Eric Fiselier 208e8a1b66 Revert accidental change to __member_pointer_traits_imp.
A previous patch accidentally made the primary template
an incomplete type. This broke some C++03 constructs.

llvm-svn: 367762
2019-08-03 19:03:22 +00:00
Eric Fiselier 10bf563171 Simplify <type_traits> implementations.
This patch rewrites a number of old meta-function implementations
that assumed const/volatile could not be safely applied to all types.
This is no longer the case, though for some types (Ex function types),
the const qualifier can be ignored.

The largest improvement in this patch is the reduction of is_function.
Thanks to Matt Calabrese for the improved implementation.

llvm-svn: 367749
2019-08-03 05:01:34 +00:00
Eric Fiselier c4952da401 Add benchmarks to test the cost of allocator
llvm-svn: 367722
2019-08-02 21:13:38 +00:00
Eric Fiselier d544d1441d Refactor deque to centralize handling of spare blocks.
I have upcoming changes that modify how deque handles spare blocks.
This cleanup is intended to make those changes easier to review
and understand. This patch should have NFC.

llvm-svn: 367631
2019-08-01 23:11:18 +00:00
Eric Fiselier 8f2124b47a Teach malloc_allocator how to count bytes
llvm-svn: 367606
2019-08-01 19:52:46 +00:00
Eric Fiselier 3eb5aec61f Change default bucket count in hash_set/hash_map.
Previously these types rehashed to a table of 193 elements
upon construction. But this is non-ideal, first because default
constructors should not allocate unless necessary, and second
because 193 is big and can waste a bunch of memory.

This number had previously been chosen to match GCC's implementation.

llvm-svn: 367605
2019-08-01 19:48:29 +00:00
Roman Lebedev 1e4a094b37 [benchmark] Fix win32 link on case-sensitive fs
Summary: This fixes cross-builds with MinGW from case-sensitive file-systems (on Linux)

This is a cherry-pick from
https://github.com/google/benchmark/pull/840
8e48105d46

Original patch by: @jschueller (Julien Schueller) !

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

llvm-svn: 367356
2019-07-30 20:47:59 +00:00
Eric Fiselier 54bb5413e6 add more information to benchmark test failures
llvm-svn: 367319
2019-07-30 15:11:41 +00:00
Nico Weber 9aae539d4c libcxx: Define __STDCPP_THREADS__ to 1, not to __cplusplus.
[cpp.predefined]p2:

   __STDCPP_THREADS__
    Defined, and has the value integer literal 1, if and only if a program
    can have more than one thread of execution .

Also define it only if it's not defined already, since it's supposed
to be defined by the compiler.

Also move it from thread to __config (which requires setting it only
if _LIBCPP_HAS_NO_THREADS is not defined).

Part of PR33230. The intent is to eventually make the compiler define
this instead.

llvm-svn: 367316
2019-07-30 14:32:47 +00:00
Eric Fiselier b49d45925c Fix tests with modules enabled
llvm-svn: 367268
2019-07-29 22:48:51 +00:00
Eric Fiselier 0c045f135d Ensure __config_site definitions are passed to modules tests.
The test configuration contained a bug where we only raised
the __config_site commands to the command line if modules were
enabled for all of the libc++ tests. However there are special
modules-only tests, and these tests weren't getting the correct
defines.

This patch corrects that issue.

llvm-svn: 367267
2019-07-29 22:48:34 +00:00
Eric Fiselier d4ace50ed0 Fix PR35637: suboptimal codegen for `vector<unsigned char>`.
The optimizer is petulant and temperamental. In this case LLVM failed to lower
the the "insert at end" loop used by`vector<unsigned char>` to a `memset` despite
`memset` being substantially faster over a range of bytes.

LLVM has the ability to lower loops to `memset` whet appropriate, but the
odd nature of libc++'s loops prevented the optimization from taking places.

This patch addresses the issue by rewriting the loops from the form
`do [ ... --__n; } while (__n > 0);` to instead use a for loop over a pointer
range (For example: `for (auto *__i = ...; __i < __e; ++__i)`).

This patch also rewrites the asan annotations to unposion all additional memory
at the start of the loop instead of once per iterations. This could potentially
permit false negatives where the constructor of element N attempts to access
element N + 1 during its construction.

The before and after results for the `BM_ConstructSize/vector_byte/5140480_mean`
benchmark (run 5 times) are:

--------------------------------------------------------------------------------------------
Benchmark                                                 Time             CPU   Iterations
--------------------------------------------------------------------------------------------
Before
------
BM_ConstructSize/vector_byte/5140480_mean          12530140 ns     12469693 ns            N/A
BM_ConstructSize/vector_byte/5140480_median        12512818 ns     12445571 ns            N/A
BM_ConstructSize/vector_byte/5140480_stddev          106224 ns       107907 ns            5
-----
After
-----
BM_ConstructSize/vector_byte/5140480_mean            167285 ns       166500 ns            N/A
BM_ConstructSize/vector_byte/5140480_median          166749 ns       166069 ns            N/A
BM_ConstructSize/vector_byte/5140480_stddev            3242 ns         3184 ns            5

llvm-svn: 367183
2019-07-28 04:37:02 +00:00
Marshall Clow 736e8aa8ed Fix a bug in std::chrono::abs where it would fail when the duration's period had not been reduced.s
llvm-svn: 367120
2019-07-26 15:10:46 +00:00
Louis Dionne 568bb7eeb6 [NFC][libcxx] Add comments about making mutex/condition_variable trivial on Apple platforms
Leaving some comments behind so that we avoid re-having that discussion
in the future.

llvm-svn: 367048
2019-07-25 20:29:20 +00:00
Marshall Clow db99d3a2a2 Implement change #4 of P1466: Change weekday to accept both 0 and 7 as Sunday. Add accessors 'c_encoding' and 'iso_encoding' to provide different interpretations of the weekday. Remove 'operator unsigned'
llvm-svn: 366981
2019-07-25 03:26:05 +00:00
David Tenty b9179ff857 [AIX][lit] Don't depend on psutil on AIX
Summary:
On AIX psutil can run into problems with permissions to read the process
tree, which causes problems for python timeout tests which need to kill off
a test and it's children.

This patch adds a workaround by invoking shell via subprocess and using a
platform specific option to ps to list all the descendant processes so we can
kill them. We add some checks so lit can tell whether timeout tests are
supported with out exposing whether we are utilizing the psutil
implementation or the alternative.

Reviewers: hubert.reinterpretcast, andusy, davide, delcypher

Reviewed By: delcypher

Subscribers: davide, delcypher, christof, lldb-commits, libcxx-commits, llvm-commits

Tags: #lldb, #libc, #llvm

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

llvm-svn: 366912
2019-07-24 15:04:27 +00:00
Roger Ferrer Ibanez 09e6304440 [RISCV] Implement benchmark::cycleclock::Now
This is a cherrypick of D64237 onto llvm/utils/benchmark and
libcxx/utils/google-benchmark.

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

llvm-svn: 366868
2019-07-24 05:33:46 +00:00
Marshall Clow 30f12a4247 Implement most of P1612R1: Relocate endian. Moves the std::endian functionality from 'type-traits' to 'bit'. No other change. The reason that this is 'partial' is that P1621 also recommends a feature-test macro, but I don't have the value for that one yet. In a month or so, I'll add that
llvm-svn: 366776
2019-07-23 04:20:19 +00:00
Louis Dionne e35c5121da [NFC][libc++] Add missing EXPLICIT to pair and tuple synopsis
The constructors for std::pair and std::tuple have been made conditionally
explicit, however the synopsis in the headers do not reflect that.

llvm-svn: 366735
2019-07-22 20:45:23 +00:00
Yi Kong d8bdb9225c [runtimes] Don't depend on libpthread on Android
r362048 added support for ELF dependent libraries, but broke Android
build since Android does not have libpthread. Remove the dependency on
the Android build.

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

llvm-svn: 366734
2019-07-22 20:41:03 +00:00
Petr Hosek 89385633ba [libc++] Set __file_ to 0 in basic_filebuf::close() even if fclose fails
This issue was detected by ASan in one of our tests. This test manually
invokes basic_filebuf::cloe(). fclose(__h.release() returned a non-zero
exit status, so __file_ wasn't set to 0. Later when basic_filebuf
destructor ran, we would enter the if (__file_) block again leading to
heap-use-after-free error.

The POSIX specification for fclose says that independently of the return
value, fclose closes the underlying file descriptor and any further
access (including another call to fclose()) to the stream results in
undefined behavior. This is exactly what happened in our test case.

To avoid this issue, we have to always set __file_ to 0 independently of
the fclose return value.

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

llvm-svn: 366730
2019-07-22 19:54:34 +00:00
Louis Dionne c3e452acde [libc++] Do not infer support for C++17 in GCC < 7
libc++'s lit configuration infers the C++ language dialect when it is
not provided by checking which -std= flags that a compiler supports.
GCC 5 and GCC 6 have a -std=c++17 flag, however, they do not have full
C++17 support. The lit configuration has hardcoded logic that removes
-std=c++1z as an option to test for GCC < 7, but not -std=c++17.

This leads to a bunch of failures when running libc++ tests with GCC 5
or GCC 6. This patch adds -std=c++17 to the list of flags that are
discarded for GCC < 7 by lit's language dialect inference.

Thanks to Bryce Adelstein Lelbach for the patch.

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

llvm-svn: 366700
2019-07-22 16:24:48 +00:00
Marshall Clow 6e9dfc499d Update c++2a status page with post-Cologne information
llvm-svn: 366696
2019-07-22 15:13:14 +00:00
Louis Dionne 4e8c8aa959 [libc++] Mark libcpp_deallocate.sh.cpp as UNSUPPORTED instead of XFAIL on AppleClang 9
Some minor versions of AppleClang 9 appear not to fail the test. It's
such a mess that the only sane thing to do is to mark the test as
UNSUPPORTED.

llvm-svn: 366606
2019-07-19 19:41:40 +00:00
Louis Dionne a3c83b7511 Revert "[libc++] Integrate the PSTL into libc++"
This reverts r366593, which caused unforeseen breakage on the build bots.
I'm reverting until the problems have been figured out and fixed.

llvm-svn: 366603
2019-07-19 18:52:46 +00:00
Louis Dionne 3b1ef58128 [libc++] Allow passing additional CMake arguments in macOS trunk CI script
llvm-svn: 366601
2019-07-19 18:47:00 +00:00
Louis Dionne a5bd48939c [libc++] Use _EnableIf instead of std::enable_if in deduction guides for map and set
llvm-svn: 366594
2019-07-19 17:13:39 +00:00
Louis Dionne 910323e667 [libc++] Integrate the PSTL into libc++
Summary:
This commit allows specifying LIBCXX_ENABLE_PARALLEL_ALGORITHMS when
configuring libc++ in CMake. When that option is enabled, libc++ will
assume that the PSTL can be found somewhere on the CMake module path,
and it will provide the C++17 parallel algorithms based on the PSTL
(that is assumed to be available).

The commit also adds support for running the PSTL tests as part of
the libc++ test suite.

Reviewers: rodgert, EricWF

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

Tags: #libc

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

llvm-svn: 366593
2019-07-19 17:02:42 +00:00
Louis Dionne 9e6a42a185 [libc++] Add missing %link_flags to .sh.cpp test
Without the link flags, the test always fails on Linux. For some reason,
however, it works on Darwin -- which is why it wasn't caught at first.

llvm-svn: 366579
2019-07-19 14:01:48 +00:00
Louis Dionne e068c7463f [libc++] Fix link error with _LIBCPP_HIDE_FROM_ABI_PER_TU and std::string
Summary:
This is effectively a revert of r344616, which was a partial fix for
PR38964 (compilation of <string> with GCC in C++03 mode). However, that
configuration is explicitly not supported anymore and that partial fix
breaks compilation with Clang when per-TU insulation is provided.

PR42676
rdar://52899715

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

llvm-svn: 366567
2019-07-19 11:52:55 +00:00
Louis Dionne e1eabcdfad [libc++] Add C++17 deduction guides for std::function
Summary: http://llvm.org/PR39606

Reviewers: Quuxplusone

Subscribers: christof, dexonsmith, libcxx-commits

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

llvm-svn: 366484
2019-07-18 19:50:56 +00:00
Hans Wennborg 8f5b44aead Bump the trunk version to 10.0.0svn
and clear the release notes.

llvm-svn: 366427
2019-07-18 11:51:05 +00:00
Louis Dionne 66412df94f [libc++] XFAIL a test that does not behave properly on older Clang
rdar://53015486

llvm-svn: 366359
2019-07-17 18:54:29 +00:00
Louis Dionne e559f62506 [libcxx] Rejigger test for destroying delete feature-test macros
In r361572, we introduced library support for C++20 destroying delete
and decided to only define the library feature-test macro when the
compiler supports the underlying language feature. This patch reworks
the tests to mirror that.

llvm-svn: 366263
2019-07-16 21:13:40 +00:00
Louis Dionne 12154ee8f1 [libc++] Add missing UNSUPPORTED for CTAD tests
The tests for unordered_set and unordered_multiset were missing UNSUPPORTED
markup for Apple Clang 9.1, which is still being used on some CI bots.

llvm-svn: 366259
2019-07-16 20:41:33 +00:00
Zoe Carver a17b1aed6a Add contains method to associative containers. This patch implements P0458R2, adding contains to map, multimap, unordered_map, unordered_multimap, set, multiset, unordered_set, and unordered_multiset.
llvm-svn: 366170
2019-07-16 03:21:01 +00:00
Louis Dionne dfcd4384cb [libc++] Implement P0433: deduction guides for <unordered_map>
Thanks to Arthur O'Dwyer for the patch.

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

llvm-svn: 366124
2019-07-15 20:06:01 +00:00
Eric Fiselier c5d7b0c454 Constrain workaround to avoid affecting other buildbots
llvm-svn: 366122
2019-07-15 19:53:42 +00:00
Eric Fiselier 4066978cb7 Improve compile time of variant.
In particular, improve the compile time of the overload set builder
that variant uses to determine which alternative to construct.

Instead of having the __overload type construct itself recursively,
this patch uses a flat construction for the overload set.

llvm-svn: 366033
2019-07-14 21:29:39 +00:00
Eric Fiselier 3c0e2bb0cb Add test for variant construction with duplicate types.
llvm-svn: 366032
2019-07-14 20:59:51 +00:00
Eric Fiselier aae0cb67ed Cleanup whitespace in <variant>. NFC.
llvm-svn: 366026
2019-07-14 18:31:55 +00:00
Eric Fiselier 273857d1ea Harden variant test added in r366022
The test was brittle since it only went boom for one specific type, when
really it should go boom for all of them.

llvm-svn: 366025
2019-07-14 18:30:34 +00:00
Eric Fiselier 194b337f33 Avoid eager template instantiation caused by the variant narrowing checks.
The standard disallows narrowing conversions when constructing a variant.
This is checked by attempting to perform braced initialization of the
destination type from the argument type. However, braced initialization
can force the compiler (mostly clang) to eagerly instantiate the
constructors of the destintation type -- which can lead to errors in
a non-immediate context.

However, as variant is currently specified, the narrowing checks only
observably apply when the destination type is arithmetic. Meaning we can
skip the check for class types. Hense avoiding the hard errors.

In order to cause fewer build breakages, this patch avoids the narrowing
check except when the destination type is arithmetic.

llvm-svn: 366022
2019-07-14 18:21:15 +00:00
Eric Fiselier 882fdf68b7 Fix non-conformance it `std::tuple`.
Previously we implemented all one trillion tuple-like constructors using
a single generic overload. This worked fairly well, except that it
differed in behavior from the standard version because it didn't
consider both T&& and T const&. This was observable for certain
types.

This patch addresses that issue by splitting the generic constructor
in two. We now provide both T&& and T const& versions of the
tuple-like constructors (sort of).

llvm-svn: 365973
2019-07-12 23:01:48 +00:00
Eric Fiselier 128af31595 Add option to disable variant narrowing conversion changes.
The paper P0608R3 - "A sane variant converting constructor" disallows
narrowing conversions in variant. It was meant to address this
surprising problem:

  std::variant<std::string, bool> v = "abc";
  assert(v.index() == 1); // constructs a bool.

However, it also disables every potentially narrowing conversion. For
example:

  variant<unsigned> v = 0; // ill-formed
  variant<string, double> v2 = 42; // ill-formed (int -> double narrows)

These latter changes break code. A lot of code. Within Google it broke
on the order of a hundred thousand target with thousands of root causes
responsible for the breakages.

Of the breakages related to the narrowing restrictions, none of them
exposed outstanding bugs. However, the breakages caused by boolean
conversions (~13 root causes), all but one of them were bugs.

For this reasons, I am adding a flag to disable the narrowing conversion
changes but not the boolean conversions one.

One purpose of this flag is to allow users to opt-out of breaking changes
in variant until the offending code can be cleaned up. For non-trivial
variant usages the amount of cleanup may be significant.

This flag is also required to support automated tooling, such as
clang-tidy, that can automatically fix code broken by this change.
In order for clang-tidy to know the correct alternative to construct,
it must know what alternative was being constructed previously, which
means running it over the old version of std::variant.

Because this change breaks so much code, I will be implementing the
aforementioned clang-tidy check in the very near future.

Additionally I'm plan present this new information to the committee so they can
re-consider if this is a breaking change we want to make.

I think libc++ should very seriously consider pulling this change
before the 9.0 release branch is cut. But that's a separate discussion
that I will start on the lists.

For now this is the minimal first step.

llvm-svn: 365960
2019-07-12 21:32:11 +00:00
Louis Dionne 189639b1c3 [libc++] Add XFAILs for CTAD tests on older compilers
llvm-svn: 365923
2019-07-12 17:30:57 +00:00
Eric Fiselier d49103bd2f Mark destroying delete test as UNSUPPORTED with clang 7
llvm-svn: 365856
2019-07-12 01:16:08 +00:00
Eric Fiselier a780216fb3 Tolerate import errors in "not.py" implementation
llvm-svn: 365855
2019-07-12 01:13:05 +00:00
Marshall Clow f3b851f0b8 Reorganize the 'bit' header to make most of the facilities available for internal use pre-C++20. NFC for external users
llvm-svn: 365854
2019-07-12 01:01:55 +00:00
Eric Fiselier 02fdc51c04 Add another buildbot username to the workaround list
llvm-svn: 365848
2019-07-12 00:16:38 +00:00
Eric Fiselier ce13f67618 Attempt to override broken buildbot config for libc++abi.
The buildbots were changed to pass -DLIBCXX_CXX_ABI=libcxxabi, but
they don't provide an include path for the library, so cxxabi.h is
never found while building libc++.

This is a temporary change until the buildbots are updated or until
D63883 lands in a form that unbreaks the bots

llvm-svn: 365847
2019-07-12 00:02:49 +00:00
Eric Fiselier 41798c05cd Fix memory leak in set and map.
When assigning an initializer list into set/map, libc++ would
leak memory if the initializer list contained equivalent keys
because we failed to check if the insertion was successful.

llvm-svn: 365840
2019-07-11 23:13:38 +00:00
Louis Dionne 296a80102a [libc++] Implement deduction guides for <unordered_set>
Thanks to Arthur O'Dwyer for the patch.
Differential Revision: https://reviews.llvm.org/D58617

llvm-svn: 365788
2019-07-11 15:16:39 +00:00
Saleem Abdulrasool 97d6fcce4e build: use multiple `install` rather than building up a list
Rather than building up a list to iterate over later, just create multiple
install commands based on the configuration. This makes it easier to see what
is getting installed and allows for the install handling to be centralised. NFC

llvm-svn: 365562
2019-07-09 21:43:01 +00:00
Vitaly Buka a9d5c186e2 Revert "[libc++] Take 2: Do not cleverly link against libc++abi just because it happens to be there"
r365326 still breaks bots:
http://lab.llvm.org:8011/builders/netbsd-amd64/builds/20712/steps/ninja%20build%20local/logs/stdio
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/39477/steps/test%20tsan%20in%20debug%20compiler-rt%20build/logs/stdio

And probably others

This reverts commit 945b9ec069.

llvm-svn: 365359
2019-07-08 17:46:23 +00:00
Louis Dionne 945b9ec069 [libc++] Take 2: Do not cleverly link against libc++abi just because it happens to be there
Summary:
Otherwise, when libcxxabi is not an enabled project in the monorepo, we
get a link error because we try to link against non-existent cxxabi_shared.

More generally, we shouldn't change the behavior of the build based on
implicit things like whether a file happens to be at a specific path or
not.

This is a re-application of r365222 that had been reverted in r365233
because it broke the build bots. However, the build bots now specify
explicitly what ABI library they want to use (libc++abi), so this
commit should now be OK to merge.

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

llvm-svn: 365326
2019-07-08 14:49:35 +00:00
Marshall Clow f814dcbafb Make forward_list::remove/remove_if/unique all return void before C++20; undoes that bit of D58332. Thanks to Mikhail Maltsev for pointing this out
llvm-svn: 365290
2019-07-08 03:45:28 +00:00
Eric Fiselier 8cedf04a6c Make ~mutex and ~condition_variable trivial on Windows.
The implementations of __libcpp_mutex_destroy and __libcpp_condvar_destroy
are already NOPs, so this optimization is safe to perform.

See r365273 and PR27658 for more information.

llvm-svn: 365281
2019-07-07 17:24:03 +00:00
Eric Fiselier 8baf83839e Fix PR27658 - Make ~mutex trivial when possible.
Currently std::mutex has a constexpr constructor, but a non-trivial
destruction.

The constexpr constructor is required to ensure the construction of a
mutex with static storage duration happens at compile time, during
constant initialization, and not during dynamic initialization.
This means that static mutex's are always initialized and can be used
safely during dynamic initialization without the "static initialization
order fiasco".

A trivial destructor is important for similar reasons. If a mutex is
used during dynamic initialization it might also be used during program
termination. If a static mutex has a non-trivial destructor it will be
invoked during termination. This can introduce the "static
deinitialization order fiasco".

Additionally, function-local statics emit a guard variable around
non-trivially destructible types. This results in horrible codegen and
adds a runtime cost to every call to that function. non-local static's
also result in slightly worse codegen but it's not as big of a problem.

Example codegen can be found here: https://goo.gl/3CSzbM

Note: This optimization is not safe with every pthread implementation.
Some implementations allocate on the first call to pthread_mutex_lock
and free the allocation in pthread_mutex_destroy.

Also, changing the triviality of the destructor is not an ABI break.
At least to the best of my knowledge :-)

llvm-svn: 365273
2019-07-07 01:20:54 +00:00
Marshall Clow 1ab3fe8a7a Make list::remove/remove_if/unique all return void before C++20; undoes that bit of D58332. Thanks to Mikhail Maltsev for pointing this out
llvm-svn: 365261
2019-07-06 06:10:03 +00:00
Zoe Carver 28e0187175 This patch makes swap functions constexpr. Both swap overloads, swap_ranges and iter_swap are updated (with tests).
llvm-svn: 365238
2019-07-05 20:13:34 +00:00
Louis Dionne 51de516486 Revert "[libc++] Do not cleverly link against libc++abi just because it happens to be there"
This reverts r365222, which broke the libc++ build bots.

llvm-svn: 365233
2019-07-05 18:44:25 +00:00
Louis Dionne 4ba29e5fbe [libc++] Do not cleverly link against libc++abi just because it happens to be there
Summary:
Otherwise, when libcxxabi is not an enabled project in the monorepo, we
get a link error because we try to link against non-existent cxxabi_shared.

More generally, we shouldn't change the behavior of the build based on
implicit things like whether a file happens to be at a specific path or
not.

Reviewers: EricWF

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

Tags: #libc

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

llvm-svn: 365222
2019-07-05 17:06:23 +00:00
Saleem Abdulrasool bce9d8b138 docs: add documentation for `LIBCXX_INCLUDE_TESTS`
Add some missing documentation for the `LIBCXX_INCLUDE_TESTS` option.

Patch by Jean Heyd Meneide!

llvm-svn: 365154
2019-07-04 19:08:16 +00:00
Marshall Clow 7afe9ea96f Add tests for regex_match ambiguity (aka LWG2273). NFC. Reviewed as https://reviews.llvm.org/D63051
llvm-svn: 365080
2019-07-03 20:32:35 +00:00
Eric Fiselier f1807a7df6 Fix tuple's conditionally explicit constructors for very weird user
types.

It seems some people like to write types that can explicitly convert
to anything, but cannot be used to explicitly construct anything.

This patch makes tuple tolerate such types, as is required
by the standard.

llvm-svn: 365074
2019-07-03 19:21:40 +00:00
Louis Dionne 1c478d6e85 [libc++] Update availability markup for Filesystem on Apple platforms
llvm-svn: 365068
2019-07-03 18:29:02 +00:00
Marshall Clow 2a622b30e3 Update status of papers for upcoming WG21 meeting. NFC
llvm-svn: 364885
2019-07-02 03:23:06 +00:00
Marshall Clow bd7f84a482 Use new '__libcpp_is_constant_evaluated' call to remove an '#ifdef' from the bit code. NFC
llvm-svn: 364884
2019-07-02 03:21:16 +00:00
Marshall Clow 745379a0af Mark the newly added '__libcpp_is_constant_evaluated' as 'inline', since it can be included multiple times by multiple headers, and we don't want 'duplicate definition' errors.
llvm-svn: 364879
2019-07-02 00:20:06 +00:00
Marshall Clow 491ddc00ae Add a private call '__libcpp_is_constant_evaluated' which 'works' for old language versions and w/o any compiler support. 'Working', in this case, means that it returns false in those cases.
llvm-svn: 364873
2019-07-01 23:16:46 +00:00
Marshall Clow fc61db5a3e Update status for bit operations
llvm-svn: 364863
2019-07-01 23:00:34 +00:00
Marshall Clow a5c3485a58 Bit Operations: P0556, P0553 and P1355. Reviewed as: https://reviews.llvm.org/D51262
llvm-svn: 364862
2019-07-01 23:00:32 +00:00
Eric Fiselier d1523f7a8c Ensure bitset's string constructor doesn't poison the overload set.
llvm-svn: 364842
2019-07-01 19:59:34 +00:00
Marshall Clow 24edf8ef4b Implement P0646R1: Erase-Like Algorithms Should Return size_type. Reviewed as https://reviews.llvm.org/D58332, and then updated because I rewrote a couple of those routines to eliminate some UB. Thanks to Zoe for tghe patch.
llvm-svn: 364840
2019-07-01 19:22:00 +00:00
Marshall Clow 3c125fe821 Implement LWG2221: 'Formatted output for nullptr_t' Reviewed as: https://reviews.llvm.org/D63053
llvm-svn: 364802
2019-07-01 16:20:25 +00:00
Bruce Mitchener 4603460a39 __threading_support: Remove (void) in favor of ().
Summary:
This fixes a clang-tidy warning when building something that uses
this file.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 364799
2019-07-01 16:18:38 +00:00
Bruce Mitchener ba41d3b1fd Fix -Wdouble-promotion warnings.
Reviewers: mclow.lists

Subscribers: christof, ldionne, cfe-commits, libcxx-commits

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

llvm-svn: 364798
2019-07-01 16:13:31 +00:00
Billy Robert O'Neal III 0384a78054 [libcxx] [test] Add void cast to result of compare_exchange_weak to suppress [[nodiscard]].
llvm-svn: 364732
2019-07-01 08:09:02 +00:00
Marshall Clow 954014a0fa Add a missing '__uncvref_t' to the SFINAE constraints for optional's assignment operator. Fixes PR38638. Thanks to Jonathan Wakely for the report
llvm-svn: 364574
2019-06-27 18:40:55 +00:00
Marshall Clow 7d8274d54d Followup to revision 364545: Turns out that clang issues different errors for C++11 vs c++2a, so I tweaked the 'expected-error' bits that I added to match either of them.
llvm-svn: 364554
2019-06-27 15:37:31 +00:00
Marshall Clow 9318430237 Provide hashers for string_view only if they are using the default char_traits. Seen on SO: test/std/strings/string.view/string.view.hash/char_type.hash.fail.cpp
llvm-svn: 364545
2019-06-27 14:18:32 +00:00
Eric Fiselier ae9e42f614 Revert "Change the ABI version and ABI namespace to be `_LIBCPP_VERSION`"
There are some suspicious bot failures that I want to ensure aren't
caused by this patch.

I'll recommit tomorrow.

llvm-svn: 364363
2019-06-26 00:05:14 +00:00
Eric Fiselier 1fa0f4b942 Change the ABI version and ABI namespace to be `_LIBCPP_VERSION`
when _LIBCPP_ABI_UNSTABLE is defined.

User defined _LIBCPP_ABI_NAMESPACE will still be respected,
but the default version namespace in unstable mode will be the libc++ version
(Currently '__9000').

Previously  `_LIBCPP_ABI_VERSION` and `_LIBCPP_ABI_NAMESPACE` were
`1` and `__1` respectively, whuch conflicted with the stable ABI

llvm-svn: 364354
2019-06-25 22:13:39 +00:00
Richard Smith 4bd4acc969 Fix test failures due to modified wording in Clang diagnostics.
llvm-svn: 364241
2019-06-24 22:01:03 +00:00
Richard Smith 66e6e37447 Fix test failures when using a custom ABI namespace.
llvm-svn: 364239
2019-06-24 21:46:05 +00:00
Michal Gorny a5bb7b6c20 [libcxx] [test] Read files as bytestrings to fix py3 encoding issues
Use binary mode to read test files in libcxx LibcxxTestFormat class.
This ensures that tests are read correctly independently of encoding,
and therefore fixes UnicodeDecodeError when file is opened in Python 3
that defaults to pure ASCII encoding.

Technically this could be also fixed via conditionally appending
encoding argument when opening the file in Python 3.  However, since
the code in question only searches for fixed ASCII substrings reading
it in binary mode is simpler and more universal.

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

llvm-svn: 364170
2019-06-24 09:40:33 +00:00
Eric Fiselier fb2bd4a939 Use C++11 implementation of unique_ptr in C++03.
llvm-svn: 364161
2019-06-23 20:47:21 +00:00
Eric Fiselier 3359a17b3a Apply new meta-programming traits throughout the library.
The new meta-programming primitives are lower cost than the old versions. This patch removes those old versions and switches libc++ to use the new ones.

llvm-svn: 364160
2019-06-23 20:28:29 +00:00
Eric Fiselier 8d7924560e Disable test by default
llvm-svn: 364149
2019-06-23 03:59:32 +00:00
Eric Fiselier de2b633a4a Add super fast _IsSame trait for internal use.
Clang provides __is_same that doesn't produce any instantiations
and just returns a bool. It's a lot faster than using std::is_same

I'll follow up with a patch to actually start using it.

llvm-svn: 364148
2019-06-23 03:58:41 +00:00
Eric Fiselier cf92a1f6eb Add noexcept throughout <atomic>
The CMake CheckLibcxxAtomic module was always failing to compile
the example, even when libatomic wasn't needed. This was caused
because the check doesn't link a C++ runtime library to provide
std::terminate, which is required for exception support.

The check is still really broken, but <atomic> is better!

llvm-svn: 364146
2019-06-23 02:49:12 +00:00
Eric Fiselier 2a31c9ba67 Fix placement of -Wno-ignored-attributes
llvm-svn: 364144
2019-06-23 00:31:18 +00:00
Eric Fiselier bc85dbe2ba Disable -Wignored-attributes for now
llvm-svn: 364142
2019-06-23 00:17:14 +00:00
Eric Fiselier 51a741c87f Add new style meta-programming primatives.
Using class templates instead of alias templates causes a lot of
instantiations. As part of the move away from C++03, we want to
improve the efficiency of our meta-programming.

This patch lays the groundwork by introducing new _If, _EnableIf,
_And, _Or, and _IsValidExpansion (detect member). Future patches
will replace the existing implementations after verifying there
compile time differences.

llvm-svn: 364114
2019-06-21 23:37:52 +00:00
Marshall Clow 410b650e67 Implement P0340R3: Make 'underlying_type' SFINAE-friendly. Reviewed as https://reviews.llvm.org/D63574
llvm-svn: 364094
2019-06-21 18:57:06 +00:00
Eric Fiselier e652f8097b Use rvalue references throughout the is_constructible traits.
llvm-svn: 364065
2019-06-21 15:35:33 +00:00
Eric Fiselier 000f25a37e Make move and forward work in C++03.
These functions are key to allowing the use of rvalues and variadics
in C++03 mode. Everything works the same as in C++11, except for one
tangentially related case:

struct T {
  T(T &&) = default;
};

In C++11, T has a deleted copy constructor. But in C++03 Clang gives
it both a move and a copy constructor. This seems reasonable enough
given the extensions it's using.

The other changes in this patch were the minimal set required
to keep the tests passing after the move/forward change. Most notably
the removal of the `__rv<unique_ptr>` hack that was present
in an attempt to make unique_ptr move only without language support.

llvm-svn: 364063
2019-06-21 15:20:55 +00:00
Eric Fiselier f044ebeb8d Enable aligned_union in C++03
llvm-svn: 364058
2019-06-21 14:45:08 +00:00
Eric Fiselier b6a9afa823 Get is_convertible tests passing in C++03 (except the fallback).
llvm-svn: 364057
2019-06-21 14:43:15 +00:00
Eric Fiselier 3503d84ae0 Remove dead non-variadic workarounds in <type_traits>
We can use variadics with clang

llvm-svn: 364054
2019-06-21 14:37:28 +00:00
Eric Fiselier 87cf92d9cb Make rvalue metaprogramming traits work in C++03.
The next step is to get move and forward working in C++03.

llvm-svn: 364053
2019-06-21 14:31:34 +00:00
Eric Fiselier 5b4cc84b87 Remove even more dead code.
llvm-svn: 364050
2019-06-21 14:09:32 +00:00
Eric Fiselier 395c7330e4 Assume __is_final, __is_base_of, and friends.
All the compilers we support provide these builtins. We don't
need to do a configuration dance anymore.

This patch also cleans up some dead or almost dead
C++11 feature detection macros.

llvm-svn: 364047
2019-06-21 13:56:13 +00:00
Eric Fiselier 8d30a6e40c Remove dead config now that C++03 requires Clang.
llvm-svn: 364031
2019-06-21 11:32:43 +00:00
Mikhail Maltsev cfdc7f0d7e [libc++] Avoid using timespec when it might not be available
Summary:
The type timespec is unconditionally used in __threading_support.
Since the C library is only required to provide it in C11, this might
cause problems for platforms with external thread porting layer (i.e.
when _LIBCPP_HAS_THREAD_API_EXTERNAL is defined) with pre-C11
C libraries.

In our downstream port of libc++ we used to provide a definition of
timespec in __external_threading, but this solution is not ideal
because timespec is not a reserved name.

This patch renames timespec into __libcpp_timespec_t in the
thread-related parts of libc++. For all cases except external
threading this type is an alias for ::timespec (and no functional
changes are intended).

In case of external threading it is expected that the
__external_threading header will either provide a similar typedef (if
timespec is available in the vendor's C library) or provide a
definition of __libcpp_timespec_t compatible with POSIX timespec.

Reviewers: ldionne, mclow.lists, EricWF

Reviewed By: ldionne

Subscribers: dexonsmith, libcxx-commits, christof, carwil

Tags: #libc

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

llvm-svn: 364012
2019-06-21 08:33:47 +00:00
Zhihao Yuan 4513f0f022 [libc++] Recommit r363692 to implement P0608R3
Re-apply the change which was reverted in r363764 as-is after
breakages being resolved.  Thanks Eric Fiselier for working
hard on this.

See also: https://bugs.llvm.org/show_bug.cgi?id=42330

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

llvm-svn: 363993
2019-06-20 22:09:40 +00:00
Louis Dionne f2f7d72f00 [libc++] Take 2: Implement CTAD for map and multimap
This is a re-application of r362986 (which was reverted in r363688) with fixes
for the issue that caused it to be reverted.

Thanks to Arthur O'Dwyer for the patch.

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

llvm-svn: 363968
2019-06-20 19:32:00 +00:00
Xing Xue ab4bcd844a AIX system headers need stdint.h and inttypes.h to be re-enterable
Summary:
AIX system headers need stdint.h and inttypes.h to be re-enterable when macro _STD_TYPES_T is defined so that limit macro definitions such as UINT32_MAX can be found. This patch attempts to allow that on AIX.

Reviewers: hubert.reinterpretcast, jasonliu, mclow.lists, EricWF

Reviewed by: hubert.reinterpretcast, mclow.lists

Subscribers: jfb, jsji, christof, cfe-commits, libcxx-commits, llvm-commits

Tags: #LLVM, #clang, #libc++

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

llvm-svn: 363939
2019-06-20 15:36:32 +00:00
Louis Dionne 205ead8c16 [NFC][libc++] Remove stray semi-colon after function definition
llvm-svn: 363835
2019-06-19 16:33:28 +00:00
Marshall Clow d72ebeef2c Mark papers P1458, P1459, P1462 and P1464 as complete. No changed needed to either the library or the tests.
llvm-svn: 363834
2019-06-19 16:32:07 +00:00
Zhihao Yuan 3f0ae625eb [libc++] Revert r363692 which implements P0608R3
The change caused a large number of compiler failures in
Google's codebase.  People need time to evaluate the impact.

llvm-svn: 363764
2019-06-19 07:11:08 +00:00
Marshall Clow 2184374d94 Disable the 'nextafter' portions of these tests on PPC when using 128-bit doubles because the 'nextafter' call doesn't work right. Reviewed as https://reviews.llvm.org/D62384. Thanks to Xing Xue for the patch, and Hubert for the explanation.
llvm-svn: 363740
2019-06-18 21:20:02 +00:00
Eric Fiselier 5c739665a8 Remove GCC C++03 fallbacks for decltype and static_assert.
This means libc++ no longer needs to write extra braces in
static asserts: Ex `static_assert((is_same_v<T, V>), "msg")`.

llvm-svn: 363738
2019-06-18 20:50:25 +00:00
Eric Fiselier a8aa58fb3d Reconfigure docker builders to be more modular.
And other various cleanups to the configuration.

llvm-svn: 363722
2019-06-18 19:31:38 +00:00
Marshall Clow 8dc6840f1c Fix the floating point version of midpoint. It wasn't constexpr, among other things. Add more tests. As a drive-by, the LCD implementation had a class named '__abs' which did a 'absolute value to a common-type' conversion. Rename that to be '__ct_abs'.
llvm-svn: 363714
2019-06-18 18:13:54 +00:00
Zhihao Yuan c74fc6d5f9 [libc++] Implement P0608R3 - A sane variant converting constructor
Summary:
Prefer user-defined conversions over narrowing conversions and conversions to bool.

References:
 http://wg21.link/p0608

Reviewers: EricWF, mpark, mclow.lists

Reviewed By: mclow.lists

Subscribers: zoecarver, ldionne, libcxx-commits, cfe-commits, christof

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

llvm-svn: 363692
2019-06-18 15:26:50 +00:00
Louis Dionne 91185b69d1 [libc++] Re-apply XFAIL to is_base_of test that was inadvertently reverted
llvm-svn: 363689
2019-06-18 15:01:59 +00:00
Louis Dionne 1fab01f92b [libc++] Revert the addition of map/multimap CTAD
This was found to be broken on Clang trunk. This is a revert of the
following commits (the subsequent commits added XFAILs to the tests
that were missing from the original submission):

    r362986: Implement deduction guides for map/multimap.
    r363014: Add some XFAILs
    r363097: Add more XFAILs
    r363197: Add even more XFAILs

llvm-svn: 363688
2019-06-18 14:40:15 +00:00
Louis Dionne 15722626e3 [NFC] Assign a couple of LWG issues to myself
llvm-svn: 363605
2019-06-17 19:40:09 +00:00
Louis Dionne be8c669af0 [libc++] Update ABI list for ABI v2
I forgot to add symbols for filesystem.

llvm-svn: 363603
2019-06-17 19:37:26 +00:00
Marshall Clow 546006b64e Update status of issue 3209
llvm-svn: 363594
2019-06-17 18:25:52 +00:00
Marshall Clow 2e550cabea Add tests for LWG 3206. NFC
llvm-svn: 363589
2019-06-17 18:06:30 +00:00
Marshall Clow a8dcd47688 Update the meeting page with papers/issues that are ready for Cologne
llvm-svn: 363575
2019-06-17 16:17:56 +00:00
Marshall Clow 2dda1ff038 Fix a '>= 0' test on unsigned that I inadvertantly introduced. Now correctly '!= 0'. Thanks to Arthur for the catch
llvm-svn: 363557
2019-06-17 13:41:14 +00:00
Eric Fiselier 186ca60e51 add header to help with template testing
llvm-svn: 363503
2019-06-15 21:16:57 +00:00
Eric Fiselier 2ade4f6f72 attempt to unbreak buildbots
llvm-svn: 363442
2019-06-14 19:31:17 +00:00
Louis Dionne 0feebef501 [libcxx] Add XFAIL for facet test when back-deploying to older macOS
llvm-svn: 363405
2019-06-14 14:40:38 +00:00
Mikhail Maltsev 411c630bae [libc++] Keep __regex_word in sync with ctype_base
Summary:
The class ctype_base in the header <__locale> contains masks for
character classification functions, which are kept in sync with
platform's C library, hence it contains many special cases.
The value of the bit mask __regex_word in the header <regex> must not
clash with those bit masks.

Currently the default case (i.e. unknown platform/C library) is
handled incorrectly: the __regex_word clashes with ctype_base::punct.

To avoid replicating the whole list of platforms in <regex> this patch
defines __regex_word in <__locale>, so that it is always kept in sync
with other masks.

Reviewers: ldionne, mclow.lists, EricWF

Reviewed By: ldionne

Subscribers: krytarowski, christof, dexonsmith, pbarrio, simon_tatham, libcxx-commits

Tags: #libc

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

llvm-svn: 363363
2019-06-14 09:04:16 +00:00
Thomas Anderson 2ce370c957 [libc++] Fix build with gcc 4.8
gcc 4.8.4 (but not 5.4.0 or 7.3.0) has trouble initializing errc with {}, giving
the error in [1]. This CL switches to explicitly using errc(0), which gcc 4.8
accepts.

[1] https://bugs.chromium.org/p/chromium/issues/detail?id=973723

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

llvm-svn: 363333
2019-06-13 22:27:24 +00:00
Louis Dionne 64c1d456c1 [libc++] Add missing #include in <cwchar> tests
Thanks to Mikhail Maltsev for the patch.
Differential Revision: https://reviews.llvm.org/D63289

llvm-svn: 363290
2019-06-13 18:24:28 +00:00
Eric Fiselier 5de7cacf07 Make GCC in C++03 Unsupported
Summary:
This patch make G++03 explicitly unsupported with libc++, as discussed on the mailing lists.


Below is the rational for this decision.
----------------------------------------------------------------------------------------------------

libc++ claims to support GCC with C++03 ("G++03"), and this is a problem for our users.

Our C++03 users are all using Clang. They must be.  Less than 9% of the C++03 tests pass with GCC [1][2]. No non-trivial C++ program could work.

Attempting to support G++03 impacts our QoI considerably. Unlike Clang, G++03 offers almost no C++11 extensions. If we could remove all the fallbacks for G++03, it would mean libc++ could::

* Improve Correctness:

Every `#ifdef _LIBCPP_HAS_NO_<C++11-feature>` is a bug manifest. It exists to admit for deviant semantics.

* Achieve ABI stability between C++03 and C++11

Differences between our C++03 and C++Rest branches contain ABI bugs. For example `std::nullptr_t` and `std::function::operator()(...)` are currently incompatible between C++11 and C++03, but could be fixed.

* Decrease Compile Times and Memory Usage:

Writing efficient SFINAE requires C++11. Using alias templates, libc++ could reduce the number of instantiations it produces substantially.

* Decrease Binary Size

Similar to the last point, G++03 forces metaprogramming techniques that emit more debug information [3] [4]. Compared to libstdc++, debug information size increases of +10% are not uncommon.

Reviewers: ldionne, mclow.lists, EricWF

Reviewed By: ldionne, EricWF

Subscribers: zoecarver, aprantl, dexonsmith, arphaman, libcxx-commits, #libc

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

llvm-svn: 363219
2019-06-13 00:37:25 +00:00
Louis Dionne c45f592b98 [libcxx] XFAIL set/multiset CTAD tests on Apple Clang 10
llvm-svn: 363209
2019-06-12 22:01:05 +00:00
Louis Dionne 782fff1bf8 [libcxx] XFAIL some CTAD tests on AppleClang 10
AppleClang 10 doesn't contain some changes that are required for this
test to give the right error message.

llvm-svn: 363197
2019-06-12 20:12:44 +00:00
Eric Fiselier 14d4869209 Apply [[nodebug]] to typedefs throughout the STL.
When applied to a typedef or alias template, the [[nodebug]] attribute
makes the typedef transparent to the debugger, so instead of seeing
`std::__function::__alloc_func<remove_reference<void(&)()>::type,
allocator<remove_reference<void(&)()>, void()>::_Target` you see
`void(&)()` as the type of the variable in your debugger.

Removing all this SFINAE noise from debug info has huge binary size
wins, in addition to improving the readability.

For now this change is on by default. Users can override it by
specifying -D_LIBCPP_NODEBUG_TYPE=

llvm-svn: 363117
2019-06-12 02:03:31 +00:00
Eric Fiselier 0e9b1d2a20 Move libc++ specific tests for std::function out of the std directory
llvm-svn: 363111
2019-06-11 22:59:53 +00:00
Eric Fiselier 4959542657 Add documentation and tests for Clangs C++11 extensions in C++03.
As we gear up to drop support for GCC in C++03, we should make clear
what our C++03 mode is, the C++11 extensions it provides,
and the C++11 extensions it depends on.

The section of this document discussing user-facing extensions has
been left blank while the community discusses new directions. For now
it's just a warning to users.

Additionally, the document contains examples of how these extensions
should be used and why. For example, using alias templates over class
templates.

llvm-svn: 363110
2019-06-11 22:53:49 +00:00
Louis Dionne c06943b67d [libcxx] Mark CTAD tests for set and multiset as unsupported on older Apple Clangs
Those fail on Green Dragon.

llvm-svn: 363107
2019-06-11 22:36:20 +00:00
Marshall Clow 903d3db593 Mark CTAD fail tests for set/multiset as XFAIL for older compilers that give different error messages
llvm-svn: 363099
2019-06-11 20:35:19 +00:00
Marshall Clow 1dc3c9aa8f XFAIL a couple of tests on apple-clang-9.1, which is a compiler that I didn't know existed
llvm-svn: 363097
2019-06-11 20:14:07 +00:00
Eric Fiselier 5d6626c758 Check in test that demonstrates ABI break for std::function.
Our C++03 and C++11 implementations of function are not ABI
compatible. I've added a "test" that demonstrates this.

llvm-svn: 363092
2019-06-11 18:41:47 +00:00
Louis Dionne e20865c387 [libc++] Implement deduction guides for <set>
This is part of C++17's P0433.

Thanks to Arthur O'Dwyer for the patch.

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

llvm-svn: 363090
2019-06-11 18:21:08 +00:00
Louis Dionne 405570dc7a [libcxx] Make std::tuple<> trivially constructible
Summary:
This is not mandated by the Standard, but it's nonetheless a nice
property to have, especially since it's so easy to implement. It
also shrinks our bug list!

PR41714

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

llvm-svn: 363075
2019-06-11 15:02:10 +00:00
Louis Dionne 776acf225b [libcxx] Slightly improved policy for handling experimental features
Summary:
Following the discussion on the libcxx-dev mailing list
(http://lists.llvm.org/pipermail/libcxx-dev/2019-May/000358.html),
this implements the new policy for handling experimental features and
their deprecation. We basically add a deprecation warning for
std::experimental::filesystem, and we remove a bunch of <experimental/*>
headers that were now empty.

Reviewers: mclow.lists, EricWF

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

Tags: #libc

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

llvm-svn: 363072
2019-06-11 14:48:40 +00:00
Marshall Clow 2efd2957ef Add a test for is_base_of and incomplete types. Because this trait uses a compiler intrinsic which was broken in many clangs, have lots of XFAILs.
llvm-svn: 363029
2019-06-11 03:38:29 +00:00
Marshall Clow d40807c6bb XFAIL a couple of CTAD tests on clang-6; it gives different error messages than clang 7/8/9
llvm-svn: 363014
2019-06-11 00:23:50 +00:00
Marshall Clow 141c2b768d Recommit r362649, which was reverted in r262680 because of bugs in std::to_chars (which have now been fixed). Speedup to_string and to_wstring for integers using stack buffer and SSO
llvm-svn: 363003
2019-06-10 23:20:01 +00:00
Marshall Clow edfe8525de Implement deduction guides for map/multimap. Reviewed as https://reviews.llvm.org/D58587. Thanks to Quuxplusone for the submission.
llvm-svn: 362986
2019-06-10 21:28:23 +00:00
Zhihao Yuan 6bc4a7685e [libc++] Fix leading zeros in std::to_chars
Summary:
It is a bugfix proposal for https://bugs.llvm.org/show_bug.cgi?id=42166.

`std::to_chars` appends leading zeros if input 64-bit value has 9, 10 or 11 digits.
According to documentation `std::to_chars` must not append leading zeros:
https://en.cppreference.com/w/cpp/utility/to_chars

Changeset should not affect `std::to_chars` performance:
http://quick-bench.com/CEpRs14xxA9WLvkXFtaJ3TWOVAg

Unit test that `std::from_chars` supports compatibility for both `std::to_chars` outputs (previous and fixed one) already exists:
1f60111b59/test/std/utilities/charconv/charconv.from.chars/integral.pass.cpp (L63)

Reviewers: lichray, mclow.lists, ldionne, EricWF

Reviewed By: lichray, mclow.lists

Subscribers: zoecarver, christof, dexonsmith, libcxx-commits

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

llvm-svn: 362967
2019-06-10 17:11:46 +00:00
Eric Fiselier 99dfd7084d update debugging docs to be less out of date
llvm-svn: 362866
2019-06-08 04:59:41 +00:00
Eric Fiselier d63dd874ec Substantially reduce instantiations and debug size of std::function
std::function uses a standard allocator to manage its memory, however
standard allocators are templates and using them correctly requires
a stupid amount of instantiations. This leads to a substantial increase
in debug info and object sizes.

This patch addresses the issue by dropping the allocator when possible
and using raw new and delete to get memory.

This change decreases the object file size for the test func.wrap.func.con/F.pass.cpp by 33% and the final binary by 29% (when compiled with -g -ggnu-pubnames -gpubnames).

It also roughly halfs the number of entries in the pubnames and pubtype
sections.

llvm-svn: 362865
2019-06-08 01:31:19 +00:00
Eric Fiselier cdff380681 Fix some incorrect std::function tests
llvm-svn: 362861
2019-06-08 00:45:45 +00:00
Vlad Tsyrklevich bad2b3cf08 Revert "Speedup to_string and to_wstring for integers using stack buffer and SSO."
This reverts commit 7ce7110e6d, it was
causing sanitizer bot failures due to changing behavior of
std::to_string(). See https://reviews.llvm.org/D59178#1532023

llvm-svn: 362680
2019-06-06 07:51:39 +00:00
Louis Dionne 8f500a6f9c [libcxx][test] Include test_workarounds.h where needed
Some tests require `TEST_WORKAROUND_CONSTEXPR_IMPLIES_NOEXCEPT`, but they
did not include the header that defines that macro.

Thanks to Michael Park for the patch.

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

llvm-svn: 362660
2019-06-05 21:54:34 +00:00
Marshall Clow 5347024e28 Update issue statuses. Reviewed as https://reviews.llvm.org/D62932
llvm-svn: 362659
2019-06-05 21:52:19 +00:00
Marshall Clow 7ce7110e6d Speedup to_string and to_wstring for integers using stack buffer and SSO. Reviewed as https://reviews.llvm.org/D59178 Thanks to ivafanas for all his work on this patch.
llvm-svn: 362649
2019-06-05 21:04:26 +00:00
Louis Dionne c3c23b27a4 [libcxx] Add test to check min/max requirement to regular expression
This commit adds tests that repeated characters in regular expressions
are within numeric limits, and that a <= b in a regex like `x{a,b}`.

Thanks to Andrey Maksimov for the patch.

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

llvm-svn: 362525
2019-06-04 16:47:18 +00:00
Marshall Clow 605d62e9de No longer reject inputs when using a locale that has grouping information _and_ the input has no grouping characters at all. We continue to reject cases when the input has grouping characters in the wrong place. Fixes PR#28704
llvm-svn: 362508
2019-06-04 15:18:46 +00:00
Marshall Clow f67524d400 We had a _LIBCPP_ASSERT commented out because gcc 4.9 didn't like it. We (LLVM) now require GCC 5.1, so that's not a problem any more. Re-enable the assertion. Fixes PR#36863
llvm-svn: 362465
2019-06-04 02:07:11 +00:00
Petr Hosek 737de4d363 [libcxx] Use libtool when merging archives on Apple platforms
ar doesn't produce the correct results when used for linking static
archives on Apple platforms, so instead use libtool -static which is
the official way to build static archives on those platforms.

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

llvm-svn: 362311
2019-06-02 01:14:31 +00:00
Marshall Clow 7fc6a55688 Add include for 'test_macros.h' to all the tests that were missing them. Thanks to Zoe for the (big, but simple) patch. NFC intended.
llvm-svn: 362252
2019-05-31 18:35:30 +00:00
Louis Dionne ee319034ab [libcxx] Add regex test cases from PR40904
llvm-svn: 362115
2019-05-30 16:53:05 +00:00
J. Ryan Stinnett d45eaf9405 [Docs] Modernize references to macOS
Summary:
This updates all places in documentation that refer to "Mac OS X", "OS X", etc.
to instead use the modern name "macOS" when no specific version number is
mentioned.

If a specific version is mentioned, this attempts to use the OS name at the time
of that version:

* Mac OS X for 10.0 - 10.7
* OS X for 10.8 - 10.11
* macOS for 10.12 - present

Reviewers: JDevlieghere

Subscribers: mgorny, christof, arphaman, cfe-commits, lldb-commits, libcxx-commits, llvm-commits

Tags: #clang, #lldb, #libc, #llvm

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

llvm-svn: 362113
2019-05-30 16:46:22 +00:00
Petr Hosek b19977d5af [runtimes] Use _LIBCPP_HAS_COMMENT_LIB_PRAGMA in all relevant files
These two sources were omitted in r362055.

llvm-svn: 362061
2019-05-30 06:57:27 +00:00
Petr Hosek 0528726a69 [libcxx][libcxxabi] Remove the unused CMake checks
These seemed to have been used in the past but were since removed
by the add_compile_flags_if_supported functions that combine these
these checks and adding the flag, but the original checks were never
removed.

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

llvm-svn: 362058
2019-05-30 06:08:56 +00:00
Petr Hosek f1ddf431b5 [runtimes] Use -Wunknown-pragmas for the pragma check
This is a follow up to r362055, we need -Wunknown-pragmas otherwise
the check is going to succeed it the pragma isn't supported.

llvm-svn: 362057
2019-05-30 05:38:06 +00:00
Petr Hosek 789b7f0828 [runtimes] Check if pragma comment(lib, ...) is supported first
This fixes the issue introduced by r362048 where we always use
pragma comment(lib, ...) for dependent libraries when the compiler
is Clang, but older Clang versions don't support this pragma so
we need to check first if it's supported before using it.

llvm-svn: 362055
2019-05-30 04:40:21 +00:00
Petr Hosek 996e62eef7 [runtimes] Support ELF dependent libraries feature
As of r360984, LLD supports dependent libraries feature for ELF.
libunwind, libc++abi and libc++ have library dependencies: libdl librt
and libpthread, which means that when libunwind and libc++ are being
statically linked (using -static-libstdc++ flag), user has to manually
specify -ldl -lpthread which is onerous.

This change includes the lib pragma to specify the library dependencies
directly in the source that uses those libraries. This doesn't make any
difference when using linkers that don't support dependent libraries.
However, when using LLD that has dependent libraries feature, users no
longer have to manually specifying library dependencies when using
static linking, linker will pick the library automatically.

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

llvm-svn: 362048
2019-05-30 01:34:41 +00:00
Louis Dionne a2a1ec27d0 [NFC][libcxx] Remove trailing whitespace
It's incredibly annoying when trying to create diffs

llvm-svn: 361981
2019-05-29 16:01:36 +00:00
Marshall Clow 6b03a1b423 Add additional constraints on midpoint(pointer, pointer). Fixes PR#42037.
llvm-svn: 361970
2019-05-29 15:17:55 +00:00
Eric Fiselier 82705e7d52 Fix build breakage on 32-bit machines
llvm-svn: 361917
2019-05-29 02:38:19 +00:00
Eric Fiselier 2405bd6898 Rework std::type_info definition to support systems without fully
merged type info names.

Previously std::type_info always expected type info string to be unique.
But this isn't always the case. Like when -Bsymbolic is passed to the
linker or due to llvm.org/PR37398.

This patch adds the LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT CMake
option which, when specified, overrides the default configuration for
the library.

The current defaults still assume unique names even though this isn't
strictly correct for ELF binaries. We should consider changing the
default in a follow up commit.

llvm-svn: 361913
2019-05-29 02:21:37 +00:00
Marshall Clow 41d5fdfa91 Fix test that used raw string literals. Doesn't work in C++03
llvm-svn: 361894
2019-05-28 23:13:55 +00:00
Marshall Clow 1efbe67414 Fix an incorrect 'Throws' in the regex code. Add a test for the new behavior. Reviewed as https://reviews.llvm.org/D61828. Thanks to Mark for the catch and the fix.
llvm-svn: 361887
2019-05-28 22:42:32 +00:00
Eric Fiselier a38ddc36fd fix test for older clang versions
llvm-svn: 361594
2019-05-24 03:15:32 +00:00
Eric Fiselier e46721a153 fix destroying delete test with older apple compilers
llvm-svn: 361593
2019-05-24 02:46:34 +00:00
Eric Fiselier 3c9c9ea2c9 Update C++2a status for destroying delete
llvm-svn: 361574
2019-05-24 00:10:33 +00:00
Eric Fiselier ae02e89448 P0722R3: Implement library support for destroying delete
Summary:
This provides the `std::destroying_delete_t` declaration in C++2a and after. (Even when the compiler doesn't support the language feature).

However, the feature test macro `__cpp_lib_destroying_delete` is only defined when we have both language support and  C++2a.


Reviewers: ldionne, ckennelly, serge-sans-paille, EricWF

Reviewed By: EricWF

Subscribers: dexonsmith, riccibruno, christof, jwakely, jdoerfert, mclow.lists, ldionne, libcxx-commits

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

llvm-svn: 361572
2019-05-23 23:46:44 +00:00
Chris Bieneman c5ec2a2bc1 [CMake] Copy C++ headers before configuring runtimes build
Summary: On some platforms C++ headers are packaged with the compiler not the sysroot. If you don't copy C++ headers into the build include directory during configuraiton of the outer build the C++ check during the runtime configuration may get inaccurate results.

Reviewers: phosek, compnerd, smeenai, EricWF

Reviewed By: compnerd

Subscribers: EricWF, christof, libcxx-commits, mgorny, llvm-commits

Tags: #llvm, #libc

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

llvm-svn: 361513
2019-05-23 17:06:46 +00:00
Louis Dionne 6b48742e43 [libcxx][tests] Fix order checking in unordered_multiset tests.
Some tests assume that iteration through an unordered multiset elements
will return them in the same order as at the container creation. This
assumption is not true since the container is unordered, so that no
specific order of elements is ever guaranteed for such container. This
patch introduces checks verifying that any iteration will return
elements exactly from a set of valid values and without repetition,
but in no particular order.

Thanks to Andrey Maksimov for  the patch.

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

llvm-svn: 361494
2019-05-23 13:11:00 +00:00
Petr Hosek 81f433b48c [runtimes] Move libunwind, libc++abi and libc++ to lib/$target/c++ and include/c++
This change is a consequence of the discussion in "RFC: Place libs in
Clang-dedicated directories", specifically the suggestion that
libunwind, libc++abi and libc++ shouldn't be using Clang resource
directory. Tools like clangd make this assumption, but this is
currently not true for the LLVM_ENABLE_PER_TARGET_RUNTIME_DIR build.
This change addresses that by moving the output of these libraries to
lib/$target/c++ and include/c++ directories, leaving resource directory
only for compiler-rt runtimes and Clang builtin headers.

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

llvm-svn: 361432
2019-05-22 21:08:33 +00:00
Louis Dionne c44cd1e4ed [libcxx][test] Fix order checking in some more unordered_multimap tests
Some tests assume that iteration through an unordered multimap elements
will return them in the same order as at the container creation. This
assumption is not true since the container is unordered, so that no
specific order of elements is ever guaranteed for such container. This
patch is a continuation of D54838 and introduces checks verifying that
any iteration will return elements exactly from a set of valid values
and without repetition, but in no particular order.

Thanks to Andrey Maksimov for the patch.

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

llvm-svn: 361414
2019-05-22 18:10:32 +00:00
Eric Fiselier f8d2d87fbb Speculative fix for std stream destruction order on Windows.
The MSVC CRT uses TLS storage to implement per-thread locales.
This storage gets freed during program termination, and if we attempt
to do any io operations (like flushing the std streams) after this occurs
the program may abort.

This patch is a speculative fix for that issue.

The fix tries forcing the initialization of the locale TLS before
initializing the std streams. This should mean that the TLS is freed
after we destroy the streams.

llvm-svn: 361348
2019-05-22 03:45:49 +00:00
Marshall Clow d75a0450ad Ensure that hash<basic_string> uses char_traits. Fixes PR#41876. Reviewed as https://reviews.llvm.org/D61954
llvm-svn: 361201
2019-05-20 21:56:51 +00:00
Eric Fiselier 236317d216 Fix missing std:: qualifier in __gnu_cxx::hash_map in C++03
llvm-svn: 361075
2019-05-17 20:59:57 +00:00
Eric Fiselier 549ddae58f Remove `using namespace std;` in __gnu_cxx namespace.
The `using namespace std;` opens us up to ambiguity
when any of the std:: names are also present in the global namespace.
Instead we should properly qualify names we use from std::.

llvm-svn: 361074
2019-05-17 20:46:00 +00:00
Marshall Clow 402ca78c43 Improve the test coverage for std::is_base_of
llvm-svn: 360911
2019-05-16 15:56:26 +00:00
Michal Gorny 87ae6bf80b [libc++] [test] Use std::nextafter() instead of std::nexttoward()
Use std::nextafter() instead of std::nexttoward() in midpoint tests.
In the context of this test, this should not cause any difference.
Since nexttowardl() is not implemented on NetBSD 8, the latter function
combined with 'long double' type caused test failure.  nextafterl() does
not have this problem.

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

llvm-svn: 360673
2019-05-14 13:56:20 +00:00
Brian Cain 9423ba8121 [libcxx] teach type_traits test about long uint32_t
Patch by Ben Craig.

llvm-svn: 360590
2019-05-13 15:41:18 +00:00
Marshall Clow 98c7c4fad2 Add a test for LWG#3204 and mark it as complete. Reviewed as https://reviews.llvm.org/D61829 Thanks to Zoe for the patch.
llvm-svn: 360586
2019-05-13 14:56:02 +00:00
Eric Fiselier 7d402732c2 force the bots to cycle
llvm-svn: 360306
2019-05-09 02:34:37 +00:00
Marshall Clow 51497fb8b3 Mark private function __sign as constexpr.
llvm-svn: 360167
2019-05-07 16:07:24 +00:00
Eric Fiselier ac6843cea2 Remove unneeded <algorithm> include in cmath.
It's a remnant from an earlier version of the lerp change
and is unneeded.

llvm-svn: 360098
2019-05-06 23:14:31 +00:00
Petr Hosek 741f52ca62 [libcxx] Don't use -fvisibility-global-new-delete-hidden when not defining them
When builing the hermetic static library, the compiler switch
-fvisibility-global-new-delete-hidden is necessary to get the new and
delete operator definitions made correctly. However, when those
definitions are not included in the library, then this switch does harm.
With lld (though not all linkers) setting STV_HIDDEN on SHN_UNDEF
symbols makes it an error to leave them undefined or defined via dynamic
linking that should generate PLTs for -shared linking (lld makes this a
hard error even without -z defs). Though leaving the symbols undefined
would usually work in practice if the linker were to allow it (and the
user didn't pass -z defs), this actually indicates a real problem that
could bite some target configurations more subtly at runtime. For
example, x86-32 ELF -fpic code generation uses hidden visibility on
declarations in the caller's scope as a signal that the call will never
be resolved to a PLT entry and so doesn't have to meet the special ABI
requirements for PLT calls (setting %ebx). Since these functions might
actually be resolved to PLT entries at link time (we don't know what the
user is linking in when the hermetic library doesn't provide all the
symbols itself), it's not safe for the compiler to treat their
declarations at call sites as having hidden visibility.

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

llvm-svn: 360003
2019-05-06 01:22:28 +00:00
Nico Weber 30649ce09b Mark is_trivially_destructible as unsupported with apple-clang-9
See discussion on https://reviews.llvm.org/D48292

llvm-svn: 359907
2019-05-03 17:26:17 +00:00
Casey Carter b574e11217 [libc++][test] Remove non-portable assumption that thread's constructor allocates with ::new
Drive-by:
* Fix potential race between check and update of `throw_one` in `operator new`
* Fix latent bug in `operator delete`, which shouldn't decrement `outstanding_new` when passed a null pointer
* Specifically catch the expected `bad_alloc` in `main` instead of `...`

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

llvm-svn: 359827
2019-05-02 21:19:41 +00:00
Louis Dionne 223ed705d0 [libc++][CMake] Link against libSystem on Apple platforms
Instead of manually linking against libm/librt/libpthread, we should be
linking against libSystem on Apple platforms, and only that. libm and
libpthread are symlinks to libSystem anyway.

llvm-svn: 359808
2019-05-02 17:43:48 +00:00
Petr Hosek fa3c328c51 [gn] Support for building libc++
This change introduces support for building libc++. The library
build should be complete, but not all CMake options have been
replicated in GN. We also don't support tests yet.

We only support two stage build at the moment.

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

llvm-svn: 359806
2019-05-02 17:29:41 +00:00
Brian Cain 9d744bcde9 [libcxx] cmake - guard list remove
REMOVE_ITEM fails if CMAKE_REQUIRED_LIBRARIES is empty on some
versions of cmake.

llvm-svn: 359755
2019-05-02 03:49:50 +00:00
Dan Albert dfa7af5b6b Add missing locale requirement to test.
Linux is failing even though the test runner does report this locale
is available, but the test still isn't expected to work on platforms
without the locale (like Android).

llvm-svn: 359726
2019-05-01 21:02:32 +00:00
Dan Gohman 3efd6e37e4 [WebAssembly] WASI support for libcxx
This adds explicit support for the WASI platform to libcxx.

WASI libc uses some components from musl, however it's not fully compatible
with musl, so we're planning to stop using _LIBCPP_HAS_MUSL_LIBC and
customize for WASI libc specifically.

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

Reviewers: sbc100, ldionne
llvm-svn: 359703
2019-05-01 16:47:30 +00:00
Marshall Clow ccbe567f46 Get rid of a bunch of 'unused variable' warnings in test when run with debug_level set. NFC
llvm-svn: 359672
2019-05-01 11:25:58 +00:00
Petr Hosek f80c4b6348 [libcxx] Move CMake file to src, avoid using globs
This addresses the longstanding FIXME and makes libc++ build more
similar to other runtimes.

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

llvm-svn: 359656
2019-05-01 06:40:36 +00:00
Marshall Clow 3740ca1e7f Fix a bunch of unordered container tests that were failing when _LIBCPP_DEBUG was set.
llvm-svn: 359642
2019-05-01 01:52:51 +00:00
Eric Fiselier 71aa67506b Support overaligned types in `aligned_storage`.
Summary:
The current implementation of aligned storage was written before we had `alignas`, so it used a list of builtin types to force the alignment. But this doesn't work overaligned requests.

This patch adds a fallback case supporting over-alignment. It only affects case that were previously ill-formed.

Reviewers: rsmith, ldionne, dlj, mclow.lists

Reviewed By: mclow.lists

Subscribers: mclow.lists, dexonsmith, libcxx-commits

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

llvm-svn: 359596
2019-04-30 18:44:45 +00:00
Louis Dionne 68924e6be7 [libc++][CMake] Refactor how we link against system libraries
Summary:
Instead of populating the global LIBCXX_LIBRARIES, we use the link-time
dependency management built into CMake to propagate link flags. This
leads to a cleaner and easier-to-follow build.

Reviewers: phosek, smeenai, EricWF

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

Tags: #libc

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

llvm-svn: 359571
2019-04-30 15:44:19 +00:00
Marshall Clow 39084db328 Implement LWG 2960: nonesuch is insufficiently useless
llvm-svn: 359526
2019-04-30 00:54:38 +00:00
Marshall Clow fafbddc275 Mark LWG#2977 as 'Nothing to do'. NFC
llvm-svn: 359525
2019-04-30 00:54:26 +00:00
Marshall Clow 8a02f8d928 Add tests specifically for LWG2164. We already did this; but now we have tests. NFC
llvm-svn: 359458
2019-04-29 15:38:07 +00:00
Eric Fiselier a1f420de8c Fix permission error while running bots
llvm-svn: 359405
2019-04-28 17:00:46 +00:00
Eric Fiselier 290a3a3648 attempt to unbreak build bots
llvm-svn: 359404
2019-04-28 16:42:49 +00:00
Eric Fiselier 2f5f9a159b Attempt to switch to auto-scaling bots
llvm-svn: 359403
2019-04-28 15:54:50 +00:00
Marshall Clow c29db2d83e Add '_LIBCPP_ASSERT(ready())' to several match_results method that have this precondtion. Fix several tests which did not honor this precondition. Thanks to Andrey Maksimov for pointing this out.
llvm-svn: 359324
2019-04-26 17:10:03 +00:00
Louis Dionne f30f261dc5 [libc++] Relax libc++-only test on regex_constants
The standard requires the following for the std::regex_constants::error_type
values: "The type error_type is an implementation-defined enumerated type."

The values of this enumerated type are not required to be non-zero.
This patch makes such checks in tests libc++-specific to let the tests
pass for other conforming implementations.

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

llvm-svn: 359320
2019-04-26 16:46:37 +00:00
Chandler Carruth dd0a2e4461 Fix r359229 which tried to fix r359159...
When r359229 added noexcept to the declaration of `~mutex`, it didn't
add it to the definition which caused -Wimplicit-exception-spec-mismatch
to fire. This just adapts the definition to agree with the declaration.

llvm-svn: 359275
2019-04-26 05:04:33 +00:00
Eric Fiselier eea2287f83 add tuple_cat test for const T
llvm-svn: 359256
2019-04-26 01:06:32 +00:00
Eric Fiselier 7e528bc4ce Fix return type of std::tuple_cat.
When the arguments to tuple cat were const, the const was incorrectly
propagated into the type of the resulting tuple. For example:

const std::tuple<int> t(42);
auto r = std::tuple_cat(t, t);
// Incorrect! should be std::tuple<int, int>.
static_assert(is_same_v<decltype(r), std::tuple<const int, const int>>);

llvm-svn: 359255
2019-04-26 01:02:18 +00:00
Richard Smith de329354aa Remove incorrect explicit instantiation declarations for valarray
libc++ ABI v1 provides three valarray symbols as part of the shared library:

valarray<size_t>::valarray(size_t)
valarray<size_t>::~valarray()
valarray<size_t>::resize(size_t, size_t)

The first two of these are intended to be removed in V2 of the ABI: they're
attributed _LIBCPP_HIDE_FROM_ABI_AFTER_V1, and  it appears that the intention
is that these symbols from the library are not used even when building using
the V1 ABI. However, there are explicit instantiation declarations for all
three symbols in the header, which are not correct as we do not intend to find
an instantiation of these functions that is provided elsewhere.

(A recent change to clang to properly diagnose explicit instantiation
declarations of internal linkage functions -- required by [temp.explicit]p13 --
had to be rolled back because it diagnosed these explicit instantiations.)

Remove the explicit instantiation declarations, and remove the explicit
instantiation definitions for V2 of the libc++ ABI onwards.

llvm-svn: 359243
2019-04-25 21:31:58 +00:00
Richard Smith ae62727a28 Remove libc++ checks and workarounds for unsupported old versions of GCC (<4.9).
Differential Revision: https://reviews.llvm.org/D61107

llvm-svn: 359232
2019-04-25 20:02:10 +00:00
Richard Smith 65d4d5e9e7 Fix buildbot failures after r359159.
std::mutex was not actually is_nothrow_default_constructible in C++98/C++03,
because the variable declaration

  std::mutex M;

... could throw an exception from the mutex destructor. Fix it by marking the
destructor as non-throwing. This has no effect in C++11 onwards, because
destructors are non-throwing by default in those language modes.

llvm-svn: 359229
2019-04-25 20:00:06 +00:00
Martin Storsjo 2bbb7feda8 Set _LIBCPP_DLL_VIS on _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS in MinGW mode
Contrary to MSVC, MinGW compilers wants the dllexport attribute on
the declaration of an explicit template instantiation, not on the
definition.

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

llvm-svn: 359227
2019-04-25 19:46:28 +00:00
Casey Carter 413732354d [libc++][test] Fix noexcept assertions in variant's get tests
All constant expressions are non-potentially-throwing in C++14, but that is *not* the case in C++17. Change these tests of the `variant`-flavored overloads of `std::get` to expect the correct behavior when the compiler is not GCC or is GCC 9+.

Credit to Jonathan Wakely for providing an improved version of my initial change that validates the incorrect behavior on GCC < 9 as well as validating the correct behavior on other compilers.

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

llvm-svn: 359220
2019-04-25 18:36:29 +00:00
Marshall Clow b0e2daf64b Implement 'lerp'; which is the last bit of P0811. Mark that paper as complete.
llvm-svn: 359211
2019-04-25 17:44:18 +00:00
Marshall Clow d3d0ecbfd5 Implement midpoint for floating point types. Reviewed as https://reviews.llvm.org/D61014.
llvm-svn: 359184
2019-04-25 12:11:43 +00:00
Marshall Clow 07161d6de3 Update test to better check for the non-constexpr-ness of a move constructor. Fixes PR#41577.
llvm-svn: 359162
2019-04-25 02:12:51 +00:00
Richard Smith d8b01111a0 Use modern type trait implementations when available.
Teach libcxx to stop using various deprecated __has_* type traits, in favor of
the ("modern", C++11 era) __is_* type traits.

This is mostly just a simplification, but fixes at least one bug: _Atomic T
should be considered trivially-destructible, but is not considered to be POD by
Clang, and __has_trivial_destructor is specified in the GCC documentation as
returning false for non-POD non-class types.

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

llvm-svn: 359159
2019-04-25 00:35:01 +00:00