Pass arena down to `RepeatedPtrField` accessors in generated code.
Future optimizations to `RepeatedPtrField` will make `GetArena()` more expensive. Reading the arena pointer directly from the message will be cheaper, so we should pass arena pointers down to `RepeatedPtrField`s from the containing message whenever possible.
We define `Internal(Add|MergeFrom)WithArena` methods which take an arena pointer as an argument, which is required to be the arena pointer from the parent message. These specializations are for internal use only, and function the same as their public counterparts, aside from avoiding a call to `RepeatedPtrField::GetArena()`.
PiperOrigin-RevId: 810533181
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 913662c..f4acb9c 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 @@
void GenerateIsInitialized(io::Printer* p) const override;
bool NeedsIsInitialized() const override;
+ bool RequiresArena(GeneratorFunction function) const override;
+
private:
const Options* opts_;
bool has_required_;
@@ -831,7 +833,9 @@
ABSL_ATTRIBUTE_LIFETIME_BOUND {
$WeakDescriptorSelfPin$;
$TsanDetectConcurrentMutation$;
- $Submsg$* _add = _internal_mutable_$name_internal$()->Add();
+ $Submsg$* _add =
+ _internal_mutable_$name_internal$()->InternalAddWithArena(
+ $pb$::MessageLite::internal_visibility(), GetArena());
$set_hasbit$;
$annotate_add_mutable$;
// @@protoc_insertion_point(field_add:$pkg.Msg.field$)
@@ -908,7 +912,8 @@
// `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$()->InternalMergeFromWithArena(
+ $pb$::MessageLite::internal_visibility(), arena,
from._internal$_weak$_$name$());
)cc");
};
@@ -940,7 +945,9 @@
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$()->InternalMergeFromWithArena(
+ $pb$::MessageLite::internal_visibility(), arena,
+ from._internal$_weak$_$name$());
}
)cc");
}
@@ -1047,6 +1054,15 @@
}
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<FieldGeneratorBase> 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 510821c..9b5200d 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 @@
}
}
+ 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$()->InternalMergeFromWithArena(
+ $pb$::MessageLite::internal_visibility(), arena,
+ from._internal_$name$());
)cc");
};
if (!should_split()) {
@@ -793,7 +803,9 @@
if (should_split()) {
p->Emit(R"cc(
if (!from._internal_$name$().empty()) {
- _internal_mutable_$name$()->MergeFrom(from._internal_$name$());
+ _internal_mutable_$name$()->InternalMergeFromWithArena(
+ $pb$::MessageLite::internal_visibility(), arena,
+ from._internal_$name$());
}
)cc");
}
@@ -869,7 +881,9 @@
ABSL_ATTRIBUTE_LIFETIME_BOUND {
$WeakDescriptorSelfPin$;
$TsanDetectConcurrentMutation$;
- ::std::string* _s = _internal_mutable_$name_internal$()->Add();
+ ::std::string* _s =
+ _internal_mutable_$name_internal$()->InternalAddWithArena(
+ $pb$::MessageLite::internal_visibility(), GetArena());
$set_hasbit$;
$annotate_add_mutable$;
// @@protoc_insertion_point(field_add_mutable:$pkg.Msg.field$)
@@ -907,9 +921,10 @@
inline void $Msg$::add_$name$(Arg_&& value, Args_... args) {
$WeakDescriptorSelfPin$;
$TsanDetectConcurrentMutation$;
- $pbi$::AddToRepeatedPtrField(*_internal_mutable_$name_internal$(),
- ::std::forward<Arg_>(value),
- args... $bytes_tag$);
+ $pbi$::AddToRepeatedPtrField(
+ $pb$::MessageLite::internal_visibility(), GetArena(),
+ *_internal_mutable_$name_internal$(), ::std::forward<Arg_>(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 e384124..4b4ef26 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 @@
}
}
+ 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$()->InternalMergeFromWithArena(
+ $pb$::MessageLite::internal_visibility(), arena,
+ from._internal_$name$());
)cc");
};
if (!should_split()) {
@@ -670,7 +680,9 @@
if (should_split()) {
p->Emit(R"cc(
if (!from._internal_$name$().empty()) {
- _internal_mutable_$name$()->MergeFrom(from._internal_$name$());
+ _internal_mutable_$name$()->InternalMergeFromWithArena(
+ $pb$::MessageLite::internal_visibility(), arena,
+ from._internal_$name$());
}
)cc");
}
@@ -757,7 +769,9 @@
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<Arg_>(value) $bytes_tag$);
$set_hasbit$;
$annotate_add$;
diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc
index 6c0b502..5dd5e28 100644
--- a/src/google/protobuf/compiler/plugin.pb.cc
+++ b/src/google/protobuf/compiler/plugin.pb.cc
@@ -1025,10 +1025,13 @@
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()->InternalMergeFromWithArena(
+ ::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()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
from._internal_proto_file());
}
if (CheckHasBit(cached_has_bits, 0x00000004U)) {
@@ -1043,7 +1046,8 @@
}
}
if (CheckHasBitForRepeated(cached_has_bits, 0x00000010U)) {
- _this->_internal_mutable_source_file_descriptors()->MergeFrom(
+ _this->_internal_mutable_source_file_descriptors()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
from._internal_source_file_descriptors());
}
}
@@ -1799,6 +1803,7 @@
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 +1812,8 @@
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()->InternalMergeFromWithArena(
+ ::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 645b7e0..c5b5d43 100644
--- a/src/google/protobuf/compiler/plugin.pb.h
+++ b/src/google/protobuf/compiler/plugin.pb.h
@@ -1361,7 +1361,9 @@
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()->InternalAddWithArena(
+ ::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 +1387,10 @@
template <typename Arg_, typename... Args_>
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<Arg_>(value),
- args... );
+ ::google::protobuf::internal::AddToRepeatedPtrField(
+ ::google::protobuf::MessageLite::internal_visibility(), GetArena(),
+ *_internal_mutable_file_to_generate(), ::std::forward<Arg_>(value),
+ args... );
SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U);
// @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
}
@@ -1510,7 +1513,9 @@
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()->InternalAddWithArena(
+ ::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 +1563,9 @@
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()->InternalAddWithArena(
+ ::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 +2182,9 @@
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()->InternalAddWithArena(
+ ::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/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc
index 983abc3..a972be6 100644
--- a/src/google/protobuf/descriptor.pb.cc
+++ b/src/google/protobuf/descriptor.pb.cc
@@ -2526,6 +2526,7 @@
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 +2534,8 @@
cached_has_bits = from._impl_._has_bits_[0];
if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) {
- _this->_internal_mutable_file()->MergeFrom(
+ _this->_internal_mutable_file()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
from._internal_file());
}
_this->_impl_._has_bits_[0] |= cached_has_bits;
@@ -3224,22 +3226,28 @@
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()->InternalMergeFromWithArena(
+ ::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()->InternalMergeFromWithArena(
+ ::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()->InternalMergeFromWithArena(
+ ::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()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
from._internal_service());
}
if (CheckHasBitForRepeated(cached_has_bits, 0x00000010U)) {
- _this->_internal_mutable_extension()->MergeFrom(
+ _this->_internal_mutable_extension()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
from._internal_extension());
}
if (CheckHasBitForRepeated(cached_has_bits, 0x00000020U)) {
@@ -3249,7 +3257,9 @@
_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()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
+ from._internal_option_dependency());
}
}
if (BatchCheckHasBit(cached_has_bits, 0x00003f00U)) {
@@ -4562,35 +4572,44 @@
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()->InternalMergeFromWithArena(
+ ::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()->InternalMergeFromWithArena(
+ ::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()->InternalMergeFromWithArena(
+ ::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()->InternalMergeFromWithArena(
+ ::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()->InternalMergeFromWithArena(
+ ::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()->InternalMergeFromWithArena(
+ ::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()->InternalMergeFromWithArena(
+ ::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()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
+ from._internal_reserved_name());
}
}
if (BatchCheckHasBit(cached_has_bits, 0x00000700U)) {
@@ -5402,11 +5421,13 @@
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()->InternalMergeFromWithArena(
+ ::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()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
from._internal_uninterpreted_option());
}
if (CheckHasBit(cached_has_bits, 0x00000004U)) {
@@ -7024,15 +7045,19 @@
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()->InternalMergeFromWithArena(
+ ::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()->InternalMergeFromWithArena(
+ ::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()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
+ from._internal_reserved_name());
}
if (CheckHasBit(cached_has_bits, 0x00000008U)) {
_this->_internal_set_name(from._internal_name());
@@ -7751,7 +7776,8 @@
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()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
from._internal_method());
}
if (CheckHasBit(cached_has_bits, 0x00000002U)) {
@@ -8982,7 +9008,8 @@
_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()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
from._internal_uninterpreted_option());
}
}
@@ -9443,7 +9470,8 @@
_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()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
from._internal_uninterpreted_option());
}
}
@@ -10683,11 +10711,13 @@
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()->InternalMergeFromWithArena(
+ ::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()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
from._internal_uninterpreted_option());
}
if (CheckHasBit(cached_has_bits, 0x00000004U)) {
@@ -11089,7 +11119,8 @@
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()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
from._internal_uninterpreted_option());
}
if (CheckHasBit(cached_has_bits, 0x00000002U)) {
@@ -11512,7 +11543,8 @@
_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()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
from._internal_uninterpreted_option());
}
}
@@ -11934,7 +11966,8 @@
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()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
from._internal_uninterpreted_option());
}
if (CheckHasBit(cached_has_bits, 0x00000002U)) {
@@ -12330,7 +12363,8 @@
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()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
from._internal_uninterpreted_option());
}
if (CheckHasBit(cached_has_bits, 0x00000002U)) {
@@ -12747,7 +12781,8 @@
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()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
from._internal_uninterpreted_option());
}
if (CheckHasBit(cached_has_bits, 0x00000002U)) {
@@ -13492,6 +13527,7 @@
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 +13536,8 @@
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()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
from._internal_name());
}
if (CheckHasBit(cached_has_bits, 0x00000002U)) {
@@ -14791,6 +14828,7 @@
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 +14837,8 @@
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()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
from._internal_defaults());
}
if (CheckHasBit(cached_has_bits, 0x00000002U)) {
@@ -15209,6 +15248,7 @@
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 +15263,9 @@
_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()->InternalMergeFromWithArena(
+ ::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());
@@ -15520,6 +15562,7 @@
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 +15570,8 @@
cached_has_bits = from._impl_._has_bits_[0];
if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) {
- _this->_internal_mutable_location()->MergeFrom(
+ _this->_internal_mutable_location()->InternalMergeFromWithArena(
+ ::google::protobuf::MessageLite::internal_visibility(), arena,
from._internal_location());
}
_this->_impl_._has_bits_[0] |= cached_has_bits;
@@ -16215,6 +16259,7 @@
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 +16267,8 @@
cached_has_bits = from._impl_._has_bits_[0];
if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) {
- _this->_internal_mutable_annotation()->MergeFrom(
+ _this->_internal_mutable_annotation()->InternalMergeFromWithArena(
+ ::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 8b6954a..82fa6ba 100644
--- a/src/google/protobuf/descriptor.pb.h
+++ b/src/google/protobuf/descriptor.pb.h
@@ -12654,7 +12654,9 @@
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()->InternalAddWithArena(
+ ::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 +12835,9 @@
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()->InternalAddWithArena(
+ ::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 +12861,10 @@
template <typename Arg_, typename... Args_>
inline void FileDescriptorProto::add_dependency(Arg_&& value, Args_... args) {
::google::protobuf::internal::TSanWrite(&_impl_);
- ::google::protobuf::internal::AddToRepeatedPtrField(*_internal_mutable_dependency(),
- ::std::forward<Arg_>(value),
- args... );
+ ::google::protobuf::internal::AddToRepeatedPtrField(
+ ::google::protobuf::MessageLite::internal_visibility(), GetArena(),
+ *_internal_mutable_dependency(), ::std::forward<Arg_>(value),
+ args... );
SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U);
// @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.dependency)
}
@@ -13002,7 +13007,9 @@
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()->InternalAddWithArena(
+ ::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 +13033,10 @@
template <typename Arg_, typename... Args_>
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<Arg_>(value),
- args... );
+ ::google::protobuf::internal::AddToRepeatedPtrField(
+ ::google::protobuf::MessageLite::internal_visibility(), GetArena(),
+ *_internal_mutable_option_dependency(), ::std::forward<Arg_>(value),
+ args... );
SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000080U);
// @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.option_dependency)
}
@@ -13088,7 +13096,9 @@
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()->InternalAddWithArena(
+ ::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 +13152,9 @@
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()->InternalAddWithArena(
+ ::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 +13208,9 @@
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()->InternalAddWithArena(
+ ::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 +13264,9 @@
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()->InternalAddWithArena(
+ ::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 +13915,9 @@
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()->InternalAddWithArena(
+ ::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 +13971,9 @@
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()->InternalAddWithArena(
+ ::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 +14027,9 @@
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()->InternalAddWithArena(
+ ::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 +14083,9 @@
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()->InternalAddWithArena(
+ ::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 +14139,9 @@
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()->InternalAddWithArena(
+ ::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 +14195,9 @@
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()->InternalAddWithArena(
+ ::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 +14350,9 @@
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()->InternalAddWithArena(
+ ::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 +14389,9 @@
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()->InternalAddWithArena(
+ ::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 +14415,10 @@
template <typename Arg_, typename... Args_>
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<Arg_>(value),
- args... );
+ ::google::protobuf::internal::AddToRepeatedPtrField(
+ ::google::protobuf::MessageLite::internal_visibility(), GetArena(),
+ *_internal_mutable_reserved_name(), ::std::forward<Arg_>(value),
+ args... );
SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000080U);
// @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_name)
}
@@ -14710,7 +14743,9 @@
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()->InternalAddWithArena(
+ ::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 +14799,9 @@
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()->InternalAddWithArena(
+ ::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 +15892,9 @@
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()->InternalAddWithArena(
+ ::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 +16047,9 @@
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()->InternalAddWithArena(
+ ::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 +16086,9 @@
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()->InternalAddWithArena(
+ ::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 +16112,10 @@
template <typename Arg_, typename... Args_>
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<Arg_>(value),
- args... );
+ ::google::protobuf::internal::AddToRepeatedPtrField(
+ ::google::protobuf::MessageLite::internal_visibility(), GetArena(),
+ *_internal_mutable_reserved_name(), ::std::forward<Arg_>(value),
+ args... );
SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U);
// @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.reserved_name)
}
@@ -16437,7 +16481,9 @@
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()->InternalAddWithArena(
+ ::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 +18061,9 @@
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()->InternalAddWithArena(
+ ::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 +18365,9 @@
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()->InternalAddWithArena(
+ ::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 +19025,9 @@
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()->InternalAddWithArena(
+ ::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 +19279,9 @@
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()->InternalAddWithArena(
+ ::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 +19438,9 @@
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()->InternalAddWithArena(
+ ::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 +19684,9 @@
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()->InternalAddWithArena(
+ ::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 +20000,9 @@
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()->InternalAddWithArena(
+ ::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 +20188,9 @@
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()->InternalAddWithArena(
+ ::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 +20408,9 @@
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()->InternalAddWithArena(
+ ::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 +20570,9 @@
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()->InternalAddWithArena(
+ ::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 +21422,9 @@
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()->InternalAddWithArena(
+ ::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 +21767,9 @@
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()->InternalAddWithArena(
+ ::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 @@
template <typename Arg_, typename... Args_>
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<Arg_>(value),
- args... );
+ ::google::protobuf::internal::AddToRepeatedPtrField(
+ ::google::protobuf::MessageLite::internal_visibility(), GetArena(),
+ *_internal_mutable_leading_detached_comments(), ::std::forward<Arg_>(value),
+ args... );
SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U);
// @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
}
@@ -21789,7 +21860,9 @@
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()->InternalAddWithArena(
+ ::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 +22133,9 @@
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()->InternalAddWithArena(
+ ::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/generated_message_util.h b/src/google/protobuf/generated_message_util.h
index 969ad4e..ba99a3d 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 @@
// This overload set is used to implement `add_xxx()` methods for repeated
// string fields in generated code.
template <typename Arg, typename... Args>
-void AddToRepeatedPtrField(google::protobuf::RepeatedPtrField<std::string>& dest,
+void AddToRepeatedPtrField(InternalVisibility visibility, google::protobuf::Arena* arena,
+ google::protobuf::RepeatedPtrField<std::string>& dest,
Arg&& value, Args... args) {
- AssignToString(*dest.Add(), std::forward<Arg>(value), args...);
+ AssignToString(*dest.InternalAddWithArena(visibility, arena),
+ std::forward<Arg>(value), args...);
}
-inline void AddToRepeatedPtrField(google::protobuf::RepeatedPtrField<std::string>& dest,
+inline void AddToRepeatedPtrField(InternalVisibility visibility,
+ google::protobuf::Arena* arena,
+ google::protobuf::RepeatedPtrField<std::string>& dest,
std::string&& value,
BytesTag /*tag*/ = BytesTag{}) {
- dest.Add(std::move(value));
+ dest.InternalAddWithArena(visibility, arena, std::move(value));
}
constexpr std::optional<uintptr_t> EncodePlacementArenaOffsets(
diff --git a/src/google/protobuf/implicit_weak_message.h b/src/google/protobuf/implicit_weak_message.h
index cdf905d..8d58024 100644
--- a/src/google/protobuf/implicit_weak_message.h
+++ b/src/google/protobuf/implicit_weak_message.h
@@ -13,9 +13,11 @@
#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/repeated_ptr_field.h"
#ifdef SWIG
#error "You cannot SWIG proto headers"
@@ -198,6 +200,11 @@
if (other.empty()) return;
base().template MergeFrom<MessageLite>(other.base(), base().GetArena());
}
+ void InternalMergeFromWithArena(internal::InternalVisibility, Arena* arena,
+ const WeakRepeatedPtrField& other) {
+ if (other.empty()) return;
+ base().template MergeFrom<MessageLite>(other.base(), arena);
+ }
void InternalSwap(WeakRepeatedPtrField* PROTOBUF_RESTRICT other) {
base().InternalSwap(&other->base());
}
diff --git a/src/google/protobuf/repeated_ptr_field.h b/src/google/protobuf/repeated_ptr_field.h
index afb17ca..bc2ddaf 100644
--- a/src/google/protobuf/repeated_ptr_field.h
+++ b/src/google/protobuf/repeated_ptr_field.h
@@ -1344,6 +1344,30 @@
internal::RepeatedPtrFieldBase::InternalSwap(other);
}
+ // For internal use only.
+ //
+ // Like `Add()`, but uses the given arena instead of calling `GetArena()`. It
+ // is the responsibility of the caller to ensure that this arena is the same
+ // as the arena returned from `GetArena()`.
+ pointer InternalAddWithArena(internal::InternalVisibility,
+ Arena* arena) ABSL_ATTRIBUTE_LIFETIME_BOUND;
+
+ // For internal use only.
+ //
+ // Like `Add(Element&&)`, but uses the given arena instead of calling
+ // `GetArena()`. It is the responsibility of the caller to ensure that this
+ // arena is the same as the arena returned from `GetArena()`.
+ void InternalAddWithArena(internal::InternalVisibility, Arena* arena,
+ Element&& value);
+
+ // For internal use only.
+ //
+ // Like `MergeFrom(const RepeatedPtrField& other)`, but uses the given arena
+ // instead of calling `GetArena()`. It is the responsibility of the caller to
+ // ensure that this arena is the same as the arena returned from `GetArena()`.
+ void InternalMergeFromWithArena(internal::InternalVisibility, Arena* arena,
+ const RepeatedPtrField& other);
+
using RepeatedPtrFieldBase::InternalGetArenaOffset;
private:
@@ -1497,11 +1521,23 @@
}
template <typename Element>
+PROTOBUF_NDEBUG_INLINE Element* RepeatedPtrField<Element>::InternalAddWithArena(
+ internal::InternalVisibility, Arena* arena) ABSL_ATTRIBUTE_LIFETIME_BOUND {
+ return RepeatedPtrFieldBase::Add<TypeHandler>(arena);
+}
+
+template <typename Element>
PROTOBUF_NDEBUG_INLINE void RepeatedPtrField<Element>::Add(Element&& value) {
RepeatedPtrFieldBase::Add<TypeHandler>(GetArena(), std::move(value));
}
template <typename Element>
+PROTOBUF_NDEBUG_INLINE void RepeatedPtrField<Element>::InternalAddWithArena(
+ internal::InternalVisibility, Arena* arena, Element&& value) {
+ RepeatedPtrFieldBase::Add<TypeHandler>(arena, std::move(value));
+}
+
+template <typename Element>
template <typename Iter>
PROTOBUF_NDEBUG_INLINE void RepeatedPtrField<Element>::Add(Iter begin,
Iter end) {
@@ -1604,6 +1640,13 @@
}
template <typename Element>
+inline void RepeatedPtrField<Element>::InternalMergeFromWithArena(
+ internal::InternalVisibility, Arena* arena, const RepeatedPtrField& other) {
+ if (other.empty()) return;
+ RepeatedPtrFieldBase::MergeFrom<Element>(other, arena);
+}
+
+template <typename Element>
inline void RepeatedPtrField<Element>::CopyFrom(const RepeatedPtrField& other) {
RepeatedPtrFieldBase::CopyFrom<TypeHandler>(other, GetArena());
}