Internal change

PiperOrigin-RevId: 525235311
pull/12498/head
Protobuf Team Bot 2 years ago committed by Copybara-Service
parent 5e8510cfe5
commit 6ad1a6d674
  1. 26
      src/google/protobuf/compiler/cpp/field_generators/enum_field.cc
  2. 11
      src/google/protobuf/descriptor.pb.cc
  3. 14
      src/google/protobuf/descriptor.pb.h
  4. 20
      version.json

@ -258,25 +258,26 @@ class RepeatedEnum : public FieldGeneratorBase {
void GenerateClearingCode(io::Printer* p) const override {
p->Emit(R"cc(
$field_$.Clear();
_internal_mutable_$name$()->Clear();
)cc");
}
void GenerateMergingCode(io::Printer* p) const override {
p->Emit(R"cc(
_this->$field_$.MergeFrom(from.$field_$);
_this->_internal_mutable_$name$()->MergeFrom(from._internal_$name$());
)cc");
}
void GenerateSwappingCode(io::Printer* p) const override {
p->Emit(R"cc(
$field_$.InternalSwap(&other->$field_$);
_internal_mutable_$name$()->InternalSwap(
other->_internal_mutable_$name$());
)cc");
}
void GenerateDestructorCode(io::Printer* p) const override {
p->Emit(R"cc(
$field_$.~RepeatedField();
_internal_mutable_$name$()->~RepeatedField();
)cc");
}
@ -306,7 +307,7 @@ class RepeatedEnum : public FieldGeneratorBase {
void GenerateCopyAggregateInitializer(io::Printer* p) const override {
p->Emit(R"cc(
decltype($field_$) { from.$field_$ })cc");
decltype($field_$) { from._internal_$name$() })cc");
if (has_cached_size_) {
// std::atomic has no copy constructor.
p->Emit(R"cc(
@ -351,6 +352,7 @@ void RepeatedEnum::GenerateAccessorDeclarations(io::Printer* p) const {
private:
$Enum$ $_internal_name$(int index) const;
void $_internal_add_name$($Enum$ value);
const $pb$::RepeatedField<int>& $_internal_name$() const;
$pb$::RepeatedField<int>* $_internal_mutable_name$();
public:
@ -366,7 +368,7 @@ void RepeatedEnum::GenerateInlineAccessorDefinitions(io::Printer* p) const {
}
inline void $Msg$::set_$name$(int index, $Enum$ value) {
$assert_valid$;
$field_$.Set(index, value);
_internal_mutable_$name$()->Set(index, value);
$annotate_set$
// @@protoc_insertion_point(field_set:$pkg.Msg.field$)
}
@ -378,7 +380,7 @@ void RepeatedEnum::GenerateInlineAccessorDefinitions(io::Printer* p) const {
inline const $pb$::RepeatedField<int>& $Msg$::$name$() const {
$annotate_list$;
// @@protoc_insertion_point(field_list:$pkg.Msg.field$)
return $field_$;
return _internal_$name$();
}
inline $pb$::RepeatedField<int>* $Msg$::mutable_$name$() {
$annotate_mutable_list$;
@ -386,11 +388,14 @@ void RepeatedEnum::GenerateInlineAccessorDefinitions(io::Printer* p) const {
return _internal_mutable_$name$();
}
inline $Enum$ $Msg$::_internal_$name$(int index) const {
return static_cast<$Enum$>($field_$.Get(index));
return static_cast<$Enum$>(_internal_$name$().Get(index));
}
inline void $Msg$::_internal_add_$name$($Enum$ value) {
$assert_valid$;
$field_$.Add(value);
_internal_mutable_$name$()->Add(value);
}
inline const $pb$::RepeatedField<int>& $Msg$::_internal_$name$() const {
return $field_$;
}
inline $pb$::RepeatedField<int>* $Msg$::_internal_mutable_$name$() {
return &$field_$;
@ -405,7 +410,8 @@ void RepeatedEnum::GenerateSerializeWithCachedSizesToArray(
{
int byte_size = $cached_size_$.Get();
if (byte_size > 0) {
target = stream->WriteEnumPacked($number$, $field_$, byte_size, target);
target = stream->WriteEnumPacked($number$, _internal_$name$(),
byte_size, target);
}
}
)cc");

@ -8671,7 +8671,7 @@ FieldOptions::FieldOptions(const FieldOptions& from)
/*decltype(_impl_._extensions_)*/{}
, decltype(_impl_._has_bits_){from._impl_._has_bits_}
, /*decltype(_impl_._cached_size_)*/{}
, decltype(_impl_.targets_) { from._impl_.targets_ }
, decltype(_impl_.targets_) { from._internal_targets() }
, decltype(_impl_.uninterpreted_option_){from._impl_.uninterpreted_option_}
, decltype(_impl_.ctype_) {}
@ -8747,7 +8747,7 @@ FieldOptions::~FieldOptions() {
inline void FieldOptions::SharedDtor() {
ABSL_DCHECK(GetArenaForAllocation() == nullptr);
_impl_._extensions_.~ExtensionSet();
_impl_.targets_.~RepeatedField();
_internal_mutable_targets()->~RepeatedField();
_impl_.uninterpreted_option_.~RepeatedPtrField();
}
@ -8762,7 +8762,7 @@ void FieldOptions::Clear() {
(void) cached_has_bits;
_impl_._extensions_.Clear();
_impl_.targets_.Clear();
_internal_mutable_targets()->Clear();
_impl_.uninterpreted_option_.Clear();
cached_has_bits = _impl_._has_bits_[0];
if (cached_has_bits & 0x000000ffu) {
@ -9178,7 +9178,7 @@ void FieldOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::P
::uint32_t cached_has_bits = 0;
(void) cached_has_bits;
_this->_impl_.targets_.MergeFrom(from._impl_.targets_);
_this->_internal_mutable_targets()->MergeFrom(from._internal_targets());
_this->_impl_.uninterpreted_option_.MergeFrom(from._impl_.uninterpreted_option_);
cached_has_bits = from._impl_._has_bits_[0];
if (cached_has_bits & 0x000000ffu) {
@ -9243,7 +9243,8 @@ void FieldOptions::InternalSwap(FieldOptions* other) {
_impl_._extensions_.InternalSwap(&other->_impl_._extensions_);
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
_impl_.targets_.InternalSwap(&other->_impl_.targets_);
_internal_mutable_targets()->InternalSwap(
other->_internal_mutable_targets());
_impl_.uninterpreted_option_.InternalSwap(&other->_impl_.uninterpreted_option_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(FieldOptions, _impl_.target_)

@ -5319,6 +5319,7 @@ class PROTOBUF_EXPORT FieldOptions final :
private:
::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType _internal_targets(int index) const;
void _internal_add_targets(::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType value);
const ::PROTOBUF_NAMESPACE_ID::RepeatedField<int>& _internal_targets() const;
::PROTOBUF_NAMESPACE_ID::RepeatedField<int>* _internal_mutable_targets();
public:
@ -13606,7 +13607,7 @@ inline int FieldOptions::targets_size() const {
return _internal_targets_size();
}
inline void FieldOptions::clear_targets() {
_impl_.targets_.Clear();
_internal_mutable_targets()->Clear();
}
inline ::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType FieldOptions::targets(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.targets)
@ -13614,7 +13615,7 @@ inline ::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType FieldOptions::targ
}
inline void FieldOptions::set_targets(int index, ::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType value) {
assert(::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType_IsValid(value));
_impl_.targets_.Set(index, value);
_internal_mutable_targets()->Set(index, value);
// @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.targets)
}
inline void FieldOptions::add_targets(::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType value) {
@ -13623,18 +13624,21 @@ inline void FieldOptions::add_targets(::PROTOBUF_NAMESPACE_ID::FieldOptions_Opti
}
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField<int>& FieldOptions::targets() const {
// @@protoc_insertion_point(field_list:google.protobuf.FieldOptions.targets)
return _impl_.targets_;
return _internal_targets();
}
inline ::PROTOBUF_NAMESPACE_ID::RepeatedField<int>* FieldOptions::mutable_targets() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.FieldOptions.targets)
return _internal_mutable_targets();
}
inline ::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType FieldOptions::_internal_targets(int index) const {
return static_cast<::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType>(_impl_.targets_.Get(index));
return static_cast<::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType>(_internal_targets().Get(index));
}
inline void FieldOptions::_internal_add_targets(::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType value) {
assert(::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType_IsValid(value));
_impl_.targets_.Add(value);
_internal_mutable_targets()->Add(value);
}
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField<int>& FieldOptions::_internal_targets() const {
return _impl_.targets_;
}
inline ::PROTOBUF_NAMESPACE_ID::RepeatedField<int>* FieldOptions::_internal_mutable_targets() {
return &_impl_.targets_;

@ -1,17 +1,17 @@
{
"main": {
"protoc_version": "23-dev",
"protoc_version": "22-dev",
"lts": false,
"date": "2023-01-26",
"date": "2022-07-21",
"languages": {
"cpp": "4.23-dev",
"csharp": "3.23-dev",
"java": "3.23-dev",
"javascript": "3.23-dev",
"objectivec": "3.23-dev",
"php": "3.23-dev",
"python": "4.23-dev",
"ruby": "3.23-dev"
"cpp": "4.22-dev",
"csharp": "3.22-dev",
"java": "3.22-dev",
"javascript": "3.22-dev",
"objectivec": "3.22-dev",
"php": "3.22-dev",
"python": "4.22-dev",
"ruby": "3.22-dev"
}
}
}

Loading…
Cancel
Save