diff --git a/src/google/protobuf/BUILD.bazel b/src/google/protobuf/BUILD.bazel index 42388e42944ce..fc35db7332c93 100644 --- a/src/google/protobuf/BUILD.bazel +++ b/src/google/protobuf/BUILD.bazel @@ -659,6 +659,7 @@ cc_library( "has_bits.h", "implicit_weak_message.h", "inlined_string_field.h", + "internal_metadata_locator.h", "map.h", "map_field_lite.h", "map_type_handler.h", @@ -887,6 +888,25 @@ cc_test( ], ) +cc_test( + name = "internal_metadata_locator_test", + size = "small", + srcs = [ + "internal_metadata_locator_test.cc", + ], + deps = [ + ":arena", + ":port", + ":protobuf", + ":protobuf_lite", + ":test_util2", + ":unittest_cc_proto", + "//src/google/protobuf/io", + "@googletest//:gtest", + "@googletest//:gtest_main", + ], +) + # This provides just the header files for use in projects that need to build # shared libraries for dynamic loading. This target is available until Bazel # adds native support for such use cases. diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h index 5884a9a558bda..4f423af3bbb01 100644 --- a/src/google/protobuf/arena.h +++ b/src/google/protobuf/arena.h @@ -446,10 +446,19 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena* PROTOBUF_NULLABLE arena, Args&&... args) { if constexpr (internal::IsRepeatedPtrFieldType::value) { - using ArenaRepT = typename internal::RepeatedPtrFieldArenaRep::Type; - auto* arena_repr = - new (ptr) ArenaRepT(arena, static_cast(args)...); - return arena_repr; + if (ABSL_PREDICT_FALSE(arena == nullptr)) { + return new (ptr) T(static_cast(args)...); + } else { + using ArenaRepT = + typename internal::RepeatedPtrFieldArenaRep::Type; + auto* arena_repr = + new (ptr) ArenaRepT(arena, static_cast(args)...); +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + return &arena_repr->field(); +#else + return arena_repr; +#endif + } } else { return new (ptr) T(arena, static_cast(args)...); } @@ -559,7 +568,11 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) using ArenaRepT = typename internal::RepeatedPtrFieldArenaRep::Type; auto* arena_repr = arena->DoCreateMessage(static_cast(args)...); +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + return &arena_repr->field(); +#else return arena_repr; +#endif } } diff --git a/src/google/protobuf/arena_unittest.cc b/src/google/protobuf/arena_unittest.cc index 265977e23be33..f5a601462d7dd 100644 --- a/src/google/protobuf/arena_unittest.cc +++ b/src/google/protobuf/arena_unittest.cc @@ -493,7 +493,12 @@ TEST(ArenaTest, RepeatedPtrFieldMoveCtorOnArena) { TestUtil::ExpectAllFieldsSet(moved->Get(0)); // The only extra allocation with moves is sizeof(RepeatedPtrField). +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + EXPECT_EQ(usage_by_move, + sizeof(internal::RepeatedPtrFieldWithArena)); +#else EXPECT_EQ(usage_by_move, sizeof(internal::RepeatedPtrFieldBase)); +#endif EXPECT_LT(usage_by_move + sizeof(TestAllTypes), usage_original); // Status after move is unspecified and must not be assumed. It's merely diff --git a/src/google/protobuf/compiler/cpp/field.cc b/src/google/protobuf/compiler/cpp/field.cc index 24ee2c081daac..4ff9207e7fce9 100644 --- a/src/google/protobuf/compiler/cpp/field.cc +++ b/src/google/protobuf/compiler/cpp/field.cc @@ -39,9 +39,20 @@ namespace google { namespace protobuf { namespace compiler { namespace cpp { + +namespace { using ::google::protobuf::internal::WireFormat; using Sub = ::google::protobuf::io::Printer::Sub; +void InternalMetadataOffsetFormatString(io::Printer* p) { + p->Emit(R"cc( + $pbi$::InternalMetadataOffset::Build< + $classtype$, offsetof($classtype$, _impl_.$name$_)>() + )cc"); +} + +} // namespace + std::vector FieldVars(const FieldDescriptor* field, const Options& opts) { bool split = ShouldSplit(field, opts); std::vector vars = { @@ -156,7 +167,19 @@ void FieldGeneratorBase::GenerateMemberConstexprConstructor( io::Printer* p) const { ABSL_CHECK(!field_->is_extension()); if (field_->is_repeated()) { - p->Emit("$name$_{}"); + if (IsRepeatedPtrField(field_)) { + p->Emit({{"internal_metadata_offset", + [p] { InternalMetadataOffsetFormatString(p); }}}, + R"cc( +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + $name$_{visibility, $internal_metadata_offset$} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + $name$_ {} +#endif + )cc"); + } else { + p->Emit("$name$_{}"); + } } else { p->Emit({{"default", DefaultValue(options_, field_)}}, "$name$_{$default$}"); @@ -170,6 +193,16 @@ void FieldGeneratorBase::GenerateMemberConstructor(io::Printer* p) const { } else if (field_->is_repeated()) { if (ShouldSplit(field_, options_)) { p->Emit("$name$_{}"); // RawPtr + } else if (IsRepeatedPtrField(field_)) { + p->Emit({{"internal_metadata_offset", + [p] { InternalMetadataOffsetFormatString(p); }}}, + R"cc( +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + $name$_{visibility, $internal_metadata_offset$} +#else + $name$_ { visibility, arena } +#endif + )cc"); } else { p->Emit("$name$_{visibility, arena}"); } @@ -182,7 +215,19 @@ void FieldGeneratorBase::GenerateMemberConstructor(io::Printer* p) const { void FieldGeneratorBase::GenerateMemberCopyConstructor(io::Printer* p) const { ABSL_CHECK(!field_->is_extension()); if (field_->is_repeated()) { - p->Emit("$name$_{visibility, arena, from.$name$_}"); + if (IsRepeatedPtrField(field_)) { + p->Emit({{"internal_metadata_offset", + [p] { InternalMetadataOffsetFormatString(p); }}}, + R"cc( +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + $name$_{visibility, ($internal_metadata_offset$), from.$name$_} +#else + $name$_ { visibility, arena, from.$name$_ } +#endif + )cc"); + } else { + p->Emit("$name$_{visibility, arena, from.$name$_}"); + } } else { p->Emit("$name$_{from.$name$_}"); } diff --git a/src/google/protobuf/compiler/cpp/field_generators/message_field.cc b/src/google/protobuf/compiler/cpp/field_generators/message_field.cc index 913662c6ce02e..7282ce9cc12fe 100644 --- a/src/google/protobuf/compiler/cpp/field_generators/message_field.cc +++ b/src/google/protobuf/compiler/cpp/field_generators/message_field.cc @@ -740,6 +740,8 @@ class RepeatedMessage : public FieldGeneratorBase { void GenerateIsInitialized(io::Printer* p) const override; bool NeedsIsInitialized() const override; + bool RequiresArena(GeneratorFunction function) const override; + private: const Options* opts_; bool has_required_; @@ -748,7 +750,11 @@ class RepeatedMessage : public FieldGeneratorBase { void RepeatedMessage::GeneratePrivateMembers(io::Printer* p) const { if (should_split()) { p->Emit(R"cc( +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + $pbi$::RawPtr<$pbi$::$Weak$RepeatedPtrFieldWithArena<$Submsg$>> $name$_; +#else $pbi$::RawPtr<$pb$::$Weak$RepeatedPtrField<$Submsg$>> $name$_; +#endif )cc"); } else { p->Emit("$pb$::$Weak$RepeatedPtrField< $Submsg$ > $name$_;\n"); @@ -831,7 +837,8 @@ void RepeatedMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const { ABSL_ATTRIBUTE_LIFETIME_BOUND { $WeakDescriptorSelfPin$; $TsanDetectConcurrentMutation$; - $Submsg$* _add = _internal_mutable_$name_internal$()->Add(); + $Submsg$* _add = _internal_mutable_$name_internal$()->AddWithArena( + $pb$::MessageLite::internal_visibility(), GetArena()); $set_hasbit$; $annotate_add_mutable$; // @@protoc_insertion_point(field_add:$pkg.Msg.field$) @@ -854,17 +861,31 @@ void RepeatedMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const { inline const $pb$::$Weak$RepeatedPtrField<$Submsg$>& $Msg$::_internal$_weak$_$name_internal$() const { $TsanDetectConcurrentRead$; +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + return $field_$->field(); +#else return *$field_$; +#endif } inline $pb$::$Weak$RepeatedPtrField<$Submsg$>* $nonnull$ $Msg$::_internal_mutable$_weak$_$name_internal$() { $TsanDetectConcurrentRead$; $PrepareSplitMessageForWrite$; if ($field_$.IsDefault()) { +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + $field_$.Set($superclass$::DefaultConstruct< + $pbi$::$Weak$RepeatedPtrFieldWithArena<$Submsg$>>( + GetArena())); +#else $field_$.Set($superclass$::DefaultConstruct< $pb$::$Weak$RepeatedPtrField<$Submsg$>>(GetArena())); +#endif } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + return &$field_$->field(); +#else return $field_$.Get(); +#endif } )cc"); } else { @@ -908,7 +929,8 @@ void RepeatedMessage::GenerateMergingCode(io::Printer* p) const { // `if (!from.empty()) { body(); }` for both split and non-split cases. auto body = [&] { p->Emit(R"cc( - _this->_internal_mutable$_weak$_$name$()->MergeFrom( + _this->_internal_mutable$_weak$_$name$()->MergeFromWithArena( + $pb$::MessageLite::internal_visibility(), arena, from._internal$_weak$_$name$()); )cc"); }; @@ -940,7 +962,9 @@ void RepeatedMessage::GenerateCopyConstructorCode(io::Printer* p) const { if (should_split()) { p->Emit(R"cc( if (!from._internal$_weak$_$name$().empty()) { - _internal_mutable$_weak$_$name$()->MergeFrom(from._internal$_weak$_$name$()); + _internal_mutable$_weak$_$name$()->MergeFromWithArena( + $pb$::MessageLite::internal_visibility(), arena, + from._internal$_weak$_$name$()); } )cc"); } @@ -1047,6 +1071,15 @@ void RepeatedMessage::GenerateIsInitialized(io::Printer* p) const { } bool RepeatedMessage::NeedsIsInitialized() const { return has_required_; } + +bool RepeatedMessage::RequiresArena(GeneratorFunction func) const { + switch (func) { + case GeneratorFunction::kMergeFrom: + return true; + } + return false; +} + } // namespace std::unique_ptr MakeSinguarMessageGenerator( diff --git a/src/google/protobuf/compiler/cpp/field_generators/string_field.cc b/src/google/protobuf/compiler/cpp/field_generators/string_field.cc index 510821c1e7945..b1184e6f5652e 100644 --- a/src/google/protobuf/compiler/cpp/field_generators/string_field.cc +++ b/src/google/protobuf/compiler/cpp/field_generators/string_field.cc @@ -753,12 +753,22 @@ class RepeatedString : public FieldGeneratorBase { } } + bool RequiresArena(GeneratorFunction function) const override { + switch (function) { + case GeneratorFunction::kMergeFrom: + return true; + } + return false; + } + void GenerateMergingCode(io::Printer* p) const override { // TODO: experiment with simplifying this to be // `if (!from.empty()) { body(); }` for both split and non-split cases. auto body = [&] { p->Emit(R"cc( - _this->_internal_mutable_$name$()->MergeFrom(from._internal_$name$()); + _this->_internal_mutable_$name$()->MergeFromWithArena( + $pb$::MessageLite::internal_visibility(), arena, + from._internal_$name$()); )cc"); }; if (!should_split()) { @@ -793,7 +803,9 @@ class RepeatedString : public FieldGeneratorBase { if (should_split()) { p->Emit(R"cc( if (!from._internal_$name$().empty()) { - _internal_mutable_$name$()->MergeFrom(from._internal_$name$()); + _internal_mutable_$name$()->MergeFromWithArena( + $pb$::MessageLite::internal_visibility(), arena, + from._internal_$name$()); } )cc"); } @@ -869,7 +881,8 @@ void RepeatedString::GenerateInlineAccessorDefinitions(io::Printer* p) const { ABSL_ATTRIBUTE_LIFETIME_BOUND { $WeakDescriptorSelfPin$; $TsanDetectConcurrentMutation$; - ::std::string* _s = _internal_mutable_$name_internal$()->Add(); + ::std::string* _s = _internal_mutable_$name_internal$()->AddWithArena( + $pb$::MessageLite::internal_visibility(), GetArena()); $set_hasbit$; $annotate_add_mutable$; // @@protoc_insertion_point(field_add_mutable:$pkg.Msg.field$) @@ -907,9 +920,10 @@ void RepeatedString::GenerateInlineAccessorDefinitions(io::Printer* p) const { inline void $Msg$::add_$name$(Arg_&& value, Args_... args) { $WeakDescriptorSelfPin$; $TsanDetectConcurrentMutation$; - $pbi$::AddToRepeatedPtrField(*_internal_mutable_$name_internal$(), - ::std::forward(value), - args... $bytes_tag$); + $pbi$::AddToRepeatedPtrField( + $pb$::MessageLite::internal_visibility(), GetArena(), + *_internal_mutable_$name_internal$(), ::std::forward(value), + args... $bytes_tag$); $set_hasbit$; $annotate_add$; // @@protoc_insertion_point(field_add:$pkg.Msg.field$) diff --git a/src/google/protobuf/compiler/cpp/field_generators/string_view_field.cc b/src/google/protobuf/compiler/cpp/field_generators/string_view_field.cc index e38412472aaf9..9836d95b59997 100644 --- a/src/google/protobuf/compiler/cpp/field_generators/string_view_field.cc +++ b/src/google/protobuf/compiler/cpp/field_generators/string_view_field.cc @@ -630,12 +630,22 @@ class RepeatedStringView : public FieldGeneratorBase { } } + bool RequiresArena(GeneratorFunction function) const override { + switch (function) { + case GeneratorFunction::kMergeFrom: + return true; + } + return false; + } + void GenerateMergingCode(io::Printer* p) const override { // TODO: experiment with simplifying this to be // `if (!from.empty()) { body(); }` for both split and non-split cases. auto body = [&] { p->Emit(R"cc( - _this->_internal_mutable_$name$()->MergeFrom(from._internal_$name$()); + _this->_internal_mutable_$name$()->MergeFromWithArena( + $pb$::MessageLite::internal_visibility(), arena, + from._internal_$name$()); )cc"); }; if (!should_split()) { @@ -670,7 +680,9 @@ class RepeatedStringView : public FieldGeneratorBase { if (should_split()) { p->Emit(R"cc( if (!from._internal_$name$().empty()) { - _internal_mutable_$name$()->MergeFrom(from._internal_$name$()); + _internal_mutable_$name$()->MergeFromWithArena( + $pb$::MessageLite::internal_visibility(), arena, + from._internal_$name$()); } )cc"); } @@ -757,7 +769,9 @@ void RepeatedStringView::GenerateInlineAccessorDefinitions( inline void $Msg$::add_$name$(Arg_&& value) { $WeakDescriptorSelfPin$; $TsanDetectConcurrentMutation$; - $pbi$::AddToRepeatedPtrField(*_internal_mutable_$name_internal$(), + $pbi$::AddToRepeatedPtrField($pb$::MessageLite::internal_visibility(), + GetArena(), + *_internal_mutable_$name_internal$(), ::std::forward(value) $bytes_tag$); $set_hasbit$; $annotate_add$; diff --git a/src/google/protobuf/compiler/cpp/message.cc b/src/google/protobuf/compiler/cpp/message.cc index 8f00975a82216..005412337d418 100644 --- a/src/google/protobuf/compiler/cpp/message.cc +++ b/src/google/protobuf/compiler/cpp/message.cc @@ -1722,7 +1722,8 @@ void MessageGenerator::GenerateImplDefinition(io::Printer* p) { struct Impl_ { //~ TODO: check if/when there is a need for an //~ outline dtor. - inline explicit constexpr Impl_($pbi$::ConstantInitialized) noexcept; + inline explicit constexpr Impl_($pbi$::InternalVisibility visibility, + $pbi$::ConstantInitialized) noexcept; inline explicit Impl_( //~ $pbi$::InternalVisibility visibility, @@ -3198,6 +3199,7 @@ void MessageGenerator::GenerateConstexprConstructor(io::Printer* p) { p->Emit({{"init", [&] { GenerateImplMemberInit(p, InitType::kConstexpr); }}}, R"cc( inline constexpr $classname$::Impl_::Impl_( + [[maybe_unused]] $pbi$::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept //~ $init$ {} @@ -3213,7 +3215,7 @@ void MessageGenerator::GenerateConstexprConstructor(io::Printer* p) { #else // PROTOBUF_CUSTOM_VTABLE : $superclass$(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } )cc"); } @@ -3963,7 +3965,7 @@ void MessageGenerator::GenerateSwap(io::Printer* p) { } MessageGenerator::NewOpRequirements MessageGenerator::GetNewOp( - io::Printer* arena_emitter) const { + io::Printer* arena_emitter, bool without_rpf_arena_ptrs) const { size_t arena_seeding_count = 0; NewOpRequirements op; if (IsBootstrapProto(options_, descriptor_->file())) { @@ -4023,8 +4025,12 @@ MessageGenerator::NewOpRequirements MessageGenerator::GetNewOp( print_arena_offset("Alt"); } } else if (field->is_repeated()) { - op.needs_arena_seeding = true; - print_arena_offset(); + if (without_rpf_arena_ptrs && IsRepeatedPtrField(field)) { + op.needs_memcpy = true; + } else { + op.needs_arena_seeding = true; + print_arena_offset(); + } } else { const auto& generator = field_generators_.get(field); if (generator.has_trivial_zero_default()) { @@ -4078,20 +4084,9 @@ MessageGenerator::NewOpRequirements MessageGenerator::GetNewOp( return op; } -void MessageGenerator::GenerateClassData(io::Printer* p) { - const auto new_op = GetNewOp(nullptr); - // Always generate PlacementNew_ because we might need it for different - // reasons. EnableCustomNewFor might be false in this compiler, or the - // object might be too large for arena seeding. - // We mark `inline` to avoid library bloat if the function is unused. - p->Emit(R"cc( - inline void* $nonnull$ $classname$::PlacementNew_( - //~ - const void* $nonnull$, void* $nonnull$ mem, - $pb$::Arena* $nullable$ arena) { - return ::new (mem) $classname$(arena); - } - )cc"); +void MessageGenerator::GenerateNewOp(io::Printer* p, + bool without_rpf_arena_ptrs) const { + const auto new_op = GetNewOp(nullptr, without_rpf_arena_ptrs); if (new_op.needs_to_run_constructor) { p->Emit(R"cc( constexpr auto $classname$::InternalNewImpl_() { @@ -4101,7 +4096,7 @@ void MessageGenerator::GenerateClassData(io::Printer* p) { )cc"); } else if (new_op.needs_arena_seeding) { p->Emit({{"copy_type", new_op.needs_memcpy ? "CopyInit" : "ZeroInit"}, - {"arena_offsets", [&] { GetNewOp(p); }}}, + {"arena_offsets", [&] { GetNewOp(p, without_rpf_arena_ptrs); }}}, R"cc( constexpr auto $classname$::InternalNewImpl_() { constexpr auto arena_bits = $pbi$::EncodePlacementArenaOffsets({ @@ -4118,8 +4113,7 @@ void MessageGenerator::GenerateClassData(io::Printer* p) { } )cc"); } else { - p->Emit({{"copy_type", new_op.needs_memcpy ? "CopyInit" : "ZeroInit"}, - {"arena_offsets", [&] { GetNewOp(p); }}}, + p->Emit({{"copy_type", new_op.needs_memcpy ? "CopyInit" : "ZeroInit"}}, R"cc( constexpr auto $classname$::InternalNewImpl_() { return $pbi$::MessageCreator::$copy_type$(sizeof($classname$), @@ -4127,6 +4121,39 @@ void MessageGenerator::GenerateClassData(io::Printer* p) { } )cc"); } +} + +void MessageGenerator::GenerateClassData(io::Printer* p) { + // Always generate PlacementNew_ because we might need it for different + // reasons. EnableCustomNewFor might be false in this compiler, or the + // object might be too large for arena seeding. + // We mark `inline` to avoid library bloat if the function is unused. + p->Emit(R"cc( + inline void* $nonnull$ $classname$::PlacementNew_( + //~ + const void* $nonnull$, void* $nonnull$ mem, + $pb$::Arena* $nullable$ arena) { + return ::new (mem) $classname$(arena); + } + )cc"); + + if (absl::c_any_of(FieldRange(descriptor_), [](const FieldDescriptor* field) { + return IsRepeatedPtrField(field); + })) { + p->Emit({{"new_op", + [&] { GenerateNewOp(p, /*without_rpf_arena_ptrs=*/false); }}, + {"new_op_without_rpf_arena_ptrs", + [&] { GenerateNewOp(p, /*without_rpf_arena_ptrs=*/true); }}}, + R"cc( +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + $new_op_without_rpf_arena_ptrs$; +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + $new_op$; +#endif + )cc"); + } else { + GenerateNewOp(p, /*without_rpf_arena_ptrs=*/false); + } auto vars = p->WithVars( {{"default_instance", diff --git a/src/google/protobuf/compiler/cpp/message.h b/src/google/protobuf/compiler/cpp/message.h index 60f697c33ef47..04ea49e252f25 100644 --- a/src/google/protobuf/compiler/cpp/message.h +++ b/src/google/protobuf/compiler/cpp/message.h @@ -148,7 +148,9 @@ class MessageGenerator { // Some field has logic that needs to run. bool needs_to_run_constructor = false; }; - NewOpRequirements GetNewOp(io::Printer* arena_emitter) const; + NewOpRequirements GetNewOp(io::Printer* arena_emitter, + bool without_rpf_arena_ptrs) const; + void GenerateNewOp(io::Printer* p, bool without_rpf_arena_ptrs) const; // Helpers for GenerateSerializeWithCachedSizes(). diff --git a/src/google/protobuf/compiler/java/java_features.pb.cc b/src/google/protobuf/compiler/java/java_features.pb.cc index 3647880ec856c..e06e4f5e371e9 100644 --- a/src/google/protobuf/compiler/java/java_features.pb.cc +++ b/src/google/protobuf/compiler/java/java_features.pb.cc @@ -45,6 +45,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOC_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 JavaFeatures_NestInFileClassFeatureDefaultTypeInternal _JavaFeatures_NestInFileClassFeature_default_instance_; inline constexpr JavaFeatures::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, utf8_validation_{static_cast< ::pb::JavaFeatures_Utf8Validation >(0)}, @@ -60,7 +61,7 @@ PROTOBUF_CONSTEXPR JavaFeatures::JavaFeatures(::_pbi::ConstantInitialized) #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct JavaFeaturesDefaultTypeInternal { PROTOBUF_CONSTEXPR JavaFeaturesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} diff --git a/src/google/protobuf/compiler/java/java_features.pb.h b/src/google/protobuf/compiler/java/java_features.pb.h index 411361551a18c..2f28b1f812d6a 100644 --- a/src/google/protobuf/compiler/java/java_features.pb.h +++ b/src/google/protobuf/compiler/java/java_features.pb.h @@ -551,7 +551,8 @@ class PROTOC_EXPORT JavaFeatures final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index 6c0b502f07acb..a2877e84f0277 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -29,6 +29,7 @@ namespace protobuf { namespace compiler { inline constexpr Version::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, suffix_( @@ -45,7 +46,7 @@ PROTOBUF_CONSTEXPR Version::Version(::_pbi::ConstantInitialized) #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct VersionDefaultTypeInternal { PROTOBUF_CONSTEXPR VersionDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} @@ -59,6 +60,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOC_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 VersionDefaultTypeInternal _Version_default_instance_; inline constexpr CodeGeneratorResponse_File::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, name_( @@ -79,7 +81,7 @@ PROTOBUF_CONSTEXPR CodeGeneratorResponse_File::CodeGeneratorResponse_File(::_pbi #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct CodeGeneratorResponse_FileDefaultTypeInternal { PROTOBUF_CONSTEXPR CodeGeneratorResponse_FileDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} @@ -93,9 +95,17 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOC_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 CodeGeneratorResponse_FileDefaultTypeInternal _CodeGeneratorResponse_File_default_instance_; inline constexpr CodeGeneratorResponse::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, - file_{}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + file_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::compiler::CodeGeneratorResponse, offsetof(::google::protobuf::compiler::CodeGeneratorResponse, _impl_.file_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + file_ {} + #endif + , error_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), @@ -110,7 +120,7 @@ PROTOBUF_CONSTEXPR CodeGeneratorResponse::CodeGeneratorResponse(::_pbi::Constant #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct CodeGeneratorResponseDefaultTypeInternal { PROTOBUF_CONSTEXPR CodeGeneratorResponseDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} @@ -124,15 +134,37 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOC_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 CodeGeneratorResponseDefaultTypeInternal _CodeGeneratorResponse_default_instance_; inline constexpr CodeGeneratorRequest::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, - file_to_generate_{}, - proto_file_{}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + file_to_generate_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::compiler::CodeGeneratorRequest, offsetof(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.file_to_generate_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + file_to_generate_ {} + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + proto_file_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::compiler::CodeGeneratorRequest, offsetof(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.proto_file_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + proto_file_ {} + #endif + , parameter_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), compiler_version_{nullptr}, - source_file_descriptors_{} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + source_file_descriptors_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::compiler::CodeGeneratorRequest, offsetof(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.source_file_descriptors_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + source_file_descriptors_ {} + #endif + {} template PROTOBUF_CONSTEXPR CodeGeneratorRequest::CodeGeneratorRequest(::_pbi::ConstantInitialized) @@ -141,7 +173,7 @@ PROTOBUF_CONSTEXPR CodeGeneratorRequest::CodeGeneratorRequest(::_pbi::ConstantIn #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct CodeGeneratorRequestDefaultTypeInternal { PROTOBUF_CONSTEXPR CodeGeneratorRequestDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} @@ -670,10 +702,31 @@ PROTOBUF_NDEBUG_INLINE CodeGeneratorRequest::Impl_::Impl_( [[maybe_unused]] const ::google::protobuf::compiler::CodeGeneratorRequest& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, - file_to_generate_{visibility, arena, from.file_to_generate_}, - proto_file_{visibility, arena, from.proto_file_}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + file_to_generate_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::compiler::CodeGeneratorRequest, offsetof(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.file_to_generate_)>() + ), from.file_to_generate_} + #else + file_to_generate_ { visibility, arena, from.file_to_generate_ } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + proto_file_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::compiler::CodeGeneratorRequest, offsetof(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.proto_file_)>() + ), from.proto_file_} + #else + proto_file_ { visibility, arena, from.proto_file_ } + #endif + , parameter_(arena, from.parameter_), - source_file_descriptors_{visibility, arena, from.source_file_descriptors_} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + source_file_descriptors_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::compiler::CodeGeneratorRequest, offsetof(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.source_file_descriptors_)>() + ), from.source_file_descriptors_} + #else + source_file_descriptors_ { visibility, arena, from.source_file_descriptors_ } + #endif + {} CodeGeneratorRequest::CodeGeneratorRequest( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, @@ -699,10 +752,31 @@ PROTOBUF_NDEBUG_INLINE CodeGeneratorRequest::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, - file_to_generate_{visibility, arena}, - proto_file_{visibility, arena}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + file_to_generate_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::compiler::CodeGeneratorRequest, offsetof(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.file_to_generate_)>() + } + #else + file_to_generate_ { visibility, arena } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + proto_file_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::compiler::CodeGeneratorRequest, offsetof(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.proto_file_)>() + } + #else + proto_file_ { visibility, arena } + #endif + , parameter_(arena), - source_file_descriptors_{visibility, arena} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + source_file_descriptors_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::compiler::CodeGeneratorRequest, offsetof(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.source_file_descriptors_)>() + } + #else + source_file_descriptors_ { visibility, arena } + #endif + {} inline void CodeGeneratorRequest::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -729,6 +803,12 @@ inline void* PROTOBUF_NONNULL CodeGeneratorRequest::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) CodeGeneratorRequest(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto CodeGeneratorRequest::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(CodeGeneratorRequest), + alignof(CodeGeneratorRequest)); +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto CodeGeneratorRequest::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(CodeGeneratorRequest, _impl_.file_to_generate_) + @@ -753,6 +833,7 @@ constexpr auto CodeGeneratorRequest::InternalNewImpl_() { alignof(CodeGeneratorRequest)); } } +#endif constexpr auto CodeGeneratorRequest::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -1025,10 +1106,13 @@ void CodeGeneratorRequest::MergeImpl(::google::protobuf::MessageLite& to_msg, cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0x0000001fU)) { if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_file_to_generate()->MergeFrom(from._internal_file_to_generate()); + _this->_internal_mutable_file_to_generate()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, + from._internal_file_to_generate()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_proto_file()->MergeFrom( + _this->_internal_mutable_proto_file()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_proto_file()); } if (CheckHasBit(cached_has_bits, 0x00000004U)) { @@ -1043,7 +1127,8 @@ void CodeGeneratorRequest::MergeImpl(::google::protobuf::MessageLite& to_msg, } } if (CheckHasBitForRepeated(cached_has_bits, 0x00000010U)) { - _this->_internal_mutable_source_file_descriptors()->MergeFrom( + _this->_internal_mutable_source_file_descriptors()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_source_file_descriptors()); } } @@ -1475,7 +1560,14 @@ PROTOBUF_NDEBUG_INLINE CodeGeneratorResponse::Impl_::Impl_( [[maybe_unused]] const ::google::protobuf::compiler::CodeGeneratorResponse& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, - file_{visibility, arena, from.file_}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + file_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::compiler::CodeGeneratorResponse, offsetof(::google::protobuf::compiler::CodeGeneratorResponse, _impl_.file_)>() + ), from.file_} + #else + file_ { visibility, arena, from.file_ } + #endif + , error_(arena, from.error_) {} CodeGeneratorResponse::CodeGeneratorResponse( @@ -1505,7 +1597,14 @@ PROTOBUF_NDEBUG_INLINE CodeGeneratorResponse::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, - file_{visibility, arena}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + file_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::compiler::CodeGeneratorResponse, offsetof(::google::protobuf::compiler::CodeGeneratorResponse, _impl_.file_)>() + } + #else + file_ { visibility, arena } + #endif + , error_(arena) {} inline void CodeGeneratorResponse::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { @@ -1537,6 +1636,12 @@ inline void* PROTOBUF_NONNULL CodeGeneratorResponse::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) CodeGeneratorResponse(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto CodeGeneratorResponse::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(CodeGeneratorResponse), + alignof(CodeGeneratorResponse)); +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto CodeGeneratorResponse::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(CodeGeneratorResponse, _impl_.file_) + @@ -1553,6 +1658,7 @@ constexpr auto CodeGeneratorResponse::InternalNewImpl_() { alignof(CodeGeneratorResponse)); } } +#endif constexpr auto CodeGeneratorResponse::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -1799,6 +1905,7 @@ void CodeGeneratorResponse::MergeImpl(::google::protobuf::MessageLite& to_msg, if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { from.CheckHasBitConsistency(); } + ::google::protobuf::Arena* arena = _this->GetArena(); // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; @@ -1807,7 +1914,8 @@ void CodeGeneratorResponse::MergeImpl(::google::protobuf::MessageLite& to_msg, cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0x0000001fU)) { if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_file()->MergeFrom( + _this->_internal_mutable_file()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_file()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index 645b7e0cdee4a..49e58bcc3d103 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -342,7 +342,8 @@ class PROTOC_EXPORT Version final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -591,7 +592,8 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : public ::google::protobuf using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -866,7 +868,8 @@ class PROTOC_EXPORT CodeGeneratorResponse final : public ::google::protobuf::Mes using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -1146,7 +1149,8 @@ class PROTOC_EXPORT CodeGeneratorRequest final : public ::google::protobuf::Mess using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -1361,7 +1365,8 @@ inline void CodeGeneratorRequest::clear_file_to_generate() { inline ::std::string* PROTOBUF_NONNULL CodeGeneratorRequest::add_file_to_generate() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = _internal_mutable_file_to_generate()->Add(); + ::std::string* _s = _internal_mutable_file_to_generate()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add_mutable:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) return _s; @@ -1385,9 +1390,10 @@ inline void CodeGeneratorRequest::set_file_to_generate(int index, Arg_&& value, template inline void CodeGeneratorRequest::add_file_to_generate(Arg_&& value, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField(*_internal_mutable_file_to_generate(), - ::std::forward(value), - args... ); + ::google::protobuf::internal::AddToRepeatedPtrField( + ::google::protobuf::MessageLite::internal_visibility(), GetArena(), + *_internal_mutable_file_to_generate(), ::std::forward(value), + args... ); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) } @@ -1510,7 +1516,8 @@ inline const ::google::protobuf::FileDescriptorProto& CodeGeneratorRequest::prot inline ::google::protobuf::FileDescriptorProto* PROTOBUF_NONNULL CodeGeneratorRequest::add_proto_file() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::FileDescriptorProto* _add = _internal_mutable_proto_file()->Add(); + ::google::protobuf::FileDescriptorProto* _add = _internal_mutable_proto_file()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return _add; @@ -1558,7 +1565,8 @@ inline const ::google::protobuf::FileDescriptorProto& CodeGeneratorRequest::sour inline ::google::protobuf::FileDescriptorProto* PROTOBUF_NONNULL CodeGeneratorRequest::add_source_file_descriptors() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::FileDescriptorProto* _add = _internal_mutable_source_file_descriptors()->Add(); + ::google::protobuf::FileDescriptorProto* _add = _internal_mutable_source_file_descriptors()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000010U); // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.source_file_descriptors) return _add; @@ -2175,7 +2183,8 @@ inline const ::google::protobuf::compiler::CodeGeneratorResponse_File& CodeGener inline ::google::protobuf::compiler::CodeGeneratorResponse_File* PROTOBUF_NONNULL CodeGeneratorResponse::add_file() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::compiler::CodeGeneratorResponse_File* _add = _internal_mutable_file()->Add(); + ::google::protobuf::compiler::CodeGeneratorResponse_File* _add = _internal_mutable_file()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorResponse.file) return _add; diff --git a/src/google/protobuf/cpp_features.pb.cc b/src/google/protobuf/cpp_features.pb.cc index 1e6a162b74775..a193f963b1d08 100644 --- a/src/google/protobuf/cpp_features.pb.cc +++ b/src/google/protobuf/cpp_features.pb.cc @@ -27,6 +27,7 @@ namespace _fl = ::google::protobuf::internal::field_layout; namespace pb { inline constexpr CppFeatures::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, string_type_{static_cast< ::pb::CppFeatures_StringType >(0)}, @@ -40,7 +41,7 @@ PROTOBUF_CONSTEXPR CppFeatures::CppFeatures(::_pbi::ConstantInitialized) #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct CppFeaturesDefaultTypeInternal { PROTOBUF_CONSTEXPR CppFeaturesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} diff --git a/src/google/protobuf/cpp_features.pb.h b/src/google/protobuf/cpp_features.pb.h index 5de3d9ca29867..abc708bf33432 100644 --- a/src/google/protobuf/cpp_features.pb.h +++ b/src/google/protobuf/cpp_features.pb.h @@ -328,7 +328,8 @@ class PROTOBUF_EXPORT CppFeatures final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 983abc3bbafff..0e02bea856d5e 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -28,6 +28,7 @@ namespace google { namespace protobuf { inline constexpr UninterpretedOption_NamePart::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, name_part_( @@ -42,7 +43,7 @@ PROTOBUF_CONSTEXPR UninterpretedOption_NamePart::UninterpretedOption_NamePart(:: #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct UninterpretedOption_NamePartDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -61,13 +62,21 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 UninterpretedOption_NamePartDefaultTypeInternal _UninterpretedOption_NamePart_default_instance_; inline constexpr SourceCodeInfo_Location::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, path_{}, _path_cached_byte_size_{0}, span_{}, _span_cached_byte_size_{0}, - leading_detached_comments_{}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + leading_detached_comments_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::SourceCodeInfo_Location, offsetof(::google::protobuf::SourceCodeInfo_Location, _impl_.leading_detached_comments_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + leading_detached_comments_ {} + #endif + , leading_comments_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), @@ -82,7 +91,7 @@ PROTOBUF_CONSTEXPR SourceCodeInfo_Location::SourceCodeInfo_Location(::_pbi::Cons #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct SourceCodeInfo_LocationDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -101,6 +110,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 SourceCodeInfo_LocationDefaultTypeInternal _SourceCodeInfo_Location_default_instance_; inline constexpr GeneratedCodeInfo_Annotation::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, path_{}, @@ -119,7 +129,7 @@ PROTOBUF_CONSTEXPR GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(:: #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct GeneratedCodeInfo_AnnotationDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -138,6 +148,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 GeneratedCodeInfo_AnnotationDefaultTypeInternal _GeneratedCodeInfo_Annotation_default_instance_; inline constexpr FieldOptions_FeatureSupport::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, deprecation_warning_( @@ -154,7 +165,7 @@ PROTOBUF_CONSTEXPR FieldOptions_FeatureSupport::FieldOptions_FeatureSupport(::_p #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct FieldOptions_FeatureSupportDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -173,6 +184,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FieldOptions_FeatureSupportDefaultTypeInternal _FieldOptions_FeatureSupport_default_instance_; inline constexpr FieldOptions_EditionDefault::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, value_( @@ -187,7 +199,7 @@ PROTOBUF_CONSTEXPR FieldOptions_EditionDefault::FieldOptions_EditionDefault(::_p #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct FieldOptions_EditionDefaultDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -229,6 +241,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FeatureSet_VisibilityFeatureDefaultTypeInternal _FeatureSet_VisibilityFeature_default_instance_; inline constexpr FeatureSet::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, field_presence_{static_cast< ::google::protobuf::FeatureSet_FieldPresence >(0)}, @@ -247,7 +260,7 @@ PROTOBUF_CONSTEXPR FeatureSet::FeatureSet(::_pbi::ConstantInitialized) #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct FeatureSetDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -266,6 +279,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FeatureSetDefaultTypeInternal _FeatureSet_default_instance_; inline constexpr ExtensionRangeOptions_Declaration::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, full_name_( @@ -285,7 +299,7 @@ PROTOBUF_CONSTEXPR ExtensionRangeOptions_Declaration::ExtensionRangeOptions_Decl #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct ExtensionRangeOptions_DeclarationDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -304,6 +318,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ExtensionRangeOptions_DeclarationDefaultTypeInternal _ExtensionRangeOptions_Declaration_default_instance_; inline constexpr EnumDescriptorProto_EnumReservedRange::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, start_{0}, @@ -316,7 +331,7 @@ PROTOBUF_CONSTEXPR EnumDescriptorProto_EnumReservedRange::EnumDescriptorProto_En #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct EnumDescriptorProto_EnumReservedRangeDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -335,6 +350,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 EnumDescriptorProto_EnumReservedRangeDefaultTypeInternal _EnumDescriptorProto_EnumReservedRange_default_instance_; inline constexpr DescriptorProto_ReservedRange::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, start_{0}, @@ -347,7 +363,7 @@ PROTOBUF_CONSTEXPR DescriptorProto_ReservedRange::DescriptorProto_ReservedRange( #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct DescriptorProto_ReservedRangeDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -366,9 +382,17 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 DescriptorProto_ReservedRangeDefaultTypeInternal _DescriptorProto_ReservedRange_default_instance_; inline constexpr UninterpretedOption::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, - name_{}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + name_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::UninterpretedOption, offsetof(::google::protobuf::UninterpretedOption, _impl_.name_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + name_ {} + #endif + , identifier_value_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), @@ -389,7 +413,7 @@ PROTOBUF_CONSTEXPR UninterpretedOption::UninterpretedOption(::_pbi::ConstantInit #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct UninterpretedOptionDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -408,9 +432,17 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 UninterpretedOptionDefaultTypeInternal _UninterpretedOption_default_instance_; inline constexpr SourceCodeInfo::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, - location_{} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + location_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::SourceCodeInfo, offsetof(::google::protobuf::SourceCodeInfo, _impl_.location_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + location_ {} + #endif + {} template PROTOBUF_CONSTEXPR SourceCodeInfo::SourceCodeInfo(::_pbi::ConstantInitialized) @@ -419,7 +451,7 @@ PROTOBUF_CONSTEXPR SourceCodeInfo::SourceCodeInfo(::_pbi::ConstantInitialized) #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct SourceCodeInfoDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -438,9 +470,17 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 SourceCodeInfoDefaultTypeInternal _SourceCodeInfo_default_instance_; inline constexpr GeneratedCodeInfo::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, - annotation_{} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + annotation_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::GeneratedCodeInfo, offsetof(::google::protobuf::GeneratedCodeInfo, _impl_.annotation_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + annotation_ {} + #endif + {} template PROTOBUF_CONSTEXPR GeneratedCodeInfo::GeneratedCodeInfo(::_pbi::ConstantInitialized) @@ -449,7 +489,7 @@ PROTOBUF_CONSTEXPR GeneratedCodeInfo::GeneratedCodeInfo(::_pbi::ConstantInitiali #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct GeneratedCodeInfoDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -468,6 +508,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 GeneratedCodeInfoDefaultTypeInternal _GeneratedCodeInfo_default_instance_; inline constexpr FeatureSetDefaults_FeatureSetEditionDefault::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, overridable_features_{nullptr}, @@ -481,7 +522,7 @@ PROTOBUF_CONSTEXPR FeatureSetDefaults_FeatureSetEditionDefault::FeatureSetDefaul #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct FeatureSetDefaults_FeatureSetEditionDefaultDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -500,9 +541,17 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FeatureSetDefaults_FeatureSetEditionDefaultDefaultTypeInternal _FeatureSetDefaults_FeatureSetEditionDefault_default_instance_; inline constexpr ServiceOptions::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, - uninterpreted_option_{}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::ServiceOptions, offsetof(::google::protobuf::ServiceOptions, _impl_.uninterpreted_option_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_ {} + #endif + , features_{nullptr}, deprecated_{false} {} @@ -513,7 +562,7 @@ PROTOBUF_CONSTEXPR ServiceOptions::ServiceOptions(::_pbi::ConstantInitialized) #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct ServiceOptionsDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -532,9 +581,17 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ServiceOptionsDefaultTypeInternal _ServiceOptions_default_instance_; inline constexpr OneofOptions::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, - uninterpreted_option_{}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::OneofOptions, offsetof(::google::protobuf::OneofOptions, _impl_.uninterpreted_option_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_ {} + #endif + , features_{nullptr} {} template @@ -544,7 +601,7 @@ PROTOBUF_CONSTEXPR OneofOptions::OneofOptions(::_pbi::ConstantInitialized) #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct OneofOptionsDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -563,9 +620,17 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 OneofOptionsDefaultTypeInternal _OneofOptions_default_instance_; inline constexpr MethodOptions::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, - uninterpreted_option_{}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::MethodOptions, offsetof(::google::protobuf::MethodOptions, _impl_.uninterpreted_option_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_ {} + #endif + , features_{nullptr}, deprecated_{false}, idempotency_level_{static_cast< ::google::protobuf::MethodOptions_IdempotencyLevel >(0)} {} @@ -577,7 +642,7 @@ PROTOBUF_CONSTEXPR MethodOptions::MethodOptions(::_pbi::ConstantInitialized) #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct MethodOptionsDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -596,6 +661,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MethodOptionsDefaultTypeInternal _MethodOptions_default_instance_; inline constexpr MessageOptions::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, features_{nullptr}, @@ -604,7 +670,14 @@ inline constexpr MessageOptions::Impl_::Impl_( deprecated_{false}, map_entry_{false}, deprecated_legacy_json_field_conflicts_{false}, - uninterpreted_option_{} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::MessageOptions, offsetof(::google::protobuf::MessageOptions, _impl_.uninterpreted_option_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_ {} + #endif + {} template PROTOBUF_CONSTEXPR MessageOptions::MessageOptions(::_pbi::ConstantInitialized) @@ -613,7 +686,7 @@ PROTOBUF_CONSTEXPR MessageOptions::MessageOptions(::_pbi::ConstantInitialized) #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct MessageOptionsDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -632,6 +705,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MessageOptionsDefaultTypeInternal _MessageOptions_default_instance_; inline constexpr FileOptions::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, java_package_( @@ -674,7 +748,14 @@ inline constexpr FileOptions::Impl_::Impl_( java_string_check_utf8_{false}, optimize_for_{static_cast< ::google::protobuf::FileOptions_OptimizeMode >(1)}, cc_enable_arenas_{true}, - uninterpreted_option_{} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileOptions, offsetof(::google::protobuf::FileOptions, _impl_.uninterpreted_option_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_ {} + #endif + {} template PROTOBUF_CONSTEXPR FileOptions::FileOptions(::_pbi::ConstantInitialized) @@ -683,7 +764,7 @@ PROTOBUF_CONSTEXPR FileOptions::FileOptions(::_pbi::ConstantInitialized) #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct FileOptionsDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -702,10 +783,25 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FileOptionsDefaultTypeInternal _FileOptions_default_instance_; inline constexpr FieldOptions::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, - edition_defaults_{}, - uninterpreted_option_{}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + edition_defaults_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FieldOptions, offsetof(::google::protobuf::FieldOptions, _impl_.edition_defaults_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + edition_defaults_ {} + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FieldOptions, offsetof(::google::protobuf::FieldOptions, _impl_.uninterpreted_option_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_ {} + #endif + , features_{nullptr}, feature_support_{nullptr}, ctype_{static_cast< ::google::protobuf::FieldOptions_CType >(0)}, @@ -726,7 +822,7 @@ PROTOBUF_CONSTEXPR FieldOptions::FieldOptions(::_pbi::ConstantInitialized) #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct FieldOptionsDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -745,9 +841,17 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FieldOptionsDefaultTypeInternal _FieldOptions_default_instance_; inline constexpr FeatureSetDefaults::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, - defaults_{}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + defaults_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FeatureSetDefaults, offsetof(::google::protobuf::FeatureSetDefaults, _impl_.defaults_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + defaults_ {} + #endif + , minimum_edition_{static_cast< ::google::protobuf::Edition >(0)}, maximum_edition_{static_cast< ::google::protobuf::Edition >(0)} {} @@ -758,7 +862,7 @@ PROTOBUF_CONSTEXPR FeatureSetDefaults::FeatureSetDefaults(::_pbi::ConstantInitia #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct FeatureSetDefaultsDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -777,10 +881,25 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FeatureSetDefaultsDefaultTypeInternal _FeatureSetDefaults_default_instance_; inline constexpr ExtensionRangeOptions::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, - declaration_{}, - uninterpreted_option_{}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + declaration_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::ExtensionRangeOptions, offsetof(::google::protobuf::ExtensionRangeOptions, _impl_.declaration_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + declaration_ {} + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::ExtensionRangeOptions, offsetof(::google::protobuf::ExtensionRangeOptions, _impl_.uninterpreted_option_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_ {} + #endif + , features_{nullptr}, verification_{static_cast< ::google::protobuf::ExtensionRangeOptions_VerificationState >(1)} {} @@ -791,7 +910,7 @@ PROTOBUF_CONSTEXPR ExtensionRangeOptions::ExtensionRangeOptions(::_pbi::Constant #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct ExtensionRangeOptionsDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -810,9 +929,17 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ExtensionRangeOptionsDefaultTypeInternal _ExtensionRangeOptions_default_instance_; inline constexpr EnumValueOptions::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, - uninterpreted_option_{}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::EnumValueOptions, offsetof(::google::protobuf::EnumValueOptions, _impl_.uninterpreted_option_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_ {} + #endif + , features_{nullptr}, feature_support_{nullptr}, deprecated_{false}, @@ -825,7 +952,7 @@ PROTOBUF_CONSTEXPR EnumValueOptions::EnumValueOptions(::_pbi::ConstantInitialize #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct EnumValueOptionsDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -844,13 +971,21 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 EnumValueOptionsDefaultTypeInternal _EnumValueOptions_default_instance_; inline constexpr EnumOptions::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, features_{nullptr}, allow_alias_{false}, deprecated_{false}, deprecated_legacy_json_field_conflicts_{false}, - uninterpreted_option_{} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::EnumOptions, offsetof(::google::protobuf::EnumOptions, _impl_.uninterpreted_option_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_ {} + #endif + {} template PROTOBUF_CONSTEXPR EnumOptions::EnumOptions(::_pbi::ConstantInitialized) @@ -859,7 +994,7 @@ PROTOBUF_CONSTEXPR EnumOptions::EnumOptions(::_pbi::ConstantInitialized) #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct EnumOptionsDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -878,6 +1013,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 EnumOptionsDefaultTypeInternal _EnumOptions_default_instance_; inline constexpr OneofDescriptorProto::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, name_( @@ -892,7 +1028,7 @@ PROTOBUF_CONSTEXPR OneofDescriptorProto::OneofDescriptorProto(::_pbi::ConstantIn #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct OneofDescriptorProtoDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -911,6 +1047,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 OneofDescriptorProtoDefaultTypeInternal _OneofDescriptorProto_default_instance_; inline constexpr MethodDescriptorProto::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, name_( @@ -933,7 +1070,7 @@ PROTOBUF_CONSTEXPR MethodDescriptorProto::MethodDescriptorProto(::_pbi::Constant #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct MethodDescriptorProtoDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -952,6 +1089,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MethodDescriptorProtoDefaultTypeInternal _MethodDescriptorProto_default_instance_; inline constexpr FieldDescriptorProto::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, name_( @@ -983,7 +1121,7 @@ PROTOBUF_CONSTEXPR FieldDescriptorProto::FieldDescriptorProto(::_pbi::ConstantIn #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct FieldDescriptorProtoDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -1002,6 +1140,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FieldDescriptorProtoDefaultTypeInternal _FieldDescriptorProto_default_instance_; inline constexpr EnumValueDescriptorProto::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, name_( @@ -1017,7 +1156,7 @@ PROTOBUF_CONSTEXPR EnumValueDescriptorProto::EnumValueDescriptorProto(::_pbi::Co #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct EnumValueDescriptorProtoDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -1036,6 +1175,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 EnumValueDescriptorProtoDefaultTypeInternal _EnumValueDescriptorProto_default_instance_; inline constexpr DescriptorProto_ExtensionRange::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, options_{nullptr}, @@ -1049,7 +1189,7 @@ PROTOBUF_CONSTEXPR DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRang #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct DescriptorProto_ExtensionRangeDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -1068,9 +1208,17 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 DescriptorProto_ExtensionRangeDefaultTypeInternal _DescriptorProto_ExtensionRange_default_instance_; inline constexpr ServiceDescriptorProto::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, - method_{}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + method_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::ServiceDescriptorProto, offsetof(::google::protobuf::ServiceDescriptorProto, _impl_.method_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + method_ {} + #endif + , name_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), @@ -1083,7 +1231,7 @@ PROTOBUF_CONSTEXPR ServiceDescriptorProto::ServiceDescriptorProto(::_pbi::Consta #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct ServiceDescriptorProtoDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -1102,11 +1250,33 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ServiceDescriptorProtoDefaultTypeInternal _ServiceDescriptorProto_default_instance_; inline constexpr EnumDescriptorProto::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, - value_{}, - reserved_range_{}, - reserved_name_{}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + value_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::EnumDescriptorProto, offsetof(::google::protobuf::EnumDescriptorProto, _impl_.value_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + value_ {} + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + reserved_range_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::EnumDescriptorProto, offsetof(::google::protobuf::EnumDescriptorProto, _impl_.reserved_range_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + reserved_range_ {} + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + reserved_name_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::EnumDescriptorProto, offsetof(::google::protobuf::EnumDescriptorProto, _impl_.reserved_name_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + reserved_name_ {} + #endif + , name_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), @@ -1120,7 +1290,7 @@ PROTOBUF_CONSTEXPR EnumDescriptorProto::EnumDescriptorProto(::_pbi::ConstantInit #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct EnumDescriptorProtoDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -1139,16 +1309,73 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 EnumDescriptorProtoDefaultTypeInternal _EnumDescriptorProto_default_instance_; inline constexpr DescriptorProto::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, - field_{}, - nested_type_{}, - enum_type_{}, - extension_range_{}, - extension_{}, - oneof_decl_{}, - reserved_range_{}, - reserved_name_{}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + field_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.field_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + field_ {} + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + nested_type_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.nested_type_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + nested_type_ {} + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + enum_type_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.enum_type_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + enum_type_ {} + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + extension_range_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.extension_range_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + extension_range_ {} + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + extension_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.extension_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + extension_ {} + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + oneof_decl_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.oneof_decl_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + oneof_decl_ {} + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + reserved_range_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.reserved_range_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + reserved_range_ {} + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + reserved_name_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.reserved_name_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + reserved_name_ {} + #endif + , name_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), @@ -1162,7 +1389,7 @@ PROTOBUF_CONSTEXPR DescriptorProto::DescriptorProto(::_pbi::ConstantInitialized) #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct DescriptorProtoDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -1181,16 +1408,59 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 DescriptorProtoDefaultTypeInternal _DescriptorProto_default_instance_; inline constexpr FileDescriptorProto::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, - dependency_{}, - message_type_{}, - enum_type_{}, - service_{}, - extension_{}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + dependency_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.dependency_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + dependency_ {} + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + message_type_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.message_type_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + message_type_ {} + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + enum_type_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.enum_type_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + enum_type_ {} + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + service_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.service_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + service_ {} + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + extension_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.extension_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + extension_ {} + #endif + , public_dependency_{}, weak_dependency_{}, - option_dependency_{}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + option_dependency_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.option_dependency_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + option_dependency_ {} + #endif + , name_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), @@ -1211,7 +1481,7 @@ PROTOBUF_CONSTEXPR FileDescriptorProto::FileDescriptorProto(::_pbi::ConstantInit #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct FileDescriptorProtoDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -1230,9 +1500,17 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FileDescriptorProtoDefaultTypeInternal _FileDescriptorProto_default_instance_; inline constexpr FileDescriptorSet::Impl_::Impl_( + [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, - file_{} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + file_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorSet, offsetof(::google::protobuf::FileDescriptorSet, _impl_.file_)>() + } + #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + file_ {} + #endif + {} template PROTOBUF_CONSTEXPR FileDescriptorSet::FileDescriptorSet(::_pbi::ConstantInitialized) @@ -1241,7 +1519,7 @@ PROTOBUF_CONSTEXPR FileDescriptorSet::FileDescriptorSet(::_pbi::ConstantInitiali #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { + _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) { } struct FileDescriptorSetDefaultTypeInternal { #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) @@ -2293,7 +2571,14 @@ PROTOBUF_NDEBUG_INLINE FileDescriptorSet::Impl_::Impl_( : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, - file_{visibility, arena, from.file_} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + file_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorSet, offsetof(::google::protobuf::FileDescriptorSet, _impl_.file_)>() + ), from.file_} + #else + file_ { visibility, arena, from.file_ } + #endif + {} FileDescriptorSet::FileDescriptorSet( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, @@ -2317,7 +2602,14 @@ PROTOBUF_NDEBUG_INLINE FileDescriptorSet::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, - file_{visibility, arena} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + file_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorSet, offsetof(::google::protobuf::FileDescriptorSet, _impl_.file_)>() + } + #else + file_ { visibility, arena } + #endif + {} inline void FileDescriptorSet::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -2341,6 +2633,23 @@ inline void* PROTOBUF_NONNULL FileDescriptorSet::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) FileDescriptorSet(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto FileDescriptorSet::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(FileDescriptorSet, _impl_._extensions_) + + decltype(FileDescriptorSet::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit( + sizeof(FileDescriptorSet), alignof(FileDescriptorSet), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&FileDescriptorSet::PlacementNew_, + sizeof(FileDescriptorSet), + alignof(FileDescriptorSet)); + } +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto FileDescriptorSet::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(FileDescriptorSet, _impl_._extensions_) + @@ -2360,6 +2669,7 @@ constexpr auto FileDescriptorSet::InternalNewImpl_() { alignof(FileDescriptorSet)); } } +#endif constexpr auto FileDescriptorSet::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -2526,6 +2836,7 @@ void FileDescriptorSet::MergeImpl(::google::protobuf::MessageLite& to_msg, if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { from.CheckHasBitConsistency(); } + ::google::protobuf::Arena* arena = _this->GetArena(); // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FileDescriptorSet) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; @@ -2533,7 +2844,8 @@ void FileDescriptorSet::MergeImpl(::google::protobuf::MessageLite& to_msg, cached_has_bits = from._impl_._has_bits_[0]; if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_file()->MergeFrom( + _this->_internal_mutable_file()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_file()); } _this->_impl_._has_bits_[0] |= cached_has_bits; @@ -2597,14 +2909,56 @@ PROTOBUF_NDEBUG_INLINE FileDescriptorProto::Impl_::Impl_( [[maybe_unused]] const ::google::protobuf::FileDescriptorProto& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, - dependency_{visibility, arena, from.dependency_}, - message_type_{visibility, arena, from.message_type_}, - enum_type_{visibility, arena, from.enum_type_}, - service_{visibility, arena, from.service_}, - extension_{visibility, arena, from.extension_}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + dependency_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.dependency_)>() + ), from.dependency_} + #else + dependency_ { visibility, arena, from.dependency_ } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + message_type_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.message_type_)>() + ), from.message_type_} + #else + message_type_ { visibility, arena, from.message_type_ } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + enum_type_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.enum_type_)>() + ), from.enum_type_} + #else + enum_type_ { visibility, arena, from.enum_type_ } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + service_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.service_)>() + ), from.service_} + #else + service_ { visibility, arena, from.service_ } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + extension_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.extension_)>() + ), from.extension_} + #else + extension_ { visibility, arena, from.extension_ } + #endif + , public_dependency_{visibility, arena, from.public_dependency_}, weak_dependency_{visibility, arena, from.weak_dependency_}, - option_dependency_{visibility, arena, from.option_dependency_}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + option_dependency_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.option_dependency_)>() + ), from.option_dependency_} + #else + option_dependency_ { visibility, arena, from.option_dependency_ } + #endif + , name_(arena, from.name_), package_(arena, from.package_), syntax_(arena, from.syntax_) {} @@ -2637,14 +2991,56 @@ PROTOBUF_NDEBUG_INLINE FileDescriptorProto::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, - dependency_{visibility, arena}, - message_type_{visibility, arena}, - enum_type_{visibility, arena}, - service_{visibility, arena}, - extension_{visibility, arena}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + dependency_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.dependency_)>() + } + #else + dependency_ { visibility, arena } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + message_type_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.message_type_)>() + } + #else + message_type_ { visibility, arena } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + enum_type_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.enum_type_)>() + } + #else + enum_type_ { visibility, arena } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + service_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.service_)>() + } + #else + service_ { visibility, arena } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + extension_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.extension_)>() + } + #else + extension_ { visibility, arena } + #endif + , public_dependency_{visibility, arena}, weak_dependency_{visibility, arena}, - option_dependency_{visibility, arena}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + option_dependency_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.option_dependency_)>() + } + #else + option_dependency_ { visibility, arena } + #endif + , name_(arena), package_(arena), syntax_(arena) {} @@ -2682,6 +3078,28 @@ inline void* PROTOBUF_NONNULL FileDescriptorProto::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) FileDescriptorProto(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto FileDescriptorProto::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(FileDescriptorProto, _impl_.public_dependency_) + + decltype(FileDescriptorProto::_impl_.public_dependency_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(FileDescriptorProto, _impl_.weak_dependency_) + + decltype(FileDescriptorProto::_impl_.weak_dependency_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit( + sizeof(FileDescriptorProto), alignof(FileDescriptorProto), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&FileDescriptorProto::PlacementNew_, + sizeof(FileDescriptorProto), + alignof(FileDescriptorProto)); + } +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto FileDescriptorProto::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(FileDescriptorProto, _impl_.dependency_) + @@ -2726,6 +3144,7 @@ constexpr auto FileDescriptorProto::InternalNewImpl_() { alignof(FileDescriptorProto)); } } +#endif constexpr auto FileDescriptorProto::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -3224,22 +3643,28 @@ void FileDescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0x000000ffU)) { if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_dependency()->MergeFrom(from._internal_dependency()); + _this->_internal_mutable_dependency()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, + from._internal_dependency()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_message_type()->MergeFrom( + _this->_internal_mutable_message_type()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_message_type()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_enum_type()->MergeFrom( + _this->_internal_mutable_enum_type()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_enum_type()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000008U)) { - _this->_internal_mutable_service()->MergeFrom( + _this->_internal_mutable_service()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_service()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000010U)) { - _this->_internal_mutable_extension()->MergeFrom( + _this->_internal_mutable_extension()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_extension()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000020U)) { @@ -3249,7 +3674,9 @@ void FileDescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, _this->_internal_mutable_weak_dependency()->MergeFrom(from._internal_weak_dependency()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000080U)) { - _this->_internal_mutable_option_dependency()->MergeFrom(from._internal_option_dependency()); + _this->_internal_mutable_option_dependency()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, + from._internal_option_dependency()); } } if (BatchCheckHasBit(cached_has_bits, 0x00003f00U)) { @@ -3993,14 +4420,70 @@ PROTOBUF_NDEBUG_INLINE DescriptorProto::Impl_::Impl_( [[maybe_unused]] const ::google::protobuf::DescriptorProto& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, - field_{visibility, arena, from.field_}, - nested_type_{visibility, arena, from.nested_type_}, - enum_type_{visibility, arena, from.enum_type_}, - extension_range_{visibility, arena, from.extension_range_}, - extension_{visibility, arena, from.extension_}, - oneof_decl_{visibility, arena, from.oneof_decl_}, - reserved_range_{visibility, arena, from.reserved_range_}, - reserved_name_{visibility, arena, from.reserved_name_}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + field_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.field_)>() + ), from.field_} + #else + field_ { visibility, arena, from.field_ } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + nested_type_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.nested_type_)>() + ), from.nested_type_} + #else + nested_type_ { visibility, arena, from.nested_type_ } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + enum_type_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.enum_type_)>() + ), from.enum_type_} + #else + enum_type_ { visibility, arena, from.enum_type_ } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + extension_range_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.extension_range_)>() + ), from.extension_range_} + #else + extension_range_ { visibility, arena, from.extension_range_ } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + extension_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.extension_)>() + ), from.extension_} + #else + extension_ { visibility, arena, from.extension_ } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + oneof_decl_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.oneof_decl_)>() + ), from.oneof_decl_} + #else + oneof_decl_ { visibility, arena, from.oneof_decl_ } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + reserved_range_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.reserved_range_)>() + ), from.reserved_range_} + #else + reserved_range_ { visibility, arena, from.reserved_range_ } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + reserved_name_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.reserved_name_)>() + ), from.reserved_name_} + #else + reserved_name_ { visibility, arena, from.reserved_name_ } + #endif + , name_(arena, from.name_) {} DescriptorProto::DescriptorProto( @@ -4028,14 +4511,70 @@ PROTOBUF_NDEBUG_INLINE DescriptorProto::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, - field_{visibility, arena}, - nested_type_{visibility, arena}, - enum_type_{visibility, arena}, - extension_range_{visibility, arena}, - extension_{visibility, arena}, - oneof_decl_{visibility, arena}, - reserved_range_{visibility, arena}, - reserved_name_{visibility, arena}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + field_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.field_)>() + } + #else + field_ { visibility, arena } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + nested_type_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.nested_type_)>() + } + #else + nested_type_ { visibility, arena } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + enum_type_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.enum_type_)>() + } + #else + enum_type_ { visibility, arena } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + extension_range_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.extension_range_)>() + } + #else + extension_range_ { visibility, arena } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + extension_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.extension_)>() + } + #else + extension_ { visibility, arena } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + oneof_decl_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.oneof_decl_)>() + } + #else + oneof_decl_ { visibility, arena } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + reserved_range_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.reserved_range_)>() + } + #else + reserved_range_ { visibility, arena } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + reserved_name_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::DescriptorProto, offsetof(::google::protobuf::DescriptorProto, _impl_.reserved_name_)>() + } + #else + reserved_name_ { visibility, arena } + #endif + , name_(arena) {} inline void DescriptorProto::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { @@ -4068,6 +4607,12 @@ inline void* PROTOBUF_NONNULL DescriptorProto::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) DescriptorProto(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto DescriptorProto::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(DescriptorProto), + alignof(DescriptorProto)); +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto DescriptorProto::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(DescriptorProto, _impl_.field_) + @@ -4112,6 +4657,7 @@ constexpr auto DescriptorProto::InternalNewImpl_() { alignof(DescriptorProto)); } } +#endif constexpr auto DescriptorProto::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -4562,35 +5108,44 @@ void DescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0x000000ffU)) { if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_field()->MergeFrom( + _this->_internal_mutable_field()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_field()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_nested_type()->MergeFrom( + _this->_internal_mutable_nested_type()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_nested_type()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_enum_type()->MergeFrom( + _this->_internal_mutable_enum_type()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_enum_type()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000008U)) { - _this->_internal_mutable_extension_range()->MergeFrom( + _this->_internal_mutable_extension_range()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_extension_range()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000010U)) { - _this->_internal_mutable_extension()->MergeFrom( + _this->_internal_mutable_extension()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_extension()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000020U)) { - _this->_internal_mutable_oneof_decl()->MergeFrom( + _this->_internal_mutable_oneof_decl()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_oneof_decl()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000040U)) { - _this->_internal_mutable_reserved_range()->MergeFrom( + _this->_internal_mutable_reserved_range()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_reserved_range()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000080U)) { - _this->_internal_mutable_reserved_name()->MergeFrom(from._internal_reserved_name()); + _this->_internal_mutable_reserved_name()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, + from._internal_reserved_name()); } } if (BatchCheckHasBit(cached_has_bits, 0x00000700U)) { @@ -5066,8 +5621,22 @@ PROTOBUF_NDEBUG_INLINE ExtensionRangeOptions::Impl_::Impl_( : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, - declaration_{visibility, arena, from.declaration_}, - uninterpreted_option_{visibility, arena, from.uninterpreted_option_} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + declaration_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::ExtensionRangeOptions, offsetof(::google::protobuf::ExtensionRangeOptions, _impl_.declaration_)>() + ), from.declaration_} + #else + declaration_ { visibility, arena, from.declaration_ } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::ExtensionRangeOptions, offsetof(::google::protobuf::ExtensionRangeOptions, _impl_.uninterpreted_option_)>() + ), from.uninterpreted_option_} + #else + uninterpreted_option_ { visibility, arena, from.uninterpreted_option_ } + #endif + {} ExtensionRangeOptions::ExtensionRangeOptions( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, @@ -5096,8 +5665,22 @@ PROTOBUF_NDEBUG_INLINE ExtensionRangeOptions::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, - declaration_{visibility, arena}, - uninterpreted_option_{visibility, arena}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + declaration_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::ExtensionRangeOptions, offsetof(::google::protobuf::ExtensionRangeOptions, _impl_.declaration_)>() + } + #else + declaration_ { visibility, arena } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::ExtensionRangeOptions, offsetof(::google::protobuf::ExtensionRangeOptions, _impl_.uninterpreted_option_)>() + } + #else + uninterpreted_option_ { visibility, arena } + #endif + , verification_{static_cast< ::google::protobuf::ExtensionRangeOptions_VerificationState >(1)} {} inline void ExtensionRangeOptions::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { @@ -5124,6 +5707,23 @@ inline void* PROTOBUF_NONNULL ExtensionRangeOptions::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) ExtensionRangeOptions(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto ExtensionRangeOptions::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(ExtensionRangeOptions, _impl_._extensions_) + + decltype(ExtensionRangeOptions::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit( + sizeof(ExtensionRangeOptions), alignof(ExtensionRangeOptions), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&ExtensionRangeOptions::PlacementNew_, + sizeof(ExtensionRangeOptions), + alignof(ExtensionRangeOptions)); + } +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto ExtensionRangeOptions::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(ExtensionRangeOptions, _impl_._extensions_) + @@ -5147,6 +5747,7 @@ constexpr auto ExtensionRangeOptions::InternalNewImpl_() { alignof(ExtensionRangeOptions)); } } +#endif constexpr auto ExtensionRangeOptions::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -5402,11 +6003,13 @@ void ExtensionRangeOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_declaration()->MergeFrom( + _this->_internal_mutable_declaration()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_declaration()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_uninterpreted_option()->MergeFrom( + _this->_internal_mutable_uninterpreted_option()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_uninterpreted_option()); } if (CheckHasBit(cached_has_bits, 0x00000004U)) { @@ -6642,9 +7245,30 @@ PROTOBUF_NDEBUG_INLINE EnumDescriptorProto::Impl_::Impl_( [[maybe_unused]] const ::google::protobuf::EnumDescriptorProto& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, - value_{visibility, arena, from.value_}, - reserved_range_{visibility, arena, from.reserved_range_}, - reserved_name_{visibility, arena, from.reserved_name_}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + value_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::EnumDescriptorProto, offsetof(::google::protobuf::EnumDescriptorProto, _impl_.value_)>() + ), from.value_} + #else + value_ { visibility, arena, from.value_ } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + reserved_range_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::EnumDescriptorProto, offsetof(::google::protobuf::EnumDescriptorProto, _impl_.reserved_range_)>() + ), from.reserved_range_} + #else + reserved_range_ { visibility, arena, from.reserved_range_ } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + reserved_name_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::EnumDescriptorProto, offsetof(::google::protobuf::EnumDescriptorProto, _impl_.reserved_name_)>() + ), from.reserved_name_} + #else + reserved_name_ { visibility, arena, from.reserved_name_ } + #endif + , name_(arena, from.name_) {} EnumDescriptorProto::EnumDescriptorProto( @@ -6672,9 +7296,30 @@ PROTOBUF_NDEBUG_INLINE EnumDescriptorProto::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, - value_{visibility, arena}, - reserved_range_{visibility, arena}, - reserved_name_{visibility, arena}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + value_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::EnumDescriptorProto, offsetof(::google::protobuf::EnumDescriptorProto, _impl_.value_)>() + } + #else + value_ { visibility, arena } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + reserved_range_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::EnumDescriptorProto, offsetof(::google::protobuf::EnumDescriptorProto, _impl_.reserved_range_)>() + } + #else + reserved_range_ { visibility, arena } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + reserved_name_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::EnumDescriptorProto, offsetof(::google::protobuf::EnumDescriptorProto, _impl_.reserved_name_)>() + } + #else + reserved_name_ { visibility, arena } + #endif + , name_(arena) {} inline void EnumDescriptorProto::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { @@ -6707,6 +7352,12 @@ inline void* PROTOBUF_NONNULL EnumDescriptorProto::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) EnumDescriptorProto(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto EnumDescriptorProto::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(EnumDescriptorProto), + alignof(EnumDescriptorProto)); +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto EnumDescriptorProto::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(EnumDescriptorProto, _impl_.value_) + @@ -6731,6 +7382,7 @@ constexpr auto EnumDescriptorProto::InternalNewImpl_() { alignof(EnumDescriptorProto)); } } +#endif constexpr auto EnumDescriptorProto::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -7024,15 +7676,19 @@ void EnumDescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0x0000003fU)) { if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_value()->MergeFrom( + _this->_internal_mutable_value()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_value()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_reserved_range()->MergeFrom( + _this->_internal_mutable_reserved_range()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_reserved_range()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_reserved_name()->MergeFrom(from._internal_reserved_name()); + _this->_internal_mutable_reserved_name()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, + from._internal_reserved_name()); } if (CheckHasBit(cached_has_bits, 0x00000008U)) { _this->_internal_set_name(from._internal_name()); @@ -7464,7 +8120,14 @@ PROTOBUF_NDEBUG_INLINE ServiceDescriptorProto::Impl_::Impl_( [[maybe_unused]] const ::google::protobuf::ServiceDescriptorProto& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, - method_{visibility, arena, from.method_}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + method_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::ServiceDescriptorProto, offsetof(::google::protobuf::ServiceDescriptorProto, _impl_.method_)>() + ), from.method_} + #else + method_ { visibility, arena, from.method_ } + #endif + , name_(arena, from.name_) {} ServiceDescriptorProto::ServiceDescriptorProto( @@ -7491,7 +8154,14 @@ PROTOBUF_NDEBUG_INLINE ServiceDescriptorProto::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, - method_{visibility, arena}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + method_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::ServiceDescriptorProto, offsetof(::google::protobuf::ServiceDescriptorProto, _impl_.method_)>() + } + #else + method_ { visibility, arena } + #endif + , name_(arena) {} inline void ServiceDescriptorProto::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { @@ -7519,6 +8189,12 @@ inline void* PROTOBUF_NONNULL ServiceDescriptorProto::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) ServiceDescriptorProto(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto ServiceDescriptorProto::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(ServiceDescriptorProto), + alignof(ServiceDescriptorProto)); +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto ServiceDescriptorProto::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(ServiceDescriptorProto, _impl_.method_) + @@ -7535,6 +8211,7 @@ constexpr auto ServiceDescriptorProto::InternalNewImpl_() { alignof(ServiceDescriptorProto)); } } +#endif constexpr auto ServiceDescriptorProto::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -7751,7 +8428,8 @@ void ServiceDescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_method()->MergeFrom( + _this->_internal_mutable_method()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_method()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { @@ -8260,7 +8938,14 @@ PROTOBUF_NDEBUG_INLINE FileOptions::Impl_::Impl_( php_namespace_(arena, from.php_namespace_), php_metadata_namespace_(arena, from.php_metadata_namespace_), ruby_package_(arena, from.ruby_package_), - uninterpreted_option_{visibility, arena, from.uninterpreted_option_} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileOptions, offsetof(::google::protobuf::FileOptions, _impl_.uninterpreted_option_)>() + ), from.uninterpreted_option_} + #else + uninterpreted_option_ { visibility, arena, from.uninterpreted_option_ } + #endif + {} FileOptions::FileOptions( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, @@ -8307,7 +8992,14 @@ PROTOBUF_NDEBUG_INLINE FileOptions::Impl_::Impl_( ruby_package_(arena), optimize_for_{static_cast< ::google::protobuf::FileOptions_OptimizeMode >(1)}, cc_enable_arenas_{true}, - uninterpreted_option_{visibility, arena} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FileOptions, offsetof(::google::protobuf::FileOptions, _impl_.uninterpreted_option_)>() + } + #else + uninterpreted_option_ { visibility, arena } + #endif + {} inline void FileOptions::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -8348,6 +9040,23 @@ inline void* PROTOBUF_NONNULL FileOptions::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) FileOptions(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto FileOptions::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(FileOptions, _impl_._extensions_) + + decltype(FileOptions::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit( + sizeof(FileOptions), alignof(FileOptions), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&FileOptions::PlacementNew_, + sizeof(FileOptions), + alignof(FileOptions)); + } +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto FileOptions::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(FileOptions, _impl_._extensions_) + @@ -8367,6 +9076,7 @@ constexpr auto FileOptions::InternalNewImpl_() { alignof(FileOptions)); } } +#endif constexpr auto FileOptions::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -8982,7 +9692,8 @@ void FileOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, _this->_impl_.cc_enable_arenas_ = from._impl_.cc_enable_arenas_; } if (CheckHasBitForRepeated(cached_has_bits, 0x00100000U)) { - _this->_internal_mutable_uninterpreted_option()->MergeFrom( + _this->_internal_mutable_uninterpreted_option()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_uninterpreted_option()); } } @@ -9069,7 +9780,14 @@ PROTOBUF_NDEBUG_INLINE MessageOptions::Impl_::Impl_( : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, - uninterpreted_option_{visibility, arena, from.uninterpreted_option_} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::MessageOptions, offsetof(::google::protobuf::MessageOptions, _impl_.uninterpreted_option_)>() + ), from.uninterpreted_option_} + #else + uninterpreted_option_ { visibility, arena, from.uninterpreted_option_ } + #endif + {} MessageOptions::MessageOptions( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, @@ -9104,7 +9822,14 @@ PROTOBUF_NDEBUG_INLINE MessageOptions::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, - uninterpreted_option_{visibility, arena} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::MessageOptions, offsetof(::google::protobuf::MessageOptions, _impl_.uninterpreted_option_)>() + } + #else + uninterpreted_option_ { visibility, arena } + #endif + {} inline void MessageOptions::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -9135,6 +9860,23 @@ inline void* PROTOBUF_NONNULL MessageOptions::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) MessageOptions(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto MessageOptions::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(MessageOptions, _impl_._extensions_) + + decltype(MessageOptions::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit( + sizeof(MessageOptions), alignof(MessageOptions), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&MessageOptions::PlacementNew_, + sizeof(MessageOptions), + alignof(MessageOptions)); + } +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto MessageOptions::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(MessageOptions, _impl_._extensions_) + @@ -9154,6 +9896,7 @@ constexpr auto MessageOptions::InternalNewImpl_() { alignof(MessageOptions)); } } +#endif constexpr auto MessageOptions::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -9443,7 +10186,8 @@ void MessageOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, _this->_impl_.deprecated_legacy_json_field_conflicts_ = from._impl_.deprecated_legacy_json_field_conflicts_; } if (CheckHasBitForRepeated(cached_has_bits, 0x00000040U)) { - _this->_internal_mutable_uninterpreted_option()->MergeFrom( + _this->_internal_mutable_uninterpreted_option()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_uninterpreted_option()); } } @@ -10160,8 +10904,22 @@ PROTOBUF_NDEBUG_INLINE FieldOptions::Impl_::Impl_( : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, - edition_defaults_{visibility, arena, from.edition_defaults_}, - uninterpreted_option_{visibility, arena, from.uninterpreted_option_}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + edition_defaults_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FieldOptions, offsetof(::google::protobuf::FieldOptions, _impl_.edition_defaults_)>() + ), from.edition_defaults_} + #else + edition_defaults_ { visibility, arena, from.edition_defaults_ } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FieldOptions, offsetof(::google::protobuf::FieldOptions, _impl_.uninterpreted_option_)>() + ), from.uninterpreted_option_} + #else + uninterpreted_option_ { visibility, arena, from.uninterpreted_option_ } + #endif + , targets_{visibility, arena, from.targets_} {} FieldOptions::FieldOptions( @@ -10200,8 +10958,22 @@ PROTOBUF_NDEBUG_INLINE FieldOptions::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, - edition_defaults_{visibility, arena}, - uninterpreted_option_{visibility, arena}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + edition_defaults_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FieldOptions, offsetof(::google::protobuf::FieldOptions, _impl_.edition_defaults_)>() + } + #else + edition_defaults_ { visibility, arena } + #endif + , + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FieldOptions, offsetof(::google::protobuf::FieldOptions, _impl_.uninterpreted_option_)>() + } + #else + uninterpreted_option_ { visibility, arena } + #endif + , targets_{visibility, arena} {} inline void FieldOptions::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { @@ -10234,6 +11006,27 @@ inline void* PROTOBUF_NONNULL FieldOptions::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) FieldOptions(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto FieldOptions::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(FieldOptions, _impl_._extensions_) + + decltype(FieldOptions::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(FieldOptions, _impl_.targets_) + + decltype(FieldOptions::_impl_.targets_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit( + sizeof(FieldOptions), alignof(FieldOptions), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&FieldOptions::PlacementNew_, + sizeof(FieldOptions), + alignof(FieldOptions)); + } +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto FieldOptions::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(FieldOptions, _impl_._extensions_) + @@ -10261,6 +11054,7 @@ constexpr auto FieldOptions::InternalNewImpl_() { alignof(FieldOptions)); } } +#endif constexpr auto FieldOptions::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -10683,11 +11477,13 @@ void FieldOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0x000000ffU)) { if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_edition_defaults()->MergeFrom( + _this->_internal_mutable_edition_defaults()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_edition_defaults()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_uninterpreted_option()->MergeFrom( + _this->_internal_mutable_uninterpreted_option()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_uninterpreted_option()); } if (CheckHasBit(cached_has_bits, 0x00000004U)) { @@ -10812,7 +11608,14 @@ PROTOBUF_NDEBUG_INLINE OneofOptions::Impl_::Impl_( : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, - uninterpreted_option_{visibility, arena, from.uninterpreted_option_} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::OneofOptions, offsetof(::google::protobuf::OneofOptions, _impl_.uninterpreted_option_)>() + ), from.uninterpreted_option_} + #else + uninterpreted_option_ { visibility, arena, from.uninterpreted_option_ } + #endif + {} OneofOptions::OneofOptions( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, @@ -10840,7 +11643,14 @@ PROTOBUF_NDEBUG_INLINE OneofOptions::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, - uninterpreted_option_{visibility, arena} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::OneofOptions, offsetof(::google::protobuf::OneofOptions, _impl_.uninterpreted_option_)>() + } + #else + uninterpreted_option_ { visibility, arena } + #endif + {} inline void OneofOptions::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -10866,6 +11676,23 @@ inline void* PROTOBUF_NONNULL OneofOptions::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) OneofOptions(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto OneofOptions::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(OneofOptions, _impl_._extensions_) + + decltype(OneofOptions::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit( + sizeof(OneofOptions), alignof(OneofOptions), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&OneofOptions::PlacementNew_, + sizeof(OneofOptions), + alignof(OneofOptions)); + } +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto OneofOptions::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(OneofOptions, _impl_._extensions_) + @@ -10885,6 +11712,7 @@ constexpr auto OneofOptions::InternalNewImpl_() { alignof(OneofOptions)); } } +#endif constexpr auto OneofOptions::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -11089,7 +11917,8 @@ void OneofOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0x00000003U)) { if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_uninterpreted_option()->MergeFrom( + _this->_internal_mutable_uninterpreted_option()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_uninterpreted_option()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { @@ -11167,7 +11996,14 @@ PROTOBUF_NDEBUG_INLINE EnumOptions::Impl_::Impl_( : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, - uninterpreted_option_{visibility, arena, from.uninterpreted_option_} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::EnumOptions, offsetof(::google::protobuf::EnumOptions, _impl_.uninterpreted_option_)>() + ), from.uninterpreted_option_} + #else + uninterpreted_option_ { visibility, arena, from.uninterpreted_option_ } + #endif + {} EnumOptions::EnumOptions( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, @@ -11202,7 +12038,14 @@ PROTOBUF_NDEBUG_INLINE EnumOptions::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, - uninterpreted_option_{visibility, arena} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::EnumOptions, offsetof(::google::protobuf::EnumOptions, _impl_.uninterpreted_option_)>() + } + #else + uninterpreted_option_ { visibility, arena } + #endif + {} inline void EnumOptions::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -11233,6 +12076,23 @@ inline void* PROTOBUF_NONNULL EnumOptions::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) EnumOptions(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto EnumOptions::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(EnumOptions, _impl_._extensions_) + + decltype(EnumOptions::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit( + sizeof(EnumOptions), alignof(EnumOptions), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&EnumOptions::PlacementNew_, + sizeof(EnumOptions), + alignof(EnumOptions)); + } +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto EnumOptions::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(EnumOptions, _impl_._extensions_) + @@ -11252,6 +12112,7 @@ constexpr auto EnumOptions::InternalNewImpl_() { alignof(EnumOptions)); } } +#endif constexpr auto EnumOptions::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -11512,7 +12373,8 @@ void EnumOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, _this->_impl_.deprecated_legacy_json_field_conflicts_ = from._impl_.deprecated_legacy_json_field_conflicts_; } if (CheckHasBitForRepeated(cached_has_bits, 0x00000010U)) { - _this->_internal_mutable_uninterpreted_option()->MergeFrom( + _this->_internal_mutable_uninterpreted_option()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_uninterpreted_option()); } } @@ -11587,7 +12449,14 @@ PROTOBUF_NDEBUG_INLINE EnumValueOptions::Impl_::Impl_( : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, - uninterpreted_option_{visibility, arena, from.uninterpreted_option_} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::EnumValueOptions, offsetof(::google::protobuf::EnumValueOptions, _impl_.uninterpreted_option_)>() + ), from.uninterpreted_option_} + #else + uninterpreted_option_ { visibility, arena, from.uninterpreted_option_ } + #endif + {} EnumValueOptions::EnumValueOptions( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, @@ -11625,7 +12494,14 @@ PROTOBUF_NDEBUG_INLINE EnumValueOptions::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, - uninterpreted_option_{visibility, arena} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::EnumValueOptions, offsetof(::google::protobuf::EnumValueOptions, _impl_.uninterpreted_option_)>() + } + #else + uninterpreted_option_ { visibility, arena } + #endif + {} inline void EnumValueOptions::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -11657,6 +12533,23 @@ inline void* PROTOBUF_NONNULL EnumValueOptions::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) EnumValueOptions(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto EnumValueOptions::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(EnumValueOptions, _impl_._extensions_) + + decltype(EnumValueOptions::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit( + sizeof(EnumValueOptions), alignof(EnumValueOptions), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&EnumValueOptions::PlacementNew_, + sizeof(EnumValueOptions), + alignof(EnumValueOptions)); + } +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto EnumValueOptions::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(EnumValueOptions, _impl_._extensions_) + @@ -11676,6 +12569,7 @@ constexpr auto EnumValueOptions::InternalNewImpl_() { alignof(EnumValueOptions)); } } +#endif constexpr auto EnumValueOptions::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -11934,7 +12828,8 @@ void EnumValueOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0x0000001fU)) { if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_uninterpreted_option()->MergeFrom( + _this->_internal_mutable_uninterpreted_option()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_uninterpreted_option()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { @@ -12031,7 +12926,14 @@ PROTOBUF_NDEBUG_INLINE ServiceOptions::Impl_::Impl_( : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, - uninterpreted_option_{visibility, arena, from.uninterpreted_option_} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::ServiceOptions, offsetof(::google::protobuf::ServiceOptions, _impl_.uninterpreted_option_)>() + ), from.uninterpreted_option_} + #else + uninterpreted_option_ { visibility, arena, from.uninterpreted_option_ } + #endif + {} ServiceOptions::ServiceOptions( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, @@ -12060,7 +12962,14 @@ PROTOBUF_NDEBUG_INLINE ServiceOptions::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, - uninterpreted_option_{visibility, arena} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::ServiceOptions, offsetof(::google::protobuf::ServiceOptions, _impl_.uninterpreted_option_)>() + } + #else + uninterpreted_option_ { visibility, arena } + #endif + {} inline void ServiceOptions::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -12091,6 +13000,23 @@ inline void* PROTOBUF_NONNULL ServiceOptions::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) ServiceOptions(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto ServiceOptions::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(ServiceOptions, _impl_._extensions_) + + decltype(ServiceOptions::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit( + sizeof(ServiceOptions), alignof(ServiceOptions), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&ServiceOptions::PlacementNew_, + sizeof(ServiceOptions), + alignof(ServiceOptions)); + } +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto ServiceOptions::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(ServiceOptions, _impl_._extensions_) + @@ -12110,6 +13036,7 @@ constexpr auto ServiceOptions::InternalNewImpl_() { alignof(ServiceOptions)); } } +#endif constexpr auto ServiceOptions::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -12330,7 +13257,8 @@ void ServiceOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_uninterpreted_option()->MergeFrom( + _this->_internal_mutable_uninterpreted_option()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_uninterpreted_option()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { @@ -12416,7 +13344,14 @@ PROTOBUF_NDEBUG_INLINE MethodOptions::Impl_::Impl_( : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, - uninterpreted_option_{visibility, arena, from.uninterpreted_option_} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::MethodOptions, offsetof(::google::protobuf::MethodOptions, _impl_.uninterpreted_option_)>() + ), from.uninterpreted_option_} + #else + uninterpreted_option_ { visibility, arena, from.uninterpreted_option_ } + #endif + {} MethodOptions::MethodOptions( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, @@ -12451,7 +13386,14 @@ PROTOBUF_NDEBUG_INLINE MethodOptions::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, - uninterpreted_option_{visibility, arena} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + uninterpreted_option_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::MethodOptions, offsetof(::google::protobuf::MethodOptions, _impl_.uninterpreted_option_)>() + } + #else + uninterpreted_option_ { visibility, arena } + #endif + {} inline void MethodOptions::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -12482,6 +13424,23 @@ inline void* PROTOBUF_NONNULL MethodOptions::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) MethodOptions(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto MethodOptions::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(MethodOptions, _impl_._extensions_) + + decltype(MethodOptions::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit( + sizeof(MethodOptions), alignof(MethodOptions), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&MethodOptions::PlacementNew_, + sizeof(MethodOptions), + alignof(MethodOptions)); + } +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto MethodOptions::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(MethodOptions, _impl_._extensions_) + @@ -12501,6 +13460,7 @@ constexpr auto MethodOptions::InternalNewImpl_() { alignof(MethodOptions)); } } +#endif constexpr auto MethodOptions::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -12747,7 +13707,8 @@ void MethodOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_uninterpreted_option()->MergeFrom( + _this->_internal_mutable_uninterpreted_option()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_uninterpreted_option()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { @@ -13129,7 +14090,14 @@ PROTOBUF_NDEBUG_INLINE UninterpretedOption::Impl_::Impl_( [[maybe_unused]] const ::google::protobuf::UninterpretedOption& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, - name_{visibility, arena, from.name_}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + name_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::UninterpretedOption, offsetof(::google::protobuf::UninterpretedOption, _impl_.name_)>() + ), from.name_} + #else + name_ { visibility, arena, from.name_ } + #endif + , identifier_value_(arena, from.identifier_value_), string_value_(arena, from.string_value_), aggregate_value_(arena, from.aggregate_value_) {} @@ -13161,7 +14129,14 @@ PROTOBUF_NDEBUG_INLINE UninterpretedOption::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, - name_{visibility, arena}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + name_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::UninterpretedOption, offsetof(::google::protobuf::UninterpretedOption, _impl_.name_)>() + } + #else + name_ { visibility, arena } + #endif + , identifier_value_(arena), string_value_(arena), aggregate_value_(arena) {} @@ -13197,6 +14172,12 @@ inline void* PROTOBUF_NONNULL UninterpretedOption::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) UninterpretedOption(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto UninterpretedOption::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(UninterpretedOption), + alignof(UninterpretedOption)); +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto UninterpretedOption::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(UninterpretedOption, _impl_.name_) + @@ -13213,6 +14194,7 @@ constexpr auto UninterpretedOption::InternalNewImpl_() { alignof(UninterpretedOption)); } } +#endif constexpr auto UninterpretedOption::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -13492,6 +14474,7 @@ void UninterpretedOption::MergeImpl(::google::protobuf::MessageLite& to_msg, if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { from.CheckHasBitConsistency(); } + ::google::protobuf::Arena* arena = _this->GetArena(); // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UninterpretedOption) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; @@ -13500,7 +14483,8 @@ void UninterpretedOption::MergeImpl(::google::protobuf::MessageLite& to_msg, cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0x0000007fU)) { if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_name()->MergeFrom( + _this->_internal_mutable_name()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_name()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { @@ -14516,7 +15500,14 @@ PROTOBUF_NDEBUG_INLINE FeatureSetDefaults::Impl_::Impl_( [[maybe_unused]] const ::google::protobuf::FeatureSetDefaults& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, - defaults_{visibility, arena, from.defaults_} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + defaults_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FeatureSetDefaults, offsetof(::google::protobuf::FeatureSetDefaults, _impl_.defaults_)>() + ), from.defaults_} + #else + defaults_ { visibility, arena, from.defaults_ } + #endif + {} FeatureSetDefaults::FeatureSetDefaults( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, @@ -14545,7 +15536,14 @@ PROTOBUF_NDEBUG_INLINE FeatureSetDefaults::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, - defaults_{visibility, arena} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + defaults_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::FeatureSetDefaults, offsetof(::google::protobuf::FeatureSetDefaults, _impl_.defaults_)>() + } + #else + defaults_ { visibility, arena } + #endif + {} inline void FeatureSetDefaults::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -14575,6 +15573,12 @@ inline void* PROTOBUF_NONNULL FeatureSetDefaults::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) FeatureSetDefaults(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto FeatureSetDefaults::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(FeatureSetDefaults), + alignof(FeatureSetDefaults)); +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto FeatureSetDefaults::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(FeatureSetDefaults, _impl_.defaults_) + @@ -14591,6 +15595,7 @@ constexpr auto FeatureSetDefaults::InternalNewImpl_() { alignof(FeatureSetDefaults)); } } +#endif constexpr auto FeatureSetDefaults::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -14791,6 +15796,7 @@ void FeatureSetDefaults::MergeImpl(::google::protobuf::MessageLite& to_msg, if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { from.CheckHasBitConsistency(); } + ::google::protobuf::Arena* arena = _this->GetArena(); // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FeatureSetDefaults) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; @@ -14799,7 +15805,8 @@ void FeatureSetDefaults::MergeImpl(::google::protobuf::MessageLite& to_msg, cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_defaults()->MergeFrom( + _this->_internal_mutable_defaults()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_defaults()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { @@ -14874,7 +15881,14 @@ PROTOBUF_NDEBUG_INLINE SourceCodeInfo_Location::Impl_::Impl_( _path_cached_byte_size_{0}, span_{visibility, arena, from.span_}, _span_cached_byte_size_{0}, - leading_detached_comments_{visibility, arena, from.leading_detached_comments_}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + leading_detached_comments_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::SourceCodeInfo_Location, offsetof(::google::protobuf::SourceCodeInfo_Location, _impl_.leading_detached_comments_)>() + ), from.leading_detached_comments_} + #else + leading_detached_comments_ { visibility, arena, from.leading_detached_comments_ } + #endif + , leading_comments_(arena, from.leading_comments_), trailing_comments_(arena, from.trailing_comments_) {} @@ -14902,7 +15916,14 @@ PROTOBUF_NDEBUG_INLINE SourceCodeInfo_Location::Impl_::Impl_( _path_cached_byte_size_{0}, span_{visibility, arena}, _span_cached_byte_size_{0}, - leading_detached_comments_{visibility, arena}, + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + leading_detached_comments_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::SourceCodeInfo_Location, offsetof(::google::protobuf::SourceCodeInfo_Location, _impl_.leading_detached_comments_)>() + } + #else + leading_detached_comments_ { visibility, arena } + #endif + , leading_comments_(arena), trailing_comments_(arena) {} @@ -14930,6 +15951,28 @@ inline void* PROTOBUF_NONNULL SourceCodeInfo_Location::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) SourceCodeInfo_Location(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto SourceCodeInfo_Location::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(SourceCodeInfo_Location, _impl_.path_) + + decltype(SourceCodeInfo_Location::_impl_.path_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(SourceCodeInfo_Location, _impl_.span_) + + decltype(SourceCodeInfo_Location::_impl_.span_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit( + sizeof(SourceCodeInfo_Location), alignof(SourceCodeInfo_Location), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&SourceCodeInfo_Location::PlacementNew_, + sizeof(SourceCodeInfo_Location), + alignof(SourceCodeInfo_Location)); + } +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto SourceCodeInfo_Location::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(SourceCodeInfo_Location, _impl_.path_) + @@ -14954,6 +15997,7 @@ constexpr auto SourceCodeInfo_Location::InternalNewImpl_() { alignof(SourceCodeInfo_Location)); } } +#endif constexpr auto SourceCodeInfo_Location::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -15209,6 +16253,7 @@ void SourceCodeInfo_Location::MergeImpl(::google::protobuf::MessageLite& to_msg, if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { from.CheckHasBitConsistency(); } + ::google::protobuf::Arena* arena = _this->GetArena(); // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.SourceCodeInfo.Location) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; @@ -15223,7 +16268,9 @@ void SourceCodeInfo_Location::MergeImpl(::google::protobuf::MessageLite& to_msg, _this->_internal_mutable_span()->MergeFrom(from._internal_span()); } if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_leading_detached_comments()->MergeFrom(from._internal_leading_detached_comments()); + _this->_internal_mutable_leading_detached_comments()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, + from._internal_leading_detached_comments()); } if (CheckHasBit(cached_has_bits, 0x00000008U)) { _this->_internal_set_leading_comments(from._internal_leading_comments()); @@ -15287,7 +16334,14 @@ PROTOBUF_NDEBUG_INLINE SourceCodeInfo::Impl_::Impl_( : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, - location_{visibility, arena, from.location_} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + location_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::SourceCodeInfo, offsetof(::google::protobuf::SourceCodeInfo, _impl_.location_)>() + ), from.location_} + #else + location_ { visibility, arena, from.location_ } + #endif + {} SourceCodeInfo::SourceCodeInfo( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, @@ -15311,7 +16365,14 @@ PROTOBUF_NDEBUG_INLINE SourceCodeInfo::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, - location_{visibility, arena} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + location_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::SourceCodeInfo, offsetof(::google::protobuf::SourceCodeInfo, _impl_.location_)>() + } + #else + location_ { visibility, arena } + #endif + {} inline void SourceCodeInfo::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -15335,6 +16396,23 @@ inline void* PROTOBUF_NONNULL SourceCodeInfo::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) SourceCodeInfo(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto SourceCodeInfo::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(SourceCodeInfo, _impl_._extensions_) + + decltype(SourceCodeInfo::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit( + sizeof(SourceCodeInfo), alignof(SourceCodeInfo), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&SourceCodeInfo::PlacementNew_, + sizeof(SourceCodeInfo), + alignof(SourceCodeInfo)); + } +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto SourceCodeInfo::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(SourceCodeInfo, _impl_._extensions_) + @@ -15354,6 +16432,7 @@ constexpr auto SourceCodeInfo::InternalNewImpl_() { alignof(SourceCodeInfo)); } } +#endif constexpr auto SourceCodeInfo::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -15520,6 +16599,7 @@ void SourceCodeInfo::MergeImpl(::google::protobuf::MessageLite& to_msg, if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { from.CheckHasBitConsistency(); } + ::google::protobuf::Arena* arena = _this->GetArena(); // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.SourceCodeInfo) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; @@ -15527,7 +16607,8 @@ void SourceCodeInfo::MergeImpl(::google::protobuf::MessageLite& to_msg, cached_has_bits = from._impl_._has_bits_[0]; if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_location()->MergeFrom( + _this->_internal_mutable_location()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_location()); } _this->_impl_._has_bits_[0] |= cached_has_bits; @@ -15992,7 +17073,14 @@ PROTOBUF_NDEBUG_INLINE GeneratedCodeInfo::Impl_::Impl_( [[maybe_unused]] const ::google::protobuf::GeneratedCodeInfo& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, - annotation_{visibility, arena, from.annotation_} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + annotation_{visibility, (::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::GeneratedCodeInfo, offsetof(::google::protobuf::GeneratedCodeInfo, _impl_.annotation_)>() + ), from.annotation_} + #else + annotation_ { visibility, arena, from.annotation_ } + #endif + {} GeneratedCodeInfo::GeneratedCodeInfo( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, @@ -16014,7 +17102,14 @@ PROTOBUF_NDEBUG_INLINE GeneratedCodeInfo::Impl_::Impl_( [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, - annotation_{visibility, arena} {} + #ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + annotation_{visibility, ::google::protobuf::internal::InternalMetadataOffset::Build< + ::google::protobuf::GeneratedCodeInfo, offsetof(::google::protobuf::GeneratedCodeInfo, _impl_.annotation_)>() + } + #else + annotation_ { visibility, arena } + #endif + {} inline void GeneratedCodeInfo::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); @@ -16038,6 +17133,12 @@ inline void* PROTOBUF_NONNULL GeneratedCodeInfo::PlacementNew_( ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) GeneratedCodeInfo(arena); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +constexpr auto GeneratedCodeInfo::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(GeneratedCodeInfo), + alignof(GeneratedCodeInfo)); +} +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD constexpr auto GeneratedCodeInfo::InternalNewImpl_() { constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ PROTOBUF_FIELD_OFFSET(GeneratedCodeInfo, _impl_.annotation_) + @@ -16054,6 +17155,7 @@ constexpr auto GeneratedCodeInfo::InternalNewImpl_() { alignof(GeneratedCodeInfo)); } } +#endif constexpr auto GeneratedCodeInfo::InternalGenerateClassData_() { return ::google::protobuf::internal::ClassDataFull{ ::google::protobuf::internal::ClassData{ @@ -16215,6 +17317,7 @@ void GeneratedCodeInfo::MergeImpl(::google::protobuf::MessageLite& to_msg, if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { from.CheckHasBitConsistency(); } + ::google::protobuf::Arena* arena = _this->GetArena(); // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.GeneratedCodeInfo) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; @@ -16222,7 +17325,8 @@ void GeneratedCodeInfo::MergeImpl(::google::protobuf::MessageLite& to_msg, cached_has_bits = from._impl_._has_bits_[0]; if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_annotation()->MergeFrom( + _this->_internal_mutable_annotation()->MergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, from._internal_annotation()); } _this->_impl_._has_bits_[0] |= cached_has_bits; diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index 8b6954ac31b44..2bde4d33a1dc7 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -1188,7 +1188,8 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : public ::google::prot using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -1463,7 +1464,8 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf: using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -1741,7 +1743,8 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public ::google::prot using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -1978,7 +1981,8 @@ class PROTOBUF_EXPORT FieldOptions_FeatureSupport final : public ::google::proto using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -2189,7 +2193,8 @@ class PROTOBUF_EXPORT FieldOptions_EditionDefault final : public ::google::proto using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -2961,7 +2966,8 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -3218,7 +3224,8 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final : public ::google: using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -3425,7 +3432,8 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : public ::goo using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -3629,7 +3637,8 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : public ::google::pro using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -3920,7 +3929,8 @@ class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Mes using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -4314,7 +4324,8 @@ class PROTOBUF_EXPORT SourceCodeInfo final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -4513,7 +4524,8 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : public ::google::protobuf::Messa using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -4741,7 +4753,8 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : public using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -5158,7 +5171,8 @@ class PROTOBUF_EXPORT ServiceOptions final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -5564,7 +5578,8 @@ class PROTOBUF_EXPORT OneofOptions final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -6014,7 +6029,8 @@ class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -6481,7 +6497,8 @@ class PROTOBUF_EXPORT MessageOptions final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -7190,7 +7207,8 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -7869,7 +7887,8 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -8110,7 +8129,8 @@ class PROTOBUF_EXPORT FeatureSetDefaults final : public ::google::protobuf::Mess using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -8566,7 +8586,8 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::M using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -9013,7 +9034,8 @@ class PROTOBUF_EXPORT EnumValueOptions final : public ::google::protobuf::Messag using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -9457,7 +9479,8 @@ class PROTOBUF_EXPORT EnumOptions final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -9679,7 +9702,8 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : public ::google::protobuf::Me using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -9955,7 +9979,8 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : public ::google::protobuf::M using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -10362,7 +10387,8 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -10601,7 +10627,8 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : public ::google::protobuf using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -10827,7 +10854,8 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : public ::google::pr using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -11064,7 +11092,8 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : public ::google::protobuf:: using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -11355,7 +11384,8 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : public ::google::protobuf::Mes using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -11740,7 +11770,8 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -12185,7 +12216,8 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -12585,7 +12617,8 @@ class PROTOBUF_EXPORT FileDescriptorSet final : public ::google::protobuf::Messa using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit constexpr Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::internal::ConstantInitialized) noexcept; inline explicit Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); @@ -12654,7 +12687,8 @@ inline const ::google::protobuf::FileDescriptorProto& FileDescriptorSet::file(in inline ::google::protobuf::FileDescriptorProto* PROTOBUF_NONNULL FileDescriptorSet::add_file() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::FileDescriptorProto* _add = _internal_mutable_file()->Add(); + ::google::protobuf::FileDescriptorProto* _add = _internal_mutable_file()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorSet.file) return _add; @@ -12833,7 +12867,8 @@ inline void FileDescriptorProto::clear_dependency() { inline ::std::string* PROTOBUF_NONNULL FileDescriptorProto::add_dependency() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = _internal_mutable_dependency()->Add(); + ::std::string* _s = _internal_mutable_dependency()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add_mutable:google.protobuf.FileDescriptorProto.dependency) return _s; @@ -12857,9 +12892,10 @@ inline void FileDescriptorProto::set_dependency(int index, Arg_&& value, Args_.. template inline void FileDescriptorProto::add_dependency(Arg_&& value, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField(*_internal_mutable_dependency(), - ::std::forward(value), - args... ); + ::google::protobuf::internal::AddToRepeatedPtrField( + ::google::protobuf::MessageLite::internal_visibility(), GetArena(), + *_internal_mutable_dependency(), ::std::forward(value), + args... ); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.dependency) } @@ -13002,7 +13038,8 @@ inline void FileDescriptorProto::clear_option_dependency() { inline ::std::string* PROTOBUF_NONNULL FileDescriptorProto::add_option_dependency() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = _internal_mutable_option_dependency()->Add(); + ::std::string* _s = _internal_mutable_option_dependency()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000080U); // @@protoc_insertion_point(field_add_mutable:google.protobuf.FileDescriptorProto.option_dependency) return _s; @@ -13026,9 +13063,10 @@ inline void FileDescriptorProto::set_option_dependency(int index, Arg_&& value, template inline void FileDescriptorProto::add_option_dependency(Arg_&& value, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField(*_internal_mutable_option_dependency(), - ::std::forward(value), - args... ); + ::google::protobuf::internal::AddToRepeatedPtrField( + ::google::protobuf::MessageLite::internal_visibility(), GetArena(), + *_internal_mutable_option_dependency(), ::std::forward(value), + args... ); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000080U); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.option_dependency) } @@ -13088,7 +13126,8 @@ inline const ::google::protobuf::DescriptorProto& FileDescriptorProto::message_t inline ::google::protobuf::DescriptorProto* PROTOBUF_NONNULL FileDescriptorProto::add_message_type() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::DescriptorProto* _add = _internal_mutable_message_type()->Add(); + ::google::protobuf::DescriptorProto* _add = _internal_mutable_message_type()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.message_type) return _add; @@ -13142,7 +13181,8 @@ inline const ::google::protobuf::EnumDescriptorProto& FileDescriptorProto::enum_ inline ::google::protobuf::EnumDescriptorProto* PROTOBUF_NONNULL FileDescriptorProto::add_enum_type() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::EnumDescriptorProto* _add = _internal_mutable_enum_type()->Add(); + ::google::protobuf::EnumDescriptorProto* _add = _internal_mutable_enum_type()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.enum_type) return _add; @@ -13196,7 +13236,8 @@ inline const ::google::protobuf::ServiceDescriptorProto& FileDescriptorProto::se inline ::google::protobuf::ServiceDescriptorProto* PROTOBUF_NONNULL FileDescriptorProto::add_service() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::ServiceDescriptorProto* _add = _internal_mutable_service()->Add(); + ::google::protobuf::ServiceDescriptorProto* _add = _internal_mutable_service()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000008U); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.service) return _add; @@ -13250,7 +13291,8 @@ inline const ::google::protobuf::FieldDescriptorProto& FileDescriptorProto::exte inline ::google::protobuf::FieldDescriptorProto* PROTOBUF_NONNULL FileDescriptorProto::add_extension() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::FieldDescriptorProto* _add = _internal_mutable_extension()->Add(); + ::google::protobuf::FieldDescriptorProto* _add = _internal_mutable_extension()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000010U); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.extension) return _add; @@ -13899,7 +13941,8 @@ inline const ::google::protobuf::FieldDescriptorProto& DescriptorProto::field(in inline ::google::protobuf::FieldDescriptorProto* PROTOBUF_NONNULL DescriptorProto::add_field() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::FieldDescriptorProto* _add = _internal_mutable_field()->Add(); + ::google::protobuf::FieldDescriptorProto* _add = _internal_mutable_field()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.field) return _add; @@ -13953,7 +13996,8 @@ inline const ::google::protobuf::FieldDescriptorProto& DescriptorProto::extensio inline ::google::protobuf::FieldDescriptorProto* PROTOBUF_NONNULL DescriptorProto::add_extension() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::FieldDescriptorProto* _add = _internal_mutable_extension()->Add(); + ::google::protobuf::FieldDescriptorProto* _add = _internal_mutable_extension()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000010U); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension) return _add; @@ -14007,7 +14051,8 @@ inline const ::google::protobuf::DescriptorProto& DescriptorProto::nested_type(i inline ::google::protobuf::DescriptorProto* PROTOBUF_NONNULL DescriptorProto::add_nested_type() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::DescriptorProto* _add = _internal_mutable_nested_type()->Add(); + ::google::protobuf::DescriptorProto* _add = _internal_mutable_nested_type()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.nested_type) return _add; @@ -14061,7 +14106,8 @@ inline const ::google::protobuf::EnumDescriptorProto& DescriptorProto::enum_type inline ::google::protobuf::EnumDescriptorProto* PROTOBUF_NONNULL DescriptorProto::add_enum_type() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::EnumDescriptorProto* _add = _internal_mutable_enum_type()->Add(); + ::google::protobuf::EnumDescriptorProto* _add = _internal_mutable_enum_type()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.enum_type) return _add; @@ -14115,7 +14161,8 @@ inline const ::google::protobuf::DescriptorProto_ExtensionRange& DescriptorProto inline ::google::protobuf::DescriptorProto_ExtensionRange* PROTOBUF_NONNULL DescriptorProto::add_extension_range() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::DescriptorProto_ExtensionRange* _add = _internal_mutable_extension_range()->Add(); + ::google::protobuf::DescriptorProto_ExtensionRange* _add = _internal_mutable_extension_range()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000008U); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension_range) return _add; @@ -14169,7 +14216,8 @@ inline const ::google::protobuf::OneofDescriptorProto& DescriptorProto::oneof_de inline ::google::protobuf::OneofDescriptorProto* PROTOBUF_NONNULL DescriptorProto::add_oneof_decl() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::OneofDescriptorProto* _add = _internal_mutable_oneof_decl()->Add(); + ::google::protobuf::OneofDescriptorProto* _add = _internal_mutable_oneof_decl()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000020U); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.oneof_decl) return _add; @@ -14322,7 +14370,8 @@ inline const ::google::protobuf::DescriptorProto_ReservedRange& DescriptorProto: inline ::google::protobuf::DescriptorProto_ReservedRange* PROTOBUF_NONNULL DescriptorProto::add_reserved_range() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::DescriptorProto_ReservedRange* _add = _internal_mutable_reserved_range()->Add(); + ::google::protobuf::DescriptorProto_ReservedRange* _add = _internal_mutable_reserved_range()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000040U); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_range) return _add; @@ -14359,7 +14408,8 @@ inline void DescriptorProto::clear_reserved_name() { inline ::std::string* PROTOBUF_NONNULL DescriptorProto::add_reserved_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = _internal_mutable_reserved_name()->Add(); + ::std::string* _s = _internal_mutable_reserved_name()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000080U); // @@protoc_insertion_point(field_add_mutable:google.protobuf.DescriptorProto.reserved_name) return _s; @@ -14383,9 +14433,10 @@ inline void DescriptorProto::set_reserved_name(int index, Arg_&& value, Args_... template inline void DescriptorProto::add_reserved_name(Arg_&& value, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField(*_internal_mutable_reserved_name(), - ::std::forward(value), - args... ); + ::google::protobuf::internal::AddToRepeatedPtrField( + ::google::protobuf::MessageLite::internal_visibility(), GetArena(), + *_internal_mutable_reserved_name(), ::std::forward(value), + args... ); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000080U); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_name) } @@ -14710,7 +14761,8 @@ inline const ::google::protobuf::UninterpretedOption& ExtensionRangeOptions::uni inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL ExtensionRangeOptions::add_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->Add(); + ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); // @@protoc_insertion_point(field_add:google.protobuf.ExtensionRangeOptions.uninterpreted_option) return _add; @@ -14764,7 +14816,8 @@ inline const ::google::protobuf::ExtensionRangeOptions_Declaration& ExtensionRan inline ::google::protobuf::ExtensionRangeOptions_Declaration* PROTOBUF_NONNULL ExtensionRangeOptions::add_declaration() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::ExtensionRangeOptions_Declaration* _add = _internal_mutable_declaration()->Add(); + ::google::protobuf::ExtensionRangeOptions_Declaration* _add = _internal_mutable_declaration()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add:google.protobuf.ExtensionRangeOptions.declaration) return _add; @@ -15855,7 +15908,8 @@ inline const ::google::protobuf::EnumValueDescriptorProto& EnumDescriptorProto:: inline ::google::protobuf::EnumValueDescriptorProto* PROTOBUF_NONNULL EnumDescriptorProto::add_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::EnumValueDescriptorProto* _add = _internal_mutable_value()->Add(); + ::google::protobuf::EnumValueDescriptorProto* _add = _internal_mutable_value()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.value) return _add; @@ -16008,7 +16062,8 @@ inline const ::google::protobuf::EnumDescriptorProto_EnumReservedRange& EnumDesc inline ::google::protobuf::EnumDescriptorProto_EnumReservedRange* PROTOBUF_NONNULL EnumDescriptorProto::add_reserved_range() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::EnumDescriptorProto_EnumReservedRange* _add = _internal_mutable_reserved_range()->Add(); + ::google::protobuf::EnumDescriptorProto_EnumReservedRange* _add = _internal_mutable_reserved_range()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.reserved_range) return _add; @@ -16045,7 +16100,8 @@ inline void EnumDescriptorProto::clear_reserved_name() { inline ::std::string* PROTOBUF_NONNULL EnumDescriptorProto::add_reserved_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = _internal_mutable_reserved_name()->Add(); + ::std::string* _s = _internal_mutable_reserved_name()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); // @@protoc_insertion_point(field_add_mutable:google.protobuf.EnumDescriptorProto.reserved_name) return _s; @@ -16069,9 +16125,10 @@ inline void EnumDescriptorProto::set_reserved_name(int index, Arg_&& value, Args template inline void EnumDescriptorProto::add_reserved_name(Arg_&& value, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField(*_internal_mutable_reserved_name(), - ::std::forward(value), - args... ); + ::google::protobuf::internal::AddToRepeatedPtrField( + ::google::protobuf::MessageLite::internal_visibility(), GetArena(), + *_internal_mutable_reserved_name(), ::std::forward(value), + args... ); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.reserved_name) } @@ -16437,7 +16494,8 @@ inline const ::google::protobuf::MethodDescriptorProto& ServiceDescriptorProto:: inline ::google::protobuf::MethodDescriptorProto* PROTOBUF_NONNULL ServiceDescriptorProto::add_method() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::MethodDescriptorProto* _add = _internal_mutable_method()->Add(); + ::google::protobuf::MethodDescriptorProto* _add = _internal_mutable_method()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add:google.protobuf.ServiceDescriptorProto.method) return _add; @@ -18015,7 +18073,8 @@ inline const ::google::protobuf::UninterpretedOption& FileOptions::uninterpreted inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL FileOptions::add_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->Add(); + ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00100000U); // @@protoc_insertion_point(field_add:google.protobuf.FileOptions.uninterpreted_option) return _add; @@ -18317,7 +18376,8 @@ inline const ::google::protobuf::UninterpretedOption& MessageOptions::uninterpre inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL MessageOptions::add_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->Add(); + ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000040U); // @@protoc_insertion_point(field_add:google.protobuf.MessageOptions.uninterpreted_option) return _add; @@ -18975,7 +19035,8 @@ inline const ::google::protobuf::FieldOptions_EditionDefault& FieldOptions::edit inline ::google::protobuf::FieldOptions_EditionDefault* PROTOBUF_NONNULL FieldOptions::add_edition_defaults() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::FieldOptions_EditionDefault* _add = _internal_mutable_edition_defaults()->Add(); + ::google::protobuf::FieldOptions_EditionDefault* _add = _internal_mutable_edition_defaults()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add:google.protobuf.FieldOptions.edition_defaults) return _add; @@ -19227,7 +19288,8 @@ inline const ::google::protobuf::UninterpretedOption& FieldOptions::uninterprete inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL FieldOptions::add_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->Add(); + ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); // @@protoc_insertion_point(field_add:google.protobuf.FieldOptions.uninterpreted_option) return _add; @@ -19384,7 +19446,8 @@ inline const ::google::protobuf::UninterpretedOption& OneofOptions::uninterprete inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL OneofOptions::add_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->Add(); + ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add:google.protobuf.OneofOptions.uninterpreted_option) return _add; @@ -19628,7 +19691,8 @@ inline const ::google::protobuf::UninterpretedOption& EnumOptions::uninterpreted inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL EnumOptions::add_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->Add(); + ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000010U); // @@protoc_insertion_point(field_add:google.protobuf.EnumOptions.uninterpreted_option) return _add; @@ -19942,7 +20006,8 @@ inline const ::google::protobuf::UninterpretedOption& EnumValueOptions::uninterp inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL EnumValueOptions::add_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->Add(); + ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add:google.protobuf.EnumValueOptions.uninterpreted_option) return _add; @@ -20128,7 +20193,8 @@ inline const ::google::protobuf::UninterpretedOption& ServiceOptions::uninterpre inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL ServiceOptions::add_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->Add(); + ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add:google.protobuf.ServiceOptions.uninterpreted_option) return _add; @@ -20346,7 +20412,8 @@ inline const ::google::protobuf::UninterpretedOption& MethodOptions::uninterpret inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL MethodOptions::add_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->Add(); + ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add:google.protobuf.MethodOptions.uninterpreted_option) return _add; @@ -20506,7 +20573,8 @@ inline const ::google::protobuf::UninterpretedOption_NamePart& UninterpretedOpti inline ::google::protobuf::UninterpretedOption_NamePart* PROTOBUF_NONNULL UninterpretedOption::add_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::UninterpretedOption_NamePart* _add = _internal_mutable_name()->Add(); + ::google::protobuf::UninterpretedOption_NamePart* _add = _internal_mutable_name()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add:google.protobuf.UninterpretedOption.name) return _add; @@ -21356,7 +21424,8 @@ inline const ::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault& Fe inline ::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault* PROTOBUF_NONNULL FeatureSetDefaults::add_defaults() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault* _add = _internal_mutable_defaults()->Add(); + ::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault* _add = _internal_mutable_defaults()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add:google.protobuf.FeatureSetDefaults.defaults) return _add; @@ -21699,7 +21768,8 @@ inline void SourceCodeInfo_Location::clear_leading_detached_comments() { inline ::std::string* PROTOBUF_NONNULL SourceCodeInfo_Location::add_leading_detached_comments() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = _internal_mutable_leading_detached_comments()->Add(); + ::std::string* _s = _internal_mutable_leading_detached_comments()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); // @@protoc_insertion_point(field_add_mutable:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) return _s; @@ -21723,9 +21793,10 @@ inline void SourceCodeInfo_Location::set_leading_detached_comments(int index, Ar template inline void SourceCodeInfo_Location::add_leading_detached_comments(Arg_&& value, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField(*_internal_mutable_leading_detached_comments(), - ::std::forward(value), - args... ); + ::google::protobuf::internal::AddToRepeatedPtrField( + ::google::protobuf::MessageLite::internal_visibility(), GetArena(), + *_internal_mutable_leading_detached_comments(), ::std::forward(value), + args... ); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) } @@ -21789,7 +21860,8 @@ inline const ::google::protobuf::SourceCodeInfo_Location& SourceCodeInfo::locati inline ::google::protobuf::SourceCodeInfo_Location* PROTOBUF_NONNULL SourceCodeInfo::add_location() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::SourceCodeInfo_Location* _add = _internal_mutable_location()->Add(); + ::google::protobuf::SourceCodeInfo_Location* _add = _internal_mutable_location()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.location) return _add; @@ -22060,7 +22132,8 @@ inline const ::google::protobuf::GeneratedCodeInfo_Annotation& GeneratedCodeInfo inline ::google::protobuf::GeneratedCodeInfo_Annotation* PROTOBUF_NONNULL GeneratedCodeInfo::add_annotation() ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::GeneratedCodeInfo_Annotation* _add = _internal_mutable_annotation()->Add(); + ::google::protobuf::GeneratedCodeInfo_Annotation* _add = _internal_mutable_annotation()->AddWithArena( + ::google::protobuf::MessageLite::internal_visibility(), GetArena()); SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.annotation) return _add; diff --git a/src/google/protobuf/dynamic_message.cc b/src/google/protobuf/dynamic_message.cc index c28b7a8cef41b..5015e26e97398 100644 --- a/src/google/protobuf/dynamic_message.cc +++ b/src/google/protobuf/dynamic_message.cc @@ -62,6 +62,7 @@ #include "google/protobuf/generated_message_reflection.h" #include "google/protobuf/generated_message_util.h" #include "google/protobuf/has_bits.h" +#include "google/protobuf/internal_metadata_locator.h" #include "google/protobuf/map.h" #include "google/protobuf/map_field.h" #include "google/protobuf/message_lite.h" @@ -496,6 +497,12 @@ void DynamicMessage::SharedCtor(bool lock_factory) { } for (int i = 0; i < descriptor->field_count(); i++) { const FieldDescriptor* field = descriptor->field(i); +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + size_t field_offset = FieldOffset(i); + const auto offset = + internal::InternalMetadataOffset::BuildFromDynamicOffset< + DynamicMessage>(field_offset); +#endif void* field_ptr = MutableRaw(i); if (InRealOneof(field)) { continue; @@ -571,7 +578,11 @@ void DynamicMessage::SharedCtor(bool lock_factory) { ArenaStringPtr* asp = new (field_ptr) ArenaStringPtr(); asp->InitDefault(); } else { +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + new (field_ptr) RepeatedPtrField(offset); +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD new (field_ptr) RepeatedPtrField(arena); +#endif } break; } @@ -599,7 +610,11 @@ void DynamicMessage::SharedCtor(bool lock_factory) { : nullptr, arena); } else { +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + new (field_ptr) RepeatedPtrField(offset); +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD new (field_ptr) RepeatedPtrField(arena); +#endif } } break; diff --git a/src/google/protobuf/generated_message_util.h b/src/google/protobuf/generated_message_util.h index 969ad4e68800f..11efd3c492e74 100644 --- a/src/google/protobuf/generated_message_util.h +++ b/src/google/protobuf/generated_message_util.h @@ -38,6 +38,7 @@ #include "google/protobuf/any.h" #include "google/protobuf/has_bits.h" #include "google/protobuf/implicit_weak_message.h" +#include "google/protobuf/internal_visibility.h" #include "google/protobuf/message_lite.h" #include "google/protobuf/port.h" #include "google/protobuf/repeated_field.h" @@ -369,14 +370,18 @@ inline void AssignToString(std::string& dest, absl::string_view value, // This overload set is used to implement `add_xxx()` methods for repeated // string fields in generated code. template -void AddToRepeatedPtrField(google::protobuf::RepeatedPtrField& dest, +void AddToRepeatedPtrField(InternalVisibility visibility, google::protobuf::Arena* arena, + google::protobuf::RepeatedPtrField& dest, Arg&& value, Args... args) { - AssignToString(*dest.Add(), std::forward(value), args...); + AssignToString(*dest.AddWithArena(visibility, arena), + std::forward(value), args...); } -inline void AddToRepeatedPtrField(google::protobuf::RepeatedPtrField& dest, +inline void AddToRepeatedPtrField(InternalVisibility visibility, + google::protobuf::Arena* arena, + google::protobuf::RepeatedPtrField& dest, std::string&& value, BytesTag /*tag*/ = BytesTag{}) { - dest.Add(std::move(value)); + dest.AddWithArena(visibility, arena, std::move(value)); } constexpr std::optional EncodePlacementArenaOffsets( diff --git a/src/google/protobuf/implicit_weak_message.h b/src/google/protobuf/implicit_weak_message.h index cdf905d2b7007..d0361060635ca 100644 --- a/src/google/protobuf/implicit_weak_message.h +++ b/src/google/protobuf/implicit_weak_message.h @@ -9,13 +9,16 @@ #define GOOGLE_PROTOBUF_IMPLICIT_WEAK_MESSAGE_H__ #include +#include #include #include "google/protobuf/arena.h" #include "google/protobuf/generated_message_tctable_decl.h" +#include "google/protobuf/internal_visibility.h" #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/message_lite.h" -#include "google/protobuf/repeated_field.h" +#include "google/protobuf/port.h" +#include "google/protobuf/repeated_ptr_field.h" #ifdef SWIG #error "You cannot SWIG proto headers" @@ -149,6 +152,16 @@ struct WeakRepeatedPtrField { : WeakRepeatedPtrField(nullptr, rhs) {} // Arena enabled constructors: for internal use only. +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + constexpr WeakRepeatedPtrField(internal::InternalVisibility, + internal::InternalMetadataOffset offset) + : WeakRepeatedPtrField(offset) {} + WeakRepeatedPtrField(internal::InternalVisibility, + internal::InternalMetadataOffset offset, + const WeakRepeatedPtrField& rhs) + : WeakRepeatedPtrField(offset, rhs) {} + +#else WeakRepeatedPtrField(internal::InternalVisibility, Arena* arena) : WeakRepeatedPtrField(arena) {} WeakRepeatedPtrField(internal::InternalVisibility, Arena* arena, @@ -157,6 +170,7 @@ struct WeakRepeatedPtrField { // TODO: make this constructor private explicit WeakRepeatedPtrField(Arena* arena) : weak(arena) {} +#endif ~WeakRepeatedPtrField() { if (weak.NeedsDestroy()) { @@ -198,6 +212,11 @@ struct WeakRepeatedPtrField { if (other.empty()) return; base().template MergeFrom(other.base(), base().GetArena()); } + void MergeFromWithArena(internal::InternalVisibility, Arena* arena, + const WeakRepeatedPtrField& other) { + if (other.empty()) return; + base().template MergeFrom(other.base(), arena); + } void InternalSwap(WeakRepeatedPtrField* PROTOBUF_RESTRICT other) { base().InternalSwap(&other->base()); } @@ -217,12 +236,59 @@ struct WeakRepeatedPtrField { } private: +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + constexpr explicit WeakRepeatedPtrField( + internal::InternalMetadataOffset offset) + : weak(offset) {} + WeakRepeatedPtrField(internal::InternalMetadataOffset offset, + const WeakRepeatedPtrField& rhs) + : WeakRepeatedPtrField(offset) { + MergeFrom(rhs); + } +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD WeakRepeatedPtrField(Arena* arena, const WeakRepeatedPtrField& rhs) : WeakRepeatedPtrField(arena) { MergeFrom(rhs); } +#endif }; +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +namespace internal { + +template +class WeakRepeatedPtrFieldWithArena { + public: + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; + + static const int kInternalMetadataOffset; + + explicit WeakRepeatedPtrFieldWithArena(Arena* arena) + : internal_metadata_(arena), + field_(/*internal_metadata_offset=*/kInternalMetadataOffset) {} + + const WeakRepeatedPtrField& field() const { return field_; } + WeakRepeatedPtrField& field() { return field_; } + + void Clear() { field_.Clear(); } + + private: + // Clang thinks this field is unused, but field_ accesses it indirectly + // through internal_metadata_offset_. + [[maybe_unused]] InternalMetadata internal_metadata_; + WeakRepeatedPtrField field_; +}; + +template +const int WeakRepeatedPtrFieldWithArena::kInternalMetadataOffset = + static_cast( + offsetof(WeakRepeatedPtrFieldWithArena, internal_metadata_)) - + static_cast(offsetof(WeakRepeatedPtrFieldWithArena, field_)); + +} // namespace internal +#endif // PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/internal_metadata_locator.h b/src/google/protobuf/internal_metadata_locator.h new file mode 100644 index 0000000000000..a3113c42385cc --- /dev/null +++ b/src/google/protobuf/internal_metadata_locator.h @@ -0,0 +1,170 @@ +#ifndef GOOGLE_PROTOBUF_INTERNAL_METADATA_LOCATOR_H__ +#define GOOGLE_PROTOBUF_INTERNAL_METADATA_LOCATOR_H__ + +#include +#include +#include + +#include "absl/log/absl_check.h" +#include "google/protobuf/arena.h" +#include "google/protobuf/metadata_lite.h" + +namespace google { +namespace protobuf { +namespace internal { + +// A wrapper around the offset to internal metadata that is only constructible +// via the API's provided in this header. This is done to minimize the room for +// error in calculating internal metadata offsets. +class InternalMetadataOffset { + // The offset to arena to use when there is no arena. + static constexpr int32_t kSentinelInternalMetadataOffset = 0; + + public: + // A sentinel `InternalMetadataOffset`, which does not point to any metadata. + constexpr InternalMetadataOffset() = default; + + // Constructs an `InternalMetadataOffset` which can recover the + // `InternalMetadata` from a containing type `T` given a reference to the + // field at offset `FieldOffset` within `T`. + // + // This method expects to find a field with name `_internal_metadata_` in `T`, + // and the type of that field should be `InternalMetadata`. + template + static constexpr InternalMetadataOffset Build() { + static_assert( + std::is_same_v, + InternalMetadata>, + "Field `_internal_metadata_ is not of type `InternalMetadata`"); + + constexpr int64_t kInternalMetadataOffset = + static_cast(offsetof(T, _internal_metadata_)); + + static_assert( + kInternalMetadataOffset - static_cast(kFieldOffset) >= + int64_t{INT32_MIN}, + "Offset from `_internal_metadata_` is underflowing an int32_t, " + "likely meaning your message body is too large."); + static_assert( + kInternalMetadataOffset - static_cast(kFieldOffset) <= + int64_t{INT32_MAX}, + "Offset from `_internal_metadata_` is overflowing an int32_t, " + "likely meaning your message body is too large."); + + return InternalMetadataOffset( + static_cast(kInternalMetadataOffset) - + static_cast(kFieldOffset)); + } + + // Builds an `InternalMetadataOffset` from a dynamic offset from the start of + // `T`. This is used by `DynamicMessage` to build an `InternalMetadataOffset` + // for a field at a given offset from the start of the message. + // + // This function performs a runtime check to ensure that the offset from + // `_internal_metadata_` to the field is within the range of an int32_t. This + // is necessary to prevent integer overflow when calculating the offset. + template + static InternalMetadataOffset BuildFromDynamicOffset(size_t field_offset) { + static_assert( + std::is_base_of_v, + "BuildFromDynamicOffset can only be used for `DynamicMessage`"); + + constexpr int64_t kInternalMetadataOffset = + static_cast(offsetof(T, _internal_metadata_)); + + ABSL_DCHECK_GE(kInternalMetadataOffset - static_cast(field_offset), + int64_t{INT32_MIN}) + << "Offset from `_internal_metadata_` to the field at offset " + << field_offset + << " is underflowing an int32_t, likely meaning your message body is " + "too large."; + ABSL_DCHECK_LE(kInternalMetadataOffset - static_cast(field_offset), + int64_t{INT32_MAX}) + << "Offset from `_internal_metadata_` to the field at offset " + << field_offset + << " is overflowing an int32_t, likely meaning your message body is " + "too large."; + + return InternalMetadataOffset( + static_cast(kInternalMetadataOffset) - + static_cast(field_offset)); + } + + // If true, this `InternalMetadataOffset` does not point to any metadata. + constexpr bool IsSentinel() const { + return offset_ == kSentinelInternalMetadataOffset; + } + + // The offset from the start of the field to the internal metadata of the + // containing type (either a `MessageLite` or some other internal class, like + // `RepeatedPtrFieldWithArena`). + // + // This should only be called if `IsSentinel()` is false. + constexpr int32_t Offset() const { + ABSL_DCHECK(!IsSentinel()); + return offset_; + } + + private: + // A private constructor for non-sentinel offsets which can only be called + // from the constructors in this header. + explicit constexpr InternalMetadataOffset(int32_t offset) : offset_(offset) {} + + int32_t offset_ = kSentinelInternalMetadataOffset; +}; + +// A class which can recover the `InternalMetadata` field from a containing type +// given a reference to a field contained by that type. +class InternalMetadataResolver { + public: + // Builds an `InternalMetadataResolver` which points to no metadata. + constexpr InternalMetadataResolver() = default; + + constexpr explicit InternalMetadataResolver(InternalMetadataOffset offset) + : offset_(offset) {} + + private: + template + friend inline Arena* ResolveArena(const T* object); + + // Finds the `Arena*` from the `InternalMetadata` of the containing type given + // the `this` pointer to the field contained by that type. + template + static inline Arena* FindArena(const T* object) { + auto& resolver = object->*Resolver; + if (resolver.offset_.IsSentinel()) { + return nullptr; + } + return resolver.FindInternalMetadata(object).arena(); + } + + // Finds the `InternalMetadata` by adding the offset to the address of the + // start of the field. + inline const InternalMetadata& FindInternalMetadata(const void* _this) const { + return *reinterpret_cast( + reinterpret_cast(_this) + offset_.Offset()); + } + + InternalMetadataOffset offset_; +}; + +// Resolves an Arena* from the `InternalMetadata` of a containing type (which +// has a member `InternalMetadata _internal_metadata_`) given a reference to a +// field of type `T` contained by that type. +// +// The template parameter `Resolver` is a pointer-to-member to the +// `InternalMetadataResolver` field of `object`. +// +// `object` must have been constructed by the containing type, which is +// responsible for correctly constructing the `InternalMetadataOffset` for +// `object`. +template +inline Arena* ResolveArena(const T* object) { + return InternalMetadataResolver::FindArena(object); +} + +} // namespace internal +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_INTERNAL_METADATA_LOCATOR_H__ diff --git a/src/google/protobuf/internal_metadata_locator_test.cc b/src/google/protobuf/internal_metadata_locator_test.cc new file mode 100644 index 0000000000000..556c2468955b9 --- /dev/null +++ b/src/google/protobuf/internal_metadata_locator_test.cc @@ -0,0 +1,86 @@ +#include "google/protobuf/internal_metadata_locator.h" + +#include +#include + +#include +#include "google/protobuf/arena.h" +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/message_lite.h" +#include "google/protobuf/metadata_lite.h" +#include "google/protobuf/unittest.pb.h" + +// Must be included last. +#include "google/protobuf/port_def.inc" + +namespace google::protobuf::internal { +namespace { + +// Since the `MoreString` message has only one field, the offset of the field is +// sizeof(MessageLite) + sizeof(void*) for hasbits. +static constexpr size_t kMoreStringFieldOffset = + sizeof(MessageLite) + sizeof(void*); + +#ifdef PROTOBUF_CUSTOM_VTABLE +static constexpr size_t kMoreStringInternalMetadataOffset = 0; +#else +static constexpr size_t kMoreStringInternalMetadataOffset = sizeof(void*); +#endif + +struct FieldWithInternalMetadataOffset { + explicit FieldWithInternalMetadataOffset(InternalMetadataOffset offset) + : resolver(offset) {} + + int field = 0; + InternalMetadataResolver resolver; +}; + +struct StructWithInternalMetadata { + StructWithInternalMetadata() = default; + explicit StructWithInternalMetadata(Arena* arena) + : _internal_metadata_(arena), + field(InternalMetadataOffset::Build()) {} + + InternalMetadata _internal_metadata_; + FieldWithInternalMetadataOffset field; +}; + +TEST(InternalMetadataLocatorTest, Sentinel) { + constexpr InternalMetadataOffset offset; + EXPECT_TRUE(offset.IsSentinel()); +} + +TEST(InternalMetadataLocatorTest, BuildFromStaticOffset) { + constexpr auto offset = + InternalMetadataOffset::Build(); + EXPECT_FALSE(offset.IsSentinel()); + EXPECT_EQ(offset.Offset(), -static_cast(sizeof(void*))); +} + +TEST(InternalMetadataLocatorTest, BuildFromStaticOffsetForProtoMessage) { + constexpr auto offset = + InternalMetadataOffset::Build(); + EXPECT_FALSE(offset.IsSentinel()); + EXPECT_EQ(offset.Offset(), + -static_cast(kMoreStringFieldOffset - + kMoreStringInternalMetadataOffset)); +} + +TEST(InternalMetadataLocatorTest, ReadArenaFromInternalMetadata) { + Arena arena; + StructWithInternalMetadata message(&arena); + const auto* field = &message.field; + EXPECT_EQ((ResolveArena<&FieldWithInternalMetadataOffset::resolver>(field)), + &arena); +} + +} // namespace +} // namespace protobuf +} // namespace google::internal + +#include "google/protobuf/port_undef.inc" diff --git a/src/google/protobuf/map_field.cc b/src/google/protobuf/map_field.cc index 179a6b221fa4a..04fa5939a8715 100644 --- a/src/google/protobuf/map_field.cc +++ b/src/google/protobuf/map_field.cc @@ -238,8 +238,7 @@ void MapFieldBase::SwapPayload(MapFieldBase& lhs, MapFieldBase& rhs) { if (p1 == nullptr) p1 = &lhs.payload(); if (p2 == nullptr) p2 = &rhs.payload(); - p1->repeated_field.Swap(&p2->repeated_field); - SwapRelaxed(p1->state, p2->state); + p1->Swap(*p2); } void MapFieldBase::InternalSwap(MapFieldBase* other) { @@ -251,11 +250,11 @@ size_t MapFieldBase::SpaceUsedExcludingSelfLong() const { ConstAccess(); size_t size = 0; if (auto* p = maybe_payload()) { - absl::MutexLock lock(&p->mutex); + absl::MutexLock lock(p->mutex()); // Measure the map under the lock, because there could be some repeated // field data that might be sync'd back into the map. size = GetMapRaw().SpaceUsedExcludingSelfLong(); - size += p->repeated_field.SpaceUsedExcludingSelfLong(); + size += p->repeated_field().SpaceUsedExcludingSelfLong(); ConstAccess(); } else { // Only measure the map without the repeated field, because it is not there. @@ -281,7 +280,7 @@ void MapFieldBase::SetRepeatedDirty() { MutableAccess(); // These are called by (non-const) mutator functions. So by our API it's the // callers responsibility to have these calls properly ordered. - payload().state.store(STATE_MODIFIED_REPEATED, std::memory_order_relaxed); + payload().set_state(STATE_MODIFIED_REPEATED, std::memory_order_relaxed); } const RepeatedPtrFieldBase& MapFieldBase::SyncRepeatedFieldWithMap( @@ -301,19 +300,18 @@ const RepeatedPtrFieldBase& MapFieldBase::SyncRepeatedFieldWithMap( } { - absl::MutexLock lock(&p->mutex); + absl::MutexLock lock(p->mutex()); // Double check state, because another thread may have seen the same // state and done the synchronization before the current thread. - if (p->state.load(std::memory_order_relaxed) == STATE_MODIFIED_MAP) { + if (p->state(std::memory_order_relaxed) == STATE_MODIFIED_MAP) { const_cast(this)->SyncRepeatedFieldWithMapNoLock(); - p->state.store(CLEAN, std::memory_order_release); + p->set_state(CLEAN, std::memory_order_release); } } ConstAccess(); - return reinterpret_cast(p->repeated_field); + return static_cast(p->repeated_field()); } - return reinterpret_cast( - payload().repeated_field); + return static_cast(payload().repeated_field()); } void MapFieldBase::SyncRepeatedFieldWithMapNoLock() { @@ -323,7 +321,7 @@ void MapFieldBase::SyncRepeatedFieldWithMapNoLock() { const FieldDescriptor* key_des = descriptor->map_key(); const FieldDescriptor* val_des = descriptor->map_value(); - RepeatedPtrField& rep = payload().repeated_field; + RepeatedPtrField& rep = payload().repeated_field(); rep.Clear(); ConstMapIterator it(this, descriptor); @@ -407,12 +405,12 @@ void MapFieldBase::SyncMapWithRepeatedField() const { if (state() == STATE_MODIFIED_REPEATED) { auto& p = payload(); { - absl::MutexLock lock(&p.mutex); + absl::MutexLock lock(p.mutex()); // Double check state, because another thread may have seen the same state // and done the synchronization before the current thread. - if (p.state.load(std::memory_order_relaxed) == STATE_MODIFIED_REPEATED) { + if (p.state(std::memory_order_relaxed) == STATE_MODIFIED_REPEATED) { const_cast(this)->SyncMapWithRepeatedFieldNoLock(); - p.state.store(CLEAN, std::memory_order_release); + p.set_state(CLEAN, std::memory_order_release); } } ConstAccess(); @@ -422,7 +420,7 @@ void MapFieldBase::SyncMapWithRepeatedField() const { void MapFieldBase::SyncMapWithRepeatedFieldNoLock() { ClearMapNoSync(); - RepeatedPtrField& rep = payload().repeated_field; + RepeatedPtrField& rep = payload().repeated_field(); if (rep.empty()) return; @@ -492,7 +490,7 @@ void MapFieldBase::SyncMapWithRepeatedFieldNoLock() { void MapFieldBase::Clear() { if (ReflectionPayload* p = maybe_payload()) { - p->repeated_field.Clear(); + p->repeated_field().Clear(); } ClearMapNoSync(); @@ -511,6 +509,11 @@ bool MapFieldBase::InsertOrLookupMapValue(const MapKey& map_key, return InsertOrLookupMapValueNoSync(map_key, val); } +void MapFieldBase::ReflectionPayload::Swap(ReflectionPayload& other) { + repeated_field().Swap(&other.repeated_field()); + SwapRelaxed(state_, other.state_); +} + } // namespace internal template diff --git a/src/google/protobuf/map_field.h b/src/google/protobuf/map_field.h index c976cfbcb6ff9..4599e457a681c 100644 --- a/src/google/protobuf/map_field.h +++ b/src/google/protobuf/map_field.h @@ -30,6 +30,7 @@ #include "google/protobuf/message_lite.h" #include "google/protobuf/port.h" #include "google/protobuf/repeated_field.h" +#include "google/protobuf/repeated_ptr_field.h" #include "google/protobuf/unknown_field_set.h" @@ -389,7 +390,7 @@ class PROTOBUF_EXPORT MapFieldBase : public MapFieldBaseForParse { // callers responsibility to have these calls properly ordered. if (auto* p = maybe_payload()) { // If we don't have a payload, it is already assumed `STATE_MODIFIED_MAP`. - p->state.store(STATE_MODIFIED_MAP, std::memory_order_relaxed); + p->set_state(STATE_MODIFIED_MAP, std::memory_order_relaxed); } } @@ -429,18 +430,43 @@ class PROTOBUF_EXPORT MapFieldBase : public MapFieldBaseForParse { CLEAN = 2, // data in map and repeated field are same }; - struct ReflectionPayload { - explicit ReflectionPayload(Arena* arena) : repeated_field(arena) {} - RepeatedPtrField repeated_field; + class ReflectionPayload { + public: + explicit ReflectionPayload(Arena* arena) : repeated_field_(arena) {} - absl::Mutex mutex; // The thread to synchronize map and repeated - // field needs to get lock first; - std::atomic state{STATE_MODIFIED_MAP}; + RepeatedPtrField& repeated_field() { +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + return repeated_field_.field(); +#else + return repeated_field_; +#endif + } + + absl::Mutex& mutex() { return mutex_; } + + State state(std::memory_order memory_order) const { + return state_.load(memory_order); + } + void set_state(State state, std::memory_order memory_order) { + state_.store(state, memory_order); + } + + void Swap(ReflectionPayload& other); + + private: +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + RepeatedPtrFieldWithArena repeated_field_; +#else + RepeatedPtrField repeated_field_; +#endif + absl::Mutex mutex_; // The thread to synchronize map and repeated + // field needs to get lock first; + std::atomic state_{STATE_MODIFIED_MAP}; }; Arena* arena() const { auto p = payload_.load(std::memory_order_acquire); - if (IsPayload(p)) return ToPayload(p)->repeated_field.GetArena(); + if (IsPayload(p)) return ToPayload(p)->repeated_field().GetArena(); return ToArena(p); } @@ -458,7 +484,7 @@ class PROTOBUF_EXPORT MapFieldBase : public MapFieldBaseForParse { State state() const { auto* p = maybe_payload(); - return p != nullptr ? p->state.load(std::memory_order_acquire) + return p != nullptr ? p->state(std::memory_order_acquire) // The default : STATE_MODIFIED_MAP; } diff --git a/src/google/protobuf/map_field_test.cc b/src/google/protobuf/map_field_test.cc index 553afe54b6b36..076a562c6aa42 100644 --- a/src/google/protobuf/map_field_test.cc +++ b/src/google/protobuf/map_field_test.cc @@ -248,7 +248,7 @@ class MapFieldStateTest EXPECT_EQ(repeated_size, map_field->maybe_payload() == nullptr ? 0 - : map_field->maybe_payload()->repeated_field.size()); + : map_field->maybe_payload()->repeated_field().size()); } std::unique_ptr arena_; diff --git a/src/google/protobuf/message_lite.h b/src/google/protobuf/message_lite.h index 8bec7c69ba2ea..6a356b142c081 100644 --- a/src/google/protobuf/message_lite.h +++ b/src/google/protobuf/message_lite.h @@ -309,6 +309,9 @@ struct DescriptorTable; class DescriptorPoolExtensionFinder; class ExtensionSet; class HasBitsTestPeer; +class InternalMetadataOffset; +template +struct InternalMetadataOffsetHelper; class LazyField; class RepeatedPtrFieldBase; class TcParser; @@ -1094,6 +1097,9 @@ class PROTOBUF_EXPORT MessageLite { friend class internal::DescriptorPoolExtensionFinder; friend class internal::ExtensionSet; friend class internal::HasBitsTestPeer; + friend class internal::InternalMetadataOffset; + template + friend struct internal::InternalMetadataOffsetHelper; friend class internal::LazyField; friend class internal::SwapFieldHelper; friend class internal::TcParser; diff --git a/src/google/protobuf/repeated_ptr_field.cc b/src/google/protobuf/repeated_ptr_field.cc index b3ebe830d6316..d9032cac5c4b8 100644 --- a/src/google/protobuf/repeated_ptr_field.cc +++ b/src/google/protobuf/repeated_ptr_field.cc @@ -34,6 +34,15 @@ namespace protobuf { namespace internal { +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +RepeatedPtrFieldWithArenaBase::RepeatedPtrFieldWithArenaBase(Arena* arena) + : _internal_metadata_(arena), + field_( + InternalMetadataOffset::Build()) {} +#endif + MessageLite* CloneSlow(Arena* arena, const MessageLite& value) { auto* msg = value.New(arena); msg->CheckTypeAndMergeFrom(value); @@ -128,7 +137,7 @@ void InternalOutOfLineDeleteMessageLite(MessageLite* message) { } template PROTOBUF_EXPORT_TEMPLATE_DEFINE void -memswap::value>( +memswap::value>( char* PROTOBUF_RESTRICT, char* PROTOBUF_RESTRICT); template <> diff --git a/src/google/protobuf/repeated_ptr_field.h b/src/google/protobuf/repeated_ptr_field.h index 8bafe06f82b3a..2a851b933f70c 100644 --- a/src/google/protobuf/repeated_ptr_field.h +++ b/src/google/protobuf/repeated_ptr_field.h @@ -39,6 +39,7 @@ #include "absl/meta/type_traits.h" #include "google/protobuf/arena.h" #include "google/protobuf/arena_align.h" +#include "google/protobuf/internal_metadata_locator.h" #include "google/protobuf/internal_visibility.h" #include "google/protobuf/message_lite.h" #include "google/protobuf/port.h" @@ -53,6 +54,7 @@ namespace google { namespace protobuf { +class DynamicMessage; class Message; class Reflection; @@ -63,19 +65,22 @@ namespace internal { class MergePartialFromCodedStreamHelper; class SwapFieldHelper; +class MapFieldBase; -} // namespace internal +class MapFieldBase; -namespace internal { template class RepeatedPtrIterator; template class RepeatedPtrOverPtrsIterator; template class AllocatedRepeatedPtrFieldBackInsertIterator; -} // namespace internal -namespace internal { +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +class RepeatedPtrFieldWithArenaBase; +template +class RepeatedPtrFieldWithArena; +#endif // Swaps two non-overlapping blocks of memory of size `N` template @@ -85,12 +90,16 @@ inline void memswap(char* PROTOBUF_RESTRICT a, char* PROTOBUF_RESTRICT b) { std::swap_ranges(a, a + N, b); } -// A trait that tells offset of `T::arena_`. +// A trait that tells offset of `T::resolver_`. // // Do not use this struct - it exists for internal use only. template -struct ArenaOffsetHelper { +struct InternalMetadataResolverOffsetHelper { +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + static constexpr size_t value = offsetof(T, resolver_); +#else static constexpr size_t value = offsetof(T, arena_); +#endif }; // Copies the object in the arena. @@ -161,9 +170,21 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { GenericTypeHandler, TypeHandler>::type; constexpr RepeatedPtrFieldBase() - : tagged_rep_or_elem_(nullptr), current_size_(0), arena_(nullptr) {} + : tagged_rep_or_elem_(nullptr), + current_size_(0) +#ifndef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + , + arena_(nullptr) +#endif + { + } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + constexpr explicit RepeatedPtrFieldBase(InternalMetadataOffset offset) + : tagged_rep_or_elem_(nullptr), current_size_(0), resolver_(offset) {} +#else explicit RepeatedPtrFieldBase(Arena* arena) : tagged_rep_or_elem_(nullptr), current_size_(0), arena_(arena) {} +#endif RepeatedPtrFieldBase(const RepeatedPtrFieldBase&) = delete; RepeatedPtrFieldBase& operator=(const RepeatedPtrFieldBase&) = delete; @@ -334,8 +355,9 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { inline void InternalSwap(RepeatedPtrFieldBase* PROTOBUF_RESTRICT rhs) { ABSL_DCHECK(this != rhs); - // Swap all fields except arena pointer at once. - internal::memswap::value>( + // Swap all fields except arena offset and arena pointer at once. + internal::memswap< + InternalMetadataResolverOffsetHelper::value>( reinterpret_cast(this), reinterpret_cast(rhs)); } @@ -564,19 +586,24 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { UnsafeArenaAddAllocated(my_arena, value); } - // TODO - Outline this function so a future change can use a - // type in its implementation that requires `RepeatedPtrFieldBase` to be fully - // defined. template PROTOBUF_NOINLINE void SwapFallback(Arena* arena, RepeatedPtrFieldBase* other, Arena* other_arena); // Gets the Arena on which this RepeatedPtrField stores its elements. - inline Arena* GetArena() const { return arena_; } + inline Arena* GetArena() const { +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + return ResolveArena<&RepeatedPtrFieldBase::resolver_>(this); +#else + return arena_; +#endif + } +#ifndef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD static constexpr size_t InternalGetArenaOffset(internal::InternalVisibility) { return PROTOBUF_FIELD_OFFSET(RepeatedPtrFieldBase, arena_); } +#endif // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD private: // Tests that need to access private methods. @@ -586,6 +613,10 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + friend internal::RepeatedPtrFieldWithArenaBase; +#endif + friend google::protobuf::Arena; template @@ -601,7 +632,7 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { // The MapFieldBase implementation needs to call protected methods directly, // reinterpreting pointers as being to Message instead of a specific Message // subclass. - friend class MapFieldBase; + friend MapFieldBase; friend struct MapFieldTestPeer; // The table-driven MergePartialFromCodedStream implementation needs to @@ -615,10 +646,10 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { friend class internal::TcParser; // TODO: Remove this friend. - // Expose offset of `arena_` without exposing the member itself. - // Used to optimize code size of `InternalSwap` method. + // Expose offset of `resolver_` without exposing the member itself. Used to + // optimize code size of `InternalSwap` method. template - friend struct ArenaOffsetHelper; + friend struct InternalMetadataResolverOffsetHelper; // The reflection implementation needs to call protected methods directly, // reinterpreting pointers as being to Message instead of a specific Message @@ -778,8 +809,12 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { // significant performance for memory-sensitive workloads. void* tagged_rep_or_elem_; int current_size_; +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + InternalMetadataResolver resolver_; +#else const int arena_offset_placeholder_do_not_use_ = 0; Arena* arena_; +#endif }; // Appends all message values from `from` to this instance using the abstract @@ -837,6 +872,30 @@ inline void* RepeatedPtrFieldBase::AddInternal( return result; } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +// A container that holds a RepeatedPtrFieldBase and an arena pointer. This is +// only used for `RepeatedPtrFieldBase::SwapFallback`, which temporarily needs +// a RepeatedPtrFieldBase and an arena pointer to avoid doing extra copies, but +// doesn't have complete type information on `Element` yet. +class RepeatedPtrFieldWithArenaBase { + public: + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; + + explicit RepeatedPtrFieldWithArenaBase(Arena* arena); + + RepeatedPtrFieldBase& field() { return field_; } + + private: + friend class InternalMetadataOffset; + + // Clang thinks this field is unused, but field_ accesses it indirectly + // through resolver_. + [[maybe_unused]] const InternalMetadata _internal_metadata_; + RepeatedPtrFieldBase field_; +}; +#endif // PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + template PROTOBUF_NOINLINE void RepeatedPtrFieldBase::SwapFallback( Arena* arena, RepeatedPtrFieldBase* other, Arena* other_arena) { @@ -847,7 +906,12 @@ PROTOBUF_NOINLINE void RepeatedPtrFieldBase::SwapFallback( // Copy semantics in this case. We try to improve efficiency by placing the // temporary on |other|'s arena so that messages are copied twice rather // than three times. +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + RepeatedPtrFieldWithArenaBase temp_container(other_arena); + RepeatedPtrFieldBase& temp = temp_container.field(); +#else RepeatedPtrFieldBase temp(other_arena); +#endif if (!this->empty()) { temp.MergeFrom(*this, other_arena); } @@ -1005,18 +1069,20 @@ struct RepeatedPtrFieldArenaRep {}; template <> struct RepeatedPtrFieldArenaRep { - // TODO - With removed arena pointers, we will need a class that - // holds both the arena pointer and the repeated field, and points the - // repeated to the arena pointer. +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + using Type = RepeatedPtrFieldWithArenaBase; +#else using Type = RepeatedPtrFieldBase; +#endif }; template struct RepeatedPtrFieldArenaRep> { - // TODO - With removed arena pointers, we will need a class that - // holds both the arena pointer and the repeated field, and points the - // repeated to the arena pointer. +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + using Type = RepeatedPtrFieldWithArena; +#else using Type = RepeatedPtrField; +#endif }; } // namespace internal @@ -1067,6 +1133,16 @@ class ABSL_ATTRIBUTE_WARN_UNUSED RepeatedPtrField final constexpr RepeatedPtrField(); // Arena enabled constructors: for internal use only. +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + constexpr RepeatedPtrField(internal::InternalVisibility, + internal::InternalMetadataOffset offset) + : RepeatedPtrField(offset) {} + RepeatedPtrField(internal::InternalVisibility, + internal::InternalMetadataOffset offset, + const RepeatedPtrField& rhs) + : RepeatedPtrField(offset, rhs) {} + +#else RepeatedPtrField(internal::InternalVisibility, Arena* arena) : RepeatedPtrField(arena) {} RepeatedPtrField(internal::InternalVisibility, Arena* arena, @@ -1076,6 +1152,7 @@ class ABSL_ATTRIBUTE_WARN_UNUSED RepeatedPtrField final // TODO: make constructor private [[deprecated("Use Arena::Create>(Arena*) instead")]] explicit RepeatedPtrField(Arena* arena); +#endif // PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD template friend struct WeakRepeatedPtrField; +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + friend internal::RepeatedPtrFieldWithArena; +#endif + + // The MapFieldBase implementation needs to be able to static_cast down to + // `RepeatedPtrFieldBase`. + friend internal::MapFieldBase; + // Note: RepeatedPtrField SHOULD NOT be subclassed by users. using TypeHandler = internal::GenericTypeHandler; +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + constexpr explicit RepeatedPtrField(internal::InternalMetadataOffset offset); + RepeatedPtrField(internal::InternalMetadataOffset offset, + const RepeatedPtrField& rhs); + RepeatedPtrField(internal::InternalMetadataOffset offset, + RepeatedPtrField&& rhs); +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD RepeatedPtrField(Arena* arena, const RepeatedPtrField& rhs); RepeatedPtrField(Arena* arena, RepeatedPtrField&& rhs); +#endif void AddAllocatedForParse(Element* p, Arena* arena) { @@ -1381,6 +1516,25 @@ constexpr RepeatedPtrField::RepeatedPtrField() StaticValidityCheck(); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +template +constexpr inline RepeatedPtrField::RepeatedPtrField( + internal::InternalMetadataOffset offset) + : RepeatedPtrFieldBase(offset) { + // We can't have StaticValidityCheck here because that requires Element to be + // a complete type, and in split repeated fields cases, we call + // CreateMessage> for incomplete Ts. +} + +template +inline RepeatedPtrField::RepeatedPtrField( + internal::InternalMetadataOffset offset, const RepeatedPtrField& rhs) + : RepeatedPtrFieldBase(offset) { + StaticValidityCheck(); + MergeFrom(rhs); +} + +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD template inline RepeatedPtrField::RepeatedPtrField(Arena* arena) : RepeatedPtrFieldBase(arena) { @@ -1397,6 +1551,7 @@ inline RepeatedPtrField::RepeatedPtrField(Arena* arena, if (rhs.empty()) return; RepeatedPtrFieldBase::MergeFrom(rhs, arena); } +#endif template template @@ -1423,6 +1578,23 @@ inline RepeatedPtrField& RepeatedPtrField::operator=( return *this; } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +template +inline RepeatedPtrField::RepeatedPtrField( + internal::InternalMetadataOffset offset, RepeatedPtrField&& rhs) + : RepeatedPtrFieldBase(offset) { + // We don't just call Swap(&rhs) here because it would perform 3 copies if rhs + // is on a different arena. + Arena* arena = GetArena(); + Arena* rhs_arena = rhs.GetArena(); + if (internal::CanMoveWithInternalSwap(arena, rhs_arena)) { + InternalSwap(&rhs); + } else { + RepeatedPtrFieldBase::CopyFrom(rhs, arena); + } +} + +#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD template inline RepeatedPtrField::RepeatedPtrField(Arena* arena, RepeatedPtrField&& rhs) @@ -1435,6 +1607,7 @@ inline RepeatedPtrField::RepeatedPtrField(Arena* arena, RepeatedPtrFieldBase::CopyFrom(rhs, arena); } } +#endif template inline RepeatedPtrField& RepeatedPtrField::operator=( @@ -1493,11 +1666,23 @@ PROTOBUF_NDEBUG_INLINE Element* RepeatedPtrField::Add() return RepeatedPtrFieldBase::Add(GetArena()); } +template +PROTOBUF_NDEBUG_INLINE Element* RepeatedPtrField::AddWithArena( + internal::InternalVisibility, Arena* arena) ABSL_ATTRIBUTE_LIFETIME_BOUND { + return RepeatedPtrFieldBase::Add(arena); +} + template PROTOBUF_NDEBUG_INLINE void RepeatedPtrField::Add(Element&& value) { RepeatedPtrFieldBase::Add(GetArena(), std::move(value)); } +template +PROTOBUF_NDEBUG_INLINE void RepeatedPtrField::AddWithArena( + internal::InternalVisibility, Arena* arena, Element&& value) { + RepeatedPtrFieldBase::Add(arena, std::move(value)); +} + template template PROTOBUF_NDEBUG_INLINE void RepeatedPtrField::Add(Iter begin, @@ -1600,6 +1785,13 @@ inline void RepeatedPtrField::MergeFrom( RepeatedPtrFieldBase::MergeFrom(other, GetArena()); } +template +inline void RepeatedPtrField::MergeFromWithArena( + internal::InternalVisibility, Arena* arena, const RepeatedPtrField& other) { + if (other.empty()) return; + RepeatedPtrFieldBase::MergeFrom(other, arena); +} + template inline void RepeatedPtrField::CopyFrom(const RepeatedPtrField& other) { RepeatedPtrFieldBase::CopyFrom(other, GetArena()); @@ -2198,6 +2390,79 @@ inline T* CheckedMutableOrAbort(RepeatedPtrField* field, int index) { return field->Mutable(index); } +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD +// A container that holds a RepeatedPtrField and an arena pointer. This +// is used for both directly arena-allocated RepeatedPtrField's and split +// RepeatedPtrField's. Both cases need to return the correct thing when a user +// calls `GetArena()` on the RepeatedPtrField. +// +// Since RepeatedPtrField's can only point to an existing arena pointer "nearby" +// in memory, we will need to store the arena pointer alongside individually +// allocated RepeatedPtrField's. +template +class RepeatedPtrFieldWithArena { + public: + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; + + explicit RepeatedPtrFieldWithArena(Arena* arena) + : _internal_metadata_(arena) { + new (field_storage_) RepeatedPtrField(kOffset); + } + + RepeatedPtrFieldWithArena(Arena* arena, + const RepeatedPtrField& other) + : _internal_metadata_(arena) { + ABSL_DCHECK_NE(arena, nullptr); + new (field_storage_) RepeatedPtrField(kOffset, other); + } + + RepeatedPtrFieldWithArena(Arena* arena, RepeatedPtrField&& other) + : _internal_metadata_(arena) { + ABSL_DCHECK_NE(arena, nullptr); + new (field_storage_) RepeatedPtrField(kOffset, std::move(other)); + } + + ~RepeatedPtrFieldWithArena() { field().~RepeatedPtrField(); } + + const RepeatedPtrField& field() const { + return *reinterpret_cast*>(field_storage_); + } + RepeatedPtrField& field() { + return *reinterpret_cast*>(field_storage_); + } + + void Clear() { field().Clear(); } + + private: + friend class internal::InternalMetadataOffset; + + static const internal::InternalMetadataOffset kOffset; + + // Clang thinks this field is unused, but field_ accesses it indirectly + // through resolver_. + [[maybe_unused]] const InternalMetadata _internal_metadata_; + // We can't have a member with type `RepeatedPtrField` here because + // that will require `Element` to be a complete type, and in split repeated + // fields cases, we call `CreateMessage>` for incomplete + // `T`s. When the constructor of `RepeatedPtrFieldWithArena` is invoked, both + // the constructor and destructor of all members are pulled in, and the + // destructor of `RepeatedPtrField` calls + // `StaticValidityCheck`, which requires `Element` to be a complete + // type. + alignas(RepeatedPtrField) uint8_t + field_storage_[sizeof(RepeatedPtrField)]; +}; + +template +constexpr internal::InternalMetadataOffset + RepeatedPtrFieldWithArena::kOffset = + internal::InternalMetadataOffset::Build< + RepeatedPtrFieldWithArena, + offsetof(RepeatedPtrFieldWithArena, field_storage_)>(); + +#endif // PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + } // namespace internal // Provides a back insert iterator for RepeatedPtrField instances, @@ -2252,7 +2517,7 @@ namespace internal { // Size optimization for `memswap` - supplied below N is used by every // `RepeatedPtrField`. extern template PROTOBUF_EXPORT_TEMPLATE_DECLARE void -memswap::value>( +memswap::value>( char* PROTOBUF_RESTRICT, char* PROTOBUF_RESTRICT); } // namespace internal diff --git a/src/google/protobuf/repeated_ptr_field_unittest.cc b/src/google/protobuf/repeated_ptr_field_unittest.cc index 874141d345389..40f8ee56665b2 100644 --- a/src/google/protobuf/repeated_ptr_field_unittest.cc +++ b/src/google/protobuf/repeated_ptr_field_unittest.cc @@ -829,20 +829,32 @@ TEST(RepeatedPtrFieldTest, CopyConstruct) { EXPECT_EQ("1", destination1.Get(0)); EXPECT_EQ("2", destination1.Get(1)); +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + RepeatedPtrField destination2( + token, internal::InternalMetadataOffset(), source); +#else RepeatedPtrField destination2(token, nullptr, source); +#endif ASSERT_EQ(2, destination2.size()); EXPECT_EQ("1", destination2.Get(0)); EXPECT_EQ("2", destination2.Get(1)); } TEST(RepeatedPtrFieldTest, CopyConstructWithArena) { +#ifndef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD auto token = internal::InternalVisibilityForTesting{}; +#endif RepeatedPtrField source; source.Add()->assign("1"); source.Add()->assign("2"); Arena arena; +#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD + RepeatedPtrFieldWithArena destination_container(&arena, source); + auto& destination = destination_container.field(); +#else RepeatedPtrField destination(token, &arena, source); +#endif ASSERT_EQ(2, destination.size()); EXPECT_EQ("1", destination.Get(0)); EXPECT_EQ("2", destination.Get(1));