Commit Graph

5684 Commits

Author SHA1 Message Date
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