[libc++] Make sure calls to std::move are always qualified

This fixes instances of the newly added `-Wunqualified-std-cast-call`.

(Commit 7853371146 removed unqualified `move` from the tests,
but these unqualified `move`s remained undetected in the actual headers.)

Differential Revision: https://reviews.llvm.org/D120509
This commit is contained in:
Corentin Jabot 2022-02-24 19:54:00 -05:00 committed by Arthur O'Dwyer
parent 6aa285eb85
commit 48f8a7c4f2
3 changed files with 24 additions and 24 deletions

View File

@ -126,7 +126,7 @@ public:
__barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF()) __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF())
: __expected(__expected), __base(__construct_barrier_algorithm_base(this->__expected), : __expected(__expected), __base(__construct_barrier_algorithm_base(this->__expected),
&__destroy_barrier_algorithm_base), &__destroy_barrier_algorithm_base),
__expected_adjustment(0), __completion(move(__completion)), __phase(0) __expected_adjustment(0), __completion(std::move(__completion)), __phase(0)
{ {
} }
[[nodiscard]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY [[nodiscard]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
@ -190,7 +190,7 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF()) __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF())
: __expected(__expected), __arrived(__expected), __completion(move(__completion)), __phase(false) : __expected(__expected), __arrived(__expected), __completion(std::move(__completion)), __phase(false)
{ {
} }
[[nodiscard]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY [[nodiscard]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY

View File

@ -1536,21 +1536,21 @@ public:
gslice(size_t __start, const valarray<size_t>& __size, gslice(size_t __start, const valarray<size_t>& __size,
valarray<size_t>&& __stride) valarray<size_t>&& __stride)
: __size_(__size), : __size_(__size),
__stride_(move(__stride)) __stride_(std::move(__stride))
{__init(__start);} {__init(__start);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
gslice(size_t __start, valarray<size_t>&& __size, gslice(size_t __start, valarray<size_t>&& __size,
const valarray<size_t>& __stride) const valarray<size_t>& __stride)
: __size_(move(__size)), : __size_(std::move(__size)),
__stride_(__stride) __stride_(__stride)
{__init(__start);} {__init(__start);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
gslice(size_t __start, valarray<size_t>&& __size, gslice(size_t __start, valarray<size_t>&& __size,
valarray<size_t>&& __stride) valarray<size_t>&& __stride)
: __size_(move(__size)), : __size_(std::move(__size)),
__stride_(move(__stride)) __stride_(std::move(__stride))
{__init(__start);} {__init(__start);}
#endif // _LIBCPP_CXX03_LANG #endif // _LIBCPP_CXX03_LANG
@ -1701,7 +1701,7 @@ private:
#ifndef _LIBCPP_CXX03_LANG #ifndef _LIBCPP_CXX03_LANG
gslice_array(gslice&& __gs, const valarray<value_type>& __v) gslice_array(gslice&& __gs, const valarray<value_type>& __v)
: __vp_(const_cast<value_type*>(__v.__begin_)), : __vp_(const_cast<value_type*>(__v.__begin_)),
__1d_(move(__gs.__1d_)) __1d_(std::move(__gs.__1d_))
{} {}
#endif // _LIBCPP_CXX03_LANG #endif // _LIBCPP_CXX03_LANG
@ -2395,7 +2395,7 @@ private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
indirect_array(valarray<size_t>&& __ia, const valarray<value_type>& __v) indirect_array(valarray<size_t>&& __ia, const valarray<value_type>& __v)
: __vp_(const_cast<value_type*>(__v.__begin_)), : __vp_(const_cast<value_type*>(__v.__begin_)),
__1d_(move(__ia)) __1d_(std::move(__ia))
{} {}
#endif // _LIBCPP_CXX03_LANG #endif // _LIBCPP_CXX03_LANG
@ -2614,7 +2614,7 @@ private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__indirect_expr(valarray<size_t>&& __ia, const _RmExpr& __e) __indirect_expr(valarray<size_t>&& __ia, const _RmExpr& __e)
: __expr_(__e), : __expr_(__e),
__1d_(move(__ia)) __1d_(std::move(__ia))
{} {}
#endif // _LIBCPP_CXX03_LANG #endif // _LIBCPP_CXX03_LANG
@ -3209,7 +3209,7 @@ inline
__val_expr<__indirect_expr<const valarray<_Tp>&> > __val_expr<__indirect_expr<const valarray<_Tp>&> >
valarray<_Tp>::operator[](gslice&& __gs) const valarray<_Tp>::operator[](gslice&& __gs) const
{ {
return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(move(__gs.__1d_), *this)); return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(std::move(__gs.__1d_), *this));
} }
template <class _Tp> template <class _Tp>
@ -3217,7 +3217,7 @@ inline
gslice_array<_Tp> gslice_array<_Tp>
valarray<_Tp>::operator[](gslice&& __gs) valarray<_Tp>::operator[](gslice&& __gs)
{ {
return gslice_array<value_type>(move(__gs), *this); return gslice_array<value_type>(std::move(__gs), *this);
} }
#endif // _LIBCPP_CXX03_LANG #endif // _LIBCPP_CXX03_LANG
@ -3245,7 +3245,7 @@ inline
__val_expr<__mask_expr<const valarray<_Tp>&> > __val_expr<__mask_expr<const valarray<_Tp>&> >
valarray<_Tp>::operator[](valarray<bool>&& __vb) const valarray<_Tp>::operator[](valarray<bool>&& __vb) const
{ {
return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(move(__vb), *this)); return __val_expr<__mask_expr<const valarray&> >(__mask_expr<const valarray&>(std::move(__vb), *this));
} }
template <class _Tp> template <class _Tp>
@ -3253,7 +3253,7 @@ inline
mask_array<_Tp> mask_array<_Tp>
valarray<_Tp>::operator[](valarray<bool>&& __vb) valarray<_Tp>::operator[](valarray<bool>&& __vb)
{ {
return mask_array<value_type>(move(__vb), *this); return mask_array<value_type>(std::move(__vb), *this);
} }
#endif // _LIBCPP_CXX03_LANG #endif // _LIBCPP_CXX03_LANG
@ -3281,7 +3281,7 @@ inline
__val_expr<__indirect_expr<const valarray<_Tp>&> > __val_expr<__indirect_expr<const valarray<_Tp>&> >
valarray<_Tp>::operator[](valarray<size_t>&& __vs) const valarray<_Tp>::operator[](valarray<size_t>&& __vs) const
{ {
return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(move(__vs), *this)); return __val_expr<__indirect_expr<const valarray&> >(__indirect_expr<const valarray&>(std::move(__vs), *this));
} }
template <class _Tp> template <class _Tp>
@ -3289,7 +3289,7 @@ inline
indirect_array<_Tp> indirect_array<_Tp>
valarray<_Tp>::operator[](valarray<size_t>&& __vs) valarray<_Tp>::operator[](valarray<size_t>&& __vs)
{ {
return indirect_array<value_type>(move(__vs), *this); return indirect_array<value_type>(std::move(__vs), *this);
} }
#endif // _LIBCPP_CXX03_LANG #endif // _LIBCPP_CXX03_LANG

View File

@ -25,8 +25,8 @@ public:
__dir_stream& operator=(const __dir_stream&) = delete; __dir_stream& operator=(const __dir_stream&) = delete;
__dir_stream(__dir_stream&& __ds) noexcept : __stream_(__ds.__stream_), __dir_stream(__dir_stream&& __ds) noexcept : __stream_(__ds.__stream_),
__root_(move(__ds.__root_)), __root_(std::move(__ds.__root_)),
__entry_(move(__ds.__entry_)) { __entry_(std::move(__ds.__entry_)) {
__ds.__stream_ = INVALID_HANDLE_VALUE; __ds.__stream_ = INVALID_HANDLE_VALUE;
} }
@ -104,8 +104,8 @@ public:
__dir_stream& operator=(const __dir_stream&) = delete; __dir_stream& operator=(const __dir_stream&) = delete;
__dir_stream(__dir_stream&& other) noexcept : __stream_(other.__stream_), __dir_stream(__dir_stream&& other) noexcept : __stream_(other.__stream_),
__root_(move(other.__root_)), __root_(std::move(other.__root_)),
__entry_(move(other.__entry_)) { __entry_(std::move(other.__entry_)) {
other.__stream_ = nullptr; other.__stream_ = nullptr;
} }
@ -187,7 +187,7 @@ directory_iterator& directory_iterator::__increment(error_code* ec) {
error_code m_ec; error_code m_ec;
if (!__imp_->advance(m_ec)) { if (!__imp_->advance(m_ec)) {
path root = move(__imp_->__root_); path root = std::move(__imp_->__root_);
__imp_.reset(); __imp_.reset();
if (m_ec) if (m_ec)
err.report(m_ec, "at root " PATH_CSTR_FMT, root.c_str()); err.report(m_ec, "at root " PATH_CSTR_FMT, root.c_str());
@ -221,7 +221,7 @@ recursive_directory_iterator::recursive_directory_iterator(
__imp_ = make_shared<__shared_imp>(); __imp_ = make_shared<__shared_imp>();
__imp_->__options_ = opt; __imp_->__options_ = opt;
__imp_->__stack_.push(move(new_s)); __imp_->__stack_.push(std::move(new_s));
} }
void recursive_directory_iterator::__pop(error_code* ec) { void recursive_directory_iterator::__pop(error_code* ec) {
@ -275,7 +275,7 @@ void recursive_directory_iterator::__advance(error_code* ec) {
} }
if (m_ec) { if (m_ec) {
path root = move(stack.top().__root_); path root = std::move(stack.top().__root_);
__imp_.reset(); __imp_.reset();
err.report(m_ec, "at root " PATH_CSTR_FMT, root.c_str()); err.report(m_ec, "at root " PATH_CSTR_FMT, root.c_str());
} else { } else {
@ -309,7 +309,7 @@ bool recursive_directory_iterator::__try_recursion(error_code* ec) {
if (!skip_rec) { if (!skip_rec) {
__dir_stream new_it(curr_it.__entry_.path(), __imp_->__options_, m_ec); __dir_stream new_it(curr_it.__entry_.path(), __imp_->__options_, m_ec);
if (new_it.good()) { if (new_it.good()) {
__imp_->__stack_.push(move(new_it)); __imp_->__stack_.push(std::move(new_it));
return true; return true;
} }
} }
@ -320,7 +320,7 @@ bool recursive_directory_iterator::__try_recursion(error_code* ec) {
if (ec) if (ec)
ec->clear(); ec->clear();
} else { } else {
path at_ent = move(curr_it.__entry_.__p_); path at_ent = std::move(curr_it.__entry_.__p_);
__imp_.reset(); __imp_.reset();
err.report(m_ec, "attempting recursion into " PATH_CSTR_FMT, err.report(m_ec, "attempting recursion into " PATH_CSTR_FMT,
at_ent.c_str()); at_ent.c_str());