From f257fd2eed26d9e48dce2272deafe6a5c81fb54a Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 15 Mar 2023 01:43:51 +0000 Subject: [PATCH] Auto-generate files after cl/516687577 --- src/google/protobuf/api.pb.cc | 67 ++++++++---- src/google/protobuf/api.pb.h | 29 ++--- src/google/protobuf/type.pb.cc | 187 +++++++++++++++++++++------------ src/google/protobuf/type.pb.h | 87 +++++++-------- 4 files changed, 226 insertions(+), 144 deletions(-) diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc index 649d48dc60..c7f399399f 100644 --- a/src/google/protobuf/api.pb.cc +++ b/src/google/protobuf/api.pb.cc @@ -21,7 +21,9 @@ namespace _pbi = ::PROTOBUF_NAMESPACE_ID::internal; PROTOBUF_NAMESPACE_OPEN PROTOBUF_CONSTEXPR Api::Api( ::_pbi::ConstantInitialized): _impl_{ - /*decltype(_impl_.methods_)*/{} + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.methods_)*/{} , /*decltype(_impl_.options_)*/{} , /*decltype(_impl_.mixins_)*/{} , /*decltype(_impl_.name_)*/ { @@ -34,8 +36,7 @@ PROTOBUF_CONSTEXPR Api::Api( , /*decltype(_impl_.source_context_)*/nullptr , /*decltype(_impl_.syntax_)*/ 0 - - , /*decltype(_impl_._cached_size_)*/{}} {} +} {} struct ApiDefaultTypeInternal { PROTOBUF_CONSTEXPR ApiDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} ~ApiDefaultTypeInternal() {} @@ -107,7 +108,7 @@ static constexpr const ::_pb::ServiceDescriptor** file_level_service_descriptors_google_2fprotobuf_2fapi_2eproto = nullptr; const ::uint32_t TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE( protodesc_cold) = { - ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -122,6 +123,13 @@ const ::uint32_t TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.source_context_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.mixins_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.syntax_), + ~0u, + ~0u, + ~0u, + ~0u, + 0, + ~0u, + ~0u, ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _internal_metadata_), ~0u, // no _extensions_ @@ -151,9 +159,9 @@ const ::uint32_t TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Api)}, - { 15, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Method)}, - { 30, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Mixin)}, + { 0, 15, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Api)}, + { 22, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Method)}, + { 37, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Mixin)}, }; static const ::_pb::Message* const file_default_instances[] = { @@ -228,7 +236,13 @@ PROTOBUF_NAMESPACE_OPEN class Api::_Internal { public: + using HasBits = decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Api, _impl_._has_bits_); static const ::PROTOBUF_NAMESPACE_ID::SourceContext& source_context(const Api* msg); + static void set_has_source_context(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } }; const ::PROTOBUF_NAMESPACE_ID::SourceContext& @@ -239,10 +253,8 @@ void Api::clear_options() { _impl_.options_.Clear(); } void Api::clear_source_context() { - if (GetArenaForAllocation() == nullptr && _impl_.source_context_ != nullptr) { - delete _impl_.source_context_; - } - _impl_.source_context_ = nullptr; + if (_impl_.source_context_ != nullptr) _impl_.source_context_->Clear(); + _impl_._has_bits_[0] &= ~0x00000001u; } Api::Api(::PROTOBUF_NAMESPACE_ID::Arena* arena) : ::PROTOBUF_NAMESPACE_ID::Message(arena) { @@ -253,7 +265,9 @@ Api::Api(const Api& from) : ::PROTOBUF_NAMESPACE_ID::Message() { Api* const _this = this; (void)_this; new (&_impl_) Impl_{ - decltype(_impl_.methods_){from._impl_.methods_} + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.methods_){from._impl_.methods_} , decltype(_impl_.options_){from._impl_.options_} , decltype(_impl_.mixins_){from._impl_.mixins_} , decltype(_impl_.name_) {} @@ -262,8 +276,7 @@ Api::Api(const Api& from) , decltype(_impl_.source_context_){nullptr} , decltype(_impl_.syntax_) {} - - , /*decltype(_impl_._cached_size_)*/{}}; + }; _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _impl_.name_.InitDefault(); @@ -280,7 +293,7 @@ Api::Api(const Api& from) if (!from._internal_version().empty()) { _this->_impl_.version_.Set(from._internal_version(), _this->GetArenaForAllocation()); } - if (from._internal_has_source_context()) { + if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) { _this->_impl_.source_context_ = new ::PROTOBUF_NAMESPACE_ID::SourceContext(*from._impl_.source_context_); } _this->_impl_.syntax_ = from._impl_.syntax_; @@ -290,7 +303,9 @@ Api::Api(const Api& from) inline void Api::SharedCtor(::_pb::Arena* arena) { (void)arena; new (&_impl_) Impl_{ - decltype(_impl_.methods_){arena} + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.methods_){arena} , decltype(_impl_.options_){arena} , decltype(_impl_.mixins_){arena} , decltype(_impl_.name_) {} @@ -300,7 +315,6 @@ inline void Api::SharedCtor(::_pb::Arena* arena) { , decltype(_impl_.source_context_){nullptr} , decltype(_impl_.syntax_) { 0 } - , /*decltype(_impl_._cached_size_)*/{} }; _impl_.name_.InitDefault(); #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING @@ -346,16 +360,19 @@ void Api::Clear() { _impl_.mixins_.Clear(); _impl_.name_.ClearToEmpty(); _impl_.version_.ClearToEmpty(); - if (GetArenaForAllocation() == nullptr && _impl_.source_context_ != nullptr) { - delete _impl_.source_context_; + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + ABSL_DCHECK(_impl_.source_context_ != nullptr); + _impl_.source_context_->Clear(); } - _impl_.source_context_ = nullptr; _impl_.syntax_ = 0; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* Api::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::uint32_t tag; ptr = ::_pbi::ReadTag(ptr, &tag); @@ -459,6 +476,7 @@ const char* Api::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { CHK_(ptr != nullptr); } // while message_done: + _impl_._has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; @@ -504,8 +522,9 @@ failure: target = stream->WriteStringMaybeAliased(4, _s, target); } + cached_has_bits = _impl_._has_bits_[0]; // .google.protobuf.SourceContext source_context = 5; - if (this->_internal_has_source_context()) { + if (cached_has_bits & 0x00000001u) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage(5, _Internal::source_context(this), _Internal::source_context(this).GetCachedSize(), target, stream); @@ -576,7 +595,8 @@ failure: } // .google.protobuf.SourceContext source_context = 5; - if (this->_internal_has_source_context()) { + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *_impl_.source_context_); @@ -615,7 +635,7 @@ void Api::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_N if (!from._internal_version().empty()) { _this->_internal_set_version(from._internal_version()); } - if (from._internal_has_source_context()) { + if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) { _this->_internal_mutable_source_context()->::PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom( from._internal_source_context()); } @@ -641,6 +661,7 @@ void Api::InternalSwap(Api* other) { auto* lhs_arena = GetArenaForAllocation(); auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); _impl_.methods_.InternalSwap(&other->_impl_.methods_); _impl_.options_.InternalSwap(&other->_impl_.options_); _impl_.mixins_.InternalSwap(&other->_impl_.mixins_); diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h index f7930953e5..61ba000136 100644 --- a/src/google/protobuf/api.pb.h +++ b/src/google/protobuf/api.pb.h @@ -308,10 +308,6 @@ class PROTOBUF_EXPORT Api final : public: // .google.protobuf.SourceContext source_context = 5; bool has_source_context() const; - private: - bool _internal_has_source_context() const; - - public: void clear_source_context() ; const ::PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const; PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context(); @@ -342,6 +338,8 @@ class PROTOBUF_EXPORT Api final : typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method > methods_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option > options_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin > mixins_; @@ -349,7 +347,6 @@ class PROTOBUF_EXPORT Api final : ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr version_; ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context_; int syntax_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fapi_2eproto; @@ -993,11 +990,10 @@ inline void Api::set_allocated_version(std::string* value) { } // .google.protobuf.SourceContext source_context = 5; -inline bool Api::_internal_has_source_context() const { - return this != internal_default_instance() && _impl_.source_context_ != nullptr; -} inline bool Api::has_source_context() const { - return _internal_has_source_context(); + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || _impl_.source_context_ != nullptr); + return value; } inline const ::PROTOBUF_NAMESPACE_ID::SourceContext& Api::_internal_source_context() const { const ::PROTOBUF_NAMESPACE_ID::SourceContext* p = _impl_.source_context_; @@ -1014,10 +1010,15 @@ inline void Api::unsafe_arena_set_allocated_source_context( delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.source_context_); } _impl_.source_context_ = source_context; + if (source_context) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Api.source_context) } inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::release_source_context() { - + _impl_._has_bits_[0] &= ~0x00000001u; ::PROTOBUF_NAMESPACE_ID::SourceContext* temp = _impl_.source_context_; _impl_.source_context_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE @@ -1033,13 +1034,13 @@ inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::release_source_context() { } inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::unsafe_arena_release_source_context() { // @@protoc_insertion_point(field_release:google.protobuf.Api.source_context) - + _impl_._has_bits_[0] &= ~0x00000001u; ::PROTOBUF_NAMESPACE_ID::SourceContext* temp = _impl_.source_context_; _impl_.source_context_ = nullptr; return temp; } inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::_internal_mutable_source_context() { - + _impl_._has_bits_[0] |= 0x00000001u; if (_impl_.source_context_ == nullptr) { auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::SourceContext>(GetArenaForAllocation()); _impl_.source_context_ = p; @@ -1064,9 +1065,9 @@ inline void Api::set_allocated_source_context(::PROTOBUF_NAMESPACE_ID::SourceCon source_context = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, source_context, submessage_arena); } - + _impl_._has_bits_[0] |= 0x00000001u; } else { - + _impl_._has_bits_[0] &= ~0x00000001u; } _impl_.source_context_ = source_context; // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.source_context) diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index 15a9d80884..1177b0bf54 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -21,7 +21,9 @@ namespace _pbi = ::PROTOBUF_NAMESPACE_ID::internal; PROTOBUF_NAMESPACE_OPEN PROTOBUF_CONSTEXPR Type::Type( ::_pbi::ConstantInitialized): _impl_{ - /*decltype(_impl_.fields_)*/{} + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.fields_)*/{} , /*decltype(_impl_.oneofs_)*/{} , /*decltype(_impl_.options_)*/{} , /*decltype(_impl_.name_)*/ { @@ -34,8 +36,7 @@ PROTOBUF_CONSTEXPR Type::Type( , /*decltype(_impl_.source_context_)*/nullptr , /*decltype(_impl_.syntax_)*/ 0 - - , /*decltype(_impl_._cached_size_)*/{}} {} +} {} struct TypeDefaultTypeInternal { PROTOBUF_CONSTEXPR TypeDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} ~TypeDefaultTypeInternal() {} @@ -88,7 +89,9 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FieldDefaultTypeInternal _Field_default_instance_; PROTOBUF_CONSTEXPR Enum::Enum( ::_pbi::ConstantInitialized): _impl_{ - /*decltype(_impl_.enumvalue_)*/{} + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.enumvalue_)*/{} , /*decltype(_impl_.options_)*/{} , /*decltype(_impl_.name_)*/ { &::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized {} @@ -100,8 +103,7 @@ PROTOBUF_CONSTEXPR Enum::Enum( , /*decltype(_impl_.source_context_)*/nullptr , /*decltype(_impl_.syntax_)*/ 0 - - , /*decltype(_impl_._cached_size_)*/{}} {} +} {} struct EnumDefaultTypeInternal { PROTOBUF_CONSTEXPR EnumDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} ~EnumDefaultTypeInternal() {} @@ -134,12 +136,13 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 EnumValueDefaultTypeInternal _EnumValue_default_instance_; PROTOBUF_CONSTEXPR Option::Option( ::_pbi::ConstantInitialized): _impl_{ - /*decltype(_impl_.name_)*/ { + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.name_)*/ { &::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized {} } - , /*decltype(_impl_.value_)*/nullptr - , /*decltype(_impl_._cached_size_)*/{}} {} + , /*decltype(_impl_.value_)*/nullptr} {} struct OptionDefaultTypeInternal { PROTOBUF_CONSTEXPR OptionDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} ~OptionDefaultTypeInternal() {} @@ -157,7 +160,7 @@ static constexpr const ::_pb::ServiceDescriptor** file_level_service_descriptors_google_2fprotobuf_2ftype_2eproto = nullptr; const ::uint32_t TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE( protodesc_cold) = { - ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Type, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Type, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -172,6 +175,13 @@ const ::uint32_t TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBU PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Type, _impl_.source_context_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Type, _impl_.syntax_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Type, _impl_.edition_), + ~0u, + ~0u, + ~0u, + ~0u, + 0, + ~0u, + ~0u, ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Field, _internal_metadata_), ~0u, // no _extensions_ @@ -190,7 +200,7 @@ const ::uint32_t TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBU PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Field, _impl_.options_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Field, _impl_.json_name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Field, _impl_.default_value_), - ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Enum, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Enum, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -204,6 +214,12 @@ const ::uint32_t TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBU PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Enum, _impl_.source_context_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Enum, _impl_.syntax_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Enum, _impl_.edition_), + ~0u, + ~0u, + ~0u, + 0, + ~0u, + ~0u, ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValue, _internal_metadata_), ~0u, // no _extensions_ @@ -215,7 +231,7 @@ const ::uint32_t TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBU PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValue, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValue, _impl_.number_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValue, _impl_.options_), - ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Option, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Option, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -225,15 +241,17 @@ const ::uint32_t TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBU ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Option, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Option, _impl_.value_), + ~0u, + 0, }; static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Type)}, - { 15, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Field)}, - { 33, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Enum)}, - { 47, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumValue)}, - { 58, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Option)}, + { 0, 15, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Type)}, + { 22, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Field)}, + { 40, 54, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Enum)}, + { 60, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumValue)}, + { 71, 81, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Option)}, }; static const ::_pb::Message* const file_default_instances[] = { @@ -433,7 +451,13 @@ bool Syntax_IsValid(int value) { class Type::_Internal { public: + using HasBits = decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Type, _impl_._has_bits_); static const ::PROTOBUF_NAMESPACE_ID::SourceContext& source_context(const Type* msg); + static void set_has_source_context(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } }; const ::PROTOBUF_NAMESPACE_ID::SourceContext& @@ -441,10 +465,8 @@ Type::_Internal::source_context(const Type* msg) { return *msg->_impl_.source_context_; } void Type::clear_source_context() { - if (GetArenaForAllocation() == nullptr && _impl_.source_context_ != nullptr) { - delete _impl_.source_context_; - } - _impl_.source_context_ = nullptr; + if (_impl_.source_context_ != nullptr) _impl_.source_context_->Clear(); + _impl_._has_bits_[0] &= ~0x00000001u; } Type::Type(::PROTOBUF_NAMESPACE_ID::Arena* arena) : ::PROTOBUF_NAMESPACE_ID::Message(arena) { @@ -455,7 +477,9 @@ Type::Type(const Type& from) : ::PROTOBUF_NAMESPACE_ID::Message() { Type* const _this = this; (void)_this; new (&_impl_) Impl_{ - decltype(_impl_.fields_){from._impl_.fields_} + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.fields_){from._impl_.fields_} , decltype(_impl_.oneofs_){from._impl_.oneofs_} , decltype(_impl_.options_){from._impl_.options_} , decltype(_impl_.name_) {} @@ -464,8 +488,7 @@ Type::Type(const Type& from) , decltype(_impl_.source_context_){nullptr} , decltype(_impl_.syntax_) {} - - , /*decltype(_impl_._cached_size_)*/{}}; + }; _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _impl_.name_.InitDefault(); @@ -482,7 +505,7 @@ Type::Type(const Type& from) if (!from._internal_edition().empty()) { _this->_impl_.edition_.Set(from._internal_edition(), _this->GetArenaForAllocation()); } - if (from._internal_has_source_context()) { + if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) { _this->_impl_.source_context_ = new ::PROTOBUF_NAMESPACE_ID::SourceContext(*from._impl_.source_context_); } _this->_impl_.syntax_ = from._impl_.syntax_; @@ -492,7 +515,9 @@ Type::Type(const Type& from) inline void Type::SharedCtor(::_pb::Arena* arena) { (void)arena; new (&_impl_) Impl_{ - decltype(_impl_.fields_){arena} + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.fields_){arena} , decltype(_impl_.oneofs_){arena} , decltype(_impl_.options_){arena} , decltype(_impl_.name_) {} @@ -502,7 +527,6 @@ inline void Type::SharedCtor(::_pb::Arena* arena) { , decltype(_impl_.source_context_){nullptr} , decltype(_impl_.syntax_) { 0 } - , /*decltype(_impl_._cached_size_)*/{} }; _impl_.name_.InitDefault(); #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING @@ -548,16 +572,19 @@ void Type::Clear() { _impl_.options_.Clear(); _impl_.name_.ClearToEmpty(); _impl_.edition_.ClearToEmpty(); - if (GetArenaForAllocation() == nullptr && _impl_.source_context_ != nullptr) { - delete _impl_.source_context_; + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + ABSL_DCHECK(_impl_.source_context_ != nullptr); + _impl_.source_context_->Clear(); } - _impl_.source_context_ = nullptr; _impl_.syntax_ = 0; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* Type::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::uint32_t tag; ptr = ::_pbi::ReadTag(ptr, &tag); @@ -663,6 +690,7 @@ const char* Type::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { CHK_(ptr != nullptr); } // while message_done: + _impl_._has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; @@ -708,8 +736,9 @@ failure: InternalWriteMessage(4, repfield, repfield.GetCachedSize(), target, stream); } + cached_has_bits = _impl_._has_bits_[0]; // .google.protobuf.SourceContext source_context = 5; - if (this->_internal_has_source_context()) { + if (cached_has_bits & 0x00000001u) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage(5, _Internal::source_context(this), _Internal::source_context(this).GetCachedSize(), target, stream); @@ -779,7 +808,8 @@ failure: } // .google.protobuf.SourceContext source_context = 5; - if (this->_internal_has_source_context()) { + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *_impl_.source_context_); @@ -818,7 +848,7 @@ void Type::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_ if (!from._internal_edition().empty()) { _this->_internal_set_edition(from._internal_edition()); } - if (from._internal_has_source_context()) { + if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) { _this->_internal_mutable_source_context()->::PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom( from._internal_source_context()); } @@ -844,6 +874,7 @@ void Type::InternalSwap(Type* other) { auto* lhs_arena = GetArenaForAllocation(); auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); _impl_.fields_.InternalSwap(&other->_impl_.fields_); _impl_.oneofs_.InternalSwap(&other->_impl_.oneofs_); _impl_.options_.InternalSwap(&other->_impl_.options_); @@ -1398,7 +1429,13 @@ void Field::InternalSwap(Field* other) { class Enum::_Internal { public: + using HasBits = decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Enum, _impl_._has_bits_); static const ::PROTOBUF_NAMESPACE_ID::SourceContext& source_context(const Enum* msg); + static void set_has_source_context(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } }; const ::PROTOBUF_NAMESPACE_ID::SourceContext& @@ -1406,10 +1443,8 @@ Enum::_Internal::source_context(const Enum* msg) { return *msg->_impl_.source_context_; } void Enum::clear_source_context() { - if (GetArenaForAllocation() == nullptr && _impl_.source_context_ != nullptr) { - delete _impl_.source_context_; - } - _impl_.source_context_ = nullptr; + if (_impl_.source_context_ != nullptr) _impl_.source_context_->Clear(); + _impl_._has_bits_[0] &= ~0x00000001u; } Enum::Enum(::PROTOBUF_NAMESPACE_ID::Arena* arena) : ::PROTOBUF_NAMESPACE_ID::Message(arena) { @@ -1420,7 +1455,9 @@ Enum::Enum(const Enum& from) : ::PROTOBUF_NAMESPACE_ID::Message() { Enum* const _this = this; (void)_this; new (&_impl_) Impl_{ - decltype(_impl_.enumvalue_){from._impl_.enumvalue_} + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.enumvalue_){from._impl_.enumvalue_} , decltype(_impl_.options_){from._impl_.options_} , decltype(_impl_.name_) {} @@ -1428,8 +1465,7 @@ Enum::Enum(const Enum& from) , decltype(_impl_.source_context_){nullptr} , decltype(_impl_.syntax_) {} - - , /*decltype(_impl_._cached_size_)*/{}}; + }; _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _impl_.name_.InitDefault(); @@ -1446,7 +1482,7 @@ Enum::Enum(const Enum& from) if (!from._internal_edition().empty()) { _this->_impl_.edition_.Set(from._internal_edition(), _this->GetArenaForAllocation()); } - if (from._internal_has_source_context()) { + if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) { _this->_impl_.source_context_ = new ::PROTOBUF_NAMESPACE_ID::SourceContext(*from._impl_.source_context_); } _this->_impl_.syntax_ = from._impl_.syntax_; @@ -1456,7 +1492,9 @@ Enum::Enum(const Enum& from) inline void Enum::SharedCtor(::_pb::Arena* arena) { (void)arena; new (&_impl_) Impl_{ - decltype(_impl_.enumvalue_){arena} + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.enumvalue_){arena} , decltype(_impl_.options_){arena} , decltype(_impl_.name_) {} @@ -1465,7 +1503,6 @@ inline void Enum::SharedCtor(::_pb::Arena* arena) { , decltype(_impl_.source_context_){nullptr} , decltype(_impl_.syntax_) { 0 } - , /*decltype(_impl_._cached_size_)*/{} }; _impl_.name_.InitDefault(); #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING @@ -1509,16 +1546,19 @@ void Enum::Clear() { _impl_.options_.Clear(); _impl_.name_.ClearToEmpty(); _impl_.edition_.ClearToEmpty(); - if (GetArenaForAllocation() == nullptr && _impl_.source_context_ != nullptr) { - delete _impl_.source_context_; + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + ABSL_DCHECK(_impl_.source_context_ != nullptr); + _impl_.source_context_->Clear(); } - _impl_.source_context_ = nullptr; _impl_.syntax_ = 0; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* Enum::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::uint32_t tag; ptr = ::_pbi::ReadTag(ptr, &tag); @@ -1608,6 +1648,7 @@ const char* Enum::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { CHK_(ptr != nullptr); } // while message_done: + _impl_._has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; @@ -1645,8 +1686,9 @@ failure: InternalWriteMessage(3, repfield, repfield.GetCachedSize(), target, stream); } + cached_has_bits = _impl_._has_bits_[0]; // .google.protobuf.SourceContext source_context = 4; - if (this->_internal_has_source_context()) { + if (cached_has_bits & 0x00000001u) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage(4, _Internal::source_context(this), _Internal::source_context(this).GetCachedSize(), target, stream); @@ -1710,7 +1752,8 @@ failure: } // .google.protobuf.SourceContext source_context = 4; - if (this->_internal_has_source_context()) { + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *_impl_.source_context_); @@ -1748,7 +1791,7 @@ void Enum::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_ if (!from._internal_edition().empty()) { _this->_internal_set_edition(from._internal_edition()); } - if (from._internal_has_source_context()) { + if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) { _this->_internal_mutable_source_context()->::PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom( from._internal_source_context()); } @@ -1774,6 +1817,7 @@ void Enum::InternalSwap(Enum* other) { auto* lhs_arena = GetArenaForAllocation(); auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); _impl_.enumvalue_.InternalSwap(&other->_impl_.enumvalue_); _impl_.options_.InternalSwap(&other->_impl_.options_); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, lhs_arena, @@ -2061,7 +2105,13 @@ void EnumValue::InternalSwap(EnumValue* other) { class Option::_Internal { public: + using HasBits = decltype(std::declval