Skip to content

Commit

Permalink
Merge branch 'clang-format-rename' into v2
Browse files Browse the repository at this point in the history
  • Loading branch information
jll63 committed Sep 7, 2024
2 parents ef5bae3 + ad9b00b commit f0eb8c8
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 82 deletions.
2 changes: 1 addition & 1 deletion dev/clang-format-all
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

find include src examples tests docs.in -type f -name "*.?pp" | xargs clang-format -i
find include src examples tests -type f -name "*.?pp" | xargs clang-format -i
3 changes: 1 addition & 2 deletions include/yorel/yomm2/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,7 @@ method<Key, R(A...), Policy>::resolve(const ArgType&... args) const {
if constexpr (arity == 1) {
pf = resolve_uni<types<A...>, ArgType...>(args...);
} else {
pf = resolve_multi_first<0, types<A...>, ArgType...>(
args...);
pf = resolve_multi_first<0, types<A...>, ArgType...>(args...);
}

return reinterpret_cast<function_pointer_type>(pf);
Expand Down
51 changes: 16 additions & 35 deletions include/yorel/yomm2/detail.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ template<class Policy, typename... T>
type_id* type_id_list<Policy, types<T...>>::begin = value;

template<class Policy, typename... T>
type_id* type_id_list<Policy, types<T...>>::end =
value + sizeof...(T);
type_id* type_id_list<Policy, types<T...>>::end = value + sizeof...(T);

template<class Policy>
struct type_id_list<Policy, types<>> {
Expand Down Expand Up @@ -136,14 +135,11 @@ template<class...>
struct class_declaration_aux;

template<class Policy, class Class, typename... Bases>
struct class_declaration_aux<Policy, types<Class, Bases...>>
: class_info {
struct class_declaration_aux<Policy, types<Class, Bases...>> : class_info {
class_declaration_aux() {
this->type = collect_static_type_id<Policy, Class>();
this->first_base =
type_id_list<Policy, types<Bases...>>::begin;
this->last_base =
type_id_list<Policy, types<Bases...>>::end;
this->first_base = type_id_list<Policy, types<Bases...>>::begin;
this->last_base = type_id_list<Policy, types<Bases...>>::end;
Policy::classes.push_back(*this);
this->is_abstract = std::is_abstract_v<Class>;
this->static_vptr = &Policy::template static_vptr<Class>;
Expand Down Expand Up @@ -336,8 +332,7 @@ constexpr bool is_virtual_ptr = is_virtual_ptr_aux<T>::value;

template<class... Ts>
using virtual_ptr_class = std::conditional_t<
sizeof...(Ts) == 2,
boost::mp11::mp_second<types<Ts..., void>>,
sizeof...(Ts) == 2, boost::mp11::mp_second<types<Ts..., void>>,
boost::mp11::mp_first<types<Ts...>>>;

template<class Policy, typename T>
Expand Down Expand Up @@ -498,14 +493,12 @@ inline uintptr_t get_tip(const T& arg) {
template<typename... Classes>
using get_policy = std::conditional_t<
is_policy<boost::mp11::mp_back<types<Classes...>>>,
boost::mp11::mp_back<types<Classes...>>,
YOMM2_DEFAULT_POLICY>;
boost::mp11::mp_back<types<Classes...>>, YOMM2_DEFAULT_POLICY>;

template<typename... Classes>
using remove_policy = std::conditional_t<
is_policy<boost::mp11::mp_back<types<Classes...>>>,
boost::mp11::mp_pop_back<types<Classes...>>,
types<Classes...>>;
boost::mp11::mp_pop_back<types<Classes...>>, types<Classes...>>;

template<class... Ts>
using virtual_ptr_policy = std::conditional_t<
Expand All @@ -521,14 +514,10 @@ struct thunk;
template<
class Policy, typename BASE_RETURN, typename... BASE_PARAM, auto SPEC,
typename... SPEC_PARAM>
struct thunk<
Policy, BASE_RETURN(BASE_PARAM...), SPEC,
types<SPEC_PARAM...>> {
struct thunk<Policy, BASE_RETURN(BASE_PARAM...), SPEC, types<SPEC_PARAM...>> {
static BASE_RETURN fn(remove_virtual<BASE_PARAM>... arg) {
using base_type =
boost::mp11::mp_first<types<BASE_PARAM...>>;
using spec_type =
boost::mp11::mp_first<types<SPEC_PARAM...>>;
using base_type = boost::mp11::mp_first<types<BASE_PARAM...>>;
using spec_type = boost::mp11::mp_first<types<SPEC_PARAM...>>;
return SPEC(
argument_traits<Policy, BASE_PARAM>::template cast<SPEC_PARAM>(
remove_virtual<BASE_PARAM>(arg))...);
Expand Down Expand Up @@ -562,8 +551,7 @@ struct member_function_thunk<F, R (C::*)(Args...)> {
template<typename... Cs>
using inheritance_map = types<boost::mp11::mp_push_front<
boost::mp11::mp_filter_q<
boost::mp11::mp_bind_back<std::is_base_of, Cs>,
types<Cs...>>,
boost::mp11::mp_bind_back<std::is_base_of, Cs>, types<Cs...>>,
Cs>...>;

template<class Policy, class... Classes>
Expand All @@ -575,33 +563,26 @@ struct use_classes_aux<Policy, types<Classes...>> {
std::tuple,
boost::mp11::mp_transform_q<
boost::mp11::mp_bind_front<class_declaration_aux, Policy>,
boost::mp11::mp_apply<
inheritance_map, types<Classes...>>>>;
boost::mp11::mp_apply<inheritance_map, types<Classes...>>>>;
};

template<class Policy, class... Classes, class... MoreClassLists>
struct use_classes_aux<
Policy,
types<types<Classes...>, MoreClassLists...>>
struct use_classes_aux<Policy, types<types<Classes...>, MoreClassLists...>>
: use_classes_aux<
Policy,
boost::mp11::mp_append<
types<Classes...>, MoreClassLists...>>
Policy, boost::mp11::mp_append<types<Classes...>, MoreClassLists...>>

{};

template<typename... Ts>
using second_last = boost::mp11::mp_at_c<
types<Ts...>,
boost::mp11::mp_size<types<Ts...>>::value - 2>;
types<Ts...>, boost::mp11::mp_size<types<Ts...>>::value - 2>;

template<class... Classes>
using use_classes_macro = typename std::conditional_t<
is_policy<second_last<Classes...>>,
use_classes_aux<
second_last<Classes...>,
boost::mp11::mp_pop_back<
boost::mp11::mp_pop_back<types<Classes...>>>>,
boost::mp11::mp_pop_back<boost::mp11::mp_pop_back<types<Classes...>>>>,
use_classes_aux<
boost::mp11::mp_back<types<Classes...>>,
boost::mp11::mp_pop_back<types<Classes...>>>>::type;
Expand Down
21 changes: 7 additions & 14 deletions include/yorel/yomm2/detail/compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,20 @@ struct aggregate_reports;

template<class... Reports, class Facet, class... MoreFacets>
struct aggregate_reports<
types<Reports...>,
types<Facet, MoreFacets...>,
types<Reports...>, types<Facet, MoreFacets...>,
std::void_t<typename Facet::report>> {
using type = typename aggregate_reports<
types<Reports..., typename Facet::report>,
types<MoreFacets...>>::type;
types<Reports..., typename Facet::report>, types<MoreFacets...>>::type;
};

template<class... Reports, class Facet, class... MoreFacets, typename Void>
struct aggregate_reports<
types<Reports...>,
types<Facet, MoreFacets...>, Void> {
struct aggregate_reports<types<Reports...>, types<Facet, MoreFacets...>, Void> {
using type = typename aggregate_reports<
types<Reports...>,
types<MoreFacets...>>::type;
types<Reports...>, types<MoreFacets...>>::type;
};

template<class... Reports, typename Void>
struct aggregate_reports<
types<Reports...>, types<>, Void> {
struct aggregate_reports<types<Reports...>, types<>, Void> {
struct type : Reports... {};
};

Expand Down Expand Up @@ -241,9 +235,8 @@ struct compiler : detail::generic_compiler {
using policy_type = Policy;
using type_index_type = decltype(Policy::type_index(0));

typename detail::aggregate_reports<
detail::types<update_report>, typename Policy::facets>::type
report;
typename aggregate_reports<
types<update_report>, typename Policy::facets>::type report;

std::unordered_map<type_index_type, class_*> class_map;

Expand Down
6 changes: 3 additions & 3 deletions include/yorel/yomm2/policies/basic_error_output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ struct yOMM2_API_gcc basic_error_output : virtual error_output {
template<class Policy, typename Stream>
Stream basic_error_output<Policy, Stream>::error_stream;

}
}
}
} // namespace policy
} // namespace yomm2
} // namespace yorel

#endif
6 changes: 3 additions & 3 deletions include/yorel/yomm2/policies/basic_indirect_vptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ template<class Policy>
std::vector<std::uintptr_t const* const*>
basic_indirect_vptr<Policy>::indirect_vptrs;

}
}
}
} // namespace policy
} // namespace yomm2
} // namespace yorel

#endif
6 changes: 3 additions & 3 deletions include/yorel/yomm2/policies/basic_trace_output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ bool basic_trace_output<Policy, Stream>::trace_enabled([]() {
return env && *env++ == '1' && *env++ == 0;
}());

}
}
}
} // namespace policy
} // namespace yomm2
} // namespace yorel

#endif
6 changes: 3 additions & 3 deletions include/yorel/yomm2/policies/fast_perfect_hash.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ struct yOMM2_API_gcc checked_perfect_hash : virtual fast_perfect_hash<Policy>,
template<class Policy>
std::vector<type_id> checked_perfect_hash<Policy>::control;

}
}
}
} // namespace policy
} // namespace yomm2
} // namespace yorel

#endif
6 changes: 3 additions & 3 deletions include/yorel/yomm2/policies/minimal_rtti.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ struct minimal_rtti : virtual rtti {
}
};

}
}
}
} // namespace policy
} // namespace yomm2
} // namespace yorel

#endif
6 changes: 3 additions & 3 deletions include/yorel/yomm2/policies/std_rtti.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ struct std_rtti : virtual rtti {
#endif
};

}
}
}
} // namespace policy
} // namespace yomm2
} // namespace yorel

#endif
6 changes: 3 additions & 3 deletions include/yorel/yomm2/policies/throw_error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ struct yOMM2_API_gcc throw_error : virtual error_handler {
}
};

}
}
}
} // namespace policy
} // namespace yomm2
} // namespace yorel

#endif
6 changes: 3 additions & 3 deletions include/yorel/yomm2/policies/vectored_error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ error_handler_type vectored_error<Policy, DefaultHandlerProvider>::error =
std::is_same_v<DefaultHandlerProvider, void>, vectored_error<Policy>,
DefaultHandlerProvider>::default_error_handler;

}
}
}
} // namespace policy
} // namespace yomm2
} // namespace yorel

#endif
6 changes: 3 additions & 3 deletions include/yorel/yomm2/policies/vptr_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ struct yOMM2_API_gcc vptr_map : virtual external_vptr {
template<class Policy, class Map>
Map vptr_map<Policy, Map>::vptrs;

}
}
}
} // namespace policy
} // namespace yomm2
} // namespace yorel

#endif
6 changes: 3 additions & 3 deletions include/yorel/yomm2/policies/vptr_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ struct yOMM2_API_gcc vptr_vector : virtual external_vptr {
template<class Policy>
std::vector<const std::uintptr_t*> vptr_vector<Policy>::vptrs;

}
}
}
} // namespace policy
} // namespace yomm2
} // namespace yorel

#endif

0 comments on commit f0eb8c8

Please sign in to comment.