summaryrefslogtreecommitdiffstats
path: root/contrib/libc++/include
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2017-12-26 14:44:02 +0000
committerLuiz Souza <luiz@netgate.com>2018-02-21 15:19:36 -0300
commitec9fc666d7930ca3c4404c65f66b1058774bc764 (patch)
treee7414581cd9c06d4b7c7049b30f8b58a91d5da15 /contrib/libc++/include
parentccc29696d4051a58a5fc07d4aef5be6a99d2bff6 (diff)
downloadFreeBSD-src-ec9fc666d7930ca3c4404c65f66b1058774bc764.zip
FreeBSD-src-ec9fc666d7930ca3c4404c65f66b1058774bc764.tar.gz
MFC r326496:
Upgrade our copies of clang, llvm, lldb and libc++ to r319231 from the upstream release_50 branch. This corresponds to 5.0.1 rc2. MFC r326831: Pull in r315334 from upstream lld trunk (by Rafael Espindola): Don't create a dummy __tls_get_addr. We just don't need one with the current setup. We only error on undefined references that are used by some relocation. If we managed to relax all uses of __tls_get_addr, no relocation uses it and we don't produce an error. This is less code and fixes the case were we fail to relax. Before we would produce a broken output, but now we produce an error. Pull in r320390 from upstream lld trunk (by Rafael Espindola): Create reserved symbols early so they can be versioned. This fixes pr35570. We were creating these symbols after parsing version scripts, so they could not be versioned. We cannot move the version script parsing later because we need it for lto. One option is to move both addReservedSymbols and createSyntheticSections earlier. The disadvantage is that some sections created by createSyntheticSections replace other input sections. For example, gdb index replaces .debug_gnu_pubnames, so it wants to run after gc sections so that it can set S->Live to false. What this patch does instead is to move just the ElfHeader creation early. Pull in r320412 from upstream lld trunk (by Rafael Espindola): Handle symbols pointing to output sections. Now that gc sections runs after linker defined symbols are added it can see symbols that point to an OutputSection. Should fix a bot failure. Pull in r320431 from upstream lld trunk (by Peter Collingbourne): ELF: Do not follow relocation edges to output sections during GC. This fixes an assertion error introduced by r320390. Differential Revision: https://reviews.llvm.org/D41095 Together these fix handling of reserved symbols, in particular _end, which is needed to make brk(2) and sbrk(2) work correctly. This unbreaks the emacs ports on amd64, and also appears to unbreak most of world on i386. Differential Revision: https://reviews.freebsd.org/D13466 MFC r326879 (by emaste): lld: Simplify a boolean expression by De Morgan's laws. Cherry-pick lld r315653 by Rui Ueyama: I don't really understand what exactly this expression means, but at least I can mechanically transform it. Obtained from: LLVM r315653 MFC r326897 (by emaste): lld: Slightly simplify code and add comment. Cherry-pick lld r315658 by Rui Ueyama: This is not a mechanical transformation. Even though I believe this patch is correct, I'm not 100% sure if lld with this patch behaves exactly the same way as before on all edge cases. At least all tests still pass. I'm submitting this patch because it took almost a day to understand this function, and I don't want to lose it. This fixes jemalloc assertion failures observed at startup with i386 binaries and an lld-linked libc.so. Reviewed by: dim Obtained from: LLVM r315658 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D13503 MFC r326909: Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to 5.0.1 release (upstream r320880). Relnotes: yes MFC r326957 (by emaste): lld: Don't write preemptible symbol values to the .got. It is not necessary and matches what bfd and gold do. This was a regression from [LLVM] r315658. Obtained from: LLVM r321023 by Rafael EspĂ­ndola (cherry picked from commit 1bc68d01849a9c2d056c4cab94b4097bd14c313c)
Diffstat (limited to 'contrib/libc++/include')
-rw-r--r--contrib/libc++/include/algorithm5
-rw-r--r--contrib/libc++/include/deque5
-rw-r--r--contrib/libc++/include/functional36
-rw-r--r--contrib/libc++/include/list13
-rw-r--r--contrib/libc++/include/string12
-rw-r--r--contrib/libc++/include/type_traits7
-rw-r--r--contrib/libc++/include/vector17
7 files changed, 56 insertions, 39 deletions
diff --git a/contrib/libc++/include/algorithm b/contrib/libc++/include/algorithm
index 4542275..00db6d7 100644
--- a/contrib/libc++/include/algorithm
+++ b/contrib/libc++/include/algorithm
@@ -3013,6 +3013,7 @@ template<class _Engine, class _UIntType>
_UIntType
__independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
{
+ const size_t _WRt = numeric_limits<result_type>::digits;
result_type _Sp = 0;
for (size_t __k = 0; __k < __n0_; ++__k)
{
@@ -3021,7 +3022,7 @@ __independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
{
__u = __e_() - _Engine::min();
} while (__u >= __y0_);
- if (__w0_ < _WDt)
+ if (__w0_ < _WRt)
_Sp <<= __w0_;
else
_Sp = 0;
@@ -3034,7 +3035,7 @@ __independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
{
__u = __e_() - _Engine::min();
} while (__u >= __y1_);
- if (__w0_ < _WDt - 1)
+ if (__w0_ < _WRt - 1)
_Sp <<= __w0_ + 1;
else
_Sp = 0;
diff --git a/contrib/libc++/include/deque b/contrib/libc++/include/deque
index f795b48..fee7561 100644
--- a/contrib/libc++/include/deque
+++ b/contrib/libc++/include/deque
@@ -1356,7 +1356,6 @@ public:
iterator insert(const_iterator __p, initializer_list<value_type> __il)
{return insert(__p, __il.begin(), __il.end());}
#endif // _LIBCPP_CXX03_LANG
-
iterator insert(const_iterator __p, const value_type& __v);
iterator insert(const_iterator __p, size_type __n, const value_type& __v);
template <class _InputIter>
@@ -2224,7 +2223,11 @@ deque<_Tp, _Allocator>::__append(_InpIter __f, _InpIter __l,
!__is_forward_iterator<_InpIter>::value>::type*)
{
for (; __f != __l; ++__f)
+#ifdef _LIBCPP_CXX03_LANG
push_back(*__f);
+#else
+ emplace_back(*__f);
+#endif
}
template <class _Tp, class _Allocator>
diff --git a/contrib/libc++/include/functional b/contrib/libc++/include/functional
index 83a2e5a..f73c3ca 100644
--- a/contrib/libc++/include/functional
+++ b/contrib/libc++/include/functional
@@ -1597,9 +1597,11 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
return reinterpret_cast<__base*>(p);
}
- template <class _Fp, bool = !is_same<_Fp, function>::value &&
- __invokable<_Fp&, _ArgTypes...>::value>
- struct __callable;
+ template <class _Fp, bool = __lazy_and<
+ integral_constant<bool, !is_same<__uncvref_t<_Fp>, function>::value>,
+ __invokable<_Fp&, _ArgTypes...>
+ >::value>
+ struct __callable;
template <class _Fp>
struct __callable<_Fp, true>
{
@@ -1612,6 +1614,9 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
{
static const bool value = false;
};
+
+ template <class _Fp>
+ using _EnableIfCallable = typename enable_if<__callable<_Fp>::value>::type;
public:
typedef _Rp result_type;
@@ -1622,9 +1627,7 @@ public:
function(nullptr_t) _NOEXCEPT : __f_(0) {}
function(const function&);
function(function&&) _NOEXCEPT;
- template<class _Fp, class = typename enable_if<
- __callable<_Fp>::value && !is_same<_Fp, function>::value
- >::type>
+ template<class _Fp, class = _EnableIfCallable<_Fp>>
function(_Fp);
#if _LIBCPP_STD_VER <= 14
@@ -1638,21 +1641,15 @@ public:
function(allocator_arg_t, const _Alloc&, const function&);
template<class _Alloc>
function(allocator_arg_t, const _Alloc&, function&&);
- template<class _Fp, class _Alloc, class = typename enable_if<__callable<_Fp>::value>::type>
+ template<class _Fp, class _Alloc, class = _EnableIfCallable<_Fp>>
function(allocator_arg_t, const _Alloc& __a, _Fp __f);
#endif
function& operator=(const function&);
function& operator=(function&&) _NOEXCEPT;
function& operator=(nullptr_t) _NOEXCEPT;
- template<class _Fp>
- typename enable_if
- <
- __callable<typename decay<_Fp>::type>::value &&
- !is_same<typename remove_reference<_Fp>::type, function>::value,
- function&
- >::type
- operator=(_Fp&&);
+ template<class _Fp, class = _EnableIfCallable<_Fp>>
+ function& operator=(_Fp&&);
~function();
@@ -1854,13 +1851,8 @@ function<_Rp(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT
}
template<class _Rp, class ..._ArgTypes>
-template <class _Fp>
-typename enable_if
-<
- function<_Rp(_ArgTypes...)>::template __callable<typename decay<_Fp>::type>::value &&
- !is_same<typename remove_reference<_Fp>::type, function<_Rp(_ArgTypes...)>>::value,
- function<_Rp(_ArgTypes...)>&
->::type
+template <class _Fp, class>
+function<_Rp(_ArgTypes...)>&
function<_Rp(_ArgTypes...)>::operator=(_Fp&& __f)
{
function(_VSTD::forward<_Fp>(__f)).swap(*this);
diff --git a/contrib/libc++/include/list b/contrib/libc++/include/list
index 20a66c3..9c70fff 100644
--- a/contrib/libc++/include/list
+++ b/contrib/libc++/include/list
@@ -992,6 +992,15 @@ public:
void push_front(const value_type& __x);
void push_back(const value_type& __x);
+#ifndef _LIBCPP_CXX03_LANG
+ template <class _Arg>
+ _LIBCPP_INLINE_VISIBILITY
+ void __emplace_back(_Arg&& __arg) { emplace_back(_VSTD::forward<_Arg>(__arg)); }
+#else
+ _LIBCPP_INLINE_VISIBILITY
+ void __emplace_back(value_type const& __arg) { push_back(__arg); }
+#endif
+
iterator insert(const_iterator __p, const value_type& __x);
iterator insert(const_iterator __p, size_type __n, const value_type& __x);
template <class _InpIter>
@@ -1189,7 +1198,7 @@ list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l,
__get_db()->__insert_c(this);
#endif
for (; __f != __l; ++__f)
- push_back(*__f);
+ __emplace_back(*__f);
}
template <class _Tp, class _Alloc>
@@ -1202,7 +1211,7 @@ list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a,
__get_db()->__insert_c(this);
#endif
for (; __f != __l; ++__f)
- push_back(*__f);
+ __emplace_back(*__f);
}
template <class _Tp, class _Alloc>
diff --git a/contrib/libc++/include/string b/contrib/libc++/include/string
index 610f19e..7775587 100644
--- a/contrib/libc++/include/string
+++ b/contrib/libc++/include/string
@@ -259,7 +259,7 @@ public:
size_type find(value_type c, size_type pos = 0) const noexcept;
size_type rfind(const basic_string& str, size_type pos = npos) const noexcept;
- size_type ffind(basic_string_view<charT, traits> sv, size_type pos = 0) const noexcept;
+ size_type rfind(basic_string_view<charT, traits> sv, size_type pos = npos) const noexcept;
size_type rfind(const value_type* s, size_type pos, size_type n) const noexcept;
size_type rfind(const value_type* s, size_type pos = npos) const noexcept;
size_type rfind(value_type c, size_type pos = npos) const noexcept;
@@ -271,7 +271,7 @@ public:
size_type find_first_of(value_type c, size_type pos = 0) const noexcept;
size_type find_last_of(const basic_string& str, size_type pos = npos) const noexcept;
- size_type find_last_of(basic_string_view<charT, traits> sv, size_type pos = 0) const noexcept;
+ size_type find_last_of(basic_string_view<charT, traits> sv, size_type pos = npos) const noexcept;
size_type find_last_of(const value_type* s, size_type pos, size_type n) const noexcept;
size_type find_last_of(const value_type* s, size_type pos = npos) const noexcept;
size_type find_last_of(value_type c, size_type pos = npos) const noexcept;
@@ -283,7 +283,7 @@ public:
size_type find_first_not_of(value_type c, size_type pos = 0) const noexcept;
size_type find_last_not_of(const basic_string& str, size_type pos = npos) const noexcept;
- size_type find_last_not_of(basic_string_view<charT, traits> sv, size_type pos = 0) const noexcept;
+ size_type find_last_not_of(basic_string_view<charT, traits> sv, size_type pos = npos) const noexcept;
size_type find_last_not_of(const value_type* s, size_type pos, size_type n) const noexcept;
size_type find_last_not_of(const value_type* s, size_type pos = npos) const noexcept;
size_type find_last_not_of(value_type c, size_type pos = npos) const noexcept;
@@ -1147,7 +1147,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
size_type rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
- size_type rfind(__self_view __sv, size_type __pos = 0) const _NOEXCEPT;
+ size_type rfind(__self_view __sv, size_type __pos = npos) const _NOEXCEPT;
size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
size_type rfind(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
@@ -1166,7 +1166,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
size_type find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
- size_type find_last_of(__self_view __sv, size_type __pos = 0) const _NOEXCEPT;
+ size_type find_last_of(__self_view __sv, size_type __pos = npos) const _NOEXCEPT;
size_type find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
@@ -1186,7 +1186,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
- size_type find_last_not_of(__self_view __sv, size_type __pos = 0) const _NOEXCEPT;
+ size_type find_last_not_of(__self_view __sv, size_type __pos = npos) const _NOEXCEPT;
size_type find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_not_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
diff --git a/contrib/libc++/include/type_traits b/contrib/libc++/include/type_traits
index 9db4d66..6c111ab 100644
--- a/contrib/libc++/include/type_traits
+++ b/contrib/libc++/include/type_traits
@@ -4339,8 +4339,8 @@ struct __invokable_r
using _Result = decltype(
_VSTD::__invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...));
- static const bool value =
- conditional<
+ using type =
+ typename conditional<
!is_same<_Result, __nat>::value,
typename conditional<
is_void<_Ret>::value,
@@ -4348,7 +4348,8 @@ struct __invokable_r
is_convertible<_Result, _Ret>
>::type,
false_type
- >::type::value;
+ >::type;
+ static const bool value = type::value;
};
template <class _Fp, class ..._Args>
diff --git a/contrib/libc++/include/vector b/contrib/libc++/include/vector
index 6e9920a..b2f8f09 100644
--- a/contrib/libc++/include/vector
+++ b/contrib/libc++/include/vector
@@ -674,6 +674,17 @@ public:
const value_type* data() const _NOEXCEPT
{return _VSTD::__to_raw_pointer(this->__begin_);}
+#ifdef _LIBCPP_CXX03_LANG
+ _LIBCPP_INLINE_VISIBILITY
+ void __emplace_back(const value_type& __x) { push_back(__x); }
+#else
+ template <class _Arg>
+ _LIBCPP_INLINE_VISIBILITY
+ void __emplace_back(_Arg&& __arg) {
+ emplace_back(_VSTD::forward<_Arg>(__arg));
+ }
+#endif
+
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
#ifndef _LIBCPP_CXX03_LANG
@@ -1128,7 +1139,7 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first,
__get_db()->__insert_c(this);
#endif
for (; __first != __last; ++__first)
- push_back(*__first);
+ __emplace_back(*__first);
}
template <class _Tp, class _Allocator>
@@ -1145,7 +1156,7 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, c
__get_db()->__insert_c(this);
#endif
for (; __first != __last; ++__first)
- push_back(*__first);
+ __emplace_back(*__first);
}
template <class _Tp, class _Allocator>
@@ -1365,7 +1376,7 @@ vector<_Tp, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
{
clear();
for (; __first != __last; ++__first)
- push_back(*__first);
+ __emplace_back(*__first);
}
template <class _Tp, class _Allocator>
OpenPOWER on IntegriCloud