diff options
author | Adam Cozzette <acozzette@google.com> | 2017-12-01 10:05:10 -0800 |
---|---|---|
committer | Adam Cozzette <acozzette@google.com> | 2017-12-01 10:05:10 -0800 |
commit | 92a7e778e7394386f413cec28d67a07630f784b1 (patch) | |
tree | cb5673c7c09b0d3905b48a24765d07e423bc5b30 /src/google/protobuf/type.pb.cc | |
parent | ce0a53273a400369932ba788d17500336a6ecaad (diff) | |
download | protobuf-92a7e778e7394386f413cec28d67a07630f784b1.tar.gz protobuf-92a7e778e7394386f413cec28d67a07630f784b1.tar.bz2 protobuf-92a7e778e7394386f413cec28d67a07630f784b1.zip |
Integrated internal changes from Google
Diffstat (limited to 'src/google/protobuf/type.pb.cc')
-rw-r--r-- | src/google/protobuf/type.pb.cc | 120 |
1 files changed, 65 insertions, 55 deletions
diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index 92f6589c..a2edabb6 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -420,10 +420,6 @@ void Type::InitAsDefaultInstance() { ::google::protobuf::_Type_default_instance_._instance.get_mutable()->source_context_ = const_cast< ::google::protobuf::SourceContext*>( ::google::protobuf::SourceContext::internal_default_instance()); } -void Type::_slow_mutable_source_context() { - source_context_ = ::google::protobuf::Arena::Create< ::google::protobuf::SourceContext >( - GetArenaNoVirtual()); -} void Type::unsafe_arena_set_allocated_source_context( ::google::protobuf::SourceContext* source_context) { if (GetArenaNoVirtual() == NULL) { @@ -533,9 +529,6 @@ const Type& Type::default_instance() { return *internal_default_instance(); } -Type* Type::New(::google::protobuf::Arena* arena) const { - return ::google::protobuf::Arena::CreateMessage<Type>(arena); -} void Type::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Type) @@ -585,7 +578,8 @@ bool Type::MergePartialFromCodedStream( case 2: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_fields())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( + input, add_fields())); } else { goto handle_unusual; } @@ -613,7 +607,8 @@ bool Type::MergePartialFromCodedStream( case 4: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( + input, add_options())); } else { goto handle_unusual; } @@ -687,7 +682,9 @@ void Type::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->fields_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->fields(static_cast<int>(i)), output); + 2, + this->fields(static_cast<int>(i)), + output); } // repeated string oneofs = 3; @@ -704,13 +701,15 @@ void Type::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->options_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 4, this->options(static_cast<int>(i)), output); + 4, + this->options(static_cast<int>(i)), + output); } // .google.protobuf.SourceContext source_context = 5; if (this->has_source_context()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 5, *this->source_context_, output); + 5, *source_context_, output); } // .google.protobuf.Syntax syntax = 6; @@ -774,7 +773,7 @@ void Type::SerializeWithCachedSizes( if (this->has_source_context()) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageToArray( - 5, *this->source_context_, deterministic, target); + 5, *source_context_, deterministic, target); } // .google.protobuf.Syntax syntax = 6; @@ -841,7 +840,7 @@ size_t Type::ByteSizeLong() const { if (this->has_source_context()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSize( - *this->source_context_); + *source_context_); } // .google.protobuf.Syntax syntax = 6; @@ -932,9 +931,9 @@ void Type::UnsafeArenaSwap(Type* other) { } void Type::InternalSwap(Type* other) { using std::swap; - fields_.InternalSwap(&other->fields_); - oneofs_.InternalSwap(&other->oneofs_); - options_.InternalSwap(&other->options_); + CastToBase(&fields_)->InternalSwap(CastToBase(&other->fields_)); + oneofs_.InternalSwap(CastToBase(&other->oneofs_)); + CastToBase(&options_)->InternalSwap(CastToBase(&other->options_)); name_.Swap(&other->name_); swap(source_context_, other->source_context_); swap(syntax_, other->syntax_); @@ -1059,9 +1058,6 @@ const Field& Field::default_instance() { return *internal_default_instance(); } -Field* Field::New(::google::protobuf::Arena* arena) const { - return ::google::protobuf::Arena::CreateMessage<Field>(arena); -} void Field::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Field) @@ -1198,7 +1194,8 @@ bool Field::MergePartialFromCodedStream( case 9: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(74u /* 74 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( + input, add_options())); } else { goto handle_unusual; } @@ -1314,7 +1311,9 @@ void Field::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->options_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 9, this->options(static_cast<int>(i)), output); + 9, + this->options(static_cast<int>(i)), + output); } // string json_name = 10; @@ -1615,7 +1614,7 @@ void Field::UnsafeArenaSwap(Field* other) { } void Field::InternalSwap(Field* other) { using std::swap; - options_.InternalSwap(&other->options_); + CastToBase(&options_)->InternalSwap(CastToBase(&other->options_)); name_.Swap(&other->name_); type_url_.Swap(&other->type_url_); json_name_.Swap(&other->json_name_); @@ -1641,10 +1640,6 @@ void Enum::InitAsDefaultInstance() { ::google::protobuf::_Enum_default_instance_._instance.get_mutable()->source_context_ = const_cast< ::google::protobuf::SourceContext*>( ::google::protobuf::SourceContext::internal_default_instance()); } -void Enum::_slow_mutable_source_context() { - source_context_ = ::google::protobuf::Arena::Create< ::google::protobuf::SourceContext >( - GetArenaNoVirtual()); -} void Enum::unsafe_arena_set_allocated_source_context( ::google::protobuf::SourceContext* source_context) { if (GetArenaNoVirtual() == NULL) { @@ -1751,9 +1746,6 @@ const Enum& Enum::default_instance() { return *internal_default_instance(); } -Enum* Enum::New(::google::protobuf::Arena* arena) const { - return ::google::protobuf::Arena::CreateMessage<Enum>(arena); -} void Enum::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Enum) @@ -1802,7 +1794,8 @@ bool Enum::MergePartialFromCodedStream( case 2: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_enumvalue())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( + input, add_enumvalue())); } else { goto handle_unusual; } @@ -1813,7 +1806,8 @@ bool Enum::MergePartialFromCodedStream( case 3: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( + input, add_options())); } else { goto handle_unusual; } @@ -1887,20 +1881,24 @@ void Enum::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->enumvalue_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->enumvalue(static_cast<int>(i)), output); + 2, + this->enumvalue(static_cast<int>(i)), + output); } // repeated .google.protobuf.Option options = 3; for (unsigned int i = 0, n = static_cast<unsigned int>(this->options_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 3, this->options(static_cast<int>(i)), output); + 3, + this->options(static_cast<int>(i)), + output); } // .google.protobuf.SourceContext source_context = 4; if (this->has_source_context()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 4, *this->source_context_, output); + 4, *source_context_, output); } // .google.protobuf.Syntax syntax = 5; @@ -1954,7 +1952,7 @@ void Enum::SerializeWithCachedSizes( if (this->has_source_context()) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageToArray( - 4, *this->source_context_, deterministic, target); + 4, *source_context_, deterministic, target); } // .google.protobuf.Syntax syntax = 5; @@ -2013,7 +2011,7 @@ size_t Enum::ByteSizeLong() const { if (this->has_source_context()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSize( - *this->source_context_); + *source_context_); } // .google.protobuf.Syntax syntax = 5; @@ -2103,8 +2101,8 @@ void Enum::UnsafeArenaSwap(Enum* other) { } void Enum::InternalSwap(Enum* other) { using std::swap; - enumvalue_.InternalSwap(&other->enumvalue_); - options_.InternalSwap(&other->options_); + CastToBase(&enumvalue_)->InternalSwap(CastToBase(&other->enumvalue_)); + CastToBase(&options_)->InternalSwap(CastToBase(&other->options_)); name_.Swap(&other->name_); swap(source_context_, other->source_context_); swap(syntax_, other->syntax_); @@ -2197,9 +2195,6 @@ const EnumValue& EnumValue::default_instance() { return *internal_default_instance(); } -EnumValue* EnumValue::New(::google::protobuf::Arena* arena) const { - return ::google::protobuf::Arena::CreateMessage<EnumValue>(arena); -} void EnumValue::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValue) @@ -2257,7 +2252,8 @@ bool EnumValue::MergePartialFromCodedStream( case 3: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( + input, add_options())); } else { goto handle_unusual; } @@ -2309,7 +2305,9 @@ void EnumValue::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->options_size()); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 3, this->options(static_cast<int>(i)), output); + 3, + this->options(static_cast<int>(i)), + output); } if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { @@ -2469,7 +2467,7 @@ void EnumValue::UnsafeArenaSwap(EnumValue* other) { } void EnumValue::InternalSwap(EnumValue* other) { using std::swap; - options_.InternalSwap(&other->options_); + CastToBase(&options_)->InternalSwap(CastToBase(&other->options_)); name_.Swap(&other->name_); swap(number_, other->number_); _internal_metadata_.Swap(&other->_internal_metadata_); @@ -2488,10 +2486,6 @@ void Option::InitAsDefaultInstance() { ::google::protobuf::_Option_default_instance_._instance.get_mutable()->value_ = const_cast< ::google::protobuf::Any*>( ::google::protobuf::Any::internal_default_instance()); } -void Option::_slow_mutable_value() { - value_ = ::google::protobuf::Arena::Create< ::google::protobuf::Any >( - GetArenaNoVirtual()); -} void Option::unsafe_arena_set_allocated_value( ::google::protobuf::Any* value) { if (GetArenaNoVirtual() == NULL) { @@ -2588,9 +2582,6 @@ const Option& Option::default_instance() { return *internal_default_instance(); } -Option* Option::New(::google::protobuf::Arena* arena) const { - return ::google::protobuf::Arena::CreateMessage<Option>(arena); -} void Option::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Option) @@ -2683,7 +2674,7 @@ void Option::SerializeWithCachedSizes( // .google.protobuf.Any value = 2; if (this->has_value()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, *this->value_, output); + 2, *value_, output); } if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { @@ -2715,7 +2706,7 @@ void Option::SerializeWithCachedSizes( if (this->has_value()) { target = ::google::protobuf::internal::WireFormatLite:: InternalWriteMessageToArray( - 2, *this->value_, deterministic, target); + 2, *value_, deterministic, target); } if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { @@ -2746,7 +2737,7 @@ size_t Option::ByteSizeLong() const { if (this->has_value()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSize( - *this->value_); + *value_); } int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); @@ -2840,5 +2831,24 @@ void Option::InternalSwap(Option* other) { // @@protoc_insertion_point(namespace_scope) } // namespace protobuf } // namespace google +namespace google { +namespace protobuf { +template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Type* Arena::CreateMessage< ::google::protobuf::Type >(Arena* arena) { + return Arena::CreateMessageInternal< ::google::protobuf::Type >(arena); +} +template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Field* Arena::CreateMessage< ::google::protobuf::Field >(Arena* arena) { + return Arena::CreateMessageInternal< ::google::protobuf::Field >(arena); +} +template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Enum* Arena::CreateMessage< ::google::protobuf::Enum >(Arena* arena) { + return Arena::CreateMessageInternal< ::google::protobuf::Enum >(arena); +} +template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::EnumValue* Arena::CreateMessage< ::google::protobuf::EnumValue >(Arena* arena) { + return Arena::CreateMessageInternal< ::google::protobuf::EnumValue >(arena); +} +template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Option* Arena::CreateMessage< ::google::protobuf::Option >(Arena* arena) { + return Arena::CreateMessageInternal< ::google::protobuf::Option >(arena); +} +} // namespace protobuf +} // namespace google // @@protoc_insertion_point(global_scope) |