[libcxx-commits] [libcxx] 48f8a7c - [libc++] Make sure calls to std::move are always qualified
Arthur O'Dwyer via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Feb 24 16:58:15 PST 2022
Author: Corentin Jabot
Date: 2022-02-24T19:58:08-05:00
New Revision: 48f8a7c4f2356d7aeab2994a9adebcbff9b83ffd
URL: https://github.com/llvm/llvm-project/commit/48f8a7c4f2356d7aeab2994a9adebcbff9b83ffd
DIFF: https://github.com/llvm/llvm-project/commit/48f8a7c4f2356d7aeab2994a9adebcbff9b83ffd.diff
LOG: [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
Added:
Modified:
libcxx/include/barrier
libcxx/include/valarray
libcxx/src/filesystem/directory_iterator.cpp
Removed:
################################################################################
diff --git a/libcxx/include/barrier b/libcxx/include/barrier
index b0975a5519ab6..52cd129596416 100644
--- a/libcxx/include/barrier
+++ b/libcxx/include/barrier
@@ -126,7 +126,7 @@ public:
__barrier_base(ptr
diff _t __expected, _CompletionF __completion = _CompletionF())
: __expected(__expected), __base(__construct_barrier_algorithm_base(this->__expected),
&__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
@@ -190,7 +190,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
__barrier_base(ptr
diff _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
diff --git a/libcxx/include/valarray b/libcxx/include/valarray
index ac1ca9b204a87..8ceaafeb35bdb 100644
--- a/libcxx/include/valarray
+++ b/libcxx/include/valarray
@@ -1536,21 +1536,21 @@ public:
gslice(size_t __start, const valarray<size_t>& __size,
valarray<size_t>&& __stride)
: __size_(__size),
- __stride_(move(__stride))
+ __stride_(std::move(__stride))
{__init(__start);}
_LIBCPP_INLINE_VISIBILITY
gslice(size_t __start, valarray<size_t>&& __size,
const valarray<size_t>& __stride)
- : __size_(move(__size)),
+ : __size_(std::move(__size)),
__stride_(__stride)
{__init(__start);}
_LIBCPP_INLINE_VISIBILITY
gslice(size_t __start, valarray<size_t>&& __size,
valarray<size_t>&& __stride)
- : __size_(move(__size)),
- __stride_(move(__stride))
+ : __size_(std::move(__size)),
+ __stride_(std::move(__stride))
{__init(__start);}
#endif // _LIBCPP_CXX03_LANG
@@ -1701,7 +1701,7 @@ private:
#ifndef _LIBCPP_CXX03_LANG
gslice_array(gslice&& __gs, const valarray<value_type>& __v)
: __vp_(const_cast<value_type*>(__v.__begin_)),
- __1d_(move(__gs.__1d_))
+ __1d_(std::move(__gs.__1d_))
{}
#endif // _LIBCPP_CXX03_LANG
@@ -2395,7 +2395,7 @@ private:
_LIBCPP_INLINE_VISIBILITY
indirect_array(valarray<size_t>&& __ia, const valarray<value_type>& __v)
: __vp_(const_cast<value_type*>(__v.__begin_)),
- __1d_(move(__ia))
+ __1d_(std::move(__ia))
{}
#endif // _LIBCPP_CXX03_LANG
@@ -2614,7 +2614,7 @@ private:
_LIBCPP_INLINE_VISIBILITY
__indirect_expr(valarray<size_t>&& __ia, const _RmExpr& __e)
: __expr_(__e),
- __1d_(move(__ia))
+ __1d_(std::move(__ia))
{}
#endif // _LIBCPP_CXX03_LANG
@@ -3209,7 +3209,7 @@ inline
__val_expr<__indirect_expr<const valarray<_Tp>&> >
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>
@@ -3217,7 +3217,7 @@ inline
gslice_array<_Tp>
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
@@ -3245,7 +3245,7 @@ inline
__val_expr<__mask_expr<const valarray<_Tp>&> >
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>
@@ -3253,7 +3253,7 @@ inline
mask_array<_Tp>
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
@@ -3281,7 +3281,7 @@ inline
__val_expr<__indirect_expr<const valarray<_Tp>&> >
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>
@@ -3289,7 +3289,7 @@ inline
indirect_array<_Tp>
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
diff --git a/libcxx/src/filesystem/directory_iterator.cpp b/libcxx/src/filesystem/directory_iterator.cpp
index 8b91929df8770..8d069cc080d89 100644
--- a/libcxx/src/filesystem/directory_iterator.cpp
+++ b/libcxx/src/filesystem/directory_iterator.cpp
@@ -25,8 +25,8 @@ class __dir_stream {
__dir_stream& operator=(const __dir_stream&) = delete;
__dir_stream(__dir_stream&& __ds) noexcept : __stream_(__ds.__stream_),
- __root_(move(__ds.__root_)),
- __entry_(move(__ds.__entry_)) {
+ __root_(std::move(__ds.__root_)),
+ __entry_(std::move(__ds.__entry_)) {
__ds.__stream_ = INVALID_HANDLE_VALUE;
}
@@ -104,8 +104,8 @@ class __dir_stream {
__dir_stream& operator=(const __dir_stream&) = delete;
__dir_stream(__dir_stream&& other) noexcept : __stream_(other.__stream_),
- __root_(move(other.__root_)),
- __entry_(move(other.__entry_)) {
+ __root_(std::move(other.__root_)),
+ __entry_(std::move(other.__entry_)) {
other.__stream_ = nullptr;
}
@@ -187,7 +187,7 @@ directory_iterator& directory_iterator::__increment(error_code* ec) {
error_code m_ec;
if (!__imp_->advance(m_ec)) {
- path root = move(__imp_->__root_);
+ path root = std::move(__imp_->__root_);
__imp_.reset();
if (m_ec)
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_->__options_ = opt;
- __imp_->__stack_.push(move(new_s));
+ __imp_->__stack_.push(std::move(new_s));
}
void recursive_directory_iterator::__pop(error_code* ec) {
@@ -275,7 +275,7 @@ void recursive_directory_iterator::__advance(error_code* ec) {
}
if (m_ec) {
- path root = move(stack.top().__root_);
+ path root = std::move(stack.top().__root_);
__imp_.reset();
err.report(m_ec, "at root " PATH_CSTR_FMT, root.c_str());
} else {
@@ -309,7 +309,7 @@ bool recursive_directory_iterator::__try_recursion(error_code* ec) {
if (!skip_rec) {
__dir_stream new_it(curr_it.__entry_.path(), __imp_->__options_, m_ec);
if (new_it.good()) {
- __imp_->__stack_.push(move(new_it));
+ __imp_->__stack_.push(std::move(new_it));
return true;
}
}
@@ -320,7 +320,7 @@ bool recursive_directory_iterator::__try_recursion(error_code* ec) {
if (ec)
ec->clear();
} else {
- path at_ent = move(curr_it.__entry_.__p_);
+ path at_ent = std::move(curr_it.__entry_.__p_);
__imp_.reset();
err.report(m_ec, "attempting recursion into " PATH_CSTR_FMT,
at_ent.c_str());
More information about the libcxx-commits
mailing list