diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc index 12e7c755c4..4058400779 100644 --- a/src/google/protobuf/any.pb.cc +++ b/src/google/protobuf/any.pb.cc @@ -33,13 +33,13 @@ namespace protobuf { inline constexpr Any::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : type_url_( + : _cached_size_{0}, + type_url_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), value_( &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - _cached_size_{0} {} + ::_pbi::ConstantInitialized()) {} template PROTOBUF_CONSTEXPR Any::Any(::_pbi::ConstantInitialized) @@ -69,7 +69,7 @@ static constexpr const ::_pb::ServiceDescriptor** const ::uint32_t TableStruct_google_2fprotobuf_2fany_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( protodesc_cold) = { - ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::google::protobuf::Any, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Any, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -79,11 +79,13 @@ const ::uint32_t ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::Any, _impl_.type_url_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Any, _impl_.value_), + 0, + 1, }; static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, -1, -1, sizeof(::google::protobuf::Any)}, + {0, 10, -1, sizeof(::google::protobuf::Any)}, }; static const ::_pb::Message* const file_default_instances[] = { &::google::protobuf::_Any_default_instance_._instance, @@ -130,6 +132,10 @@ bool Any::ParseAnyTypeUrl(::absl::string_view type_url, } class Any::_Internal { public: + using HasBits = + decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Any, _impl_._has_bits_); }; Any::Any(::google::protobuf::Arena* arena) @@ -144,9 +150,10 @@ Any::Any(::google::protobuf::Arena* arena) inline PROTOBUF_NDEBUG_INLINE Any::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const ::google::protobuf::Any& from_msg) - : type_url_(arena, from.type_url_), - value_(arena, from.value_), - _cached_size_{0} {} + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + type_url_(arena, from.type_url_), + value_(arena, from.value_) {} Any::Any( ::google::protobuf::Arena* arena, @@ -167,9 +174,9 @@ Any::Any( inline PROTOBUF_NDEBUG_INLINE Any::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : type_url_(arena), - value_(arena), - _cached_size_{0} {} + : _cached_size_{0}, + type_url_(arena), + value_(arena) {} inline void Any::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -231,7 +238,7 @@ const ::google::protobuf::internal::ClassData* Any::GetClassData() const { PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::_pbi::TcParseTable<1, 2, 0, 36, 2> Any::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(Any, _impl_._has_bits_), 0, // no _extensions_ 2, 8, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -249,19 +256,19 @@ const ::_pbi::TcParseTable<1, 2, 0, 36, 2> Any::_table_ = { }, {{ // bytes value = 2; {::_pbi::TcParser::FastBS1, - {18, 63, 0, PROTOBUF_FIELD_OFFSET(Any, _impl_.value_)}}, + {18, 1, 0, PROTOBUF_FIELD_OFFSET(Any, _impl_.value_)}}, // string type_url = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(Any, _impl_.type_url_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(Any, _impl_.type_url_)}}, }}, {{ 65535, 65535 }}, {{ // string type_url = 1; - {PROTOBUF_FIELD_OFFSET(Any, _impl_.type_url_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Any, _impl_.type_url_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // bytes value = 2; - {PROTOBUF_FIELD_OFFSET(Any, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBytes | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Any, _impl_.value_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, }}, // no aux_entries {{ @@ -278,8 +285,16 @@ PROTOBUF_NOINLINE void Any::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.type_url_.ClearToEmpty(); - _impl_.value_.ClearToEmpty(); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + _impl_.type_url_.ClearToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + _impl_.value_.ClearToEmpty(); + } + } + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -299,17 +314,21 @@ PROTOBUF_NOINLINE void Any::Clear() { (void)cached_has_bits; // string type_url = 1; - if (!this_._internal_type_url().empty()) { - const std::string& _s = this_._internal_type_url(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Any.type_url"); - target = stream->WriteStringMaybeAliased(1, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_type_url().empty()) { + const std::string& _s = this_._internal_type_url(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Any.type_url"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } } // bytes value = 2; - if (!this_._internal_value().empty()) { - const std::string& _s = this_._internal_value(); - target = stream->WriteBytesMaybeAliased(2, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { + if (!this_._internal_value().empty()) { + const std::string& _s = this_._internal_value(); + target = stream->WriteBytesMaybeAliased(2, _s, target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -336,16 +355,21 @@ PROTOBUF_NOINLINE void Any::Clear() { (void)cached_has_bits; ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { // string type_url = 1; - if (!this_._internal_type_url().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_type_url()); + if (cached_has_bits & 0x00000001u) { + if (!this_._internal_type_url().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_type_url()); + } } // bytes value = 2; - if (!this_._internal_value().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( - this_._internal_value()); + if (cached_has_bits & 0x00000002u) { + if (!this_._internal_value().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( + this_._internal_value()); + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -360,12 +384,20 @@ void Any::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::pro ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (!from._internal_type_url().empty()) { - _this->_internal_set_type_url(from._internal_type_url()); - } - if (!from._internal_value().empty()) { - _this->_internal_set_value(from._internal_value()); + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + if (!from._internal_type_url().empty()) { + _this->_internal_set_type_url(from._internal_type_url()); + } + } + if (cached_has_bits & 0x00000002u) { + if (!from._internal_value().empty()) { + _this->_internal_set_value(from._internal_value()); + } + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -382,6 +414,7 @@ void Any::InternalSwap(Any* PROTOBUF_RESTRICT other) { auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.type_url_, &other->_impl_.type_url_, arena); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.value_, &other->_impl_.value_, arena); } diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h index f09cf376cc..c753c8c5e5 100644 --- a/src/google/protobuf/any.pb.h +++ b/src/google/protobuf/any.pb.h @@ -330,9 +330,10 @@ class PROTOBUF_EXPORT Any final inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const Any& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; + ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::internal::ArenaStringPtr type_url_; ::google::protobuf::internal::ArenaStringPtr value_; - ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -361,6 +362,7 @@ PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Any_cla inline void Any::clear_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.type_url_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& Any::type_url() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -371,6 +373,7 @@ template inline PROTOBUF_ALWAYS_INLINE void Any::set_type_url(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.type_url_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Any.type_url) } @@ -385,19 +388,34 @@ inline const std::string& Any::_internal_type_url() const { } inline void Any::_internal_set_type_url(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.type_url_.Set(value, GetArena()); } inline std::string* Any::_internal_mutable_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.type_url_.Mutable( GetArena()); } inline std::string* Any::release_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Any.type_url) - return _impl_.type_url_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.type_url_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.type_url_.Set("", GetArena()); + } + return released; } inline void Any::set_allocated_type_url(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.type_url_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.type_url_.IsDefault()) { _impl_.type_url_.Set("", GetArena()); @@ -409,6 +427,7 @@ inline void Any::set_allocated_type_url(std::string* value) { inline void Any::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000002u; } inline const std::string& Any::value() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -419,6 +438,7 @@ template inline PROTOBUF_ALWAYS_INLINE void Any::set_value(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.value_.SetBytes(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Any.value) } @@ -433,19 +453,34 @@ inline const std::string& Any::_internal_value() const { } inline void Any::_internal_set_value(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.value_.Set(value, GetArena()); } inline std::string* Any::_internal_mutable_value() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; return _impl_.value_.Mutable( GetArena()); } inline std::string* Any::release_value() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Any.value) - return _impl_.value_.Release(); + if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000002u; + auto* released = _impl_.value_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.value_.Set("", GetArena()); + } + return released; } inline void Any::set_allocated_value(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } _impl_.value_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.value_.IsDefault()) { _impl_.value_.Set("", GetArena()); diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc index c5b823c8ac..45f2f1cfdd 100644 --- a/src/google/protobuf/api.pb.cc +++ b/src/google/protobuf/api.pb.cc @@ -29,13 +29,13 @@ namespace protobuf { inline constexpr Mixin::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : name_( + : _cached_size_{0}, + name_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), root_( &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - _cached_size_{0} {} + ::_pbi::ConstantInitialized()) {} template PROTOBUF_CONSTEXPR Mixin::Mixin(::_pbi::ConstantInitialized) @@ -59,7 +59,8 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr Method::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : options_{}, + : _cached_size_{0}, + options_{}, name_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), @@ -71,8 +72,7 @@ inline constexpr Method::Impl_::Impl_( ::_pbi::ConstantInitialized()), request_streaming_{false}, response_streaming_{false}, - syntax_{static_cast< ::google::protobuf::Syntax >(0)}, - _cached_size_{0} {} + syntax_{static_cast< ::google::protobuf::Syntax >(0)} {} template PROTOBUF_CONSTEXPR Method::Method(::_pbi::ConstantInitialized) @@ -152,14 +152,14 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::google::protobuf::Api, _impl_.source_context_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Api, _impl_.mixins_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Api, _impl_.syntax_), - ~0u, - ~0u, - ~0u, - ~0u, 0, ~0u, ~0u, - ~0u, // no _has_bits_ + 1, + 2, + ~0u, + 3, + PROTOBUF_FIELD_OFFSET(::google::protobuf::Method, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Method, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -174,7 +174,14 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::google::protobuf::Method, _impl_.response_streaming_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Method, _impl_.options_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Method, _impl_.syntax_), - ~0u, // no _has_bits_ + 0, + 1, + 3, + 2, + 4, + ~0u, + 5, + PROTOBUF_FIELD_OFFSET(::google::protobuf::Mixin, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Mixin, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -184,13 +191,15 @@ const ::uint32_t ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::Mixin, _impl_.name_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Mixin, _impl_.root_), + 0, + 1, }; static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { {0, 15, -1, sizeof(::google::protobuf::Api)}, - {22, -1, -1, sizeof(::google::protobuf::Method)}, - {37, -1, -1, sizeof(::google::protobuf::Mixin)}, + {22, 37, -1, sizeof(::google::protobuf::Method)}, + {44, 54, -1, sizeof(::google::protobuf::Mixin)}, }; static const ::_pb::Message* const file_default_instances[] = { &::google::protobuf::_Api_default_instance_._instance, @@ -260,7 +269,7 @@ void Api::clear_options() { void Api::clear_source_context() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.source_context_ != nullptr) _impl_.source_context_->Clear(); - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; } Api::Api(::google::protobuf::Arena* arena) #if defined(PROTOBUF_CUSTOM_VTABLE) @@ -296,7 +305,7 @@ Api::Api( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.source_context_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceContext>( + _impl_.source_context_ = (cached_has_bits & 0x00000004u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceContext>( arena, *from._impl_.source_context_) : nullptr; _impl_.syntax_ = from._impl_.syntax_; @@ -419,7 +428,7 @@ const ::_pbi::TcParseTable<3, 7, 4, 39, 2> Api::_table_ = { {::_pbi::TcParser::MiniParse, {}}, // string name = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(Api, _impl_.name_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(Api, _impl_.name_)}}, // repeated .google.protobuf.Method methods = 2; {::_pbi::TcParser::FastMtR1, {18, 63, 0, PROTOBUF_FIELD_OFFSET(Api, _impl_.methods_)}}, @@ -428,22 +437,22 @@ const ::_pbi::TcParseTable<3, 7, 4, 39, 2> Api::_table_ = { {26, 63, 1, PROTOBUF_FIELD_OFFSET(Api, _impl_.options_)}}, // string version = 4; {::_pbi::TcParser::FastUS1, - {34, 63, 0, PROTOBUF_FIELD_OFFSET(Api, _impl_.version_)}}, + {34, 1, 0, PROTOBUF_FIELD_OFFSET(Api, _impl_.version_)}}, // .google.protobuf.SourceContext source_context = 5; {::_pbi::TcParser::FastMtS1, - {42, 0, 2, PROTOBUF_FIELD_OFFSET(Api, _impl_.source_context_)}}, + {42, 2, 2, PROTOBUF_FIELD_OFFSET(Api, _impl_.source_context_)}}, // repeated .google.protobuf.Mixin mixins = 6; {::_pbi::TcParser::FastMtR1, {50, 63, 3, PROTOBUF_FIELD_OFFSET(Api, _impl_.mixins_)}}, // .google.protobuf.Syntax syntax = 7; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Api, _impl_.syntax_), 63>(), - {56, 63, 0, PROTOBUF_FIELD_OFFSET(Api, _impl_.syntax_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Api, _impl_.syntax_), 3>(), + {56, 3, 0, PROTOBUF_FIELD_OFFSET(Api, _impl_.syntax_)}}, }}, {{ 65535, 65535 }}, {{ // string name = 1; - {PROTOBUF_FIELD_OFFSET(Api, _impl_.name_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Api, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // repeated .google.protobuf.Method methods = 2; {PROTOBUF_FIELD_OFFSET(Api, _impl_.methods_), -1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, @@ -451,17 +460,17 @@ const ::_pbi::TcParseTable<3, 7, 4, 39, 2> Api::_table_ = { {PROTOBUF_FIELD_OFFSET(Api, _impl_.options_), -1, 1, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, // string version = 4; - {PROTOBUF_FIELD_OFFSET(Api, _impl_.version_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Api, _impl_.version_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // .google.protobuf.SourceContext source_context = 5; - {PROTOBUF_FIELD_OFFSET(Api, _impl_.source_context_), _Internal::kHasBitsOffset + 0, 2, + {PROTOBUF_FIELD_OFFSET(Api, _impl_.source_context_), _Internal::kHasBitsOffset + 2, 2, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, // repeated .google.protobuf.Mixin mixins = 6; {PROTOBUF_FIELD_OFFSET(Api, _impl_.mixins_), -1, 3, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, // .google.protobuf.Syntax syntax = 7; - {PROTOBUF_FIELD_OFFSET(Api, _impl_.syntax_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + {PROTOBUF_FIELD_OFFSET(Api, _impl_.syntax_), _Internal::kHasBitsOffset + 3, 0, + (0 | ::_fl::kFcOptional | ::_fl::kOpenEnum)}, }}, {{ {::_pbi::TcParser::GetTable<::google::protobuf::Method>()}, {::_pbi::TcParser::GetTable<::google::protobuf::Option>()}, @@ -485,12 +494,18 @@ PROTOBUF_NOINLINE void Api::Clear() { _impl_.methods_.Clear(); _impl_.options_.Clear(); _impl_.mixins_.Clear(); - _impl_.name_.ClearToEmpty(); - _impl_.version_.ClearToEmpty(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - ABSL_DCHECK(_impl_.source_context_ != nullptr); - _impl_.source_context_->Clear(); + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + _impl_.name_.ClearToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + _impl_.version_.ClearToEmpty(); + } + if (cached_has_bits & 0x00000004u) { + ABSL_DCHECK(_impl_.source_context_ != nullptr); + _impl_.source_context_->Clear(); + } } _impl_.syntax_ = 0; _impl_._has_bits_.Clear(); @@ -513,11 +528,13 @@ PROTOBUF_NOINLINE void Api::Clear() { (void)cached_has_bits; // string name = 1; - if (!this_._internal_name().empty()) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Api.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Api.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } } // repeated .google.protobuf.Method methods = 2; @@ -543,16 +560,18 @@ PROTOBUF_NOINLINE void Api::Clear() { } // string version = 4; - if (!this_._internal_version().empty()) { - const std::string& _s = this_._internal_version(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Api.version"); - target = stream->WriteStringMaybeAliased(4, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { + if (!this_._internal_version().empty()) { + const std::string& _s = this_._internal_version(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Api.version"); + target = stream->WriteStringMaybeAliased(4, _s, target); + } } cached_has_bits = this_._impl_._has_bits_[0]; // .google.protobuf.SourceContext source_context = 5; - if (cached_has_bits & 0x00000001u) { + if (cached_has_bits & 0x00000004u) { target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( 5, *this_._impl_.source_context_, this_._impl_.source_context_->GetCachedSize(), target, stream); @@ -570,10 +589,12 @@ PROTOBUF_NOINLINE void Api::Clear() { } // .google.protobuf.Syntax syntax = 7; - if (this_._internal_syntax() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 7, this_._internal_syntax(), target); + if (cached_has_bits & 0x00000008u) { + if (this_._internal_syntax() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 7, this_._internal_syntax(), target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -623,31 +644,33 @@ PROTOBUF_NOINLINE void Api::Clear() { } } } - { + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { // string name = 1; - if (!this_._internal_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); + if (cached_has_bits & 0x00000001u) { + if (!this_._internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } } // string version = 4; - if (!this_._internal_version().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_version()); + if (cached_has_bits & 0x00000002u) { + if (!this_._internal_version().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_version()); + } } - } - { // .google.protobuf.SourceContext source_context = 5; - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { + if (cached_has_bits & 0x00000004u) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.source_context_); } - } - { // .google.protobuf.Syntax syntax = 7; - if (this_._internal_syntax() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_syntax()); + if (cached_has_bits & 0x00000008u) { + if (this_._internal_syntax() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_syntax()); + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -669,24 +692,32 @@ void Api::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::pro from._internal_options()); _this->_internal_mutable_mixins()->MergeFrom( from._internal_mixins()); - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } - if (!from._internal_version().empty()) { - _this->_internal_set_version(from._internal_version()); - } cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - ABSL_DCHECK(from._impl_.source_context_ != nullptr); - if (_this->_impl_.source_context_ == nullptr) { - _this->_impl_.source_context_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceContext>(arena, *from._impl_.source_context_); - } else { - _this->_impl_.source_context_->MergeFrom(*from._impl_.source_context_); + if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000001u) { + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } + } + if (cached_has_bits & 0x00000002u) { + if (!from._internal_version().empty()) { + _this->_internal_set_version(from._internal_version()); + } + } + if (cached_has_bits & 0x00000004u) { + ABSL_DCHECK(from._impl_.source_context_ != nullptr); + if (_this->_impl_.source_context_ == nullptr) { + _this->_impl_.source_context_ = + ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceContext>(arena, *from._impl_.source_context_); + } else { + _this->_impl_.source_context_->MergeFrom(*from._impl_.source_context_); + } + } + if (cached_has_bits & 0x00000008u) { + if (from._internal_syntax() != 0) { + _this->_impl_.syntax_ = from._impl_.syntax_; + } } - } - if (from._internal_syntax() != 0) { - _this->_impl_.syntax_ = from._impl_.syntax_; } _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); @@ -726,6 +757,10 @@ void Api::InternalSwap(Api* PROTOBUF_RESTRICT other) { class Method::_Internal { public: + using HasBits = + decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Method, _impl_._has_bits_); }; void Method::clear_options() { @@ -744,11 +779,12 @@ Method::Method(::google::protobuf::Arena* arena) inline PROTOBUF_NDEBUG_INLINE Method::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const ::google::protobuf::Method& from_msg) - : options_{visibility, arena, from.options_}, + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + options_{visibility, arena, from.options_}, name_(arena, from.name_), request_type_url_(arena, from.request_type_url_), - response_type_url_(arena, from.response_type_url_), - _cached_size_{0} {} + response_type_url_(arena, from.response_type_url_) {} Method::Method( ::google::protobuf::Arena* arena, @@ -776,11 +812,11 @@ Method::Method( inline PROTOBUF_NDEBUG_INLINE Method::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : options_{visibility, arena}, + : _cached_size_{0}, + options_{visibility, arena}, name_(arena), request_type_url_(arena), - response_type_url_(arena), - _cached_size_{0} {} + response_type_url_(arena) {} inline void Method::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -861,7 +897,7 @@ const ::google::protobuf::internal::ClassData* Method::GetClassData() const { PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::_pbi::TcParseTable<3, 7, 1, 68, 2> Method::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(Method, _impl_._has_bits_), 0, // no _extensions_ 7, 56, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -880,49 +916,49 @@ const ::_pbi::TcParseTable<3, 7, 1, 68, 2> Method::_table_ = { {::_pbi::TcParser::MiniParse, {}}, // string name = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.name_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.name_)}}, // string request_type_url = 2; {::_pbi::TcParser::FastUS1, - {18, 63, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.request_type_url_)}}, + {18, 1, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.request_type_url_)}}, // bool request_streaming = 3; - {::_pbi::TcParser::SingularVarintNoZag1(), - {24, 63, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.request_streaming_)}}, + {::_pbi::TcParser::SingularVarintNoZag1(), + {24, 3, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.request_streaming_)}}, // string response_type_url = 4; {::_pbi::TcParser::FastUS1, - {34, 63, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.response_type_url_)}}, + {34, 2, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.response_type_url_)}}, // bool response_streaming = 5; - {::_pbi::TcParser::SingularVarintNoZag1(), - {40, 63, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.response_streaming_)}}, + {::_pbi::TcParser::SingularVarintNoZag1(), + {40, 4, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.response_streaming_)}}, // repeated .google.protobuf.Option options = 6; {::_pbi::TcParser::FastMtR1, {50, 63, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.options_)}}, // .google.protobuf.Syntax syntax = 7; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Method, _impl_.syntax_), 63>(), - {56, 63, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.syntax_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Method, _impl_.syntax_), 5>(), + {56, 5, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.syntax_)}}, }}, {{ 65535, 65535 }}, {{ // string name = 1; - {PROTOBUF_FIELD_OFFSET(Method, _impl_.name_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Method, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // string request_type_url = 2; - {PROTOBUF_FIELD_OFFSET(Method, _impl_.request_type_url_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Method, _impl_.request_type_url_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // bool request_streaming = 3; - {PROTOBUF_FIELD_OFFSET(Method, _impl_.request_streaming_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + {PROTOBUF_FIELD_OFFSET(Method, _impl_.request_streaming_), _Internal::kHasBitsOffset + 3, 0, + (0 | ::_fl::kFcOptional | ::_fl::kBool)}, // string response_type_url = 4; - {PROTOBUF_FIELD_OFFSET(Method, _impl_.response_type_url_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Method, _impl_.response_type_url_), _Internal::kHasBitsOffset + 2, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // bool response_streaming = 5; - {PROTOBUF_FIELD_OFFSET(Method, _impl_.response_streaming_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + {PROTOBUF_FIELD_OFFSET(Method, _impl_.response_streaming_), _Internal::kHasBitsOffset + 4, 0, + (0 | ::_fl::kFcOptional | ::_fl::kBool)}, // repeated .google.protobuf.Option options = 6; - {PROTOBUF_FIELD_OFFSET(Method, _impl_.options_), 0, 0, + {PROTOBUF_FIELD_OFFSET(Method, _impl_.options_), -1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, // .google.protobuf.Syntax syntax = 7; - {PROTOBUF_FIELD_OFFSET(Method, _impl_.syntax_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + {PROTOBUF_FIELD_OFFSET(Method, _impl_.syntax_), _Internal::kHasBitsOffset + 5, 0, + (0 | ::_fl::kFcOptional | ::_fl::kOpenEnum)}, }}, {{ {::_pbi::TcParser::GetTable<::google::protobuf::Option>()}, }}, {{ @@ -942,12 +978,24 @@ PROTOBUF_NOINLINE void Method::Clear() { (void) cached_has_bits; _impl_.options_.Clear(); - _impl_.name_.ClearToEmpty(); - _impl_.request_type_url_.ClearToEmpty(); - _impl_.response_type_url_.ClearToEmpty(); - ::memset(&_impl_.request_streaming_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.syntax_) - - reinterpret_cast(&_impl_.request_streaming_)) + sizeof(_impl_.syntax_)); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + _impl_.name_.ClearToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + _impl_.request_type_url_.ClearToEmpty(); + } + if (cached_has_bits & 0x00000004u) { + _impl_.response_type_url_.ClearToEmpty(); + } + } + if (cached_has_bits & 0x00000038u) { + ::memset(&_impl_.request_streaming_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.syntax_) - + reinterpret_cast(&_impl_.request_streaming_)) + sizeof(_impl_.syntax_)); + } + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -967,41 +1015,51 @@ PROTOBUF_NOINLINE void Method::Clear() { (void)cached_has_bits; // string name = 1; - if (!this_._internal_name().empty()) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } } // string request_type_url = 2; - if (!this_._internal_request_type_url().empty()) { - const std::string& _s = this_._internal_request_type_url(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.request_type_url"); - target = stream->WriteStringMaybeAliased(2, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { + if (!this_._internal_request_type_url().empty()) { + const std::string& _s = this_._internal_request_type_url(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.request_type_url"); + target = stream->WriteStringMaybeAliased(2, _s, target); + } } // bool request_streaming = 3; - if (this_._internal_request_streaming() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 3, this_._internal_request_streaming(), target); + if ((this_._impl_._has_bits_[0] & 0x00000008u) != 0) { + if (this_._internal_request_streaming() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 3, this_._internal_request_streaming(), target); + } } // string response_type_url = 4; - if (!this_._internal_response_type_url().empty()) { - const std::string& _s = this_._internal_response_type_url(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.response_type_url"); - target = stream->WriteStringMaybeAliased(4, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000004u) != 0) { + if (!this_._internal_response_type_url().empty()) { + const std::string& _s = this_._internal_response_type_url(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.response_type_url"); + target = stream->WriteStringMaybeAliased(4, _s, target); + } } // bool response_streaming = 5; - if (this_._internal_response_streaming() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 5, this_._internal_response_streaming(), target); + if ((this_._impl_._has_bits_[0] & 0x00000010u) != 0) { + if (this_._internal_response_streaming() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 5, this_._internal_response_streaming(), target); + } } // repeated .google.protobuf.Option options = 6; @@ -1016,10 +1074,12 @@ PROTOBUF_NOINLINE void Method::Clear() { } // .google.protobuf.Syntax syntax = 7; - if (this_._internal_syntax() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 7, this_._internal_syntax(), target); + if ((this_._impl_._has_bits_[0] & 0x00000020u) != 0) { + if (this_._internal_syntax() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 7, this_._internal_syntax(), target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -1055,34 +1115,47 @@ PROTOBUF_NOINLINE void Method::Clear() { } } } - { + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x0000003fu) { // string name = 1; - if (!this_._internal_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); + if (cached_has_bits & 0x00000001u) { + if (!this_._internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } } // string request_type_url = 2; - if (!this_._internal_request_type_url().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_request_type_url()); + if (cached_has_bits & 0x00000002u) { + if (!this_._internal_request_type_url().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_request_type_url()); + } } // string response_type_url = 4; - if (!this_._internal_response_type_url().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_response_type_url()); + if (cached_has_bits & 0x00000004u) { + if (!this_._internal_response_type_url().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_response_type_url()); + } } // bool request_streaming = 3; - if (this_._internal_request_streaming() != 0) { - total_size += 2; + if (cached_has_bits & 0x00000008u) { + if (this_._internal_request_streaming() != 0) { + total_size += 2; + } } // bool response_streaming = 5; - if (this_._internal_response_streaming() != 0) { - total_size += 2; + if (cached_has_bits & 0x00000010u) { + if (this_._internal_response_streaming() != 0) { + total_size += 2; + } } // .google.protobuf.Syntax syntax = 7; - if (this_._internal_syntax() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_syntax()); + if (cached_has_bits & 0x00000020u) { + if (this_._internal_syntax() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_syntax()); + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -1099,24 +1172,40 @@ void Method::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google:: _this->_internal_mutable_options()->MergeFrom( from._internal_options()); - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } - if (!from._internal_request_type_url().empty()) { - _this->_internal_set_request_type_url(from._internal_request_type_url()); - } - if (!from._internal_response_type_url().empty()) { - _this->_internal_set_response_type_url(from._internal_response_type_url()); - } - if (from._internal_request_streaming() != 0) { - _this->_impl_.request_streaming_ = from._impl_.request_streaming_; - } - if (from._internal_response_streaming() != 0) { - _this->_impl_.response_streaming_ = from._impl_.response_streaming_; - } - if (from._internal_syntax() != 0) { - _this->_impl_.syntax_ = from._impl_.syntax_; + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x0000003fu) { + if (cached_has_bits & 0x00000001u) { + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } + } + if (cached_has_bits & 0x00000002u) { + if (!from._internal_request_type_url().empty()) { + _this->_internal_set_request_type_url(from._internal_request_type_url()); + } + } + if (cached_has_bits & 0x00000004u) { + if (!from._internal_response_type_url().empty()) { + _this->_internal_set_response_type_url(from._internal_response_type_url()); + } + } + if (cached_has_bits & 0x00000008u) { + if (from._internal_request_streaming() != 0) { + _this->_impl_.request_streaming_ = from._impl_.request_streaming_; + } + } + if (cached_has_bits & 0x00000010u) { + if (from._internal_response_streaming() != 0) { + _this->_impl_.response_streaming_ = from._impl_.response_streaming_; + } + } + if (cached_has_bits & 0x00000020u) { + if (from._internal_syntax() != 0) { + _this->_impl_.syntax_ = from._impl_.syntax_; + } + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -1133,6 +1222,7 @@ void Method::InternalSwap(Method* PROTOBUF_RESTRICT other) { auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); _impl_.options_.InternalSwap(&other->_impl_.options_); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, &other->_impl_.name_, arena); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.request_type_url_, &other->_impl_.request_type_url_, arena); @@ -1152,6 +1242,10 @@ void Method::InternalSwap(Method* PROTOBUF_RESTRICT other) { class Mixin::_Internal { public: + using HasBits = + decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Mixin, _impl_._has_bits_); }; Mixin::Mixin(::google::protobuf::Arena* arena) @@ -1166,9 +1260,10 @@ Mixin::Mixin(::google::protobuf::Arena* arena) inline PROTOBUF_NDEBUG_INLINE Mixin::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const ::google::protobuf::Mixin& from_msg) - : name_(arena, from.name_), - root_(arena, from.root_), - _cached_size_{0} {} + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + name_(arena, from.name_), + root_(arena, from.root_) {} Mixin::Mixin( ::google::protobuf::Arena* arena, @@ -1189,9 +1284,9 @@ Mixin::Mixin( inline PROTOBUF_NDEBUG_INLINE Mixin::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : name_(arena), - root_(arena), - _cached_size_{0} {} + : _cached_size_{0}, + name_(arena), + root_(arena) {} inline void Mixin::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -1253,7 +1348,7 @@ const ::google::protobuf::internal::ClassData* Mixin::GetClassData() const { PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::_pbi::TcParseTable<1, 2, 0, 38, 2> Mixin::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(Mixin, _impl_._has_bits_), 0, // no _extensions_ 2, 8, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -1271,19 +1366,19 @@ const ::_pbi::TcParseTable<1, 2, 0, 38, 2> Mixin::_table_ = { }, {{ // string root = 2; {::_pbi::TcParser::FastUS1, - {18, 63, 0, PROTOBUF_FIELD_OFFSET(Mixin, _impl_.root_)}}, + {18, 1, 0, PROTOBUF_FIELD_OFFSET(Mixin, _impl_.root_)}}, // string name = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(Mixin, _impl_.name_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(Mixin, _impl_.name_)}}, }}, {{ 65535, 65535 }}, {{ // string name = 1; - {PROTOBUF_FIELD_OFFSET(Mixin, _impl_.name_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Mixin, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // string root = 2; - {PROTOBUF_FIELD_OFFSET(Mixin, _impl_.root_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Mixin, _impl_.root_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, }}, // no aux_entries {{ @@ -1301,8 +1396,16 @@ PROTOBUF_NOINLINE void Mixin::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.name_.ClearToEmpty(); - _impl_.root_.ClearToEmpty(); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + _impl_.name_.ClearToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + _impl_.root_.ClearToEmpty(); + } + } + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -1322,19 +1425,23 @@ PROTOBUF_NOINLINE void Mixin::Clear() { (void)cached_has_bits; // string name = 1; - if (!this_._internal_name().empty()) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Mixin.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Mixin.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } } // string root = 2; - if (!this_._internal_root().empty()) { - const std::string& _s = this_._internal_root(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Mixin.root"); - target = stream->WriteStringMaybeAliased(2, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { + if (!this_._internal_root().empty()) { + const std::string& _s = this_._internal_root(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Mixin.root"); + target = stream->WriteStringMaybeAliased(2, _s, target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -1361,16 +1468,21 @@ PROTOBUF_NOINLINE void Mixin::Clear() { (void)cached_has_bits; ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { // string name = 1; - if (!this_._internal_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); + if (cached_has_bits & 0x00000001u) { + if (!this_._internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } } // string root = 2; - if (!this_._internal_root().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_root()); + if (cached_has_bits & 0x00000002u) { + if (!this_._internal_root().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_root()); + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -1385,12 +1497,20 @@ void Mixin::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::p ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } - if (!from._internal_root().empty()) { - _this->_internal_set_root(from._internal_root()); + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } + } + if (cached_has_bits & 0x00000002u) { + if (!from._internal_root().empty()) { + _this->_internal_set_root(from._internal_root()); + } + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -1407,6 +1527,7 @@ void Mixin::InternalSwap(Mixin* PROTOBUF_RESTRICT other) { auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, &other->_impl_.name_, arena); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.root_, &other->_impl_.root_, arena); } diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h index 7510a77df5..287da99e3f 100644 --- a/src/google/protobuf/api.pb.h +++ b/src/google/protobuf/api.pb.h @@ -284,9 +284,10 @@ class PROTOBUF_EXPORT Mixin final inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const Mixin& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; + ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::internal::ArenaStringPtr root_; - ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -570,6 +571,8 @@ class PROTOBUF_EXPORT Method final inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const Method& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; + ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option > options_; ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::internal::ArenaStringPtr request_type_url_; @@ -577,7 +580,6 @@ class PROTOBUF_EXPORT Method final bool request_streaming_; bool response_streaming_; int syntax_; - ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -911,6 +913,7 @@ PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Api_cla inline void Api::clear_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& Api::name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -921,6 +924,7 @@ template inline PROTOBUF_ALWAYS_INLINE void Api::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Api.name) } @@ -935,19 +939,34 @@ inline const std::string& Api::_internal_name() const { } inline void Api::_internal_set_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } inline std::string* Api::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } inline std::string* Api::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Api.name) - return _impl_.name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.name_.Set("", GetArena()); + } + return released; } inline void Api::set_allocated_name(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.name_.IsDefault()) { _impl_.name_.Set("", GetArena()); @@ -1053,6 +1072,7 @@ Api::_internal_mutable_options() { inline void Api::clear_version() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.version_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000002u; } inline const std::string& Api::version() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -1063,6 +1083,7 @@ template inline PROTOBUF_ALWAYS_INLINE void Api::set_version(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.version_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Api.version) } @@ -1077,19 +1098,34 @@ inline const std::string& Api::_internal_version() const { } inline void Api::_internal_set_version(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.version_.Set(value, GetArena()); } inline std::string* Api::_internal_mutable_version() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; return _impl_.version_.Mutable( GetArena()); } inline std::string* Api::release_version() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Api.version) - return _impl_.version_.Release(); + if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000002u; + auto* released = _impl_.version_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.version_.Set("", GetArena()); + } + return released; } inline void Api::set_allocated_version(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } _impl_.version_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.version_.IsDefault()) { _impl_.version_.Set("", GetArena()); @@ -1099,7 +1135,7 @@ inline void Api::set_allocated_version(std::string* value) { // .google.protobuf.SourceContext source_context = 5; inline bool Api::has_source_context() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; PROTOBUF_ASSUME(!value || _impl_.source_context_ != nullptr); return value; } @@ -1119,16 +1155,16 @@ inline void Api::unsafe_arena_set_allocated_source_context(::google::protobuf::S } _impl_.source_context_ = reinterpret_cast<::google::protobuf::SourceContext*>(value); if (value != nullptr) { - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000004u; } else { - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Api.source_context) } inline ::google::protobuf::SourceContext* Api::release_source_context() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; ::google::protobuf::SourceContext* released = _impl_.source_context_; _impl_.source_context_ = nullptr; if (::google::protobuf::internal::DebugHardenForceCopyInRelease()) { @@ -1148,7 +1184,7 @@ inline ::google::protobuf::SourceContext* Api::unsafe_arena_release_source_conte ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Api.source_context) - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; ::google::protobuf::SourceContext* temp = _impl_.source_context_; _impl_.source_context_ = nullptr; return temp; @@ -1162,7 +1198,7 @@ inline ::google::protobuf::SourceContext* Api::_internal_mutable_source_context( return _impl_.source_context_; } inline ::google::protobuf::SourceContext* Api::mutable_source_context() ABSL_ATTRIBUTE_LIFETIME_BOUND { - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000004u; ::google::protobuf::SourceContext* _msg = _internal_mutable_source_context(); // @@protoc_insertion_point(field_mutable:google.protobuf.Api.source_context) return _msg; @@ -1179,9 +1215,9 @@ inline void Api::set_allocated_source_context(::google::protobuf::SourceContext* if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000004u; } else { - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; } _impl_.source_context_ = reinterpret_cast<::google::protobuf::SourceContext*>(value); @@ -1241,6 +1277,7 @@ Api::_internal_mutable_mixins() { inline void Api::clear_syntax() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.syntax_ = 0; + _impl_._has_bits_[0] &= ~0x00000008u; } inline ::google::protobuf::Syntax Api::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Api.syntax) @@ -1248,6 +1285,7 @@ inline ::google::protobuf::Syntax Api::syntax() const { } inline void Api::set_syntax(::google::protobuf::Syntax value) { _internal_set_syntax(value); + _impl_._has_bits_[0] |= 0x00000008u; // @@protoc_insertion_point(field_set:google.protobuf.Api.syntax) } inline ::google::protobuf::Syntax Api::_internal_syntax() const { @@ -1267,6 +1305,7 @@ inline void Api::_internal_set_syntax(::google::protobuf::Syntax value) { inline void Method::clear_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& Method::name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -1277,6 +1316,7 @@ template inline PROTOBUF_ALWAYS_INLINE void Method::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Method.name) } @@ -1291,19 +1331,34 @@ inline const std::string& Method::_internal_name() const { } inline void Method::_internal_set_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } inline std::string* Method::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } inline std::string* Method::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Method.name) - return _impl_.name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.name_.Set("", GetArena()); + } + return released; } inline void Method::set_allocated_name(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.name_.IsDefault()) { _impl_.name_.Set("", GetArena()); @@ -1315,6 +1370,7 @@ inline void Method::set_allocated_name(std::string* value) { inline void Method::clear_request_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.request_type_url_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000002u; } inline const std::string& Method::request_type_url() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -1325,6 +1381,7 @@ template inline PROTOBUF_ALWAYS_INLINE void Method::set_request_type_url(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.request_type_url_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Method.request_type_url) } @@ -1339,19 +1396,34 @@ inline const std::string& Method::_internal_request_type_url() const { } inline void Method::_internal_set_request_type_url(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.request_type_url_.Set(value, GetArena()); } inline std::string* Method::_internal_mutable_request_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; return _impl_.request_type_url_.Mutable( GetArena()); } inline std::string* Method::release_request_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Method.request_type_url) - return _impl_.request_type_url_.Release(); + if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000002u; + auto* released = _impl_.request_type_url_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.request_type_url_.Set("", GetArena()); + } + return released; } inline void Method::set_allocated_request_type_url(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } _impl_.request_type_url_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.request_type_url_.IsDefault()) { _impl_.request_type_url_.Set("", GetArena()); @@ -1363,6 +1435,7 @@ inline void Method::set_allocated_request_type_url(std::string* value) { inline void Method::clear_request_streaming() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.request_streaming_ = false; + _impl_._has_bits_[0] &= ~0x00000008u; } inline bool Method::request_streaming() const { // @@protoc_insertion_point(field_get:google.protobuf.Method.request_streaming) @@ -1370,6 +1443,7 @@ inline bool Method::request_streaming() const { } inline void Method::set_request_streaming(bool value) { _internal_set_request_streaming(value); + _impl_._has_bits_[0] |= 0x00000008u; // @@protoc_insertion_point(field_set:google.protobuf.Method.request_streaming) } inline bool Method::_internal_request_streaming() const { @@ -1385,6 +1459,7 @@ inline void Method::_internal_set_request_streaming(bool value) { inline void Method::clear_response_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.response_type_url_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000004u; } inline const std::string& Method::response_type_url() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -1395,6 +1470,7 @@ template inline PROTOBUF_ALWAYS_INLINE void Method::set_response_type_url(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000004u; _impl_.response_type_url_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Method.response_type_url) } @@ -1409,19 +1485,34 @@ inline const std::string& Method::_internal_response_type_url() const { } inline void Method::_internal_set_response_type_url(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000004u; _impl_.response_type_url_.Set(value, GetArena()); } inline std::string* Method::_internal_mutable_response_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000004u; return _impl_.response_type_url_.Mutable( GetArena()); } inline std::string* Method::release_response_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Method.response_type_url) - return _impl_.response_type_url_.Release(); + if ((_impl_._has_bits_[0] & 0x00000004u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000004u; + auto* released = _impl_.response_type_url_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.response_type_url_.Set("", GetArena()); + } + return released; } inline void Method::set_allocated_response_type_url(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000004u; + } else { + _impl_._has_bits_[0] &= ~0x00000004u; + } _impl_.response_type_url_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.response_type_url_.IsDefault()) { _impl_.response_type_url_.Set("", GetArena()); @@ -1433,6 +1524,7 @@ inline void Method::set_allocated_response_type_url(std::string* value) { inline void Method::clear_response_streaming() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.response_streaming_ = false; + _impl_._has_bits_[0] &= ~0x00000010u; } inline bool Method::response_streaming() const { // @@protoc_insertion_point(field_get:google.protobuf.Method.response_streaming) @@ -1440,6 +1532,7 @@ inline bool Method::response_streaming() const { } inline void Method::set_response_streaming(bool value) { _internal_set_response_streaming(value); + _impl_._has_bits_[0] |= 0x00000010u; // @@protoc_insertion_point(field_set:google.protobuf.Method.response_streaming) } inline bool Method::_internal_response_streaming() const { @@ -1500,6 +1593,7 @@ Method::_internal_mutable_options() { inline void Method::clear_syntax() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.syntax_ = 0; + _impl_._has_bits_[0] &= ~0x00000020u; } inline ::google::protobuf::Syntax Method::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Method.syntax) @@ -1507,6 +1601,7 @@ inline ::google::protobuf::Syntax Method::syntax() const { } inline void Method::set_syntax(::google::protobuf::Syntax value) { _internal_set_syntax(value); + _impl_._has_bits_[0] |= 0x00000020u; // @@protoc_insertion_point(field_set:google.protobuf.Method.syntax) } inline ::google::protobuf::Syntax Method::_internal_syntax() const { @@ -1526,6 +1621,7 @@ inline void Method::_internal_set_syntax(::google::protobuf::Syntax value) { inline void Mixin::clear_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& Mixin::name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -1536,6 +1632,7 @@ template inline PROTOBUF_ALWAYS_INLINE void Mixin::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Mixin.name) } @@ -1550,19 +1647,34 @@ inline const std::string& Mixin::_internal_name() const { } inline void Mixin::_internal_set_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } inline std::string* Mixin::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } inline std::string* Mixin::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Mixin.name) - return _impl_.name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.name_.Set("", GetArena()); + } + return released; } inline void Mixin::set_allocated_name(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.name_.IsDefault()) { _impl_.name_.Set("", GetArena()); @@ -1574,6 +1686,7 @@ inline void Mixin::set_allocated_name(std::string* value) { inline void Mixin::clear_root() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.root_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000002u; } inline const std::string& Mixin::root() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -1584,6 +1697,7 @@ template inline PROTOBUF_ALWAYS_INLINE void Mixin::set_root(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.root_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Mixin.root) } @@ -1598,19 +1712,34 @@ inline const std::string& Mixin::_internal_root() const { } inline void Mixin::_internal_set_root(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.root_.Set(value, GetArena()); } inline std::string* Mixin::_internal_mutable_root() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; return _impl_.root_.Mutable( GetArena()); } inline std::string* Mixin::release_root() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Mixin.root) - return _impl_.root_.Release(); + if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000002u; + auto* released = _impl_.root_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.root_.Set("", GetArena()); + } + return released; } inline void Mixin::set_allocated_root(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } _impl_.root_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.root_.IsDefault()) { _impl_.root_.Set("", GetArena()); diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc index e520d5e4a4..fae2cec226 100644 --- a/src/google/protobuf/duration.pb.cc +++ b/src/google/protobuf/duration.pb.cc @@ -29,9 +29,9 @@ namespace protobuf { inline constexpr Duration::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : seconds_{::int64_t{0}}, - nanos_{0}, - _cached_size_{0} {} + : _cached_size_{0}, + seconds_{::int64_t{0}}, + nanos_{0} {} template PROTOBUF_CONSTEXPR Duration::Duration(::_pbi::ConstantInitialized) @@ -61,7 +61,7 @@ static constexpr const ::_pb::ServiceDescriptor** const ::uint32_t TableStruct_google_2fprotobuf_2fduration_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( protodesc_cold) = { - ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::google::protobuf::Duration, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Duration, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -71,11 +71,13 @@ const ::uint32_t ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::Duration, _impl_.seconds_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Duration, _impl_.nanos_), + 0, + 1, }; static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, -1, -1, sizeof(::google::protobuf::Duration)}, + {0, 10, -1, sizeof(::google::protobuf::Duration)}, }; static const ::_pb::Message* const file_default_instances[] = { &::google::protobuf::_Duration_default_instance_._instance, @@ -112,6 +114,10 @@ namespace protobuf { class Duration::_Internal { public: + using HasBits = + decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Duration, _impl_._has_bits_); }; Duration::Duration(::google::protobuf::Arena* arena) @@ -203,7 +209,7 @@ const ::google::protobuf::internal::ClassData* Duration::GetClassData() const { PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::_pbi::TcParseTable<1, 2, 0, 0, 2> Duration::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(Duration, _impl_._has_bits_), 0, // no _extensions_ 2, 8, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -220,20 +226,20 @@ const ::_pbi::TcParseTable<1, 2, 0, 0, 2> Duration::_table_ = { #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // int32 nanos = 2; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Duration, _impl_.nanos_), 63>(), - {16, 63, 0, PROTOBUF_FIELD_OFFSET(Duration, _impl_.nanos_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Duration, _impl_.nanos_), 1>(), + {16, 1, 0, PROTOBUF_FIELD_OFFSET(Duration, _impl_.nanos_)}}, // int64 seconds = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(Duration, _impl_.seconds_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(Duration, _impl_.seconds_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(Duration, _impl_.seconds_), 0>(), + {8, 0, 0, PROTOBUF_FIELD_OFFSET(Duration, _impl_.seconds_)}}, }}, {{ 65535, 65535 }}, {{ // int64 seconds = 1; - {PROTOBUF_FIELD_OFFSET(Duration, _impl_.seconds_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt64)}, + {PROTOBUF_FIELD_OFFSET(Duration, _impl_.seconds_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt64)}, // int32 nanos = 2; - {PROTOBUF_FIELD_OFFSET(Duration, _impl_.nanos_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + {PROTOBUF_FIELD_OFFSET(Duration, _impl_.nanos_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, }}, // no aux_entries {{ @@ -247,9 +253,13 @@ PROTOBUF_NOINLINE void Duration::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - ::memset(&_impl_.seconds_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.nanos_) - - reinterpret_cast(&_impl_.seconds_)) + sizeof(_impl_.nanos_)); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + ::memset(&_impl_.seconds_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.nanos_) - + reinterpret_cast(&_impl_.seconds_)) + sizeof(_impl_.nanos_)); + } + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -269,17 +279,21 @@ PROTOBUF_NOINLINE void Duration::Clear() { (void)cached_has_bits; // int64 seconds = 1; - if (this_._internal_seconds() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt64ToArrayWithField<1>( - stream, this_._internal_seconds(), target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (this_._internal_seconds() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt64ToArrayWithField<1>( + stream, this_._internal_seconds(), target); + } } // int32 nanos = 2; - if (this_._internal_nanos() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<2>( - stream, this_._internal_nanos(), target); + if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { + if (this_._internal_nanos() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<2>( + stream, this_._internal_nanos(), target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -306,16 +320,21 @@ PROTOBUF_NOINLINE void Duration::Clear() { (void)cached_has_bits; ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { // int64 seconds = 1; - if (this_._internal_seconds() != 0) { - total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( - this_._internal_seconds()); + if (cached_has_bits & 0x00000001u) { + if (this_._internal_seconds() != 0) { + total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( + this_._internal_seconds()); + } } // int32 nanos = 2; - if (this_._internal_nanos() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_nanos()); + if (cached_has_bits & 0x00000002u) { + if (this_._internal_nanos() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_nanos()); + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -330,12 +349,20 @@ void Duration::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_seconds() != 0) { - _this->_impl_.seconds_ = from._impl_.seconds_; - } - if (from._internal_nanos() != 0) { - _this->_impl_.nanos_ = from._impl_.nanos_; + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + if (from._internal_seconds() != 0) { + _this->_impl_.seconds_ = from._impl_.seconds_; + } + } + if (cached_has_bits & 0x00000002u) { + if (from._internal_nanos() != 0) { + _this->_impl_.nanos_ = from._impl_.nanos_; + } + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -350,6 +377,7 @@ void Duration::CopyFrom(const Duration& from) { void Duration::InternalSwap(Duration* PROTOBUF_RESTRICT other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::google::protobuf::internal::memswap< PROTOBUF_FIELD_OFFSET(Duration, _impl_.nanos_) + sizeof(Duration::_impl_.nanos_) diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h index ba70b5da2a..371569a604 100644 --- a/src/google/protobuf/duration.pb.h +++ b/src/google/protobuf/duration.pb.h @@ -262,9 +262,10 @@ class PROTOBUF_EXPORT Duration final inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const Duration& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; + ::google::protobuf::internal::CachedSize _cached_size_; ::int64_t seconds_; ::int32_t nanos_; - ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -293,6 +294,7 @@ PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Duratio inline void Duration::clear_seconds() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.seconds_ = ::int64_t{0}; + _impl_._has_bits_[0] &= ~0x00000001u; } inline ::int64_t Duration::seconds() const { // @@protoc_insertion_point(field_get:google.protobuf.Duration.seconds) @@ -300,6 +302,7 @@ inline ::int64_t Duration::seconds() const { } inline void Duration::set_seconds(::int64_t value) { _internal_set_seconds(value); + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:google.protobuf.Duration.seconds) } inline ::int64_t Duration::_internal_seconds() const { @@ -315,6 +318,7 @@ inline void Duration::_internal_set_seconds(::int64_t value) { inline void Duration::clear_nanos() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.nanos_ = 0; + _impl_._has_bits_[0] &= ~0x00000002u; } inline ::int32_t Duration::nanos() const { // @@protoc_insertion_point(field_get:google.protobuf.Duration.nanos) @@ -322,6 +326,7 @@ inline ::int32_t Duration::nanos() const { } inline void Duration::set_nanos(::int32_t value) { _internal_set_nanos(value); + _impl_._has_bits_[0] |= 0x00000002u; // @@protoc_insertion_point(field_set:google.protobuf.Duration.nanos) } inline ::int32_t Duration::_internal_nanos() const { diff --git a/src/google/protobuf/source_context.pb.cc b/src/google/protobuf/source_context.pb.cc index dd4cd5c30d..4fe1961a37 100644 --- a/src/google/protobuf/source_context.pb.cc +++ b/src/google/protobuf/source_context.pb.cc @@ -29,10 +29,10 @@ namespace protobuf { inline constexpr SourceContext::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : file_name_( + : _cached_size_{0}, + file_name_( &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - _cached_size_{0} {} + ::_pbi::ConstantInitialized()) {} template PROTOBUF_CONSTEXPR SourceContext::SourceContext(::_pbi::ConstantInitialized) @@ -62,7 +62,7 @@ static constexpr const ::_pb::ServiceDescriptor** const ::uint32_t TableStruct_google_2fprotobuf_2fsource_5fcontext_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( protodesc_cold) = { - ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::google::protobuf::SourceContext, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::SourceContext, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -71,11 +71,12 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::SourceContext, _impl_.file_name_), + 0, }; static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, -1, -1, sizeof(::google::protobuf::SourceContext)}, + {0, 9, -1, sizeof(::google::protobuf::SourceContext)}, }; static const ::_pb::Message* const file_default_instances[] = { &::google::protobuf::_SourceContext_default_instance_._instance, @@ -112,6 +113,10 @@ namespace protobuf { class SourceContext::_Internal { public: + using HasBits = + decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(SourceContext, _impl_._has_bits_); }; SourceContext::SourceContext(::google::protobuf::Arena* arena) @@ -126,8 +131,9 @@ SourceContext::SourceContext(::google::protobuf::Arena* arena) inline PROTOBUF_NDEBUG_INLINE SourceContext::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const ::google::protobuf::SourceContext& from_msg) - : file_name_(arena, from.file_name_), - _cached_size_{0} {} + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + file_name_(arena, from.file_name_) {} SourceContext::SourceContext( ::google::protobuf::Arena* arena, @@ -148,8 +154,8 @@ SourceContext::SourceContext( inline PROTOBUF_NDEBUG_INLINE SourceContext::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : file_name_(arena), - _cached_size_{0} {} + : _cached_size_{0}, + file_name_(arena) {} inline void SourceContext::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -210,7 +216,7 @@ const ::google::protobuf::internal::ClassData* SourceContext::GetClassData() con PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::_pbi::TcParseTable<0, 1, 0, 47, 2> SourceContext::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(SourceContext, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -228,13 +234,13 @@ const ::_pbi::TcParseTable<0, 1, 0, 47, 2> SourceContext::_table_ = { }, {{ // string file_name = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(SourceContext, _impl_.file_name_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(SourceContext, _impl_.file_name_)}}, }}, {{ 65535, 65535 }}, {{ // string file_name = 1; - {PROTOBUF_FIELD_OFFSET(SourceContext, _impl_.file_name_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(SourceContext, _impl_.file_name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, }}, // no aux_entries {{ @@ -251,7 +257,11 @@ PROTOBUF_NOINLINE void SourceContext::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.file_name_.ClearToEmpty(); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + _impl_.file_name_.ClearToEmpty(); + } + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -271,11 +281,13 @@ PROTOBUF_NOINLINE void SourceContext::Clear() { (void)cached_has_bits; // string file_name = 1; - if (!this_._internal_file_name().empty()) { - const std::string& _s = this_._internal_file_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.SourceContext.file_name"); - target = stream->WriteStringMaybeAliased(1, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_file_name().empty()) { + const std::string& _s = this_._internal_file_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.SourceContext.file_name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -303,9 +315,12 @@ PROTOBUF_NOINLINE void SourceContext::Clear() { { // string file_name = 1; - if (!this_._internal_file_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_file_name()); + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (!this_._internal_file_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_file_name()); + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -320,9 +335,13 @@ void SourceContext::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::g ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (!from._internal_file_name().empty()) { - _this->_internal_set_file_name(from._internal_file_name()); + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (!from._internal_file_name().empty()) { + _this->_internal_set_file_name(from._internal_file_name()); + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -339,6 +358,7 @@ void SourceContext::InternalSwap(SourceContext* PROTOBUF_RESTRICT other) { auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.file_name_, &other->_impl_.file_name_, arena); } diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h index 299d71ff11..73db1869b3 100644 --- a/src/google/protobuf/source_context.pb.h +++ b/src/google/protobuf/source_context.pb.h @@ -257,8 +257,9 @@ class PROTOBUF_EXPORT SourceContext final inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const SourceContext& from_msg); - ::google::protobuf::internal::ArenaStringPtr file_name_; + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + ::google::protobuf::internal::ArenaStringPtr file_name_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -287,6 +288,7 @@ PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull SourceC inline void SourceContext::clear_file_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.file_name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& SourceContext::file_name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -297,6 +299,7 @@ template inline PROTOBUF_ALWAYS_INLINE void SourceContext::set_file_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.file_name_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.SourceContext.file_name) } @@ -311,19 +314,34 @@ inline const std::string& SourceContext::_internal_file_name() const { } inline void SourceContext::_internal_set_file_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.file_name_.Set(value, GetArena()); } inline std::string* SourceContext::_internal_mutable_file_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.file_name_.Mutable( GetArena()); } inline std::string* SourceContext::release_file_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.SourceContext.file_name) - return _impl_.file_name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.file_name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.file_name_.Set("", GetArena()); + } + return released; } inline void SourceContext::set_allocated_file_name(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.file_name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.file_name_.IsDefault()) { _impl_.file_name_.Set("", GetArena()); diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc index b08a2dc4c6..f1b60d43e8 100644 --- a/src/google/protobuf/struct.pb.cc +++ b/src/google/protobuf/struct.pb.cc @@ -310,18 +310,18 @@ const ::_pbi::TcParseTable<1, 2, 1, 46, 2> Struct_FieldsEntry_DoNotUse::_table_ }, {{ // .google.protobuf.Value value = 2; {::_pbi::TcParser::FastMtS1, - {18, 0, 0, PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_.value_)}}, + {18, 1, 0, PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_.value_)}}, // string key = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_.key_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_.key_)}}, }}, {{ 65535, 65535 }}, {{ // string key = 1; - {PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_.key_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_.key_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // .google.protobuf.Value value = 2; - {PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + {PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_.value_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, }}, {{ {::_pbi::TcParser::GetTable<::google::protobuf::Value>()}, diff --git a/src/google/protobuf/timestamp.pb.cc b/src/google/protobuf/timestamp.pb.cc index 6c3f0c104e..f054271d4b 100644 --- a/src/google/protobuf/timestamp.pb.cc +++ b/src/google/protobuf/timestamp.pb.cc @@ -29,9 +29,9 @@ namespace protobuf { inline constexpr Timestamp::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : seconds_{::int64_t{0}}, - nanos_{0}, - _cached_size_{0} {} + : _cached_size_{0}, + seconds_{::int64_t{0}}, + nanos_{0} {} template PROTOBUF_CONSTEXPR Timestamp::Timestamp(::_pbi::ConstantInitialized) @@ -61,7 +61,7 @@ static constexpr const ::_pb::ServiceDescriptor** const ::uint32_t TableStruct_google_2fprotobuf_2ftimestamp_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( protodesc_cold) = { - ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::google::protobuf::Timestamp, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Timestamp, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -71,11 +71,13 @@ const ::uint32_t ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::Timestamp, _impl_.seconds_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Timestamp, _impl_.nanos_), + 0, + 1, }; static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, -1, -1, sizeof(::google::protobuf::Timestamp)}, + {0, 10, -1, sizeof(::google::protobuf::Timestamp)}, }; static const ::_pb::Message* const file_default_instances[] = { &::google::protobuf::_Timestamp_default_instance_._instance, @@ -112,6 +114,10 @@ namespace protobuf { class Timestamp::_Internal { public: + using HasBits = + decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Timestamp, _impl_._has_bits_); }; Timestamp::Timestamp(::google::protobuf::Arena* arena) @@ -203,7 +209,7 @@ const ::google::protobuf::internal::ClassData* Timestamp::GetClassData() const { PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::_pbi::TcParseTable<1, 2, 0, 0, 2> Timestamp::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(Timestamp, _impl_._has_bits_), 0, // no _extensions_ 2, 8, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -220,20 +226,20 @@ const ::_pbi::TcParseTable<1, 2, 0, 0, 2> Timestamp::_table_ = { #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // int32 nanos = 2; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Timestamp, _impl_.nanos_), 63>(), - {16, 63, 0, PROTOBUF_FIELD_OFFSET(Timestamp, _impl_.nanos_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Timestamp, _impl_.nanos_), 1>(), + {16, 1, 0, PROTOBUF_FIELD_OFFSET(Timestamp, _impl_.nanos_)}}, // int64 seconds = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(Timestamp, _impl_.seconds_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(Timestamp, _impl_.seconds_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(Timestamp, _impl_.seconds_), 0>(), + {8, 0, 0, PROTOBUF_FIELD_OFFSET(Timestamp, _impl_.seconds_)}}, }}, {{ 65535, 65535 }}, {{ // int64 seconds = 1; - {PROTOBUF_FIELD_OFFSET(Timestamp, _impl_.seconds_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt64)}, + {PROTOBUF_FIELD_OFFSET(Timestamp, _impl_.seconds_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt64)}, // int32 nanos = 2; - {PROTOBUF_FIELD_OFFSET(Timestamp, _impl_.nanos_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + {PROTOBUF_FIELD_OFFSET(Timestamp, _impl_.nanos_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, }}, // no aux_entries {{ @@ -247,9 +253,13 @@ PROTOBUF_NOINLINE void Timestamp::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - ::memset(&_impl_.seconds_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.nanos_) - - reinterpret_cast(&_impl_.seconds_)) + sizeof(_impl_.nanos_)); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + ::memset(&_impl_.seconds_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.nanos_) - + reinterpret_cast(&_impl_.seconds_)) + sizeof(_impl_.nanos_)); + } + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -269,17 +279,21 @@ PROTOBUF_NOINLINE void Timestamp::Clear() { (void)cached_has_bits; // int64 seconds = 1; - if (this_._internal_seconds() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt64ToArrayWithField<1>( - stream, this_._internal_seconds(), target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (this_._internal_seconds() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt64ToArrayWithField<1>( + stream, this_._internal_seconds(), target); + } } // int32 nanos = 2; - if (this_._internal_nanos() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<2>( - stream, this_._internal_nanos(), target); + if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { + if (this_._internal_nanos() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<2>( + stream, this_._internal_nanos(), target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -306,16 +320,21 @@ PROTOBUF_NOINLINE void Timestamp::Clear() { (void)cached_has_bits; ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { // int64 seconds = 1; - if (this_._internal_seconds() != 0) { - total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( - this_._internal_seconds()); + if (cached_has_bits & 0x00000001u) { + if (this_._internal_seconds() != 0) { + total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( + this_._internal_seconds()); + } } // int32 nanos = 2; - if (this_._internal_nanos() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_nanos()); + if (cached_has_bits & 0x00000002u) { + if (this_._internal_nanos() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_nanos()); + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -330,12 +349,20 @@ void Timestamp::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::googl ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_seconds() != 0) { - _this->_impl_.seconds_ = from._impl_.seconds_; - } - if (from._internal_nanos() != 0) { - _this->_impl_.nanos_ = from._impl_.nanos_; + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + if (from._internal_seconds() != 0) { + _this->_impl_.seconds_ = from._impl_.seconds_; + } + } + if (cached_has_bits & 0x00000002u) { + if (from._internal_nanos() != 0) { + _this->_impl_.nanos_ = from._impl_.nanos_; + } + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -350,6 +377,7 @@ void Timestamp::CopyFrom(const Timestamp& from) { void Timestamp::InternalSwap(Timestamp* PROTOBUF_RESTRICT other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::google::protobuf::internal::memswap< PROTOBUF_FIELD_OFFSET(Timestamp, _impl_.nanos_) + sizeof(Timestamp::_impl_.nanos_) diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h index 7841a663c9..31b18f470c 100644 --- a/src/google/protobuf/timestamp.pb.h +++ b/src/google/protobuf/timestamp.pb.h @@ -262,9 +262,10 @@ class PROTOBUF_EXPORT Timestamp final inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const Timestamp& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; + ::google::protobuf::internal::CachedSize _cached_size_; ::int64_t seconds_; ::int32_t nanos_; - ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -293,6 +294,7 @@ PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Timesta inline void Timestamp::clear_seconds() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.seconds_ = ::int64_t{0}; + _impl_._has_bits_[0] &= ~0x00000001u; } inline ::int64_t Timestamp::seconds() const { // @@protoc_insertion_point(field_get:google.protobuf.Timestamp.seconds) @@ -300,6 +302,7 @@ inline ::int64_t Timestamp::seconds() const { } inline void Timestamp::set_seconds(::int64_t value) { _internal_set_seconds(value); + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:google.protobuf.Timestamp.seconds) } inline ::int64_t Timestamp::_internal_seconds() const { @@ -315,6 +318,7 @@ inline void Timestamp::_internal_set_seconds(::int64_t value) { inline void Timestamp::clear_nanos() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.nanos_ = 0; + _impl_._has_bits_[0] &= ~0x00000002u; } inline ::int32_t Timestamp::nanos() const { // @@protoc_insertion_point(field_get:google.protobuf.Timestamp.nanos) @@ -322,6 +326,7 @@ inline ::int32_t Timestamp::nanos() const { } inline void Timestamp::set_nanos(::int32_t value) { _internal_set_nanos(value); + _impl_._has_bits_[0] |= 0x00000002u; // @@protoc_insertion_point(field_set:google.protobuf.Timestamp.nanos) } inline ::int32_t Timestamp::_internal_nanos() const { diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index f554b50827..cd1c7c1993 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -57,7 +57,8 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr Field::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : options_{}, + : _cached_size_{0}, + options_{}, name_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), @@ -74,8 +75,7 @@ inline constexpr Field::Impl_::Impl_( cardinality_{static_cast< ::google::protobuf::Field_Cardinality >(0)}, number_{0}, oneof_index_{0}, - packed_{false}, - _cached_size_{0} {} + packed_{false} {} template PROTOBUF_CONSTEXPR Field::Field(::_pbi::ConstantInitialized) @@ -99,12 +99,12 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr EnumValue::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : options_{}, + : _cached_size_{0}, + options_{}, name_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), - number_{0}, - _cached_size_{0} {} + number_{0} {} template PROTOBUF_CONSTEXPR EnumValue::EnumValue(::_pbi::ConstantInitialized) @@ -217,14 +217,14 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::google::protobuf::Type, _impl_.source_context_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Type, _impl_.syntax_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Type, _impl_.edition_), - ~0u, - ~0u, - ~0u, - ~0u, 0, ~0u, ~0u, - ~0u, // no _has_bits_ + ~0u, + 2, + 3, + 1, + PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -242,6 +242,16 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, _impl_.options_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, _impl_.json_name_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, _impl_.default_value_), + 4, + 5, + 6, + 0, + 1, + 7, + 8, + ~0u, + 2, + 3, PROTOBUF_FIELD_OFFSET(::google::protobuf::Enum, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Enum, _internal_metadata_), ~0u, // no _extensions_ @@ -256,13 +266,13 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::google::protobuf::Enum, _impl_.source_context_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Enum, _impl_.syntax_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Enum, _impl_.edition_), - ~0u, - ~0u, - ~0u, 0, ~0u, ~0u, - ~0u, // no _has_bits_ + 2, + 3, + 1, + PROTOBUF_FIELD_OFFSET(::google::protobuf::EnumValue, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::EnumValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -273,6 +283,9 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::google::protobuf::EnumValue, _impl_.name_), PROTOBUF_FIELD_OFFSET(::google::protobuf::EnumValue, _impl_.number_), PROTOBUF_FIELD_OFFSET(::google::protobuf::EnumValue, _impl_.options_), + 0, + 1, + ~0u, PROTOBUF_FIELD_OFFSET(::google::protobuf::Option, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Option, _internal_metadata_), ~0u, // no _extensions_ @@ -283,17 +296,17 @@ const ::uint32_t ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::Option, _impl_.name_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Option, _impl_.value_), - ~0u, 0, + 1, }; static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { {0, 15, -1, sizeof(::google::protobuf::Type)}, - {22, -1, -1, sizeof(::google::protobuf::Field)}, - {40, 54, -1, sizeof(::google::protobuf::Enum)}, - {60, -1, -1, sizeof(::google::protobuf::EnumValue)}, - {71, 81, -1, sizeof(::google::protobuf::Option)}, + {22, 40, -1, sizeof(::google::protobuf::Field)}, + {50, 64, -1, sizeof(::google::protobuf::Enum)}, + {70, 81, -1, sizeof(::google::protobuf::EnumValue)}, + {84, 94, -1, sizeof(::google::protobuf::Option)}, }; static const ::_pb::Message* const file_default_instances[] = { &::google::protobuf::_Type_default_instance_._instance, @@ -411,7 +424,7 @@ class Type::_Internal { void Type::clear_source_context() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.source_context_ != nullptr) _impl_.source_context_->Clear(); - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; } Type::Type(::google::protobuf::Arena* arena) #if defined(PROTOBUF_CUSTOM_VTABLE) @@ -447,7 +460,7 @@ Type::Type( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.source_context_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceContext>( + _impl_.source_context_ = (cached_has_bits & 0x00000004u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceContext>( arena, *from._impl_.source_context_) : nullptr; _impl_.syntax_ = from._impl_.syntax_; @@ -570,7 +583,7 @@ const ::_pbi::TcParseTable<3, 7, 3, 46, 2> Type::_table_ = { {::_pbi::TcParser::MiniParse, {}}, // string name = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(Type, _impl_.name_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(Type, _impl_.name_)}}, // repeated .google.protobuf.Field fields = 2; {::_pbi::TcParser::FastMtR1, {18, 63, 0, PROTOBUF_FIELD_OFFSET(Type, _impl_.fields_)}}, @@ -582,19 +595,19 @@ const ::_pbi::TcParseTable<3, 7, 3, 46, 2> Type::_table_ = { {34, 63, 1, PROTOBUF_FIELD_OFFSET(Type, _impl_.options_)}}, // .google.protobuf.SourceContext source_context = 5; {::_pbi::TcParser::FastMtS1, - {42, 0, 2, PROTOBUF_FIELD_OFFSET(Type, _impl_.source_context_)}}, + {42, 2, 2, PROTOBUF_FIELD_OFFSET(Type, _impl_.source_context_)}}, // .google.protobuf.Syntax syntax = 6; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Type, _impl_.syntax_), 63>(), - {48, 63, 0, PROTOBUF_FIELD_OFFSET(Type, _impl_.syntax_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Type, _impl_.syntax_), 3>(), + {48, 3, 0, PROTOBUF_FIELD_OFFSET(Type, _impl_.syntax_)}}, // string edition = 7; {::_pbi::TcParser::FastUS1, - {58, 63, 0, PROTOBUF_FIELD_OFFSET(Type, _impl_.edition_)}}, + {58, 1, 0, PROTOBUF_FIELD_OFFSET(Type, _impl_.edition_)}}, }}, {{ 65535, 65535 }}, {{ // string name = 1; - {PROTOBUF_FIELD_OFFSET(Type, _impl_.name_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Type, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // repeated .google.protobuf.Field fields = 2; {PROTOBUF_FIELD_OFFSET(Type, _impl_.fields_), -1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, @@ -605,14 +618,14 @@ const ::_pbi::TcParseTable<3, 7, 3, 46, 2> Type::_table_ = { {PROTOBUF_FIELD_OFFSET(Type, _impl_.options_), -1, 1, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, // .google.protobuf.SourceContext source_context = 5; - {PROTOBUF_FIELD_OFFSET(Type, _impl_.source_context_), _Internal::kHasBitsOffset + 0, 2, + {PROTOBUF_FIELD_OFFSET(Type, _impl_.source_context_), _Internal::kHasBitsOffset + 2, 2, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, // .google.protobuf.Syntax syntax = 6; - {PROTOBUF_FIELD_OFFSET(Type, _impl_.syntax_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + {PROTOBUF_FIELD_OFFSET(Type, _impl_.syntax_), _Internal::kHasBitsOffset + 3, 0, + (0 | ::_fl::kFcOptional | ::_fl::kOpenEnum)}, // string edition = 7; - {PROTOBUF_FIELD_OFFSET(Type, _impl_.edition_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Type, _impl_.edition_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, }}, {{ {::_pbi::TcParser::GetTable<::google::protobuf::Field>()}, {::_pbi::TcParser::GetTable<::google::protobuf::Option>()}, @@ -636,12 +649,18 @@ PROTOBUF_NOINLINE void Type::Clear() { _impl_.fields_.Clear(); _impl_.oneofs_.Clear(); _impl_.options_.Clear(); - _impl_.name_.ClearToEmpty(); - _impl_.edition_.ClearToEmpty(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - ABSL_DCHECK(_impl_.source_context_ != nullptr); - _impl_.source_context_->Clear(); + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + _impl_.name_.ClearToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + _impl_.edition_.ClearToEmpty(); + } + if (cached_has_bits & 0x00000004u) { + ABSL_DCHECK(_impl_.source_context_ != nullptr); + _impl_.source_context_->Clear(); + } } _impl_.syntax_ = 0; _impl_._has_bits_.Clear(); @@ -664,11 +683,13 @@ PROTOBUF_NOINLINE void Type::Clear() { (void)cached_has_bits; // string name = 1; - if (!this_._internal_name().empty()) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Type.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Type.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } } // repeated .google.protobuf.Field fields = 2; @@ -703,25 +724,29 @@ PROTOBUF_NOINLINE void Type::Clear() { cached_has_bits = this_._impl_._has_bits_[0]; // .google.protobuf.SourceContext source_context = 5; - if (cached_has_bits & 0x00000001u) { + if (cached_has_bits & 0x00000004u) { target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( 5, *this_._impl_.source_context_, this_._impl_.source_context_->GetCachedSize(), target, stream); } // .google.protobuf.Syntax syntax = 6; - if (this_._internal_syntax() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 6, this_._internal_syntax(), target); + if (cached_has_bits & 0x00000008u) { + if (this_._internal_syntax() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 6, this_._internal_syntax(), target); + } } // string edition = 7; - if (!this_._internal_edition().empty()) { - const std::string& _s = this_._internal_edition(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Type.edition"); - target = stream->WriteStringMaybeAliased(7, _s, target); + if (cached_has_bits & 0x00000002u) { + if (!this_._internal_edition().empty()) { + const std::string& _s = this_._internal_edition(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Type.edition"); + target = stream->WriteStringMaybeAliased(7, _s, target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -773,31 +798,33 @@ PROTOBUF_NOINLINE void Type::Clear() { } } } - { + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { // string name = 1; - if (!this_._internal_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); + if (cached_has_bits & 0x00000001u) { + if (!this_._internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } } // string edition = 7; - if (!this_._internal_edition().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_edition()); + if (cached_has_bits & 0x00000002u) { + if (!this_._internal_edition().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_edition()); + } } - } - { // .google.protobuf.SourceContext source_context = 5; - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { + if (cached_has_bits & 0x00000004u) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.source_context_); } - } - { // .google.protobuf.Syntax syntax = 6; - if (this_._internal_syntax() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_syntax()); + if (cached_has_bits & 0x00000008u) { + if (this_._internal_syntax() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_syntax()); + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -818,24 +845,32 @@ void Type::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::pr _this->_internal_mutable_oneofs()->MergeFrom(from._internal_oneofs()); _this->_internal_mutable_options()->MergeFrom( from._internal_options()); - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } - if (!from._internal_edition().empty()) { - _this->_internal_set_edition(from._internal_edition()); - } cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - ABSL_DCHECK(from._impl_.source_context_ != nullptr); - if (_this->_impl_.source_context_ == nullptr) { - _this->_impl_.source_context_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceContext>(arena, *from._impl_.source_context_); - } else { - _this->_impl_.source_context_->MergeFrom(*from._impl_.source_context_); + if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000001u) { + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } + } + if (cached_has_bits & 0x00000002u) { + if (!from._internal_edition().empty()) { + _this->_internal_set_edition(from._internal_edition()); + } + } + if (cached_has_bits & 0x00000004u) { + ABSL_DCHECK(from._impl_.source_context_ != nullptr); + if (_this->_impl_.source_context_ == nullptr) { + _this->_impl_.source_context_ = + ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceContext>(arena, *from._impl_.source_context_); + } else { + _this->_impl_.source_context_->MergeFrom(*from._impl_.source_context_); + } + } + if (cached_has_bits & 0x00000008u) { + if (from._internal_syntax() != 0) { + _this->_impl_.syntax_ = from._impl_.syntax_; + } } - } - if (from._internal_syntax() != 0) { - _this->_impl_.syntax_ = from._impl_.syntax_; } _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); @@ -875,6 +910,10 @@ void Type::InternalSwap(Type* PROTOBUF_RESTRICT other) { class Field::_Internal { public: + using HasBits = + decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Field, _impl_._has_bits_); }; Field::Field(::google::protobuf::Arena* arena) @@ -889,12 +928,13 @@ Field::Field(::google::protobuf::Arena* arena) inline PROTOBUF_NDEBUG_INLINE Field::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const ::google::protobuf::Field& from_msg) - : options_{visibility, arena, from.options_}, + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + options_{visibility, arena, from.options_}, name_(arena, from.name_), type_url_(arena, from.type_url_), json_name_(arena, from.json_name_), - default_value_(arena, from.default_value_), - _cached_size_{0} {} + default_value_(arena, from.default_value_) {} Field::Field( ::google::protobuf::Arena* arena, @@ -922,12 +962,12 @@ Field::Field( inline PROTOBUF_NDEBUG_INLINE Field::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : options_{visibility, arena}, + : _cached_size_{0}, + options_{visibility, arena}, name_(arena), type_url_(arena), json_name_(arena), - default_value_(arena), - _cached_size_{0} {} + default_value_(arena) {} inline void Field::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -1009,7 +1049,7 @@ const ::google::protobuf::internal::ClassData* Field::GetClassData() const { PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::_pbi::TcParseTable<4, 10, 1, 72, 2> Field::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(Field, _impl_._has_bits_), 0, // no _extensions_ 11, 120, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -1027,36 +1067,36 @@ const ::_pbi::TcParseTable<4, 10, 1, 72, 2> Field::_table_ = { }, {{ {::_pbi::TcParser::MiniParse, {}}, // .google.protobuf.Field.Kind kind = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Field, _impl_.kind_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.kind_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Field, _impl_.kind_), 4>(), + {8, 4, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.kind_)}}, // .google.protobuf.Field.Cardinality cardinality = 2; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Field, _impl_.cardinality_), 63>(), - {16, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.cardinality_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Field, _impl_.cardinality_), 5>(), + {16, 5, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.cardinality_)}}, // int32 number = 3; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Field, _impl_.number_), 63>(), - {24, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.number_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Field, _impl_.number_), 6>(), + {24, 6, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.number_)}}, // string name = 4; {::_pbi::TcParser::FastUS1, - {34, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.name_)}}, + {34, 0, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.name_)}}, {::_pbi::TcParser::MiniParse, {}}, // string type_url = 6; {::_pbi::TcParser::FastUS1, - {50, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.type_url_)}}, + {50, 1, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.type_url_)}}, // int32 oneof_index = 7; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Field, _impl_.oneof_index_), 63>(), - {56, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.oneof_index_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Field, _impl_.oneof_index_), 7>(), + {56, 7, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.oneof_index_)}}, // bool packed = 8; - {::_pbi::TcParser::SingularVarintNoZag1(), - {64, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.packed_)}}, + {::_pbi::TcParser::SingularVarintNoZag1(), + {64, 8, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.packed_)}}, // repeated .google.protobuf.Option options = 9; {::_pbi::TcParser::FastMtR1, {74, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.options_)}}, // string json_name = 10; {::_pbi::TcParser::FastUS1, - {82, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.json_name_)}}, + {82, 2, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.json_name_)}}, // string default_value = 11; {::_pbi::TcParser::FastUS1, - {90, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.default_value_)}}, + {90, 3, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.default_value_)}}, {::_pbi::TcParser::MiniParse, {}}, {::_pbi::TcParser::MiniParse, {}}, {::_pbi::TcParser::MiniParse, {}}, @@ -1065,35 +1105,35 @@ const ::_pbi::TcParseTable<4, 10, 1, 72, 2> Field::_table_ = { 65535, 65535 }}, {{ // .google.protobuf.Field.Kind kind = 1; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.kind_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.kind_), _Internal::kHasBitsOffset + 4, 0, + (0 | ::_fl::kFcOptional | ::_fl::kOpenEnum)}, // .google.protobuf.Field.Cardinality cardinality = 2; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.cardinality_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.cardinality_), _Internal::kHasBitsOffset + 5, 0, + (0 | ::_fl::kFcOptional | ::_fl::kOpenEnum)}, // int32 number = 3; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.number_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.number_), _Internal::kHasBitsOffset + 6, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, // string name = 4; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.name_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // string type_url = 6; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.type_url_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.type_url_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // int32 oneof_index = 7; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.oneof_index_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.oneof_index_), _Internal::kHasBitsOffset + 7, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, // bool packed = 8; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.packed_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.packed_), _Internal::kHasBitsOffset + 8, 0, + (0 | ::_fl::kFcOptional | ::_fl::kBool)}, // repeated .google.protobuf.Option options = 9; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.options_), 0, 0, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.options_), -1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, // string json_name = 10; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.json_name_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.json_name_), _Internal::kHasBitsOffset + 2, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // string default_value = 11; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.default_value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.default_value_), _Internal::kHasBitsOffset + 3, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, }}, {{ {::_pbi::TcParser::GetTable<::google::protobuf::Option>()}, }}, {{ @@ -1114,13 +1154,28 @@ PROTOBUF_NOINLINE void Field::Clear() { (void) cached_has_bits; _impl_.options_.Clear(); - _impl_.name_.ClearToEmpty(); - _impl_.type_url_.ClearToEmpty(); - _impl_.json_name_.ClearToEmpty(); - _impl_.default_value_.ClearToEmpty(); - ::memset(&_impl_.kind_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.packed_) - - reinterpret_cast(&_impl_.kind_)) + sizeof(_impl_.packed_)); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000001u) { + _impl_.name_.ClearToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + _impl_.type_url_.ClearToEmpty(); + } + if (cached_has_bits & 0x00000004u) { + _impl_.json_name_.ClearToEmpty(); + } + if (cached_has_bits & 0x00000008u) { + _impl_.default_value_.ClearToEmpty(); + } + } + if (cached_has_bits & 0x000000f0u) { + ::memset(&_impl_.kind_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.oneof_index_) - + reinterpret_cast(&_impl_.kind_)) + sizeof(_impl_.oneof_index_)); + } + _impl_.packed_ = false; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -1140,54 +1195,68 @@ PROTOBUF_NOINLINE void Field::Clear() { (void)cached_has_bits; // .google.protobuf.Field.Kind kind = 1; - if (this_._internal_kind() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 1, this_._internal_kind(), target); + if ((this_._impl_._has_bits_[0] & 0x00000010u) != 0) { + if (this_._internal_kind() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 1, this_._internal_kind(), target); + } } // .google.protobuf.Field.Cardinality cardinality = 2; - if (this_._internal_cardinality() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 2, this_._internal_cardinality(), target); + if ((this_._impl_._has_bits_[0] & 0x00000020u) != 0) { + if (this_._internal_cardinality() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 2, this_._internal_cardinality(), target); + } } // int32 number = 3; - if (this_._internal_number() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<3>( - stream, this_._internal_number(), target); + if ((this_._impl_._has_bits_[0] & 0x00000040u) != 0) { + if (this_._internal_number() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<3>( + stream, this_._internal_number(), target); + } } // string name = 4; - if (!this_._internal_name().empty()) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.name"); - target = stream->WriteStringMaybeAliased(4, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.name"); + target = stream->WriteStringMaybeAliased(4, _s, target); + } } // string type_url = 6; - if (!this_._internal_type_url().empty()) { - const std::string& _s = this_._internal_type_url(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.type_url"); - target = stream->WriteStringMaybeAliased(6, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { + if (!this_._internal_type_url().empty()) { + const std::string& _s = this_._internal_type_url(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.type_url"); + target = stream->WriteStringMaybeAliased(6, _s, target); + } } // int32 oneof_index = 7; - if (this_._internal_oneof_index() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<7>( - stream, this_._internal_oneof_index(), target); + if ((this_._impl_._has_bits_[0] & 0x00000080u) != 0) { + if (this_._internal_oneof_index() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<7>( + stream, this_._internal_oneof_index(), target); + } } // bool packed = 8; - if (this_._internal_packed() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 8, this_._internal_packed(), target); + if ((this_._impl_._has_bits_[0] & 0x00000100u) != 0) { + if (this_._internal_packed() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 8, this_._internal_packed(), target); + } } // repeated .google.protobuf.Option options = 9; @@ -1202,19 +1271,23 @@ PROTOBUF_NOINLINE void Field::Clear() { } // string json_name = 10; - if (!this_._internal_json_name().empty()) { - const std::string& _s = this_._internal_json_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.json_name"); - target = stream->WriteStringMaybeAliased(10, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000004u) != 0) { + if (!this_._internal_json_name().empty()) { + const std::string& _s = this_._internal_json_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.json_name"); + target = stream->WriteStringMaybeAliased(10, _s, target); + } } // string default_value = 11; - if (!this_._internal_default_value().empty()) { - const std::string& _s = this_._internal_default_value(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.default_value"); - target = stream->WriteStringMaybeAliased(11, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000008u) != 0) { + if (!this_._internal_default_value().empty()) { + const std::string& _s = this_._internal_default_value(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.default_value"); + target = stream->WriteStringMaybeAliased(11, _s, target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -1250,50 +1323,71 @@ PROTOBUF_NOINLINE void Field::Clear() { } } } - { + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x000000ffu) { // string name = 4; - if (!this_._internal_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); + if (cached_has_bits & 0x00000001u) { + if (!this_._internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } } // string type_url = 6; - if (!this_._internal_type_url().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_type_url()); + if (cached_has_bits & 0x00000002u) { + if (!this_._internal_type_url().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_type_url()); + } } // string json_name = 10; - if (!this_._internal_json_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_json_name()); + if (cached_has_bits & 0x00000004u) { + if (!this_._internal_json_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_json_name()); + } } // string default_value = 11; - if (!this_._internal_default_value().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_default_value()); + if (cached_has_bits & 0x00000008u) { + if (!this_._internal_default_value().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_default_value()); + } } // .google.protobuf.Field.Kind kind = 1; - if (this_._internal_kind() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_kind()); + if (cached_has_bits & 0x00000010u) { + if (this_._internal_kind() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_kind()); + } } // .google.protobuf.Field.Cardinality cardinality = 2; - if (this_._internal_cardinality() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_cardinality()); + if (cached_has_bits & 0x00000020u) { + if (this_._internal_cardinality() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_cardinality()); + } } // int32 number = 3; - if (this_._internal_number() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_number()); + if (cached_has_bits & 0x00000040u) { + if (this_._internal_number() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_number()); + } } // int32 oneof_index = 7; - if (this_._internal_oneof_index() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_oneof_index()); + if (cached_has_bits & 0x00000080u) { + if (this_._internal_oneof_index() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_oneof_index()); + } } + } + { // bool packed = 8; - if (this_._internal_packed() != 0) { - total_size += 2; + if (cached_has_bits & 0x00000100u) { + if (this_._internal_packed() != 0) { + total_size += 2; + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -1310,33 +1404,55 @@ void Field::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::p _this->_internal_mutable_options()->MergeFrom( from._internal_options()); - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } - if (!from._internal_type_url().empty()) { - _this->_internal_set_type_url(from._internal_type_url()); - } - if (!from._internal_json_name().empty()) { - _this->_internal_set_json_name(from._internal_json_name()); - } - if (!from._internal_default_value().empty()) { - _this->_internal_set_default_value(from._internal_default_value()); - } - if (from._internal_kind() != 0) { - _this->_impl_.kind_ = from._impl_.kind_; - } - if (from._internal_cardinality() != 0) { - _this->_impl_.cardinality_ = from._impl_.cardinality_; - } - if (from._internal_number() != 0) { - _this->_impl_.number_ = from._impl_.number_; - } - if (from._internal_oneof_index() != 0) { - _this->_impl_.oneof_index_ = from._impl_.oneof_index_; + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x000000ffu) { + if (cached_has_bits & 0x00000001u) { + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } + } + if (cached_has_bits & 0x00000002u) { + if (!from._internal_type_url().empty()) { + _this->_internal_set_type_url(from._internal_type_url()); + } + } + if (cached_has_bits & 0x00000004u) { + if (!from._internal_json_name().empty()) { + _this->_internal_set_json_name(from._internal_json_name()); + } + } + if (cached_has_bits & 0x00000008u) { + if (!from._internal_default_value().empty()) { + _this->_internal_set_default_value(from._internal_default_value()); + } + } + if (cached_has_bits & 0x00000010u) { + if (from._internal_kind() != 0) { + _this->_impl_.kind_ = from._impl_.kind_; + } + } + if (cached_has_bits & 0x00000020u) { + if (from._internal_cardinality() != 0) { + _this->_impl_.cardinality_ = from._impl_.cardinality_; + } + } + if (cached_has_bits & 0x00000040u) { + if (from._internal_number() != 0) { + _this->_impl_.number_ = from._impl_.number_; + } + } + if (cached_has_bits & 0x00000080u) { + if (from._internal_oneof_index() != 0) { + _this->_impl_.oneof_index_ = from._impl_.oneof_index_; + } + } } - if (from._internal_packed() != 0) { - _this->_impl_.packed_ = from._impl_.packed_; + if (cached_has_bits & 0x00000100u) { + if (from._internal_packed() != 0) { + _this->_impl_.packed_ = from._impl_.packed_; + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -1353,6 +1469,7 @@ void Field::InternalSwap(Field* PROTOBUF_RESTRICT other) { auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); _impl_.options_.InternalSwap(&other->_impl_.options_); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, &other->_impl_.name_, arena); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.type_url_, &other->_impl_.type_url_, arena); @@ -1382,7 +1499,7 @@ class Enum::_Internal { void Enum::clear_source_context() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.source_context_ != nullptr) _impl_.source_context_->Clear(); - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; } Enum::Enum(::google::protobuf::Arena* arena) #if defined(PROTOBUF_CUSTOM_VTABLE) @@ -1417,7 +1534,7 @@ Enum::Enum( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.source_context_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceContext>( + _impl_.source_context_ = (cached_has_bits & 0x00000004u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceContext>( arena, *from._impl_.source_context_) : nullptr; _impl_.syntax_ = from._impl_.syntax_; @@ -1535,7 +1652,7 @@ const ::_pbi::TcParseTable<3, 6, 3, 40, 2> Enum::_table_ = { {::_pbi::TcParser::MiniParse, {}}, // string name = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(Enum, _impl_.name_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(Enum, _impl_.name_)}}, // repeated .google.protobuf.EnumValue enumvalue = 2; {::_pbi::TcParser::FastMtR1, {18, 63, 0, PROTOBUF_FIELD_OFFSET(Enum, _impl_.enumvalue_)}}, @@ -1544,20 +1661,20 @@ const ::_pbi::TcParseTable<3, 6, 3, 40, 2> Enum::_table_ = { {26, 63, 1, PROTOBUF_FIELD_OFFSET(Enum, _impl_.options_)}}, // .google.protobuf.SourceContext source_context = 4; {::_pbi::TcParser::FastMtS1, - {34, 0, 2, PROTOBUF_FIELD_OFFSET(Enum, _impl_.source_context_)}}, + {34, 2, 2, PROTOBUF_FIELD_OFFSET(Enum, _impl_.source_context_)}}, // .google.protobuf.Syntax syntax = 5; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Enum, _impl_.syntax_), 63>(), - {40, 63, 0, PROTOBUF_FIELD_OFFSET(Enum, _impl_.syntax_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Enum, _impl_.syntax_), 3>(), + {40, 3, 0, PROTOBUF_FIELD_OFFSET(Enum, _impl_.syntax_)}}, // string edition = 6; {::_pbi::TcParser::FastUS1, - {50, 63, 0, PROTOBUF_FIELD_OFFSET(Enum, _impl_.edition_)}}, + {50, 1, 0, PROTOBUF_FIELD_OFFSET(Enum, _impl_.edition_)}}, {::_pbi::TcParser::MiniParse, {}}, }}, {{ 65535, 65535 }}, {{ // string name = 1; - {PROTOBUF_FIELD_OFFSET(Enum, _impl_.name_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Enum, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // repeated .google.protobuf.EnumValue enumvalue = 2; {PROTOBUF_FIELD_OFFSET(Enum, _impl_.enumvalue_), -1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, @@ -1565,14 +1682,14 @@ const ::_pbi::TcParseTable<3, 6, 3, 40, 2> Enum::_table_ = { {PROTOBUF_FIELD_OFFSET(Enum, _impl_.options_), -1, 1, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, // .google.protobuf.SourceContext source_context = 4; - {PROTOBUF_FIELD_OFFSET(Enum, _impl_.source_context_), _Internal::kHasBitsOffset + 0, 2, + {PROTOBUF_FIELD_OFFSET(Enum, _impl_.source_context_), _Internal::kHasBitsOffset + 2, 2, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, // .google.protobuf.Syntax syntax = 5; - {PROTOBUF_FIELD_OFFSET(Enum, _impl_.syntax_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + {PROTOBUF_FIELD_OFFSET(Enum, _impl_.syntax_), _Internal::kHasBitsOffset + 3, 0, + (0 | ::_fl::kFcOptional | ::_fl::kOpenEnum)}, // string edition = 6; - {PROTOBUF_FIELD_OFFSET(Enum, _impl_.edition_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Enum, _impl_.edition_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, }}, {{ {::_pbi::TcParser::GetTable<::google::protobuf::EnumValue>()}, {::_pbi::TcParser::GetTable<::google::protobuf::Option>()}, @@ -1594,12 +1711,18 @@ PROTOBUF_NOINLINE void Enum::Clear() { _impl_.enumvalue_.Clear(); _impl_.options_.Clear(); - _impl_.name_.ClearToEmpty(); - _impl_.edition_.ClearToEmpty(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - ABSL_DCHECK(_impl_.source_context_ != nullptr); - _impl_.source_context_->Clear(); + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + _impl_.name_.ClearToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + _impl_.edition_.ClearToEmpty(); + } + if (cached_has_bits & 0x00000004u) { + ABSL_DCHECK(_impl_.source_context_ != nullptr); + _impl_.source_context_->Clear(); + } } _impl_.syntax_ = 0; _impl_._has_bits_.Clear(); @@ -1622,11 +1745,13 @@ PROTOBUF_NOINLINE void Enum::Clear() { (void)cached_has_bits; // string name = 1; - if (!this_._internal_name().empty()) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Enum.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Enum.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } } // repeated .google.protobuf.EnumValue enumvalue = 2; @@ -1653,25 +1778,29 @@ PROTOBUF_NOINLINE void Enum::Clear() { cached_has_bits = this_._impl_._has_bits_[0]; // .google.protobuf.SourceContext source_context = 4; - if (cached_has_bits & 0x00000001u) { + if (cached_has_bits & 0x00000004u) { target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( 4, *this_._impl_.source_context_, this_._impl_.source_context_->GetCachedSize(), target, stream); } // .google.protobuf.Syntax syntax = 5; - if (this_._internal_syntax() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 5, this_._internal_syntax(), target); + if (cached_has_bits & 0x00000008u) { + if (this_._internal_syntax() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 5, this_._internal_syntax(), target); + } } // string edition = 6; - if (!this_._internal_edition().empty()) { - const std::string& _s = this_._internal_edition(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Enum.edition"); - target = stream->WriteStringMaybeAliased(6, _s, target); + if (cached_has_bits & 0x00000002u) { + if (!this_._internal_edition().empty()) { + const std::string& _s = this_._internal_edition(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Enum.edition"); + target = stream->WriteStringMaybeAliased(6, _s, target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -1714,31 +1843,33 @@ PROTOBUF_NOINLINE void Enum::Clear() { } } } - { + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { // string name = 1; - if (!this_._internal_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); + if (cached_has_bits & 0x00000001u) { + if (!this_._internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } } // string edition = 6; - if (!this_._internal_edition().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_edition()); + if (cached_has_bits & 0x00000002u) { + if (!this_._internal_edition().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_edition()); + } } - } - { // .google.protobuf.SourceContext source_context = 4; - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { + if (cached_has_bits & 0x00000004u) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.source_context_); } - } - { // .google.protobuf.Syntax syntax = 5; - if (this_._internal_syntax() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_syntax()); + if (cached_has_bits & 0x00000008u) { + if (this_._internal_syntax() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_syntax()); + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -1758,24 +1889,32 @@ void Enum::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::pr from._internal_enumvalue()); _this->_internal_mutable_options()->MergeFrom( from._internal_options()); - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } - if (!from._internal_edition().empty()) { - _this->_internal_set_edition(from._internal_edition()); - } cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - ABSL_DCHECK(from._impl_.source_context_ != nullptr); - if (_this->_impl_.source_context_ == nullptr) { - _this->_impl_.source_context_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceContext>(arena, *from._impl_.source_context_); - } else { - _this->_impl_.source_context_->MergeFrom(*from._impl_.source_context_); + if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000001u) { + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } + } + if (cached_has_bits & 0x00000002u) { + if (!from._internal_edition().empty()) { + _this->_internal_set_edition(from._internal_edition()); + } + } + if (cached_has_bits & 0x00000004u) { + ABSL_DCHECK(from._impl_.source_context_ != nullptr); + if (_this->_impl_.source_context_ == nullptr) { + _this->_impl_.source_context_ = + ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceContext>(arena, *from._impl_.source_context_); + } else { + _this->_impl_.source_context_->MergeFrom(*from._impl_.source_context_); + } + } + if (cached_has_bits & 0x00000008u) { + if (from._internal_syntax() != 0) { + _this->_impl_.syntax_ = from._impl_.syntax_; + } } - } - if (from._internal_syntax() != 0) { - _this->_impl_.syntax_ = from._impl_.syntax_; } _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); @@ -1814,6 +1953,10 @@ void Enum::InternalSwap(Enum* PROTOBUF_RESTRICT other) { class EnumValue::_Internal { public: + using HasBits = + decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(EnumValue, _impl_._has_bits_); }; EnumValue::EnumValue(::google::protobuf::Arena* arena) @@ -1828,9 +1971,10 @@ EnumValue::EnumValue(::google::protobuf::Arena* arena) inline PROTOBUF_NDEBUG_INLINE EnumValue::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const ::google::protobuf::EnumValue& from_msg) - : options_{visibility, arena, from.options_}, - name_(arena, from.name_), - _cached_size_{0} {} + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + options_{visibility, arena, from.options_}, + name_(arena, from.name_) {} EnumValue::EnumValue( ::google::protobuf::Arena* arena, @@ -1852,9 +1996,9 @@ EnumValue::EnumValue( inline PROTOBUF_NDEBUG_INLINE EnumValue::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : options_{visibility, arena}, - name_(arena), - _cached_size_{0} {} + : _cached_size_{0}, + options_{visibility, arena}, + name_(arena) {} inline void EnumValue::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -1928,7 +2072,7 @@ const ::google::protobuf::internal::ClassData* EnumValue::GetClassData() const { PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::_pbi::TcParseTable<2, 3, 1, 38, 2> EnumValue::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(EnumValue, _impl_._has_bits_), 0, // no _extensions_ 3, 24, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -1947,10 +2091,10 @@ const ::_pbi::TcParseTable<2, 3, 1, 38, 2> EnumValue::_table_ = { {::_pbi::TcParser::MiniParse, {}}, // string name = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.name_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.name_)}}, // int32 number = 2; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(EnumValue, _impl_.number_), 63>(), - {16, 63, 0, PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.number_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(EnumValue, _impl_.number_), 1>(), + {16, 1, 0, PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.number_)}}, // repeated .google.protobuf.Option options = 3; {::_pbi::TcParser::FastMtR1, {26, 63, 0, PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.options_)}}, @@ -1958,13 +2102,13 @@ const ::_pbi::TcParseTable<2, 3, 1, 38, 2> EnumValue::_table_ = { 65535, 65535 }}, {{ // string name = 1; - {PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.name_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // int32 number = 2; - {PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.number_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + {PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.number_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, // repeated .google.protobuf.Option options = 3; - {PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.options_), 0, 0, + {PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.options_), -1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, }}, {{ {::_pbi::TcParser::GetTable<::google::protobuf::Option>()}, @@ -1983,8 +2127,12 @@ PROTOBUF_NOINLINE void EnumValue::Clear() { (void) cached_has_bits; _impl_.options_.Clear(); - _impl_.name_.ClearToEmpty(); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + _impl_.name_.ClearToEmpty(); + } _impl_.number_ = 0; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -2004,18 +2152,22 @@ PROTOBUF_NOINLINE void EnumValue::Clear() { (void)cached_has_bits; // string name = 1; - if (!this_._internal_name().empty()) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.EnumValue.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.EnumValue.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } } // int32 number = 2; - if (this_._internal_number() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<2>( - stream, this_._internal_number(), target); + if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { + if (this_._internal_number() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<2>( + stream, this_._internal_number(), target); + } } // repeated .google.protobuf.Option options = 3; @@ -2062,16 +2214,21 @@ PROTOBUF_NOINLINE void EnumValue::Clear() { } } } - { + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { // string name = 1; - if (!this_._internal_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); + if (cached_has_bits & 0x00000001u) { + if (!this_._internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } } // int32 number = 2; - if (this_._internal_number() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_number()); + if (cached_has_bits & 0x00000002u) { + if (this_._internal_number() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_number()); + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -2088,12 +2245,20 @@ void EnumValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::googl _this->_internal_mutable_options()->MergeFrom( from._internal_options()); - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } - if (from._internal_number() != 0) { - _this->_impl_.number_ = from._impl_.number_; + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } + } + if (cached_has_bits & 0x00000002u) { + if (from._internal_number() != 0) { + _this->_impl_.number_ = from._impl_.number_; + } + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -2110,6 +2275,7 @@ void EnumValue::InternalSwap(EnumValue* PROTOBUF_RESTRICT other) { auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); _impl_.options_.InternalSwap(&other->_impl_.options_); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, &other->_impl_.name_, arena); swap(_impl_.number_, other->_impl_.number_); @@ -2131,7 +2297,7 @@ class Option::_Internal { void Option::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.value_ != nullptr) _impl_.value_->Clear(); - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000002u; } Option::Option(::google::protobuf::Arena* arena) #if defined(PROTOBUF_CUSTOM_VTABLE) @@ -2163,7 +2329,7 @@ Option::Option( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.value_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::Any>( + _impl_.value_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::Any>( arena, *from._impl_.value_) : nullptr; @@ -2254,18 +2420,18 @@ const ::_pbi::TcParseTable<1, 2, 1, 35, 2> Option::_table_ = { }, {{ // .google.protobuf.Any value = 2; {::_pbi::TcParser::FastMtS1, - {18, 0, 0, PROTOBUF_FIELD_OFFSET(Option, _impl_.value_)}}, + {18, 1, 0, PROTOBUF_FIELD_OFFSET(Option, _impl_.value_)}}, // string name = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(Option, _impl_.name_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(Option, _impl_.name_)}}, }}, {{ 65535, 65535 }}, {{ // string name = 1; - {PROTOBUF_FIELD_OFFSET(Option, _impl_.name_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Option, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // .google.protobuf.Any value = 2; - {PROTOBUF_FIELD_OFFSET(Option, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + {PROTOBUF_FIELD_OFFSET(Option, _impl_.value_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, }}, {{ {::_pbi::TcParser::GetTable<::google::protobuf::Any>()}, @@ -2283,11 +2449,15 @@ PROTOBUF_NOINLINE void Option::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.name_.ClearToEmpty(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - ABSL_DCHECK(_impl_.value_ != nullptr); - _impl_.value_->Clear(); + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + _impl_.name_.ClearToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + ABSL_DCHECK(_impl_.value_ != nullptr); + _impl_.value_->Clear(); + } } _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); @@ -2309,16 +2479,18 @@ PROTOBUF_NOINLINE void Option::Clear() { (void)cached_has_bits; // string name = 1; - if (!this_._internal_name().empty()) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Option.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Option.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } } cached_has_bits = this_._impl_._has_bits_[0]; // .google.protobuf.Any value = 2; - if (cached_has_bits & 0x00000001u) { + if (cached_has_bits & 0x00000002u) { target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( 2, *this_._impl_.value_, this_._impl_.value_->GetCachedSize(), target, stream); @@ -2348,17 +2520,17 @@ PROTOBUF_NOINLINE void Option::Clear() { (void)cached_has_bits; ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { // string name = 1; - if (!this_._internal_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); + if (cached_has_bits & 0x00000001u) { + if (!this_._internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } } - } - { // .google.protobuf.Any value = 2; - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { + if (cached_has_bits & 0x00000002u) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.value_); } @@ -2376,17 +2548,21 @@ void Option::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google:: ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - ABSL_DCHECK(from._impl_.value_ != nullptr); - if (_this->_impl_.value_ == nullptr) { - _this->_impl_.value_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::Any>(arena, *from._impl_.value_); - } else { - _this->_impl_.value_->MergeFrom(*from._impl_.value_); + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } + } + if (cached_has_bits & 0x00000002u) { + ABSL_DCHECK(from._impl_.value_ != nullptr); + if (_this->_impl_.value_ == nullptr) { + _this->_impl_.value_ = + ::google::protobuf::Message::CopyConstruct<::google::protobuf::Any>(arena, *from._impl_.value_); + } else { + _this->_impl_.value_->MergeFrom(*from._impl_.value_); + } } } _this->_impl_._has_bits_[0] |= cached_has_bits; diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h index d78440d8ed..a14ed2c9ae 100644 --- a/src/google/protobuf/type.pb.h +++ b/src/google/protobuf/type.pb.h @@ -818,6 +818,8 @@ class PROTOBUF_EXPORT Field final inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const Field& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; + ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option > options_; ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::internal::ArenaStringPtr type_url_; @@ -828,7 +830,6 @@ class PROTOBUF_EXPORT Field final ::int32_t number_; ::int32_t oneof_index_; bool packed_; - ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -1056,10 +1057,11 @@ class PROTOBUF_EXPORT EnumValue final inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const EnumValue& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; + ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option > options_; ::google::protobuf::internal::ArenaStringPtr name_; ::int32_t number_; - ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -1684,6 +1686,7 @@ PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Enum_cl inline void Type::clear_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& Type::name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -1694,6 +1697,7 @@ template inline PROTOBUF_ALWAYS_INLINE void Type::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Type.name) } @@ -1708,19 +1712,34 @@ inline const std::string& Type::_internal_name() const { } inline void Type::_internal_set_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } inline std::string* Type::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } inline std::string* Type::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Type.name) - return _impl_.name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.name_.Set("", GetArena()); + } + return released; } inline void Type::set_allocated_name(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.name_.IsDefault()) { _impl_.name_.Set("", GetArena()); @@ -1892,7 +1911,7 @@ Type::_internal_mutable_options() { // .google.protobuf.SourceContext source_context = 5; inline bool Type::has_source_context() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; PROTOBUF_ASSUME(!value || _impl_.source_context_ != nullptr); return value; } @@ -1912,16 +1931,16 @@ inline void Type::unsafe_arena_set_allocated_source_context(::google::protobuf:: } _impl_.source_context_ = reinterpret_cast<::google::protobuf::SourceContext*>(value); if (value != nullptr) { - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000004u; } else { - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Type.source_context) } inline ::google::protobuf::SourceContext* Type::release_source_context() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; ::google::protobuf::SourceContext* released = _impl_.source_context_; _impl_.source_context_ = nullptr; if (::google::protobuf::internal::DebugHardenForceCopyInRelease()) { @@ -1941,7 +1960,7 @@ inline ::google::protobuf::SourceContext* Type::unsafe_arena_release_source_cont ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Type.source_context) - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; ::google::protobuf::SourceContext* temp = _impl_.source_context_; _impl_.source_context_ = nullptr; return temp; @@ -1955,7 +1974,7 @@ inline ::google::protobuf::SourceContext* Type::_internal_mutable_source_context return _impl_.source_context_; } inline ::google::protobuf::SourceContext* Type::mutable_source_context() ABSL_ATTRIBUTE_LIFETIME_BOUND { - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000004u; ::google::protobuf::SourceContext* _msg = _internal_mutable_source_context(); // @@protoc_insertion_point(field_mutable:google.protobuf.Type.source_context) return _msg; @@ -1972,9 +1991,9 @@ inline void Type::set_allocated_source_context(::google::protobuf::SourceContext if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000004u; } else { - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; } _impl_.source_context_ = reinterpret_cast<::google::protobuf::SourceContext*>(value); @@ -1985,6 +2004,7 @@ inline void Type::set_allocated_source_context(::google::protobuf::SourceContext inline void Type::clear_syntax() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.syntax_ = 0; + _impl_._has_bits_[0] &= ~0x00000008u; } inline ::google::protobuf::Syntax Type::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Type.syntax) @@ -1992,6 +2012,7 @@ inline ::google::protobuf::Syntax Type::syntax() const { } inline void Type::set_syntax(::google::protobuf::Syntax value) { _internal_set_syntax(value); + _impl_._has_bits_[0] |= 0x00000008u; // @@protoc_insertion_point(field_set:google.protobuf.Type.syntax) } inline ::google::protobuf::Syntax Type::_internal_syntax() const { @@ -2007,6 +2028,7 @@ inline void Type::_internal_set_syntax(::google::protobuf::Syntax value) { inline void Type::clear_edition() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.edition_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000002u; } inline const std::string& Type::edition() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2017,6 +2039,7 @@ template inline PROTOBUF_ALWAYS_INLINE void Type::set_edition(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.edition_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Type.edition) } @@ -2031,19 +2054,34 @@ inline const std::string& Type::_internal_edition() const { } inline void Type::_internal_set_edition(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.edition_.Set(value, GetArena()); } inline std::string* Type::_internal_mutable_edition() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; return _impl_.edition_.Mutable( GetArena()); } inline std::string* Type::release_edition() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Type.edition) - return _impl_.edition_.Release(); + if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000002u; + auto* released = _impl_.edition_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.edition_.Set("", GetArena()); + } + return released; } inline void Type::set_allocated_edition(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } _impl_.edition_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.edition_.IsDefault()) { _impl_.edition_.Set("", GetArena()); @@ -2059,6 +2097,7 @@ inline void Type::set_allocated_edition(std::string* value) { inline void Field::clear_kind() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.kind_ = 0; + _impl_._has_bits_[0] &= ~0x00000010u; } inline ::google::protobuf::Field_Kind Field::kind() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.kind) @@ -2066,6 +2105,7 @@ inline ::google::protobuf::Field_Kind Field::kind() const { } inline void Field::set_kind(::google::protobuf::Field_Kind value) { _internal_set_kind(value); + _impl_._has_bits_[0] |= 0x00000010u; // @@protoc_insertion_point(field_set:google.protobuf.Field.kind) } inline ::google::protobuf::Field_Kind Field::_internal_kind() const { @@ -2081,6 +2121,7 @@ inline void Field::_internal_set_kind(::google::protobuf::Field_Kind value) { inline void Field::clear_cardinality() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.cardinality_ = 0; + _impl_._has_bits_[0] &= ~0x00000020u; } inline ::google::protobuf::Field_Cardinality Field::cardinality() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.cardinality) @@ -2088,6 +2129,7 @@ inline ::google::protobuf::Field_Cardinality Field::cardinality() const { } inline void Field::set_cardinality(::google::protobuf::Field_Cardinality value) { _internal_set_cardinality(value); + _impl_._has_bits_[0] |= 0x00000020u; // @@protoc_insertion_point(field_set:google.protobuf.Field.cardinality) } inline ::google::protobuf::Field_Cardinality Field::_internal_cardinality() const { @@ -2103,6 +2145,7 @@ inline void Field::_internal_set_cardinality(::google::protobuf::Field_Cardinali inline void Field::clear_number() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.number_ = 0; + _impl_._has_bits_[0] &= ~0x00000040u; } inline ::int32_t Field::number() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.number) @@ -2110,6 +2153,7 @@ inline ::int32_t Field::number() const { } inline void Field::set_number(::int32_t value) { _internal_set_number(value); + _impl_._has_bits_[0] |= 0x00000040u; // @@protoc_insertion_point(field_set:google.protobuf.Field.number) } inline ::int32_t Field::_internal_number() const { @@ -2125,6 +2169,7 @@ inline void Field::_internal_set_number(::int32_t value) { inline void Field::clear_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& Field::name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2135,6 +2180,7 @@ template inline PROTOBUF_ALWAYS_INLINE void Field::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Field.name) } @@ -2149,19 +2195,34 @@ inline const std::string& Field::_internal_name() const { } inline void Field::_internal_set_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } inline std::string* Field::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } inline std::string* Field::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Field.name) - return _impl_.name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.name_.Set("", GetArena()); + } + return released; } inline void Field::set_allocated_name(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.name_.IsDefault()) { _impl_.name_.Set("", GetArena()); @@ -2173,6 +2234,7 @@ inline void Field::set_allocated_name(std::string* value) { inline void Field::clear_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.type_url_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000002u; } inline const std::string& Field::type_url() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2183,6 +2245,7 @@ template inline PROTOBUF_ALWAYS_INLINE void Field::set_type_url(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.type_url_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Field.type_url) } @@ -2197,19 +2260,34 @@ inline const std::string& Field::_internal_type_url() const { } inline void Field::_internal_set_type_url(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.type_url_.Set(value, GetArena()); } inline std::string* Field::_internal_mutable_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; return _impl_.type_url_.Mutable( GetArena()); } inline std::string* Field::release_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Field.type_url) - return _impl_.type_url_.Release(); + if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000002u; + auto* released = _impl_.type_url_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.type_url_.Set("", GetArena()); + } + return released; } inline void Field::set_allocated_type_url(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } _impl_.type_url_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.type_url_.IsDefault()) { _impl_.type_url_.Set("", GetArena()); @@ -2221,6 +2299,7 @@ inline void Field::set_allocated_type_url(std::string* value) { inline void Field::clear_oneof_index() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.oneof_index_ = 0; + _impl_._has_bits_[0] &= ~0x00000080u; } inline ::int32_t Field::oneof_index() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.oneof_index) @@ -2228,6 +2307,7 @@ inline ::int32_t Field::oneof_index() const { } inline void Field::set_oneof_index(::int32_t value) { _internal_set_oneof_index(value); + _impl_._has_bits_[0] |= 0x00000080u; // @@protoc_insertion_point(field_set:google.protobuf.Field.oneof_index) } inline ::int32_t Field::_internal_oneof_index() const { @@ -2243,6 +2323,7 @@ inline void Field::_internal_set_oneof_index(::int32_t value) { inline void Field::clear_packed() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.packed_ = false; + _impl_._has_bits_[0] &= ~0x00000100u; } inline bool Field::packed() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.packed) @@ -2250,6 +2331,7 @@ inline bool Field::packed() const { } inline void Field::set_packed(bool value) { _internal_set_packed(value); + _impl_._has_bits_[0] |= 0x00000100u; // @@protoc_insertion_point(field_set:google.protobuf.Field.packed) } inline bool Field::_internal_packed() const { @@ -2314,6 +2396,7 @@ Field::_internal_mutable_options() { inline void Field::clear_json_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.json_name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000004u; } inline const std::string& Field::json_name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2324,6 +2407,7 @@ template inline PROTOBUF_ALWAYS_INLINE void Field::set_json_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000004u; _impl_.json_name_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Field.json_name) } @@ -2338,19 +2422,34 @@ inline const std::string& Field::_internal_json_name() const { } inline void Field::_internal_set_json_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000004u; _impl_.json_name_.Set(value, GetArena()); } inline std::string* Field::_internal_mutable_json_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000004u; return _impl_.json_name_.Mutable( GetArena()); } inline std::string* Field::release_json_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Field.json_name) - return _impl_.json_name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000004u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000004u; + auto* released = _impl_.json_name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.json_name_.Set("", GetArena()); + } + return released; } inline void Field::set_allocated_json_name(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000004u; + } else { + _impl_._has_bits_[0] &= ~0x00000004u; + } _impl_.json_name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.json_name_.IsDefault()) { _impl_.json_name_.Set("", GetArena()); @@ -2362,6 +2461,7 @@ inline void Field::set_allocated_json_name(std::string* value) { inline void Field::clear_default_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.default_value_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000008u; } inline const std::string& Field::default_value() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2372,6 +2472,7 @@ template inline PROTOBUF_ALWAYS_INLINE void Field::set_default_value(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000008u; _impl_.default_value_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Field.default_value) } @@ -2386,19 +2487,34 @@ inline const std::string& Field::_internal_default_value() const { } inline void Field::_internal_set_default_value(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000008u; _impl_.default_value_.Set(value, GetArena()); } inline std::string* Field::_internal_mutable_default_value() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000008u; return _impl_.default_value_.Mutable( GetArena()); } inline std::string* Field::release_default_value() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Field.default_value) - return _impl_.default_value_.Release(); + if ((_impl_._has_bits_[0] & 0x00000008u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000008u; + auto* released = _impl_.default_value_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.default_value_.Set("", GetArena()); + } + return released; } inline void Field::set_allocated_default_value(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000008u; + } else { + _impl_._has_bits_[0] &= ~0x00000008u; + } _impl_.default_value_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.default_value_.IsDefault()) { _impl_.default_value_.Set("", GetArena()); @@ -2414,6 +2530,7 @@ inline void Field::set_allocated_default_value(std::string* value) { inline void Enum::clear_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& Enum::name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2424,6 +2541,7 @@ template inline PROTOBUF_ALWAYS_INLINE void Enum::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Enum.name) } @@ -2438,19 +2556,34 @@ inline const std::string& Enum::_internal_name() const { } inline void Enum::_internal_set_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } inline std::string* Enum::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } inline std::string* Enum::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Enum.name) - return _impl_.name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.name_.Set("", GetArena()); + } + return released; } inline void Enum::set_allocated_name(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.name_.IsDefault()) { _impl_.name_.Set("", GetArena()); @@ -2558,7 +2691,7 @@ Enum::_internal_mutable_options() { // .google.protobuf.SourceContext source_context = 4; inline bool Enum::has_source_context() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; PROTOBUF_ASSUME(!value || _impl_.source_context_ != nullptr); return value; } @@ -2578,16 +2711,16 @@ inline void Enum::unsafe_arena_set_allocated_source_context(::google::protobuf:: } _impl_.source_context_ = reinterpret_cast<::google::protobuf::SourceContext*>(value); if (value != nullptr) { - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000004u; } else { - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Enum.source_context) } inline ::google::protobuf::SourceContext* Enum::release_source_context() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; ::google::protobuf::SourceContext* released = _impl_.source_context_; _impl_.source_context_ = nullptr; if (::google::protobuf::internal::DebugHardenForceCopyInRelease()) { @@ -2607,7 +2740,7 @@ inline ::google::protobuf::SourceContext* Enum::unsafe_arena_release_source_cont ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Enum.source_context) - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; ::google::protobuf::SourceContext* temp = _impl_.source_context_; _impl_.source_context_ = nullptr; return temp; @@ -2621,7 +2754,7 @@ inline ::google::protobuf::SourceContext* Enum::_internal_mutable_source_context return _impl_.source_context_; } inline ::google::protobuf::SourceContext* Enum::mutable_source_context() ABSL_ATTRIBUTE_LIFETIME_BOUND { - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000004u; ::google::protobuf::SourceContext* _msg = _internal_mutable_source_context(); // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.source_context) return _msg; @@ -2638,9 +2771,9 @@ inline void Enum::set_allocated_source_context(::google::protobuf::SourceContext if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000004u; } else { - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; } _impl_.source_context_ = reinterpret_cast<::google::protobuf::SourceContext*>(value); @@ -2651,6 +2784,7 @@ inline void Enum::set_allocated_source_context(::google::protobuf::SourceContext inline void Enum::clear_syntax() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.syntax_ = 0; + _impl_._has_bits_[0] &= ~0x00000008u; } inline ::google::protobuf::Syntax Enum::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Enum.syntax) @@ -2658,6 +2792,7 @@ inline ::google::protobuf::Syntax Enum::syntax() const { } inline void Enum::set_syntax(::google::protobuf::Syntax value) { _internal_set_syntax(value); + _impl_._has_bits_[0] |= 0x00000008u; // @@protoc_insertion_point(field_set:google.protobuf.Enum.syntax) } inline ::google::protobuf::Syntax Enum::_internal_syntax() const { @@ -2673,6 +2808,7 @@ inline void Enum::_internal_set_syntax(::google::protobuf::Syntax value) { inline void Enum::clear_edition() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.edition_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000002u; } inline const std::string& Enum::edition() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2683,6 +2819,7 @@ template inline PROTOBUF_ALWAYS_INLINE void Enum::set_edition(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.edition_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Enum.edition) } @@ -2697,19 +2834,34 @@ inline const std::string& Enum::_internal_edition() const { } inline void Enum::_internal_set_edition(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.edition_.Set(value, GetArena()); } inline std::string* Enum::_internal_mutable_edition() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; return _impl_.edition_.Mutable( GetArena()); } inline std::string* Enum::release_edition() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Enum.edition) - return _impl_.edition_.Release(); + if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000002u; + auto* released = _impl_.edition_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.edition_.Set("", GetArena()); + } + return released; } inline void Enum::set_allocated_edition(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } _impl_.edition_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.edition_.IsDefault()) { _impl_.edition_.Set("", GetArena()); @@ -2725,6 +2877,7 @@ inline void Enum::set_allocated_edition(std::string* value) { inline void EnumValue::clear_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& EnumValue::name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2735,6 +2888,7 @@ template inline PROTOBUF_ALWAYS_INLINE void EnumValue::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.EnumValue.name) } @@ -2749,19 +2903,34 @@ inline const std::string& EnumValue::_internal_name() const { } inline void EnumValue::_internal_set_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } inline std::string* EnumValue::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } inline std::string* EnumValue::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.EnumValue.name) - return _impl_.name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.name_.Set("", GetArena()); + } + return released; } inline void EnumValue::set_allocated_name(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.name_.IsDefault()) { _impl_.name_.Set("", GetArena()); @@ -2773,6 +2942,7 @@ inline void EnumValue::set_allocated_name(std::string* value) { inline void EnumValue::clear_number() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.number_ = 0; + _impl_._has_bits_[0] &= ~0x00000002u; } inline ::int32_t EnumValue::number() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.number) @@ -2780,6 +2950,7 @@ inline ::int32_t EnumValue::number() const { } inline void EnumValue::set_number(::int32_t value) { _internal_set_number(value); + _impl_._has_bits_[0] |= 0x00000002u; // @@protoc_insertion_point(field_set:google.protobuf.EnumValue.number) } inline ::int32_t EnumValue::_internal_number() const { @@ -2848,6 +3019,7 @@ EnumValue::_internal_mutable_options() { inline void Option::clear_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& Option::name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2858,6 +3030,7 @@ template inline PROTOBUF_ALWAYS_INLINE void Option::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Option.name) } @@ -2872,19 +3045,34 @@ inline const std::string& Option::_internal_name() const { } inline void Option::_internal_set_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } inline std::string* Option::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } inline std::string* Option::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Option.name) - return _impl_.name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.name_.Set("", GetArena()); + } + return released; } inline void Option::set_allocated_name(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.name_.IsDefault()) { _impl_.name_.Set("", GetArena()); @@ -2894,7 +3082,7 @@ inline void Option::set_allocated_name(std::string* value) { // .google.protobuf.Any value = 2; inline bool Option::has_value() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; PROTOBUF_ASSUME(!value || _impl_.value_ != nullptr); return value; } @@ -2914,16 +3102,16 @@ inline void Option::unsafe_arena_set_allocated_value(::google::protobuf::Any* va } _impl_.value_ = reinterpret_cast<::google::protobuf::Any*>(value); if (value != nullptr) { - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000002u; } else { - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000002u; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Option.value) } inline ::google::protobuf::Any* Option::release_value() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000002u; ::google::protobuf::Any* released = _impl_.value_; _impl_.value_ = nullptr; if (::google::protobuf::internal::DebugHardenForceCopyInRelease()) { @@ -2943,7 +3131,7 @@ inline ::google::protobuf::Any* Option::unsafe_arena_release_value() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Option.value) - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000002u; ::google::protobuf::Any* temp = _impl_.value_; _impl_.value_ = nullptr; return temp; @@ -2957,7 +3145,7 @@ inline ::google::protobuf::Any* Option::_internal_mutable_value() { return _impl_.value_; } inline ::google::protobuf::Any* Option::mutable_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000002u; ::google::protobuf::Any* _msg = _internal_mutable_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.Option.value) return _msg; @@ -2974,9 +3162,9 @@ inline void Option::set_allocated_value(::google::protobuf::Any* value) { if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000002u; } else { - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000002u; } _impl_.value_ = reinterpret_cast<::google::protobuf::Any*>(value); diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc index 5a0078a6ed..d17791a6f2 100644 --- a/src/google/protobuf/wrappers.pb.cc +++ b/src/google/protobuf/wrappers.pb.cc @@ -29,8 +29,8 @@ namespace protobuf { inline constexpr UInt64Value::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : value_{::uint64_t{0u}}, - _cached_size_{0} {} + : _cached_size_{0}, + value_{::uint64_t{0u}} {} template PROTOBUF_CONSTEXPR UInt64Value::UInt64Value(::_pbi::ConstantInitialized) @@ -54,8 +54,8 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr UInt32Value::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : value_{0u}, - _cached_size_{0} {} + : _cached_size_{0}, + value_{0u} {} template PROTOBUF_CONSTEXPR UInt32Value::UInt32Value(::_pbi::ConstantInitialized) @@ -79,10 +79,10 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr StringValue::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : value_( + : _cached_size_{0}, + value_( &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - _cached_size_{0} {} + ::_pbi::ConstantInitialized()) {} template PROTOBUF_CONSTEXPR StringValue::StringValue(::_pbi::ConstantInitialized) @@ -106,8 +106,8 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr Int64Value::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : value_{::int64_t{0}}, - _cached_size_{0} {} + : _cached_size_{0}, + value_{::int64_t{0}} {} template PROTOBUF_CONSTEXPR Int64Value::Int64Value(::_pbi::ConstantInitialized) @@ -131,8 +131,8 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr Int32Value::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : value_{0}, - _cached_size_{0} {} + : _cached_size_{0}, + value_{0} {} template PROTOBUF_CONSTEXPR Int32Value::Int32Value(::_pbi::ConstantInitialized) @@ -156,8 +156,8 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr FloatValue::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : value_{0}, - _cached_size_{0} {} + : _cached_size_{0}, + value_{0} {} template PROTOBUF_CONSTEXPR FloatValue::FloatValue(::_pbi::ConstantInitialized) @@ -181,8 +181,8 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr DoubleValue::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : value_{0}, - _cached_size_{0} {} + : _cached_size_{0}, + value_{0} {} template PROTOBUF_CONSTEXPR DoubleValue::DoubleValue(::_pbi::ConstantInitialized) @@ -206,10 +206,10 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr BytesValue::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : value_( + : _cached_size_{0}, + value_( &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - _cached_size_{0} {} + ::_pbi::ConstantInitialized()) {} template PROTOBUF_CONSTEXPR BytesValue::BytesValue(::_pbi::ConstantInitialized) @@ -233,8 +233,8 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr BoolValue::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : value_{false}, - _cached_size_{0} {} + : _cached_size_{0}, + value_{false} {} template PROTOBUF_CONSTEXPR BoolValue::BoolValue(::_pbi::ConstantInitialized) @@ -264,7 +264,7 @@ static constexpr const ::_pb::ServiceDescriptor** const ::uint32_t TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( protodesc_cold) = { - ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::google::protobuf::DoubleValue, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::DoubleValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -273,7 +273,8 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::DoubleValue, _impl_.value_), - ~0u, // no _has_bits_ + 0, + PROTOBUF_FIELD_OFFSET(::google::protobuf::FloatValue, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::FloatValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -282,7 +283,8 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::FloatValue, _impl_.value_), - ~0u, // no _has_bits_ + 0, + PROTOBUF_FIELD_OFFSET(::google::protobuf::Int64Value, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Int64Value, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -291,7 +293,8 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::Int64Value, _impl_.value_), - ~0u, // no _has_bits_ + 0, + PROTOBUF_FIELD_OFFSET(::google::protobuf::UInt64Value, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::UInt64Value, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -300,7 +303,8 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::UInt64Value, _impl_.value_), - ~0u, // no _has_bits_ + 0, + PROTOBUF_FIELD_OFFSET(::google::protobuf::Int32Value, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Int32Value, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -309,7 +313,8 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::Int32Value, _impl_.value_), - ~0u, // no _has_bits_ + 0, + PROTOBUF_FIELD_OFFSET(::google::protobuf::UInt32Value, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::UInt32Value, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -318,7 +323,8 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::UInt32Value, _impl_.value_), - ~0u, // no _has_bits_ + 0, + PROTOBUF_FIELD_OFFSET(::google::protobuf::BoolValue, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::BoolValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -327,7 +333,8 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::BoolValue, _impl_.value_), - ~0u, // no _has_bits_ + 0, + PROTOBUF_FIELD_OFFSET(::google::protobuf::StringValue, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::StringValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -336,7 +343,8 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::StringValue, _impl_.value_), - ~0u, // no _has_bits_ + 0, + PROTOBUF_FIELD_OFFSET(::google::protobuf::BytesValue, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::BytesValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -345,19 +353,20 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::BytesValue, _impl_.value_), + 0, }; static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, -1, -1, sizeof(::google::protobuf::DoubleValue)}, - {9, -1, -1, sizeof(::google::protobuf::FloatValue)}, - {18, -1, -1, sizeof(::google::protobuf::Int64Value)}, - {27, -1, -1, sizeof(::google::protobuf::UInt64Value)}, - {36, -1, -1, sizeof(::google::protobuf::Int32Value)}, - {45, -1, -1, sizeof(::google::protobuf::UInt32Value)}, - {54, -1, -1, sizeof(::google::protobuf::BoolValue)}, - {63, -1, -1, sizeof(::google::protobuf::StringValue)}, - {72, -1, -1, sizeof(::google::protobuf::BytesValue)}, + {0, 9, -1, sizeof(::google::protobuf::DoubleValue)}, + {10, 19, -1, sizeof(::google::protobuf::FloatValue)}, + {20, 29, -1, sizeof(::google::protobuf::Int64Value)}, + {30, 39, -1, sizeof(::google::protobuf::UInt64Value)}, + {40, 49, -1, sizeof(::google::protobuf::Int32Value)}, + {50, 59, -1, sizeof(::google::protobuf::UInt32Value)}, + {60, 69, -1, sizeof(::google::protobuf::BoolValue)}, + {70, 79, -1, sizeof(::google::protobuf::StringValue)}, + {80, 89, -1, sizeof(::google::protobuf::BytesValue)}, }; static const ::_pb::Message* const file_default_instances[] = { &::google::protobuf::_DoubleValue_default_instance_._instance, @@ -408,6 +417,10 @@ namespace protobuf { class DoubleValue::_Internal { public: + using HasBits = + decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(DoubleValue, _impl_._has_bits_); }; DoubleValue::DoubleValue(::google::protobuf::Arena* arena) @@ -494,7 +507,7 @@ const ::google::protobuf::internal::ClassData* DoubleValue::GetClassData() const PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::_pbi::TcParseTable<0, 1, 0, 0, 2> DoubleValue::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(DoubleValue, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -512,13 +525,13 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> DoubleValue::_table_ = { }, {{ // double value = 1; {::_pbi::TcParser::FastF64S1, - {9, 63, 0, PROTOBUF_FIELD_OFFSET(DoubleValue, _impl_.value_)}}, + {9, 0, 0, PROTOBUF_FIELD_OFFSET(DoubleValue, _impl_.value_)}}, }}, {{ 65535, 65535 }}, {{ // double value = 1; - {PROTOBUF_FIELD_OFFSET(DoubleValue, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kDouble)}, + {PROTOBUF_FIELD_OFFSET(DoubleValue, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kDouble)}, }}, // no aux_entries {{ @@ -533,6 +546,7 @@ PROTOBUF_NOINLINE void DoubleValue::Clear() { (void) cached_has_bits; _impl_.value_ = 0; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -552,10 +566,12 @@ PROTOBUF_NOINLINE void DoubleValue::Clear() { (void)cached_has_bits; // double value = 1; - if (::absl::bit_cast<::uint64_t>(this_._internal_value()) != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteDoubleToArray( - 1, this_._internal_value(), target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (::absl::bit_cast<::uint64_t>(this_._internal_value()) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteDoubleToArray( + 1, this_._internal_value(), target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -583,8 +599,11 @@ PROTOBUF_NOINLINE void DoubleValue::Clear() { { // double value = 1; - if (::absl::bit_cast<::uint64_t>(this_._internal_value()) != 0) { - total_size += 9; + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (::absl::bit_cast<::uint64_t>(this_._internal_value()) != 0) { + total_size += 9; + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -599,9 +618,13 @@ void DoubleValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goo ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (::absl::bit_cast<::uint64_t>(from._internal_value()) != 0) { - _this->_impl_.value_ = from._impl_.value_; + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (::absl::bit_cast<::uint64_t>(from._internal_value()) != 0) { + _this->_impl_.value_ = from._impl_.value_; + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -616,6 +639,7 @@ void DoubleValue::CopyFrom(const DoubleValue& from) { void DoubleValue::InternalSwap(DoubleValue* PROTOBUF_RESTRICT other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); swap(_impl_.value_, other->_impl_.value_); } @@ -626,6 +650,10 @@ void DoubleValue::InternalSwap(DoubleValue* PROTOBUF_RESTRICT other) { class FloatValue::_Internal { public: + using HasBits = + decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(FloatValue, _impl_._has_bits_); }; FloatValue::FloatValue(::google::protobuf::Arena* arena) @@ -712,7 +740,7 @@ const ::google::protobuf::internal::ClassData* FloatValue::GetClassData() const PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::_pbi::TcParseTable<0, 1, 0, 0, 2> FloatValue::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(FloatValue, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -730,13 +758,13 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> FloatValue::_table_ = { }, {{ // float value = 1; {::_pbi::TcParser::FastF32S1, - {13, 63, 0, PROTOBUF_FIELD_OFFSET(FloatValue, _impl_.value_)}}, + {13, 0, 0, PROTOBUF_FIELD_OFFSET(FloatValue, _impl_.value_)}}, }}, {{ 65535, 65535 }}, {{ // float value = 1; - {PROTOBUF_FIELD_OFFSET(FloatValue, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kFloat)}, + {PROTOBUF_FIELD_OFFSET(FloatValue, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kFloat)}, }}, // no aux_entries {{ @@ -751,6 +779,7 @@ PROTOBUF_NOINLINE void FloatValue::Clear() { (void) cached_has_bits; _impl_.value_ = 0; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -770,10 +799,12 @@ PROTOBUF_NOINLINE void FloatValue::Clear() { (void)cached_has_bits; // float value = 1; - if (::absl::bit_cast<::uint32_t>(this_._internal_value()) != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFloatToArray( - 1, this_._internal_value(), target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (::absl::bit_cast<::uint32_t>(this_._internal_value()) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteFloatToArray( + 1, this_._internal_value(), target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -801,8 +832,11 @@ PROTOBUF_NOINLINE void FloatValue::Clear() { { // float value = 1; - if (::absl::bit_cast<::uint32_t>(this_._internal_value()) != 0) { - total_size += 5; + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (::absl::bit_cast<::uint32_t>(this_._internal_value()) != 0) { + total_size += 5; + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -817,9 +851,13 @@ void FloatValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goog ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (::absl::bit_cast<::uint32_t>(from._internal_value()) != 0) { - _this->_impl_.value_ = from._impl_.value_; + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (::absl::bit_cast<::uint32_t>(from._internal_value()) != 0) { + _this->_impl_.value_ = from._impl_.value_; + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -834,6 +872,7 @@ void FloatValue::CopyFrom(const FloatValue& from) { void FloatValue::InternalSwap(FloatValue* PROTOBUF_RESTRICT other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); swap(_impl_.value_, other->_impl_.value_); } @@ -844,6 +883,10 @@ void FloatValue::InternalSwap(FloatValue* PROTOBUF_RESTRICT other) { class Int64Value::_Internal { public: + using HasBits = + decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Int64Value, _impl_._has_bits_); }; Int64Value::Int64Value(::google::protobuf::Arena* arena) @@ -930,7 +973,7 @@ const ::google::protobuf::internal::ClassData* Int64Value::GetClassData() const PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::_pbi::TcParseTable<0, 1, 0, 0, 2> Int64Value::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(Int64Value, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -947,14 +990,14 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> Int64Value::_table_ = { #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // int64 value = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(Int64Value, _impl_.value_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(Int64Value, _impl_.value_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(Int64Value, _impl_.value_), 0>(), + {8, 0, 0, PROTOBUF_FIELD_OFFSET(Int64Value, _impl_.value_)}}, }}, {{ 65535, 65535 }}, {{ // int64 value = 1; - {PROTOBUF_FIELD_OFFSET(Int64Value, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt64)}, + {PROTOBUF_FIELD_OFFSET(Int64Value, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt64)}, }}, // no aux_entries {{ @@ -969,6 +1012,7 @@ PROTOBUF_NOINLINE void Int64Value::Clear() { (void) cached_has_bits; _impl_.value_ = ::int64_t{0}; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -988,10 +1032,12 @@ PROTOBUF_NOINLINE void Int64Value::Clear() { (void)cached_has_bits; // int64 value = 1; - if (this_._internal_value() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt64ToArrayWithField<1>( - stream, this_._internal_value(), target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (this_._internal_value() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt64ToArrayWithField<1>( + stream, this_._internal_value(), target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -1019,9 +1065,12 @@ PROTOBUF_NOINLINE void Int64Value::Clear() { { // int64 value = 1; - if (this_._internal_value() != 0) { - total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( - this_._internal_value()); + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (this_._internal_value() != 0) { + total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( + this_._internal_value()); + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -1036,9 +1085,13 @@ void Int64Value::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goog ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_value() != 0) { - _this->_impl_.value_ = from._impl_.value_; + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (from._internal_value() != 0) { + _this->_impl_.value_ = from._impl_.value_; + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -1053,6 +1106,7 @@ void Int64Value::CopyFrom(const Int64Value& from) { void Int64Value::InternalSwap(Int64Value* PROTOBUF_RESTRICT other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); swap(_impl_.value_, other->_impl_.value_); } @@ -1063,6 +1117,10 @@ void Int64Value::InternalSwap(Int64Value* PROTOBUF_RESTRICT other) { class UInt64Value::_Internal { public: + using HasBits = + decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(UInt64Value, _impl_._has_bits_); }; UInt64Value::UInt64Value(::google::protobuf::Arena* arena) @@ -1149,7 +1207,7 @@ const ::google::protobuf::internal::ClassData* UInt64Value::GetClassData() const PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::_pbi::TcParseTable<0, 1, 0, 0, 2> UInt64Value::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(UInt64Value, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -1166,14 +1224,14 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> UInt64Value::_table_ = { #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // uint64 value = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(UInt64Value, _impl_.value_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(UInt64Value, _impl_.value_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(UInt64Value, _impl_.value_), 0>(), + {8, 0, 0, PROTOBUF_FIELD_OFFSET(UInt64Value, _impl_.value_)}}, }}, {{ 65535, 65535 }}, {{ // uint64 value = 1; - {PROTOBUF_FIELD_OFFSET(UInt64Value, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUInt64)}, + {PROTOBUF_FIELD_OFFSET(UInt64Value, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUInt64)}, }}, // no aux_entries {{ @@ -1188,6 +1246,7 @@ PROTOBUF_NOINLINE void UInt64Value::Clear() { (void) cached_has_bits; _impl_.value_ = ::uint64_t{0u}; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -1207,10 +1266,12 @@ PROTOBUF_NOINLINE void UInt64Value::Clear() { (void)cached_has_bits; // uint64 value = 1; - if (this_._internal_value() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 1, this_._internal_value(), target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (this_._internal_value() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt64ToArray( + 1, this_._internal_value(), target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -1238,9 +1299,12 @@ PROTOBUF_NOINLINE void UInt64Value::Clear() { { // uint64 value = 1; - if (this_._internal_value() != 0) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_value()); + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (this_._internal_value() != 0) { + total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( + this_._internal_value()); + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -1255,9 +1319,13 @@ void UInt64Value::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goo ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_value() != 0) { - _this->_impl_.value_ = from._impl_.value_; + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (from._internal_value() != 0) { + _this->_impl_.value_ = from._impl_.value_; + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -1272,6 +1340,7 @@ void UInt64Value::CopyFrom(const UInt64Value& from) { void UInt64Value::InternalSwap(UInt64Value* PROTOBUF_RESTRICT other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); swap(_impl_.value_, other->_impl_.value_); } @@ -1282,6 +1351,10 @@ void UInt64Value::InternalSwap(UInt64Value* PROTOBUF_RESTRICT other) { class Int32Value::_Internal { public: + using HasBits = + decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Int32Value, _impl_._has_bits_); }; Int32Value::Int32Value(::google::protobuf::Arena* arena) @@ -1368,7 +1441,7 @@ const ::google::protobuf::internal::ClassData* Int32Value::GetClassData() const PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::_pbi::TcParseTable<0, 1, 0, 0, 2> Int32Value::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(Int32Value, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -1385,14 +1458,14 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> Int32Value::_table_ = { #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // int32 value = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Int32Value, _impl_.value_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(Int32Value, _impl_.value_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Int32Value, _impl_.value_), 0>(), + {8, 0, 0, PROTOBUF_FIELD_OFFSET(Int32Value, _impl_.value_)}}, }}, {{ 65535, 65535 }}, {{ // int32 value = 1; - {PROTOBUF_FIELD_OFFSET(Int32Value, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + {PROTOBUF_FIELD_OFFSET(Int32Value, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, }}, // no aux_entries {{ @@ -1407,6 +1480,7 @@ PROTOBUF_NOINLINE void Int32Value::Clear() { (void) cached_has_bits; _impl_.value_ = 0; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -1426,10 +1500,12 @@ PROTOBUF_NOINLINE void Int32Value::Clear() { (void)cached_has_bits; // int32 value = 1; - if (this_._internal_value() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<1>( - stream, this_._internal_value(), target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (this_._internal_value() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<1>( + stream, this_._internal_value(), target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -1457,9 +1533,12 @@ PROTOBUF_NOINLINE void Int32Value::Clear() { { // int32 value = 1; - if (this_._internal_value() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_value()); + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (this_._internal_value() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_value()); + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -1474,9 +1553,13 @@ void Int32Value::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goog ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_value() != 0) { - _this->_impl_.value_ = from._impl_.value_; + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (from._internal_value() != 0) { + _this->_impl_.value_ = from._impl_.value_; + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -1491,6 +1574,7 @@ void Int32Value::CopyFrom(const Int32Value& from) { void Int32Value::InternalSwap(Int32Value* PROTOBUF_RESTRICT other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); swap(_impl_.value_, other->_impl_.value_); } @@ -1501,6 +1585,10 @@ void Int32Value::InternalSwap(Int32Value* PROTOBUF_RESTRICT other) { class UInt32Value::_Internal { public: + using HasBits = + decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(UInt32Value, _impl_._has_bits_); }; UInt32Value::UInt32Value(::google::protobuf::Arena* arena) @@ -1587,7 +1675,7 @@ const ::google::protobuf::internal::ClassData* UInt32Value::GetClassData() const PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::_pbi::TcParseTable<0, 1, 0, 0, 2> UInt32Value::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(UInt32Value, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -1604,14 +1692,14 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> UInt32Value::_table_ = { #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // uint32 value = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(UInt32Value, _impl_.value_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(UInt32Value, _impl_.value_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(UInt32Value, _impl_.value_), 0>(), + {8, 0, 0, PROTOBUF_FIELD_OFFSET(UInt32Value, _impl_.value_)}}, }}, {{ 65535, 65535 }}, {{ // uint32 value = 1; - {PROTOBUF_FIELD_OFFSET(UInt32Value, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUInt32)}, + {PROTOBUF_FIELD_OFFSET(UInt32Value, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUInt32)}, }}, // no aux_entries {{ @@ -1626,6 +1714,7 @@ PROTOBUF_NOINLINE void UInt32Value::Clear() { (void) cached_has_bits; _impl_.value_ = 0u; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -1645,10 +1734,12 @@ PROTOBUF_NOINLINE void UInt32Value::Clear() { (void)cached_has_bits; // uint32 value = 1; - if (this_._internal_value() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt32ToArray( - 1, this_._internal_value(), target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (this_._internal_value() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray( + 1, this_._internal_value(), target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -1676,9 +1767,12 @@ PROTOBUF_NOINLINE void UInt32Value::Clear() { { // uint32 value = 1; - if (this_._internal_value() != 0) { - total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne( - this_._internal_value()); + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (this_._internal_value() != 0) { + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne( + this_._internal_value()); + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -1693,9 +1787,13 @@ void UInt32Value::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goo ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_value() != 0) { - _this->_impl_.value_ = from._impl_.value_; + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (from._internal_value() != 0) { + _this->_impl_.value_ = from._impl_.value_; + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -1710,6 +1808,7 @@ void UInt32Value::CopyFrom(const UInt32Value& from) { void UInt32Value::InternalSwap(UInt32Value* PROTOBUF_RESTRICT other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); swap(_impl_.value_, other->_impl_.value_); } @@ -1720,6 +1819,10 @@ void UInt32Value::InternalSwap(UInt32Value* PROTOBUF_RESTRICT other) { class BoolValue::_Internal { public: + using HasBits = + decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(BoolValue, _impl_._has_bits_); }; BoolValue::BoolValue(::google::protobuf::Arena* arena) @@ -1806,7 +1909,7 @@ const ::google::protobuf::internal::ClassData* BoolValue::GetClassData() const { PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::_pbi::TcParseTable<0, 1, 0, 0, 2> BoolValue::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(BoolValue, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -1823,14 +1926,14 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> BoolValue::_table_ = { #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // bool value = 1; - {::_pbi::TcParser::SingularVarintNoZag1(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(BoolValue, _impl_.value_)}}, + {::_pbi::TcParser::SingularVarintNoZag1(), + {8, 0, 0, PROTOBUF_FIELD_OFFSET(BoolValue, _impl_.value_)}}, }}, {{ 65535, 65535 }}, {{ // bool value = 1; - {PROTOBUF_FIELD_OFFSET(BoolValue, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + {PROTOBUF_FIELD_OFFSET(BoolValue, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kBool)}, }}, // no aux_entries {{ @@ -1845,6 +1948,7 @@ PROTOBUF_NOINLINE void BoolValue::Clear() { (void) cached_has_bits; _impl_.value_ = false; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -1864,10 +1968,12 @@ PROTOBUF_NOINLINE void BoolValue::Clear() { (void)cached_has_bits; // bool value = 1; - if (this_._internal_value() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 1, this_._internal_value(), target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (this_._internal_value() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 1, this_._internal_value(), target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -1895,8 +2001,11 @@ PROTOBUF_NOINLINE void BoolValue::Clear() { { // bool value = 1; - if (this_._internal_value() != 0) { - total_size += 2; + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (this_._internal_value() != 0) { + total_size += 2; + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -1911,9 +2020,13 @@ void BoolValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::googl ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_value() != 0) { - _this->_impl_.value_ = from._impl_.value_; + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (from._internal_value() != 0) { + _this->_impl_.value_ = from._impl_.value_; + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -1928,6 +2041,7 @@ void BoolValue::CopyFrom(const BoolValue& from) { void BoolValue::InternalSwap(BoolValue* PROTOBUF_RESTRICT other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); swap(_impl_.value_, other->_impl_.value_); } @@ -1938,6 +2052,10 @@ void BoolValue::InternalSwap(BoolValue* PROTOBUF_RESTRICT other) { class StringValue::_Internal { public: + using HasBits = + decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(StringValue, _impl_._has_bits_); }; StringValue::StringValue(::google::protobuf::Arena* arena) @@ -1952,8 +2070,9 @@ StringValue::StringValue(::google::protobuf::Arena* arena) inline PROTOBUF_NDEBUG_INLINE StringValue::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const ::google::protobuf::StringValue& from_msg) - : value_(arena, from.value_), - _cached_size_{0} {} + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + value_(arena, from.value_) {} StringValue::StringValue( ::google::protobuf::Arena* arena, @@ -1974,8 +2093,8 @@ StringValue::StringValue( inline PROTOBUF_NDEBUG_INLINE StringValue::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : value_(arena), - _cached_size_{0} {} + : _cached_size_{0}, + value_(arena) {} inline void StringValue::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -2036,7 +2155,7 @@ const ::google::protobuf::internal::ClassData* StringValue::GetClassData() const PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::_pbi::TcParseTable<0, 1, 0, 41, 2> StringValue::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(StringValue, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -2054,13 +2173,13 @@ const ::_pbi::TcParseTable<0, 1, 0, 41, 2> StringValue::_table_ = { }, {{ // string value = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(StringValue, _impl_.value_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(StringValue, _impl_.value_)}}, }}, {{ 65535, 65535 }}, {{ // string value = 1; - {PROTOBUF_FIELD_OFFSET(StringValue, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(StringValue, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, }}, // no aux_entries {{ @@ -2077,7 +2196,11 @@ PROTOBUF_NOINLINE void StringValue::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.value_.ClearToEmpty(); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + _impl_.value_.ClearToEmpty(); + } + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -2097,11 +2220,13 @@ PROTOBUF_NOINLINE void StringValue::Clear() { (void)cached_has_bits; // string value = 1; - if (!this_._internal_value().empty()) { - const std::string& _s = this_._internal_value(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.StringValue.value"); - target = stream->WriteStringMaybeAliased(1, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_value().empty()) { + const std::string& _s = this_._internal_value(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.StringValue.value"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -2129,9 +2254,12 @@ PROTOBUF_NOINLINE void StringValue::Clear() { { // string value = 1; - if (!this_._internal_value().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_value()); + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (!this_._internal_value().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_value()); + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -2146,9 +2274,13 @@ void StringValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goo ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (!from._internal_value().empty()) { - _this->_internal_set_value(from._internal_value()); + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (!from._internal_value().empty()) { + _this->_internal_set_value(from._internal_value()); + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -2165,6 +2297,7 @@ void StringValue::InternalSwap(StringValue* PROTOBUF_RESTRICT other) { auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.value_, &other->_impl_.value_, arena); } @@ -2175,6 +2308,10 @@ void StringValue::InternalSwap(StringValue* PROTOBUF_RESTRICT other) { class BytesValue::_Internal { public: + using HasBits = + decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(BytesValue, _impl_._has_bits_); }; BytesValue::BytesValue(::google::protobuf::Arena* arena) @@ -2189,8 +2326,9 @@ BytesValue::BytesValue(::google::protobuf::Arena* arena) inline PROTOBUF_NDEBUG_INLINE BytesValue::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const ::google::protobuf::BytesValue& from_msg) - : value_(arena, from.value_), - _cached_size_{0} {} + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + value_(arena, from.value_) {} BytesValue::BytesValue( ::google::protobuf::Arena* arena, @@ -2211,8 +2349,8 @@ BytesValue::BytesValue( inline PROTOBUF_NDEBUG_INLINE BytesValue::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : value_(arena), - _cached_size_{0} {} + : _cached_size_{0}, + value_(arena) {} inline void BytesValue::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -2273,7 +2411,7 @@ const ::google::protobuf::internal::ClassData* BytesValue::GetClassData() const PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::_pbi::TcParseTable<0, 1, 0, 0, 2> BytesValue::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(BytesValue, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -2291,13 +2429,13 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> BytesValue::_table_ = { }, {{ // bytes value = 1; {::_pbi::TcParser::FastBS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(BytesValue, _impl_.value_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(BytesValue, _impl_.value_)}}, }}, {{ 65535, 65535 }}, {{ // bytes value = 1; - {PROTOBUF_FIELD_OFFSET(BytesValue, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBytes | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(BytesValue, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, }}, // no aux_entries {{ @@ -2311,7 +2449,11 @@ PROTOBUF_NOINLINE void BytesValue::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.value_.ClearToEmpty(); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + _impl_.value_.ClearToEmpty(); + } + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -2331,9 +2473,11 @@ PROTOBUF_NOINLINE void BytesValue::Clear() { (void)cached_has_bits; // bytes value = 1; - if (!this_._internal_value().empty()) { - const std::string& _s = this_._internal_value(); - target = stream->WriteBytesMaybeAliased(1, _s, target); + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_value().empty()) { + const std::string& _s = this_._internal_value(); + target = stream->WriteBytesMaybeAliased(1, _s, target); + } } if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { @@ -2361,9 +2505,12 @@ PROTOBUF_NOINLINE void BytesValue::Clear() { { // bytes value = 1; - if (!this_._internal_value().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( - this_._internal_value()); + cached_has_bits = this_._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (!this_._internal_value().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( + this_._internal_value()); + } } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -2378,9 +2525,13 @@ void BytesValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goog ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (!from._internal_value().empty()) { - _this->_internal_set_value(from._internal_value()); + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + if (!from._internal_value().empty()) { + _this->_internal_set_value(from._internal_value()); + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -2397,6 +2548,7 @@ void BytesValue::InternalSwap(BytesValue* PROTOBUF_RESTRICT other) { auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.value_, &other->_impl_.value_, arena); } diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h index faf787c7e7..f5f1caa12a 100644 --- a/src/google/protobuf/wrappers.pb.h +++ b/src/google/protobuf/wrappers.pb.h @@ -283,8 +283,9 @@ class PROTOBUF_EXPORT UInt64Value final inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const UInt64Value& from_msg); - ::uint64_t value_; + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + ::uint64_t value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -477,8 +478,9 @@ class PROTOBUF_EXPORT UInt32Value final inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const UInt32Value& from_msg); - ::uint32_t value_; + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + ::uint32_t value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -677,8 +679,9 @@ class PROTOBUF_EXPORT StringValue final inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const StringValue& from_msg); - ::google::protobuf::internal::ArenaStringPtr value_; + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + ::google::protobuf::internal::ArenaStringPtr value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -871,8 +874,9 @@ class PROTOBUF_EXPORT Int64Value final inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const Int64Value& from_msg); - ::int64_t value_; + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + ::int64_t value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -1065,8 +1069,9 @@ class PROTOBUF_EXPORT Int32Value final inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const Int32Value& from_msg); - ::int32_t value_; + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + ::int32_t value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -1259,8 +1264,9 @@ class PROTOBUF_EXPORT FloatValue final inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const FloatValue& from_msg); - float value_; + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + float value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -1453,8 +1459,9 @@ class PROTOBUF_EXPORT DoubleValue final inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const DoubleValue& from_msg); - double value_; + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + double value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -1653,8 +1660,9 @@ class PROTOBUF_EXPORT BytesValue final inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const BytesValue& from_msg); - ::google::protobuf::internal::ArenaStringPtr value_; + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + ::google::protobuf::internal::ArenaStringPtr value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -1847,8 +1855,9 @@ class PROTOBUF_EXPORT BoolValue final inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, const BoolValue& from_msg); - bool value_; + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + bool value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -1877,6 +1886,7 @@ PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull BoolVal inline void DoubleValue::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_ = 0; + _impl_._has_bits_[0] &= ~0x00000001u; } inline double DoubleValue::value() const { // @@protoc_insertion_point(field_get:google.protobuf.DoubleValue.value) @@ -1884,6 +1894,7 @@ inline double DoubleValue::value() const { } inline void DoubleValue::set_value(double value) { _internal_set_value(value); + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:google.protobuf.DoubleValue.value) } inline double DoubleValue::_internal_value() const { @@ -1903,6 +1914,7 @@ inline void DoubleValue::_internal_set_value(double value) { inline void FloatValue::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_ = 0; + _impl_._has_bits_[0] &= ~0x00000001u; } inline float FloatValue::value() const { // @@protoc_insertion_point(field_get:google.protobuf.FloatValue.value) @@ -1910,6 +1922,7 @@ inline float FloatValue::value() const { } inline void FloatValue::set_value(float value) { _internal_set_value(value); + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:google.protobuf.FloatValue.value) } inline float FloatValue::_internal_value() const { @@ -1929,6 +1942,7 @@ inline void FloatValue::_internal_set_value(float value) { inline void Int64Value::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_ = ::int64_t{0}; + _impl_._has_bits_[0] &= ~0x00000001u; } inline ::int64_t Int64Value::value() const { // @@protoc_insertion_point(field_get:google.protobuf.Int64Value.value) @@ -1936,6 +1950,7 @@ inline ::int64_t Int64Value::value() const { } inline void Int64Value::set_value(::int64_t value) { _internal_set_value(value); + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:google.protobuf.Int64Value.value) } inline ::int64_t Int64Value::_internal_value() const { @@ -1955,6 +1970,7 @@ inline void Int64Value::_internal_set_value(::int64_t value) { inline void UInt64Value::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_ = ::uint64_t{0u}; + _impl_._has_bits_[0] &= ~0x00000001u; } inline ::uint64_t UInt64Value::value() const { // @@protoc_insertion_point(field_get:google.protobuf.UInt64Value.value) @@ -1962,6 +1978,7 @@ inline ::uint64_t UInt64Value::value() const { } inline void UInt64Value::set_value(::uint64_t value) { _internal_set_value(value); + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:google.protobuf.UInt64Value.value) } inline ::uint64_t UInt64Value::_internal_value() const { @@ -1981,6 +1998,7 @@ inline void UInt64Value::_internal_set_value(::uint64_t value) { inline void Int32Value::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_ = 0; + _impl_._has_bits_[0] &= ~0x00000001u; } inline ::int32_t Int32Value::value() const { // @@protoc_insertion_point(field_get:google.protobuf.Int32Value.value) @@ -1988,6 +2006,7 @@ inline ::int32_t Int32Value::value() const { } inline void Int32Value::set_value(::int32_t value) { _internal_set_value(value); + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:google.protobuf.Int32Value.value) } inline ::int32_t Int32Value::_internal_value() const { @@ -2007,6 +2026,7 @@ inline void Int32Value::_internal_set_value(::int32_t value) { inline void UInt32Value::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_ = 0u; + _impl_._has_bits_[0] &= ~0x00000001u; } inline ::uint32_t UInt32Value::value() const { // @@protoc_insertion_point(field_get:google.protobuf.UInt32Value.value) @@ -2014,6 +2034,7 @@ inline ::uint32_t UInt32Value::value() const { } inline void UInt32Value::set_value(::uint32_t value) { _internal_set_value(value); + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:google.protobuf.UInt32Value.value) } inline ::uint32_t UInt32Value::_internal_value() const { @@ -2033,6 +2054,7 @@ inline void UInt32Value::_internal_set_value(::uint32_t value) { inline void BoolValue::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_ = false; + _impl_._has_bits_[0] &= ~0x00000001u; } inline bool BoolValue::value() const { // @@protoc_insertion_point(field_get:google.protobuf.BoolValue.value) @@ -2040,6 +2062,7 @@ inline bool BoolValue::value() const { } inline void BoolValue::set_value(bool value) { _internal_set_value(value); + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:google.protobuf.BoolValue.value) } inline bool BoolValue::_internal_value() const { @@ -2059,6 +2082,7 @@ inline void BoolValue::_internal_set_value(bool value) { inline void StringValue::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& StringValue::value() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2069,6 +2093,7 @@ template inline PROTOBUF_ALWAYS_INLINE void StringValue::set_value(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.value_.Set(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.StringValue.value) } @@ -2083,19 +2108,34 @@ inline const std::string& StringValue::_internal_value() const { } inline void StringValue::_internal_set_value(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.value_.Set(value, GetArena()); } inline std::string* StringValue::_internal_mutable_value() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.value_.Mutable( GetArena()); } inline std::string* StringValue::release_value() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.StringValue.value) - return _impl_.value_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.value_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.value_.Set("", GetArena()); + } + return released; } inline void StringValue::set_allocated_value(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.value_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.value_.IsDefault()) { _impl_.value_.Set("", GetArena()); @@ -2111,6 +2151,7 @@ inline void StringValue::set_allocated_value(std::string* value) { inline void BytesValue::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& BytesValue::value() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2121,6 +2162,7 @@ template inline PROTOBUF_ALWAYS_INLINE void BytesValue::set_value(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.value_.SetBytes(static_cast(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.BytesValue.value) } @@ -2135,19 +2177,34 @@ inline const std::string& BytesValue::_internal_value() const { } inline void BytesValue::_internal_set_value(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.value_.Set(value, GetArena()); } inline std::string* BytesValue::_internal_mutable_value() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.value_.Mutable( GetArena()); } inline std::string* BytesValue::release_value() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.BytesValue.value) - return _impl_.value_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.value_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.value_.Set("", GetArena()); + } + return released; } inline void BytesValue::set_allocated_value(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.value_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.value_.IsDefault()) { _impl_.value_.Set("", GetArena());