From e098e9216f021d684f83dbe8e5098a0f87c5cf31 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Thu, 19 Oct 2023 08:20:09 -0700 Subject: [PATCH] Move `GetTypeName` implementation into `ClassData`. For LITE messages we append the type name to the data, avoiding an indirection and a relocation. For descriptor messages we have a single secondary vtable. This reduces the per-message cost of all the descriptor methods to a single pointer. PiperOrigin-RevId: 574877986 --- src/google/protobuf/compiler/cpp/message.cc | 114 ++-- src/google/protobuf/compiler/cpp/message.h | 1 + .../compiler/java/java_features.pb.cc | 17 +- .../protobuf/compiler/java/java_features.pb.h | 4 +- src/google/protobuf/compiler/plugin.pb.cc | 68 ++- src/google/protobuf/compiler/plugin.pb.h | 16 +- src/google/protobuf/cpp_features.pb.cc | 17 +- src/google/protobuf/cpp_features.pb.h | 4 +- src/google/protobuf/descriptor.pb.cc | 544 ++++++++++-------- src/google/protobuf/descriptor.pb.h | 128 ++--- .../protobuf/generated_message_bases.cc | 7 +- src/google/protobuf/implicit_weak_message.h | 9 +- src/google/protobuf/message.cc | 25 +- src/google/protobuf/message.h | 10 +- src/google/protobuf/message_lite.cc | 21 +- src/google/protobuf/message_lite.h | 17 +- 16 files changed, 572 insertions(+), 430 deletions(-) diff --git a/src/google/protobuf/compiler/cpp/message.cc b/src/google/protobuf/compiler/cpp/message.cc index 20c8f33a5d..184d83d16b 100644 --- a/src/google/protobuf/compiler/cpp/message.cc +++ b/src/google/protobuf/compiler/cpp/message.cc @@ -1603,26 +1603,20 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { break; } + if (!HasSimpleBaseClass(descriptor_, options_)) { + p->Emit(R"cc( + const ::$proto_ns$::MessageLite::ClassData* GetClassData() const final; + )cc"); + } + format( "public:\n" "\n"); if (HasDescriptorMethods(descriptor_->file(), options_)) { - if (HasGeneratedMethods(descriptor_->file(), options_) && - !HasSimpleBaseClass(descriptor_, options_)) { - format( - "static const ClassData _class_data_;\n" - "const ::$proto_ns$::Message::ClassData*" - "GetClassData() const final;\n" - "\n"); - } format( "::$proto_ns$::Metadata GetMetadata() const final;\n" "\n"); - } else { - format( - "std::string GetTypeName() const final;\n" - "\n"); } if (ShouldSplit(descriptor_, options_)) { @@ -2049,6 +2043,8 @@ void MessageGenerator::GenerateClassMethods(io::Printer* p) { format("\n"); } + GenerateClassData(p); + if (HasGeneratedMethods(descriptor_->file(), options_)) { GenerateClear(p); format("\n"); @@ -2124,12 +2120,6 @@ void MessageGenerator::GenerateClassMethods(io::Printer* p) { "}\n", index_in_file_messages_); } - } else { - format( - "std::string $classname$::GetTypeName() const {\n" - " return \"$full_name$\";\n" - "}\n" - "\n"); } if (HasTracker(descriptor_, options_)) { @@ -3587,21 +3577,27 @@ void MessageGenerator::GenerateSwap(io::Printer* p) { format("}\n"); } -void MessageGenerator::GenerateMergeFrom(io::Printer* p) { +void MessageGenerator::GenerateClassData(io::Printer* p) { Formatter format(p); if (HasSimpleBaseClass(descriptor_, options_)) return; - if (HasDescriptorMethods(descriptor_->file(), options_)) { - // We don't override the generalized MergeFrom (aka that which - // takes in the Message base class as a parameter); instead we just - // let the base Message::MergeFrom take care of it. The base MergeFrom - // knows how to quickly confirm the types exactly match, and if so, will - // use GetClassData() to retrieve the address of MergeImpl, which calls - // the fast MergeFrom overload. Most callers avoid all this by passing - // a "from" message that is the same type as the message being merged - // into, rather than a generic Message. + const auto class_data_members = [&] { p->Emit( { + {"merge_impl", + [&] { + // TODO: This check is not needed once we migrate + // CheckTypeAndMergeFrom to ClassData fully. + if (HasDescriptorMethods(descriptor_->file(), options_)) { + p->Emit(R"cc( + $classname$::MergeImpl, + )cc"); + } else { + p->Emit(R"cc( + nullptr, // MergeImpl + )cc"); + } + }}, {"on_demand_register_arena_dtor", [&] { if (NeedsArenaDestructor() == ArenaDtorNeeds::kOnDemand) { @@ -3614,17 +3610,67 @@ void MessageGenerator::GenerateMergeFrom(io::Printer* p) { )cc"); } }}, + {"descriptor_methods", + [&] { + if (HasDescriptorMethods(descriptor_->file(), options_)) { + p->Emit(R"cc( + &::$proto_ns$::Message::kDescriptorMethods, + )cc"); + } else { + p->Emit(R"cc( + nullptr, // DescriptorMethods + )cc"); + } + }}, }, R"cc( - const ::$proto_ns$::Message::ClassData $classname$::_class_data_ = { - $classname$::MergeImpl, - $on_demand_register_arena_dtor$, - }; - const ::$proto_ns$::Message::ClassData* $classname$::GetClassData() const { - return &_class_data_; + $merge_impl$, $on_demand_register_arena_dtor$, $descriptor_methods$, + )cc"); + }; + + if (HasDescriptorMethods(descriptor_->file(), options_)) { + p->Emit( + {{"class_data_members", class_data_members}}, + R"cc( + const ::$proto_ns$::MessageLite::ClassData* + $classname$::GetClassData() const { + PROTOBUF_CONSTINIT static const ::$proto_ns$::MessageLite::ClassData + data = { + $class_data_members$, + }; + return &data; } )cc"); } else { + p->Emit( + { + {"class_data_members", class_data_members}, + {"type_size", descriptor_->full_name().size() + 1}, + }, + R"cc( + const ::$proto_ns$::MessageLite::ClassData* + $classname$::GetClassData() const { + struct ClassData_ { + ::$proto_ns$::MessageLite::ClassData header; + char type_name[$type_size$]; + }; + PROTOBUF_CONSTINIT static const ClassData_ data = { + { + $class_data_members$, + }, + "$full_name$", + }; + + return &data.header; + } + )cc"); + } +} + +void MessageGenerator::GenerateMergeFrom(io::Printer* p) { + Formatter format(p); + + if (!HasDescriptorMethods(descriptor_->file(), options_)) { // Generate CheckTypeAndMergeFrom(). format( "void $classname$::CheckTypeAndMergeFrom(\n" diff --git a/src/google/protobuf/compiler/cpp/message.h b/src/google/protobuf/compiler/cpp/message.h index 894650f829..26843ec412 100644 --- a/src/google/protobuf/compiler/cpp/message.h +++ b/src/google/protobuf/compiler/cpp/message.h @@ -117,6 +117,7 @@ class MessageGenerator { void GenerateSerializeWithCachedSizesBody(io::Printer* p); void GenerateSerializeWithCachedSizesBodyShuffled(io::Printer* p); void GenerateByteSize(io::Printer* p); + void GenerateClassData(io::Printer* p); void GenerateMergeFrom(io::Printer* p); void GenerateClassSpecificMergeImpl(io::Printer* p); void GenerateCopyFrom(io::Printer* p); diff --git a/src/google/protobuf/compiler/java/java_features.pb.cc b/src/google/protobuf/compiler/java/java_features.pb.cc index e3dac1672b..309375292d 100644 --- a/src/google/protobuf/compiler/java/java_features.pb.cc +++ b/src/google/protobuf/compiler/java/java_features.pb.cc @@ -196,6 +196,16 @@ inline void JavaFeatures::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +JavaFeatures::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + JavaFeatures::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void JavaFeatures::Clear() { // @@protoc_insertion_point(message_clear_start:pb.JavaFeatures) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -312,13 +322,6 @@ const ::_pbi::TcParseTable<1, 2, 1, 0, 2> JavaFeatures::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData JavaFeatures::_class_data_ = { - JavaFeatures::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* JavaFeatures::GetClassData() const { - return &_class_data_; -} void JavaFeatures::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); diff --git a/src/google/protobuf/compiler/java/java_features.pb.h b/src/google/protobuf/compiler/java/java_features.pb.h index 66c51efb87..1a0c7bba2e 100644 --- a/src/google/protobuf/compiler/java/java_features.pb.h +++ b/src/google/protobuf/compiler/java/java_features.pb.h @@ -224,11 +224,9 @@ class PROTOC_EXPORT JavaFeatures final : protected: explicit JavaFeatures(::google::protobuf::Arena* arena); JavaFeatures(::google::protobuf::Arena* arena, const JavaFeatures& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index 8b8084c62f..06e403cc6e 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -381,6 +381,16 @@ inline void Version::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +Version::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + Version::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void Version::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.Version) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -543,13 +553,6 @@ const ::_pbi::TcParseTable<2, 4, 0, 47, 2> Version::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData Version::_class_data_ = { - Version::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* Version::GetClassData() const { - return &_class_data_; -} void Version::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -695,6 +698,16 @@ inline void CodeGeneratorRequest::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +CodeGeneratorRequest::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + CodeGeneratorRequest::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void CodeGeneratorRequest::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorRequest) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -887,13 +900,6 @@ const ::_pbi::TcParseTable<3, 5, 3, 79, 2> CodeGeneratorRequest::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData CodeGeneratorRequest::_class_data_ = { - CodeGeneratorRequest::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* CodeGeneratorRequest::GetClassData() const { - return &_class_data_; -} void CodeGeneratorRequest::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -1043,6 +1049,16 @@ inline void CodeGeneratorResponse_File::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +CodeGeneratorResponse_File::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + CodeGeneratorResponse_File::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void CodeGeneratorResponse_File::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse.File) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -1216,13 +1232,6 @@ const ::_pbi::TcParseTable<2, 4, 1, 86, 2> CodeGeneratorResponse_File::_table_ = return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData CodeGeneratorResponse_File::_class_data_ = { - CodeGeneratorResponse_File::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* CodeGeneratorResponse_File::GetClassData() const { - return &_class_data_; -} void CodeGeneratorResponse_File::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -1345,6 +1354,16 @@ inline void CodeGeneratorResponse::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +CodeGeneratorResponse::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + CodeGeneratorResponse::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void CodeGeneratorResponse::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -1487,13 +1506,6 @@ const ::_pbi::TcParseTable<2, 3, 1, 60, 2> CodeGeneratorResponse::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData CodeGeneratorResponse::_class_data_ = { - CodeGeneratorResponse::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* CodeGeneratorResponse::GetClassData() const { - return &_class_data_; -} void CodeGeneratorResponse::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index 1a2c568124..eb3da21003 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -241,11 +241,9 @@ class PROTOC_EXPORT Version final : protected: explicit Version(::google::protobuf::Arena* arena); Version(::google::protobuf::Arena* arena, const Version& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -463,11 +461,9 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : protected: explicit CodeGeneratorResponse_File(::google::protobuf::Arena* arena); CodeGeneratorResponse_File(::google::protobuf::Arena* arena, const CodeGeneratorResponse_File& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -701,11 +697,9 @@ class PROTOC_EXPORT CodeGeneratorResponse final : protected: explicit CodeGeneratorResponse(::google::protobuf::Arena* arena); CodeGeneratorResponse(::google::protobuf::Arena* arena, const CodeGeneratorResponse& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -940,11 +934,9 @@ class PROTOC_EXPORT CodeGeneratorRequest final : protected: explicit CodeGeneratorRequest(::google::protobuf::Arena* arena); CodeGeneratorRequest(::google::protobuf::Arena* arena, const CodeGeneratorRequest& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- diff --git a/src/google/protobuf/cpp_features.pb.cc b/src/google/protobuf/cpp_features.pb.cc index 762c63077a..b7eee1a5fa 100644 --- a/src/google/protobuf/cpp_features.pb.cc +++ b/src/google/protobuf/cpp_features.pb.cc @@ -157,6 +157,16 @@ inline void CppFeatures::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +CppFeatures::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + CppFeatures::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void CppFeatures::Clear() { // @@protoc_insertion_point(message_clear_start:pb.CppFeatures) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -247,13 +257,6 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> CppFeatures::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData CppFeatures::_class_data_ = { - CppFeatures::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* CppFeatures::GetClassData() const { - return &_class_data_; -} void CppFeatures::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); diff --git a/src/google/protobuf/cpp_features.pb.h b/src/google/protobuf/cpp_features.pb.h index fddd800989..3b470431e3 100644 --- a/src/google/protobuf/cpp_features.pb.h +++ b/src/google/protobuf/cpp_features.pb.h @@ -193,11 +193,9 @@ class PROTOBUF_EXPORT CppFeatures final : protected: explicit CppFeatures(::google::protobuf::Arena* arena); CppFeatures(::google::protobuf::Arena* arena, const CppFeatures& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index ce7e962bf4..ae02aa9a2d 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -2396,6 +2396,16 @@ inline void FileDescriptorSet::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +FileDescriptorSet::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + FileDescriptorSet::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void FileDescriptorSet::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FileDescriptorSet) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -2484,13 +2494,6 @@ constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 2> FileDescriptorSet::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData FileDescriptorSet::_class_data_ = { - FileDescriptorSet::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* FileDescriptorSet::GetClassData() const { - return &_class_data_; -} void FileDescriptorSet::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -2647,6 +2650,16 @@ inline void FileDescriptorProto::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +FileDescriptorProto::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + FileDescriptorProto::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void FileDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FileDescriptorProto) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -3025,13 +3038,6 @@ constexpr ::_pbi::TcParseTable<4, 13, 7, 79, 2> FileDescriptorProto::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData FileDescriptorProto::_class_data_ = { - FileDescriptorProto::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* FileDescriptorProto::GetClassData() const { - return &_class_data_; -} void FileDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -3214,6 +3220,16 @@ inline void DescriptorProto_ExtensionRange::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +DescriptorProto_ExtensionRange::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + DescriptorProto_ExtensionRange::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void DescriptorProto_ExtensionRange::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ExtensionRange) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -3354,13 +3370,6 @@ constexpr ::_pbi::TcParseTable<2, 3, 1, 0, 2> DescriptorProto_ExtensionRange::_t return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData DescriptorProto_ExtensionRange::_class_data_ = { - DescriptorProto_ExtensionRange::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* DescriptorProto_ExtensionRange::GetClassData() const { - return &_class_data_; -} void DescriptorProto_ExtensionRange::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -3470,6 +3479,16 @@ inline void DescriptorProto_ReservedRange::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +DescriptorProto_ReservedRange::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + DescriptorProto_ReservedRange::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void DescriptorProto_ReservedRange::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ReservedRange) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -3586,13 +3605,6 @@ constexpr ::_pbi::TcParseTable<1, 2, 0, 0, 2> DescriptorProto_ReservedRange::_ta return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData DescriptorProto_ReservedRange::_class_data_ = { - DescriptorProto_ReservedRange::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* DescriptorProto_ReservedRange::GetClassData() const { - return &_class_data_; -} void DescriptorProto_ReservedRange::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -3731,6 +3743,16 @@ inline void DescriptorProto::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +DescriptorProto::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + DescriptorProto::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void DescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -4037,13 +4059,6 @@ constexpr ::_pbi::TcParseTable<4, 10, 8, 65, 2> DescriptorProto::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData DescriptorProto::_class_data_ = { - DescriptorProto::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* DescriptorProto::GetClassData() const { - return &_class_data_; -} void DescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -4217,6 +4232,16 @@ inline void ExtensionRangeOptions_Declaration::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +ExtensionRangeOptions_Declaration::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + ExtensionRangeOptions_Declaration::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void ExtensionRangeOptions_Declaration::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.ExtensionRangeOptions.Declaration) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -4405,13 +4430,6 @@ constexpr ::_pbi::TcParseTable<3, 5, 0, 71, 2> ExtensionRangeOptions_Declaration return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData ExtensionRangeOptions_Declaration::_class_data_ = { - ExtensionRangeOptions_Declaration::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* ExtensionRangeOptions_Declaration::GetClassData() const { - return &_class_data_; -} void ExtensionRangeOptions_Declaration::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -4553,6 +4571,16 @@ inline void ExtensionRangeOptions::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +ExtensionRangeOptions::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + ExtensionRangeOptions::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void ExtensionRangeOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.ExtensionRangeOptions) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -4727,13 +4755,6 @@ constexpr ::_pbi::TcParseTable<3, 4, 4, 0, 12> ExtensionRangeOptions::_table_ = return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData ExtensionRangeOptions::_class_data_ = { - ExtensionRangeOptions::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* ExtensionRangeOptions::GetClassData() const { - return &_class_data_; -} void ExtensionRangeOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -4926,6 +4947,16 @@ inline void FieldDescriptorProto::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +FieldDescriptorProto::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + FieldDescriptorProto::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void FieldDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FieldDescriptorProto) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -5257,13 +5288,6 @@ constexpr ::_pbi::TcParseTable<4, 11, 3, 96, 2> FieldDescriptorProto::_table_ = return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData FieldDescriptorProto::_class_data_ = { - FieldDescriptorProto::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* FieldDescriptorProto::GetClassData() const { - return &_class_data_; -} void FieldDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -5427,6 +5451,16 @@ inline void OneofDescriptorProto::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +OneofDescriptorProto::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + OneofDescriptorProto::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void OneofDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.OneofDescriptorProto) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -5551,13 +5585,6 @@ constexpr ::_pbi::TcParseTable<1, 2, 1, 49, 2> OneofDescriptorProto::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData OneofDescriptorProto::_class_data_ = { - OneofDescriptorProto::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* OneofDescriptorProto::GetClassData() const { - return &_class_data_; -} void OneofDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -5661,6 +5688,16 @@ inline void EnumDescriptorProto_EnumReservedRange::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +EnumDescriptorProto_EnumReservedRange::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + EnumDescriptorProto_EnumReservedRange::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void EnumDescriptorProto_EnumReservedRange::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -5777,13 +5814,6 @@ constexpr ::_pbi::TcParseTable<1, 2, 0, 0, 2> EnumDescriptorProto_EnumReservedRa return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData EnumDescriptorProto_EnumReservedRange::_class_data_ = { - EnumDescriptorProto_EnumReservedRange::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* EnumDescriptorProto_EnumReservedRange::GetClassData() const { - return &_class_data_; -} void EnumDescriptorProto_EnumReservedRange::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -5912,6 +5942,16 @@ inline void EnumDescriptorProto::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +EnumDescriptorProto::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + EnumDescriptorProto::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void EnumDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumDescriptorProto) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -6105,13 +6145,6 @@ constexpr ::_pbi::TcParseTable<3, 5, 3, 61, 2> EnumDescriptorProto::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData EnumDescriptorProto::_class_data_ = { - EnumDescriptorProto::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* EnumDescriptorProto::GetClassData() const { - return &_class_data_; -} void EnumDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -6254,6 +6287,16 @@ inline void EnumValueDescriptorProto::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +EnumValueDescriptorProto::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + EnumValueDescriptorProto::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void EnumValueDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValueDescriptorProto) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -6399,13 +6442,6 @@ constexpr ::_pbi::TcParseTable<2, 3, 1, 53, 2> EnumValueDescriptorProto::_table_ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData EnumValueDescriptorProto::_class_data_ = { - EnumValueDescriptorProto::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* EnumValueDescriptorProto::GetClassData() const { - return &_class_data_; -} void EnumValueDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -6540,6 +6576,16 @@ inline void ServiceDescriptorProto::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +ServiceDescriptorProto::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + ServiceDescriptorProto::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void ServiceDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.ServiceDescriptorProto) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -6687,13 +6733,6 @@ constexpr ::_pbi::TcParseTable<2, 3, 2, 51, 2> ServiceDescriptorProto::_table_ = return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData ServiceDescriptorProto::_class_data_ = { - ServiceDescriptorProto::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* ServiceDescriptorProto::GetClassData() const { - return &_class_data_; -} void ServiceDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -6852,6 +6891,16 @@ inline void MethodDescriptorProto::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +MethodDescriptorProto::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + MethodDescriptorProto::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void MethodDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.MethodDescriptorProto) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -7065,13 +7114,6 @@ constexpr ::_pbi::TcParseTable<3, 6, 1, 71, 2> MethodDescriptorProto::_table_ = return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData MethodDescriptorProto::_class_data_ = { - MethodDescriptorProto::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* MethodDescriptorProto::GetClassData() const { - return &_class_data_; -} void MethodDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -7318,6 +7360,16 @@ inline void FileOptions::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +FileOptions::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + FileOptions::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void FileOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FileOptions) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -7891,13 +7943,6 @@ constexpr ::_pbi::TcParseTable<5, 22, 3, 202, 12> FileOptions::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData FileOptions::_class_data_ = { - FileOptions::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* FileOptions::GetClassData() const { - return &_class_data_; -} void FileOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -8134,6 +8179,16 @@ inline void MessageOptions::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +MessageOptions::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + MessageOptions::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void MessageOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.MessageOptions) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -8352,13 +8407,6 @@ constexpr ::_pbi::TcParseTable<3, 7, 2, 0, 7> MessageOptions::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData MessageOptions::_class_data_ = { - MessageOptions::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* MessageOptions::GetClassData() const { - return &_class_data_; -} void MessageOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -8499,6 +8547,16 @@ inline void FieldOptions_EditionDefault::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +FieldOptions_EditionDefault::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + FieldOptions_EditionDefault::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void FieldOptions_EditionDefault::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FieldOptions.EditionDefault) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -8618,13 +8676,6 @@ constexpr ::_pbi::TcParseTable<1, 2, 1, 57, 2> FieldOptions_EditionDefault::_tab return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData FieldOptions_EditionDefault::_class_data_ = { - FieldOptions_EditionDefault::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* FieldOptions_EditionDefault::GetClassData() const { - return &_class_data_; -} void FieldOptions_EditionDefault::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -8787,6 +8838,16 @@ inline void FieldOptions::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +FieldOptions::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + FieldOptions::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void FieldOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FieldOptions) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -9140,13 +9201,6 @@ constexpr ::_pbi::TcParseTable<4, 13, 7, 0, 7> FieldOptions::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData FieldOptions::_class_data_ = { - FieldOptions::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* FieldOptions::GetClassData() const { - return &_class_data_; -} void FieldOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -9314,6 +9368,16 @@ inline void OneofOptions::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +OneofOptions::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + OneofOptions::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void OneofOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.OneofOptions) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -9440,13 +9504,6 @@ constexpr ::_pbi::TcParseTable<2, 2, 2, 0, 7> OneofOptions::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData OneofOptions::_class_data_ = { - OneofOptions::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* OneofOptions::GetClassData() const { - return &_class_data_; -} void OneofOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -9591,6 +9648,16 @@ inline void EnumOptions::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +EnumOptions::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + EnumOptions::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void EnumOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumOptions) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -9775,13 +9842,6 @@ constexpr ::_pbi::TcParseTable<3, 5, 2, 0, 7> EnumOptions::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData EnumOptions::_class_data_ = { - EnumOptions::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* EnumOptions::GetClassData() const { - return &_class_data_; -} void EnumOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -9941,6 +10001,16 @@ inline void EnumValueOptions::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +EnumValueOptions::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + EnumValueOptions::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void EnumValueOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValueOptions) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -10110,13 +10180,6 @@ constexpr ::_pbi::TcParseTable<3, 4, 2, 0, 7> EnumValueOptions::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData EnumValueOptions::_class_data_ = { - EnumValueOptions::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* EnumValueOptions::GetClassData() const { - return &_class_data_; -} void EnumValueOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -10264,6 +10327,16 @@ inline void ServiceOptions::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +ServiceOptions::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + ServiceOptions::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void ServiceOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.ServiceOptions) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -10411,13 +10484,6 @@ constexpr ::_pbi::TcParseTable<2, 3, 2, 0, 12> ServiceOptions::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData ServiceOptions::_class_data_ = { - ServiceOptions::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* ServiceOptions::GetClassData() const { - return &_class_data_; -} void ServiceOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -10571,6 +10637,16 @@ inline void MethodOptions::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +MethodOptions::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + MethodOptions::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void MethodOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.MethodOptions) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -10745,13 +10821,6 @@ constexpr ::_pbi::TcParseTable<3, 4, 3, 0, 12> MethodOptions::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData MethodOptions::_class_data_ = { - MethodOptions::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* MethodOptions::GetClassData() const { - return &_class_data_; -} void MethodOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -10886,6 +10955,16 @@ inline void UninterpretedOption_NamePart::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +UninterpretedOption_NamePart::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + UninterpretedOption_NamePart::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void UninterpretedOption_NamePart::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.UninterpretedOption.NamePart) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -11004,13 +11083,6 @@ constexpr ::_pbi::TcParseTable<1, 2, 0, 62, 2> UninterpretedOption_NamePart::_ta return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData UninterpretedOption_NamePart::_class_data_ = { - UninterpretedOption_NamePart::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* UninterpretedOption_NamePart::GetClassData() const { - return &_class_data_; -} void UninterpretedOption_NamePart::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -11157,6 +11229,16 @@ inline void UninterpretedOption::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +UninterpretedOption::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + UninterpretedOption::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void UninterpretedOption::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.UninterpretedOption) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -11386,13 +11468,6 @@ constexpr ::_pbi::TcParseTable<3, 7, 1, 75, 2> UninterpretedOption::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData UninterpretedOption::_class_data_ = { - UninterpretedOption::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* UninterpretedOption::GetClassData() const { - return &_class_data_; -} void UninterpretedOption::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -11552,6 +11627,16 @@ inline void FeatureSet::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +FeatureSet::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + FeatureSet::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void FeatureSet::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FeatureSet) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -11757,13 +11842,6 @@ constexpr ::_pbi::TcParseTable<3, 6, 6, 0, 2> FeatureSet::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData FeatureSet::_class_data_ = { - FeatureSet::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* FeatureSet::GetClassData() const { - return &_class_data_; -} void FeatureSet::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -11906,6 +11984,16 @@ inline void FeatureSetDefaults_FeatureSetEditionDefault::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +FeatureSetDefaults_FeatureSetEditionDefault::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + FeatureSetDefaults_FeatureSetEditionDefault::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void FeatureSetDefaults_FeatureSetEditionDefault::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -12023,13 +12111,6 @@ constexpr ::_pbi::TcParseTable<1, 2, 2, 0, 2> FeatureSetDefaults_FeatureSetEditi return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData FeatureSetDefaults_FeatureSetEditionDefault::_class_data_ = { - FeatureSetDefaults_FeatureSetEditionDefault::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* FeatureSetDefaults_FeatureSetEditionDefault::GetClassData() const { - return &_class_data_; -} void FeatureSetDefaults_FeatureSetEditionDefault::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -12158,6 +12239,16 @@ inline void FeatureSetDefaults::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +FeatureSetDefaults::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + FeatureSetDefaults::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void FeatureSetDefaults::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FeatureSetDefaults) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -12294,13 +12385,6 @@ constexpr ::_pbi::TcParseTable<1, 3, 3, 0, 2> FeatureSetDefaults::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData FeatureSetDefaults::_class_data_ = { - FeatureSetDefaults::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* FeatureSetDefaults::GetClassData() const { - return &_class_data_; -} void FeatureSetDefaults::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -12431,6 +12515,16 @@ inline void SourceCodeInfo_Location::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +SourceCodeInfo_Location::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + SourceCodeInfo_Location::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void SourceCodeInfo_Location::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.SourceCodeInfo.Location) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -12639,13 +12733,6 @@ constexpr ::_pbi::TcParseTable<3, 5, 0, 106, 2> SourceCodeInfo_Location::_table_ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData SourceCodeInfo_Location::_class_data_ = { - SourceCodeInfo_Location::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* SourceCodeInfo_Location::GetClassData() const { - return &_class_data_; -} void SourceCodeInfo_Location::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -12750,6 +12837,16 @@ inline void SourceCodeInfo::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +SourceCodeInfo::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + SourceCodeInfo::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void SourceCodeInfo::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.SourceCodeInfo) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -12838,13 +12935,6 @@ constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 2> SourceCodeInfo::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData SourceCodeInfo::_class_data_ = { - SourceCodeInfo::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* SourceCodeInfo::GetClassData() const { - return &_class_data_; -} void SourceCodeInfo::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -12966,6 +13056,16 @@ inline void GeneratedCodeInfo_Annotation::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +GeneratedCodeInfo_Annotation::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + GeneratedCodeInfo_Annotation::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void GeneratedCodeInfo_Annotation::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.GeneratedCodeInfo.Annotation) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -13159,13 +13259,6 @@ constexpr ::_pbi::TcParseTable<3, 5, 1, 64, 2> GeneratedCodeInfo_Annotation::_ta return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData GeneratedCodeInfo_Annotation::_class_data_ = { - GeneratedCodeInfo_Annotation::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* GeneratedCodeInfo_Annotation::GetClassData() const { - return &_class_data_; -} void GeneratedCodeInfo_Annotation::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); @@ -13278,6 +13371,16 @@ inline void GeneratedCodeInfo::SharedDtor() { _impl_.~Impl_(); } +const ::google::protobuf::MessageLite::ClassData* +GeneratedCodeInfo::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + data = { + GeneratedCodeInfo::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + }; + return &data; +} PROTOBUF_NOINLINE void GeneratedCodeInfo::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.GeneratedCodeInfo) PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); @@ -13366,13 +13469,6 @@ constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 2> GeneratedCodeInfo::_table_ = { return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -const ::google::protobuf::Message::ClassData GeneratedCodeInfo::_class_data_ = { - GeneratedCodeInfo::MergeImpl, - nullptr, // OnDemandRegisterArenaDtor -}; -const ::google::protobuf::Message::ClassData* GeneratedCodeInfo::GetClassData() const { - return &_class_data_; -} void GeneratedCodeInfo::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) { auto* const _this = static_cast(&to_msg); diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index 6367994ea9..ea38e1f3d0 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -822,11 +822,9 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : protected: explicit UninterpretedOption_NamePart(::google::protobuf::Arena* arena); UninterpretedOption_NamePart(::google::protobuf::Arena* arena, const UninterpretedOption_NamePart& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -1018,11 +1016,9 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : protected: explicit SourceCodeInfo_Location(::google::protobuf::Arena* arena); SourceCodeInfo_Location(::google::protobuf::Arena* arena, const SourceCodeInfo_Location& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -1292,11 +1288,9 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : protected: explicit GeneratedCodeInfo_Annotation(::google::protobuf::Arena* arena); GeneratedCodeInfo_Annotation(::google::protobuf::Arena* arena, const GeneratedCodeInfo_Annotation& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -1556,11 +1550,9 @@ class PROTOBUF_EXPORT FieldOptions_EditionDefault final : protected: explicit FieldOptions_EditionDefault(::google::protobuf::Arena* arena); FieldOptions_EditionDefault(::google::protobuf::Arena* arena, const FieldOptions_EditionDefault& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -1752,11 +1744,9 @@ class PROTOBUF_EXPORT FeatureSet final : protected: explicit FeatureSet(::google::protobuf::Arena* arena); FeatureSet(::google::protobuf::Arena* arena, const FeatureSet& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -2300,11 +2290,9 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final : protected: explicit ExtensionRangeOptions_Declaration(::google::protobuf::Arena* arena); ExtensionRangeOptions_Declaration(::google::protobuf::Arena* arena, const ExtensionRangeOptions_Declaration& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -2541,11 +2529,9 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : protected: explicit EnumDescriptorProto_EnumReservedRange(::google::protobuf::Arena* arena); EnumDescriptorProto_EnumReservedRange(::google::protobuf::Arena* arena, const EnumDescriptorProto_EnumReservedRange& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -2731,11 +2717,9 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : protected: explicit DescriptorProto_ReservedRange(::google::protobuf::Arena* arena); DescriptorProto_ReservedRange(::google::protobuf::Arena* arena, const DescriptorProto_ReservedRange& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -2921,11 +2905,9 @@ class PROTOBUF_EXPORT UninterpretedOption final : protected: explicit UninterpretedOption(::google::protobuf::Arena* arena); UninterpretedOption(::google::protobuf::Arena* arena, const UninterpretedOption& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -3203,11 +3185,9 @@ class PROTOBUF_EXPORT SourceCodeInfo final : protected: explicit SourceCodeInfo(::google::protobuf::Arena* arena); SourceCodeInfo(::google::protobuf::Arena* arena, const SourceCodeInfo& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -3388,11 +3368,9 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : protected: explicit GeneratedCodeInfo(::google::protobuf::Arena* arena); GeneratedCodeInfo(::google::protobuf::Arena* arena, const GeneratedCodeInfo& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -3573,11 +3551,9 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : protected: explicit FeatureSetDefaults_FeatureSetEditionDefault(::google::protobuf::Arena* arena); FeatureSetDefaults_FeatureSetEditionDefault(::google::protobuf::Arena* arena, const FeatureSetDefaults_FeatureSetEditionDefault& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -3767,11 +3743,9 @@ class PROTOBUF_EXPORT ServiceOptions final : protected: explicit ServiceOptions(::google::protobuf::Arena* arena); ServiceOptions(::google::protobuf::Arena* arena, const ServiceOptions& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -4160,11 +4134,9 @@ class PROTOBUF_EXPORT OneofOptions final : protected: explicit OneofOptions(::google::protobuf::Arena* arena); OneofOptions(::google::protobuf::Arena* arena, const OneofOptions& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -4540,11 +4512,9 @@ class PROTOBUF_EXPORT MethodOptions final : protected: explicit MethodOptions(::google::protobuf::Arena* arena); MethodOptions(::google::protobuf::Arena* arena, const MethodOptions& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -4967,11 +4937,9 @@ class PROTOBUF_EXPORT MessageOptions final : protected: explicit MessageOptions(::google::protobuf::Arena* arena); MessageOptions(::google::protobuf::Arena* arena, const MessageOptions& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -5412,11 +5380,9 @@ class PROTOBUF_EXPORT FileOptions final : protected: explicit FileOptions(::google::protobuf::Arena* arena); FileOptions(::google::protobuf::Arena* arena, const FileOptions& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -6133,11 +6099,9 @@ class PROTOBUF_EXPORT FieldOptions final : protected: explicit FieldOptions(::google::protobuf::Arena* arena); FieldOptions(::google::protobuf::Arena* arena, const FieldOptions& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -6764,11 +6728,9 @@ class PROTOBUF_EXPORT FeatureSetDefaults final : protected: explicit FeatureSetDefaults(::google::protobuf::Arena* arena); FeatureSetDefaults(::google::protobuf::Arena* arena, const FeatureSetDefaults& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -6976,11 +6938,9 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : protected: explicit ExtensionRangeOptions(::google::protobuf::Arena* arena); ExtensionRangeOptions(::google::protobuf::Arena* arena, const ExtensionRangeOptions& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -7411,11 +7371,9 @@ class PROTOBUF_EXPORT EnumValueOptions final : protected: explicit EnumValueOptions(::google::protobuf::Arena* arena); EnumValueOptions(::google::protobuf::Arena* arena, const EnumValueOptions& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -7817,11 +7775,9 @@ class PROTOBUF_EXPORT EnumOptions final : protected: explicit EnumOptions(::google::protobuf::Arena* arena); EnumOptions(::google::protobuf::Arena* arena, const EnumOptions& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -8236,11 +8192,9 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : protected: explicit OneofDescriptorProto(::google::protobuf::Arena* arena); OneofDescriptorProto(::google::protobuf::Arena* arena, const OneofDescriptorProto& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -8436,11 +8390,9 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : protected: explicit MethodDescriptorProto(::google::protobuf::Arena* arena); MethodDescriptorProto(::google::protobuf::Arena* arena, const MethodDescriptorProto& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -8700,11 +8652,9 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : protected: explicit FieldDescriptorProto(::google::protobuf::Arena* arena); FieldDescriptorProto(::google::protobuf::Arena* arena, const FieldDescriptorProto& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -9098,11 +9048,9 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : protected: explicit EnumValueDescriptorProto(::google::protobuf::Arena* arena); EnumValueDescriptorProto(::google::protobuf::Arena* arena, const EnumValueDescriptorProto& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -9311,11 +9259,9 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : protected: explicit DescriptorProto_ExtensionRange(::google::protobuf::Arena* arena); DescriptorProto_ExtensionRange(::google::protobuf::Arena* arena, const DescriptorProto_ExtensionRange& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -9518,11 +9464,9 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : protected: explicit ServiceDescriptorProto(::google::protobuf::Arena* arena); ServiceDescriptorProto(::google::protobuf::Arena* arena, const ServiceDescriptorProto& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -9738,11 +9682,9 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : protected: explicit EnumDescriptorProto(::google::protobuf::Arena* arena); EnumDescriptorProto(::google::protobuf::Arena* arena, const EnumDescriptorProto& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -10010,11 +9952,9 @@ class PROTOBUF_EXPORT DescriptorProto final : protected: explicit DescriptorProto(::google::protobuf::Arena* arena); DescriptorProto(::google::protobuf::Arena* arena, const DescriptorProto& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -10383,11 +10323,9 @@ class PROTOBUF_EXPORT FileDescriptorProto final : protected: explicit FileDescriptorProto(::google::protobuf::Arena* arena); FileDescriptorProto(::google::protobuf::Arena* arena, const FileDescriptorProto& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -10801,11 +10739,9 @@ class PROTOBUF_EXPORT FileDescriptorSet final : protected: explicit FileDescriptorSet(::google::protobuf::Arena* arena); FileDescriptorSet(::google::protobuf::Arena* arena, const FileDescriptorSet& from); + const ::google::protobuf::MessageLite::ClassData* GetClassData() const final; public: - static const ClassData _class_data_; - const ::google::protobuf::Message::ClassData*GetClassData() const final; - ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- diff --git a/src/google/protobuf/generated_message_bases.cc b/src/google/protobuf/generated_message_bases.cc index 319a0ae681..5821ac6157 100644 --- a/src/google/protobuf/generated_message_bases.cc +++ b/src/google/protobuf/generated_message_bases.cc @@ -7,6 +7,7 @@ #include "google/protobuf/generated_message_bases.h" +#include "google/protobuf/generated_message_reflection.h" #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/io/zero_copy_stream_impl.h" #include "google/protobuf/parse_context.h" @@ -95,7 +96,11 @@ void ZeroFieldsBase::InternalSwap(ZeroFieldsBase* other) { } const Message::ClassData* ZeroFieldsBase::GetClassData() const { - static constexpr ClassData data = {&MergeImpl}; + static constexpr ClassData data = { + &MergeImpl, + nullptr, + &kDescriptorMethods, + }; return &data; } diff --git a/src/google/protobuf/implicit_weak_message.h b/src/google/protobuf/implicit_weak_message.h index 170155a2c9..0428d9eb32 100644 --- a/src/google/protobuf/implicit_weak_message.h +++ b/src/google/protobuf/implicit_weak_message.h @@ -56,7 +56,14 @@ class PROTOBUF_EXPORT ImplicitWeakMessage : public MessageLite { static const ImplicitWeakMessage* default_instance(); - std::string GetTypeName() const override { return ""; } + const ClassData* GetClassData() const final { + struct Data { + ClassData header; + char name[1]; + }; + static constexpr Data data = {{}, ""}; + return &data.header; + } MessageLite* New(Arena* arena) const override { return Arena::CreateMessage(arena); diff --git a/src/google/protobuf/message.cc b/src/google/protobuf/message.cc index b4b1a40c51..a28bd9b770 100644 --- a/src/google/protobuf/message.cc +++ b/src/google/protobuf/message.cc @@ -58,6 +58,10 @@ using internal::ReflectionOps; using internal::WireFormat; using internal::WireFormatLite; +void Message::MergeImpl(Message& to, const Message& from) { + ReflectionOps::Merge(from, &to); +} + void Message::MergeFrom(const Message& from) { auto* class_to = GetClassData(); auto* class_from = from.GetClassData(); @@ -70,6 +74,15 @@ void Message::MergeFrom(const Message& from) { merge_to_from(*this, from); } +const MessageLite::ClassData* Message::GetClassData() const { + static constexpr ClassData data = { + &MergeImpl, + nullptr, + &kDescriptorMethods, + }; + return &data; +} + void Message::CheckTypeAndMergeFrom(const MessageLite& other) { MergeFrom(*DownCast(&other)); } @@ -99,10 +112,6 @@ void Message::CopyFrom(const Message& from) { } } -std::string Message::GetTypeName() const { - return GetDescriptor()->full_name(); -} - void Message::Clear() { ReflectionOps::Clear(this); } bool Message::IsInitialized() const { @@ -182,6 +191,14 @@ size_t Message::SpaceUsedLong() const { return GetReflection()->SpaceUsedLong(*this); } +static std::string GetTypeNameImpl(const MessageLite& msg) { + return DownCast(msg).GetDescriptor()->full_name(); +} + +constexpr MessageLite::DescriptorMethods Message::kDescriptorMethods = { + GetTypeNameImpl, +}; + namespace internal { void* CreateSplitMessageGeneric(Arena* arena, const void* default_split, size_t size, const void* message, diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h index 1fb5368a23..9d38c634b9 100644 --- a/src/google/protobuf/message.h +++ b/src/google/protobuf/message.h @@ -330,7 +330,6 @@ class PROTOBUF_EXPORT Message : public MessageLite { // These methods are pure-virtual in MessageLite, but Message provides // reflection-based default implementations. - std::string GetTypeName() const override; void Clear() override; // Returns whether all required fields have been set. Note that required @@ -370,6 +369,15 @@ class PROTOBUF_EXPORT Message : public MessageLite { size_t MaybeComputeUnknownFieldsSize(size_t total_size, internal::CachedSize* cached_size) const; + // Reflection based version for reflection based types. + static void MergeImpl(Message& to, const Message& from); + + static const DescriptorMethods kDescriptorMethods; + + // Default implementation using reflection. Avoids bloat in MapEntry. + // Generated types will make their own. + const ClassData* GetClassData() const override; + }; namespace internal { diff --git a/src/google/protobuf/message_lite.cc b/src/google/protobuf/message_lite.cc index 4505222763..390852b903 100644 --- a/src/google/protobuf/message_lite.cc +++ b/src/google/protobuf/message_lite.cc @@ -44,18 +44,29 @@ namespace google { namespace protobuf { +std::string MessageLite::GetTypeName() const { + auto* data = GetClassData(); + ABSL_DCHECK(data != nullptr); + + if (data->descriptor_methods != nullptr) { + // For !LITE messages, we use the descriptor method function. + return data->descriptor_methods->get_type_name(*this); + } + + // For LITE messages, the type name is a char[] just beyond ClassData. + return reinterpret_cast(data) + sizeof(ClassData); +} + void MessageLite::OnDemandRegisterArenaDtor(Arena* arena) { if (arena == nullptr) return; auto* data = GetClassData(); - if (data != nullptr && data->on_demand_register_arena_dtor != nullptr) { + ABSL_DCHECK(data != nullptr); + + if (data->on_demand_register_arena_dtor != nullptr) { data->on_demand_register_arena_dtor(*this, *arena); } } -const MessageLite::ClassData* MessageLite::GetClassData() const { - return nullptr; -} - std::string MessageLite::InitializationErrorString() const { return "(cannot determine missing fields for lite message)"; } diff --git a/src/google/protobuf/message_lite.h b/src/google/protobuf/message_lite.h index f8e1167c34..f0c16316ed 100644 --- a/src/google/protobuf/message_lite.h +++ b/src/google/protobuf/message_lite.h @@ -211,7 +211,7 @@ class PROTOBUF_EXPORT MessageLite { // Basic Operations ------------------------------------------------ // Get the name of this message type, e.g. "foo.bar.BazProto". - virtual std::string GetTypeName() const = 0; + std::string GetTypeName() const; // Construct a new instance of the same type. Ownership is passed to the // caller. @@ -518,12 +518,21 @@ class PROTOBUF_EXPORT MessageLite { // of this message or its internal memory could be changed. Arena* GetOwningArena() const { return _internal_metadata_.arena(); } + // We use a secondary vtable for descriptor based methods. This way ClassData + // does not growth with the number of descriptor methods. This avoids extra + // costs in MessageLite. + struct DescriptorMethods { + std::string (*get_type_name)(const MessageLite&); + }; struct ClassData { // 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. void (*merge_to_from)(Message& to, const Message& from_msg); void (*on_demand_register_arena_dtor)(MessageLite& msg, Arena& arena); + // LITE objects (ie !descriptor_methods) collocate their name as a + // char[] just beyond the ClassData. + const DescriptorMethods* descriptor_methods; }; // GetClassData() returns a pointer to a ClassData struct which @@ -531,9 +540,9 @@ class PROTOBUF_EXPORT MessageLite { // property is used in order to quickly determine whether two messages are // of the same type. // - // This is a work in progress. Currently only SPEED messages return an - // instance. In the future all message types will return one. - virtual const ClassData* GetClassData() const; + // This is a work in progress. There are still some types (eg MapEntry) that + // return a default table instead of a unique one. + virtual const ClassData* GetClassData() const = 0; internal::InternalMetadata _internal_metadata_;