Replace CreateMaybeMessage hooks with a `void*` based signature to allow

reusing the functions in more generic contexts.
Reuse these new functions in the implementation of RepeatedPtrField.

PiperOrigin-RevId: 580530262
pull/14665/head
Protobuf Team Bot 1 year ago committed by Copybara-Service
parent a9b11dd7bd
commit e4196b1443
  1. 110
      src/google/protobuf/arena.h
  2. 5
      src/google/protobuf/arena_test_util.h
  3. 77
      src/google/protobuf/arena_unittest.cc
  4. 24
      src/google/protobuf/compiler/cpp/field_generators/message_field.cc
  5. 8
      src/google/protobuf/compiler/cpp/file.cc
  6. 30
      src/google/protobuf/compiler/cpp/message.cc
  7. 2
      src/google/protobuf/compiler/java/java_features.pb.h
  8. 18
      src/google/protobuf/compiler/plugin.pb.cc
  9. 12
      src/google/protobuf/compiler/plugin.pb.h
  10. 2
      src/google/protobuf/cpp_features.pb.h
  11. 180
      src/google/protobuf/descriptor.pb.cc
  12. 104
      src/google/protobuf/descriptor.pb.h
  13. 5
      src/google/protobuf/message_lite.cc
  14. 8
      src/google/protobuf/message_lite.h
  15. 10
      src/google/protobuf/repeated_ptr_field.cc
  16. 48
      src/google/protobuf/repeated_ptr_field.h

@ -223,13 +223,23 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
// allocation protocol, documented above.
template <typename T, typename... Args>
PROTOBUF_ALWAYS_INLINE static T* CreateMessage(Arena* arena, Args&&... args) {
using Type = std::remove_const_t<T>;
static_assert(
is_arena_constructable<T>::value,
is_arena_constructable<Type>::value,
"CreateMessage can only construct types that are ArenaConstructable");
// We must delegate to CreateMaybeMessage() and NOT CreateMessageInternal()
// because protobuf generated classes specialize CreateMaybeMessage() and we
// need to use that specialization for code size reasons.
return Arena::CreateMaybeMessage<T>(arena, static_cast<Args&&>(args)...);
#ifdef __cpp_if_constexpr
constexpr auto construct_type = GetConstructType<T, Args&&...>();
// We delegate to DefaultConstruct/CopyConstruct where appropriate
// because protobuf generated classes have external templates for these
// functions for code size reasons.
// When `if constexpr` is not available always use the fallback.
if constexpr (construct_type == ConstructType::kDefault) {
return static_cast<Type*>(DefaultConstruct<Type>(arena));
} else if constexpr (construct_type == ConstructType::kCopy) {
return static_cast<Type*>(CopyConstruct<Type>(arena, &args...));
}
#endif
return CreateMessageInternal<Type>(arena, std::forward<Args>(args)...);
}
// API to create any objects on the arena. Note that only the object will
@ -471,6 +481,36 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
private:
internal::ThreadSafeArena impl_;
enum class ConstructType { kUnknown, kDefault, kCopy, kMove };
// Overload set to detect which kind of construction is going to happen for a
// specific set of input arguments. This is used to dispatch to different
// helper functions.
template <typename T>
static auto ProbeConstructType()
-> std::integral_constant<ConstructType, ConstructType::kDefault>;
template <typename T>
static auto ProbeConstructType(const T&)
-> std::integral_constant<ConstructType, ConstructType::kCopy>;
template <typename T>
static auto ProbeConstructType(T&)
-> std::integral_constant<ConstructType, ConstructType::kCopy>;
template <typename T>
static auto ProbeConstructType(const T&&)
-> std::integral_constant<ConstructType, ConstructType::kCopy>;
template <typename T>
static auto ProbeConstructType(T&&)
-> std::integral_constant<ConstructType, ConstructType::kMove>;
template <typename T, typename... U>
static auto ProbeConstructType(U&&...)
-> std::integral_constant<ConstructType, ConstructType::kUnknown>;
template <typename T, typename... Args>
static constexpr auto GetConstructType() {
return std::is_base_of<MessageLite, T>::value
? decltype(ProbeConstructType<T>(std::declval<Args>()...))::value
: ConstructType::kUnknown;
}
void ReturnArrayMemory(void* p, size_t size) {
impl_.ReturnArrayMemory(p, size);
}
@ -517,31 +557,21 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
}
}
// CreateMessage<T> requires that T supports arenas, but this private method
// works whether or not T supports arenas. These are not exposed to user code
// as it can cause confusing API usages, and end up having double free in
// user code. These are used only internally from LazyField and Repeated
// fields, since they are designed to work in all mode combinations.
template <typename Msg, typename... Args>
PROTOBUF_ALWAYS_INLINE static Msg* DoCreateMaybeMessage(Arena* arena,
std::true_type,
Args&&... args) {
return CreateMessageInternal<Msg>(arena, std::forward<Args>(args)...);
}
template <typename T, typename... Args>
PROTOBUF_ALWAYS_INLINE static T* DoCreateMaybeMessage(Arena* arena,
std::false_type,
Args&&... args) {
return Create<T>(arena, std::forward<Args>(args)...);
}
template <typename T, typename... Args>
PROTOBUF_ALWAYS_INLINE static T* CreateMaybeMessage(Arena* arena,
Args&&... args) {
return DoCreateMaybeMessage<T>(arena, is_arena_constructable<T>(),
std::forward<Args>(args)...);
}
// DefaultConstruct/CopyConstruct:
//
// Functions with a generic signature to support taking the address in generic
// contexts, like RepeatedPtrField, etc.
// These are also used as a hook for `extern template` instantiations where
// codegen can offload the instantiations to the respective .pb.cc files. This
// has two benefits:
// - It reduces the library bloat as callers don't have to instantiate the
// function.
// - It allows the optimizer to see the constructors called to
// further optimize the instantiation.
template <typename T>
static void* DefaultConstruct(Arena* arena);
template <typename T>
static void* CopyConstruct(Arena* arena, const void* from);
template <typename T, typename... Args>
PROTOBUF_NDEBUG_INLINE T* DoCreateMessage(Args&&... args) {
@ -620,7 +650,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
template <typename Type>
friend class internal::GenericTypeHandler;
friend class internal::InternalMetadata; // For user_arena().
friend class internal::LazyField; // For CreateMaybeMessage.
friend class internal::LazyField; // For DefaultConstruct.
friend class internal::EpsCopyInputStream; // For parser performance
friend class internal::TcParser; // For parser performance
friend class MessageLite;
@ -632,6 +662,24 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
friend struct internal::ArenaTestPeer;
};
// DefaultConstruct/CopyConstruct
//
// IMPORTANT: These have to be defined out of line and without an `inline`
// keyword to make sure the `extern template` suppresses instantiations.
template <typename T>
PROTOBUF_NOINLINE void* Arena::DefaultConstruct(Arena* arena) {
void* mem = arena != nullptr ? arena->AllocateAligned(sizeof(T))
: ::operator new(sizeof(T));
return new (mem) T(arena);
}
template <typename T>
PROTOBUF_NOINLINE void* Arena::CopyConstruct(Arena* arena, const void* from) {
void* mem = arena != nullptr ? arena->AllocateAligned(sizeof(T))
: ::operator new(sizeof(T));
return new (mem) T(arena, *static_cast<const T*>(from));
}
template <>
inline void* Arena::AllocateInternal<std::string, false>() {
return impl_.AllocateFromStringBlock();

@ -62,6 +62,11 @@ struct ArenaTestPeer {
static auto PeekCleanupListForTesting(Arena* arena) {
return arena->PeekCleanupListForTesting();
}
template <typename T, typename... U>
static constexpr auto GetConstructType() {
return Arena::GetConstructType<T, U...>();
}
using ConstructType = Arena::ConstructType;
};
struct CleanupGrowthInfo {

@ -17,11 +17,13 @@
#include <thread>
#include <type_traits>
#include <typeinfo>
#include <utility>
#include <vector>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include "absl/strings/string_view.h"
#include "absl/synchronization/barrier.h"
#include "google/protobuf/arena_test_util.h"
@ -324,6 +326,81 @@ TEST(ArenaTest, ArenaOnlyTypesCanBeConstructed) {
Arena::CreateMessage<OnlyArenaConstructible>(&arena);
}
TEST(ArenaTest, GetConstructTypeWorks) {
using T = TestAllTypes;
using Peer = internal::ArenaTestPeer;
using CT = typename Peer::ConstructType;
EXPECT_EQ(CT::kDefault, (Peer::GetConstructType<T>()));
EXPECT_EQ(CT::kCopy, (Peer::GetConstructType<T, const T&>()));
EXPECT_EQ(CT::kCopy, (Peer::GetConstructType<T, T&>()));
EXPECT_EQ(CT::kCopy, (Peer::GetConstructType<T, const T&&>()));
EXPECT_EQ(CT::kMove, (Peer::GetConstructType<T, T&&>()));
EXPECT_EQ(CT::kUnknown, (Peer::GetConstructType<T, double&>()));
EXPECT_EQ(CT::kUnknown, (Peer::GetConstructType<T, T&, T&>()));
// For non-protos, it's always unknown
EXPECT_EQ(CT::kUnknown, (Peer::GetConstructType<int, const int&>()));
}
#ifdef __cpp_if_constexpr
class DispatcherTestProto : public Message {
public:
using InternalArenaConstructable_ = void;
// For the test below to construct.
explicit DispatcherTestProto(absl::in_place_t) {}
explicit DispatcherTestProto(Arena*) { ABSL_LOG(FATAL); }
DispatcherTestProto(Arena*, const DispatcherTestProto&) { ABSL_LOG(FATAL); }
DispatcherTestProto* New(Arena*) const final { ABSL_LOG(FATAL); }
Metadata GetMetadata() const final { ABSL_LOG(FATAL); }
const ClassData* GetClassData() const final { ABSL_LOG(FATAL); }
};
// We use a specialization to inject behavior for the test.
// This test is very intrusive and will have to be fixed if we change the
// implementation of CreateMessage.
absl::string_view hook_called;
template <>
void* Arena::DefaultConstruct<DispatcherTestProto>(Arena*) {
hook_called = "default";
return nullptr;
}
template <>
void* Arena::CopyConstruct<DispatcherTestProto>(Arena*, const void*) {
hook_called = "copy";
return nullptr;
}
template <>
DispatcherTestProto* Arena::CreateMessageInternal<DispatcherTestProto, int>(
Arena*, int&&) {
hook_called = "fallback";
return nullptr;
}
TEST(ArenaTest, CreateMessageDispatchesToSpecialFunctions) {
hook_called = "";
Arena::CreateMessage<DispatcherTestProto>(nullptr);
EXPECT_EQ(hook_called, "default");
DispatcherTestProto ref(absl::in_place);
const DispatcherTestProto& cref = ref;
hook_called = "";
Arena::CreateMessage<DispatcherTestProto>(nullptr);
EXPECT_EQ(hook_called, "default");
hook_called = "";
Arena::CreateMessage<DispatcherTestProto>(nullptr, ref);
EXPECT_EQ(hook_called, "copy");
hook_called = "";
Arena::CreateMessage<DispatcherTestProto>(nullptr, cref);
EXPECT_EQ(hook_called, "copy");
hook_called = "";
Arena::CreateMessage<DispatcherTestProto>(nullptr, 1);
EXPECT_EQ(hook_called, "fallback");
}
#endif // __cpp_if_constexpr
TEST(ArenaTest, Parsing) {
TestAllTypes original;
TestUtil::SetAllFields(&original);

@ -133,12 +133,13 @@ class SingularMessage : public FieldGeneratorBase {
}
void GenerateMemberCopyConstructor(io::Printer* p) const override {
p->Emit("$name$_{CreateMaybeMessage<$Submsg$>(arena, *from.$name$_)}");
p->Emit(
"$name$_{$superclass$::CopyConstruct<$Submsg$>(arena, *from.$name$_)}");
}
void GenerateOneofCopyConstruct(io::Printer* p) const override {
p->Emit(R"cc(
$field$ = CreateMaybeMessage<$Submsg$>(arena, *from.$field$);
$field$ = $superclass$::CopyConstruct<$Submsg$>(arena, *from.$field$);
)cc");
}
@ -262,7 +263,7 @@ void SingularMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const {
$StrongRef$;
$set_hasbit$;
if ($field_$ == nullptr) {
auto* p = CreateMaybeMessage<$Submsg$>(GetArena());
auto* p = $superclass$::DefaultConstruct<$Submsg$>(GetArena());
$field_$ = reinterpret_cast<$MemberType$*>(p);
}
return $cast_field_$;
@ -443,7 +444,8 @@ void SingularMessage::GenerateMergingCode(io::Printer* p) const {
p->Emit(R"cc(
$DCHK$(from.$field_$ != nullptr);
if (_this->$field_$ == nullptr) {
_this->$field_$ = CreateMaybeMessage<$Submsg$>(arena, *from.$field_$);
_this->$field_$ =
$superclass$::CopyConstruct<$Submsg$>(arena, *from.$field_$);
} else {
_this->$field_$->MergeFrom(*from.$field_$);
}
@ -474,13 +476,15 @@ void SingularMessage::GenerateCopyConstructorCode(io::Printer* p) const {
if (has_hasbit_) {
p->Emit(R"cc(
if ((from.$has_hasbit$) != 0) {
_this->$field_$ = CreateMaybeMessage<$Submsg$>(arena, *from.$field_$);
_this->$field_$ =
$superclass$::CopyConstruct<$Submsg$>(arena, *from.$field_$);
}
)cc");
} else {
p->Emit(R"cc(
if (from._internal_has_$name$()) {
_this->$field_$ = CreateMaybeMessage<$Submsg$>(arena, *from.$field_$);
_this->$field_$ =
$superclass$::CopyConstruct<$Submsg$>(arena, *from.$field_$);
}
)cc");
}
@ -661,7 +665,8 @@ void OneofMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const {
if ($not_has_field$) {
clear_$oneof_name$();
set_has_$name$();
$field_$ = $weak_cast$(CreateMaybeMessage<$Submsg$>(GetArena()));
$field_$ =
$weak_cast$($superclass$::DefaultConstruct<$Submsg$>(GetArena()));
}
return $cast_field_$;
}
@ -855,9 +860,8 @@ void RepeatedMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const {
$TsanDetectConcurrentRead$;
$PrepareSplitMessageForWrite$;
if ($field_$.IsDefault()) {
$field_$.Set(
CreateMaybeMessage<$pb$::$Weak$RepeatedPtrField<$Submsg$>>(
GetArena()));
$field_$.Set($superclass$::DefaultConstruct<
$pb$::$Weak$RepeatedPtrField<$Submsg$>>(GetArena()));
}
return $field_$.Get();
}

@ -1405,14 +1405,12 @@ class FileGenerator::ForwardDeclarations {
// However, it increases the size of the pb.cc translation units so it
// is a tradeoff.
p->Emit({{"class", QualifiedClassName(c.second, options)}}, R"cc(
template <>
$dllexport_decl $$class$* Arena::CreateMaybeMessage<$class$>(Arena*);
extern template void* Arena::DefaultConstruct<$class$>(Arena*);
)cc");
if (!IsMapEntryMessage(c.second)) {
p->Emit({{"class", QualifiedClassName(c.second, options)}}, R"cc(
template <>
$dllexport_decl $$class$* Arena::CreateMaybeMessage<$class$>(
Arena*, const $class$&);
extern template void* Arena::CopyConstruct<$class$>(Arena*,
const void*);
)cc");
}
}

@ -1477,7 +1477,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) {
"// implements Message ----------------------------------------------\n"
"\n"
"$classname$* New(::$proto_ns$::Arena* arena = nullptr) const final {\n"
" return CreateMaybeMessage<$classname$>(arena);\n"
" return $superclass$::DefaultConstruct<$classname$>(arena);\n"
"}\n");
// For instances that derive from Message (rather than MessageLite), some
@ -2739,9 +2739,9 @@ void MessageGenerator::GenerateCopyInitFields(io::Printer* p) const {
p->Emit({{"has_msg", [&] { has_message(field); }},
{"submsg", FieldMessageTypeName(field, options_)}},
R"cc(
$field$ = ($has_msg$)
? CreateMaybeMessage<$submsg$>(arena, *from.$field$)
: nullptr;
$field$ = ($has_msg$) ? $superclass$::CopyConstruct<$submsg$>(
arena, *from.$field$)
: nullptr;
)cc");
};
@ -3000,26 +3000,12 @@ void MessageGenerator::GenerateSourceInProto2Namespace(io::Printer* p) {
Formatter format(p);
if (ShouldGenerateExternSpecializations(options_) &&
ShouldGenerateClass(descriptor_, options_)) {
format(R"cc(
template <>
PROTOBUF_NOINLINE $classtype$* Arena::CreateMaybeMessage<$classtype$>(
Arena* arena) {
using T = $classtype$;
void* mem = arena != nullptr ? arena->AllocateAligned(sizeof(T))
: ::operator new(sizeof(T));
return new (mem) T(arena);
}
p->Emit(R"cc(
template void* Arena::DefaultConstruct<$classtype$>(Arena*);
)cc");
if (!IsMapEntryMessage(descriptor_)) {
format(R"cc(
template <>
PROTOBUF_NOINLINE $classtype$* Arena::CreateMaybeMessage<$classtype$>(
Arena* arena, const $classtype$& from) {
using T = $classtype$;
void* mem = arena != nullptr ? arena->AllocateAligned(sizeof(T))
: ::operator new(sizeof(T));
return new (mem) T(arena, from);
}
p->Emit(R"cc(
template void* Arena::CopyConstruct<$classtype$>(Arena*, const void*);
)cc");
}
}

@ -190,7 +190,7 @@ class PROTOC_EXPORT JavaFeatures final :
// implements Message ----------------------------------------------
JavaFeatures* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<JavaFeatures>(arena);
return ::google::protobuf::Message::DefaultConstruct<JavaFeatures>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const JavaFeatures& from);

@ -665,9 +665,9 @@ CodeGeneratorRequest::CodeGeneratorRequest(
from._internal_metadata_);
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.compiler_version_ = (cached_has_bits & 0x00000002u)
? CreateMaybeMessage<::google::protobuf::compiler::Version>(arena, *from._impl_.compiler_version_)
: nullptr;
_impl_.compiler_version_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::compiler::Version>(
arena, *from._impl_.compiler_version_)
: nullptr;
// @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorRequest)
}
@ -922,7 +922,8 @@ void CodeGeneratorRequest::MergeImpl(::google::protobuf::Message& to_msg, const
if (cached_has_bits & 0x00000002u) {
ABSL_DCHECK(from._impl_.compiler_version_ != nullptr);
if (_this->_impl_.compiler_version_ == nullptr) {
_this->_impl_.compiler_version_ = CreateMaybeMessage<::google::protobuf::compiler::Version>(arena, *from._impl_.compiler_version_);
_this->_impl_.compiler_version_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::compiler::Version>(arena, *from._impl_.compiler_version_);
} else {
_this->_impl_.compiler_version_->MergeFrom(*from._impl_.compiler_version_);
}
@ -1019,9 +1020,9 @@ CodeGeneratorResponse_File::CodeGeneratorResponse_File(
from._internal_metadata_);
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.generated_code_info_ = (cached_has_bits & 0x00000008u)
? CreateMaybeMessage<::google::protobuf::GeneratedCodeInfo>(arena, *from._impl_.generated_code_info_)
: nullptr;
_impl_.generated_code_info_ = (cached_has_bits & 0x00000008u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::GeneratedCodeInfo>(
arena, *from._impl_.generated_code_info_)
: nullptr;
// @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse.File)
}
@ -1259,7 +1260,8 @@ void CodeGeneratorResponse_File::MergeImpl(::google::protobuf::Message& to_msg,
if (cached_has_bits & 0x00000008u) {
ABSL_DCHECK(from._impl_.generated_code_info_ != nullptr);
if (_this->_impl_.generated_code_info_ == nullptr) {
_this->_impl_.generated_code_info_ = CreateMaybeMessage<::google::protobuf::GeneratedCodeInfo>(arena, *from._impl_.generated_code_info_);
_this->_impl_.generated_code_info_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::GeneratedCodeInfo>(arena, *from._impl_.generated_code_info_);
} else {
_this->_impl_.generated_code_info_->MergeFrom(*from._impl_.generated_code_info_);
}

@ -207,7 +207,7 @@ class PROTOC_EXPORT Version final :
// implements Message ----------------------------------------------
Version* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<Version>(arena);
return ::google::protobuf::Message::DefaultConstruct<Version>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const Version& from);
@ -426,7 +426,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
// implements Message ----------------------------------------------
CodeGeneratorResponse_File* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<CodeGeneratorResponse_File>(arena);
return ::google::protobuf::Message::DefaultConstruct<CodeGeneratorResponse_File>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const CodeGeneratorResponse_File& from);
@ -661,7 +661,7 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
// implements Message ----------------------------------------------
CodeGeneratorResponse* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<CodeGeneratorResponse>(arena);
return ::google::protobuf::Message::DefaultConstruct<CodeGeneratorResponse>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const CodeGeneratorResponse& from);
@ -897,7 +897,7 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
// implements Message ----------------------------------------------
CodeGeneratorRequest* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<CodeGeneratorRequest>(arena);
return ::google::protobuf::Message::DefaultConstruct<CodeGeneratorRequest>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const CodeGeneratorRequest& from);
@ -1580,7 +1580,7 @@ inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::_internal_mu
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000002u;
if (_impl_.compiler_version_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::compiler::Version>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::compiler::Version>(GetArena());
_impl_.compiler_version_ = reinterpret_cast<::google::protobuf::compiler::Version*>(p);
}
return _impl_.compiler_version_;
@ -1888,7 +1888,7 @@ inline ::google::protobuf::GeneratedCodeInfo* CodeGeneratorResponse_File::_inter
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000008u;
if (_impl_.generated_code_info_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::GeneratedCodeInfo>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::GeneratedCodeInfo>(GetArena());
_impl_.generated_code_info_ = reinterpret_cast<::google::protobuf::GeneratedCodeInfo*>(p);
}
return _impl_.generated_code_info_;

@ -159,7 +159,7 @@ class PROTOBUF_EXPORT CppFeatures final :
// implements Message ----------------------------------------------
CppFeatures* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<CppFeatures>(arena);
return ::google::protobuf::Message::DefaultConstruct<CppFeatures>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const CppFeatures& from);

@ -2599,12 +2599,12 @@ FileDescriptorProto::FileDescriptorProto(
from._internal_metadata_);
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.options_ = (cached_has_bits & 0x00000008u)
? CreateMaybeMessage<::google::protobuf::FileOptions>(arena, *from._impl_.options_)
: nullptr;
_impl_.source_code_info_ = (cached_has_bits & 0x00000010u)
? CreateMaybeMessage<::google::protobuf::SourceCodeInfo>(arena, *from._impl_.source_code_info_)
: nullptr;
_impl_.options_ = (cached_has_bits & 0x00000008u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FileOptions>(
arena, *from._impl_.options_)
: nullptr;
_impl_.source_code_info_ = (cached_has_bits & 0x00000010u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceCodeInfo>(
arena, *from._impl_.source_code_info_)
: nullptr;
_impl_.edition_ = from._impl_.edition_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.FileDescriptorProto)
@ -3072,7 +3072,8 @@ void FileDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const :
if (cached_has_bits & 0x00000008u) {
ABSL_DCHECK(from._impl_.options_ != nullptr);
if (_this->_impl_.options_ == nullptr) {
_this->_impl_.options_ = CreateMaybeMessage<::google::protobuf::FileOptions>(arena, *from._impl_.options_);
_this->_impl_.options_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::FileOptions>(arena, *from._impl_.options_);
} else {
_this->_impl_.options_->MergeFrom(*from._impl_.options_);
}
@ -3081,7 +3082,8 @@ void FileDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const :
if (cached_has_bits & 0x00000010u) {
ABSL_DCHECK(from._impl_.source_code_info_ != nullptr);
if (_this->_impl_.source_code_info_ == nullptr) {
_this->_impl_.source_code_info_ = CreateMaybeMessage<::google::protobuf::SourceCodeInfo>(arena, *from._impl_.source_code_info_);
_this->_impl_.source_code_info_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceCodeInfo>(arena, *from._impl_.source_code_info_);
} else {
_this->_impl_.source_code_info_->MergeFrom(*from._impl_.source_code_info_);
}
@ -3189,9 +3191,9 @@ DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(
from._internal_metadata_);
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.options_ = (cached_has_bits & 0x00000001u)
? CreateMaybeMessage<::google::protobuf::ExtensionRangeOptions>(arena, *from._impl_.options_)
: nullptr;
_impl_.options_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::ExtensionRangeOptions>(
arena, *from._impl_.options_)
: nullptr;
::memcpy(reinterpret_cast<char *>(&_impl_) +
offsetof(Impl_, start_),
reinterpret_cast<const char *>(&from._impl_) +
@ -3393,7 +3395,8 @@ void DescriptorProto_ExtensionRange::MergeImpl(::google::protobuf::Message& to_m
if (cached_has_bits & 0x00000001u) {
ABSL_DCHECK(from._impl_.options_ != nullptr);
if (_this->_impl_.options_ == nullptr) {
_this->_impl_.options_ = CreateMaybeMessage<::google::protobuf::ExtensionRangeOptions>(arena, *from._impl_.options_);
_this->_impl_.options_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::ExtensionRangeOptions>(arena, *from._impl_.options_);
} else {
_this->_impl_.options_->MergeFrom(*from._impl_.options_);
}
@ -3716,9 +3719,9 @@ DescriptorProto::DescriptorProto(
from._internal_metadata_);
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.options_ = (cached_has_bits & 0x00000002u)
? CreateMaybeMessage<::google::protobuf::MessageOptions>(arena, *from._impl_.options_)
: nullptr;
_impl_.options_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::MessageOptions>(
arena, *from._impl_.options_)
: nullptr;
// @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto)
}
@ -4102,7 +4105,8 @@ void DescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const ::goo
if (cached_has_bits & 0x00000002u) {
ABSL_DCHECK(from._impl_.options_ != nullptr);
if (_this->_impl_.options_ == nullptr) {
_this->_impl_.options_ = CreateMaybeMessage<::google::protobuf::MessageOptions>(arena, *from._impl_.options_);
_this->_impl_.options_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::MessageOptions>(arena, *from._impl_.options_);
} else {
_this->_impl_.options_->MergeFrom(*from._impl_.options_);
}
@ -4551,9 +4555,9 @@ ExtensionRangeOptions::ExtensionRangeOptions(
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
_impl_._extensions_.MergeFrom(this, from._impl_._extensions_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.features_ = (cached_has_bits & 0x00000001u)
? CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_)
: nullptr;
_impl_.features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(
arena, *from._impl_.features_)
: nullptr;
_impl_.verification_ = from._impl_.verification_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.ExtensionRangeOptions)
@ -4786,7 +4790,8 @@ void ExtensionRangeOptions::MergeImpl(::google::protobuf::Message& to_msg, const
if (cached_has_bits & 0x00000001u) {
ABSL_DCHECK(from._impl_.features_ != nullptr);
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
_this->_impl_.features_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
@ -4912,9 +4917,9 @@ FieldDescriptorProto::FieldDescriptorProto(
from._internal_metadata_);
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.options_ = (cached_has_bits & 0x00000020u)
? CreateMaybeMessage<::google::protobuf::FieldOptions>(arena, *from._impl_.options_)
: nullptr;
_impl_.options_ = (cached_has_bits & 0x00000020u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FieldOptions>(
arena, *from._impl_.options_)
: nullptr;
::memcpy(reinterpret_cast<char *>(&_impl_) +
offsetof(Impl_, number_),
reinterpret_cast<const char *>(&from._impl_) +
@ -5334,7 +5339,8 @@ void FieldDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const
if (cached_has_bits & 0x00000020u) {
ABSL_DCHECK(from._impl_.options_ != nullptr);
if (_this->_impl_.options_ == nullptr) {
_this->_impl_.options_ = CreateMaybeMessage<::google::protobuf::FieldOptions>(arena, *from._impl_.options_);
_this->_impl_.options_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::FieldOptions>(arena, *from._impl_.options_);
} else {
_this->_impl_.options_->MergeFrom(*from._impl_.options_);
}
@ -5442,9 +5448,9 @@ OneofDescriptorProto::OneofDescriptorProto(
from._internal_metadata_);
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.options_ = (cached_has_bits & 0x00000002u)
? CreateMaybeMessage<::google::protobuf::OneofOptions>(arena, *from._impl_.options_)
: nullptr;
_impl_.options_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::OneofOptions>(
arena, *from._impl_.options_)
: nullptr;
// @@protoc_insertion_point(copy_constructor:google.protobuf.OneofDescriptorProto)
}
@ -5623,7 +5629,8 @@ void OneofDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const
if (cached_has_bits & 0x00000002u) {
ABSL_DCHECK(from._impl_.options_ != nullptr);
if (_this->_impl_.options_ == nullptr) {
_this->_impl_.options_ = CreateMaybeMessage<::google::protobuf::OneofOptions>(arena, *from._impl_.options_);
_this->_impl_.options_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::OneofOptions>(arena, *from._impl_.options_);
} else {
_this->_impl_.options_->MergeFrom(*from._impl_.options_);
}
@ -5932,9 +5939,9 @@ EnumDescriptorProto::EnumDescriptorProto(
from._internal_metadata_);
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.options_ = (cached_has_bits & 0x00000002u)
? CreateMaybeMessage<::google::protobuf::EnumOptions>(arena, *from._impl_.options_)
: nullptr;
_impl_.options_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::EnumOptions>(
arena, *from._impl_.options_)
: nullptr;
// @@protoc_insertion_point(copy_constructor:google.protobuf.EnumDescriptorProto)
}
@ -6190,7 +6197,8 @@ void EnumDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const :
if (cached_has_bits & 0x00000002u) {
ABSL_DCHECK(from._impl_.options_ != nullptr);
if (_this->_impl_.options_ == nullptr) {
_this->_impl_.options_ = CreateMaybeMessage<::google::protobuf::EnumOptions>(arena, *from._impl_.options_);
_this->_impl_.options_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::EnumOptions>(arena, *from._impl_.options_);
} else {
_this->_impl_.options_->MergeFrom(*from._impl_.options_);
}
@ -6278,9 +6286,9 @@ EnumValueDescriptorProto::EnumValueDescriptorProto(
from._internal_metadata_);
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.options_ = (cached_has_bits & 0x00000002u)
? CreateMaybeMessage<::google::protobuf::EnumValueOptions>(arena, *from._impl_.options_)
: nullptr;
_impl_.options_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::EnumValueOptions>(
arena, *from._impl_.options_)
: nullptr;
_impl_.number_ = from._impl_.number_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValueDescriptorProto)
@ -6486,7 +6494,8 @@ void EnumValueDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, co
if (cached_has_bits & 0x00000002u) {
ABSL_DCHECK(from._impl_.options_ != nullptr);
if (_this->_impl_.options_ == nullptr) {
_this->_impl_.options_ = CreateMaybeMessage<::google::protobuf::EnumValueOptions>(arena, *from._impl_.options_);
_this->_impl_.options_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::EnumValueOptions>(arena, *from._impl_.options_);
} else {
_this->_impl_.options_->MergeFrom(*from._impl_.options_);
}
@ -6576,9 +6585,9 @@ ServiceDescriptorProto::ServiceDescriptorProto(
from._internal_metadata_);
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.options_ = (cached_has_bits & 0x00000002u)
? CreateMaybeMessage<::google::protobuf::ServiceOptions>(arena, *from._impl_.options_)
: nullptr;
_impl_.options_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::ServiceOptions>(
arena, *from._impl_.options_)
: nullptr;
// @@protoc_insertion_point(copy_constructor:google.protobuf.ServiceDescriptorProto)
}
@ -6783,7 +6792,8 @@ void ServiceDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, cons
if (cached_has_bits & 0x00000002u) {
ABSL_DCHECK(from._impl_.options_ != nullptr);
if (_this->_impl_.options_ == nullptr) {
_this->_impl_.options_ = CreateMaybeMessage<::google::protobuf::ServiceOptions>(arena, *from._impl_.options_);
_this->_impl_.options_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::ServiceOptions>(arena, *from._impl_.options_);
} else {
_this->_impl_.options_->MergeFrom(*from._impl_.options_);
}
@ -6880,9 +6890,9 @@ MethodDescriptorProto::MethodDescriptorProto(
from._internal_metadata_);
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.options_ = (cached_has_bits & 0x00000008u)
? CreateMaybeMessage<::google::protobuf::MethodOptions>(arena, *from._impl_.options_)
: nullptr;
_impl_.options_ = (cached_has_bits & 0x00000008u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::MethodOptions>(
arena, *from._impl_.options_)
: nullptr;
::memcpy(reinterpret_cast<char *>(&_impl_) +
offsetof(Impl_, client_streaming_),
reinterpret_cast<const char *>(&from._impl_) +
@ -7172,7 +7182,8 @@ void MethodDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const
if (cached_has_bits & 0x00000008u) {
ABSL_DCHECK(from._impl_.options_ != nullptr);
if (_this->_impl_.options_ == nullptr) {
_this->_impl_.options_ = CreateMaybeMessage<::google::protobuf::MethodOptions>(arena, *from._impl_.options_);
_this->_impl_.options_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::MethodOptions>(arena, *from._impl_.options_);
} else {
_this->_impl_.options_->MergeFrom(*from._impl_.options_);
}
@ -7335,9 +7346,9 @@ FileOptions::FileOptions(
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
_impl_._extensions_.MergeFrom(this, from._impl_._extensions_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.features_ = (cached_has_bits & 0x00000400u)
? CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_)
: nullptr;
_impl_.features_ = (cached_has_bits & 0x00000400u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(
arena, *from._impl_.features_)
: nullptr;
::memcpy(reinterpret_cast<char *>(&_impl_) +
offsetof(Impl_, java_multiple_files_),
reinterpret_cast<const char *>(&from._impl_) +
@ -8030,7 +8041,8 @@ void FileOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google:
if (cached_has_bits & 0x00000400u) {
ABSL_DCHECK(from._impl_.features_ != nullptr);
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
_this->_impl_.features_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
@ -8180,9 +8192,9 @@ MessageOptions::MessageOptions(
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
_impl_._extensions_.MergeFrom(this, from._impl_._extensions_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.features_ = (cached_has_bits & 0x00000001u)
? CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_)
: nullptr;
_impl_.features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(
arena, *from._impl_.features_)
: nullptr;
::memcpy(reinterpret_cast<char *>(&_impl_) +
offsetof(Impl_, message_set_wire_format_),
reinterpret_cast<const char *>(&from._impl_) +
@ -8466,7 +8478,8 @@ void MessageOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::goog
if (cached_has_bits & 0x00000001u) {
ABSL_DCHECK(from._impl_.features_ != nullptr);
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
_this->_impl_.features_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
@ -8839,9 +8852,9 @@ FieldOptions::FieldOptions(
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
_impl_._extensions_.MergeFrom(this, from._impl_._extensions_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.features_ = (cached_has_bits & 0x00000001u)
? CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_)
: nullptr;
_impl_.features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(
arena, *from._impl_.features_)
: nullptr;
::memcpy(reinterpret_cast<char *>(&_impl_) +
offsetof(Impl_, ctype_),
reinterpret_cast<const char *>(&from._impl_) +
@ -9265,7 +9278,8 @@ void FieldOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google
if (cached_has_bits & 0x00000001u) {
ABSL_DCHECK(from._impl_.features_ != nullptr);
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
_this->_impl_.features_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
@ -9387,9 +9401,9 @@ OneofOptions::OneofOptions(
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
_impl_._extensions_.MergeFrom(this, from._impl_._extensions_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.features_ = (cached_has_bits & 0x00000001u)
? CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_)
: nullptr;
_impl_.features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(
arena, *from._impl_.features_)
: nullptr;
// @@protoc_insertion_point(copy_constructor:google.protobuf.OneofOptions)
}
@ -9567,7 +9581,8 @@ void OneofOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
ABSL_DCHECK(from._impl_.features_ != nullptr);
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
_this->_impl_.features_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
@ -9659,9 +9674,9 @@ EnumOptions::EnumOptions(
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
_impl_._extensions_.MergeFrom(this, from._impl_._extensions_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.features_ = (cached_has_bits & 0x00000001u)
? CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_)
: nullptr;
_impl_.features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(
arena, *from._impl_.features_)
: nullptr;
::memcpy(reinterpret_cast<char *>(&_impl_) +
offsetof(Impl_, allow_alias_),
reinterpret_cast<const char *>(&from._impl_) +
@ -9911,7 +9926,8 @@ void EnumOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google:
if (cached_has_bits & 0x00000001u) {
ABSL_DCHECK(from._impl_.features_ != nullptr);
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
_this->_impl_.features_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
@ -10016,9 +10032,9 @@ EnumValueOptions::EnumValueOptions(
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
_impl_._extensions_.MergeFrom(this, from._impl_._extensions_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.features_ = (cached_has_bits & 0x00000001u)
? CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_)
: nullptr;
_impl_.features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(
arena, *from._impl_.features_)
: nullptr;
::memcpy(reinterpret_cast<char *>(&_impl_) +
offsetof(Impl_, deprecated_),
reinterpret_cast<const char *>(&from._impl_) +
@ -10253,7 +10269,8 @@ void EnumValueOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::go
if (cached_has_bits & 0x00000001u) {
ABSL_DCHECK(from._impl_.features_ != nullptr);
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
_this->_impl_.features_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
@ -10352,9 +10369,9 @@ ServiceOptions::ServiceOptions(
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
_impl_._extensions_.MergeFrom(this, from._impl_._extensions_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.features_ = (cached_has_bits & 0x00000001u)
? CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_)
: nullptr;
_impl_.features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(
arena, *from._impl_.features_)
: nullptr;
_impl_.deprecated_ = from._impl_.deprecated_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.ServiceOptions)
@ -10561,7 +10578,8 @@ void ServiceOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::goog
if (cached_has_bits & 0x00000001u) {
ABSL_DCHECK(from._impl_.features_ != nullptr);
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
_this->_impl_.features_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
@ -10660,9 +10678,9 @@ MethodOptions::MethodOptions(
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
_impl_._extensions_.MergeFrom(this, from._impl_._extensions_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.features_ = (cached_has_bits & 0x00000001u)
? CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_)
: nullptr;
_impl_.features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(
arena, *from._impl_.features_)
: nullptr;
::memcpy(reinterpret_cast<char *>(&_impl_) +
offsetof(Impl_, deprecated_),
reinterpret_cast<const char *>(&from._impl_) +
@ -10902,7 +10920,8 @@ void MethodOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::googl
if (cached_has_bits & 0x00000001u) {
ABSL_DCHECK(from._impl_.features_ != nullptr);
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
_this->_impl_.features_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
@ -12013,9 +12032,9 @@ FeatureSetDefaults_FeatureSetEditionDefault::FeatureSetDefaults_FeatureSetEditio
from._internal_metadata_);
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
::uint32_t cached_has_bits = _impl_._has_bits_[0];
_impl_.features_ = (cached_has_bits & 0x00000001u)
? CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_)
: nullptr;
_impl_.features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(
arena, *from._impl_.features_)
: nullptr;
_impl_.edition_ = from._impl_.edition_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault)
@ -12188,7 +12207,8 @@ void FeatureSetDefaults_FeatureSetEditionDefault::MergeImpl(::google::protobuf::
if (cached_has_bits & 0x00000001u) {
ABSL_DCHECK(from._impl_.features_ != nullptr);
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
_this->_impl_.features_ =
::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}

@ -788,7 +788,7 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final :
// implements Message ----------------------------------------------
UninterpretedOption_NamePart* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<UninterpretedOption_NamePart>(arena);
return ::google::protobuf::Message::DefaultConstruct<UninterpretedOption_NamePart>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const UninterpretedOption_NamePart& from);
@ -981,7 +981,7 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final :
// implements Message ----------------------------------------------
SourceCodeInfo_Location* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<SourceCodeInfo_Location>(arena);
return ::google::protobuf::Message::DefaultConstruct<SourceCodeInfo_Location>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const SourceCodeInfo_Location& from);
@ -1252,7 +1252,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final :
// implements Message ----------------------------------------------
GeneratedCodeInfo_Annotation* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<GeneratedCodeInfo_Annotation>(arena);
return ::google::protobuf::Message::DefaultConstruct<GeneratedCodeInfo_Annotation>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const GeneratedCodeInfo_Annotation& from);
@ -1513,7 +1513,7 @@ class PROTOBUF_EXPORT FieldOptions_EditionDefault final :
// implements Message ----------------------------------------------
FieldOptions_EditionDefault* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<FieldOptions_EditionDefault>(arena);
return ::google::protobuf::Message::DefaultConstruct<FieldOptions_EditionDefault>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const FieldOptions_EditionDefault& from);
@ -1706,7 +1706,7 @@ class PROTOBUF_EXPORT FeatureSet final :
// implements Message ----------------------------------------------
FeatureSet* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<FeatureSet>(arena);
return ::google::protobuf::Message::DefaultConstruct<FeatureSet>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const FeatureSet& from);
@ -2251,7 +2251,7 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final :
// implements Message ----------------------------------------------
ExtensionRangeOptions_Declaration* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<ExtensionRangeOptions_Declaration>(arena);
return ::google::protobuf::Message::DefaultConstruct<ExtensionRangeOptions_Declaration>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const ExtensionRangeOptions_Declaration& from);
@ -2489,7 +2489,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final :
// implements Message ----------------------------------------------
EnumDescriptorProto_EnumReservedRange* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<EnumDescriptorProto_EnumReservedRange>(arena);
return ::google::protobuf::Message::DefaultConstruct<EnumDescriptorProto_EnumReservedRange>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const EnumDescriptorProto_EnumReservedRange& from);
@ -2676,7 +2676,7 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final :
// implements Message ----------------------------------------------
DescriptorProto_ReservedRange* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<DescriptorProto_ReservedRange>(arena);
return ::google::protobuf::Message::DefaultConstruct<DescriptorProto_ReservedRange>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const DescriptorProto_ReservedRange& from);
@ -2863,7 +2863,7 @@ class PROTOBUF_EXPORT UninterpretedOption final :
// implements Message ----------------------------------------------
UninterpretedOption* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<UninterpretedOption>(arena);
return ::google::protobuf::Message::DefaultConstruct<UninterpretedOption>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const UninterpretedOption& from);
@ -3142,7 +3142,7 @@ class PROTOBUF_EXPORT SourceCodeInfo final :
// implements Message ----------------------------------------------
SourceCodeInfo* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<SourceCodeInfo>(arena);
return ::google::protobuf::Message::DefaultConstruct<SourceCodeInfo>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const SourceCodeInfo& from);
@ -3324,7 +3324,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final :
// implements Message ----------------------------------------------
GeneratedCodeInfo* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<GeneratedCodeInfo>(arena);
return ::google::protobuf::Message::DefaultConstruct<GeneratedCodeInfo>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const GeneratedCodeInfo& from);
@ -3506,7 +3506,7 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final :
// implements Message ----------------------------------------------
FeatureSetDefaults_FeatureSetEditionDefault* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<FeatureSetDefaults_FeatureSetEditionDefault>(arena);
return ::google::protobuf::Message::DefaultConstruct<FeatureSetDefaults_FeatureSetEditionDefault>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const FeatureSetDefaults_FeatureSetEditionDefault& from);
@ -3697,7 +3697,7 @@ class PROTOBUF_EXPORT ServiceOptions final :
// implements Message ----------------------------------------------
ServiceOptions* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<ServiceOptions>(arena);
return ::google::protobuf::Message::DefaultConstruct<ServiceOptions>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const ServiceOptions& from);
@ -4087,7 +4087,7 @@ class PROTOBUF_EXPORT OneofOptions final :
// implements Message ----------------------------------------------
OneofOptions* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<OneofOptions>(arena);
return ::google::protobuf::Message::DefaultConstruct<OneofOptions>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const OneofOptions& from);
@ -4464,7 +4464,7 @@ class PROTOBUF_EXPORT MethodOptions final :
// implements Message ----------------------------------------------
MethodOptions* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<MethodOptions>(arena);
return ::google::protobuf::Message::DefaultConstruct<MethodOptions>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const MethodOptions& from);
@ -4888,7 +4888,7 @@ class PROTOBUF_EXPORT MessageOptions final :
// implements Message ----------------------------------------------
MessageOptions* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<MessageOptions>(arena);
return ::google::protobuf::Message::DefaultConstruct<MessageOptions>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const MessageOptions& from);
@ -5330,7 +5330,7 @@ class PROTOBUF_EXPORT FileOptions final :
// implements Message ----------------------------------------------
FileOptions* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<FileOptions>(arena);
return ::google::protobuf::Message::DefaultConstruct<FileOptions>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const FileOptions& from);
@ -6048,7 +6048,7 @@ class PROTOBUF_EXPORT FieldOptions final :
// implements Message ----------------------------------------------
FieldOptions* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<FieldOptions>(arena);
return ::google::protobuf::Message::DefaultConstruct<FieldOptions>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const FieldOptions& from);
@ -6676,7 +6676,7 @@ class PROTOBUF_EXPORT FeatureSetDefaults final :
// implements Message ----------------------------------------------
FeatureSetDefaults* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<FeatureSetDefaults>(arena);
return ::google::protobuf::Message::DefaultConstruct<FeatureSetDefaults>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const FeatureSetDefaults& from);
@ -6885,7 +6885,7 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final :
// implements Message ----------------------------------------------
ExtensionRangeOptions* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<ExtensionRangeOptions>(arena);
return ::google::protobuf::Message::DefaultConstruct<ExtensionRangeOptions>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const ExtensionRangeOptions& from);
@ -7317,7 +7317,7 @@ class PROTOBUF_EXPORT EnumValueOptions final :
// implements Message ----------------------------------------------
EnumValueOptions* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<EnumValueOptions>(arena);
return ::google::protobuf::Message::DefaultConstruct<EnumValueOptions>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const EnumValueOptions& from);
@ -7720,7 +7720,7 @@ class PROTOBUF_EXPORT EnumOptions final :
// implements Message ----------------------------------------------
EnumOptions* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<EnumOptions>(arena);
return ::google::protobuf::Message::DefaultConstruct<EnumOptions>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const EnumOptions& from);
@ -8136,7 +8136,7 @@ class PROTOBUF_EXPORT OneofDescriptorProto final :
// implements Message ----------------------------------------------
OneofDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<OneofDescriptorProto>(arena);
return ::google::protobuf::Message::DefaultConstruct<OneofDescriptorProto>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const OneofDescriptorProto& from);
@ -8333,7 +8333,7 @@ class PROTOBUF_EXPORT MethodDescriptorProto final :
// implements Message ----------------------------------------------
MethodDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<MethodDescriptorProto>(arena);
return ::google::protobuf::Message::DefaultConstruct<MethodDescriptorProto>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const MethodDescriptorProto& from);
@ -8594,7 +8594,7 @@ class PROTOBUF_EXPORT FieldDescriptorProto final :
// implements Message ----------------------------------------------
FieldDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<FieldDescriptorProto>(arena);
return ::google::protobuf::Message::DefaultConstruct<FieldDescriptorProto>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const FieldDescriptorProto& from);
@ -8989,7 +8989,7 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final :
// implements Message ----------------------------------------------
EnumValueDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<EnumValueDescriptorProto>(arena);
return ::google::protobuf::Message::DefaultConstruct<EnumValueDescriptorProto>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const EnumValueDescriptorProto& from);
@ -9199,7 +9199,7 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final :
// implements Message ----------------------------------------------
DescriptorProto_ExtensionRange* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<DescriptorProto_ExtensionRange>(arena);
return ::google::protobuf::Message::DefaultConstruct<DescriptorProto_ExtensionRange>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const DescriptorProto_ExtensionRange& from);
@ -9403,7 +9403,7 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final :
// implements Message ----------------------------------------------
ServiceDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<ServiceDescriptorProto>(arena);
return ::google::protobuf::Message::DefaultConstruct<ServiceDescriptorProto>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const ServiceDescriptorProto& from);
@ -9620,7 +9620,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto final :
// implements Message ----------------------------------------------
EnumDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<EnumDescriptorProto>(arena);
return ::google::protobuf::Message::DefaultConstruct<EnumDescriptorProto>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const EnumDescriptorProto& from);
@ -9889,7 +9889,7 @@ class PROTOBUF_EXPORT DescriptorProto final :
// implements Message ----------------------------------------------
DescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<DescriptorProto>(arena);
return ::google::protobuf::Message::DefaultConstruct<DescriptorProto>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const DescriptorProto& from);
@ -10259,7 +10259,7 @@ class PROTOBUF_EXPORT FileDescriptorProto final :
// implements Message ----------------------------------------------
FileDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<FileDescriptorProto>(arena);
return ::google::protobuf::Message::DefaultConstruct<FileDescriptorProto>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const FileDescriptorProto& from);
@ -10674,7 +10674,7 @@ class PROTOBUF_EXPORT FileDescriptorSet final :
// implements Message ----------------------------------------------
FileDescriptorSet* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<FileDescriptorSet>(arena);
return ::google::protobuf::Message::DefaultConstruct<FileDescriptorSet>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const FileDescriptorSet& from);
@ -11431,7 +11431,7 @@ inline ::google::protobuf::FileOptions* FileDescriptorProto::_internal_mutable_o
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000008u;
if (_impl_.options_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::FileOptions>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FileOptions>(GetArena());
_impl_.options_ = reinterpret_cast<::google::protobuf::FileOptions*>(p);
}
return _impl_.options_;
@ -11527,7 +11527,7 @@ inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::_internal_mutabl
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000010u;
if (_impl_.source_code_info_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::SourceCodeInfo>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::SourceCodeInfo>(GetArena());
_impl_.source_code_info_ = reinterpret_cast<::google::protobuf::SourceCodeInfo*>(p);
}
return _impl_.source_code_info_;
@ -11783,7 +11783,7 @@ inline ::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
if (_impl_.options_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::ExtensionRangeOptions>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::ExtensionRangeOptions>(GetArena());
_impl_.options_ = reinterpret_cast<::google::protobuf::ExtensionRangeOptions*>(p);
}
return _impl_.options_;
@ -12308,7 +12308,7 @@ inline ::google::protobuf::MessageOptions* DescriptorProto::_internal_mutable_op
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000002u;
if (_impl_.options_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::MessageOptions>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::MessageOptions>(GetArena());
_impl_.options_ = reinterpret_cast<::google::protobuf::MessageOptions*>(p);
}
return _impl_.options_;
@ -12886,7 +12886,7 @@ inline ::google::protobuf::FeatureSet* ExtensionRangeOptions::_internal_mutable_
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
if (_impl_.features_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::FeatureSet>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena());
_impl_.features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(p);
}
return _impl_.features_;
@ -13484,7 +13484,7 @@ inline ::google::protobuf::FieldOptions* FieldDescriptorProto::_internal_mutable
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000020u;
if (_impl_.options_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::FieldOptions>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FieldOptions>(GetArena());
_impl_.options_ = reinterpret_cast<::google::protobuf::FieldOptions*>(p);
}
return _impl_.options_;
@ -13683,7 +13683,7 @@ inline ::google::protobuf::OneofOptions* OneofDescriptorProto::_internal_mutable
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000002u;
if (_impl_.options_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::OneofOptions>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::OneofOptions>(GetArena());
_impl_.options_ = reinterpret_cast<::google::protobuf::OneofOptions*>(p);
}
return _impl_.options_;
@ -13963,7 +13963,7 @@ inline ::google::protobuf::EnumOptions* EnumDescriptorProto::_internal_mutable_o
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000002u;
if (_impl_.options_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::EnumOptions>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::EnumOptions>(GetArena());
_impl_.options_ = reinterpret_cast<::google::protobuf::EnumOptions*>(p);
}
return _impl_.options_;
@ -14312,7 +14312,7 @@ inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::_internal
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000002u;
if (_impl_.options_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::EnumValueOptions>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::EnumValueOptions>(GetArena());
_impl_.options_ = reinterpret_cast<::google::protobuf::EnumValueOptions*>(p);
}
return _impl_.options_;
@ -14532,7 +14532,7 @@ inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::_internal_mut
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000002u;
if (_impl_.options_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::ServiceOptions>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::ServiceOptions>(GetArena());
_impl_.options_ = reinterpret_cast<::google::protobuf::ServiceOptions*>(p);
}
return _impl_.options_;
@ -14845,7 +14845,7 @@ inline ::google::protobuf::MethodOptions* MethodDescriptorProto::_internal_mutab
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000008u;
if (_impl_.options_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::MethodOptions>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::MethodOptions>(GetArena());
_impl_.options_ = reinterpret_cast<::google::protobuf::MethodOptions*>(p);
}
return _impl_.options_;
@ -15992,7 +15992,7 @@ inline ::google::protobuf::FeatureSet* FileOptions::_internal_mutable_features()
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000400u;
if (_impl_.features_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::FeatureSet>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena());
_impl_.features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(p);
}
return _impl_.features_;
@ -16281,7 +16281,7 @@ inline ::google::protobuf::FeatureSet* MessageOptions::_internal_mutable_feature
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
if (_impl_.features_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::FeatureSet>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena());
_impl_.features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(p);
}
return _impl_.features_;
@ -16884,7 +16884,7 @@ inline ::google::protobuf::FeatureSet* FieldOptions::_internal_mutable_features(
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
if (_impl_.features_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::FeatureSet>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena());
_impl_.features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(p);
}
return _impl_.features_;
@ -17033,7 +17033,7 @@ inline ::google::protobuf::FeatureSet* OneofOptions::_internal_mutable_features(
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
if (_impl_.features_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::FeatureSet>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena());
_impl_.features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(p);
}
return _impl_.features_;
@ -17266,7 +17266,7 @@ inline ::google::protobuf::FeatureSet* EnumOptions::_internal_mutable_features()
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
if (_impl_.features_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::FeatureSet>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena());
_impl_.features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(p);
}
return _impl_.features_;
@ -17443,7 +17443,7 @@ inline ::google::protobuf::FeatureSet* EnumValueOptions::_internal_mutable_featu
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
if (_impl_.features_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::FeatureSet>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena());
_impl_.features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(p);
}
return _impl_.features_;
@ -17620,7 +17620,7 @@ inline ::google::protobuf::FeatureSet* ServiceOptions::_internal_mutable_feature
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
if (_impl_.features_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::FeatureSet>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena());
_impl_.features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(p);
}
return _impl_.features_;
@ -17854,7 +17854,7 @@ inline ::google::protobuf::FeatureSet* MethodOptions::_internal_mutable_features
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
if (_impl_.features_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::FeatureSet>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena());
_impl_.features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(p);
}
return _impl_.features_;
@ -18663,7 +18663,7 @@ inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefau
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_._has_bits_[0] |= 0x00000001u;
if (_impl_.features_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::FeatureSet>(GetArena());
auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena());
_impl_.features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(p);
}
return _impl_.features_;

@ -651,11 +651,6 @@ void GenericTypeHandler<MessageLite>::Merge(const MessageLite& from,
MessageLite* to) {
to->CheckTypeAndMergeFrom(from);
}
template <>
void GenericTypeHandler<std::string>::Merge(const std::string& from,
std::string* to) {
*to = from;
}
// Non-inline variants of std::string specializations for
// various InternalMetadata routines.

@ -505,13 +505,13 @@ class PROTOBUF_EXPORT MessageLite {
}
template <typename T>
static T* CreateMaybeMessage(Arena* arena) {
return Arena::CreateMaybeMessage<T>(arena);
PROTOBUF_ALWAYS_INLINE static T* DefaultConstruct(Arena* arena) {
return static_cast<T*>(Arena::DefaultConstruct<T>(arena));
}
template <typename T>
static T* CreateMaybeMessage(Arena* arena, const T& from) {
return Arena::CreateMaybeMessage<T>(arena, from);
PROTOBUF_ALWAYS_INLINE static T* CopyConstruct(Arena* arena, const T& from) {
return static_cast<T*>(Arena::CopyConstruct<T>(arena, &from));
}
inline explicit MessageLite(Arena* arena) : _internal_metadata_(arena) {}

@ -219,8 +219,8 @@ void RepeatedPtrFieldBase::MergeFromConcreteMessage(
const RepeatedPtrFieldBase& from, CopyFn copy_fn) {
ABSL_DCHECK_NE(&from, this);
int new_size = current_size_ + from.current_size_;
auto dst = reinterpret_cast<MessageLite**>(InternalReserve(new_size));
auto src = reinterpret_cast<MessageLite const* const*>(from.elements());
void** dst = InternalReserve(new_size);
const void* const* src = from.elements();
auto end = src + from.current_size_;
if (PROTOBUF_PREDICT_FALSE(ClearedCount() > 0)) {
int recycled = MergeIntoClearedMessages(from);
@ -229,7 +229,7 @@ void RepeatedPtrFieldBase::MergeFromConcreteMessage(
}
Arena* arena = GetArena();
for (; src < end; ++src, ++dst) {
*dst = copy_fn(arena, **src);
*dst = copy_fn(arena, *src);
}
ExchangeCurrentSize(new_size);
if (new_size > allocated_size()) {
@ -270,6 +270,10 @@ void RepeatedPtrFieldBase::MergeFrom<MessageLite>(
}
}
void* NewStringElement(Arena* arena) {
return Arena::Create<std::string>(arena);
}
} // namespace internal
} // namespace protobuf
} // namespace google

@ -72,11 +72,6 @@ class RepeatedPtrOverPtrsIterator;
namespace internal {
template <typename Element>
inline void* NewT(Arena* a) {
return GenericTypeHandler<Element>::New(a);
}
// 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) {
@ -229,7 +224,7 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase {
template <typename Handler>
Value<Handler>* Add() {
return cast<Handler>(AddOutOfLineHelper(NewT<Value<Handler>>));
return cast<Handler>(AddOutOfLineHelper(Handler::GetNewFunc()));
}
template <
@ -304,17 +299,11 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase {
}
}
// Message creating functor: used in MergeFrom<T>()
template <typename T>
static MessageLite* CopyMessage(Arena* arena, const MessageLite& src) {
return Arena::CreateMaybeMessage<T>(arena, static_cast<const T&>(src));
}
// Appends all message values from `from` to this instance.
template <typename T>
void MergeFrom(const RepeatedPtrFieldBase& from) {
static_assert(std::is_base_of<MessageLite, T>::value, "");
MergeFromConcreteMessage(from, CopyMessage<T>);
MergeFromConcreteMessage(from, Arena::CopyConstruct<T>);
}
inline void InternalSwap(RepeatedPtrFieldBase* PROTOBUF_RESTRICT rhs) {
@ -693,7 +682,7 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase {
// This follows the `Arena::CreateMaybeMessage` signature so that the compiler
// can have the inlined call into the out of line copy function(s) simply pass
// the address of `Arena::CreateMaybeMessage` 'as is'.
using CopyFn = MessageLite* (*)(Arena*, const MessageLite&);
using CopyFn = void* (*)(Arena*, const void*);
struct Rep {
int allocated_size;
@ -891,8 +880,10 @@ class GenericTypeHandler {
typedef GenericType Type;
using Movable = IsMovable<GenericType>;
static constexpr auto GetNewFunc() { return Arena::DefaultConstruct<Type>; }
static inline GenericType* New(Arena* arena) {
return Arena::CreateMaybeMessage<Type>(arena);
return static_cast<GenericType*>(Arena::DefaultConstruct<Type>(arena));
}
static inline GenericType* New(Arena* arena, GenericType&& value) {
return Arena::Create<GenericType>(arena, std::move(value));
@ -951,14 +942,6 @@ template <>
PROTOBUF_EXPORT void GenericTypeHandler<MessageLite>::Merge(
const MessageLite& from, MessageLite* to);
template <>
inline void GenericTypeHandler<std::string>::Clear(std::string* value) {
value->clear();
}
template <>
void GenericTypeHandler<std::string>::Merge(const std::string& from,
std::string* to);
// Message specialization bodies defined in message.cc. This split is necessary
// to allow proto2-lite (which includes this header) to be independent of
// Message.
@ -968,11 +951,16 @@ PROTOBUF_EXPORT Message* GenericTypeHandler<Message>::NewFromPrototype(
template <>
PROTOBUF_EXPORT Arena* GenericTypeHandler<Message>::GetArena(Message* value);
class StringTypeHandler {
PROTOBUF_EXPORT void* NewStringElement(Arena* arena);
template <>
class GenericTypeHandler<std::string> {
public:
typedef std::string Type;
using Movable = IsMovable<Type>;
static constexpr auto GetNewFunc() { return NewStringElement; }
static PROTOBUF_NOINLINE std::string* New(Arena* arena) {
return Arena::Create<std::string>(arena);
}
@ -1333,7 +1321,7 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
friend struct WeakRepeatedPtrField;
// Note: RepeatedPtrField SHOULD NOT be subclassed by users.
class TypeHandler;
using TypeHandler = internal::GenericTypeHandler<Element>;
RepeatedPtrField(Arena* arena, const RepeatedPtrField& rhs);
@ -1354,14 +1342,6 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
// -------------------------------------------------------------------
template <typename Element>
class RepeatedPtrField<Element>::TypeHandler
: public internal::GenericTypeHandler<Element> {};
template <>
class RepeatedPtrField<std::string>::TypeHandler
: public internal::StringTypeHandler {};
template <typename Element>
constexpr RepeatedPtrField<Element>::RepeatedPtrField()
: RepeatedPtrFieldBase() {
@ -1373,7 +1353,7 @@ inline RepeatedPtrField<Element>::RepeatedPtrField(Arena* arena)
: RepeatedPtrFieldBase(arena) {
// We can't have StaticValidityCheck here because that requires Element to be
// a complete type, and in split repeated fields cases, we call
// CreateMaybeMessage<RepeatedPtrField<T>> for incomplete Ts.
// CreateMessage<RepeatedPtrField<T>> for incomplete Ts.
}
template <typename Element>

Loading…
Cancel
Save