Commit Graph

6072 Commits

Author SHA1 Message Date
Eric Fiselier 0b8585ede4 [libc++] Update compiler images and more docker cleanup. 2020-02-27 17:22:58 -05:00
Eric Fiselier fdba2e4ed1 [libc++] Update lld version on buildbots to be LLVM-11. 2020-02-27 16:28:04 -05:00
Eric Fiselier 1d8fad44d3 [libc++] Rework docker files for buildbots.
I've been sitting on this change for a while and have been using
it to build the bot images, so it should be upstream.

This re-configures the docker build files to use docker-compose
more heavily. This allows for composing large images with multiple
compilers without invalidating the docker caches.

After this commit I'll quickly switch all the current buildbots
over to a new docker image, followed by another update to add new
compilers
2020-02-27 15:32:48 -05:00
Eric Fiselier d4ad2adb00 [libc++] Mark more try_lock tests as possibly flaky.
These tests check that an operations happens within a specified
deadline, which causes flaky failures on slow machines or machines
under heavy load.

By adding the // FLAKY_TEST. tag it allows the test suite to
retry or ignore the tests
2020-02-27 13:25:57 -05:00
ogiroux 621388468b Some fixes for open breaks on MacOS and UBSan 2020-02-26 20:51:19 -08:00
Louis Dionne 682e703755 [libc++] Workaround unused variable warning in test
This only showed up in C++11/C++14 where the static_assert below was
ifdef'd out, and the variable was indeed unused.
2020-02-26 19:30:10 -05:00
Louis Dionne 12339efd70 Revert "[libc++] Do not set the `availability=XXX` feature when not testing against a system libc++"
This reverts commit 7dd6a862e, which broke more tests than it fixed.
2020-02-26 19:20:14 -05:00
Louis Dionne a0ec111c92 [libc++] Temporarily disable availability markup for the C++20 Synchronization library
The markup wasn't quite right, and that broke compilation with availability
markup enabled. I'm disabling it until I have time to fix it properly to
get the CI mostly green again.
2020-02-26 19:10:27 -05:00
Martijn Vels d260ea7199 Inline basic_string::erase for fastpath where __n == npos
Summary:
This change checks for the case where people want to erase a string to the end, i.e., __n == npos, and inlines the call if so.

This also demonstrates keeping the ABI intact for V1, but inlining the erase() method for unstable.

Reviewers: EricWF, mclow.lists, ldionne

Reviewed By: EricWF, ldionne

Subscribers: smeenai, dexonsmith, christof, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D73743
2020-02-26 13:37:45 -05:00
Mikhail Maltsev 14aef5367d [libcxx] Fix _LIBCPP_HAS_THREAD_API_EXTERNAL build
Summary:
The definition of `__libcpp_timed_backoff_policy` and the declaration of
`__libcpp_thread_poll_with_backoff` must not be guarded by
  #if !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
because the definitions of `__libcpp_timed_backoff_policy::operator()`
and `__libcpp_thread_poll_with_backoff` aren't guarded by this macro
(and this is correct because these two functions are implemented in
terms of other libc++ functions and don't interact with the host
threading library).

Reviewers: ldionne, __simt__, EricWF, mclow.lists

Reviewed By: ldionne

Subscribers: dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D75191
2020-02-26 17:54:43 +00:00
Martijn Vels 07eb82fc06 Add _LIBCPP_BUILTIN_CONSTANT_P support.
Summary:
This change adds the macros _LIBCPP_COMPILER_HAS_BUILTIN_CONSTANT and _LIBCPP_BUILTIN_CONSTANT_P to detect compile time constants, and optimze the code accordingly.

A planned usage example:
The implementation of basic_string::assign() can short-cut a compile time known short string assignent into a fast and compact inlined assignment:

```
basic_string::assign(const value_type* __s) {
  if (_LIBCPP_BUILTIN_CONSTANT_P(__s[0]) && length(__s) < __min_cap) {
    copy(pointer(), _s, length(__s) + 1);
    set_size(length(__s));
  } else {
    // delegate / tail call out of line implementation
  }
}
```

Subscribers: christof, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D73732
2020-02-26 11:03:51 -05:00
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