diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -107,6 +107,8 @@ # define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI // Enable clang::trivial_abi on std::shared_ptr and std::weak_ptr # define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI +// Remove vector base class +# define _LIBCPP_ABI_NO_VECTOR_BASE_CLASS #elif _LIBCPP_ABI_VERSION == 1 # if !defined(_LIBCPP_OBJECT_FORMAT_COFF) // Enable compiling copies of now inline methods into the dylib to support diff --git a/libcxx/include/vector b/libcxx/include/vector --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -346,8 +346,10 @@ template */> class _LIBCPP_TEMPLATE_VIS vector +#ifndef _LIBCPP_ABI_NO_VECTOR_BASE_CLASS // This base class is historical, but it needs to remain for ABI compatibility. : private __vector_base<_Tp, _Allocator> +#endif { private: typedef __vector_base<_Tp, _Allocator> __base; @@ -382,7 +384,11 @@ #else _NOEXCEPT #endif +#ifdef _LIBCPP_ABI_NO_VECTOR_BASE_CLASS + : __end_cap_(nullptr, __a) +#else : __base(__a) +#endif { _VSTD::__debug_db_insert_c(this); } @@ -394,7 +400,11 @@ template ::value> > vector(size_type __n, const value_type& __x, const allocator_type& __a) +#ifdef _LIBCPP_ABI_NO_VECTOR_BASE_CLASS + : __end_cap_(nullptr, __a) +#else : __base(__a) +#endif { _VSTD::__debug_db_insert_c(this); if (__n > 0) @@ -691,6 +701,13 @@ #endif // _LIBCPP_DEBUG_LEVEL == 2 private: +#ifdef _LIBCPP_ABI_NO_VECTOR_BASE_CLASS + pointer __begin_ = nullptr; + pointer __end_ = nullptr; + __compressed_pair __end_cap_ = + __compressed_pair(nullptr, allocator_type()); +#endif + _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators(); _LIBCPP_INLINE_VISIBILITY void __invalidate_iterators_past(pointer __new_last); void __vallocate(size_type __n); @@ -859,20 +876,12 @@ _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const { -#ifndef _LIBCPP_NO_EXCEPTIONS - __vector_base_common::__throw_length_error(); -#else - _VSTD::abort(); -#endif + _VSTD::__throw_length_error("vector"); } _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { -#ifndef _LIBCPP_NO_EXCEPTIONS - __vector_base_common::__throw_out_of_range(); -#else - _VSTD::abort(); -#endif + _VSTD::__throw_out_of_range("vector"); } _LIBCPP_INLINE_VISIBILITY @@ -1106,7 +1115,11 @@ #if _LIBCPP_STD_VER > 11 template vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a) +#ifdef _LIBCPP_ABI_NO_VECTOR_BASE_CLASS + : __end_cap_(nullptr, __a) +#else : __base(__a) +#endif { _VSTD::__debug_db_insert_c(this); if (__n > 0) @@ -1151,7 +1164,11 @@ is_constructible< value_type, typename iterator_traits<_InputIterator>::reference>::value>::type*) +#ifdef _LIBCPP_ABI_NO_VECTOR_BASE_CLASS + : __end_cap_(nullptr, __a) +#else : __base(__a) +#endif { _VSTD::__debug_db_insert_c(this); for (; __first != __last; ++__first) @@ -1183,7 +1200,11 @@ is_constructible< value_type, typename iterator_traits<_ForwardIterator>::reference>::value>::type*) +#ifdef _LIBCPP_ABI_NO_VECTOR_BASE_CLASS + : __end_cap_(nullptr, __a) +#else : __base(__a) +#endif { _VSTD::__debug_db_insert_c(this); size_type __n = static_cast(_VSTD::distance(__first, __last)); @@ -1196,7 +1217,11 @@ template vector<_Tp, _Allocator>::vector(const vector& __x) +#ifdef _LIBCPP_ABI_NO_VECTOR_BASE_CLASS + : __end_cap_(nullptr, __alloc_traits::select_on_container_copy_construction(__x.__alloc())) +#else : __base(__alloc_traits::select_on_container_copy_construction(__x.__alloc())) +#endif { _VSTD::__debug_db_insert_c(this); size_type __n = __x.size(); @@ -1209,7 +1234,11 @@ template vector<_Tp, _Allocator>::vector(const vector& __x, const __identity_t& __a) +#ifdef _LIBCPP_ABI_NO_VECTOR_BASE_CLASS + : __end_cap_(nullptr, __a) +#else : __base(__a) +#endif { _VSTD::__debug_db_insert_c(this); size_type __n = __x.size(); @@ -1230,7 +1259,11 @@ #else _NOEXCEPT_(is_nothrow_move_constructible::value) #endif +#ifdef _LIBCPP_ABI_NO_VECTOR_BASE_CLASS + : __end_cap_(nullptr, _VSTD::move(__x.__alloc())) +#else : __base(_VSTD::move(__x.__alloc())) +#endif { _VSTD::__debug_db_insert_c(this); #if _LIBCPP_DEBUG_LEVEL == 2 @@ -1245,7 +1278,11 @@ template inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>::vector(vector&& __x, const __identity_t& __a) +#ifdef _LIBCPP_ABI_NO_VECTOR_BASE_CLASS + : __end_cap_(nullptr, __a) +#else : __base(__a) +#endif { _VSTD::__debug_db_insert_c(this); if (__a == __x.__alloc()) @@ -1280,7 +1317,11 @@ template inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>::vector(initializer_list __il, const allocator_type& __a) +#ifdef _LIBCPP_ABI_NO_VECTOR_BASE_CLASS + : __end_cap_(nullptr, __a) +#else : __base(__a) +#endif { _VSTD::__debug_db_insert_c(this); if (__il.size() > 0)