Skip to content

Commit 69cb9d3

Browse files
Mizuchimeta-codesync[bot]
authored andcommitted
Migrate class/field name from legacy reflection to always-on reflection in unit-test
Reviewed By: aristidisp Differential Revision: D90030432 fbshipit-source-id: dfc8a2d6509cddd1f451606766058d86a4ccff58
1 parent 6b781d9 commit 69cb9d3

3 files changed

Lines changed: 88 additions & 145 deletions

File tree

third-party/thrift/src/thrift/lib/cpp2/reflection/internal/legacy_reflection-inl-post.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,10 @@ struct impl<T, type_class::structure> {
238238
using type = deref_inner_t<decltype(getter{}(std::declval<T&>()))>;
239239
using type_class = typename MemberInfo::type_class;
240240
using type_helper = get_helper<type, type_class>;
241-
using member_name = typename MemberInfo::name;
242241
using member_annotations = typename MemberInfo::annotations::map;
243242
type_helper::register_into(schema);
244243
auto& f = (*dt.fields())[MemberInfo::id::value];
245-
std::string name = fatal::to_instance<std::string, member_name>();
244+
std::string name = MemberInfo::name_v.str();
246245
impl_structure_util::init(
247246
f,
248247
type_helper::id(),

third-party/thrift/src/thrift/test/benchmarks/reflection_benchmark.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void add_benchmark() {
7777
int k = 0;
7878
fatal::foreach<typename reflect_struct<Struct>::members>([&k](auto tag) {
7979
using Member = decltype(fatal::tag_type(tag));
80-
const char* name = fatal::z_data<typename Member::name>();
80+
const char* name = Member::name_v.data();
8181
for (char c : std::string_view(name)) {
8282
k += c;
8383
}

0 commit comments

Comments
 (0)