Revert "Update aosp/master libcxx rebase to r263688"

The world is burning.

This reverts commit c004fd909c, reversing
changes made to 1418e4163d.
This commit is contained in:
Dan Albert
2016-05-25 22:36:09 -07:00
parent c004fd909c
commit 1d4a1edbc7
1396 changed files with 11495 additions and 38952 deletions

View File

@@ -543,12 +543,6 @@ template<class T, class Compare>
T
min(initializer_list<T> t, Compare comp); // constexpr in C++14
template<class T>
constexpr const T& clamp( const T& v, const T& lo, const T& hi ); // C++17
template<class T, class Compare>
constexpr const T& clamp( const T& v, const T& lo, const T& hi, Compare comp ); // C++17
template <class ForwardIterator>
ForwardIterator
max_element(ForwardIterator first, ForwardIterator last); // constexpr in C++14
@@ -630,7 +624,7 @@ template <class BidirectionalIterator, class Compare>
#include <initializer_list>
#include <type_traits>
#include <cstring>
#include <utility> // needed to provide swap_ranges.
#include <utility>
#include <memory>
#include <iterator>
#include <cstddef>
@@ -857,7 +851,7 @@ for_each(_InputIterator __first, _InputIterator __last, _Function __f)
{
for (; __first != __last; ++__first)
__f(*__first);
return _LIBCPP_EXPLICIT_MOVE(__f); // explicitly moved for (emulated) C++03
return _VSTD::move(__f); // explicitly moved for (emulated) C++03
}
// find
@@ -1421,20 +1415,20 @@ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
// search
template <class _BinaryPredicate, class _ForwardIterator1, class _ForwardIterator2>
pair<_ForwardIterator1, _ForwardIterator1>
_ForwardIterator1
__search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred,
forward_iterator_tag, forward_iterator_tag)
{
if (__first2 == __last2)
return make_pair(__first1, __first1); // Everything matches an empty sequence
return __first1; // Everything matches an empty sequence
while (true)
{
// Find first element in sequence 1 that matchs *__first2, with a mininum of loop checks
while (true)
{
if (__first1 == __last1) // return __last1 if no element matches *__first2
return make_pair(__last1, __last1);
return __last1;
if (__pred(*__first1, *__first2))
break;
++__first1;
@@ -1445,9 +1439,9 @@ __search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
while (true)
{
if (++__m2 == __last2) // If pattern exhausted, __first1 is the answer (works for 1 element pattern)
return make_pair(__first1, __m1);
return __first1;
if (++__m1 == __last1) // Otherwise if source exhaused, pattern not found
return make_pair(__last1, __last1);
return __last1;
if (!__pred(*__m1, *__m2)) // if there is a mismatch, restart with a new __first1
{
++__first1;
@@ -1458,21 +1452,20 @@ __search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
}
template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
_LIBCPP_CONSTEXPR_AFTER_CXX11
pair<_RandomAccessIterator1, _RandomAccessIterator1>
_LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator1
__search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
_RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred,
_RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred,
random_access_iterator_tag, random_access_iterator_tag)
{
typedef typename iterator_traits<_RandomAccessIterator1>::difference_type _D1;
typedef typename iterator_traits<_RandomAccessIterator2>::difference_type _D2;
typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type _D1;
typedef typename std::iterator_traits<_RandomAccessIterator2>::difference_type _D2;
// Take advantage of knowing source and pattern lengths. Stop short when source is smaller than pattern
const _D2 __len2 = __last2 - __first2;
_D2 __len2 = __last2 - __first2;
if (__len2 == 0)
return make_pair(__first1, __first1);
const _D1 __len1 = __last1 - __first1;
return __first1;
_D1 __len1 = __last1 - __first1;
if (__len1 < __len2)
return make_pair(__last1, __last1);
return __last1;
const _RandomAccessIterator1 __s = __last1 - (__len2 - 1); // Start of pattern match can't go beyond here
while (true)
{
@@ -1480,7 +1473,7 @@ __search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
while (true)
{
if (__first1 == __s)
return make_pair(__last1, __last1);
return __last1;
if (__pred(*__first1, *__first2))
break;
++__first1;
@@ -1512,7 +1505,7 @@ __search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
if (__pred(*__first1, *__first2))
break;
case 0:
return make_pair(__last1, __last1);
return __last1;
}
__phase2:
#endif // !_LIBCPP_UNROLL_LOOPS
@@ -1522,7 +1515,7 @@ __search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
while (true)
{
if (++__m2 == __last2)
return make_pair(__first1, __first1 + __len2);
return __first1;
++__m1; // no need to check range on __m1 because __s guarantees we have enough source
if (!__pred(*__m1, *__m2))
{
@@ -1562,7 +1555,7 @@ __search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
if (!__pred(*__m1, *__m2))
break;
case 0:
return make_pair(__first1, __first1 + __len2);
return __first1;
}
__continue:
++__first1;
@@ -1578,9 +1571,8 @@ search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
{
return _VSTD::__search<typename add_lvalue_reference<_BinaryPredicate>::type>
(__first1, __last1, __first2, __last2, __pred,
typename iterator_traits<_ForwardIterator1>::iterator_category(),
typename iterator_traits<_ForwardIterator2>::iterator_category())
.first;
typename std::iterator_traits<_ForwardIterator1>::iterator_category(),
typename std::iterator_traits<_ForwardIterator2>::iterator_category());
}
template <class _ForwardIterator1, class _ForwardIterator2>
@@ -1589,8 +1581,8 @@ _ForwardIterator1
search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2)
{
typedef typename iterator_traits<_ForwardIterator1>::value_type __v1;
typedef typename iterator_traits<_ForwardIterator2>::value_type __v2;
typedef typename std::iterator_traits<_ForwardIterator1>::value_type __v1;
typedef typename std::iterator_traits<_ForwardIterator2>::value_type __v2;
return _VSTD::search(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>());
}
@@ -1695,6 +1687,25 @@ search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const
}
// copy
template <class _Iter>
struct __libcpp_is_trivial_iterator
{
static const bool value = is_pointer<_Iter>::value;
};
template <class _Iter>
struct __libcpp_is_trivial_iterator<move_iterator<_Iter> >
{
static const bool value = is_pointer<_Iter>::value;
};
template <class _Iter>
struct __libcpp_is_trivial_iterator<__wrap_iter<_Iter> >
{
static const bool value = is_pointer<_Iter>::value;
};
template <class _Iter>
inline _LIBCPP_INLINE_VISIBILITY
_Iter
@@ -2319,7 +2330,7 @@ __reverse(_BidirectionalIterator __first, _BidirectionalIterator __last, bidirec
{
if (__first == --__last)
break;
_VSTD::iter_swap(__first, __last);
swap(*__first, *__last);
++__first;
}
}
@@ -2331,7 +2342,7 @@ __reverse(_RandomAccessIterator __first, _RandomAccessIterator __last, random_ac
{
if (__first != __last)
for (; __first < --__last; ++__first)
_VSTD::iter_swap(__first, __last);
swap(*__first, *__last);
}
template <class _BidirectionalIterator>
@@ -2665,27 +2676,6 @@ max(initializer_list<_Tp> __t)
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#if _LIBCPP_STD_VER > 14
// clamp
template<class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
const _Tp&
clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi, _Compare __comp)
{
_LIBCPP_ASSERT(!__comp(__hi, __lo), "Bad bounds passed to std::clamp");
return __comp(__v, __lo) ? __lo : __comp(__hi, __v) ? __hi : __v;
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
const _Tp&
clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi)
{
return _VSTD::clamp(__v, __lo, __hi, __less<_Tp>());
}
#endif
// minmax_element
template <class _ForwardIterator, class _Compare>
@@ -5754,6 +5744,34 @@ prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last)
__less<typename iterator_traits<_BidirectionalIterator>::value_type>());
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_integral<_Tp>::value,
_Tp
>::type
__rotate_left(_Tp __t, _Tp __n = 1)
{
const unsigned __bits = static_cast<unsigned>(sizeof(_Tp) * __CHAR_BIT__ - 1);
__n &= __bits;
return static_cast<_Tp>((__t << __n) | (static_cast<typename make_unsigned<_Tp>::type>(__t) >> (__bits - __n)));
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_integral<_Tp>::value,
_Tp
>::type
__rotate_right(_Tp __t, _Tp __n = 1)
{
const unsigned __bits = static_cast<unsigned>(sizeof(_Tp) * __CHAR_BIT__ - 1);
__n &= __bits;
return static_cast<_Tp>((__t << (__bits - __n)) | (static_cast<typename make_unsigned<_Tp>::type>(__t) >> __n));
}
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_ALGORITHM