Use Arena enabled copy constructor when merging child messages

PiperOrigin-RevId: 575841937
pull/14480/head
Martijn Vels 1 year ago committed by Copybara-Service
parent 8bf4fe924a
commit 538a8e9a0d
  1. 4
      src/google/protobuf/compiler/cpp/field.cc
  2. 16
      src/google/protobuf/compiler/cpp/field.h
  3. 21
      src/google/protobuf/compiler/cpp/field_generators/message_field.cc
  4. 14
      src/google/protobuf/compiler/cpp/message.cc
  5. 5
      src/google/protobuf/compiler/cpp/message.h
  6. 18
      src/google/protobuf/compiler/plugin.pb.cc
  7. 179
      src/google/protobuf/descriptor.pb.cc

@ -263,6 +263,7 @@ void HasBitVars(const FieldDescriptor* field, const Options& opts,
absl::optional<uint32_t> idx, std::vector<Sub>& vars) {
if (!idx.has_value()) {
vars.emplace_back("set_hasbit", "");
vars.emplace_back("this_set_hasbit", "");
vars.emplace_back("clear_hasbit", "");
return;
}
@ -283,6 +284,9 @@ void HasBitVars(const FieldDescriptor* field, const Options& opts,
vars.emplace_back("has_hasbit", has);
vars.emplace_back(Sub("set_hasbit", set).WithSuffix(";"));
vars.emplace_back(Sub("clear_hasbit", clr).WithSuffix(";"));
set = absl::StrFormat("_this->%s[%d] |= %s;", has_bits, index, mask);
vars.emplace_back(Sub("this_set_hasbit", set).WithSuffix(";"));
}
void InlinedStringVars(const FieldDescriptor* field, const Options& opts,

@ -39,6 +39,11 @@ namespace cpp {
// matter of clean composability.
class FieldGeneratorBase {
public:
// `GeneratorFunction` defines a subset of generator functions that may have
// additional optimizations or requirements such as 'uses a local `arena`
// variable instead of calling GetArena()'
enum class GeneratorFunction { kMergeFrom };
FieldGeneratorBase(const FieldDescriptor* descriptor, const Options& options,
MessageSCCAnalyzer* scc_analyzer);
@ -100,6 +105,10 @@ class FieldGeneratorBase {
return has_default_constexpr_constructor_;
}
// Returns true if this generator requires an 'arena' parameter on the
// given generator function.
virtual bool RequiresArena(GeneratorFunction) const { return false; }
virtual std::vector<io::Printer::Sub> MakeVars() const { return {}; }
virtual void GeneratePrivateMembers(io::Printer* p) const = 0;
@ -230,6 +239,8 @@ class FieldGenerator {
}
public:
using GeneratorFunction = FieldGeneratorBase::GeneratorFunction;
FieldGenerator(const FieldGenerator&) = delete;
FieldGenerator& operator=(const FieldGenerator&) = delete;
FieldGenerator(FieldGenerator&&) = default;
@ -256,6 +267,11 @@ class FieldGenerator {
return impl_->has_default_constexpr_constructor();
}
// Requirements: see FieldGeneratorBase for documentation
bool RequiresArena(GeneratorFunction function) const {
return impl_->RequiresArena(function);
}
// Prints private members needed to represent this field.
//
// These are placed inside the class definition.

@ -102,6 +102,8 @@ class SingularMessage : public FieldGeneratorBase {
)cc");
}
bool RequiresArena(GeneratorFunction function) const override;
void GenerateNonInlineAccessorDefinitions(io::Printer* p) const override {}
void GenerateAccessorDeclarations(io::Printer* p) const override;
@ -415,15 +417,32 @@ void SingularMessage::GenerateMessageClearingCode(io::Printer* p) const {
}
}
bool SingularMessage::RequiresArena(GeneratorFunction function) const {
switch (function) {
case GeneratorFunction::kMergeFrom:
return !(is_weak() || is_oneof() || should_split());
}
return false;
}
void SingularMessage::GenerateMergingCode(io::Printer* p) const {
if (is_weak()) {
p->Emit(
"_Internal::mutable_$name$(_this)->CheckTypeAndMergeFrom(\n"
" _Internal::$name$(&from));\n");
} else {
} else if (is_oneof() || should_split()) {
p->Emit(
"_this->_internal_mutable_$name$()->$Submsg$::MergeFrom(\n"
" from._internal_$name$());\n");
} else {
p->Emit(R"cc(
$this_set_hasbit$;
if (_this->$field_$ == nullptr) {
_this->$field_$ = CreateMaybeMessage<$Submsg$>(arena, *from.$field_$);
} else {
_this->$field_$->MergeFrom(*from.$field_$);
}
)cc");
}
}

@ -3496,6 +3496,15 @@ void MessageGenerator::GenerateMergeFrom(io::Printer* p) {
}
}
bool MessageGenerator::RequiresArena(GeneratorFunction function) const {
for (const FieldDescriptor* field : FieldRange(descriptor_)) {
if (field_generators_.get(field).RequiresArena(function)) {
return true;
}
}
return false;
}
void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* p) {
if (HasSimpleBaseClass(descriptor_, options_)) return;
// Generate the class-specific MergeFrom, which avoids the ABSL_CHECK and
@ -3515,6 +3524,11 @@ void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* p) {
" auto& from = static_cast<const $classname$&>(from_msg);\n");
}
format.Indent();
if (RequiresArena(GeneratorFunction::kMergeFrom)) {
p->Emit(R"cc(
::$proto_ns$::Arena* arena = _this->GetArena();
)cc");
}
format(
"$annotate_mergefrom$"
"// @@protoc_insertion_point(class_specific_merge_from_start:"

@ -80,6 +80,7 @@ class MessageGenerator {
const Descriptor* descriptor() const { return descriptor_; }
private:
using GeneratorFunction = FieldGeneratorBase::GeneratorFunction;
enum class InitType { kConstexpr, kArena, kArenaCopy };
// Generate declarations and definitions of accessors for fields.
@ -148,6 +149,10 @@ class MessageGenerator {
void GenerateFieldClear(const FieldDescriptor* field, bool is_inline,
io::Printer* p);
// Returns true if any of the fields needs an `arena` variable containing
// the current message's arena, reducing `GetArena()` call churn.
bool RequiresArena(GeneratorFunction function) const;
// Returns whether impl_ has a copy ctor.
bool ImplHasCopyCtor() const;

@ -904,6 +904,7 @@ const ::_pbi::TcParseTable<3, 5, 3, 79, 2> CodeGeneratorRequest::_table_ = {
void CodeGeneratorRequest::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<CodeGeneratorRequest*>(&to_msg);
auto& from = static_cast<const CodeGeneratorRequest&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorRequest)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -920,8 +921,12 @@ void CodeGeneratorRequest::MergeImpl(::google::protobuf::Message& to_msg, const
_this->_internal_set_parameter(from._internal_parameter());
}
if (cached_has_bits & 0x00000002u) {
_this->_internal_mutable_compiler_version()->::google::protobuf::compiler::Version::MergeFrom(
from._internal_compiler_version());
_this->_impl_._has_bits_[0] |= 0x00000002u;
if (_this->_impl_.compiler_version_ == nullptr) {
_this->_impl_.compiler_version_ = CreateMaybeMessage<::google::protobuf::compiler::Version>(arena, *from._impl_.compiler_version_);
} else {
_this->_impl_.compiler_version_->MergeFrom(*from._impl_.compiler_version_);
}
}
}
_this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_);
@ -1236,6 +1241,7 @@ const ::_pbi::TcParseTable<2, 4, 1, 86, 2> CodeGeneratorResponse_File::_table_ =
void CodeGeneratorResponse_File::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<CodeGeneratorResponse_File*>(&to_msg);
auto& from = static_cast<const CodeGeneratorResponse_File&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse.File)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -1253,8 +1259,12 @@ void CodeGeneratorResponse_File::MergeImpl(::google::protobuf::Message& to_msg,
_this->_internal_set_content(from._internal_content());
}
if (cached_has_bits & 0x00000008u) {
_this->_internal_mutable_generated_code_info()->::google::protobuf::GeneratedCodeInfo::MergeFrom(
from._internal_generated_code_info());
_this->_impl_._has_bits_[0] |= 0x00000008u;
if (_this->_impl_.generated_code_info_ == nullptr) {
_this->_impl_.generated_code_info_ = CreateMaybeMessage<::google::protobuf::GeneratedCodeInfo>(arena, *from._impl_.generated_code_info_);
} else {
_this->_impl_.generated_code_info_->MergeFrom(*from._impl_.generated_code_info_);
}
}
}
_this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_);

@ -3042,6 +3042,7 @@ constexpr ::_pbi::TcParseTable<4, 13, 7, 79, 2> FileDescriptorProto::_table_ = {
void FileDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<FileDescriptorProto*>(&to_msg);
auto& from = static_cast<const FileDescriptorProto&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FileDescriptorProto)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -3070,12 +3071,20 @@ void FileDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const :
_this->_internal_set_syntax(from._internal_syntax());
}
if (cached_has_bits & 0x00000008u) {
_this->_internal_mutable_options()->::google::protobuf::FileOptions::MergeFrom(
from._internal_options());
_this->_impl_._has_bits_[0] |= 0x00000008u;
if (_this->_impl_.options_ == nullptr) {
_this->_impl_.options_ = CreateMaybeMessage<::google::protobuf::FileOptions>(arena, *from._impl_.options_);
} else {
_this->_impl_.options_->MergeFrom(*from._impl_.options_);
}
}
if (cached_has_bits & 0x00000010u) {
_this->_internal_mutable_source_code_info()->::google::protobuf::SourceCodeInfo::MergeFrom(
from._internal_source_code_info());
_this->_impl_._has_bits_[0] |= 0x00000010u;
if (_this->_impl_.source_code_info_ == nullptr) {
_this->_impl_.source_code_info_ = CreateMaybeMessage<::google::protobuf::SourceCodeInfo>(arena, *from._impl_.source_code_info_);
} else {
_this->_impl_.source_code_info_->MergeFrom(*from._impl_.source_code_info_);
}
}
if (cached_has_bits & 0x00000020u) {
_this->_impl_.edition_ = from._impl_.edition_;
@ -3374,6 +3383,7 @@ constexpr ::_pbi::TcParseTable<2, 3, 1, 0, 2> DescriptorProto_ExtensionRange::_t
void DescriptorProto_ExtensionRange::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<DescriptorProto_ExtensionRange*>(&to_msg);
auto& from = static_cast<const DescriptorProto_ExtensionRange&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DescriptorProto.ExtensionRange)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -3382,8 +3392,12 @@ void DescriptorProto_ExtensionRange::MergeImpl(::google::protobuf::Message& to_m
cached_has_bits = from._impl_._has_bits_[0];
if (cached_has_bits & 0x00000007u) {
if (cached_has_bits & 0x00000001u) {
_this->_internal_mutable_options()->::google::protobuf::ExtensionRangeOptions::MergeFrom(
from._internal_options());
_this->_impl_._has_bits_[0] |= 0x00000001u;
if (_this->_impl_.options_ == nullptr) {
_this->_impl_.options_ = CreateMaybeMessage<::google::protobuf::ExtensionRangeOptions>(arena, *from._impl_.options_);
} else {
_this->_impl_.options_->MergeFrom(*from._impl_.options_);
}
}
if (cached_has_bits & 0x00000002u) {
_this->_impl_.start_ = from._impl_.start_;
@ -4063,6 +4077,7 @@ constexpr ::_pbi::TcParseTable<4, 10, 8, 65, 2> DescriptorProto::_table_ = {
void DescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<DescriptorProto*>(&to_msg);
auto& from = static_cast<const DescriptorProto&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DescriptorProto)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -4089,8 +4104,12 @@ void DescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const ::goo
_this->_internal_set_name(from._internal_name());
}
if (cached_has_bits & 0x00000002u) {
_this->_internal_mutable_options()->::google::protobuf::MessageOptions::MergeFrom(
from._internal_options());
_this->_impl_._has_bits_[0] |= 0x00000002u;
if (_this->_impl_.options_ == nullptr) {
_this->_impl_.options_ = CreateMaybeMessage<::google::protobuf::MessageOptions>(arena, *from._impl_.options_);
} else {
_this->_impl_.options_->MergeFrom(*from._impl_.options_);
}
}
}
_this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_);
@ -4759,6 +4778,7 @@ constexpr ::_pbi::TcParseTable<3, 4, 4, 0, 12> ExtensionRangeOptions::_table_ =
void ExtensionRangeOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<ExtensionRangeOptions*>(&to_msg);
auto& from = static_cast<const ExtensionRangeOptions&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ExtensionRangeOptions)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -4771,8 +4791,12 @@ void ExtensionRangeOptions::MergeImpl(::google::protobuf::Message& to_msg, const
cached_has_bits = from._impl_._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000001u) {
_this->_internal_mutable_features()->::google::protobuf::FeatureSet::MergeFrom(
from._internal_features());
_this->_impl_._has_bits_[0] |= 0x00000001u;
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
}
if (cached_has_bits & 0x00000002u) {
_this->_impl_.verification_ = from._impl_.verification_;
@ -5292,6 +5316,7 @@ constexpr ::_pbi::TcParseTable<4, 11, 3, 96, 2> FieldDescriptorProto::_table_ =
void FieldDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<FieldDescriptorProto*>(&to_msg);
auto& from = static_cast<const FieldDescriptorProto&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FieldDescriptorProto)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -5315,8 +5340,12 @@ void FieldDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const
_this->_internal_set_json_name(from._internal_json_name());
}
if (cached_has_bits & 0x00000020u) {
_this->_internal_mutable_options()->::google::protobuf::FieldOptions::MergeFrom(
from._internal_options());
_this->_impl_._has_bits_[0] |= 0x00000020u;
if (_this->_impl_.options_ == nullptr) {
_this->_impl_.options_ = CreateMaybeMessage<::google::protobuf::FieldOptions>(arena, *from._impl_.options_);
} else {
_this->_impl_.options_->MergeFrom(*from._impl_.options_);
}
}
if (cached_has_bits & 0x00000040u) {
_this->_impl_.number_ = from._impl_.number_;
@ -5589,6 +5618,7 @@ constexpr ::_pbi::TcParseTable<1, 2, 1, 49, 2> OneofDescriptorProto::_table_ = {
void OneofDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<OneofDescriptorProto*>(&to_msg);
auto& from = static_cast<const OneofDescriptorProto&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.OneofDescriptorProto)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -5600,8 +5630,12 @@ void OneofDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const
_this->_internal_set_name(from._internal_name());
}
if (cached_has_bits & 0x00000002u) {
_this->_internal_mutable_options()->::google::protobuf::OneofOptions::MergeFrom(
from._internal_options());
_this->_impl_._has_bits_[0] |= 0x00000002u;
if (_this->_impl_.options_ == nullptr) {
_this->_impl_.options_ = CreateMaybeMessage<::google::protobuf::OneofOptions>(arena, *from._impl_.options_);
} else {
_this->_impl_.options_->MergeFrom(*from._impl_.options_);
}
}
}
_this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_);
@ -6149,6 +6183,7 @@ constexpr ::_pbi::TcParseTable<3, 5, 3, 61, 2> EnumDescriptorProto::_table_ = {
void EnumDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<EnumDescriptorProto*>(&to_msg);
auto& from = static_cast<const EnumDescriptorProto&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumDescriptorProto)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -6165,8 +6200,12 @@ void EnumDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const :
_this->_internal_set_name(from._internal_name());
}
if (cached_has_bits & 0x00000002u) {
_this->_internal_mutable_options()->::google::protobuf::EnumOptions::MergeFrom(
from._internal_options());
_this->_impl_._has_bits_[0] |= 0x00000002u;
if (_this->_impl_.options_ == nullptr) {
_this->_impl_.options_ = CreateMaybeMessage<::google::protobuf::EnumOptions>(arena, *from._impl_.options_);
} else {
_this->_impl_.options_->MergeFrom(*from._impl_.options_);
}
}
}
_this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_);
@ -6446,6 +6485,7 @@ constexpr ::_pbi::TcParseTable<2, 3, 1, 53, 2> EnumValueDescriptorProto::_table_
void EnumValueDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<EnumValueDescriptorProto*>(&to_msg);
auto& from = static_cast<const EnumValueDescriptorProto&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumValueDescriptorProto)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -6457,8 +6497,12 @@ void EnumValueDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, co
_this->_internal_set_name(from._internal_name());
}
if (cached_has_bits & 0x00000002u) {
_this->_internal_mutable_options()->::google::protobuf::EnumValueOptions::MergeFrom(
from._internal_options());
_this->_impl_._has_bits_[0] |= 0x00000002u;
if (_this->_impl_.options_ == nullptr) {
_this->_impl_.options_ = CreateMaybeMessage<::google::protobuf::EnumValueOptions>(arena, *from._impl_.options_);
} else {
_this->_impl_.options_->MergeFrom(*from._impl_.options_);
}
}
if (cached_has_bits & 0x00000004u) {
_this->_impl_.number_ = from._impl_.number_;
@ -6737,6 +6781,7 @@ constexpr ::_pbi::TcParseTable<2, 3, 2, 51, 2> ServiceDescriptorProto::_table_ =
void ServiceDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<ServiceDescriptorProto*>(&to_msg);
auto& from = static_cast<const ServiceDescriptorProto&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ServiceDescriptorProto)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -6750,8 +6795,12 @@ void ServiceDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, cons
_this->_internal_set_name(from._internal_name());
}
if (cached_has_bits & 0x00000002u) {
_this->_internal_mutable_options()->::google::protobuf::ServiceOptions::MergeFrom(
from._internal_options());
_this->_impl_._has_bits_[0] |= 0x00000002u;
if (_this->_impl_.options_ == nullptr) {
_this->_impl_.options_ = CreateMaybeMessage<::google::protobuf::ServiceOptions>(arena, *from._impl_.options_);
} else {
_this->_impl_.options_->MergeFrom(*from._impl_.options_);
}
}
}
_this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_);
@ -7118,6 +7167,7 @@ constexpr ::_pbi::TcParseTable<3, 6, 1, 71, 2> MethodDescriptorProto::_table_ =
void MethodDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<MethodDescriptorProto*>(&to_msg);
auto& from = static_cast<const MethodDescriptorProto&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.MethodDescriptorProto)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -7135,8 +7185,12 @@ void MethodDescriptorProto::MergeImpl(::google::protobuf::Message& to_msg, const
_this->_internal_set_output_type(from._internal_output_type());
}
if (cached_has_bits & 0x00000008u) {
_this->_internal_mutable_options()->::google::protobuf::MethodOptions::MergeFrom(
from._internal_options());
_this->_impl_._has_bits_[0] |= 0x00000008u;
if (_this->_impl_.options_ == nullptr) {
_this->_impl_.options_ = CreateMaybeMessage<::google::protobuf::MethodOptions>(arena, *from._impl_.options_);
} else {
_this->_impl_.options_->MergeFrom(*from._impl_.options_);
}
}
if (cached_has_bits & 0x00000010u) {
_this->_impl_.client_streaming_ = from._impl_.client_streaming_;
@ -7947,6 +8001,7 @@ constexpr ::_pbi::TcParseTable<5, 22, 3, 202, 12> FileOptions::_table_ = {
void FileOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<FileOptions*>(&to_msg);
auto& from = static_cast<const FileOptions&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FileOptions)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -7989,8 +8044,12 @@ void FileOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google:
_this->_internal_set_ruby_package(from._internal_ruby_package());
}
if (cached_has_bits & 0x00000400u) {
_this->_internal_mutable_features()->::google::protobuf::FeatureSet::MergeFrom(
from._internal_features());
_this->_impl_._has_bits_[0] |= 0x00000400u;
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
}
if (cached_has_bits & 0x00000800u) {
_this->_impl_.java_multiple_files_ = from._impl_.java_multiple_files_;
@ -8411,6 +8470,7 @@ constexpr ::_pbi::TcParseTable<3, 7, 2, 0, 7> MessageOptions::_table_ = {
void MessageOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<MessageOptions*>(&to_msg);
auto& from = static_cast<const MessageOptions&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.MessageOptions)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -8421,8 +8481,12 @@ void MessageOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::goog
cached_has_bits = from._impl_._has_bits_[0];
if (cached_has_bits & 0x0000003fu) {
if (cached_has_bits & 0x00000001u) {
_this->_internal_mutable_features()->::google::protobuf::FeatureSet::MergeFrom(
from._internal_features());
_this->_impl_._has_bits_[0] |= 0x00000001u;
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
}
if (cached_has_bits & 0x00000002u) {
_this->_impl_.message_set_wire_format_ = from._impl_.message_set_wire_format_;
@ -9205,6 +9269,7 @@ constexpr ::_pbi::TcParseTable<4, 13, 7, 0, 7> FieldOptions::_table_ = {
void FieldOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<FieldOptions*>(&to_msg);
auto& from = static_cast<const FieldOptions&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FieldOptions)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -9218,8 +9283,12 @@ void FieldOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google
cached_has_bits = from._impl_._has_bits_[0];
if (cached_has_bits & 0x000000ffu) {
if (cached_has_bits & 0x00000001u) {
_this->_internal_mutable_features()->::google::protobuf::FeatureSet::MergeFrom(
from._internal_features());
_this->_impl_._has_bits_[0] |= 0x00000001u;
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
}
if (cached_has_bits & 0x00000002u) {
_this->_impl_.ctype_ = from._impl_.ctype_;
@ -9508,6 +9577,7 @@ constexpr ::_pbi::TcParseTable<2, 2, 2, 0, 7> OneofOptions::_table_ = {
void OneofOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<OneofOptions*>(&to_msg);
auto& from = static_cast<const OneofOptions&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.OneofOptions)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -9516,8 +9586,12 @@ void OneofOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google
_this->_internal_mutable_uninterpreted_option()->MergeFrom(
from._internal_uninterpreted_option());
if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) {
_this->_internal_mutable_features()->::google::protobuf::FeatureSet::MergeFrom(
from._internal_features());
_this->_impl_._has_bits_[0] |= 0x00000001u;
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
}
_this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_);
_this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_);
@ -9846,6 +9920,7 @@ constexpr ::_pbi::TcParseTable<3, 5, 2, 0, 7> EnumOptions::_table_ = {
void EnumOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<EnumOptions*>(&to_msg);
auto& from = static_cast<const EnumOptions&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumOptions)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -9856,8 +9931,12 @@ void EnumOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google:
cached_has_bits = from._impl_._has_bits_[0];
if (cached_has_bits & 0x0000000fu) {
if (cached_has_bits & 0x00000001u) {
_this->_internal_mutable_features()->::google::protobuf::FeatureSet::MergeFrom(
from._internal_features());
_this->_impl_._has_bits_[0] |= 0x00000001u;
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
}
if (cached_has_bits & 0x00000002u) {
_this->_impl_.allow_alias_ = from._impl_.allow_alias_;
@ -10184,6 +10263,7 @@ constexpr ::_pbi::TcParseTable<3, 4, 2, 0, 7> EnumValueOptions::_table_ = {
void EnumValueOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<EnumValueOptions*>(&to_msg);
auto& from = static_cast<const EnumValueOptions&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumValueOptions)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -10194,8 +10274,12 @@ void EnumValueOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::go
cached_has_bits = from._impl_._has_bits_[0];
if (cached_has_bits & 0x00000007u) {
if (cached_has_bits & 0x00000001u) {
_this->_internal_mutable_features()->::google::protobuf::FeatureSet::MergeFrom(
from._internal_features());
_this->_impl_._has_bits_[0] |= 0x00000001u;
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
}
if (cached_has_bits & 0x00000002u) {
_this->_impl_.deprecated_ = from._impl_.deprecated_;
@ -10488,6 +10572,7 @@ constexpr ::_pbi::TcParseTable<2, 3, 2, 0, 12> ServiceOptions::_table_ = {
void ServiceOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<ServiceOptions*>(&to_msg);
auto& from = static_cast<const ServiceOptions&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ServiceOptions)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -10498,8 +10583,12 @@ void ServiceOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::goog
cached_has_bits = from._impl_._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000001u) {
_this->_internal_mutable_features()->::google::protobuf::FeatureSet::MergeFrom(
from._internal_features());
_this->_impl_._has_bits_[0] |= 0x00000001u;
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
}
if (cached_has_bits & 0x00000002u) {
_this->_impl_.deprecated_ = from._impl_.deprecated_;
@ -10825,6 +10914,7 @@ constexpr ::_pbi::TcParseTable<3, 4, 3, 0, 12> MethodOptions::_table_ = {
void MethodOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<MethodOptions*>(&to_msg);
auto& from = static_cast<const MethodOptions&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.MethodOptions)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -10835,8 +10925,12 @@ void MethodOptions::MergeImpl(::google::protobuf::Message& to_msg, const ::googl
cached_has_bits = from._impl_._has_bits_[0];
if (cached_has_bits & 0x00000007u) {
if (cached_has_bits & 0x00000001u) {
_this->_internal_mutable_features()->::google::protobuf::FeatureSet::MergeFrom(
from._internal_features());
_this->_impl_._has_bits_[0] |= 0x00000001u;
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
}
if (cached_has_bits & 0x00000002u) {
_this->_impl_.deprecated_ = from._impl_.deprecated_;
@ -12115,6 +12209,7 @@ constexpr ::_pbi::TcParseTable<1, 2, 2, 0, 2> FeatureSetDefaults_FeatureSetEditi
void FeatureSetDefaults_FeatureSetEditionDefault::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<FeatureSetDefaults_FeatureSetEditionDefault*>(&to_msg);
auto& from = static_cast<const FeatureSetDefaults_FeatureSetEditionDefault&>(from_msg);
::google::protobuf::Arena* arena = _this->GetArena();
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
@ -12123,8 +12218,12 @@ void FeatureSetDefaults_FeatureSetEditionDefault::MergeImpl(::google::protobuf::
cached_has_bits = from._impl_._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000001u) {
_this->_internal_mutable_features()->::google::protobuf::FeatureSet::MergeFrom(
from._internal_features());
_this->_impl_._has_bits_[0] |= 0x00000001u;
if (_this->_impl_.features_ == nullptr) {
_this->_impl_.features_ = CreateMaybeMessage<::google::protobuf::FeatureSet>(arena, *from._impl_.features_);
} else {
_this->_impl_.features_->MergeFrom(*from._impl_.features_);
}
}
if (cached_has_bits & 0x00000002u) {
_this->_impl_.edition_ = from._impl_.edition_;

Loading…
Cancel
Save