Commit Graph

4194 Commits

Author SHA1 Message Date
Duncan P. N. Exon Smith
e452f6a7e3 cmath: Support clang's -fdelayed-template-parsing
r283051 added some functions to cmath (in namespace std) that have the
same name as functions in math.h (in the global namespace).  Clang's
limited support for `-fdelayed-template-parsing` chokes on this.  Rename
the ones in `cmath` and their uses in `complex` and the test.

rdar://problem/32848355

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@307357 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 05:13:36 +00:00
Eric Fiselier
58cb7c19bf Suppress -Waligned-allocation-unavailable warning in libc++ test suite
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@307218 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 22:40:58 +00:00
Marshall Clow
e00d350bbd Fix a bug in regex_Iterator where it would report zero-length matches forever. Reported as http://llvm.org/PR33681. Thanks to Karen Arutyunov for the report.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@307171 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 16:37:19 +00:00
Eric Fiselier
530ad8eb20 Fix equivalent test on OS X and FreeBSD
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@307119 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 03:54:38 +00:00
Eric Fiselier
f26da86616 Add dummy CMake target for *.pass.cpp tests when LIBCXX_CONFIGURE_IDE=ON.
In order for IDE's like CLion to correctly parse and highlight the tests
it needs to know roughly how to build them. This patch adds a dummy CMake target
for each/all of the .pass.cpp tests in the test suite to solve this problem.
The target is only created when LIBCXX_CONFIGURE_IDE=ON, so it shouldn't affect
most users.

Originally I wasn't sure that this change deserved to live upstream, but it's
quite frustrating to edit libc++ tests using CLion or Visual Studio without it,
in particular the filesystem tests which rely heavily on macros. Even though the change
should have no effect on non-IDE users/configurations I decided to commit it upstream
with the hopes it will benefit somebody other than me.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@307118 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 03:50:03 +00:00
Eric Fiselier
3288eac673 Implement LWG 2937 - equivalent("dne", "exists") is not an error
This patch speculatively implements the PR for LWG 2937, which fixes
two issues with equivalent.

(1) It makes equivalent("dne", "exists") an error. Previously only
    equivalent("dne", "dne") was an error and the former case was not (it returned false).
    Now equivalent reports an error when either input doesn't exist.

(2) It makes equivalent(p1, p2) well-formed when `is_other(p1) && is_other(p2)`.
    Previously this was an error, but there is seemingly no reason why it should be on POSIX system.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@307117 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 03:37:05 +00:00
Akira Hatanaka
c5247b417b Revert "[libcxx] Annotate c++17 aligned new/delete operators with availability"
This reverts commit r306310.

r306310 causes clang to reject a call to an aligned allocation or
deallocation function if it is not implemented in the standard library
of the deployment target. This is not the desired behavior when users
have defined their own aligned functions.

rdar://problem/32664169

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@306859 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-30 18:50:23 +00:00
David L. Jones
4438e211a7 [lit/libcxx] Fix a remaining reference to lit.util.capture() in custom libcxx/Darwin code.
Summary:
This reference to lit.util.capture is functionally identical to
subprocess.check_output, so this change switches to call the library routine
directly.

Reviewers: mzolotukhin, EricWF

Reviewed By: mzolotukhin

Subscribers: sanjoy, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@306755 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-29 23:07:27 +00:00
Shoaib Meenai
6850670375 [libc++] Hoist explicit instantiation above implicit. NFC
The string literal operators have implicit instantiations of
basic_string<char> and basic_string<wchar>, which prevent the dllimport
on the subsequent explicit instantiation declarations from having an
effect. Hoisting the explicit instantiations above the implicit ones
fixes the issue.

I think it's pretty unfortunate that the ordering has such an effect,
and I'd fixed the same issue for dllexport in r288682. dllimport is more
complicated from a codegen perspective, however, and clang's behavior of
ignoring the dllimport when there's a previous implicit instantiation is
consistent with cl, so changing the order is our only recourse.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@306632 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-29 02:52:46 +00:00
Marshall Clow
c98c89099a Updated notest on 2974
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@306581 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-28 18:19:34 +00:00
Marshall Clow
a12318f5ae Added failing tests for index out of range for tuple_element<pair<T1,T2>> and variant_alternative<>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@306580 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-28 18:18:30 +00:00
Akira Hatanaka
a028f3c8d9 [libcxx] Annotate c++17 aligned new/delete operators with availability
attribute.

This is needed because older versions of libc++ do not have these
operators. If users target an older deployment target and try to compile
programs in which these operators are explicitly called, the compiler
will complain.

The following is the list of minimum deployment targets for the four
OSes:

macosx: 10.13
ios: 11.0
tvos: 11.0
watchos: 4.0

rdar://problem/32664169

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@306310 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-26 17:39:48 +00:00
Marshall Clow
2ac0ed06e2 Updated for the Toronto meeting
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@306269 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-26 04:25:15 +00:00
Marshall Clow
3477ae445a Implement inclusive_scan/transform_inclusive_scan for C++17.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@306083 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23 05:12:42 +00:00
Eric Fiselier
186b81a517 Attempt to avoid static init ordering issues with globalMemCounter
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305955 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-21 21:42:50 +00:00
Stephan T. Lavavej
3497449a37 [libcxx] [test] Fix -Wmismatched-tags in tuple_size_structured_bindings.pass.cpp.
Clang and C1XX both complain about mismatched class/struct, but libc++ and MSVC's STL
differ on what they use for tuple_element/tuple_size, so there's no way to win here.

I'm reverting this part of my previous change. In the future, I'll have to suppress
the warning for one compiler or the other.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305854 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 21:10:53 +00:00
Stephan T. Lavavej
b836deb5db [libcxx] [test] Strip trailing whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305848 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 21:00:02 +00:00
Stephan T. Lavavej
750da9c572 [libcxx] [test] Add more tests to tuple_size_structured_bindings.pass.cpp and make it friendlier to C1XX.
Style/paranoia: 42.1 doesn't have an exact binary representation. Although this doesn't
cause failures, it makes me uncomfortable, so I'm changing it to 42.5.

C1XX rightly warns about unreferenced variables. Adding tests for their values
makes C1XX happy and improves test coverage.

C1XX (somewhat obnoxiously) warns about seeing a struct specialized as a class.
Although the Standard doesn't care, saying struct consistently is better.
(The Standard itself is still inconsistent about whether to depict tuple_element
and tuple_size as structs or classes.)

Fixes D33953.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305843 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 20:34:50 +00:00
Reid Kleckner
bfe423eeb3 Fix discovery of cxxabi.h in the monorepo layout
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305841 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 20:34:13 +00:00
Michael Park
b47a9bc6c4 Add a missing SFINAE condition to the variant's converting constructor.
Remarks: This function shall not participate in overload resolution unless
         `is_same_v<decay_t<T>, variant>` is false, unless `decay_t<T>` is
         neither a specialization of `in_place_type_t` nor a specialization of
         `in_place_index_t`, unless `is_constructible_v<Tj, T>` is true, and
         unless the expression `FUN(std::forward<T>(t))` (with `FUN` being the
         above-mentioned set of imaginary functions) is well formed.

Depends on D34111.

Reviewers: EricWF, K-ballo

Reviewed By: EricWF

Subscribers: fhahn

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305668 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-19 08:25:57 +00:00
Duncan P. N. Exon Smith
7db4f7b426 path: Use string_view_t consistently
Most of filesystem/path.cpp uses string_view_t. This fixes the two spots
that use string_view directly.

https://reviews.llvm.org/D34332

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305661 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-19 04:27:41 +00:00
Duncan P. N. Exon Smith
2b93569a36 iostreams: Fix deployment target for streams dylib support
Fix an off-by-one in r302172, which triggered building local versions of
the iostreams when deploying to `<= macOS 10.9`, when it should have
been `< macOS 10.9`.  10.9 had the dylib support.

This defines `_LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE` less
often, reducing code size for users with deployment targets of exactly
macOS 10.9 or iOS 7.0.

rdar://problem/32233981

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305649 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-18 16:50:23 +00:00
Duncan P. N. Exon Smith
2b001ff730 func.wrap.func.con: Fix test comment
This tests moving `function`, not `const function`.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305648 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-18 15:34:47 +00:00
Duncan P. N. Exon Smith
10a803db2c any: Add availability for experimental::bad_any_cast
As a follow up to r302172, add missing availability for bad_any_cast.

rdar://problem/32161524

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305647 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-18 14:52:26 +00:00
Eric Fiselier
4b1c560ca3 Fix potential bug by casting to the POSIX specified type
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305549 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 06:17:52 +00:00
Eric Fiselier
73202133d9 Allow the libc++ C header wrappers to be included when compiling C.
C99 at least. C89 still fails due to the use of block comments.

NOTE: Having libc++ on the include path when compiling C is not
recommended or ever really supported. However it happens often
enough that this change is warrented.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305539 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 01:57:41 +00:00
Eric Fiselier
660d2654f8 Allow coroutine_handle<const T> to support creation from const references to the promise_type
It seems conceivable that a user would need to get a coroutine handle
having only a const reference to the promise_type, for example from
within a const member function of the promise.

This patch allows that use case. A coroutine_handle<const T> can be used
in essentially the same way a coroutine_handle<T>, ie to start and destroy
the coroutine. The constness of the promise doesn't/shouldn't propagate
to the handle.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305536 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 00:36:17 +00:00
Marshall Clow
daea5bc508 Add missing include to __bsd_locale_fallbacks.h. Fixes https://bugs.llvm.org/show_bug.cgi?id=33370
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305469 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 14:31:11 +00:00
Marshall Clow
270a04fb06 Renamed some of the newly added tests. No functional change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305453 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 05:44:49 +00:00
Eric Fiselier
5f8e0d7ed9 attempt to fix GCC ToT build failures
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305451 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 03:50:02 +00:00
Eric Fiselier
63e0adbe3a Fix another test with modules enabled
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305448 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 03:03:45 +00:00
Eric Fiselier
924c998c0e remove incorrectly committed assertion
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305447 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 03:02:43 +00:00
Eric Fiselier
954bf04d1d Add hack to get --param=enable_modules=true working with a __config_site header
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305446 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 02:54:15 +00:00
Eric Fiselier
8c6e35cf2c Fix test when modules are enabled
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305445 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 02:54:12 +00:00
Eric Fiselier
957d7f4ec7 Move external instantiation for __vector_base_common to vector.cpp
Previously the explicit instantiation for this was in locale.cpp,
but that didn't make much sense. This patch creates a new vector.cpp
source file to contain the explicit instantiation.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305442 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 01:53:12 +00:00
Aditya Kumar
aa356d6b86 [locale] Avoid copy of __atoms when char_type is char
The function num_get<_CharT>::stage2_int_prep makes unnecessary copy of src
into atoms when char_type is char. This can be avoided by creating
a switch on type and just returning __src when char_type is char.

Added the test case to demonstrate performance improvement.
In order to avoid ABI incompatibilities, the changes are guarded
with a macro _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET

Differential Revision: https://reviews.llvm.org/D30268
Reviewed by: EricWF

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305427 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-14 23:17:45 +00:00
Marshall Clow
405af58e6b Rework some metaprogramming to use the detection idiom; no functional change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305417 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-14 21:23:57 +00:00
Marshall Clow
ff5f9b28ba Add some const_casts in places where we were implicitly casting away constness. No functional change, but now they're explicit
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305410 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-14 20:00:36 +00:00
Marshall Clow
899f113f6c In several places in std::allocator<const T> (and one in shared_ptr, we were casting a 'const T*' to a 'void *' - implicitly casting away the const. Add const_cast to make that explicit. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305397 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-14 16:54:43 +00:00
James Y Knight
13498f6888 PR32476: __nop_locale_mgmt.h not needed with newlib 2.5+
Newlib 2.5 added the locale management functions, so it should not
include __nop_local_mgmt.h. This change adds proper guard around that
include statement.

For newlib 2.4, some releases contain these functions and some don't,
and they all have the same version numbers. This patch will work
properly with the initial "2.4.0" release which does not include these
functions and require __nop_local_mgmt.h.

This has been tested against newlib 2.2 and 2.5, and also sanity
checks against other different version numbers.

Patch by Martin J. O'Riordan and Walter Lee

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305394 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-14 16:40:03 +00:00
Michael Park
eaa74739c0 Mark __is_inplace_* tests as UNSUPPORTED in <= C++14.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305373 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-14 07:12:55 +00:00
Michael Park
c590dae5d6 Add an __is_inplace_index metafunction.
Summary: This is used to constrain `variant`'s converting constructor correctly.

Reviewers: EricWF, mclow.lists

Reviewed By: EricWF, mclow.lists

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305370 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-14 05:51:18 +00:00
Marshall Clow
0175dfdfdf Implement the non-parallel versions of reduce and transform_reduce for C++17
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305365 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-14 04:48:45 +00:00
Marshall Clow
246eb897c9 Fix bug 33389 - __is_transparent check requires too much
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305292 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-13 14:34:58 +00:00
Marshall Clow
6bb9569124 Add a test with an empty input range - should do nothing
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305268 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-13 02:28:40 +00:00
Marshall Clow
3128b5abf0 Mark the recent variant test as UNSUPPORTED for C++ before 17
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305198 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-12 16:33:41 +00:00
Marshall Clow
bc37f8d93d Make tuple_element static_assert in pair if the index is out of range. Also, add a message to variant_alternative<> in the similar case (it already asserted). Add tests for this
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305196 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-12 16:13:17 +00:00
Marshall Clow
568c481c7b [array.tuple]/1 says that instantiating tuple_element<N, array<T, M>> is ill-formed if N >= M. We didn't do that. Add a static_assert to cause a failure, and a test that checks that we failed
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305191 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-12 14:41:37 +00:00
Marshall Clow
fb97c4408f Implement the non-parallel versions of exclusive_scan and transform_exclusive_scan. Reviewed as https://reviews.llvm.org/D34038.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305136 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-10 02:22:13 +00:00
Stephan T. Lavavej
76836caa7d [libcxx] [test] Update locale names for Windows.
locale.codecvt.byname/ctor_char.pass.cpp:
This test used to use "en_US" as a plain string instead of using platform_support.
Need to fix this because MS STL expects "en-US" instead.

platform_support.h:
These are the legacy Windows locale names. Should use IETF tags instead.
I've also added en_US, since a test was using that as a locale string as well.

msvc_stdlib_force_include.hpp:
Remove _MSVC_STL_VER. The libraries will directly define _MSVC_STL_VERSION in the future.

Fixes D29351.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305000 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-08 18:22:03 +00:00