Introduce `FieldWithArena` to encapsulate field arena storage alongside an arena pointer.
We will be using this idiom for all other public field types that we're removing arena pointers from.
PiperOrigin-RevId: 810333648
diff --git a/src/google/protobuf/BUILD.bazel b/src/google/protobuf/BUILD.bazel
index 1b8a3ec..c7dfcb4 100644
--- a/src/google/protobuf/BUILD.bazel
+++ b/src/google/protobuf/BUILD.bazel
@@ -653,6 +653,7 @@
"explicitly_constructed.h",
"extension_set.h",
"extension_set_inl.h",
+ "field_with_arena.h",
"generated_enum_util.h",
"generated_message_tctable_decl.h",
"generated_message_tctable_impl.h",
@@ -660,6 +661,7 @@
"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",
@@ -704,6 +706,7 @@
"@abseil-cpp//absl/base:config",
"@abseil-cpp//absl/base:core_headers",
"@abseil-cpp//absl/base:dynamic_annotations",
+ "@abseil-cpp//absl/base:no_destructor",
"@abseil-cpp//absl/base:prefetch",
"@abseil-cpp//absl/container:btree",
"@abseil-cpp//absl/container:flat_hash_set",
@@ -805,6 +808,7 @@
"@abseil-cpp//absl/base:config",
"@abseil-cpp//absl/base:core_headers",
"@abseil-cpp//absl/base:dynamic_annotations",
+ "@abseil-cpp//absl/base:no_destructor",
"@abseil-cpp//absl/cleanup",
"@abseil-cpp//absl/container:btree",
"@abseil-cpp//absl/container:fixed_array",
@@ -888,6 +892,36 @@
],
)
+proto_library(
+ name = "internal_metadata_locator_test_proto",
+ srcs = ["internal_metadata_locator_test.proto"],
+ strip_import_prefix = "/src",
+)
+
+cc_proto_library(
+ name = "internal_metadata_locator_test_cc_proto",
+ deps = [":internal_metadata_locator_test_proto"],
+)
+
+cc_test(
+ name = "internal_metadata_locator_test",
+ size = "small",
+ srcs = [
+ "internal_metadata_locator_test.cc",
+ ],
+ deps = [
+ ":arena",
+ ":internal_metadata_locator_test_cc_proto",
+ ":port",
+ ":protobuf",
+ ":protobuf_lite",
+ ":test_util2",
+ "//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 4ef3759..3fc0089 100644
--- a/src/google/protobuf/arena.h
+++ b/src/google/protobuf/arena.h
@@ -81,11 +81,39 @@
template <typename Type>
class GenericTypeHandler; // defined in repeated_field.h
+// This struct maps field types to the types that we will use to represent them
+// when allocated on an arena. This is necessary because fields no longer own an
+// arena pointer, but can be allocated directly on an arena. In this case, we
+// will use a wrapper class that holds both the arena pointer and the field, and
+// points the field to the arena pointer.
+//
+// Additionally, split pointer fields will use this representation when
+// allocated, regardless of whether they are on an arena or not.
+//
+// For example:
+// ```
+// template <>
+// struct FieldArenaRep<Message> {
+// using Type = ArenaMessage;
+// static Message* Get(ArenaMessage* arena_rep) {
+// return &arena_rep->message();
+// }
+// };
+// ```
template <typename T>
-struct IsRepeatedPtrFieldType; // defined in repeated_ptr_field.h
+struct FieldArenaRep {
+ // The type of the field when allocated on an arena. By default, this is just
+ // `T`, but can be specialized to use a wrapper class that holds both the
+ // arena pointer and the field.
+ using Type = T;
-template <typename T>
-struct RepeatedPtrFieldArenaRep; // defined in repeated_ptr_field.h
+ // Returns a pointer to the field from the arena representation. By default,
+ // this is just a no-op, but can be specialized to extract the field from the
+ // wrapper class.
+ static T* PROTOBUF_NONNULL Get(Type* PROTOBUF_NONNULL arena_rep) {
+ return arena_rep;
+ }
+};
template <typename T>
void arena_delete_object(void* PROTOBUF_NONNULL object) {
@@ -232,12 +260,7 @@
return static_cast<Type*>(CopyConstruct<Type>(arena, &args...));
}
}
- if constexpr (internal::IsRepeatedPtrFieldType<Type>::value) {
- return CreateRepeatedPtrFieldWithArena<Type>(
- arena, std::forward<Args>(args)...);
- } else {
- return CreateArenaCompatible<Type>(arena, std::forward<Args>(args)...);
- }
+ return CreateArenaCompatible<Type>(arena, std::forward<Args>(args)...);
} else {
if (ABSL_PREDICT_FALSE(arena == nullptr)) {
return new T(std::forward<Args>(args)...);
@@ -442,36 +465,53 @@
sizeof(char)>
is_arena_constructable;
+ // Note that by this point, for types which have a different arena
+ // representation, `T` is that representation and is expected to have an
+ // arena-enabled constructor.
+ //
+ // For types with a different arena representation, if the arena pointer is
+ // null, the object is allocated directly with `new` as its original type,
+ // since wrapping the type in the arena representation would be wasteful.
+ template <typename... Args>
+ static T* PROTOBUF_NONNULL ConstructOnArena(void* PROTOBUF_NONNULL ptr,
+ Arena& arena, Args&&... args) {
+#ifndef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ // TODO - ClangTidy gives warnings for calling the deprecated
+ // `RepeatedPtrField(Arena*)` constructor here, but this is the correct
+ // way to call it as it will allow us to silently switch to a different
+ // constructor once arena pointers are removed from RepeatedPtrFields.
+ // While this constructor exists, we will call the `InternalVisibility`
+ // override to silence the warning.
+ //
+ // Note: RepeatedPtrFieldBase is sometimes constructed internally, and it
+ // doesn't have `InternalVisibility` constructors.
+ if constexpr (std::is_base_of_v<internal::RepeatedPtrFieldBase, T> &&
+ !std::is_same_v<T, internal::RepeatedPtrFieldBase>) {
+ return new (ptr) T(internal::InternalVisibility(), &arena,
+ static_cast<Args&&>(args)...);
+ } else {
+#endif
+ return new (ptr) T(&arena, static_cast<Args&&>(args)...);
+#ifndef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ }
+#endif
+ }
+
template <typename... Args>
static T* PROTOBUF_NONNULL Construct(void* PROTOBUF_NONNULL ptr,
Arena* PROTOBUF_NULLABLE arena,
Args&&... args) {
- if constexpr (internal::IsRepeatedPtrFieldType<T>::value) {
- using ArenaRepT = typename internal::RepeatedPtrFieldArenaRep<T>::Type;
- // TODO - ClangTidy gives warnings for calling the
- // deprecated `RepeatedPtrField(Arena*)` constructor here, but this is
- // the correct way to call it as it will allow us to silently switch to
- // a different constructor once arena pointers are removed from
- // RepeatedPtrFields. While this constructor exists, we will call the
- // `InternalVisibility` override to silence the warning.
- if constexpr (std::is_same_v<ArenaRepT,
- internal::RepeatedPtrFieldBase>) {
- // RepeatedPtrFieldBase is sometimes constructed internally, and it
- // doesn't have `InternalVisibility` constructors.
- return new (ptr) ArenaRepT(arena, static_cast<Args&&>(args)...);
- } else {
- return new (ptr) ArenaRepT(internal::InternalVisibility(), arena,
- static_cast<Args&&>(args)...);
- }
+ if (ABSL_PREDICT_FALSE(arena == nullptr)) {
+ return new (ptr) T(static_cast<Args&&>(args)...);
} else {
- return new (ptr) T(arena, static_cast<Args&&>(args)...);
+ return ConstructOnArena(ptr, *arena, static_cast<Args&&>(args)...);
}
}
static PROTOBUF_ALWAYS_INLINE T* PROTOBUF_NONNULL New() {
// Repeated pointer fields no longer have an arena constructor, so
// specialize calling their default constructor.
- if constexpr (internal::IsRepeatedPtrFieldType<T>::value) {
+ if constexpr (std::is_base_of_v<internal::RepeatedPtrFieldBase, T>) {
return new T();
} else {
return new T(nullptr);
@@ -551,28 +591,9 @@
static_assert(is_arena_constructable<T>::value,
"Can only construct types that are ArenaConstructable");
if (ABSL_PREDICT_FALSE(arena == nullptr)) {
- return new T(nullptr, static_cast<Args&&>(args)...);
- } else {
- return arena->DoCreateMessage<T>(static_cast<Args&&>(args)...);
- }
- }
-
- template <typename T, typename... Args>
- PROTOBUF_NDEBUG_INLINE static T* PROTOBUF_NONNULL
- CreateRepeatedPtrFieldWithArena(Arena* PROTOBUF_NULLABLE arena,
- Args&&... args) {
- static_assert(is_arena_constructable<T>::value,
- "Can only construct types that are ArenaConstructable");
- static_assert(internal::IsRepeatedPtrFieldType<T>::value,
- "Can only construct repeated pointer fields with "
- "CreateRepeatedPtrFieldWithArena");
- if (ABSL_PREDICT_FALSE(arena == nullptr)) {
return new T(static_cast<Args&&>(args)...);
} else {
- using ArenaRepT = typename internal::RepeatedPtrFieldArenaRep<T>::Type;
- auto* arena_repr =
- arena->DoCreateMessage<ArenaRepT>(static_cast<Args&&>(args)...);
- return arena_repr;
+ return arena->DoCreateMessage<T>(static_cast<Args&&>(args)...);
}
}
@@ -625,9 +646,12 @@
template <typename T, typename... Args>
PROTOBUF_NDEBUG_INLINE T* PROTOBUF_NONNULL DoCreateMessage(Args&&... args) {
- return InternalHelper<T>::Construct(
- AllocateInternal<T, is_destructor_skippable<T>::value>(), this,
- std::forward<Args>(args)...);
+ using ArenaRepT = typename internal::FieldArenaRep<T>::Type;
+ auto* arena_repr = InternalHelper<ArenaRepT>::ConstructOnArena(
+ AllocateInternal<ArenaRepT,
+ is_destructor_skippable<ArenaRepT>::value>(),
+ *this, std::forward<Args>(args)...);
+ return internal::FieldArenaRep<T>::Get(arena_repr);
}
// CreateInArenaStorage is used to implement map field. Without it,
diff --git a/src/google/protobuf/arena_unittest.cc b/src/google/protobuf/arena_unittest.cc
index e433a62..753e128 100644
--- a/src/google/protobuf/arena_unittest.cc
+++ b/src/google/protobuf/arena_unittest.cc
@@ -493,7 +493,12 @@
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<TestAllTypes>));
+#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
@@ -535,14 +540,21 @@
explicit constexpr DispatcherTestProto(absl::in_place_t)
: Message(static_cast<internal::ClassData*>(nullptr)) {}
explicit DispatcherTestProto(Arena*) : Message(nullptr, nullptr) {
- ABSL_LOG(FATAL);
+ ABSL_LOG(FATAL) << "This constructor is defined so the code builds, but "
+ "should never be called.";
+ }
+ DispatcherTestProto(const DispatcherTestProto&) : Message(nullptr, nullptr) {
+ ABSL_LOG(FATAL) << "This constructor is defined so the code builds, but "
+ "should never be called.";
}
DispatcherTestProto(Arena*, const DispatcherTestProto&)
: Message(nullptr, nullptr) {
- ABSL_LOG(FATAL);
+ ABSL_LOG(FATAL) << "This constructor is defined so the code builds, but "
+ "should never be called.";
}
const internal::ClassData* GetClassData() const PROTOBUF_FINAL {
- ABSL_LOG(FATAL);
+ ABSL_LOG(FATAL) << "This method is defined so the code builds, but should "
+ "never be called.";
}
};
DispatcherTestProto dispatcher_test_proto_instance(absl::in_place);
diff --git a/src/google/protobuf/compiler/cpp/field.cc b/src/google/protobuf/compiler/cpp/field.cc
index 24ee2c0..547319e 100644
--- a/src/google/protobuf/compiler/cpp/field.cc
+++ b/src/google/protobuf/compiler/cpp/field.cc
@@ -39,9 +39,20 @@
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<Sub> FieldVars(const FieldDescriptor* field, const Options& opts) {
bool split = ShouldSplit(field, opts);
std::vector<Sub> vars = {
@@ -156,7 +167,19 @@
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 @@
} else if (field_->is_repeated()) {
if (ShouldSplit(field_, options_)) {
p->Emit("$name$_{}"); // RawPtr<Repeated>
+ } 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::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 f4acb9c..65444cb 100644
--- a/src/google/protobuf/compiler/cpp/field_generators/message_field.cc
+++ b/src/google/protobuf/compiler/cpp/field_generators/message_field.cc
@@ -750,7 +750,11 @@
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");
@@ -858,17 +862,31 @@
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 {
diff --git a/src/google/protobuf/compiler/cpp/file.cc b/src/google/protobuf/compiler/cpp/file.cc
index 09534d3..4483b88 100644
--- a/src/google/protobuf/compiler/cpp/file.cc
+++ b/src/google/protobuf/compiler/cpp/file.cc
@@ -492,6 +492,7 @@
IncludeFile("third_party/protobuf/io/coded_stream.h", p);
IncludeFile("third_party/protobuf/generated_message_tctable_impl.h", p);
+ IncludeFile("third_party/protobuf/internal_visibility.h", p);
// TODO This is to include parse_context.h, we need a better way
IncludeFile("third_party/protobuf/extension_set.h", p);
IncludeFile("third_party/protobuf/generated_message_util.h", p);
diff --git a/src/google/protobuf/compiler/cpp/message.cc b/src/google/protobuf/compiler/cpp/message.cc
index 8f00975..e8c16ed 100644
--- a/src/google/protobuf/compiler/cpp/message.cc
+++ b/src/google/protobuf/compiler/cpp/message.cc
@@ -1722,7 +1722,8 @@
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 @@
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 @@
#else // PROTOBUF_CUSTOM_VTABLE
: $superclass$(),
#endif // PROTOBUF_CUSTOM_VTABLE
- _impl_(::_pbi::ConstantInitialized()) {
+ _impl_(internal_visibility(), ::_pbi::ConstantInitialized()) {
}
)cc");
}
@@ -3963,7 +3965,7 @@
}
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 @@
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 @@
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<T> 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 @@
)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 @@
}
)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,40 @@
}
)cc");
}
+}
+
+void MessageGenerator::GenerateClassData(io::Printer* p) {
+ // Always generate PlacementNew_ because we might need it for different
+ // reasons. EnableCustomNewFor<T> 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");
+
+ const bool has_repeated_ptr_field = absl::c_any_of(
+ FieldRange(descriptor_),
+ [](const FieldDescriptor* field) { return IsRepeatedPtrField(field); });
+ if (has_repeated_ptr_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 60f697c..04ea49e 100644
--- a/src/google/protobuf/compiler/cpp/message.h
+++ b/src/google/protobuf/compiler/cpp/message.h
@@ -148,7 +148,9 @@
// 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 3647880..f648c71 100644
--- a/src/google/protobuf/compiler/java/java_features.pb.cc
+++ b/src/google/protobuf/compiler/java/java_features.pb.cc
@@ -9,6 +9,7 @@
#include <type_traits>
#include "google/protobuf/io/coded_stream.h"
#include "google/protobuf/generated_message_tctable_impl.h"
+#include "google/protobuf/internal_visibility.h"
#include "google/protobuf/extension_set.h"
#include "google/protobuf/generated_message_util.h"
#include "google/protobuf/wire_format_lite.h"
@@ -45,6 +46,7 @@
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 +62,7 @@
#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 4113615..2f28b1f 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 @@
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 5dd5e28..f1dcb33 100644
--- a/src/google/protobuf/compiler/plugin.pb.cc
+++ b/src/google/protobuf/compiler/plugin.pb.cc
@@ -9,6 +9,7 @@
#include <type_traits>
#include "google/protobuf/io/coded_stream.h"
#include "google/protobuf/generated_message_tctable_impl.h"
+#include "google/protobuf/internal_visibility.h"
#include "google/protobuf/extension_set.h"
#include "google/protobuf/generated_message_util.h"
#include "google/protobuf/wire_format_lite.h"
@@ -29,6 +30,7 @@
namespace compiler {
inline constexpr Version::Impl_::Impl_(
+ [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility,
::_pbi::ConstantInitialized) noexcept
: _cached_size_{0},
suffix_(
@@ -45,7 +47,7 @@
#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 +61,7 @@
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 +82,7 @@
#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 +96,17 @@
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, ::_pbi::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 +121,7 @@
#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 +135,37 @@
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, ::_pbi::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, ::_pbi::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, ::_pbi::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 <typename>
PROTOBUF_CONSTEXPR CodeGeneratorRequest::CodeGeneratorRequest(::_pbi::ConstantInitialized)
@@ -141,7 +174,7 @@
#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 +703,31 @@
[[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, (::_pbi::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, (::_pbi::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, (::_pbi::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 +753,31 @@
[[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, ::_pbi::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, ::_pbi::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, ::_pbi::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 +804,12 @@
::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 +834,7 @@
alignof(CodeGeneratorRequest));
}
}
+#endif
constexpr auto CodeGeneratorRequest::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -1479,7 +1561,14 @@
[[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, (::_pbi::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(
@@ -1509,7 +1598,14 @@
[[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, ::_pbi::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) {
@@ -1541,6 +1637,12 @@
::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_) +
@@ -1557,6 +1659,7 @@
alignof(CodeGeneratorResponse));
}
}
+#endif
constexpr auto CodeGeneratorResponse::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h
index c5b5d43..f3aa889 100644
--- a/src/google/protobuf/compiler/plugin.pb.h
+++ b/src/google/protobuf/compiler/plugin.pb.h
@@ -342,7 +342,8 @@
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 @@
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 @@
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 @@
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/cpp_features.pb.cc b/src/google/protobuf/cpp_features.pb.cc
index 1e6a162..7b0036a 100644
--- a/src/google/protobuf/cpp_features.pb.cc
+++ b/src/google/protobuf/cpp_features.pb.cc
@@ -9,6 +9,7 @@
#include <type_traits>
#include "google/protobuf/io/coded_stream.h"
#include "google/protobuf/generated_message_tctable_impl.h"
+#include "google/protobuf/internal_visibility.h"
#include "google/protobuf/extension_set.h"
#include "google/protobuf/generated_message_util.h"
#include "google/protobuf/wire_format_lite.h"
@@ -27,6 +28,7 @@
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 +42,7 @@
#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 5de3d9c..abc708b 100644
--- a/src/google/protobuf/cpp_features.pb.h
+++ b/src/google/protobuf/cpp_features.pb.h
@@ -328,7 +328,8 @@
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 a972be6..fde14fa 100644
--- a/src/google/protobuf/descriptor.pb.cc
+++ b/src/google/protobuf/descriptor.pb.cc
@@ -9,6 +9,7 @@
#include <type_traits>
#include "google/protobuf/io/coded_stream.h"
#include "google/protobuf/generated_message_tctable_impl.h"
+#include "google/protobuf/internal_visibility.h"
#include "google/protobuf/extension_set.h"
#include "google/protobuf/generated_message_util.h"
#include "google/protobuf/wire_format_lite.h"
@@ -28,6 +29,7 @@
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 +44,7 @@
#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 +63,21 @@
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, ::_pbi::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 +92,7 @@
#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 +111,7 @@
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 +130,7 @@
#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 +149,7 @@
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 +166,7 @@
#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 +185,7 @@
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 +200,7 @@
#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 +242,7 @@
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 +261,7 @@
#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 +280,7 @@
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 +300,7 @@
#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 +319,7 @@
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 +332,7 @@
#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 +351,7 @@
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 +364,7 @@
#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 +383,17 @@
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, ::_pbi::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 +414,7 @@
#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 +433,17 @@
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, ::_pbi::InternalMetadataOffset::Build<
+ ::google::protobuf::SourceCodeInfo, offsetof(::google::protobuf::SourceCodeInfo, _impl_.location_)>()
+ }
+ #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ location_ {}
+ #endif
+ {}
template <typename>
PROTOBUF_CONSTEXPR SourceCodeInfo::SourceCodeInfo(::_pbi::ConstantInitialized)
@@ -419,7 +452,7 @@
#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 +471,17 @@
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, ::_pbi::InternalMetadataOffset::Build<
+ ::google::protobuf::GeneratedCodeInfo, offsetof(::google::protobuf::GeneratedCodeInfo, _impl_.annotation_)>()
+ }
+ #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ annotation_ {}
+ #endif
+ {}
template <typename>
PROTOBUF_CONSTEXPR GeneratedCodeInfo::GeneratedCodeInfo(::_pbi::ConstantInitialized)
@@ -449,7 +490,7 @@
#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 +509,7 @@
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 +523,7 @@
#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 +542,17 @@
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, ::_pbi::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 +563,7 @@
#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 +582,17 @@
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, ::_pbi::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 <typename>
@@ -544,7 +602,7 @@
#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 +621,17 @@
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, ::_pbi::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 +643,7 @@
#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 +662,7 @@
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 +671,14 @@
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, ::_pbi::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 <typename>
PROTOBUF_CONSTEXPR MessageOptions::MessageOptions(::_pbi::ConstantInitialized)
@@ -613,7 +687,7 @@
#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 +706,7 @@
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 +749,14 @@
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, ::_pbi::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 <typename>
PROTOBUF_CONSTEXPR FileOptions::FileOptions(::_pbi::ConstantInitialized)
@@ -683,7 +765,7 @@
#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 +784,25 @@
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, ::_pbi::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, ::_pbi::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 +823,7 @@
#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 +842,17 @@
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, ::_pbi::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 +863,7 @@
#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 +882,25 @@
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, ::_pbi::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, ::_pbi::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 +911,7 @@
#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 +930,17 @@
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, ::_pbi::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 +953,7 @@
#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 +972,21 @@
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, ::_pbi::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 <typename>
PROTOBUF_CONSTEXPR EnumOptions::EnumOptions(::_pbi::ConstantInitialized)
@@ -859,7 +995,7 @@
#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 +1014,7 @@
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 +1029,7 @@
#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 +1048,7 @@
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 +1071,7 @@
#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 +1090,7 @@
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 +1122,7 @@
#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 +1141,7 @@
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 +1157,7 @@
#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 +1176,7 @@
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 +1190,7 @@
#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 +1209,17 @@
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, ::_pbi::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 +1232,7 @@
#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 +1251,33 @@
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, ::_pbi::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, ::_pbi::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, ::_pbi::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 +1291,7 @@
#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 +1310,73 @@
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, ::_pbi::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, ::_pbi::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, ::_pbi::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, ::_pbi::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, ::_pbi::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, ::_pbi::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, ::_pbi::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, ::_pbi::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 +1390,7 @@
#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 +1409,59 @@
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, ::_pbi::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, ::_pbi::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, ::_pbi::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, ::_pbi::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, ::_pbi::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, ::_pbi::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 +1482,7 @@
#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 +1501,17 @@
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, ::_pbi::InternalMetadataOffset::Build<
+ ::google::protobuf::FileDescriptorSet, offsetof(::google::protobuf::FileDescriptorSet, _impl_.file_)>()
+ }
+ #else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ file_ {}
+ #endif
+ {}
template <typename>
PROTOBUF_CONSTEXPR FileDescriptorSet::FileDescriptorSet(::_pbi::ConstantInitialized)
@@ -1241,7 +1520,7 @@
#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 +2572,14 @@
: _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, (::_pbi::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 +2603,14 @@
[[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, ::_pbi::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 +2634,23 @@
::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 +2670,7 @@
alignof(FileDescriptorSet));
}
}
+#endif
constexpr auto FileDescriptorSet::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -2599,14 +2910,56 @@
[[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, (::_pbi::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, (::_pbi::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, (::_pbi::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, (::_pbi::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, (::_pbi::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, (::_pbi::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_) {}
@@ -2639,14 +2992,56 @@
[[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, ::_pbi::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, ::_pbi::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, ::_pbi::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, ::_pbi::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, ::_pbi::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, ::_pbi::InternalMetadataOffset::Build<
+ ::google::protobuf::FileDescriptorProto, offsetof(::google::protobuf::FileDescriptorProto, _impl_.option_dependency_)>()
+ }
+ #else
+ option_dependency_ { visibility, arena }
+ #endif
+ ,
name_(arena),
package_(arena),
syntax_(arena) {}
@@ -2684,6 +3079,28 @@
::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_) +
@@ -2728,6 +3145,7 @@
alignof(FileDescriptorProto));
}
}
+#endif
constexpr auto FileDescriptorProto::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -4003,14 +4421,70 @@
[[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, (::_pbi::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, (::_pbi::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, (::_pbi::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, (::_pbi::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, (::_pbi::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, (::_pbi::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, (::_pbi::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, (::_pbi::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(
@@ -4038,14 +4512,70 @@
[[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, ::_pbi::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, ::_pbi::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, ::_pbi::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, ::_pbi::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, ::_pbi::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, ::_pbi::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, ::_pbi::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, ::_pbi::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) {
@@ -4078,6 +4608,12 @@
::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_) +
@@ -4122,6 +4658,7 @@
alignof(DescriptorProto));
}
}
+#endif
constexpr auto DescriptorProto::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -5085,8 +5622,22 @@
: _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, (::_pbi::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, (::_pbi::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,
@@ -5115,8 +5666,22 @@
[[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, ::_pbi::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, ::_pbi::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) {
@@ -5143,6 +5708,23 @@
::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_) +
@@ -5166,6 +5748,7 @@
alignof(ExtensionRangeOptions));
}
}
+#endif
constexpr auto ExtensionRangeOptions::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -6663,9 +7246,30 @@
[[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, (::_pbi::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, (::_pbi::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, (::_pbi::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(
@@ -6693,9 +7297,30 @@
[[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, ::_pbi::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, ::_pbi::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, ::_pbi::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) {
@@ -6728,6 +7353,12 @@
::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_) +
@@ -6752,6 +7383,7 @@
alignof(EnumDescriptorProto));
}
}
+#endif
constexpr auto EnumDescriptorProto::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -7489,7 +8121,14 @@
[[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, (::_pbi::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(
@@ -7516,7 +8155,14 @@
[[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, ::_pbi::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) {
@@ -7544,6 +8190,12 @@
::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_) +
@@ -7560,6 +8212,7 @@
alignof(ServiceDescriptorProto));
}
}
+#endif
constexpr auto ServiceDescriptorProto::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -8286,7 +8939,14 @@
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, (::_pbi::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,
@@ -8333,7 +8993,14 @@
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, ::_pbi::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);
@@ -8374,6 +9041,23 @@
::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_) +
@@ -8393,6 +9077,7 @@
alignof(FileOptions));
}
}
+#endif
constexpr auto FileOptions::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -9096,7 +9781,14 @@
: _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, (::_pbi::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,
@@ -9131,7 +9823,14 @@
[[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, ::_pbi::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);
@@ -9162,6 +9861,23 @@
::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_) +
@@ -9181,6 +9897,7 @@
alignof(MessageOptions));
}
}
+#endif
constexpr auto MessageOptions::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -10188,8 +10905,22 @@
: _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, (::_pbi::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, (::_pbi::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(
@@ -10228,8 +10959,22 @@
[[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, ::_pbi::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, ::_pbi::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) {
@@ -10262,6 +11007,27 @@
::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_) +
@@ -10289,6 +11055,7 @@
alignof(FieldOptions));
}
}
+#endif
constexpr auto FieldOptions::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -10842,7 +11609,14 @@
: _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, (::_pbi::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,
@@ -10870,7 +11644,14 @@
[[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, ::_pbi::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);
@@ -10896,6 +11677,23 @@
::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_) +
@@ -10915,6 +11713,7 @@
alignof(OneofOptions));
}
}
+#endif
constexpr auto OneofOptions::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -11198,7 +11997,14 @@
: _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, (::_pbi::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,
@@ -11233,7 +12039,14 @@
[[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, ::_pbi::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);
@@ -11264,6 +12077,23 @@
::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_) +
@@ -11283,6 +12113,7 @@
alignof(EnumOptions));
}
}
+#endif
constexpr auto EnumOptions::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -11619,7 +12450,14 @@
: _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, (::_pbi::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,
@@ -11657,7 +12495,14 @@
[[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, ::_pbi::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);
@@ -11689,6 +12534,23 @@
::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_) +
@@ -11708,6 +12570,7 @@
alignof(EnumValueOptions));
}
}
+#endif
constexpr auto EnumValueOptions::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -12064,7 +12927,14 @@
: _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, (::_pbi::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,
@@ -12093,7 +12963,14 @@
[[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, ::_pbi::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);
@@ -12124,6 +13001,23 @@
::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_) +
@@ -12143,6 +13037,7 @@
alignof(ServiceOptions));
}
}
+#endif
constexpr auto ServiceOptions::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -12450,7 +13345,14 @@
: _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, (::_pbi::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,
@@ -12485,7 +13387,14 @@
[[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, ::_pbi::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);
@@ -12516,6 +13425,23 @@
::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_) +
@@ -12535,6 +13461,7 @@
alignof(MethodOptions));
}
}
+#endif
constexpr auto MethodOptions::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -13164,7 +14091,14 @@
[[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, (::_pbi::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_) {}
@@ -13196,7 +14130,14 @@
[[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, ::_pbi::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) {}
@@ -13232,6 +14173,12 @@
::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_) +
@@ -13248,6 +14195,7 @@
alignof(UninterpretedOption));
}
}
+#endif
constexpr auto UninterpretedOption::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -14553,7 +15501,14 @@
[[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, (::_pbi::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,
@@ -14582,7 +15537,14 @@
[[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, ::_pbi::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);
@@ -14612,6 +15574,12 @@
::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_) +
@@ -14628,6 +15596,7 @@
alignof(FeatureSetDefaults));
}
}
+#endif
constexpr auto FeatureSetDefaults::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -14913,7 +15882,14 @@
_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, (::_pbi::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_) {}
@@ -14941,7 +15917,14 @@
_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, ::_pbi::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) {}
@@ -14969,6 +15952,28 @@
::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_) +
@@ -14993,6 +15998,7 @@
alignof(SourceCodeInfo_Location));
}
}
+#endif
constexpr auto SourceCodeInfo_Location::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -15329,7 +16335,14 @@
: _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, (::_pbi::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,
@@ -15353,7 +16366,14 @@
[[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, ::_pbi::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);
@@ -15377,6 +16397,23 @@
::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_) +
@@ -15396,6 +16433,7 @@
alignof(SourceCodeInfo));
}
}
+#endif
constexpr auto SourceCodeInfo::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
@@ -16036,7 +17074,14 @@
[[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, (::_pbi::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,
@@ -16058,7 +17103,14 @@
[[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, ::_pbi::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);
@@ -16082,6 +17134,12 @@
::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_) +
@@ -16098,6 +17156,7 @@
alignof(GeneratedCodeInfo));
}
}
+#endif
constexpr auto GeneratedCodeInfo::InternalGenerateClassData_() {
return ::google::protobuf::internal::ClassDataFull{
::google::protobuf::internal::ClassData{
diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h
index 82fa6ba..fe550f2 100644
--- a/src/google/protobuf/descriptor.pb.h
+++ b/src/google/protobuf/descriptor.pb.h
@@ -1188,7 +1188,8 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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/dynamic_message.cc b/src/google/protobuf/dynamic_message.cc
index c28b7a8..e3e883a 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"
@@ -349,6 +350,7 @@
// implementation.
template <typename T>
uint32_t FieldOffset(int i) const;
+ internal::InternalMetadataOffset FieldInternalMetadataOffset(int i) const;
template <typename T = void>
T* MutableRaw(int i);
template <typename T = void>
@@ -450,6 +452,12 @@
}
return type_info_->offsets[i] & mask;
}
+inline internal::InternalMetadataOffset
+DynamicMessage::FieldInternalMetadataOffset(int i) const {
+ size_t field_offset = FieldOffset<void>(i);
+ return internal::InternalMetadataOffset::BuildFromDynamicOffset<
+ DynamicMessage>(field_offset);
+}
template <typename T>
inline T* DynamicMessage::MutableRaw(int i) {
return reinterpret_cast<T*>(OffsetToPointer(FieldOffset<T>(i)));
@@ -571,7 +579,12 @@
ArenaStringPtr* asp = new (field_ptr) ArenaStringPtr();
asp->InitDefault();
} else {
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ new (field_ptr)
+ RepeatedPtrField<std::string>(FieldInternalMetadataOffset(i));
+#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
new (field_ptr) RepeatedPtrField<std::string>(arena);
+#endif
}
break;
}
@@ -599,7 +612,12 @@
: nullptr,
arena);
} else {
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ new (field_ptr)
+ RepeatedPtrField<Message>(FieldInternalMetadataOffset(i));
+#else // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
new (field_ptr) RepeatedPtrField<Message>(arena);
+#endif
}
}
break;
diff --git a/src/google/protobuf/field_with_arena.h b/src/google/protobuf/field_with_arena.h
new file mode 100644
index 0000000..434af46
--- /dev/null
+++ b/src/google/protobuf/field_with_arena.h
@@ -0,0 +1,133 @@
+#ifndef GOOGLE_PROTOBUF_FIELD_WITH_ARENA_H__
+#define GOOGLE_PROTOBUF_FIELD_WITH_ARENA_H__
+
+#include <cstddef>
+#include <cstdint>
+
+#include "absl/log/absl_check.h"
+#include "google/protobuf/arena.h"
+#include "google/protobuf/internal_metadata_locator.h"
+#include "google/protobuf/internal_visibility.h"
+#include "google/protobuf/metadata_lite.h"
+
+// Must be included last.
+#include "google/protobuf/port_def.inc"
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+// A container that holds a `T` and an arena pointer, where `T` has an
+// `InternalMetadataResolver` member. This is used for both directly
+// arena-allocated `T`'s and split `T`'s. Both cases need to return the correct
+// thing when a user calls `GetArena()` on `T`, or when internal code needs the
+// arena to do memory allocation.
+//
+// This class is used to store `InternalMetadata` alongside `T` with an
+// `InternalMetadataResolver`, since `InternalMetadataResolver`s can only point
+// to an existing arena pointer "nearby" in memory.
+template <typename T>
+class FieldWithArena {
+ public:
+ using InternalArenaConstructable_ = void;
+ using DestructorSkippable_ = void;
+
+ FieldWithArena() : FieldWithArena(/*arena=*/nullptr) {}
+
+ template <typename... Args>
+ explicit FieldWithArena(Arena* arena, Args&&... args)
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ : _internal_metadata_(arena)
+#endif
+ {
+ StaticallyVerifyLayout();
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ new (field_storage_) T(kOffset, std::forward<Args>(args)...);
+#else
+ new (field_storage_) T(arena, std::forward<Args>(args)...);
+#endif
+ }
+
+ // The destructor of `FieldWithArena` can't call the destructor of `T` because
+ // the destructor of `FieldWithArena` is pulled in when the constructor of any
+ // subclass of `FieldWithArena` is invoked, and we would like to be able to
+ // subclass `FieldWithArena` to add behavior for specific field types. We
+ // expect that constructors of these subclasses may be called with incomplete
+ // element types (e.g. for split repeated message fields), but `~T()` requires
+ // `T` to be complete.
+ //
+ // Instead, we provide a `Destroy()` method that must be called explicitly
+ // from the destructor of subclasses of `FieldWithArena`.
+ ~FieldWithArena() = default;
+
+ // Manually destroy the underlying `T`. This should be called only when a
+ // `FieldWithArena` is being destroyed, and the associated arena is nullptr.
+ void Destroy() {
+ ABSL_DCHECK_EQ(GetArena(), nullptr);
+ field().~T();
+ }
+
+ const T& field() const { return *reinterpret_cast<const T*>(field_storage_); }
+ T& field() { return *reinterpret_cast<T*>(field_storage_); }
+
+ // Returns the arena that the field is allocated on. This is cheaper than
+ // calling `field().GetArena()`.
+ Arena* GetArena() const {
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ return _internal_metadata_.arena();
+#else
+ return field().GetArena();
+#endif
+ }
+
+ private:
+ friend InternalMetadataOffset;
+
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ static const InternalMetadataOffset kOffset;
+#endif
+
+ // A method to statically verify the offset of `field_storage_`. We need to
+ // define this in a member function out of line because `FieldWithArena` needs
+ // to be fully defined to call `offsetof`, but `field_storage_` is private.
+ [[maybe_unused]] static constexpr void StaticallyVerifyLayout();
+
+ // We can't have a member with type `T` here because generated code sometimes
+ // doesn't have a complete type for `T` (for example, split repeated message
+ // fields). When the constructor of `FieldWithArena` is invoked, both the
+ // constructor and destructor of all members are pulled in. By managing the
+ // lifetime of `T` manually, we can avoid pulling in the destructor of `T`
+ // except in the `Destroy()` method.
+ alignas(T) uint8_t field_storage_[sizeof(T)];
+
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ const InternalMetadata _internal_metadata_;
+#endif
+};
+
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+template <typename T>
+constexpr internal::InternalMetadataOffset FieldWithArena<T>::kOffset =
+ internal::InternalMetadataOffset::Build<
+ FieldWithArena<T>, offsetof(FieldWithArena<T>, field_storage_)>();
+#endif
+
+template <typename Element>
+constexpr void FieldWithArena<Element>::StaticallyVerifyLayout() {
+ static_assert(
+ offsetof(FieldWithArena, field_storage_) == 0,
+ "field_storage_ must be at offset 0 in FieldWithArena. There are "
+ "multiple places throughout the code (e.g. reflection, "
+ "VerifyHasBitConsistency) which assume that you can find the wrapped "
+ "field by interpreting a pointer as the wrapped field type, and aren't "
+ "aware of this wrapper class. By placing `field_storage_` at offset 0 in "
+ "this struct, this assumption holds.");
+}
+
+} // namespace internal
+} // namespace protobuf
+} // namespace google
+
+#include "google/protobuf/port_undef.inc"
+
+#endif // GOOGLE_PROTOBUF_FIELD_WITH_ARENA_H__
diff --git a/src/google/protobuf/implicit_weak_message.h b/src/google/protobuf/implicit_weak_message.h
index 8d58024..c6c3ded 100644
--- a/src/google/protobuf/implicit_weak_message.h
+++ b/src/google/protobuf/implicit_weak_message.h
@@ -9,14 +9,16 @@
#define GOOGLE_PROTOBUF_IMPLICIT_WEAK_MESSAGE_H__
#include <cstddef>
+#include <cstdint>
#include <string>
#include "google/protobuf/arena.h"
#include "google/protobuf/generated_message_tctable_decl.h"
+#include "google/protobuf/internal_metadata_locator.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
@@ -151,6 +153,16 @@
: 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,
@@ -159,6 +171,7 @@
// TODO: make this constructor private
explicit WeakRepeatedPtrField(Arena* arena) : weak(arena) {}
+#endif
~WeakRepeatedPtrField() {
if (weak.NeedsDestroy()) {
@@ -224,12 +237,59 @@
}
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 <typename T>
+class WeakRepeatedPtrFieldWithArena {
+ public:
+ using InternalArenaConstructable_ = void;
+ using DestructorSkippable_ = void;
+
+ static const internal::InternalMetadataOffset kInternalMetadataOffset;
+
+ explicit WeakRepeatedPtrFieldWithArena(Arena* arena)
+ : _internal_metadata_(arena), field_(kInternalMetadataOffset) {}
+
+ const WeakRepeatedPtrField<T>& field() const { return field_; }
+ WeakRepeatedPtrField<T>& 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<T> field_;
+};
+
+template <typename T>
+constexpr internal::InternalMetadataOffset
+ WeakRepeatedPtrFieldWithArena<T>::kInternalMetadataOffset =
+ internal::InternalMetadataOffset::Build<
+ WeakRepeatedPtrFieldWithArena<T>,
+ offsetof(WeakRepeatedPtrFieldWithArena<T>, 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 0000000..6093850
--- /dev/null
+++ b/src/google/protobuf/internal_metadata_locator.h
@@ -0,0 +1,207 @@
+#ifndef GOOGLE_PROTOBUF_INTERNAL_METADATA_LOCATOR_H__
+#define GOOGLE_PROTOBUF_INTERNAL_METADATA_LOCATOR_H__
+
+#include <cstddef>
+#include <cstdint>
+#include <type_traits>
+
+#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 from the address of another
+// field in the same class/struct. This is used to reduce the size of fields
+// that need access to an Arena which can be found in the containing object.
+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 the starting address of
+ // 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 <typename T, size_t kFieldOffset>
+ static constexpr InternalMetadataOffset Build() {
+ static_assert(
+ std::is_same_v<std::remove_const_t<decltype(T::_internal_metadata_)>,
+ InternalMetadata>,
+ "Field `_internal_metadata_ is not of type `InternalMetadata`");
+
+ constexpr int64_t kInternalMetadataOffset =
+ static_cast<int64_t>(offsetof(T, _internal_metadata_));
+
+ static_assert(
+ kInternalMetadataOffset - static_cast<int64_t>(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<int64_t>(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<int32_t>(kInternalMetadataOffset - 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 runtime-derived offset from the start of the
+ // message.
+ //
+ // This function performs runtime checks 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 <typename T>
+ static InternalMetadataOffset BuildFromDynamicOffset(size_t field_offset) {
+ static_assert(
+ std::is_base_of_v<MessageLite, T>,
+ "BuildFromDynamicOffset can only be used for `DynamicMessage`");
+
+ constexpr int64_t kInternalMetadataOffset =
+ static_cast<int64_t>(offsetof(T, _internal_metadata_));
+
+ ABSL_DCHECK_GE(kInternalMetadataOffset - static_cast<int64_t>(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<int64_t>(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<int32_t>(kInternalMetadataOffset - 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 static build methods.
+ 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 pointer to another 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 <auto Resolver, typename T>
+ 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 <typename T, InternalMetadataResolver T::* Resolver>
+ 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* object) const {
+ return *reinterpret_cast<const InternalMetadata*>(
+ reinterpret_cast<const char*>(object) + 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`.
+//
+// This function exists as a standalone function and not a member of
+// `InternalMetadataResolver` because the offset must be computed relative to
+// the address of the field containing the resolver, not the resolver itself.
+// This pattern is easy to get wrong from the caller, so we force callers to
+// give a pointer-to-member to the resolver as a type argument, then require
+// that the pointer passed to `ResolveArena` is of the containing type of the
+// resolver field. With the pointer-to-member type, we can load the resolver
+// directly from the passed object, thereby ensuring we are using the correct
+// offset for the object.
+//
+// Example usage:
+//
+// ```cc
+// struct Bar {
+// int some_value;
+// InternalMetadataResolver resolver;
+//
+// Bar(int value, InternalMetadataOffset offset)
+// : some_value(value), resolver(offset) {}
+//
+// Arena* GetArena() const {
+// return ResolveArena<&Bar::resolver>(this);
+// }
+// };
+//
+// struct Foo {
+// InternalMetadata _internal_metadata_;
+// Bar field1;
+//
+// Foo(Arena* arena)
+// : _internal_metadata_(arena),
+// field1(
+// 123,
+// InternalMetadataOffset::Build<Foo, offsetof(Foo, field1)>()) {}
+// };
+// ```
+template <auto Resolver, typename T>
+inline Arena* ResolveArena(const T* object) {
+ return InternalMetadataResolver::FindArena<T, Resolver>(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 0000000..437d95f
--- /dev/null
+++ b/src/google/protobuf/internal_metadata_locator_test.cc
@@ -0,0 +1,87 @@
+#include "google/protobuf/internal_metadata_locator.h"
+
+#include <cstddef>
+#include <cstdint>
+
+#include <gtest/gtest.h>
+#include "google/protobuf/arena.h"
+#include "google/protobuf/internal_metadata_locator_test.pb.h"
+#include "google/protobuf/io/coded_stream.h"
+#include "google/protobuf/message_lite.h"
+#include "google/protobuf/metadata_lite.h"
+
+// Must be included last.
+#include "google/protobuf/port_def.inc"
+
+namespace google::protobuf::internal {
+namespace {
+
+// Since the `TestOneRepeatedField` message has only one field, the offset of
+// the field is sizeof(MessageLite) + sizeof(void*) for hasbits.
+static constexpr size_t kTestOneRepeatedFieldFieldOffset =
+ sizeof(MessageLite) + sizeof(void*);
+
+#ifdef PROTOBUF_CUSTOM_VTABLE
+static constexpr size_t kTestOneRepeatedFieldInternalMetadataOffset = 0;
+#else
+static constexpr size_t kTestOneRepeatedFieldInternalMetadataOffset =
+ 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<StructWithInternalMetadata,
+ offsetof(StructWithInternalMetadata,
+ field)>()) {}
+
+ InternalMetadata _internal_metadata_;
+ FieldWithInternalMetadataOffset field;
+};
+
+TEST(InternalMetadataLocatorTest, Sentinel) {
+ constexpr InternalMetadataOffset offset;
+ EXPECT_TRUE(offset.IsSentinel());
+}
+
+TEST(InternalMetadataLocatorTest, BuildFromStaticOffset) {
+ constexpr auto offset =
+ InternalMetadataOffset::Build<StructWithInternalMetadata,
+ offsetof(StructWithInternalMetadata,
+ field)>();
+ EXPECT_FALSE(offset.IsSentinel());
+ EXPECT_EQ(offset.Offset(), -static_cast<int32_t>(sizeof(void*)));
+}
+
+TEST(InternalMetadataLocatorTest, BuildFromStaticOffsetForProtoMessage) {
+ constexpr auto offset =
+ InternalMetadataOffset::Build<proto2_unittest::TestOneRepeatedField,
+ kTestOneRepeatedFieldFieldOffset>();
+ EXPECT_FALSE(offset.IsSentinel());
+ EXPECT_EQ(offset.Offset(),
+ -static_cast<int32_t>(kTestOneRepeatedFieldFieldOffset -
+ kTestOneRepeatedFieldInternalMetadataOffset));
+}
+
+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/internal_metadata_locator_test.proto b/src/google/protobuf/internal_metadata_locator_test.proto
new file mode 100644
index 0000000..d666ef2
--- /dev/null
+++ b/src/google/protobuf/internal_metadata_locator_test.proto
@@ -0,0 +1,8 @@
+edition = "2023";
+
+package proto2_unittest;
+
+// The test that uses this message requires that the message has only one field.
+message TestOneRepeatedField {
+ repeated int32 repeated_int32 = 1;
+}
diff --git a/src/google/protobuf/map_field.h b/src/google/protobuf/map_field.h
index edb83dc..7550e40 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"
@@ -431,9 +432,15 @@
class ReflectionPayload {
public:
- explicit ReflectionPayload(Arena* arena) : repeated_field_(arena) {}
+ explicit ReflectionPayload(Arena* arena)
+ : repeated_field_(Arena::Create<RepeatedPtrField<Message>>(arena)) {}
+ ~ReflectionPayload() {
+ if (repeated_field_->GetArena() == nullptr) {
+ delete repeated_field_;
+ }
+ }
- RepeatedPtrField<Message>& repeated_field() { return repeated_field_; }
+ RepeatedPtrField<Message>& repeated_field() { return *repeated_field_; }
absl::Mutex& mutex() { return mutex_; }
@@ -453,7 +460,7 @@
void Swap(ReflectionPayload& other);
private:
- RepeatedPtrField<Message> repeated_field_;
+ RepeatedPtrField<Message>* repeated_field_;
absl::Mutex mutex_; // The thread to synchronize map and repeated
// field needs to get lock first;
std::atomic<State> state_{STATE_MODIFIED_MAP};
diff --git a/src/google/protobuf/message_lite.h b/src/google/protobuf/message_lite.h
index 8bec7c6..6a356b1 100644
--- a/src/google/protobuf/message_lite.h
+++ b/src/google/protobuf/message_lite.h
@@ -309,6 +309,9 @@
class DescriptorPoolExtensionFinder;
class ExtensionSet;
class HasBitsTestPeer;
+class InternalMetadataOffset;
+template <typename T, size_t kFieldOffset>
+struct InternalMetadataOffsetHelper;
class LazyField;
class RepeatedPtrFieldBase;
class TcParser;
@@ -1094,6 +1097,9 @@
friend class internal::DescriptorPoolExtensionFinder;
friend class internal::ExtensionSet;
friend class internal::HasBitsTestPeer;
+ friend class internal::InternalMetadataOffset;
+ template <typename T, size_t kFieldOffset>
+ 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 b3ebe83..06df31c 100644
--- a/src/google/protobuf/repeated_ptr_field.cc
+++ b/src/google/protobuf/repeated_ptr_field.cc
@@ -128,7 +128,7 @@
}
template PROTOBUF_EXPORT_TEMPLATE_DEFINE void
-memswap<ArenaOffsetHelper<RepeatedPtrFieldBase>::value>(
+memswap<InternalMetadataResolverOffsetHelper<RepeatedPtrFieldBase>::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 f7a4c0e..2cfa283 100644
--- a/src/google/protobuf/repeated_ptr_field.h
+++ b/src/google/protobuf/repeated_ptr_field.h
@@ -32,6 +32,7 @@
#include <utility>
#include "absl/base/attributes.h"
+#include "absl/base/no_destructor.h"
#include "absl/base/optimization.h"
#include "absl/base/prefetch.h"
#include "absl/functional/function_ref.h"
@@ -39,6 +40,8 @@
#include "absl/meta/type_traits.h"
#include "google/protobuf/arena.h"
#include "google/protobuf/arena_align.h"
+#include "google/protobuf/field_with_arena.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 +56,7 @@
namespace google {
namespace protobuf {
+class DynamicMessage;
class Message;
class Reflection;
@@ -63,6 +67,7 @@
class MergePartialFromCodedStreamHelper;
class SwapFieldHelper;
+class MapFieldBase;
class MapFieldBase;
@@ -73,6 +78,11 @@
template <typename T>
class AllocatedRepeatedPtrFieldBackInsertIterator;
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+template <typename Element>
+class RepeatedPtrFieldWithArena;
+#endif
+
// Swaps two non-overlapping blocks of memory of size `N`
template <size_t N>
inline void memswap(char* PROTOBUF_RESTRICT a, char* PROTOBUF_RESTRICT b) {
@@ -81,12 +91,16 @@
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 <typename T>
-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.
@@ -156,10 +170,17 @@
std::is_base_of<MessageLite, Value<TypeHandler>>::value,
GenericTypeHandler<MessageLite>, TypeHandler>::type;
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ constexpr RepeatedPtrFieldBase()
+ : tagged_rep_or_elem_(nullptr), current_size_(0) {}
+ constexpr explicit RepeatedPtrFieldBase(InternalMetadataOffset offset)
+ : tagged_rep_or_elem_(nullptr), current_size_(0), resolver_(offset) {}
+#else
constexpr RepeatedPtrFieldBase()
: tagged_rep_or_elem_(nullptr), current_size_(0), arena_(nullptr) {}
explicit RepeatedPtrFieldBase(Arena* arena)
: tagged_rep_or_elem_(nullptr), current_size_(0), arena_(arena) {}
+#endif
RepeatedPtrFieldBase(const RepeatedPtrFieldBase&) = delete;
RepeatedPtrFieldBase& operator=(const RepeatedPtrFieldBase&) = delete;
@@ -226,9 +247,13 @@
void Destroy() {
ABSL_DCHECK(NeedsDestroy());
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ ABSL_DCHECK_EQ(GetArena(), nullptr);
+#else
// TODO: arena check is redundant once all `RepeatedPtrField`s
// with non-null arena are owned by the arena.
if (ABSL_PREDICT_FALSE(GetArena() != nullptr)) return;
+#endif
using H = CommonHandler<TypeHandler>;
int n = allocated_size();
@@ -330,8 +355,9 @@
inline void InternalSwap(RepeatedPtrFieldBase* PROTOBUF_RESTRICT rhs) {
ABSL_DCHECK(this != rhs);
- // Swap all fields except arena pointer at once.
- internal::memswap<ArenaOffsetHelper<RepeatedPtrFieldBase>::value>(
+ // Swap all fields except arena offset and arena pointer at once.
+ internal::memswap<
+ InternalMetadataResolverOffsetHelper<RepeatedPtrFieldBase>::value>(
reinterpret_cast<char*>(this), reinterpret_cast<char*>(rhs));
}
@@ -560,19 +586,30 @@
UnsafeArenaAddAllocated<H>(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 <typename TypeHandler>
+ PROTOBUF_NOINLINE void SwapFallbackWithTemp(Arena* arena,
+ RepeatedPtrFieldBase* other,
+ Arena* other_arena,
+ RepeatedPtrFieldBase& temp);
+
template <typename TypeHandler>
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.
@@ -582,6 +619,10 @@
using InternalArenaConstructable_ = void;
using DestructorSkippable_ = void;
+ // FieldWithArena needs to call our protected internal metadata offset
+ // constructors.
+ friend class internal::FieldWithArena<RepeatedPtrFieldBase>;
+
friend google::protobuf::Arena;
template <typename T>
@@ -611,10 +652,10 @@
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 <typename T>
- 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
@@ -774,8 +815,12 @@
// 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
@@ -834,6 +879,50 @@
}
template <typename TypeHandler>
+PROTOBUF_NOINLINE void RepeatedPtrFieldBase::SwapFallbackWithTemp(
+ Arena* arena, RepeatedPtrFieldBase* other, Arena* other_arena,
+ RepeatedPtrFieldBase& temp) {
+ ABSL_DCHECK(!internal::CanUseInternalSwap(GetArena(), other->GetArena()));
+ ABSL_DCHECK_EQ(arena, GetArena());
+ ABSL_DCHECK_EQ(other_arena, other->GetArena());
+
+ // 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.
+ if (!this->empty()) {
+ temp.MergeFrom<typename TypeHandler::Type>(*this, other_arena);
+ }
+ this->CopyFrom<TypeHandler>(*other, arena);
+ other->InternalSwap(&temp);
+}
+
+// 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.
+using RepeatedPtrFieldWithArenaBase = FieldWithArena<RepeatedPtrFieldBase>;
+
+template <>
+struct FieldArenaRep<RepeatedPtrFieldBase> {
+ using Type = RepeatedPtrFieldWithArenaBase;
+
+ static inline RepeatedPtrFieldBase* Get(
+ RepeatedPtrFieldWithArenaBase* arena_rep) {
+ return &arena_rep->field();
+ }
+};
+
+template <>
+struct FieldArenaRep<const RepeatedPtrFieldBase> {
+ using Type = const RepeatedPtrFieldWithArenaBase;
+
+ static inline const RepeatedPtrFieldBase* Get(
+ const RepeatedPtrFieldWithArenaBase* arena_rep) {
+ return &arena_rep->field();
+ }
+};
+
+template <typename TypeHandler>
PROTOBUF_NOINLINE void RepeatedPtrFieldBase::SwapFallback(
Arena* arena, RepeatedPtrFieldBase* other, Arena* other_arena) {
ABSL_DCHECK(!internal::CanUseInternalSwap(GetArena(), other->GetArena()));
@@ -843,12 +932,23 @@
// 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.
- RepeatedPtrFieldBase temp(other_arena);
- if (!this->empty()) {
- temp.MergeFrom<typename TypeHandler::Type>(*this, other_arena);
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ if (other_arena != nullptr) {
+ // We can't call the destructor of the temp container since it allocates
+ // memory from an arena, and the destructor of FieldWithArena expects to be
+ // called only when arena is nullptr.
+ absl::NoDestructor<RepeatedPtrFieldWithArenaBase> temp_container(
+ other_arena);
+ RepeatedPtrFieldBase& temp = temp_container->field();
+ SwapFallbackWithTemp<TypeHandler>(arena, other, other_arena, temp);
+ return;
}
- this->CopyFrom<TypeHandler>(*other, arena);
- other->InternalSwap(&temp);
+
+ RepeatedPtrFieldBase temp;
+#else
+ RepeatedPtrFieldBase temp(other_arena);
+#endif
+ SwapFallbackWithTemp<TypeHandler>(arena, other, other_arena, temp);
if (temp.NeedsDestroy()) {
temp.Destroy<TypeHandler>();
}
@@ -972,49 +1072,6 @@
};
-template <typename T>
-struct IsRepeatedPtrFieldType {
- static constexpr bool value = false;
-};
-
-template <>
-struct IsRepeatedPtrFieldType<RepeatedPtrFieldBase> {
- static constexpr bool value = true;
-};
-
-template <typename Element>
-struct IsRepeatedPtrFieldType<RepeatedPtrField<Element>> {
- static constexpr bool value = true;
-};
-
-// This class maps RepeatedPtrField(Base)? types to the types that we will use
-// to represent them when allocated on an arena. This is necessary because
-// `RepeatedPtrField`s do not own an arena pointer, but can be allocated
-// directly on an arena. In this case, we will use a wrapper class that holds
-// both the arena pointer and the repeated field, and points the repeated field
-// to the arena pointer.
-//
-// Additionally, split repeated pointer fields will use this representation when
-// allocated, regardless of whether they are on an arena or not.
-template <typename T>
-struct RepeatedPtrFieldArenaRep {};
-
-template <>
-struct RepeatedPtrFieldArenaRep<RepeatedPtrFieldBase> {
- // 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.
- using Type = RepeatedPtrFieldBase;
-};
-
-template <typename Element>
-struct RepeatedPtrFieldArenaRep<RepeatedPtrField<Element>> {
- // 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.
- using Type = RepeatedPtrField<Element>;
-};
-
} // namespace internal
// RepeatedPtrField is like RepeatedField, but used for repeated strings or
@@ -1063,6 +1120,16 @@
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,
@@ -1075,6 +1142,7 @@
// TODO: make constructor private
[[deprecated("Use Arena::Create<RepeatedPtrField<...>>(Arena*) instead")]]
explicit RepeatedPtrField(Arena* arena);
+#endif // PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
template <typename Iter,
typename = typename std::enable_if<std::is_constructible<
@@ -1082,12 +1150,24 @@
RepeatedPtrField(Iter begin, Iter end);
RepeatedPtrField(const RepeatedPtrField& rhs)
- : RepeatedPtrField(nullptr, rhs) {}
+ : RepeatedPtrField(
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ internal::InternalMetadataOffset(),
+#else
+ /*arena=*/nullptr,
+#endif
+ rhs) {
+ }
RepeatedPtrField& operator=(const RepeatedPtrField& other)
ABSL_ATTRIBUTE_LIFETIME_BOUND;
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ RepeatedPtrField(RepeatedPtrField&& rhs) noexcept
+ : RepeatedPtrField(internal::InternalMetadataOffset(), std::move(rhs)) {}
+#else
RepeatedPtrField(RepeatedPtrField&& rhs) noexcept
: RepeatedPtrField(nullptr, std::move(rhs)) {}
+#endif
RepeatedPtrField& operator=(RepeatedPtrField&& other) noexcept
ABSL_ATTRIBUTE_LIFETIME_BOUND;
@@ -1364,7 +1444,9 @@
void InternalMergeFromWithArena(internal::InternalVisibility, Arena* arena,
const RepeatedPtrField& other);
+#ifndef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
using RepeatedPtrFieldBase::InternalGetArenaOffset;
+#endif // !PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
private:
using InternalArenaConstructable_ = void;
@@ -1379,11 +1461,21 @@
friend class Arena;
+ friend class internal::FieldWithArena<RepeatedPtrField<Element>>;
+
+ friend class google::protobuf::DynamicMessage;
+
+ friend class internal::MapFieldBase;
+
friend class internal::TcParser;
template <typename T>
friend struct WeakRepeatedPtrField;
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ friend internal::RepeatedPtrFieldWithArena<Element>;
+#endif
+
// The MapFieldBase implementation needs to be able to static_cast down to
// `RepeatedPtrFieldBase`.
friend internal::MapFieldBase;
@@ -1391,8 +1483,16 @@
// Note: RepeatedPtrField SHOULD NOT be subclassed by users.
using TypeHandler = internal::GenericTypeHandler<Element>;
+#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) {
@@ -1409,20 +1509,45 @@
}
template <typename Element>
-inline RepeatedPtrField<Element>::RepeatedPtrField(Arena* arena)
- : RepeatedPtrFieldBase(arena) {
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+constexpr
+#endif
+ inline RepeatedPtrField<Element>::RepeatedPtrField(
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ internal::InternalMetadataOffset offset
+#else
+ Arena* arena
+#endif
+ )
+ : RepeatedPtrFieldBase(
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ offset
+#else
+ arena
+#endif
+ ) {
// We can't have StaticValidityCheck here because that requires Element to be
// a complete type, and in split repeated fields cases, we call
// CreateMessage<RepeatedPtrField<T>> for incomplete Ts.
}
template <typename Element>
-inline RepeatedPtrField<Element>::RepeatedPtrField(Arena* arena,
- const RepeatedPtrField& rhs)
- : RepeatedPtrFieldBase(arena) {
+inline RepeatedPtrField<Element>::RepeatedPtrField(
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ internal::InternalMetadataOffset offset,
+#else
+ Arena* arena,
+#endif
+ const RepeatedPtrField& rhs)
+ : RepeatedPtrFieldBase(
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ offset
+#else
+ arena
+#endif
+ ) {
StaticValidityCheck();
- if (rhs.empty()) return;
- RepeatedPtrFieldBase::MergeFrom<Element>(rhs, arena);
+ MergeFrom(rhs);
}
template <typename Element>
@@ -1451,11 +1576,25 @@
}
template <typename Element>
-inline RepeatedPtrField<Element>::RepeatedPtrField(Arena* arena,
- RepeatedPtrField&& rhs)
- : RepeatedPtrField(arena) {
+inline RepeatedPtrField<Element>::RepeatedPtrField(
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ internal::InternalMetadataOffset offset,
+#else
+ Arena* arena,
+#endif
+ RepeatedPtrField&& rhs)
+ : RepeatedPtrFieldBase(
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ offset
+#else
+ arena
+#endif
+ ) {
// We don't just call Swap(&rhs) here because it would perform 3 copies if rhs
// is on a different arena.
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ Arena* arena = GetArena();
+#endif
if (internal::CanMoveWithInternalSwap(arena, rhs.GetArena())) {
InternalSwap(&rhs);
} else {
@@ -2244,6 +2383,63 @@
return field->Mutable(index);
}
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+// A container that holds a RepeatedPtrField<Element> 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 <typename Element>
+class RepeatedPtrFieldWithArena
+ : public FieldWithArena<RepeatedPtrField<Element>> {
+ public:
+ RepeatedPtrFieldWithArena() = default;
+
+ explicit RepeatedPtrFieldWithArena(Arena* arena)
+ : FieldWithArena<RepeatedPtrField<Element>>(arena) {}
+ RepeatedPtrFieldWithArena(Arena* arena,
+ const RepeatedPtrField<Element>& other)
+ : FieldWithArena<RepeatedPtrField<Element>>(arena, other) {}
+ RepeatedPtrFieldWithArena(Arena* arena, RepeatedPtrField<Element>&& other)
+ : FieldWithArena<RepeatedPtrField<Element>>(arena, std::move(other)) {}
+
+ ~RepeatedPtrFieldWithArena() { this->Destroy(); }
+
+ void Clear() { this->field().Clear(); }
+
+ void Swap(RepeatedPtrFieldWithArena* other) {
+ if (this == other) return;
+ this->field().RepeatedPtrFieldBase::
+ template Swap<typename RepeatedPtrField<Element>::TypeHandler>(
+ this->GetArena(), &other->field(), other->GetArena());
+ }
+};
+
+template <typename Element>
+struct FieldArenaRep<RepeatedPtrField<Element>> {
+ using Type = RepeatedPtrFieldWithArena<Element>;
+
+ static inline RepeatedPtrField<Element>* Get(
+ RepeatedPtrFieldWithArena<Element>* arena_rep) {
+ return &arena_rep->field();
+ }
+};
+
+template <typename Element>
+struct FieldArenaRep<const RepeatedPtrField<Element>> {
+ using Type = const RepeatedPtrFieldWithArena<Element>;
+
+ static inline const RepeatedPtrField<Element>* Get(
+ const RepeatedPtrFieldWithArena<Element>* arena_rep) {
+ return &arena_rep->field();
+ }
+};
+
+#endif // PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+
} // namespace internal
// Provides a back insert iterator for RepeatedPtrField instances,
@@ -2298,7 +2494,7 @@
// Size optimization for `memswap<N>` - supplied below N is used by every
// `RepeatedPtrField<T>`.
extern template PROTOBUF_EXPORT_TEMPLATE_DECLARE void
-memswap<ArenaOffsetHelper<RepeatedPtrFieldBase>::value>(
+memswap<InternalMetadataResolverOffsetHelper<RepeatedPtrFieldBase>::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 874141d..74e6956 100644
--- a/src/google/protobuf/repeated_ptr_field_unittest.cc
+++ b/src/google/protobuf/repeated_ptr_field_unittest.cc
@@ -829,23 +829,28 @@
EXPECT_EQ("1", destination1.Get(0));
EXPECT_EQ("2", destination1.Get(1));
+#ifdef PROTOBUF_INTERNAL_REMOVE_ARENA_PTRS_REPEATED_PTR_FIELD
+ RepeatedPtrField<std::string> destination2(
+ token, internal::InternalMetadataOffset(), source);
+#else
RepeatedPtrField<std::string> 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) {
- auto token = internal::InternalVisibilityForTesting{};
RepeatedPtrField<std::string> source;
source.Add()->assign("1");
source.Add()->assign("2");
Arena arena;
- RepeatedPtrField<std::string> destination(token, &arena, source);
- ASSERT_EQ(2, destination.size());
- EXPECT_EQ("1", destination.Get(0));
- EXPECT_EQ("2", destination.Get(1));
+ const auto* destination =
+ Arena::Create<RepeatedPtrField<std::string>>(&arena, source);
+ ASSERT_EQ(2, destination->size());
+ EXPECT_EQ("1", destination->Get(0));
+ EXPECT_EQ("2", destination->Get(1));
}
TEST(RepeatedPtrFieldTest, IteratorConstruct_String) {