svn commit: r338581 - in vendor/libc++/dist-release_70: include test/std/re/re.alg/re.alg.match test/std/re/re.alg/re.alg.search test/std/utilities/memory/storage.iterator test/std/utilities/memory...

Dimitry Andric dim at FreeBSD.org
Tue Sep 11 10:10:16 UTC 2018


Author: dim
Date: Tue Sep 11 10:10:09 2018
New Revision: 338581
URL: https://svnweb.freebsd.org/changeset/base/338581

Log:
  Vendor import of libc++ release_70 branch r341916:
  https://llvm.org/svn/llvm-project/libcxx/branches/release_70@341916

Added:
  vendor/libc++/dist-release_70/test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp   (contents, props changed)
Modified:
  vendor/libc++/dist-release_70/include/memory
  vendor/libc++/dist-release_70/include/regex
  vendor/libc++/dist-release_70/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp
  vendor/libc++/dist-release_70/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
  vendor/libc++/dist-release_70/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
  vendor/libc++/dist-release_70/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
  vendor/libc++/dist-release_70/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp

Modified: vendor/libc++/dist-release_70/include/memory
==============================================================================
--- vendor/libc++/dist-release_70/include/memory	Tue Sep 11 10:10:05 2018	(r338580)
+++ vendor/libc++/dist-release_70/include/memory	Tue Sep 11 10:10:09 2018	(r338581)
@@ -1989,10 +1989,10 @@ class _LIBCPP_TEMPLATE_VIS raw_storage_iterator (publi
     _LIBCPP_INLINE_VISIBILITY explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {}
     _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator*() {return *this;}
     _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(const _Tp& __element)
-        {::new(&*__x_) _Tp(__element); return *this;}
+        {::new(_VSTD::addressof(*__x_)) _Tp(__element); return *this;}
 #if _LIBCPP_STD_VER >= 14
     _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(_Tp&& __element)
-        {::new(&*__x_) _Tp(_VSTD::move(__element)); return *this;}
+        {::new(_VSTD::addressof(*__x_)) _Tp(_VSTD::move(__element)); return *this;}
 #endif
     _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator++() {++__x_; return *this;}
     _LIBCPP_INLINE_VISIBILITY raw_storage_iterator  operator++(int)
@@ -3682,7 +3682,7 @@ class __shared_ptr_emplace (private)
     virtual void __on_zero_shared_weak() _NOEXCEPT;
 public:
     _LIBCPP_INLINE_VISIBILITY
-    _Tp* get() _NOEXCEPT {return &__data_.second();}
+    _Tp* get() _NOEXCEPT {return _VSTD::addressof(__data_.second());}
 };
 
 template <class _Tp, class _Alloc>

Modified: vendor/libc++/dist-release_70/include/regex
==============================================================================
--- vendor/libc++/dist-release_70/include/regex	Tue Sep 11 10:10:05 2018	(r338580)
+++ vendor/libc++/dist-release_70/include/regex	Tue Sep 11 10:10:09 2018	(r338581)
@@ -2414,20 +2414,17 @@ __bracket_expression<_CharT, _Traits>::__exec(__state&
                 goto __exit;
             }
         }
-        // set of "__found" chars =
+        // When there's at least one of __neg_chars_ and __neg_mask_, the set
+        // of "__found" chars is
         //   union(complement(union(__neg_chars_, __neg_mask_)),
         //         other cases...)
         //
-        // __neg_chars_ and __neg_mask_'d better be handled together, as there
-        // are no short circuit opportunities.
-        //
-        // In addition, when __neg_mask_/__neg_chars_ is empty, they should be
-        // treated as all ones/all chars.
+        // It doesn't make sense to check this when there are no __neg_chars_
+        // and no __neg_mask_.
+        if (!(__neg_mask_ == 0 && __neg_chars_.empty()))
         {
-          const bool __in_neg_mask = (__neg_mask_ == 0) ||
-              __traits_.isctype(__ch, __neg_mask_);
+            const bool __in_neg_mask = __traits_.isctype(__ch, __neg_mask_);
           const bool __in_neg_chars =
-              __neg_chars_.empty() ||
               std::find(__neg_chars_.begin(), __neg_chars_.end(), __ch) !=
               __neg_chars_.end();
           if (!(__in_neg_mask || __in_neg_chars))

Added: vendor/libc++/dist-release_70/test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/libc++/dist-release_70/test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp	Tue Sep 11 10:10:09 2018	(r338581)
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+// UNSUPPORTED: c++98, c++03
+
+// Make sure that we correctly match inverted character classes.
+
+#include <cassert>
+#include <regex>
+
+
+int main() {
+    assert(std::regex_match("X", std::regex("[X]")));
+    assert(std::regex_match("X", std::regex("[XY]")));
+    assert(!std::regex_match("X", std::regex("[^X]")));
+    assert(!std::regex_match("X", std::regex("[^XY]")));
+
+    assert(std::regex_match("X", std::regex("[\\S]")));
+    assert(!std::regex_match("X", std::regex("[^\\S]")));
+
+    assert(!std::regex_match("X", std::regex("[\\s]")));
+    assert(std::regex_match("X", std::regex("[^\\s]")));
+
+    assert(std::regex_match("X", std::regex("[\\s\\S]")));
+    assert(std::regex_match("X", std::regex("[^Y\\s]")));
+    assert(!std::regex_match("X", std::regex("[^X\\s]")));
+
+    assert(std::regex_match("X", std::regex("[\\w]")));
+    assert(std::regex_match("_", std::regex("[\\w]")));
+    assert(!std::regex_match("X", std::regex("[^\\w]")));
+    assert(!std::regex_match("_", std::regex("[^\\w]")));
+
+    assert(!std::regex_match("X", std::regex("[\\W]")));
+    assert(!std::regex_match("_", std::regex("[\\W]")));
+    assert(std::regex_match("X", std::regex("[^\\W]")));
+    assert(std::regex_match("_", std::regex("[^\\W]")));
+}

Modified: vendor/libc++/dist-release_70/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp
==============================================================================
--- vendor/libc++/dist-release_70/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp	Tue Sep 11 10:10:05 2018	(r338580)
+++ vendor/libc++/dist-release_70/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp	Tue Sep 11 10:10:09 2018	(r338581)
@@ -18,7 +18,7 @@
 
 #include <regex>
 #include <cassert>
-#include "test_macros.h"
+
 
 // PR34310
 int main()

Modified: vendor/libc++/dist-release_70/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
==============================================================================
--- vendor/libc++/dist-release_70/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp	Tue Sep 11 10:10:05 2018	(r338580)
+++ vendor/libc++/dist-release_70/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp	Tue Sep 11 10:10:09 2018	(r338581)
@@ -15,6 +15,13 @@
 
 #include "test_macros.h"
 
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
+
 int A_constructed = 0;
 
 struct A
@@ -27,6 +34,7 @@ struct A (public)
     ~A() {--A_constructed; data_ = 0;}
 
     bool operator==(int i) const {return data_ == i;}
+    A* operator& () DELETE_FUNCTION;
 };
 
 int main()

Modified: vendor/libc++/dist-release_70/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
==============================================================================
--- vendor/libc++/dist-release_70/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp	Tue Sep 11 10:10:05 2018	(r338580)
+++ vendor/libc++/dist-release_70/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp	Tue Sep 11 10:10:09 2018	(r338581)
@@ -16,6 +16,12 @@
 #include "test_macros.h"
 #include <MoveOnly.h>
 
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
 int A_constructed = 0;
 
 struct A
@@ -28,6 +34,7 @@ struct A (public)
     ~A() {--A_constructed; data_ = 0;}
 
     bool operator==(int i) const {return data_ == i;}
+    A* operator& () DELETE_FUNCTION;
 };
 
 int main()

Modified: vendor/libc++/dist-release_70/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
==============================================================================
--- vendor/libc++/dist-release_70/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp	Tue Sep 11 10:10:05 2018	(r338580)
+++ vendor/libc++/dist-release_70/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp	Tue Sep 11 10:10:09 2018	(r338581)
@@ -23,6 +23,12 @@
 #include "test_allocator.h"
 #include "min_allocator.h"
 
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
 int new_count = 0;
 
 struct A
@@ -37,6 +43,8 @@ struct A
 
     int get_int() const {return int_;}
     char get_char() const {return char_;}
+
+    A* operator& () DELETE_FUNCTION;
 private:
     int int_;
     char char_;

Modified: vendor/libc++/dist-release_70/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
==============================================================================
--- vendor/libc++/dist-release_70/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp	Tue Sep 11 10:10:05 2018	(r338580)
+++ vendor/libc++/dist-release_70/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp	Tue Sep 11 10:10:09 2018	(r338581)
@@ -19,6 +19,12 @@
 #include "test_macros.h"
 #include "count_new.hpp"
 
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
 struct A
 {
     static int count;
@@ -31,6 +37,9 @@ struct A
 
     int get_int() const {return int_;}
     char get_char() const {return char_;}
+
+    A* operator& () DELETE_FUNCTION;
+
 private:
     int int_;
     char char_;


More information about the svn-src-all mailing list