From 201aeba1749c736374e3209e39eb29ede65d74de Mon Sep 17 00:00:00 2001 From: Shai Szulanski Date: Wed, 27 Nov 2024 12:51:47 -0800 Subject: [PATCH] Delete reflect_module Summary: Tearing out another piece of deprecated reflection Reviewed By: yoney Differential Revision: D66514234 fbshipit-source-id: 91de1bbaafbd39d251a9067046a0b43bced32529 --- .../templates/cpp2/module_fatal.h.mustache | 2 - .../cpp2/module_fatal_struct.h.mustache | 1 - .../cpp2/module_fatal_union.h.mustache | 2 - .../fatal/out/cpp2/gen-cpp2/module_fatal.h | 2 - .../out/cpp2/gen-cpp2/module_fatal_struct.h | 15 - .../out/cpp2/gen-cpp2/module_fatal_union.h | 12 - .../out/cpp2_enums/gen-cpp2/enums_fatal.h | 2 - .../cpp2_enums/gen-cpp2/enums_fatal_struct.h | 1 - .../gen-cpp2/extra_services_fatal.h | 2 - .../gen-cpp2/extra_services_fatal_struct.h | 1 - .../gen-cpp2/reflection_fatal.h | 2 - .../gen-cpp2/reflection_fatal_struct.h | 1 - .../types/out/cpp2/gen-cpp2/module_fatal.h | 2 - .../out/cpp2/gen-cpp2/module_fatal_struct.h | 35 -- .../lib/cpp2/reflection/demo/activation.cpp | 90 ----- .../cpp2/reflection/demo/module_basics.cpp | 90 ----- .../internal/legacy_reflection-inl-post.h | 15 +- .../reflection/internal/reflection-inl-post.h | 3 +- .../reflection/internal/reflection-inl-pre.h | 6 - .../thrift/lib/cpp2/reflection/reflection.h | 366 ------------------ .../test/reflection/TroublesomeTest.cpp | 2 - .../test/reflection/fatal_struct_test.cpp | 1 - .../src/thrift/test/reflection/fatal_test.cpp | 211 ---------- 23 files changed, 11 insertions(+), 853 deletions(-) delete mode 100644 third-party/thrift/src/thrift/lib/cpp2/reflection/demo/activation.cpp delete mode 100644 third-party/thrift/src/thrift/lib/cpp2/reflection/demo/module_basics.cpp diff --git a/third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_fatal.h.mustache b/third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_fatal.h.mustache index 65a74a40e2eea1..79195fd561f179 100644 --- a/third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_fatal.h.mustache +++ b/third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_fatal.h.mustache @@ -117,6 +117,4 @@ class {{program:name}}_tags { using services = __fbthrift_services; }; -THRIFT_REGISTER_REFLECTION_METADATA({{program:name}}_tags::module, __fbthrift_refl::{{program:name}}_module_traits); - {{ > common/namespace_cpp2_end}} diff --git a/third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_fatal_struct.h.mustache b/third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_fatal_struct.h.mustache index 5f846b79947363..6b8c4aad3fb17e 100644 --- a/third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_fatal_struct.h.mustache +++ b/third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_fatal_struct.h.mustache @@ -144,7 +144,6 @@ class {{struct:cpp_name}}_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - {{program:name}}_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>({{struct:legacy_type_id}}ull) >; diff --git a/third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_fatal_union.h.mustache b/third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_fatal_union.h.mustache index 9b3d1da31279af..532d7547ebc97a 100644 --- a/third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_fatal_union.h.mustache +++ b/third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_fatal_union.h.mustache @@ -199,7 +199,6 @@ class {{struct:cpp_name}}_variant_traits { FATAL_REGISTER_ENUM_TRAITS( __fbthrift_refl::{{struct:cpp_name}}_tenum_traits, ::apache::thrift::detail::type_common_metadata_impl< - {{program:name}}_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_refl::{{struct:cpp_name}}_tenum_traits::annotations>, static_cast<::apache::thrift::legacy_type_id_t>(0ull) > @@ -207,7 +206,6 @@ FATAL_REGISTER_ENUM_TRAITS( FATAL_REGISTER_VARIANT_TRAITS( __fbthrift_refl::{{struct:cpp_name}}_variant_traits, ::apache::thrift::detail::type_common_metadata_impl< - {{program:name}}_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_refl::{{struct:cpp_name}}_variant_traits::annotations>, static_cast<::apache::thrift::legacy_type_id_t>({{struct:legacy_type_id}}ull) > diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_fatal.h b/third-party/thrift/src/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_fatal.h index b1b0509923858d..d6f9ae4fd9cd3c 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_fatal.h +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_fatal.h @@ -486,6 +486,4 @@ class module_tags { using services = __fbthrift_services; }; -THRIFT_REGISTER_REFLECTION_METADATA(module_tags::module, __fbthrift_refl::module_module_traits); - } // namespace test_cpp2::cpp_reflection diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_fatal_struct.h b/third-party/thrift/src/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_fatal_struct.h index b76e798f352bd0..79462fd875c64b 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_fatal_struct.h +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_fatal_struct.h @@ -72,7 +72,6 @@ class structA_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(16040306389268712140ull) >; @@ -168,7 +167,6 @@ class structB_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(17011230197513777036ull) >; @@ -645,7 +643,6 @@ class structC_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(15703963988028277228ull) >; @@ -762,7 +759,6 @@ class struct1_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(16486839729778550796ull) >; @@ -894,7 +890,6 @@ class struct2_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(2030839855051909900ull) >; @@ -1191,7 +1186,6 @@ class struct3_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(8845469880920676204ull) >; @@ -1278,7 +1272,6 @@ class struct4_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(8628553040095454508ull) >; @@ -1397,7 +1390,6 @@ class struct5_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(7967269041282488716ull) >; @@ -1439,7 +1431,6 @@ class struct_binary_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(15392351242833807340ull) >; @@ -1511,7 +1502,6 @@ class dep_A_struct_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(8602591000426722284ull) >; @@ -1583,7 +1573,6 @@ class dep_B_struct_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(8784116305731192876ull) >; @@ -1709,7 +1698,6 @@ class annotated_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(13050506750255744236ull) >; @@ -2156,7 +2144,6 @@ class struct_with_special_names_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(1059263577269097804ull) >; @@ -2280,7 +2267,6 @@ class struct_with_indirections_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(16986623410512473676ull) >; @@ -2322,7 +2308,6 @@ class StructWithFieldAdapter_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(12839341089809937516ull) >; diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_fatal_union.h b/third-party/thrift/src/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_fatal_union.h index b13b3b0191c90b..51d5ea6dc040c6 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_fatal_union.h +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/fatal/out/cpp2/gen-cpp2/module_fatal_union.h @@ -2144,7 +2144,6 @@ class UnionWithTypedefFieldAdapter_variant_traits { FATAL_REGISTER_ENUM_TRAITS( __fbthrift_refl::union1_tenum_traits, ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_refl::union1_tenum_traits::annotations>, static_cast<::apache::thrift::legacy_type_id_t>(0ull) > @@ -2152,7 +2151,6 @@ FATAL_REGISTER_ENUM_TRAITS( FATAL_REGISTER_VARIANT_TRAITS( __fbthrift_refl::union1_variant_traits, ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_refl::union1_variant_traits::annotations>, static_cast<::apache::thrift::legacy_type_id_t>(15193987089687821868ull) > @@ -2160,7 +2158,6 @@ FATAL_REGISTER_VARIANT_TRAITS( FATAL_REGISTER_ENUM_TRAITS( __fbthrift_refl::union2_tenum_traits, ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_refl::union2_tenum_traits::annotations>, static_cast<::apache::thrift::legacy_type_id_t>(0ull) > @@ -2168,7 +2165,6 @@ FATAL_REGISTER_ENUM_TRAITS( FATAL_REGISTER_VARIANT_TRAITS( __fbthrift_refl::union2_variant_traits, ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_refl::union2_variant_traits::annotations>, static_cast<::apache::thrift::legacy_type_id_t>(7436399996138825996ull) > @@ -2176,7 +2172,6 @@ FATAL_REGISTER_VARIANT_TRAITS( FATAL_REGISTER_ENUM_TRAITS( __fbthrift_refl::union3_tenum_traits, ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_refl::union3_tenum_traits::annotations>, static_cast<::apache::thrift::legacy_type_id_t>(0ull) > @@ -2184,7 +2179,6 @@ FATAL_REGISTER_ENUM_TRAITS( FATAL_REGISTER_VARIANT_TRAITS( __fbthrift_refl::union3_variant_traits, ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_refl::union3_variant_traits::annotations>, static_cast<::apache::thrift::legacy_type_id_t>(12630661616538286124ull) > @@ -2192,7 +2186,6 @@ FATAL_REGISTER_VARIANT_TRAITS( FATAL_REGISTER_ENUM_TRAITS( __fbthrift_refl::unionA_tenum_traits, ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_refl::unionA_tenum_traits::annotations>, static_cast<::apache::thrift::legacy_type_id_t>(0ull) > @@ -2200,7 +2193,6 @@ FATAL_REGISTER_ENUM_TRAITS( FATAL_REGISTER_VARIANT_TRAITS( __fbthrift_refl::unionA_variant_traits, ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_refl::unionA_variant_traits::annotations>, static_cast<::apache::thrift::legacy_type_id_t>(15005039916229430860ull) > @@ -2208,7 +2200,6 @@ FATAL_REGISTER_VARIANT_TRAITS( FATAL_REGISTER_ENUM_TRAITS( __fbthrift_refl::union_with_special_names_tenum_traits, ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_refl::union_with_special_names_tenum_traits::annotations>, static_cast<::apache::thrift::legacy_type_id_t>(0ull) > @@ -2216,7 +2207,6 @@ FATAL_REGISTER_ENUM_TRAITS( FATAL_REGISTER_VARIANT_TRAITS( __fbthrift_refl::union_with_special_names_variant_traits, ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_refl::union_with_special_names_variant_traits::annotations>, static_cast<::apache::thrift::legacy_type_id_t>(13162369197726992076ull) > @@ -2224,7 +2214,6 @@ FATAL_REGISTER_VARIANT_TRAITS( FATAL_REGISTER_ENUM_TRAITS( __fbthrift_refl::UnionWithTypedefFieldAdapter_tenum_traits, ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_refl::UnionWithTypedefFieldAdapter_tenum_traits::annotations>, static_cast<::apache::thrift::legacy_type_id_t>(0ull) > @@ -2232,7 +2221,6 @@ FATAL_REGISTER_ENUM_TRAITS( FATAL_REGISTER_VARIANT_TRAITS( __fbthrift_refl::UnionWithTypedefFieldAdapter_variant_traits, ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_refl::UnionWithTypedefFieldAdapter_variant_traits::annotations>, static_cast<::apache::thrift::legacy_type_id_t>(10841541077214060908ull) > diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_enums/gen-cpp2/enums_fatal.h b/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_enums/gen-cpp2/enums_fatal.h index 31cc39bb4180e3..893dd76e83a1fe 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_enums/gen-cpp2/enums_fatal.h +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_enums/gen-cpp2/enums_fatal.h @@ -116,6 +116,4 @@ class enums_tags { using services = __fbthrift_services; }; -THRIFT_REGISTER_REFLECTION_METADATA(enums_tags::module, __fbthrift_refl::enums_module_traits); - } // namespace facebook::ns::qwerty diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_enums/gen-cpp2/enums_fatal_struct.h b/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_enums/gen-cpp2/enums_fatal_struct.h index 0624a4e4bb784f..c69b4a78b61a7b 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_enums/gen-cpp2/enums_fatal_struct.h +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_enums/gen-cpp2/enums_fatal_struct.h @@ -55,7 +55,6 @@ class SomeStruct_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - enums_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(10691278903523363788ull) >; diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_extra_services/gen-cpp2/extra_services_fatal.h b/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_extra_services/gen-cpp2/extra_services_fatal.h index 774815f5f7845b..31899240b99195 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_extra_services/gen-cpp2/extra_services_fatal.h +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_extra_services/gen-cpp2/extra_services_fatal.h @@ -117,6 +117,4 @@ class extra_services_tags { using services = __fbthrift_services; }; -THRIFT_REGISTER_REFLECTION_METADATA(extra_services_tags::module, __fbthrift_refl::extra_services_module_traits); - } // namespace extra::svc diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_extra_services/gen-cpp2/extra_services_fatal_struct.h b/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_extra_services/gen-cpp2/extra_services_fatal_struct.h index afce4776a74826..3f29d05928528c 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_extra_services/gen-cpp2/extra_services_fatal_struct.h +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_extra_services/gen-cpp2/extra_services_fatal_struct.h @@ -236,7 +236,6 @@ class containerStruct2_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - extra_services_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(6698051510995854220ull) >; diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_reflection/gen-cpp2/reflection_fatal.h b/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_reflection/gen-cpp2/reflection_fatal.h index 25f93e327abb94..d9bd2b6ff15859 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_reflection/gen-cpp2/reflection_fatal.h +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_reflection/gen-cpp2/reflection_fatal.h @@ -72,6 +72,4 @@ class reflection_tags { using services = __fbthrift_services; }; -THRIFT_REGISTER_REFLECTION_METADATA(reflection_tags::module, __fbthrift_refl::reflection_module_traits); - } // namespace cpp2 diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_reflection/gen-cpp2/reflection_fatal_struct.h b/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_reflection/gen-cpp2/reflection_fatal_struct.h index b5d34c778920e9..f89e02b9cd30ea 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_reflection/gen-cpp2/reflection_fatal_struct.h +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/mcpp2-compare/out/cpp2_reflection/gen-cpp2/reflection_fatal_struct.h @@ -55,7 +55,6 @@ class ReflectionStruct_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - reflection_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(16334935087599571500ull) >; diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_fatal.h b/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_fatal.h index 21d5cbe64d4e67..b58e38754e4bcf 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_fatal.h +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_fatal.h @@ -321,6 +321,4 @@ class module_tags { using services = __fbthrift_services; }; -THRIFT_REGISTER_REFLECTION_METADATA(module_tags::module, __fbthrift_refl::module_module_traits); - } // namespace apache::thrift::fixtures::types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_fatal_struct.h b/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_fatal_struct.h index 6fa822d0e3156f..b82fb415526e64 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_fatal_struct.h +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_fatal_struct.h @@ -41,7 +41,6 @@ class empty_struct_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(7419850808542508140ull) >; @@ -99,7 +98,6 @@ class decorated_struct_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(13385404739325801676ull) >; @@ -246,7 +244,6 @@ class ContainerStruct_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(3474903760707401964ull) >; @@ -288,7 +285,6 @@ class CppTypeStruct_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(7889194779953601868ull) >; @@ -343,7 +339,6 @@ class VirtualStruct_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(13724968379201536076ull) >; @@ -400,7 +395,6 @@ class MyStructWithForwardRefEnum_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(13020438871755031308ull) >; @@ -457,7 +451,6 @@ class TrivialNumeric_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(13240042291233619340ull) >; @@ -514,7 +507,6 @@ class TrivialNestedWithDefault_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(14671643653509810348ull) >; @@ -571,7 +563,6 @@ class ComplexString_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(14031875880679100460ull) >; @@ -628,7 +619,6 @@ class ComplexNestedWithDefault_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(4696534039109938636ull) >; @@ -730,7 +720,6 @@ class MinPadding_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(15544025728095240172ull) >; @@ -832,7 +821,6 @@ class MinPaddingWithCustomType_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(7684052946909757228ull) >; @@ -932,7 +920,6 @@ class MyStruct_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(7297685140594097580ull) >; @@ -972,7 +959,6 @@ class MyDataItem_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(12130458833448478092ull) >; @@ -1014,7 +1000,6 @@ class Renamed_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(16991037874674243596ull) >; @@ -1071,7 +1056,6 @@ class AnnotatedTypes_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(1793176683567931084ull) >; @@ -1128,7 +1112,6 @@ class ForwardUsageRoot_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(10538773386942393836ull) >; @@ -1170,7 +1153,6 @@ class ForwardUsageStruct_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(18216634639574172236ull) >; @@ -1212,7 +1194,6 @@ class ForwardUsageByRef_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(5700960773715231532ull) >; @@ -1254,7 +1235,6 @@ class IncompleteMap_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(16588713789532572172ull) >; @@ -1281,7 +1261,6 @@ class IncompleteMapDep_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(4444540283774281516ull) >; @@ -1323,7 +1302,6 @@ class CompleteMap_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(9142601727424815244ull) >; @@ -1350,7 +1328,6 @@ class CompleteMapDep_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(2085767742389370668ull) >; @@ -1392,7 +1369,6 @@ class IncompleteList_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(9170269616021633420ull) >; @@ -1419,7 +1395,6 @@ class IncompleteListDep_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(4545907507200868780ull) >; @@ -1461,7 +1436,6 @@ class CompleteList_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(14114502851208255084ull) >; @@ -1488,7 +1462,6 @@ class CompleteListDep_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(2033021518320534444ull) >; @@ -1530,7 +1503,6 @@ class AdaptedList_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(125790966858066028ull) >; @@ -1572,7 +1544,6 @@ class AdaptedListDep_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(18047110259932940396ull) >; @@ -1614,7 +1585,6 @@ class DependentAdaptedList_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(7176728000892714092ull) >; @@ -1656,7 +1626,6 @@ class DependentAdaptedListDep_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(6008111321105911756ull) >; @@ -1801,7 +1770,6 @@ class AllocatorAware_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(435233143439422188ull) >; @@ -1871,7 +1839,6 @@ class AllocatorAware2_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(17013646540360458924ull) >; @@ -1943,7 +1910,6 @@ class TypedefStruct_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(17342541271444691756ull) >; @@ -1985,7 +1951,6 @@ class StructWithDoubleUnderscores_struct_traits { >; using members_annotations = __fbthrift_annotations::members; using metadata = ::apache::thrift::detail::type_common_metadata_impl< - module_tags::module, ::apache::thrift::reflected_annotations<__fbthrift_annotations>, static_cast<::apache::thrift::legacy_type_id_t>(11308628853865465068ull) >; diff --git a/third-party/thrift/src/thrift/lib/cpp2/reflection/demo/activation.cpp b/third-party/thrift/src/thrift/lib/cpp2/reflection/demo/activation.cpp deleted file mode 100644 index 823bf4bda3a1c5..00000000000000 --- a/third-party/thrift/src/thrift/lib/cpp2/reflection/demo/activation.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include - -using namespace apache::thrift; -using namespace static_reflection::demo; - -struct creator { - template - void operator()(fatal::tag, Out& out) { - out.template emplace(); - } -}; - -template -struct activator { - using module = reflect_module; - - using structs = fatal::transform; - // fatal::list - - using reflected_structs = - fatal::transform>; - // fatal::list< - // reflect_struct, - // reflect_struct, - // ..., - // reflect_struct - // > - - using variant = fatal::apply_to; - // fatal::auto_variant - - static variant create(folly::StringPiece name) { - variant out; - - bool found = fatal::trie_find( - name.begin(), name.end(), creator(), out); - - if (!found) { - std::cerr << "no type named " << name << '\n'; - } - - return out; - } -}; - -int main(int argc, char** argv) { - folly::init(&argc, &argv); - - using factory = activator; - - auto prompt = [](std::string& out) { - std::cout << "type to instantiate: "; - std::cin >> out; - return static_cast(std::cin); - }; - - for (std::string name; prompt(name);) { - auto instance = factory::create(name); - - instance.visit([](const auto& what) { - std::cout << typeid(what).name() << std::endl; - }); - } - - return 0; -} diff --git a/third-party/thrift/src/thrift/lib/cpp2/reflection/demo/module_basics.cpp b/third-party/thrift/src/thrift/lib/cpp2/reflection/demo/module_basics.cpp deleted file mode 100644 index 55434d81013045..00000000000000 --- a/third-party/thrift/src/thrift/lib/cpp2/reflection/demo/module_basics.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include -#include - -using namespace apache::thrift; -using namespace static_reflection::demo; - -struct print_namespace { - template - void operator()(fatal::indexed_pair) const { - std::cout << " namespace for '" << fatal::z_data() << "'\n"; - } -}; - -struct print_variant_member { - template - void operator()(fatal::indexed) const { - std::cout << " " << fatal::z_data() - << '\n'; - } -}; - -struct print_variant { - template - void operator()(fatal::indexed_pair) const { - using info = fatal::variant_traits; - std::cout << " variant " << fatal::z_data() << " {\n"; - fatal::foreach(print_variant_member()); - std::cout << " }\n\n"; - } -}; - -struct print_struct_member { - template - void operator()(fatal::indexed) const { - std::cout << " " << fatal::z_data() << '\n'; - } -}; - -struct print_struct { - template - void operator()(fatal::indexed_pair) const { - using info = reflect_struct; - std::cout << " struct " << fatal::z_data() << " {\n"; - fatal::foreach(print_struct_member()); - std::cout << " }\n\n"; - } -}; - -template -void print_module_info() { - using info = reflect_module; - std::cout << "module name: " << fatal::z_data() << '\n'; - - std::cout << '\n'; - - std::cout << "namespaces declared in module\n"; - fatal::foreach(print_namespace()); - - std::cout << '\n'; - - std::cout << "variants declared in module\n"; - fatal::foreach(print_variant()); - - std::cout << "structs declared in module\n"; - fatal::foreach(print_struct()); -} - -int main() { - print_module_info(); - - return 0; -} diff --git a/third-party/thrift/src/thrift/lib/cpp2/reflection/internal/legacy_reflection-inl-post.h b/third-party/thrift/src/thrift/lib/cpp2/reflection/internal/legacy_reflection-inl-post.h index fbc9577b1884de..e6e03d8ca6ef5c 100644 --- a/third-party/thrift/src/thrift/lib/cpp2/reflection/internal/legacy_reflection-inl-post.h +++ b/third-party/thrift/src/thrift/lib/cpp2/reflection/internal/legacy_reflection-inl-post.h @@ -230,7 +230,6 @@ struct impl_structure_util { template struct impl { using meta = reflect_struct; - using module_meta = reflect_module; struct visitor { template void operator()( @@ -261,7 +260,11 @@ struct impl { } }; static std::string rname() { - return "struct "_fs + fs() + "." + fs(); + using pa = ::apache::thrift::detail::st::private_access; + return fmt::format( + "struct {}.{}", + pa::__fbthrift_get_module_name(), + pa::__fbthrift_get_class_name()); } static id_t rid() { static const auto storage = get_type_id(type_t::TYPE_STRUCT, rname()); @@ -278,8 +281,6 @@ struct impl { template struct impl { using meta = reflect_variant; - using meta_traits = typename meta::traits; - using module_meta = reflect_module; struct visitor { template void operator()( @@ -298,7 +299,11 @@ struct impl { } }; static std::string rname() { - return "struct "_fs + fs() + "." + fs(); + using pa = ::apache::thrift::detail::st::private_access; + return fmt::format( + "struct {}.{}", + pa::__fbthrift_get_module_name(), + pa::__fbthrift_get_class_name()); } static id_t rid() { static const auto storage = get_type_id(type_t::TYPE_STRUCT, rname()); diff --git a/third-party/thrift/src/thrift/lib/cpp2/reflection/internal/reflection-inl-post.h b/third-party/thrift/src/thrift/lib/cpp2/reflection/internal/reflection-inl-post.h index 37e05d437f93f2..da6ef3491ca44a 100644 --- a/third-party/thrift/src/thrift/lib/cpp2/reflection/internal/reflection-inl-post.h +++ b/third-party/thrift/src/thrift/lib/cpp2/reflection/internal/reflection-inl-post.h @@ -41,9 +41,8 @@ using reflected_no_annotations = reflected_annotations; } // namespace reflection_impl -template +template struct type_common_metadata_impl { - using module = Module; using annotations = Annotations; using legacy_id = std::integral_constant; }; diff --git a/third-party/thrift/src/thrift/lib/cpp2/reflection/internal/reflection-inl-pre.h b/third-party/thrift/src/thrift/lib/cpp2/reflection/internal/reflection-inl-pre.h index a114908d1e7a4c..725c3c56f271c0 100644 --- a/third-party/thrift/src/thrift/lib/cpp2/reflection/internal/reflection-inl-pre.h +++ b/third-party/thrift/src/thrift/lib/cpp2/reflection/internal/reflection-inl-pre.h @@ -211,12 +211,6 @@ using getter_direct_getter_t = folly::_t>; } // namespace reflection_impl } // namespace detail -#define THRIFT_REGISTER_REFLECTION_METADATA(Tag, Traits) \ - FATAL_REGISTER_TYPE( \ - ::apache::thrift::detail::reflection_metadata_tag, \ - Tag, \ - ::apache::thrift::reflected_module) - #define THRIFT_REGISTER_STRUCT_TRAITS(Struct, Traits) \ FATAL_REGISTER_TYPE( \ ::apache::thrift::detail::struct_traits_metadata_tag, \ diff --git a/third-party/thrift/src/thrift/lib/cpp2/reflection/reflection.h b/third-party/thrift/src/thrift/lib/cpp2/reflection/reflection.h index 90a0ba1da54c62..3eca7d0cdb1843 100644 --- a/third-party/thrift/src/thrift/lib/cpp2/reflection/reflection.h +++ b/third-party/thrift/src/thrift/lib/cpp2/reflection/reflection.h @@ -210,342 +210,6 @@ template using reflect_type_class_of_thrift_class = typename detail::reflect_type_class_of_thrift_class_impl::type; -///////////////////////// -// SECTION: MODULE API // -///////////////////////// - -/** - * Holds reflection metadata for stuff defined in a Thrift file. - * - * NOTE: this class template is only intended to be instantiated by Thrift. - * Users should ignore the template parameters taken by it and focus simply on - * the members provided. - * - * @author: Marcelo Juchem - */ -template -struct reflected_module { - /** - * The name. - * - * A `fatal::constant_sequence` (compile-time string) representing the module - * name. - * - * Example: - * - * // MyModule.thrift - * - * namespace cpp2 My.Namespace - * struct MyStruct {} - * - * // C++ - * - * using info = reflect_module; - * using name = typename info::name; - * // yields `fatal::constant_sequence< - * // char, 'M', 'y', 'M', 'o', 'd', 'u', 'l', 'e', - * // >` - */ - using name = typename Traits::name; - - /** - * The map from language to namespace. - * - * A `fatal::list` of `fatal::pair` where the key is a `fatal::sequence` - * (compile-time string) representing the language, associated with a - * compile-time string representing the namespace. - * - * Example: - * - * // MyModule.thrift - * - * namespace cpp My.NamespaceCpp - * namespace cpp2 My.Namespace - * namespace java My.Namespace - * - * struct MyStruct { - * 1: i32 a - * 2: string b - * 3: double c - * } - * - * // C++ - * - * using info = reflect_module; - * - * FATAL_S(cpp, "cpp"); - * FATAL_S(cpp2, "cpp2"); - * FATAL_S(java, "java"); - * - * // yields `fatal::sequence< - * // char, - * // 'M', 'y', ':', ':', 'N', 'a', 'm', 'e', - * // 's', 'p', 'a', 'c', 'e', 'C', 'p', 'p' - * // >` - * using result1 = fatal::get; - * - * // yields `fatal::sequence< - * // char, 'M', 'y', ':', ':', 'N', 'a', 'm', 'e', 's', 'p', 'a', 'c', 'e' - * // >` - * using result2 = fatal::get; - * - * // yields `fatal::sequence< - * // char, 'M', 'y', '.', 'N', 'a', 'm', 'e', 's', 'p', 'a', 'c', 'e' - * // >` - * using result3 = fatal::get; - * - * @author: Marcelo Juchem - */ - using namespaces = typename Traits::namespaces; - - /** - * The list of enumerations with reflection metadata available. - * - * A `fatal::list` of `fatal::pair` where the first type is the one generated - * by the Thrift compiler for each enumeration, and the second one is the - * compile-time string (`fatal::sequence`) representing the enumeration name. - * - * Use `fatal::enum_traits` to retrieve reflection information for each - * enumeration (fatal/type/enum.h). - * - * @author: Marcelo Juchem - */ - using enums = typename Traits::enums; - - /** - * The list of unions with reflection metadata available. - * - * A `fatal::list` of `fatal::pair` where the first type is the one generated - * by the Thrift compiler for each union, and the second one is the - * compile-time string (`fatal::sequence`) representing the union name. - * - * Use `fatal::variant_traits` to retrieve reflection information for each - * union (fatal/type/variant_traits.h). - * - * @author: Marcelo Juchem - */ - using unions = typename Traits::unions; - - /** - * The list of structs with reflection metadata available. - * - * A `fatal::list` of `fatal::pair` where the first type is the one generated - * by the Thrift compiler for each struct, and the second one is the - * compile-time string (`fatal::sequence`) representing the struct name. - * - * @author: Marcelo Juchem - */ - using structs = typename Traits::structs; - - /** - * The list of services with reflection metadata available. - * - * A `fatal::list` of compile-time strings - * (`fatal::sequence`) representing each service name. - * - * @author: Marcelo Juchem - */ - using services = typename Traits::services; -}; - -/** - * Retrieves reflection metadata (as a `reflected_module`) associated with the - * given reflection metadata tag. - * - * The Thrift compiler generates a reflection metadata tag for each Thrift file - * named `namespace::thriftfilename_tags::module`. - * - * If the given tag does not represent a Thrift module, or if there's no - * reflection metadata available for it, compilation will fail. - * - * See the documentation on `reflected_module` (above) for more information on - * the returned type. - * - * Example: - * - * ///////////////////// - * // MyModule.thrift // - * ///////////////////// - * namespace cpp2 My.Namespace - * - * enum MyEnum1 { a, b, c } - * enum MyEnum2 { x, y, x } - * - * ////////////////// - * // whatever.cpp // - * ////////////////// - * using info = reflect_module; - * - * // yields `2` - * auto result1 = info::enums::size; - * - * // fails compilation - * using result2 = reflect_module; - * - * @author: Marcelo Juchem - */ -template -using reflect_module = fatal:: - registry_lookup; - -/** - * Retrieves reflection metadata (as a `reflected_module`) associated with the - * given reflection metadata tag. - * - * The Thrift compiler generates a reflection metadata tag for each Thrift file - * named `namespace::thriftfilename_tags::module`. - * - * If the given tag does not represent a Thrift module, or if there's no - * reflection metadata available for it, `Default` will be returned.s If - * `Default` is not specified, it defaults to void. - * - * See the documentation on `reflected_module` (above) for more information on - * the returned type. - * - * Example: - * - * ///////////////////// - * // MyModule.thrift // - * ///////////////////// - * namespace cpp2 My.Namespace - * - * enum MyEnum1 { a, b, c } - * enum MyEnum2 { x, y, x } - * - * ////////////////// - * // whatever.cpp // - * ////////////////// - * using info = try_reflect_module< - * My::Namespace::MyModule_tags::module, - * void - * >; - * - * // yields `2` - * auto result1 = info::enums::size; - * - * // yields `void` - * using result2 = try_reflect_module; - * - * @author: Marcelo Juchem - */ -template -using try_reflect_module = fatal::try_registry_lookup< - apache::thrift::detail::reflection_metadata_tag, - Tag, - Default>; - -/** - * Tells whether the given type is a tag that represents the reflection metadata - * of the types declared in a Thrift file. - * - * Example: - * - * ///////////////////// - * // MyModule.thrift // - * ///////////////////// - * namespace cpp2 My.Namespace - * - * struct MyStruct { - * 1: i32 a - * 2: string b - * 3: double c - * } - * - * ///////////// - * // foo.cpp // - * ///////////// - * - * // yields `std::true_type` - * using result1 = is_reflectable_module; - * - * // yields `std::false_type` - * using result2 = is_reflectable_module; - * - * // yields `std::false_type` - * using result3 = is_reflectable_module; - * - * @author: Marcelo Juchem - */ -template -using is_reflectable_module = std:: - integral_constant, void>>; - -/** - * Gets the reflection metadata tag for the Thrift file where the type `T` is - * declared. - * - * The type `T` must be either a struct, enum or union. - * - * Example: - * - * // MyModule.thrift - * - * namespace cpp2 My.Namespace - * - * struct MyStruct { - * 1: i32 a - * 2: string b - * 3: double c - * } - * - * enum MyEnum { a, b, c } - * - * // C++ - * - * // yields `My::Namespace::MyModule_tags::module` - * using result1 = reflect_module_tag; - * - * // yields `My::Namespace::MyModule_tags::module` - * using result2 = reflect_module_tag; - * - * @author: Marcelo Juchem - */ -template -using reflect_module_tag = - typename apache::thrift::detail::reflect_module_tag_selector< - reflect_type_class_of_thrift_class, - T, - false>::type; - -/** - * Tries to get the reflection metadata tag for the Thrift file where the type - * `T` is declared. - * -e: - * - * // MyModule.thrift - * - * namespace cpp2 My.Namespace - * - * struct MyStruct { - * 1: i32 a - * 2: string b - * 3: double c - * } - * - * enum MyEnum { a, b, c } - * - * // C++ - * - * // yields `My::Namespace::MyModule_tags::module` - * using result1 = reflect_module_tag; - * - * // yields `My::Namespace::MyModule_tags::module` - * using result2 = reflect_module_tag; - * - * // yields `void` - * using result3 = reflect_module_tag; - * - * @author: Marcelo Juchem - */ -template -using try_reflect_module_tag = - typename apache::thrift::detail::reflect_module_tag_selector< - reflect_type_class_of_thrift_class, - T, - true, - Default>::type; - /** * Represents an annotation from `reflected_annotations::map`. * @@ -752,21 +416,6 @@ struct reflected_struct { */ using name = typename Traits::name; - /** - * The reflection metadata tag for the Thrift file where this structure is - * declared. - * - * Example: - * - * using info = reflect_struct; - * - * // yields `My::Namespace::MyModule_tags::module` - * using result = info::module; - * - * @author: Marcelo Juchem - */ - using module = typename Traits::metadata::module; - /** * An implementation defined type template that provides the appropriate * `reflected_struct_data_member` for each data member as a member type alias @@ -1361,21 +1010,6 @@ struct reflected_variant { */ using traits = fatal::variant_traits; - /** - * The reflection metadata tag for the Thrift file where this union is - * declared. - * - * Example: - * - * using info = reflect_variant; - * - * // yields `My::Namespace::MyModule_tags::module` - * using result = info::module; - * - * @author: Marcelo Juchem - */ - using module = typename traits::metadata::module; - /** * An instantiation of `reflected_annotations` representing the annotations * declared for this type in the Thrift file. diff --git a/third-party/thrift/src/thrift/test/reflection/TroublesomeTest.cpp b/third-party/thrift/src/thrift/test/reflection/TroublesomeTest.cpp index 9e65c56caae777..fe15fb0fd74937 100644 --- a/third-party/thrift/src/thrift/test/reflection/TroublesomeTest.cpp +++ b/third-party/thrift/src/thrift/test/reflection/TroublesomeTest.cpp @@ -23,8 +23,6 @@ namespace apache::thrift::test::reflection { namespace { TEST(TroublesomeTest, FatalReflection) { - using module = reflect_module; - EXPECT_STREQ(fatal::z_data(), "troublesome"); EXPECT_STREQ(fatal::z_data(), "strings"); EXPECT_STREQ(fatal::z_data(), "structs"); EXPECT_STREQ(fatal::z_data(), "enums"); diff --git a/third-party/thrift/src/thrift/test/reflection/fatal_struct_test.cpp b/third-party/thrift/src/thrift/test/reflection/fatal_struct_test.cpp index 88a9e840d2994e..8054c8d81499c7 100644 --- a/third-party/thrift/src/thrift/test/reflection/fatal_struct_test.cpp +++ b/third-party/thrift/src/thrift/test/reflection/fatal_struct_test.cpp @@ -74,7 +74,6 @@ TEST(fatal_struct, struct1_sanity_check) { EXPECT_SAME(); EXPECT_SAME(); - EXPECT_SAME(); EXPECT_SAME>(); EXPECT_SAME>(); diff --git a/third-party/thrift/src/thrift/test/reflection/fatal_test.cpp b/third-party/thrift/src/thrift/test/reflection/fatal_test.cpp index abde95e5af4038..2eb84b478df2c9 100644 --- a/third-party/thrift/src/thrift/test/reflection/fatal_test.cpp +++ b/third-party/thrift/src/thrift/test/reflection/fatal_test.cpp @@ -141,81 +141,6 @@ TEST(fatal, tags) { reflection_tags::services::service_with_special_names>(); } -TEST(fatal, metadata) { - using info = apache::thrift::reflect_module; - - EXPECT_SAME< - info, - apache::thrift::try_reflect_module>(); - EXPECT_SAME>(); - - EXPECT_SAME< - fatal::list< - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair>, - info::namespaces>(); - - EXPECT_SAME< - fatal::list< - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair>, - info::enums>(); - - EXPECT_SAME< - fatal::list< - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair>, - info::unions>(); - - EXPECT_SAME< - fatal::list< - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair, - fatal::pair>, - - info::structs>(); - - EXPECT_SAME< - fatal::list, - info::services>(); -} - } // namespace cpp_reflection } // namespace test_cpp2 @@ -224,135 +149,6 @@ TEST(fatal, metadata) { namespace test_cpp2 { namespace cpp_reflection { -TEST(fatal, reflect_module_tag) { - using tag = reflection_tags::module; - - EXPECT_SAME>(); - EXPECT_SAME>(); - EXPECT_SAME>(); - EXPECT_SAME< - tag, - apache::thrift::reflect_module_tag>(); - - EXPECT_SAME>(); - EXPECT_SAME>(); - EXPECT_SAME>(); - EXPECT_SAME>(); - EXPECT_SAME>(); - EXPECT_SAME>(); - EXPECT_SAME>(); - EXPECT_SAME< - tag, - apache::thrift::reflect_module_tag>(); -} - -TEST(fatal, try_reflect_module_tag) { - using tag = reflection_tags::module; - - EXPECT_SAME>(); - EXPECT_SAME>(); - EXPECT_SAME>(); - EXPECT_SAME< - tag, - apache::thrift::try_reflect_module_tag>(); - - EXPECT_SAME>(); - EXPECT_SAME>(); - EXPECT_SAME>(); - EXPECT_SAME>(); - EXPECT_SAME>(); - EXPECT_SAME< - tag, - apache::thrift::try_reflect_module_tag>(); - EXPECT_SAME>(); - EXPECT_SAME< - tag, - apache::thrift:: - try_reflect_module_tag>(); - - EXPECT_SAME>(); - EXPECT_SAME>(); - EXPECT_SAME< - void, - apache::thrift::try_reflect_module_tag>(); -} - -TEST(reflection, is_reflectable_module) { - EXPECT_SAME< - std::true_type, - apache::thrift::is_reflectable_module>(); - - EXPECT_SAME>(); - EXPECT_SAME>(); - EXPECT_SAME>(); - - EXPECT_SAME>(); - EXPECT_SAME>(); - EXPECT_SAME>(); - - EXPECT_SAME< - std::false_type, - apache::thrift::is_reflectable_module>(); - EXPECT_SAME< - std::false_type, - apache::thrift::is_reflectable_module>(); - EXPECT_SAME< - std::false_type, - apache::thrift::is_reflectable_module>(); - - EXPECT_SAME>(); - EXPECT_SAME>(); - EXPECT_SAME< - std::false_type, - apache::thrift::is_reflectable_module>(); - - EXPECT_SAME< - std::false_type, - apache::thrift::is_reflectable_module>>(); - EXPECT_SAME< - std::false_type, - apache::thrift::is_reflectable_module>>(); - EXPECT_SAME< - std::false_type, - apache::thrift::is_reflectable_module>>(); - - EXPECT_SAME< - std::false_type, - apache::thrift::is_reflectable_module>>(); - EXPECT_SAME< - std::false_type, - apache::thrift::is_reflectable_module>>(); - EXPECT_SAME< - std::false_type, - apache::thrift::is_reflectable_module>>(); - - EXPECT_SAME< - std::false_type, - apache::thrift::is_reflectable_module>>(); - EXPECT_SAME< - std::false_type, - apache::thrift::is_reflectable_module>>(); - - EXPECT_SAME< - std::false_type, - apache::thrift::is_reflectable_module>>(); - EXPECT_SAME< - std::false_type, - apache::thrift::is_reflectable_module>>(); - EXPECT_SAME< - std::false_type, - apache::thrift::is_reflectable_module>>(); - - EXPECT_SAME< - std::false_type, - apache::thrift::is_reflectable_module< - std::unordered_map>>(); - EXPECT_SAME< - std::false_type, - apache::thrift::is_reflectable_module< - std::unordered_map>>(); -} - TEST(reflection, is_reflectable_struct) { EXPECT_SAME< std::false_type, @@ -534,12 +330,5 @@ TEST(reflection, reflect_type_class_of_thrift_class) { apache::thrift::reflect_type_class_of_thrift_class>(); } -TEST(reflection, reflected_module_name) { - using module = test_cpp2::cpp_reflection::reflection_tags::module; - using module_meta = apache::thrift::reflect_module; - const auto module_name = fatal::to_instance(); - EXPECT_EQ("reflection", module_name); -} - } // namespace cpp_reflection } // namespace test_cpp2