Skip to content

Commit e7aeaf3

Browse files
ClaytonKnittelcopybara-github
authored andcommitted
Migrate remaining old-style $tag_size$ substitutions to $kTagBytes$ in field generators.
PiperOrigin-RevId: 908608483
1 parent a8896e8 commit e7aeaf3

5 files changed

Lines changed: 55 additions & 56 deletions

File tree

src/google/protobuf/compiler/cpp/field.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ std::vector<Sub> FieldVars(const FieldDescriptor* field, const Options& opts) {
8585
// Old-style names.
8686
{"classname", ClassName(FieldScope(field), false)},
8787
{"ns", Namespace(field)},
88-
{"tag_size", WireFormat::TagSize(field->number(), field->type())},
8988
{"deprecated_attr", DeprecatedAttribute(opts, field)},
9089
Sub("WeakDescriptorSelfPin",
9190
UsingImplicitWeakDescriptor(field->file(), opts)

src/google/protobuf/compiler/cpp/field_generators/cord_field.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ void CordFieldGenerator::GenerateSerializeWithCachedSizesToArray(
287287
void CordFieldGenerator::GenerateByteSize(io::Printer* p) const {
288288
auto v = p->WithVars(variables_);
289289
p->Emit(R"cc(
290-
total_size += $tag_size$ + $pbi$::WireFormatLite::$DeclaredType$Size(
291-
this_._internal_$name$());
290+
total_size += $kTagBytes$ + $pbi$::WireFormatLite::$DeclaredType$Size(
291+
this_._internal_$name$());
292292
)cc");
293293
}
294294

src/google/protobuf/compiler/cpp/field_generators/message_field.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ void SingularMessage::GenerateSerializeWithCachedSizesToArray(
407407

408408
void SingularMessage::GenerateByteSize(io::Printer* p) const {
409409
p->Emit(R"cc(
410-
total_size +=
411-
$tag_size$ + $pbi$::WireFormatLite::$DeclaredType$Size(*this_.$field_$);
410+
total_size += $kTagBytes$ +
411+
$pbi$::WireFormatLite::$DeclaredType$Size(*this_.$field_$);
412412
)cc");
413413
}
414414

@@ -1070,7 +1070,7 @@ void RepeatedMessage::GenerateSerializeWithCachedSizesToArray(
10701070
void RepeatedMessage::GenerateByteSize(io::Printer* p) const {
10711071
p->Emit(
10721072
R"cc(
1073-
total_size += $tag_size$UL * this_._internal_$name$_size();
1073+
total_size += $kTagBytes$UL * this_._internal_$name$_size();
10741074
for (const auto& msg : this_._internal$_weak$_$name$()) {
10751075
total_size += $pbi$::WireFormatLite::$DeclaredType$Size(msg);
10761076
}

src/google/protobuf/compiler/plugin.pb.cc

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/google/protobuf/descriptor.pb.cc

Lines changed: 46 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)