Codegen refactoring to simplify split layout changes. Use `$this_field$` and `$from_field$` in more places. Except in Serialize functions, we must keep using `this_.$field_$` there because we interleave split and non-split fields to keep field order stable in the wire. Collapse the split-vs-!split codegen for repeated fields by making RawPtr forward some operations. PiperOrigin-RevId: 1000897067
diff --git a/editions/golden/compare_cpp_codegen_failure.txt b/editions/golden/compare_cpp_codegen_failure.txt index e033082..0bc9031 100644 --- a/editions/golden/compare_cpp_codegen_failure.txt +++ b/editions/golden/compare_cpp_codegen_failure.txt
@@ -33,7 +33,7 @@ + // int32 int32_field = 1; cached_has_bits = this_._impl_._has_bits_[0]; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + total_size += [ FAILED ] third_party/protobuf/editions/golden/simple_proto3.pb.cc (Go) [ RUN ] third_party/protobuf/editions/golden/simple_proto3.pb.cc (Java) @@ @@ @@ -70,7 +70,7 @@ + // int32 int32_field = 1; cached_has_bits = this_._impl_._has_bits_[0]; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + total_size += [ FAILED ] third_party/protobuf/editions/golden/simple_proto3.pb.cc (Java) [ RUN ] third_party/protobuf/editions/golden/simple_proto3.pb.h (Go) @@ @@
diff --git a/editions/golden/compare_cpp_codegen_failure.xml b/editions/golden/compare_cpp_codegen_failure.xml index f83c006..bf1bdf6 100644 --- a/editions/golden/compare_cpp_codegen_failure.xml +++ b/editions/golden/compare_cpp_codegen_failure.xml
@@ -2,10 +2,10 @@ <testsuites tests="3" name="AllTests"> <testsuite name="EditionsCodegenTests"> <testcase name="third_party/protobuf/editions/golden/simple_proto3.pb.cc (Go)" status="run" result="completed" classname="DiffTest"> -<failure message="Value of: third_party/protobuf/editions/golden/simple_proto3.pb.cc
Expected: 
// clang-format off
// Generated by the protocol buffer compiler. DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
// source: third_party/protobuf/editions/golden/simple_proto3.proto

#include "third_party/protobuf/editions/golden/simple_proto3.pb.h"

#include <algorithm>
#include <type_traits>
#include "third_party/protobuf/io/coded_stream.h"
#include "third_party/protobuf/generated_message_tctable_impl.h"
#include "third_party/protobuf/internal_visibility.h"
#include "third_party/protobuf/extension_set.h"
#include "third_party/protobuf/generated_message_util.h"
#include "third_party/protobuf/private_access.h"
#include "third_party/protobuf/wire_format_lite.h"
#include "third_party/protobuf/io/zero_copy_stream_impl_lite.h"
// @@protoc_insertion_point(includes)

// Must be included last.
// clang-format on
, with the difference:
@@ @@
 nullptr, // post_loop_handler
 ::_pbi::TcParser::MpUnknownFields, // fallback
 }, {{
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 {::_pbi::TcParser::FastV32S1,
 {8, 0, 0,
 PROTOBUF_FIELD_OFFSET(SimpleProto3, _impl_.int32_field_)}},
 }}, {{
 65535, 65535
 }}, {{
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 {PROTOBUF_FIELD_OFFSET(SimpleProto3, _impl_.int32_field_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcOptional | ::_fl::kInt32)},
 }},
 // no aux_entries
@@ @@
 (void)cached_has_bits;
 
 cached_has_bits = this_._impl_._has_bits_[0];
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 if (CheckHasBit(cached_has_bits, 0x00000001U)) {
 target =
 ::proto2::internal::WireFormatLite::WriteInt32ToArrayWithField<1>(
@@ @@
 ::uint32_t cached_has_bits [[maybe_unused]] = 0;
 
 {
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 cached_has_bits = this_._impl_._has_bits_[0];
 if (CheckHasBit(cached_has_bits, 0x00000001U)) {
 total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(" type=""></failure> +<failure message="Value of: third_party/protobuf/editions/golden/simple_proto3.pb.cc
Expected: 
// clang-format off
// Generated by the protocol buffer compiler. DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
// source: third_party/protobuf/editions/golden/simple_proto3.proto

#include "third_party/protobuf/editions/golden/simple_proto3.pb.h"

#include <algorithm>
#include <type_traits>
#include "third_party/protobuf/io/coded_stream.h"
#include "third_party/protobuf/generated_message_tctable_impl.h"
#include "third_party/protobuf/internal_visibility.h"
#include "third_party/protobuf/extension_set.h"
#include "third_party/protobuf/generated_message_util.h"
#include "third_party/protobuf/private_access.h"
#include "third_party/protobuf/wire_format_lite.h"
#include "third_party/protobuf/io/zero_copy_stream_impl_lite.h"
// @@protoc_insertion_point(includes)

// Must be included last.
// clang-format on
, with the difference:
@@ @@
 nullptr, // post_loop_handler
 ::_pbi::TcParser::MpUnknownFields, // fallback
 }, {{
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 {::_pbi::TcParser::FastV32S1,
 {8, 0, 0,
 PROTOBUF_FIELD_OFFSET(SimpleProto3, _impl_.int32_field_)}},
 }}, {{
 65535, 65535
 }}, {{
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 {PROTOBUF_FIELD_OFFSET(SimpleProto3, _impl_.int32_field_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcOptional | ::_fl::kInt32)},
 }},
 // no aux_entries
@@ @@
 (void)cached_has_bits;
 
 cached_has_bits = this_._impl_._has_bits_[0];
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 if (CheckHasBit(cached_has_bits, 0x00000001U)) {
 target =
 ::proto2::internal::WireFormatLite::WriteInt32ToArrayWithField<1>(
@@ @@
 ::uint32_t cached_has_bits [[maybe_unused]] = 0;
 
 {
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 cached_has_bits = this_._impl_._has_bits_[0];
 if (CheckHasBit(cached_has_bits, 0x00000001U)) {
 total_size +=" type=""></failure> </testcase> <testcase name="third_party/protobuf/editions/golden/simple_proto3.pb.cc (Java)" status="run" result="completed" classname="DiffTest"> -<failure message="Value of: third_party/protobuf/editions/golden/simple_proto3.pb.cc
Expected: 
// clang-format off
// Generated by the protocol buffer compiler. DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
// source: third_party/protobuf/editions/golden/simple_proto3.proto

#include "third_party/protobuf/editions/golden/simple_proto3.pb.h"

#include <algorithm>
#include <type_traits>
#include "third_party/protobuf/io/coded_stream.h"
#include "third_party/protobuf/generated_message_tctable_impl.h"
#include "third_party/protobuf/internal_visibility.h"
#include "third_party/protobuf/extension_set.h"
#include "third_party/protobuf/generated_message_util.h"
#include "third_party/protobuf/private_access.h"
#include "third_party/protobuf/wire_format_lite.h"
#include "third_party/protobuf/io/zero_copy_stream_impl_lite.h"
// @@protoc_insertion_point(includes)

// Must be included last.
// clang-format on
, with the difference:
@@ @@
 nullptr, // post_loop_handler
 ::_pbi::TcParser::MpUnknownFields, // fallback
 }, {{
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 {::_pbi::TcParser::FastV32S1,
 {8, 0, 0,
 PROTOBUF_FIELD_OFFSET(SimpleProto3, _impl_.int32_field_)}},
 }}, {{
 65535, 65535
 }}, {{
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 {PROTOBUF_FIELD_OFFSET(SimpleProto3, _impl_.int32_field_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcOptional | ::_fl::kInt32)},
 }},
 // no aux_entries
@@ @@
 (void)cached_has_bits;
 
 cached_has_bits = this_._impl_._has_bits_[0];
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 if (CheckHasBit(cached_has_bits, 0x00000001U)) {
 target =
 ::proto2::internal::WireFormatLite::WriteInt32ToArrayWithField<1>(
@@ @@
 ::uint32_t cached_has_bits [[maybe_unused]] = 0;
 
 {
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 cached_has_bits = this_._impl_._has_bits_[0];
 if (CheckHasBit(cached_has_bits, 0x00000001U)) {
 total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(" type=""></failure> +<failure message="Value of: third_party/protobuf/editions/golden/simple_proto3.pb.cc
Expected: 
// clang-format off
// Generated by the protocol buffer compiler. DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
// source: third_party/protobuf/editions/golden/simple_proto3.proto

#include "third_party/protobuf/editions/golden/simple_proto3.pb.h"

#include <algorithm>
#include <type_traits>
#include "third_party/protobuf/io/coded_stream.h"
#include "third_party/protobuf/generated_message_tctable_impl.h"
#include "third_party/protobuf/internal_visibility.h"
#include "third_party/protobuf/extension_set.h"
#include "third_party/protobuf/generated_message_util.h"
#include "third_party/protobuf/private_access.h"
#include "third_party/protobuf/wire_format_lite.h"
#include "third_party/protobuf/io/zero_copy_stream_impl_lite.h"
// @@protoc_insertion_point(includes)

// Must be included last.
// clang-format on
, with the difference:
@@ @@
 nullptr, // post_loop_handler
 ::_pbi::TcParser::MpUnknownFields, // fallback
 }, {{
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 {::_pbi::TcParser::FastV32S1,
 {8, 0, 0,
 PROTOBUF_FIELD_OFFSET(SimpleProto3, _impl_.int32_field_)}},
 }}, {{
 65535, 65535
 }}, {{
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 {PROTOBUF_FIELD_OFFSET(SimpleProto3, _impl_.int32_field_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcOptional | ::_fl::kInt32)},
 }},
 // no aux_entries
@@ @@
 (void)cached_has_bits;
 
 cached_has_bits = this_._impl_._has_bits_[0];
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 if (CheckHasBit(cached_has_bits, 0x00000001U)) {
 target =
 ::proto2::internal::WireFormatLite::WriteInt32ToArrayWithField<1>(
@@ @@
 ::uint32_t cached_has_bits [[maybe_unused]] = 0;
 
 {
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 cached_has_bits = this_._impl_._has_bits_[0];
 if (CheckHasBit(cached_has_bits, 0x00000001U)) {
 total_size +=" type=""></failure> </testcase> <testcase name="third_party/protobuf/editions/golden/simple_proto3.pb.h (Go)" status="run" result="completed" classname="DiffTest"> <failure message="Value of: third_party/protobuf/editions/golden/simple_proto3.pb.h
Expected: 
// Generated by the protocol buffer compiler. DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
// source: third_party/protobuf/editions/golden/simple_proto3.proto

#ifndef third_5fparty_2fprotobuf_2feditions_2fgolden_2fsimple_5fproto3_2eproto_2epb_2eh
#define third_5fparty_2fprotobuf_2feditions_2fgolden_2fsimple_5fproto3_2eproto_2epb_2eh

#include <limits>
#include <string>
#include <type_traits>
#include <utility>

// clang-format off
#include "third_party/protobuf/runtime_version.h"
#include "third_party/protobuf/io/coded_stream.h"
#include "third_party/protobuf/arena.h"
#include "third_party/protobuf/arenastring.h"
#include "third_party/protobuf/generated_message_tctable_decl.h"
#include "third_party/protobuf/generated_message_util.h"
#include "third_party/protobuf/metadata_lite.h"
#include "third_party/protobuf/message_lite.h"
// @@protoc_insertion_point(includes)

// Must be included last.
// clang-format on

#endif // third_5fparty_2fprotobuf_2feditions_2fgolden_2fsimple_5fproto3_2eproto_2epb_2eh
, with the difference:
@@ @@
 enum : int {
 kInt32FieldFieldNumber = 1,
 };
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 [[nodiscard]] bool has_int32_field() const;
 void clear_int32_field() ;
 [[nodiscard]] ::int32_t int32_field() const;
@@ @@
 static void SharedDtor(MessageLite& self);
 void InternalSwap(SimpleProto3* PROTOBUF_NONNULL other);
 
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 ::int32_t _internal_int32_field() const;
 void _internal_set_int32_field(::int32_t value);
 
@@ @@
 
 // SimpleProto3
 
-// optional int32 int32_field = 1;
+// int32 int32_field = 1;
 inline bool SimpleProto3::has_int32_field() const {
 bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000001U);
 return value;" type=""></failure>
diff --git a/src/google/protobuf/compiler/cpp/field_generators/enum_field.cc b/src/google/protobuf/compiler/cpp/field_generators/enum_field.cc index a63d3c5..2b593a7 100644 --- a/src/google/protobuf/compiler/cpp/field_generators/enum_field.cc +++ b/src/google/protobuf/compiler/cpp/field_generators/enum_field.cc
@@ -108,8 +108,8 @@ void GenerateByteSize(io::Printer* p) const override { p->Emit(R"cc( - total_size += $kTagBytes$ + - ::_pbi::WireFormatLite::EnumSize(this_._internal_$name$()); + total_size += + $kTagBytes$ + ::_pbi::WireFormatLite::EnumSize($this_field$); )cc"); } @@ -259,22 +259,11 @@ } void GenerateMergingCode(io::Printer* p) const override { - // TODO: experiment with simplifying this to be - // `if (!from.empty()) { body(); }` for both split and non-split cases. - auto body = [&] { - p->Emit(R"cc( - this_._internal_mutable_$name$()->MergeFrom(from._internal_$name$()); - )cc"); - }; - if (!should_split()) { - body(); - } else { - p->Emit({{"body", body}}, R"cc( - if (!$from_field$.IsDefault()) { - $body$; - } - )cc"); - } + p->Emit(R"cc( + if (const auto& f = $from_field$; !f.empty()) { + this_._internal_mutable_$name$()->MergeFrom(f); + } + )cc"); } void GenerateSwappingCode(io::Printer* p) const override { @@ -541,7 +530,7 @@ ABSL_CHECK(field_->is_packed()); p->Emit(R"cc( total_size += ::_pbi::WireFormatLite::EnumSizeWithPackedTagSize( - this_._internal_$name$(), $kTagBytes$, this_.$cached_size_$); + $this_field$, $kTagBytes$, this_.$cached_size_$); )cc"); return; } @@ -559,14 +548,13 @@ } else { p->Emit(R"cc( ::size_t{$kTagBytes$} * - ::_pbi::FromIntSize(this_._internal_$name$_size()); + ::_pbi::FromIntSize($this_field$.size()); )cc"); } }}, }, R"cc( - ::size_t data_size = - ::_pbi::WireFormatLite::EnumSize(this_._internal_$name$()); + ::size_t data_size = ::_pbi::WireFormatLite::EnumSize($this_field$); ::size_t tag_size = $tag_size$; total_size += data_size + tag_size; )cc");
diff --git a/src/google/protobuf/compiler/cpp/field_generators/message_field.cc b/src/google/protobuf/compiler/cpp/field_generators/message_field.cc index 8d2a6d7..1d0dcf4 100644 --- a/src/google/protobuf/compiler/cpp/field_generators/message_field.cc +++ b/src/google/protobuf/compiler/cpp/field_generators/message_field.cc
@@ -343,7 +343,7 @@ p->Emit( R"cc( this_._internal_mutable_$name$()->$Submsg$::MergeFrom( - from._internal_$name$()); + *reinterpret_cast<const $Submsg$*>($from_field$)); )cc"); } else { // Important: we set `hasbits` after we copied the field. There are cases @@ -386,7 +386,7 @@ if (!is_group()) { p->Emit(R"cc( { - auto* sub = $this_field$; + auto* sub = this_.$field_$; target = $pbi$::WireFormatLite::InternalWrite$DeclaredType$( $number$, *sub, sub->GetCachedSize(), target, stream); } @@ -395,7 +395,7 @@ p->Emit(R"cc( target = stream->EnsureSpace(target); target = $pbi$::WireFormatLite::InternalWrite$DeclaredType$( - $number$, *$this_field$, target, stream); + $number$, *this_.$field_$, target, stream); )cc"); } } @@ -413,7 +413,7 @@ if (HasHasbit(field_, *opts_)) { p->Emit(R"cc( if (CheckHasBit(this_.$has_bits_array$, $has_mask$)) { - if (!$this_field$->IsInitialized()) return false; + if (!this_.$field_$->IsInitialized()) return false; } )cc"); } else { @@ -933,24 +933,12 @@ } void RepeatedMessage::GenerateMergingCode(io::Printer* p) const { - // TODO: experiment with simplifying this to be - // `if (!from.empty()) { body(); }` for both split and non-split cases. - auto body = [&] { - p->Emit(R"cc( + p->Emit(R"cc( + if (const auto& sub = $from_field$; !sub.empty()) { this_._internal_mutable$_weak$_$name$()->InternalMergeFromWithArena( - $pb$::MessageLite::internal_visibility(), arena, - from._internal$_weak$_$name$()); - )cc"); - }; - if (!should_split()) { - body(); - } else { - p->Emit({{"body", body}}, R"cc( - if (!$from_field$.IsDefault()) { - $body$; - } - )cc"); - } + $pb$::MessageLite::internal_visibility(), arena, sub); + } + )cc"); } void RepeatedMessage::GenerateSwappingCode(io::Printer* p) const { @@ -989,20 +977,21 @@ } }}}, R"cc( - for (const auto& sub : $this_field$) { + for (const auto& sub : this_.$field_$) { $serialize_field$; } )cc"); } void RepeatedMessage::GenerateByteSize(io::Printer* p) const { - p->Emit( - R"cc( - total_size += $kTagBytes$UL * this_._internal_$name$_size(); - for (const auto& msg : this_._internal$_weak$_$name$()) { - total_size += $pbi$::WireFormatLite::$DeclaredType$Size(msg); - } - )cc"); + p->Emit(R"cc( + if (const auto& value = $this_field$; !value.empty()) { + total_size += $kTagBytes$UL * value.size(); + for (const auto& msg : value) { + total_size += $pbi$::WireFormatLite::$DeclaredType$Size(msg); + } + } + )cc"); } void RepeatedMessage::GenerateIsInitialized(io::Printer* p) const {
diff --git a/src/google/protobuf/compiler/cpp/field_generators/primitive_field.cc b/src/google/protobuf/compiler/cpp/field_generators/primitive_field.cc index 1e11ee9..e766523 100644 --- a/src/google/protobuf/compiler/cpp/field_generators/primitive_field.cc +++ b/src/google/protobuf/compiler/cpp/field_generators/primitive_field.cc
@@ -260,15 +260,15 @@ // free inside of WireFormatLite, so we can save an instruction here. if (tag_size == 1) { p->Emit(R"cc( - total_size += ::_pbi::WireFormatLite::$DeclaredType$SizePlusOne( - this_._internal_$name$()); + total_size += + ::_pbi::WireFormatLite::$DeclaredType$SizePlusOne($this_field$); )cc"); return; } p->Emit(R"cc( - total_size += $kTagBytes$ + ::_pbi::WireFormatLite::$DeclaredType$Size( - this_._internal_$name$()); + total_size += + $kTagBytes$ + ::_pbi::WireFormatLite::$DeclaredType$Size($this_field$); )cc"); } @@ -299,22 +299,11 @@ } void GenerateMergingCode(io::Printer* p) const override { - // TODO: experiment with simplifying this to be - // `if (!from.empty()) { body(); }` for both split and non-split cases. - auto body = [&] { - p->Emit(R"cc( - this_._internal_mutable_$name$()->MergeFrom(from._internal_$name$()); - )cc"); - }; - if (!should_split()) { - body(); - } else { - p->Emit({{"body", body}}, R"cc( - if (!$from_field$.IsDefault()) { - $body$; - } - )cc"); - } + p->Emit(R"cc( + if (const auto& f = $from_field$; !f.empty()) { + this_._internal_mutable_$name$()->MergeFrom(f); + } + )cc"); } void GenerateSwappingCode(io::Printer* p) const override { @@ -581,7 +570,7 @@ io::Printer* p) const { if (!field_->is_packed()) { p->Emit(R"cc( - for ($Type$ v : $this_field$) { + for ($Type$ v : this_.$field_$) { target = stream->EnsureSpace(target); target = ::_pbi::WireFormatLite::Write$DeclaredType$ToArray($number$, v, target); @@ -631,8 +620,7 @@ R"cc( total_size += ::_pbi::WireFormatLite::$DeclaredType$SizeWithPackedTagSize( - this_._internal_$name$(), $kTagBytes$, - this_.$_field_cached_byte_size_$); + $this_field$, $kTagBytes$, this_.$_field_cached_byte_size_$); )cc"); return; } @@ -643,13 +631,11 @@ auto fixed_size = FixedSize(field_->type()); if (fixed_size.has_value()) { p->Emit({{"kFixed", *fixed_size}}, R"cc( - ::size_t{$kFixed$} * - ::_pbi::FromIntSize(this_._internal_$name$_size()); + ::size_t{$kFixed$} * ::_pbi::FromIntSize($this_field$.size()); )cc"); } else { p->Emit(R"cc( - ::_pbi::WireFormatLite::$DeclaredType$Size( - this_._internal_$name$()); + ::_pbi::WireFormatLite::$DeclaredType$Size($this_field$); )cc"); } }}, @@ -665,7 +651,7 @@ } else { p->Emit(R"cc( ::size_t{$kTagBytes$} * - ::_pbi::FromIntSize(this_._internal_$name$_size()); + ::_pbi::FromIntSize($this_field$.size()); )cc"); } }},
diff --git a/src/google/protobuf/compiler/cpp/field_generators/string_field.cc b/src/google/protobuf/compiler/cpp/field_generators/string_field.cc index 92bb1e4..7658283 100644 --- a/src/google/protobuf/compiler/cpp/field_generators/string_field.cc +++ b/src/google/protobuf/compiler/cpp/field_generators/string_field.cc
@@ -103,7 +103,7 @@ )cc"); } else { p->Emit(R"cc( - this_._internal_set_$name$(from._internal_$name$()); + this_._internal_set_$name$($from_field$.Get()); )cc"); } } @@ -121,7 +121,7 @@ void GenerateByteSize(io::Printer* p) const override { p->Emit(R"cc( total_size += $kTagBytes$ + $pbi$::WireFormatLite::$DeclaredType$Size( - this_._internal_$name$()); + $this_field$.Get()); )cc"); } @@ -642,24 +642,12 @@ } void GenerateMergingCode(io::Printer* p) const override { - // TODO: experiment with simplifying this to be - // `if (!from.empty()) { body(); }` for both split and non-split cases. - auto body = [&] { - p->Emit(R"cc( + p->Emit(R"cc( + if (const auto& sub = $from_field$; !sub.empty()) { this_._internal_mutable_$name$()->InternalMergeFromWithArena( - $pb$::MessageLite::internal_visibility(), arena, - from._internal_$name$()); - )cc"); - }; - if (!should_split()) { - body(); - } else { - p->Emit({{"body", body}}, R"cc( - if (!$from_field$.IsDefault()) { - $body$; - } - )cc"); - } + $pb$::MessageLite::internal_visibility(), arena, sub); + } + )cc"); } void GenerateSwappingCode(io::Printer* p) const override { @@ -922,7 +910,7 @@ "s.data(), static_cast<int>(s.length()),"); }}}, R"cc( - for (const auto& s : $this_field$) { + for (const auto& s : this_.$field_$) { $utf8_check$; target = stream->Write$DeclaredType$($number$, s, target); }
diff --git a/src/google/protobuf/compiler/cpp/field_generators/string_view_field.cc b/src/google/protobuf/compiler/cpp/field_generators/string_view_field.cc index 09ddd02..5b3f4c0 100644 --- a/src/google/protobuf/compiler/cpp/field_generators/string_view_field.cc +++ b/src/google/protobuf/compiler/cpp/field_generators/string_view_field.cc
@@ -116,7 +116,7 @@ )cc"); } else { p->Emit(R"cc( - this_._internal_set_$name$(from._internal_$name$()); + this_._internal_set_$name$($from_field$.Get()); )cc"); } } @@ -133,8 +133,8 @@ void GenerateByteSize(io::Printer* p) const override { p->Emit(R"cc( - total_size += $kTagBytes$ + $pbi$::WireFormatLite::$DeclaredType$Size( - this_._internal_$name$()); + total_size += + $kTagBytes$ + $pbi$::WireFormatLite::$DeclaredType$Size($this_field$); )cc"); } @@ -525,24 +525,12 @@ } void GenerateMergingCode(io::Printer* p) const override { - // TODO: experiment with simplifying this to be - // `if (!from.empty()) { body(); }` for both split and non-split cases. - auto body = [&] { - p->Emit(R"cc( + p->Emit(R"cc( + if (const auto& sub = $from_field$; !sub.empty()) { this_._internal_mutable_$name$()->InternalMergeFromWithArena( - $pb$::MessageLite::internal_visibility(), arena, - from._internal_$name$()); - )cc"); - }; - if (!should_split()) { - body(); - } else { - p->Emit({{"body", body}}, R"cc( - if (!$from_field$.IsDefault()) { - $body$; - } - )cc"); - } + $pb$::MessageLite::internal_visibility(), arena, sub); + } + )cc"); } void GenerateSwappingCode(io::Printer* p) const override { @@ -774,7 +762,7 @@ "s.data(), static_cast<int>(s.length()),"); }}}, R"cc( - for (const auto& s : $this_field$) { + for (const auto& s : this_.$field_$) { $utf8_check$; target = stream->Write$DeclaredType$($number$, s, target); }
diff --git a/src/google/protobuf/compiler/java/java_features.pb.cc b/src/google/protobuf/compiler/java/java_features.pb.cc index d4f4dc8..2f8ec0c 100644 --- a/src/google/protobuf/compiler/java/java_features.pb.cc +++ b/src/google/protobuf/compiler/java/java_features.pb.cc
@@ -576,13 +576,13 @@ if (BatchCheckHasBit(cached_has_bits, 0x00000011U)) { // optional .pb.JavaFeatures.Utf8Validation utf8_validation = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_utf8_validation()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.utf8_validation_); } // optional .pb.JavaFeatures.NestInFileClassFeature.NestInFileClass nest_in_file_class = 5 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_SERVICE, edition_defaults = { if (CheckHasBit(cached_has_bits, 0x00000010U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_nest_in_file_class()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.nest_in_file_class_); } } return this_.MaybeComputeUnknownFieldsSize(total_size,
diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index ee9e553..f07276e 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc
@@ -914,22 +914,22 @@ // optional string suffix = 4; if (CheckHasBit(cached_has_bits, 0x00000001U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_suffix()); + this_._impl_.suffix_.Get()); } // optional int32 major = 1; if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_major()); + total_size += + ::_pbi::WireFormatLite::Int32SizePlusOne(this_._impl_.major_); } // optional int32 minor = 2; if (CheckHasBit(cached_has_bits, 0x00000004U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_minor()); + total_size += + ::_pbi::WireFormatLite::Int32SizePlusOne(this_._impl_.minor_); } // optional int32 patch = 3; if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_patch()); + total_size += + ::_pbi::WireFormatLite::Int32SizePlusOne(this_._impl_.patch_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -954,7 +954,7 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_set_suffix(from._internal_suffix()); + this_._internal_set_suffix(from._impl_.suffix_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { this_._impl_.major_ = from._impl_.major_; @@ -1240,15 +1240,17 @@ } // repeated .google.protobuf.FileDescriptorProto proto_file = 15; if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += 1UL * this_._internal_proto_file_size(); - for (const auto& msg : this_._internal_proto_file()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.proto_file_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // optional string parameter = 2; if (CheckHasBit(cached_has_bits, 0x00000004U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_parameter()); + this_._impl_.parameter_.Get()); } // optional .google.protobuf.compiler.Version compiler_version = 3; if (CheckHasBit(cached_has_bits, 0x00000008U)) { @@ -1257,9 +1259,11 @@ } // repeated .google.protobuf.FileDescriptorProto source_file_descriptors = 17; if (CheckHasBit(cached_has_bits, 0x00000010U)) { - total_size += 2UL * this_._internal_source_file_descriptors_size(); - for (const auto& msg : this_._internal_source_file_descriptors()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.source_file_descriptors_; !value.empty()) { + total_size += 2UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } } @@ -1286,17 +1290,19 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_file_to_generate()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_file_to_generate()); + if (const auto& sub = from._impl_.file_to_generate_; !sub.empty()) { + this_._internal_mutable_file_to_generate()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000002U)) { - this_._internal_mutable_proto_file()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_proto_file()); + if (const auto& sub = from._impl_.proto_file_; !sub.empty()) { + this_._internal_mutable_proto_file()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000004U)) { - this_._internal_set_parameter(from._internal_parameter()); + this_._internal_set_parameter(from._impl_.parameter_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000008U)) { ABSL_DCHECK(from._impl_.compiler_version_ != nullptr); @@ -1310,9 +1316,10 @@ } } if (CheckHasBit(cached_has_bits, 0x00000010U)) { - this_._internal_mutable_source_file_descriptors()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_source_file_descriptors()); + if (const auto& sub = from._impl_.source_file_descriptors_; !sub.empty()) { + this_._internal_mutable_source_file_descriptors()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } } this_._impl_._has_bits_[0] |= cached_has_bits; @@ -1538,17 +1545,17 @@ // optional string name = 1; if (CheckHasBit(cached_has_bits, 0x00000001U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); + this_._impl_.name_.Get()); } // optional string insertion_point = 2; if (CheckHasBit(cached_has_bits, 0x00000002U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_insertion_point()); + this_._impl_.insertion_point_.Get()); } // optional string content = 15; if (CheckHasBit(cached_has_bits, 0x00000004U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_content()); + this_._impl_.content_.Get()); } // optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16; if (CheckHasBit(cached_has_bits, 0x00000008U)) { @@ -1579,13 +1586,13 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_set_name(from._internal_name()); + this_._internal_set_name(from._impl_.name_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { - this_._internal_set_insertion_point(from._internal_insertion_point()); + this_._internal_set_insertion_point(from._impl_.insertion_point_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000004U)) { - this_._internal_set_content(from._internal_content()); + this_._internal_set_content(from._impl_.content_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000008U)) { ABSL_DCHECK(from._impl_.generated_code_info_ != nullptr); @@ -1824,30 +1831,32 @@ if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1UL * this_._internal_file_size(); - for (const auto& msg : this_._internal_file()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.file_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // optional string error = 1; if (CheckHasBit(cached_has_bits, 0x00000002U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_error()); + this_._impl_.error_.Get()); } // optional uint64 supported_features = 2; if (CheckHasBit(cached_has_bits, 0x00000004U)) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_supported_features()); + total_size += + ::_pbi::WireFormatLite::UInt64SizePlusOne(this_._impl_.supported_features_); } // optional int32 minimum_edition = 3; if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_minimum_edition()); + total_size += + ::_pbi::WireFormatLite::Int32SizePlusOne(this_._impl_.minimum_edition_); } // optional int32 maximum_edition = 4; if (CheckHasBit(cached_has_bits, 0x00000010U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_maximum_edition()); + total_size += + ::_pbi::WireFormatLite::Int32SizePlusOne(this_._impl_.maximum_edition_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -1873,12 +1882,13 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_file()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_file()); + if (const auto& sub = from._impl_.file_; !sub.empty()) { + this_._internal_mutable_file()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000002U)) { - this_._internal_set_error(from._internal_error()); + this_._internal_set_error(from._impl_.error_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000004U)) { this_._impl_.supported_features_ = from._impl_.supported_features_;
diff --git a/src/google/protobuf/cpp_features.pb.cc b/src/google/protobuf/cpp_features.pb.cc index 73f768d..eb8ec3e 100644 --- a/src/google/protobuf/cpp_features.pb.cc +++ b/src/google/protobuf/cpp_features.pb.cc
@@ -408,13 +408,13 @@ if (BatchCheckHasBit(cached_has_bits, 0x00000009U)) { // optional .pb.CppFeatures.StringType string_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_string_type()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.string_type_); } // optional .pb.CppFeatures.RepeatedType repeated_type = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_repeated_type()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.repeated_type_); } } return this_.MaybeComputeUnknownFieldsSize(total_size,
diff --git a/src/google/protobuf/cpp_file_options.pb.cc b/src/google/protobuf/cpp_file_options.pb.cc index db776e8..de5fa54 100644 --- a/src/google/protobuf/cpp_file_options.pb.cc +++ b/src/google/protobuf/cpp_file_options.pb.cc
@@ -341,8 +341,8 @@ // string namespace = 1; cached_has_bits = this_._impl_._has_bits_[0]; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_namespace_()); + total_size += + 1 + ::google::protobuf::internal::WireFormatLite::StringSize(this_._impl_.namespace__); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -366,7 +366,7 @@ cached_has_bits = from._impl_._has_bits_[0]; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_set_namespace_(from._internal_namespace_()); + this_._internal_set_namespace_(from._impl_.namespace__.Get()); } this_._impl_._has_bits_[0] |= cached_has_bits; this_._internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(
diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 39f9aa4..b0bcca7 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc
@@ -6806,9 +6806,11 @@ // repeated .google.protobuf.FileDescriptorProto file = 1; cached_has_bits = this_._impl_._has_bits_[0]; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1UL * this_._internal_file_size(); - for (const auto& msg : this_._internal_file()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.file_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } } @@ -6834,9 +6836,10 @@ cached_has_bits = from._impl_._has_bits_[0]; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_file()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_file()); + if (const auto& sub = from._impl_.file_; !sub.empty()) { + this_._internal_mutable_file()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } this_._impl_._has_bits_[0] |= cached_has_bits; this_._impl_._extensions_.MergeFrom(arena, &default_instance(), @@ -7279,46 +7282,52 @@ } // repeated .google.protobuf.DescriptorProto message_type = 4; if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += 1UL * this_._internal_message_type_size(); - for (const auto& msg : this_._internal_message_type()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.message_type_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; if (CheckHasBit(cached_has_bits, 0x00000004U)) { - total_size += 1UL * this_._internal_enum_type_size(); - for (const auto& msg : this_._internal_enum_type()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.enum_type_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // repeated .google.protobuf.ServiceDescriptorProto service = 6; if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += 1UL * this_._internal_service_size(); - for (const auto& msg : this_._internal_service()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.service_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // repeated .google.protobuf.FieldDescriptorProto extension = 7; if (CheckHasBit(cached_has_bits, 0x00000010U)) { - total_size += 1UL * this_._internal_extension_size(); - for (const auto& msg : this_._internal_extension()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.extension_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // repeated int32 public_dependency = 10; if (CheckHasBit(cached_has_bits, 0x00000020U)) { - ::size_t data_size = ::_pbi::WireFormatLite::Int32Size( - this_._internal_public_dependency()); + ::size_t data_size = ::_pbi::WireFormatLite::Int32Size(this_._impl_.public_dependency_); ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_public_dependency_size()); + ::_pbi::FromIntSize(this_._impl_.public_dependency_.size()); total_size += tag_size + data_size; } // repeated int32 weak_dependency = 11; if (CheckHasBit(cached_has_bits, 0x00000040U)) { - ::size_t data_size = ::_pbi::WireFormatLite::Int32Size( - this_._internal_weak_dependency()); + ::size_t data_size = ::_pbi::WireFormatLite::Int32Size(this_._impl_.weak_dependency_); ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_weak_dependency_size()); + ::_pbi::FromIntSize(this_._impl_.weak_dependency_.size()); total_size += tag_size + data_size; } // repeated string option_dependency = 15; @@ -7334,17 +7343,17 @@ // optional string name = 1; if (CheckHasBit(cached_has_bits, 0x00000100U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); + this_._impl_.name_.Get()); } // optional string package = 2; if (CheckHasBit(cached_has_bits, 0x00000200U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_package()); + this_._impl_.package_.Get()); } // optional string syntax = 12; if (CheckHasBit(cached_has_bits, 0x00000400U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_syntax()); + this_._impl_.syntax_.Get()); } // optional .google.protobuf.FileOptions options = 8; if (CheckHasBit(cached_has_bits, 0x00000800U)) { @@ -7358,8 +7367,8 @@ } // optional .google.protobuf.Edition edition = 14; if (CheckHasBit(cached_has_bits, 0x00002000U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_edition()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.edition_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -7385,49 +7394,59 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_dependency()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_dependency()); + if (const auto& sub = from._impl_.dependency_; !sub.empty()) { + this_._internal_mutable_dependency()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000002U)) { - this_._internal_mutable_message_type()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_message_type()); + if (const auto& sub = from._impl_.message_type_; !sub.empty()) { + this_._internal_mutable_message_type()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000004U)) { - this_._internal_mutable_enum_type()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_enum_type()); + if (const auto& sub = from._impl_.enum_type_; !sub.empty()) { + this_._internal_mutable_enum_type()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000008U)) { - this_._internal_mutable_service()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_service()); + if (const auto& sub = from._impl_.service_; !sub.empty()) { + this_._internal_mutable_service()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000010U)) { - this_._internal_mutable_extension()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_extension()); + if (const auto& sub = from._impl_.extension_; !sub.empty()) { + this_._internal_mutable_extension()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000020U)) { - this_._internal_mutable_public_dependency()->MergeFrom(from._internal_public_dependency()); + if (const auto& f = from._impl_.public_dependency_; !f.empty()) { + this_._internal_mutable_public_dependency()->MergeFrom(f); + } } if (CheckHasBit(cached_has_bits, 0x00000040U)) { - this_._internal_mutable_weak_dependency()->MergeFrom(from._internal_weak_dependency()); + if (const auto& f = from._impl_.weak_dependency_; !f.empty()) { + this_._internal_mutable_weak_dependency()->MergeFrom(f); + } } if (CheckHasBit(cached_has_bits, 0x00000080U)) { - this_._internal_mutable_option_dependency()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_option_dependency()); + if (const auto& sub = from._impl_.option_dependency_; !sub.empty()) { + this_._internal_mutable_option_dependency()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000100U)) { - this_._internal_set_name(from._internal_name()); + this_._internal_set_name(from._impl_.name_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000200U)) { - this_._internal_set_package(from._internal_package()); + this_._internal_set_package(from._impl_.package_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000400U)) { - this_._internal_set_syntax(from._internal_syntax()); + this_._internal_set_syntax(from._impl_.syntax_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000800U)) { ABSL_DCHECK(from._impl_.options_ != nullptr); @@ -7692,13 +7711,13 @@ } // optional int32 start = 1; if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_start()); + total_size += + ::_pbi::WireFormatLite::Int32SizePlusOne(this_._impl_.start_); } // optional int32 end = 2; if (CheckHasBit(cached_has_bits, 0x00000004U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_end()); + total_size += + ::_pbi::WireFormatLite::Int32SizePlusOne(this_._impl_.end_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -7912,13 +7931,13 @@ if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { // optional int32 start = 1; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_start()); + total_size += + ::_pbi::WireFormatLite::Int32SizePlusOne(this_._impl_.start_); } // optional int32 end = 2; if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_end()); + total_size += + ::_pbi::WireFormatLite::Int32SizePlusOne(this_._impl_.end_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -8329,51 +8348,65 @@ if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { // repeated .google.protobuf.FieldDescriptorProto field = 2; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1UL * this_._internal_field_size(); - for (const auto& msg : this_._internal_field()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.field_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // repeated .google.protobuf.DescriptorProto nested_type = 3; if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += 1UL * this_._internal_nested_type_size(); - for (const auto& msg : this_._internal_nested_type()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.nested_type_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; if (CheckHasBit(cached_has_bits, 0x00000004U)) { - total_size += 1UL * this_._internal_enum_type_size(); - for (const auto& msg : this_._internal_enum_type()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.enum_type_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += 1UL * this_._internal_extension_range_size(); - for (const auto& msg : this_._internal_extension_range()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.extension_range_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // repeated .google.protobuf.FieldDescriptorProto extension = 6; if (CheckHasBit(cached_has_bits, 0x00000010U)) { - total_size += 1UL * this_._internal_extension_size(); - for (const auto& msg : this_._internal_extension()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.extension_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; if (CheckHasBit(cached_has_bits, 0x00000020U)) { - total_size += 1UL * this_._internal_oneof_decl_size(); - for (const auto& msg : this_._internal_oneof_decl()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.oneof_decl_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; if (CheckHasBit(cached_has_bits, 0x00000040U)) { - total_size += 1UL * this_._internal_reserved_range_size(); - for (const auto& msg : this_._internal_reserved_range()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.reserved_range_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // repeated string reserved_name = 10; @@ -8389,7 +8422,7 @@ // optional string name = 1; if (CheckHasBit(cached_has_bits, 0x00000100U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); + this_._impl_.name_.Get()); } // optional .google.protobuf.MessageOptions options = 7; if (CheckHasBit(cached_has_bits, 0x00000200U)) { @@ -8398,8 +8431,8 @@ } // optional .google.protobuf.SymbolVisibility visibility = 11; if (CheckHasBit(cached_has_bits, 0x00000400U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_visibility()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.visibility_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -8425,47 +8458,55 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_field()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_field()); + if (const auto& sub = from._impl_.field_; !sub.empty()) { + this_._internal_mutable_field()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000002U)) { - this_._internal_mutable_nested_type()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_nested_type()); + if (const auto& sub = from._impl_.nested_type_; !sub.empty()) { + this_._internal_mutable_nested_type()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000004U)) { - this_._internal_mutable_enum_type()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_enum_type()); + if (const auto& sub = from._impl_.enum_type_; !sub.empty()) { + this_._internal_mutable_enum_type()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000008U)) { - this_._internal_mutable_extension_range()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_extension_range()); + if (const auto& sub = from._impl_.extension_range_; !sub.empty()) { + this_._internal_mutable_extension_range()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000010U)) { - this_._internal_mutable_extension()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_extension()); + if (const auto& sub = from._impl_.extension_; !sub.empty()) { + this_._internal_mutable_extension()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000020U)) { - this_._internal_mutable_oneof_decl()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_oneof_decl()); + if (const auto& sub = from._impl_.oneof_decl_; !sub.empty()) { + this_._internal_mutable_oneof_decl()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000040U)) { - this_._internal_mutable_reserved_range()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_reserved_range()); + if (const auto& sub = from._impl_.reserved_range_; !sub.empty()) { + this_._internal_mutable_reserved_range()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000080U)) { - this_._internal_mutable_reserved_name()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_reserved_name()); + if (const auto& sub = from._impl_.reserved_name_; !sub.empty()) { + this_._internal_mutable_reserved_name()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000100U)) { - this_._internal_set_name(from._internal_name()); + this_._internal_set_name(from._impl_.name_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000200U)) { ABSL_DCHECK(from._impl_.options_ != nullptr); @@ -8729,17 +8770,17 @@ // optional string full_name = 2; if (CheckHasBit(cached_has_bits, 0x00000001U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_full_name()); + this_._impl_.full_name_.Get()); } // optional string type = 3; if (CheckHasBit(cached_has_bits, 0x00000002U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_type()); + this_._impl_.type_.Get()); } // optional int32 number = 1; if (CheckHasBit(cached_has_bits, 0x00000004U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_number()); + total_size += + ::_pbi::WireFormatLite::Int32SizePlusOne(this_._impl_.number_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -8764,10 +8805,10 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_set_full_name(from._internal_full_name()); + this_._internal_set_full_name(from._impl_.full_name_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { - this_._internal_set_type(from._internal_type()); + this_._internal_set_type(from._impl_.type_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000004U)) { this_._impl_.number_ = from._impl_.number_; @@ -9024,16 +9065,20 @@ if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { // repeated .google.protobuf.ExtensionRangeOptions.Declaration declaration = 2 [retention = RETENTION_SOURCE]; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1UL * this_._internal_declaration_size(); - for (const auto& msg : this_._internal_declaration()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.declaration_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += 2UL * this_._internal_uninterpreted_option_size(); - for (const auto& msg : this_._internal_uninterpreted_option()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.uninterpreted_option_; !value.empty()) { + total_size += 2UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // optional .google.protobuf.FeatureSet features = 50; @@ -9043,8 +9088,8 @@ } // optional .google.protobuf.ExtensionRangeOptions.VerificationState verification = 3 [default = UNVERIFIED, retention = RETENTION_SOURCE]; if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_verification()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.verification_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -9070,14 +9115,16 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_declaration()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_declaration()); + if (const auto& sub = from._impl_.declaration_; !sub.empty()) { + this_._internal_mutable_declaration()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000002U)) { - this_._internal_mutable_uninterpreted_option()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_uninterpreted_option()); + if (const auto& sub = from._impl_.uninterpreted_option_; !sub.empty()) { + this_._internal_mutable_uninterpreted_option()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000004U)) { ABSL_DCHECK(from._impl_.features_ != nullptr); @@ -9401,27 +9448,27 @@ // optional string name = 1; if (CheckHasBit(cached_has_bits, 0x00000001U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); + this_._impl_.name_.Get()); } // optional string extendee = 2; if (CheckHasBit(cached_has_bits, 0x00000002U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_extendee()); + this_._impl_.extendee_.Get()); } // optional string type_name = 6; if (CheckHasBit(cached_has_bits, 0x00000004U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_type_name()); + this_._impl_.type_name_.Get()); } // optional string default_value = 7; if (CheckHasBit(cached_has_bits, 0x00000008U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_default_value()); + this_._impl_.default_value_.Get()); } // optional string json_name = 10; if (CheckHasBit(cached_has_bits, 0x00000010U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_json_name()); + this_._impl_.json_name_.Get()); } // optional .google.protobuf.FieldOptions options = 8; if (CheckHasBit(cached_has_bits, 0x00000020U)) { @@ -9430,23 +9477,23 @@ } // optional int32 number = 3; if (CheckHasBit(cached_has_bits, 0x00000040U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_number()); + total_size += + ::_pbi::WireFormatLite::Int32SizePlusOne(this_._impl_.number_); } // optional int32 oneof_index = 9; if (CheckHasBit(cached_has_bits, 0x00000080U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_oneof_index()); + total_size += + ::_pbi::WireFormatLite::Int32SizePlusOne(this_._impl_.oneof_index_); } // optional .google.protobuf.FieldDescriptorProto.Label label = 4; if (CheckHasBit(cached_has_bits, 0x00000200U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_label()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.label_); } // optional .google.protobuf.FieldDescriptorProto.Type type = 5; if (CheckHasBit(cached_has_bits, 0x00000400U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_type()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.type_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -9472,19 +9519,19 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_set_name(from._internal_name()); + this_._internal_set_name(from._impl_.name_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { - this_._internal_set_extendee(from._internal_extendee()); + this_._internal_set_extendee(from._impl_.extendee_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000004U)) { - this_._internal_set_type_name(from._internal_type_name()); + this_._internal_set_type_name(from._impl_.type_name_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000008U)) { - this_._internal_set_default_value(from._internal_default_value()); + this_._internal_set_default_value(from._impl_.default_value_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000010U)) { - this_._internal_set_json_name(from._internal_json_name()); + this_._internal_set_json_name(from._impl_.json_name_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000020U)) { ABSL_DCHECK(from._impl_.options_ != nullptr); @@ -9712,7 +9759,7 @@ // optional string name = 1; if (CheckHasBit(cached_has_bits, 0x00000001U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); + this_._impl_.name_.Get()); } // optional .google.protobuf.OneofOptions options = 2; if (CheckHasBit(cached_has_bits, 0x00000002U)) { @@ -9743,7 +9790,7 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_set_name(from._internal_name()); + this_._internal_set_name(from._impl_.name_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { ABSL_DCHECK(from._impl_.options_ != nullptr); @@ -9926,13 +9973,13 @@ if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { // optional int32 start = 1; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_start()); + total_size += + ::_pbi::WireFormatLite::Int32SizePlusOne(this_._impl_.start_); } // optional int32 end = 2; if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_end()); + total_size += + ::_pbi::WireFormatLite::Int32SizePlusOne(this_._impl_.end_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -10228,16 +10275,20 @@ if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { // repeated .google.protobuf.EnumValueDescriptorProto value = 2; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1UL * this_._internal_value_size(); - for (const auto& msg : this_._internal_value()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.value_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += 1UL * this_._internal_reserved_range_size(); - for (const auto& msg : this_._internal_reserved_range()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.reserved_range_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // repeated string reserved_name = 5; @@ -10253,7 +10304,7 @@ // optional string name = 1; if (CheckHasBit(cached_has_bits, 0x00000008U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); + this_._impl_.name_.Get()); } // optional .google.protobuf.EnumOptions options = 3; if (CheckHasBit(cached_has_bits, 0x00000010U)) { @@ -10262,8 +10313,8 @@ } // optional .google.protobuf.SymbolVisibility visibility = 6; if (CheckHasBit(cached_has_bits, 0x00000020U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_visibility()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.visibility_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -10289,22 +10340,25 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_value()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_value()); + if (const auto& sub = from._impl_.value_; !sub.empty()) { + this_._internal_mutable_value()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000002U)) { - this_._internal_mutable_reserved_range()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_reserved_range()); + if (const auto& sub = from._impl_.reserved_range_; !sub.empty()) { + this_._internal_mutable_reserved_range()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000004U)) { - this_._internal_mutable_reserved_name()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_reserved_name()); + if (const auto& sub = from._impl_.reserved_name_; !sub.empty()) { + this_._internal_mutable_reserved_name()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000008U)) { - this_._internal_set_name(from._internal_name()); + this_._internal_set_name(from._impl_.name_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000010U)) { ABSL_DCHECK(from._impl_.options_ != nullptr); @@ -10535,7 +10589,7 @@ // optional string name = 1; if (CheckHasBit(cached_has_bits, 0x00000001U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); + this_._impl_.name_.Get()); } // optional .google.protobuf.EnumValueOptions options = 3; if (CheckHasBit(cached_has_bits, 0x00000002U)) { @@ -10544,8 +10598,8 @@ } // optional int32 number = 2; if (CheckHasBit(cached_has_bits, 0x00000004U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_number()); + total_size += + ::_pbi::WireFormatLite::Int32SizePlusOne(this_._impl_.number_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -10571,7 +10625,7 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_set_name(from._internal_name()); + this_._internal_set_name(from._impl_.name_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { ABSL_DCHECK(from._impl_.options_ != nullptr); @@ -10805,15 +10859,17 @@ if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { // repeated .google.protobuf.MethodDescriptorProto method = 2; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1UL * this_._internal_method_size(); - for (const auto& msg : this_._internal_method()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.method_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // optional string name = 1; if (CheckHasBit(cached_has_bits, 0x00000002U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); + this_._impl_.name_.Get()); } // optional .google.protobuf.ServiceOptions options = 3; if (CheckHasBit(cached_has_bits, 0x00000004U)) { @@ -10844,12 +10900,13 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_method()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_method()); + if (const auto& sub = from._impl_.method_; !sub.empty()) { + this_._internal_mutable_method()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000002U)) { - this_._internal_set_name(from._internal_name()); + this_._internal_set_name(from._impl_.name_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000004U)) { ABSL_DCHECK(from._impl_.options_ != nullptr); @@ -11111,17 +11168,17 @@ // optional string name = 1; if (CheckHasBit(cached_has_bits, 0x00000001U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); + this_._impl_.name_.Get()); } // optional string input_type = 2; if (CheckHasBit(cached_has_bits, 0x00000002U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_input_type()); + this_._impl_.input_type_.Get()); } // optional string output_type = 3; if (CheckHasBit(cached_has_bits, 0x00000004U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_output_type()); + this_._impl_.output_type_.Get()); } // optional .google.protobuf.MethodOptions options = 4; if (CheckHasBit(cached_has_bits, 0x00000008U)) { @@ -11152,13 +11209,13 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_set_name(from._internal_name()); + this_._internal_set_name(from._impl_.name_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { - this_._internal_set_input_type(from._internal_input_type()); + this_._internal_set_input_type(from._impl_.input_type_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000004U)) { - this_._internal_set_output_type(from._internal_output_type()); + this_._internal_set_output_type(from._impl_.output_type_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000008U)) { ABSL_DCHECK(from._impl_.options_ != nullptr); @@ -11605,52 +11662,52 @@ // optional string java_package = 1; if (CheckHasBit(cached_has_bits, 0x00000001U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_java_package()); + this_._impl_.java_package_.Get()); } // optional string java_outer_classname = 8; if (CheckHasBit(cached_has_bits, 0x00000002U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_java_outer_classname()); + this_._impl_.java_outer_classname_.Get()); } // optional string go_package = 11; if (CheckHasBit(cached_has_bits, 0x00000004U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_go_package()); + this_._impl_.go_package_.Get()); } // optional string objc_class_prefix = 36; if (CheckHasBit(cached_has_bits, 0x00000008U)) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_objc_class_prefix()); + this_._impl_.objc_class_prefix_.Get()); } // optional string csharp_namespace = 37; if (CheckHasBit(cached_has_bits, 0x00000010U)) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_csharp_namespace()); + this_._impl_.csharp_namespace_.Get()); } // optional string swift_prefix = 39; if (CheckHasBit(cached_has_bits, 0x00000020U)) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_swift_prefix()); + this_._impl_.swift_prefix_.Get()); } // optional string php_class_prefix = 40; if (CheckHasBit(cached_has_bits, 0x00000040U)) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_php_class_prefix()); + this_._impl_.php_class_prefix_.Get()); } // optional string php_namespace = 41; if (CheckHasBit(cached_has_bits, 0x00000080U)) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_php_namespace()); + this_._impl_.php_namespace_.Get()); } // optional string php_metadata_namespace = 44; if (CheckHasBit(cached_has_bits, 0x00000100U)) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_php_metadata_namespace()); + this_._impl_.php_metadata_namespace_.Get()); } // optional string ruby_package = 45; if (CheckHasBit(cached_has_bits, 0x00000200U)) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_ruby_package()); + this_._impl_.ruby_package_.Get()); } // optional .google.protobuf.FeatureSet features = 50; if (CheckHasBit(cached_has_bits, 0x00000400U)) { @@ -11659,14 +11716,16 @@ } // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; if (CheckHasBit(cached_has_bits, 0x00040000U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_optimize_for()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.optimize_for_); } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; if (CheckHasBit(cached_has_bits, 0x00100000U)) { - total_size += 2UL * this_._internal_uninterpreted_option_size(); - for (const auto& msg : this_._internal_uninterpreted_option()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.uninterpreted_option_; !value.empty()) { + total_size += 2UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } } @@ -11693,34 +11752,34 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_set_java_package(from._internal_java_package()); + this_._internal_set_java_package(from._impl_.java_package_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { - this_._internal_set_java_outer_classname(from._internal_java_outer_classname()); + this_._internal_set_java_outer_classname(from._impl_.java_outer_classname_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000004U)) { - this_._internal_set_go_package(from._internal_go_package()); + this_._internal_set_go_package(from._impl_.go_package_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000008U)) { - this_._internal_set_objc_class_prefix(from._internal_objc_class_prefix()); + this_._internal_set_objc_class_prefix(from._impl_.objc_class_prefix_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000010U)) { - this_._internal_set_csharp_namespace(from._internal_csharp_namespace()); + this_._internal_set_csharp_namespace(from._impl_.csharp_namespace_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000020U)) { - this_._internal_set_swift_prefix(from._internal_swift_prefix()); + this_._internal_set_swift_prefix(from._impl_.swift_prefix_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000040U)) { - this_._internal_set_php_class_prefix(from._internal_php_class_prefix()); + this_._internal_set_php_class_prefix(from._impl_.php_class_prefix_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000080U)) { - this_._internal_set_php_namespace(from._internal_php_namespace()); + this_._internal_set_php_namespace(from._impl_.php_namespace_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000100U)) { - this_._internal_set_php_metadata_namespace(from._internal_php_metadata_namespace()); + this_._internal_set_php_metadata_namespace(from._impl_.php_metadata_namespace_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000200U)) { - this_._internal_set_ruby_package(from._internal_ruby_package()); + this_._internal_set_ruby_package(from._impl_.ruby_package_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000400U)) { ABSL_DCHECK(from._impl_.features_ != nullptr); @@ -11761,9 +11820,10 @@ this_._impl_.cc_enable_arenas_ = from._impl_.cc_enable_arenas_; } if (CheckHasBit(cached_has_bits, 0x00100000U)) { - this_._internal_mutable_uninterpreted_option()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_uninterpreted_option()); + if (const auto& sub = from._impl_.uninterpreted_option_; !sub.empty()) { + this_._internal_mutable_uninterpreted_option()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } } this_._impl_._has_bits_[0] |= cached_has_bits; @@ -12061,9 +12121,11 @@ } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; if (CheckHasBit(cached_has_bits, 0x00000040U)) { - total_size += 2UL * this_._internal_uninterpreted_option_size(); - for (const auto& msg : this_._internal_uninterpreted_option()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.uninterpreted_option_; !value.empty()) { + total_size += 2UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } } @@ -12116,9 +12178,10 @@ this_._impl_.deprecated_legacy_json_field_conflicts_ = from._impl_.deprecated_legacy_json_field_conflicts_; } if (CheckHasBit(cached_has_bits, 0x00000040U)) { - this_._internal_mutable_uninterpreted_option()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_uninterpreted_option()); + if (const auto& sub = from._impl_.uninterpreted_option_; !sub.empty()) { + this_._internal_mutable_uninterpreted_option()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } } this_._impl_._has_bits_[0] |= cached_has_bits; @@ -12312,12 +12375,12 @@ // optional string value = 2; if (CheckHasBit(cached_has_bits, 0x00000001U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_value()); + this_._impl_.value_.Get()); } // optional .google.protobuf.Edition edition = 3; if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_edition()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.edition_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -12342,7 +12405,7 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_set_value(from._internal_value()); + this_._internal_set_value(from._impl_.value_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { this_._impl_.edition_ = from._impl_.edition_; @@ -12561,27 +12624,27 @@ // optional string deprecation_warning = 3; if (CheckHasBit(cached_has_bits, 0x00000001U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_deprecation_warning()); + this_._impl_.deprecation_warning_.Get()); } // optional string removal_error = 5; if (CheckHasBit(cached_has_bits, 0x00000002U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_removal_error()); + this_._impl_.removal_error_.Get()); } // optional .google.protobuf.Edition edition_introduced = 1; if (CheckHasBit(cached_has_bits, 0x00000004U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_edition_introduced()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.edition_introduced_); } // optional .google.protobuf.Edition edition_deprecated = 2; if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_edition_deprecated()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.edition_deprecated_); } // optional .google.protobuf.Edition edition_removed = 4; if (CheckHasBit(cached_has_bits, 0x00000010U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_edition_removed()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.edition_removed_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -12606,10 +12669,10 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_set_deprecation_warning(from._internal_deprecation_warning()); + this_._internal_set_deprecation_warning(from._impl_.deprecation_warning_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { - this_._internal_set_removal_error(from._internal_removal_error()); + this_._internal_set_removal_error(from._impl_.removal_error_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000004U)) { this_._impl_.edition_introduced_ = from._impl_.edition_introduced_; @@ -12977,16 +13040,20 @@ if (BatchCheckHasBit(cached_has_bits, 0x0000321fU)) { // repeated .google.protobuf.FieldOptions.EditionDefault edition_defaults = 20; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 2UL * this_._internal_edition_defaults_size(); - for (const auto& msg : this_._internal_edition_defaults()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.edition_defaults_; !value.empty()) { + total_size += 2UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += 2UL * this_._internal_uninterpreted_option_size(); - for (const auto& msg : this_._internal_uninterpreted_option()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.uninterpreted_option_; !value.empty()) { + total_size += 2UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // optional .google.protobuf.FeatureSet features = 21; @@ -13001,25 +13068,24 @@ } // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; if (CheckHasBit(cached_has_bits, 0x00000010U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_ctype()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.ctype_); } // optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; if (CheckHasBit(cached_has_bits, 0x00000200U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_jstype()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.jstype_); } // optional .google.protobuf.FieldOptions.OptionRetention retention = 17; if (CheckHasBit(cached_has_bits, 0x00001000U)) { - total_size += 2 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_retention()); + total_size += + 2 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.retention_); } // repeated .google.protobuf.FieldOptions.OptionTargetType targets = 19; if (CheckHasBit(cached_has_bits, 0x00002000U)) { - ::size_t data_size = - ::_pbi::WireFormatLite::EnumSize(this_._internal_targets()); + ::size_t data_size = ::_pbi::WireFormatLite::EnumSize(this_._impl_.targets_); ::size_t tag_size = ::size_t{2} * - ::_pbi::FromIntSize(this_._internal_targets_size()); + ::_pbi::FromIntSize(this_._impl_.targets_.size()); total_size += data_size + tag_size; } } @@ -13046,14 +13112,16 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_edition_defaults()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_edition_defaults()); + if (const auto& sub = from._impl_.edition_defaults_; !sub.empty()) { + this_._internal_mutable_edition_defaults()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000002U)) { - this_._internal_mutable_uninterpreted_option()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_uninterpreted_option()); + if (const auto& sub = from._impl_.uninterpreted_option_; !sub.empty()) { + this_._internal_mutable_uninterpreted_option()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000004U)) { ABSL_DCHECK(from._impl_.features_ != nullptr); @@ -13105,7 +13173,9 @@ this_._impl_.retention_ = from._impl_.retention_; } if (CheckHasBit(cached_has_bits, 0x00002000U)) { - this_._internal_mutable_targets()->MergeFrom(from._internal_targets()); + if (const auto& f = from._impl_.targets_; !f.empty()) { + this_._internal_mutable_targets()->MergeFrom(f); + } } } this_._impl_._has_bits_[0] |= cached_has_bits; @@ -13334,9 +13404,11 @@ if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 2UL * this_._internal_uninterpreted_option_size(); - for (const auto& msg : this_._internal_uninterpreted_option()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.uninterpreted_option_; !value.empty()) { + total_size += 2UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // optional .google.protobuf.FeatureSet features = 1; @@ -13368,9 +13440,10 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_uninterpreted_option()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_uninterpreted_option()); + if (const auto& sub = from._impl_.uninterpreted_option_; !sub.empty()) { + this_._internal_mutable_uninterpreted_option()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000002U)) { ABSL_DCHECK(from._impl_.features_ != nullptr); @@ -13648,9 +13721,11 @@ } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; if (CheckHasBit(cached_has_bits, 0x00000010U)) { - total_size += 2UL * this_._internal_uninterpreted_option_size(); - for (const auto& msg : this_._internal_uninterpreted_option()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.uninterpreted_option_; !value.empty()) { + total_size += 2UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } } @@ -13697,9 +13772,10 @@ this_._impl_.deprecated_legacy_json_field_conflicts_ = from._impl_.deprecated_legacy_json_field_conflicts_; } if (CheckHasBit(cached_has_bits, 0x00000010U)) { - this_._internal_mutable_uninterpreted_option()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_uninterpreted_option()); + if (const auto& sub = from._impl_.uninterpreted_option_; !sub.empty()) { + this_._internal_mutable_uninterpreted_option()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } } this_._impl_._has_bits_[0] |= cached_has_bits; @@ -13976,9 +14052,11 @@ if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 2UL * this_._internal_uninterpreted_option_size(); - for (const auto& msg : this_._internal_uninterpreted_option()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.uninterpreted_option_; !value.empty()) { + total_size += 2UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // optional .google.protobuf.FeatureSet features = 2; @@ -14015,9 +14093,10 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_uninterpreted_option()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_uninterpreted_option()); + if (const auto& sub = from._impl_.uninterpreted_option_; !sub.empty()) { + this_._internal_mutable_uninterpreted_option()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000002U)) { ABSL_DCHECK(from._impl_.features_ != nullptr); @@ -14289,9 +14368,11 @@ if (BatchCheckHasBit(cached_has_bits, 0x00000003U)) { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 2UL * this_._internal_uninterpreted_option_size(); - for (const auto& msg : this_._internal_uninterpreted_option()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.uninterpreted_option_; !value.empty()) { + total_size += 2UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // optional .google.protobuf.FeatureSet features = 34; @@ -14323,9 +14404,10 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_uninterpreted_option()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_uninterpreted_option()); + if (const auto& sub = from._impl_.uninterpreted_option_; !sub.empty()) { + this_._internal_mutable_uninterpreted_option()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000002U)) { ABSL_DCHECK(from._impl_.features_ != nullptr); @@ -14599,9 +14681,11 @@ if (BatchCheckHasBit(cached_has_bits, 0x0000000bU)) { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 2UL * this_._internal_uninterpreted_option_size(); - for (const auto& msg : this_._internal_uninterpreted_option()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.uninterpreted_option_; !value.empty()) { + total_size += 2UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // optional .google.protobuf.FeatureSet features = 35; @@ -14611,8 +14695,8 @@ } // optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += 2 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_idempotency_level()); + total_size += + 2 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.idempotency_level_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -14638,9 +14722,10 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_uninterpreted_option()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_uninterpreted_option()); + if (const auto& sub = from._impl_.uninterpreted_option_; !sub.empty()) { + this_._internal_mutable_uninterpreted_option()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000002U)) { ABSL_DCHECK(from._impl_.features_ != nullptr); @@ -14852,7 +14937,7 @@ // required string name_part = 1; if (CheckHasBit(cached_has_bits, 0x00000001U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name_part()); + this_._impl_.name_part_.Get()); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -14877,7 +14962,7 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_set_name_part(from._internal_name_part()); + this_._internal_set_name_part(from._impl_.name_part_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000002U)) { this_._impl_.is_extension_ = from._impl_.is_extension_; @@ -15139,35 +15224,37 @@ if (BatchCheckHasBit(cached_has_bits, 0x0000003fU)) { // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1UL * this_._internal_name_size(); - for (const auto& msg : this_._internal_name()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.name_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // optional string identifier_value = 3; if (CheckHasBit(cached_has_bits, 0x00000002U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_identifier_value()); + this_._impl_.identifier_value_.Get()); } // optional bytes string_value = 7; if (CheckHasBit(cached_has_bits, 0x00000004U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( - this_._internal_string_value()); + this_._impl_.string_value_.Get()); } // optional string aggregate_value = 8; if (CheckHasBit(cached_has_bits, 0x00000008U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_aggregate_value()); + this_._impl_.aggregate_value_.Get()); } // optional uint64 positive_int_value = 4; if (CheckHasBit(cached_has_bits, 0x00000010U)) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_positive_int_value()); + total_size += + ::_pbi::WireFormatLite::UInt64SizePlusOne(this_._impl_.positive_int_value_); } // optional int64 negative_int_value = 5; if (CheckHasBit(cached_has_bits, 0x00000020U)) { - total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( - this_._internal_negative_int_value()); + total_size += + ::_pbi::WireFormatLite::Int64SizePlusOne(this_._impl_.negative_int_value_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -15193,18 +15280,19 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_name()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_name()); + if (const auto& sub = from._impl_.name_; !sub.empty()) { + this_._internal_mutable_name()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000002U)) { - this_._internal_set_identifier_value(from._internal_identifier_value()); + this_._internal_set_identifier_value(from._impl_.identifier_value_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000004U)) { - this_._internal_set_string_value(from._internal_string_value()); + this_._internal_set_string_value(from._impl_.string_value_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000008U)) { - this_._internal_set_aggregate_value(from._internal_aggregate_value()); + this_._internal_set_aggregate_value(from._impl_.aggregate_value_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000010U)) { this_._impl_.positive_int_value_ = from._impl_.positive_int_value_; @@ -15555,48 +15643,48 @@ if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { // optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_field_presence()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.field_presence_); } // optional .google.protobuf.FeatureSet.EnumType enum_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_enum_type()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.enum_type_); } // optional .google.protobuf.FeatureSet.RepeatedFieldEncoding repeated_field_encoding = 3 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { if (CheckHasBit(cached_has_bits, 0x00000004U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_repeated_field_encoding()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.repeated_field_encoding_); } // optional .google.protobuf.FeatureSet.Utf8Validation utf8_validation = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_utf8_validation()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.utf8_validation_); } // optional .google.protobuf.FeatureSet.MessageEncoding message_encoding = 5 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { if (CheckHasBit(cached_has_bits, 0x00000010U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_message_encoding()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.message_encoding_); } // optional .google.protobuf.FeatureSet.JsonFormat json_format = 6 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { if (CheckHasBit(cached_has_bits, 0x00000020U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_json_format()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.json_format_); } // optional .google.protobuf.FeatureSet.EnforceNamingStyle enforce_naming_style = 7 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_FILE, targets = TARGET_TYPE_EXTENSION_RANGE, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_ONEOF, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_ENUM_ENTRY, targets = TARGET_TYPE_SERVICE, targets = TARGET_TYPE_METHOD, edition_defaults = { if (CheckHasBit(cached_has_bits, 0x00000040U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_enforce_naming_style()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.enforce_naming_style_); } // optional .google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility default_symbol_visibility = 8 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_FILE, edition_defaults = { if (CheckHasBit(cached_has_bits, 0x00000080U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_default_symbol_visibility()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.default_symbol_visibility_); } // optional .google.protobuf.FeatureSet.ProtoLimitsFeature.EnforceProtoLimits enforce_proto_limits = 9 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_ONEOF, edition_defaults = { if (CheckHasBit(cached_has_bits, 0x00000100U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_enforce_proto_limits()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.enforce_proto_limits_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -15874,8 +15962,8 @@ } // optional .google.protobuf.Edition edition = 3; if (CheckHasBit(cached_has_bits, 0x00000004U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_edition()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.edition_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -16141,20 +16229,22 @@ if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { // repeated .google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault defaults = 1; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1UL * this_._internal_defaults_size(); - for (const auto& msg : this_._internal_defaults()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.defaults_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } // optional .google.protobuf.Edition minimum_edition = 4; if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_minimum_edition()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.minimum_edition_); } // optional .google.protobuf.Edition maximum_edition = 5; if (CheckHasBit(cached_has_bits, 0x00000004U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_maximum_edition()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.maximum_edition_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -16180,9 +16270,10 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_defaults()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_defaults()); + if (const auto& sub = from._impl_.defaults_; !sub.empty()) { + this_._internal_mutable_defaults()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000002U)) { this_._impl_.minimum_edition_ = from._impl_.minimum_edition_; @@ -16451,15 +16542,13 @@ if (CheckHasBit(cached_has_bits, 0x00000001U)) { total_size += ::_pbi::WireFormatLite::Int32SizeWithPackedTagSize( - this_._internal_path(), 1, - this_._impl_._path_cached_byte_size_); + this_._impl_.path_, 1, this_._impl_._path_cached_byte_size_); } // repeated int32 span = 2 [packed = true]; if (CheckHasBit(cached_has_bits, 0x00000002U)) { total_size += ::_pbi::WireFormatLite::Int32SizeWithPackedTagSize( - this_._internal_span(), 1, - this_._impl_._span_cached_byte_size_); + this_._impl_.span_, 1, this_._impl_._span_cached_byte_size_); } // repeated string leading_detached_comments = 6; if (CheckHasBit(cached_has_bits, 0x00000004U)) { @@ -16474,12 +16563,12 @@ // optional string leading_comments = 3; if (CheckHasBit(cached_has_bits, 0x00000008U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_leading_comments()); + this_._impl_.leading_comments_.Get()); } // optional string trailing_comments = 4; if (CheckHasBit(cached_has_bits, 0x00000010U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_trailing_comments()); + this_._impl_.trailing_comments_.Get()); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -16505,21 +16594,26 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_path()->MergeFrom(from._internal_path()); + if (const auto& f = from._impl_.path_; !f.empty()) { + this_._internal_mutable_path()->MergeFrom(f); + } } if (CheckHasBit(cached_has_bits, 0x00000002U)) { - this_._internal_mutable_span()->MergeFrom(from._internal_span()); + if (const auto& f = from._impl_.span_; !f.empty()) { + this_._internal_mutable_span()->MergeFrom(f); + } } if (CheckHasBit(cached_has_bits, 0x00000004U)) { - this_._internal_mutable_leading_detached_comments()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_leading_detached_comments()); + if (const auto& sub = from._impl_.leading_detached_comments_; !sub.empty()) { + this_._internal_mutable_leading_detached_comments()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } if (CheckHasBit(cached_has_bits, 0x00000008U)) { - this_._internal_set_leading_comments(from._internal_leading_comments()); + this_._internal_set_leading_comments(from._impl_.leading_comments_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000010U)) { - this_._internal_set_trailing_comments(from._internal_trailing_comments()); + this_._internal_set_trailing_comments(from._impl_.trailing_comments_.Get()); } } this_._impl_._has_bits_[0] |= cached_has_bits; @@ -16705,9 +16799,11 @@ // repeated .google.protobuf.SourceCodeInfo.Location location = 1; cached_has_bits = this_._impl_._has_bits_[0]; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1UL * this_._internal_location_size(); - for (const auto& msg : this_._internal_location()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.location_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } } @@ -16733,9 +16829,10 @@ cached_has_bits = from._impl_._has_bits_[0]; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_location()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_location()); + if (const auto& sub = from._impl_.location_; !sub.empty()) { + this_._internal_mutable_location()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } this_._impl_._has_bits_[0] |= cached_has_bits; this_._impl_._extensions_.MergeFrom(arena, &default_instance(), @@ -16974,28 +17071,27 @@ if (CheckHasBit(cached_has_bits, 0x00000001U)) { total_size += ::_pbi::WireFormatLite::Int32SizeWithPackedTagSize( - this_._internal_path(), 1, - this_._impl_._path_cached_byte_size_); + this_._impl_.path_, 1, this_._impl_._path_cached_byte_size_); } // optional string source_file = 2; if (CheckHasBit(cached_has_bits, 0x00000002U)) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_source_file()); + this_._impl_.source_file_.Get()); } // optional int32 begin = 3; if (CheckHasBit(cached_has_bits, 0x00000004U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_begin()); + total_size += + ::_pbi::WireFormatLite::Int32SizePlusOne(this_._impl_.begin_); } // optional int32 end = 4; if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_end()); + total_size += + ::_pbi::WireFormatLite::Int32SizePlusOne(this_._impl_.end_); } // optional .google.protobuf.GeneratedCodeInfo.Annotation.Semantic semantic = 5; if (CheckHasBit(cached_has_bits, 0x00000010U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_semantic()); + total_size += + 1 + ::_pbi::WireFormatLite::EnumSize(this_._impl_.semantic_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -17020,10 +17116,12 @@ cached_has_bits = from._impl_._has_bits_[0]; if (BatchCheckHasBit(cached_has_bits, 0xffffffffU)) { if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_path()->MergeFrom(from._internal_path()); + if (const auto& f = from._impl_.path_; !f.empty()) { + this_._internal_mutable_path()->MergeFrom(f); + } } if (CheckHasBit(cached_has_bits, 0x00000002U)) { - this_._internal_set_source_file(from._internal_source_file()); + this_._internal_set_source_file(from._impl_.source_file_.Get()); } if (CheckHasBit(cached_has_bits, 0x00000004U)) { this_._impl_.begin_ = from._impl_.begin_; @@ -17210,9 +17308,11 @@ // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; cached_has_bits = this_._impl_._has_bits_[0]; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1UL * this_._internal_annotation_size(); - for (const auto& msg : this_._internal_annotation()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + if (const auto& value = this_._impl_.annotation_; !value.empty()) { + total_size += 1UL * value.size(); + for (const auto& msg : value) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } } } } @@ -17238,9 +17338,10 @@ cached_has_bits = from._impl_._has_bits_[0]; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_mutable_annotation()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_annotation()); + if (const auto& sub = from._impl_.annotation_; !sub.empty()) { + this_._internal_mutable_annotation()->InternalMergeFromWithArena( + ::google::protobuf::MessageLite::internal_visibility(), arena, sub); + } } this_._impl_._has_bits_[0] |= cached_has_bits; this_._internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(
diff --git a/src/google/protobuf/implicit_weak_message.h b/src/google/protobuf/implicit_weak_message.h index 4b16324..694417a 100644 --- a/src/google/protobuf/implicit_weak_message.h +++ b/src/google/protobuf/implicit_weak_message.h
@@ -178,6 +178,7 @@ const_pointer_iterator; bool empty() const { return base().empty(); } + int size() const { return base().size(); } iterator begin() { return iterator(base().raw_data()); } const_iterator begin() const { return iterator(base().raw_data()); } const_iterator cbegin() const { return begin(); }
diff --git a/src/google/protobuf/json_enumvalue_options.pb.cc b/src/google/protobuf/json_enumvalue_options.pb.cc index d549839..6deb809 100644 --- a/src/google/protobuf/json_enumvalue_options.pb.cc +++ b/src/google/protobuf/json_enumvalue_options.pb.cc
@@ -343,8 +343,8 @@ // string string = 1; cached_has_bits = this_._impl_._has_bits_[0]; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_string()); + total_size += + 1 + ::google::protobuf::internal::WireFormatLite::StringSize(this_._impl_.string_); } } return this_.MaybeComputeUnknownFieldsSize(total_size, @@ -368,7 +368,7 @@ cached_has_bits = from._impl_._has_bits_[0]; if (CheckHasBit(cached_has_bits, 0x00000001U)) { - this_._internal_set_string(from._internal_string()); + this_._internal_set_string(from._impl_.string_.Get()); } this_._impl_._has_bits_[0] |= cached_has_bits; this_._internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(
diff --git a/src/google/protobuf/raw_ptr.h b/src/google/protobuf/raw_ptr.h index dad714f..cb25dc3 100644 --- a/src/google/protobuf/raw_ptr.h +++ b/src/google/protobuf/raw_ptr.h
@@ -28,6 +28,8 @@ template <typename T> class RawPtr { public: + using value_type = T; + constexpr RawPtr() : RawPtr(kZeroBuffer) { static_assert(sizeof(T) <= sizeof(kZeroBuffer), ""); static_assert(alignof(T) <= ABSL_CACHELINE_SIZE, ""); @@ -52,6 +54,8 @@ operator T&() { return *Get(); } // NOLINT auto begin() const { return Get()->begin(); } auto end() const { return Get()->end(); } + bool empty() const { return Get()->empty(); } + int size() const { return Get()->size(); } private: void* p_; @@ -61,6 +65,11 @@ return const_cast<void*>(static_cast<const void*>(kZeroBuffer)); } +template <typename T> +inline constexpr bool kIsRawPtr = false; +template <typename T> +inline constexpr bool kIsRawPtr<RawPtr<T>> = true; + } // namespace internal } // namespace protobuf } // namespace google
diff --git a/src/google/protobuf/wire_format_lite.h b/src/google/protobuf/wire_format_lite.h index 1801242..8cd5dfa 100644 --- a/src/google/protobuf/wire_format_lite.h +++ b/src/google/protobuf/wire_format_lite.h
@@ -667,6 +667,16 @@ PROTOBUF_FUTURE_ADD_EARLY_NODISCARD static inline size_t BytesSize( absl::string_view value); + // To simplify codegen: + template <typename T> + [[nodiscard]] static size_t StringSize(const T& value) { + return StringSize(value.Get()); + } + template <typename T> + [[nodiscard]] static size_t BytesSize(const T& value) { + return BytesSize(value.Get()); + } + template <typename MessageType> PROTOBUF_FUTURE_ADD_EARLY_NODISCARD static inline size_t GroupSize( const MessageType& value);