Automated rollback of commit 543169bd55.

PiperOrigin-RevId: 694552602
pull/19197/head
Protobuf Team Bot 3 months ago committed by Copybara-Service
parent 1a39f5d07a
commit ff343a03bb
  1. 17
      csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs
  2. 31
      src/google/protobuf/compiler/cpp/field_generators/message_field.cc
  3. 8
      src/google/protobuf/compiler/cpp/field_generators/string_field.cc
  4. 10
      src/google/protobuf/compiler/cpp/field_generators/string_view_field.cc
  5. 10
      src/google/protobuf/repeated_ptr_field.h

@ -1,17 +0,0 @@
#region Copyright notice and license
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
#endregion
namespace Google.Protobuf.Reflection;
internal sealed partial class FeatureSetDescriptor
{
// Canonical serialized form of the edition defaults, generated by embed_edition_defaults.
private const string DefaultsBase64 =
"ChMYhAciACoMCAEQAhgCIAMoATACChMY5wciACoMCAIQARgBIAIoATABChMY6AciDAgBEAEYASACKAEwASoAIOYHKOgH";
}

@ -783,17 +783,26 @@ void RepeatedMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const {
return _internal_mutable_$name_internal$();
}
)cc");
p->Emit({{"Get", opts_->safe_boundary_check ? "InternalCheckedGet" : "Get"}},
R"cc(
inline const $Submsg$& $Msg$::$name$(int index) const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
$WeakDescriptorSelfPin$;
$annotate_get$;
// @@protoc_insertion_point(field_get:$pkg.Msg.field$)
$StrongRef$;
return _internal_$name_internal$().$Get$(index);
}
)cc");
p->Emit(
{
{"Get", opts_->safe_boundary_check ? "InternalCheckedGet" : "Get"},
{"GetExtraArg",
[&] {
p->Emit(opts_->safe_boundary_check
? ", reinterpret_cast<const $Submsg$&>($kDefault$)"
: "");
}},
},
R"cc(
inline const $Submsg$& $Msg$::$name$(int index) const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
$WeakDescriptorSelfPin$;
$annotate_get$;
// @@protoc_insertion_point(field_get:$pkg.Msg.field$)
$StrongRef$;
return _internal_$name_internal$().$Get$(index$GetExtraArg$);
}
)cc");
p->Emit(R"cc(
inline $Submsg$* $Msg$::add_$name$() ABSL_ATTRIBUTE_LIFETIME_BOUND {
$WeakDescriptorSelfPin$;

@ -851,6 +851,12 @@ void RepeatedString::GenerateInlineAccessorDefinitions(io::Printer* p) const {
p->Emit(
{
{"Get", opts_->safe_boundary_check ? "InternalCheckedGet" : "Get"},
{"GetExtraArg",
[&] {
p->Emit(opts_->safe_boundary_check
? ", $pbi$::GetEmptyStringAlreadyInited()"
: "");
}},
{"bytes_tag",
[&] {
if (bytes) {
@ -872,7 +878,7 @@ void RepeatedString::GenerateInlineAccessorDefinitions(io::Printer* p) const {
$WeakDescriptorSelfPin$;
$annotate_get$;
// @@protoc_insertion_point(field_get:$pkg.Msg.field$)
return _internal_$name_internal$().$Get$(index);
return _internal_$name_internal$().$Get$(index$GetExtraArg$);
}
inline std::string* $Msg$::mutable_$name$(int index)
ABSL_ATTRIBUTE_LIFETIME_BOUND {

@ -666,14 +666,20 @@ void RepeatedStringView::GenerateAccessorDeclarations(io::Printer* p) const {
void RepeatedStringView::GenerateInlineAccessorDefinitions(
io::Printer* p) const {
p->Emit({{"Get", opts_->safe_boundary_check ? "InternalCheckedGet" : "Get"}},
p->Emit({{"Get", opts_->safe_boundary_check ? "InternalCheckedGet" : "Get"},
{"GetExtraArg",
[&] {
p->Emit(opts_->safe_boundary_check
? ", $pbi$::GetEmptyStringAlreadyInited()"
: "");
}}},
R"cc(
inline absl::string_view $Msg$::$name$(int index) const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
$WeakDescriptorSelfPin$;
$annotate_get$;
// @@protoc_insertion_point(field_get:$pkg.Msg.field$)
return _internal_$name_internal$().$Get$(index);
return _internal_$name_internal$().$Get$(index$GetExtraArg$);
}
inline void $Msg$::set_$name$(int index, const std::string& value) {
$WeakDescriptorSelfPin$;

@ -117,8 +117,6 @@ class GenericTypeHandler;
//
// // Only needs to be implemented if SpaceUsedExcludingSelf() is called.
// static int SpaceUsedLong(const Type&);
//
// static const Type& default_instance();
// };
class PROTOBUF_EXPORT RepeatedPtrFieldBase {
template <typename TypeHandler>
@ -841,11 +839,6 @@ class GenericTypeHandler {
static inline size_t SpaceUsedLong(const Type& value) {
return value.SpaceUsedLong();
}
static const Type& default_instance() {
return *static_cast<const GenericType*>(
MessageTraits<Type>::default_instance());
}
};
template <>
@ -882,9 +875,6 @@ class GenericTypeHandler<std::string> {
static size_t SpaceUsedLong(const Type& value) {
return sizeof(value) + StringSpaceUsedExcludingSelfLong(value);
}
static const Type& default_instance() {
return GetEmptyStringAlreadyInited();
}
};
} // namespace internal

Loading…
Cancel
Save