Commit Graph

5049 Commits

Author SHA1 Message Date
Eric Fiselier 32869c6997 Add emplace tests for multiset/unordered_multiset.
This patch adds tests to ensure that multiset/unordered_multiset's emplace
method correctly constructs the elements without any intervening
constructions.

llvm-svn: 346743
2018-11-13 06:30:36 +00:00
Marshall Clow d4fa0381e3 Fix PR39619 - iterator_traits isn't SFINAE-friendly enough. Thanks to Eric for the report
llvm-svn: 346738
2018-11-13 05:33:31 +00:00
Marshall Clow a87fe7a345 Update to-do list with new work from WG21 meeting in San Diego
llvm-svn: 346634
2018-11-12 04:58:00 +00:00
Louis Dionne cdaf2b8dce [NFC] Reformat std::optional tests
llvm-svn: 346630
2018-11-12 01:38:30 +00:00
Louis Dionne d9247890da [NFC] Fix typo in <tuple>
llvm-svn: 346629
2018-11-12 01:28:07 +00:00
Petr Hosek f30c0117c8 [libcxx] Provide thread annotations for shared_mutex
shared_mutex was introduced in C++17 but its implementation currently
doesn't use Clang's thread annotations like regular mutex. This change
adds those.

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

llvm-svn: 346567
2018-11-09 23:32:25 +00:00
Eric Fiselier b50daf7a21 Attempt to enable -Wconversion
llvm-svn: 346451
2018-11-08 23:57:32 +00:00
Fangrui Song 892bbd3f88 Fix -Wimplicit-fallthrough warning
Reviewers: EricWF, ldionne, mclow.lists

Reviewed By: ldionne

Subscribers: christof, libcxx-commits

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

llvm-svn: 346369
2018-11-07 23:51:13 +00:00
Marshall Clow 89176c72e7 Fix the test for partition_copy so it is not ridiculously slow. Also, detab.
llvm-svn: 346104
2018-11-04 17:57:25 +00:00
Louis Dionne d1ad7b31ee [NFC] Fix incorrect comment in std::list
llvm-svn: 346072
2018-11-03 17:51:09 +00:00
Dan Albert d5d06a0763 Fix test assumption that Linux implies glibc.
Summary:
This fixes an regression when using bionic introduced in r345173.

I need to follow up and figure out what exactly is implied by
TEST_HAS_C11_FEATURES and see what the correct configuration is for
bionic (new versions should have everything the tests care about,
versions that predate C11 certainly don't), but this gets the tests
back to the old behavior.

Reviewers: EricWF

Reviewed By: EricWF

Subscribers: mclow.lists, christof, ldionne, libcxx-commits, cfe-commits

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

llvm-svn: 345900
2018-11-01 22:35:51 +00:00
Louis Dionne e0a724ef9c Revert "Bug 39129: Speeding up partition_point/lower_bound/upper_bound/ by using unsigned division by 2 when possible."
This reverts r345525. I'm reverting because that patch apparently caused
a regression on certain platforms (see https://reviews.llvm.org/D53994).
Since we don't fully understand the reasons for the regression, I'm
reverting until we can provide a fix we understand.

llvm-svn: 345893
2018-11-01 21:24:32 +00:00
Reid Kleckner 60cce5c782 Use C++11 fallthrough attribute syntax when available and add a break
Summary:
This silences the two -Wimplicit-fallthrough warnings clang finds in
ItaniumDemangle.h in libc++abi.

Clang does not have a GNU attribute spelling for this attribute, so this
is necessary.

I will commit the same change to the LLVM demangler soon.

Reviewers: EricWF, ldionne

Subscribers: christof, erik.pilkington, cfe-commits

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

llvm-svn: 345870
2018-11-01 18:24:03 +00:00
Louis Dionne 8df1d5a546 [libcxx] Fix usage of _C2, which is a "nasty macro" in some environments
The problem was pointed out in https://reviews.llvm.org/D48896#inline-475775.

llvm-svn: 345834
2018-11-01 14:41:37 +00:00
Louis Dionne 7c7cac05ed [NFC] Replace C++1y and C++1z by C++14 and C++17, respectively
llvm-svn: 345762
2018-10-31 18:53:31 +00:00
Louis Dionne 534900b12e [NFC] Mark "Splicing Maps and Sets" as done in LLVM 8.0
llvm-svn: 345759
2018-10-31 18:33:11 +00:00
Erik Pilkington 5c4e07ae5c Second half of C++17's splicing maps and sets
This commit adds a merge member function to all the map and set containers,
which splices nodes from the source container. This completes support for
P0083r3.

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

llvm-svn: 345744
2018-10-31 17:31:35 +00:00
Louis Dionne bdc6deedd3 Correct ABI list change wrongly advertised as being in the 7.0 release
llvm-svn: 345670
2018-10-30 23:24:02 +00:00
Eric Fiselier 88be0d1baf Revert "Build with -fvisibility=hidden"
I messed it up somewhere and now the tests aren't linking.
Reverting while I investigate.

llvm-svn: 345667
2018-10-30 22:23:01 +00:00
Eric Fiselier 6426a8d0c8 Build with -fvisibility=hidden
Summary:
This change changes the build to use -fvisibility=hidden

The exports this patch removes are symbols that should have never been exported
by the dylib in the first place, and should all be symbols which the linker
won't de-duplicate across SO boundaries, making them safe to remove.

After this change, we should be able to apply `_LIBCPP_HIDDEN` to the versioning namespace without changing the export lists.

Reviewers: ldionne, mclow.lists

Reviewed By: ldionne

Subscribers: smeenai, mgorny, libcxx-commits

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

llvm-svn: 345664
2018-10-30 22:07:52 +00:00
Louis Dionne 7bf7edec79 [libcxx] Correct link to code review for P1006
llvm-svn: 345658
2018-10-30 21:50:11 +00:00
Eric Fiselier fe13c13cc2 Make libc++'s versioning namespace customizable
Summary:
This patch makes the versioning namespace libc++ uses customizable by the user using `-DLIBCXX_ABI_NAMESPACE=__foo`. 

This allows users to build custom versions of libc++ which can be linked into binaries with other libc++ versions without causing symbol conflicts or ODR issues. 

Reviewers: mclow.lists, ldionne

Reviewed By: ldionne

Subscribers: kristina, smeenai, mgorny, phosek, libcxx-commits

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

llvm-svn: 345657
2018-10-30 21:44:53 +00:00
Marshall Clow 537aae35dd Add link to implementation for P1006R0
llvm-svn: 345653
2018-10-30 21:27:42 +00:00
Eric Fiselier dec8cbad48 Update LLVM version used on Appveyor bot, remove MSVC 2015 bot
llvm-svn: 345652
2018-10-30 21:23:31 +00:00
Samuel Benzaquen 74583444e7 Add more benchmarks for std::string.
Summary:
Added benchmarks for Construct, Copy, Move, Destroy, Relationals and
Read. On the ones that matter, the benchmarks tests hot and cold data,
and opaque and transparent inputs.

Reviewers: EricWF

Subscribers: christof, ldionne, libcxx-commits

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

llvm-svn: 345611
2018-10-30 15:54:22 +00:00
Eric Fiselier 2f3e8b3d2e Unify definition of _LIBCPP_BEGIN/END_NAMESPACE_STD
llvm-svn: 345561
2018-10-30 02:02:00 +00:00
Eric Fiselier 5d3c5ba7d5 XFAIL test on OS X availability
llvm-svn: 345529
2018-10-29 19:52:22 +00:00
Marshall Clow 8179e5042f Added Phab link for P0927
llvm-svn: 345526
2018-10-29 19:31:35 +00:00
Eric Fiselier 8c40d81d4f Bug 39129: Speeding up partition_point/lower_bound/upper_bound/ by using unsigned division by 2 when possible.
Patch by Denis Yaroshevskiy (denis.yaroshevskij@gmail.com)

The rational and measurements can be found in the bug description: https://bugs.llvm.org/show_bug.cgi?id=39129

Reviewed as https://reviews.llvm.org/D52697

llvm-svn: 345525
2018-10-29 19:25:02 +00:00
Samuel Benzaquen 2f628a1030 Fix mismatch between size_t and uint64_t in std::set benchmark.
llvm-svn: 345523
2018-10-29 19:08:31 +00:00
Louis Dionne e9d85264ac [libc++] Use exclude_from_explicit_instantiation instead of always_inline
Summary:
This commit adopts the exclude_from_explicit_instantiation attribute discussed
at [1] and reviewed in [2] in libc++ to supplant the use of __always_inline__
for visibility purposes.

This change means that users wanting to link together translation units built
with different versions of libc++'s headers into the same final linked image
MUST define the _LIBCPP_HIDE_FROM_ABI_PER_TU macro to 1 when building those
TUs. Doing otherwise will lead to ODR violations and ABI issues.

[1]: http://lists.llvm.org/pipermail/cfe-dev/2018-August/059024.html
[2]: https://reviews.llvm.org/D51789

Reviewers: rsmith, EricWF

Subscribers: dexonsmith, libcxx-commits

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

llvm-svn: 345516
2018-10-29 17:30:04 +00:00
Eric Fiselier e503a1c3b8 Fix PR39458 _LIBCPP_DEBUG breaks heterogeneous compare.
The types/comparators passed to std::upper_bound and std::lower_bound
are not required to provided to provide an operator</comp(...) which
accepts the arguments in reverse order. Nor are the ranges required
to have a strict weak ordering.

However, in debug mode we attempted to check the result of a comparison
with the arguments reversed, which may not compiler.

This patch removes the use of the debug comparator for upper_bound
and lower_bound.

equal_range et al still use debug comparators when they call
__upper_bound and __lower_bound.

See llvm.org/PR39458

llvm-svn: 345434
2018-10-26 22:54:46 +00:00
Eric Fiselier e2ec68e177 Work around gcc.gnu.org/PR87766
llvm-svn: 345425
2018-10-26 20:20:12 +00:00
Louis Dionne 7bf45572c2 [NFC] Update comment in libc++ ABI changelog
llvm-svn: 345424
2018-10-26 20:08:43 +00:00
Eric Fiselier 43245b1f3b Fix incorrect use of aligned allocation in get_temporary_buffer.
llvm-svn: 345403
2018-10-26 17:12:32 +00:00
Eric Fiselier b914eaf45f XFAIL sized deallocation test with GCC
llvm-svn: 345400
2018-10-26 16:37:11 +00:00
Marshall Clow 27e9fdb2ff Run the min/max tests agaist the header <charconv>. Fix that header so it passes. NFC.
llvm-svn: 345352
2018-10-26 01:00:56 +00:00
Eric Fiselier 8622e866a6 fix incorrect placement of _LIBCPP_ALWAYS_INLINE in valarray
llvm-svn: 345289
2018-10-25 17:43:26 +00:00
Eric Fiselier f25b75b91b Implement sized deallocation for std::allocator and friends.
Summary:
C++14 sized deallocation is disabled by default due to ABI concerns. However, when a user manually enables it then libc++ should take advantage of it since sized deallocation can provide a significant performance win depending on the underlying malloc implementation. (Note that libc++'s definitions of sized delete don't do anything special yet, but users are free to provide their own).

This patch updates __libcpp_deallocate to selectively call sized operator delete when it's available. `__libcpp_deallocate_unsized` should be used when the size of the allocation is unknown.

On Apple this patch makes no attempt to determine if the sized operator delete is unavailable, only that the language feature is enabled. This could cause a compile error when using `std::allocator`, but the same compile error would occur whenever the user calls `new`, so I don't think it's a problem.

Reviewers: ldionne, mclow.lists

Reviewed By: ldionne

Subscribers: rsmith, ckennelly, libcxx-commits, christof

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

llvm-svn: 345281
2018-10-25 17:21:30 +00:00
Louis Dionne 9b3222f613 [libc++] Make sure we can build libc++ with -fvisibility=hidden
Summary:
When building with -fvisibility=hidden, some symbols do not get exported from
libc++.dylib. This means that some entities are not explicitly given default
visibility in the source code, and that we rely on the fact -fvisibility=default
is the default. This commit explicitly gives default visibility to those
symbols to avoid being dependent on the command line flags used.

The commit also remove symbols from the dylib -- those symbols do not
actually need to be exported from the dylib and this should not be an
ABI break.

Finally, in the future, we may want to mark the whole std:: namespace as
having hidden visibility (to switch from opt-out to opt-in), in which
case the changes done in this commit will be required.

Reviewers: EricWF

Subscribers: mgorny, christof, dexonsmith, libcxx-commits

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

llvm-svn: 345260
2018-10-25 12:13:43 +00:00
Eric Christopher 9ecdb5a711 Revert "Fix use of __libcpp_deallocate in dynarray"
This reverts commit r345234 as it depended on the sized deallocation commit.

llvm-svn: 345240
2018-10-25 06:43:56 +00:00
Eric Christopher 9bbee38db3 Temporarily Revert "Implement sized deallocation for std::allocator and friends."
This is breaking the bots here (and related): http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-asan/builds/1428

This reverts commit r345214.

llvm-svn: 345239
2018-10-25 06:20:12 +00:00
Eric Fiselier 46493ac9b5 Fix use of __libcpp_deallocate in dynarray
llvm-svn: 345234
2018-10-25 02:36:31 +00:00
Eric Fiselier 7e6448bb02 Implement sized deallocation for std::allocator and friends.
Summary:
C++14 sized deallocation is disabled by default due to ABI concerns. However, when a user manually enables it then libc++ should take advantage of it since sized deallocation can provide a significant performance win depending on the underlying malloc implementation. (Note that libc++'s definitions of sized delete don't do anything special yet, but users are free to provide their own).

This patch updates __libcpp_deallocate to selectively call sized operator delete when it's available. `__libcpp_deallocate_unsized` should be used when the size of the allocation is unknown.

On Apple this patch makes no attempt to determine if the sized operator delete is unavailable, only that the language feature is enabled. This could cause a compile error when using `std::allocator`, but the same compile error would occur whenever the user calls `new`, so I don't think it's a problem.

Reviewers: ldionne, mclow.lists

Reviewed By: ldionne

Subscribers: rsmith, ckennelly, libcxx-commits, christof

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

llvm-svn: 345214
2018-10-24 22:44:01 +00:00
Petr Hosek 76ccec07b4 Revert "Teach __libcpp_is_floating_point that __fp16 and _Float16 are"
This reverts commits r333103 and r333108. _Float16 and __fp16 are C11
extensions and compilers other than Clang don't define these for C++.

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

llvm-svn: 345199
2018-10-24 21:29:15 +00:00
Eric Fiselier 5efe8ec4cd Fix use of libc++ specific macro in support/test_macros.h
llvm-svn: 345173
2018-10-24 18:37:42 +00:00
Mikhail Maltsev b7e43df3c2 Adjust unsupported C++ versions in some tests
Summary:
Some tests (mainly the new C++20 calendar library) fail when libc++ is
tested with '--param=std=c++98'. The failures happen because the tests
actually don't support C++98, but don't mention C++98 in the
'UNSUPPORTED:' line.

This change fixes the issue.

Reviewers: mclow.lists, ldionne

Reviewed By: ldionne

Subscribers: arphaman, michaelplatings, libcxx-commits

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

llvm-svn: 345148
2018-10-24 15:09:08 +00:00
Marshall Clow 5ac28a0cfd Off-by-one errors strike again. Thank goodness for ASAN and the bots.
llvm-svn: 345076
2018-10-23 20:07:45 +00:00
Marshall Clow 55fb053f57 When filling a vector<bool> with stuff, initialize the last word of the storage that you're touching. Otherwise, when we lay down the bits with operator&=, we get UB from reading uninitialized memory. Fixes Bug 39354. Thanks to David Wagner for the bug report.
llvm-svn: 345067
2018-10-23 18:38:15 +00:00
Samuel Benzaquen 37632992ef Add benchmark for std::set.
Summary:
Benchmarks for construct, find, insert and iterate, with sequential
and random ordered inputs.

It also improves the cartesian product benchmark header to allow for
runtime values to be specified in the product.

Reviewers: EricWF

Subscribers: christof, ldionne, libcxx-commits

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

llvm-svn: 345035
2018-10-23 14:49:27 +00:00