[libcxx] r300148 - Fix most failures caused by r300140

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 12 17:34:24 PDT 2017


Author: ericwf
Date: Wed Apr 12 19:34:24 2017
New Revision: 300148

URL: http://llvm.org/viewvc/llvm-project?rev=300148&view=rev
Log:
Fix most failures caused by r300140

r300140 introduced a bunch of failures by changing the internal
interface provided by __compressed_pair. This patch fixes all of
the failures caused by the new interface by changing the existing
code to use it.

In addition to those changes this patch also fixes two separate
issues causing test failures:

1) Fix the member swap definition for __map_value_compare. Previously
   the swap was incorrectly configured to swap the comparator as const.

2) Fix an assertion failure in futures.task.members/ctor_func_alloc.pass.cpp
that incorrectly expected a move to take place when a single copy is sufficient.

There is one remaining failure regarding make_shared. I'll commit a fix for that
shortly.

Modified:
    libcxx/trunk/include/__split_buffer
    libcxx/trunk/include/__tree
    libcxx/trunk/include/map
    libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp

Modified: libcxx/trunk/include/__split_buffer
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__split_buffer?rev=300148&r1=300147&r2=300148&view=diff
==============================================================================
--- libcxx/trunk/include/__split_buffer (original)
+++ libcxx/trunk/include/__split_buffer Wed Apr 12 19:34:24 2017
@@ -361,7 +361,7 @@ __split_buffer<_Tp, _Allocator>::__split
 
 template <class _Tp, class _Allocator>
 __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
-    : __end_cap_(__a)
+    : __end_cap_(__second_tag(), __a)
 {
     if (__a == __c.__alloc())
     {

Modified: libcxx/trunk/include/__tree
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__tree?rev=300148&r1=300147&r2=300148&view=diff
==============================================================================
--- libcxx/trunk/include/__tree (original)
+++ libcxx/trunk/include/__tree Wed Apr 12 19:34:24 2017
@@ -1502,7 +1502,7 @@ __tree<_Tp, _Compare, _Allocator>::__tre
 template <class _Tp, class _Compare, class _Allocator>
 __tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
     : __begin_node_(__iter_pointer()),
-      __pair1_(__node_allocator(__a)),
+      __pair1_(__second_tag(), __node_allocator(__a)),
       __pair3_(0)
 {
     __begin_node() = __end_node();
@@ -1512,7 +1512,7 @@ template <class _Tp, class _Compare, cla
 __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
                                            const allocator_type& __a)
     : __begin_node_(__iter_pointer()),
-      __pair1_(__node_allocator(__a)),
+      __pair1_(__second_tag(), __node_allocator(__a)),
       __pair3_(0, __comp)
 {
     __begin_node() = __end_node();
@@ -1669,7 +1669,7 @@ __tree<_Tp, _Compare, _Allocator>::__ass
 template <class _Tp, class _Compare, class _Allocator>
 __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
     : __begin_node_(__iter_pointer()),
-      __pair1_(__node_traits::select_on_container_copy_construction(__t.__node_alloc())),
+      __pair1_(__second_tag(), __node_traits::select_on_container_copy_construction(__t.__node_alloc())),
       __pair3_(0, __t.value_comp())
 {
     __begin_node() = __end_node();
@@ -1699,7 +1699,7 @@ __tree<_Tp, _Compare, _Allocator>::__tre
 
 template <class _Tp, class _Compare, class _Allocator>
 __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)
-    : __pair1_(__node_allocator(__a)),
+    : __pair1_(__second_tag(), __node_allocator(__a)),
       __pair3_(0, _VSTD::move(__t.value_comp()))
 {
     if (__a == __t.__alloc())

Modified: libcxx/trunk/include/map
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/map?rev=300148&r1=300147&r2=300148&view=diff
==============================================================================
--- libcxx/trunk/include/map (original)
+++ libcxx/trunk/include/map Wed Apr 12 19:34:24 2017
@@ -480,8 +480,8 @@ public:
     void swap(__map_value_compare&__y)
         _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value)
     {
-        using _VSTD::swap;
-        swap(static_cast<const _Compare&>(*this), static_cast<const _Compare&>(__y));
+      using _VSTD::swap;
+      swap(static_cast<_Compare&>(*this), static_cast<_Compare&>(__y));
     }
 
 #if _LIBCPP_STD_VER > 11

Modified: libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp?rev=300148&r1=300147&r2=300148&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp Wed Apr 12 19:34:24 2017
@@ -69,7 +69,7 @@ int main()
         p(3, 'a');
         assert(f.get() == 105.0);
         assert(A::n_copies > 0);
-        assert(A::n_moves > 0);
+        assert(A::n_moves >= 0);
     }
     assert(test_alloc_base::alloc_count == 0);
     A::n_copies = 0;




More information about the cfe-commits mailing list