Skip to content

Commit

Permalink
Automated rollback of commit 543169b.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 694552602
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Nov 8, 2024
1 parent 1a39f5d commit ff343a0
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 41 deletions.
17 changes: 0 additions & 17 deletions csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs

This file was deleted.

31 changes: 20 additions & 11 deletions src/google/protobuf/compiler/cpp/field_generators/message_field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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$;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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$;
Expand Down
10 changes: 0 additions & 10 deletions src/google/protobuf/repeated_ptr_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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 <>
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ff343a0

Please sign in to comment.