diff --git a/libcxx/.clang-tidy b/libcxx/.clang-tidy --- a/libcxx/.clang-tidy +++ b/libcxx/.clang-tidy @@ -15,6 +15,7 @@ modernize-loop-convert, modernize-redundant-void-arg, + modernize-use-override, readability-duplicate-include, readability-identifier-naming, @@ -49,7 +50,6 @@ # modernize-use-equals-default, # modernize-use-equals-delete, # modernize-use-nullptr, -# modernize-use-override, # portability-restrict-system-includes, # readability-function-cognitive-complexity, # readability-implicit-bool-conversion, diff --git a/libcxx/include/__debug b/libcxx/include/__debug --- a/libcxx/include/__debug +++ b/libcxx/include/__debug @@ -87,10 +87,10 @@ explicit _C_node(void* __c, __c_node* __n) : __c_node(__c, __n) {} - virtual bool __dereferenceable(const void*) const; - virtual bool __decrementable(const void*) const; - virtual bool __addable(const void*, ptrdiff_t) const; - virtual bool __subscriptable(const void*, ptrdiff_t) const; + bool __dereferenceable(const void*) const override; + bool __decrementable(const void*) const override; + bool __addable(const void*, ptrdiff_t) const override; + bool __subscriptable(const void*, ptrdiff_t) const override; }; template diff --git a/libcxx/include/__format/format_error.h b/libcxx/include/__format/format_error.h --- a/libcxx/include/__format/format_error.h +++ b/libcxx/include/__format/format_error.h @@ -31,7 +31,7 @@ : runtime_error(__s) {} _LIBCPP_HIDE_FROM_ABI explicit format_error(const char* __s) : runtime_error(__s) {} - virtual ~format_error() noexcept; + ~format_error() noexcept override; }; _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h --- a/libcxx/include/__functional/function.h +++ b/libcxx/include/__functional/function.h @@ -45,13 +45,13 @@ // bad_function_call will end up containing a weak definition of the vtable and // typeinfo. #ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION - virtual ~bad_function_call() _NOEXCEPT; + ~bad_function_call() _NOEXCEPT override; #else - virtual ~bad_function_call() _NOEXCEPT {} + ~bad_function_call() _NOEXCEPT override {} #endif #ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE - virtual const char* what() const _NOEXCEPT; + const char* what() const _NOEXCEPT override; #endif }; _LIBCPP_DIAGNOSTIC_POP diff --git a/libcxx/include/__locale b/libcxx/include/__locale --- a/libcxx/include/__locale +++ b/libcxx/include/__locale @@ -191,12 +191,12 @@ explicit facet(size_t __refs = 0) : __shared_count(static_cast(__refs)-1) {} - virtual ~facet(); + ~facet() override; // facet(const facet&) = delete; // effectively done in __shared_count // void operator=(const facet&) = delete; private: - virtual void __on_zero_shared() _NOEXCEPT; + void __on_zero_shared() _NOEXCEPT override; }; class _LIBCPP_TYPE_VIS locale::id @@ -291,7 +291,7 @@ static locale::id id; protected: - ~collate(); + ~collate() override; virtual int do_compare(const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const; virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const @@ -359,10 +359,10 @@ explicit collate_byname(const string& __n, size_t __refs = 0); protected: - ~collate_byname(); - virtual int do_compare(const char_type* __lo1, const char_type* __hi1, - const char_type* __lo2, const char_type* __hi2) const; - virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const; + ~collate_byname() override; + int do_compare(const char_type* __lo1, const char_type* __hi1, + const char_type* __lo2, const char_type* __hi2) const override; + string_type do_transform(const char_type* __lo, const char_type* __hi) const override; }; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -379,11 +379,11 @@ explicit collate_byname(const string& __n, size_t __refs = 0); protected: - ~collate_byname(); + ~collate_byname() override; - virtual int do_compare(const char_type* __lo1, const char_type* __hi1, - const char_type* __lo2, const char_type* __hi2) const; - virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const; + int do_compare(const char_type* __lo1, const char_type* __hi1, + const char_type* __lo2, const char_type* __hi2) const override; + string_type do_transform(const char_type* __lo, const char_type* __hi) const override; }; #endif @@ -643,7 +643,7 @@ static locale::id id; protected: - ~ctype(); + ~ctype() override; virtual bool do_is(mask __m, char_type __c) const; virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const; virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const; @@ -773,7 +773,7 @@ #endif protected: - ~ctype(); + ~ctype() override; virtual char_type do_toupper(char_type __c) const; virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; virtual char_type do_tolower(char_type __c) const; @@ -799,11 +799,11 @@ explicit ctype_byname(const string&, size_t = 0); protected: - ~ctype_byname(); - virtual char_type do_toupper(char_type) const; - virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; - virtual char_type do_tolower(char_type) const; - virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; + ~ctype_byname() override; + char_type do_toupper(char_type) const override; + const char_type* do_toupper(char_type* __low, const char_type* __high) const override; + char_type do_tolower(char_type) const override; + const char_type* do_tolower(char_type* __low, const char_type* __high) const override; }; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -818,19 +818,19 @@ explicit ctype_byname(const string&, size_t = 0); protected: - ~ctype_byname(); - virtual bool do_is(mask __m, char_type __c) const; - virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const; - virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const; - virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const; - virtual char_type do_toupper(char_type) const; - virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; - virtual char_type do_tolower(char_type) const; - virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; - virtual char_type do_widen(char) const; - virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const; - virtual char do_narrow(char_type, char __dfault) const; - virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const; + ~ctype_byname() override; + bool do_is(mask __m, char_type __c) const override; + const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const override; + const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const override; + const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const override; + char_type do_toupper(char_type) const override; + const char_type* do_toupper(char_type* __low, const char_type* __high) const override; + char_type do_tolower(char_type) const override; + const char_type* do_tolower(char_type* __low, const char_type* __high) const override; + char_type do_widen(char) const override; + const char* do_widen(const char* __low, const char* __high, char_type* __dest) const override; + char do_narrow(char_type, char __dfault) const override; + const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const override; }; #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -1021,7 +1021,7 @@ explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {} - ~codecvt(); + ~codecvt() override; virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, @@ -1105,7 +1105,7 @@ protected: explicit codecvt(const char*, size_t __refs = 0); - ~codecvt(); + ~codecvt() override; virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, @@ -1192,7 +1192,7 @@ explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {} - ~codecvt(); + ~codecvt() override; virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, @@ -1280,7 +1280,7 @@ explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {} - ~codecvt(); + ~codecvt() override; virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, @@ -1368,7 +1368,7 @@ explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {} - ~codecvt(); + ~codecvt() override; virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, @@ -1456,7 +1456,7 @@ explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {} - ~codecvt(); + ~codecvt() override; virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, @@ -1488,7 +1488,7 @@ explicit codecvt_byname(const string& __nm, size_t __refs = 0) : codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {} protected: - ~codecvt_byname(); + ~codecvt_byname() override; }; _LIBCPP_SUPPRESS_DEPRECATED_PUSH @@ -1540,7 +1540,7 @@ __narrow_to_utf8() : codecvt(1) {} _LIBCPP_SUPPRESS_DEPRECATED_POP - ~__narrow_to_utf8(); + ~__narrow_to_utf8() override; template _LIBCPP_INLINE_VISIBILITY @@ -1576,7 +1576,7 @@ __narrow_to_utf8() : codecvt(1) {} _LIBCPP_SUPPRESS_DEPRECATED_POP - ~__narrow_to_utf8(); + ~__narrow_to_utf8() override; template _LIBCPP_INLINE_VISIBILITY @@ -1634,7 +1634,7 @@ __widen_from_utf8() : codecvt(1) {} _LIBCPP_SUPPRESS_DEPRECATED_POP - ~__widen_from_utf8(); + ~__widen_from_utf8() override; template _LIBCPP_INLINE_VISIBILITY @@ -1670,7 +1670,7 @@ __widen_from_utf8() : codecvt(1) {} _LIBCPP_SUPPRESS_DEPRECATED_POP - ~__widen_from_utf8(); + ~__widen_from_utf8() override; template _LIBCPP_INLINE_VISIBILITY @@ -1720,7 +1720,7 @@ static locale::id id; protected: - ~numpunct(); + ~numpunct() override; virtual char_type do_decimal_point() const; virtual char_type do_thousands_sep() const; virtual string do_grouping() const; @@ -1752,7 +1752,7 @@ static locale::id id; protected: - ~numpunct(); + ~numpunct() override; virtual char_type do_decimal_point() const; virtual char_type do_thousands_sep() const; virtual string do_grouping() const; @@ -1781,7 +1781,7 @@ explicit numpunct_byname(const string& __nm, size_t __refs = 0); protected: - ~numpunct_byname(); + ~numpunct_byname() override; private: void __init(const char*); @@ -1800,7 +1800,7 @@ explicit numpunct_byname(const string& __nm, size_t __refs = 0); protected: - ~numpunct_byname(); + ~numpunct_byname() override; private: void __init(const char*); diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h --- a/libcxx/include/__memory/shared_ptr.h +++ b/libcxx/include/__memory/shared_ptr.h @@ -130,8 +130,8 @@ public: bad_weak_ptr() _NOEXCEPT = default; bad_weak_ptr(const bad_weak_ptr&) _NOEXCEPT = default; - virtual ~bad_weak_ptr() _NOEXCEPT; - virtual const char* what() const _NOEXCEPT; + ~bad_weak_ptr() _NOEXCEPT override; + const char* what() const _NOEXCEPT override; }; _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY @@ -196,7 +196,7 @@ : __shared_count(__refs), __shared_weak_owners_(__refs) {} protected: - virtual ~__shared_weak_count(); + ~__shared_weak_count() override; public: #if defined(_LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS) @@ -239,12 +239,12 @@ : __data_(__compressed_pair<_Tp, _Dp>(__p, _VSTD::move(__d)), _VSTD::move(__a)) {} #ifndef _LIBCPP_NO_RTTI - virtual const void* __get_deleter(const type_info&) const _NOEXCEPT; + const void* __get_deleter(const type_info&) const _NOEXCEPT override; #endif private: - virtual void __on_zero_shared() _NOEXCEPT; - virtual void __on_zero_shared_weak() _NOEXCEPT; + void __on_zero_shared() _NOEXCEPT override; + void __on_zero_shared_weak() _NOEXCEPT override; }; #ifndef _LIBCPP_NO_RTTI @@ -304,7 +304,7 @@ _Tp* __get_elem() _NOEXCEPT { return __storage_.__get_elem(); } private: - virtual void __on_zero_shared() _NOEXCEPT { + void __on_zero_shared() _NOEXCEPT override { #if _LIBCPP_STD_VER > 17 using _TpAlloc = typename __allocator_traits_rebind<_Alloc, _Tp>::type; _TpAlloc __tmp(*__get_alloc()); @@ -314,7 +314,7 @@ #endif } - virtual void __on_zero_shared_weak() _NOEXCEPT { + void __on_zero_shared_weak() _NOEXCEPT override { using _ControlBlockAlloc = typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type; using _ControlBlockPointer = typename allocator_traits<_ControlBlockAlloc>::pointer; _ControlBlockAlloc __tmp(*__get_alloc()); diff --git a/libcxx/include/any b/libcxx/include/any --- a/libcxx/include/any +++ b/libcxx/include/any @@ -106,7 +106,7 @@ class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast { public: - virtual const char* what() const _NOEXCEPT; + const char* what() const _NOEXCEPT override; }; } // namespace std diff --git a/libcxx/include/codecvt b/libcxx/include/codecvt --- a/libcxx/include/codecvt +++ b/libcxx/include/codecvt @@ -98,22 +98,18 @@ _Mode_(__mode) {} _LIBCPP_SUPPRESS_DEPRECATED_POP protected: - virtual result - do_out(state_type& __st, - const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual result - do_in(state_type& __st, - const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, - intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; - virtual result - do_unshift(state_type& __st, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual int do_encoding() const _NOEXCEPT; - virtual bool do_always_noconv() const _NOEXCEPT; - virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, - size_t __mx) const; - virtual int do_max_length() const _NOEXCEPT; + result do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + result do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; + result do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + int do_encoding() const _NOEXCEPT override; + bool do_always_noconv() const _NOEXCEPT override; + int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; + int do_max_length() const _NOEXCEPT override; }; #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -137,22 +133,18 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP protected: - virtual result - do_out(state_type& __st, - const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual result - do_in(state_type& __st, - const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, - intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; - virtual result - do_unshift(state_type& __st, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual int do_encoding() const _NOEXCEPT; - virtual bool do_always_noconv() const _NOEXCEPT; - virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, - size_t __mx) const; - virtual int do_max_length() const _NOEXCEPT; + result do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + result do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; + result do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + int do_encoding() const _NOEXCEPT override; + bool do_always_noconv() const _NOEXCEPT override; + int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; + int do_max_length() const _NOEXCEPT override; }; _LIBCPP_SUPPRESS_DEPRECATED_PUSH @@ -175,22 +167,18 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP protected: - virtual result - do_out(state_type& __st, - const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual result - do_in(state_type& __st, - const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, - intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; - virtual result - do_unshift(state_type& __st, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual int do_encoding() const _NOEXCEPT; - virtual bool do_always_noconv() const _NOEXCEPT; - virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, - size_t __mx) const; - virtual int do_max_length() const _NOEXCEPT; + result do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + result do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; + result do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + int do_encoding() const _NOEXCEPT override; + bool do_always_noconv() const _NOEXCEPT override; + int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; + int do_max_length() const _NOEXCEPT override; }; _LIBCPP_SUPPRESS_DEPRECATED_PUSH @@ -235,22 +223,19 @@ _Mode_(__mode) {} _LIBCPP_SUPPRESS_DEPRECATED_POP protected: - virtual result - do_out(state_type& __st, - const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual result - do_in(state_type& __st, - const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, - intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; - virtual result - do_unshift(state_type& __st, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual int do_encoding() const _NOEXCEPT; - virtual bool do_always_noconv() const _NOEXCEPT; - virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, - size_t __mx) const; - virtual int do_max_length() const _NOEXCEPT; + result do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + result do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; + result do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + int do_encoding() const _NOEXCEPT override; + bool do_always_noconv() const _NOEXCEPT override; + int do_length(state_type&, const extern_type* __frm, const extern_type* __end, + size_t __mx) const override; + int do_max_length() const _NOEXCEPT override; }; template <> @@ -274,22 +259,18 @@ _Mode_(__mode) {} _LIBCPP_SUPPRESS_DEPRECATED_POP protected: - virtual result - do_out(state_type& __st, - const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual result - do_in(state_type& __st, - const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, - intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; - virtual result - do_unshift(state_type& __st, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual int do_encoding() const _NOEXCEPT; - virtual bool do_always_noconv() const _NOEXCEPT; - virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, - size_t __mx) const; - virtual int do_max_length() const _NOEXCEPT; + result do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + result do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; + result do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + int do_encoding() const _NOEXCEPT override; + bool do_always_noconv() const _NOEXCEPT override; + int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; + int do_max_length() const _NOEXCEPT override; }; #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -313,22 +294,18 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP protected: - virtual result - do_out(state_type& __st, - const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual result - do_in(state_type& __st, - const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, - intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; - virtual result - do_unshift(state_type& __st, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual int do_encoding() const _NOEXCEPT; - virtual bool do_always_noconv() const _NOEXCEPT; - virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, - size_t __mx) const; - virtual int do_max_length() const _NOEXCEPT; + result do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + result do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; + result do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + int do_encoding() const _NOEXCEPT override; + bool do_always_noconv() const _NOEXCEPT override; + int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; + int do_max_length() const _NOEXCEPT override; }; _LIBCPP_SUPPRESS_DEPRECATED_PUSH @@ -351,22 +328,18 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP protected: - virtual result - do_out(state_type& __st, - const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual result - do_in(state_type& __st, - const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, - intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; - virtual result - do_unshift(state_type& __st, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual int do_encoding() const _NOEXCEPT; - virtual bool do_always_noconv() const _NOEXCEPT; - virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, - size_t __mx) const; - virtual int do_max_length() const _NOEXCEPT; + result do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + result do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; + result do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + int do_encoding() const _NOEXCEPT override; + bool do_always_noconv() const _NOEXCEPT override; + int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; + int do_max_length() const _NOEXCEPT override; }; _LIBCPP_SUPPRESS_DEPRECATED_PUSH @@ -389,22 +362,18 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP protected: - virtual result - do_out(state_type& __st, - const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual result - do_in(state_type& __st, - const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, - intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; - virtual result - do_unshift(state_type& __st, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual int do_encoding() const _NOEXCEPT; - virtual bool do_always_noconv() const _NOEXCEPT; - virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, - size_t __mx) const; - virtual int do_max_length() const _NOEXCEPT; + result do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + result do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; + result do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + int do_encoding() const _NOEXCEPT override; + bool do_always_noconv() const _NOEXCEPT override; + int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; + int do_max_length() const _NOEXCEPT override; }; _LIBCPP_SUPPRESS_DEPRECATED_PUSH @@ -427,22 +396,18 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP protected: - virtual result - do_out(state_type& __st, - const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual result - do_in(state_type& __st, - const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, - intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; - virtual result - do_unshift(state_type& __st, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual int do_encoding() const _NOEXCEPT; - virtual bool do_always_noconv() const _NOEXCEPT; - virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, - size_t __mx) const; - virtual int do_max_length() const _NOEXCEPT; + result do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + result do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; + result do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + int do_encoding() const _NOEXCEPT override; + bool do_always_noconv() const _NOEXCEPT override; + int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; + int do_max_length() const _NOEXCEPT override; }; _LIBCPP_SUPPRESS_DEPRECATED_PUSH @@ -487,22 +452,18 @@ _Mode_(__mode) {} _LIBCPP_SUPPRESS_DEPRECATED_POP protected: - virtual result - do_out(state_type& __st, - const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual result - do_in(state_type& __st, - const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, - intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; - virtual result - do_unshift(state_type& __st, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual int do_encoding() const _NOEXCEPT; - virtual bool do_always_noconv() const _NOEXCEPT; - virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, - size_t __mx) const; - virtual int do_max_length() const _NOEXCEPT; + result do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + result do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; + result do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + int do_encoding() const _NOEXCEPT override; + bool do_always_noconv() const _NOEXCEPT override; + int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; + int do_max_length() const _NOEXCEPT override; }; #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -526,22 +487,18 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP protected: - virtual result - do_out(state_type& __st, - const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual result - do_in(state_type& __st, - const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, - intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; - virtual result - do_unshift(state_type& __st, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual int do_encoding() const _NOEXCEPT; - virtual bool do_always_noconv() const _NOEXCEPT; - virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, - size_t __mx) const; - virtual int do_max_length() const _NOEXCEPT; + result do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + result do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; + result do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + int do_encoding() const _NOEXCEPT override; + bool do_always_noconv() const _NOEXCEPT override; + int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; + int do_max_length() const _NOEXCEPT override; }; _LIBCPP_SUPPRESS_DEPRECATED_PUSH @@ -564,22 +521,18 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP protected: - virtual result - do_out(state_type& __st, - const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual result - do_in(state_type& __st, - const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, - intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; - virtual result - do_unshift(state_type& __st, - extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; - virtual int do_encoding() const _NOEXCEPT; - virtual bool do_always_noconv() const _NOEXCEPT; - virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, - size_t __mx) const; - virtual int do_max_length() const _NOEXCEPT; + result do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + result do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const override; + result do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const override; + int do_encoding() const _NOEXCEPT override; + bool do_always_noconv() const _NOEXCEPT override; + int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const override; + int do_max_length() const _NOEXCEPT override; }; _LIBCPP_SUPPRESS_DEPRECATED_PUSH diff --git a/libcxx/include/exception b/libcxx/include/exception --- a/libcxx/include/exception +++ b/libcxx/include/exception @@ -156,8 +156,8 @@ class _LIBCPP_EXCEPTION_ABI bad_exception : public exception { public: _LIBCPP_INLINE_VISIBILITY bad_exception() _NOEXCEPT {} - virtual ~bad_exception() _NOEXCEPT; - virtual const char* what() const _NOEXCEPT; + ~bad_exception() _NOEXCEPT override; + const char* what() const _NOEXCEPT override; }; #endif // !_LIBCPP_ABI_VCRUNTIME diff --git a/libcxx/include/experimental/memory_resource b/libcxx/include/experimental/memory_resource --- a/libcxx/include/experimental/memory_resource +++ b/libcxx/include/experimental/memory_resource @@ -379,7 +379,7 @@ // 8.7.3, memory.resource.adaptor.mem private: - virtual void * do_allocate(size_t __bytes, size_t) + void * do_allocate(size_t __bytes, size_t) override { if (__bytes > __max_size()) __throw_bad_array_new_length(); @@ -387,7 +387,7 @@ return __alloc_.allocate(__s); } - virtual void do_deallocate(void * __p, size_t __bytes, size_t) + void do_deallocate(void * __p, size_t __bytes, size_t) override { _LIBCPP_ASSERT(__bytes <= __max_size(), "do_deallocate called for size which exceeds the maximum allocation size"); @@ -395,7 +395,7 @@ __alloc_.deallocate((_ValueType*)__p, __s); } - virtual bool do_is_equal(memory_resource const & __other) const _NOEXCEPT { + bool do_is_equal(memory_resource const & __other) const _NOEXCEPT override { __resource_adaptor_imp const * __p = dynamic_cast<__resource_adaptor_imp const *>(&__other); return __p ? __alloc_ == __p->__alloc_ : false; diff --git a/libcxx/include/fstream b/libcxx/include/fstream --- a/libcxx/include/fstream +++ b/libcxx/include/fstream @@ -226,7 +226,7 @@ // 27.9.1.2 Constructors/destructor: basic_filebuf(); basic_filebuf(basic_filebuf&& __rhs); - virtual ~basic_filebuf(); + ~basic_filebuf() override; // 27.9.1.3 Assign/swap: _LIBCPP_INLINE_VISIBILITY @@ -259,16 +259,16 @@ protected: // 27.9.1.5 Overridden virtual functions: - virtual int_type underflow(); - virtual int_type pbackfail(int_type __c = traits_type::eof()); - virtual int_type overflow (int_type __c = traits_type::eof()); - virtual basic_streambuf* setbuf(char_type* __s, streamsize __n); - virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, - ios_base::openmode __wch = ios_base::in | ios_base::out); - virtual pos_type seekpos(pos_type __sp, - ios_base::openmode __wch = ios_base::in | ios_base::out); - virtual int sync(); - virtual void imbue(const locale& __loc); + int_type underflow() override; + int_type pbackfail(int_type __c = traits_type::eof()) override; + int_type overflow (int_type __c = traits_type::eof()) override; + basic_streambuf* setbuf(char_type* __s, streamsize __n) override; + pos_type seekoff(off_type __off, ios_base::seekdir __way, + ios_base::openmode __wch = ios_base::in | ios_base::out) override; + pos_type seekpos(pos_type __sp, + ios_base::openmode __wch = ios_base::in | ios_base::out) override; + int sync() override; + void imbue(const locale& __loc) override; private: char* __extbuf_; diff --git a/libcxx/include/future b/libcxx/include/future --- a/libcxx/include/future +++ b/libcxx/include/future @@ -518,7 +518,7 @@ const error_code& code() const _NOEXCEPT {return __ec_;} future_error(const future_error&) _NOEXCEPT = default; - virtual ~future_error() _NOEXCEPT; + ~future_error() _NOEXCEPT override; }; _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY @@ -544,7 +544,7 @@ mutable condition_variable __cv_; unsigned __state_; - virtual void __on_zero_shared() _NOEXCEPT; + void __on_zero_shared() _NOEXCEPT override; void __sub_wait(unique_lock& __lk); public: enum @@ -631,7 +631,7 @@ protected: _Up __value_; - virtual void __on_zero_shared() _NOEXCEPT; + void __on_zero_shared() _NOEXCEPT override; public: template @@ -711,7 +711,7 @@ protected: _Up __value_; - virtual void __on_zero_shared() _NOEXCEPT; + void __on_zero_shared() _NOEXCEPT override; public: void set_value(_Rp& __arg); @@ -823,7 +823,7 @@ typedef __assoc_sub_state base; _Alloc __alloc_; - virtual void __on_zero_shared() _NOEXCEPT; + void __on_zero_shared() _NOEXCEPT override; public: _LIBCPP_INLINE_VISIBILITY explicit __assoc_sub_state_alloc(const _Alloc& __a) @@ -895,7 +895,7 @@ _LIBCPP_INLINE_VISIBILITY explicit __deferred_assoc_state(_Fp&& __f); - virtual void __execute(); + void __execute() override; }; template @@ -982,12 +982,12 @@ _Fp __func_; - virtual void __on_zero_shared() _NOEXCEPT; + void __on_zero_shared() _NOEXCEPT override; public: _LIBCPP_INLINE_VISIBILITY explicit __async_assoc_state(_Fp&& __f); - virtual void __execute(); + void __execute() override; }; template diff --git a/libcxx/include/ios b/libcxx/include/ios --- a/libcxx/include/ios +++ b/libcxx/include/ios @@ -441,7 +441,7 @@ explicit failure(const string& __msg, const error_code& __ec = io_errc::stream); explicit failure(const char* __msg, const error_code& __ec = io_errc::stream); failure(const failure&) _NOEXCEPT = default; - virtual ~failure() _NOEXCEPT; + ~failure() _NOEXCEPT override; }; _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY @@ -641,7 +641,7 @@ // 27.5.4.1 Constructor/destructor: _LIBCPP_INLINE_VISIBILITY explicit basic_ios(basic_streambuf* __sb); - virtual ~basic_ios(); + ~basic_ios() override; // 27.5.4.2 Members: _LIBCPP_INLINE_VISIBILITY diff --git a/libcxx/include/istream b/libcxx/include/istream --- a/libcxx/include/istream +++ b/libcxx/include/istream @@ -192,7 +192,7 @@ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 explicit basic_istream(basic_streambuf* __sb) : __gc_(0) { this->init(__sb); } - virtual ~basic_istream(); + ~basic_istream() override; protected: inline _LIBCPP_INLINE_VISIBILITY basic_istream(basic_istream&& __rhs); @@ -1408,7 +1408,7 @@ : basic_istream<_CharT, _Traits>(__sb) {} - virtual ~basic_iostream(); + ~basic_iostream() override; protected: inline _LIBCPP_INLINE_VISIBILITY basic_iostream(basic_iostream&& __rhs); diff --git a/libcxx/include/locale b/libcxx/include/locale --- a/libcxx/include/locale +++ b/libcxx/include/locale @@ -681,8 +681,7 @@ static locale::id id; protected: - _LIBCPP_INLINE_VISIBILITY - ~num_get() {} + _LIBCPP_HIDE_FROM_ABI ~num_get() override {} template _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS @@ -1352,8 +1351,7 @@ static locale::id id; protected: - _LIBCPP_INLINE_VISIBILITY - ~num_put() {} + _LIBCPP_HIDE_FROM_ABI ~num_put() override {} virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, bool __v) const; @@ -1798,8 +1796,7 @@ static locale::id id; protected: - _LIBCPP_INLINE_VISIBILITY - ~time_get() {} + _LIBCPP_HIDE_FROM_ABI ~time_get() override {} virtual dateorder do_date_order() const; virtual iter_type do_get_time(iter_type __b, iter_type __e, ios_base& __iob, @@ -2416,26 +2413,25 @@ __time_get_storage<_CharT>(__nm) {} protected: - _LIBCPP_INLINE_VISIBILITY - ~time_get_byname() {} + _LIBCPP_HIDE_FROM_ABI ~time_get_byname() override {} _LIBCPP_INLINE_VISIBILITY - virtual dateorder do_date_order() const {return this->__do_date_order();} + dateorder do_date_order() const override {return this->__do_date_order();} private: _LIBCPP_INLINE_VISIBILITY - virtual const string_type* __weeks() const {return this->__weeks_;} + const string_type* __weeks() const override {return this->__weeks_;} _LIBCPP_INLINE_VISIBILITY - virtual const string_type* __months() const {return this->__months_;} + const string_type* __months() const override {return this->__months_;} _LIBCPP_INLINE_VISIBILITY - virtual const string_type* __am_pm() const {return this->__am_pm_;} + const string_type* __am_pm() const override {return this->__am_pm_;} _LIBCPP_INLINE_VISIBILITY - virtual const string_type& __c() const {return this->__c_;} + const string_type& __c() const override {return this->__c_;} _LIBCPP_INLINE_VISIBILITY - virtual const string_type& __r() const {return this->__r_;} + const string_type& __r() const override {return this->__r_;} _LIBCPP_INLINE_VISIBILITY - virtual const string_type& __x() const {return this->__x_;} + const string_type& __x() const override {return this->__x_;} _LIBCPP_INLINE_VISIBILITY - virtual const string_type& __X() const {return this->__X_;} + const string_type& __X() const override {return this->__X_;} }; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname; @@ -2483,8 +2479,7 @@ static locale::id id; protected: - _LIBCPP_INLINE_VISIBILITY - ~time_put() {} + _LIBCPP_HIDE_FROM_ABI ~time_put() override {} virtual iter_type do_put(iter_type __s, ios_base&, char_type, const tm* __tm, char __fmt, char __mod) const; @@ -2572,8 +2567,7 @@ : time_put<_CharT, _OutputIterator>(__nm, __refs) {} protected: - _LIBCPP_INLINE_VISIBILITY - ~time_put_byname() {} + _LIBCPP_HIDE_FROM_ABI ~time_put_byname() override {} }; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname; @@ -2621,8 +2615,7 @@ static const bool intl = _International; protected: - _LIBCPP_INLINE_VISIBILITY - ~moneypunct() {} + _LIBCPP_HIDE_FROM_ABI ~moneypunct() override {} virtual char_type do_decimal_point() const {return numeric_limits::max();} virtual char_type do_thousands_sep() const {return numeric_limits::max();} @@ -2672,18 +2665,17 @@ : moneypunct<_CharT, _International>(__refs) {init(__nm.c_str());} protected: - _LIBCPP_INLINE_VISIBILITY - ~moneypunct_byname() {} - - virtual char_type do_decimal_point() const {return __decimal_point_;} - virtual char_type do_thousands_sep() const {return __thousands_sep_;} - virtual string do_grouping() const {return __grouping_;} - virtual string_type do_curr_symbol() const {return __curr_symbol_;} - virtual string_type do_positive_sign() const {return __positive_sign_;} - virtual string_type do_negative_sign() const {return __negative_sign_;} - virtual int do_frac_digits() const {return __frac_digits_;} - virtual pattern do_pos_format() const {return __pos_format_;} - virtual pattern do_neg_format() const {return __neg_format_;} + _LIBCPP_HIDE_FROM_ABI ~moneypunct_byname() override {} + + char_type do_decimal_point() const override {return __decimal_point_;} + char_type do_thousands_sep() const override {return __thousands_sep_;} + string do_grouping() const override {return __grouping_;} + string_type do_curr_symbol() const override {return __curr_symbol_;} + string_type do_positive_sign() const override {return __positive_sign_;} + string_type do_negative_sign() const override {return __negative_sign_;} + int do_frac_digits() const override {return __frac_digits_;} + pattern do_pos_format() const override {return __pos_format_;} + pattern do_neg_format() const override {return __neg_format_;} private: char_type __decimal_point_; @@ -2801,9 +2793,7 @@ static locale::id id; protected: - - _LIBCPP_INLINE_VISIBILITY - ~money_get() {} + _LIBCPP_HIDE_FROM_ABI ~money_get() override {} virtual iter_type do_get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, @@ -3347,8 +3337,7 @@ static locale::id id; protected: - _LIBCPP_INLINE_VISIBILITY - ~money_put() {} + _LIBCPP_HIDE_FROM_ABI ~money_put() override {} virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl, long double __units) const; @@ -3516,8 +3505,7 @@ static locale::id id; protected: - _LIBCPP_INLINE_VISIBILITY - ~messages() {} + _LIBCPP_HIDE_FROM_ABI ~messages() override {} virtual catalog do_open(const basic_string&, const locale&) const; virtual string_type do_get(catalog, int __set, int __msgid, @@ -3606,8 +3594,7 @@ : messages<_CharT>(__refs) {} protected: - _LIBCPP_INLINE_VISIBILITY - ~messages_byname() {} + _LIBCPP_HIDE_FROM_ABI ~messages_byname() override {} }; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname; diff --git a/libcxx/include/new b/libcxx/include/new --- a/libcxx/include/new +++ b/libcxx/include/new @@ -129,8 +129,8 @@ { public: bad_alloc() _NOEXCEPT; - virtual ~bad_alloc() _NOEXCEPT; - virtual const char* what() const _NOEXCEPT; + ~bad_alloc() _NOEXCEPT override; + const char* what() const _NOEXCEPT override; }; class _LIBCPP_EXCEPTION_ABI bad_array_new_length @@ -138,8 +138,8 @@ { public: bad_array_new_length() _NOEXCEPT; - virtual ~bad_array_new_length() _NOEXCEPT; - virtual const char* what() const _NOEXCEPT; + ~bad_array_new_length() _NOEXCEPT override; + const char* what() const _NOEXCEPT override; }; typedef void (*new_handler)(); diff --git a/libcxx/include/optional b/libcxx/include/optional --- a/libcxx/include/optional +++ b/libcxx/include/optional @@ -207,8 +207,8 @@ { public: // Get the key function ~bad_optional_access() into the dylib - virtual ~bad_optional_access() _NOEXCEPT; - virtual const char* what() const _NOEXCEPT; + ~bad_optional_access() _NOEXCEPT override; + const char* what() const _NOEXCEPT override; }; } // namespace std diff --git a/libcxx/include/ostream b/libcxx/include/ostream --- a/libcxx/include/ostream +++ b/libcxx/include/ostream @@ -197,7 +197,7 @@ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 explicit basic_ostream(basic_streambuf* __sb) { this->init(__sb); } - virtual ~basic_ostream(); + ~basic_ostream() override; protected: inline _LIBCPP_INLINE_VISIBILITY basic_ostream(basic_ostream&& __rhs); diff --git a/libcxx/include/regex b/libcxx/include/regex --- a/libcxx/include/regex +++ b/libcxx/include/regex @@ -1006,8 +1006,8 @@ public: explicit regex_error(regex_constants::error_type __ecode); regex_error(const regex_error&) _NOEXCEPT = default; - virtual ~regex_error() _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + ~regex_error() _NOEXCEPT override; + _LIBCPP_INLINE_VISIBILITY regex_constants::error_type code() const {return __code_;} }; @@ -1507,7 +1507,7 @@ explicit __owns_one_state(__node<_CharT>* __s) : base(__s) {} - virtual ~__owns_one_state(); + ~__owns_one_state() override; }; template @@ -2196,7 +2196,7 @@ __match_any_but_newline(__node<_CharT>* __s) : base(__s) {} - virtual void __exec(__state&) const; + void __exec(__state&) const override; }; template <> _LIBCPP_FUNC_VIS void __match_any_but_newline::__exec(__state&) const; diff --git a/libcxx/include/sstream b/libcxx/include/sstream --- a/libcxx/include/sstream +++ b/libcxx/include/sstream @@ -250,14 +250,14 @@ protected: // 27.8.1.4 Overridden virtual functions: - virtual int_type underflow(); - virtual int_type pbackfail(int_type __c = traits_type::eof()); - virtual int_type overflow (int_type __c = traits_type::eof()); - virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, - ios_base::openmode __wch = ios_base::in | ios_base::out); + int_type underflow() override; + int_type pbackfail(int_type __c = traits_type::eof()) override; + int_type overflow (int_type __c = traits_type::eof()) override; + pos_type seekoff(off_type __off, ios_base::seekdir __way, + ios_base::openmode __wch = ios_base::in | ios_base::out) override; _LIBCPP_INLINE_VISIBILITY - virtual pos_type seekpos(pos_type __sp, - ios_base::openmode __wch = ios_base::in | ios_base::out) { + pos_type seekpos(pos_type __sp, + ios_base::openmode __wch = ios_base::in | ios_base::out) override { return seekoff(__sp, ios_base::beg, __wch); } }; diff --git a/libcxx/include/stdexcept b/libcxx/include/stdexcept --- a/libcxx/include/stdexcept +++ b/libcxx/include/stdexcept @@ -87,9 +87,9 @@ logic_error(const logic_error&) _NOEXCEPT; logic_error& operator=(const logic_error&) _NOEXCEPT; - virtual ~logic_error() _NOEXCEPT; + ~logic_error() _NOEXCEPT override; - virtual const char* what() const _NOEXCEPT; + const char* what() const _NOEXCEPT override; #else public: explicit logic_error(const _VSTD::string&); // Symbol uses versioned std::string @@ -110,9 +110,9 @@ runtime_error(const runtime_error&) _NOEXCEPT; runtime_error& operator=(const runtime_error&) _NOEXCEPT; - virtual ~runtime_error() _NOEXCEPT; + ~runtime_error() _NOEXCEPT override; - virtual const char* what() const _NOEXCEPT; + const char* what() const _NOEXCEPT override; #else public: explicit runtime_error(const _VSTD::string&); // Symbol uses versioned std::string @@ -129,7 +129,7 @@ #ifndef _LIBCPP_ABI_VCRUNTIME domain_error(const domain_error&) _NOEXCEPT = default; - virtual ~domain_error() _NOEXCEPT; + ~domain_error() _NOEXCEPT override; #endif }; @@ -142,7 +142,7 @@ #ifndef _LIBCPP_ABI_VCRUNTIME invalid_argument(const invalid_argument&) _NOEXCEPT = default; - virtual ~invalid_argument() _NOEXCEPT; + ~invalid_argument() _NOEXCEPT override; #endif }; @@ -154,7 +154,7 @@ _LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s) : logic_error(__s) {} #ifndef _LIBCPP_ABI_VCRUNTIME length_error(const length_error&) _NOEXCEPT = default; - virtual ~length_error() _NOEXCEPT; + ~length_error() _NOEXCEPT override; #endif }; @@ -167,7 +167,7 @@ #ifndef _LIBCPP_ABI_VCRUNTIME out_of_range(const out_of_range&) _NOEXCEPT = default; - virtual ~out_of_range() _NOEXCEPT; + ~out_of_range() _NOEXCEPT override; #endif }; @@ -180,7 +180,7 @@ #ifndef _LIBCPP_ABI_VCRUNTIME range_error(const range_error&) _NOEXCEPT = default; - virtual ~range_error() _NOEXCEPT; + ~range_error() _NOEXCEPT override; #endif }; @@ -193,7 +193,7 @@ #ifndef _LIBCPP_ABI_VCRUNTIME overflow_error(const overflow_error&) _NOEXCEPT = default; - virtual ~overflow_error() _NOEXCEPT; + ~overflow_error() _NOEXCEPT override; #endif }; @@ -206,7 +206,7 @@ #ifndef _LIBCPP_ABI_VCRUNTIME underflow_error(const underflow_error&) _NOEXCEPT = default; - virtual ~underflow_error() _NOEXCEPT; + ~underflow_error() _NOEXCEPT override; #endif }; diff --git a/libcxx/include/strstream b/libcxx/include/strstream --- a/libcxx/include/strstream +++ b/libcxx/include/strstream @@ -167,7 +167,7 @@ strstreambuf& operator=(strstreambuf&& __rhs); #endif // _LIBCPP_CXX03_LANG - virtual ~strstreambuf(); + ~strstreambuf() override; void swap(strstreambuf& __rhs); @@ -176,13 +176,13 @@ int pcount() const; protected: - virtual int_type overflow (int_type __c = EOF); - virtual int_type pbackfail(int_type __c = EOF); - virtual int_type underflow(); - virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, - ios_base::openmode __which = ios_base::in | ios_base::out); - virtual pos_type seekpos(pos_type __sp, - ios_base::openmode __which = ios_base::in | ios_base::out); + int_type overflow (int_type __c = EOF) override; + int_type pbackfail(int_type __c = EOF) override; + int_type underflow() override; + pos_type seekoff(off_type __off, ios_base::seekdir __way, + ios_base::openmode __which = ios_base::in | ios_base::out) override; + pos_type seekpos(pos_type __sp, + ios_base::openmode __which = ios_base::in | ios_base::out) override; private: typedef unsigned __mode_type; @@ -272,7 +272,7 @@ } #endif // _LIBCPP_CXX03_LANG - virtual ~istrstream(); + ~istrstream() override; _LIBCPP_INLINE_VISIBILITY void swap(istrstream& __rhs) @@ -321,7 +321,7 @@ } #endif // _LIBCPP_CXX03_LANG - virtual ~ostrstream(); + ~ostrstream() override; _LIBCPP_INLINE_VISIBILITY void swap(ostrstream& __rhs) @@ -381,7 +381,7 @@ } #endif // _LIBCPP_CXX03_LANG - virtual ~strstream(); + ~strstream() override; _LIBCPP_INLINE_VISIBILITY void swap(strstream& __rhs) diff --git a/libcxx/include/system_error b/libcxx/include/system_error --- a/libcxx/include/system_error +++ b/libcxx/include/system_error @@ -248,7 +248,7 @@ : public error_category { public: - virtual string message(int __ev) const; + string message(int __ev) const override; }; _LIBCPP_FUNC_VIS const error_category& generic_category() _NOEXCEPT; @@ -508,7 +508,7 @@ system_error(int __ev, const error_category& __ecat, const char* __what_arg); system_error(int __ev, const error_category& __ecat); system_error(const system_error&) _NOEXCEPT = default; - ~system_error() _NOEXCEPT; + ~system_error() _NOEXCEPT override; _LIBCPP_INLINE_VISIBILITY const error_code& code() const _NOEXCEPT {return __ec_;} diff --git a/libcxx/include/typeinfo b/libcxx/include/typeinfo --- a/libcxx/include/typeinfo +++ b/libcxx/include/typeinfo @@ -353,8 +353,8 @@ public: bad_cast() _NOEXCEPT; bad_cast(const bad_cast&) _NOEXCEPT = default; - virtual ~bad_cast() _NOEXCEPT; - virtual const char* what() const _NOEXCEPT; + ~bad_cast() _NOEXCEPT override; + const char* what() const _NOEXCEPT override; }; class _LIBCPP_EXCEPTION_ABI bad_typeid @@ -362,8 +362,8 @@ { public: bad_typeid() _NOEXCEPT; - virtual ~bad_typeid() _NOEXCEPT; - virtual const char* what() const _NOEXCEPT; + ~bad_typeid() _NOEXCEPT override; + const char* what() const _NOEXCEPT override; }; } // namespace std diff --git a/libcxx/include/variant b/libcxx/include/variant --- a/libcxx/include/variant +++ b/libcxx/include/variant @@ -247,7 +247,7 @@ class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS bad_variant_access : public exception { public: - virtual const char* what() const _NOEXCEPT; + const char* what() const _NOEXCEPT override; }; } // namespace std diff --git a/libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.fail.cpp b/libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.fail.cpp --- a/libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.fail.cpp +++ b/libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.fail.cpp @@ -17,8 +17,17 @@ int main(int, char**) { - std::basic_filebuf > f; + std::basic_filebuf > f; // expected-error-re@streambuf:* {{{{(static_assert|static assertion)}} failed{{.*}}traits_type::char_type must be the same type as CharT}} + // expected-error@fstream:* {{only virtual member functions can be marked 'override'}} + // expected-error@fstream:* {{only virtual member functions can be marked 'override'}} + // expected-error@fstream:* {{only virtual member functions can be marked 'override'}} + // expected-error@fstream:* {{only virtual member functions can be marked 'override'}} + // expected-error@fstream:* {{only virtual member functions can be marked 'override'}} + // expected-error@fstream:* {{only virtual member functions can be marked 'override'}} + // expected-error@fstream:* {{only virtual member functions can be marked 'override'}} + // expected-error@fstream:* {{only virtual member functions can be marked 'override'}} + // expected-error@fstream:* {{only virtual member functions can be marked 'override'}} return 0; } diff --git a/libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp b/libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp --- a/libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp +++ b/libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp @@ -21,6 +21,18 @@ // expected-error-re@ios:* {{{{(static_assert|static assertion)}} failed{{.*}}traits_type::char_type must be the same type as CharT}} // expected-error-re@streambuf:* {{{{(static_assert|static assertion)}} failed{{.*}}traits_type::char_type must be the same type as CharT}} +// expected-error@fstream:* {{only virtual member functions can be marked 'override'}} +// expected-error@fstream:* {{only virtual member functions can be marked 'override'}} +// expected-error@fstream:* {{only virtual member functions can be marked 'override'}} +// expected-error@fstream:* {{only virtual member functions can be marked 'override'}} +// expected-error@fstream:* {{only virtual member functions can be marked 'override'}} +// expected-error@fstream:* {{only virtual member functions can be marked 'override'}} +// expected-error@fstream:* {{only virtual member functions can be marked 'override'}} +// expected-error@fstream:* {{only virtual member functions can be marked 'override'}} +// expected-error@fstream:* {{only virtual member functions can be marked 'override'}} +// expected-error@istream:* {{only virtual member functions can be marked 'override'}} +// expected-error@istream:* {{only virtual member functions can be marked 'override'}} + // FIXME: As of commit r324062 Clang incorrectly generates a diagnostic about mismatching // exception specifications for types which are already invalid for one reason or another. // For now we tolerate this diagnostic. diff --git a/libcxx/test/libcxx/input.output/iostream.format/input.streams/traits_mismatch.fail.cpp b/libcxx/test/libcxx/input.output/iostream.format/input.streams/traits_mismatch.fail.cpp --- a/libcxx/test/libcxx/input.output/iostream.format/input.streams/traits_mismatch.fail.cpp +++ b/libcxx/test/libcxx/input.output/iostream.format/input.streams/traits_mismatch.fail.cpp @@ -26,6 +26,7 @@ int main(int, char**) { // expected-error-re@ios:* {{{{(static_assert|static assertion)}} failed{{.*}}traits_type::char_type must be the same type as CharT}} +// expected-error@istream:* {{only virtual member functions can be marked 'override'}} return 0; } diff --git a/libcxx/test/libcxx/input.output/iostream.format/output.streams/traits_mismatch.fail.cpp b/libcxx/test/libcxx/input.output/iostream.format/output.streams/traits_mismatch.fail.cpp --- a/libcxx/test/libcxx/input.output/iostream.format/output.streams/traits_mismatch.fail.cpp +++ b/libcxx/test/libcxx/input.output/iostream.format/output.streams/traits_mismatch.fail.cpp @@ -26,6 +26,7 @@ int main(int, char**) { // expected-error-re@ios:* {{{{(static_assert|static assertion)}} failed{{.*}}traits_type::char_type must be the same type as CharT}} +// expected-error@ostream:* {{only virtual member functions can be marked 'override'}} return 0; } diff --git a/libcxx/test/libcxx/input.output/string.streams/traits_mismatch.fail.cpp b/libcxx/test/libcxx/input.output/string.streams/traits_mismatch.fail.cpp --- a/libcxx/test/libcxx/input.output/string.streams/traits_mismatch.fail.cpp +++ b/libcxx/test/libcxx/input.output/string.streams/traits_mismatch.fail.cpp @@ -24,5 +24,11 @@ // expected-error-re@streambuf:* {{{{(static_assert|static assertion)}} failed{{.*}}traits_type::char_type must be the same type as CharT}} // expected-error-re@string:* {{{{(static_assert|static assertion)}} failed{{.*}}traits_type::char_type must be the same type as CharT}} + // expected-error@sstream:* {{only virtual member functions can be marked 'override'}} + // expected-error@sstream:* {{only virtual member functions can be marked 'override'}} + // expected-error@sstream:* {{only virtual member functions can be marked 'override'}} + // expected-error@sstream:* {{only virtual member functions can be marked 'override'}} + // expected-error@sstream:* {{only virtual member functions can be marked 'override'}} + return 0; }