From 32cf6bb504a49b0e948a88462ab5bfdc6598a353 Mon Sep 17 00:00:00 2001 From: Mingxin Wang Date: Wed, 10 Jun 2026 22:17:45 +0800 Subject: [PATCH 1/2] Split proxy into multiple header files --- CMakeLists.txt | 19 +- include/proxy/v4/detail/core.h | 1541 ++++++++++++ include/proxy/v4/detail/dispatch.h | 305 +++ include/proxy/v4/detail/facade_creation.h | 195 ++ include/proxy/v4/detail/proxy_creation.h | 433 ++++ include/proxy/v4/detail/skills.h | 310 +++ include/proxy/v4/proxy.h | 2751 +-------------------- include/proxy/v4/proxy_fmt.h | 16 +- meson.build | 27 +- tests/BUILD.bazel | 2 +- tests/CMakeLists.txt | 2 +- tests/meson.build | 2 +- tests/proxy_creation_tests.cpp | 248 +- tests/proxy_detail_tests.cpp | 30 + tests/proxy_details_tests.cpp | 31 - tests/proxy_dispatch_tests.cpp | 22 +- tests/proxy_fmt_format_no_wchar_tests.cpp | 8 +- tests/proxy_fmt_format_tests.cpp | 10 +- tests/proxy_format_tests.cpp | 10 +- tests/proxy_integration_tests.cpp | 24 +- tests/proxy_invocation_tests.cpp | 93 +- tests/proxy_lifetime_tests.cpp | 180 +- tests/proxy_reflection_tests.cpp | 14 +- tests/proxy_regression_tests.cpp | 12 +- tests/proxy_rtti_tests.cpp | 58 +- tests/proxy_traits_tests.cpp | 30 +- tests/proxy_view_tests.cpp | 39 +- 27 files changed, 3213 insertions(+), 3199 deletions(-) create mode 100644 include/proxy/v4/detail/core.h create mode 100644 include/proxy/v4/detail/dispatch.h create mode 100644 include/proxy/v4/detail/facade_creation.h create mode 100644 include/proxy/v4/detail/proxy_creation.h create mode 100644 include/proxy/v4/detail/skills.h create mode 100644 tests/proxy_detail_tests.cpp delete mode 100644 tests/proxy_details_tests.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index defa6e5..c29405d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,20 +24,15 @@ if(PROJECT_IS_TOP_LEVEL) ) endif() -target_sources( - msft_proxy4 +file(GLOB_RECURSE proxy_public_headers CONFIGURE_DEPENDS + "${CMAKE_CURRENT_SOURCE_DIR}/include/proxy/*.h" + "${CMAKE_CURRENT_SOURCE_DIR}/include/proxy/*.ixx") +target_sources(msft_proxy4 INTERFACE FILE_SET public_headers - TYPE HEADERS - BASE_DIRS include - FILES - include/proxy/proxy.h - include/proxy/proxy_macros.h - include/proxy/proxy_fmt.h - include/proxy/v4/proxy.ixx - include/proxy/v4/proxy.h - include/proxy/v4/proxy_macros.h - include/proxy/v4/proxy_fmt.h + TYPE HEADERS + BASE_DIRS include + FILES ${proxy_public_headers} ) target_compile_features(msft_proxy4 INTERFACE cxx_std_20) diff --git a/include/proxy/v4/detail/core.h b/include/proxy/v4/detail/core.h new file mode 100644 index 0000000..a1a0f00 --- /dev/null +++ b/include/proxy/v4/detail/core.h @@ -0,0 +1,1541 @@ +// Copyright (c) 2022-2026 Microsoft Corporation. +// Copyright (c) 2026-Present Next Gen C++ Foundation. +// Licensed under the MIT License. + +#ifndef MSFT_PROXY_V4_DETAIL_CORE_H_ +#define MSFT_PROXY_V4_DETAIL_CORE_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../proxy_macros.h" + +#if __has_cpp_attribute(msvc::no_unique_address) +#define PRO4D_NO_UNIQUE_ADDRESS_ATTRIBUTE msvc::no_unique_address +#elif __has_cpp_attribute(no_unique_address) +#define PRO4D_NO_UNIQUE_ADDRESS_ATTRIBUTE no_unique_address +#else +#error Proxy requires C++20 attribute no_unique_address. +#endif // __has_cpp_attribute(msvc::no_unique_address) + +#if __cpp_lib_unreachable >= 202202L +#define PRO4D_UNREACHABLE() std::unreachable() +#else +#define PRO4D_UNREACHABLE() std::abort() +#endif // __cpp_lib_unreachable >= 202202L + +namespace pro::inline v4 { + +namespace detail { + +template +struct basic_facade_traits; + +} // namespace detail + +enum class constraint_level { none, nontrivial, nothrow, trivial }; + +template