Commit Graph

6061 Commits

Author SHA1 Message Date
zoecarver 28d38a25e9 Remove std::shared_ptr::allocate_shared
std::shared_ptr::allocate_shared isn't in the standard. This commit removes it from libc++. It updates std::allocate_shared to use __create_with_cntrl_block.

Differential Revision: https://reviews.llvm.org/D66178
2020-02-25 16:50:57 -08:00
Louis Dionne b051cc9327 [NFC][libc++] Refactor some future tests to reduce code duplication
The same test was being repeated over and over again.
That's what functions are for.
2020-02-25 18:16:45 -05:00
Louis Dionne 3b5530cf96 [libc++] Avoid including <semaphore.h> on Apple
It turns out that <semaphore.h> is not well-behaved, as it transitively
includes <sys/param.h>, and that one defines several non-reserved macros
that clash with some downstream projects in modular builds. For the time
being, using <sys/semaphore.h> instead gives us the declarations we need
without the macros.

rdar://59744472
2020-02-25 17:52:34 -05:00
Martin Storsjö e3add3e5a1 [libcxx] Fix building for windows after 54fa9ecd30
Move the implementation of __libcpp_thread_poll_with_backoff
and __libcpp_timed_backoff_policy::operator() out of the
_LIBCPP_HAS_THREAD_API_PTHREAD block. None of the code in these
methods is pthreads specific.

Also add "inline _LIBCPP_INLINE_VISIBILITY" to
__libcpp_timed_backoff_policy::operator(), to avoid errors due to
multiple definitions of the operator. Contrary to
__libcpp_thread_poll_with_backoff (which is a template function),
this is a normal non-templated method.

Differential Revision: https://reviews.llvm.org/D75102
2020-02-25 21:33:52 +02:00
Louis Dionne bf6d94f159 [libc++] Remove incorrect XFAIL in modules test
Apparently, the test still works on single-threaded systems.
2020-02-25 12:17:21 -05:00
Louis Dionne 7c2f4a8370 [libc++] Revert 03dd205c15 "Adjust max_align_t handling"
That commit was made without approval from a libc++ reviewer, and it
also broke the build in C++03 mode.
2020-02-25 11:42:08 -05:00
Louis Dionne ab41129b1e [libc++] Proper fix for libc++'s modulemap after D68480
Summary:
In libc++, we normally #ifdef out header content instead of #erroring
out when the Standard in use is insufficient for the requirements of
the header.

Reviewers: EricWF

Subscribers: jkorous, dexonsmith, libcxx-commits, teemperor

Tags: #libc

Differential Revision: https://reviews.llvm.org/D75074
2020-02-25 11:31:10 -05:00
Joerg Sonnenberger 03dd205c15 Adjust max_align_t handling
Depend on the compiler to provide a correct implementation of
max_align_t. If __STDCPP_NEW_ALIGNMENT__ is missing and C++03 mode has
been explicitly enabled, provide a minimal fallback in <new> as
alignment of the largest primitive types.
2020-02-25 01:36:43 +01:00
Shoaib Meenai e34ddc09f4 [arcconfig] Delete subproject arcconfigs
From https://secure.phabricator.com/book/phabricator/article/arcanist_new_project/:

> An .arcconfig file is a JSON file which you check into your project's root.

I've done some experimentation, and it looks like the subproject
.arcconfigs just get ignored, as the documentation says. Given that
we're fully on the monorepo now, it's safe to remove them.

Differential Revision: https://reviews.llvm.org/D74996
2020-02-24 16:20:36 -08:00
Raphael Isemann b61e83eb0e [libc++] Give headers that require C++14 a cplusplus14 requires in the modulemap
https://reviews.llvm.org/D68480 added those headers and made the std module
only usable with C++14 or later as the submodules were not marked as requiring
C++14 or later. This just adds the missing requires directives.
2020-02-24 20:20:55 +01:00
Louis Dionne a3d58fcc03 [libc++] Drop redundant check for -std=c++14
We always build all components of libc++ with -std=c++14 anyway
2020-02-24 12:23:05 -05:00
Louis Dionne b21405d1cd [libc++] Fix CI and Linux failures after landing D68480
- Avoid using C++11-and-later features in <atomic>:
  Historically, we've supported <atomic> in C++03, so we can't use C++11
  features in that header. This is something we really need to change,
  since our implementation of <atomic> is starting to accumulate technical
  debt because of that.
- Mark a test as unsupported on single threaded systems
- Add missing symbols to the Linux ABI list
2020-02-24 11:58:25 -05:00
Louis Dionne c008716417 [libc++] Mark the C++03 version of std::function as deprecated
Summary: We want to eventually remove it.

Reviewers: EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D74719
2020-02-24 10:59:58 -05:00
Louis Dionne 80e73f2295 [libc++] Adapt a few things around the implementation of P1135R6
- Add the new symbols to the ABI list on Darwin
- Add XFAIL markup to the tests that require dylib support on older platforms
- Add availability markup for back-deployment
2020-02-24 10:59:35 -05:00
Olivier Giroux 54fa9ecd30 [libc++] Implementation of C++20's P1135R6 for libcxx
Differential Revision: https://reviews.llvm.org/D68480
2020-02-24 10:59:35 -05:00
Billy Robert O'Neal III e48849a240 [libcxx] [test] Suppress MSVC++ warning 4640 under /Zc:threadSafeInit- 2020-02-22 06:57:37 -08:00
Louis Dionne 7dd6a862e5 [libc++] Do not set the `availability=XXX` feature when not testing against a system libc++
Otherwise, the `availability=XXX` lit feature is set even when we're
testing trunk and _LIBCPP_DISABLE_AVAILABILITY is defined, which causes
tests that check for availability markup to be enabled and unexpectedly
pass.
2020-02-21 14:21:16 -05:00
Martijn Vels d8969a1cb9 Split _LIBCPP_STRING_EXTERN_TEMPLATE_LIST up into a V1 and UNSTABLE version.
This change splits the _LIBCPP_STRING_EXTERN_TEMPLATE_LIST up into a _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST containing the stable ABI, and a _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST containing the unstable ABI.

The purpose is to explicitly define and maintain the two lists, where the unstable ABI allows for ABI breaking changes for purposes such as optimization while offering a strong guarantee that any change inside the unstable ABI does not affect the stable ABI.

As per the comment in the __string header, we do still allow etries to be added to the stable ABI list as the c++ versions and corresponding c++ std API changes.
2020-02-20 23:21:14 -05:00
Mark de Wever 72ce0c8073 [libc++][regex] Validate backreferences in the constructor.
This patch enables throwing exceptions for invalid backreferences
in the constructor when using the basic, extended,  grep, or egrep grammar.

This fixes bug 34297.

Differential Revision: https://reviews.llvm.org/D62453
2020-02-20 18:16:21 -05:00
Louis Dionne 07c559caef [libc++] Explain XFAILs with std::uncaught_exceptions test 2020-02-20 18:04:30 -05:00
Logan Smith 092a57f508 [libc++] Fix unqualified call to 'ref' inside shared_ptr(unique_ptr<U, D>)
This prevents unintended ADL: https://gcc.godbolt.org/z/EHw3Gy
This issue was mentioned as an addendum in PR44398.

Differential Revision: https://reviews.llvm.org/D74289
2020-02-20 12:24:40 -05:00
Logan Smith e442f38395 [libc++] Fix unintended ADL inside ref(reference_wrapper<T>) and cref(reference_wrapper<T>)
This patch qualifies calls to ref and cref inside ref(reference_wrapper<T>)
and cref(reference_wrapper<T>), respectively. These previously unqualified
calls could break in the presence of user functions called ref/cref inside
associated namespaces: https://gcc.godbolt.org/z/8VfprT

Fixes PR44398.

Differential Revision: https://reviews.llvm.org/D74287
2020-02-20 12:22:21 -05:00
Martijn Vels c4b8c3ddc1 Add benchmarks for basic_string::erase
Reviewers: EricWF

Subscribers: christof, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D73740
2020-02-19 17:09:25 -05:00
Louis Dionne c3478eff7a [libc++] reduce <complex> parsing time
Instead of including <ios> for ios_base::failbit, simply get failbit
member of the template argument. Print directly to a stream instead
of using intermediate ostringstream.

    Parsing time: 874ms -> 164ms (-81%)

Thanks to Nikita Kniazev for the patch!

Differential Revision: https://reviews.llvm.org/D71214
2020-02-19 16:09:41 -05:00
Louis Dionne 6ba2d7b166 [libc++] Fixes backreferences for extended grammar.
The regex backreferences were not properly parsed and used when using
the extended grammar. This change parses them. The issue was found while
working on PR34297.

Thanks to Mark de Wever for the patch!

Differential Revision: https://reviews.llvm.org/D62451
2020-02-19 15:57:16 -05:00
Eric Fiselier a829443cc7 [libc++] Fix ABI break in __bit_reference.
The libc++ __bit_iterator type has weird ABI calling conventions as a
quirk
of the implementation. The const bit iterator is trivial, but the
non-const
bit iterator is not because it declares a user-defined copy constructor.

Changing this now is an ABI break, so this test ensures that each type
is trivial/non-trivial as expected.

The definition of 'non-trivial for the purposes of calls':
  A type is considered non-trivial for the purposes of calls if:
      * it has a non-trivial copy constructor, move constructor, or
            destructor, or
	        * all of its copy and move constructors are deleted.
2020-02-19 12:02:06 -05:00
Louis Dionne a7dcbe90cc [libc++] Fix overly complicated test of std::span's extent
Thanks to Billy O'Neal for the patch.

Differential Revision: https://reviews.llvm.org/D73138
2020-02-18 15:04:33 -05:00
Louis Dionne 5e52effca6 [libc++] Add ABI list for 9.0 release
I just took a snapshot of the current ABI lists on master, since I don't
think they changed since the actual 9.0 release.
2020-02-18 10:50:49 -05:00
Louis Dionne 1cff2aa512 [libc++] Remove XFAILs for macOS 10.15, which were fixed in later dot releases 2020-02-18 09:06:12 -05:00
Raphael Isemann 23368bee15 Revert "[libc++] Move abs and div into stdlib.h to fix header cycle."
This reverts commit 82b47b2978.

This broke Clang and LLDB module builds without -fmodules-local-submodule-visbility.
I'll revert this for now until we have a fix and reland once Clang
can properly handle this code.

See also the discussion in https://reviews.llvm.org/rG82b47b2978405f802a33b00d046e6f18ef6a47be
2020-02-17 17:59:08 +01:00
Louis Dionne 8b60ba73af [libc++] Add availability markup for std::to_chars on Apple platforms
Summary:
Otherwise, one gets link errors when trying to back-deploy to older platforms.

rdar://problem/57854364

Reviewers: lichray, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D74626
2020-02-17 09:32:46 -05:00
marshall 8424789eec Update last-mod date for libcxx status page 2020-02-16 18:55:50 +01:00
marshall 1a07084f6d Updated with list of papers and issues adopted in Prague 2020-02-16 18:54:28 +01:00
Eric Fiselier 82b47b2978 [libc++] Move abs and div into stdlib.h to fix header cycle.
libc++ is careful to not fracture overload sets. When one overload
is visible to a user, all of them should be. Anything less causes
subtle bugs and ODR violations.

Previously, in order to support ::abs and ::div being supplied by
both <cmath> and <cstdlib> we had to do awful things that make
<math.h> and <stdlib.h> have header cycles and be non-modular.
This really breaks with modules.

Specifically the problem was that in C++ ::abs introduces overloads
for floating point numbers, these overloads forward to ::fabs,
which are defined in math.h. Therefore ::abs needed to be in math.h
too. But this required stdlib.h to include math.h and math.h to
include stdlib.h.

To avoid these problems the definitions have been moved to stddef.h
(which math includes), and the floating point overloads of ::abs
have been changed to call __builtin_fabs, which both Clang and GCC
support.
2020-02-15 18:55:07 -05:00
Eric Fiselier 99382e450f [libc++] Add utility to generate and display libc++'s header dependency
graph.
2020-02-15 18:47:17 -05:00
Eric Fiselier e8358455a2 [libc++] Add missing include for is_same in test 2020-02-14 18:55:27 +01:00
Eric Fiselier cccf1ef0c8 [libc++] Remove cycle between <type_traits> and <cstddef>
This was caused by byte depending on traits. This patch moves
the minimal amount of meta-programming into <cstddef> to break the cycle.
2020-02-14 17:36:27 +01:00
Eric Fiselier e337fb0790 add type_traits include as required for std::integral_constant 2020-02-14 16:38:28 +01:00
Louis Dionne f54e7b4e3a [libc++] Remove unnecessary typenames from std/numerics/c.math/abs.pass.cpp
There are some unnecessary typenames in std/numerics/c.math/abs.pass.cpp;
e.g. they're not in a dependent context.

Patch by Bryce Adelstein Lelbach

Differential Revision: https://reviews.llvm.org/D72106
2020-02-14 16:04:40 +01:00
Louis Dionne 0a0e0afaa0 [libc++] span: Fix incorrect static asserts
The static asserts in span<T, N>::front() and span<T, N>::back() are
incorrect as they may be triggered from valid code due to evaluation
of a never taken branch:

    span<int, 0> foo;
    if (!foo.empty()) {
        auto x = foo.front();
    }

The problem is that the branch is always evaluated by the compiler,
creating invalid compile errors for span<T, 0>.

Thanks to Michael Schellenberger Costa for the patch.

Differential Revision: https://reviews.llvm.org/D71995
2020-02-14 14:32:41 +01:00
Louis Dionne 8bec892713 [libc++][Apple] Use CLOCK_MONOTONIC_RAW instead of CLOCK_UPTIME_RAW for steady_clock
Summary:
In D27429, we switched the Apple implementation of steady_clock::now()
from clock_gettime(CLOCK_MONOTONIC) to clock_gettime(CLOCK_UPTIME_RAW).
The purpose was to get nanosecond precision, and also to improve the
performance of the implementation.

However, it appears that CLOCK_UPTIME_RAW does not satisfy the requirements
of the Standard, since it is not strictly speaking monotonic. Indeed, the
clock does not increment while the system is asleep, which had been
mentioned in D27429 but somehow not addressed.

This patch switches to CLOCK_MONOTONIC_RAW, which is monotonic, increased
during sleep, and also has nanosecond precision.

https://llvm.org/PR44773

Reviewers: bruno, howard.hinnant, EricWF

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

Tags: #libc

Differential Revision: https://reviews.llvm.org/D74341
2020-02-12 16:43:36 +01:00
Louis Dionne b5abd50f06 [libc++] span: Guard against overflow in span::subspan
The calculation _Offset + _Count <= size() may overflow, so use
_Count <= size() - _Offset instead. Note that this is safe due to
the previous constraint that _Offset <= size().

Patch by Michael Schellenberger Costa.

Differential Revision: https://reviews.llvm.org/D71998
2020-02-12 16:21:46 +01:00
Sergej Jaskiewicz 377a1c80e9 [libcxx] Don't assume cwd name in std::filesystem tests
Summary:
In `std::filesystem::proximate` tests we assume that the current working directory's name
is `fs.op.proximate`. This is fine when we're running the tests locally.

However, if we're running those tests on a remote machine via SSH, the directory layout may be
different. For example, currently we copy each test executable individually into
a temporary directory on the target board using SCP, so the assumption about the working directory name
doesn't necessarily hold.

This patch is the only thing that is necessary for all libc++ tests to pass when run remotely.

Reviewers: ldionne, EricWF, mclow.lists

Reviewed By: ldionne, EricWF

Subscribers: christof, dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D74348
2020-02-12 16:08:17 +03:00
David Zarzycki 11fb68abab [libc++] Unbreak test suite (CWG1423)
clang 9ce6dc9872 drops support for
implicit conversion of nullptr_t to bool. From that commit:

    The C++ rules briefly allowed this, but the rule changed nearly 10
    years ago and we never updated our implementation to match. However,
    we've warned on this by default for a long time, and no other compiler
    accepts (even as an extension).
2020-02-11 15:00:33 -05:00
Louis Dionne 37f46650c3 [libc++] Make sure that vector copy-construction is disabled for non-copyable types
The Standard requires the value_type of the vector to be Cpp17CopyInsertable
in order for copy-construction to be enabled:

	http://eel.is/c++draft/container.requirements#tab:container.req

rdar://problem/56674564

Differential Revision: https://reviews.llvm.org/D74251
2020-02-11 17:12:16 +01:00
Louis Dionne 592f35481a [libc++] Disable a filesystem test that uses debug mode with the macOS system libc++
The system libc++.dylib doesn't support the debug mode, so this test
can't be supported. As a fly-by fix, we also specify more stringently
that only the macOS system library is unsupported in other tests using
the debug mode.
2020-02-11 14:57:14 +01:00
Louis Dionne 2234cf5114 [libc++][macOS CI] Ensure that the SDK version is not older than the deployment target 2020-02-11 13:52:41 +01:00
Louis Dionne 92a1f65f17 [libc++] span: Fix incorrect return type of span::subspan
The extent of the returned span was always std::dynamic_extent, which
is incorrect.

Thanks to Michael Schellenberger Costa for the patch.

Differential Revision: https://reviews.llvm.org/D71997
2020-02-11 11:58:45 +01:00
Louis Dionne b4a3e6b664 [libcxx] span: Remove unneeded comparison
size_t is always greater than 0, so remove the artifact from the old
index_type.

Patch by Michael Schellenberger Costa.

Differential Revision: https://reviews.llvm.org/D71996
2020-02-11 11:39:12 +01:00
Louis Dionne edbaa7fc04 [libc++] span: Cleanup includes
Thanks to Michael Schellenberger Costa for the patch.

Differential Revision: https://reviews.llvm.org/D72036
2020-02-11 11:17:30 +01:00