[libcxx] r341034 - Merging r340823:

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 30 01:19:16 PDT 2018


Author: hans
Date: Thu Aug 30 01:19:15 2018
New Revision: 341034

URL: http://llvm.org/viewvc/llvm-project?rev=341034&view=rev
Log:
Merging r340823:
------------------------------------------------------------------------
r340823 | marshall | 2018-08-28 15:29:30 +0200 (Tue, 28 Aug 2018) | 1 line

Use addressof instead of operator& in make_shared. Fixes PR38729. As a drive-by, make the same change in raw_storage_iterator (twice).
------------------------------------------------------------------------

Modified:
    libcxx/branches/release_70/   (props changed)
    libcxx/branches/release_70/include/memory
    libcxx/branches/release_70/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
    libcxx/branches/release_70/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
    libcxx/branches/release_70/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
    libcxx/branches/release_70/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp

Propchange: libcxx/branches/release_70/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 30 01:19:15 2018
@@ -1,2 +1,2 @@
 /libcxx/branches/apple:136569-137939
-/libcxx/trunk:339431,339675,339697,339702,339741-339743,339794,339804,339816,339874,340406,340544
+/libcxx/trunk:339431,339675,339697,339702,339741-339743,339794,339804,339816,339874,340406,340544,340823

Modified: libcxx/branches/release_70/include/memory
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_70/include/memory?rev=341034&r1=341033&r2=341034&view=diff
==============================================================================
--- libcxx/branches/release_70/include/memory (original)
+++ libcxx/branches/release_70/include/memory Thu Aug 30 01:19:15 2018
@@ -1989,10 +1989,10 @@ public:
     _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 @@ 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: libcxx/branches/release_70/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_70/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp?rev=341034&r1=341033&r2=341034&view=diff
==============================================================================
--- libcxx/branches/release_70/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp (original)
+++ libcxx/branches/release_70/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp Thu Aug 30 01:19:15 2018
@@ -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 @@ public:
     ~A() {--A_constructed; data_ = 0;}
 
     bool operator==(int i) const {return data_ == i;}
+    A* operator& () DELETE_FUNCTION;
 };
 
 int main()

Modified: libcxx/branches/release_70/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_70/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp?rev=341034&r1=341033&r2=341034&view=diff
==============================================================================
--- libcxx/branches/release_70/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp (original)
+++ libcxx/branches/release_70/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp Thu Aug 30 01:19:15 2018
@@ -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 @@ public:
     ~A() {--A_constructed; data_ = 0;}
 
     bool operator==(int i) const {return data_ == i;}
+    A* operator& () DELETE_FUNCTION;
 };
 
 int main()

Modified: libcxx/branches/release_70/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_70/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp?rev=341034&r1=341033&r2=341034&view=diff
==============================================================================
--- libcxx/branches/release_70/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp (original)
+++ libcxx/branches/release_70/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp Thu Aug 30 01:19:15 2018
@@ -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: libcxx/branches/release_70/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_70/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp?rev=341034&r1=341033&r2=341034&view=diff
==============================================================================
--- libcxx/branches/release_70/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp (original)
+++ libcxx/branches/release_70/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp Thu Aug 30 01:19:15 2018
@@ -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 cfe-commits mailing list