fix new clang-tidy warnings

This commit is contained in:
BlackMATov
2023-12-10 06:23:10 +07:00
parent debecdb14b
commit 1aea60c686
12 changed files with 34 additions and 9 deletions

View File

@@ -1839,6 +1839,7 @@ namespace meta_hpp
external,
};
// NOLINTNEXTLINE(*-union-access)
struct storage_u final {
union {
internal_storage_t internal;
@@ -4166,6 +4167,7 @@ namespace meta_hpp::detail
public:
template < typename F >
// NOLINTNEXTLINE(*-missing-std-forward)
void for_each_type(F&& f) const {
const locker lock;
@@ -4355,6 +4357,7 @@ namespace meta_hpp::detail
public:
template < typename F >
// NOLINTNEXTLINE(*-missing-std-forward)
void for_each_scope(F&& f) const {
const locker lock;
@@ -4400,6 +4403,7 @@ namespace meta_hpp::detail
namespace meta_hpp
{
template < type_family Type = any_type, typename F >
// NOLINTNEXTLINE(*-missing-std-forward)
void for_each_type(F&& f) {
using namespace detail;
type_registry& registry = type_registry::instance();
@@ -4418,6 +4422,7 @@ namespace meta_hpp
}
template < typename T >
// NOLINTNEXTLINE(*-missing-std-forward)
[[nodiscard]] auto resolve_type(T&&) {
using namespace detail;
type_registry& registry = type_registry::instance();
@@ -4442,6 +4447,7 @@ namespace meta_hpp
namespace meta_hpp
{
template < typename T >
// NOLINTNEXTLINE(*-missing-std-forward)
[[nodiscard]] auto resolve_poly_type(T&& from) {
using namespace detail;
@@ -5984,6 +5990,7 @@ namespace meta_hpp::detail
template < typename T, typename Tp = std::decay_t<T> >
requires(!uvalue_family<Tp>)
// NOLINTNEXTLINE(*-missing-std-forward)
explicit uarg_base(type_registry& registry, T&&)
: uarg_base{registry, type_list<T&&>{}} {}
@@ -6005,6 +6012,7 @@ namespace meta_hpp::detail
: ref_type_{ref_types::const_lvalue}
, raw_type_{v.get_type()} {}
// NOLINTNEXTLINE(*-param-not-moved)
explicit uarg_base(type_registry&, uvalue&& v)
: ref_type_{ref_types::rvalue}
, raw_type_{v.get_type()} {}
@@ -6326,9 +6334,9 @@ namespace meta_hpp::detail
template < typename ArgTypeList, typename F >
auto unchecked_call_with_uargs(type_registry& registry, std::span<const uarg> args, F&& f) {
META_HPP_DEV_ASSERT(args.size() == type_list_arity_v<ArgTypeList>);
return [args, &registry, &f]<std::size_t... Is>(std::index_sequence<Is...>) {
return f(args[Is].cast<type_list_at_t<Is, ArgTypeList>>(registry)...);
}(std::make_index_sequence<type_list_arity_v<ArgTypeList>>());
return [args, &registry]<std::size_t... Is>(auto&& captured_f, std::index_sequence<Is...>) {
return std::invoke(META_HPP_FWD(captured_f), args[Is].cast<type_list_at_t<Is, ArgTypeList>>(registry)...);
}(META_HPP_FWD(f), std::make_index_sequence<type_list_arity_v<ArgTypeList>>());
}
}
@@ -6584,6 +6592,7 @@ namespace meta_hpp::detail
template < typename T, typename Tp = std::decay_t<T> >
requires(!uvalue_family<Tp>)
// NOLINTNEXTLINE(*-missing-std-forward)
explicit uinst_base(type_registry& registry, T&&)
: uinst_base{registry, type_list<T&&>{}} {}
@@ -6605,6 +6614,7 @@ namespace meta_hpp::detail
: ref_type_{ref_types::const_lvalue}
, raw_type_{v.get_type()} {}
// NOLINTNEXTLINE(*-param-not-moved)
explicit uinst_base(type_registry&, uvalue&& v)
: ref_type_{ref_types::rvalue}
, raw_type_{v.get_type()} {}
@@ -9392,6 +9402,7 @@ namespace meta_hpp
template < typename To, typename From >
requires detail::lvalue_reference_ucast_kind<To, From>
// NOLINTNEXTLINE(*-missing-std-forward)
To ucast(From&& from) {
using from_data_type = std::remove_reference_t<From>;
using to_data_type = std::remove_reference_t<To>;
@@ -9715,6 +9726,7 @@ namespace meta_hpp
static vtable_t table{
.type = resolve_type<Tp>(),
// NOLINTNEXTLINE(*-param-not-moved)
.move{[](uvalue&& self, uvalue& to) noexcept {
META_HPP_DEV_ASSERT(!to);
META_HPP_DEV_ASSERT(self);

View File

@@ -21,7 +21,6 @@ ConstructorInitializerIndentWidth: 0
FixNamespaceComments: false
IndentPPDirectives: AfterHash
IndentWidth: 4
LambdaBodyIndentation: OuterScope
NamespaceIndentation: All
PackConstructorInitializers: Never
PenaltyBreakAssignment: 100

View File

@@ -1,4 +1,6 @@
Diagnostics:
UnusedIncludes: None
MissingIncludes: None
ClangTidy:
Add:
- bugprone-*
@@ -20,7 +22,7 @@ Diagnostics:
- misc-unused-using-decls
- modernize-use-trailing-return-type
- readability-identifier-length
- readability-named-parameter``
- readability-named-parameter
- readability-redundant-access-specifiers
- readability-simplify-boolean-expr
- readability-use-anyofallof

View File

@@ -37,6 +37,7 @@ namespace meta_hpp::detail
public:
template < typename F >
// NOLINTNEXTLINE(*-missing-std-forward)
void for_each_scope(F&& f) const {
const locker lock;

View File

@@ -37,6 +37,7 @@ namespace meta_hpp::detail
public:
template < typename F >
// NOLINTNEXTLINE(*-missing-std-forward)
void for_each_type(F&& f) const {
const locker lock;

View File

@@ -36,6 +36,7 @@ namespace meta_hpp::detail
template < typename T, typename Tp = std::decay_t<T> >
requires(!uvalue_family<Tp>)
// NOLINTNEXTLINE(*-missing-std-forward)
explicit uarg_base(type_registry& registry, T&&)
: uarg_base{registry, type_list<T&&>{}} {}
@@ -57,6 +58,7 @@ namespace meta_hpp::detail
: ref_type_{ref_types::const_lvalue}
, raw_type_{v.get_type()} {}
// NOLINTNEXTLINE(*-param-not-moved)
explicit uarg_base(type_registry&, uvalue&& v)
: ref_type_{ref_types::rvalue}
, raw_type_{v.get_type()} {}
@@ -378,8 +380,8 @@ namespace meta_hpp::detail
template < typename ArgTypeList, typename F >
auto unchecked_call_with_uargs(type_registry& registry, std::span<const uarg> args, F&& f) {
META_HPP_DEV_ASSERT(args.size() == type_list_arity_v<ArgTypeList>);
return [args, &registry, &f]<std::size_t... Is>(std::index_sequence<Is...>) {
return f(args[Is].cast<type_list_at_t<Is, ArgTypeList>>(registry)...);
}(std::make_index_sequence<type_list_arity_v<ArgTypeList>>());
return [args, &registry]<std::size_t... Is>(auto&& captured_f, std::index_sequence<Is...>) {
return std::invoke(META_HPP_FWD(captured_f), args[Is].cast<type_list_at_t<Is, ArgTypeList>>(registry)...);
}(META_HPP_FWD(f), std::make_index_sequence<type_list_arity_v<ArgTypeList>>());
}
}

View File

@@ -36,6 +36,7 @@ namespace meta_hpp::detail
template < typename T, typename Tp = std::decay_t<T> >
requires(!uvalue_family<Tp>)
// NOLINTNEXTLINE(*-missing-std-forward)
explicit uinst_base(type_registry& registry, T&&)
: uinst_base{registry, type_list<T&&>{}} {}
@@ -57,6 +58,7 @@ namespace meta_hpp::detail
: ref_type_{ref_types::const_lvalue}
, raw_type_{v.get_type()} {}
// NOLINTNEXTLINE(*-param-not-moved)
explicit uinst_base(type_registry&, uvalue&& v)
: ref_type_{ref_types::rvalue}
, raw_type_{v.get_type()} {}

View File

@@ -17,6 +17,7 @@
namespace meta_hpp
{
template < type_family Type = any_type, typename F >
// NOLINTNEXTLINE(*-missing-std-forward)
void for_each_type(F&& f) {
using namespace detail;
type_registry& registry = type_registry::instance();
@@ -35,6 +36,7 @@ namespace meta_hpp
}
template < typename T >
// NOLINTNEXTLINE(*-missing-std-forward)
[[nodiscard]] auto resolve_type(T&&) {
using namespace detail;
type_registry& registry = type_registry::instance();
@@ -59,6 +61,7 @@ namespace meta_hpp
namespace meta_hpp
{
template < typename T >
// NOLINTNEXTLINE(*-missing-std-forward)
[[nodiscard]] auto resolve_poly_type(T&& from) {
using namespace detail;

View File

@@ -50,6 +50,7 @@ namespace meta_hpp
template < typename To, typename From >
requires detail::lvalue_reference_ucast_kind<To, From>
// NOLINTNEXTLINE(*-missing-std-forward)
To ucast(From&& from) {
using from_data_type = std::remove_reference_t<From>;
using to_data_type = std::remove_reference_t<To>;

View File

@@ -129,6 +129,7 @@ namespace meta_hpp
external,
};
// NOLINTNEXTLINE(*-union-access)
struct storage_u final {
union {
internal_storage_t internal;

View File

@@ -162,6 +162,7 @@ namespace meta_hpp
static vtable_t table{
.type = resolve_type<Tp>(),
// NOLINTNEXTLINE(*-param-not-moved)
.move{[](uvalue&& self, uvalue& to) noexcept {
META_HPP_DEV_ASSERT(!to);
META_HPP_DEV_ASSERT(self);