Commit Graph

4310 Commits

Author SHA1 Message Date
James Y Knight 929f159777 Rework libcxx strerror_r handling.
The set of #ifdefs used to handle the two incompatible variants of
strerror_r were not complete (they didn't handle newlib appropriately).

Rather than attempting to make the ifdefs more complex, make them
unnecessary by choosing which behavior to use dependent upon the
return type.

Reviewers: waltl

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

llvm-svn: 308528
2017-07-19 21:48:49 +00:00
Hans Wennborg 9e82a506ae Update _LIBCPP_VERSION and the version in CMakeLists to 6.0
llvm-svn: 308468
2017-07-19 13:57:10 +00:00
Hans Wennborg dd2f4e0288 Bump docs version to 6.0
llvm-svn: 308462
2017-07-19 13:46:11 +00:00
Leo Li 95e45f9f93 [CMake] Use MATCHES for regular expression.
Subscribers: mgorny

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

llvm-svn: 308347
2017-07-18 19:48:02 +00:00
Bruno Cardoso Lopes e59dd00038 Check for _MSC_VER before defining _LIBCPP_MSVCRT
Some targets (e.g. Darwin) might have the Win32 API available, but they
do not use MSVC CRT. Assume _LIBCPP_MSVCRT only when _MSC_VER is available
and __MINGW32__ isn't defined.

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

rdar://problem/32628786

llvm-svn: 308225
2017-07-17 21:52:31 +00:00
Marshall Clow 33116350ad Add case for c++2a to libc++ and test macros
llvm-svn: 308159
2017-07-17 03:02:27 +00:00
Marshall Clow 5820ae49ab Update libc++ status pages with results of the Toronto Meeting - and for C++2a
llvm-svn: 308153
2017-07-16 23:59:23 +00:00
Marshall Clow d994e3f35d Update issues moved in Toronto
llvm-svn: 308097
2017-07-15 15:22:21 +00:00
Shoaib Meenai 316a3e572e [libc++] Clean up cl warning 4231 disabling
Once upon a time, extern templates used to be a Microsoft extension, so
cl would warn about their usage, and libc++ suppressed that warning.
They've long since been standardized, so the warning is defunct. (libc++
also doesn't currently support building with cl anyway.)

llvm-svn: 307997
2017-07-14 03:56:54 +00:00
Shoaib Meenai 24767a7c2f [libc++] class template -> template class. NFC
llvm-svn: 307972
2017-07-13 22:08:59 +00:00
Shoaib Meenai 5b67cd3567 [libc++] Mark string operator+ _LIBCPP_FUNC_VIS
It has an extern template instantiation declaration in the headers and a
corresponding instantiation definition in the library, so we must mark
it with _LIBCPP_FUNC_VIS to make it available outside the library.

This doesn't cause any ABI changes as-is since we don't build libc++
with hidden visibility (so the function is exported anyway). It's needed
for building libc++ with hidden visibility, however.

Clarify the Windows behavior for extern function templates while I'm
here, since this exercises that behavior.

llvm-svn: 307966
2017-07-13 21:35:52 +00:00
Shoaib Meenai c44edbcc94 [libc++] Remove unused _LIBCPP_FUNC_VIS_ONLY
This has been unused since r282644.

llvm-svn: 307965
2017-07-13 21:28:17 +00:00
Shoaib Meenai 982060b0a4 [libc++] Use proper template terminology. NFC
It's supposed to be "class template" and "function template" instead of
"template class" and "template function".

llvm-svn: 307954
2017-07-13 20:47:24 +00:00
Ben Craig 7e17e52b87 Fix unrepresentable enum for clang-cl unstable ABI
When using LIBCXX_ABI_UNSTABLE=YES, clang-cl gave the following warning:

P:\llvm_master\src\llvm\projects\libcxx\include\string(683,51):
warning: enumerator value is not representable in the underlying type
'int' [-Wmicrosoft-enum-value]

Fixed by switching from enums to static const size_type.

https://reviews.llvm.org/D35174

llvm-svn: 307751
2017-07-12 01:45:13 +00:00
Eric Fiselier e3e7c0fb37 Remove <__refstring> header; Move it into source directory.
The libc++ <__refstring> headers has no real reason why it should
be a public header that libc++ ships. The only reason it was in the include
directory was because libc++abi needed it to build the library.

However keeping <__refstring> a header had other problems, like requiring its
dependancies to also be in the headers. For that reason this patch
moves it into the source directory.

To work around libc++abi's need for this header a duplicated copy was added
to libc++abi in r307748. While duplicating the code is an unfortunate solution
it's the best solution that's currently possible.

In the future I would like to start a discussion on the mailing lists about
making libc++abi build as a sub-project of libc++, requiring the libc++ sources
always be present.

llvm-svn: 307749
2017-07-12 01:38:35 +00:00
Eric Fiselier e82f49849b Revert "[libc++] Refactoring __sync_* builtins; NFC (Reland)"
This reverts commit r307595. The commit had some issues that needed
to first be addressed in review.

llvm-svn: 307746
2017-07-12 01:16:33 +00:00
Petr Hosek 510e70fdd5 [libcxx][CMake] Add install path variable to allow overriding the destination
This is going to be used by the runtime build in the multi-target
setup to allow using different install prefix for each target.

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

llvm-svn: 307615
2017-07-11 02:39:50 +00:00
Weiming Zhao f7850fa8b6 [libc++] Refactoring __sync_* builtins; NFC (Reland)
Summary: Wrap __sync_* builtins with __libcpp_ functions to facility future customizations as atomic operations are unavailable on some targets.

Reviewers: danalbert, EricWF, jroelofs

Subscribers: joerg, llvm-commits

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

llvm-svn: 307595
2017-07-10 21:37:35 +00:00
Weiming Zhao ba5b8c8ee7 Revert "[libc++] Refactoring __sync_* builtins; NFC"
This reverts commit 72ff8866bca49ee7d24c87673293b4ce88a039ec.

llvm-svn: 307593
2017-07-10 21:23:32 +00:00
Weiming Zhao 07f6efddc0 [libc++] Refactoring __sync_* builtins; NFC
Summary: Wrap __sync_* builtins with __libcpp_ functions to facility future customizations as atomic operations are unavailable on some targets.

Reviewers: danalbert, EricWF, jroelofs

Subscribers: joerg, llvm-commits

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

llvm-svn: 307591
2017-07-10 21:02:54 +00:00
Eric Fiselier 766233b153 Fix issues with UBSAN test configuration.
On Apple the test feature 'sanitizer-new-delete' was incorrectly
getting added to the LIT feature set, which mistakenly caused tests
to be disabled when using UBSAN (the feature is only needed with ASAN/MSAN/TSAN).

llvm-svn: 307518
2017-07-10 04:32:21 +00:00
Eric Fiselier cc859306f4 Work around PR31864 - ATOMIC_LLONG_LOCK_FREE is incorrect in 32 bit builds
llvm-svn: 307517
2017-07-10 04:16:50 +00:00
Eric Fiselier 52f2683695 Fix test failure to to new/delete ellisions
llvm-svn: 307510
2017-07-09 22:20:07 +00:00
Casey Carter f2d571c8ac optional: Implement LWG 2900 and P0602
Differential Revision: https://reviews.llvm.org/D32385

llvm-svn: 307505
2017-07-09 17:15:49 +00:00
Eric Fiselier 433c2f0859 Fix filesystem build on platforms with weird time_t types.
32-bit powerpc provides a 64 bit time_t type and older ppc64 systems
provide time_t as a floating point type. This caused problems when building
operations.cpp since operations.cpp contained compile time tests for conversions
between time_t and filesystem time type.

When these tests failed they caused the libc++ build to fail as well. This is unfortunate.

This patch moves the tests out of the source file and into the test suite. It also
expands the tests to allow testing of the weird time_t configurations on all platforms.

llvm-svn: 307461
2017-07-08 04:18:41 +00:00
Eric Fiselier f29a1b921c Fix diagnostic in verify test to match new Clang output
llvm-svn: 307450
2017-07-07 23:02:30 +00:00
Duncan P. N. Exon Smith 66631a12b8 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

llvm-svn: 307357
2017-07-07 05:13:36 +00:00
Eric Fiselier 226dbd78eb Suppress -Waligned-allocation-unavailable warning in libc++ test suite
llvm-svn: 307218
2017-07-05 22:40:58 +00:00
Marshall Clow 52f4f72fa9 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.
llvm-svn: 307171
2017-07-05 16:37:19 +00:00
Eric Fiselier 57495596bd Fix equivalent test on OS X and FreeBSD
llvm-svn: 307119
2017-07-05 03:54:38 +00:00
Eric Fiselier 635430895a 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.

llvm-svn: 307118
2017-07-05 03:50:03 +00:00
Eric Fiselier 459877388b 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.

llvm-svn: 307117
2017-07-05 03:37:05 +00:00
Akira Hatanaka 539cb66bea 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

llvm-svn: 306859
2017-06-30 18:50:23 +00:00
David L. Jones 8e293f15db [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

llvm-svn: 306755
2017-06-29 23:07:27 +00:00
Shoaib Meenai 8e07cadde0 [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.

llvm-svn: 306632
2017-06-29 02:52:46 +00:00
Marshall Clow 797bcb40e3 Updated notest on 2974
llvm-svn: 306581
2017-06-28 18:19:34 +00:00
Marshall Clow f8c16417a9 Added failing tests for index out of range for tuple_element<pair<T1,T2>> and variant_alternative<>
llvm-svn: 306580
2017-06-28 18:18:30 +00:00
Akira Hatanaka 393b55ffe2 [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

llvm-svn: 306310
2017-06-26 17:39:48 +00:00
Marshall Clow 77957d19f8 Updated for the Toronto meeting
llvm-svn: 306269
2017-06-26 04:25:15 +00:00
Marshall Clow ac8ea7c6ff Implement inclusive_scan/transform_inclusive_scan for C++17.
llvm-svn: 306083
2017-06-23 05:12:42 +00:00
Eric Fiselier 0509238077 Attempt to avoid static init ordering issues with globalMemCounter
llvm-svn: 305955
2017-06-21 21:42:50 +00:00
Stephan T. Lavavej 73f7f8df2b [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.

llvm-svn: 305854
2017-06-20 21:10:53 +00:00
Stephan T. Lavavej 5984426f91 [libcxx] [test] Strip trailing whitespace. NFC.
llvm-svn: 305848
2017-06-20 21:00:02 +00:00
Stephan T. Lavavej afdc99333a [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.

llvm-svn: 305843
2017-06-20 20:34:50 +00:00
Reid Kleckner 324568f909 Fix discovery of cxxabi.h in the monorepo layout
llvm-svn: 305841
2017-06-20 20:34:13 +00:00
Michael Park 3f1e89380b 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

llvm-svn: 305668
2017-06-19 08:25:57 +00:00
Duncan P. N. Exon Smith 8b1b1322f1 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

llvm-svn: 305661
2017-06-19 04:27:41 +00:00
Duncan P. N. Exon Smith 878cf8fbd4 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

llvm-svn: 305649
2017-06-18 16:50:23 +00:00
Duncan P. N. Exon Smith e203359c45 func.wrap.func.con: Fix test comment
This tests moving `function`, not `const function`.

llvm-svn: 305648
2017-06-18 15:34:47 +00:00
Duncan P. N. Exon Smith b1cb279014 any: Add availability for experimental::bad_any_cast
As a follow up to r302172, add missing availability for bad_any_cast.

rdar://problem/32161524

llvm-svn: 305647
2017-06-18 14:52:26 +00:00
Eric Fiselier 63cfb6872b Fix potential bug by casting to the POSIX specified type
llvm-svn: 305549
2017-06-16 06:17:52 +00:00
Eric Fiselier 56312f5ad5 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.

llvm-svn: 305539
2017-06-16 01:57:41 +00:00
Eric Fiselier f9bc058935 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.

llvm-svn: 305536
2017-06-16 00:36:17 +00:00
Marshall Clow 3ebdbb5c80 Add missing include to __bsd_locale_fallbacks.h. Fixes https://bugs.llvm.org/show_bug.cgi?id=33370
llvm-svn: 305469
2017-06-15 14:31:11 +00:00
Marshall Clow 9a102b0924 Renamed some of the newly added tests. No functional change
llvm-svn: 305453
2017-06-15 05:44:49 +00:00
Eric Fiselier b4f962cdcc attempt to fix GCC ToT build failures
llvm-svn: 305451
2017-06-15 03:50:02 +00:00
Eric Fiselier 968eea2c11 Fix another test with modules enabled
llvm-svn: 305448
2017-06-15 03:03:45 +00:00
Eric Fiselier 40eaecc35e remove incorrectly committed assertion
llvm-svn: 305447
2017-06-15 03:02:43 +00:00
Eric Fiselier 1d2274d9a6 Add hack to get --param=enable_modules=true working with a __config_site header
llvm-svn: 305446
2017-06-15 02:54:15 +00:00
Eric Fiselier c6cce07882 Fix test when modules are enabled
llvm-svn: 305445
2017-06-15 02:54:12 +00:00
Eric Fiselier 6af1b7d95c 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.

llvm-svn: 305442
2017-06-15 01:53:12 +00:00
Aditya Kumar 38bc3df8a3 [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

llvm-svn: 305427
2017-06-14 23:17:45 +00:00
Marshall Clow b082f11fdc Rework some metaprogramming to use the detection idiom; no functional change
llvm-svn: 305417
2017-06-14 21:23:57 +00:00
Marshall Clow 8b086e3878 Add some const_casts in places where we were implicitly casting away constness. No functional change, but now they're explicit
llvm-svn: 305410
2017-06-14 20:00:36 +00:00
Marshall Clow 4a911c867f 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.
llvm-svn: 305397
2017-06-14 16:54:43 +00:00
James Y Knight b6567b18c7 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

llvm-svn: 305394
2017-06-14 16:40:03 +00:00
Michael Park 26d98348dc Mark `__is_inplace_*` tests as UNSUPPORTED in <= C++14.
llvm-svn: 305373
2017-06-14 07:12:55 +00:00
Michael Park 9cac9ad9d4 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

llvm-svn: 305370
2017-06-14 05:51:18 +00:00
Marshall Clow f4ea23d3a5 Implement the non-parallel versions of reduce and transform_reduce for C++17
llvm-svn: 305365
2017-06-14 04:48:45 +00:00
Marshall Clow b707e7f391 Fix bug 33389 - __is_transparent check requires too much
llvm-svn: 305292
2017-06-13 14:34:58 +00:00
Marshall Clow ba2b6c6fae Add a test with an empty input range - should do nothing
llvm-svn: 305268
2017-06-13 02:28:40 +00:00
Marshall Clow 59494f2303 Mark the recent variant test as UNSUPPORTED for C++ before 17
llvm-svn: 305198
2017-06-12 16:33:41 +00:00
Marshall Clow 0c69d6e9bb 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
llvm-svn: 305196
2017-06-12 16:13:17 +00:00
Marshall Clow 6db379a2c8 [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
llvm-svn: 305191
2017-06-12 14:41:37 +00:00
Marshall Clow e948ba1cd1 Implement the non-parallel versions of exclusive_scan and transform_exclusive_scan. Reviewed as https://reviews.llvm.org/D34038.
llvm-svn: 305136
2017-06-10 02:22:13 +00:00
Stephan T. Lavavej ba8754ab09 [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.

llvm-svn: 305000
2017-06-08 18:22:03 +00:00
Stephan T. Lavavej 2bd63dae21 [libcxx] [test] Remove a Clang/C2 workaround.
Clang/LLVM doesn't need this workaround.

Fixes D33955.

llvm-svn: 304999
2017-06-08 18:21:59 +00:00
Eric Fiselier 183d83b5b9 XFAIL tuple deduction guide test on GCC
llvm-svn: 304969
2017-06-08 08:03:35 +00:00
Eric Fiselier baaee20690 Add tests for class template deduction on std::tuple.
llvm-svn: 304967
2017-06-08 07:18:17 +00:00
Eric Fiselier 1ef13310b8 Revert r304955 - Fix class template deduction for scoped_lock.
Richard decided to fix these cases in Clang, even though they are
representative of a larger problem for more complex
cases.

llvm-svn: 304966
2017-06-08 07:18:15 +00:00
Eric Fiselier 955290d21f Fix class template deduction for scoped_lock.
r304862 changed how CTD handles deducing a non-primary class template
using a non-dependent constructor of the primary template. This change
requires libc++ to provide explicit deduction guides to make scoped_lock
work again.

llvm-svn: 304955
2017-06-08 00:38:56 +00:00
Eric Fiselier 8551d0e319 Fix compile error with Bionic's PTHREAD_MUTEX_INITIALIZER
On Bionic PTHREAD_MUTEX_INITIALIZER contains the expression "<enum-type> & <integer-type>",
which causes ADL to perform name lookup for operator&. During this lookup Clang decides
that it requires the default member initializer for std::mutex while defining the DMI
for std::mutex::__m_.

If I'm not mistaken this is caused by the explicit noexcept declaration on the defaulted
constructor.

This patch removes the explicit noexcept and instead allows the compiler to declare
the default constructor implicitly noexcept. It also adds a static_assert to ensure
that happens.

Unfortunatly because it's not easy to change the value of _LIBCPP_MUTEX_INITIALIZER
for a single test there is no good way to test this patch.

The Clang behavior causing the trouble here was introduced in r287713, which first
appears in the 4.0 release.

llvm-svn: 304942
2017-06-07 20:47:42 +00:00
Michael Park aeb2c881ce Mark LWG 2904 as complete.
llvm-svn: 304893
2017-06-07 10:27:17 +00:00
Michael Park a8b057483b Implement LWG 2904.
Summary:
- Removed the move-constructibe requirement from copy-assignable.
- Updated `__assign_alt` such that we direct initialize if
  `_Tp` can be `nothrow`-constructible from `_Arg`, or `_Tp`'s
  move construction can throw. Otherwise, construct a temporary and move it.
- Updated the tests to remove the pre-LWG2904 path.

Depends on D32671.

Reviewers: EricWF, CaseyCarter

Reviewed By: EricWF

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

llvm-svn: 304891
2017-06-07 10:22:43 +00:00
Eric Fiselier bc8383e76c Fix test with exceptions disabled
llvm-svn: 304883
2017-06-07 09:06:05 +00:00
Casey Carter 708a21bd5f [test] Test changes to accommodate LWG 2904 "Make variant move-assignment more exception safe"
Also: Move constexpr / triviality extension tests into the std tree and make them conditional on _LIBCPP_VERSION / _MSVC_STL_VERSION.

https://reviews.llvm.org/D32671

llvm-svn: 304847
2017-06-07 00:06:04 +00:00
Casey Carter dd7c68bc78 add missing constexpr to optional::value_or
[Credit to cpplearner]

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

llvm-svn: 304813
2017-06-06 18:47:26 +00:00
Stephan T. Lavavej a651f73a79 [libcxx] [test] Add _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to msvc_stdlib_force_include.hpp.
This macro will instruct MSVC's STL to not warn about features that are deprecated in C++17,
as libcxx tests those features and uses them elsewhere.

llvm-svn: 304765
2017-06-06 02:46:12 +00:00
Casey Carter c8342f2eef [test] Remove workaround for C1XX empty parameter pack bug
Was VSO#109062. This bug was filed *4 years ago*. I submitted a workaround to enable the scoped_allocator_adaptor tests to pass. Bug fixed a week and a half later. This was either a waste of my time, or I've discovered that libc++ has magical bugfix-inducing powers. My money's on the latter.

llvm-svn: 304730
2017-06-05 19:59:17 +00:00
Marshall Clow 1798ec5241 Fix the recently introduced test to work on C++03
llvm-svn: 304629
2017-06-03 01:21:29 +00:00
Marshall Clow 87af646034 Fix some undefined behavior in __hash_table. Thanks to vsk for the report and the patch. Reviewed as https://reviews.llvm.org/D33588.
llvm-svn: 304617
2017-06-03 00:08:32 +00:00
Vedant Kumar 8f5f93a4a8 Mark two coroutine tests as unsupported under ubsan, again
This reverts commit r304580, making bool_await_suspend.pass.cpp and
generator.pass.cpp unsupported on ubsan again. The host compiler is
based on r304329, which has the change from PR33271 (r304277). However,
this was not enough to address the issue.

Bot Failure:
http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/builds/628

Unknown type!
UNREACHABLE executed at /home/eric/full-llvm/llvm/lib/IR/ValueTypes.cpp:287!
llvm::EVT::getEVT(llvm::Type*, bool) (/usr/local/bin/clang-5.0+0x17e7a07)
llvm::TargetLoweringBase::getValueType(llvm::DataLayout const&, llvm::Type*, bool) const (/usr/local/bin/clang-5.0+0x852c4a)
llvm::ComputeValueVTs(llvm::TargetLowering const&, llvm::DataLayout const&, llvm::Type*, llvm::SmallVectorImpl<llvm::EVT>&, llvm::SmallVectorImpl<unsigned long>*, unsigned long) (/usr/local/bin/clang-5.0+0x141b6e9)
 llvm::SelectionDAGBuilder::visitTargetIntrinsic(llvm::CallInst const&, unsigned int) (/usr/local/bin/clang-5.0+0x237b1ca)

clang-5.0: /home/eric/full-llvm/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1236: virtual void llvm::DwarfDebug::endFunctionImpl(const llvm::MachineFunction *): Assertion `LScopes.getAbstractScopesList().size() == NumAbstractScopes && "ensureAbstractVariableIsCreated inserted abstract scopes"' failed.
__assert_fail_base /build/glibc-9tT8Do/glibc-2.23/assert/assert.c:92:0
(/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
llvm::DwarfDebug::endFunctionImpl(llvm::MachineFunction const*) (/usr/local/bin/clang-5.0+0x223f86b)
llvm::DebugHandlerBase::endFunction(llvm::MachineFunction const*) (/usr/local/bin/clang-5.0+0x227a5a1)
llvm::AsmPrinter::EmitFunctionBody() (/usr/local/bin/clang-5.0+0x222522f)

llvm-svn: 304591
2017-06-02 20:06:49 +00:00
Vedant Kumar 07a493e263 Revert "Mark two coroutine tests as unsupported under ubsan"
This reverts commit r304462, thereby re-enabling two tests under ubsan.
We expect these tests to pass now that PR33271 is fixed.

llvm-svn: 304580
2017-06-02 18:30:16 +00:00
Casey Carter 75f2f4c9c1 [test] Allow non-libc++ coroutine_handle::done to strengthen noexcept
llvm-svn: 304487
2017-06-01 22:40:16 +00:00
Vedant Kumar 962aa247de Mark two coroutine tests as unsupported under ubsan
They appear to crash inside of SelectionDAG on some Linux bots, when
ubsan is enabled.

https://bugs.llvm.org/show_bug.cgi?id=33271

llvm-svn: 304462
2017-06-01 20:00:40 +00:00
Vedant Kumar 3a424a857f Remove ubsan XFAILS in two tests
These two tests are ubsan-clean now:
http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_check/3553/

llvm-svn: 304450
2017-06-01 18:48:27 +00:00
Eric Fiselier f8d76e6185 Fix name used in -verify diagnostic to match trunk
llvm-svn: 304384
2017-06-01 02:31:01 +00:00
Eric Fiselier 9ffacf3d16 Fix more unreserved names
llvm-svn: 304383
2017-06-01 02:29:37 +00:00
Eric Fiselier def3c375e0 Rename unreserved names in tuple
llvm-svn: 304382
2017-06-01 02:14:21 +00:00
Eric Fiselier 9bcd8e500e Upgrade Clang version used by appveyor
llvm-svn: 304377
2017-06-01 01:00:59 +00:00
Eric Fiselier baa9198585 Define -DNOMINMAX when running the tests on Windows
llvm-svn: 304372
2017-05-31 23:27:25 +00:00
Eric Fiselier 1c3b0afbbe Fix silly mistakes in recent changes made to coroutine test
llvm-svn: 304364
2017-05-31 22:20:42 +00:00
Eric Fiselier 1ec026252b Fix Libc++ build with MinGW64
Summary: This patch corrects the build errors I encountered when building on MinGW64.

Reviewers: mati865, rnk, compnerd, smeenai, bcraig

Reviewed By: mati865, smeenai

Subscribers: martell, chapuni, cfe-commits

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

llvm-svn: 304360
2017-05-31 22:14:05 +00:00
Eric Fiselier a016efb1dc [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows
Summary:
This patch improves how libc++ handles min/max macros within the headers. Previously libc++ would undef them and emit a warning.
This patch changes libc++ to use `#pragma push_macro`  to save the macro before undefining it, and `#pragma pop_macro` to restore the macros and the end of the header.

Reviewers: mclow.lists, bcraig, compnerd, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits, krytarowski

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

llvm-svn: 304357
2017-05-31 22:07:49 +00:00
Eric Fiselier f9645c3a92 Guard against more macros in tchar.h
llvm-svn: 304352
2017-05-31 21:39:54 +00:00
Eric Fiselier 4f429cecd9 Transform the libc++ coroutine shell tests into normal .pass.cpp tests.
The shell test versions didn't get all of the flags normal tests
do, specifically warning flags. This patch makes them .pass.cpp tests,
and uses a lit.local.cfg to add -fcoroutines-ts and to make them
UNSUPPORTED when that flag isn't available.

llvm-svn: 304351
2017-05-31 21:34:43 +00:00
Eric Fiselier 89918caaa7 Remove uses of _UI because Windows is evil and tchar.h #define's it
llvm-svn: 304348
2017-05-31 21:20:18 +00:00
Casey Carter 0927291471 [test] s/uexpectedly/unexpectedly/
llvm-svn: 304236
2017-05-30 20:12:55 +00:00
Eric Fiselier a607ba6134 Add missing 'requires coroutines' to module map
llvm-svn: 304180
2017-05-29 23:17:28 +00:00
Eric Fiselier 6e88ac2b6c Fix <experimental/coroutine> in C++03
llvm-svn: 304173
2017-05-29 19:46:16 +00:00
Eric Fiselier 3fd0228ead [coroutines] Make coroutine_handle<T>::from_address ill-formed for everything but void*.
from_address requires that the provided pointer refer to the suspended coroutine,
which doesn't have a type, or at least not one knowable by the user. Therefore
every use of `from_address` with a typed pointer is almost certainly a bug.

This behavior is a part of the TS specification, but hopefully it will be
in the future.

llvm-svn: 304172
2017-05-29 19:24:25 +00:00
Eric Fiselier bae0a1d43c Fix coroutine test failures caused by API misusages.
More tests to come. I think that from_address overload should be deleted
or ill-formed, except for the 'void*' one; The user cannot possibly
have a typed pointer to the coroutine state.

llvm-svn: 304131
2017-05-29 06:42:01 +00:00
Eric Fiselier 207d13cf84 Fix multiple bugs in coroutine tests.
llvm-svn: 304124
2017-05-29 05:00:24 +00:00
Eric Fiselier 09fcc2ce9b Correct XFAIL's in coroutine tests to only list ubsan
llvm-svn: 304106
2017-05-28 20:56:16 +00:00
Eric Fiselier 15ee787ac2 Fix use of uninitialized memory
llvm-svn: 304105
2017-05-28 20:49:13 +00:00
Eric Fiselier f8b10f99c9 XFAIL tests which trigger coroutine debug info crash in Clang
llvm-svn: 304104
2017-05-28 20:49:11 +00:00
Eric Fiselier 8f7952c190 Add hack to allow test to run w/o C++17 copy elision
llvm-svn: 304103
2017-05-28 20:30:18 +00:00
Eric Fiselier 4aaf69749b Remove XFAIL's for recently fixed bug
llvm-svn: 304102
2017-05-28 20:25:41 +00:00
Eric Fiselier c34a497b40 [coroutines] Add end-to-end tests within libc++
This patch adds end-to-end/breathing tests for coroutines
into libc++. The tests aren't specifically to test libc++ requirements
but instead are intented to ensure coroutines are working fine in general.

Although libc++ isn't exactly the most correct place for these tests
to live, there is one major advantage. The libc++ test suite is also
used by MSVC and by adding the tests here it ensures they will be
run against all currently available coroutine implementations.

llvm-svn: 304101
2017-05-28 19:38:21 +00:00
Eric Fiselier 298dbf9e89 Workaround debug info bug in Clangs coroutine implementation
llvm-svn: 303966
2017-05-26 04:09:38 +00:00
Eric Fiselier 997a391466 Get <experimental/coroutine> working in C++03.
Clang supports coroutines in all dialects; Therefore libc++ should too,
otherwise the Clang extension is unusable.

I'm not convinced extending support to C++03 is a feasible long term
plan, since as the library grows to offer things like generators it
will be come increasingly difficult to limit the implementation to C++03.

However for the time being supporting C++03 isn't a big deal.

llvm-svn: 303963
2017-05-26 03:02:54 +00:00
Eric Fiselier eb04c8cae2 Guard <experimental/coroutine> against older Clang versions.
Clang started providing -fcoroutines and defining __cpp_coroutines
way before it implemented the __builtin_coro_foo functions. This
means that simply checking if __cpp_coroutines is not a sufficient
way of detecting the actual feature.

This patch implements _LIBCPP_HAS_NO_COROUTINES which implements
a slightly more complex feature check. Specifically it requires
__cpp_coroutines >= 201703L, which only holds for Clang 5.0 built
after 2017/05/24.

llvm-svn: 303956
2017-05-26 01:52:59 +00:00
Eric Fiselier abaf967ceb Remove incorrect #ifdef guards around variant tests.
The tests were previously guarded by #if defined(_LIBCPP_VER) || defined(_MSVC_STL_VER),
which is both incorrect (e.g. _LIBCPP_VERSION) and unneeded. Although the tests are
technically non-standard (yet) they are supported by both libc++ and MSVC's STL.

libstdc++ doesn't regularly use the test suite so I'm not concerned about guarding these
tests for them.

llvm-svn: 303953
2017-05-26 01:27:08 +00:00
Casey Carter f611d873a3 [test] Fix breakage from r303947 =(
llvm-svn: 303951
2017-05-26 01:00:56 +00:00
Casey Carter a60c9bced5 [test] make_shared<T()>(...) is, uh, libc++-specific
llvm-svn: 303947
2017-05-26 00:37:33 +00:00
Eric Fiselier ea96891fb4 Re-add <experimental/coroutine> to the module map.
The original issues were caused because <experimental/coroutine>
didn't correctly #ifdef out enough of the header, which caused incomplete
types to be used.

This patch fixes the `#if defined(__cpp_coroutines)` guard and re-adds
the headers to the module map.

It also uglifies some incorrectly non-reserved names.

llvm-svn: 303936
2017-05-25 23:39:29 +00:00
Eric Fiselier 5099ddfdf7 Correct typo: LIBCXXABI_BUILTINS_LIBRARY -> LIBCXX_BUILTINS_LIBRARY
llvm-svn: 303929
2017-05-25 22:43:42 +00:00
Martell Malone 8fd2d37b0b libcxx: fix bootstrapping for mingw-w64
Differential Revision: https://reviews.llvm.org/D33388

llvm-svn: 303928
2017-05-25 22:37:15 +00:00
Eric Fiselier 51056aef65 Update more coroutine_handle signatures to reflect N4663.
Thanks to Casey Carter for pointing out the out-of-date tests and
implementation.

llvm-svn: 303900
2017-05-25 19:04:55 +00:00
Billy Robert O'Neal III 4deabc97a1 Add asserts that the nullptr is maintained in string erase operations.
llvm-svn: 303899
2017-05-25 19:01:14 +00:00
Eric Fiselier 2944c5a3fa Update coroutine_handle<P>::promise to reflect N4663.
This patch updates the promise() member to match the current spec.
Specifically it removes the non-const overload and make the return
type of the const overload non-const.

This patch also makes the ASSERT_NOT_NOEXCEPT tests libc++ specific,
since other implementations may be free to strengthen the specification.

llvm-svn: 303895
2017-05-25 18:52:34 +00:00
Casey Carter b4f3924dd5 [test] Remove workaround for C1XX conversion-to-nullptr bug
VSO#391542 "Types can't be convertible to nullptr_t"

Also put internal bug numbers on the workarounds in test_workarounds.h for correlation.

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

llvm-svn: 303889
2017-05-25 17:42:21 +00:00
Casey Carter 895db0a5f6 [test] Workaround C1XX bug in uses_allocator_types.hpp
VSO#109062 "Explicit template argument specification with empty template parameter pack expansion does not imply further empty pack expansion"

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

llvm-svn: 303888
2017-05-25 17:42:17 +00:00
Erik Pilkington 76886e82e5 Fix a test that was failing in C++11 mode introduced in r303874
llvm-svn: 303878
2017-05-25 16:16:17 +00:00
Marshall Clow 91a091cc00 Mark LWG#2900 as complete - we already do this, and I checked the tests in a couple days ago (r303268 & r303824)
llvm-svn: 303876
2017-05-25 16:05:54 +00:00
Erik Pilkington 72d0d603fb Add support for shared_ptr<FunctionType>
Fixes PR27566.

Differential revision: https://reviews.llvm.org/D30837

llvm-svn: 303874
2017-05-25 15:43:31 +00:00
Marshall Clow 5b7c98e52a Last commit included some extra constexpr; remove them
llvm-svn: 303862
2017-05-25 14:20:26 +00:00
Marshall Clow 1d02996d28 Make for_each_n only avaliable on C++17
llvm-svn: 303856
2017-05-25 13:40:57 +00:00
Eric Fiselier 39b56d80a1 Remove <experimental/coroutine> from the module map for now. It doesn't work unless modules are enabled
llvm-svn: 303838
2017-05-25 05:30:05 +00:00
Eric Fiselier d791d4ea3c Disable the coroutines tests until Clang bumps __cpp_coroutines to reflect recent changes
llvm-svn: 303837
2017-05-25 05:11:40 +00:00
Eric Fiselier 3ca9185073 Add <experimental/coroutine>
This patch adds the library portions of the coroutines PDTS,
which should now be supported by Clang.

llvm-svn: 303836
2017-05-25 04:36:24 +00:00
Eric Fiselier c81c8cbe77 Fix broken links on C++1z status page
llvm-svn: 303835
2017-05-25 04:09:07 +00:00
Marshall Clow d5c65ffa8d Add non-parallel version of for_each_n (+tests) from the Parallelism TS
llvm-svn: 303833
2017-05-25 02:29:54 +00:00
Marshall Clow 29b75d6986 Add some constexpr tests for optional's move/copy ctor
llvm-svn: 303824
2017-05-25 00:22:33 +00:00
Marshall Clow c44a727ee4 Implement LWG#2790: Remove istreambuf_iterator::operator->. It never did anything useful.
llvm-svn: 303675
2017-05-23 18:55:32 +00:00
Erik Pilkington 0de31c7e53 [test] Add support for Objective-C++ tests
Differential revision: https://reviews.llvm.org/D33049

llvm-svn: 303466
2017-05-19 23:02:49 +00:00
Marshall Clow f51ee63247 Make next/prev/advance/distance operations on iterators be constexpr. I missed this when I implemented the rest of P0031R0
llvm-svn: 303281
2017-05-17 18:51:36 +00:00
Marshall Clow c1bcd4c1f2 Mark the copy constructor and move
constructor to be constexpr. This only works when the contained type has a constexpr copy/move ctor.

llvm-svn: 303268
2017-05-17 15:30:01 +00:00
Casey Carter 4de0f034cf [test] Add specific test for P0138R2, direct-list-init of fixed enums from integers, part 3/3.
Test the C++17 Core Language feature independently from other std::byte tests.

llvm-svn: 302946
2017-05-12 20:33:46 +00:00
Casey Carter 7bba58f24d [test] Avoid P0138R2, direct-list-init of fixed enums from integers, part 2/3.
This C++17 Core Language feature isn't necessary when testing std::byte.
It's a minor convenience, but it limits test coverage to very new compilers.

This part activates the tests for more compilers.

llvm-svn: 302945
2017-05-12 20:33:41 +00:00