Incremental migration of message.cc to Emit

PiperOrigin-RevId: 532287642
pull/12826/head
Matt Kulukundis 2 years ago committed by Copybara-Service
parent f9174079ba
commit 235b9e60be
  1. 30
      src/google/protobuf/compiler/cpp/message.cc

@ -3685,28 +3685,24 @@ void MessageGenerator::GenerateSerializeOneExtensionRange(io::Printer* p,
void MessageGenerator::GenerateSerializeWithCachedSizesToArray(io::Printer* p) { void MessageGenerator::GenerateSerializeWithCachedSizesToArray(io::Printer* p) {
if (HasSimpleBaseClass(descriptor_, options_)) return; if (HasSimpleBaseClass(descriptor_, options_)) return;
Formatter format(p);
if (descriptor_->options().message_set_wire_format()) { if (descriptor_->options().message_set_wire_format()) {
// Special-case MessageSet. // Special-case MessageSet.
format( p->Emit(R"cc(
"$uint8$* $classname$::_InternalSerialize(\n" $uint8$* $classname$::_InternalSerialize(
" $uint8$* target, ::$proto_ns$::io::EpsCopyOutputStream* stream) " $uint8$* target,
"const {\n" ::$proto_ns$::io::EpsCopyOutputStream* stream) const {
"$annotate_serialize$" $annotate_serialize$ target =
" target = $extensions$." $extensions$.InternalSerializeMessageSetWithCachedSizesToArray(
"InternalSerializeMessageSetWithCachedSizesToArray(\n" // internal_default_instance(), target, stream);
"internal_default_instance(), target, stream);\n"); target = ::_pbi::InternalSerializeUnknownMessageSetItemsToArray(
$unknown_fields$, target, stream);
format( return target;
" target = ::_pbi::" }
"InternalSerializeUnknownMessageSetItemsToArray(\n" )cc");
" $unknown_fields$, target, stream);\n");
format(
" return target;\n"
"}\n");
return; return;
} }
Formatter format(p);
format( format(
"$uint8$* $classname$::_InternalSerialize(\n" "$uint8$* $classname$::_InternalSerialize(\n"
" $uint8$* target, ::$proto_ns$::io::EpsCopyOutputStream* stream) " " $uint8$* target, ::$proto_ns$::io::EpsCopyOutputStream* stream) "

Loading…
Cancel
Save