aboutsummaryrefslogtreecommitdiff
path: root/system/include/libcxx/memory
diff options
context:
space:
mode:
Diffstat (limited to 'system/include/libcxx/memory')
-rw-r--r--system/include/libcxx/memory146
1 files changed, 49 insertions, 97 deletions
diff --git a/system/include/libcxx/memory b/system/include/libcxx/memory
index ffd0cd0c..bf44837f 100644
--- a/system/include/libcxx/memory
+++ b/system/include/libcxx/memory
@@ -90,7 +90,7 @@ struct allocator_traits
template <class T>
static void destroy(allocator_type& a, T* p);
- static size_type max_size(const allocator_type& a);
+ static size_type max_size(const allocator_type& a); // noexcept in C++14
static allocator_type
select_on_container_copy_construction(const allocator_type& a);
@@ -496,8 +496,8 @@ public:
long use_count() const noexcept;
bool expired() const noexcept;
shared_ptr<T> lock() const noexcept;
- template<class U> bool owner_before(shared_ptr<U> const& b);
- template<class U> bool owner_before(weak_ptr<U> const& b);
+ template<class U> bool owner_before(shared_ptr<U> const& b) const;
+ template<class U> bool owner_before(weak_ptr<U> const& b) const;
};
// weak_ptr specialized algorithms:
@@ -618,60 +618,12 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
_LIBCPP_BEGIN_NAMESPACE_STD
-// addressof
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-_Tp*
-addressof(_Tp& __x) _NOEXCEPT
-{
- return (_Tp*)&reinterpret_cast<const volatile char&>(__x);
-}
-
-#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
-// Objective-C++ Automatic Reference Counting uses qualified pointers
-// that require special addressof() signatures. When
-// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
-// itself is providing these definitions. Otherwise, we provide them.
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-__strong _Tp*
-addressof(__strong _Tp& __x) _NOEXCEPT
-{
- return &__x;
-}
-
-#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-__weak _Tp*
-addressof(__weak _Tp& __x) _NOEXCEPT
-{
- return &__x;
-}
-#endif
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-__autoreleasing _Tp*
-addressof(__autoreleasing _Tp& __x) _NOEXCEPT
-{
- return &__x;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-__unsafe_unretained _Tp*
-addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
-{
- return &__x;
-}
-#endif
+// addressof moved to <__functional_base>
template <class _Tp> class allocator;
template <>
-class _LIBCPP_TYPE_VIS allocator<void>
+class _LIBCPP_TYPE_VIS_ONLY allocator<void>
{
public:
typedef void* pointer;
@@ -682,7 +634,7 @@ public:
};
template <>
-class _LIBCPP_TYPE_VIS allocator<const void>
+class _LIBCPP_TYPE_VIS_ONLY allocator<const void>
{
public:
typedef const void* pointer;
@@ -917,7 +869,7 @@ struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1, _A2>, _Up, false>
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Ptr>
-struct _LIBCPP_TYPE_VIS pointer_traits
+struct _LIBCPP_TYPE_VIS_ONLY pointer_traits
{
typedef _Ptr pointer;
typedef typename __pointer_traits_element_type<pointer>::type element_type;
@@ -940,7 +892,7 @@ public:
};
template <class _Tp>
-struct _LIBCPP_TYPE_VIS pointer_traits<_Tp*>
+struct _LIBCPP_TYPE_VIS_ONLY pointer_traits<_Tp*>
{
typedef _Tp* pointer;
typedef _Tp element_type;
@@ -965,13 +917,13 @@ public:
namespace __has_pointer_type_imp
{
- template <class _Up> static __two test(...);
- template <class _Up> static char test(typename _Up::pointer* = 0);
+ template <class _Up> static __two __test(...);
+ template <class _Up> static char __test(typename _Up::pointer* = 0);
}
template <class _Tp>
struct __has_pointer_type
- : public integral_constant<bool, sizeof(__has_pointer_type_imp::test<_Tp>(0)) == 1>
+ : public integral_constant<bool, sizeof(__has_pointer_type_imp::__test<_Tp>(0)) == 1>
{
};
@@ -1447,7 +1399,7 @@ struct __alloc_traits_difference_type<_Alloc, _Ptr, true>
};
template <class _Alloc>
-struct _LIBCPP_TYPE_VIS allocator_traits
+struct _LIBCPP_TYPE_VIS_ONLY allocator_traits
{
typedef _Alloc allocator_type;
typedef typename allocator_type::value_type value_type;
@@ -1531,7 +1483,7 @@ struct _LIBCPP_TYPE_VIS allocator_traits
{__destroy(__has_destroy<allocator_type, _Tp*>(), __a, __p);}
_LIBCPP_INLINE_VISIBILITY
- static size_type max_size(const allocator_type& __a)
+ static size_type max_size(const allocator_type& __a) _NOEXCEPT
{return __max_size(__has_max_size<const allocator_type>(), __a);}
_LIBCPP_INLINE_VISIBILITY
@@ -1653,7 +1605,7 @@ private:
// allocator
template <class _Tp>
-class _LIBCPP_TYPE_VIS allocator
+class _LIBCPP_TYPE_VIS_ONLY allocator
{
public:
typedef size_t size_type;
@@ -1745,7 +1697,7 @@ public:
};
template <class _Tp>
-class _LIBCPP_TYPE_VIS allocator<const _Tp>
+class _LIBCPP_TYPE_VIS_ONLY allocator<const _Tp>
{
public:
typedef size_t size_type;
@@ -1843,7 +1795,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return false;}
template <class _OutputIterator, class _Tp>
-class _LIBCPP_TYPE_VIS raw_storage_iterator
+class _LIBCPP_TYPE_VIS_ONLY raw_storage_iterator
: public iterator<output_iterator_tag,
_Tp, // purposefully not C++03
ptrdiff_t, // purposefully not C++03
@@ -1896,7 +1848,7 @@ struct auto_ptr_ref
};
template<class _Tp>
-class _LIBCPP_TYPE_VIS auto_ptr
+class _LIBCPP_TYPE_VIS_ONLY auto_ptr
{
private:
_Tp* __ptr_;
@@ -1940,7 +1892,7 @@ public:
};
template <>
-class _LIBCPP_TYPE_VIS auto_ptr<void>
+class _LIBCPP_TYPE_VIS_ONLY auto_ptr<void>
{
public:
typedef void element_type;
@@ -2476,7 +2428,7 @@ struct __same_or_less_cv_qualified<_Ptr1, _Ptr2, true>
// default_delete
template <class _Tp>
-struct _LIBCPP_TYPE_VIS default_delete
+struct _LIBCPP_TYPE_VIS_ONLY default_delete
{
#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT = default;
@@ -2495,7 +2447,7 @@ struct _LIBCPP_TYPE_VIS default_delete
};
template <class _Tp>
-struct _LIBCPP_TYPE_VIS default_delete<_Tp[]>
+struct _LIBCPP_TYPE_VIS_ONLY default_delete<_Tp[]>
{
public:
#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
@@ -2518,7 +2470,7 @@ public:
};
template <class _Tp, class _Dp = default_delete<_Tp> >
-class _LIBCPP_TYPE_VIS unique_ptr
+class _LIBCPP_TYPE_VIS_ONLY unique_ptr
{
public:
typedef _Tp element_type;
@@ -2697,7 +2649,7 @@ public:
};
template <class _Tp, class _Dp>
-class _LIBCPP_TYPE_VIS unique_ptr<_Tp[], _Dp>
+class _LIBCPP_TYPE_VIS_ONLY unique_ptr<_Tp[], _Dp>
{
public:
typedef _Tp element_type;
@@ -3452,7 +3404,7 @@ struct __scalar_hash<_Tp, 4>
};
template<class _Tp>
-struct _LIBCPP_TYPE_VIS hash<_Tp*>
+struct _LIBCPP_TYPE_VIS_ONLY hash<_Tp*>
: public unary_function<_Tp*, size_t>
{
_LIBCPP_INLINE_VISIBILITY
@@ -3469,7 +3421,7 @@ struct _LIBCPP_TYPE_VIS hash<_Tp*>
};
template <class _Tp, class _Dp>
-struct _LIBCPP_TYPE_VIS hash<unique_ptr<_Tp, _Dp> >
+struct _LIBCPP_TYPE_VIS_ONLY hash<unique_ptr<_Tp, _Dp> >
{
typedef unique_ptr<_Tp, _Dp> argument_type;
typedef size_t result_type;
@@ -3642,9 +3594,9 @@ public:
virtual const char* what() const _NOEXCEPT;
};
-template<class _Tp> class _LIBCPP_TYPE_VIS weak_ptr;
+template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY weak_ptr;
-class __shared_count
+class _LIBCPP_TYPE_VIS __shared_count
{
__shared_count(const __shared_count&);
__shared_count& operator=(const __shared_count&);
@@ -3666,7 +3618,7 @@ public:
long use_count() const _NOEXCEPT {return __shared_owners_ + 1;}
};
-class __shared_weak_count
+class _LIBCPP_TYPE_VIS __shared_weak_count
: private __shared_count
{
long __shared_weak_owners_;
@@ -3811,10 +3763,10 @@ __shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
__a.deallocate(this, 1);
}
-template<class _Tp> class _LIBCPP_TYPE_VIS enable_shared_from_this;
+template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY enable_shared_from_this;
template<class _Tp>
-class _LIBCPP_TYPE_VIS shared_ptr
+class _LIBCPP_TYPE_VIS_ONLY shared_ptr
{
public:
typedef _Tp element_type;
@@ -3943,8 +3895,8 @@ public:
<
!is_array<_Yp>::value &&
is_convertible<_Yp*, element_type*>::value,
- shared_ptr&
- >::type
+ shared_ptr
+ >::type&
operator=(auto_ptr<_Yp>&& __r);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Yp>
@@ -4083,8 +4035,8 @@ private:
_LIBCPP_INLINE_VISIBILITY
void __enable_weak_this(const void*) _NOEXCEPT {}
- template <class _Up> friend class _LIBCPP_TYPE_VIS shared_ptr;
- template <class _Up> friend class _LIBCPP_TYPE_VIS weak_ptr;
+ template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY shared_ptr;
+ template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY weak_ptr;
};
template<class _Tp>
@@ -4570,8 +4522,8 @@ typename enable_if
<
!is_array<_Yp>::value &&
is_convertible<_Yp*, _Tp*>::value,
- shared_ptr<_Tp>&
->::type
+ shared_ptr<_Tp>
+>::type&
shared_ptr<_Tp>::operator=(auto_ptr<_Yp>&& __r)
{
shared_ptr(_VSTD::move(__r)).swap(*this);
@@ -4980,7 +4932,7 @@ get_deleter(const shared_ptr<_Tp>& __p) _NOEXCEPT
#endif // _LIBCPP_NO_RTTI
template<class _Tp>
-class _LIBCPP_TYPE_VIS weak_ptr
+class _LIBCPP_TYPE_VIS_ONLY weak_ptr
{
public:
typedef _Tp element_type;
@@ -5055,8 +5007,8 @@ public:
bool owner_before(const weak_ptr<_Up>& __r) const
{return __cntrl_ < __r.__cntrl_;}
- template <class _Up> friend class _LIBCPP_TYPE_VIS weak_ptr;
- template <class _Up> friend class _LIBCPP_TYPE_VIS shared_ptr;
+ template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY weak_ptr;
+ template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY shared_ptr;
};
template<class _Tp>
@@ -5256,7 +5208,7 @@ weak_ptr<_Tp>::lock() const _NOEXCEPT
template <class _Tp> struct owner_less;
template <class _Tp>
-struct _LIBCPP_TYPE_VIS owner_less<shared_ptr<_Tp> >
+struct _LIBCPP_TYPE_VIS_ONLY owner_less<shared_ptr<_Tp> >
: binary_function<shared_ptr<_Tp>, shared_ptr<_Tp>, bool>
{
typedef bool result_type;
@@ -5272,7 +5224,7 @@ struct _LIBCPP_TYPE_VIS owner_less<shared_ptr<_Tp> >
};
template <class _Tp>
-struct _LIBCPP_TYPE_VIS owner_less<weak_ptr<_Tp> >
+struct _LIBCPP_TYPE_VIS_ONLY owner_less<weak_ptr<_Tp> >
: binary_function<weak_ptr<_Tp>, weak_ptr<_Tp>, bool>
{
typedef bool result_type;
@@ -5288,7 +5240,7 @@ struct _LIBCPP_TYPE_VIS owner_less<weak_ptr<_Tp> >
};
template<class _Tp>
-class _LIBCPP_TYPE_VIS enable_shared_from_this
+class _LIBCPP_TYPE_VIS_ONLY enable_shared_from_this
{
mutable weak_ptr<_Tp> __weak_this_;
protected:
@@ -5313,7 +5265,7 @@ public:
};
template <class _Tp>
-struct _LIBCPP_TYPE_VIS hash<shared_ptr<_Tp> >
+struct _LIBCPP_TYPE_VIS_ONLY hash<shared_ptr<_Tp> >
{
typedef shared_ptr<_Tp> argument_type;
typedef size_t result_type;
@@ -5331,7 +5283,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);
#if __has_feature(cxx_atomic)
-class __sp_mut
+class _LIBCPP_TYPE_VIS __sp_mut
{
void* __lx;
public:
@@ -5475,11 +5427,11 @@ struct _LIBCPP_TYPE_VIS pointer_safety
operator int() const {return __v_;}
};
-void declare_reachable(void* __p);
-void declare_no_pointers(char* __p, size_t __n);
-void undeclare_no_pointers(char* __p, size_t __n);
-pointer_safety get_pointer_safety() _NOEXCEPT;
-void* __undeclare_reachable(void* __p);
+_LIBCPP_FUNC_VIS void declare_reachable(void* __p);
+_LIBCPP_FUNC_VIS void declare_no_pointers(char* __p, size_t __n);
+_LIBCPP_FUNC_VIS void undeclare_no_pointers(char* __p, size_t __n);
+_LIBCPP_FUNC_VIS pointer_safety get_pointer_safety() _NOEXCEPT;
+_LIBCPP_FUNC_VIS void* __undeclare_reachable(void* __p);
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
@@ -5489,7 +5441,7 @@ undeclare_reachable(_Tp* __p)
return static_cast<_Tp*>(__undeclare_reachable(__p));
}
-void* align(size_t __align, size_t __sz, void*& __ptr, size_t& __space);
+_LIBCPP_FUNC_VIS void* align(size_t __align, size_t __sz, void*& __ptr, size_t& __space);
_LIBCPP_END_NAMESPACE_STD