Move `ClassData` and friends out of `MessageLite` and into the `internal` namespace.

This will simplify runtime code that wants to access and use the structures.
This is a refactor with no expected behavior change.

PiperOrigin-RevId: 679316372
pull/18451/head
Protobuf Team Bot 2 months ago committed by Copybara-Service
parent df5a4d63e8
commit 49bb305147
  1. 6
      src/google/protobuf/arena_unittest.cc
  2. 78
      src/google/protobuf/compiler/cpp/message.cc
  3. 37
      src/google/protobuf/compiler/java/java_features.pb.cc
  4. 4
      src/google/protobuf/compiler/java/java_features.pb.h
  5. 148
      src/google/protobuf/compiler/plugin.pb.cc
  6. 16
      src/google/protobuf/compiler/plugin.pb.h
  7. 37
      src/google/protobuf/cpp_features.pb.cc
  8. 4
      src/google/protobuf/cpp_features.pb.h
  9. 1419
      src/google/protobuf/descriptor.pb.cc
  10. 132
      src/google/protobuf/descriptor.pb.h
  11. 8
      src/google/protobuf/dynamic_message.cc
  12. 7
      src/google/protobuf/generated_message_tctable_decl.h
  13. 4
      src/google/protobuf/implicit_weak_message.cc
  14. 6
      src/google/protobuf/message.cc
  15. 6
      src/google/protobuf/message.h
  16. 2
      src/google/protobuf/message_lite.cc
  17. 340
      src/google/protobuf/message_lite.h

@ -205,7 +205,7 @@ void TestCtorAndDtorTraits(std::vector<absl::string_view> def,
ABSL_LOG(FATAL); ABSL_LOG(FATAL);
return nullptr; return nullptr;
} }
const ClassData* GetClassData() const PROTOBUF_FINAL { const internal::ClassData* GetClassData() const PROTOBUF_FINAL {
ABSL_LOG(FATAL); ABSL_LOG(FATAL);
return nullptr; return nullptr;
} }
@ -528,7 +528,9 @@ class DispatcherTestProto : public Message {
: Message(nullptr, nullptr) { : Message(nullptr, nullptr) {
ABSL_LOG(FATAL); ABSL_LOG(FATAL);
} }
const ClassData* GetClassData() const PROTOBUF_FINAL { ABSL_LOG(FATAL); } const internal::ClassData* GetClassData() const PROTOBUF_FINAL {
ABSL_LOG(FATAL);
}
}; };
// We use a specialization to inject behavior for the test. // We use a specialization to inject behavior for the test.
// This test is very intrusive and will have to be fixed if we change the // This test is very intrusive and will have to be fixed if we change the

@ -1399,11 +1399,11 @@ void MessageGenerator::GenerateMapEntryClassDefinition(io::Printer* p) {
$parse_decls$; $parse_decls$;
$decl_annotate$; $decl_annotate$;
const $superclass$::ClassData* GetClassData() const PROTOBUF_FINAL; const $pbi$::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::$proto_ns$::Arena* arena); ::$proto_ns$::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const $superclass$::ClassDataFull _class_data_; static const $pbi$::ClassDataFull _class_data_;
}; };
)cc"); )cc");
} }
@ -2182,11 +2182,11 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) {
*this = ::std::move(from); *this = ::std::move(from);
} }
$arena_dtor$; $arena_dtor$;
const $superclass$::ClassData* GetClassData() const PROTOBUF_FINAL; const $pbi$::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::$proto_ns$::Arena* arena); ::$proto_ns$::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const $superclass$::$classdata_type$ _class_data_; static const $pbi$::$classdata_type$ _class_data_;
public: public:
$get_metadata$; $get_metadata$;
@ -4066,28 +4066,27 @@ void MessageGenerator::GenerateClassData(io::Printer* p) {
R"cc( R"cc(
PROTOBUF_CONSTINIT PROTOBUF_CONSTINIT
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
const ::$proto_ns$::MessageLite::ClassDataFull const $pbi$::ClassDataFull $classname$::_class_data_ = {
$classname$::_class_data_ = { $pbi$::ClassData{
$superclass$::ClassData{ $default_instance$,
$default_instance$, &_table_.header,
&_table_.header, $on_demand_register_arena_dtor$,
$on_demand_register_arena_dtor$, $is_initialized$,
$is_initialized$, &$classname$::MergeImpl,
&$classname$::MergeImpl, $superclass$::GetNewImpl<$classname$>(),
$superclass$::GetNewImpl<$classname$>(),
#if defined(PROTOBUF_CUSTOM_VTABLE) #if defined(PROTOBUF_CUSTOM_VTABLE)
&$classname$::SharedDtor, &$classname$::SharedDtor,
$custom_vtable_methods$, $custom_vtable_methods$,
#endif // PROTOBUF_CUSTOM_VTABLE #endif // PROTOBUF_CUSTOM_VTABLE
PROTOBUF_FIELD_OFFSET($classname$, $cached_size$), PROTOBUF_FIELD_OFFSET($classname$, $cached_size$),
false, false,
$v2_msg_table$, $v2_msg_table$,
}, },
&$classname$::kDescriptorMethods, &$classname$::kDescriptorMethods,
&$desc_table$, &$desc_table$,
$tracker_on_get_metadata$, $tracker_on_get_metadata$,
}; };
const ::$proto_ns$::MessageLite::ClassData* $classname$::GetClassData() const { const $pbi$::ClassData* $classname$::GetClassData() const {
$pin_weak_descriptor$; $pin_weak_descriptor$;
$pbi$::PrefetchToLocalCache(&_class_data_); $pbi$::PrefetchToLocalCache(&_class_data_);
$pbi$::PrefetchToLocalCache(_class_data_.tc_table); $pbi$::PrefetchToLocalCache(_class_data_.tc_table);
@ -4108,26 +4107,25 @@ void MessageGenerator::GenerateClassData(io::Printer* p) {
R"cc( R"cc(
PROTOBUF_CONSTINIT PROTOBUF_CONSTINIT
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
const ::$proto_ns$::MessageLite::ClassDataLite<$type_size$> const $pbi$::ClassDataLite<$type_size$> $classname$::_class_data_ = {
$classname$::_class_data_ = { {
{ $default_instance$,
$default_instance$, &_table_.header,
&_table_.header, $on_demand_register_arena_dtor$,
$on_demand_register_arena_dtor$, $is_initialized$,
$is_initialized$, &$classname$::MergeImpl,
&$classname$::MergeImpl, $superclass$::GetNewImpl<$classname$>(),
$superclass$::GetNewImpl<$classname$>(),
#if defined(PROTOBUF_CUSTOM_VTABLE) #if defined(PROTOBUF_CUSTOM_VTABLE)
&$classname$::SharedDtor, &$classname$::SharedDtor,
$custom_vtable_methods$, $custom_vtable_methods$,
#endif // PROTOBUF_CUSTOM_VTABLE #endif // PROTOBUF_CUSTOM_VTABLE
PROTOBUF_FIELD_OFFSET($classname$, $cached_size$), PROTOBUF_FIELD_OFFSET($classname$, $cached_size$),
true, true,
$v2_msg_table$, $v2_msg_table$,
}, },
"$full_name$", "$full_name$",
}; };
const ::$proto_ns$::MessageLite::ClassData* $classname$::GetClassData() const { const $pbi$::ClassData* $classname$::GetClassData() const {
return _class_data_.base(); return _class_data_.base();
} }
)cc"); )cc");

@ -205,28 +205,27 @@ constexpr auto JavaFeatures::InternalNewImpl_() {
} }
PROTOBUF_CONSTINIT PROTOBUF_CONSTINIT
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
const ::google::protobuf::MessageLite::ClassDataFull const ::google::protobuf::internal::ClassDataFull JavaFeatures::_class_data_ = {
JavaFeatures::_class_data_ = { ::google::protobuf::internal::ClassData{
::google::protobuf::Message::ClassData{ &_JavaFeatures_default_instance_._instance,
&_JavaFeatures_default_instance_._instance, &_table_.header,
&_table_.header, nullptr, // OnDemandRegisterArenaDtor
nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized
nullptr, // IsInitialized &JavaFeatures::MergeImpl,
&JavaFeatures::MergeImpl, ::google::protobuf::Message::GetNewImpl<JavaFeatures>(),
::google::protobuf::Message::GetNewImpl<JavaFeatures>(),
#if defined(PROTOBUF_CUSTOM_VTABLE) #if defined(PROTOBUF_CUSTOM_VTABLE)
&JavaFeatures::SharedDtor, &JavaFeatures::SharedDtor,
::google::protobuf::Message::GetClearImpl<JavaFeatures>(), &JavaFeatures::ByteSizeLong, ::google::protobuf::Message::GetClearImpl<JavaFeatures>(), &JavaFeatures::ByteSizeLong,
&JavaFeatures::_InternalSerialize, &JavaFeatures::_InternalSerialize,
#endif // PROTOBUF_CUSTOM_VTABLE #endif // PROTOBUF_CUSTOM_VTABLE
PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_._cached_size_), PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_._cached_size_),
false, false,
}, },
&JavaFeatures::kDescriptorMethods, &JavaFeatures::kDescriptorMethods,
&descriptor_table_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto, &descriptor_table_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto,
nullptr, // tracker nullptr, // tracker
}; };
const ::google::protobuf::MessageLite::ClassData* JavaFeatures::GetClassData() const { const ::google::protobuf::internal::ClassData* JavaFeatures::GetClassData() const {
::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_);
::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table);
return _class_data_.base(); return _class_data_.base();

@ -234,11 +234,11 @@ class PROTOC_EXPORT JavaFeatures final
: JavaFeatures(arena) { : JavaFeatures(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;

@ -403,28 +403,27 @@ constexpr auto Version::InternalNewImpl_() {
} }
PROTOBUF_CONSTINIT PROTOBUF_CONSTINIT
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
const ::google::protobuf::MessageLite::ClassDataFull const ::google::protobuf::internal::ClassDataFull Version::_class_data_ = {
Version::_class_data_ = { ::google::protobuf::internal::ClassData{
::google::protobuf::Message::ClassData{ &_Version_default_instance_._instance,
&_Version_default_instance_._instance, &_table_.header,
&_table_.header, nullptr, // OnDemandRegisterArenaDtor
nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized
nullptr, // IsInitialized &Version::MergeImpl,
&Version::MergeImpl, ::google::protobuf::Message::GetNewImpl<Version>(),
::google::protobuf::Message::GetNewImpl<Version>(),
#if defined(PROTOBUF_CUSTOM_VTABLE) #if defined(PROTOBUF_CUSTOM_VTABLE)
&Version::SharedDtor, &Version::SharedDtor,
::google::protobuf::Message::GetClearImpl<Version>(), &Version::ByteSizeLong, ::google::protobuf::Message::GetClearImpl<Version>(), &Version::ByteSizeLong,
&Version::_InternalSerialize, &Version::_InternalSerialize,
#endif // PROTOBUF_CUSTOM_VTABLE #endif // PROTOBUF_CUSTOM_VTABLE
PROTOBUF_FIELD_OFFSET(Version, _impl_._cached_size_), PROTOBUF_FIELD_OFFSET(Version, _impl_._cached_size_),
false, false,
}, },
&Version::kDescriptorMethods, &Version::kDescriptorMethods,
&descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto, &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto,
nullptr, // tracker nullptr, // tracker
}; };
const ::google::protobuf::MessageLite::ClassData* Version::GetClassData() const { const ::google::protobuf::internal::ClassData* Version::GetClassData() const {
::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_);
::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table);
return _class_data_.base(); return _class_data_.base();
@ -766,28 +765,27 @@ constexpr auto CodeGeneratorRequest::InternalNewImpl_() {
} }
PROTOBUF_CONSTINIT PROTOBUF_CONSTINIT
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
const ::google::protobuf::MessageLite::ClassDataFull const ::google::protobuf::internal::ClassDataFull CodeGeneratorRequest::_class_data_ = {
CodeGeneratorRequest::_class_data_ = { ::google::protobuf::internal::ClassData{
::google::protobuf::Message::ClassData{ &_CodeGeneratorRequest_default_instance_._instance,
&_CodeGeneratorRequest_default_instance_._instance, &_table_.header,
&_table_.header, nullptr, // OnDemandRegisterArenaDtor
nullptr, // OnDemandRegisterArenaDtor CodeGeneratorRequest::IsInitializedImpl,
CodeGeneratorRequest::IsInitializedImpl, &CodeGeneratorRequest::MergeImpl,
&CodeGeneratorRequest::MergeImpl, ::google::protobuf::Message::GetNewImpl<CodeGeneratorRequest>(),
::google::protobuf::Message::GetNewImpl<CodeGeneratorRequest>(),
#if defined(PROTOBUF_CUSTOM_VTABLE) #if defined(PROTOBUF_CUSTOM_VTABLE)
&CodeGeneratorRequest::SharedDtor, &CodeGeneratorRequest::SharedDtor,
::google::protobuf::Message::GetClearImpl<CodeGeneratorRequest>(), &CodeGeneratorRequest::ByteSizeLong, ::google::protobuf::Message::GetClearImpl<CodeGeneratorRequest>(), &CodeGeneratorRequest::ByteSizeLong,
&CodeGeneratorRequest::_InternalSerialize, &CodeGeneratorRequest::_InternalSerialize,
#endif // PROTOBUF_CUSTOM_VTABLE #endif // PROTOBUF_CUSTOM_VTABLE
PROTOBUF_FIELD_OFFSET(CodeGeneratorRequest, _impl_._cached_size_), PROTOBUF_FIELD_OFFSET(CodeGeneratorRequest, _impl_._cached_size_),
false, false,
}, },
&CodeGeneratorRequest::kDescriptorMethods, &CodeGeneratorRequest::kDescriptorMethods,
&descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto, &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto,
nullptr, // tracker nullptr, // tracker
}; };
const ::google::protobuf::MessageLite::ClassData* CodeGeneratorRequest::GetClassData() const { const ::google::protobuf::internal::ClassData* CodeGeneratorRequest::GetClassData() const {
::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_);
::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table);
return _class_data_.base(); return _class_data_.base();
@ -1164,28 +1162,27 @@ constexpr auto CodeGeneratorResponse_File::InternalNewImpl_() {
} }
PROTOBUF_CONSTINIT PROTOBUF_CONSTINIT
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
const ::google::protobuf::MessageLite::ClassDataFull const ::google::protobuf::internal::ClassDataFull CodeGeneratorResponse_File::_class_data_ = {
CodeGeneratorResponse_File::_class_data_ = { ::google::protobuf::internal::ClassData{
::google::protobuf::Message::ClassData{ &_CodeGeneratorResponse_File_default_instance_._instance,
&_CodeGeneratorResponse_File_default_instance_._instance, &_table_.header,
&_table_.header, nullptr, // OnDemandRegisterArenaDtor
nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized
nullptr, // IsInitialized &CodeGeneratorResponse_File::MergeImpl,
&CodeGeneratorResponse_File::MergeImpl, ::google::protobuf::Message::GetNewImpl<CodeGeneratorResponse_File>(),
::google::protobuf::Message::GetNewImpl<CodeGeneratorResponse_File>(),
#if defined(PROTOBUF_CUSTOM_VTABLE) #if defined(PROTOBUF_CUSTOM_VTABLE)
&CodeGeneratorResponse_File::SharedDtor, &CodeGeneratorResponse_File::SharedDtor,
::google::protobuf::Message::GetClearImpl<CodeGeneratorResponse_File>(), &CodeGeneratorResponse_File::ByteSizeLong, ::google::protobuf::Message::GetClearImpl<CodeGeneratorResponse_File>(), &CodeGeneratorResponse_File::ByteSizeLong,
&CodeGeneratorResponse_File::_InternalSerialize, &CodeGeneratorResponse_File::_InternalSerialize,
#endif // PROTOBUF_CUSTOM_VTABLE #endif // PROTOBUF_CUSTOM_VTABLE
PROTOBUF_FIELD_OFFSET(CodeGeneratorResponse_File, _impl_._cached_size_), PROTOBUF_FIELD_OFFSET(CodeGeneratorResponse_File, _impl_._cached_size_),
false, false,
}, },
&CodeGeneratorResponse_File::kDescriptorMethods, &CodeGeneratorResponse_File::kDescriptorMethods,
&descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto, &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto,
nullptr, // tracker nullptr, // tracker
}; };
const ::google::protobuf::MessageLite::ClassData* CodeGeneratorResponse_File::GetClassData() const { const ::google::protobuf::internal::ClassData* CodeGeneratorResponse_File::GetClassData() const {
::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_);
::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table);
return _class_data_.base(); return _class_data_.base();
@ -1529,28 +1526,27 @@ constexpr auto CodeGeneratorResponse::InternalNewImpl_() {
} }
PROTOBUF_CONSTINIT PROTOBUF_CONSTINIT
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
const ::google::protobuf::MessageLite::ClassDataFull const ::google::protobuf::internal::ClassDataFull CodeGeneratorResponse::_class_data_ = {
CodeGeneratorResponse::_class_data_ = { ::google::protobuf::internal::ClassData{
::google::protobuf::Message::ClassData{ &_CodeGeneratorResponse_default_instance_._instance,
&_CodeGeneratorResponse_default_instance_._instance, &_table_.header,
&_table_.header, nullptr, // OnDemandRegisterArenaDtor
nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized
nullptr, // IsInitialized &CodeGeneratorResponse::MergeImpl,
&CodeGeneratorResponse::MergeImpl, ::google::protobuf::Message::GetNewImpl<CodeGeneratorResponse>(),
::google::protobuf::Message::GetNewImpl<CodeGeneratorResponse>(),
#if defined(PROTOBUF_CUSTOM_VTABLE) #if defined(PROTOBUF_CUSTOM_VTABLE)
&CodeGeneratorResponse::SharedDtor, &CodeGeneratorResponse::SharedDtor,
::google::protobuf::Message::GetClearImpl<CodeGeneratorResponse>(), &CodeGeneratorResponse::ByteSizeLong, ::google::protobuf::Message::GetClearImpl<CodeGeneratorResponse>(), &CodeGeneratorResponse::ByteSizeLong,
&CodeGeneratorResponse::_InternalSerialize, &CodeGeneratorResponse::_InternalSerialize,
#endif // PROTOBUF_CUSTOM_VTABLE #endif // PROTOBUF_CUSTOM_VTABLE
PROTOBUF_FIELD_OFFSET(CodeGeneratorResponse, _impl_._cached_size_), PROTOBUF_FIELD_OFFSET(CodeGeneratorResponse, _impl_._cached_size_),
false, false,
}, },
&CodeGeneratorResponse::kDescriptorMethods, &CodeGeneratorResponse::kDescriptorMethods,
&descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto, &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto,
nullptr, // tracker nullptr, // tracker
}; };
const ::google::protobuf::MessageLite::ClassData* CodeGeneratorResponse::GetClassData() const { const ::google::protobuf::internal::ClassData* CodeGeneratorResponse::GetClassData() const {
::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_);
::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table);
return _class_data_.base(); return _class_data_.base();

@ -251,11 +251,11 @@ class PROTOC_EXPORT Version final
: Version(arena) { : Version(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -490,11 +490,11 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final
: CodeGeneratorResponse_File(arena) { : CodeGeneratorResponse_File(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -745,11 +745,11 @@ class PROTOC_EXPORT CodeGeneratorResponse final
: CodeGeneratorResponse(arena) { : CodeGeneratorResponse(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -1029,11 +1029,11 @@ class PROTOC_EXPORT CodeGeneratorRequest final
: CodeGeneratorRequest(arena) { : CodeGeneratorRequest(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;

@ -205,28 +205,27 @@ constexpr auto CppFeatures::InternalNewImpl_() {
} }
PROTOBUF_CONSTINIT PROTOBUF_CONSTINIT
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
const ::google::protobuf::MessageLite::ClassDataFull const ::google::protobuf::internal::ClassDataFull CppFeatures::_class_data_ = {
CppFeatures::_class_data_ = { ::google::protobuf::internal::ClassData{
::google::protobuf::Message::ClassData{ &_CppFeatures_default_instance_._instance,
&_CppFeatures_default_instance_._instance, &_table_.header,
&_table_.header, nullptr, // OnDemandRegisterArenaDtor
nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized
nullptr, // IsInitialized &CppFeatures::MergeImpl,
&CppFeatures::MergeImpl, ::google::protobuf::Message::GetNewImpl<CppFeatures>(),
::google::protobuf::Message::GetNewImpl<CppFeatures>(),
#if defined(PROTOBUF_CUSTOM_VTABLE) #if defined(PROTOBUF_CUSTOM_VTABLE)
&CppFeatures::SharedDtor, &CppFeatures::SharedDtor,
::google::protobuf::Message::GetClearImpl<CppFeatures>(), &CppFeatures::ByteSizeLong, ::google::protobuf::Message::GetClearImpl<CppFeatures>(), &CppFeatures::ByteSizeLong,
&CppFeatures::_InternalSerialize, &CppFeatures::_InternalSerialize,
#endif // PROTOBUF_CUSTOM_VTABLE #endif // PROTOBUF_CUSTOM_VTABLE
PROTOBUF_FIELD_OFFSET(CppFeatures, _impl_._cached_size_), PROTOBUF_FIELD_OFFSET(CppFeatures, _impl_._cached_size_),
false, false,
}, },
&CppFeatures::kDescriptorMethods, &CppFeatures::kDescriptorMethods,
&descriptor_table_google_2fprotobuf_2fcpp_5ffeatures_2eproto, &descriptor_table_google_2fprotobuf_2fcpp_5ffeatures_2eproto,
nullptr, // tracker nullptr, // tracker
}; };
const ::google::protobuf::MessageLite::ClassData* CppFeatures::GetClassData() const { const ::google::protobuf::internal::ClassData* CppFeatures::GetClassData() const {
::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_);
::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table);
return _class_data_.base(); return _class_data_.base();

@ -235,11 +235,11 @@ class PROTOBUF_EXPORT CppFeatures final
: CppFeatures(arena) { : CppFeatures(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;

File diff suppressed because it is too large Load Diff

@ -842,11 +842,11 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final
: UninterpretedOption_NamePart(arena) { : UninterpretedOption_NamePart(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -1055,11 +1055,11 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final
: SourceCodeInfo_Location(arena) { : SourceCodeInfo_Location(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -1340,11 +1340,11 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final
: GeneratedCodeInfo_Annotation(arena) { : GeneratedCodeInfo_Annotation(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -1620,11 +1620,11 @@ class PROTOBUF_EXPORT FieldOptions_FeatureSupport final
: FieldOptions_FeatureSupport(arena) { : FieldOptions_FeatureSupport(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -1859,11 +1859,11 @@ class PROTOBUF_EXPORT FieldOptions_EditionDefault final
: FieldOptions_EditionDefault(arena) { : FieldOptions_EditionDefault(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -2077,11 +2077,11 @@ class PROTOBUF_EXPORT FeatureSet final
: FeatureSet(arena) { : FeatureSet(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -2637,11 +2637,11 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final
: ExtensionRangeOptions_Declaration(arena) { : ExtensionRangeOptions_Declaration(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -2895,11 +2895,11 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final
: EnumDescriptorProto_EnumReservedRange(arena) { : EnumDescriptorProto_EnumReservedRange(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -3102,11 +3102,11 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final
: DescriptorProto_ReservedRange(arena) { : DescriptorProto_ReservedRange(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -3314,11 +3314,11 @@ class PROTOBUF_EXPORT UninterpretedOption final
: UninterpretedOption(arena) { : UninterpretedOption(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -3611,11 +3611,11 @@ class PROTOBUF_EXPORT SourceCodeInfo final
: SourceCodeInfo(arena) { : SourceCodeInfo(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -3811,11 +3811,11 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final
: GeneratedCodeInfo(arena) { : GeneratedCodeInfo(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -4016,11 +4016,11 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final
: FeatureSetDefaults_FeatureSetEditionDefault(arena) { : FeatureSetDefaults_FeatureSetEditionDefault(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -4249,11 +4249,11 @@ class PROTOBUF_EXPORT ServiceOptions final
: ServiceOptions(arena) { : ServiceOptions(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -4664,11 +4664,11 @@ class PROTOBUF_EXPORT OneofOptions final
: OneofOptions(arena) { : OneofOptions(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -5066,11 +5066,11 @@ class PROTOBUF_EXPORT MethodOptions final
: MethodOptions(arena) { : MethodOptions(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -5514,11 +5514,11 @@ class PROTOBUF_EXPORT MessageOptions final
: MessageOptions(arena) { : MessageOptions(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -5981,11 +5981,11 @@ class PROTOBUF_EXPORT FileOptions final
: FileOptions(arena) { : FileOptions(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -6710,11 +6710,11 @@ class PROTOBUF_EXPORT FieldOptions final
: FieldOptions(arena) { : FieldOptions(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -7375,11 +7375,11 @@ class PROTOBUF_EXPORT FeatureSetDefaults final
: FeatureSetDefaults(arena) { : FeatureSetDefaults(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -7607,11 +7607,11 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final
: ExtensionRangeOptions(arena) { : ExtensionRangeOptions(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -8061,11 +8061,11 @@ class PROTOBUF_EXPORT EnumValueOptions final
: EnumValueOptions(arena) { : EnumValueOptions(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -8506,11 +8506,11 @@ class PROTOBUF_EXPORT EnumOptions final
: EnumOptions(arena) { : EnumOptions(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -8947,11 +8947,11 @@ class PROTOBUF_EXPORT OneofDescriptorProto final
: OneofDescriptorProto(arena) { : OneofDescriptorProto(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -9169,11 +9169,11 @@ class PROTOBUF_EXPORT MethodDescriptorProto final
: MethodDescriptorProto(arena) { : MethodDescriptorProto(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -9455,11 +9455,11 @@ class PROTOBUF_EXPORT FieldDescriptorProto final
: FieldDescriptorProto(arena) { : FieldDescriptorProto(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -9873,11 +9873,11 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final
: EnumValueDescriptorProto(arena) { : EnumValueDescriptorProto(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -10108,11 +10108,11 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final
: DescriptorProto_ExtensionRange(arena) { : DescriptorProto_ExtensionRange(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -10337,11 +10337,11 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final
: ServiceDescriptorProto(arena) { : ServiceDescriptorProto(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -10578,11 +10578,11 @@ class PROTOBUF_EXPORT EnumDescriptorProto final
: EnumDescriptorProto(arena) { : EnumDescriptorProto(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -10863,11 +10863,11 @@ class PROTOBUF_EXPORT DescriptorProto final
: DescriptorProto(arena) { : DescriptorProto(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -11244,11 +11244,11 @@ class PROTOBUF_EXPORT FileDescriptorProto final
: FileDescriptorProto(arena) { : FileDescriptorProto(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;
@ -11674,11 +11674,11 @@ class PROTOBUF_EXPORT FileDescriptorSet final
: FileDescriptorSet(arena) { : FileDescriptorSet(arena) {
*this = ::std::move(from); *this = ::std::move(from);
} }
const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL;
static void* PlacementNew_(const void*, void* mem, static void* PlacementNew_(const void*, void* mem,
::google::protobuf::Arena* arena); ::google::protobuf::Arena* arena);
static constexpr auto InternalNewImpl_(); static constexpr auto InternalNewImpl_();
static const ::google::protobuf::Message::ClassDataFull _class_data_; static const ::google::protobuf::internal::ClassDataFull _class_data_;
public: public:
::google::protobuf::Metadata GetMetadata() const; ::google::protobuf::Metadata GetMetadata() const;

@ -204,7 +204,7 @@ class DynamicMessage final : public Message {
// implements Message ---------------------------------------------- // implements Message ----------------------------------------------
const ClassData* GetClassData() const PROTOBUF_FINAL; const internal::ClassData* GetClassData() const PROTOBUF_FINAL;
#if defined(__cpp_lib_destroying_delete) && defined(__cpp_sized_deallocation) #if defined(__cpp_lib_destroying_delete) && defined(__cpp_sized_deallocation)
static void operator delete(DynamicMessage* msg, std::destroying_delete_t); static void operator delete(DynamicMessage* msg, std::destroying_delete_t);
@ -265,8 +265,8 @@ struct DynamicMessageFactory::TypeInfo {
std::unique_ptr<uint32_t[]> has_bits_indices; std::unique_ptr<uint32_t[]> has_bits_indices;
int weak_field_map_offset; // The offset for the weak_field_map; int weak_field_map_offset; // The offset for the weak_field_map;
DynamicMessage::ClassDataFull class_data = { internal::ClassDataFull class_data = {
DynamicMessage::ClassData{ internal::ClassData{
nullptr, // default_instance nullptr, // default_instance
nullptr, // tc_table nullptr, // tc_table
nullptr, // on_demand_register_arena_dtor nullptr, // on_demand_register_arena_dtor
@ -634,7 +634,7 @@ void DynamicMessage::CrossLinkPrototypes() {
} }
} }
const MessageLite::ClassData* DynamicMessage::GetClassData() const { const internal::ClassData* DynamicMessage::GetClassData() const {
return type_info_->class_data.base(); return type_info_->class_data.base();
} }

@ -287,7 +287,7 @@ struct alignas(uint64_t) TcParseTableBase {
uint16_t num_aux_entries; uint16_t num_aux_entries;
uint32_t aux_offset; uint32_t aux_offset;
const MessageLite::ClassData* class_data; const ClassData* class_data;
using PostLoopHandler = const char* (*)(MessageLite* msg, const char* ptr, using PostLoopHandler = const char* (*)(MessageLite* msg, const char* ptr,
ParseContext* ctx); ParseContext* ctx);
PostLoopHandler post_loop_handler; PostLoopHandler post_loop_handler;
@ -312,7 +312,7 @@ struct alignas(uint64_t) TcParseTableBase {
uint32_t field_entries_offset, uint32_t field_entries_offset,
uint16_t num_field_entries, uint16_t num_field_entries,
uint16_t num_aux_entries, uint32_t aux_offset, uint16_t num_aux_entries, uint32_t aux_offset,
const MessageLite::ClassData* class_data, const ClassData* class_data,
PostLoopHandler post_loop_handler, PostLoopHandler post_loop_handler,
TailCallParseFunc fallback TailCallParseFunc fallback
#ifdef PROTOBUF_PREFETCH_PARSE_TABLE #ifdef PROTOBUF_PREFETCH_PARSE_TABLE
@ -551,8 +551,7 @@ PROTOBUF_CC const char* StubParseImpl(PROTOBUF_TC_PARAM_DECL) {
} }
template <typename T, template <typename T,
PROTOBUF_CC const char* (*func)(T*, const char*, ParseContext*), PROTOBUF_CC const char* (*func)(T*, const char*, ParseContext*)>
typename ClassData>
constexpr TcParseTable<0> CreateStubTcParseTable( constexpr TcParseTable<0> CreateStubTcParseTable(
const ClassData* class_data, const ClassData* class_data,
TcParseTableBase::PostLoopHandler post_loop_handler = nullptr) { TcParseTableBase::PostLoopHandler post_loop_handler = nullptr) {

@ -62,7 +62,7 @@ const TcParseTable<0> ImplicitWeakMessage::table_ =
internal::CreateStubTcParseTable<ImplicitWeakMessage, ParseImpl>( internal::CreateStubTcParseTable<ImplicitWeakMessage, ParseImpl>(
class_data_.base()); class_data_.base());
constexpr MessageLite::ClassDataLite<1> ImplicitWeakMessage::class_data_ = { constexpr ClassDataLite<1> ImplicitWeakMessage::class_data_ = {
{ {
&implicit_weak_message_default_instance.instance, &implicit_weak_message_default_instance.instance,
&table_.header, &table_.header,
@ -81,7 +81,7 @@ constexpr MessageLite::ClassDataLite<1> ImplicitWeakMessage::class_data_ = {
}, },
""}; ""};
const MessageLite::ClassData* ImplicitWeakMessage::GetClassData() const { const ClassData* ImplicitWeakMessage::GetClassData() const {
return class_data_.base(); return class_data_.base();
} }

@ -156,7 +156,7 @@ Metadata Message::GetMetadata() const {
return GetMetadataImpl(GetClassData()->full()); return GetMetadataImpl(GetClassData()->full());
} }
Metadata Message::GetMetadataImpl(const ClassDataFull& data) { Metadata Message::GetMetadataImpl(const internal::ClassDataFull& data) {
auto* table = data.descriptor_table; auto* table = data.descriptor_table;
// Only codegen types provide a table. DynamicMessage does not provide a table // Only codegen types provide a table. DynamicMessage does not provide a table
// and instead eagerly initializes the descriptor/reflection members. // and instead eagerly initializes the descriptor/reflection members.
@ -206,7 +206,7 @@ size_t Message::SpaceUsedLong() const {
return GetClassData()->full().descriptor_methods->space_used_long(*this); return GetClassData()->full().descriptor_methods->space_used_long(*this);
} }
absl::string_view Message::GetTypeNameImpl(const ClassData* data) { absl::string_view Message::GetTypeNameImpl(const internal::ClassData* data) {
return GetMetadataImpl(data->full()).descriptor->full_name(); return GetMetadataImpl(data->full()).descriptor->full_name();
} }
@ -228,7 +228,7 @@ static std::string DebugStringImpl(const MessageLite& msg) {
return DownCastMessage<Message>(msg).DebugString(); return DownCastMessage<Message>(msg).DebugString();
} }
PROTOBUF_CONSTINIT const MessageLite::DescriptorMethods PROTOBUF_CONSTINIT const internal::DescriptorMethods
Message::kDescriptorMethods = { Message::kDescriptorMethods = {
GetTypeNameImpl, InitializationErrorStringImpl, GetTypeNameImpl, InitializationErrorStringImpl,
GetTcParseTableImpl, SpaceUsedLongImpl, GetTcParseTableImpl, SpaceUsedLongImpl,

@ -377,7 +377,7 @@ class PROTOBUF_EXPORT Message : public MessageLite {
// Get a struct containing the metadata for the Message, which is used in turn // Get a struct containing the metadata for the Message, which is used in turn
// to implement GetDescriptor() and GetReflection() above. // to implement GetDescriptor() and GetReflection() above.
Metadata GetMetadata() const; Metadata GetMetadata() const;
static Metadata GetMetadataImpl(const ClassDataFull& data); static Metadata GetMetadataImpl(const internal::ClassDataFull& data);
// For CODE_SIZE types // For CODE_SIZE types
static bool IsInitializedImpl(const MessageLite&); static bool IsInitializedImpl(const MessageLite&);
@ -388,7 +388,7 @@ class PROTOBUF_EXPORT Message : public MessageLite {
size_t total_size, const internal::CachedSize* cached_size) const; size_t total_size, const internal::CachedSize* cached_size) const;
// Reflection based version for reflection based types. // Reflection based version for reflection based types.
static absl::string_view GetTypeNameImpl(const ClassData* data); static absl::string_view GetTypeNameImpl(const internal::ClassData* data);
static void MergeImpl(MessageLite& to, const MessageLite& from); static void MergeImpl(MessageLite& to, const MessageLite& from);
void ClearImpl(); void ClearImpl();
static size_t ByteSizeLongImpl(const MessageLite& msg); static size_t ByteSizeLongImpl(const MessageLite& msg);
@ -401,7 +401,7 @@ class PROTOBUF_EXPORT Message : public MessageLite {
static size_t SpaceUsedLongImpl(const MessageLite& msg_lite); static size_t SpaceUsedLongImpl(const MessageLite& msg_lite);
static const DescriptorMethods kDescriptorMethods; static const internal::DescriptorMethods kDescriptorMethods;
}; };

@ -104,7 +104,7 @@ absl::string_view TypeId::name() const {
} }
// For LITE messages, the type name is a char[] just beyond ClassData. // For LITE messages, the type name is a char[] just beyond ClassData.
return reinterpret_cast<const char*>(data_) + sizeof(MessageLite::ClassData); return reinterpret_cast<const char*>(data_) + sizeof(internal::ClassData);
} }
void MessageLite::OnDemandRegisterArenaDtor(Arena* arena) { void MessageLite::OnDemandRegisterArenaDtor(Arena* arena) {

@ -289,6 +289,165 @@ PROTOBUF_EXPORT constexpr const std::string& GetEmptyStringAlreadyInited() {
PROTOBUF_EXPORT size_t StringSpaceUsedExcludingSelfLong(const std::string& str); PROTOBUF_EXPORT size_t StringSpaceUsedExcludingSelfLong(const std::string& str);
struct ClassDataFull;
// Note: The order of arguments in the functions is chosen so that it has
// the same ABI as the member function that calls them. Eg the `this`
// pointer becomes the first argument in the free function.
//
// Future work:
// We could save more data by omitting any optional pointer that would
// otherwise be null. We can have some metadata in ClassData telling us if we
// have them and their offset.
struct PROTOBUF_EXPORT ClassData {
const MessageLite* prototype;
const internal::TcParseTableBase* tc_table;
void (*on_demand_register_arena_dtor)(MessageLite& msg, Arena& arena);
bool (*is_initialized)(const MessageLite&);
void (*merge_to_from)(MessageLite& to, const MessageLite& from_msg);
internal::MessageCreator message_creator;
#if defined(PROTOBUF_CUSTOM_VTABLE)
void (*destroy_message)(MessageLite& msg);
void (MessageLite::*clear)();
size_t (*byte_size_long)(const MessageLite&);
uint8_t* (*serialize)(const MessageLite& msg, uint8_t* ptr,
io::EpsCopyOutputStream* stream);
#endif // PROTOBUF_CUSTOM_VTABLE
// Offset of the CachedSize member.
uint32_t cached_size_offset;
// LITE objects (ie !descriptor_methods) collocate their name as a
// char[] just beyond the ClassData.
bool is_lite;
bool is_dynamic = false;
// In normal mode we have the small constructor to avoid the cost in
// codegen.
#if !defined(PROTOBUF_CUSTOM_VTABLE)
constexpr ClassData(
const MessageLite* prototype, const internal::TcParseTableBase* tc_table,
void (*on_demand_register_arena_dtor)(MessageLite&, Arena&),
bool (*is_initialized)(const MessageLite&),
void (*merge_to_from)(MessageLite& to, const MessageLite& from_msg),
internal::MessageCreator message_creator, uint32_t cached_size_offset,
bool is_lite
)
: prototype(prototype),
tc_table(tc_table),
on_demand_register_arena_dtor(on_demand_register_arena_dtor),
is_initialized(is_initialized),
merge_to_from(merge_to_from),
message_creator(message_creator),
cached_size_offset(cached_size_offset),
is_lite(is_lite)
{
}
#endif // !PROTOBUF_CUSTOM_VTABLE
// But we always provide the full constructor even in normal mode to make
// helper code simpler.
constexpr ClassData(
const MessageLite* prototype, const internal::TcParseTableBase* tc_table,
void (*on_demand_register_arena_dtor)(MessageLite&, Arena&),
bool (*is_initialized)(const MessageLite&),
void (*merge_to_from)(MessageLite& to, const MessageLite& from_msg),
internal::MessageCreator message_creator,
void (*destroy_message)(MessageLite& msg), //
void (MessageLite::*clear)(),
size_t (*byte_size_long)(const MessageLite&),
uint8_t* (*serialize)(const MessageLite& msg, uint8_t* ptr,
io::EpsCopyOutputStream* stream),
uint32_t cached_size_offset, bool is_lite
)
: prototype(prototype),
tc_table(tc_table),
on_demand_register_arena_dtor(on_demand_register_arena_dtor),
is_initialized(is_initialized),
merge_to_from(merge_to_from),
message_creator(message_creator),
#if defined(PROTOBUF_CUSTOM_VTABLE)
destroy_message(destroy_message),
clear(clear),
byte_size_long(byte_size_long),
serialize(serialize),
#endif // PROTOBUF_CUSTOM_VTABLE
cached_size_offset(cached_size_offset),
is_lite(is_lite)
{
}
const ClassDataFull& full() const;
MessageLite* New(Arena* arena) const {
return message_creator.New(prototype, prototype, arena);
}
MessageLite* PlacementNew(void* mem, Arena* arena) const {
return message_creator.PlacementNew(prototype, prototype, mem, arena);
}
uint32_t allocation_size() const { return message_creator.allocation_size(); }
uint8_t alignment() const { return message_creator.alignment(); }
};
template <size_t N>
struct ClassDataLite {
ClassData header;
const char type_name[N];
constexpr const ClassData* base() const { return &header; }
};
// We use a secondary vtable for descriptor based methods. This way ClassData
// does not grow with the number of descriptor methods. This avoids extra
// costs in MessageLite.
struct PROTOBUF_EXPORT DescriptorMethods {
absl::string_view (*get_type_name)(const ClassData* data);
std::string (*initialization_error_string)(const MessageLite&);
const internal::TcParseTableBase* (*get_tc_table)(const MessageLite&);
size_t (*space_used_long)(const MessageLite&);
std::string (*debug_string)(const MessageLite&);
};
struct PROTOBUF_EXPORT ClassDataFull : ClassData {
constexpr ClassDataFull(ClassData base,
const DescriptorMethods* descriptor_methods,
const internal::DescriptorTable* descriptor_table,
void (*get_metadata_tracker)())
: ClassData(base),
descriptor_methods(descriptor_methods),
descriptor_table(descriptor_table),
reflection(),
descriptor(),
get_metadata_tracker(get_metadata_tracker) {}
constexpr const ClassData* base() const { return this; }
const DescriptorMethods* descriptor_methods;
// Codegen types will provide a DescriptorTable to do lazy
// registration/initialization of the reflection objects.
// Other types, like DynamicMessage, keep the table as null but eagerly
// populate `reflection`/`descriptor` fields.
const internal::DescriptorTable* descriptor_table;
// Accesses are protected by the once_flag in `descriptor_table`. When the
// table is null these are populated from the beginning and need to
// protection.
mutable const Reflection* reflection;
mutable const Descriptor* descriptor;
// When an access tracker is installed, this function notifies the tracker
// that GetMetadata was called.
void (*get_metadata_tracker)();
};
inline const ClassDataFull& ClassData::full() const {
ABSL_DCHECK(!is_lite);
return *static_cast<const ClassDataFull*>(this);
}
} // namespace internal } // namespace internal
// Interface to light weight protocol messages. // Interface to light weight protocol messages.
@ -682,175 +841,16 @@ class PROTOBUF_EXPORT MessageLite {
return tc_table; return tc_table;
} }
// We use a secondary vtable for descriptor based methods. This way ClassData
// does not grow with the number of descriptor methods. This avoids extra
// costs in MessageLite.
struct ClassData;
struct ClassDataFull;
struct DescriptorMethods {
absl::string_view (*get_type_name)(const ClassData* data);
std::string (*initialization_error_string)(const MessageLite&);
const internal::TcParseTableBase* (*get_tc_table)(const MessageLite&);
size_t (*space_used_long)(const MessageLite&);
std::string (*debug_string)(const MessageLite&);
};
// Note: The order of arguments in the functions is chosen so that it has
// the same ABI as the member function that calls them. Eg the `this`
// pointer becomes the first argument in the free function.
//
// Future work:
// We could save more data by omitting any optional pointer that would
// otherwise be null. We can have some metadata in ClassData telling us if we
// have them and their offset.
friend internal::MessageCreator;
using DestroyMessageF = void (*)(MessageLite& msg);
struct ClassData {
const MessageLite* prototype;
const internal::TcParseTableBase* tc_table;
void (*on_demand_register_arena_dtor)(MessageLite& msg, Arena& arena);
bool (*is_initialized)(const MessageLite&);
void (*merge_to_from)(MessageLite& to, const MessageLite& from_msg);
internal::MessageCreator message_creator;
#if defined(PROTOBUF_CUSTOM_VTABLE)
DestroyMessageF destroy_message;
void (MessageLite::*clear)();
size_t (*byte_size_long)(const MessageLite&);
uint8_t* (*serialize)(const MessageLite& msg, uint8_t* ptr,
io::EpsCopyOutputStream* stream);
#endif // PROTOBUF_CUSTOM_VTABLE
// Offset of the CachedSize member.
uint32_t cached_size_offset;
// LITE objects (ie !descriptor_methods) collocate their name as a
// char[] just beyond the ClassData.
bool is_lite;
bool is_dynamic = false;
// In normal mode we have the small constructor to avoid the cost in
// codegen.
#if !defined(PROTOBUF_CUSTOM_VTABLE)
constexpr ClassData(
const MessageLite* prototype,
const internal::TcParseTableBase* tc_table,
void (*on_demand_register_arena_dtor)(MessageLite&, Arena&),
bool (*is_initialized)(const MessageLite&),
void (*merge_to_from)(MessageLite& to, const MessageLite& from_msg),
internal::MessageCreator message_creator, uint32_t cached_size_offset,
bool is_lite
)
: prototype(prototype),
tc_table(tc_table),
on_demand_register_arena_dtor(on_demand_register_arena_dtor),
is_initialized(is_initialized),
merge_to_from(merge_to_from),
message_creator(message_creator),
cached_size_offset(cached_size_offset),
is_lite(is_lite)
{
}
#endif // !PROTOBUF_CUSTOM_VTABLE
// But we always provide the full constructor even in normal mode to make
// helper code simpler.
constexpr ClassData(
const MessageLite* prototype,
const internal::TcParseTableBase* tc_table,
void (*on_demand_register_arena_dtor)(MessageLite&, Arena&),
bool (*is_initialized)(const MessageLite&),
void (*merge_to_from)(MessageLite& to, const MessageLite& from_msg),
internal::MessageCreator message_creator, //
DestroyMessageF destroy_message, //
void (MessageLite::*clear)(),
size_t (*byte_size_long)(const MessageLite&),
uint8_t* (*serialize)(const MessageLite& msg, uint8_t* ptr,
io::EpsCopyOutputStream* stream),
uint32_t cached_size_offset, bool is_lite
)
: prototype(prototype),
tc_table(tc_table),
on_demand_register_arena_dtor(on_demand_register_arena_dtor),
is_initialized(is_initialized),
merge_to_from(merge_to_from),
message_creator(message_creator),
#if defined(PROTOBUF_CUSTOM_VTABLE)
destroy_message(destroy_message),
clear(clear),
byte_size_long(byte_size_long),
serialize(serialize),
#endif // PROTOBUF_CUSTOM_VTABLE
cached_size_offset(cached_size_offset),
is_lite(is_lite)
{
}
const ClassDataFull& full() const {
ABSL_DCHECK(!is_lite);
return *static_cast<const ClassDataFull*>(this);
}
MessageLite* New(Arena* arena) const {
return message_creator.New(prototype, prototype, arena);
}
MessageLite* PlacementNew(void* mem, Arena* arena) const {
return message_creator.PlacementNew(prototype, prototype, mem, arena);
}
uint32_t allocation_size() const {
return message_creator.allocation_size();
}
uint8_t alignment() const { return message_creator.alignment(); }
};
template <size_t N>
struct ClassDataLite {
ClassData header;
const char type_name[N];
constexpr const ClassData* base() const { return &header; }
};
struct ClassDataFull : ClassData {
constexpr ClassDataFull(ClassData base,
const DescriptorMethods* descriptor_methods,
const internal::DescriptorTable* descriptor_table,
void (*get_metadata_tracker)())
: ClassData(base),
descriptor_methods(descriptor_methods),
descriptor_table(descriptor_table),
reflection(),
descriptor(),
get_metadata_tracker(get_metadata_tracker) {}
constexpr const ClassData* base() const { return this; }
const DescriptorMethods* descriptor_methods;
// Codegen types will provide a DescriptorTable to do lazy
// registration/initialization of the reflection objects.
// Other types, like DynamicMessage, keep the table as null but eagerly
// populate `reflection`/`descriptor` fields.
const internal::DescriptorTable* descriptor_table;
// Accesses are protected by the once_flag in `descriptor_table`. When the
// table is null these are populated from the beginning and need to
// protection.
mutable const Reflection* reflection;
mutable const Descriptor* descriptor;
// When an access tracker is installed, this function notifies the tracker
// that GetMetadata was called.
void (*get_metadata_tracker)();
};
#if defined(PROTOBUF_CUSTOM_VTABLE) #if defined(PROTOBUF_CUSTOM_VTABLE)
explicit constexpr MessageLite(const ClassData* data) : _class_data_(data) {} explicit constexpr MessageLite(const internal::ClassData* data)
explicit MessageLite(Arena* arena, const ClassData* data) : _class_data_(data) {}
explicit MessageLite(Arena* arena, const internal::ClassData* data)
: _internal_metadata_(arena), _class_data_(data) {} : _internal_metadata_(arena), _class_data_(data) {}
#else // PROTOBUF_CUSTOM_VTABLE #else // PROTOBUF_CUSTOM_VTABLE
constexpr MessageLite() {} constexpr MessageLite() {}
explicit MessageLite(Arena* arena) : _internal_metadata_(arena) {} explicit MessageLite(Arena* arena) : _internal_metadata_(arena) {}
explicit constexpr MessageLite(const ClassData*) {} explicit constexpr MessageLite(const internal::ClassData*) {}
explicit MessageLite(Arena* arena, const ClassData*) explicit MessageLite(Arena* arena, const internal::ClassData*)
: _internal_metadata_(arena) {} : _internal_metadata_(arena) {}
#endif // PROTOBUF_CUSTOM_VTABLE #endif // PROTOBUF_CUSTOM_VTABLE
@ -862,12 +862,12 @@ class PROTOBUF_EXPORT MessageLite {
// This is a work in progress. There are still some types (eg MapEntry) that // This is a work in progress. There are still some types (eg MapEntry) that
// return a default table instead of a unique one. // return a default table instead of a unique one.
#if defined(PROTOBUF_CUSTOM_VTABLE) #if defined(PROTOBUF_CUSTOM_VTABLE)
const ClassData* GetClassData() const { const internal::ClassData* GetClassData() const {
::absl::PrefetchToLocalCache(_class_data_); ::absl::PrefetchToLocalCache(_class_data_);
return _class_data_; return _class_data_;
} }
#else // PROTOBUF_CUSTOM_VTABLE #else // PROTOBUF_CUSTOM_VTABLE
virtual const ClassData* GetClassData() const = 0; virtual const internal::ClassData* GetClassData() const = 0;
#endif // PROTOBUF_CUSTOM_VTABLE #endif // PROTOBUF_CUSTOM_VTABLE
template <typename T> template <typename T>
@ -882,7 +882,7 @@ class PROTOBUF_EXPORT MessageLite {
internal::InternalMetadata _internal_metadata_; internal::InternalMetadata _internal_metadata_;
#if defined(PROTOBUF_CUSTOM_VTABLE) #if defined(PROTOBUF_CUSTOM_VTABLE)
const ClassData* _class_data_; const internal::ClassData* _class_data_;
#endif // PROTOBUF_CUSTOM_VTABLE #endif // PROTOBUF_CUSTOM_VTABLE
// Return the cached size object as described by // Return the cached size object as described by
@ -965,7 +965,7 @@ class PROTOBUF_EXPORT MessageLite {
friend class internal::WeakFieldMap; friend class internal::WeakFieldMap;
friend class internal::WireFormatLite; friend class internal::WireFormatLite;
friend class internal::RustMapHelper; friend class internal::RustMapHelper;
friend struct internal::TcParseTableBase; friend internal::MessageCreator;
template <typename Type> template <typename Type>
friend class Arena::InternalHelper; friend class Arena::InternalHelper;
@ -1067,9 +1067,9 @@ class TypeId {
} }
private: private:
constexpr explicit TypeId(const MessageLite::ClassData* data) : data_(data) {} constexpr explicit TypeId(const internal::ClassData* data) : data_(data) {}
const MessageLite::ClassData* data_; const internal::ClassData* data_;
}; };
namespace internal { namespace internal {

Loading…
Cancel
Save