From 60f8917f1c86392d37dfc48f20607bfc22ee57e2 Mon Sep 17 00:00:00 2001 From: Nana Sakisaka <1901813+saki7@users.noreply.github.com> Date: Mon, 21 Sep 2026 12:04:57 +0900 Subject: [PATCH] Improve compilation time --- CMakeLists.txt | 1 + include/iris/x4/attribute/value.hpp | 1 - include/iris/x4/core/action.hpp | 28 ++++++++++--------- include/iris/x4/core/context.hpp | 2 +- .../x4/core/detail/parse_into_container.hpp | 2 +- include/iris/x4/core/list_like_parser.hpp | 8 +++--- include/iris/x4/core/move_to.hpp | 11 ++------ include/iris/x4/core/parser.hpp | 4 +-- include/iris/x4/traits/variant_traits.hpp | 8 +++--- modules/iris | 2 +- test/x4/move_to.cpp | 1 - 11 files changed, 32 insertions(+), 36 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 87ce78c3c..cef512c71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,7 @@ endif() project(iris_x4 VERSION 1.0.0 LANGUAGES CXX) +set(CMAKE_CXX_SCAN_FOR_MODULES OFF) # ----------------------------------------------------------------- # Load Iris diff --git a/include/iris/x4/attribute/value.hpp b/include/iris/x4/attribute/value.hpp index 396fdab7b..2fb95e84b 100644 --- a/include/iris/x4/attribute/value.hpp +++ b/include/iris/x4/attribute/value.hpp @@ -33,7 +33,6 @@ struct fixed_value_parser : parser> { static_assert(X4Attribute); static_assert(!X4UnusedAttribute, "fixed_value_parser with `unused_type` is meaningless"); - static_assert(X4Movable); // `HeldValueT` is almost always equal to `T`. // diff --git a/include/iris/x4/core/action.hpp b/include/iris/x4/core/action.hpp index d5f08b8cb..7261ea438 100644 --- a/include/iris/x4/core/action.hpp +++ b/include/iris/x4/core/action.hpp @@ -10,13 +10,15 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ -#include +#include // IWYU pragma: keep #include #include #include #include +#include + #include #include #include @@ -49,9 +51,9 @@ struct action_context // Ideally we should have a context-agnostic concept that can be used // like `X4ActionFunctor`, but we technically can't. // -// In order to check `std::invocable`, we need to know the actual context -// type passed to the `.parse(...)` function but it is unknown until -// runtime. +// In order to check whether it is invocable, we need to know the actual +// context type passed to the `.parse(...)` function, but it is unknown +// until runtime. // // Even if we make up the most trivial context type (i.e. `unused_type`), // such concept will be useless because a user-provided functor always @@ -154,18 +156,18 @@ struct action : proxy_parser, Subject> template [[nodiscard]] constexpr bool call_action(Context const&, Attr&) const - noexcept(std::is_nothrow_invocable_v) + noexcept(is_nothrow_directly_invocable_v) { // Explicitly make this hard error instead of emitting "no matching overload". // This provides much more human-friendly errors. static_assert( - std::invocable, + directly_invocable, "Neither `f(ctx)` nor `f()` is well-formed for your semantic action. " "Check your function signature. Note that some functors might need " "`const` qualifier to satisfy the constraints." ); - using action_return_type = std::invoke_result_t; + using action_return_type = directly_invoke_result_t; constexpr bool action_returns_bool = std::same_as; static_assert( action_returns_bool || std::same_as, @@ -182,12 +184,12 @@ struct action : proxy_parser, Subject> // Semantic action with parameter: `p[([](auto&& ctx) { /* ... */ })]` template - requires std::invocable::type> + requires directly_invocable::type> [[nodiscard]] constexpr bool call_action(Context const& ctx, Attr& attr) const - noexcept(std::is_nothrow_invocable_v::type>) + noexcept(is_nothrow_directly_invocable_v::type>) { - using action_return_type = std::invoke_result_t::type>; + using action_return_type = directly_invoke_result_t::type>; constexpr bool action_returns_bool = std::same_as; static_assert( action_returns_bool || std::same_as, @@ -215,13 +217,13 @@ struct action : proxy_parser, Subject> template requires - (!std::invocable::type>) && - std::invocable::type const&> + (!directly_invocable::type>) && + directly_invocable::type const&> static constexpr bool call_action(Context const&, Attr&) { static_assert( - std::invocable::type>, + directly_invocable::type>, "Semantic action expecting non-const lvalue reference context is obsolete. Use `auto&& ctx` and avoid using `auto& ctx`." ); return false; // dummy diff --git a/include/iris/x4/core/context.hpp b/include/iris/x4/core/context.hpp index ab57110e0..becbe18f1 100644 --- a/include/iris/x4/core/context.hpp +++ b/include/iris/x4/core/context.hpp @@ -117,7 +117,7 @@ concept ContextNextType = !std::is_lvalue_reference_v && !std::is_rvalue_reference_v && !std::is_const_v && - std::move_constructible + std::is_move_constructible_v ) ); diff --git a/include/iris/x4/core/detail/parse_into_container.hpp b/include/iris/x4/core/detail/parse_into_container.hpp index 2b37abb06..9fda9b254 100644 --- a/include/iris/x4/core/detail/parse_into_container.hpp +++ b/include/iris/x4/core/detail/parse_into_container.hpp @@ -66,7 +66,7 @@ struct parse_into_container_impl_default static constexpr bool call(Parser const& parser, It& first, Se const& last, Context& ctx, Attr& attr) // never noexcept (requires container insertion) { - using unwrapped_attribute_type = iris::unwrap_recursive_type; + using unwrapped_attribute_type = iris::unwrap_recursive_t; auto& unwrapped_attr = iris::unwrap_recursive(attr); if constexpr (traits::is_container_v) { // Attr is a container diff --git a/include/iris/x4/core/list_like_parser.hpp b/include/iris/x4/core/list_like_parser.hpp index 3d9c6e21f..d5cb74043 100644 --- a/include/iris/x4/core/list_like_parser.hpp +++ b/include/iris/x4/core/list_like_parser.hpp @@ -30,18 +30,18 @@ template struct unwrap_container_candidate { using type = traits::synthesized_value< - unwrap_recursive_type< + unwrap_recursive_t< typename unwrap_container_appender::type > >::type; }; template - requires traits::is_variant_v> + requires traits::is_variant_v> struct unwrap_container_candidate { using type = traits::variant_find_holdable_type< - unwrap_recursive_type, ParserAttr + unwrap_recursive_t, ParserAttr >::type; }; @@ -89,7 +89,7 @@ template [[nodiscard]] constexpr auto& get_container(ExposedAttr& attr) { using unwrapped_attr_type = detail::unwrap_single_element_plain< - unwrap_recursive_type + unwrap_recursive_t >::type; auto& unwrapped_attr = detail::unwrap_single_element(iris::unwrap_recursive(attr)); diff --git a/include/iris/x4/core/move_to.hpp b/include/iris/x4/core/move_to.hpp index 95a837160..e7ccd00c8 100644 --- a/include/iris/x4/core/move_to.hpp +++ b/include/iris/x4/core/move_to.hpp @@ -11,7 +11,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ -#include +#include // IWYU pragma: keep #include @@ -19,7 +19,7 @@ #include #include -#include +#include // IWYU pragma: keep #include #include @@ -265,7 +265,7 @@ move_to(Source&& src, Dest& dest) { static_assert(!std::same_as, Dest>, "[BUG] This call should instead resolve to the overload handling identical types"); - if constexpr (std::constructible_from::type, Source>) { + if constexpr (std::is_constructible_v::type, Source>) { traits::push_back(dest, std::forward(src)); } else { if constexpr (std::is_rvalue_reference_v) { @@ -288,11 +288,6 @@ move_to(Source&& src, Dest& dest) x4::move_to(std::forward(src), alloy::get<0>(dest)); } -template -concept X4Movable = requires { - x4::move_to(std::declval(), std::declval()); -}; - } // iris::x4 #endif diff --git a/include/iris/x4/core/parser.hpp b/include/iris/x4/core/parser.hpp index 04bc827e7..c3103eb5e 100644 --- a/include/iris/x4/core/parser.hpp +++ b/include/iris/x4/core/parser.hpp @@ -66,7 +66,7 @@ struct parser static constexpr bool requires_exact_attribute_type = false; template - requires std::constructible_from< + requires std::is_constructible_v< action, std::remove_cvref_t>, Self, Action > @@ -82,7 +82,7 @@ struct parser } template - requires std::constructible_from< + requires std::is_constructible_v< action, std::remove_cvref_t>, Self, Action > diff --git a/include/iris/x4/traits/variant_traits.hpp b/include/iris/x4/traits/variant_traits.hpp index f3fdc5415..8573b5bd8 100644 --- a/include/iris/x4/traits/variant_traits.hpp +++ b/include/iris/x4/traits/variant_traits.hpp @@ -44,13 +44,13 @@ struct any_of_unwrapped_exactly_same {}; template - requires std::same_as> + requires std::same_as> struct any_of_unwrapped_exactly_same : std::true_type {}; template - requires (!std::same_as>) + requires (!std::same_as>) struct any_of_unwrapped_exactly_same : any_of_unwrapped_exactly_same {}; @@ -68,7 +68,7 @@ template struct variant_find_holdable_type_impl { using type = std::conditional_t< - can_hold, T>::value, + can_hold, T>::value, // Given some type `T`, when both `T` and `recursive_wrapper` is seen // during attribute resolution, X4 should ideally materialize the latter @@ -109,7 +109,7 @@ template requires (!std::same_as, T>) && (!detail::any_of_unwrapped_exactly_same::value) struct variant_find_holdable_type, T> { - using type = typename detail::variant_find_holdable_type_impl::type; + using type = detail::variant_find_holdable_type_impl::type; }; } // iris::x4::traits diff --git a/modules/iris b/modules/iris index b29919bfc..1d1d6c60b 160000 --- a/modules/iris +++ b/modules/iris @@ -1 +1 @@ -Subproject commit b29919bfca9288b035e27b62df0d52c3b8747b71 +Subproject commit 1d1d6c60b4aa6e525b1aab23be38bda4c44a11ec diff --git a/test/x4/move_to.cpp b/test/x4/move_to.cpp index b7f168bde..80cdbb882 100644 --- a/test/x4/move_to.cpp +++ b/test/x4/move_to.cpp @@ -32,7 +32,6 @@ TEST_CASE("move_to") //XYZ xyz; //xyz = std::vector{}; static_assert(!std::is_assignable_v>); - STATIC_CHECK(!x4::X4Movable, XYZ>); } // tuple contains reference