From 71ec8b688540d1a998b864b7a00c816a5821de90 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Wed, 9 Nov 2022 07:32:20 +0700 Subject: [PATCH] beautify tidy comments --- .clang-tidy | 6 - headers/meta.hpp/meta_base/fixed_function.hpp | 17 +- headers/meta.hpp/meta_base/hash_combiner.hpp | 2 +- headers/meta.hpp/meta_base/type_id.hpp | 1 - headers/meta.hpp/meta_binds/class_bind.hpp | 2 + headers/meta.hpp/meta_binds/scope_bind.hpp | 3 +- .../meta_detail/value_traits/index_traits.hpp | 2 + .../meta_detail/value_utilities/uarg.hpp | 16 +- .../meta_detail/value_utilities/uinst.hpp | 12 +- .../meta_detail/value_utilities/utraits.hpp | 2 +- headers/meta.hpp/meta_registry.hpp | 2 - headers/meta.hpp/meta_states/constructor.hpp | 3 - headers/meta.hpp/meta_states/function.hpp | 3 - headers/meta.hpp/meta_states/method.hpp | 3 - headers/meta.hpp/meta_types/any_type.hpp | 26 +-- headers/meta.hpp/meta_types/array_type.hpp | 1 - headers/meta.hpp/meta_types/class_type.hpp | 3 +- .../meta.hpp/meta_types/constructor_type.hpp | 1 - .../meta.hpp/meta_types/destructor_type.hpp | 1 - headers/meta.hpp/meta_types/enum_type.hpp | 1 - headers/meta.hpp/meta_types/function_type.hpp | 1 - headers/meta.hpp/meta_types/member_type.hpp | 1 - headers/meta.hpp/meta_types/method_type.hpp | 1 - headers/meta.hpp/meta_types/nullptr_type.hpp | 1 - headers/meta.hpp/meta_types/number_type.hpp | 1 - headers/meta.hpp/meta_types/pointer_type.hpp | 1 - .../meta.hpp/meta_types/reference_type.hpp | 1 - headers/meta.hpp/meta_types/void_type.hpp | 1 - headers/meta.hpp/meta_uvalue.hpp | 1 + headers/meta.hpp/meta_uvalue/uvalue.hpp | 17 +- singles/headers/meta.hpp/meta_all.hpp | 219 ++++++++---------- untests/meta_utilities/arg_tests.cpp | 4 +- untests/meta_utilities/inst_tests.cpp | 4 +- 33 files changed, 163 insertions(+), 197 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 271fe9f..923b0e8 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -3,8 +3,6 @@ Checks: '-*, bugprone-*, -bugprone-easily-swappable-parameters, - -bugprone-forwarding-reference-overload, - -bugprone-lambda-function-name, -bugprone-macro-parentheses, clang-analyzer-*, @@ -13,8 +11,6 @@ Checks: '-*, cppcoreguidelines-*, -cppcoreguidelines-macro-usage, - -cppcoreguidelines-pro-bounds-array-to-pointer-decay, - -cppcoreguidelines-pro-bounds-pointer-arithmetic, modernize-*, -modernize-use-trailing-return-type, @@ -27,7 +23,5 @@ Checks: '-*, -readability-identifier-length, -readability-named-parameter, -readability-redundant-access-specifiers, - -readability-simplify-boolean-expr, - -readability-use-anyofallof, ' ... diff --git a/headers/meta.hpp/meta_base/fixed_function.hpp b/headers/meta.hpp/meta_base/fixed_function.hpp index e891b0f..4c515c2 100644 --- a/headers/meta.hpp/meta_base/fixed_function.hpp +++ b/headers/meta.hpp/meta_base/fixed_function.hpp @@ -13,6 +13,8 @@ #include #include +#include "stdex.hpp" + namespace meta_hpp::detail { template < typename Function > @@ -43,11 +45,14 @@ namespace meta_hpp::detail } template < typename Functor > + requires (!stdex::same_as>) + // NOLINTNEXTLINE(*-forwarding-reference-overload) fixed_function(Functor&& functor) { vtable_t::construct(*this, std::forward(functor)); } template < typename Functor > + requires (!stdex::same_as>) fixed_function& operator=(Functor&& functor) { fixed_function{std::forward(functor)}.swap(*this); return *this; @@ -62,7 +67,7 @@ namespace meta_hpp::detail } R operator()(Args... args) const { - assert(vtable_ && "bad function call"); + assert(vtable_ && "bad function call"); // NOLINT return vtable_->call(*this, std::forward(args)...); } @@ -101,13 +106,13 @@ namespace meta_hpp::detail template < typename T > static T* buffer_cast(buffer_t& buffer) noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) + // NOLINTNEXTLINE(*-reinterpret-cast) return std::launder(reinterpret_cast(buffer.data)); } template < typename T > static const T* buffer_cast(const buffer_t& buffer) noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) + // NOLINTNEXTLINE(*-reinterpret-cast) return std::launder(reinterpret_cast(buffer.data)); } @@ -115,13 +120,13 @@ namespace meta_hpp::detail static vtable_t* get() { static vtable_t table{ .call = +[](const fixed_function& self, Args... args) -> R { - assert(self); + assert(self); // NOLINT const Fp& src = *buffer_cast(self.buffer_); return std::invoke(src, std::forward(args)...); }, .move = +[](fixed_function& from, fixed_function& to) noexcept { - assert(from && !to); + assert(from && !to); // NOLINT Fp& src = *buffer_cast(from.buffer_); ::new (buffer_cast(to.buffer_)) Fp(std::move(src)); @@ -131,7 +136,7 @@ namespace meta_hpp::detail from.vtable_ = nullptr; }, .destroy = +[](fixed_function& self){ - assert(self); + assert(self); // NOLINT Fp& src = *buffer_cast(self.buffer_); src.~Fp(); diff --git a/headers/meta.hpp/meta_base/hash_combiner.hpp b/headers/meta.hpp/meta_base/hash_combiner.hpp index 01f7ee6..e228c45 100644 --- a/headers/meta.hpp/meta_base/hash_combiner.hpp +++ b/headers/meta.hpp/meta_base/hash_combiner.hpp @@ -19,7 +19,7 @@ namespace meta_hpp::detail template < typename T > [[nodiscard]] std::size_t operator()(std::size_t seed, const T& x) noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers, readability-magic-numbers) + // NOLINTNEXTLINE(*-magic-numbers) return (seed ^= std::hash{}(x) + 0x9e3779b9 + (seed << 6) + (seed >> 2)); } }; diff --git a/headers/meta.hpp/meta_base/type_id.hpp b/headers/meta.hpp/meta_base/type_id.hpp index 8f6f793..ddcfe97 100644 --- a/headers/meta.hpp/meta_base/type_id.hpp +++ b/headers/meta.hpp/meta_base/type_id.hpp @@ -17,7 +17,6 @@ namespace meta_hpp::detail class type_id final { public: template < typename T > - // NOLINTNEXTLINE(readability-named-parameter) explicit type_id(type_list) noexcept : id_{type_to_id()} {} diff --git a/headers/meta.hpp/meta_binds/class_bind.hpp b/headers/meta.hpp/meta_binds/class_bind.hpp index 9fddbd7..9a44fb6 100644 --- a/headers/meta.hpp/meta_binds/class_bind.hpp +++ b/headers/meta.hpp/meta_binds/class_bind.hpp @@ -163,6 +163,7 @@ namespace meta_hpp for ( std::size_t i = 0; i < arguments.size(); ++i ) { argument& arg = state->arguments[i]; + // NOLINTNEXTLINE(*-pointer-arithmetic) detail::state_access(arg)->name = std::data(arguments)[i]; } @@ -265,6 +266,7 @@ namespace meta_hpp for ( std::size_t i = 0; i < arguments.size(); ++i ) { argument& arg = state->arguments[i]; + // NOLINTNEXTLINE(*-pointer-arithmetic) detail::state_access(arg)->name = std::data(arguments)[i]; } diff --git a/headers/meta.hpp/meta_binds/scope_bind.hpp b/headers/meta.hpp/meta_binds/scope_bind.hpp index 4db401c..4925997 100644 --- a/headers/meta.hpp/meta_binds/scope_bind.hpp +++ b/headers/meta.hpp/meta_binds/scope_bind.hpp @@ -12,11 +12,9 @@ namespace meta_hpp { - // NOLINTNEXTLINE(readability-named-parameter) inline scope_bind::scope_bind(std::string name, metadata_map metadata, local_tag) : state_{detail::scope_state::make(std::move(name), std::move(metadata))} {} - // NOLINTNEXTLINE(readability-named-parameter) inline scope_bind::scope_bind(std::string_view name, metadata_map metadata, static_tag) : state_{detail::state_access(resolve_scope(name))} { state_->metadata.swap(metadata); @@ -84,6 +82,7 @@ namespace meta_hpp for ( std::size_t i = 0; i < arguments.size(); ++i ) { argument& arg = state->arguments[i]; + // NOLINTNEXTLINE(*-pointer-arithmetic) detail::state_access(arg)->name = std::data(arguments)[i]; } diff --git a/headers/meta.hpp/meta_detail/value_traits/index_traits.hpp b/headers/meta.hpp/meta_detail/value_traits/index_traits.hpp index fc7894b..98c9ef2 100644 --- a/headers/meta.hpp/meta_detail/value_traits/index_traits.hpp +++ b/headers/meta.hpp/meta_detail/value_traits/index_traits.hpp @@ -25,6 +25,7 @@ namespace meta_hpp::detail template < stdex::copy_constructible T > struct index_traits { uvalue operator()(T* v, std::size_t i) const { + // NOLINTNEXTLINE(*-pointer-arithmetic) return uvalue{v[i]}; } }; @@ -32,6 +33,7 @@ namespace meta_hpp::detail template < stdex::copy_constructible T > struct index_traits { uvalue operator()(const T* v, std::size_t i) const { + // NOLINTNEXTLINE(*-pointer-arithmetic) return uvalue{v[i]}; } }; diff --git a/headers/meta.hpp/meta_detail/value_utilities/uarg.hpp b/headers/meta.hpp/meta_detail/value_utilities/uarg.hpp index 4b9d583..46dfff0 100644 --- a/headers/meta.hpp/meta_detail/value_utilities/uarg.hpp +++ b/headers/meta.hpp/meta_detail/value_utilities/uarg.hpp @@ -33,17 +33,16 @@ namespace meta_hpp::detail virtual ~uarg_base() = default; template < decay_value_kind T > - // NOLINTNEXTLINE(readability-named-parameter) + // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uarg_base(T&&) : uarg_base{type_list{}} {} template < decay_non_uvalue_kind T > - // NOLINTNEXTLINE(readability-named-parameter) + // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uarg_base(T&&) : uarg_base{type_list{}} {} template < arg_lvalue_ref_kind T > - // NOLINTNEXTLINE(readability-named-parameter) explicit uarg_base(type_list) : ref_type_{std::is_const_v> ? ref_types::const_lvalue @@ -51,7 +50,6 @@ namespace meta_hpp::detail , raw_type_{resolve_type>()} {} template < arg_rvalue_ref_kind T > - // NOLINTNEXTLINE(readability-named-parameter) explicit uarg_base(type_list) : ref_type_{std::is_const_v> ? ref_types::const_rvalue @@ -120,15 +118,17 @@ namespace meta_hpp::detail ~uarg() override = default; template < decay_value_kind T > + // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uarg(T&& v) : uarg_base{std::forward(v)} - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast) + // NOLINTNEXTLINE(*-const-cast) , data_{const_cast(v.data())} {} template < decay_non_uvalue_kind T > + // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uarg(T&& v) : uarg_base{std::forward(v)} - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast) + // NOLINTNEXTLINE(*-const-cast) , data_{const_cast*>(std::addressof(v))} {} template < typename To > @@ -141,7 +141,7 @@ namespace meta_hpp::detail namespace meta_hpp::detail { template < typename To > - // NOLINTNEXTLINE(readability-function-cognitive-complexity) + // NOLINTNEXTLINE(*-cognitive-complexity) bool uarg_base::can_cast_to() const noexcept { using to_raw_type_cv = std::remove_reference_t; using to_raw_type = std::remove_cv_t; @@ -245,7 +245,7 @@ namespace meta_hpp::detail namespace meta_hpp::detail { template < typename To > - // NOLINTNEXTLINE(readability-function-cognitive-complexity) + // NOLINTNEXTLINE(*-cognitive-complexity) To uarg::cast() const { if ( !can_cast_to() ) { throw_exception_with("bad argument cast"); diff --git a/headers/meta.hpp/meta_detail/value_utilities/uinst.hpp b/headers/meta.hpp/meta_detail/value_utilities/uinst.hpp index d613ada..6ae886a 100644 --- a/headers/meta.hpp/meta_detail/value_utilities/uinst.hpp +++ b/headers/meta.hpp/meta_detail/value_utilities/uinst.hpp @@ -33,17 +33,16 @@ namespace meta_hpp::detail virtual ~uinst_base() = default; template < decay_value_kind T > - // NOLINTNEXTLINE(readability-named-parameter) + // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uinst_base(T&&) : uinst_base{type_list{}} {} template < decay_non_uvalue_kind T > - // NOLINTNEXTLINE(readability-named-parameter) + // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uinst_base(T&&) : uinst_base{type_list{}} {} template < inst_class_lvalue_ref_kind T > - // NOLINTNEXTLINE(readability-named-parameter) explicit uinst_base(type_list) : ref_type_{std::is_const_v> ? ref_types::const_lvalue @@ -51,7 +50,6 @@ namespace meta_hpp::detail , raw_type_{resolve_type>()} {} template < inst_class_rvalue_ref_kind T > - // NOLINTNEXTLINE(readability-named-parameter) explicit uinst_base(type_list) : ref_type_{std::is_const_v> ? ref_types::const_rvalue @@ -120,15 +118,17 @@ namespace meta_hpp::detail ~uinst() override = default; template < decay_value_kind T > + // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uinst(T&& v) : uinst_base{std::forward(v)} - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast) + // NOLINTNEXTLINE(*-const-cast) , data_{const_cast(v.data())} {} template < decay_non_uvalue_kind T > + // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uinst(T&& v) : uinst_base{std::forward(v)} - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast) + // NOLINTNEXTLINE(*-const-cast) , data_{const_cast*>(std::addressof(v))} {} template < inst_class_ref_kind Q > diff --git a/headers/meta.hpp/meta_detail/value_utilities/utraits.hpp b/headers/meta.hpp/meta_detail/value_utilities/utraits.hpp index 5e53c7b..a39b769 100644 --- a/headers/meta.hpp/meta_detail/value_utilities/utraits.hpp +++ b/headers/meta.hpp/meta_detail/value_utilities/utraits.hpp @@ -136,7 +136,7 @@ namespace meta_hpp::detail } [[nodiscard]] inline const void* pointer_upcast(const void* ptr, const class_type& from, const class_type& to) { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast) + // NOLINTNEXTLINE(*-const-cast) return pointer_upcast(const_cast(ptr), from, to); } diff --git a/headers/meta.hpp/meta_registry.hpp b/headers/meta.hpp/meta_registry.hpp index 882748f..615936b 100644 --- a/headers/meta.hpp/meta_registry.hpp +++ b/headers/meta.hpp/meta_registry.hpp @@ -31,13 +31,11 @@ namespace meta_hpp namespace meta_hpp { template < typename T > - // NOLINTNEXTLINE(readability-named-parameter) [[nodiscard]] auto resolve_type(T&&) { return resolve_type>(); } template < typename... Ts > - // NOLINTNEXTLINE(readability-named-parameter) [[nodiscard]] std::vector resolve_types(type_list) { return { resolve_type()... }; } diff --git a/headers/meta.hpp/meta_states/constructor.hpp b/headers/meta.hpp/meta_states/constructor.hpp index fee31b3..02f5241 100644 --- a/headers/meta.hpp/meta_states/constructor.hpp +++ b/headers/meta.hpp/meta_states/constructor.hpp @@ -36,7 +36,6 @@ namespace meta_hpp::detail throw_exception_with("an attempt to call a constructor with an incorrect arity"); } - // NOLINTNEXTLINE(readability-named-parameter) return [args](std::index_sequence) -> uvalue { if ( !(... && args[Is].can_cast_to>()) ) { throw_exception_with("an attempt to call a constructor with incorrect argument types"); @@ -68,7 +67,6 @@ namespace meta_hpp::detail return false; } - // NOLINTNEXTLINE(readability-named-parameter) return [args](std::index_sequence){ return (... && args[Is].can_cast_to>()); }(std::make_index_sequence()); @@ -94,7 +92,6 @@ namespace meta_hpp::detail argument_list arguments; arguments.reserve(ct::arity); - // NOLINTNEXTLINE(readability-named-parameter) [&arguments](std::index_sequence) mutable { (arguments.push_back([](){ using P = detail::type_list_at_t; diff --git a/headers/meta.hpp/meta_states/function.hpp b/headers/meta.hpp/meta_states/function.hpp index bb35a8d..285ed2a 100644 --- a/headers/meta.hpp/meta_states/function.hpp +++ b/headers/meta.hpp/meta_states/function.hpp @@ -38,7 +38,6 @@ namespace meta_hpp::detail throw_exception_with("an attempt to call a function with an incorrect arity"); } - // NOLINTNEXTLINE(readability-named-parameter) return [&function, args](std::index_sequence) -> uvalue { if ( !(... && args[Is].can_cast_to>()) ) { throw_exception_with("an attempt to call a function with incorrect argument types"); @@ -74,7 +73,6 @@ namespace meta_hpp::detail return false; } - // NOLINTNEXTLINE(readability-named-parameter) return [args](std::index_sequence){ return (... && args[Is].can_cast_to>()); }(std::make_index_sequence()); @@ -102,7 +100,6 @@ namespace meta_hpp::detail argument_list arguments; arguments.reserve(ft::arity); - // NOLINTNEXTLINE(readability-named-parameter) [&arguments](std::index_sequence) mutable { (arguments.push_back([](){ using P = detail::type_list_at_t; diff --git a/headers/meta.hpp/meta_states/method.hpp b/headers/meta.hpp/meta_states/method.hpp index c778210..cbd34c2 100644 --- a/headers/meta.hpp/meta_states/method.hpp +++ b/headers/meta.hpp/meta_states/method.hpp @@ -44,7 +44,6 @@ namespace meta_hpp::detail throw_exception_with("an attempt to call a method with an incorrect instance type"); } - // NOLINTNEXTLINE(readability-named-parameter) return [&method, &inst, args](std::index_sequence) -> uvalue { if ( !(... && args[Is].can_cast_to>()) ) { throw_exception_with("an attempt to call a method with incorrect argument types"); @@ -85,7 +84,6 @@ namespace meta_hpp::detail return false; } - // NOLINTNEXTLINE(readability-named-parameter) return [args](std::index_sequence){ return (... && args[Is].can_cast_to>()); }(std::make_index_sequence()); @@ -113,7 +111,6 @@ namespace meta_hpp::detail argument_list arguments; arguments.reserve(mt::arity); - // NOLINTNEXTLINE(readability-named-parameter) [&arguments](std::index_sequence) mutable { (arguments.push_back([](){ using P = detail::type_list_at_t; diff --git a/headers/meta.hpp/meta_types/any_type.hpp b/headers/meta.hpp/meta_types/any_type.hpp index 4f0a206..101b67c 100644 --- a/headers/meta.hpp/meta_types/any_type.hpp +++ b/headers/meta.hpp/meta_types/any_type.hpp @@ -123,67 +123,67 @@ namespace meta_hpp } inline array_type any_type::as_array() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_array() ? array_type{static_cast(data_)} : array_type{}; } inline class_type any_type::as_class() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_class() ? class_type{static_cast(data_)} : class_type{}; } inline constructor_type any_type::as_constructor() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_constructor() ? constructor_type{static_cast(data_)} : constructor_type{}; } inline destructor_type any_type::as_destructor() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_destructor() ? destructor_type{static_cast(data_)} : destructor_type{}; } inline enum_type any_type::as_enum() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_enum() ? enum_type{static_cast(data_)} : enum_type{}; } inline function_type any_type::as_function() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_function() ? function_type{static_cast(data_)} : function_type{}; } inline member_type any_type::as_member() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_member() ? member_type{static_cast(data_)} : member_type{}; } inline method_type any_type::as_method() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_method() ? method_type{static_cast(data_)} : method_type{}; } inline nullptr_type any_type::as_nullptr() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_nullptr() ? nullptr_type{static_cast(data_)} : nullptr_type{}; } inline number_type any_type::as_number() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_number() ? number_type{static_cast(data_)} : number_type{}; } inline pointer_type any_type::as_pointer() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_pointer() ? pointer_type{static_cast(data_)} : pointer_type{}; } inline reference_type any_type::as_reference() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_reference() ? reference_type{static_cast(data_)} : reference_type{}; } inline void_type any_type::as_void() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_void() ? void_type{static_cast(data_)} : void_type{}; } } diff --git a/headers/meta.hpp/meta_types/array_type.hpp b/headers/meta.hpp/meta_types/array_type.hpp index d7e5f1d..6314902 100644 --- a/headers/meta.hpp/meta_types/array_type.hpp +++ b/headers/meta.hpp/meta_types/array_type.hpp @@ -18,7 +18,6 @@ namespace meta_hpp::detail struct array_tag {}; template < array_kind Array > - // NOLINTNEXTLINE(readability-named-parameter) array_type_data::array_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::array_} , flags{array_traits::make_flags()} diff --git a/headers/meta.hpp/meta_types/class_type.hpp b/headers/meta.hpp/meta_types/class_type.hpp index f73f836..68d27e6 100644 --- a/headers/meta.hpp/meta_types/class_type.hpp +++ b/headers/meta.hpp/meta_types/class_type.hpp @@ -24,7 +24,6 @@ namespace meta_hpp::detail struct class_tag {}; template < class_kind Class > - // NOLINTNEXTLINE(readability-named-parameter) class_type_data::class_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::class_} , flags{class_traits::make_flags()} @@ -150,6 +149,7 @@ namespace meta_hpp return true; } + // NOLINTNEXTLINE(*-use-anyofallof) for ( auto&& derived_base : derived.data_->bases ) { if ( is_base_of(derived_base) ) { return true; @@ -173,6 +173,7 @@ namespace meta_hpp return true; } + // NOLINTNEXTLINE(*-use-anyofallof) for ( auto&& self_base : data_->bases ) { if ( self_base.is_derived_from(base) ) { return true; diff --git a/headers/meta.hpp/meta_types/constructor_type.hpp b/headers/meta.hpp/meta_types/constructor_type.hpp index 2da9e7b..185801a 100644 --- a/headers/meta.hpp/meta_types/constructor_type.hpp +++ b/headers/meta.hpp/meta_types/constructor_type.hpp @@ -18,7 +18,6 @@ namespace meta_hpp::detail struct constructor_tag {}; template < class_kind Class, typename... Args > - // NOLINTNEXTLINE(readability-named-parameter) constructor_type_data::constructor_type_data(type_list, type_list) : type_data_base{type_id{type_list>{}}, type_kind::constructor_} , flags{constructor_traits::make_flags()} diff --git a/headers/meta.hpp/meta_types/destructor_type.hpp b/headers/meta.hpp/meta_types/destructor_type.hpp index 5a0b510..2db3607 100644 --- a/headers/meta.hpp/meta_types/destructor_type.hpp +++ b/headers/meta.hpp/meta_types/destructor_type.hpp @@ -18,7 +18,6 @@ namespace meta_hpp::detail struct destructor_tag {}; template < class_kind Class > - // NOLINTNEXTLINE(readability-named-parameter) destructor_type_data::destructor_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::destructor_} , flags{destructor_traits::make_flags()} diff --git a/headers/meta.hpp/meta_types/enum_type.hpp b/headers/meta.hpp/meta_types/enum_type.hpp index 818064a..2bae019 100644 --- a/headers/meta.hpp/meta_types/enum_type.hpp +++ b/headers/meta.hpp/meta_types/enum_type.hpp @@ -21,7 +21,6 @@ namespace meta_hpp::detail struct enum_tag {}; template < enum_kind Enum > - // NOLINTNEXTLINE(readability-named-parameter) enum_type_data::enum_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::enum_} , flags{enum_traits::make_flags()} diff --git a/headers/meta.hpp/meta_types/function_type.hpp b/headers/meta.hpp/meta_types/function_type.hpp index b4bcbe2..4dd6eee 100644 --- a/headers/meta.hpp/meta_types/function_type.hpp +++ b/headers/meta.hpp/meta_types/function_type.hpp @@ -18,7 +18,6 @@ namespace meta_hpp::detail struct function_tag {}; template < function_kind Function > - // NOLINTNEXTLINE(readability-named-parameter) function_type_data::function_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::function_} , flags{function_traits::make_flags()} diff --git a/headers/meta.hpp/meta_types/member_type.hpp b/headers/meta.hpp/meta_types/member_type.hpp index 06b706c..9101786 100644 --- a/headers/meta.hpp/meta_types/member_type.hpp +++ b/headers/meta.hpp/meta_types/member_type.hpp @@ -18,7 +18,6 @@ namespace meta_hpp::detail struct member_tag {}; template < member_kind Member > - // NOLINTNEXTLINE(readability-named-parameter) member_type_data::member_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::member_} , flags{member_traits::make_flags()} diff --git a/headers/meta.hpp/meta_types/method_type.hpp b/headers/meta.hpp/meta_types/method_type.hpp index a9d86c7..1304827 100644 --- a/headers/meta.hpp/meta_types/method_type.hpp +++ b/headers/meta.hpp/meta_types/method_type.hpp @@ -18,7 +18,6 @@ namespace meta_hpp::detail struct method_tag {}; template < method_kind Method > - // NOLINTNEXTLINE(readability-named-parameter) method_type_data::method_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::method_} , flags{method_traits::make_flags()} diff --git a/headers/meta.hpp/meta_types/nullptr_type.hpp b/headers/meta.hpp/meta_types/nullptr_type.hpp index a2c7ddd..d9f911f 100644 --- a/headers/meta.hpp/meta_types/nullptr_type.hpp +++ b/headers/meta.hpp/meta_types/nullptr_type.hpp @@ -16,7 +16,6 @@ namespace meta_hpp::detail struct nullptr_tag {}; template < nullptr_kind Nullptr > - // NOLINTNEXTLINE(readability-named-parameter) nullptr_type_data::nullptr_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::nullptr_} {} } diff --git a/headers/meta.hpp/meta_types/number_type.hpp b/headers/meta.hpp/meta_types/number_type.hpp index 84fac25..8803e71 100644 --- a/headers/meta.hpp/meta_types/number_type.hpp +++ b/headers/meta.hpp/meta_types/number_type.hpp @@ -18,7 +18,6 @@ namespace meta_hpp::detail struct number_tag {}; template < number_kind Number > - // NOLINTNEXTLINE(readability-named-parameter) number_type_data::number_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::number_} , flags{number_traits::make_flags()} diff --git a/headers/meta.hpp/meta_types/pointer_type.hpp b/headers/meta.hpp/meta_types/pointer_type.hpp index 4964f6b..fce7a36 100644 --- a/headers/meta.hpp/meta_types/pointer_type.hpp +++ b/headers/meta.hpp/meta_types/pointer_type.hpp @@ -18,7 +18,6 @@ namespace meta_hpp::detail struct pointer_tag {}; template < pointer_kind Pointer > - // NOLINTNEXTLINE(readability-named-parameter) pointer_type_data::pointer_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::pointer_} , flags{pointer_traits::make_flags()} diff --git a/headers/meta.hpp/meta_types/reference_type.hpp b/headers/meta.hpp/meta_types/reference_type.hpp index 60fd331..31fea5d 100644 --- a/headers/meta.hpp/meta_types/reference_type.hpp +++ b/headers/meta.hpp/meta_types/reference_type.hpp @@ -18,7 +18,6 @@ namespace meta_hpp::detail struct reference_tag {}; template < reference_kind Reference > - // NOLINTNEXTLINE(readability-named-parameter) reference_type_data::reference_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::reference_} , flags{reference_traits::make_flags()} diff --git a/headers/meta.hpp/meta_types/void_type.hpp b/headers/meta.hpp/meta_types/void_type.hpp index 859ca4e..b4a22d2 100644 --- a/headers/meta.hpp/meta_types/void_type.hpp +++ b/headers/meta.hpp/meta_types/void_type.hpp @@ -16,7 +16,6 @@ namespace meta_hpp::detail struct void_tag {}; template < void_kind Void > - // NOLINTNEXTLINE(readability-named-parameter) void_type_data::void_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::void_} {} } diff --git a/headers/meta.hpp/meta_uvalue.hpp b/headers/meta.hpp/meta_uvalue.hpp index e4600e9..85e941f 100644 --- a/headers/meta.hpp/meta_uvalue.hpp +++ b/headers/meta.hpp/meta_uvalue.hpp @@ -39,6 +39,7 @@ namespace meta_hpp template < detail::decay_non_value_kind T > requires stdex::copy_constructible> + // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uvalue(T&& val); template < detail::decay_non_value_kind T > diff --git a/headers/meta.hpp/meta_uvalue/uvalue.hpp b/headers/meta.hpp/meta_uvalue/uvalue.hpp index 0b8f693..79b58db 100644 --- a/headers/meta.hpp/meta_uvalue/uvalue.hpp +++ b/headers/meta.hpp/meta_uvalue/uvalue.hpp @@ -42,13 +42,13 @@ namespace meta_hpp template < typename T > static T* buffer_cast(buffer_t& buffer) noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) + // NOLINTNEXTLINE(*-reinterpret-cast) return std::launder(reinterpret_cast(buffer.data)); } template < typename T > static const T* buffer_cast(const buffer_t& buffer) noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) + // NOLINTNEXTLINE(*-reinterpret-cast) return std::launder(reinterpret_cast(buffer.data)); } @@ -115,7 +115,7 @@ namespace meta_hpp } template < typename Tp > - // NOLINTNEXTLINE(readability-function-cognitive-complexity) + // NOLINTNEXTLINE(*-cognitive-complexity) static vtable_t* get() { static vtable_t table{ .type = resolve_type(), @@ -129,7 +129,7 @@ namespace meta_hpp }, .move = [](uvalue& from, uvalue& to) noexcept { - assert(from && !to); + assert(from && !to); // NOLINT std::visit(detail::overloaded { [&to](void* ptr) { @@ -149,7 +149,7 @@ namespace meta_hpp }, .copy = [](const uvalue& from, uvalue& to){ - assert(from && !to); + assert(from && !to); // NOLINT std::visit(detail::overloaded { [&to](void* ptr) { @@ -167,7 +167,7 @@ namespace meta_hpp }, .destroy = [](uvalue& self) noexcept { - assert(self); + assert(self); // NOLINT std::visit(detail::overloaded { [](void* ptr) { @@ -272,6 +272,7 @@ namespace meta_hpp template < detail::decay_non_value_kind T > requires stdex::copy_constructible> + // NOLINTNEXTLINE(*-forwarding-reference-overload) uvalue::uvalue(T&& val) { vtable_t::construct(*this, std::forward(val)); } @@ -361,7 +362,7 @@ namespace meta_hpp } template < typename T > - // NOLINTNEXTLINE(*-function-cognitive-complexity) + // NOLINTNEXTLINE(*-cognitive-complexity) auto uvalue::try_get_as() noexcept -> std::conditional_t, T, T*> { static_assert(std::is_same_v>); @@ -426,7 +427,7 @@ namespace meta_hpp } template < typename T > - // NOLINTNEXTLINE(*-function-cognitive-complexity) + // NOLINTNEXTLINE(*-cognitive-complexity) auto uvalue::try_get_as() const noexcept -> std::conditional_t, T, const T*> { static_assert(std::is_same_v>); diff --git a/singles/headers/meta.hpp/meta_all.hpp b/singles/headers/meta.hpp/meta_all.hpp index ba64639..4333872 100644 --- a/singles/headers/meta.hpp/meta_all.hpp +++ b/singles/headers/meta.hpp/meta_all.hpp @@ -270,6 +270,53 @@ namespace meta_hpp::detail using copy_cvref_t = typename copy_cvref::type; } +namespace meta_hpp::stdex +{ + template < typename T, typename U > + concept same_as = + std::is_same_v && + std::is_same_v; + + template < typename Derived, typename Base > + concept derived_from = + std::is_base_of_v && + std::is_convertible_v; + + template < typename From, typename To > + concept convertible_to = + std::is_convertible_v && + requires { static_cast(std::declval()); }; + + template < typename T > + concept destructible = + std::is_nothrow_destructible_v; + + template < typename T, typename... Args > + concept constructible_from = + destructible && + std::is_constructible_v; + + template < typename T > + concept move_constructible = + constructible_from && + convertible_to; + + template + concept copy_constructible = + move_constructible && + constructible_from && convertible_to && + constructible_from && convertible_to && + constructible_from && convertible_to; +} + +namespace meta_hpp::stdex +{ + template < typename Enum > + [[nodiscard]] constexpr std::underlying_type_t to_underlying(Enum e) noexcept { + return static_cast>(e); + } +} + namespace meta_hpp::detail { template < typename Function > @@ -300,11 +347,14 @@ namespace meta_hpp::detail } template < typename Functor > + requires (!stdex::same_as>) + // NOLINTNEXTLINE(*-forwarding-reference-overload) fixed_function(Functor&& functor) { vtable_t::construct(*this, std::forward(functor)); } template < typename Functor > + requires (!stdex::same_as>) fixed_function& operator=(Functor&& functor) { fixed_function{std::forward(functor)}.swap(*this); return *this; @@ -319,7 +369,7 @@ namespace meta_hpp::detail } R operator()(Args... args) const { - assert(vtable_ && "bad function call"); + assert(vtable_ && "bad function call"); // NOLINT return vtable_->call(*this, std::forward(args)...); } @@ -358,13 +408,13 @@ namespace meta_hpp::detail template < typename T > static T* buffer_cast(buffer_t& buffer) noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) + // NOLINTNEXTLINE(*-reinterpret-cast) return std::launder(reinterpret_cast(buffer.data)); } template < typename T > static const T* buffer_cast(const buffer_t& buffer) noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) + // NOLINTNEXTLINE(*-reinterpret-cast) return std::launder(reinterpret_cast(buffer.data)); } @@ -372,13 +422,13 @@ namespace meta_hpp::detail static vtable_t* get() { static vtable_t table{ .call = +[](const fixed_function& self, Args... args) -> R { - assert(self); + assert(self); // NOLINT const Fp& src = *buffer_cast(self.buffer_); return std::invoke(src, std::forward(args)...); }, .move = +[](fixed_function& from, fixed_function& to) noexcept { - assert(from && !to); + assert(from && !to); // NOLINT Fp& src = *buffer_cast(from.buffer_); ::new (buffer_cast(to.buffer_)) Fp(std::move(src)); @@ -388,7 +438,7 @@ namespace meta_hpp::detail from.vtable_ = nullptr; }, .destroy = +[](fixed_function& self){ - assert(self); + assert(self); // NOLINT Fp& src = *buffer_cast(self.buffer_); src.~Fp(); @@ -481,7 +531,7 @@ namespace meta_hpp::detail template < typename T > [[nodiscard]] std::size_t operator()(std::size_t seed, const T& x) noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers, readability-magic-numbers) + // NOLINTNEXTLINE(*-magic-numbers) return (seed ^= std::hash{}(x) + 0x9e3779b9 + (seed << 6) + (seed >> 2)); } }; @@ -545,53 +595,6 @@ namespace meta_hpp::detail } } -namespace meta_hpp::stdex -{ - template < typename T, typename U > - concept same_as = - std::is_same_v && - std::is_same_v; - - template < typename Derived, typename Base > - concept derived_from = - std::is_base_of_v && - std::is_convertible_v; - - template < typename From, typename To > - concept convertible_to = - std::is_convertible_v && - requires { static_cast(std::declval()); }; - - template < typename T > - concept destructible = - std::is_nothrow_destructible_v; - - template < typename T, typename... Args > - concept constructible_from = - destructible && - std::is_constructible_v; - - template < typename T > - concept move_constructible = - constructible_from && - convertible_to; - - template - concept copy_constructible = - move_constructible && - constructible_from && convertible_to && - constructible_from && convertible_to && - constructible_from && convertible_to; -} - -namespace meta_hpp::stdex -{ - template < typename Enum > - [[nodiscard]] constexpr std::underlying_type_t to_underlying(Enum e) noexcept { - return static_cast>(e); - } -} - namespace meta_hpp::detail { template < typename... Types > @@ -614,7 +617,6 @@ namespace meta_hpp::detail class type_id final { public: template < typename T > - // NOLINTNEXTLINE(readability-named-parameter) explicit type_id(type_list) noexcept : id_{type_to_id()} {} @@ -2241,6 +2243,7 @@ namespace meta_hpp template < detail::decay_non_value_kind T > requires stdex::copy_constructible> + // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uvalue(T&& val); template < detail::decay_non_value_kind T > @@ -3606,13 +3609,11 @@ namespace meta_hpp namespace meta_hpp { template < typename T > - // NOLINTNEXTLINE(readability-named-parameter) [[nodiscard]] auto resolve_type(T&&) { return resolve_type>(); } template < typename... Ts > - // NOLINTNEXTLINE(readability-named-parameter) [[nodiscard]] std::vector resolve_types(type_list) { return { resolve_type()... }; } @@ -3827,6 +3828,7 @@ namespace meta_hpp for ( std::size_t i = 0; i < arguments.size(); ++i ) { argument& arg = state->arguments[i]; + // NOLINTNEXTLINE(*-pointer-arithmetic) detail::state_access(arg)->name = std::data(arguments)[i]; } @@ -3929,6 +3931,7 @@ namespace meta_hpp for ( std::size_t i = 0; i < arguments.size(); ++i ) { argument& arg = state->arguments[i]; + // NOLINTNEXTLINE(*-pointer-arithmetic) detail::state_access(arg)->name = std::data(arguments)[i]; } @@ -4115,11 +4118,9 @@ namespace meta_hpp namespace meta_hpp { - // NOLINTNEXTLINE(readability-named-parameter) inline scope_bind::scope_bind(std::string name, metadata_map metadata, local_tag) : state_{detail::scope_state::make(std::move(name), std::move(metadata))} {} - // NOLINTNEXTLINE(readability-named-parameter) inline scope_bind::scope_bind(std::string_view name, metadata_map metadata, static_tag) : state_{detail::state_access(resolve_scope(name))} { state_->metadata.swap(metadata); @@ -4187,6 +4188,7 @@ namespace meta_hpp for ( std::size_t i = 0; i < arguments.size(); ++i ) { argument& arg = state->arguments[i]; + // NOLINTNEXTLINE(*-pointer-arithmetic) detail::state_access(arg)->name = std::data(arguments)[i]; } @@ -4577,7 +4579,6 @@ namespace meta_hpp::detail struct constructor_tag {}; template < class_kind Class, typename... Args > - // NOLINTNEXTLINE(readability-named-parameter) constructor_type_data::constructor_type_data(type_list, type_list) : type_data_base{type_id{type_list>{}}, type_kind::constructor_} , flags{constructor_traits::make_flags()} @@ -4754,7 +4755,7 @@ namespace meta_hpp::detail } [[nodiscard]] inline const void* pointer_upcast(const void* ptr, const class_type& from, const class_type& to) { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast) + // NOLINTNEXTLINE(*-const-cast) return pointer_upcast(const_cast(ptr), from, to); } @@ -4791,17 +4792,16 @@ namespace meta_hpp::detail virtual ~uarg_base() = default; template < decay_value_kind T > - // NOLINTNEXTLINE(readability-named-parameter) + // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uarg_base(T&&) : uarg_base{type_list{}} {} template < decay_non_uvalue_kind T > - // NOLINTNEXTLINE(readability-named-parameter) + // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uarg_base(T&&) : uarg_base{type_list{}} {} template < arg_lvalue_ref_kind T > - // NOLINTNEXTLINE(readability-named-parameter) explicit uarg_base(type_list) : ref_type_{std::is_const_v> ? ref_types::const_lvalue @@ -4809,7 +4809,6 @@ namespace meta_hpp::detail , raw_type_{resolve_type>()} {} template < arg_rvalue_ref_kind T > - // NOLINTNEXTLINE(readability-named-parameter) explicit uarg_base(type_list) : ref_type_{std::is_const_v> ? ref_types::const_rvalue @@ -4878,15 +4877,17 @@ namespace meta_hpp::detail ~uarg() override = default; template < decay_value_kind T > + // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uarg(T&& v) : uarg_base{std::forward(v)} - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast) + // NOLINTNEXTLINE(*-const-cast) , data_{const_cast(v.data())} {} template < decay_non_uvalue_kind T > + // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uarg(T&& v) : uarg_base{std::forward(v)} - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast) + // NOLINTNEXTLINE(*-const-cast) , data_{const_cast*>(std::addressof(v))} {} template < typename To > @@ -4899,7 +4900,7 @@ namespace meta_hpp::detail namespace meta_hpp::detail { template < typename To > - // NOLINTNEXTLINE(readability-function-cognitive-complexity) + // NOLINTNEXTLINE(*-cognitive-complexity) bool uarg_base::can_cast_to() const noexcept { using to_raw_type_cv = std::remove_reference_t; using to_raw_type = std::remove_cv_t; @@ -5003,7 +5004,7 @@ namespace meta_hpp::detail namespace meta_hpp::detail { template < typename To > - // NOLINTNEXTLINE(readability-function-cognitive-complexity) + // NOLINTNEXTLINE(*-cognitive-complexity) To uarg::cast() const { if ( !can_cast_to() ) { throw_exception_with("bad argument cast"); @@ -5144,7 +5145,6 @@ namespace meta_hpp::detail throw_exception_with("an attempt to call a constructor with an incorrect arity"); } - // NOLINTNEXTLINE(readability-named-parameter) return [args](std::index_sequence) -> uvalue { if ( !(... && args[Is].can_cast_to>()) ) { throw_exception_with("an attempt to call a constructor with incorrect argument types"); @@ -5176,7 +5176,6 @@ namespace meta_hpp::detail return false; } - // NOLINTNEXTLINE(readability-named-parameter) return [args](std::index_sequence){ return (... && args[Is].can_cast_to>()); }(std::make_index_sequence()); @@ -5202,7 +5201,6 @@ namespace meta_hpp::detail argument_list arguments; arguments.reserve(ct::arity); - // NOLINTNEXTLINE(readability-named-parameter) [&arguments](std::index_sequence) mutable { (arguments.push_back([](){ using P = detail::type_list_at_t; @@ -5311,7 +5309,6 @@ namespace meta_hpp::detail struct destructor_tag {}; template < class_kind Class > - // NOLINTNEXTLINE(readability-named-parameter) destructor_type_data::destructor_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::destructor_} , flags{destructor_traits::make_flags()} @@ -5463,7 +5460,6 @@ namespace meta_hpp::detail struct enum_tag {}; template < enum_kind Enum > - // NOLINTNEXTLINE(readability-named-parameter) enum_type_data::enum_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::enum_} , flags{enum_traits::make_flags()} @@ -5600,7 +5596,6 @@ namespace meta_hpp::detail struct function_tag {}; template < function_kind Function > - // NOLINTNEXTLINE(readability-named-parameter) function_type_data::function_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::function_} , flags{function_traits::make_flags()} @@ -5676,7 +5671,6 @@ namespace meta_hpp::detail throw_exception_with("an attempt to call a function with an incorrect arity"); } - // NOLINTNEXTLINE(readability-named-parameter) return [&function, args](std::index_sequence) -> uvalue { if ( !(... && args[Is].can_cast_to>()) ) { throw_exception_with("an attempt to call a function with incorrect argument types"); @@ -5712,7 +5706,6 @@ namespace meta_hpp::detail return false; } - // NOLINTNEXTLINE(readability-named-parameter) return [args](std::index_sequence){ return (... && args[Is].can_cast_to>()); }(std::make_index_sequence()); @@ -5740,7 +5733,6 @@ namespace meta_hpp::detail argument_list arguments; arguments.reserve(ft::arity); - // NOLINTNEXTLINE(readability-named-parameter) [&arguments](std::index_sequence) mutable { (arguments.push_back([](){ using P = detail::type_list_at_t; @@ -5853,7 +5845,6 @@ namespace meta_hpp::detail struct member_tag {}; template < member_kind Member > - // NOLINTNEXTLINE(readability-named-parameter) member_type_data::member_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::member_} , flags{member_traits::make_flags()} @@ -5917,17 +5908,16 @@ namespace meta_hpp::detail virtual ~uinst_base() = default; template < decay_value_kind T > - // NOLINTNEXTLINE(readability-named-parameter) + // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uinst_base(T&&) : uinst_base{type_list{}} {} template < decay_non_uvalue_kind T > - // NOLINTNEXTLINE(readability-named-parameter) + // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uinst_base(T&&) : uinst_base{type_list{}} {} template < inst_class_lvalue_ref_kind T > - // NOLINTNEXTLINE(readability-named-parameter) explicit uinst_base(type_list) : ref_type_{std::is_const_v> ? ref_types::const_lvalue @@ -5935,7 +5925,6 @@ namespace meta_hpp::detail , raw_type_{resolve_type>()} {} template < inst_class_rvalue_ref_kind T > - // NOLINTNEXTLINE(readability-named-parameter) explicit uinst_base(type_list) : ref_type_{std::is_const_v> ? ref_types::const_rvalue @@ -6004,15 +5993,17 @@ namespace meta_hpp::detail ~uinst() override = default; template < decay_value_kind T > + // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uinst(T&& v) : uinst_base{std::forward(v)} - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast) + // NOLINTNEXTLINE(*-const-cast) , data_{const_cast(v.data())} {} template < decay_non_uvalue_kind T > + // NOLINTNEXTLINE(*-forwarding-reference-overload) explicit uinst(T&& v) : uinst_base{std::forward(v)} - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast) + // NOLINTNEXTLINE(*-const-cast) , data_{const_cast*>(std::addressof(v))} {} template < inst_class_ref_kind Q > @@ -6334,7 +6325,6 @@ namespace meta_hpp::detail struct method_tag {}; template < method_kind Method > - // NOLINTNEXTLINE(readability-named-parameter) method_type_data::method_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::method_} , flags{method_traits::make_flags()} @@ -6420,7 +6410,6 @@ namespace meta_hpp::detail throw_exception_with("an attempt to call a method with an incorrect instance type"); } - // NOLINTNEXTLINE(readability-named-parameter) return [&method, &inst, args](std::index_sequence) -> uvalue { if ( !(... && args[Is].can_cast_to>()) ) { throw_exception_with("an attempt to call a method with incorrect argument types"); @@ -6461,7 +6450,6 @@ namespace meta_hpp::detail return false; } - // NOLINTNEXTLINE(readability-named-parameter) return [args](std::index_sequence){ return (... && args[Is].can_cast_to>()); }(std::make_index_sequence()); @@ -6489,7 +6477,6 @@ namespace meta_hpp::detail argument_list arguments; arguments.reserve(mt::arity); - // NOLINTNEXTLINE(readability-named-parameter) [&arguments](std::index_sequence) mutable { (arguments.push_back([](){ using P = detail::type_list_at_t; @@ -6605,7 +6592,6 @@ namespace meta_hpp::detail struct pointer_tag {}; template < pointer_kind Pointer > - // NOLINTNEXTLINE(readability-named-parameter) pointer_type_data::pointer_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::pointer_} , flags{pointer_traits::make_flags()} @@ -6812,7 +6798,6 @@ namespace meta_hpp::detail struct class_tag {}; template < class_kind Class > - // NOLINTNEXTLINE(readability-named-parameter) class_type_data::class_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::class_} , flags{class_traits::make_flags()} @@ -6938,6 +6923,7 @@ namespace meta_hpp return true; } + // NOLINTNEXTLINE(*-use-anyofallof) for ( auto&& derived_base : derived.data_->bases ) { if ( is_base_of(derived_base) ) { return true; @@ -6961,6 +6947,7 @@ namespace meta_hpp return true; } + // NOLINTNEXTLINE(*-use-anyofallof) for ( auto&& self_base : data_->bases ) { if ( self_base.is_derived_from(base) ) { return true; @@ -7379,67 +7366,67 @@ namespace meta_hpp } inline array_type any_type::as_array() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_array() ? array_type{static_cast(data_)} : array_type{}; } inline class_type any_type::as_class() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_class() ? class_type{static_cast(data_)} : class_type{}; } inline constructor_type any_type::as_constructor() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_constructor() ? constructor_type{static_cast(data_)} : constructor_type{}; } inline destructor_type any_type::as_destructor() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_destructor() ? destructor_type{static_cast(data_)} : destructor_type{}; } inline enum_type any_type::as_enum() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_enum() ? enum_type{static_cast(data_)} : enum_type{}; } inline function_type any_type::as_function() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_function() ? function_type{static_cast(data_)} : function_type{}; } inline member_type any_type::as_member() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_member() ? member_type{static_cast(data_)} : member_type{}; } inline method_type any_type::as_method() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_method() ? method_type{static_cast(data_)} : method_type{}; } inline nullptr_type any_type::as_nullptr() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_nullptr() ? nullptr_type{static_cast(data_)} : nullptr_type{}; } inline number_type any_type::as_number() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_number() ? number_type{static_cast(data_)} : number_type{}; } inline pointer_type any_type::as_pointer() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_pointer() ? pointer_type{static_cast(data_)} : pointer_type{}; } inline reference_type any_type::as_reference() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_reference() ? reference_type{static_cast(data_)} : reference_type{}; } inline void_type any_type::as_void() const noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + // NOLINTNEXTLINE(*-static-cast-downcast) return is_void() ? void_type{static_cast(data_)} : void_type{}; } } @@ -7450,7 +7437,6 @@ namespace meta_hpp::detail struct array_tag {}; template < array_kind Array > - // NOLINTNEXTLINE(readability-named-parameter) array_type_data::array_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::array_} , flags{array_traits::make_flags()} @@ -7498,7 +7484,6 @@ namespace meta_hpp::detail struct nullptr_tag {}; template < nullptr_kind Nullptr > - // NOLINTNEXTLINE(readability-named-parameter) nullptr_type_data::nullptr_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::nullptr_} {} } @@ -7531,7 +7516,6 @@ namespace meta_hpp::detail struct number_tag {}; template < number_kind Number > - // NOLINTNEXTLINE(readability-named-parameter) number_type_data::number_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::number_} , flags{number_traits::make_flags()} @@ -7579,7 +7563,6 @@ namespace meta_hpp::detail struct reference_tag {}; template < reference_kind Reference > - // NOLINTNEXTLINE(readability-named-parameter) reference_type_data::reference_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::reference_} , flags{reference_traits::make_flags()} @@ -7622,7 +7605,6 @@ namespace meta_hpp::detail struct void_tag {}; template < void_kind Void > - // NOLINTNEXTLINE(readability-named-parameter) void_type_data::void_type_data(type_list) : type_data_base{type_id{type_list>{}}, type_kind::void_} {} } @@ -7890,6 +7872,7 @@ namespace meta_hpp::detail template < stdex::copy_constructible T > struct index_traits { uvalue operator()(T* v, std::size_t i) const { + // NOLINTNEXTLINE(*-pointer-arithmetic) return uvalue{v[i]}; } }; @@ -7897,6 +7880,7 @@ namespace meta_hpp::detail template < stdex::copy_constructible T > struct index_traits { uvalue operator()(const T* v, std::size_t i) const { + // NOLINTNEXTLINE(*-pointer-arithmetic) return uvalue{v[i]}; } }; @@ -8025,13 +8009,13 @@ namespace meta_hpp template < typename T > static T* buffer_cast(buffer_t& buffer) noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) + // NOLINTNEXTLINE(*-reinterpret-cast) return std::launder(reinterpret_cast(buffer.data)); } template < typename T > static const T* buffer_cast(const buffer_t& buffer) noexcept { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) + // NOLINTNEXTLINE(*-reinterpret-cast) return std::launder(reinterpret_cast(buffer.data)); } @@ -8098,7 +8082,7 @@ namespace meta_hpp } template < typename Tp > - // NOLINTNEXTLINE(readability-function-cognitive-complexity) + // NOLINTNEXTLINE(*-cognitive-complexity) static vtable_t* get() { static vtable_t table{ .type = resolve_type(), @@ -8112,7 +8096,7 @@ namespace meta_hpp }, .move = [](uvalue& from, uvalue& to) noexcept { - assert(from && !to); + assert(from && !to); // NOLINT std::visit(detail::overloaded { [&to](void* ptr) { @@ -8132,7 +8116,7 @@ namespace meta_hpp }, .copy = [](const uvalue& from, uvalue& to){ - assert(from && !to); + assert(from && !to); // NOLINT std::visit(detail::overloaded { [&to](void* ptr) { @@ -8150,7 +8134,7 @@ namespace meta_hpp }, .destroy = [](uvalue& self) noexcept { - assert(self); + assert(self); // NOLINT std::visit(detail::overloaded { [](void* ptr) { @@ -8255,6 +8239,7 @@ namespace meta_hpp template < detail::decay_non_value_kind T > requires stdex::copy_constructible> + // NOLINTNEXTLINE(*-forwarding-reference-overload) uvalue::uvalue(T&& val) { vtable_t::construct(*this, std::forward(val)); } @@ -8344,7 +8329,7 @@ namespace meta_hpp } template < typename T > - // NOLINTNEXTLINE(*-function-cognitive-complexity) + // NOLINTNEXTLINE(*-cognitive-complexity) auto uvalue::try_get_as() noexcept -> std::conditional_t, T, T*> { static_assert(std::is_same_v>); @@ -8409,7 +8394,7 @@ namespace meta_hpp } template < typename T > - // NOLINTNEXTLINE(*-function-cognitive-complexity) + // NOLINTNEXTLINE(*-cognitive-complexity) auto uvalue::try_get_as() const noexcept -> std::conditional_t, T, const T*> { static_assert(std::is_same_v>); diff --git a/untests/meta_utilities/arg_tests.cpp b/untests/meta_utilities/arg_tests.cpp index 666025b..b016d96 100644 --- a/untests/meta_utilities/arg_tests.cpp +++ b/untests/meta_utilities/arg_tests.cpp @@ -65,7 +65,7 @@ namespace // int f6(const clazz* const&&) { return v->ii; } } -// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) +// NOLINTNEXTLINE(*-macro-usage) #define META_HPP_CHECK_INVOCABLE(FromValue, FName, ToType)\ {\ using namespace meta::detail;\ @@ -89,7 +89,7 @@ namespace }\ } -// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) +// NOLINTNEXTLINE(*-macro-usage) #define META_HPP_CHECK_INVOCABLE_2(FromValue, FName, FromType, ToType)\ {\ using namespace meta::detail;\ diff --git a/untests/meta_utilities/inst_tests.cpp b/untests/meta_utilities/inst_tests.cpp index 82ee784..6394a62 100644 --- a/untests/meta_utilities/inst_tests.cpp +++ b/untests/meta_utilities/inst_tests.cpp @@ -25,7 +25,7 @@ namespace struct dclazz : fake, clazz {}; } -// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) +// NOLINTNEXTLINE(*-macro-usage) #define META_HPP_CHECK_INVOCABLE(Inst, FName, Qualifiers)\ {\ using namespace meta::detail;\ @@ -49,7 +49,7 @@ namespace }\ } -// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) +// NOLINTNEXTLINE(*-macro-usage) #define META_HPP_CHECK_INVOCABLE_2(FromValue, FName, FromType, ToQualifiers)\ {\ using namespace meta::detail;\