From owner-svn-src-vendor@freebsd.org  Wed Jun 27 19:14:58 2018
Return-Path: <owner-svn-src-vendor@freebsd.org>
Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3489D1003085;
 Wed, 27 Jun 2018 19:14:58 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 5876C8DE8F;
 Wed, 27 Jun 2018 19:14:56 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 01604272FF;
 Wed, 27 Jun 2018 19:14:56 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5RJEt6I043145;
 Wed, 27 Jun 2018 19:14:55 GMT (envelope-from dim@FreeBSD.org)
Received: (from dim@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5RJEtSk043140;
 Wed, 27 Jun 2018 19:14:55 GMT (envelope-from dim@FreeBSD.org)
Message-Id: <201806271914.w5RJEtSk043140@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org
 using -f
From: Dimitry Andric <dim@FreeBSD.org>
Date: Wed, 27 Jun 2018 19:14:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-vendor@freebsd.org
Subject: svn commit: r335726 - in vendor/libc++/dist-release_60: include
 src/support/runtime test/libcxx/debug/containers
 test/std/language.support/support.exception/uncaught
X-SVN-Group: vendor
X-SVN-Commit-Author: dim
X-SVN-Commit-Paths: in vendor/libc++/dist-release_60: include
 src/support/runtime test/libcxx/debug/containers
 test/std/language.support/support.exception/uncaught
X-SVN-Commit-Revision: 335726
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-vendor@freebsd.org
X-Mailman-Version: 2.1.26
Precedence: list
List-Id: SVN commit messages for the vendor work area tree
 <svn-src-vendor.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-vendor>, 
 <mailto:svn-src-vendor-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-vendor/>
List-Post: <mailto:svn-src-vendor@freebsd.org>
List-Help: <mailto:svn-src-vendor-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-vendor>,
 <mailto:svn-src-vendor-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 27 Jun 2018 19:14:58 -0000

Author: dim
Date: Wed Jun 27 19:14:54 2018
New Revision: 335726
URL: https://svnweb.freebsd.org/changeset/base/335726

Log:
  Vendor import of libc++ 6.0.1 release r335540:
  https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_601/final@335540

Modified:
  vendor/libc++/dist-release_60/include/list
  vendor/libc++/dist-release_60/src/support/runtime/exception_libcxxabi.ipp
  vendor/libc++/dist-release_60/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp
  vendor/libc++/dist-release_60/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp

Modified: vendor/libc++/dist-release_60/include/list
==============================================================================
--- vendor/libc++/dist-release_60/include/list	Wed Jun 27 19:14:48 2018	(r335725)
+++ vendor/libc++/dist-release_60/include/list	Wed Jun 27 19:14:54 2018	(r335726)
@@ -2058,15 +2058,15 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __
 #endif
     if (__f != __l)
     {
+        __link_pointer __first = __f.__ptr_;
+        --__l;
+        __link_pointer __last = __l.__ptr_;
         if (this != &__c)
         {
-            size_type __s = _VSTD::distance(__f, __l);
+            size_type __s = _VSTD::distance(__f, __l) + 1;
             __c.__sz() -= __s;
             base::__sz() += __s;
         }
-        __link_pointer __first = __f.__ptr_;
-        --__l;
-        __link_pointer __last = __l.__ptr_;
         base::__unlink_nodes(__first, __last);
         __link_nodes(__p.__ptr_, __first, __last);
 #if _LIBCPP_DEBUG_LEVEL >= 2

Modified: vendor/libc++/dist-release_60/src/support/runtime/exception_libcxxabi.ipp
==============================================================================
--- vendor/libc++/dist-release_60/src/support/runtime/exception_libcxxabi.ipp	Wed Jun 27 19:14:48 2018	(r335725)
+++ vendor/libc++/dist-release_60/src/support/runtime/exception_libcxxabi.ipp	Wed Jun 27 19:14:54 2018	(r335726)
@@ -18,7 +18,7 @@ bool uncaught_exception() _NOEXCEPT { return uncaught_
 
 int uncaught_exceptions() _NOEXCEPT
 {
-# if _LIBCPPABI_VERSION > 1101
+# if _LIBCPPABI_VERSION > 1001
     return __cxa_uncaught_exceptions();
 # else
     return __cxa_uncaught_exception() ? 1 : 0;

Modified: vendor/libc++/dist-release_60/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp
==============================================================================
--- vendor/libc++/dist-release_60/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp	Wed Jun 27 19:14:48 2018	(r335725)
+++ vendor/libc++/dist-release_60/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp	Wed Jun 27 19:14:54 2018	(r335726)
@@ -42,6 +42,7 @@ struct SequenceContainerChecks : BasicContainerChecks<
     Base::run();
     try {
       FrontOnEmptyContainer();
+
       if constexpr (CT != CT_ForwardList) {
         AssignInvalidates();
         BackOnEmptyContainer();
@@ -50,6 +51,8 @@ struct SequenceContainerChecks : BasicContainerChecks<
         InsertIterIterIter();
         EmplaceIterValue();
         EraseIterIter();
+      } else {
+        SpliceFirstElemAfter();
       }
       if constexpr (CT == CT_Vector || CT == CT_Deque || CT == CT_List) {
         PopBack();
@@ -57,12 +60,66 @@ struct SequenceContainerChecks : BasicContainerChecks<
       if constexpr (CT == CT_List || CT == CT_Deque) {
         PopFront(); // FIXME: Run with forward list as well
       }
+      if constexpr (CT == CT_List || CT == CT_ForwardList) {
+        RemoveFirstElem();
+      }
+      if constexpr (CT == CT_List) {
+        SpliceFirstElem();
+      }
     } catch (...) {
       assert(false && "uncaught debug exception");
     }
   }
 
 private:
+  static void RemoveFirstElem() {
+    // See llvm.org/PR35564
+    CHECKPOINT("remove(<first-elem>)");
+    {
+      Container C = makeContainer(1);
+      auto FirstVal = *(C.begin());
+      C.remove(FirstVal);
+      assert(C.empty());
+    }
+    {
+      Container C = {1, 1, 1, 1};
+      auto FirstVal = *(C.begin());
+      C.remove(FirstVal);
+      assert(C.empty());
+    }
+  }
+
+  static void SpliceFirstElem() {
+    // See llvm.org/PR35564
+    CHECKPOINT("splice(<first-elem>)");
+    {
+      Container C = makeContainer(1);
+      Container C2;
+      C2.splice(C2.end(), C, C.begin(), ++C.begin());
+    }
+    {
+      Container C = makeContainer(1);
+      Container C2;
+      C2.splice(C2.end(), C, C.begin());
+    }
+  }
+
+
+  static void SpliceFirstElemAfter() {
+    // See llvm.org/PR35564
+    CHECKPOINT("splice(<first-elem>)");
+    {
+      Container C = makeContainer(1);
+      Container C2;
+      C2.splice_after(C2.begin(), C, C.begin(), ++C.begin());
+    }
+    {
+      Container C = makeContainer(1);
+      Container C2;
+      C2.splice_after(C2.begin(), C, C.begin());
+    }
+  }
+
   static void AssignInvalidates() {
     CHECKPOINT("assign(Size, Value)");
     Container C(allocator_type{});

Modified: vendor/libc++/dist-release_60/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
==============================================================================
--- vendor/libc++/dist-release_60/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp	Wed Jun 27 19:14:48 2018	(r335725)
+++ vendor/libc++/dist-release_60/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp	Wed Jun 27 19:14:54 2018	(r335726)
@@ -15,40 +15,48 @@
 // XFAIL: availability=macosx10.9
 // XFAIL: availability=macosx10.10
 // XFAIL: availability=macosx10.11
+// XFAIL: with_system_cxx_lib=macosx10.12
+// XFAIL: with_system_cxx_lib=macosx10.13
 
 // test uncaught_exceptions
 
 #include <exception>
 #include <cassert>
 
-struct A
-{
-    ~A()
-    {
-        assert(std::uncaught_exceptions() > 0);
-    }
-};
+struct Uncaught {
+    Uncaught(int depth) : d_(depth) {}
+    ~Uncaught() { assert(std::uncaught_exceptions() == d_); }
+    int d_;
+    };
 
-struct B
-{
-    B()
-    {
-        // http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#475
-        assert(std::uncaught_exceptions() == 0);
+struct Outer {
+    Outer(int depth) : d_(depth) {}
+    ~Outer() {
+    try {
+        assert(std::uncaught_exceptions() == d_);
+        Uncaught u(d_+1);
+        throw 2;
     }
+    catch (int) {}
+    }
+    int d_;
 };
 
-int main()
-{
-    try
+int main () {
+    assert(std::uncaught_exceptions() == 0);
     {
-        A a;
-        assert(std::uncaught_exceptions() == 0);
-        throw B();
+    Outer o(0);
     }
-    catch (...)
+    
+    assert(std::uncaught_exceptions() == 0);
     {
-        assert(std::uncaught_exception() == 0);
+    try {
+        Outer o(1);
+        throw 1;
+        }
+    catch (int) {
+        assert(std::uncaught_exceptions() == 0);
+        }   
     }
     assert(std::uncaught_exceptions() == 0);
 }