[libc++] Enable modernize-use-equals-delete (#93293)
Differential Revision: https://reviews.llvm.org/D121213
This commit is contained in:
parent
6b4b29f859
commit
bbe4a80605
@ -17,6 +17,7 @@ Checks: >
|
||||
modernize-redundant-void-arg,
|
||||
modernize-use-nullptr,
|
||||
modernize-use-override,
|
||||
modernize-use-equals-delete,
|
||||
|
||||
readability-duplicate-include,
|
||||
readability-identifier-naming,
|
||||
@ -72,7 +73,6 @@ CheckOptions:
|
||||
# modernize-use-bool-literals,
|
||||
# modernize-use-default-member-init,
|
||||
# modernize-use-equals-default,
|
||||
# modernize-use-equals-delete,
|
||||
# portability-restrict-system-includes,
|
||||
# readability-function-cognitive-complexity,
|
||||
# readability-implicit-bool-conversion,
|
||||
|
@ -149,6 +149,7 @@ public:
|
||||
using __container = typename _Cp::__self;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI __bit_const_reference(const __bit_const_reference&) = default;
|
||||
__bit_const_reference& operator=(const __bit_const_reference&) = delete;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT
|
||||
: __seg_(__x.__seg_),
|
||||
@ -167,8 +168,6 @@ private:
|
||||
__storage_pointer __s, __storage_type __m) _NOEXCEPT
|
||||
: __seg_(__s),
|
||||
__mask_(__m) {}
|
||||
|
||||
__bit_const_reference& operator=(const __bit_const_reference&) = delete;
|
||||
};
|
||||
|
||||
// copy
|
||||
|
@ -232,10 +232,10 @@ class _LIBCPP_TEMPLATE_VIS __base;
|
||||
|
||||
template <class _Rp, class... _ArgTypes>
|
||||
class __base<_Rp(_ArgTypes...)> {
|
||||
__base(const __base&);
|
||||
__base& operator=(const __base&);
|
||||
|
||||
public:
|
||||
__base(const __base&) = delete;
|
||||
__base& operator=(const __base&) = delete;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI __base() {}
|
||||
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual ~__base() {}
|
||||
virtual __base* __clone() const = 0;
|
||||
|
@ -39,7 +39,7 @@ private:
|
||||
type* __f_;
|
||||
|
||||
static void __fun(_Tp&) _NOEXCEPT;
|
||||
static void __fun(_Tp&&) = delete;
|
||||
static void __fun(_Tp&&) = delete; // NOLINT(modernize-use-equals-delete) ; This is llvm.org/PR54276
|
||||
|
||||
public:
|
||||
template <class _Up,
|
||||
|
@ -30,9 +30,8 @@ struct __libcpp_locale_guard {
|
||||
|
||||
locale_t __old_loc_;
|
||||
|
||||
private:
|
||||
__libcpp_locale_guard(__libcpp_locale_guard const&);
|
||||
__libcpp_locale_guard& operator=(__libcpp_locale_guard const&);
|
||||
__libcpp_locale_guard(__libcpp_locale_guard const&) = delete;
|
||||
__libcpp_locale_guard& operator=(__libcpp_locale_guard const&) = delete;
|
||||
};
|
||||
#elif defined(_LIBCPP_MSVCRT_LIKE)
|
||||
struct __libcpp_locale_guard {
|
||||
|
@ -40,7 +40,6 @@ public:
|
||||
: __m_(__m) {}
|
||||
_LIBCPP_HIDE_FROM_ABI ~lock_guard() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) { __m_.unlock(); }
|
||||
|
||||
private:
|
||||
lock_guard(lock_guard const&) = delete;
|
||||
lock_guard& operator=(lock_guard const&) = delete;
|
||||
};
|
||||
|
@ -52,6 +52,9 @@ public:
|
||||
}
|
||||
~basic_ostream() override;
|
||||
|
||||
basic_ostream(const basic_ostream& __rhs) = delete;
|
||||
basic_ostream& operator=(const basic_ostream& __rhs) = delete;
|
||||
|
||||
protected:
|
||||
inline _LIBCPP_HIDE_FROM_ABI basic_ostream(basic_ostream&& __rhs);
|
||||
|
||||
@ -62,9 +65,6 @@ protected:
|
||||
basic_ios<char_type, traits_type>::swap(__rhs);
|
||||
}
|
||||
|
||||
basic_ostream(const basic_ostream& __rhs) = delete;
|
||||
basic_ostream& operator=(const basic_ostream& __rhs) = delete;
|
||||
|
||||
public:
|
||||
// 27.7.2.4 Prefix/suffix:
|
||||
class _LIBCPP_TEMPLATE_VIS sentry;
|
||||
|
@ -43,7 +43,7 @@ class ref_view : public view_interface<ref_view<_Range>> {
|
||||
_Range* __range_;
|
||||
|
||||
static void __fun(_Range&);
|
||||
static void __fun(_Range&&) = delete;
|
||||
static void __fun(_Range&&) = delete; // NOLINT(modernize-use-equals-delete) ; This is llvm.org/PR54276
|
||||
|
||||
public:
|
||||
template <class _Tp>
|
||||
|
@ -69,14 +69,13 @@ class __thread_specific_ptr {
|
||||
__thread_specific_ptr();
|
||||
friend _LIBCPP_EXPORTED_FROM_ABI __thread_specific_ptr<__thread_struct>& __thread_local_data();
|
||||
|
||||
__thread_specific_ptr(const __thread_specific_ptr&);
|
||||
__thread_specific_ptr& operator=(const __thread_specific_ptr&);
|
||||
|
||||
_LIBCPP_HIDDEN static void _LIBCPP_TLS_DESTRUCTOR_CC __at_thread_exit(void*);
|
||||
|
||||
public:
|
||||
typedef _Tp* pointer;
|
||||
|
||||
__thread_specific_ptr(const __thread_specific_ptr&) = delete;
|
||||
__thread_specific_ptr& operator=(const __thread_specific_ptr&) = delete;
|
||||
~__thread_specific_ptr();
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI pointer get() const { return static_cast<_Tp*>(__libcpp_tls_get(__key_)); }
|
||||
|
@ -651,7 +651,6 @@ public:
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI void __set_parent(pointer __p) { __parent_ = static_cast<__parent_pointer>(__p); }
|
||||
|
||||
private:
|
||||
~__tree_node_base() = delete;
|
||||
__tree_node_base(__tree_node_base const&) = delete;
|
||||
__tree_node_base& operator=(__tree_node_base const&) = delete;
|
||||
@ -666,7 +665,6 @@ public:
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
|
||||
|
||||
private:
|
||||
~__tree_node() = delete;
|
||||
__tree_node(__tree_node const&) = delete;
|
||||
__tree_node& operator=(__tree_node const&) = delete;
|
||||
|
@ -510,19 +510,17 @@ protected:
|
||||
: __before_begin_(__begin_node(), __node_allocator(__a)) {}
|
||||
_LIBCPP_HIDE_FROM_ABI explicit __forward_list_base(const __node_allocator& __a)
|
||||
: __before_begin_(__begin_node(), __a) {}
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
public:
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_HIDE_FROM_ABI __forward_list_base(__forward_list_base&& __x)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
|
||||
_LIBCPP_HIDE_FROM_ABI __forward_list_base(__forward_list_base&& __x, const allocator_type& __a);
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
private:
|
||||
__forward_list_base(const __forward_list_base&);
|
||||
__forward_list_base& operator=(const __forward_list_base&);
|
||||
__forward_list_base(const __forward_list_base&) = delete;
|
||||
__forward_list_base& operator=(const __forward_list_base&) = delete;
|
||||
|
||||
public:
|
||||
_LIBCPP_HIDE_FROM_ABI ~__forward_list_base();
|
||||
|
||||
protected:
|
||||
|
@ -1384,11 +1384,10 @@ class __packaged_task_base;
|
||||
|
||||
template <class _Rp, class... _ArgTypes>
|
||||
class __packaged_task_base<_Rp(_ArgTypes...)> {
|
||||
__packaged_task_base(const __packaged_task_base&);
|
||||
__packaged_task_base& operator=(const __packaged_task_base&);
|
||||
|
||||
public:
|
||||
_LIBCPP_HIDE_FROM_ABI __packaged_task_base() {}
|
||||
__packaged_task_base(const __packaged_task_base&) = delete;
|
||||
__packaged_task_base& operator=(const __packaged_task_base&) = delete;
|
||||
_LIBCPP_HIDE_FROM_ABI_VIRTUAL
|
||||
virtual ~__packaged_task_base() {}
|
||||
virtual void __move_to(__packaged_task_base*) _NOEXCEPT = 0;
|
||||
|
@ -169,10 +169,10 @@ class __save_flags {
|
||||
fmtflags __fmtflags_;
|
||||
_CharT __fill_;
|
||||
|
||||
__save_flags(const __save_flags&);
|
||||
__save_flags& operator=(const __save_flags&);
|
||||
|
||||
public:
|
||||
__save_flags(const __save_flags&) = delete;
|
||||
__save_flags& operator=(const __save_flags&) = delete;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI explicit __save_flags(__stream_type& __stream)
|
||||
: __stream_(__stream), __fmtflags_(__stream.flags()), __fill_(__stream.fill()) {}
|
||||
_LIBCPP_HIDE_FROM_ABI ~__save_flags() {
|
||||
|
@ -216,10 +216,10 @@ protected:
|
||||
basic_ios<char_type, traits_type>::swap(__rhs);
|
||||
}
|
||||
|
||||
public:
|
||||
basic_istream(const basic_istream& __rhs) = delete;
|
||||
basic_istream& operator=(const basic_istream& __rhs) = delete;
|
||||
|
||||
public:
|
||||
// 27.7.1.1.3 Prefix/suffix:
|
||||
class _LIBCPP_TEMPLATE_VIS sentry;
|
||||
|
||||
|
@ -465,10 +465,10 @@ public:
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
class __list_imp {
|
||||
__list_imp(const __list_imp&);
|
||||
__list_imp& operator=(const __list_imp&);
|
||||
|
||||
public:
|
||||
__list_imp(const __list_imp&) = delete;
|
||||
__list_imp& operator=(const __list_imp&) = delete;
|
||||
|
||||
typedef _Alloc allocator_type;
|
||||
typedef allocator_traits<allocator_type> __alloc_traits;
|
||||
typedef typename __alloc_traits::size_type size_type;
|
||||
|
@ -3148,9 +3148,6 @@ private:
|
||||
state_type __cvtstate_;
|
||||
size_t __cvtcount_;
|
||||
|
||||
wstring_convert(const wstring_convert& __wc);
|
||||
wstring_convert& operator=(const wstring_convert& __wc);
|
||||
|
||||
public:
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_HIDE_FROM_ABI wstring_convert() : wstring_convert(new _Codecvt) {}
|
||||
@ -3167,6 +3164,9 @@ public:
|
||||
#endif
|
||||
_LIBCPP_HIDE_FROM_ABI ~wstring_convert();
|
||||
|
||||
wstring_convert(const wstring_convert& __wc) = delete;
|
||||
wstring_convert& operator=(const wstring_convert& __wc) = delete;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI wide_string from_bytes(char __byte) { return from_bytes(&__byte, &__byte + 1); }
|
||||
_LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const char* __ptr) {
|
||||
return from_bytes(__ptr, __ptr + char_traits<char>::length(__ptr));
|
||||
@ -3371,9 +3371,6 @@ private:
|
||||
bool __owns_ib_;
|
||||
bool __always_noconv_;
|
||||
|
||||
wbuffer_convert(const wbuffer_convert&);
|
||||
wbuffer_convert& operator=(const wbuffer_convert&);
|
||||
|
||||
public:
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_HIDE_FROM_ABI wbuffer_convert() : wbuffer_convert(nullptr) {}
|
||||
@ -3393,6 +3390,9 @@ public:
|
||||
return __r;
|
||||
}
|
||||
|
||||
wbuffer_convert(const wbuffer_convert&) = delete;
|
||||
wbuffer_convert& operator=(const wbuffer_convert&) = delete;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI state_type state() const { return __st_; }
|
||||
|
||||
protected:
|
||||
|
@ -715,8 +715,6 @@ public:
|
||||
private:
|
||||
allocator_type& __na_;
|
||||
|
||||
__map_node_destructor& operator=(const __map_node_destructor&);
|
||||
|
||||
public:
|
||||
bool __first_constructed;
|
||||
bool __second_constructed;
|
||||
@ -735,6 +733,8 @@ public:
|
||||
}
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
__map_node_destructor& operator=(const __map_node_destructor&) = delete;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT {
|
||||
if (__second_constructed)
|
||||
__alloc_traits::destroy(__na_, std::addressof(__p->__value_.__get_value().second));
|
||||
@ -808,7 +808,6 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
__value_type() = delete;
|
||||
~__value_type() = delete;
|
||||
__value_type(const __value_type&) = delete;
|
||||
@ -830,11 +829,10 @@ public:
|
||||
_LIBCPP_HIDE_FROM_ABI value_type& __get_value() { return __cc_; }
|
||||
_LIBCPP_HIDE_FROM_ABI const value_type& __get_value() const { return __cc_; }
|
||||
|
||||
private:
|
||||
__value_type();
|
||||
__value_type(__value_type const&);
|
||||
__value_type& operator=(__value_type const&);
|
||||
~__value_type();
|
||||
__value_type() = delete;
|
||||
__value_type(__value_type const&) = delete;
|
||||
__value_type& operator=(__value_type const&) = delete;
|
||||
~__value_type() = delete;
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
@ -1345,13 +1345,12 @@ struct __state {
|
||||
|
||||
template <class _CharT>
|
||||
class __node {
|
||||
__node(const __node&);
|
||||
__node& operator=(const __node&);
|
||||
|
||||
public:
|
||||
typedef std::__state<_CharT> __state;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI __node() {}
|
||||
__node(const __node&) = delete;
|
||||
__node& operator=(const __node&) = delete;
|
||||
_LIBCPP_HIDE_FROM_ABI_VIRTUAL
|
||||
virtual ~__node() {}
|
||||
|
||||
@ -1952,14 +1951,14 @@ class __match_char : public __owns_one_state<_CharT> {
|
||||
|
||||
_CharT __c_;
|
||||
|
||||
__match_char(const __match_char&);
|
||||
__match_char& operator=(const __match_char&);
|
||||
|
||||
public:
|
||||
typedef std::__state<_CharT> __state;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI __match_char(_CharT __c, __node<_CharT>* __s) : base(__s), __c_(__c) {}
|
||||
|
||||
__match_char(const __match_char&) = delete;
|
||||
__match_char& operator=(const __match_char&) = delete;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
|
||||
};
|
||||
|
||||
@ -1984,15 +1983,15 @@ class __match_char_icase : public __owns_one_state<_CharT> {
|
||||
_Traits __traits_;
|
||||
_CharT __c_;
|
||||
|
||||
__match_char_icase(const __match_char_icase&);
|
||||
__match_char_icase& operator=(const __match_char_icase&);
|
||||
|
||||
public:
|
||||
typedef std::__state<_CharT> __state;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI __match_char_icase(const _Traits& __traits, _CharT __c, __node<_CharT>* __s)
|
||||
: base(__s), __traits_(__traits), __c_(__traits.translate_nocase(__c)) {}
|
||||
|
||||
__match_char_icase(const __match_char_icase&) = delete;
|
||||
__match_char_icase& operator=(const __match_char_icase&) = delete;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
|
||||
};
|
||||
|
||||
@ -2017,15 +2016,15 @@ class __match_char_collate : public __owns_one_state<_CharT> {
|
||||
_Traits __traits_;
|
||||
_CharT __c_;
|
||||
|
||||
__match_char_collate(const __match_char_collate&);
|
||||
__match_char_collate& operator=(const __match_char_collate&);
|
||||
|
||||
public:
|
||||
typedef std::__state<_CharT> __state;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI __match_char_collate(const _Traits& __traits, _CharT __c, __node<_CharT>* __s)
|
||||
: base(__s), __traits_(__traits), __c_(__traits.translate(__c)) {}
|
||||
|
||||
__match_char_collate(const __match_char_collate&) = delete;
|
||||
__match_char_collate& operator=(const __match_char_collate&) = delete;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
|
||||
};
|
||||
|
||||
@ -2061,9 +2060,6 @@ class __bracket_expression : public __owns_one_state<_CharT> {
|
||||
bool __collate_;
|
||||
bool __might_have_digraph_;
|
||||
|
||||
__bracket_expression(const __bracket_expression&);
|
||||
__bracket_expression& operator=(const __bracket_expression&);
|
||||
|
||||
public:
|
||||
typedef std::__state<_CharT> __state;
|
||||
|
||||
@ -2078,6 +2074,9 @@ public:
|
||||
__collate_(__collate),
|
||||
__might_have_digraph_(__traits_.getloc().name() != "C") {}
|
||||
|
||||
__bracket_expression(const __bracket_expression&) = delete;
|
||||
__bracket_expression& operator=(const __bracket_expression&) = delete;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI bool __negated() const { return __negate_; }
|
||||
@ -2699,9 +2698,6 @@ class __lookahead : public __owns_one_state<_CharT> {
|
||||
unsigned __mexp_;
|
||||
bool __invert_;
|
||||
|
||||
__lookahead(const __lookahead&);
|
||||
__lookahead& operator=(const __lookahead&);
|
||||
|
||||
public:
|
||||
typedef std::__state<_CharT> __state;
|
||||
|
||||
@ -2709,6 +2705,9 @@ public:
|
||||
__lookahead(const basic_regex<_CharT, _Traits>& __exp, bool __invert, __node<_CharT>* __s, unsigned __mexp)
|
||||
: base(__s), __exp_(__exp), __mexp_(__mexp), __invert_(__invert) {}
|
||||
|
||||
__lookahead(const __lookahead&) = delete;
|
||||
__lookahead& operator=(const __lookahead&) = delete;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
|
||||
};
|
||||
|
||||
|
@ -304,9 +304,9 @@ class __tuple_leaf {
|
||||
# endif
|
||||
}
|
||||
|
||||
public:
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_leaf& operator=(const __tuple_leaf&) = delete;
|
||||
|
||||
public:
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf() _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : __value_() {
|
||||
static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");
|
||||
}
|
||||
@ -380,9 +380,9 @@ public:
|
||||
|
||||
template <size_t _Ip, class _Hp>
|
||||
class __tuple_leaf<_Ip, _Hp, true> : private _Hp {
|
||||
public:
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_leaf& operator=(const __tuple_leaf&) = delete;
|
||||
|
||||
public:
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf() _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) {}
|
||||
|
||||
template <class _Alloc>
|
||||
|
@ -792,12 +792,12 @@ public:
|
||||
private:
|
||||
allocator_type& __na_;
|
||||
|
||||
__hash_map_node_destructor& operator=(const __hash_map_node_destructor&);
|
||||
|
||||
public:
|
||||
bool __first_constructed;
|
||||
bool __second_constructed;
|
||||
|
||||
__hash_map_node_destructor& operator=(const __hash_map_node_destructor&) = delete;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI explicit __hash_map_node_destructor(allocator_type& __na) _NOEXCEPT
|
||||
: __na_(__na),
|
||||
__first_constructed(false),
|
||||
@ -882,7 +882,6 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
__hash_value_type(const __hash_value_type& __v) = delete;
|
||||
__hash_value_type(__hash_value_type&& __v) = delete;
|
||||
template <class... _Args>
|
||||
@ -906,8 +905,7 @@ public:
|
||||
_LIBCPP_HIDE_FROM_ABI value_type& __get_value() { return __cc_; }
|
||||
_LIBCPP_HIDE_FROM_ABI const value_type& __get_value() const { return __cc_; }
|
||||
|
||||
private:
|
||||
~__hash_value_type();
|
||||
~__hash_value_type() = delete;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -905,6 +905,7 @@ private:
|
||||
__v_.__annotate_increase(__n);
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() {
|
||||
__v_.__end_ = __pos_;
|
||||
#ifndef _LIBCPP_HAS_NO_ASAN
|
||||
@ -918,7 +919,6 @@ private:
|
||||
pointer __pos_;
|
||||
const_pointer const __new_end_;
|
||||
|
||||
private:
|
||||
_ConstructTransaction(_ConstructTransaction const&) = delete;
|
||||
_ConstructTransaction& operator=(_ConstructTransaction const&) = delete;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user