Commit Graph

6045 Commits

Author SHA1 Message Date
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
Louis Dionne 9fda213d62 [libcxx] Qualify make_move_iterator in vector::insert for input iterators
Unqualified calls to make_move_iterator in the vector::insert overload
for input iterators lead to ADL issues: https://gcc.godbolt.org/z/bmcNbh

Patch by Logan Smith.

Differential Revision: https://reviews.llvm.org/D74290
2020-02-11 11:00:45 +01:00
Louis Dionne f2af4f8a45 [libc++][span] Add failing tests for span::first and span::last
Both methods have compile time constraints that we should test against.

Patch by Michael Schellenberger Costa

Differential Revision: https://reviews.llvm.org/D71999
2020-02-10 13:52:20 +01:00
Louis Dionne 1ac44d9fd1 [libc++] Protect <span> against min/max macro
Patch by Corentin Jabot
Differential Revision: https://reviews.llvm.org/D73855
2020-02-10 13:41:34 +01:00
Sergej Jaskiewicz 1a7e688b0b Revert "[libcxx] Force-cache LIBCXX_CXX_ABI_LIBRARY_PATH"
This reverts commit 41f4dfd63e.

It broke standalone libc++ builds, which now try to use libc++abi from the wrong directory, instead of system instance.

(cherry picked from commit 3573526c0286c9461f0459be1a4592b2214594e7)
2020-02-03 11:03:58 +01:00
Stephan T. Lavavej 5b14abf0c1 [libcxx] [test] Update msvc_stdlib_force_include.h.
Restore features that are removed in C++20.
2020-01-31 16:38:01 -08:00
Marek Kurdej e93e58c6c4 Reland [libc++] [P0325] Implement to_array from LFTS with updates.
Fixed expected errors and notes.

Summary:
This patch implements https://wg21.link/P0325.

Reviewers: EricWF, mclow.lists, ldionne, lichray

Reviewed By: ldionne, lichray

Subscribers: lichray, dexonsmith, zoecarver, christof, ldionne, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D69882
2020-01-31 11:47:18 +01:00
Marek Kurdej 5e7017273f Revert "[libc++] [P0325] Implement to_array from LFTS with updates."
This reverts commit 86aae78268.

A test is failing on "Release" build without assertions enabled (Fedora 31 on x86_64).
2020-01-31 09:45:50 +01:00
Martijn Vels 282b803b62 White space only change: reflow a comment in basic_string
Summary: This change reflows a comment line. This change serves as a no-op test commit

Reviewers: mclow.lists, ldionne, EricWF

Subscribers: dexonsmith, christof, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D73552
2020-01-30 19:55:48 -05:00
Marek Kurdej 86aae78268 [libc++] [P0325] Implement to_array from LFTS with updates.
Summary:
This patch implements https://wg21.link/P0325.
Please mind that at it is my first contribution to libc++, so I may have forgotten to abide to some conventions.

Reviewers: EricWF, mclow.lists, ldionne, lichray

Reviewed By: ldionne, lichray

Subscribers: lichray, dexonsmith, zoecarver, christof, ldionne, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D69882
2020-01-30 13:38:37 +01:00
Dimitry Andric 5e416ba943 Define _LIBCPP_HAS_TIMESPEC_GET for FreeBSD when appropriate
Summary:
FreeBSD got `timespec_get` support somewhere in the 12.x timeframe, but
the C++ version check in its system headers was written incorrectly.
This has now been fixed for both FreeBSD 13 and 12.

Add checks for the corresponding `__FreeBSD_version` values, to define
`_LIBCPP_HAS_TIMESPEC_GET` when the function is supported.

Reviewers: emaste, EricWF, ldionne, mclow.lists

Reviewed By: ldionne

Subscribers: arichardson, krytarowski, christof, dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D71522
2020-01-30 08:00:56 +01:00
Petr Hosek 7f49dc4966 [CMake][libcxx] Don't wrap __config_site path in quotes on Windows
This is failing to compile on Windows because clang-cl is trying to
use the path with quotes, dropping them resolves the issue.

Differential Revision: https://reviews.llvm.org/D73525
2020-01-29 19:37:35 -08:00
Louis Dionne 93cdd310e1 [libc++] Explicitly specify LIBCXX_ENABLE_SHARED to try and fix CI
Configuring libc++abi with LIBCXX_ENABLE_STATIC=OFF is broken since
https://reviews.llvm.org/D71894, so this patch fixes the issue for
Apple platforms to unblock our CI.
2020-01-29 17:29:43 -08:00
Martin Storsjö 7db4f2c694 [libcxx] [Windows] Store the lconv struct returned from localeconv in locale_t
This fixes using non-default locales, which currently can crash when
e.g. formatting numbers.

Within the localeconv_l function, the per-thread locale is temporarily
changed with __libcpp_locale_guard, then localeconv() is called,
returning an lconv * struct pointer.

When localeconv_l returns, the __libcpp_locale_guard dtor restores
the per-thread locale back to the original. This invalidates the
contents of the earlier returned lconv struct, and all C strings
that are pointed to within it are also invalidated.

Thus, to have an actually working localeconv_l function, the
function needs to allocate some sort of storage for the returned
contents, that stays valid for as long as the caller needs to use
the returned struct.

Extend the libcxx/win32 specific locale_t class with storage for
a deep copy of a lconv struct, and change localeconv_l to take
a reference to the locale_t, to allow it to store the returned
lconv struct there.

This works fine for libcxx itself, but wouldn't necessarily be right
for a caller that uses libcxx's localeconv_l function.

This fixes around 11 of libcxx's currently failing tests on windows.

Differential Revision: https://reviews.llvm.org/D69505
2020-01-29 22:37:11 +02:00
Eric Fiselier b4c911eccc [libcxx] Add a std::string_view pretty printer for libcxx.
This adds a std::string_view pretty printer for libcxx and updates the gdb
pretty printer test.

Patch by Ali Tamur (tamur@google.com)
Reviewed as https://reviews.llvm.org/D73514
2020-01-29 13:04:29 -05:00
Shoaib Meenai 076da521f3 [libcxx] Link against android_support when needed
libc++ on Android needs to be linked against libandroid_support on API
levels less than 21 to provide needed functions that aren't in the libc
on those platforms (e.g. posix_memalign for libcxxabi). libc++ from the
NDK is a linker script that pulls in libandroid_support, but for
building libc++ itself, we need to explicitly add libandroid_support as
a dependency. Moreover, libc++ headers reference the functions provided
by libandroid_support, so it needs to be added as a public dependency.

Differential Revision: https://reviews.llvm.org/D73516
2020-01-28 14:36:24 -08:00
David Zarzycki 5dda92fcb0
Add test for spaceship operator to __config
Summary:
The libcxx test suite auto-detects spaceship operator, but __config does not. This means that the libcxx test suite has been broken for over a month when using top-of-tree clang. This also really ought to be fixed before 10.0.

See: bc633a42dd

Reviewers: chandlerc, mclow.lists, EricWF, ldionne, CaseyCarter

Reviewed By: EricWF

Subscribers: broadwaylamb, hans, dexonsmith, tstellar, llvm-commits, libcxx-commits

Tags: #libc, #llvm

Differential Revision: https://reviews.llvm.org/D72980
2020-01-24 13:27:22 -05:00