Commit Graph

2812 Commits

Author SHA1 Message Date
Marshall Clow dc3eb83d08 Always use the allocator to construct/destruct elements of a deque/vector. Fixes PR#28412. Thanks to Jonathan Wakely for the report.
llvm-svn: 275105
2016-07-11 21:38:08 +00:00
Eric Fiselier 0774aa96dc Allow is_swappable to SFINAE on deleted/ambiguous swap functions
llvm-svn: 275094
2016-07-11 19:57:13 +00:00
Eric Fiselier faaeaaf0d8 Hide some internal symbols for memory resource.
llvm-svn: 275089
2016-07-11 19:22:09 +00:00
Marshall Clow bc3b1f3b7b Fix typo in #ifdef; leave tests commented out b/c gcc 4.8 harks on them.
llvm-svn: 274882
2016-07-08 16:59:54 +00:00
Marshall Clow 947ce6b59f Implement LWG685 (which is from C++11!). Fixes PR#28421. Note: this (subtly) changes the return type of operator-(Iter1, Iter2) where Iter1 is a reverse iterator or a move_iterator, and Iter2 is some other move/reverse iterator type. In practice, I believe that almost every time the second param will be const_XXX and this will mean that the return type will be the same as it was before.
llvm-svn: 274880
2016-07-08 16:54:47 +00:00
Kwasi Mensah 318d35a7bc [libc++] Check hash before calling __hash_table key_eq function
Summary: The current implementations of __hash_table::find used by std::unordered_set/unordered_map call key_eq on each key that lands in the same bucket as the key you're looking for. However, since equal objects mush hash to the same value, you can short-circuit the possibly expensive call to key_eq by checking the hashes first.

Reviewers: EricWF

Subscribers: kmensah, cfe-commits

Differential Revision: http://reviews.llvm.org/D21510

llvm-svn: 274857
2016-07-08 15:34:28 +00:00
Manman Ren 78fa242ec2 Revert r274605 due to bot failure: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/244/
llvm-svn: 274651
2016-07-06 18:24:53 +00:00
Marshall Clow 5c29783bf2 Fix typo in #ifdef, and re-enable tests now that the green-dragon bots are no more
llvm-svn: 274605
2016-07-06 05:28:44 +00:00
Eric Fiselier c835c12f6c Add unordered_map::insert benchmark test and rename file
llvm-svn: 274424
2016-07-02 05:30:54 +00:00
Eric Fiselier f977598bb6 Improve performance of unordered_set<uint32_t>::find by 45%. Add benchmarks.
This patch improves the performance of unordered_set's find by 45% when
the value exists within the set. __hash_tables find method
needs to check if it's reached the end of the bucket by constraining the
hash of the current node and checking it against the bucket index. However
constraining the hash is an expensive operations and it can be avoided if the
two unconstrained hashes are equal. This patch applies that optimization.

This patch also adds a top level directory called benchmarks. 'benchmarks/'
is intended to store any/all benchmarks written for the standard library.
Currently nothing is done with files under 'benchmarks/' but I would like
to move towards introducing a formal format and test runner.

llvm-svn: 274423
2016-07-02 05:19:59 +00:00
Eric Fiselier 4f905b8daa Handle std::get<T>(...) for std::tuple<>
llvm-svn: 274422
2016-07-02 03:46:08 +00:00
Eric Fiselier 3a0485427f Remove workarounds for C++17 inline variable ABI break. It has been fixed in clang.
llvm-svn: 274419
2016-07-02 03:21:58 +00:00
Eric Fiselier f447e62e1d Rewrite std::get<Type>(...) helper using constexpr functions.
llvm-svn: 274418
2016-07-02 03:18:30 +00:00
Eric Fiselier 27cdf401ea Cleanup SFINAE in tuple, and add tests for reference assignment
llvm-svn: 274414
2016-07-02 01:25:46 +00:00
Eric Fiselier 7b60958aea Make tuple_constructible and family lazy again.
llvm-svn: 274413
2016-07-02 00:58:17 +00:00
Eric Fiselier fa10f41f3e Add another workaround for C++17 inline variable ABI breakage.
llvm-svn: 274408
2016-07-01 23:41:48 +00:00
Eric Fiselier d3ac6ae7d3 Remove accidental change committed in r274403.
llvm-svn: 274407
2016-07-01 23:31:55 +00:00
Eric Fiselier 58b6e3e3d0 Turn off ASAN's odr-violation diagnostics for now. See PR28391
llvm-svn: 274404
2016-07-01 23:25:47 +00:00
Eric Fiselier d3a1ed814b Work around ABI break caused by C++17 inline variables.
llvm-svn: 274403
2016-07-01 23:22:25 +00:00
Eric Fiselier e2fd8b8db9 Flatten tuple_constructible, tuple_convertible and tuple_assignable.
This patch is the last in a series that replaces recursive meta-programming
in std::tuple with non-recursive implementations.

Previously std::tuple could only be instantiated with 126 elements before
it blew the max template instantiation depth. Now the size of std::tuple is
essentially unbounded (I've tested with over 5000 elements).

One unfortunate side-effect of this change is that tuple_constructible
and similar no longer short circuit after the first failure. Instead they
evaluate the conditions for all elements. This could be potentially breaking.
I plan to look into this further.

llvm-svn: 274331
2016-07-01 04:07:39 +00:00
Eric Fiselier 10b9a1bb42 Flatten the tuple_element and __make_tuple_types implementations.
This patch attempts to improve the QoI of std::tuples tuple_element and
__make_tuple_types helpers. Previously they required O(N) instantiations,
one for every element in the tuple

The new implementations are O(1) after __tuple_indices<Id...> is created.

llvm-svn: 274330
2016-07-01 03:54:54 +00:00
Eric Fiselier 9743af6e31 Replace __make_tuple_indices implementation with superior implementation.
The previous __make_tuple_indices implementation caused O(N) instantiations
and was pretty inefficient. The C++14 __make_integer_sequence implementation
is much better, since it either uses a builtin to generate the sequence or
a very nice Log8(N) implementation provided by richard smith.

This patch moves the __make_integer_sequence implementation into __tuple
and uses it to implement __make_tuple_indices.

Since libc++ can't expose the name 'integer_sequence' in C++11 this patch
also introduces a dummy type '__integer_sequence' which is used when generating
the sequence. One the sequence is generated '__integer_sequence' can be
converted into the required type; either '__tuple_indices' or 'integer_sequence'.

llvm-svn: 274286
2016-06-30 22:34:43 +00:00
Marshall Clow 3b8669edbf Fix static assert problem on gcc; remove XFAILs that I put in in r274250
llvm-svn: 274285
2016-06-30 22:05:45 +00:00
Eric Fiselier 19cf6b6c93 Fix C++03 build.
llvm-svn: 274274
2016-06-30 20:46:58 +00:00
Marshall Clow f7aaf31c53 Mark issues 2550, 2551, 2555, 2685, 2698 as complete. These issues are wording clarifications; no code changes required.
llvm-svn: 274255
2016-06-30 18:05:19 +00:00
Marshall Clow 2f63da2887 Mark issues 2667, 2669, 2670, 2671, 2673 as complete. These issues are wording clarifications; no code changes required.
llvm-svn: 274253
2016-06-30 17:59:01 +00:00
Marshall Clow e46c0885ff Implement LWG#2688: 'clamp misses preconditions and has extraneous condition on result'. We already did this, just added tests
llvm-svn: 274252
2016-06-30 17:52:51 +00:00
Marshall Clow bc4618647f Temporarily XFAIL the incomplete type tests for GCC while I figure out why adding a static_assert in r274235 broken them
llvm-svn: 274250
2016-06-30 17:49:36 +00:00
Marshall Clow c8afc869b0 Implement LWG#2684: 'priority_queue lacking comparator typedef'. We already did this, just added tests
llvm-svn: 274243
2016-06-30 16:03:50 +00:00
Marshall Clow 81fce9729c Implement LWG#2596: 'vector::data() should use addressof'
llvm-svn: 274241
2016-06-30 15:50:55 +00:00
Marshall Clow e766a87b01 Implement LWG#2441: 'Exact-width atomic typedefs should be provided'
llvm-svn: 274236
2016-06-30 15:28:38 +00:00
Marshall Clow 497677449b Implement LWG#2436: 'Comparators for associative containers should always be CopyConstructible'
llvm-svn: 274235
2016-06-30 15:11:53 +00:00
Eric Fiselier b4fe59b595 Update status of already completed Oulu issues.
* P0163r0: Implemented in r273839.

* LWG 2309: pthread_mutex_lock only returns this error if certain debug flags
  were passed during construction. libc++ does not pass these flags. There is
  nothing to do.

* LWG 2310: Wording fix. No impact on libc++'s implementation.

* LWG 2312: libc++'s std::tuple implementation already constrains the overloads
  based on the number of arguments.

* LWG 2549: libc++'s std::tuple already applied this fix.

* LWG 2674: libc++ already depends on this relaxed wording.

* LWG 2704, 2706, 2707, 2719, 2720, 2721, 2723, 2725, 2728: All of these filesystem were either
  submitted by me and fixed before submission, or have already been applied.

llvm-svn: 274214
2016-06-30 06:59:29 +00:00
Eric Fiselier d3c2acd38c Make futures.overview enum tests more portable. Patch from STL@microsoft.com
llvm-svn: 274211
2016-06-30 05:00:32 +00:00
Eric Fiselier b21f96ac4b Make std::array typedef tests more portable.
llvm-svn: 274210
2016-06-30 04:54:00 +00:00
Eric Fiselier 8892b4eef0 Fix ::reference typedef in insert iterators.
Since at least the C++11 standard insert iterators are specified
as having ::reference typedef void. Libc++ was not doing that.
This patch corrects the typedef.

This patch changes the std::iterator base class of insert_iterator,
front_insert_iterator and back_insert_iterator. This should not
be an ABI breaking change.

llvm-svn: 274209
2016-06-30 04:40:50 +00:00
Eric Fiselier cb1fd66853 Make instreambuf.iterator/types.pass.cpp more portable.
llvm-svn: 274207
2016-06-30 04:31:09 +00:00
Eric Fiselier c76111a132 Fix use of terse static assert. Patch from STL@microsoft.com
llvm-svn: 274206
2016-06-30 04:29:12 +00:00
Eric Fiselier 3b0184321f Fix unary_function inheritance assumption. Patch from STL@microsoft.com
llvm-svn: 274205
2016-06-30 04:28:12 +00:00
Eric Fiselier 2bbb125d4e Fix unreferenced parameter warning. Patch from STL@microsoft.com
llvm-svn: 274204
2016-06-30 04:22:58 +00:00
Eric Fiselier 2afa66e124 Avoid applying unary minus to unsigned integers. Patch from STL@microsoft.com
llvm-svn: 274203
2016-06-30 04:21:52 +00:00
Akira Hatanaka 2556b769ec [libcxx] Fix a bug in strstreambuf::overflow.
The end pointer should point to one past the end of the newly allocated
buffer.

rdar://problem/24265174

Differential Revision: http://reviews.llvm.org/D20334

llvm-svn: 274132
2016-06-29 15:26:13 +00:00
Marshall Clow 91bd7dda3a Use WG21.link reflector to get to issues, rather than linking directly
llvm-svn: 274018
2016-06-28 14:13:28 +00:00
Marshall Clow baf27df0bf Updated C++1Z status page with new work from Oulu WG21 meeting
llvm-svn: 274016
2016-06-28 14:11:54 +00:00
Marshall Clow 3044c34c45 Fix bad link for P0006
llvm-svn: 273861
2016-06-27 11:14:34 +00:00
Eric Fiselier e3c72c1c85 Fix UB in uses_alloc_types.hpp
llvm-svn: 273840
2016-06-27 01:52:14 +00:00
Eric Fiselier 68436a9b48 Implement P0163r0. Add shared_ptr::weak_type.
This patch adds the weak_type typedef in shared_ptr. It is available in
C++17 and newer.

This patch also updates the _LIBCPP_STD_VER and TEST_STD_VER macros to
have the value of 16, since 2016 is the current year.

llvm-svn: 273839
2016-06-27 01:02:43 +00:00
Eric Fiselier 8b7faa6871 Implement p0337r0. Delete operator= for polymorphic_allocator.
llvm-svn: 273838
2016-06-27 00:55:25 +00:00
Eric Fiselier 9372d8bc61 Implement P0358r1. Fixes for not_fn.
llvm-svn: 273837
2016-06-27 00:40:41 +00:00
Eric Fiselier 06e9017d7b Fix C++03 failure in enable_shared_from_this test
llvm-svn: 273836
2016-06-27 00:38:28 +00:00