diff options
Diffstat (limited to 'src/google')
148 files changed, 13396 insertions, 14740 deletions
diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc index 7d538212..29687477 100644 --- a/src/google/protobuf/any.pb.cc +++ b/src/google/protobuf/any.pb.cc @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/any.proto -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #include <google/protobuf/any.pb.h> #include <algorithm> @@ -15,58 +14,61 @@ #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> +// This is a temporary google only hack +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS +#include "third_party/protobuf/version.h" +#endif // @@protoc_insertion_point(includes) - namespace google { namespace protobuf { class AnyDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<Any> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<Any> + _instance; } _Any_default_instance_; - +} // namespace protobuf +} // namespace google namespace protobuf_google_2fprotobuf_2fany_2eproto { +void InitDefaultsAnyImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_Any_default_instance_; + new (ptr) ::google::protobuf::Any(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::Any::InitAsDefaultInstance(); +} -namespace { +void InitDefaultsAny() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsAnyImpl); +} ::google::protobuf::Metadata file_level_metadata[1]; -} // namespace - -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField - const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0}, -}; - -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField - const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - ::google::protobuf::internal::AuxillaryParseTableField(), -}; -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const - TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, -}; - -const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { +const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Any, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Any, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Any, type_url_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Any, value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Any, type_url_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Any, value_), }; -static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(Any)}, +static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, sizeof(::google::protobuf::Any)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { - reinterpret_cast<const ::google::protobuf::Message*>(&_Any_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Any_default_instance_), }; -namespace { - void protobuf_AssignDescriptors() { AddDescriptors(); ::google::protobuf::MessageFactory* factory = NULL; @@ -80,29 +82,15 @@ void protobuf_AssignDescriptorsOnce() { ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); } -void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; +void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1); } -} // namespace -void TableStruct::InitDefaultsImpl() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::internal::InitProtobufDefaults(); - _Any_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_Any_default_instance_);} - -void InitDefaults() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl); -} -namespace { void AddDescriptorsImpl() { InitDefaults(); - static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { "\n\031google/protobuf/any.proto\022\017google.prot" "obuf\"&\n\003Any\022\020\n\010type_url\030\001 \001(\t\022\r\n\005value\030\002" " \001(\014Bo\n\023com.google.protobufB\010AnyProtoP\001Z" @@ -115,7 +103,6 @@ void AddDescriptorsImpl() { ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/any.proto", &protobuf_RegisterTypes); } -} // anonymous namespace void AddDescriptors() { static GOOGLE_PROTOBUF_DECLARE_ONCE(once); @@ -127,12 +114,14 @@ struct StaticDescriptorInitializer { AddDescriptors(); } } static_descriptor_initializer; - } // namespace protobuf_google_2fprotobuf_2fany_2eproto - +namespace google { +namespace protobuf { // =================================================================== +void Any::InitAsDefaultInstance() { +} void Any::PackFrom(const ::google::protobuf::Message& message) { _any_metadata_.PackFrom(message); } @@ -154,7 +143,7 @@ const int Any::kValueFieldNumber; Any::Any() : ::google::protobuf::Message(), _internal_metadata_(NULL), _any_metadata_(&type_url_, &value_) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fany_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fany_2eproto::InitDefaultsAny(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.Any) @@ -198,12 +187,12 @@ void Any::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* Any::descriptor() { - protobuf_google_2fprotobuf_2fany_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fany_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fany_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fany_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const Any& Any::default_instance() { - protobuf_google_2fprotobuf_2fany_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fany_2eproto::InitDefaultsAny(); return *internal_default_instance(); } @@ -440,122 +429,11 @@ void Any::InternalSwap(Any* other) { ::google::protobuf::Metadata Any::GetMetadata() const { protobuf_google_2fprotobuf_2fany_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fany_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// Any - -// string type_url = 1; -void Any::clear_type_url() { - type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -const ::std::string& Any::type_url() const { - // @@protoc_insertion_point(field_get:google.protobuf.Any.type_url) - return type_url_.GetNoArena(); -} -void Any::set_type_url(const ::std::string& value) { - - type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.Any.type_url) -} -#if LANG_CXX11 -void Any::set_type_url(::std::string&& value) { - - type_url_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Any.type_url) -} -#endif -void Any::set_type_url(const char* value) { - GOOGLE_DCHECK(value != NULL); - - type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.Any.type_url) -} -void Any::set_type_url(const char* value, size_t size) { - - type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Any.type_url) -} -::std::string* Any::mutable_type_url() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.Any.type_url) - return type_url_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* Any::release_type_url() { - // @@protoc_insertion_point(field_release:google.protobuf.Any.type_url) - - return type_url_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void Any::set_allocated_type_url(::std::string* type_url) { - if (type_url != NULL) { - - } else { - - } - type_url_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), type_url); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.type_url) + return ::protobuf_google_2fprotobuf_2fany_2eproto::file_level_metadata[kIndexInFileMessages]; } -// bytes value = 2; -void Any::clear_value() { - value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -const ::std::string& Any::value() const { - // @@protoc_insertion_point(field_get:google.protobuf.Any.value) - return value_.GetNoArena(); -} -void Any::set_value(const ::std::string& value) { - - value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.Any.value) -} -#if LANG_CXX11 -void Any::set_value(::std::string&& value) { - - value_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Any.value) -} -#endif -void Any::set_value(const char* value) { - GOOGLE_DCHECK(value != NULL); - - value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.Any.value) -} -void Any::set_value(const void* value, size_t size) { - - value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Any.value) -} -::std::string* Any::mutable_value() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.Any.value) - return value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* Any::release_value() { - // @@protoc_insertion_point(field_release:google.protobuf.Any.value) - - return value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void Any::set_allocated_value(::std::string* value) { - if (value != NULL) { - - } else { - - } - value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.value) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h index 5ffda741..20a1cbed 100644 --- a/src/google/protobuf/any.pb.h +++ b/src/google/protobuf/any.pb.h @@ -31,31 +31,33 @@ #include <google/protobuf/unknown_field_set.h> #include <google/protobuf/any.h> // @@protoc_insertion_point(includes) -namespace google { -namespace protobuf { -class Any; -class AnyDefaultTypeInternal; -LIBPROTOBUF_EXPORT extern AnyDefaultTypeInternal _Any_default_instance_; -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { namespace protobuf_google_2fprotobuf_2fany_2eproto { -// Internal implementation detail -- do not call these. +// Internal implementation detail -- do not use these members. struct LIBPROTOBUF_EXPORT TableStruct { static const ::google::protobuf::internal::ParseTableField entries[]; static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; - static const ::google::protobuf::internal::ParseTable schema[]; - static const ::google::protobuf::uint32 offsets[]; + static const ::google::protobuf::internal::ParseTable schema[1]; static const ::google::protobuf::internal::FieldMetadata field_metadata[]; static const ::google::protobuf::internal::SerializationTable serialization_table[]; - static void InitDefaultsImpl(); + static const ::google::protobuf::uint32 offsets[]; }; void LIBPROTOBUF_EXPORT AddDescriptors(); -void LIBPROTOBUF_EXPORT InitDefaults(); +void LIBPROTOBUF_EXPORT InitDefaultsAnyImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsAny(); +inline void LIBPROTOBUF_EXPORT InitDefaults() { + InitDefaultsAny(); +} } // namespace protobuf_google_2fprotobuf_2fany_2eproto +namespace google { +namespace protobuf { +class Any; +class AnyDefaultTypeInternal; +LIBPROTOBUF_EXPORT extern AnyDefaultTypeInternal _Any_default_instance_; +} // namespace protobuf +} // namespace google +namespace google { +namespace protobuf { // =================================================================== @@ -70,9 +72,25 @@ class LIBPROTOBUF_EXPORT Any : public ::google::protobuf::Message /* @@protoc_in CopyFrom(from); return *this; } + #if LANG_CXX11 + Any(Any&& from) noexcept + : Any() { + *this = ::std::move(from); + } + + inline Any& operator=(Any&& from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + #endif static const ::google::protobuf::Descriptor* descriptor(); static const Any& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Any* internal_default_instance() { return reinterpret_cast<const Any*>( &_Any_default_instance_); @@ -171,14 +189,14 @@ class LIBPROTOBUF_EXPORT Any : public ::google::protobuf::Message /* @@protoc_in ::google::protobuf::internal::ArenaStringPtr value_; mutable int _cached_size_; ::google::protobuf::internal::AnyMetadata _any_metadata_; - friend struct protobuf_google_2fprotobuf_2fany_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fany_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fany_2eproto::InitDefaultsAnyImpl(); }; // =================================================================== // =================================================================== -#if !PROTOBUF_INLINE_NOT_IN_HEADERS #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" @@ -294,11 +312,9 @@ inline void Any::set_allocated_value(::std::string* value) { #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ -#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc index 96a5074d..439a47c6 100644 --- a/src/google/protobuf/api.pb.cc +++ b/src/google/protobuf/api.pb.cc @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/api.proto -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #include <google/protobuf/api.pb.h> #include <algorithm> @@ -15,98 +14,146 @@ #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> +// This is a temporary google only hack +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS +#include "third_party/protobuf/version.h" +#endif // @@protoc_insertion_point(includes) - namespace google { namespace protobuf { class ApiDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<Api> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<Api> + _instance; } _Api_default_instance_; class MethodDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<Method> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<Method> + _instance; } _Method_default_instance_; class MixinDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<Mixin> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<Mixin> + _instance; } _Mixin_default_instance_; - +} // namespace protobuf +} // namespace google namespace protobuf_google_2fprotobuf_2fapi_2eproto { +void InitDefaultsApiImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaultsMethod(); + protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsOption(); + protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::InitDefaultsSourceContext(); + protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaultsMixin(); + { + void* ptr = &::google::protobuf::_Api_default_instance_; + new (ptr) ::google::protobuf::Api(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::Api::InitAsDefaultInstance(); +} -namespace { +void InitDefaultsApi() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsApiImpl); +} -::google::protobuf::Metadata file_level_metadata[3]; +void InitDefaultsMethodImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; -} // namespace +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsOption(); + { + void* ptr = &::google::protobuf::_Method_default_instance_; + new (ptr) ::google::protobuf::Method(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::Method::InitAsDefaultInstance(); +} -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField - const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0}, -}; +void InitDefaultsMethod() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsMethodImpl); +} -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField - const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - ::google::protobuf::internal::AuxillaryParseTableField(), -}; -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const - TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, -}; +void InitDefaultsMixinImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_Mixin_default_instance_; + new (ptr) ::google::protobuf::Mixin(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::Mixin::InitAsDefaultInstance(); +} -const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { +void InitDefaultsMixin() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsMixinImpl); +} + +::google::protobuf::Metadata file_level_metadata[3]; + +const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Api, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, methods_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, options_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, version_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, source_context_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, mixins_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, syntax_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Api, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Api, methods_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Api, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Api, version_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Api, source_context_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Api, mixins_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Api, syntax_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Method, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, request_type_url_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, request_streaming_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, response_type_url_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, response_streaming_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, options_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, syntax_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Method, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Method, request_type_url_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Method, request_streaming_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Method, response_type_url_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Method, response_streaming_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Method, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Method, syntax_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Mixin, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Mixin, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Mixin, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Mixin, root_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Mixin, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Mixin, root_), }; -static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(Api)}, - { 12, -1, sizeof(Method)}, - { 24, -1, sizeof(Mixin)}, +static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, sizeof(::google::protobuf::Api)}, + { 12, -1, sizeof(::google::protobuf::Method)}, + { 24, -1, sizeof(::google::protobuf::Mixin)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { - reinterpret_cast<const ::google::protobuf::Message*>(&_Api_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_Method_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_Mixin_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Api_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Method_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Mixin_default_instance_), }; -namespace { - void protobuf_AssignDescriptors() { AddDescriptors(); ::google::protobuf::MessageFactory* factory = NULL; @@ -120,37 +167,15 @@ void protobuf_AssignDescriptorsOnce() { ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); } -void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; +void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 3); } -} // namespace -void TableStruct::InitDefaultsImpl() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::internal::InitProtobufDefaults(); - ::google::protobuf::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::InitDefaults(); - ::google::protobuf::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults(); - _Api_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_Api_default_instance_);_Method_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_Method_default_instance_);_Mixin_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_Mixin_default_instance_);_Api_default_instance_._instance.get_mutable()->source_context_ = const_cast< ::google::protobuf::SourceContext*>( - ::google::protobuf::SourceContext::internal_default_instance()); -} - -void InitDefaults() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl); -} -namespace { void AddDescriptorsImpl() { InitDefaults(); - static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { "\n\031google/protobuf/api.proto\022\017google.prot" "obuf\032$google/protobuf/source_context.pro" "to\032\032google/protobuf/type.proto\"\201\002\n\003Api\022\014" @@ -175,10 +200,9 @@ void AddDescriptorsImpl() { descriptor, 750); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/api.proto", &protobuf_RegisterTypes); - ::google::protobuf::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::AddDescriptors(); - ::google::protobuf::protobuf_google_2fprotobuf_2ftype_2eproto::AddDescriptors(); + ::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::AddDescriptors(); + ::protobuf_google_2fprotobuf_2ftype_2eproto::AddDescriptors(); } -} // anonymous namespace void AddDescriptors() { static GOOGLE_PROTOBUF_DECLARE_ONCE(once); @@ -190,12 +214,25 @@ struct StaticDescriptorInitializer { AddDescriptors(); } } static_descriptor_initializer; - } // namespace protobuf_google_2fprotobuf_2fapi_2eproto - +namespace google { +namespace protobuf { // =================================================================== +void Api::InitAsDefaultInstance() { + ::google::protobuf::_Api_default_instance_._instance.get_mutable()->source_context_ = const_cast< ::google::protobuf::SourceContext*>( + ::google::protobuf::SourceContext::internal_default_instance()); +} +void Api::clear_options() { + options_.Clear(); +} +void Api::clear_source_context() { + if (GetArenaNoVirtual() == NULL && source_context_ != NULL) { + delete source_context_; + } + source_context_ = NULL; +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int Api::kNameFieldNumber; const int Api::kMethodsFieldNumber; @@ -209,7 +246,7 @@ const int Api::kSyntaxFieldNumber; Api::Api() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaultsApi(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.Api) @@ -265,12 +302,12 @@ void Api::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* Api::descriptor() { - protobuf_google_2fprotobuf_2fapi_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fapi_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const Api& Api::default_instance() { - protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaultsApi(); return *internal_default_instance(); } @@ -331,8 +368,7 @@ bool Api::MergePartialFromCodedStream( case 2: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_methods())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_methods())); } else { goto handle_unusual; } @@ -343,8 +379,7 @@ bool Api::MergePartialFromCodedStream( case 3: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_options())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options())); } else { goto handle_unusual; } @@ -371,7 +406,7 @@ bool Api::MergePartialFromCodedStream( case 5: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_source_context())); } else { goto handle_unusual; @@ -383,8 +418,7 @@ bool Api::MergePartialFromCodedStream( case 6: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(50u /* 50 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_mixins())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_mixins())); } else { goto handle_unusual; } @@ -514,7 +548,7 @@ void Api::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->methods_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 2, this->methods(static_cast<int>(i)), deterministic, target); } @@ -522,7 +556,7 @@ void Api::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 3, this->options(static_cast<int>(i)), deterministic, target); } @@ -540,7 +574,7 @@ void Api::SerializeWithCachedSizes( // .google.protobuf.SourceContext source_context = 5; if (this->has_source_context()) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 5, *this->source_context_, deterministic, target); } @@ -548,7 +582,7 @@ void Api::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->mixins_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 6, this->mixins(static_cast<int>(i)), deterministic, target); } @@ -581,7 +615,7 @@ size_t Api::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->methods(static_cast<int>(i))); } } @@ -592,7 +626,7 @@ size_t Api::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->options(static_cast<int>(i))); } } @@ -603,7 +637,7 @@ size_t Api::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->mixins(static_cast<int>(i))); } } @@ -625,7 +659,7 @@ size_t Api::ByteSizeLong() const { // .google.protobuf.SourceContext source_context = 5; if (this->has_source_context()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *this->source_context_); } @@ -720,266 +754,17 @@ void Api::InternalSwap(Api* other) { ::google::protobuf::Metadata Api::GetMetadata() const { protobuf_google_2fprotobuf_2fapi_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// Api - -// string name = 1; -void Api::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -const ::std::string& Api::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.Api.name) - return name_.GetNoArena(); -} -void Api::set_name(const ::std::string& value) { - - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.Api.name) -} -#if LANG_CXX11 -void Api::set_name(::std::string&& value) { - - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Api.name) -} -#endif -void Api::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.Api.name) -} -void Api::set_name(const char* value, size_t size) { - - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Api.name) -} -::std::string* Api::mutable_name() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.Api.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* Api::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.Api.name) - - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void Api::set_allocated_name(::std::string* name) { - if (name != NULL) { - - } else { - - } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.name) -} -// repeated .google.protobuf.Method methods = 2; -int Api::methods_size() const { - return methods_.size(); -} -void Api::clear_methods() { - methods_.Clear(); -} -const ::google::protobuf::Method& Api::methods(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.Api.methods) - return methods_.Get(index); -} -::google::protobuf::Method* Api::mutable_methods(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.Api.methods) - return methods_.Mutable(index); -} -::google::protobuf::Method* Api::add_methods() { - // @@protoc_insertion_point(field_add:google.protobuf.Api.methods) - return methods_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::Method >* -Api::mutable_methods() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.methods) - return &methods_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Method >& -Api::methods() const { - // @@protoc_insertion_point(field_list:google.protobuf.Api.methods) - return methods_; -} +// =================================================================== -// repeated .google.protobuf.Option options = 3; -int Api::options_size() const { - return options_.size(); +void Method::InitAsDefaultInstance() { } -void Api::clear_options() { +void Method::clear_options() { options_.Clear(); } -const ::google::protobuf::Option& Api::options(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.Api.options) - return options_.Get(index); -} -::google::protobuf::Option* Api::mutable_options(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.Api.options) - return options_.Mutable(index); -} -::google::protobuf::Option* Api::add_options() { - // @@protoc_insertion_point(field_add:google.protobuf.Api.options) - return options_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* -Api::mutable_options() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.options) - return &options_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& -Api::options() const { - // @@protoc_insertion_point(field_list:google.protobuf.Api.options) - return options_; -} - -// string version = 4; -void Api::clear_version() { - version_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -const ::std::string& Api::version() const { - // @@protoc_insertion_point(field_get:google.protobuf.Api.version) - return version_.GetNoArena(); -} -void Api::set_version(const ::std::string& value) { - - version_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.Api.version) -} -#if LANG_CXX11 -void Api::set_version(::std::string&& value) { - - version_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Api.version) -} -#endif -void Api::set_version(const char* value) { - GOOGLE_DCHECK(value != NULL); - - version_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.Api.version) -} -void Api::set_version(const char* value, size_t size) { - - version_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Api.version) -} -::std::string* Api::mutable_version() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.Api.version) - return version_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* Api::release_version() { - // @@protoc_insertion_point(field_release:google.protobuf.Api.version) - - return version_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void Api::set_allocated_version(::std::string* version) { - if (version != NULL) { - - } else { - - } - version_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), version); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.version) -} - -// .google.protobuf.SourceContext source_context = 5; -bool Api::has_source_context() const { - return this != internal_default_instance() && source_context_ != NULL; -} -void Api::clear_source_context() { - if (GetArenaNoVirtual() == NULL && source_context_ != NULL) delete source_context_; - source_context_ = NULL; -} -const ::google::protobuf::SourceContext& Api::source_context() const { - const ::google::protobuf::SourceContext* p = source_context_; - // @@protoc_insertion_point(field_get:google.protobuf.Api.source_context) - return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::SourceContext*>( - &::google::protobuf::_SourceContext_default_instance_); -} -::google::protobuf::SourceContext* Api::mutable_source_context() { - - if (source_context_ == NULL) { - source_context_ = new ::google::protobuf::SourceContext; - } - // @@protoc_insertion_point(field_mutable:google.protobuf.Api.source_context) - return source_context_; -} -::google::protobuf::SourceContext* Api::release_source_context() { - // @@protoc_insertion_point(field_release:google.protobuf.Api.source_context) - - ::google::protobuf::SourceContext* temp = source_context_; - source_context_ = NULL; - return temp; -} -void Api::set_allocated_source_context(::google::protobuf::SourceContext* source_context) { - delete source_context_; - source_context_ = source_context; - if (source_context) { - - } else { - - } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.source_context) -} - -// repeated .google.protobuf.Mixin mixins = 6; -int Api::mixins_size() const { - return mixins_.size(); -} -void Api::clear_mixins() { - mixins_.Clear(); -} -const ::google::protobuf::Mixin& Api::mixins(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.Api.mixins) - return mixins_.Get(index); -} -::google::protobuf::Mixin* Api::mutable_mixins(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.Api.mixins) - return mixins_.Mutable(index); -} -::google::protobuf::Mixin* Api::add_mixins() { - // @@protoc_insertion_point(field_add:google.protobuf.Api.mixins) - return mixins_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::Mixin >* -Api::mutable_mixins() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.mixins) - return &mixins_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Mixin >& -Api::mixins() const { - // @@protoc_insertion_point(field_list:google.protobuf.Api.mixins) - return mixins_; -} - -// .google.protobuf.Syntax syntax = 7; -void Api::clear_syntax() { - syntax_ = 0; -} -::google::protobuf::Syntax Api::syntax() const { - // @@protoc_insertion_point(field_get:google.protobuf.Api.syntax) - return static_cast< ::google::protobuf::Syntax >(syntax_); -} -void Api::set_syntax(::google::protobuf::Syntax value) { - - syntax_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Api.syntax) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int Method::kNameFieldNumber; const int Method::kRequestTypeUrlFieldNumber; @@ -993,7 +778,7 @@ const int Method::kSyntaxFieldNumber; Method::Method() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaultsMethod(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.Method) @@ -1049,12 +834,12 @@ void Method::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* Method::descriptor() { - protobuf_google_2fprotobuf_2fapi_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fapi_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const Method& Method::default_instance() { - protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaultsMethod(); return *internal_default_instance(); } @@ -1172,8 +957,7 @@ bool Method::MergePartialFromCodedStream( case 6: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(50u /* 50 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_options())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options())); } else { goto handle_unusual; } @@ -1335,7 +1119,7 @@ void Method::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 6, this->options(static_cast<int>(i)), deterministic, target); } @@ -1368,7 +1152,7 @@ size_t Method::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->options(static_cast<int>(i))); } } @@ -1500,247 +1284,14 @@ void Method::InternalSwap(Method* other) { ::google::protobuf::Metadata Method::GetMetadata() const { protobuf_google_2fprotobuf_2fapi_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// Method - -// string name = 1; -void Method::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -const ::std::string& Method::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.Method.name) - return name_.GetNoArena(); -} -void Method::set_name(const ::std::string& value) { - - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.Method.name) -} -#if LANG_CXX11 -void Method::set_name(::std::string&& value) { - - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Method.name) -} -#endif -void Method::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.Method.name) -} -void Method::set_name(const char* value, size_t size) { - - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.name) -} -::std::string* Method::mutable_name() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.Method.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* Method::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.Method.name) - - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void Method::set_allocated_name(::std::string* name) { - if (name != NULL) { - - } else { - - } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.name) -} - -// string request_type_url = 2; -void Method::clear_request_type_url() { - request_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -const ::std::string& Method::request_type_url() const { - // @@protoc_insertion_point(field_get:google.protobuf.Method.request_type_url) - return request_type_url_.GetNoArena(); -} -void Method::set_request_type_url(const ::std::string& value) { - - request_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.Method.request_type_url) -} -#if LANG_CXX11 -void Method::set_request_type_url(::std::string&& value) { - - request_type_url_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Method.request_type_url) -} -#endif -void Method::set_request_type_url(const char* value) { - GOOGLE_DCHECK(value != NULL); - - request_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.Method.request_type_url) -} -void Method::set_request_type_url(const char* value, size_t size) { - - request_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.request_type_url) -} -::std::string* Method::mutable_request_type_url() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.Method.request_type_url) - return request_type_url_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* Method::release_request_type_url() { - // @@protoc_insertion_point(field_release:google.protobuf.Method.request_type_url) - - return request_type_url_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void Method::set_allocated_request_type_url(::std::string* request_type_url) { - if (request_type_url != NULL) { - - } else { - - } - request_type_url_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), request_type_url); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.request_type_url) -} - -// bool request_streaming = 3; -void Method::clear_request_streaming() { - request_streaming_ = false; -} -bool Method::request_streaming() const { - // @@protoc_insertion_point(field_get:google.protobuf.Method.request_streaming) - return request_streaming_; -} -void Method::set_request_streaming(bool value) { - - request_streaming_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Method.request_streaming) -} - -// string response_type_url = 4; -void Method::clear_response_type_url() { - response_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -const ::std::string& Method::response_type_url() const { - // @@protoc_insertion_point(field_get:google.protobuf.Method.response_type_url) - return response_type_url_.GetNoArena(); -} -void Method::set_response_type_url(const ::std::string& value) { - - response_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.Method.response_type_url) -} -#if LANG_CXX11 -void Method::set_response_type_url(::std::string&& value) { - - response_type_url_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Method.response_type_url) -} -#endif -void Method::set_response_type_url(const char* value) { - GOOGLE_DCHECK(value != NULL); - - response_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.Method.response_type_url) -} -void Method::set_response_type_url(const char* value, size_t size) { - - response_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.response_type_url) -} -::std::string* Method::mutable_response_type_url() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.Method.response_type_url) - return response_type_url_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* Method::release_response_type_url() { - // @@protoc_insertion_point(field_release:google.protobuf.Method.response_type_url) - - return response_type_url_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void Method::set_allocated_response_type_url(::std::string* response_type_url) { - if (response_type_url != NULL) { - - } else { - - } - response_type_url_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), response_type_url); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.response_type_url) -} - -// bool response_streaming = 5; -void Method::clear_response_streaming() { - response_streaming_ = false; -} -bool Method::response_streaming() const { - // @@protoc_insertion_point(field_get:google.protobuf.Method.response_streaming) - return response_streaming_; -} -void Method::set_response_streaming(bool value) { - - response_streaming_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Method.response_streaming) -} - -// repeated .google.protobuf.Option options = 6; -int Method::options_size() const { - return options_.size(); -} -void Method::clear_options() { - options_.Clear(); -} -const ::google::protobuf::Option& Method::options(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.Method.options) - return options_.Get(index); -} -::google::protobuf::Option* Method::mutable_options(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.Method.options) - return options_.Mutable(index); -} -::google::protobuf::Option* Method::add_options() { - // @@protoc_insertion_point(field_add:google.protobuf.Method.options) - return options_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* -Method::mutable_options() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.Method.options) - return &options_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& -Method::options() const { - // @@protoc_insertion_point(field_list:google.protobuf.Method.options) - return options_; + return ::protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages]; } -// .google.protobuf.Syntax syntax = 7; -void Method::clear_syntax() { - syntax_ = 0; -} -::google::protobuf::Syntax Method::syntax() const { - // @@protoc_insertion_point(field_get:google.protobuf.Method.syntax) - return static_cast< ::google::protobuf::Syntax >(syntax_); -} -void Method::set_syntax(::google::protobuf::Syntax value) { - - syntax_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Method.syntax) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void Mixin::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int Mixin::kNameFieldNumber; const int Mixin::kRootFieldNumber; @@ -1749,7 +1300,7 @@ const int Mixin::kRootFieldNumber; Mixin::Mixin() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaultsMixin(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.Mixin) @@ -1792,12 +1343,12 @@ void Mixin::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* Mixin::descriptor() { - protobuf_google_2fprotobuf_2fapi_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fapi_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const Mixin& Mixin::default_instance() { - protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaultsMixin(); return *internal_default_instance(); } @@ -2046,122 +1597,11 @@ void Mixin::InternalSwap(Mixin* other) { ::google::protobuf::Metadata Mixin::GetMetadata() const { protobuf_google_2fprotobuf_2fapi_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fapi_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// Mixin - -// string name = 1; -void Mixin::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -const ::std::string& Mixin::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.Mixin.name) - return name_.GetNoArena(); -} -void Mixin::set_name(const ::std::string& value) { - - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.Mixin.name) -} -#if LANG_CXX11 -void Mixin::set_name(::std::string&& value) { - - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Mixin.name) -} -#endif -void Mixin::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.Mixin.name) -} -void Mixin::set_name(const char* value, size_t size) { - - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Mixin.name) -} -::std::string* Mixin::mutable_name() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.Mixin.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* Mixin::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.Mixin.name) - - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void Mixin::set_allocated_name(::std::string* name) { - if (name != NULL) { - - } else { - - } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.name) -} - -// string root = 2; -void Mixin::clear_root() { - root_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -const ::std::string& Mixin::root() const { - // @@protoc_insertion_point(field_get:google.protobuf.Mixin.root) - return root_.GetNoArena(); -} -void Mixin::set_root(const ::std::string& value) { - - root_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.Mixin.root) -} -#if LANG_CXX11 -void Mixin::set_root(::std::string&& value) { - - root_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Mixin.root) -} -#endif -void Mixin::set_root(const char* value) { - GOOGLE_DCHECK(value != NULL); - - root_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.Mixin.root) -} -void Mixin::set_root(const char* value, size_t size) { - - root_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Mixin.root) -} -::std::string* Mixin::mutable_root() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.Mixin.root) - return root_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* Mixin::release_root() { - // @@protoc_insertion_point(field_release:google.protobuf.Mixin.root) - - return root_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void Mixin::set_allocated_root(::std::string* root) { - if (root != NULL) { - - } else { - - } - root_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), root); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.root) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h index bed136db..e74528e1 100644 --- a/src/google/protobuf/api.pb.h +++ b/src/google/protobuf/api.pb.h @@ -32,6 +32,30 @@ #include <google/protobuf/source_context.pb.h> #include <google/protobuf/type.pb.h> // @@protoc_insertion_point(includes) + +namespace protobuf_google_2fprotobuf_2fapi_2eproto { +// Internal implementation detail -- do not use these members. +struct LIBPROTOBUF_EXPORT TableStruct { + static const ::google::protobuf::internal::ParseTableField entries[]; + static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; + static const ::google::protobuf::internal::ParseTable schema[3]; + static const ::google::protobuf::internal::FieldMetadata field_metadata[]; + static const ::google::protobuf::internal::SerializationTable serialization_table[]; + static const ::google::protobuf::uint32 offsets[]; +}; +void LIBPROTOBUF_EXPORT AddDescriptors(); +void LIBPROTOBUF_EXPORT InitDefaultsApiImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsApi(); +void LIBPROTOBUF_EXPORT InitDefaultsMethodImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsMethod(); +void LIBPROTOBUF_EXPORT InitDefaultsMixinImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsMixin(); +inline void LIBPROTOBUF_EXPORT InitDefaults() { + InitDefaultsApi(); + InitDefaultsMethod(); + InitDefaultsMixin(); +} +} // namespace protobuf_google_2fprotobuf_2fapi_2eproto namespace google { namespace protobuf { class Api; @@ -45,25 +69,9 @@ class MixinDefaultTypeInternal; LIBPROTOBUF_EXPORT extern MixinDefaultTypeInternal _Mixin_default_instance_; } // namespace protobuf } // namespace google - namespace google { namespace protobuf { -namespace protobuf_google_2fprotobuf_2fapi_2eproto { -// Internal implementation detail -- do not call these. -struct LIBPROTOBUF_EXPORT TableStruct { - static const ::google::protobuf::internal::ParseTableField entries[]; - static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; - static const ::google::protobuf::internal::ParseTable schema[]; - static const ::google::protobuf::uint32 offsets[]; - static const ::google::protobuf::internal::FieldMetadata field_metadata[]; - static const ::google::protobuf::internal::SerializationTable serialization_table[]; - static void InitDefaultsImpl(); -}; -void LIBPROTOBUF_EXPORT AddDescriptors(); -void LIBPROTOBUF_EXPORT InitDefaults(); -} // namespace protobuf_google_2fprotobuf_2fapi_2eproto - // =================================================================== class LIBPROTOBUF_EXPORT Api : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Api) */ { @@ -95,6 +103,7 @@ class LIBPROTOBUF_EXPORT Api : public ::google::protobuf::Message /* @@protoc_in static const ::google::protobuf::Descriptor* descriptor(); static const Api& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Api* internal_default_instance() { return reinterpret_cast<const Api*>( &_Api_default_instance_); @@ -216,8 +225,8 @@ class LIBPROTOBUF_EXPORT Api : public ::google::protobuf::Message /* @@protoc_in void clear_source_context(); static const int kSourceContextFieldNumber = 5; const ::google::protobuf::SourceContext& source_context() const; - ::google::protobuf::SourceContext* mutable_source_context(); ::google::protobuf::SourceContext* release_source_context(); + ::google::protobuf::SourceContext* mutable_source_context(); void set_allocated_source_context(::google::protobuf::SourceContext* source_context); // .google.protobuf.Syntax syntax = 7; @@ -238,7 +247,8 @@ class LIBPROTOBUF_EXPORT Api : public ::google::protobuf::Message /* @@protoc_in ::google::protobuf::SourceContext* source_context_; int syntax_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2fapi_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fapi_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaultsApiImpl(); }; // ------------------------------------------------------------------- @@ -271,6 +281,7 @@ class LIBPROTOBUF_EXPORT Method : public ::google::protobuf::Message /* @@protoc static const ::google::protobuf::Descriptor* descriptor(); static const Method& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Method* internal_default_instance() { return reinterpret_cast<const Method*>( &_Method_default_instance_); @@ -407,7 +418,8 @@ class LIBPROTOBUF_EXPORT Method : public ::google::protobuf::Message /* @@protoc bool response_streaming_; int syntax_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2fapi_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fapi_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaultsMethodImpl(); }; // ------------------------------------------------------------------- @@ -440,6 +452,7 @@ class LIBPROTOBUF_EXPORT Mixin : public ::google::protobuf::Message /* @@protoc_ static const ::google::protobuf::Descriptor* descriptor(); static const Mixin& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Mixin* internal_default_instance() { return reinterpret_cast<const Mixin*>( &_Mixin_default_instance_); @@ -527,14 +540,14 @@ class LIBPROTOBUF_EXPORT Mixin : public ::google::protobuf::Message /* @@protoc_ ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::internal::ArenaStringPtr root_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2fapi_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fapi_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaultsMixinImpl(); }; // =================================================================== // =================================================================== -#if !PROTOBUF_INLINE_NOT_IN_HEADERS #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" @@ -628,9 +641,6 @@ Api::methods() const { inline int Api::options_size() const { return options_.size(); } -inline void Api::clear_options() { - options_.Clear(); -} inline const ::google::protobuf::Option& Api::options(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Api.options) return options_.Get(index); @@ -711,16 +721,19 @@ inline void Api::set_allocated_version(::std::string* version) { inline bool Api::has_source_context() const { return this != internal_default_instance() && source_context_ != NULL; } -inline void Api::clear_source_context() { - if (GetArenaNoVirtual() == NULL && source_context_ != NULL) delete source_context_; - source_context_ = NULL; -} inline const ::google::protobuf::SourceContext& Api::source_context() const { const ::google::protobuf::SourceContext* p = source_context_; // @@protoc_insertion_point(field_get:google.protobuf.Api.source_context) return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::SourceContext*>( &::google::protobuf::_SourceContext_default_instance_); } +inline ::google::protobuf::SourceContext* Api::release_source_context() { + // @@protoc_insertion_point(field_release:google.protobuf.Api.source_context) + + ::google::protobuf::SourceContext* temp = source_context_; + source_context_ = NULL; + return temp; +} inline ::google::protobuf::SourceContext* Api::mutable_source_context() { if (source_context_ == NULL) { @@ -729,21 +742,22 @@ inline ::google::protobuf::SourceContext* Api::mutable_source_context() { // @@protoc_insertion_point(field_mutable:google.protobuf.Api.source_context) return source_context_; } -inline ::google::protobuf::SourceContext* Api::release_source_context() { - // @@protoc_insertion_point(field_release:google.protobuf.Api.source_context) - - ::google::protobuf::SourceContext* temp = source_context_; - source_context_ = NULL; - return temp; -} inline void Api::set_allocated_source_context(::google::protobuf::SourceContext* source_context) { - delete source_context_; - source_context_ = source_context; + ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); + if (message_arena == NULL) { + delete reinterpret_cast< ::google::protobuf::MessageLite*>(source_context_); + } if (source_context) { + ::google::protobuf::Arena* submessage_arena = NULL; + if (message_arena != submessage_arena) { + source_context = ::google::protobuf::internal::GetOwnedMessage( + message_arena, source_context, submessage_arena); + } } else { } + source_context_ = source_context; // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.source_context) } @@ -986,9 +1000,6 @@ inline void Method::set_response_streaming(bool value) { inline int Method::options_size() const { return options_.size(); } -inline void Method::clear_options() { - options_.Clear(); -} inline const ::google::protobuf::Option& Method::options(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Method.options) return options_.Get(index); @@ -1139,7 +1150,6 @@ inline void Mixin::set_allocated_root(::std::string* root) { #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ -#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // ------------------------------------------------------------------- // ------------------------------------------------------------------- @@ -1147,7 +1157,6 @@ inline void Mixin::set_allocated_root(::std::string* root) { // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/arena.cc b/src/google/protobuf/arena.cc index fe38f5dd..e9289988 100755 --- a/src/google/protobuf/arena.cc +++ b/src/google/protobuf/arena.cc @@ -38,6 +38,8 @@ #include <sanitizer/asan_interface.h> #endif // ADDRESS_SANITIZER +#include <google/protobuf/stubs/port.h> + namespace google { static const size_t kMinCleanupListElements = 8; static const size_t kMaxCleanupListElements = 64; // 1kB on 64-bit. @@ -64,90 +66,78 @@ GOOGLE_THREAD_LOCAL ArenaImpl::ThreadCache ArenaImpl::thread_cache_ = {-1, NULL} void ArenaImpl::Init() { lifecycle_id_ = lifecycle_id_generator_.GetNext(); - blocks_ = 0; - hint_ = 0; - space_allocated_ = 0; - owns_first_block_ = true; - - if (options_.initial_block != NULL && options_.initial_block_size > 0) { - GOOGLE_CHECK_GE(options_.initial_block_size, sizeof(Block)) - << ": Initial block size too small for header."; - - // Add first unowned block to list. - Block* first_block = reinterpret_cast<Block*>(options_.initial_block); - first_block->size = options_.initial_block_size; - first_block->pos = kHeaderSize; - first_block->next = NULL; - first_block->cleanup = NULL; + google::protobuf::internal::NoBarrier_Store(&hint_, 0); + google::protobuf::internal::NoBarrier_Store(&threads_, 0); + + if (initial_block_) { // Thread which calls Init() owns the first block. This allows the - // single-threaded case to allocate on the first block without taking any - // locks. - first_block->owner = &thread_cache(); - AddBlockInternal(first_block); - CacheBlock(first_block); - owns_first_block_ = false; + // single-threaded case to allocate on the first block without having to + // perform atomic operations. + InitBlock(initial_block_, &thread_cache(), options_.initial_block_size); + ThreadInfo* info = NewThreadInfo(initial_block_); + info->next = NULL; + google::protobuf::internal::NoBarrier_Store(&threads_, + reinterpret_cast<google::protobuf::internal::AtomicWord>(info)); + google::protobuf::internal::NoBarrier_Store(&space_allocated_, + options_.initial_block_size); + CacheBlock(initial_block_); + } else { + google::protobuf::internal::NoBarrier_Store(&space_allocated_, 0); } } -ArenaImpl::~ArenaImpl() { ResetInternal(); } - -uint64 ArenaImpl::Reset() { - // Invalidate any ThreadCaches pointing to any blocks we just destroyed. - lifecycle_id_ = lifecycle_id_generator_.GetNext(); - return ResetInternal(); +ArenaImpl::~ArenaImpl() { + // Have to do this in a first pass, because some of the destructors might + // refer to memory in other blocks. + CleanupList(); + FreeBlocks(); } -uint64 ArenaImpl::ResetInternal() { - Block* head = - reinterpret_cast<Block*>(google::protobuf::internal::NoBarrier_Load(&blocks_)); - CleanupList(head); - uint64 space_allocated = FreeBlocks(head); +uint64 ArenaImpl::Reset() { + // Have to do this in a first pass, because some of the destructors might + // refer to memory in other blocks. + CleanupList(); + uint64 space_allocated = FreeBlocks(); + Init(); return space_allocated; } ArenaImpl::Block* ArenaImpl::NewBlock(void* me, Block* my_last_block, - size_t min_bytes, size_t start_block_size, - size_t max_block_size) { + size_t min_bytes) { size_t size; if (my_last_block != NULL) { // Double the current block size, up to a limit. - size = std::min(2 * my_last_block->size, max_block_size); + size = std::min(2 * my_last_block->size, options_.max_block_size); } else { - size = start_block_size; + size = options_.start_block_size; } // Verify that min_bytes + kHeaderSize won't overflow. GOOGLE_CHECK_LE(min_bytes, std::numeric_limits<size_t>::max() - kHeaderSize); size = std::max(size, kHeaderSize + min_bytes); Block* b = reinterpret_cast<Block*>(options_.block_alloc(size)); + InitBlock(b, me, size); + google::protobuf::internal::NoBarrier_AtomicIncrement(&space_allocated_, size); + return b; +} + +void ArenaImpl::InitBlock(Block* b, void *me, size_t size) { b->pos = kHeaderSize; b->size = size; b->owner = me; - b->cleanup = NULL; + b->next = NULL; #ifdef ADDRESS_SANITIZER // Poison the rest of the block for ASAN. It was unpoisoned by the underlying // malloc but it's not yet usable until we return it as part of an allocation. ASAN_POISON_MEMORY_REGION( reinterpret_cast<char*>(b) + b->pos, b->size - b->pos); #endif // ADDRESS_SANITIZER - AddBlock(b); - return b; -} - -void ArenaImpl::AddBlock(Block* b) { - MutexLock l(&blocks_lock_); - AddBlockInternal(b); -} - -void ArenaImpl::AddBlockInternal(Block* b) { - b->next = reinterpret_cast<Block*>(google::protobuf::internal::NoBarrier_Load(&blocks_)); - google::protobuf::internal::Release_Store(&blocks_, reinterpret_cast<google::protobuf::internal::AtomicWord>(b)); - space_allocated_ += b->size; } -ArenaImpl::Block* ArenaImpl::ExpandCleanupList(Block* b) { - size_t size = b->cleanup ? b->cleanup->size * 2 : kMinCleanupListElements; +ArenaImpl::CleanupChunk* ArenaImpl::ExpandCleanupList(CleanupChunk* cleanup, + Block* b) { + size_t size = cleanup ? cleanup->size * 2 : kMinCleanupListElements; size = std::min(size, kMaxCleanupListElements); size_t bytes = internal::AlignUpTo8(CleanupChunk::SizeOf(size)); if (b->avail() < bytes) { @@ -155,23 +145,25 @@ ArenaImpl::Block* ArenaImpl::ExpandCleanupList(Block* b) { } CleanupChunk* list = reinterpret_cast<CleanupChunk*>(AllocFromBlock(b, bytes)); - list->next = b->cleanup; + list->next = b->thread_info->cleanup; list->size = size; list->len = 0; - b->cleanup = list; - return b; + b->thread_info->cleanup = list; + return list; } -inline GOOGLE_ATTRIBUTE_ALWAYS_INLINE void ArenaImpl::AddCleanupInBlock( - Block* b, void* elem, void (*cleanup)(void*)) { - if (b->cleanup == NULL || b->cleanup->len == b->cleanup->size) { - b = ExpandCleanupList(b); +inline GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE +void ArenaImpl::AddCleanupInBlock( + Block* b, void* elem, void (*func)(void*)) { + CleanupChunk* cleanup = b->thread_info->cleanup; + if (cleanup == NULL || cleanup->len == cleanup->size) { + cleanup = ExpandCleanupList(cleanup, b); } - CleanupNode* node = &b->cleanup->nodes[b->cleanup->len++]; + CleanupNode* node = &cleanup->nodes[cleanup->len++]; node->elem = elem; - node->cleanup = cleanup; + node->cleanup = func; } void ArenaImpl::AddCleanup(void* elem, void (*cleanup)(void*)) { @@ -194,7 +186,8 @@ void* ArenaImpl::AllocateAlignedAndAddCleanup(size_t n, return mem; } -inline GOOGLE_ATTRIBUTE_ALWAYS_INLINE ArenaImpl::Block* ArenaImpl::GetBlock(size_t n) { +inline GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE +ArenaImpl::Block* ArenaImpl::GetBlock(size_t n) { Block* my_block = NULL; // If this thread already owns a block in this arena then try to use that. @@ -221,8 +214,8 @@ inline GOOGLE_ATTRIBUTE_ALWAYS_INLINE ArenaImpl::Block* ArenaImpl::GetBlock(size return GetBlockSlow(tc, my_block, n); } -inline GOOGLE_ATTRIBUTE_ALWAYS_INLINE void* ArenaImpl::AllocFromBlock(Block* b, - size_t n) { +inline GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE +void* ArenaImpl::AllocFromBlock(Block* b, size_t n) { GOOGLE_DCHECK_EQ(internal::AlignUpTo8(b->pos), b->pos); // Must be already aligned. GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned. GOOGLE_DCHECK_GE(b->avail(), n); @@ -236,92 +229,82 @@ inline GOOGLE_ATTRIBUTE_ALWAYS_INLINE void* ArenaImpl::AllocFromBlock(Block* b, ArenaImpl::Block* ArenaImpl::GetBlockSlow(void* me, Block* my_full_block, size_t n) { - Block* b = FindBlock(me); // Find block owned by me. - if (b == NULL || b->avail() < n) { - b = NewBlock(me, b, n, options_.start_block_size, options_.max_block_size); - - // Try to steal the cleanup list from my_full_block. It's too full for this - // allocation, but it might have space left in its cleanup list and there's - // no reason to waste that memory. - if (my_full_block) { - GOOGLE_DCHECK_EQ(my_full_block->owner, me); - GOOGLE_DCHECK(b->cleanup == NULL); - b->cleanup = my_full_block->cleanup; - my_full_block->cleanup = NULL; - } + ThreadInfo* info = + my_full_block ? my_full_block->thread_info : GetThreadInfo(me, n); + GOOGLE_DCHECK(info != NULL); + Block* b = info->head; + if (b->avail() < n) { + Block* new_b = NewBlock(me, b, n); + new_b->thread_info = info; + new_b->next = b; + info->head = new_b; + b = new_b; } CacheBlock(b); return b; } uint64 ArenaImpl::SpaceAllocated() const { - MutexLock l(&blocks_lock_); - return space_allocated_; + return google::protobuf::internal::NoBarrier_Load(&space_allocated_); } uint64 ArenaImpl::SpaceUsed() const { + ThreadInfo* info = + reinterpret_cast<ThreadInfo*>(google::protobuf::internal::Acquire_Load(&threads_)); uint64 space_used = 0; - Block* b = reinterpret_cast<Block*>(google::protobuf::internal::NoBarrier_Load(&blocks_)); - while (b != NULL) { - space_used += (b->pos - kHeaderSize); - b = b->next; + + for ( ; info; info = info->next) { + // Remove the overhead of the ThreadInfo itself. + space_used -= sizeof(ThreadInfo); + for (Block* b = info->head; b; b = b->next) { + space_used += (b->pos - kHeaderSize); + } } + return space_used; } -uint64 ArenaImpl::FreeBlocks(Block* head) { +uint64 ArenaImpl::FreeBlocks() { uint64 space_allocated = 0; - Block* first_block = NULL; - Block* b = head; + // By omitting an Acquire barrier we ensure that any user code that doesn't + // properly synchronize Reset() or the destructor will throw a TSAN warning. + ThreadInfo* info = + reinterpret_cast<ThreadInfo*>(google::protobuf::internal::NoBarrier_Load(&threads_)); + + while (info) { + // This is inside the block we are freeing, so we need to read it now. + ThreadInfo* next_info = info->next; + for (Block* b = info->head; b; ) { + // This is inside the block we are freeing, so we need to read it now. + Block* next_block = b->next; + space_allocated += (b->size); - while (b != NULL) { - space_allocated += (b->size); - Block* next = b->next; - if (next != NULL) { #ifdef ADDRESS_SANITIZER // This memory was provided by the underlying allocator as unpoisoned, so // return it in an unpoisoned state. ASAN_UNPOISON_MEMORY_REGION(reinterpret_cast<char*>(b), b->size); #endif // ADDRESS_SANITIZER - options_.block_dealloc(b, b->size); - } else { - if (owns_first_block_) { -#ifdef ADDRESS_SANITIZER - // This memory was provided by the underlying allocator as unpoisoned, - // so return it in an unpoisoned state. - ASAN_UNPOISON_MEMORY_REGION(reinterpret_cast<char*>(b), b->size); -#endif // ADDRESS_SANITIZER + + if (b != initial_block_) { options_.block_dealloc(b, b->size); - } else { - // User passed in the first block, skip free'ing the memory. - first_block = b; } + + b = next_block; } - b = next; - } - blocks_ = 0; - hint_ = 0; - space_allocated_ = 0; - if (!owns_first_block_) { - // Make the first block that was passed in through ArenaOptions - // available for reuse. - first_block->pos = kHeaderSize; - first_block->cleanup = NULL; - // Thread which calls Reset() owns the first block. This allows the - // single-threaded case to allocate on the first block without taking any - // locks. - first_block->owner = &thread_cache(); - AddBlockInternal(first_block); - CacheBlock(first_block); + info = next_info; } + return space_allocated; } -void ArenaImpl::CleanupList(Block* head) { - // Have to do this in a first pass, because some of the destructors might - // refer to memory in other blocks. - for (Block* b = head; b; b = b->next) { - CleanupChunk* list = b->cleanup; +void ArenaImpl::CleanupList() { + // By omitting an Acquire barrier we ensure that any user code that doesn't + // properly synchronize Reset() or the destructor will throw a TSAN warning. + ThreadInfo* info = + reinterpret_cast<ThreadInfo*>(google::protobuf::internal::NoBarrier_Load(&threads_)); + + for ( ; info; info = info->next) { + CleanupChunk* list = info->cleanup; while (list) { size_t n = list->len; CleanupNode* node = &list->nodes[list->len - 1]; @@ -330,22 +313,67 @@ void ArenaImpl::CleanupList(Block* head) { } list = list->next; } - b->cleanup = NULL; } } -ArenaImpl::Block* ArenaImpl::FindBlock(void* me) { - // TODO(sanjay): We might want to keep a separate list with one - // entry per thread. - Block* b = reinterpret_cast<Block*>(google::protobuf::internal::Acquire_Load(&blocks_)); - while (b != NULL && b->owner != me) { - b = b->next; +ArenaImpl::ThreadInfo* ArenaImpl::NewThreadInfo(Block* b) { + GOOGLE_DCHECK(FindThreadInfo(b->owner) == NULL); + ThreadInfo* info = + reinterpret_cast<ThreadInfo*>(AllocFromBlock(b, sizeof(ThreadInfo))); + b->thread_info = info; + info->owner = b->owner; + info->head = b; + info->cleanup = NULL; + return info; +} + +ArenaImpl::ThreadInfo* ArenaImpl::FindThreadInfo(void* me) { + ThreadInfo* info = + reinterpret_cast<ThreadInfo*>(google::protobuf::internal::Acquire_Load(&threads_)); + for ( ; info; info = info->next) { + if (info->owner == me) { + return info; + } } - return b; + + return NULL; +} + +ArenaImpl::ThreadInfo* ArenaImpl::GetThreadInfo(void* me, size_t n) { + ThreadInfo* info = FindThreadInfo(me); + + if (!info) { + // This thread doesn't have any ThreadInfo, which also means it doesn't have + // any blocks yet. So we'll allocate its first block now. + Block* b = NewBlock(me, NULL, sizeof(ThreadInfo) + n); + info = NewThreadInfo(b); + + google::protobuf::internal::AtomicWord head; + do { + head = google::protobuf::internal::NoBarrier_Load(&threads_); + info->next = reinterpret_cast<ThreadInfo*>(head); + } while (google::protobuf::internal::Release_CompareAndSwap( + &threads_, head, reinterpret_cast<google::protobuf::internal::AtomicWord>(info)) != head); + } + + return info; } } // namespace internal +void Arena::CallDestructorHooks() { + uint64 space_allocated = impl_.SpaceAllocated(); + // Call the reset hook + if (on_arena_reset_ != NULL) { + on_arena_reset_(this, hooks_cookie_, space_allocated); + } + + // Call the destruction hook + if (on_arena_destruction_ != NULL) { + on_arena_destruction_(this, hooks_cookie_, space_allocated); + } +} + void Arena::OnArenaAllocation(const std::type_info* allocated_type, size_t n) const { if (on_arena_allocation_ != NULL) { diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h index 78e8d902..32be9a17 100644 --- a/src/google/protobuf/arena.h +++ b/src/google/protobuf/arena.h @@ -52,6 +52,7 @@ using type_info = ::type_info; #endif #include <google/protobuf/arena_impl.h> +#include <google/protobuf/stubs/port.h> namespace google { namespace protobuf { @@ -60,7 +61,7 @@ class Arena; // defined below class Message; // message.h namespace internal { -class ArenaString; // arenastring.h +struct ArenaStringPtr; // arenastring.h class LazyField; // lazy_field.h template<typename Type> @@ -222,20 +223,21 @@ class LIBPROTOBUF_EXPORT Arena { Init(options); } + // Block overhead. Use this as a guide for how much to over-allocate the + // initial block if you want an allocation of size N to fit inside it. + // + // WARNING: if you allocate multiple objects, it is difficult to guarantee + // that a series of allocations will fit in the initial block, especially if + // Arena changes its alignment guarantees in the future! + static const size_t kBlockOverhead = internal::ArenaImpl::kHeaderSize; + // Default constructor with sensible default options, tuned for average // use-cases. Arena() : impl_(ArenaOptions()) { Init(ArenaOptions()); } ~Arena() { - uint64 space_allocated = SpaceAllocated(); - // Call the reset hook - if (on_arena_reset_ != NULL) { - on_arena_reset_(this, hooks_cookie_, space_allocated); - } - - // Call the destruction hook - if (on_arena_destruction_ != NULL) { - on_arena_destruction_(this, hooks_cookie_, space_allocated); + if (on_arena_reset_ != NULL || on_arena_destruction_ != NULL) { + CallDestructorHooks(); } } @@ -261,7 +263,21 @@ class LIBPROTOBUF_EXPORT Arena { // // This function also accepts any type T that satisfies the arena message // allocation protocol, documented above. - template <typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE +#if LANG_CXX11 + template <typename T, typename... Args> + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* CreateMessage( + ::google::protobuf::Arena* arena, Args&&... args) { + static_assert( + InternalHelper<T>::is_arena_constructable::value, + "CreateMessage can only construct types that are ArenaConstructable"); + if (arena == NULL) { + return new T(NULL, std::forward<Args>(args)...); + } else { + return arena->CreateMessageInternal<T>(std::forward<Args>(args)...); + } + } +#endif + template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* CreateMessage(::google::protobuf::Arena* arena) { #if LANG_CXX11 static_assert( @@ -278,7 +294,7 @@ class LIBPROTOBUF_EXPORT Arena { // One-argument form of CreateMessage. This is useful for constructing objects // that implement the arena message construction protocol described above but // take additional constructor arguments. - template <typename T, typename Arg> GOOGLE_ATTRIBUTE_ALWAYS_INLINE + template <typename T, typename Arg> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* CreateMessage(::google::protobuf::Arena* arena, const Arg& arg) { #if LANG_CXX11 static_assert( @@ -295,7 +311,8 @@ class LIBPROTOBUF_EXPORT Arena { // Two-argument form of CreateMessage. This is useful for constructing objects // that implement the arena message construction protocol described above but // take additional constructor arguments. - template <typename T, typename Arg1, typename Arg2> GOOGLE_ATTRIBUTE_ALWAYS_INLINE + template <typename T, typename Arg1, typename Arg2> + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* CreateMessage(::google::protobuf::Arena* arena, const Arg1& arg1, const Arg2& arg2) { @@ -327,7 +344,8 @@ class LIBPROTOBUF_EXPORT Arena { // if the object were allocated on the heap (except that the underlying memory // is obtained from the arena). #if LANG_CXX11 - template <typename T, typename... Args> GOOGLE_ATTRIBUTE_ALWAYS_INLINE + template <typename T, typename... Args> + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* Create(::google::protobuf::Arena* arena, Args&&... args) { if (arena == NULL) { return new T(std::forward<Args>(args)...); @@ -337,7 +355,7 @@ class LIBPROTOBUF_EXPORT Arena { } } #endif - template <typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE + template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* Create(::google::protobuf::Arena* arena) { if (arena == NULL) { return new T(); @@ -347,7 +365,7 @@ class LIBPROTOBUF_EXPORT Arena { } // Version of the above with one constructor argument for the created object. - template <typename T, typename Arg> GOOGLE_ATTRIBUTE_ALWAYS_INLINE + template <typename T, typename Arg> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* Create(::google::protobuf::Arena* arena, const Arg& arg) { if (arena == NULL) { return new T(arg); @@ -358,7 +376,8 @@ class LIBPROTOBUF_EXPORT Arena { } // Version of the above with two constructor arguments for the created object. - template <typename T, typename Arg1, typename Arg2> GOOGLE_ATTRIBUTE_ALWAYS_INLINE + template <typename T, typename Arg1, typename Arg2> + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* Create(::google::protobuf::Arena* arena, const Arg1& arg1, const Arg2& arg2) { if (arena == NULL) { return new T(arg1, arg2); @@ -371,9 +390,11 @@ class LIBPROTOBUF_EXPORT Arena { // Version of the above with three constructor arguments for the created // object. template <typename T, typename Arg1, typename Arg2, typename Arg3> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE static T* Create(::google::protobuf::Arena* arena, - const Arg1& arg1, const Arg2& arg2, - const Arg3& arg3) { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + static T* Create(::google::protobuf::Arena* arena, + const Arg1& arg1, + const Arg2& arg2, + const Arg3& arg3) { if (arena == NULL) { return new T(arg1, arg2, arg3); } else { @@ -386,9 +407,10 @@ class LIBPROTOBUF_EXPORT Arena { // object. template <typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE static T* Create(::google::protobuf::Arena* arena, - const Arg1& arg1, const Arg2& arg2, - const Arg3& arg3, const Arg4& arg4) { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + static T* Create(::google::protobuf::Arena* arena, + const Arg1& arg1, const Arg2& arg2, + const Arg3& arg3, const Arg4& arg4) { if (arena == NULL) { return new T(arg1, arg2, arg3, arg4); } else { @@ -401,10 +423,11 @@ class LIBPROTOBUF_EXPORT Arena { // object. template <typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE static T* Create(::google::protobuf::Arena* arena, - const Arg1& arg1, const Arg2& arg2, - const Arg3& arg3, const Arg4& arg4, - const Arg5& arg5) { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + static T* Create(::google::protobuf::Arena* arena, + const Arg1& arg1, const Arg2& arg2, + const Arg3& arg3, const Arg4& arg4, + const Arg5& arg5) { if (arena == NULL) { return new T(arg1, arg2, arg3, arg4, arg5); } else { @@ -417,10 +440,11 @@ class LIBPROTOBUF_EXPORT Arena { // object. template <typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5, typename Arg6> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE static T* Create(::google::protobuf::Arena* arena, - const Arg1& arg1, const Arg2& arg2, - const Arg3& arg3, const Arg4& arg4, - const Arg5& arg5, const Arg6& arg6) { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + static T* Create(::google::protobuf::Arena* arena, + const Arg1& arg1, const Arg2& arg2, + const Arg3& arg3, const Arg4& arg4, + const Arg5& arg5, const Arg6& arg6) { if (arena == NULL) { return new T(arg1, arg2, arg3, arg4, arg5, arg6); } else { @@ -433,11 +457,12 @@ class LIBPROTOBUF_EXPORT Arena { // object. template <typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5, typename Arg6, typename Arg7> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE static T* Create(::google::protobuf::Arena* arena, - const Arg1& arg1, const Arg2& arg2, - const Arg3& arg3, const Arg4& arg4, - const Arg5& arg5, const Arg6& arg6, - const Arg7& arg7) { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + static T* Create(::google::protobuf::Arena* arena, + const Arg1& arg1, const Arg2& arg2, + const Arg3& arg3, const Arg4& arg4, + const Arg5& arg5, const Arg6& arg6, + const Arg7& arg7) { if (arena == NULL) { return new T(arg1, arg2, arg3, arg4, arg5, arg6, arg7); } else { @@ -451,11 +476,12 @@ class LIBPROTOBUF_EXPORT Arena { template <typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5, typename Arg6, typename Arg7, typename Arg8> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE static T* Create(::google::protobuf::Arena* arena, - const Arg1& arg1, const Arg2& arg2, - const Arg3& arg3, const Arg4& arg4, - const Arg5& arg5, const Arg6& arg6, - const Arg7& arg7, const Arg8& arg8) { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + static T* Create(::google::protobuf::Arena* arena, + const Arg1& arg1, const Arg2& arg2, + const Arg3& arg3, const Arg4& arg4, + const Arg5& arg5, const Arg6& arg6, + const Arg7& arg7, const Arg8& arg8) { if (arena == NULL) { return new T(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); } else { @@ -471,7 +497,7 @@ class LIBPROTOBUF_EXPORT Arena { // To ensure safe uses, this function checks at compile time // (when compiled as C++11) that T is trivially default-constructible and // trivially destructible. - template <typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE + template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* CreateArray(::google::protobuf::Arena* arena, size_t num_elements) { GOOGLE_CHECK_LE(num_elements, std::numeric_limits<size_t>::max() / sizeof(T)) @@ -505,18 +531,17 @@ class LIBPROTOBUF_EXPORT Arena { // Any objects allocated on this arena are unusable after this call. It also // returns the total space used by the arena which is the sums of the sizes // of the allocated blocks. This method is not thread-safe. - GOOGLE_ATTRIBUTE_NOINLINE uint64 Reset() { - uint64 space_allocated = SpaceAllocated(); + GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE uint64 Reset() { // Call the reset hook if (on_arena_reset_ != NULL) { - on_arena_reset_(this, hooks_cookie_, space_allocated); + on_arena_reset_(this, hooks_cookie_, impl_.SpaceAllocated()); } return impl_.Reset(); } // Adds |object| to a list of heap-allocated objects to be freed with |delete| // when the arena is destroyed or reset. - template <typename T> GOOGLE_ATTRIBUTE_NOINLINE + template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE void Own(T* object) { OwnInternal(object, google::protobuf::internal::is_convertible<T*, ::google::protobuf::Message*>()); } @@ -526,7 +551,7 @@ class LIBPROTOBUF_EXPORT Arena { // that it does not free the underlying memory with |delete|; hence, it is // normally only used for objects that are placement-newed into // arena-allocated memory. - template <typename T> GOOGLE_ATTRIBUTE_NOINLINE + template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE void OwnDestructor(T* object) { if (object != NULL) { impl_.AddCleanup(object, &internal::arena_destruct_object<T>); @@ -537,8 +562,8 @@ class LIBPROTOBUF_EXPORT Arena { // will be manually called when the arena is destroyed or reset. This differs // from OwnDestructor() in that any member function may be specified, not only // the class destructor. - GOOGLE_ATTRIBUTE_NOINLINE void OwnCustomDestructor(void* object, - void (*destruct)(void*)) { + GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE void OwnCustomDestructor( + void* object, void (*destruct)(void*)) { impl_.AddCleanup(object, destruct); } @@ -546,7 +571,7 @@ class LIBPROTOBUF_EXPORT Arena { // message, or NULL otherwise. This differs from value->GetArena() in that the // latter is a virtual call, while this method is a templated call that // resolves at compile-time. - template<typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE + template<typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static ::google::protobuf::Arena* GetArena(const T* value) { return GetArenaInternal(value, is_arena_constructable<T>()); } @@ -612,6 +637,7 @@ class LIBPROTOBUF_EXPORT Arena { struct is_arena_constructable : InternalHelper<T>::is_arena_constructable {}; private: + void CallDestructorHooks(); void OnArenaAllocation(const std::type_info* allocated_type, size_t n) const; inline void AllocHook(const std::type_info* allocated_type, size_t n) const { if (GOOGLE_PREDICT_FALSE(hooks_cookie_ != NULL)) { @@ -622,7 +648,7 @@ class LIBPROTOBUF_EXPORT Arena { // Allocate and also optionally call on_arena_allocation callback with the // allocated type info when the hooks are in place in ArenaOptions and // the cookie is not null. - template<typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE + template<typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void* AllocateInternal(bool skip_explicit_ownership) { const size_t n = internal::AlignUpTo8(sizeof(T)); AllocHook(RTTI_TYPE_ID(T), n); @@ -640,26 +666,24 @@ class LIBPROTOBUF_EXPORT Arena { // as it can cause confusing API usages, and end up having double free in // user code. These are used only internally from LazyField and Repeated // fields, since they are designed to work in all mode combinations. - template <typename Msg> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE static Msg* CreateMaybeMessage(Arena* arena, - google::protobuf::internal::true_type) { + template <typename Msg> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + static Msg* CreateMaybeMessage(Arena* arena, google::protobuf::internal::true_type) { return CreateMessage<Msg>(arena); } - template <typename T> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE static T* CreateMaybeMessage(Arena* arena, - google::protobuf::internal::false_type) { + template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + static T* CreateMaybeMessage(Arena* arena, google::protobuf::internal::false_type) { return Create<T>(arena); } - template <typename T> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE static T* CreateMaybeMessage(Arena* arena) { + template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + static T* CreateMaybeMessage(Arena* arena) { return CreateMaybeMessage<T>(arena, is_arena_constructable<T>()); } // Just allocate the required size for the given type assuming the // type has a trivial constructor. - template<typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE + template<typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE T* CreateInternalRawArray(size_t num_elements) { GOOGLE_CHECK_LE(num_elements, std::numeric_limits<size_t>::max() / sizeof(T)) @@ -671,84 +695,91 @@ class LIBPROTOBUF_EXPORT Arena { } #if LANG_CXX11 - template <typename T, typename... Args> GOOGLE_ATTRIBUTE_ALWAYS_INLINE + template <typename T, typename... Args> + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE T* CreateInternal(bool skip_explicit_ownership, Args&&... args) { return new (AllocateInternal<T>(skip_explicit_ownership)) T(std::forward<Args>(args)...); } #else - template <typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE + template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE T* CreateInternal(bool skip_explicit_ownership) { return new (AllocateInternal<T>(skip_explicit_ownership)) T(); } - template <typename T, typename Arg> GOOGLE_ATTRIBUTE_ALWAYS_INLINE + template <typename T, typename Arg> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE T* CreateInternal(bool skip_explicit_ownership, const Arg& arg) { return new (AllocateInternal<T>(skip_explicit_ownership)) T(arg); } template <typename T, typename Arg1, typename Arg2> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateInternal(bool skip_explicit_ownership, - const Arg1& arg1, - const Arg2& arg2) { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + T* CreateInternal(bool skip_explicit_ownership, + const Arg1& arg1, + const Arg2& arg2) { return new (AllocateInternal<T>(skip_explicit_ownership)) T(arg1, arg2); } template <typename T, typename Arg1, typename Arg2, typename Arg3> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateInternal(bool skip_explicit_ownership, - const Arg1& arg1, - const Arg2& arg2, - const Arg3& arg3) { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + T* CreateInternal(bool skip_explicit_ownership, + const Arg1& arg1, + const Arg2& arg2, + const Arg3& arg3) { return new (AllocateInternal<T>(skip_explicit_ownership)) T(arg1, arg2, arg3); } template <typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateInternal(bool skip_explicit_ownership, - const Arg1& arg1, - const Arg2& arg2, - const Arg3& arg3, - const Arg4& arg4) { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + T* CreateInternal(bool skip_explicit_ownership, + const Arg1& arg1, + const Arg2& arg2, + const Arg3& arg3, + const Arg4& arg4) { return new (AllocateInternal<T>(skip_explicit_ownership)) T(arg1, arg2, arg3, arg4); } template <typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateInternal(bool skip_explicit_ownership, - const Arg1& arg1, - const Arg2& arg2, - const Arg3& arg3, - const Arg4& arg4, - const Arg5& arg5) { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + T* CreateInternal(bool skip_explicit_ownership, + const Arg1& arg1, + const Arg2& arg2, + const Arg3& arg3, + const Arg4& arg4, + const Arg5& arg5) { return new (AllocateInternal<T>(skip_explicit_ownership)) T(arg1, arg2, arg3, arg4, arg5); } template <typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5, typename Arg6> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateInternal(bool skip_explicit_ownership, - const Arg1& arg1, - const Arg2& arg2, - const Arg3& arg3, - const Arg4& arg4, - const Arg5& arg5, - const Arg6& arg6) { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + T* CreateInternal(bool skip_explicit_ownership, + const Arg1& arg1, + const Arg2& arg2, + const Arg3& arg3, + const Arg4& arg4, + const Arg5& arg5, + const Arg6& arg6) { return new (AllocateInternal<T>(skip_explicit_ownership)) T(arg1, arg2, arg3, arg4, arg5, arg6); } template <typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5, typename Arg6, typename Arg7> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateInternal(bool skip_explicit_ownership, - const Arg1& arg1, - const Arg2& arg2, - const Arg3& arg3, - const Arg4& arg4, - const Arg5& arg5, - const Arg6& arg6, - const Arg7& arg7) { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + T* CreateInternal(bool skip_explicit_ownership, + const Arg1& arg1, + const Arg2& arg2, + const Arg3& arg3, + const Arg4& arg4, + const Arg5& arg5, + const Arg6& arg6, + const Arg7& arg7) { return new (AllocateInternal<T>(skip_explicit_ownership)) T(arg1, arg2, arg3, arg4, arg5, arg6, arg7); } @@ -756,36 +787,46 @@ class LIBPROTOBUF_EXPORT Arena { template <typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5, typename Arg6, typename Arg7, typename Arg8> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateInternal(bool skip_explicit_ownership, - const Arg1& arg1, - const Arg2& arg2, - const Arg3& arg3, - const Arg4& arg4, - const Arg5& arg5, - const Arg6& arg6, - const Arg7& arg7, - const Arg8& arg8) { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + T* CreateInternal(bool skip_explicit_ownership, + const Arg1& arg1, + const Arg2& arg2, + const Arg3& arg3, + const Arg4& arg4, + const Arg5& arg5, + const Arg6& arg6, + const Arg7& arg7, + const Arg8& arg8) { return new (AllocateInternal<T>(skip_explicit_ownership)) T(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); } #endif +#if LANG_CXX11 + template <typename T, typename... Args> + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE T* CreateMessageInternal( + Args&&... args) { + return InternalHelper<T>::Construct( + AllocateInternal<T>(InternalHelper<T>::is_destructor_skippable::value), + this, std::forward<Args>(args)...); + } +#endif template <typename T> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateMessageInternal() { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE T* CreateMessageInternal() { return InternalHelper<T>::Construct( AllocateInternal<T>(InternalHelper<T>::is_destructor_skippable::value), this); } - template <typename T, typename Arg> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateMessageInternal(const Arg& arg) { + template <typename T, typename Arg> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + T* CreateMessageInternal(const Arg& arg) { return InternalHelper<T>::Construct( AllocateInternal<T>(InternalHelper<T>::is_destructor_skippable::value), this, arg); } template <typename T, typename Arg1, typename Arg2> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* CreateMessageInternal(const Arg1& arg1, - const Arg2& arg2) { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + T* CreateMessageInternal(const Arg1& arg1, const Arg2& arg2) { return InternalHelper<T>::Construct( AllocateInternal<T>(InternalHelper<T>::is_destructor_skippable::value), this, arg1, arg2); @@ -828,14 +869,14 @@ class LIBPROTOBUF_EXPORT Arena { // is a subtype of ::google::protobuf::Message and 'false_type' otherwise. Collapsing // all template instantiations to one for generic Message reduces code size, // using the virtual destructor instead. - template<typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE + template<typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void OwnInternal(T* object, google::protobuf::internal::true_type) { if (object != NULL) { impl_.AddCleanup(object, &internal::arena_delete_object< ::google::protobuf::Message>); } } - template<typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE + template<typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void OwnInternal(T* object, google::protobuf::internal::false_type) { if (object != NULL) { impl_.AddCleanup(object, &internal::arena_delete_object<T>); @@ -845,14 +886,15 @@ class LIBPROTOBUF_EXPORT Arena { // Implementation for GetArena(). Only message objects with // InternalArenaConstructable_ tags can be associated with an arena, and such // objects must implement a GetArenaNoVirtual() method. - template <typename T> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE static ::google::protobuf::Arena* GetArenaInternal( + template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + static ::google::protobuf::Arena* GetArenaInternal( const T* value, google::protobuf::internal::true_type) { return InternalHelper<T>::GetArena(value); } template <typename T> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE static ::google::protobuf::Arena* GetArenaInternal( + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + static ::google::protobuf::Arena* GetArenaInternal( const T* /* value */, google::protobuf::internal::false_type) { return NULL; } @@ -877,7 +919,7 @@ class LIBPROTOBUF_EXPORT Arena { template <typename Type> friend class ::google::protobuf::internal::GenericTypeHandler; - friend class internal::ArenaString; // For AllocateAligned. + friend struct internal::ArenaStringPtr; // For AllocateAligned. friend class internal::LazyField; // For CreateMaybeMessage. template <typename Key, typename T> friend class Map; diff --git a/src/google/protobuf/arena_impl.h b/src/google/protobuf/arena_impl.h index b7f0c7b6..6cc7096b 100644 --- a/src/google/protobuf/arena_impl.h +++ b/src/google/protobuf/arena_impl.h @@ -42,6 +42,8 @@ #include <google/protobuf/stubs/mutex.h> #include <google/protobuf/stubs/type_traits.h> +#include <google/protobuf/stubs/port.h> + namespace google { namespace protobuf { @@ -80,6 +82,14 @@ class LIBPROTOBUF_EXPORT ArenaImpl { template <typename O> explicit ArenaImpl(const O& options) : options_(options) { + if (options_.initial_block != NULL && options_.initial_block_size > 0) { + GOOGLE_CHECK_GE(options_.initial_block_size, sizeof(Block)) + << ": Initial block size too small for header."; + initial_block_ = reinterpret_cast<Block*>(options_.initial_block); + } else { + initial_block_ = NULL; + } + Init(); } @@ -120,34 +130,44 @@ class LIBPROTOBUF_EXPORT ArenaImpl { CleanupNode nodes[1]; // True length is |size|. }; + struct Block; + + // Tracks per-thread info. ThreadInfos are kept in a linked list. + struct ThreadInfo { + void *owner; // &ThreadCache of this thread; + Block* head; // Head of linked list of blocks. + CleanupChunk* cleanup; // Head of cleanup list. + ThreadInfo* next; // Next ThreadInfo in this linked list. + }; + // Blocks are variable length malloc-ed objects. The following structure // describes the common header for all blocks. struct Block { - void* owner; // &ThreadCache of thread that owns this block. - Block* next; // Next block in arena (may have different owner) - CleanupChunk* cleanup; // Head of cleanup list (may point to another block, - // but it must have the same owner). + void* owner; // &ThreadCache of thread that owns this block. + ThreadInfo* thread_info; // ThreadInfo of thread that owns this block. + Block* next; // Next block in arena (may have different owner) // ((char*) &block) + pos is next available byte. It is always // aligned at a multiple of 8 bytes. size_t pos; size_t size; // total size of the block. - GOOGLE_ATTRIBUTE_ALWAYS_INLINE size_t avail() const { return size - pos; } + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + size_t avail() const { return size - pos; } // data follows }; struct ThreadCache { +#if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL) + // If we are using the ThreadLocalStorage class to store the ThreadCache, + // then the ThreadCache's default constructor has to be responsible for + // initializing it. + ThreadCache() : last_lifecycle_id_seen(-1), last_block_used_(NULL) {} +#endif + // The ThreadCache is considered valid as long as this matches the // lifecycle_id of the arena being used. int64 last_lifecycle_id_seen; Block* last_block_used_; }; - - // kHeaderSize is sizeof(Block), aligned up to the nearest multiple of 8 to - // protect the invariant that pos is always at a multiple of 8. - static const size_t kHeaderSize = (sizeof(Block) + 7) & -8; -#if LANG_CXX11 - static_assert(kHeaderSize % 8 == 0, "kHeaderSize must be a multiple of 8."); -#endif static google::protobuf::internal::SequenceNumber lifecycle_id_generator_; #if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL) // Android ndk does not support GOOGLE_THREAD_LOCAL keyword so we use a custom thread @@ -167,44 +187,52 @@ class LIBPROTOBUF_EXPORT ArenaImpl { // Free all blocks and return the total space used which is the sums of sizes // of the all the allocated blocks. - uint64 FreeBlocks(Block* head); + uint64 FreeBlocks(); - void AddCleanupInBlock(Block* b, void* elem, void (*cleanup)(void*)); - Block* ExpandCleanupList(Block* b); + void AddCleanupInBlock(Block* b, void* elem, void (*func)(void*)); + CleanupChunk* ExpandCleanupList(CleanupChunk* cleanup, Block* b); // Delete or Destruct all objects owned by the arena. - void CleanupList(Block* head); - uint64 ResetInternal(); + void CleanupList(); inline void CacheBlock(Block* block) { thread_cache().last_block_used_ = block; thread_cache().last_lifecycle_id_seen = lifecycle_id_; + // TODO(haberman): evaluate whether we would gain efficiency by getting rid + // of hint_. It's the only write we do to ArenaImpl in the allocation path, + // which will dirty the cache line. google::protobuf::internal::Release_Store(&hint_, reinterpret_cast<google::protobuf::internal::AtomicWord>(block)); } - google::protobuf::internal::AtomicWord blocks_; // Head of linked list of all allocated blocks - google::protobuf::internal::AtomicWord hint_; // Fast thread-local block access - uint64 space_allocated_; // Sum of sizes of all allocated blocks. + google::protobuf::internal::AtomicWord threads_; // Pointer to a linked list of ThreadInfo. + google::protobuf::internal::AtomicWord hint_; // Fast thread-local block access + google::protobuf::internal::AtomicWord space_allocated_; // Sum of sizes of all allocated blocks. - bool owns_first_block_; // Indicates that arena owns the first block - mutable Mutex blocks_lock_; + Block *initial_block_; // If non-NULL, points to the block that came from + // user data. - void AddBlock(Block* b); - // Access must be synchronized, either by blocks_lock_ or by being called from - // Init()/Reset(). - void AddBlockInternal(Block* b); // Returns a block owned by this thread. Block* GetBlock(size_t n); Block* GetBlockSlow(void* me, Block* my_full_block, size_t n); - Block* FindBlock(void* me); - Block* NewBlock(void* me, Block* my_last_block, size_t min_bytes, - size_t start_block_size, size_t max_block_size); + Block* NewBlock(void* me, Block* my_last_block, size_t min_bytes); + void InitBlock(Block* b, void *me, size_t size); static void* AllocFromBlock(Block* b, size_t n); + ThreadInfo* NewThreadInfo(Block* b); + ThreadInfo* FindThreadInfo(void* me); + ThreadInfo* GetThreadInfo(void* me, size_t n); int64 lifecycle_id_; // Unique for each arena. Changes on Reset(). Options options_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ArenaImpl); + + public: + // kHeaderSize is sizeof(Block), aligned up to the nearest multiple of 8 to + // protect the invariant that pos is always at a multiple of 8. + static const size_t kHeaderSize = (sizeof(Block) + 7) & -8; +#if LANG_CXX11 + static_assert(kHeaderSize % 8 == 0, "kHeaderSize must be a multiple of 8."); +#endif }; } // namespace internal diff --git a/src/google/protobuf/arena_unittest.cc b/src/google/protobuf/arena_unittest.cc index 6172cade..c6ff25e8 100644 --- a/src/google/protobuf/arena_unittest.cc +++ b/src/google/protobuf/arena_unittest.cc @@ -270,7 +270,7 @@ TEST(ArenaTest, InitialBlockTooSmall) { // Construct a small (64 byte) initial block of memory to be used by the // arena allocator; then, allocate an object which will not fit in the // initial block. - std::vector<char> arena_block(64); + std::vector<char> arena_block(72); ArenaOptions options; options.initial_block = &arena_block[0]; options.initial_block_size = arena_block.size(); @@ -1299,12 +1299,12 @@ TEST(ArenaTest, SpaceAllocated_and_Used) { options.initial_block_size = 0; Arena arena_3(options); EXPECT_EQ(0, arena_3.SpaceUsed()); - ::google::protobuf::Arena::CreateArray<char>(&arena_3, 190); + ::google::protobuf::Arena::CreateArray<char>(&arena_3, 182); EXPECT_EQ(256, arena_3.SpaceAllocated()); - EXPECT_EQ(Align8(190), arena_3.SpaceUsed()); + EXPECT_EQ(Align8(182), arena_3.SpaceUsed()); ::google::protobuf::Arena::CreateArray<char>(&arena_3, 70); EXPECT_EQ(256 + 512, arena_3.SpaceAllocated()); - EXPECT_EQ(Align8(190) + Align8(70), arena_3.SpaceUsed()); + EXPECT_EQ(Align8(182) + Align8(70), arena_3.SpaceUsed()); EXPECT_EQ(256 + 512, arena_3.Reset()); } diff --git a/src/google/protobuf/arenastring.h b/src/google/protobuf/arenastring.h index 63fd00e5..c9d045a1 100755 --- a/src/google/protobuf/arenastring.h +++ b/src/google/protobuf/arenastring.h @@ -33,12 +33,11 @@ #include <string> -#include <google/protobuf/stubs/logging.h> +#include <google/protobuf/arena.h> #include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/fastmem.h> -#include <google/protobuf/arena.h> - - +#include <google/protobuf/stubs/logging.h> +#include <google/protobuf/stubs/port.h> // This is the implementation of arena string fields written for the open-source // release. The ArenaStringPtr struct below is an internal implementation class @@ -62,6 +61,12 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { } } + inline void SetLite(const ::std::string* default_value, + const ::std::string& value, + ::google::protobuf::Arena* arena) { + Set(default_value, value, arena); + } + // Basic accessors. inline const ::std::string& Get() const { return *ptr_; } @@ -84,8 +89,9 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { } ::std::string* released = NULL; if (arena != NULL) { - // ptr_ is owned by the arena -- we need to return a copy. - released = new ::std::string(*ptr_); + // ptr_ is owned by the arena. + released = new ::std::string; + released->swap(*ptr_); } else { released = ptr_; } @@ -143,7 +149,7 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { // Swaps internal pointers. Arena-safety semantics: this is guarded by the // logic in Swap()/UnsafeArenaSwap() at the message level, so this method is // 'unsafe' if called directly. - GOOGLE_ATTRIBUTE_ALWAYS_INLINE void Swap(ArenaStringPtr* other) { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void Swap(ArenaStringPtr* other) { std::swap(ptr_, other->ptr_); } @@ -291,15 +297,17 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { private: ::std::string* ptr_; - GOOGLE_ATTRIBUTE_NOINLINE void CreateInstance(::google::protobuf::Arena* arena, - const ::std::string* initial_value) { + GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE + void CreateInstance(::google::protobuf::Arena* arena, + const ::std::string* initial_value) { GOOGLE_DCHECK(initial_value != NULL); ptr_ = new ::std::string(*initial_value); if (arena != NULL) { arena->Own(ptr_); } } - GOOGLE_ATTRIBUTE_NOINLINE void CreateInstanceNoArena(const ::std::string* initial_value) { + GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE + void CreateInstanceNoArena(const ::std::string* initial_value) { GOOGLE_DCHECK(initial_value != NULL); ptr_ = new ::std::string(*initial_value); } diff --git a/src/google/protobuf/arenastring_unittest.cc b/src/google/protobuf/arenastring_unittest.cc index c330b903..d5d995a6 100644 --- a/src/google/protobuf/arenastring_unittest.cc +++ b/src/google/protobuf/arenastring_unittest.cc @@ -49,7 +49,6 @@ namespace google { -using google::protobuf::internal::ArenaString; using google::protobuf::internal::ArenaStringPtr; namespace protobuf { @@ -110,6 +109,33 @@ TEST(ArenaStringPtrTest, ArenaStringPtrOnArena) { field2.Destroy(&default_value, &arena); } +TEST(ArenaStringPtrTest, ArenaStringPtrOnArenaNoSSO) { + google::protobuf::Arena arena; + ArenaStringPtr field; + ::std::string default_value = "default"; + field.UnsafeSetDefault(&default_value); + EXPECT_EQ(string("default"), field.Get()); + + // Avoid triggering the SSO optimization by setting the string to something + // larger than the internal buffer. + field.Set(&default_value, WrapString("Test long long long long value"), + &arena); + EXPECT_EQ(string("Test long long long long value"), field.Get()); + field.Set(&default_value, string(""), &arena); + field.Destroy(&default_value, &arena); + + ArenaStringPtr field2; + field2.UnsafeSetDefault(&default_value); + ::std::string* mut = field2.Mutable(&default_value, &arena); + EXPECT_EQ(mut, field2.Mutable(&default_value, &arena)); + EXPECT_EQ(mut, &field2.Get()); + EXPECT_NE(&default_value, mut); + EXPECT_EQ(string("default"), *mut); + *mut = "Test long long long long value"; // ensure string allocates storage + EXPECT_EQ(string("Test long long long long value"), field2.Get()); + field2.Destroy(&default_value, &arena); +} + } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/compiler/annotation_test_util.cc b/src/google/protobuf/compiler/annotation_test_util.cc new file mode 100644 index 00000000..aa14faf6 --- /dev/null +++ b/src/google/protobuf/compiler/annotation_test_util.cc @@ -0,0 +1,187 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include <google/protobuf/compiler/annotation_test_util.h> + +#include <memory> +#ifndef _SHARED_PTR_H +#include <google/protobuf/stubs/shared_ptr.h> +#endif +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/command_line_interface.h> +#include <google/protobuf/io/printer.h> +#include <google/protobuf/io/zero_copy_stream.h> +#include <google/protobuf/io/zero_copy_stream_impl_lite.h> +#include <google/protobuf/descriptor.pb.h> + +#include <google/protobuf/testing/file.h> +#include <google/protobuf/testing/file.h> +#include <google/protobuf/testing/googletest.h> +#include <gtest/gtest.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace annotation_test_util { +namespace { + +// A CodeGenerator that captures the FileDescriptor it's passed as a +// FileDescriptorProto. +class DescriptorCapturingGenerator : public CodeGenerator { + public: + // Does not own file; file must outlive the Generator. + explicit DescriptorCapturingGenerator(FileDescriptorProto* file) + : file_(file) {} + + virtual bool Generate(const FileDescriptor* file, const string& parameter, + GeneratorContext* context, string* error) const { + file->CopyTo(file_); + return true; + } + + private: + FileDescriptorProto* file_; +}; +} // namespace + +void AddFile(const string& filename, const string& data) { + GOOGLE_CHECK_OK(File::SetContents(TestTempDir() + "/" + filename, data, + true)); +} + +bool CaptureMetadata(const string& filename, const string& plugin_specific_args, + const string& meta_file_suffix, CommandLineInterface* cli, + FileDescriptorProto* file, + std::vector<ExpectedOutput>* outputs) { + cli->SetInputsAreProtoPathRelative(true); + + DescriptorCapturingGenerator capturing_generator(file); + cli->RegisterGenerator("--capture_out", &capturing_generator, ""); + + string proto_path = "-I" + TestTempDir(); + string capture_out = "--capture_out=" + TestTempDir(); + + const char* argv[] = {"protoc", proto_path.c_str(), + plugin_specific_args.c_str(), capture_out.c_str(), + filename.c_str()}; + + if (cli->Run(5, argv) != 0) { + return false; + } + + if (outputs != NULL) { + for (std::vector<ExpectedOutput>::iterator i = outputs->begin(); + i != outputs->end(); ++i) { + GOOGLE_CHECK_OK(File::GetContents(TestTempDir() + "/" + i->file_path, + &i->file_content, true)); + if (!DecodeMetadata( + TestTempDir() + "/" + i->file_path + meta_file_suffix, + &i->file_info)) { + return false; + } + } + } + + return true; +} + +bool DecodeMetadata(const string& path, GeneratedCodeInfo* info) { + string data; + GOOGLE_CHECK_OK(File::GetContents(path, &data, true)); + io::ArrayInputStream input(data.data(), data.size()); + return info->ParseFromZeroCopyStream(&input); +} + +void FindAnnotationsOnPath( + const GeneratedCodeInfo& info, const string& source_file, + const std::vector<int>& path, + std::vector<const GeneratedCodeInfo::Annotation*>* annotations) { + for (int i = 0; i < info.annotation_size(); ++i) { + const GeneratedCodeInfo::Annotation* annotation = &info.annotation(i); + if (annotation->source_file() != source_file || + annotation->path_size() != path.size()) { + continue; + } + int node = 0; + for (; node < path.size(); ++node) { + if (annotation->path(node) != path[node]) { + break; + } + } + if (node == path.size()) { + annotations->push_back(annotation); + } + } +} + +const GeneratedCodeInfo::Annotation* FindAnnotationOnPath( + const GeneratedCodeInfo& info, const string& source_file, + const std::vector<int>& path) { + std::vector<const GeneratedCodeInfo::Annotation*> annotations; + FindAnnotationsOnPath(info, source_file, path, &annotations); + if (annotations.empty()) { + return NULL; + } + return annotations[0]; +} + +bool AtLeastOneAnnotationMatchesSubstring( + const string& file_content, + const std::vector<const GeneratedCodeInfo::Annotation*>& annotations, + const string& expected_text) { + for (std::vector<const GeneratedCodeInfo::Annotation*>::const_iterator + i = annotations.begin(), + e = annotations.end(); + i != e; ++i) { + const GeneratedCodeInfo::Annotation* annotation = *i; + uint32 begin = annotation->begin(); + uint32 end = annotation->end(); + if (end < begin || end > file_content.size()) { + return false; + } + if (file_content.substr(begin, end - begin) == expected_text) { + return true; + } + } + return false; +} + +bool AnnotationMatchesSubstring(const string& file_content, + const GeneratedCodeInfo::Annotation* annotation, + const string& expected_text) { + std::vector<const GeneratedCodeInfo::Annotation*> annotations; + annotations.push_back(annotation); + return AtLeastOneAnnotationMatchesSubstring(file_content, annotations, + expected_text); +} +} // namespace annotation_test_util +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/annotation_test_util.h b/src/google/protobuf/compiler/annotation_test_util.h new file mode 100644 index 00000000..4598a45a --- /dev/null +++ b/src/google/protobuf/compiler/annotation_test_util.h @@ -0,0 +1,119 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef GOOGLE_PROTOBUF_COMPILER_ANNOTATION_TEST_UTIL_H__ +#define GOOGLE_PROTOBUF_COMPILER_ANNOTATION_TEST_UTIL_H__ + +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/testing/googletest.h> +#include <gtest/gtest.h> + +// Utilities that assist in writing tests for generator annotations. +// See java/internal/annotation_unittest.cc for an example. +namespace google { +namespace protobuf { +namespace compiler { +namespace annotation_test_util { + +// Struct that contains the file generated from a .proto file and its +// GeneratedCodeInfo. For example, the Java generator will fill this struct +// (for some 'foo.proto') with: +// file_path = "Foo.java" +// file_content = content of Foo.java +// file_info = parsed content of Foo.java.pb.meta +struct ExpectedOutput { + string file_path; + string file_content; + GeneratedCodeInfo file_info; + explicit ExpectedOutput(const string& file_path) : file_path(file_path) {} +}; + +// Creates a file with name `filename` and content `data` in temp test +// directory. +void AddFile(const string& filename, const string& data); + +// Tries to capture a FileDescriptorProto, GeneratedCodeInfo, and output +// code from the previously added file with name `filename`. +// +// filename: source .proto file used to generate code. +// plugin_specific_args: command line arguments specific to current generator. +// For Java, this value might be "--java_out=annotate_code:test_temp_dir" +// meta_file_suffix: suffix of meta files that contain annotations. For Java +// it is ".pb.meta" because for file Foo.java meta file is Foo.java.pb.meta +// cli: instance of command line interface to run generator. See Java's +// annotation_unittest.cc for an example of how to initialize it. +// file: output parameter, will be set to the descriptor of the proto file +// specified in filename. +// outputs: output parameter. If not NULL, each ExpectedOutput in the vector +// should have its file_path set; CaptureMetadata will fill the rest of +// the fields appropriately. +bool CaptureMetadata(const string& filename, const string& plugin_specific_args, + const string& meta_file_suffix, CommandLineInterface* cli, + FileDescriptorProto* file, + std::vector<ExpectedOutput>* outputs); + +bool DecodeMetadata(const string& path, GeneratedCodeInfo* info); + +// Finds all of the Annotations for a given source file and path. +// See Location.path in http://google/protobuf/descriptor.proto for +// explanation of what path vector is. +void FindAnnotationsOnPath( + const GeneratedCodeInfo& info, const string& source_file, + const std::vector<int>& path, + std::vector<const GeneratedCodeInfo::Annotation*>* annotations); + +// Finds the Annotation for a given source file and path (or returns null if it +// couldn't). If there are several annotations for given path, returns the first +// one. See Location.path in +// http://google/protobuf/descriptor.proto for explanation of what path +// vector is. +const GeneratedCodeInfo::Annotation* FindAnnotationOnPath( + const GeneratedCodeInfo& info, const string& source_file, + const std::vector<int>& path); + +// Returns true if at least one of the provided annotations covers a given +// substring in file_content. +bool AtLeastOneAnnotationMatchesSubstring( + const string& file_content, + const std::vector<const GeneratedCodeInfo::Annotation*>& annotations, + const string& expected_text); + +// Returns true if the provided annotation covers a given substring in +// file_content. +bool AnnotationMatchesSubstring(const string& file_content, + const GeneratedCodeInfo::Annotation* annotation, + const string& expected_text); + +} // namespace annotation_test_util +} // namespace compiler +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_COMPILER_ANNOTATION_TEST_UTIL_H__ diff --git a/src/google/protobuf/compiler/code_generator.h b/src/google/protobuf/compiler/code_generator.h index dd6a59d8..4b1d90b8 100644 --- a/src/google/protobuf/compiler/code_generator.h +++ b/src/google/protobuf/compiler/code_generator.h @@ -51,6 +51,7 @@ class FileDescriptor; namespace compiler { class AccessInfoMap; + class Version; // Defined in this file. @@ -165,7 +166,7 @@ typedef GeneratorContext OutputDirectory; // "foo=bar,baz,qux=corge" // parses to the pairs: // ("foo", "bar"), ("baz", ""), ("qux", "corge") -LIBPROTOC_EXPORT void ParseGeneratorParameter( +void ParseGeneratorParameter( const string&, std::vector<std::pair<string, string> >*); } // namespace compiler diff --git a/src/google/protobuf/compiler/command_line_interface.cc b/src/google/protobuf/compiler/command_line_interface.cc index 5f864041..6c2fc164 100644 --- a/src/google/protobuf/compiler/command_line_interface.cc +++ b/src/google/protobuf/compiler/command_line_interface.cc @@ -69,9 +69,6 @@ #include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/logging.h> #include <google/protobuf/stubs/stringprintf.h> -#include <google/protobuf/compiler/importer.h> -#include <google/protobuf/compiler/code_generator.h> -#include <google/protobuf/compiler/plugin.pb.h> #include <google/protobuf/compiler/subprocess.h> #include <google/protobuf/compiler/zip_writer.h> #include <google/protobuf/compiler/plugin.pb.h> @@ -83,16 +80,11 @@ #include <google/protobuf/descriptor.h> #include <google/protobuf/dynamic_message.h> #include <google/protobuf/text_format.h> -#include <google/protobuf/dynamic_message.h> -#include <google/protobuf/io/coded_stream.h> -#include <google/protobuf/io/zero_copy_stream_impl.h> -#include <google/protobuf/io/printer.h> -#include <google/protobuf/stubs/io_win32.h> -#include <google/protobuf/stubs/logging.h> #include <google/protobuf/stubs/strutil.h> #include <google/protobuf/stubs/substitute.h> #include <google/protobuf/stubs/map_util.h> #include <google/protobuf/stubs/stl_util.h> +#include <google/protobuf/stubs/io_win32.h> namespace google { @@ -232,7 +224,7 @@ bool IsInstalledProtoPath(const string& path) { return access(file_path.c_str(), F_OK) != -1; } -// Add the paths where google/protobuf/descritor.proto and other well-known +// Add the paths where google/protobuf/descriptor.proto and other well-known // type protos are installed. void AddDefaultProtoPaths(vector<pair<string, string> >* paths) { // TODO(xiaofeng): The code currently only checks relative paths of where @@ -876,6 +868,7 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) { return 1; } + // We construct a separate GeneratorContext for each output location. Note // that two code generators may output to the same location, in which case // they should share a single GeneratorContext so that OpenForInsert() works. @@ -1019,7 +1012,8 @@ bool CommandLineInterface::PopulateSimpleDescriptorDatabase( bool parsed = file_descriptor_set.ParseFromFileDescriptor(fd); if (close(fd) != 0) { std::cerr << descriptor_set_in_names_[i] << ": close: " - << strerror(errno); + << strerror(errno) + << std::endl; return false; } @@ -1172,6 +1166,21 @@ bool CommandLineInterface::MakeInputsBeProtoPathRelative( return true; } +bool CommandLineInterface::ExpandArgumentFile(const string& file, + std::vector<string>* arguments) { + // The argument file is searched in the working directory only. We don't + // use the proto import path here. + std::ifstream file_stream(file.c_str()); + if (!file_stream.is_open()) { + return false; + } + string argument; + // We don't support any kind of shell expansion right now. + while (std::getline(file_stream, argument)) { + arguments->push_back(argument); + } + return true; +} CommandLineInterface::ParseArgumentStatus CommandLineInterface::ParseArguments(int argc, const char* const argv[]) { @@ -1179,11 +1188,19 @@ CommandLineInterface::ParseArguments(int argc, const char* const argv[]) { std::vector<string> arguments; for (int i = 1; i < argc; ++i) { + if (argv[i][0] == '@') { + if (!ExpandArgumentFile(argv[i] + 1, &arguments)) { + std::cerr << "Failed to open argument file: " << (argv[i] + 1) + << std::endl; + return PARSE_ARGUMENT_FAIL; + } + continue; + } arguments.push_back(argv[i]); } // if no arguments are given, show help - if(arguments.empty()) { + if (arguments.empty()) { PrintHelpText(); return PARSE_ARGUMENT_DONE_AND_EXIT; // Exit without running compiler. } @@ -1749,6 +1766,20 @@ void CommandLineInterface::PrintHelpText() { << string(19 - iter->first.size(), ' ') // Spaces for alignment. << iter->second.help_text << std::endl; } + std::cerr << +" @<filename> Read options and filenames from file. If a\n" +" relative file path is specified, the file\n" +" will be searched in the working directory.\n" +" The --proto_path option will not affect how\n" +" this argument file is searched. Content of\n" +" the file will be expanded in the position of\n" +" @<filename> as in the argument list. Note\n" +" that shell expansion is not applied to the\n" +" content of the file (i.e., you cannot use\n" +" quotes, wildcards, escapes, commands, etc.).\n" +" Each line corresponds to a single argument,\n" +" even if it contains spaces." + << std::endl; } bool CommandLineInterface::GenerateOutput( diff --git a/src/google/protobuf/compiler/command_line_interface.h b/src/google/protobuf/compiler/command_line_interface.h index e6596575..d5d85f2d 100644 --- a/src/google/protobuf/compiler/command_line_interface.h +++ b/src/google/protobuf/compiler/command_line_interface.h @@ -227,6 +227,9 @@ class LIBPROTOC_EXPORT CommandLineInterface { // Parse all command-line arguments. ParseArgumentStatus ParseArguments(int argc, const char* const argv[]); + // Read an argument file and append the file's content to the list of + // arguments. Return false if the file cannot be read. + bool ExpandArgumentFile(const string& file, std::vector<string>* arguments); // Parses a command-line argument into a name/value pair. Returns // true if the next argument in the argv should be used as the value, diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc index 73d3e4c9..38d0e388 100644 --- a/src/google/protobuf/compiler/command_line_interface_unittest.cc +++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc @@ -35,6 +35,7 @@ #include <fcntl.h> #include <sys/stat.h> #include <sys/types.h> + #ifndef _MSC_VER #include <unistd.h> #endif @@ -84,6 +85,7 @@ using google::protobuf::internal::win32::write; // which case tcmalloc will print warnings that fail the plugin tests. #if !GOOGLE_PROTOBUF_HEAP_CHECK_DRACONIAN + namespace { bool FileExists(const string& path) { @@ -1559,6 +1561,36 @@ TEST_F(CommandLineInterfaceTest, WriteDependencyManifestFileForAbsolutePath) { } #endif // !_WIN32 +TEST_F(CommandLineInterfaceTest, TestArgumentFile) { + // Test parsing multiple input files using an argument file. + + CreateTempFile("foo.proto", + "syntax = \"proto2\";\n" + "message Foo {}\n"); + CreateTempFile("bar.proto", + "syntax = \"proto2\";\n" + "message Bar {}\n"); + CreateTempFile("arguments.txt", + "--test_out=$tmpdir\n" + "--plug_out=$tmpdir\n" + "--proto_path=$tmpdir\n" + "--direct_dependencies_violation_msg=%s is not imported\n" + "foo.proto\n" + "bar.proto"); + + Run("protocol_compiler @$tmpdir/arguments.txt"); + + ExpectNoErrors(); + ExpectGeneratedWithMultipleInputs("test_generator", "foo.proto,bar.proto", + "foo.proto", "Foo"); + ExpectGeneratedWithMultipleInputs("test_generator", "foo.proto,bar.proto", + "bar.proto", "Bar"); + ExpectGeneratedWithMultipleInputs("test_plugin", "foo.proto,bar.proto", + "foo.proto", "Foo"); + ExpectGeneratedWithMultipleInputs("test_plugin", "foo.proto,bar.proto", + "bar.proto", "Bar"); +} + // ------------------------------------------------------------------- diff --git a/src/google/protobuf/compiler/cpp/cpp_enum.cc b/src/google/protobuf/compiler/cpp/cpp_enum.cc index 3b4b97e6..8adee0f5 100644 --- a/src/google/protobuf/compiler/cpp/cpp_enum.cc +++ b/src/google/protobuf/compiler/cpp/cpp_enum.cc @@ -197,6 +197,8 @@ void EnumGenerator::GenerateSymbolImports(io::Printer* printer) { vars["nested_name"] = descriptor_->name(); vars["classname"] = classname_; vars["constexpr"] = options_.proto_h ? "constexpr " : ""; + vars["{"] = ""; + vars["}"] = ""; printer->Print(vars, "typedef $classname$ $nested_name$;\n"); for (int j = 0; j < descriptor_->value_count(); j++) { @@ -204,22 +206,27 @@ void EnumGenerator::GenerateSymbolImports(io::Printer* printer) { vars["deprecated_attr"] = descriptor_->value(j)->options().deprecated() ? "GOOGLE_PROTOBUF_DEPRECATED_ATTR " : ""; printer->Print(vars, - "$deprecated_attr$static $constexpr$const $nested_name$ $tag$ =\n" + "$deprecated_attr$static $constexpr$const $nested_name$ ${$$tag$$}$ =\n" " $classname$_$tag$;\n"); + printer->Annotate("{", "}", descriptor_->value(j)); } printer->Print(vars, "static inline bool $nested_name$_IsValid(int value) {\n" " return $classname$_IsValid(value);\n" "}\n" - "static const $nested_name$ $nested_name$_MIN =\n" - " $classname$_$nested_name$_MIN;\n" - "static const $nested_name$ $nested_name$_MAX =\n" + "static const $nested_name$ ${$$nested_name$_MIN$}$ =\n" + " $classname$_$nested_name$_MIN;\n"); + printer->Annotate("{", "}", descriptor_); + printer->Print(vars, + "static const $nested_name$ ${$$nested_name$_MAX$}$ =\n" " $classname$_$nested_name$_MAX;\n"); + printer->Annotate("{", "}", descriptor_); if (generate_array_size_) { printer->Print(vars, - "static const int $nested_name$_ARRAYSIZE =\n" + "static const int ${$$nested_name$_ARRAYSIZE$}$ =\n" " $classname$_$nested_name$_ARRAYSIZE;\n"); + printer->Annotate("{", "}", descriptor_); } if (HasDescriptorMethods(descriptor_->file(), options_)) { @@ -242,27 +249,10 @@ void EnumGenerator::GenerateSymbolImports(io::Printer* printer) { } } -void EnumGenerator::GenerateDescriptorInitializer(io::Printer* printer) { - std::map<string, string> vars; - vars["index"] = SimpleItoa(descriptor_->index()); - vars["index_in_metadata"] = SimpleItoa(index_in_metadata_); - - if (descriptor_->containing_type() == NULL) { - printer->Print(vars, - "file_level_enum_descriptors[$index_in_metadata$] = " - "file->enum_type($index$);\n"); - } else { - vars["parent"] = ClassName(descriptor_->containing_type(), false); - printer->Print(vars, - "file_level_enum_descriptors[$index_in_metadata$] = " - "$parent$_descriptor->enum_type($index$);\n"); - } -} - -void EnumGenerator::GenerateMethods(io::Printer* printer) { +void EnumGenerator::GenerateMethods(int idx, io::Printer* printer) { std::map<string, string> vars; vars["classname"] = classname_; - vars["index_in_metadata"] = SimpleItoa(index_in_metadata_); + vars["index_in_metadata"] = SimpleItoa(idx); vars["constexpr"] = options_.proto_h ? "constexpr " : ""; vars["file_namespace"] = FileLevelNamespace(descriptor_->file()->name()); diff --git a/src/google/protobuf/compiler/cpp/cpp_enum.h b/src/google/protobuf/compiler/cpp/cpp_enum.h index 0b568c57..0d2488a9 100644 --- a/src/google/protobuf/compiler/cpp/cpp_enum.h +++ b/src/google/protobuf/compiler/cpp/cpp_enum.h @@ -86,13 +86,10 @@ class EnumGenerator { // Source file stuff. - // Generate code that initializes the global variable storing the enum's - // descriptor. - void GenerateDescriptorInitializer(io::Printer* printer); - // Generate non-inline methods related to the enum, such as IsValidValue(). - // Goes in the .cc file. - void GenerateMethods(io::Printer* printer); + // Goes in the .cc file. EnumDescriptors are stored in an array, idx is + // the index in this array that corresponds with this enum. + void GenerateMethods(int idx, io::Printer* printer); private: const EnumDescriptor* descriptor_; @@ -101,8 +98,6 @@ class EnumGenerator { // whether to generate the *_ARRAYSIZE constant. const bool generate_array_size_; - int index_in_metadata_; - friend class FileGenerator; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator); }; diff --git a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc index 08a635fa..3d5b5b8d 100644 --- a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc @@ -82,21 +82,18 @@ GenerateAccessorDeclarations(io::Printer* printer) const { } void EnumFieldGenerator:: -GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const { - std::map<string, string> variables(variables_); - variables["inline"] = is_inline ? "inline " : ""; - printer->Print(variables, - "$inline$$type$ $classname$::$name$() const {\n" +GenerateInlineAccessorDefinitions(io::Printer* printer) const { + printer->Print(variables_, + "inline $type$ $classname$::$name$() const {\n" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return static_cast< $type$ >($name$_);\n" "}\n" - "$inline$void $classname$::set_$name$($type$ value) {\n"); + "inline void $classname$::set_$name$($type$ value) {\n"); if (!HasPreservingUnknownEnumSemantics(descriptor_->file())) { - printer->Print(variables, + printer->Print(variables_, " assert($type$_IsValid(value));\n"); } - printer->Print(variables, + printer->Print(variables_, " $set_hasbit$\n" " $name$_ = value;\n" " // @@protoc_insertion_point(field_set:$full_name$)\n" @@ -193,24 +190,21 @@ EnumOneofFieldGenerator(const FieldDescriptor* descriptor, EnumOneofFieldGenerator::~EnumOneofFieldGenerator() {} void EnumOneofFieldGenerator:: -GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const { - std::map<string, string> variables(variables_); - variables["inline"] = is_inline ? "inline " : ""; - printer->Print(variables, - "$inline$$type$ $classname$::$name$() const {\n" +GenerateInlineAccessorDefinitions(io::Printer* printer) const { + printer->Print(variables_, + "inline $type$ $classname$::$name$() const {\n" " // @@protoc_insertion_point(field_get:$full_name$)\n" " if (has_$name$()) {\n" " return static_cast< $type$ >($oneof_prefix$$name$_);\n" " }\n" " return static_cast< $type$ >($default$);\n" "}\n" - "$inline$void $classname$::set_$name$($type$ value) {\n"); + "inline void $classname$::set_$name$($type$ value) {\n"); if (!HasPreservingUnknownEnumSemantics(descriptor_->file())) { - printer->Print(variables, + printer->Print(variables_, " assert($type$_IsValid(value));\n"); } - printer->Print(variables, + printer->Print(variables_, " if (!has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" @@ -232,9 +226,8 @@ GenerateSwappingCode(io::Printer* printer) const { void EnumOneofFieldGenerator:: GenerateConstructorCode(io::Printer* printer) const { - printer->Print( - variables_, - "_$classname$_default_instance_.$name$_ = $default$;\n"); + printer->Print(variables_, + "$ns$::_$classname$_default_instance_.$name$_ = $default$;\n"); } // =================================================================== @@ -281,39 +274,36 @@ GenerateAccessorDeclarations(io::Printer* printer) const { } void RepeatedEnumFieldGenerator:: -GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const { - std::map<string, string> variables(variables_); - variables["inline"] = is_inline ? "inline " : ""; - printer->Print(variables, - "$inline$$type$ $classname$::$name$(int index) const {\n" +GenerateInlineAccessorDefinitions(io::Printer* printer) const { + printer->Print(variables_, + "inline $type$ $classname$::$name$(int index) const {\n" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return static_cast< $type$ >($name$_.Get(index));\n" "}\n" - "$inline$void $classname$::set_$name$(int index, $type$ value) {\n"); + "inline void $classname$::set_$name$(int index, $type$ value) {\n"); if (!HasPreservingUnknownEnumSemantics(descriptor_->file())) { - printer->Print(variables, + printer->Print(variables_, " assert($type$_IsValid(value));\n"); } - printer->Print(variables, + printer->Print(variables_, " $name$_.Set(index, value);\n" " // @@protoc_insertion_point(field_set:$full_name$)\n" "}\n" - "$inline$void $classname$::add_$name$($type$ value) {\n"); + "inline void $classname$::add_$name$($type$ value) {\n"); if (!HasPreservingUnknownEnumSemantics(descriptor_->file())) { - printer->Print(variables, + printer->Print(variables_, " assert($type$_IsValid(value));\n"); } - printer->Print(variables, + printer->Print(variables_, " $name$_.Add(value);\n" " // @@protoc_insertion_point(field_add:$full_name$)\n" "}\n" - "$inline$const ::google::protobuf::RepeatedField<int>&\n" + "inline const ::google::protobuf::RepeatedField<int>&\n" "$classname$::$name$() const {\n" " // @@protoc_insertion_point(field_list:$full_name$)\n" " return $name$_;\n" "}\n" - "$inline$::google::protobuf::RepeatedField<int>*\n" + "inline ::google::protobuf::RepeatedField<int>*\n" "$classname$::mutable_$name$() {\n" " // @@protoc_insertion_point(field_mutable_list:$full_name$)\n" " return &$name$_;\n" diff --git a/src/google/protobuf/compiler/cpp/cpp_enum_field.h b/src/google/protobuf/compiler/cpp/cpp_enum_field.h index 3ecd7ba8..d0e87b79 100644 --- a/src/google/protobuf/compiler/cpp/cpp_enum_field.h +++ b/src/google/protobuf/compiler/cpp/cpp_enum_field.h @@ -52,8 +52,7 @@ class EnumFieldGenerator : public FieldGenerator { // implements FieldGenerator --------------------------------------- void GeneratePrivateMembers(io::Printer* printer) const; void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const; void GenerateClearingCode(io::Printer* printer) const; void GenerateMergingCode(io::Printer* printer) const; void GenerateSwappingCode(io::Printer* printer) const; @@ -79,8 +78,7 @@ class EnumOneofFieldGenerator : public EnumFieldGenerator { ~EnumOneofFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const; void GenerateClearingCode(io::Printer* printer) const; void GenerateSwappingCode(io::Printer* printer) const; void GenerateConstructorCode(io::Printer* printer) const; @@ -98,8 +96,7 @@ class RepeatedEnumFieldGenerator : public FieldGenerator { // implements FieldGenerator --------------------------------------- void GeneratePrivateMembers(io::Printer* printer) const; void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const; void GenerateClearingCode(io::Printer* printer) const; void GenerateMergingCode(io::Printer* printer) const; void GenerateSwappingCode(io::Printer* printer) const; diff --git a/src/google/protobuf/compiler/cpp/cpp_extension.cc b/src/google/protobuf/compiler/cpp/cpp_extension.cc index 6b1673b2..0a4e0bb9 100644 --- a/src/google/protobuf/compiler/cpp/cpp_extension.cc +++ b/src/google/protobuf/compiler/cpp/cpp_extension.cc @@ -167,46 +167,6 @@ void ExtensionGenerator::GenerateDefinition(io::Printer* printer) { " $name$($constant_name$, $default$);\n"); } -void ExtensionGenerator::GenerateRegistration(io::Printer* printer) { - std::map<string, string> vars; - vars["extendee" ] = ExtendeeClassName(descriptor_); - vars["number" ] = SimpleItoa(descriptor_->number()); - vars["field_type" ] = SimpleItoa(static_cast<int>(descriptor_->type())); - vars["is_repeated"] = descriptor_->is_repeated() ? "true" : "false"; - vars["is_packed" ] = (descriptor_->is_repeated() && - descriptor_->options().packed()) - ? "true" : "false"; - - switch (descriptor_->cpp_type()) { - case FieldDescriptor::CPPTYPE_ENUM: - printer->Print( - vars, - "::google::protobuf::internal::ExtensionSet::RegisterEnumExtension(\n" - " $extendee$::internal_default_instance(),\n" - " $number$, $field_type$, $is_repeated$, $is_packed$,\n"); - printer->Print( - " &$type$_IsValid);\n", - "type", ClassName(descriptor_->enum_type(), true)); - break; - case FieldDescriptor::CPPTYPE_MESSAGE: - printer->Print( - vars, - "::google::protobuf::internal::ExtensionSet::RegisterMessageExtension(\n" - " $extendee$::internal_default_instance(),\n" - " $number$, $field_type$, $is_repeated$, $is_packed$,\n"); - printer->Print(" $type$::internal_default_instance());\n", "type", - ClassName(descriptor_->message_type(), true)); - break; - default: - printer->Print( - vars, - "::google::protobuf::internal::ExtensionSet::RegisterExtension(\n" - " $extendee$::internal_default_instance(),\n" - " $number$, $field_type$, $is_repeated$, $is_packed$);\n"); - break; - } -} - } // namespace cpp } // namespace compiler } // namespace protobuf diff --git a/src/google/protobuf/compiler/cpp/cpp_extension.h b/src/google/protobuf/compiler/cpp/cpp_extension.h index 1c1caf1f..30236d71 100644 --- a/src/google/protobuf/compiler/cpp/cpp_extension.h +++ b/src/google/protobuf/compiler/cpp/cpp_extension.h @@ -67,9 +67,6 @@ class ExtensionGenerator { // Source file stuff. void GenerateDefinition(io::Printer* printer); - // Generate code to register the extension. - void GenerateRegistration(io::Printer* printer); - private: const FieldDescriptor* descriptor_; string type_traits_; diff --git a/src/google/protobuf/compiler/cpp/cpp_field.cc b/src/google/protobuf/compiler/cpp/cpp_field.cc index dce9617c..f8e11855 100644 --- a/src/google/protobuf/compiler/cpp/cpp_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_field.cc @@ -61,6 +61,7 @@ using internal::WireFormat; void SetCommonFieldVariables(const FieldDescriptor* descriptor, std::map<string, string>* variables, const Options& options) { + (*variables)["ns"] = Namespace(descriptor); (*variables)["name"] = FieldName(descriptor); (*variables)["index"] = SimpleItoa(descriptor->index()); (*variables)["number"] = SimpleItoa(descriptor->number()); diff --git a/src/google/protobuf/compiler/cpp/cpp_field.h b/src/google/protobuf/compiler/cpp/cpp_field.h index d9dd3850..891e30f6 100644 --- a/src/google/protobuf/compiler/cpp/cpp_field.h +++ b/src/google/protobuf/compiler/cpp/cpp_field.h @@ -109,19 +109,19 @@ class FieldGenerator { // Generate inline definitions of depenent accessor functions for this field. // These are placed inside the header after all class definitions. virtual void GenerateDependentInlineAccessorDefinitions( - io::Printer* printer) const {} + io::Printer* printer) const {} // Generate inline definitions of accessor functions for this field. // These are placed inside the header after all class definitions. // In non-.proto.h mode, this generates dependent accessor functions as well. virtual void GenerateInlineAccessorDefinitions( - io::Printer* printer, bool is_inline) const = 0; + io::Printer* printer) const = 0; // Generate definitions of accessors that aren't inlined. These are // placed somewhere in the .cc file. // Most field types don't need this, so the default implementation is empty. virtual void GenerateNonInlineAccessorDefinitions( - io::Printer* /*printer*/) const {} + io::Printer* /*printer*/) const {} // Generate lines of code (statements, not declarations) which clear the // field. This is used to define the clear_$name$() method diff --git a/src/google/protobuf/compiler/cpp/cpp_file.cc b/src/google/protobuf/compiler/cpp/cpp_file.cc index a066a6a7..52a16835 100644 --- a/src/google/protobuf/compiler/cpp/cpp_file.cc +++ b/src/google/protobuf/compiler/cpp/cpp_file.cc @@ -55,70 +55,24 @@ namespace google { namespace protobuf { namespace compiler { namespace cpp { -namespace { -// The list of names that are defined as macros on some platforms. We need to -// #undef them for the generated code to compile. -const char* kMacroNames[] = {"major", "minor"}; - -bool IsMacroName(const string& name) { - // Just do a linear search as the number of elements is very small. - for (int i = 0; i < GOOGLE_ARRAYSIZE(kMacroNames); ++i) { - if (name == kMacroNames[i]) return true; - } - return false; -} - -void CollectMacroNames(const Descriptor* message, std::vector<string>* names) { - for (int i = 0; i < message->field_count(); ++i) { - const FieldDescriptor* field = message->field(i); - if (IsMacroName(field->name())) { - names->push_back(field->name()); - } - } - for (int i = 0; i < message->nested_type_count(); ++i) { - CollectMacroNames(message->nested_type(i), names); - } -} - -void CollectMacroNames(const FileDescriptor* file, std::vector<string>* names) { - // Only do this for protobuf's own types. There are some google3 protos using - // macros as field names and the generated code compiles after the macro - // expansion. Undefing these macros actually breaks such code. - if (file->name() != "google/protobuf/compiler/plugin.proto") { - return; - } - for (int i = 0; i < file->message_type_count(); ++i) { - CollectMacroNames(file->message_type(i), names); - } -} - - -} // namespace - -// =================================================================== FileGenerator::FileGenerator(const FileDescriptor* file, const Options& options) : file_(file), options_(options), scc_analyzer_(options), - message_generators_owner_( - new google::protobuf::scoped_ptr<MessageGenerator>[file->message_type_count()]), enum_generators_owner_( new google::protobuf::scoped_ptr<EnumGenerator>[file->enum_type_count()]), service_generators_owner_( new google::protobuf::scoped_ptr<ServiceGenerator>[file->service_count()]), extension_generators_owner_( new google::protobuf::scoped_ptr<ExtensionGenerator>[file->extension_count()]) { - - for (int i = 0; i < file->message_type_count(); i++) { - message_generators_owner_[i].reset( - new MessageGenerator(file->message_type(i), options, &scc_analyzer_)); - message_generators_owner_[i]->Flatten(&message_generators_); - } - - for (int i = 0; i < message_generators_.size(); i++) { - message_generators_[i]->AddGenerators(&enum_generators_, - &extension_generators_); + std::vector<const Descriptor*> msgs = FlattenMessagesInFile(file); + for (int i = 0; i < msgs.size(); i++) { + // Deleted in destructor + MessageGenerator* msg_gen = + new MessageGenerator(msgs[i], i, options, &scc_analyzer_); + message_generators_.push_back(msg_gen); + msg_gen->AddGenerators(&enum_generators_, &extension_generators_); } for (int i = 0; i < file->enum_type_count(); i++) { @@ -126,9 +80,6 @@ FileGenerator::FileGenerator(const FileDescriptor* file, const Options& options) new EnumGenerator(file->enum_type(i), options)); enum_generators_.push_back(enum_generators_owner_[i].get()); } - for (int i = 0; i < enum_generators_.size(); i++) { - enum_generators_[i]->index_in_metadata_ = i; - } for (int i = 0; i < file->service_count(); i++) { service_generators_owner_[i].reset( @@ -147,14 +98,36 @@ FileGenerator::FileGenerator(const FileDescriptor* file, const Options& options) extension_generators_.push_back(extension_generators_owner_[i].get()); } + package_parts_ = Split(file_->package(), ".", true); } -FileGenerator::~FileGenerator() {} +FileGenerator::~FileGenerator() { + for (int i = 0; i < message_generators_.size(); i++) { + delete message_generators_[i]; + } +} void FileGenerator::GenerateMacroUndefs(io::Printer* printer) { + // Only do this for protobuf's own types. There are some google3 protos using + // macros as field names and the generated code compiles after the macro + // expansion. Undefing these macros actually breaks such code. + if (file_->name() != "google/protobuf/compiler/plugin.proto") { + return; + } std::vector<string> names_to_undef; - CollectMacroNames(file_, &names_to_undef); + std::vector<const FieldDescriptor*> fields; + ListAllFields(file_, &fields); + for (int i = 0; i < fields.size(); i++) { + const string& name = fields[i]->name(); + static const char* kMacroNames[] = {"major", "minor"}; + for (int i = 0; i < GOOGLE_ARRAYSIZE(kMacroNames); ++i) { + if (name == kMacroNames[i]) { + names_to_undef.push_back(name); + break; + } + } + } for (int i = 0; i < names_to_undef.size(); ++i) { printer->Print( "#ifdef $name$\n" @@ -170,43 +143,41 @@ void FileGenerator::GenerateHeader(io::Printer* printer) { GenerateMacroUndefs(printer); - GenerateForwardDeclarations(printer); - - // Open namespace. - GenerateNamespaceOpeners(printer); - GenerateGlobalStateFunctionDeclarations(printer); - printer->Print("\n"); + GenerateForwardDeclarations(printer); - GenerateEnumDefinitions(printer); + { + NamespaceOpener ns(Namespace(file_), printer); - printer->Print(kThickSeparator); - printer->Print("\n"); + printer->Print("\n"); - GenerateMessageDefinitions(printer); + GenerateEnumDefinitions(printer); - printer->Print("\n"); - printer->Print(kThickSeparator); - printer->Print("\n"); + printer->Print(kThickSeparator); + printer->Print("\n"); - GenerateServiceDefinitions(printer); + GenerateMessageDefinitions(printer); - GenerateExtensionIdentifiers(printer); + printer->Print("\n"); + printer->Print(kThickSeparator); + printer->Print("\n"); - printer->Print("\n"); - printer->Print(kThickSeparator); - printer->Print("\n"); + GenerateServiceDefinitions(printer); - GenerateInlineFunctionDefinitions(printer); + GenerateExtensionIdentifiers(printer); - printer->Print( - "\n" - "// @@protoc_insertion_point(namespace_scope)\n" - "\n"); + printer->Print("\n"); + printer->Print(kThickSeparator); + printer->Print("\n"); + + GenerateInlineFunctionDefinitions(printer); - // Close up namespace. - GenerateNamespaceClosers(printer); + printer->Print( + "\n" + "// @@protoc_insertion_point(namespace_scope)\n" + "\n"); + } // We need to specialize some templates in the ::google::protobuf namespace: GenerateProto2NamespaceEnumSpecializations(printer); @@ -269,15 +240,12 @@ void FileGenerator::GeneratePBHeader(io::Printer* printer, // TODO(gerbens) remove this. printer->Print( "// @@protoc_insertion_point(includes)\n"); - - // Open namespace. - GenerateNamespaceOpeners(printer); - printer->Print( - "\n" - "// @@protoc_insertion_point(namespace_scope)\n"); - // Close up namespace. - GenerateNamespaceClosers(printer); - + { + NamespaceOpener ns(Namespace(file_), printer); + printer->Print( + "\n" + "// @@protoc_insertion_point(namespace_scope)\n"); + } printer->Print( "\n" "// @@protoc_insertion_point(global_scope)\n" @@ -287,7 +255,7 @@ void FileGenerator::GeneratePBHeader(io::Printer* printer, GenerateBottomHeaderGuard(printer, filename_identifier); } -void FileGenerator::GenerateSource(io::Printer* printer) { +void FileGenerator::GenerateSourceIncludes(io::Printer* printer) { const bool use_system_include = IsWellKnownMessage(file_); string header = StripProto(file_->name()) + (options_.proto_h ? ".proto.h" : ".pb.h"); @@ -295,9 +263,6 @@ void FileGenerator::GenerateSource(io::Printer* printer) { "// Generated by the protocol buffer compiler. DO NOT EDIT!\n" "// source: $filename$\n" "\n" - // The generated code calls accessors that might be deprecated. We don't - // want the compiler to warn in generated code. - "#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION\n" "#include $left$$header$$right$\n" "\n" "#include <algorithm>\n" // for swap() @@ -338,103 +303,147 @@ void FileGenerator::GenerateSource(io::Printer* printer) { } } + // TODO(gerbens) Remove this when all code in google is using the same + // proto library. This is a temporary hack to force build errors if + // the proto library is compiled with GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + // and is also linking internal proto2. This is to prevent regressions while + // we work cleaning up the code base. After this is completed and we have + // one proto lib all code uses this should be removed. + printer->Print( + "// This is a temporary google only hack\n" + "#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS\n" + "#include \"third_party/protobuf/version.h\"\n" + "#endif\n"); + printer->Print( "// @@protoc_insertion_point(includes)\n"); +} + +void FileGenerator::GenerateSourceDefaultInstance(int idx, + io::Printer* printer) { + printer->Print( + "class $classname$DefaultTypeInternal {\n" + " public:\n" + " ::google::protobuf::internal::ExplicitlyConstructed<$classname$>\n" + " _instance;\n", + "classname", message_generators_[idx]->classname_); + printer->Indent(); + message_generators_[idx]->GenerateExtraDefaultFields(printer); + printer->Outdent(); + printer->Print("} _$classname$_default_instance_;\n", "classname", + message_generators_[idx]->classname_); +} - GenerateNamespaceOpeners(printer); +namespace { - for (int i = 0; i < message_generators_.size(); i++) { - string parent; - if (IsMapEntryMessage(message_generators_[i]->descriptor_)) { - parent = ClassName(message_generators_[i]->descriptor_->containing_type(), - false) + - "::"; +// Generates weak symbol declarations for types that are to be considered weakly +// referenced. +void GenerateWeakDeclarations( + const FileDescriptor* file, const Options& options, + SCCAnalyzer* scc_analyzer, + io::Printer* printer) { + std::vector<const FieldDescriptor*> fields; + ListAllFields(file, &fields); + + // To ensure determinism and minimize the number of namespace statements, + // we output the forward declarations sorted on namespace and type / function + // name. + std::set<std::pair<string, string> > messages; + std::set<std::pair<string, string> > inits; + for (int i = 0; i < fields.size(); ++i) { + const FieldDescriptor* field = fields[i]; + bool is_weak = IsImplicitWeakField(field, options); + if (is_weak) { + const Descriptor* msg = field->message_type(); + string flns = FileLevelNamespace(msg); + string repr = ClassName(scc_analyzer->GetSCC(msg)->GetRepresentative()); + inits.insert(std::make_pair(flns, "InitDefaults" + repr)); + inits.insert(std::make_pair(flns, "AddDescriptors")); + messages.insert(std::make_pair(Namespace(msg), ClassName(msg))); } - printer->Print( - "class $classname$DefaultTypeInternal {\n" - "public:\n" - " ::google::protobuf::internal::ExplicitlyConstructed<$parent$$classname$>\n" - " _instance;\n", - "parent", parent, "classname", message_generators_[i]->classname_); - printer->Indent(); - message_generators_[i]->GenerateExtraDefaultFields(printer); - printer->Outdent(); - printer->Print( - "} _$classname$_default_instance_;\n", - "classname", message_generators_[i]->classname_); } - for (int i = 0; i < enum_generators_.size(); i++) { - enum_generators_[i]->index_in_metadata_ = i; + if (messages.empty()) { + return; } - if (HasGenericServices(file_, options_)) { - for (int i = 0; i < service_generators_.size(); i++) { - service_generators_[i]->index_in_metadata_ = i; - } + + printer->Print("\n"); + NamespaceOpener ns(printer); + for (std::set<std::pair<string, string> >::const_iterator it = + messages.begin(); + it != messages.end(); ++it) { + ns.ChangeTo(it->first); + printer->Print( + "extern __attribute__((weak)) $classname$DefaultTypeInternal " + "_$classname$_default_instance_;\n", + "classname", it->second); } + for (std::set<std::pair<string, string> >::const_iterator it = inits.begin(); + it != inits.end(); ++it) { + ns.ChangeTo(it->first); + printer->Print("void $name$() __attribute__((weak));\n", + "name", it->second); + } +} - printer->Print( - "\n" - "namespace $file_namespace$ {\n" - "\n", - "file_namespace", FileLevelNamespace(file_->name())); +} // namespace - if (HasDescriptorMethods(file_, options_)) { - printer->Print( - "\n" - "namespace {\n" - "\n"); +void FileGenerator::GenerateSourceForMessage(int idx, io::Printer* printer) { + GenerateSourceIncludes(printer); + GenerateWeakDeclarations(file_, options_, &scc_analyzer_, printer); - if (!message_generators_.empty()) { - printer->Print("::google::protobuf::Metadata file_level_metadata[$size$];\n", - "size", SimpleItoa(message_generators_.size())); - } - if (!enum_generators_.empty()) { - printer->Print( - "const ::google::protobuf::EnumDescriptor* " - "file_level_enum_descriptors[$size$];\n", - "size", SimpleItoa(enum_generators_.size())); - } - if (HasGenericServices(file_, options_) && file_->service_count() > 0) { - printer->Print( - "const ::google::protobuf::ServiceDescriptor* " - "file_level_service_descriptors[$size$];\n", - "size", SimpleItoa(file_->service_count())); + { // package namespace + NamespaceOpener ns(Namespace(file_), printer); + + // Define default instances + GenerateSourceDefaultInstance(idx, printer); + if (UsingImplicitWeakFields(file_, options_)) { + printer->Print("void $classname$_ReferenceStrong() {}\n", "classname", + message_generators_[idx]->classname_); } + // Generate classes. + printer->Print("\n"); + message_generators_[idx]->GenerateClassMethods(printer); + printer->Print( - "\n" - "} // namespace\n" - "\n"); - } + "\n" + "// @@protoc_insertion_point(namespace_scope)\n"); + } // end package namespace - // Define our externally-visible BuildDescriptors() function. (For the lite - // library, all this does is initialize default instances.) - GenerateBuildDescriptors(printer); + if (IsSCCRepresentative(message_generators_[idx]->descriptor_)) { + NamespaceOpener ns(FileLevelNamespace(file_), printer); + GenerateInitForSCC(GetSCC(message_generators_[idx]->descriptor_), printer); + } printer->Print( "\n" - "} // namespace $file_namespace$\n" - "\n", - "file_namespace", FileLevelNamespace(file_->name())); + "// @@protoc_insertion_point(global_scope)\n"); +} + +void FileGenerator::GenerateGlobalSource(io::Printer* printer) { + GenerateSourceIncludes(printer); + GenerateWeakDeclarations(file_, options_, &scc_analyzer_, printer); + + // TODO(gerbens) Generate tables here + + // Define the code to initialize reflection. This code uses a global + // constructor to register reflection data with the runtime pre-main. + if (HasDescriptorMethods(file_, options_)) { + NamespaceOpener ns(FileLevelNamespace(file_), printer); + GenerateReflectionInitializationCode(printer); + } + + NamespaceOpener ns(Namespace(file_), printer); // Generate enums. for (int i = 0; i < enum_generators_.size(); i++) { - enum_generators_[i]->GenerateMethods(printer); + enum_generators_[i]->GenerateMethods(i, printer); } - // Generate classes. - for (int i = 0; i < message_generators_.size(); i++) { - printer->Print("\n"); - printer->Print(kThickSeparator); - printer->Print("\n"); - message_generators_[i]->GenerateClassMethods(printer); - - printer->Print("#if PROTOBUF_INLINE_NOT_IN_HEADERS\n"); - // Generate class inline methods. - message_generators_[i]->GenerateInlineMethods(printer, - /* is_inline = */ false); - printer->Print("#endif // PROTOBUF_INLINE_NOT_IN_HEADERS\n"); + // Define extensions. + for (int i = 0; i < extension_generators_.size(); i++) { + extension_generators_[i]->GenerateDefinition(printer); } if (HasGenericServices(file_, options_)) { @@ -446,18 +455,76 @@ void FileGenerator::GenerateSource(io::Printer* printer) { service_generators_[i]->GenerateImplementation(printer); } } +} - // Define extensions. - for (int i = 0; i < extension_generators_.size(); i++) { - extension_generators_[i]->GenerateDefinition(printer); +void FileGenerator::GenerateSource(io::Printer* printer) { + GenerateSourceIncludes(printer); + GenerateWeakDeclarations(file_, options_, &scc_analyzer_, printer); + + { + NamespaceOpener ns(Namespace(file_), printer); + + // Define default instances + for (int i = 0; i < message_generators_.size(); i++) { + GenerateSourceDefaultInstance(i, printer); + if (UsingImplicitWeakFields(file_, options_)) { + printer->Print("void $classname$_ReferenceStrong() {}\n", "classname", + message_generators_[i]->classname_); + } + } } - printer->Print( - "\n" - "// @@protoc_insertion_point(namespace_scope)\n"); + { + NamespaceOpener ns(FileLevelNamespace(file_), printer); + // Define the initialization code to initialize the default instances. + // This code doesn't use a global constructor. + GenerateInitializationCode(printer); - GenerateNamespaceClosers(printer); + // Define the code to initialize reflection. This code uses a global + // constructor to register reflection data with the runtime pre-main. + if (HasDescriptorMethods(file_, options_)) { + GenerateReflectionInitializationCode(printer); + } + } + + + { + NamespaceOpener ns(Namespace(file_), printer); + + // Actually implement the protos + + // Generate enums. + for (int i = 0; i < enum_generators_.size(); i++) { + enum_generators_[i]->GenerateMethods(i, printer); + } + // Generate classes. + for (int i = 0; i < message_generators_.size(); i++) { + printer->Print("\n"); + printer->Print(kThickSeparator); + printer->Print("\n"); + message_generators_[i]->GenerateClassMethods(printer); + } + + if (HasGenericServices(file_, options_)) { + // Generate services. + for (int i = 0; i < service_generators_.size(); i++) { + if (i == 0) printer->Print("\n"); + printer->Print(kThickSeparator); + printer->Print("\n"); + service_generators_[i]->GenerateImplementation(printer); + } + } + + // Define extensions. + for (int i = 0; i < extension_generators_.size(); i++) { + extension_generators_[i]->GenerateDefinition(printer); + } + + printer->Print( + "\n" + "// @@protoc_insertion_point(namespace_scope)\n"); + } printer->Print( "\n" "// @@protoc_insertion_point(global_scope)\n"); @@ -512,6 +579,10 @@ class FileGenerator::ForwardDeclarations { options.dllexport_decl.empty() ? "" : options.dllexport_decl + " ", "classname", it->first); + if (options.lite_implicit_weak_fields) { + printer->Print("void $classname$_ReferenceStrong();\n", + "classname", it->first); + } } for (std::map<string, ForwardDeclarations *>::const_iterator it = namespaces_.begin(), @@ -532,13 +603,11 @@ class FileGenerator::ForwardDeclarations { std::map<string, const EnumDescriptor*> enums_; }; -void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) { +void FileGenerator::GenerateReflectionInitializationCode(io::Printer* printer) { // AddDescriptors() is a file-level procedure which adds the encoded // FileDescriptorProto for this .proto file to the global DescriptorPool for // generated files (DescriptorPool::generated_pool()). It ordinarily runs at - // static initialization time, but is not used at all in LITE_RUNTIME mode - // except when extensions are used. This procedure also constructs default - // instances and registers extensions. + // static initialization time, but is not used at all in LITE_RUNTIME mode. // // Its sibling, AssignDescriptors(), actually pulls the compiled // FileDescriptor from the DescriptorPool and uses it to populate all of @@ -547,172 +616,83 @@ void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) { // anyone calls descriptor() or GetReflection() on one of the types defined // in the file. - // In optimize_for = LITE_RUNTIME mode, we don't generate AssignDescriptors() - // and we only use AddDescriptors() to allocate default instances. - - // TODO(ckennelly): Gate this with the same options flag to enable - // table-driven parsing. - - printer->Print("PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField\n" - " const TableStruct::entries[] " - "GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n"); - printer->Indent(); - - std::vector<size_t> entries; - size_t count = 0; - for (int i = 0; i < message_generators_.size(); i++) { - size_t value = message_generators_[i]->GenerateParseOffsets(printer); - entries.push_back(value); - count += value; - } - - // We need these arrays to exist, and MSVC does not like empty arrays. - if (count == 0) { - printer->Print("{0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},\n"); - } - - printer->Outdent(); - printer->Print( - "};\n" - "\n" - "PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField\n" - " const TableStruct::aux[] " - "GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n"); - printer->Indent(); - - std::vector<size_t> aux_entries; - count = 0; - for (int i = 0; i < message_generators_.size(); i++) { - size_t value = message_generators_[i]->GenerateParseAuxTable(printer); - aux_entries.push_back(value); - count += value; - } - - if (count == 0) { - printer->Print("::google::protobuf::internal::AuxillaryParseTableField(),\n"); + if (!message_generators_.empty()) { + printer->Print("::google::protobuf::Metadata file_level_metadata[$size$];\n", "size", + SimpleItoa(message_generators_.size())); } - - printer->Outdent(); - printer->Print( - "};\n" - "PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const\n" - " TableStruct::schema[] " - "GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n"); - printer->Indent(); - - size_t offset = 0; - size_t aux_offset = 0; - for (int i = 0; i < message_generators_.size(); i++) { - message_generators_[i]->GenerateParseTable(printer, offset, aux_offset); - offset += entries[i]; - aux_offset += aux_entries[i]; + if (!enum_generators_.empty()) { + printer->Print( + "const ::google::protobuf::EnumDescriptor* " + "file_level_enum_descriptors[$size$];\n", + "size", SimpleItoa(enum_generators_.size())); } - - if (message_generators_.empty()) { - printer->Print("{ NULL, NULL, 0, -1, -1, -1, -1, NULL, false },\n"); + if (HasGenericServices(file_, options_) && file_->service_count() > 0) { + printer->Print( + "const ::google::protobuf::ServiceDescriptor* " + "file_level_service_descriptors[$size$];\n", + "size", SimpleItoa(file_->service_count())); } - printer->Outdent(); - printer->Print( - "};\n" - "\n"); - - if (!message_generators_.empty() && options_.table_driven_serialization) { + if (!message_generators_.empty()) { printer->Print( - "const ::google::protobuf::internal::FieldMetadata TableStruct::field_metadata[] " - "= {\n"); + "\n" + "const ::google::protobuf::uint32 TableStruct::offsets[] " + "GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n"); printer->Indent(); - std::vector<int> field_metadata_offsets; - int idx = 0; + std::vector<std::pair<size_t, size_t> > pairs; + pairs.reserve(message_generators_.size()); for (int i = 0; i < message_generators_.size(); i++) { - field_metadata_offsets.push_back(idx); - idx += message_generators_[i]->GenerateFieldMetadata(printer); + pairs.push_back(message_generators_[i]->GenerateOffsets(printer)); } - field_metadata_offsets.push_back(idx); printer->Outdent(); printer->Print( "};\n" - "const ::google::protobuf::internal::SerializationTable " - "TableStruct::serialization_table[] = {\n"); + "static const ::google::protobuf::internal::MigrationSchema schemas[] " + "GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n"); + printer->Indent(); + { + int offset = 0; + for (int i = 0; i < message_generators_.size(); i++) { + message_generators_[i]->GenerateSchema(printer, offset, + pairs[i].second); + offset += pairs[i].first; + } + } + printer->Outdent(); + printer->Print( + "};\n" + "\nstatic " + "::google::protobuf::Message const * const file_default_instances[] = {\n"); printer->Indent(); - // We rely on the order we layout the tables to match the order we - // calculate them with FlattenMessagesInFile, so we check here that - // these match exactly. - std::vector<const Descriptor*> calculated_order = - FlattenMessagesInFile(file_); - GOOGLE_CHECK_EQ(calculated_order.size(), message_generators_.size()); for (int i = 0; i < message_generators_.size(); i++) { - GOOGLE_CHECK_EQ(calculated_order[i], message_generators_[i]->descriptor_); + const Descriptor* descriptor = message_generators_[i]->descriptor_; printer->Print( - "{$num_fields$, TableStruct::field_metadata + $index$},\n", - "classname", message_generators_[i]->classname_, "num_fields", - SimpleItoa(field_metadata_offsets[i + 1] - field_metadata_offsets[i]), - "index", SimpleItoa(field_metadata_offsets[i])); + "reinterpret_cast<const " + "::google::protobuf::Message*>(&$ns$::_$classname$_default_instance_),\n", + "classname", ClassName(descriptor), "ns", Namespace(descriptor)); } printer->Outdent(); printer->Print( "};\n" "\n"); + } else { + // we still need these symbols to exist + printer->Print( + // MSVC doesn't like empty arrays, so we add a dummy. + "const ::google::protobuf::uint32 TableStruct::offsets[1] = {};\n" + "static const ::google::protobuf::internal::MigrationSchema* schemas = NULL;\n" + "static const ::google::protobuf::Message* const* " + "file_default_instances = NULL;\n" + "\n"); } - if (HasDescriptorMethods(file_, options_)) { - if (!message_generators_.empty()) { - printer->Print("const ::google::protobuf::uint32 TableStruct::offsets[] " - "GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n"); - printer->Indent(); - std::vector<std::pair<size_t, size_t> > pairs; - for (int i = 0; i < message_generators_.size(); i++) { - pairs.push_back(message_generators_[i]->GenerateOffsets(printer)); - } - printer->Outdent(); - printer->Print( - "};\n" - "static const ::google::protobuf::internal::MigrationSchema schemas[] " - "GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n"); - printer->Indent(); - { - int offset = 0; - for (int i = 0; i < message_generators_.size(); i++) { - message_generators_[i]->GenerateSchema(printer, offset, - pairs[i].second); - offset += pairs[i].first; - } - } - printer->Outdent(); - printer->Print( - "};\n" - "\nstatic " - "::google::protobuf::Message const * const file_default_instances[] = {\n"); - printer->Indent(); - for (int i = 0; i < message_generators_.size(); i++) { - const Descriptor* descriptor = message_generators_[i]->descriptor_; - printer->Print( - "reinterpret_cast<const " - "::google::protobuf::Message*>(&_$classname$_default_instance_),\n", - "classname", ClassName(descriptor, false)); - } - printer->Outdent(); - printer->Print( - "};\n" - "\n"); - } else { - // we still need these symbols to exist - printer->Print( - // MSVC doesn't like empty arrays, so we add a dummy. - "const ::google::protobuf::uint32 TableStruct::offsets[1] = {};\n" - "static const ::google::protobuf::internal::MigrationSchema* schemas = NULL;\n" - "static const ::google::protobuf::Message* const* " - "file_default_instances = NULL;\n"); - } - // --------------------------------------------------------------- + // --------------------------------------------------------------- - // protobuf_AssignDescriptorsOnce(): The first time it is called, calls - // AssignDescriptors(). All later times, waits for the first call to - // complete and then returns. - string message_factory = "NULL"; + // protobuf_AssignDescriptorsOnce(): The first time it is called, calls + // AssignDescriptors(). All later times, waits for the first call to + // complete and then returns. + string message_factory = "NULL"; printer->Print( - "namespace {\n" - "\n" "void protobuf_AssignDescriptors() {\n" // Make sure the file has found its way into the pool. If a descriptor // is requested *during* static init then AddDescriptors() may not have @@ -733,20 +713,6 @@ void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) { ? "file_level_service_descriptors" : "NULL", "factory", message_factory); - // TODO(gerbens) have the compiler include the schemas for map types - // so that this can go away, and we can potentially use table driven - // serialization for map types as well. - for (int i = 0; i < message_generators_.size(); i++) { - if (!IsMapEntryMessage(message_generators_[i]->descriptor_)) continue; - printer->Print( - "file_level_metadata[$index$].reflection = " - "$parent$::$classname$::CreateReflection(file_level_metadata[$index$]" - ".descriptor, _$classname$_default_instance_._instance.get_mutable());\n", - "index", SimpleItoa(i), "parent", - ClassName(message_generators_[i]->descriptor_->containing_type(), - false), - "classname", ClassName(message_generators_[i]->descriptor_, false)); - } printer->Print( "}\n" "\n" @@ -769,7 +735,8 @@ void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) { // protobuf_AssignDescriptorsOnce, because that is called from all the // GetMetadata member methods. printer->Print( - "void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;\n" + "void protobuf_RegisterTypes(const ::std::string&) " + "GOOGLE_PROTOBUF_ATTRIBUTE_COLD;\n" "void protobuf_RegisterTypes(const ::std::string&) {\n" " protobuf_AssignDescriptorsOnce();\n"); printer->Indent(); @@ -783,63 +750,15 @@ void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) { printer->Outdent(); printer->Print( - "}\n" - "\n" - "} // namespace\n"); - } - - // Now generate the InitDefaultsImpl() function. - printer->Print( - "void TableStruct::InitDefaultsImpl() {\n" - " GOOGLE_PROTOBUF_VERIFY_VERSION;\n\n" - // Force initialization of primitive values we depend on. - " ::google::protobuf::internal::InitProtobufDefaults();\n"); - - printer->Indent(); - - // Call the InitDefaults() methods for all of our dependencies, to make - // sure they get added first. - for (int i = 0; i < file_->dependency_count(); i++) { - const FileDescriptor* dependency = file_->dependency(i); - // Print the namespace prefix for the dependency. - string file_namespace = QualifiedFileLevelSymbol( - dependency->package(), FileLevelNamespace(dependency->name())); - // Call its AddDescriptors function. - printer->Print("$file_namespace$::InitDefaults();\n", "file_namespace", - file_namespace); - } - - // Allocate and initialize default instances. This can't be done lazily - // since default instances are returned by simple accessors and are used with - // extensions. Speaking of which, we also register extensions at this time. - for (int i = 0; i < message_generators_.size(); i++) { - message_generators_[i]->GenerateDefaultInstanceAllocator(printer); - } - for (int i = 0; i < extension_generators_.size(); i++) { - extension_generators_[i]->GenerateRegistration(printer); - } - for (int i = 0; i < message_generators_.size(); i++) { - message_generators_[i]->GenerateDefaultInstanceInitializer(printer); - } - printer->Outdent(); - printer->Print( - "}\n" - "\n" - "void InitDefaults() {\n" - " static GOOGLE_PROTOBUF_DECLARE_ONCE(once);\n" - " ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);\n" - "}\n"); - - // ----------------------------------------------------------------- + "}\n" + "\n"); - // Now generate the AddDescriptors() function. - printer->Print( - "namespace {\n" - "void AddDescriptorsImpl() {\n" - " InitDefaults();\n"); + // Now generate the AddDescriptors() function. + printer->Print( + "void AddDescriptorsImpl() {\n" + " InitDefaults();\n"); + printer->Indent(); - printer->Indent(); - if (HasDescriptorMethods(file_, options_)) { // Embed the descriptor. We simply serialize the entire // FileDescriptorProto // and embed it as a string literal, which is parsed and built into real @@ -850,10 +769,11 @@ void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) { file_proto.SerializeToString(&file_data); printer->Print("static const char descriptor[] " - "GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n"); + "GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) " + "= {\n"); printer->Indent(); - if (file_data.size() > 66535) { + if (file_data.size() > 65535) { // Workaround for MSVC: "Error C1091: compiler limit: string exceeds 65535 // bytes in length". Declare a static array of characters rather than use // a string literal. Only write 25 bytes per line. @@ -887,31 +807,27 @@ void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) { "::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(\n" " \"$filename$\", &protobuf_RegisterTypes);\n", "filename", file_->name()); - } // Call the AddDescriptors() methods for all of our dependencies, to make // sure they get added first. for (int i = 0; i < file_->dependency_count(); i++) { const FileDescriptor* dependency = file_->dependency(i); // Print the namespace prefix for the dependency. - string file_namespace = QualifiedFileLevelSymbol( - dependency->package(), FileLevelNamespace(dependency->name())); + string file_namespace = FileLevelNamespace(dependency); // Call its AddDescriptors function. - printer->Print("$file_namespace$::AddDescriptors();\n", "file_namespace", + printer->Print("::$file_namespace$::AddDescriptors();\n", "file_namespace", file_namespace); } printer->Outdent(); printer->Print( "}\n" - "} // anonymous namespace\n" "\n" "void AddDescriptors() {\n" " static GOOGLE_PROTOBUF_DECLARE_ONCE(once);\n" " ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);\n" "}\n"); - if (StaticInitializersForced(file_, options_)) { printer->Print( "// Force AddDescriptors() to be called at dynamic initialization " "time.\n" @@ -920,24 +836,217 @@ void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) { " AddDescriptors();\n" " }\n" "} static_descriptor_initializer;\n"); - } } -void FileGenerator::GenerateNamespaceOpeners(io::Printer* printer) { - if (package_parts_.size() > 0) printer->Print("\n"); +void FileGenerator::GenerateInitForSCC(const SCC* scc, io::Printer* printer) { + const string scc_name = ClassName(scc->GetRepresentative()); + printer->Print( + "void InitDefaults$scc_name$Impl() {\n" + " GOOGLE_PROTOBUF_VERIFY_VERSION;\n\n" + "#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS\n" + " ::google::protobuf::internal::InitProtobufDefaultsForceUnique();\n" + "#else\n" + " ::google::protobuf::internal::InitProtobufDefaults();\n" + "#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS\n", + // Force initialization of primitive values we depend on. + "scc_name", scc_name); - for (int i = 0; i < package_parts_.size(); i++) { - printer->Print("namespace $part$ {\n", - "part", package_parts_[i]); + printer->Indent(); + + // Call the InitDefaults() methods for all of our dependencies, to make + // sure they get added first. + for (int i = 0; i < scc->children.size(); i++) { + const SCC* child_scc = scc->children[i]; + const FileDescriptor* dependency = child_scc->GetRepresentative()->file(); + // Print the namespace prefix for the dependency. + string file_namespace = FileLevelNamespace(dependency); + std::map<string, string> variables; + variables["file_namespace"] = file_namespace; + variables["scc_name"] = ClassName(child_scc->GetRepresentative(), false); + bool using_weak_fields = UsingImplicitWeakFields(file_, options_); + if (using_weak_fields) { + // We're building for lite with implicit weak fields, so we need to handle + // the possibility that this InitDefaults function is not linked into the + // binary. Some of these might actually be guaranteed to be non-null since + // we might have a strong reference to the dependency (via a required + // field, for example), but it's simplest to just assume that any of them + // could be null. + printer->Print( + variables, + "if (&$file_namespace$::InitDefaults$scc_name$ != NULL) {\n" + " $file_namespace$::InitDefaults$scc_name$();\n" + "}\n"); + } else { + printer->Print(variables, + "$file_namespace$::InitDefaults$scc_name$();\n"); + } + } + + // First construct all the necessary default instances. + for (int i = 0; i < message_generators_.size(); i++) { + if (scc_analyzer_.GetSCC(message_generators_[i]->descriptor_) != scc) { + continue; + } + // TODO(gerbens) This requires this function to be friend. Remove + // the need for this. + message_generators_[i]->GenerateFieldDefaultInstances(printer); + printer->Print( + "{\n" + " void* ptr = &$ns$::_$classname$_default_instance_;\n" + " new (ptr) $ns$::$classname$();\n", + "ns", Namespace(message_generators_[i]->descriptor_), + "classname", ClassName(message_generators_[i]->descriptor_)); + if (!IsMapEntryMessage(message_generators_[i]->descriptor_)) { + printer->Print( + " ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);\n"); + } + printer->Print("}\n"); } + + // TODO(gerbens) make default instances be the same as normal instances. + // Default instances differ from normal instances because they have cross + // linked message fields. + for (int i = 0; i < message_generators_.size(); i++) { + if (scc_analyzer_.GetSCC(message_generators_[i]->descriptor_) != scc) { + continue; + } + printer->Print("$classname$::InitAsDefaultInstance();\n", "classname", + QualifiedClassName(message_generators_[i]->descriptor_)); + } + printer->Outdent(); + printer->Print("}\n\n"); + printer->Print( + "void InitDefaults$scc_name$() {\n" + " static GOOGLE_PROTOBUF_DECLARE_ONCE(once);\n" + " ::google::protobuf::GoogleOnceInit(&once, " + "&InitDefaults$scc_name$Impl);\n" + "}\n\n", + "scc_name", scc_name); } -void FileGenerator::GenerateNamespaceClosers(io::Printer* printer) { - if (package_parts_.size() > 0) printer->Print("\n"); +void FileGenerator::GenerateInitializationCode(io::Printer* printer) { + // Messages depend on the existence of a default instance, which has to + // initialized properly. The default instances are allocated in the data + // segment, but we can't quite allocate the type directly. The destructors + // cannot run at program exit as this could lead to segfaults in a threaded + // environment. Hence these instances must be inplace constructed at first + // use. + + if (options_.table_driven_parsing) { + // TODO(ckennelly): Gate this with the same options flag to enable + // table-driven parsing. + printer->Print( + "PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField\n" + " const TableStruct::entries[] " + "GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n"); + printer->Indent(); - for (int i = package_parts_.size() - 1; i >= 0; i--) { - printer->Print("} // namespace $part$\n", - "part", package_parts_[i]); + std::vector<size_t> entries; + size_t count = 0; + for (int i = 0; i < message_generators_.size(); i++) { + size_t value = message_generators_[i]->GenerateParseOffsets(printer); + entries.push_back(value); + count += value; + } + + // We need these arrays to exist, and MSVC does not like empty arrays. + if (count == 0) { + printer->Print("{0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},\n"); + } + + printer->Outdent(); + printer->Print( + "};\n" + "\n" + "PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField\n" + " const TableStruct::aux[] " + "GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n"); + printer->Indent(); + + std::vector<size_t> aux_entries; + count = 0; + for (int i = 0; i < message_generators_.size(); i++) { + size_t value = message_generators_[i]->GenerateParseAuxTable(printer); + aux_entries.push_back(value); + count += value; + } + + if (count == 0) { + printer->Print("::google::protobuf::internal::AuxillaryParseTableField(),\n"); + } + + printer->Outdent(); + printer->Print( + "};\n" + "PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const\n" + " TableStruct::schema[] " + "GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {\n"); + printer->Indent(); + + size_t offset = 0; + size_t aux_offset = 0; + for (int i = 0; i < message_generators_.size(); i++) { + message_generators_[i]->GenerateParseTable(printer, offset, aux_offset); + offset += entries[i]; + aux_offset += aux_entries[i]; + } + + if (message_generators_.empty()) { + printer->Print("{ NULL, NULL, 0, -1, -1, false },\n"); + } + + printer->Outdent(); + printer->Print( + "};\n" + "\n"); + } + + if (!message_generators_.empty() && options_.table_driven_serialization) { + printer->Print( + "const ::google::protobuf::internal::FieldMetadata TableStruct::field_metadata[] " + "= {\n"); + printer->Indent(); + std::vector<int> field_metadata_offsets; + int idx = 0; + for (int i = 0; i < message_generators_.size(); i++) { + field_metadata_offsets.push_back(idx); + idx += message_generators_[i]->GenerateFieldMetadata(printer); + } + field_metadata_offsets.push_back(idx); + printer->Outdent(); + printer->Print( + "};\n" + "const ::google::protobuf::internal::SerializationTable " + "TableStruct::serialization_table[] = {\n"); + printer->Indent(); + // We rely on the order we layout the tables to match the order we + // calculate them with FlattenMessagesInFile, so we check here that + // these match exactly. + std::vector<const Descriptor*> calculated_order = + FlattenMessagesInFile(file_); + GOOGLE_CHECK_EQ(calculated_order.size(), message_generators_.size()); + for (int i = 0; i < message_generators_.size(); i++) { + GOOGLE_CHECK_EQ(calculated_order[i], message_generators_[i]->descriptor_); + printer->Print( + "{$num_fields$, TableStruct::field_metadata + $index$},\n", + "classname", message_generators_[i]->classname_, "num_fields", + SimpleItoa(field_metadata_offsets[i + 1] - field_metadata_offsets[i]), + "index", SimpleItoa(field_metadata_offsets[i])); + } + printer->Outdent(); + printer->Print( + "};\n" + "\n"); + } + + // ----------------------------------------------------------------- + // All functionality that need private access. + + // Now generate the InitDefaults for each SCC. + for (int i = 0; i < message_generators_.size(); i++) { + if (IsSCCRepresentative(message_generators_[i]->descriptor_)) { + GenerateInitForSCC(GetSCC(message_generators_[i]->descriptor_), printer); + } } } @@ -985,6 +1094,9 @@ void FileGenerator::GenerateBottomHeaderGuard( } void FileGenerator::GenerateLibraryIncludes(io::Printer* printer) { + if (UsingImplicitWeakFields(file_, options_)) { + printer->Print("#include <google/protobuf/implicit_weak_message.h>\n"); + } printer->Print( "#include <google/protobuf/stubs/common.h>\n" @@ -1114,31 +1226,56 @@ void FileGenerator::GenerateDependencyIncludes(io::Printer* printer) { void FileGenerator::GenerateGlobalStateFunctionDeclarations( io::Printer* printer) { - // Forward-declare the AddDescriptors, AssignDescriptors - // functions, so that we can declare them to be friends of each class. +// Forward-declare the AddDescriptors, InitDefaults because these are called +// by .pb.cc files depending on this file. printer->Print( "\n" "namespace $file_namespace$ {\n" - "// Internal implementation detail -- do not call these.\n" + "// Internal implementation detail -- do not use these members.\n" "struct $dllexport_decl$TableStruct {\n" + // These tables describe how to serialize and parse messages. Used + // for table driven code. " static const ::google::protobuf::internal::ParseTableField entries[];\n" " static const ::google::protobuf::internal::AuxillaryParseTableField aux[];\n" - " static const ::google::protobuf::internal::ParseTable schema[];\n" - " static const ::google::protobuf::uint32 offsets[];\n" + " static const ::google::protobuf::internal::ParseTable schema[$num$];\n" " static const ::google::protobuf::internal::FieldMetadata field_metadata[];\n" " static const ::google::protobuf::internal::SerializationTable " "serialization_table[];\n" - // The following function(s) need to be able to access private members of - // the messages defined in the file. So we make them static members. - // This is the internal implementation of InitDefaults. It should only - // be called by InitDefaults which makes sure it will be called only once. - " static void InitDefaultsImpl();\n" - "};\n" - "void $dllexport_decl$AddDescriptors();\n" - "void $dllexport_decl$InitDefaults();\n" - "} // namespace $file_namespace$\n", - "file_namespace", FileLevelNamespace(file_->name()), "dllexport_decl", + " static const ::google::protobuf::uint32 offsets[];\n" + "};\n", + "file_namespace", FileLevelNamespace(file_), "dllexport_decl", + options_.dllexport_decl.empty() ? "" : options_.dllexport_decl + " ", + "num", SimpleItoa(std::max(size_t(1), message_generators_.size()))); + if (HasDescriptorMethods(file_, options_)) { + printer->Print( + "void $dllexport_decl$AddDescriptors();\n", "dllexport_decl", + options_.dllexport_decl.empty() ? "" : options_.dllexport_decl + " "); + } + for (int i = 0; i < message_generators_.size(); i++) { + if (!IsSCCRepresentative(message_generators_[i]->descriptor_)) continue; + string scc_name = ClassName(message_generators_[i]->descriptor_); + // TODO(gerbens) Remove the Impl from header. This is solely because + // it currently still needs to be a friend of the protos. + printer->Print( + "void $dllexport_decl$InitDefaults$scc_name$Impl();\n" + "void $dllexport_decl$InitDefaults$scc_name$();\n", + "scc_name", scc_name, "dllexport_decl", + options_.dllexport_decl.empty() ? "" : options_.dllexport_decl + " "); + } + // TODO(gerbens) This is for proto1 interoperability. Remove when proto1 + // is gone. + printer->Print( + "inline void $dllexport_decl$InitDefaults() {\n", "dllexport_decl", options_.dllexport_decl.empty() ? "" : options_.dllexport_decl + " "); + for (int i = 0; i < message_generators_.size(); i++) { + if (!IsSCCRepresentative(message_generators_[i]->descriptor_)) continue; + string scc_name = ClassName(message_generators_[i]->descriptor_); + printer->Print(" InitDefaults$scc_name$();\n", "scc_name", scc_name); + } + printer->Print("}\n"); + printer->Print( + "} // namespace $file_namespace$\n", + "file_namespace", FileLevelNamespace(file_)); } void FileGenerator::GenerateMessageDefinitions(io::Printer* printer) { @@ -1187,41 +1324,6 @@ void FileGenerator::GenerateExtensionIdentifiers(io::Printer* printer) { } void FileGenerator::GenerateInlineFunctionDefinitions(io::Printer* printer) { - // An aside about inline functions in .proto.h mode: - // - // The PROTOBUF_INLINE_NOT_IN_HEADERS symbol controls conditionally - // moving much of the inline functions to the .pb.cc file, which can be a - // significant performance benefit for compilation time, at the expense - // of non-inline function calls. - // - // However, in .proto.h mode, the definition of the internal dependent - // base class must remain in the header, and can never be out-lined. The - // dependent base class also needs access to has-bit manipuation - // functions, so the has-bit functions must be unconditionally inlined in - // proto_h mode. - // - // This gives us three flavors of functions: - // - // 1. Functions on the message not used by the internal dependent base - // class: in .proto.h mode, only some functions are defined on the - // message class; others are defined on the dependent base class. - // These are guarded and can be out-lined. These are generated by - // GenerateInlineMethods, and include has_* bit functions in - // non-proto_h mode. - // - // 2. Functions on the internal dependent base class: these functions - // are dependent on a template parameter, so they always need to - // remain in the header. - // - // 3. Functions on the message that are used by the dependent base: the - // dependent base class down casts itself to the message - // implementation class to access these functions (the has_* bit - // manipulation functions). Unlike #1, these functions must - // unconditionally remain in the header. These are emitted by - // GenerateDependentInlineMethods, even though they are not actually - // dependent. - - printer->Print("#if !PROTOBUF_INLINE_NOT_IN_HEADERS\n"); // TODO(gerbens) remove pragmas when gcc is no longer used. Current version // of gcc fires a bogus error when compiled with strict-aliasing. printer->Print( @@ -1235,14 +1337,12 @@ void FileGenerator::GenerateInlineFunctionDefinitions(io::Printer* printer) { printer->Print(kThinSeparator); printer->Print("\n"); } - message_generators_[i]->GenerateInlineMethods(printer, - /* is_inline = */ true); + message_generators_[i]->GenerateInlineMethods(printer); } printer->Print( "#ifdef __GNUC__\n" " #pragma GCC diagnostic pop\n" "#endif // __GNUC__\n"); - printer->Print("#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS\n"); for (int i = 0; i < message_generators_.size(); i++) { if (i > 0) { diff --git a/src/google/protobuf/compiler/cpp/cpp_file.h b/src/google/protobuf/compiler/cpp/cpp_file.h index e10fe2f3..7e61cbad 100644 --- a/src/google/protobuf/compiler/cpp/cpp_file.h +++ b/src/google/protobuf/compiler/cpp/cpp_file.h @@ -35,10 +35,12 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_FILE_H__ #define GOOGLE_PROTOBUF_COMPILER_CPP_FILE_H__ +#include <algorithm> #include <memory> #ifndef _SHARED_PTR_H #include <google/protobuf/stubs/shared_ptr.h> #endif +#include <set> #include <string> #include <vector> #include <google/protobuf/stubs/common.h> @@ -82,16 +84,21 @@ class FileGenerator { const string& info_path); void GenerateSource(io::Printer* printer); + int NumMessages() const { return message_generators_.size(); } + // Similar to GenerateSource but generates only one message + void GenerateSourceForMessage(int idx, io::Printer* printer); + void GenerateGlobalSource(io::Printer* printer); + private: // Internal type used by GenerateForwardDeclarations (defined in file.cc). class ForwardDeclarations; - // Generate the BuildDescriptors() procedure, which builds all descriptors - // for types defined in the file. - void GenerateBuildDescriptors(io::Printer* printer); + void GenerateSourceIncludes(io::Printer* printer); + void GenerateSourceDefaultInstance(int idx, io::Printer* printer); - void GenerateNamespaceOpeners(io::Printer* printer); - void GenerateNamespaceClosers(io::Printer* printer); + void GenerateInitForSCC(const SCC* scc, io::Printer* printer); + void GenerateInitializationCode(io::Printer* printer); + void GenerateReflectionInitializationCode(io::Printer* printer); // For other imports, generates their forward-declarations. void GenerateForwardDeclarations(io::Printer* printer); @@ -143,11 +150,23 @@ class FileGenerator { // a breaking change so we prefer the #undef approach. void GenerateMacroUndefs(io::Printer* printer); + bool IsSCCRepresentative(const Descriptor* d) { + return GetSCCRepresentative(d) == d; + } + const Descriptor* GetSCCRepresentative(const Descriptor* d) { + return GetSCC(d)->GetRepresentative(); + } + const SCC* GetSCC(const Descriptor* d) { + return scc_analyzer_.GetSCC(d); + } + + const FileDescriptor* file_; const Options options_; SCCAnalyzer scc_analyzer_; + // Contains the post-order walk of all the messages (and child messages) in // this file. If you need a pre-order walk just reverse iterate. std::vector<MessageGenerator*> message_generators_; @@ -155,10 +174,8 @@ class FileGenerator { std::vector<ServiceGenerator*> service_generators_; std::vector<ExtensionGenerator*> extension_generators_; - // These members are just for owning (and thus proper deleting). Some of the - // message_ and enum_generators above are owned by child messages. - google::protobuf::scoped_array<google::protobuf::scoped_ptr<MessageGenerator> > - message_generators_owner_; + // These members are just for owning (and thus proper deleting). + // Nested (enum/extension)_generators are owned by child messages. google::protobuf::scoped_array<google::protobuf::scoped_ptr<EnumGenerator> > enum_generators_owner_; google::protobuf::scoped_array<google::protobuf::scoped_ptr<ServiceGenerator> > service_generators_owner_; diff --git a/src/google/protobuf/compiler/cpp/cpp_generator.cc b/src/google/protobuf/compiler/cpp/cpp_generator.cc index 68abd0ef..e01e5dca 100644 --- a/src/google/protobuf/compiler/cpp/cpp_generator.cc +++ b/src/google/protobuf/compiler/cpp/cpp_generator.cc @@ -46,6 +46,7 @@ #include <google/protobuf/io/printer.h> #include <google/protobuf/io/zero_copy_stream.h> #include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/stubs/strutil.h> namespace google { namespace protobuf { @@ -84,7 +85,7 @@ bool CppGenerator::Generate(const FileDescriptor* file, // __declspec(dllimport) depending on what is being compiled. // Options file_options; - + bool split_source = false; for (int i = 0; i < options.size(); i++) { if (options[i].first == "dllexport_decl") { file_options.dllexport_decl = options[i].second; @@ -98,10 +99,14 @@ bool CppGenerator::Generate(const FileDescriptor* file, file_options.annotation_guard_name = options[i].second; } else if (options[i].first == "lite") { file_options.enforce_lite = true; + } else if (options[i].first == "lite_implicit_weak_fields") { + file_options.lite_implicit_weak_fields = true; } else if (options[i].first == "table_driven_parsing") { file_options.table_driven_parsing = true; } else if (options[i].first == "table_driven_serialization") { file_options.table_driven_serialization = true; + } else if (options[i].first == "split_source") { + split_source = true; } else { *error = "Unknown generator option: " + options[i].first; return false; @@ -135,14 +140,13 @@ bool CppGenerator::Generate(const FileDescriptor* file, } } - basename.append(".pb"); { google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output( - generator_context->Open(basename + ".h")); + generator_context->Open(basename + ".pb.h")); GeneratedCodeInfo annotations; io::AnnotationProtoCollector<GeneratedCodeInfo> annotation_collector( &annotations); - string info_path = basename + ".h.meta"; + string info_path = basename + ".pb.h.meta"; io::Printer printer(output.get(), '$', file_options.annotate_headers ? &annotation_collector : NULL); @@ -156,9 +160,24 @@ bool CppGenerator::Generate(const FileDescriptor* file, } // Generate cc file. - { + if (split_source) { + { + // This is the global .cc file, containing enum/services/tables/reflection + google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output( + generator_context->Open(basename + ".pb.cc")); + io::Printer printer(output.get(), '$'); + file_generator.GenerateGlobalSource(&printer); + } + for (int i = 0; i < file_generator.NumMessages(); i++) { + // TODO(gerbens) Agree on naming scheme. + google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output( + generator_context->Open(basename + "." + SimpleItoa(i) + ".cc")); + io::Printer printer(output.get(), '$'); + file_generator.GenerateSourceForMessage(i, &printer); + } + } else { google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output( - generator_context->Open(basename + ".cc")); + generator_context->Open(basename + ".pb.cc")); io::Printer printer(output.get(), '$'); file_generator.GenerateSource(&printer); } diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.cc b/src/google/protobuf/compiler/cpp/cpp_helpers.cc index 00959796..96950e52 100644 --- a/src/google/protobuf/compiler/cpp/cpp_helpers.cc +++ b/src/google/protobuf/compiler/cpp/cpp_helpers.cc @@ -32,10 +32,11 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. +#include <google/protobuf/stubs/hash.h> #include <limits> #include <map> +#include <queue> #include <vector> -#include <google/protobuf/stubs/hash.h> #include <google/protobuf/stubs/logging.h> #include <google/protobuf/stubs/common.h> @@ -105,6 +106,30 @@ bool HasExtension(const Descriptor* descriptor) { return false; } +// Encode [0..63] as 'A'-'Z', 'a'-'z', '0'-'9', '_' +char Base63Char(int value) { + GOOGLE_CHECK_GE(value, 0); + if (value < 26) return 'A' + value; + value -= 26; + if (value < 26) return 'a' + value; + value -= 26; + if (value < 10) return '0' + value; + GOOGLE_CHECK_EQ(value, 10); + return '_'; +} + +// Given a c identifier has 63 legal characters we can't implement base64 +// encoding. So we return the k least significant "digits" in base 63. +template <typename I> +string Base63(I n, int k) { + string res; + while (k-- > 0) { + res += Base63Char(static_cast<int>(n % 63)); + n /= 63; + } + return res; +} + } // namespace string UnderscoresToCamelCase(const string& input, bool cap_next_letter) { @@ -137,44 +162,63 @@ const char kThickSeparator[] = const char kThinSeparator[] = "// -------------------------------------------------------------------\n"; -string ClassName(const Descriptor* descriptor, bool qualified) { - - // Find "outer", the descriptor of the top-level message in which - // "descriptor" is embedded. - const Descriptor* outer = descriptor; - while (outer->containing_type() != NULL) outer = outer->containing_type(); - - const string& outer_name = outer->full_name(); - string inner_name = descriptor->full_name().substr(outer_name.size()); - - if (qualified) { - return "::" + DotsToColons(outer_name) + DotsToUnderscores(inner_name); - } else { - return outer->name() + DotsToUnderscores(inner_name); +bool CanInitializeByZeroing(const FieldDescriptor* field) { + if (field->is_repeated() || field->is_extension()) return false; + switch (field->cpp_type()) { + case FieldDescriptor::CPPTYPE_ENUM: + return field->default_value_enum()->number() == 0; + case FieldDescriptor::CPPTYPE_INT32: + return field->default_value_int32() == 0; + case FieldDescriptor::CPPTYPE_INT64: + return field->default_value_int64() == 0; + case FieldDescriptor::CPPTYPE_UINT32: + return field->default_value_uint32() == 0; + case FieldDescriptor::CPPTYPE_UINT64: + return field->default_value_uint64() == 0; + case FieldDescriptor::CPPTYPE_FLOAT: + return field->default_value_float() == 0; + case FieldDescriptor::CPPTYPE_DOUBLE: + return field->default_value_double() == 0; + case FieldDescriptor::CPPTYPE_BOOL: + return field->default_value_bool() == false; + default: + return false; } } -string ClassName(const EnumDescriptor* enum_descriptor, bool qualified) { +string ClassName(const Descriptor* descriptor) { + const Descriptor* parent = descriptor->containing_type(); + string res; + if (parent) res += ClassName(parent) + "_"; + res += descriptor->name(); + if (IsMapEntryMessage(descriptor)) res += "_DoNotUse"; + return res; +} + +string ClassName(const EnumDescriptor* enum_descriptor) { if (enum_descriptor->containing_type() == NULL) { - if (qualified) { - return "::" + DotsToColons(enum_descriptor->full_name()); - } else { - return enum_descriptor->name(); - } + return enum_descriptor->name(); } else { - string result = ClassName(enum_descriptor->containing_type(), qualified); - result += '_'; - result += enum_descriptor->name(); - return result; + return ClassName(enum_descriptor->containing_type()) + "_" + + enum_descriptor->name(); } } +string Namespace(const string& package) { + if (package.empty()) return ""; + return "::" + DotsToColons(package); +} + string DefaultInstanceName(const Descriptor* descriptor) { string prefix = descriptor->file()->package().empty() ? "" : "::"; return prefix + DotsToColons(descriptor->file()->package()) + "::_" + ClassName(descriptor, false) + "_default_instance_"; } +string ReferenceFunctionName(const Descriptor* descriptor) { + return QualifiedClassName(descriptor) + "_ReferenceStrong"; +} + string DependentBaseClassTemplateName(const Descriptor* descriptor) { return ClassName(descriptor, false) + "_InternalBase"; } @@ -210,6 +254,30 @@ string EnumValueName(const EnumValueDescriptor* enum_value) { return result; } +int EstimateAlignmentSize(const FieldDescriptor* field) { + if (field == NULL) return 0; + if (field->is_repeated()) return 8; + switch (field->cpp_type()) { + case FieldDescriptor::CPPTYPE_BOOL: + return 1; + + case FieldDescriptor::CPPTYPE_INT32: + case FieldDescriptor::CPPTYPE_UINT32: + case FieldDescriptor::CPPTYPE_ENUM: + case FieldDescriptor::CPPTYPE_FLOAT: + return 4; + + case FieldDescriptor::CPPTYPE_INT64: + case FieldDescriptor::CPPTYPE_UINT64: + case FieldDescriptor::CPPTYPE_DOUBLE: + case FieldDescriptor::CPPTYPE_STRING: + case FieldDescriptor::CPPTYPE_MESSAGE: + return 8; + } + GOOGLE_LOG(FATAL) << "Can't get here."; + return -1; // Make compiler happy. +} + string FieldConstantName(const FieldDescriptor *field) { string field_name = UnderscoresToCamelCase(field->name(), true); string result = "k" + field_name + "FieldNumber"; @@ -484,19 +552,6 @@ string SafeFunctionName(const Descriptor* descriptor, return function_name; } -bool StaticInitializersForced(const FileDescriptor* file, - const Options& options) { - if (HasDescriptorMethods(file, options) || file->extension_count() > 0) { - return true; - } - for (int i = 0; i < file->message_type_count(); ++i) { - if (HasExtension(file->message_type(i))) { - return true; - } - } - return false; -} - static bool HasMapFields(const Descriptor* descriptor) { for (int i = 0; i < descriptor->field_count(); ++i) { @@ -672,13 +727,11 @@ void Flatten(const Descriptor* descriptor, } // namespace -std::vector<const Descriptor*> FlattenMessagesInFile( - const FileDescriptor* file) { - std::vector<const Descriptor*> result; +void FlattenMessagesInFile(const FileDescriptor* file, + std::vector<const Descriptor*>* result) { for (int i = 0; i < file->message_type_count(); i++) { - Flatten(file->message_type(i), &result); + Flatten(file->message_type(i), result); } - return result; } bool HasWeakFields(const Descriptor* descriptor) { @@ -689,6 +742,26 @@ bool HasWeakFields(const FileDescriptor* file) { return false; } +bool UsingImplicitWeakFields(const FileDescriptor* file, + const Options& options) { + return options.lite_implicit_weak_fields && + GetOptimizeFor(file, options) == FileOptions::LITE_RUNTIME; +} + + +bool IsImplicitWeakField(const FieldDescriptor* field, const Options& options) { + return UsingImplicitWeakFields(field->file(), options) && + field->type() == FieldDescriptor::TYPE_MESSAGE && + !field->is_required() && !field->is_repeated() && !field->is_map() && + field->containing_oneof() == NULL; +} + +struct CompareDescriptors { + bool operator()(const Descriptor* a, const Descriptor* b) { + return a->full_name() < b->full_name(); + } +}; + SCCAnalyzer::NodeData SCCAnalyzer::DFS(const Descriptor* descriptor) { // Must not have visited already. GOOGLE_DCHECK_EQ(cache_.count(descriptor), 0); @@ -728,10 +801,33 @@ SCCAnalyzer::NodeData SCCAnalyzer::DFS(const Descriptor* descriptor) { if (scc_desc == descriptor) break; } + + // The order of descriptors is random and depends how this SCC was + // discovered. In-order to ensure maximum stability we sort it by name. + std::sort(scc->descriptors.begin(), scc->descriptors.end(), + CompareDescriptors()); + AddChildren(scc); } return result; } +void SCCAnalyzer::AddChildren(SCC* scc) { + std::set<const SCC*> seen; + for (int i = 0; i < scc->descriptors.size(); i++) { + const Descriptor* descriptor = scc->descriptors[i]; + for (int j = 0; j < descriptor->field_count(); j++) { + const Descriptor* child_msg = descriptor->field(j)->message_type(); + if (child_msg) { + const SCC* child = GetSCC(child_msg); + if (child == scc) continue; + if (seen.insert(child).second) { + scc->children.push_back(child); + } + } + } + } +} + MessageAnalysis SCCAnalyzer::GetSCCAnalysis(const SCC* scc) { if (analysis_cache_.count(scc)) return analysis_cache_[scc]; MessageAnalysis result = MessageAnalysis(); @@ -784,6 +880,46 @@ MessageAnalysis SCCAnalyzer::GetSCCAnalysis(const SCC* scc) { return analysis_cache_[scc] = result; } +void ListAllFields(const Descriptor* d, + std::vector<const FieldDescriptor*>* fields) { + // Collect sub messages + for (int i = 0; i < d->nested_type_count(); i++) { + ListAllFields(d->nested_type(i), fields); + } + // Collect message level extensions. + for (int i = 0; i < d->extension_count(); i++) { + fields->push_back(d->extension(i)); + } + // Add types of fields necessary + for (int i = 0; i < d->field_count(); i++) { + fields->push_back(d->field(i)); + } +} + +void ListAllFields(const FileDescriptor* d, + std::vector<const FieldDescriptor*>* fields) { + // Collect file level message. + for (int i = 0; i < d->message_type_count(); i++) { + ListAllFields(d->message_type(i), fields); + } + // Collect message level extensions. + for (int i = 0; i < d->extension_count(); i++) { + fields->push_back(d->extension(i)); + } +} + +void ListAllTypesForServices(const FileDescriptor* fd, + std::vector<const Descriptor*>* types) { + for (int i = 0; i < fd->service_count(); i++) { + const ServiceDescriptor* sd = fd->service(i); + for (int j = 0; j < sd->method_count(); j++) { + const MethodDescriptor* method = sd->method(j); + types->push_back(method->input_type()); + types->push_back(method->output_type()); + } + } +} + } // namespace cpp } // namespace compiler } // namespace protobuf diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.h b/src/google/protobuf/compiler/cpp/cpp_helpers.h index 6ae68591..e0f809c9 100644 --- a/src/google/protobuf/compiler/cpp/cpp_helpers.h +++ b/src/google/protobuf/compiler/cpp/cpp_helpers.h @@ -38,16 +38,13 @@ #include <map> #include <string> #include <google/protobuf/compiler/cpp/cpp_options.h> +#include <google/protobuf/io/printer.h> #include <google/protobuf/descriptor.pb.h> #include <google/protobuf/descriptor.h> +#include <google/protobuf/stubs/strutil.h> namespace google { namespace protobuf { - -namespace io { -class Printer; -} - namespace compiler { namespace cpp { @@ -56,6 +53,31 @@ namespace cpp { extern const char kThickSeparator[]; extern const char kThinSeparator[]; +// Name space of the proto file. This namespace is such that the string +// "<namespace>::some_name" is the correct fully qualified namespace. +// This means if the package is empty the namespace is "", and otherwise +// the namespace is "::foo::bar::...::baz" without trailing semi-colons. +string Namespace(const string& package); +inline string Namespace(const FileDescriptor* d) { + return Namespace(d->package()); +} +template <typename Desc> +string Namespace(const Desc* d) { + return Namespace(d->file()); +} + +// Returns true if it's safe to reset "field" to zero. +bool CanInitializeByZeroing(const FieldDescriptor* field); + +string ClassName(const Descriptor* descriptor); +string ClassName(const EnumDescriptor* enum_descriptor); +template <typename Desc> +string QualifiedClassName(const Desc* d) { + return Namespace(d) + "::" + ClassName(d); +} + +// DEPRECATED just use ClassName or QualifiedClassName, a boolean is very +// unreadable at the callsite. // Returns the non-nested type name for the given type. If "qualified" is // true, prefix the type with the full namespace. For example, if you had: // package foo.bar; @@ -64,12 +86,22 @@ extern const char kThinSeparator[]; // ::foo::bar::Baz_Qux // While the non-qualified version would be: // Baz_Qux -string ClassName(const Descriptor* descriptor, bool qualified); -string ClassName(const EnumDescriptor* enum_descriptor, bool qualified); +inline string ClassName(const Descriptor* descriptor, bool qualified) { + return qualified ? QualifiedClassName(descriptor) : ClassName(descriptor); +} + +inline string ClassName(const EnumDescriptor* descriptor, bool qualified) { + return qualified ? QualifiedClassName(descriptor) : ClassName(descriptor); +} // Fully qualified name of the default_instance of this message. string DefaultInstanceName(const Descriptor* descriptor); +// Returns the name of a no-op function that we can call to introduce a linker +// dependency on the given message type. This is used to implement implicit weak +// fields. +string ReferenceFunctionName(const Descriptor* descriptor); + // Name of the CRTP class template (for use with proto_h). // This is a class name, like "ProtoName_InternalBase". string DependentBaseClassTemplateName(const Descriptor* descriptor); @@ -92,6 +124,12 @@ string FieldName(const FieldDescriptor* field); // Get the sanitized name that should be used for the given enum in C++ code. string EnumValueName(const EnumValueDescriptor* enum_value); +// Returns an estimate of the compiler's alignment for the field. This +// can't guarantee to be correct because the generated code could be compiled on +// different systems with different alignment rules. The estimates below assume +// 64-bit pointers. +int EstimateAlignmentSize(const FieldDescriptor* field); + // Get the unqualified name that should be used for a field's field // number constant. string FieldConstantName(const FieldDescriptor *field); @@ -150,6 +188,12 @@ string FilenameIdentifier(const string& filename); // For each .proto file generates a unique namespace. In this namespace global // definitions are put to prevent collisions. string FileLevelNamespace(const string& filename); +inline string FileLevelNamespace(const FileDescriptor* file) { + return FileLevelNamespace(file->name()); +} +inline string FileLevelNamespace(const Descriptor* d) { + return FileLevelNamespace(d->file()); +} // Return the qualified C++ name for a file level symbol. string QualifiedFileLevelSymbol(const string& package, const string& name); @@ -225,10 +269,6 @@ inline bool HasFastArraySerialization(const FileDescriptor* file, return GetOptimizeFor(file, options) == FileOptions::SPEED; } -// Returns whether we have to generate code with static initializers. -bool StaticInitializersForced(const FileDescriptor* file, - const Options& options); - inline bool IsMapEntryMessage(const Descriptor* descriptor) { return descriptor->options().map_entry(); @@ -265,6 +305,11 @@ inline bool SupportsArenas(const FieldDescriptor* field) { return SupportsArenas(field->file()); } +inline bool IsCrossFileMessage(const FieldDescriptor* field) { + return field->type() == FieldDescriptor::TYPE_MESSAGE && + field->message_type()->file() != field->file(); +} + bool IsAnyMessage(const FileDescriptor* descriptor); bool IsAnyMessage(const Descriptor* descriptor); @@ -289,12 +334,25 @@ inline ::google::protobuf::FileOptions_OptimizeMode GetOptimizeFor( } // This orders the messages in a .pb.cc as it's outputted by file.cc -std::vector<const Descriptor*> FlattenMessagesInFile( - const FileDescriptor* file); +void FlattenMessagesInFile(const FileDescriptor* file, + std::vector<const Descriptor*>* result); +inline std::vector<const Descriptor*> FlattenMessagesInFile( + const FileDescriptor* file) { + std::vector<const Descriptor*> result; + FlattenMessagesInFile(file, &result); + return result; +} bool HasWeakFields(const Descriptor* desc); bool HasWeakFields(const FileDescriptor* desc); +// Indicates whether we should use implicit weak fields for this file. +bool UsingImplicitWeakFields(const FileDescriptor* file, + const Options& options); + +// Indicates whether to treat this field as implicitly weak. +bool IsImplicitWeakField(const FieldDescriptor* field, const Options& options); + // Returns true if the "required" restriction check should be ignored for the // given field. inline static bool ShouldIgnoreRequiredFieldCheck(const FieldDescriptor* field, @@ -302,8 +360,46 @@ inline static bool ShouldIgnoreRequiredFieldCheck(const FieldDescriptor* field, return false; } +class LIBPROTOC_EXPORT NamespaceOpener { + public: + explicit NamespaceOpener(io::Printer* printer) : printer_(printer) {} + NamespaceOpener(const string& name, io::Printer* printer) + : printer_(printer) { + ChangeTo(name); + } + ~NamespaceOpener() { ChangeTo(""); } + + void ChangeTo(const string& name) { + std::vector<string> new_stack_ = + Split(name, "::", true); + int len = std::min(name_stack_.size(), new_stack_.size()); + int common_idx = 0; + while (common_idx < len) { + if (name_stack_[common_idx] != new_stack_[common_idx]) break; + common_idx++; + } + for (int i = name_stack_.size() - 1; i >= common_idx; i--) { + printer_->Print("} // namespace $ns$\n", "ns", name_stack_[i]); + } + name_stack_.swap(new_stack_); + for (int i = common_idx; i < name_stack_.size(); i++) { + printer_->Print("namespace $ns$ {\n", "ns", name_stack_[i]); + } + } + + private: + io::Printer* printer_; + std::vector<string> name_stack_; +}; + +// Description of each strongly connected component. Note that the order +// of both the descriptors in this SCC and the order of children is +// deterministic. struct SCC { std::vector<const Descriptor*> descriptors; + std::vector<const SCC*> children; + + const Descriptor* GetRepresentative() const { return descriptors[0]; } }; struct MessageAnalysis { @@ -357,8 +453,16 @@ class LIBPROTOC_EXPORT SCCAnalyzer { // Tarjan's Strongly Connected Components algo NodeData DFS(const Descriptor* descriptor); + + // Add the SCC's that are children of this SCC to its children. + void AddChildren(SCC* scc); }; +void ListAllFields(const FileDescriptor* d, + std::vector<const FieldDescriptor*>* fields); +void ListAllTypesForServices(const FileDescriptor* fd, + std::vector<const Descriptor*>* types); + } // namespace cpp } // namespace compiler } // namespace protobuf diff --git a/src/google/protobuf/compiler/cpp/cpp_map_field.cc b/src/google/protobuf/compiler/cpp/cpp_map_field.cc index da33d29b..b22c0754 100644 --- a/src/google/protobuf/compiler/cpp/cpp_map_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_map_field.cc @@ -114,50 +114,13 @@ MapFieldGenerator::~MapFieldGenerator() {} void MapFieldGenerator:: GeneratePrivateMembers(io::Printer* printer) const { - if (HasDescriptorMethods(descriptor_->file(), options_)) { - printer->Print( - variables_, - "public:\n" - "class $map_classname$ : public " - "::google::protobuf::internal::MapEntry<$map_classname$, \n" - " $key_cpp$, $val_cpp$,\n" - " $key_wire_type$,\n" - " $val_wire_type$,\n" - " $default_enum_value$ > {\n" - "public:\n" - " typedef ::google::protobuf::internal::MapEntry<$map_classname$, \n" - " $key_cpp$, $val_cpp$,\n" - " $key_wire_type$,\n" - " $val_wire_type$,\n" - " $default_enum_value$ > SuperType;\n" - " $map_classname$();\n" - " $map_classname$(::google::protobuf::Arena* arena);\n" - " void MergeFrom(const ::google::protobuf::Message& other) PROTOBUF_FINAL;\n" - " void MergeFrom(const $map_classname$& other);\n" - " static const Message* internal_default_instance() { return " - "reinterpret_cast<const " - "Message*>(&_$map_classname$_default_instance_); }\n" - " ::google::protobuf::Metadata GetMetadata() const;\n" - "};\n"); - } else { - printer->Print(variables_, - "public:\n" - "typedef ::google::protobuf::internal::MapEntryLite<\n" - " $key_cpp$, $val_cpp$,\n" - " $key_wire_type$,\n" - " $val_wire_type$,\n" - " $default_enum_value$ >\n" - " $map_classname$;\n"); - } printer->Print(variables_, - "private:\n" "::google::protobuf::internal::MapField$lite$<\n" " $map_classname$,\n" " $key_cpp$, $val_cpp$,\n" " $key_wire_type$,\n" " $val_wire_type$,\n" - " $default_enum_value$ > $name$_;\n" - "private:\n"); + " $default_enum_value$ > $name$_;\n"); } void MapFieldGenerator:: @@ -174,17 +137,14 @@ GenerateAccessorDeclarations(io::Printer* printer) const { } void MapFieldGenerator:: -GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const { - std::map<string, string> variables(variables_); - variables["inline"] = is_inline ? "inline" : ""; - printer->Print(variables, - "$inline$ const ::google::protobuf::Map< $key_cpp$, $val_cpp$ >&\n" +GenerateInlineAccessorDefinitions(io::Printer* printer) const { + printer->Print(variables_, + "inline const ::google::protobuf::Map< $key_cpp$, $val_cpp$ >&\n" "$classname$::$name$() const {\n" " // @@protoc_insertion_point(field_map:$full_name$)\n" " return $name$_.GetMap();\n" "}\n" - "$inline$ ::google::protobuf::Map< $key_cpp$, $val_cpp$ >*\n" + "inline ::google::protobuf::Map< $key_cpp$, $val_cpp$ >*\n" "$classname$::mutable_$name$() {\n" " // @@protoc_insertion_point(field_mutable_map:$full_name$)\n" " return $name$_.MutableMap();\n" @@ -193,9 +153,7 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, void MapFieldGenerator:: GenerateClearingCode(io::Printer* printer) const { - std::map<string, string> variables(variables_); - variables["this_message"] = dependent_field_ ? DependentBaseDownCast() : ""; - printer->Print(variables, "$this_message$$name$_.Clear();\n"); + printer->Print(variables_, "$name$_.Clear();\n"); } void MapFieldGenerator:: @@ -262,7 +220,7 @@ GenerateMergeFromCodedStream(io::Printer* printer) const { printer->Print(variables_, " unknown_fields_stream.WriteVarint32($tag$u);\n" " unknown_fields_stream.WriteVarint32(\n" - " static_cast<google::protobuf::uint32>(data.size()));\n" + " static_cast< ::google::protobuf::uint32>(data.size()));\n" " unknown_fields_stream.WriteString(data);\n"); } diff --git a/src/google/protobuf/compiler/cpp/cpp_map_field.h b/src/google/protobuf/compiler/cpp/cpp_map_field.h index 02e66497..88e3b464 100644 --- a/src/google/protobuf/compiler/cpp/cpp_map_field.h +++ b/src/google/protobuf/compiler/cpp/cpp_map_field.h @@ -49,8 +49,7 @@ class MapFieldGenerator : public FieldGenerator { // implements FieldGenerator --------------------------------------- void GeneratePrivateMembers(io::Printer* printer) const; void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const; void GenerateClearingCode(io::Printer* printer) const; void GenerateMergingCode(io::Printer* printer) const; void GenerateSwappingCode(io::Printer* printer) const; diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc index 63ebb3c5..60467598 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -48,6 +48,7 @@ #include <google/protobuf/compiler/cpp/cpp_extension.h> #include <google/protobuf/compiler/cpp/cpp_field.h> #include <google/protobuf/compiler/cpp/cpp_helpers.h> +#include <google/protobuf/compiler/cpp/cpp_padding_optimizer.h> #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/io/printer.h> #include <google/protobuf/descriptor.pb.h> @@ -109,106 +110,6 @@ struct ExtensionRangeSorter { } }; -// This returns an estimate of the compiler's alignment for the field. This -// can't guarantee to be correct because the generated code could be compiled on -// different systems with different alignment rules. The estimates below assume -// 64-bit pointers. -int EstimateAlignmentSize(const FieldDescriptor* field) { - if (field == NULL) return 0; - if (field->is_repeated()) return 8; - switch (field->cpp_type()) { - case FieldDescriptor::CPPTYPE_BOOL: - return 1; - - case FieldDescriptor::CPPTYPE_INT32: - case FieldDescriptor::CPPTYPE_UINT32: - case FieldDescriptor::CPPTYPE_ENUM: - case FieldDescriptor::CPPTYPE_FLOAT: - return 4; - - case FieldDescriptor::CPPTYPE_INT64: - case FieldDescriptor::CPPTYPE_UINT64: - case FieldDescriptor::CPPTYPE_DOUBLE: - case FieldDescriptor::CPPTYPE_STRING: - case FieldDescriptor::CPPTYPE_MESSAGE: - return 8; - } - GOOGLE_LOG(FATAL) << "Can't get here."; - return -1; // Make compiler happy. -} - -// FieldGroup is just a helper for OptimizePadding below. It holds a vector of -// fields that are grouped together because they have compatible alignment, and -// a preferred location in the final field ordering. -class FieldGroup { - public: - FieldGroup() - : preferred_location_(0) {} - - // A group with a single field. - FieldGroup(float preferred_location, const FieldDescriptor* field) - : preferred_location_(preferred_location), - fields_(1, field) {} - - // Append the fields in 'other' to this group. - void Append(const FieldGroup& other) { - if (other.fields_.empty()) { - return; - } - // Preferred location is the average among all the fields, so we weight by - // the number of fields on each FieldGroup object. - preferred_location_ = - (preferred_location_ * fields_.size() + - (other.preferred_location_ * other.fields_.size())) / - (fields_.size() + other.fields_.size()); - fields_.insert(fields_.end(), other.fields_.begin(), other.fields_.end()); - } - - void SetPreferredLocation(float location) { preferred_location_ = location; } - const std::vector<const FieldDescriptor*>& fields() const { return fields_; } - - // FieldGroup objects sort by their preferred location. - bool operator<(const FieldGroup& other) const { - return preferred_location_ < other.preferred_location_; - } - - private: - // "preferred_location_" is an estimate of where this group should go in the - // final list of fields. We compute this by taking the average index of each - // field in this group in the original ordering of fields. This is very - // approximate, but should put this group close to where its member fields - // originally went. - float preferred_location_; - std::vector<const FieldDescriptor*> fields_; - // We rely on the default copy constructor and operator= so this type can be - // used in a vector. -}; - -// Helper for the code that emits the Clear() method. -bool CanInitializeByZeroing(const FieldDescriptor* field) { - if (field->is_repeated() || field->is_extension()) return false; - switch (field->cpp_type()) { - case internal::WireFormatLite::CPPTYPE_ENUM: - return field->default_value_enum()->number() == 0; - case internal::WireFormatLite::CPPTYPE_INT32: - return field->default_value_int32() == 0; - case internal::WireFormatLite::CPPTYPE_INT64: - return field->default_value_int64() == 0; - case internal::WireFormatLite::CPPTYPE_UINT32: - return field->default_value_uint32() == 0; - case internal::WireFormatLite::CPPTYPE_UINT64: - return field->default_value_uint64() == 0; - case internal::WireFormatLite::CPPTYPE_FLOAT: - return field->default_value_float() == 0; - case internal::WireFormatLite::CPPTYPE_DOUBLE: - return field->default_value_double() == 0; - case internal::WireFormatLite::CPPTYPE_BOOL: - return field->default_value_bool() == false; - default: - return false; - } -} - bool IsPOD(const FieldDescriptor* field) { if (field->is_repeated() || field->is_extension()) return false; switch (field->cpp_type()) { @@ -242,133 +143,6 @@ bool CanConstructByZeroing(const FieldDescriptor* field, return ret; } -// Reorder 'fields' so that if the fields are output into a c++ class in the new -// order, fields of similiar family (see below) are together and within each -// family, alignment padding is minimized. -// -// We try to do this while keeping each field as close as possible to its field -// number order so that we don't reduce cache locality much for function that -// access each field in order. Originally, OptimizePadding used declaration -// order for its decisions, but generated code minus the serializer/parsers uses -// the output of OptimizePadding as well (stored in -// MessageGenerator::optimized_order_). Since the serializers use field number -// order, we use that as a tie-breaker. -// -// TODO(ckennelly): If/when we have profiles available for the compiler, use -// those rather than respect declaration order. -// -// We classify each field into a particular "family" of fields, that we perform -// the same operation on in our generated functions. -// -// REPEATED is placed first, as the C++ compiler automatically initializes -// these fields in layout order. -// -// STRING is grouped next, as our Clear/SharedCtor/SharedDtor walks it and -// calls ArenaStringPtr::Destroy on each. -// -// -// MESSAGE is grouped next, as our Clear/SharedDtor code walks it and calls -// delete on each. We initialize these fields with a NULL pointer (see -// MessageFieldGenerator::GenerateConstructorCode), which allows them to be -// memset. -// -// ZERO_INITIALIZABLE is memset in Clear/SharedCtor -// -// OTHER these fields are initialized one-by-one. -void OptimizePadding(std::vector<const FieldDescriptor*>* fields, - const Options& options) { - // The sorted numeric order of Family determines the declaration order in the - // memory layout. - enum Family { - REPEATED = 0, - STRING = 1, - MESSAGE = 3, - ZERO_INITIALIZABLE = 4, - OTHER = 5, - kMaxFamily - }; - - // First divide fields into those that align to 1 byte, 4 bytes or 8 bytes. - std::vector<FieldGroup> aligned_to_1[kMaxFamily]; - std::vector<FieldGroup> aligned_to_4[kMaxFamily]; - std::vector<FieldGroup> aligned_to_8[kMaxFamily]; - for (int i = 0; i < fields->size(); ++i) { - const FieldDescriptor* field = (*fields)[i]; - - Family f = OTHER; - if (field->is_repeated()) { - f = REPEATED; - } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_STRING) { - f = STRING; - } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - f = MESSAGE; - - } else if (CanInitializeByZeroing(field)) { - f = ZERO_INITIALIZABLE; - } - - const int j = field->number(); - switch (EstimateAlignmentSize(field)) { - case 1: aligned_to_1[f].push_back(FieldGroup(j, field)); break; - case 4: aligned_to_4[f].push_back(FieldGroup(j, field)); break; - case 8: aligned_to_8[f].push_back(FieldGroup(j, field)); break; - default: - GOOGLE_LOG(FATAL) << "Unknown alignment size."; - } - } - - // For each family, group fields to optimize padding. - for (int f = 0; f < kMaxFamily; f++) { - // Now group fields aligned to 1 byte into sets of 4, and treat those like a - // single field aligned to 4 bytes. - for (int i = 0; i < aligned_to_1[f].size(); i += 4) { - FieldGroup field_group; - for (int j = i; j < aligned_to_1[f].size() && j < i + 4; ++j) { - field_group.Append(aligned_to_1[f][j]); - } - aligned_to_4[f].push_back(field_group); - } - // Sort by preferred location to keep fields as close to their field number - // order as possible. Using stable_sort ensures that the output is - // consistent across runs. - std::stable_sort(aligned_to_4[f].begin(), aligned_to_4[f].end()); - - // Now group fields aligned to 4 bytes (or the 4-field groups created above) - // into pairs, and treat those like a single field aligned to 8 bytes. - for (int i = 0; i < aligned_to_4[f].size(); i += 2) { - FieldGroup field_group; - for (int j = i; j < aligned_to_4[f].size() && j < i + 2; ++j) { - field_group.Append(aligned_to_4[f][j]); - } - if (i == aligned_to_4[f].size() - 1) { - if (f == OTHER) { - // Move incomplete 4-byte block to the beginning. This is done to - // pair with the (possible) leftover blocks from the - // ZERO_INITIALIZABLE family. - field_group.SetPreferredLocation(-1); - } else { - // Move incomplete 4-byte block to the end. - field_group.SetPreferredLocation(fields->size() + 1); - } - } - aligned_to_8[f].push_back(field_group); - } - // Sort by preferred location. - std::stable_sort(aligned_to_8[f].begin(), aligned_to_8[f].end()); - } - - // Now pull out all the FieldDescriptors in order. - fields->clear(); - for (int f = 0; f < kMaxFamily; ++f) { - for (int i = 0; i < aligned_to_8[f].size(); ++i) { - fields->insert(fields->end(), - aligned_to_8[f][i].fields().begin(), - aligned_to_8[f][i].fields().end()); - } - } -} - - // Emits an if-statement with a condition that evaluates to true if |field| is // considered non-default (will be sent over the wire), for message types // without true field presence. Should only be called if @@ -423,25 +197,31 @@ bool HasHasMethod(const FieldDescriptor* field) { void CollectMapInfo(const Descriptor* descriptor, std::map<string, string>* variables) { GOOGLE_CHECK(IsMapEntryMessage(descriptor)); + std::map<string, string>& vars = *variables; const FieldDescriptor* key = descriptor->FindFieldByName("key"); const FieldDescriptor* val = descriptor->FindFieldByName("value"); - (*variables)["key"] = PrimitiveTypeName(key->cpp_type()); + vars["key_cpp"] = PrimitiveTypeName(key->cpp_type()); switch (val->cpp_type()) { case FieldDescriptor::CPPTYPE_MESSAGE: - (*variables)["val"] = FieldMessageTypeName(val); + vars["val_cpp"] = FieldMessageTypeName(val); break; case FieldDescriptor::CPPTYPE_ENUM: - (*variables)["val"] = ClassName(val->enum_type(), true); + vars["val_cpp"] = ClassName(val->enum_type(), true); break; default: - (*variables)["val"] = PrimitiveTypeName(val->cpp_type()); - } - (*variables)["key_wire_type"] = - "::google::protobuf::internal::WireFormatLite::TYPE_" + - ToUpper(DeclaredTypeMethodName(key->type())); - (*variables)["val_wire_type"] = - "::google::protobuf::internal::WireFormatLite::TYPE_" + - ToUpper(DeclaredTypeMethodName(val->type())); + vars["val_cpp"] = PrimitiveTypeName(val->cpp_type()); + } + vars["key_wire_type"] = "::google::protobuf::internal::WireFormatLite::TYPE_" + + ToUpper(DeclaredTypeMethodName(key->type())); + vars["val_wire_type"] = "::google::protobuf::internal::WireFormatLite::TYPE_" + + ToUpper(DeclaredTypeMethodName(val->type())); + if (descriptor->file()->syntax() != FileDescriptor::SYNTAX_PROTO3 && + val->type() == FieldDescriptor::TYPE_ENUM) { + const EnumValueDescriptor* default_value = val->default_value_enum(); + vars["default_enum_value"] = Int32ToString(default_value->number()); + } else { + vars["default_enum_value"] = "0"; + } } // Does the given field have a private (internal helper only) has_$name$() @@ -526,26 +306,46 @@ void SetUnknkownFieldsVariable(const Descriptor* descriptor, "_internal_metadata_.mutable_unknown_fields()"; } +bool IsCrossFileMapField(const FieldDescriptor* field) { + if (!field->is_map()) { + return false; + } + + const Descriptor* d = field->message_type(); + const FieldDescriptor* value = d->FindFieldByNumber(2); + + return IsCrossFileMessage(value); +} + +bool IsCrossFileMaybeMap(const FieldDescriptor* field) { + if (IsCrossFileMapField(field)) { + return true; + } + + return IsCrossFileMessage(field); +} + } // anonymous namespace // =================================================================== MessageGenerator::MessageGenerator(const Descriptor* descriptor, + int index_in_file_messages, const Options& options, SCCAnalyzer* scc_analyzer) : descriptor_(descriptor), + index_in_file_messages_(index_in_file_messages), classname_(ClassName(descriptor, false)), options_(options), field_generators_(descriptor, options), max_has_bit_index_(0), - nested_generators_(new google::protobuf::scoped_ptr< - MessageGenerator>[descriptor->nested_type_count()]), enum_generators_( new google::protobuf::scoped_ptr<EnumGenerator>[descriptor->enum_type_count()]), extension_generators_(new google::protobuf::scoped_ptr< ExtensionGenerator>[descriptor->extension_count()]), use_dependent_base_(false), num_weak_fields_(0), + message_layout_helper_(new PaddingOptimizer()), scc_analyzer_(scc_analyzer) { // Compute optimized field order to be used for layout and initialization // purposes. @@ -557,7 +357,8 @@ MessageGenerator::MessageGenerator(const Descriptor* descriptor, optimized_order_.push_back(field); } } - OptimizePadding(&optimized_order_, options_); + + message_layout_helper_->OptimizeLayout(&optimized_order_, options_); if (HasFieldPresence(descriptor_->file())) { // We use -1 as a sentinel. @@ -573,11 +374,6 @@ MessageGenerator::MessageGenerator(const Descriptor* descriptor, } } - for (int i = 0; i < descriptor->nested_type_count(); i++) { - nested_generators_[i].reset(new MessageGenerator(descriptor->nested_type(i), - options, scc_analyzer)); - } - for (int i = 0; i < descriptor->enum_type_count(); i++) { enum_generators_[i].reset( new EnumGenerator(descriptor->enum_type(i), options)); @@ -603,6 +399,9 @@ MessageGenerator::MessageGenerator(const Descriptor* descriptor, } table_driven_ = TableDrivenParsingEnabled(descriptor_, options_); + + scc_name_ = + ClassName(scc_analyzer_->GetSCC(descriptor_)->GetRepresentative(), false); } MessageGenerator::~MessageGenerator() {} @@ -620,14 +419,6 @@ size_t MessageGenerator::HasBitsSize() const { return sizeof_has_bits; } -void MessageGenerator::Flatten(std::vector<MessageGenerator*>* list) { - for (int i = 0; i < descriptor_->nested_type_count(); i++) { - nested_generators_[i]->Flatten(list); - } - index_in_file_messages_ = list->size(); - list->push_back(this); -} - void MessageGenerator::AddGenerators( std::vector<EnumGenerator*>* enum_generators, std::vector<ExtensionGenerator*>* extension_generators) { @@ -654,12 +445,6 @@ GenerateDependentFieldAccessorDeclarations(io::Printer* printer) { std::map<string, string> vars; SetCommonFieldVariables(field, &vars, options_); - if (use_dependent_base_ && IsFieldDependent(field)) { - // If the message is dependent, the inline clear_*() method will need - // to delete the message type, so it must be in the dependent base - // class. (See also GenerateFieldAccessorDeclarations.) - printer->Print(vars, "$deprecated_attr$void clear_$name$();\n"); - } // Generate type-specific accessor declarations. field_generators_.get(field).GenerateDependentAccessorDeclarations(printer); printer->Print("\n"); @@ -726,12 +511,8 @@ GenerateFieldAccessorDeclarations(io::Printer* printer) { printer->Annotate("{", "}", field); } - if (!dependent_field) { - // If this field is dependent, then its clear_() method is in the - // depenent base class. (See also GenerateDependentAccessorDeclarations.) - printer->Print(vars, "$deprecated_attr$void ${$clear_$name$$}$();\n"); - printer->Annotate("{", "}", field); - } + printer->Print(vars, "$deprecated_attr$void ${$clear_$name$$}$();\n"); + printer->Annotate("{", "}", field); printer->Print(vars, "$deprecated_attr$static const int $constant_name$ = " "$number$;\n"); @@ -773,36 +554,6 @@ GenerateDependentFieldAccessorDefinitions(io::Printer* printer) { if (field->options().weak()) continue; PrintFieldComment(printer, field); - - // These functions are not really dependent: they are part of the - // (non-dependent) derived class. However, they need to live outside - // any #ifdef guards, so we treat them as if they were dependent. - // - // See the comment in FileGenerator::GenerateInlineFunctionDefinitions - // for a more complete explanation. - if (use_dependent_base_ && IsFieldDependent(field)) { - std::map<string, string> vars; - SetCommonFieldVariables(field, &vars, options_); - vars["inline"] = "inline "; - if (field->containing_oneof()) { - vars["field_name"] = UnderscoresToCamelCase(field->name(), true); - vars["oneof_name"] = field->containing_oneof()->name(); - vars["oneof_index"] = SimpleItoa(field->containing_oneof()->index()); - GenerateOneofMemberHasBits(field, vars, printer); - } else if (!field->is_repeated()) { - // There will be no header guard, so this always has to be inline. - GenerateSingularFieldHasBits(field, vars, printer); - } - // vars needed for clear_(), which is in the dependent base: - // (See also GenerateDependentFieldAccessorDeclarations.) - vars["tmpl"] = "template<class T>\n"; - vars["dependent_classname"] = - DependentBaseClassTemplateName(descriptor_) + "<T>"; - vars["this_message"] = DependentBaseDownCast(); - vars["this_const_message"] = DependentBaseConstDownCast(); - GenerateFieldClear(field, vars, printer); - } - // Generate type-specific accessors. field_generators_.get(field) .GenerateDependentInlineAccessorDefinitions(printer); @@ -813,7 +564,7 @@ GenerateDependentFieldAccessorDefinitions(io::Printer* printer) { // Generate has_$name$() and clear_has_$name$() functions for oneofs // Similar to other has-bits, these must always be in the header if we // are using a dependent base class. - GenerateOneofHasBits(printer, true /* is_inline */); + GenerateOneofHasBits(printer); } void MessageGenerator:: @@ -823,8 +574,7 @@ GenerateSingularFieldHasBits(const FieldDescriptor* field, if (field->options().weak()) { printer->Print( vars, - "$inline$" - "bool $classname$::has_$name$() const {\n" + "inline bool $classname$::has_$name$() const {\n" " return _weak_field_map_.Has($number$);\n" "}\n"); return; @@ -839,16 +589,13 @@ GenerateSingularFieldHasBits(const FieldDescriptor* field, vars["has_mask"] = StrCat(strings::Hex(1u << (has_bit_index % 32), strings::ZERO_PAD_8)); printer->Print(vars, - "$inline$" - "bool $classname$::has_$name$() const {\n" + "inline bool $classname$::has_$name$() const {\n" " return (_has_bits_[$has_array_index$] & 0x$has_mask$u) != 0;\n" "}\n" - "$inline$" - "void $classname$::set_has_$name$() {\n" + "inline void $classname$::set_has_$name$() {\n" " _has_bits_[$has_array_index$] |= 0x$has_mask$u;\n" "}\n" - "$inline$" - "void $classname$::clear_has_$name$() {\n" + "inline void $classname$::clear_has_$name$() {\n" " _has_bits_[$has_array_index$] &= ~0x$has_mask$u;\n" "}\n"); } else { @@ -857,15 +604,13 @@ GenerateSingularFieldHasBits(const FieldDescriptor* field, bool is_lazy = false; if (is_lazy) { printer->Print(vars, - "$inline$" - "bool $classname$::has_$name$() const {\n" + "inline bool $classname$::has_$name$() const {\n" " return !$name$_.IsCleared();\n" "}\n"); } else { printer->Print( vars, - "$inline$" - "bool $classname$::has_$name$() const {\n" + "inline bool $classname$::has_$name$() const {\n" " return this != internal_default_instance() && $name$_ != NULL;\n" "}\n"); } @@ -874,7 +619,7 @@ GenerateSingularFieldHasBits(const FieldDescriptor* field, } void MessageGenerator:: -GenerateOneofHasBits(io::Printer* printer, bool is_inline) { +GenerateOneofHasBits(io::Printer* printer) { for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { std::map<string, string> vars; vars["oneof_name"] = descriptor_->oneof_decl(i)->name(); @@ -882,15 +627,12 @@ GenerateOneofHasBits(io::Printer* printer, bool is_inline) { vars["cap_oneof_name"] = ToUpper(descriptor_->oneof_decl(i)->name()); vars["classname"] = classname_; - vars["inline"] = (is_inline ? "inline " : ""); printer->Print( vars, - "$inline$" - "bool $classname$::has_$oneof_name$() const {\n" + "inline bool $classname$::has_$oneof_name$() const {\n" " return $oneof_name$_case() != $cap_oneof_name$_NOT_SET;\n" "}\n" - "$inline$" - "void $classname$::clear_has_$oneof_name$() {\n" + "inline void $classname$::clear_has_$oneof_name$() {\n" " _oneof_case_[$oneof_index$] = $cap_oneof_name$_NOT_SET;\n" "}\n"); } @@ -907,13 +649,11 @@ GenerateOneofMemberHasBits(const FieldDescriptor* field, // method, so that generated code is slightly cleaner (vs. comparing // _oneof_case_[index] against a constant everywhere). printer->Print(vars, - "$inline$" - "bool $classname$::has_$name$() const {\n" + "inline bool $classname$::has_$name$() const {\n" " return $oneof_name$_case() == k$field_name$;\n" "}\n"); printer->Print(vars, - "$inline$" - "void $classname$::set_has_$name$() {\n" + "inline void $classname$::set_has_$name$() {\n" " _oneof_case_[$oneof_index$] = k$field_name$;\n" "}\n"); } @@ -921,14 +661,14 @@ GenerateOneofMemberHasBits(const FieldDescriptor* field, void MessageGenerator:: GenerateFieldClear(const FieldDescriptor* field, const std::map<string, string>& vars, + bool is_inline, io::Printer* printer) { - // Generate clear_$name$() (See GenerateFieldAccessorDeclarations and - // GenerateDependentFieldAccessorDeclarations, $dependent_classname$ is - // set by the Generate*Definitions functions.) + // Generate clear_$name$(). + if (is_inline) { + printer->Print("inline "); + } printer->Print(vars, - "$tmpl$" - "$inline$" - "void $dependent_classname$::clear_$name$() {\n"); + "void $classname$::clear_$name$() {\n"); printer->Indent(); @@ -936,12 +676,12 @@ GenerateFieldClear(const FieldDescriptor* field, // Clear this field only if it is the active field in this oneof, // otherwise ignore printer->Print(vars, - "if ($this_message$has_$name$()) {\n"); + "if (has_$name$()) {\n"); printer->Indent(); field_generators_.get(field) .GenerateClearingCode(printer); printer->Print(vars, - "$this_message$clear_has_$oneof_name$();\n"); + "clear_has_$oneof_name$();\n"); printer->Outdent(); printer->Print("}\n"); } else { @@ -949,8 +689,7 @@ GenerateFieldClear(const FieldDescriptor* field, .GenerateClearingCode(printer); if (HasFieldPresence(descriptor_->file())) { if (!field->is_repeated() && !field->options().weak()) { - printer->Print(vars, - "$this_message$clear_has_$name$();\n"); + printer->Print(vars, "clear_has_$name$();\n"); } } } @@ -960,7 +699,7 @@ GenerateFieldClear(const FieldDescriptor* field, } void MessageGenerator:: -GenerateFieldAccessorDefinitions(io::Printer* printer, bool is_inline) { +GenerateFieldAccessorDefinitions(io::Printer* printer) { printer->Print("// $classname$\n\n", "classname", classname_); for (int i = 0; i < descriptor_->field_count(); i++) { @@ -970,7 +709,6 @@ GenerateFieldAccessorDefinitions(io::Printer* printer, bool is_inline) { std::map<string, string> vars; SetCommonFieldVariables(field, &vars, options_); - vars["inline"] = is_inline ? "inline " : ""; if (use_dependent_base_ && IsFieldDependent(field)) { vars["tmpl"] = "template<class T>\n"; vars["dependent_classname"] = @@ -987,31 +725,25 @@ GenerateFieldAccessorDefinitions(io::Printer* printer, bool is_inline) { // Generate has_$name$() or $name$_size(). if (field->is_repeated()) { printer->Print(vars, - "$inline$" - "int $classname$::$name$_size() const {\n" + "inline int $classname$::$name$_size() const {\n" " return $name$_.size();\n" "}\n"); } else if (field->containing_oneof()) { vars["field_name"] = UnderscoresToCamelCase(field->name(), true); vars["oneof_name"] = field->containing_oneof()->name(); vars["oneof_index"] = SimpleItoa(field->containing_oneof()->index()); - if (!use_dependent_base_ || !IsFieldDependent(field)) { - GenerateOneofMemberHasBits(field, vars, printer); - } + GenerateOneofMemberHasBits(field, vars, printer); } else { // Singular field. - if (!use_dependent_base_ || !IsFieldDependent(field)) { - GenerateSingularFieldHasBits(field, vars, printer); - } + GenerateSingularFieldHasBits(field, vars, printer); } - if (!use_dependent_base_ || !IsFieldDependent(field)) { - GenerateFieldClear(field, vars, printer); + if (!IsCrossFileMaybeMap(field)) { + GenerateFieldClear(field, vars, true, printer); } // Generate type-specific accessors. - field_generators_.get(field).GenerateInlineAccessorDefinitions(printer, - is_inline); + field_generators_.get(field).GenerateInlineAccessorDefinitions(printer); printer->Print("\n"); } @@ -1020,7 +752,7 @@ GenerateFieldAccessorDefinitions(io::Printer* printer, bool is_inline) { // Generate has_$name$() and clear_has_$name$() functions for oneofs // If we aren't using a dependent base, they can be with the other functions // that are #ifdef-guarded. - GenerateOneofHasBits(printer, is_inline); + GenerateOneofHasBits(printer); } } @@ -1056,7 +788,42 @@ GenerateDependentBaseClassDefinition(io::Printer* printer) { void MessageGenerator:: GenerateClassDefinition(io::Printer* printer) { - if (IsMapEntryMessage(descriptor_)) return; + if (IsMapEntryMessage(descriptor_)) { + std::map<string, string> vars; + vars["classname"] = classname_; + CollectMapInfo(descriptor_, &vars); + vars["lite"] = + HasDescriptorMethods(descriptor_->file(), options_) ? "" : "Lite"; + printer->Print( + vars, + "class $classname$ : public " + "::google::protobuf::internal::MapEntry$lite$<$classname$, \n" + " $key_cpp$, $val_cpp$,\n" + " $key_wire_type$,\n" + " $val_wire_type$,\n" + " $default_enum_value$ > {\n" + "public:\n" + " typedef ::google::protobuf::internal::MapEntry$lite$<$classname$, \n" + " $key_cpp$, $val_cpp$,\n" + " $key_wire_type$,\n" + " $val_wire_type$,\n" + " $default_enum_value$ > SuperType;\n" + " $classname$();\n" + " $classname$(::google::protobuf::Arena* arena);\n" + " void MergeFrom(const $classname$& other);\n" + " static const $classname$* internal_default_instance() { return " + "reinterpret_cast<const " + "$classname$*>(&_$classname$_default_instance_); }\n"); + if (HasDescriptorMethods(descriptor_->file(), options_)) { + printer->Print( + " void MergeFrom(const ::google::protobuf::Message& other) PROTOBUF_FINAL;\n" + " ::google::protobuf::Metadata GetMetadata() const;\n" + "};\n"); + } else { + printer->Print("};\n"); + } + return; + } if (use_dependent_base_) { GenerateDependentBaseClassDefinition(printer); printer->Print("\n"); @@ -1109,26 +876,23 @@ GenerateClassDefinition(io::Printer* printer) { "\n"); } - // Generate move constructor and move assignment operator for types other than - // Any. - if (!IsAnyMessage(descriptor_)) { - printer->Print(vars, - "#if LANG_CXX11\n" - "$classname$($classname$&& from) noexcept\n" - " : $classname$() {\n" - " *this = ::std::move(from);\n" - "}\n" - "\n" - "inline $classname$& operator=($classname$&& from) noexcept {\n" - " if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {\n" - " if (this != &from) InternalSwap(&from);\n" - " } else {\n" - " CopyFrom(from);\n" - " }\n" - " return *this;\n" - "}\n" - "#endif\n"); - } + // Generate move constructor and move assignment operator. + printer->Print(vars, + "#if LANG_CXX11\n" + "$classname$($classname$&& from) noexcept\n" + " : $classname$() {\n" + " *this = ::std::move(from);\n" + "}\n" + "\n" + "inline $classname$& operator=($classname$&& from) noexcept {\n" + " if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {\n" + " if (this != &from) InternalSwap(&from);\n" + " } else {\n" + " CopyFrom(from);\n" + " }\n" + " return *this;\n" + "}\n" + "#endif\n"); SetUnknkownFieldsVariable(descriptor_, options_, &vars); if (PublicUnknownFieldsAccessors(descriptor_)) { @@ -1199,6 +963,7 @@ GenerateClassDefinition(io::Printer* printer) { vars["message_index"] = SimpleItoa(index_in_file_messages_); printer->Print( vars, + "static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY\n" "static inline const $classname$* internal_default_instance() {\n" " return reinterpret_cast<const $classname$*>(\n" " &_$classname$_default_instance_);\n" @@ -1358,6 +1123,8 @@ GenerateClassDefinition(io::Printer* printer) { printer->Print("typedef $nested_full_name$ $nested_name$;\n", "nested_name", nested_type->name(), "nested_full_name", ClassName(nested_type, false)); + printer->Annotate("nested_full_name", nested_type); + printer->Annotate("nested_name", nested_type); } } @@ -1548,14 +1315,13 @@ GenerateClassDefinition(io::Printer* printer) { // The TableStruct struct needs access to the private parts, in order to // construct the offsets of all members. - // - // Some InitDefault and Shutdown are defined as static member functions of - // TableStruct such that they are also allowed to access private members. + // TODO(gerbens) Remove the friend for InitDefaults. printer->Print( - "friend struct $file_namespace$::TableStruct;\n", + "friend struct ::$file_namespace$::TableStruct;\n" + "friend void ::$file_namespace$::InitDefaults$scc_name$Impl();\n", // Vars. - "file_namespace", - FileLevelNamespace(descriptor_->file()->name())); + "scc_name", scc_name_, "file_namespace", + FileLevelNamespace(descriptor_)); printer->Outdent(); printer->Print("};"); @@ -1575,9 +1341,9 @@ GenerateDependentInlineMethods(io::Printer* printer) { } void MessageGenerator:: -GenerateInlineMethods(io::Printer* printer, bool is_inline) { +GenerateInlineMethods(io::Printer* printer) { if (IsMapEntryMessage(descriptor_)) return; - GenerateFieldAccessorDefinitions(printer, is_inline); + GenerateFieldAccessorDefinitions(printer); // Generate oneof_case() functions. for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { @@ -1587,11 +1353,9 @@ GenerateInlineMethods(io::Printer* printer, bool is_inline) { descriptor_->oneof_decl(i)->name(), true); vars["oneof_name"] = descriptor_->oneof_decl(i)->name(); vars["oneof_index"] = SimpleItoa(descriptor_->oneof_decl(i)->index()); - vars["inline"] = is_inline ? "inline " : ""; printer->Print( vars, - "$inline$" - "$class_name$::$camel_oneof_name$Case $class_name$::" + "inline $class_name$::$camel_oneof_name$Case $class_name$::" "$oneof_name$_case() const {\n" " return $class_name$::$camel_oneof_name$Case(" "_oneof_case_[$oneof_index$]);\n" @@ -1634,7 +1398,8 @@ bool MessageGenerator::GenerateParseTable(io::Printer* printer, size_t offset, std::map<string, string> vars; - vars["classname"] = classname_; + vars["classname"] = ClassName(descriptor_); + vars["classtype"] = QualifiedClassName(descriptor_); vars["offset"] = SimpleItoa(offset); vars["aux_offset"] = SimpleItoa(aux_offset); @@ -1661,48 +1426,34 @@ bool MessageGenerator::GenerateParseTable(io::Printer* printer, size_t offset, printer->Print(vars, "-1,\n"); } else { printer->Print(vars, - "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(\n" - " $classname$, _has_bits_),\n"); + "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(\n" + " $classtype$, _has_bits_),\n"); } if (descriptor_->oneof_decl_count() > 0) { printer->Print(vars, "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(\n" - " $classname$, _oneof_case_),\n"); + " $classtype$, _oneof_case_),\n"); } else { printer->Print("-1, // no _oneof_case_\n"); } if (descriptor_->extension_range_count() > 0) { printer->Print(vars, - "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($classname$, " - "_extensions_),\n"); + "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($classtype$, " + "_extensions_),\n"); } else { printer->Print("-1, // no _extensions_\n"); } // TODO(ckennelly): Consolidate this with the calculation for // AuxillaryParseTableField. - std::vector<string> package_parts; - - const Descriptor* outer = descriptor_; - while (outer->containing_type() != NULL) { - outer = outer->containing_type(); - } - - package_parts = Split( - outer->full_name(), ".", true); - // outer->full_name() contains the class itself. Remove it as it is - // used in the name of the default instance variable. - GOOGLE_DCHECK_NE(package_parts.size(), 0); - package_parts.back().clear(); - - vars["ns"] = Join(package_parts, "::"); + vars["ns"] = Namespace(descriptor_); printer->Print(vars, - "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(\n" - " $classname$, _internal_metadata_),\n" - "&::$ns$_$classname$_default_instance_,\n"); + "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(\n" + " $classtype$, _internal_metadata_),\n" + "&$ns$::_$classname$_default_instance_,\n"); if (UseUnknownFieldSet(descriptor_->file(), options_)) { printer->Print(vars, "true,\n"); @@ -1717,15 +1468,14 @@ bool MessageGenerator::GenerateParseTable(io::Printer* printer, size_t offset, void MessageGenerator::GenerateSchema(io::Printer* printer, int offset, int has_offset) { - if (IsMapEntryMessage(descriptor_)) return; - std::map<string, string> vars; - vars["classname"] = classname_; + vars["classname"] = QualifiedClassName(descriptor_); vars["offset"] = SimpleItoa(offset); - vars["has_bits_offsets"] = HasFieldPresence(descriptor_->file()) - ? SimpleItoa(offset + has_offset) - : "-1"; + vars["has_bits_offsets"] = + HasFieldPresence(descriptor_->file()) || IsMapEntryMessage(descriptor_) + ? SimpleItoa(offset + has_offset) + : "-1"; printer->Print(vars, "{ $offset$, $has_bits_offsets$, sizeof($classname$)},\n"); @@ -1804,6 +1554,8 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) { return 0; } + string full_classname = QualifiedClassName(descriptor_); + std::vector<const FieldDescriptor*> sorted = SortFieldsByNumber(descriptor_); if (IsMapEntryMessage(descriptor_)) { for (int i = 0; i < 2; i++) { @@ -1812,9 +1564,7 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) { field->number(), WireFormat::WireTypeForFieldType(field->type())); std::map<string, string> vars; - vars["classname"] = classname_; - vars["parent_classname"] = - ClassName(descriptor_->containing_type(), false); + vars["classname"] = QualifiedClassName(descriptor_); vars["field_name"] = FieldName(field); vars["tag"] = SimpleItoa(tag); vars["hasbit"] = SimpleItoa(i); @@ -1824,23 +1574,18 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) { GOOGLE_CHECK(!IsMapEntryMessage(field->message_type())); { vars["ptr"] = - QualifiedFileLevelSymbol( - field->message_type()->file()->package(), - FileLevelNamespace(field->message_type()->file()->name())) + + "::" + FileLevelNamespace(field->message_type()) + "::TableStruct::serialization_table + " + SimpleItoa(FindMessageIndexInFile(field->message_type())); } } - vars["extra"] = HasDescriptorMethods(descriptor_->file(), options_) - ? "::SuperType" - : ""; printer->Print(vars, "{GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(" - "::google::protobuf::internal::MapEntryHelper<$parent_classname$::$" - "classname$$extra$>, $field_name$_), $tag$," + "::google::protobuf::internal::MapEntryHelper<$classname$::" + "SuperType>, $field_name$_), $tag$," "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(" - "::google::protobuf::internal::MapEntryHelper<$parent_classname$::$" - "classname$$extra$>, _has_bits_) * 8 + $hasbit$, $type$, " + "::google::protobuf::internal::MapEntryHelper<$classname$::" + "SuperType>, _has_bits_) * 8 + $hasbit$, $type$, " "$ptr$},\n"); } return 2; @@ -1848,7 +1593,7 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) { printer->Print( "{GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($classname$, " "_cached_size_), 0, 0, 0, NULL},\n", - "classname", classname_); + "classname", full_classname); std::vector<const Descriptor::ExtensionRange*> sorted_extensions; for (int i = 0; i < descriptor_->extension_range_count(); ++i) { sorted_extensions.push_back(descriptor_->extension_range(i)); @@ -1868,7 +1613,7 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) { "::google::protobuf::internal::FieldMetadata::kSpecial, " "reinterpret_cast<const " "void*>(::google::protobuf::internal::ExtensionSerializer)},\n", - "classname", classname_, "start", SimpleItoa(range->start), "end", + "classname", full_classname, "start", SimpleItoa(range->start), "end", SimpleItoa(range->end)); } if (i == sorted.size()) break; @@ -1886,14 +1631,14 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) { classfieldname = field->containing_oneof()->name(); } std::map<string, string> vars; - vars["classname"] = classname_; + vars["classname"] = full_classname; vars["field_name"] = classfieldname; vars["tag"] = SimpleItoa(tag); vars["ptr"] = "NULL"; if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { if (IsMapEntryMessage(field->message_type())) { vars["idx"] = SimpleItoa(FindMessageIndexInFile(field->message_type())); - vars["fieldclassname"] = ClassName(field->message_type(), false); + vars["fieldclassname"] = QualifiedClassName(field->message_type()); printer->Print(vars, "{GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($" "classname$, $field_name$_), $tag$, $idx$, " @@ -1901,15 +1646,13 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) { "reinterpret_cast<const void*>(static_cast< " "::google::protobuf::internal::SpecialSerializer>(" "::google::protobuf::internal::MapFieldSerializer< " - "::google::protobuf::internal::MapEntryToMapField<$classname$::$" - "fieldclassname$>::MapFieldType, " + "::google::protobuf::internal::MapEntryToMapField<" + "$fieldclassname$>::MapFieldType, " "TableStruct::serialization_table>))},\n"); continue; } else { vars["ptr"] = - QualifiedFileLevelSymbol( - field->message_type()->file()->package(), - FileLevelNamespace(field->message_type()->file()->name())) + + "::" + FileLevelNamespace(field->message_type()) + "::TableStruct::serialization_table + " + SimpleItoa(FindMessageIndexInFile(field->message_type())); } @@ -1960,40 +1703,20 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) { "_internal_metadata_), 0, ~0u, " "::google::protobuf::internal::FieldMetadata::kSpecial, reinterpret_cast<const " "void*>($serializer$)},\n", - "classname", classname_, "serializer", serializer); + "classname", full_classname, "serializer", serializer); return num_field_metadata; } -void MessageGenerator:: -GenerateDefaultInstanceAllocator(io::Printer* printer) { - // Construct the default instances of all fields, as they will be used - // when creating the default instance of the entire message. +void MessageGenerator::GenerateFieldDefaultInstances(io::Printer* printer) { + // Construct the default instances for all fields that need one. for (int i = 0; i < descriptor_->field_count(); i++) { field_generators_.get(descriptor_->field(i)) .GenerateDefaultInstanceAllocator(printer); } - - // Construct the default instance. We can't call InitAsDefaultInstance() yet - // because we need to make sure all default instances that this one might - // depend on are constructed first. - printer->Print("_$classname$_default_instance_._instance.DefaultConstruct();\n" - "::google::protobuf::internal::OnShutdownDestroyMessage(\n" - " &_$classname$_default_instance_);", - "classname", classname_); } void MessageGenerator:: GenerateDefaultInstanceInitializer(io::Printer* printer) { - if (IsMapEntryMessage(descriptor_)) { - printer->Print( - "_$classname$_default_instance_._instance.get_mutable()->set_default_instance(_$" - "classname$_default_instance_._instance.get_mutable());\n" - "_$classname$_default_instance_._instance.get_mutable()->InitAsDefaultInstance();" - "\n", - "classname", classname_); - return; - } - // The default instance needs all of its embedded message pointers // cross-linked to other default instances. We can't do this initialization // in the constructor because some other default instances may not have been @@ -2016,10 +1739,11 @@ GenerateDefaultInstanceInitializer(io::Printer* printer) { } name += FieldName(field); printer->Print( - "$name$_ = const_cast< $type$*>(\n" + "$ns$::$name$_ = const_cast< $type$*>(\n" " $type$::internal_default_instance());\n", // Vars. - "name", name, "type", FieldMessageTypeName(field)); + "name", name, "type", FieldMessageTypeName(field), "ns", + Namespace(descriptor_)); } else if (field->containing_oneof() && HasDescriptorMethods(descriptor_->file(), options_)) { field_generators_.get(descriptor_->field(i)) @@ -2031,31 +1755,41 @@ GenerateDefaultInstanceInitializer(io::Printer* printer) { void MessageGenerator:: GenerateClassMethods(io::Printer* printer) { if (IsMapEntryMessage(descriptor_)) { + printer->Print( + "$classname$::$classname$() {}\n" + "$classname$::$classname$(::google::protobuf::Arena* arena) : " + "SuperType(arena) {}\n" + "void $classname$::MergeFrom(const $classname$& other) {\n" + " MergeFromInternal(other);\n" + "}\n", + "classname", classname_); if (HasDescriptorMethods(descriptor_->file(), options_)) { printer->Print( - "$parent$::$classname$::$classname$() {}\n" - "$parent$::$classname$::$classname$(::google::protobuf::Arena* arena) : " - "SuperType(arena) {}\n" - "::google::protobuf::Metadata $parent$::$classname$::GetMetadata() const {\n" - " $file_namespace$::protobuf_AssignDescriptorsOnce();\n" - " return $file_namespace$::file_level_metadata[$index$];\n" + "::google::protobuf::Metadata $classname$::GetMetadata() const {\n" + " ::$file_namespace$::protobuf_AssignDescriptorsOnce();\n" + " return ::$file_namespace$::file_level_metadata[$index$];\n" "}\n" - "void $parent$::$classname$::MergeFrom(\n" + "void $classname$::MergeFrom(\n" " const ::google::protobuf::Message& other) {\n" " ::google::protobuf::Message::MergeFrom(other);\n" "}\n" - "void $parent$::$classname$::MergeFrom(const $classname$& other) {\n" - " MergeFromInternal(other);\n" - "}\n" "\n", - "file_namespace", FileLevelNamespace(descriptor_->file()->name()), - "parent", ClassName(descriptor_->containing_type(), false), + "file_namespace", FileLevelNamespace(descriptor_), "classname", classname_, "index", SimpleItoa(index_in_file_messages_)); } return; } + // TODO(gerbens) Remove this function. With a little bit of cleanup and + // refactoring this is superfluous. + printer->Print("void $classname$::InitAsDefaultInstance() {\n", "classname", + classname_); + printer->Indent(); + GenerateDefaultInstanceInitializer(printer); + printer->Outdent(); + printer->Print("}\n"); + if (IsAnyMessage(descriptor_)) { printer->Print( "void $classname$::PackFrom(const ::google::protobuf::Message& message) {\n" @@ -2076,8 +1810,17 @@ GenerateClassMethods(io::Printer* printer) { // Generate non-inline field definitions. for (int i = 0; i < descriptor_->field_count(); i++) { - field_generators_.get(descriptor_->field(i)) + const FieldDescriptor* field = descriptor_->field(i); + field_generators_.get(field) .GenerateNonInlineAccessorDefinitions(printer); + if (IsCrossFileMaybeMap(field)) { + std::map<string, string> vars; + SetCommonFieldVariables(field, &vars, options_); + if (field->containing_oneof()) { + SetCommonOneofFieldVariables(field, &vars); + } + GenerateFieldClear(field, vars, false, printer); + } } // Generate field number constants. @@ -2134,23 +1877,24 @@ GenerateClassMethods(io::Printer* printer) { if (options_.table_driven_serialization) { printer->Print( - "const void* $classname$::InternalGetTable() const {\n" - " return $file_namespace$::TableStruct::serialization_table + $index$;\n" - "}\n" - "\n", - "classname", classname_, "index", SimpleItoa(index_in_file_messages_), - "file_namespace", FileLevelNamespace(descriptor_->file()->name())); + "const void* $classname$::InternalGetTable() const {\n" + " return ::$file_namespace$::TableStruct::serialization_table + " + "$index$;\n" + "}\n" + "\n", + "classname", classname_, "index", SimpleItoa(index_in_file_messages_), + "file_namespace", FileLevelNamespace(descriptor_)); } if (HasDescriptorMethods(descriptor_->file(), options_)) { printer->Print( "::google::protobuf::Metadata $classname$::GetMetadata() const {\n" " $file_namespace$::protobuf_AssignDescriptorsOnce();\n" - " return " + " return ::" "$file_namespace$::file_level_metadata[kIndexInFileMessages];\n" "}\n" "\n", "classname", classname_, "file_namespace", - FileLevelNamespace(descriptor_->file()->name())); + FileLevelNamespace(descriptor_)); } else { printer->Print( "::std::string $classname$::GetTypeName() const {\n" @@ -2224,7 +1968,7 @@ size_t MessageGenerator::GenerateParseOffsets(io::Printer* printer) { WireFormat::TagSize(field->number(), field->type()); std::map<string, string> vars; - vars["classname"] = classname_; + vars["classname"] = QualifiedClassName(descriptor_); if (field->containing_oneof() != NULL) { vars["name"] = field->containing_oneof()->name(); vars["presence"] = SimpleItoa(field->containing_oneof()->index()); @@ -2280,23 +2024,8 @@ size_t MessageGenerator::GenerateParseAuxTable(io::Printer* printer) { last_field_number++; break; case FieldDescriptor::CPPTYPE_MESSAGE: { - std::vector<string> package_parts; - - const Descriptor* outer = field->message_type(); - while (outer->containing_type() != NULL) { - outer = outer->containing_type(); - } - - package_parts = Split( - outer->full_name(), ".", true); - // outer->full_name() contains the class itself. Remove it as it is - // used in the name of the default instance variable. - GOOGLE_DCHECK_NE(package_parts.size(), 0); - package_parts.back().clear(); - if (field->is_map()) { - vars["classname"] = ClassName(field->containing_type(), false) + - "::" + ClassName(field->message_type(), false); + vars["classname"] = QualifiedClassName(field->message_type()); printer->Print(vars, "{::google::protobuf::internal::AuxillaryParseTableField::map_" "aux{&::google::protobuf::internal::ParseMap<$classname$>}},\n"); @@ -2305,13 +2034,15 @@ size_t MessageGenerator::GenerateParseAuxTable(io::Printer* printer) { } else { vars["classname"] = ClassName(field->message_type(), false); } - vars["ns"] = Join(package_parts, "::"); + vars["ns"] = Namespace(field->message_type()); vars["type"] = FieldMessageTypeName(field); - vars["file_namespace"] = FileLevelNamespace(outer->file()->name()); + vars["file_namespace"] = + FileLevelNamespace(field->message_type()); - printer->Print(vars, + printer->Print( + vars, "{::google::protobuf::internal::AuxillaryParseTableField::message_aux{\n" - " &::$ns$_$classname$_default_instance_,\n"); + " &$ns$::_$classname$_default_instance_,\n"); bool dont_emit_table = !TableDrivenParsingEnabled(field->message_type(), options_); @@ -2320,8 +2051,8 @@ size_t MessageGenerator::GenerateParseAuxTable(io::Printer* printer) { printer->Print(" NULL,\n"); } else { printer->Print(vars, - " ::$ns$$file_namespace$::TableStruct::schema +\n" - " ::$ns$$classname$::kIndexInFileMessages,\n"); + " ::$file_namespace$::TableStruct::schema +\n" + " $ns$::$classname$::kIndexInFileMessages,\n"); } printer->Print("}},\n"); @@ -2333,8 +2064,9 @@ size_t MessageGenerator::GenerateParseAuxTable(io::Printer* printer) { case FieldOptions::STRING: vars["default"] = field->default_value_string().empty() - ? "&::google::protobuf::internal::fixed_address_empty_string" - : "&" + classname_ + "::_default_" + FieldName(field) + "_"; + ? "&::google::protobuf::internal::fixed_address_empty_string" + : "&" + Namespace(field) + " ::" + classname_ + + "::_default_" + FieldName(field) + "_"; break; case FieldOptions::CORD: case FieldOptions::STRING_PIECE: @@ -2360,11 +2092,11 @@ size_t MessageGenerator::GenerateParseAuxTable(io::Printer* printer) { std::pair<size_t, size_t> MessageGenerator::GenerateOffsets( io::Printer* printer) { - if (IsMapEntryMessage(descriptor_)) return std::make_pair(0, 0); std::map<string, string> variables; - variables["classname"] = classname_; + string full_classname = QualifiedClassName(descriptor_); + variables["classname"] = full_classname; - if (HasFieldPresence(descriptor_->file())) { + if (HasFieldPresence(descriptor_->file()) || IsMapEntryMessage(descriptor_)) { printer->Print( variables, "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($classname$, " @@ -2405,27 +2137,29 @@ std::pair<size_t, size_t> MessageGenerator::GenerateOffsets( for (int i = 0; i < descriptor_->field_count(); i++) { const FieldDescriptor* field = descriptor_->field(i); if (field->containing_oneof() || field->options().weak()) { - printer->Print( - "offsetof($classname$DefaultTypeInternal, $name$_),\n", - "classname", classname_, "name", FieldName(field)); + printer->Print("offsetof($classname$DefaultTypeInternal, $name$_),\n", + "classname", full_classname, "name", FieldName(field)); } else { printer->Print( "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($classname$, " - "$name$_),\n", - "classname", classname_, - "name", FieldName(field)); + "$name$_),\n", + "classname", full_classname, "name", FieldName(field)); } } for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { const OneofDescriptor* oneof = descriptor_->oneof_decl(i); printer->Print( - "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($classname$, $name$_),\n", - "classname", classname_, - "name", oneof->name()); + "GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET($classname$, $name$_),\n", + "classname", full_classname, "name", oneof->name()); } - if (HasFieldPresence(descriptor_->file())) { + if (IsMapEntryMessage(descriptor_)) { + entries += 2; + printer->Print( + "0,\n" + "1,\n"); + } else if (HasFieldPresence(descriptor_->file())) { entries += has_bit_indices_.size(); for (int i = 0; i < has_bit_indices_.size(); i++) { const string index = has_bit_indices_[i] >= 0 ? @@ -2477,16 +2211,9 @@ GenerateSharedDestructorCode(io::Printer* printer) { "classname", classname_); printer->Indent(); if (SupportsArenas(descriptor_)) { - // Do nothing when the message is allocated in an arena. printer->Print( - "::google::protobuf::Arena* arena = GetArenaNoVirtual();\n" - "GOOGLE_DCHECK(arena == NULL);\n" - "if (arena != NULL) {\n" - " return;\n" - "}\n" - "\n"); + "GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);\n"); } - // Write the destructors for each field except oneof members. // optimized_order_ does not contain oneof fields. for (int i = 0; i < optimized_order_.size(); i++) { @@ -2700,27 +2427,28 @@ GenerateStructors(io::Printer* printer) { "$classname$::$classname$()\n" " : $initializer$ {\n" " if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {\n" - " $file_namespace$::InitDefaults();\n" + " ::$file_namespace$::InitDefaults$scc_name$();\n" " }\n" " SharedCtor();\n" " // @@protoc_insertion_point(constructor:$full_name$)\n" "}\n", "classname", classname_, "full_name", descriptor_->full_name(), - "initializer", initializer_null, "file_namespace", - FileLevelNamespace(descriptor_->file()->name())); + "scc_name", scc_name_, "initializer", initializer_null, "file_namespace", + FileLevelNamespace(descriptor_)); if (SupportsArenas(descriptor_)) { printer->Print( "$classname$::$classname$(::google::protobuf::Arena* arena)\n" " : $initializer$ {\n" - " $file_namespace$::InitDefaults();\n" + " ::$file_namespace$::InitDefaults$scc_name$();\n" " SharedCtor();\n" " RegisterArenaDtor(arena);\n" " // @@protoc_insertion_point(arena_constructor:$full_name$)\n" "}\n", "initializer", initializer_with_arena, "classname", classname_, "superclass", superclass, "full_name", descriptor_->full_name(), - "file_namespace", FileLevelNamespace(descriptor_->file()->name())); + "scc_name", scc_name_, "file_namespace", + FileLevelNamespace(descriptor_)); } // Generate the copy constructor. @@ -2865,23 +2593,23 @@ GenerateStructors(io::Printer* printer) { !descriptor_->options().no_standard_descriptor_accessor()) { printer->Print( "const ::google::protobuf::Descriptor* $classname$::descriptor() {\n" - " $file_namespace$::protobuf_AssignDescriptorsOnce();\n" - " return " + " ::$file_namespace$::protobuf_AssignDescriptorsOnce();\n" + " return ::" "$file_namespace$::file_level_metadata[kIndexInFileMessages]." "descriptor;\n" "}\n" "\n", "classname", classname_, "file_namespace", - FileLevelNamespace(descriptor_->file()->name())); + FileLevelNamespace(descriptor_)); } printer->Print( "const $classname$& $classname$::default_instance() {\n" - " $file_namespace$::InitDefaults();\n" + " ::$file_namespace$::InitDefaults$scc_name$();\n" " return *internal_default_instance();\n" "}\n\n", - "classname", classname_, "file_namespace", - FileLevelNamespace(descriptor_->file()->name())); + "classname", classname_, "scc_name", scc_name_, "file_namespace", + FileLevelNamespace(descriptor_)); if (SupportsArenas(descriptor_)) { printer->Print( @@ -2930,6 +2658,9 @@ bool MessageGenerator::MaybeGenerateOptionalFieldCondition( void MessageGenerator:: GenerateClear(io::Printer* printer) { + // Performance tuning parameters + const int kMaxUnconditionalPrimitiveBytesClear = 4; + printer->Print( "void $classname$::Clear() {\n" "// @@protoc_insertion_point(message_clear_start:$full_name$)\n", @@ -2951,6 +2682,17 @@ GenerateClear(io::Printer* printer) { } int last_i = -1; + int unconditional_budget = kMaxUnconditionalPrimitiveBytesClear; + for (int i = 0; i < optimized_order_.size(); i++) { + const FieldDescriptor* field = optimized_order_[i]; + + if (!CanInitializeByZeroing(field)) { + continue; + } + + unconditional_budget -= EstimateAlignmentSize(field); + } + for (int i = 0; i < optimized_order_.size(); ) { // Detect infinite loops. GOOGLE_CHECK_NE(i, last_i); @@ -2966,11 +2708,7 @@ GenerateClear(io::Printer* printer) { break; } - if (use_dependent_base_ && IsFieldDependent(field)) { - printer->Print("clear_$name$();\n", "name", FieldName(field)); - } else { - generator.GenerateMessageClearingCode(printer); - } + generator.GenerateMessageClearingCode(printer); } // Step 3: Greedily seek runs of fields that can be cleared by @@ -3012,6 +2750,11 @@ GenerateClear(io::Printer* printer) { last_chunk_mask |= static_cast<uint32>(1) << (index % 32); } + if (memset_run_start != memset_run_end && unconditional_budget >= 0) { + // Flush the memset fields. + goto flush; + } + // Step 4: Non-repeated, non-zero initializable fields. for (; i < optimized_order_.size(); i++) { const FieldDescriptor* field = optimized_order_[i]; @@ -3037,6 +2780,8 @@ GenerateClear(io::Printer* printer) { last_chunk_mask |= static_cast<uint32>(1) << (index % 32); } +flush: + if (last_chunk != -1) { GOOGLE_DCHECK_NE(-1, last_chunk_start); GOOGLE_DCHECK_NE(-1, last_chunk_end); @@ -3044,7 +2789,10 @@ GenerateClear(io::Printer* printer) { const int count = popcnt(last_chunk_mask); const bool have_outer_if = HasFieldPresence(descriptor_->file()) && - (last_chunk_start != last_chunk_end); + (last_chunk_start != last_chunk_end) && + (memset_run_start != last_chunk_start || + memset_run_end != last_chunk_end || + unconditional_budget < 0); if (have_outer_if) { // Check (up to) 8 has_bits at a time if we have more than one field in @@ -3107,6 +2855,12 @@ GenerateClear(io::Printer* printer) { if (should_check_bit && // If no field presence, then always clear strings/messages as well. HasFieldPresence(descriptor_->file())) { + if (!field->options().weak() && + cached_has_bit_index != (has_bit_indices_[field->index()] / 32)) { + cached_has_bit_index = (has_bit_indices_[field->index()] / 32); + printer->Print("cached_has_bits = _has_bits_[$new_index$];\n", + "new_index", SimpleItoa(cached_has_bit_index)); + } if (!MaybeGenerateOptionalFieldCondition(printer, field, cached_has_bit_index)) { printer->Print( @@ -3613,12 +3367,11 @@ GenerateMergeFromCodedStream(io::Printer* printer) { printer->Print( "return ::google::protobuf::internal::MergePartialFromCodedStream$lite$(\n" " this,\n" - " $file_namespace$::TableStruct::schema[\n" + " ::$file_namespace$::TableStruct::schema[\n" " $classname$::kIndexInFileMessages],\n" " input);\n", - "classname", classname_, - "file_namespace", FileLevelNamespace(descriptor_->file()->name()), - "lite", lite); + "classname", classname_, "file_namespace", + FileLevelNamespace(descriptor_), "lite", lite); printer->Outdent(); @@ -3631,17 +3384,14 @@ GenerateMergeFromCodedStream(io::Printer* printer) { " ::google::protobuf::uint32 tag;\n"); if (!UseUnknownFieldSet(descriptor_->file(), options_)) { - // Use LazyStringOutputString to avoid initializing unknown fields string - // unless it is actually needed. For the same reason, disable eager refresh - // on the CodedOutputStream. printer->Print( - " ::google::protobuf::io::LazyStringOutputStream unknown_fields_string(\n" - " ::google::protobuf::NewPermanentCallback(&_internal_metadata_,\n" - " &::google::protobuf::internal::InternalMetadataWithArenaLite::\n" - " mutable_unknown_fields));\n" - " ::google::protobuf::io::CodedOutputStream unknown_fields_stream(\n" - " &unknown_fields_string, false);\n", - "classname", classname_); + " ::google::protobuf::internal::LiteUnknownFieldSetter unknown_fields_setter(\n" + " &_internal_metadata_);\n" + " ::google::protobuf::io::StringOutputStream unknown_fields_output(\n" + " unknown_fields_setter.buffer());\n" + " ::google::protobuf::io::CodedOutputStream unknown_fields_stream(\n" + " &unknown_fields_output, false);\n", + "classname", classname_); } printer->Print( diff --git a/src/google/protobuf/compiler/cpp/cpp_message.h b/src/google/protobuf/compiler/cpp/cpp_message.h index 352069eb..0387f0ca 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message.h +++ b/src/google/protobuf/compiler/cpp/cpp_message.h @@ -43,6 +43,7 @@ #include <string> #include <google/protobuf/compiler/cpp/cpp_field.h> #include <google/protobuf/compiler/cpp/cpp_helpers.h> +#include <google/protobuf/compiler/cpp/cpp_message_layout_helper.h> #include <google/protobuf/compiler/cpp/cpp_options.h> namespace google { @@ -62,12 +63,10 @@ class ExtensionGenerator; // extension.h class MessageGenerator { public: // See generator.cc for the meaning of dllexport_decl. - MessageGenerator(const Descriptor* descriptor, const Options& options, - SCCAnalyzer* scc_analyzer); + MessageGenerator(const Descriptor* descriptor, int index_in_file_messages, + const Options& options, SCCAnalyzer* scc_analyzer); ~MessageGenerator(); - // Appends the pre-order walk of the nested generators to list. - void Flatten(std::vector<MessageGenerator*>* list); // Append the two types of nested generators to the corresponding vector. void AddGenerators(std::vector<EnumGenerator*>* enum_generators, std::vector<ExtensionGenerator*>* extension_generators); @@ -86,7 +85,7 @@ class MessageGenerator { // Generate definitions of inline methods (placed at the end of the header // file). - void GenerateInlineMethods(io::Printer* printer, bool is_inline); + void GenerateInlineMethods(io::Printer* printer); // Dependent methods are always inline. void GenerateDependentInlineMethods(io::Printer* printer); @@ -96,8 +95,8 @@ class MessageGenerator { // Generate extra fields void GenerateExtraDefaultFields(io::Printer* printer); - // Generates code that allocates the message's default instance. - void GenerateDefaultInstanceAllocator(io::Printer* printer); + // Generates code that creates default instances for fields. + void GenerateFieldDefaultInstances(io::Printer* printer); // Generates code that initializes the message's default instance. This // is separate from allocating because all default instances must be @@ -113,7 +112,7 @@ class MessageGenerator { void GenerateDependentFieldAccessorDeclarations(io::Printer* printer); void GenerateFieldAccessorDeclarations(io::Printer* printer); void GenerateDependentFieldAccessorDefinitions(io::Printer* printer); - void GenerateFieldAccessorDefinitions(io::Printer* printer, bool is_inline); + void GenerateFieldAccessorDefinitions(io::Printer* printer); // Generate the table-driven parsing array. Returns the number of entries // generated. @@ -190,7 +189,7 @@ class MessageGenerator { std::map<string, string> vars, io::Printer* printer); // Generates has_foo() functions and variables for oneof field has-bits. - void GenerateOneofHasBits(io::Printer* printer, bool is_inline); + void GenerateOneofHasBits(io::Printer* printer); // Generates has_foo_bar() functions for oneof members. void GenerateOneofMemberHasBits(const FieldDescriptor* field, const std::map<string, string>& vars, @@ -198,6 +197,7 @@ class MessageGenerator { // Generates the clear_foo() method for a field. void GenerateFieldClear(const FieldDescriptor* field, const std::map<string, string>& vars, + bool is_inline, io::Printer* printer); void GenerateConstructorBody(io::Printer* printer, @@ -208,6 +208,7 @@ class MessageGenerator { std::vector<uint32> RequiredFieldsBitMask() const; const Descriptor* descriptor_; + int index_in_file_messages_; string classname_; Options options_; FieldGeneratorMap field_generators_; @@ -218,7 +219,6 @@ class MessageGenerator { std::vector<const FieldDescriptor *> optimized_order_; std::vector<int> has_bit_indices_; int max_has_bit_index_; - google::protobuf::scoped_array<google::protobuf::scoped_ptr<MessageGenerator> > nested_generators_; google::protobuf::scoped_array<google::protobuf::scoped_ptr<EnumGenerator> > enum_generators_; google::protobuf::scoped_array<google::protobuf::scoped_ptr<ExtensionGenerator> > extension_generators_; int num_required_fields_; @@ -227,9 +227,10 @@ class MessageGenerator { // table_driven_ indicates the generated message uses table-driven parsing. bool table_driven_; - int index_in_file_messages_; + google::protobuf::scoped_ptr<MessageLayoutHelper> message_layout_helper_; SCCAnalyzer* scc_analyzer_; + string scc_name_; friend class FileGenerator; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator); diff --git a/src/google/protobuf/compiler/cpp/cpp_message_field.cc b/src/google/protobuf/compiler/cpp/cpp_message_field.cc index da4c3950..fe60a283 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message_field.cc @@ -45,13 +45,42 @@ namespace cpp { namespace { +// When we are generating code for implicit weak fields, we need to insert some +// additional casts. These functions return the casted expression if +// implicit_weak_field is true but otherwise return the original expression. +// Ordinarily a static_cast is enough to cast google::protobuf::MessageLite* to a class +// deriving from it, but we need a reinterpret_cast in cases where the generated +// message is forward-declared but its full definition is not visible. +string StaticCast(const string& type, const string& expression, + bool implicit_weak_field) { + if (implicit_weak_field) { + return "static_cast< " + type + " >(" + expression + ")"; + } else { + return expression; + } +} + +string ReinterpretCast(const string& type, const string& expression, + bool implicit_weak_field) { + if (implicit_weak_field) { + return "reinterpret_cast< " + type + " >(" + expression + ")"; + } else { + return expression; + } +} + void SetMessageVariables(const FieldDescriptor* descriptor, std::map<string, string>* variables, const Options& options) { SetCommonFieldVariables(descriptor, variables, options); (*variables)["type"] = FieldMessageTypeName(descriptor); + (*variables)["casted_member"] = + ReinterpretCast((*variables)["type"] + "*", (*variables)["name"] + "_", + IsImplicitWeakField(descriptor, options)); (*variables)["type_default_instance"] = DefaultInstanceName(descriptor->message_type()); + (*variables)["type_reference_function"] = + ReferenceFunctionName(descriptor->message_type()); if (descriptor->options().weak() || !descriptor->containing_oneof()) { (*variables)["non_null_ptr_to_name"] = StrCat("this->", (*variables)["name"], "_"); @@ -85,7 +114,8 @@ MessageFieldGenerator::MessageFieldGenerator(const FieldDescriptor* descriptor, const Options& options) : FieldGenerator(options), descriptor_(descriptor), - dependent_field_(options.proto_h && IsFieldDependent(descriptor)) { + dependent_field_(options.proto_h && IsFieldDependent(descriptor)), + implicit_weak_field_(IsImplicitWeakField(descriptor, options)) { SetMessageVariables(descriptor, &variables_, options); } @@ -93,14 +123,11 @@ MessageFieldGenerator::~MessageFieldGenerator() {} void MessageFieldGenerator:: GeneratePrivateMembers(io::Printer* printer) const { - printer->Print(variables_, "$type$* $name$_;\n"); -} - -void MessageFieldGenerator:: -GenerateGetterDeclaration(io::Printer* printer) const { - printer->Print(variables_, - "$deprecated_attr$const $type$& $name$() const;\n"); - printer->Annotate("name", descriptor_); + if (implicit_weak_field_) { + printer->Print(variables_, "google::protobuf::MessageLite* $name$_;\n"); + } else { + printer->Print(variables_, "$type$* $name$_;\n"); + } } void MessageFieldGenerator:: @@ -108,63 +135,91 @@ GenerateDependentAccessorDeclarations(io::Printer* printer) const { if (!dependent_field_) { return; } - // Arena manipulation code is out-of-line in the derived message class. printer->Print(variables_, "$deprecated_attr$$type$* ${$mutable_$name$$}$();\n"); printer->Annotate("{", "}", descriptor_); - printer->Print(variables_, "$deprecated_attr$$type$* $release_name$();\n"); - printer->Annotate("release_name", descriptor_); - printer->Print(variables_, - "$deprecated_attr$void ${$set_allocated_$name$$}$" - "($type$* $name$);\n"); - printer->Annotate("{", "}", descriptor_); } void MessageFieldGenerator:: GenerateAccessorDeclarations(io::Printer* printer) const { - if (SupportsArenas(descriptor_)) { + if (SupportsArenas(descriptor_) && !implicit_weak_field_) { printer->Print(variables_, "private:\n" - "void _slow_mutable_$name$();\n"); - if (SupportsArenas(descriptor_->message_type())) { - printer->Print(variables_, - "void _slow_set_allocated_$name$(\n" - " ::google::protobuf::Arena* message_arena, $type$** $name$);\n"); - } + "void _slow_mutable_$name$();\n" + "public:\n"); + } + if (implicit_weak_field_) { + // These private accessors are used by MergeFrom and + // MergePartialFromCodedStream, and their purpose is to provide access to + // the field without creating a strong dependency on the message type. printer->Print(variables_, - "$type$* _slow_$release_name$();\n" + "private:\n" + "const google::protobuf::MessageLite& _internal_$name$() const;\n" + "google::protobuf::MessageLite* _internal_mutable_$name$();\n" "public:\n"); } - GenerateGetterDeclaration(printer); + printer->Print(variables_, + "$deprecated_attr$const $type$& $name$() const;\n"); + printer->Annotate("name", descriptor_); + printer->Print(variables_, "$deprecated_attr$$type$* $release_name$();\n"); + printer->Annotate("release_name", descriptor_); if (!dependent_field_) { printer->Print(variables_, "$deprecated_attr$$type$* ${$mutable_$name$$}$();\n"); printer->Annotate("{", "}", descriptor_); - printer->Print(variables_, "$deprecated_attr$$type$* $release_name$();\n"); - printer->Annotate("release_name", descriptor_); - printer->Print(variables_, - "$deprecated_attr$void ${$set_allocated_$name$$}$" - "($type$* $name$);\n"); - printer->Annotate("{", "}", descriptor_); } + printer->Print(variables_, + "$deprecated_attr$void ${$set_allocated_$name$$}$" + "($type$* $name$);\n"); + printer->Annotate("{", "}", descriptor_); if (SupportsArenas(descriptor_)) { - printer->Print( - variables_, - "$deprecated_attr$$type$* ${$unsafe_arena_release_$name$$}$();\n"); - printer->Annotate("{", "}", descriptor_); printer->Print(variables_, "$deprecated_attr$void " "${$unsafe_arena_set_allocated_$name$$}$(\n" " $type$* $name$);\n"); printer->Annotate("{", "}", descriptor_); + printer->Print( + variables_, + "$deprecated_attr$$type$* ${$unsafe_arena_release_$name$$}$();\n"); + printer->Annotate("{", "}", descriptor_); } } void MessageFieldGenerator::GenerateNonInlineAccessorDefinitions( io::Printer* printer) const { - if (SupportsArenas(descriptor_)) { + if (implicit_weak_field_) { printer->Print(variables_, - "void $classname$::_slow_mutable_$name$() {\n"); + "const google::protobuf::MessageLite& $classname$::_internal_$name$() const {\n" + " if ($name$_ != NULL) {\n" + " return *$name$_;\n" + " } else if (&$type_default_instance$ != NULL) {\n" + " return *reinterpret_cast<const google::protobuf::MessageLite*>(\n" + " &$type_default_instance$);\n" + " } else {\n" + " return *reinterpret_cast<const google::protobuf::MessageLite*>(\n" + " &::google::protobuf::internal::implicit_weak_message_default_instance);\n" + " }\n" + "}\n"); + } + if (SupportsArenas(descriptor_)) { + if (implicit_weak_field_) { + printer->Print(variables_, + "google::protobuf::MessageLite* $classname$::_internal_mutable_$name$() {\n" + " $set_hasbit$\n" + " if ($name$_ == NULL) {\n" + " if (&$type_default_instance$ == NULL) {\n" + " $name$_ = ::google::protobuf::Arena::CreateMessage<\n" + " ::google::protobuf::internal::ImplicitWeakMessage>(\n" + " GetArenaNoVirtual());\n" + " } else {\n" + " $name$_ = reinterpret_cast<const google::protobuf::MessageLite*>(\n" + " &$type_default_instance$)->New(GetArenaNoVirtual());\n" + " }\n" + " }\n" + " return $name$_;\n"); + } else { + printer->Print(variables_, + "void $classname$::_slow_mutable_$name$() {\n"); if (SupportsArenas(descriptor_->message_type())) { printer->Print(variables_, " $name$_ = ::google::protobuf::Arena::CreateMessage< $type$ >(\n" @@ -174,43 +229,10 @@ void MessageFieldGenerator::GenerateNonInlineAccessorDefinitions( " $name$_ = ::google::protobuf::Arena::Create< $type$ >(\n" " GetArenaNoVirtual());\n"); } + } printer->Print(variables_, - "}\n" - "$type$* $classname$::_slow_$release_name$() {\n" - " if ($name$_ == NULL) {\n" - " return NULL;\n" - " } else {\n" - " $type$* temp = new $type$(*$name$_);\n" - " $name$_ = NULL;\n" - " return temp;\n" - " }\n" - "}\n" - "$type$* $classname$::unsafe_arena_release_$name$() {\n" - " // @@protoc_insertion_point(field_unsafe_arena_release:$full_name$)\n" - " $clear_hasbit$\n" - " $type$* temp = $name$_;\n" - " $name$_ = NULL;\n" - " return temp;\n" "}\n"); - if (SupportsArenas(descriptor_->message_type())) { - // NOTE: the same logic is mirrored in weak_message_field.cc. Any - // arena-related semantics changes should be made in both places. - printer->Print(variables_, - "void $classname$::_slow_set_allocated_$name$(\n" - " ::google::protobuf::Arena* message_arena, $type$** $name$) {\n" - " if (message_arena != NULL && \n" - " ::google::protobuf::Arena::GetArena(*$name$) == NULL) {\n" - " message_arena->Own(*$name$);\n" - " } else if (message_arena !=\n" - " ::google::protobuf::Arena::GetArena(*$name$)) {\n" - " $type$* new_$name$ = \n" - " ::google::protobuf::Arena::CreateMessage< $type$ >(\n" - " message_arena);\n" - " new_$name$->CopyFrom(**$name$);\n" - " *$name$ = new_$name$;\n" - " }\n" - "}\n"); - } + printer->Print(variables_, "void $classname$::unsafe_arena_set_allocated_$name$(\n" " $type$* $name$) {\n" @@ -228,6 +250,20 @@ void MessageFieldGenerator::GenerateNonInlineAccessorDefinitions( " // @@protoc_insertion_point(field_unsafe_arena_set_allocated" ":$full_name$)\n" "}\n"); + } else if (implicit_weak_field_) { + printer->Print(variables_, + "google::protobuf::MessageLite* $classname$::_internal_mutable_$name$() {\n" + " $set_hasbit$\n" + " if ($name$_ == NULL) {\n" + " if (&$type_default_instance$ == NULL) {\n" + " $name$_ = new ::google::protobuf::internal::ImplicitWeakMessage;\n" + " } else {\n" + " $name$_ = reinterpret_cast<const google::protobuf::MessageLite*>(\n" + " &$type_default_instance$)->New();\n" + " }\n" + " }\n" + " return $name$_;\n" + "}\n"); } } @@ -243,6 +279,10 @@ GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const { variables["dependent_classname"] = DependentBaseClassTemplateName(descriptor_->containing_type()) + "<T>"; variables["this_message"] = DependentBaseDownCast(); + variables["casted_reference"] = + ReinterpretCast(variables["dependent_typename"] + "*&", + variables["this_message"] + variables["name"] + "_", + implicit_weak_field_); if (!variables["set_hasbit"].empty()) { variables["set_hasbit"] = variables["this_message"] + variables["set_hasbit"]; @@ -255,240 +295,196 @@ GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const { if (SupportsArenas(descriptor_)) { printer->Print(variables, "template <class T>\n" - "inline $type$* $dependent_classname$::mutable_$name$() {\n" + "inline $type$* $dependent_classname$::mutable_$name$() {\n"); + if (implicit_weak_field_) { + printer->Print(variables, " $type_reference_function$();\n"); + } + printer->Print(variables, " $set_hasbit$\n" - " $dependent_typename$*& $name$_ = $this_message$$name$_;\n" - " if ($name$_ == NULL) {\n" - " $this_message$_slow_mutable_$name$();\n" - " }\n" - " // @@protoc_insertion_point(field_mutable:$full_name$)\n" - " return $name$_;\n" - "}\n" - "template <class T>\n" - "inline $type$* $dependent_classname$::$release_name$() {\n" - " // @@protoc_insertion_point(field_release:$full_name$)\n" - " $dependent_typename$*& $name$_ = $this_message$$name$_;\n" - " $clear_hasbit$\n" - " if ($this_message$GetArenaNoVirtual() != NULL) {\n" - " return $this_message$_slow_$release_name$();\n" - " } else {\n" - " $dependent_typename$* temp = $name$_;\n" - " $name$_ = NULL;\n" - " return temp;\n" - " }\n" - "}\n" - "template <class T>\n" - "inline void $dependent_classname$::" - "set_allocated_$name$($type$* $name$) {\n" - " ::google::protobuf::Arena* message_arena = $this_message$GetArenaNoVirtual();\n" - " $dependent_typename$*& $name$_ = $this_message$$name$_;\n" - " if (message_arena == NULL) {\n" - " delete $name$_;\n" - " }\n" - " if ($name$ != NULL) {\n"); - if (SupportsArenas(descriptor_->message_type())) { - // If we're on an arena and the incoming message is not, simply Own() it - // rather than copy to the arena -- either way we need a heap dealloc, - // so we might as well defer it. Otherwise, if incoming message is on a - // different ownership domain (specific arena, or the heap) than we are, - // copy to our arena (or heap, as the case may be). + " $dependent_typename$*& $name$_ = $casted_reference$;\n" + " if ($name$_ == NULL) {\n"); + if (implicit_weak_field_) { printer->Print(variables, - " $this_message$_slow_set_allocated_$name$(message_arena, " - "&$name$);\n"); + " $name$_ = reinterpret_cast<$dependent_typename$*>(\n" + " reinterpret_cast<const google::protobuf::MessageLite*>(\n" + " &$type_default_instance$)->New(\n" + " $this_message$GetArenaNoVirtual()));\n"); } else { printer->Print(variables, - " if (message_arena != NULL) {\n" - " message_arena->Own($name$);\n" - " }\n"); + " $this_message$_slow_mutable_$name$();\n"); } printer->Print(variables, " }\n" - " $name$_ = $name$;\n" - " if ($name$) {\n" - " $set_hasbit$\n" - " } else {\n" - " $clear_hasbit$\n" - " }\n" - // TODO(dlj): move insertion points to message class. - " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" + " // @@protoc_insertion_point(field_mutable:$full_name$)\n" + " return $name$_;\n" "}\n"); } else { printer->Print(variables, "template <class T>\n" "inline $type$* $dependent_classname$::mutable_$name$() {\n" " $set_hasbit$\n" - " $dependent_typename$*& $name$_ = $this_message$$name$_;\n" + " $dependent_typename$*& $name$_ = $casted_reference$;\n" " if ($name$_ == NULL) {\n" " $name$_ = new $dependent_typename$;\n" " }\n" " // @@protoc_insertion_point(field_mutable:$full_name$)\n" " return $name$_;\n" - "}\n" - "template <class T>\n" - "inline $type$* $dependent_classname$::$release_name$() {\n" - " // @@protoc_insertion_point(field_release:$full_name$)\n" - " $clear_hasbit$\n" - " $dependent_typename$*& $name$_ = $this_message$$name$_;\n" - " $dependent_typename$* temp = $name$_;\n" - " $name$_ = NULL;\n" - " return temp;\n" - "}\n" - "template <class T>\n" - "inline void $dependent_classname$::" - "set_allocated_$name$($type$* $name$) {\n" - " $dependent_typename$*& $name$_ = $this_message$$name$_;\n" - " delete $name$_;\n"); - - if (SupportsArenas(descriptor_->message_type())) { - printer->Print(variables, - " if ($name$ != NULL && static_cast< $dependent_typename$* >($name$)" - "->GetArena() != NULL) {\n" - " $dependent_typename$* new_$name$ = new $dependent_typename$;\n" - " new_$name$->CopyFrom(*$name$);\n" - " $name$ = new_$name$;\n" - " }\n"); - } - - printer->Print(variables, - " $name$_ = $name$;\n" - " if ($name$) {\n" - " $set_hasbit$\n" - " } else {\n" - " $clear_hasbit$\n" - " }\n" - " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" "}\n"); } } void MessageFieldGenerator:: -GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const { +GenerateInlineAccessorDefinitions(io::Printer* printer) const { std::map<string, string> variables(variables_); - variables["inline"] = is_inline ? "inline " : ""; + variables["const_member"] = ReinterpretCast( + "const " + variables["type"] + "*", variables["name"] + "_", + implicit_weak_field_); + printer->Print(variables, + "inline const $type$& $classname$::$name$() const {\n"); + if (implicit_weak_field_) { + printer->Print(variables, " $type_reference_function$();\n"); + } printer->Print(variables, - "$inline$const $type$& $classname$::$name$() const {\n" - " const $type$* p = $name$_;\n" + " const $type$* p = $const_member$;\n" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return p != NULL ? *p : *reinterpret_cast<const $type$*>(\n" " &$type_default_instance$);\n" "}\n"); - if (dependent_field_) return; - + printer->Print(variables, + "inline $type$* $classname$::$release_name$() {\n" + " // @@protoc_insertion_point(field_release:$full_name$)\n"); + if (implicit_weak_field_) { + printer->Print(variables, " $type_reference_function$();\n"); + } + printer->Print(variables, + " $clear_hasbit$\n" + " $type$* temp = $casted_member$;\n"); if (SupportsArenas(descriptor_)) { printer->Print(variables, - "$inline$" - "$type$* $classname$::mutable_$name$() {\n" - " $set_hasbit$\n" - " if ($name$_ == NULL) {\n" - " _slow_mutable_$name$();\n" - " }\n" - " // @@protoc_insertion_point(field_mutable:$full_name$)\n" - " return $name$_;\n" - "}\n" - "$inline$" - "$type$* $classname$::$release_name$() {\n" - " // @@protoc_insertion_point(field_release:$full_name$)\n" - " $clear_hasbit$\n" " if (GetArenaNoVirtual() != NULL) {\n" - " return _slow_$release_name$();\n" - " } else {\n" - " $type$* temp = $name$_;\n" - " $name$_ = NULL;\n" - " return temp;\n" - " }\n" - "}\n" - "$inline$ " - "void $classname$::set_allocated_$name$($type$* $name$) {\n" - " ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();\n" - " if (message_arena == NULL) {\n" - " delete $name$_;\n" - " }\n" - " if ($name$ != NULL) {\n"); - if (SupportsArenas(descriptor_->message_type())) { - // If we're on an arena and the incoming message is not, simply Own() it - // rather than copy to the arena -- either way we need a heap dealloc, - // so we might as well defer it. Otherwise, if incoming message is on a - // different ownership domain (specific arena, or the heap) than we are, - // copy to our arena (or heap, as the case may be). - printer->Print(variables, - " _slow_set_allocated_$name$(message_arena, &$name$);\n"); - } else { - printer->Print(variables, - " if (message_arena != NULL) {\n" - " message_arena->Own($name$);\n" - " }\n"); - } + " temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL);\n" + " }\n"); + } + printer->Print(variables, + " $name$_ = NULL;\n" + " return temp;\n" + "}\n"); + + if (SupportsArenas(descriptor_)) { printer->Print(variables, - " }\n" - " $name$_ = $name$;\n" - " if ($name$) {\n" - " $set_hasbit$\n" - " } else {\n" - " $clear_hasbit$\n" - " }\n" - " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" - "}\n"); - } else { + "inline $type$* $classname$::unsafe_arena_release_$name$() {\n" + " // @@protoc_insertion_point(" + "field_unsafe_arena_release:$full_name$)\n"); + if (implicit_weak_field_) { + printer->Print(variables, " $type_reference_function$();\n"); + } printer->Print(variables, - "$inline$" - "$type$* $classname$::mutable_$name$() {\n" - " $set_hasbit$\n" - " if ($name$_ == NULL) {\n" - " $name$_ = new $type$;\n" - " }\n" - " // @@protoc_insertion_point(field_mutable:$full_name$)\n" - " return $name$_;\n" - "}\n" - "$inline$" - "$type$* $classname$::$release_name$() {\n" - " // @@protoc_insertion_point(field_release:$full_name$)\n" " $clear_hasbit$\n" - " $type$* temp = $name$_;\n" + " $type$* temp = $casted_member$;\n" " $name$_ = NULL;\n" " return temp;\n" - "}\n" - "$inline$" - "void $classname$::set_allocated_$name$($type$* $name$) {\n" - " delete $name$_;\n"); + "}\n"); + } - if (SupportsArenas(descriptor_->message_type())) { + if (!dependent_field_) { + if (SupportsArenas(descriptor_)) { printer->Print(variables, - " if ($name$ != NULL && $name$->GetArena() != NULL) {\n" - " $type$* new_$name$ = new $type$;\n" - " new_$name$->CopyFrom(*$name$);\n" - " $name$ = new_$name$;\n" - " }\n"); + "inline $type$* $classname$::mutable_$name$() {\n" + " $set_hasbit$\n" + " if ($name$_ == NULL) {\n"); + if (implicit_weak_field_) { + printer->Print(variables, + " _internal_mutable_$name$();\n"); + } else { + printer->Print(variables, + " _slow_mutable_$name$();\n"); + } + printer->Print(variables, + " }\n" + " // @@protoc_insertion_point(field_mutable:$full_name$)\n" + " return $casted_member$;\n" + "}\n"); + } else { + printer->Print(variables, + "inline $type$* $classname$::mutable_$name$() {\n" + " $set_hasbit$\n" + " if ($name$_ == NULL) {\n" + " $name$_ = new $type$;\n" + " }\n" + " // @@protoc_insertion_point(field_mutable:$full_name$)\n" + " return $casted_member$;\n" + "}\n"); } + } + + // We handle the most common case inline, and delegate less common cases to + // the slow fallback function. + printer->Print(variables, + "inline void $classname$::set_allocated_$name$($type$* $name$) {\n" + " ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();\n"); + printer->Print(variables, + " if (message_arena == NULL) {\n"); + if (IsCrossFileMessage(descriptor_)) { printer->Print(variables, - " $name$_ = $name$;\n" - " if ($name$) {\n" - " $set_hasbit$\n" - " } else {\n" - " $clear_hasbit$\n" - " }\n" - " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" - "}\n"); + " delete reinterpret_cast< ::google::protobuf::MessageLite*>($name$_);\n"); + } else { + printer->Print(variables, + " delete $name$_;\n"); } + printer->Print(variables, + " }\n" + " if ($name$) {\n"); + if (SupportsArenas(descriptor_->message_type()) && + IsCrossFileMessage(descriptor_)) { + // We have to read the arena through the virtual method, because the type + // isn't defined in this file. + printer->Print(variables, + " ::google::protobuf::Arena* submessage_arena =\n" + " reinterpret_cast< ::google::protobuf::MessageLite*>($name$)->GetArena();\n"); + } else if (!SupportsArenas(descriptor_->message_type())) { + printer->Print(variables, + " ::google::protobuf::Arena* submessage_arena = NULL;\n"); + } else { + printer->Print(variables, + " ::google::protobuf::Arena* submessage_arena =\n" + " ::google::protobuf::Arena::GetArena($name$);\n"); + } + printer->Print(variables, + " if (message_arena != submessage_arena) {\n" + " $name$ = ::google::protobuf::internal::GetOwnedMessage(\n" + " message_arena, $name$, submessage_arena);\n" + " }\n" + " $set_hasbit$\n" + " } else {\n" + " $clear_hasbit$\n" + " }\n"); + if (implicit_weak_field_) { + printer->Print(variables, + " $name$_ = reinterpret_cast<MessageLite*>($name$);\n"); + } else { + printer->Print(variables, + " $name$_ = $name$;\n"); + } + printer->Print(variables, + " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" + "}\n"); } void MessageFieldGenerator:: GenerateClearingCode(io::Printer* printer) const { - std::map<string, string> variables(variables_); - variables["this_message"] = dependent_field_ ? DependentBaseDownCast() : ""; if (!HasFieldPresence(descriptor_->file())) { // If we don't have has-bits, message presence is indicated only by ptr != // NULL. Thus on clear, we need to delete the object. - printer->Print(variables, - "if ($this_message$GetArenaNoVirtual() == NULL && " - "$this_message$$name$_ != NULL) delete $this_message$$name$_;\n" - "$this_message$$name$_ = NULL;\n"); + printer->Print(variables_, + "if (GetArenaNoVirtual() == NULL && $name$_ != NULL) {\n" + " delete $name$_;\n" + "}\n" + "$name$_ = NULL;\n"); } else { - printer->Print(variables, - "if ($this_message$$name$_ != NULL) $this_message$$name$_->" - "$dependent_type$::Clear();\n"); + printer->Print(variables_, + "if ($name$_ != NULL) $name$_->Clear();\n"); } } @@ -505,14 +501,20 @@ GenerateMessageClearingCode(io::Printer* printer) const { } else { printer->Print(variables_, "GOOGLE_DCHECK($name$_ != NULL);\n" - "$name$_->$type$::Clear();\n"); + "$name$_->Clear();\n"); } } void MessageFieldGenerator:: GenerateMergingCode(io::Printer* printer) const { - printer->Print(variables_, - "mutable_$name$()->$type$::MergeFrom(from.$name$());\n"); + if (implicit_weak_field_) { + printer->Print(variables_, + "_internal_mutable_$name$()->CheckTypeAndMergeFrom(\n" + " from._internal_$name$());\n"); + } else { + printer->Print(variables_, + "mutable_$name$()->$type$::MergeFrom(from.$name$());\n"); + } } void MessageFieldGenerator:: @@ -557,23 +559,30 @@ GenerateCopyConstructorCode(io::Printer* printer) const { // wasn't copied, so both of these methods allocate the submessage on the // heap. - printer->Print(variables_, - "if (from.has_$name$()) {\n" - " $name$_ = new $type$(*from.$name$_);\n" - "} else {\n" - " $name$_ = NULL;\n" - "}\n"); + string new_expression = (implicit_weak_field_ ? "from.$name$_->New()" + : "new $type$(*from.$name$_)"); + string output = + "if (from.has_$name$()) {\n" + " $name$_ = " + new_expression + ";\n" + "} else {\n" + " $name$_ = NULL;\n" + "}\n"; + printer->Print(variables_, output.c_str()); } void MessageFieldGenerator:: GenerateMergeFromCodedStream(io::Printer* printer) const { - if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE) { + if (implicit_weak_field_) { + printer->Print(variables_, + "DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(\n" + " input, _internal_mutable_$name$()));\n"); + } else if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE) { printer->Print(variables_, - "DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(\n" + "DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(\n" " input, mutable_$name$()));\n"); } else { printer->Print(variables_, - "DO_(::google::protobuf::internal::WireFormatLite::ReadGroupNoVirtual(\n" + "DO_(::google::protobuf::internal::WireFormatLite::ReadGroup(\n" " $number$, input, mutable_$name$()));\n"); } } @@ -589,7 +598,7 @@ void MessageFieldGenerator:: GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { printer->Print(variables_, "target = ::google::protobuf::internal::WireFormatLite::\n" - " InternalWrite$declared_type$NoVirtualToArray(\n" + " InternalWrite$declared_type$ToArray(\n" " $number$, *$non_null_ptr_to_name$, deterministic, target);\n"); } @@ -597,7 +606,7 @@ void MessageFieldGenerator:: GenerateByteSize(io::Printer* printer) const { printer->Print(variables_, "total_size += $tag_size$ +\n" - " ::google::protobuf::internal::WireFormatLite::$declared_type$SizeNoVirtual(\n" + " ::google::protobuf::internal::WireFormatLite::$declared_type$Size(\n" " *$non_null_ptr_to_name$);\n"); } @@ -613,29 +622,38 @@ MessageOneofFieldGenerator(const FieldDescriptor* descriptor, MessageOneofFieldGenerator::~MessageOneofFieldGenerator() {} - -void MessageOneofFieldGenerator:: -GenerateDependentAccessorDeclarations(io::Printer* printer) const { - // Oneof field getters must be dependent as they call default_instance(). - // Otherwise, the logic is the same as MessageFields. - if (!dependent_field_) { - return; - } +void MessageOneofFieldGenerator::GenerateNonInlineAccessorDefinitions( + io::Printer* printer) const { printer->Print(variables_, - "$deprecated_attr$const $type$& $name$() const;\n"); - MessageFieldGenerator::GenerateDependentAccessorDeclarations(printer); -} - -void MessageOneofFieldGenerator:: -GenerateGetterDeclaration(io::Printer* printer) const { - // Oneof field getters must be dependent as they call default_instance(). - // Unlike MessageField, this means there is no (non-dependent) getter to - // generate. - if (dependent_field_) { - return; + "void $classname$::set_allocated_$name$($type$* $name$) {\n" + " ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();\n" + " clear_$oneof_name$();\n" + " if ($name$) {\n"); + if (SupportsArenas(descriptor_->message_type()) && + descriptor_->file() != descriptor_->message_type()->file()) { + // We have to read the arena through the virtual method, because the type + // isn't defined in this file. + printer->Print(variables_, + " ::google::protobuf::Arena* submessage_arena =\n" + " reinterpret_cast< ::google::protobuf::MessageLite*>($name$)->GetArena();\n"); + } else if (!SupportsArenas(descriptor_->message_type())) { + printer->Print(variables_, + " ::google::protobuf::Arena* submessage_arena = NULL;\n"); + } else { + printer->Print(variables_, + " ::google::protobuf::Arena* submessage_arena =\n" + " ::google::protobuf::Arena::GetArena($name$);\n"); } printer->Print(variables_, - "$deprecated_attr$const $type$& $name$() const;\n"); + " if (message_arena != submessage_arena) {\n" + " $name$ = ::google::protobuf::internal::GetOwnedMessage(\n" + " message_arena, $name$, submessage_arena);\n" + " }\n" + " set_has_$name$();\n" + " $oneof_prefix$$name$_ = $name$;\n" + " }\n" + " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" + "}\n"); } void MessageOneofFieldGenerator:: @@ -646,7 +664,6 @@ GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const { return; } std::map<string, string> variables(variables_); - variables["inline"] = "inline "; variables["dependent_classname"] = DependentBaseClassTemplateName(descriptor_->containing_type()) + "<T>"; variables["this_message"] = "reinterpret_cast<T*>(this)->"; @@ -660,13 +677,9 @@ GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const { } void MessageOneofFieldGenerator:: -GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const { - if (dependent_base_) { - return; - } +GenerateInlineAccessorDefinitions(io::Printer* printer) const { + std::map<string, string> variables(variables_); - variables["inline"] = is_inline ? "inline " : ""; variables["dependent_classname"] = variables["classname"]; variables["this_message"] = ""; variables["this_const_message"] = ""; @@ -674,26 +687,77 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, variables["field_member"] = variables["oneof_prefix"] + variables["name"] + "_"; variables["dependent_type"] = variables["type"]; - InternalGenerateInlineAccessorDefinitions(variables, printer); -} -void MessageOneofFieldGenerator::InternalGenerateInlineAccessorDefinitions( - const std::map<string, string>& variables, io::Printer* printer) const { printer->Print(variables, - "$tmpl$" - "$inline$ " - "const $type$& $dependent_classname$::$name$() const {\n" + "inline $type$* $classname$::$release_name$() {\n" + " // @@protoc_insertion_point(field_release:$full_name$)\n" + " if ($this_message$has_$name$()) {\n" + " $this_message$clear_has_$oneof_name$();\n" + " $type$* temp = $field_member$;\n"); + if (SupportsArenas(descriptor_)) { + printer->Print(variables, + " if ($this_message$GetArenaNoVirtual() != NULL) {\n" + " temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL);\n" + " }\n"); + } + printer->Print(variables, + " $field_member$ = NULL;\n" + " return temp;\n" + " } else {\n" + " return NULL;\n" + " }\n" + "}\n"); + + printer->Print(variables, + "inline const $type$& $classname$::$name$() const {\n" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return $this_const_message$has_$name$()\n" " ? *$this_const_message$$oneof_prefix$$name$_\n" - " : $dependent_type$::default_instance();\n" + " : *reinterpret_cast< $type$*>(&$type_default_instance$);\n" "}\n"); if (SupportsArenas(descriptor_)) { printer->Print(variables, + "inline $type$* $dependent_classname$::unsafe_arena_release_$name$() {\n" + " // @@protoc_insertion_point(field_unsafe_arena_release" + ":$full_name$)\n" + " if ($this_message$has_$name$()) {\n" + " $this_message$clear_has_$oneof_name$();\n" + " $type$* temp = $this_message$$oneof_prefix$$name$_;\n" + " $this_message$$oneof_prefix$$name$_ = NULL;\n" + " return temp;\n" + " } else {\n" + " return NULL;\n" + " }\n" + "}\n" + "inline void $classname$::unsafe_arena_set_allocated_$name$" + "($type$* $name$) {\n" + // We rely on the oneof clear method to free the earlier contents of this + // oneof. We can directly use the pointer we're given to set the new + // value. + " clear_$oneof_name$();\n" + " if ($name$) {\n" + " set_has_$name$();\n" + " $oneof_prefix$$name$_ = $name$;\n" + " }\n" + " // @@protoc_insertion_point(field_unsafe_arena_set_allocated:" + "$full_name$)\n" + "}\n"); + } + + if (dependent_base_) { + return; + } + + InternalGenerateInlineAccessorDefinitions(variables, printer); +} + +void MessageOneofFieldGenerator::InternalGenerateInlineAccessorDefinitions( + const std::map<string, string>& variables, io::Printer* printer) const { + if (SupportsArenas(descriptor_)) { + printer->Print(variables, "$tmpl$" - "$inline$" - "$type$* $dependent_classname$::mutable_$name$() {\n" + "inline $type$* $dependent_classname$::mutable_$name$() {\n" " if (!$this_message$has_$name$()) {\n" " $this_message$clear_$oneof_name$();\n" " $this_message$set_has_$name$();\n"); @@ -712,95 +776,11 @@ void MessageOneofFieldGenerator::InternalGenerateInlineAccessorDefinitions( " }\n" " // @@protoc_insertion_point(field_mutable:$full_name$)\n" " return $field_member$;\n" - "}\n" - "$tmpl$" - "$inline$" - "$type$* $dependent_classname$::$release_name$() {\n" - " // @@protoc_insertion_point(field_release:$full_name$)\n" - " if ($this_message$has_$name$()) {\n" - " $this_message$clear_has_$oneof_name$();\n" - " if ($this_message$GetArenaNoVirtual() != NULL) {\n" - // N.B.: safe to use the underlying field pointer here because we are sure - // that it is non-NULL (because has_$name$() returned true). - " $dependent_typename$* temp = " - "new $dependent_typename$(*$field_member$);\n" - " $field_member$ = NULL;\n" - " return temp;\n" - " } else {\n" - " $dependent_typename$* temp = $field_member$;\n" - " $field_member$ = NULL;\n" - " return temp;\n" - " }\n" - " } else {\n" - " return NULL;\n" - " }\n" - "}\n" - "$tmpl$" - "$inline$" - "void $dependent_classname$::" - "set_allocated_$name$($type$* $name$) {\n" - " $this_message$clear_$oneof_name$();\n" - " if ($name$) {\n"); - - if (SupportsArenas(descriptor_->message_type())) { - printer->Print(variables, - // If incoming message is on the heap and we are on an arena, just Own() - // it (see above). If it's on a different arena than we are or one of us - // is on the heap, we make a copy to our arena/heap. - " if ($this_message$GetArenaNoVirtual() != NULL &&\n" - " ::google::protobuf::Arena::GetArena($name$) == NULL) {\n" - " $this_message$GetArenaNoVirtual()->Own($name$);\n" - " } else if ($this_message$GetArenaNoVirtual() !=\n" - " ::google::protobuf::Arena::GetArena($name$)) {\n" - " $dependent_typename$* new_$name$ = \n" - " ::google::protobuf::Arena::CreateMessage< $dependent_typename$ >(\n" - " $this_message$GetArenaNoVirtual());\n" - " new_$name$->CopyFrom(*$name$);\n" - " $name$ = new_$name$;\n" - " }\n"); - } else { - printer->Print(variables, - " if ($this_message$GetArenaNoVirtual() != NULL) {\n" - " $this_message$GetArenaNoVirtual()->Own($name$);\n" - " }\n"); - } - - printer->Print(variables, - " $this_message$set_has_$name$();\n" - " $field_member$ = $name$;\n" - " }\n" - " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" - "}\n" - "$inline$ $type$* $classname$::unsafe_arena_release_$name$() {\n" - " // @@protoc_insertion_point(field_unsafe_arena_release" - ":$full_name$)\n" - " if (has_$name$()) {\n" - " clear_has_$oneof_name$();\n" - " $type$* temp = $oneof_prefix$$name$_;\n" - " $oneof_prefix$$name$_ = NULL;\n" - " return temp;\n" - " } else {\n" - " return NULL;\n" - " }\n" - "}\n" - "$inline$ void $classname$::unsafe_arena_set_allocated_$name$" - "($type$* $name$) {\n" - // We rely on the oneof clear method to free the earlier contents of this - // oneof. We can directly use the pointer we're given to set the new - // value. - " clear_$oneof_name$();\n" - " if ($name$) {\n" - " set_has_$name$();\n" - " $oneof_prefix$$name$_ = $name$;\n" - " }\n" - " // @@protoc_insertion_point(field_unsafe_arena_set_allocated:" - "$full_name$)\n" "}\n"); } else { printer->Print(variables, "$tmpl$" - "$inline$" - "$type$* $dependent_classname$::mutable_$name$() {\n" + "inline $type$* $dependent_classname$::mutable_$name$() {\n" " if (!$this_message$has_$name$()) {\n" " $this_message$clear_$oneof_name$();\n" " $this_message$set_has_$name$();\n" @@ -808,56 +788,20 @@ void MessageOneofFieldGenerator::InternalGenerateInlineAccessorDefinitions( " }\n" " // @@protoc_insertion_point(field_mutable:$full_name$)\n" " return $field_member$;\n" - "}\n" - "$tmpl$" - "$inline$" - "$type$* $dependent_classname$::$release_name$() {\n" - " // @@protoc_insertion_point(field_release:$full_name$)\n" - " if ($this_message$has_$name$()) {\n" - " $this_message$clear_has_$oneof_name$();\n" - " $dependent_typename$* temp = $field_member$;\n" - " $field_member$ = NULL;\n" - " return temp;\n" - " } else {\n" - " return NULL;\n" - " }\n" - "}\n" - "$tmpl$" - "$inline$" - "void $dependent_classname$::" - "set_allocated_$name$($type$* $name$) {\n" - " $this_message$clear_$oneof_name$();\n" - " if ($name$) {\n"); - if (SupportsArenas(descriptor_->message_type())) { - printer->Print(variables, - " if (static_cast< $dependent_typename$*>($name$)->" - "GetArena() != NULL) {\n" - " $dependent_typename$* new_$name$ = new $dependent_typename$;\n" - " new_$name$->CopyFrom(*$name$);\n" - " $name$ = new_$name$;\n" - " }\n"); - } - printer->Print(variables, - " $this_message$set_has_$name$();\n" - " $field_member$ = $name$;\n" - " }\n" - " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" "}\n"); } } void MessageOneofFieldGenerator:: GenerateClearingCode(io::Printer* printer) const { - std::map<string, string> variables(variables_); - variables["this_message"] = dependent_field_ ? DependentBaseDownCast() : ""; if (SupportsArenas(descriptor_)) { - printer->Print(variables, - "if ($this_message$GetArenaNoVirtual() == NULL) {\n" - " delete $this_message$$oneof_prefix$$name$_;\n" + printer->Print(variables_, + "if (GetArenaNoVirtual() == NULL) {\n" + " delete $oneof_prefix$$name$_;\n" "}\n"); } else { - printer->Print(variables, - "delete $this_message$$oneof_prefix$$name$_;\n"); + printer->Print(variables_, + "delete $oneof_prefix$$name$_;\n"); } } @@ -1008,48 +952,39 @@ GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const { } void RepeatedMessageFieldGenerator:: -GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const { - std::map<string, string> variables(variables_); - variables["inline"] = is_inline ? "inline " : ""; - +GenerateInlineAccessorDefinitions(io::Printer* printer) const { if (!dependent_getter_) { - printer->Print(variables, - "$inline$" - "const $type$& $classname$::$name$(int index) const {\n" + printer->Print(variables_, + "inline const $type$& $classname$::$name$(int index) const {\n" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return $name$_.$cppget$(index);\n" "}\n"); } if (!dependent_field_) { - printer->Print(variables, - "$inline$" - "$type$* $classname$::mutable_$name$(int index) {\n" + printer->Print(variables_, + "inline $type$* $classname$::mutable_$name$(int index) {\n" // TODO(dlj): move insertion points " // @@protoc_insertion_point(field_mutable:$full_name$)\n" " return $name$_.Mutable(index);\n" "}\n" - "$inline$" - "$type$* $classname$::add_$name$() {\n" + "inline $type$* $classname$::add_$name$() {\n" " // @@protoc_insertion_point(field_add:$full_name$)\n" " return $name$_.Add();\n" "}\n"); } if (!dependent_field_) { - printer->Print(variables, - "$inline$" - "::google::protobuf::RepeatedPtrField< $type$ >*\n" + printer->Print(variables_, + "inline ::google::protobuf::RepeatedPtrField< $type$ >*\n" "$classname$::mutable_$name$() {\n" " // @@protoc_insertion_point(field_mutable_list:$full_name$)\n" " return &$name$_;\n" "}\n"); } if (!dependent_getter_) { - printer->Print(variables, - "$inline$" - "const ::google::protobuf::RepeatedPtrField< $type$ >&\n" + printer->Print(variables_, + "inline const ::google::protobuf::RepeatedPtrField< $type$ >&\n" "$classname$::$name$() const {\n" " // @@protoc_insertion_point(field_list:$full_name$)\n" " return $name$_;\n" @@ -1059,9 +994,7 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, void RepeatedMessageFieldGenerator:: GenerateClearingCode(io::Printer* printer) const { - std::map<string, string> variables(variables_); - variables["this_message"] = dependent_field_ ? DependentBaseDownCast() : ""; - printer->Print(variables, "$this_message$$name$_.Clear();\n"); + printer->Print(variables_, "$name$_.Clear();\n"); } void RepeatedMessageFieldGenerator:: @@ -1084,13 +1017,11 @@ GenerateMergeFromCodedStream(io::Printer* printer) const { if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE) { printer->Print(variables_, "DO_(::google::protobuf::internal::WireFormatLite::" - "ReadMessageNoVirtual(\n" - " input, add_$name$()));\n"); + "ReadMessage(input, add_$name$()));\n"); } else { printer->Print(variables_, "DO_(::google::protobuf::internal::WireFormatLite::" - "ReadGroupNoVirtual(\n" - " $number$, input, add_$name$()));\n"); + "ReadGroup($number$, input, add_$name$()));\n"); } } @@ -1110,7 +1041,7 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { "for (unsigned int i = 0,\n" " n = static_cast<unsigned int>(this->$name$_size()); i < n; i++) {\n" " target = ::google::protobuf::internal::WireFormatLite::\n" - " InternalWrite$declared_type$NoVirtualToArray(\n" + " InternalWrite$declared_type$ToArray(\n" " $number$, this->$name$(static_cast<int>(i)), deterministic, target);\n" "}\n"); } @@ -1125,7 +1056,7 @@ GenerateByteSize(io::Printer* printer) const { "total_size += $tag_size$UL * count;\n" "for (unsigned int i = 0; i < count; i++) {\n" " total_size +=\n" - " ::google::protobuf::internal::WireFormatLite::$declared_type$SizeNoVirtual(\n" + " ::google::protobuf::internal::WireFormatLite::$declared_type$Size(\n" " this->$name$(static_cast<int>(i)));\n" "}\n"); printer->Outdent(); diff --git a/src/google/protobuf/compiler/cpp/cpp_message_field.h b/src/google/protobuf/compiler/cpp/cpp_message_field.h index cd9737f0..3be505e3 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message_field.h +++ b/src/google/protobuf/compiler/cpp/cpp_message_field.h @@ -44,6 +44,8 @@ namespace protobuf { namespace compiler { namespace cpp { +bool IsImplicitWeakField(const FieldDescriptor* field, const Options& options); + class MessageFieldGenerator : public FieldGenerator { public: MessageFieldGenerator(const FieldDescriptor* descriptor, @@ -55,8 +57,7 @@ class MessageFieldGenerator : public FieldGenerator { void GenerateDependentAccessorDeclarations(io::Printer* printer) const; void GenerateAccessorDeclarations(io::Printer* printer) const; void GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const; void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const; void GenerateClearingCode(io::Printer* printer) const; void GenerateMessageClearingCode(io::Printer* printer) const; @@ -71,13 +72,9 @@ class MessageFieldGenerator : public FieldGenerator { void GenerateByteSize(io::Printer* printer) const; protected: - void GenerateArenaManipulationCode(const std::map<string, string>& variables, - io::Printer* printer) const; - - virtual void GenerateGetterDeclaration(io::Printer* printer) const; - const FieldDescriptor* descriptor_; const bool dependent_field_; + const bool implicit_weak_field_; std::map<string, string> variables_; private: @@ -91,11 +88,9 @@ class MessageOneofFieldGenerator : public MessageFieldGenerator { ~MessageOneofFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GenerateDependentAccessorDeclarations(io::Printer* printer) const; void GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const; - void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const { } + void GenerateInlineAccessorDefinitions(io::Printer* printer) const; + void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const; void GenerateClearingCode(io::Printer* printer) const; // MessageFieldGenerator, from which we inherit, overrides this so we need to @@ -105,9 +100,6 @@ class MessageOneofFieldGenerator : public MessageFieldGenerator { void GenerateDestructorCode(io::Printer* printer) const; void GenerateConstructorCode(io::Printer* printer) const; - protected: - void GenerateGetterDeclaration(io::Printer* printer) const; - private: void InternalGenerateInlineAccessorDefinitions( const std::map<string, string>& variables, io::Printer* printer) const; @@ -127,8 +119,7 @@ class RepeatedMessageFieldGenerator : public FieldGenerator { void GenerateDependentAccessorDeclarations(io::Printer* printer) const; void GenerateAccessorDeclarations(io::Printer* printer) const; void GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const; void GenerateClearingCode(io::Printer* printer) const; void GenerateMergingCode(io::Printer* printer) const; void GenerateSwappingCode(io::Printer* printer) const; diff --git a/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h b/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h new file mode 100644 index 00000000..d502a6f0 --- /dev/null +++ b/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h @@ -0,0 +1,61 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: seongkim@google.com (Seong Beom Kim) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_LAYOUT_HELPER_H__ +#define GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_LAYOUT_HELPER_H__ + +#include <google/protobuf/compiler/cpp/cpp_options.h> +#include <google/protobuf/descriptor.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +// Provides an abstract interface to optimize message layout +// by rearranging the fields of a message. +class MessageLayoutHelper { + public: + virtual ~MessageLayoutHelper() {} + + virtual void OptimizeLayout(std::vector<const FieldDescriptor*>* fields, + const Options& options) = 0; +}; + +} // namespace cpp +} // namespace compiler +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_LAYOUT_HELPER_H__ diff --git a/src/google/protobuf/compiler/cpp/cpp_options.h b/src/google/protobuf/compiler/cpp/cpp_options.h index 04338083..4a29ad0e 100644 --- a/src/google/protobuf/compiler/cpp/cpp_options.h +++ b/src/google/protobuf/compiler/cpp/cpp_options.h @@ -39,6 +39,8 @@ namespace google { namespace protobuf { namespace compiler { +class AccessInfoMap; + namespace cpp { // Generator options (see generator.cc for a description of each): @@ -50,7 +52,9 @@ struct Options { annotate_headers(false), enforce_lite(false), table_driven_parsing(false), - table_driven_serialization(false) {} + table_driven_serialization(false), + lite_implicit_weak_fields(false), + access_info_map(NULL) {} string dllexport_decl; bool safe_boundary_check; @@ -60,8 +64,10 @@ struct Options { bool enforce_lite; bool table_driven_parsing; bool table_driven_serialization; + bool lite_implicit_weak_fields; string annotation_pragma_name; string annotation_guard_name; + const AccessInfoMap* access_info_map; }; } // namespace cpp diff --git a/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc b/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc new file mode 100644 index 00000000..e9303865 --- /dev/null +++ b/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc @@ -0,0 +1,220 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include <google/protobuf/compiler/cpp/cpp_padding_optimizer.h> + +#include <google/protobuf/compiler/cpp/cpp_helpers.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +namespace { + +// FieldGroup is just a helper for PaddingOptimizer below. It holds a vector of +// fields that are grouped together because they have compatible alignment, and +// a preferred location in the final field ordering. +class FieldGroup { + public: + FieldGroup() : preferred_location_(0) {} + + // A group with a single field. + FieldGroup(float preferred_location, const FieldDescriptor* field) + : preferred_location_(preferred_location), fields_(1, field) {} + + // Append the fields in 'other' to this group. + void Append(const FieldGroup& other) { + if (other.fields_.empty()) { + return; + } + // Preferred location is the average among all the fields, so we weight by + // the number of fields on each FieldGroup object. + preferred_location_ = (preferred_location_ * fields_.size() + + (other.preferred_location_ * other.fields_.size())) / + (fields_.size() + other.fields_.size()); + fields_.insert(fields_.end(), other.fields_.begin(), other.fields_.end()); + } + + void SetPreferredLocation(float location) { preferred_location_ = location; } + const std::vector<const FieldDescriptor*>& fields() const { return fields_; } + + // FieldGroup objects sort by their preferred location. + bool operator<(const FieldGroup& other) const { + return preferred_location_ < other.preferred_location_; + } + + private: + // "preferred_location_" is an estimate of where this group should go in the + // final list of fields. We compute this by taking the average index of each + // field in this group in the original ordering of fields. This is very + // approximate, but should put this group close to where its member fields + // originally went. + float preferred_location_; + std::vector<const FieldDescriptor*> fields_; + // We rely on the default copy constructor and operator= so this type can be + // used in a vector. +}; + +} // namespace + +// Reorder 'fields' so that if the fields are output into a c++ class in the new +// order, fields of similar family (see below) are together and within each +// family, alignment padding is minimized. +// +// We try to do this while keeping each field as close as possible to its field +// number order so that we don't reduce cache locality much for function that +// access each field in order. Originally, OptimizePadding used declaration +// order for its decisions, but generated code minus the serializer/parsers uses +// the output of OptimizePadding as well (stored in +// MessageGenerator::optimized_order_). Since the serializers use field number +// order, we use that as a tie-breaker. +// +// We classify each field into a particular "family" of fields, that we perform +// the same operation on in our generated functions. +// +// REPEATED is placed first, as the C++ compiler automatically initializes +// these fields in layout order. +// +// STRING is grouped next, as our Clear/SharedCtor/SharedDtor walks it and +// calls ArenaStringPtr::Destroy on each. +// +// +// MESSAGE is grouped next, as our Clear/SharedDtor code walks it and calls +// delete on each. We initialize these fields with a NULL pointer (see +// MessageFieldGenerator::GenerateConstructorCode), which allows them to be +// memset. +// +// ZERO_INITIALIZABLE is memset in Clear/SharedCtor +// +// OTHER these fields are initialized one-by-one. +void PaddingOptimizer::OptimizeLayout( + std::vector<const FieldDescriptor*>* fields, const Options& options) { + // The sorted numeric order of Family determines the declaration order in the + // memory layout. + enum Family { + REPEATED = 0, + STRING = 1, + MESSAGE = 3, + ZERO_INITIALIZABLE = 4, + OTHER = 5, + kMaxFamily + }; + + // First divide fields into those that align to 1 byte, 4 bytes or 8 bytes. + std::vector<FieldGroup> aligned_to_1[kMaxFamily]; + std::vector<FieldGroup> aligned_to_4[kMaxFamily]; + std::vector<FieldGroup> aligned_to_8[kMaxFamily]; + for (int i = 0; i < fields->size(); ++i) { + const FieldDescriptor* field = (*fields)[i]; + + Family f = OTHER; + if (field->is_repeated()) { + f = REPEATED; + } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_STRING) { + f = STRING; + } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + f = MESSAGE; + + } else if (CanInitializeByZeroing(field)) { + f = ZERO_INITIALIZABLE; + } + + const int j = field->number(); + switch (EstimateAlignmentSize(field)) { + case 1: + aligned_to_1[f].push_back(FieldGroup(j, field)); + break; + case 4: + aligned_to_4[f].push_back(FieldGroup(j, field)); + break; + case 8: + aligned_to_8[f].push_back(FieldGroup(j, field)); + break; + default: + GOOGLE_LOG(FATAL) << "Unknown alignment size " << EstimateAlignmentSize(field) + << "for a field " << field->full_name() << "."; + } + } + + // For each family, group fields to optimize padding. + for (int f = 0; f < kMaxFamily; f++) { + // Now group fields aligned to 1 byte into sets of 4, and treat those like a + // single field aligned to 4 bytes. + for (int i = 0; i < aligned_to_1[f].size(); i += 4) { + FieldGroup field_group; + for (int j = i; j < aligned_to_1[f].size() && j < i + 4; ++j) { + field_group.Append(aligned_to_1[f][j]); + } + aligned_to_4[f].push_back(field_group); + } + // Sort by preferred location to keep fields as close to their field number + // order as possible. Using stable_sort ensures that the output is + // consistent across runs. + std::stable_sort(aligned_to_4[f].begin(), aligned_to_4[f].end()); + + // Now group fields aligned to 4 bytes (or the 4-field groups created above) + // into pairs, and treat those like a single field aligned to 8 bytes. + for (int i = 0; i < aligned_to_4[f].size(); i += 2) { + FieldGroup field_group; + for (int j = i; j < aligned_to_4[f].size() && j < i + 2; ++j) { + field_group.Append(aligned_to_4[f][j]); + } + if (i == aligned_to_4[f].size() - 1) { + if (f == OTHER) { + // Move incomplete 4-byte block to the beginning. This is done to + // pair with the (possible) leftover blocks from the + // ZERO_INITIALIZABLE family. + field_group.SetPreferredLocation(-1); + } else { + // Move incomplete 4-byte block to the end. + field_group.SetPreferredLocation(fields->size() + 1); + } + } + aligned_to_8[f].push_back(field_group); + } + // Sort by preferred location. + std::stable_sort(aligned_to_8[f].begin(), aligned_to_8[f].end()); + } + + // Now pull out all the FieldDescriptors in order. + fields->clear(); + for (int f = 0; f < kMaxFamily; ++f) { + for (int i = 0; i < aligned_to_8[f].size(); ++i) { + fields->insert(fields->end(), aligned_to_8[f][i].fields().begin(), + aligned_to_8[f][i].fields().end()); + } + } +} + +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h b/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h new file mode 100644 index 00000000..9641ba40 --- /dev/null +++ b/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h @@ -0,0 +1,64 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: seongkim@google.com (Seong Beom Kim) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_PADDING_OPTIMIZER_H__ +#define GOOGLE_PROTOBUF_COMPILER_CPP_PADDING_OPTIMIZER_H__ + +#include <google/protobuf/compiler/cpp/cpp_message_layout_helper.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +// Rearranges the fields of a message to minimize padding. +// Fields are grouped by the type and the size. +// For example, grouping four boolean fields and one int32 +// field results in zero padding overhead. See OptimizeLayout's +// comment for details. +class PaddingOptimizer : public MessageLayoutHelper { + public: + PaddingOptimizer() {} + ~PaddingOptimizer() {} + + void OptimizeLayout(std::vector<const FieldDescriptor*>* fields, + const Options& options); +}; + +} // namespace cpp +} // namespace compiler +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_COMPILER_CPP_PADDING_OPTIMIZER_H__ diff --git a/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc b/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc index 34a41d82..ceb2270e 100644 --- a/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc +++ b/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc @@ -132,7 +132,7 @@ class TestGenerator : public CodeGenerator { // Check field accessors for a message inside oneof{}: TryInsert("test.pb.h", "field_get:foo.Bar.oneOfMessage", context); TryInsert("test.pb.h", "field_mutable:foo.Bar.oneOfMessage", context); - TryInsert("test.pb.h", "field_set_allocated:foo.Bar.oneOfMessage", context); + TryInsert("test.pb.cc", "field_set_allocated:foo.Bar.oneOfMessage", context); // Check field accessors for an optional enum: TryInsert("test.pb.h", "field_get:foo.Bar.optEnum", context); diff --git a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc index b05fcc4e..bc2d02ea 100644 --- a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc @@ -123,15 +123,13 @@ GenerateAccessorDeclarations(io::Printer* printer) const { } void PrimitiveFieldGenerator:: -GenerateInlineAccessorDefinitions(io::Printer* printer, bool is_inline) const { - std::map<string, string> variables(variables_); - variables["inline"] = is_inline ? "inline " : ""; - printer->Print(variables, - "$inline$$type$ $classname$::$name$() const {\n" +GenerateInlineAccessorDefinitions(io::Printer* printer) const { + printer->Print(variables_, + "inline $type$ $classname$::$name$() const {\n" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return $name$_;\n" "}\n" - "$inline$void $classname$::set_$name$($type$ value) {\n" + "inline void $classname$::set_$name$($type$ value) {\n" " $set_hasbit$\n" " $name$_ = value;\n" " // @@protoc_insertion_point(field_set:$full_name$)\n" @@ -212,18 +210,16 @@ PrimitiveOneofFieldGenerator(const FieldDescriptor* descriptor, PrimitiveOneofFieldGenerator::~PrimitiveOneofFieldGenerator() {} void PrimitiveOneofFieldGenerator:: -GenerateInlineAccessorDefinitions(io::Printer* printer, bool is_inline) const { - std::map<string, string> variables(variables_); - variables["inline"] = is_inline ? "inline " : ""; - printer->Print(variables, - "$inline$$type$ $classname$::$name$() const {\n" +GenerateInlineAccessorDefinitions(io::Printer* printer) const { + printer->Print(variables_, + "inline $type$ $classname$::$name$() const {\n" " // @@protoc_insertion_point(field_get:$full_name$)\n" " if (has_$name$()) {\n" " return $oneof_prefix$$name$_;\n" " }\n" " return $default$;\n" "}\n" - "$inline$void $classname$::set_$name$($type$ value) {\n" + "inline void $classname$::set_$name$($type$ value) {\n" " if (!has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" @@ -245,9 +241,8 @@ GenerateSwappingCode(io::Printer* printer) const { void PrimitiveOneofFieldGenerator:: GenerateConstructorCode(io::Printer* printer) const { - printer->Print( - variables_, - "_$classname$_default_instance_.$name$_ = $default$;\n"); + printer->Print(variables_, + "$ns$::_$classname$_default_instance_.$name$_ = $default$;\n"); } void PrimitiveOneofFieldGenerator:: @@ -312,28 +307,26 @@ GenerateAccessorDeclarations(io::Printer* printer) const { } void RepeatedPrimitiveFieldGenerator:: -GenerateInlineAccessorDefinitions(io::Printer* printer, bool is_inline) const { - std::map<string, string> variables(variables_); - variables["inline"] = is_inline ? "inline " : ""; - printer->Print(variables, - "$inline$$type$ $classname$::$name$(int index) const {\n" +GenerateInlineAccessorDefinitions(io::Printer* printer) const { + printer->Print(variables_, + "inline $type$ $classname$::$name$(int index) const {\n" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return $name$_.Get(index);\n" "}\n" - "$inline$void $classname$::set_$name$(int index, $type$ value) {\n" + "inline void $classname$::set_$name$(int index, $type$ value) {\n" " $name$_.Set(index, value);\n" " // @@protoc_insertion_point(field_set:$full_name$)\n" "}\n" - "$inline$void $classname$::add_$name$($type$ value) {\n" + "inline void $classname$::add_$name$($type$ value) {\n" " $name$_.Add(value);\n" " // @@protoc_insertion_point(field_add:$full_name$)\n" "}\n" - "$inline$const ::google::protobuf::RepeatedField< $type$ >&\n" + "inline const ::google::protobuf::RepeatedField< $type$ >&\n" "$classname$::$name$() const {\n" " // @@protoc_insertion_point(field_list:$full_name$)\n" " return $name$_;\n" "}\n" - "$inline$::google::protobuf::RepeatedField< $type$ >*\n" + "inline ::google::protobuf::RepeatedField< $type$ >*\n" "$classname$::mutable_$name$() {\n" " // @@protoc_insertion_point(field_mutable_list:$full_name$)\n" " return &$name$_;\n" @@ -433,7 +426,7 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { " ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n" " target);\n" " target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(\n" - " static_cast< ::google::protobuf::uint32>(\n" + " static_cast< ::google::protobuf::int32>(\n" " _$name$_cached_byte_size_), target);\n" " target = ::google::protobuf::internal::WireFormatLite::\n" " Write$declared_type$NoTagToArray(this->$name$_, target);\n" diff --git a/src/google/protobuf/compiler/cpp/cpp_primitive_field.h b/src/google/protobuf/compiler/cpp/cpp_primitive_field.h index 44c9ff3e..d52228e9 100644 --- a/src/google/protobuf/compiler/cpp/cpp_primitive_field.h +++ b/src/google/protobuf/compiler/cpp/cpp_primitive_field.h @@ -53,8 +53,7 @@ class PrimitiveFieldGenerator : public FieldGenerator { // implements FieldGenerator --------------------------------------- void GeneratePrivateMembers(io::Printer* printer) const; void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const; void GenerateClearingCode(io::Printer* printer) const; void GenerateMergingCode(io::Printer* printer) const; void GenerateSwappingCode(io::Printer* printer) const; @@ -80,8 +79,7 @@ class PrimitiveOneofFieldGenerator : public PrimitiveFieldGenerator { ~PrimitiveOneofFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const; void GenerateClearingCode(io::Printer* printer) const; void GenerateSwappingCode(io::Printer* printer) const; void GenerateConstructorCode(io::Printer* printer) const; @@ -100,8 +98,7 @@ class RepeatedPrimitiveFieldGenerator : public FieldGenerator { // implements FieldGenerator --------------------------------------- void GeneratePrivateMembers(io::Printer* printer) const; void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const; void GenerateClearingCode(io::Printer* printer) const; void GenerateMergingCode(io::Printer* printer) const; void GenerateSwappingCode(io::Printer* printer) const; diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/src/google/protobuf/compiler/cpp/cpp_string_field.cc index fec13b6d..264f6124 100644 --- a/src/google/protobuf/compiler/cpp/cpp_string_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_string_field.cc @@ -58,8 +58,8 @@ void SetStringVariables(const FieldDescriptor* descriptor, (*variables)["default_variable"] = descriptor->default_value_string().empty() ? "&::google::protobuf::internal::GetEmptyStringAlreadyInited()" - : "&" + (*variables)["classname"] + "::" + default_variable_string + - ".get()"; + : "&" + Namespace(descriptor) + "::" + (*variables)["classname"] + + "::" + default_variable_string + ".get()"; (*variables)["pointer_type"] = descriptor->type() == FieldDescriptor::TYPE_BYTES ? "void" : "char"; (*variables)["null_check"] = "GOOGLE_DCHECK(value != NULL);\n"; @@ -71,6 +71,9 @@ void SetStringVariables(const FieldDescriptor* descriptor, (*variables)["full_name"] = descriptor->full_name(); (*variables)["string_piece"] = "::std::string"; + + (*variables)["lite"] = + HasDescriptorMethods(descriptor->file(), options) ? "" : "Lite"; } } // namespace @@ -79,7 +82,8 @@ void SetStringVariables(const FieldDescriptor* descriptor, StringFieldGenerator::StringFieldGenerator(const FieldDescriptor* descriptor, const Options& options) - : FieldGenerator(options), descriptor_(descriptor) { + : FieldGenerator(options), descriptor_(descriptor), + lite_(!HasDescriptorMethods(descriptor->file(), options)) { SetStringVariables(descriptor, &variables_, options); } @@ -176,16 +180,21 @@ GenerateAccessorDeclarations(io::Printer* printer) const { if (SupportsArenas(descriptor_)) { printer->Print( variables_, - "$deprecated_attr$::std::string* ${$unsafe_arena_release_$name$$}$();\n"); + "PROTOBUF_RUNTIME_DEPRECATED(\"The unsafe_arena_ accessors for\"\n" + "\" string fields are deprecated and will be removed in a\"\n" + "\" future release.\")\n" + "::std::string* ${$unsafe_arena_release_$name$$}$();\n"); printer->Annotate("{", "}", descriptor_); printer->Print( variables_, - "$deprecated_attr$void ${$unsafe_arena_set_allocated_$name$$}$(\n" + "PROTOBUF_RUNTIME_DEPRECATED(\"The unsafe_arena_ accessors for\"\n" + "\" string fields are deprecated and will be removed in a\"\n" + "\" future release.\")\n" + "void ${$unsafe_arena_set_allocated_$name$$}$(\n" " ::std::string* $name$);\n"); printer->Annotate("{", "}", descriptor_); } - if (unknown_ctype) { printer->Outdent(); printer->Print(" public:\n"); @@ -194,65 +203,54 @@ GenerateAccessorDeclarations(io::Printer* printer) const { } void StringFieldGenerator:: -GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const { - std::map<string, string> variables(variables_); - variables["inline"] = is_inline ? "inline " : ""; +GenerateInlineAccessorDefinitions(io::Printer* printer) const { if (SupportsArenas(descriptor_)) { printer->Print( - variables, - "$inline$const ::std::string& $classname$::$name$() const {\n" + variables_, + "inline const ::std::string& $classname$::$name$() const {\n" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return $name$_.Get();\n" "}\n" - "$inline$void $classname$::set_$name$(const ::std::string& value) {\n" + "inline void $classname$::set_$name$(const ::std::string& value) {\n" " $set_hasbit$\n" - " $name$_.Set($default_variable$, value, GetArenaNoVirtual());\n" + " $name$_.Set$lite$($default_variable$, value, GetArenaNoVirtual());\n" " // @@protoc_insertion_point(field_set:$full_name$)\n" "}\n" "#if LANG_CXX11\n" - "$inline$void $classname$::set_$name$(::std::string&& value) {\n" + "inline void $classname$::set_$name$(::std::string&& value) {\n" " $set_hasbit$\n" - " $name$_.Set(\n" + " $name$_.Set$lite$(\n" " $default_variable$, ::std::move(value), GetArenaNoVirtual());\n" " // @@protoc_insertion_point(field_set_rvalue:$full_name$)\n" "}\n" "#endif\n" - "$inline$void $classname$::set_$name$(const char* value) {\n" + "inline void $classname$::set_$name$(const char* value) {\n" " $null_check$" " $set_hasbit$\n" - " $name$_.Set($default_variable$, $string_piece$(value),\n" + " $name$_.Set$lite$($default_variable$, $string_piece$(value),\n" " GetArenaNoVirtual());\n" " // @@protoc_insertion_point(field_set_char:$full_name$)\n" "}\n" - "$inline$" + "inline " "void $classname$::set_$name$(const $pointer_type$* value,\n" " size_t size) {\n" " $set_hasbit$\n" - " $name$_.Set($default_variable$, $string_piece$(\n" + " $name$_.Set$lite$($default_variable$, $string_piece$(\n" " reinterpret_cast<const char*>(value), size), " "GetArenaNoVirtual());\n" " // @@protoc_insertion_point(field_set_pointer:$full_name$)\n" "}\n" - "$inline$::std::string* $classname$::mutable_$name$() {\n" + "inline ::std::string* $classname$::mutable_$name$() {\n" " $set_hasbit$\n" " // @@protoc_insertion_point(field_mutable:$full_name$)\n" " return $name$_.Mutable($default_variable$, GetArenaNoVirtual());\n" "}\n" - "$inline$::std::string* $classname$::$release_name$() {\n" + "inline ::std::string* $classname$::$release_name$() {\n" " // @@protoc_insertion_point(field_release:$full_name$)\n" " $clear_hasbit$\n" " return $name$_.Release($default_variable$, GetArenaNoVirtual());\n" "}\n" - "$inline$::std::string* $classname$::unsafe_arena_release_$name$() {\n" - " // " - "@@protoc_insertion_point(field_unsafe_arena_release:$full_name$)\n" - " GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);\n" - " $clear_hasbit$\n" - " return $name$_.UnsafeArenaRelease($default_variable$,\n" - " GetArenaNoVirtual());\n" - "}\n" - "$inline$void $classname$::set_allocated_$name$(::std::string* $name$) {\n" + "inline void $classname$::set_allocated_$name$(::std::string* $name$) {\n" " if ($name$ != NULL) {\n" " $set_hasbit$\n" " } else {\n" @@ -262,7 +260,15 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, " GetArenaNoVirtual());\n" " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" "}\n" - "$inline$void $classname$::unsafe_arena_set_allocated_$name$(\n" + "inline ::std::string* $classname$::unsafe_arena_release_$name$() {\n" + " // " + "@@protoc_insertion_point(field_unsafe_arena_release:$full_name$)\n" + " GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);\n" + " $clear_hasbit$\n" + " return $name$_.UnsafeArenaRelease($default_variable$,\n" + " GetArenaNoVirtual());\n" + "}\n" + "inline void $classname$::unsafe_arena_set_allocated_$name$(\n" " ::std::string* $name$) {\n" " GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);\n" " if ($name$ != NULL) {\n" @@ -278,31 +284,31 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, } else { // No-arena case. printer->Print( - variables, - "$inline$const ::std::string& $classname$::$name$() const {\n" + variables_, + "inline const ::std::string& $classname$::$name$() const {\n" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return $name$_.GetNoArena();\n" "}\n" - "$inline$void $classname$::set_$name$(const ::std::string& value) {\n" + "inline void $classname$::set_$name$(const ::std::string& value) {\n" " $set_hasbit$\n" " $name$_.SetNoArena($default_variable$, value);\n" " // @@protoc_insertion_point(field_set:$full_name$)\n" "}\n" "#if LANG_CXX11\n" - "$inline$void $classname$::set_$name$(::std::string&& value) {\n" + "inline void $classname$::set_$name$(::std::string&& value) {\n" " $set_hasbit$\n" " $name$_.SetNoArena(\n" " $default_variable$, ::std::move(value));\n" " // @@protoc_insertion_point(field_set_rvalue:$full_name$)\n" "}\n" "#endif\n" - "$inline$void $classname$::set_$name$(const char* value) {\n" + "inline void $classname$::set_$name$(const char* value) {\n" " $null_check$" " $set_hasbit$\n" " $name$_.SetNoArena($default_variable$, $string_piece$(value));\n" " // @@protoc_insertion_point(field_set_char:$full_name$)\n" "}\n" - "$inline$" + "inline " "void $classname$::set_$name$(const $pointer_type$* value, " "size_t size) {\n" " $set_hasbit$\n" @@ -310,17 +316,17 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, " $string_piece$(reinterpret_cast<const char*>(value), size));\n" " // @@protoc_insertion_point(field_set_pointer:$full_name$)\n" "}\n" - "$inline$::std::string* $classname$::mutable_$name$() {\n" + "inline ::std::string* $classname$::mutable_$name$() {\n" " $set_hasbit$\n" " // @@protoc_insertion_point(field_mutable:$full_name$)\n" " return $name$_.MutableNoArena($default_variable$);\n" "}\n" - "$inline$::std::string* $classname$::$release_name$() {\n" + "inline ::std::string* $classname$::$release_name$() {\n" " // @@protoc_insertion_point(field_release:$full_name$)\n" " $clear_hasbit$\n" " return $name$_.ReleaseNoArena($default_variable$);\n" "}\n" - "$inline$void $classname$::set_allocated_$name$(::std::string* $name$) {\n" + "inline void $classname$::set_allocated_$name$(::std::string* $name$) {\n" " if ($name$ != NULL) {\n" " $set_hasbit$\n" " } else {\n" @@ -453,7 +459,7 @@ GenerateCopyConstructorCode(io::Printer* printer) const { if (SupportsArenas(descriptor_) || descriptor_->containing_oneof() != NULL) { // TODO(gpike): improve this printer->Print(variables_, - "$name$_.Set($default_variable$, from.$name$(),\n" + "$name$_.Set$lite$($default_variable$, from.$name$(),\n" " GetArenaNoVirtual());\n"); } else { printer->Print(variables_, @@ -466,27 +472,21 @@ GenerateCopyConstructorCode(io::Printer* printer) const { void StringFieldGenerator:: GenerateDestructorCode(io::Printer* printer) const { - if (SupportsArenas(descriptor_)) { - // The variable |arena| is defined by the enclosing code. - // See MessageGenerator::GenerateSharedDestructorCode. - printer->Print(variables_, - "$name$_.Destroy($default_variable$, arena);\n"); - } else { - printer->Print(variables_, - "$name$_.DestroyNoArena($default_variable$);\n"); - } + printer->Print(variables_, + "$name$_.DestroyNoArena($default_variable$);\n"); } void StringFieldGenerator:: GenerateDefaultInstanceAllocator(io::Printer* printer) const { if (!descriptor_->default_value_string().empty()) { - printer->Print(variables_, - "$classname$::$default_variable_name$.DefaultConstruct();\n" - "*$classname$::$default_variable_name$.get_mutable() = " - "::std::string($default$, $default_length$);\n" - "::google::protobuf::internal::OnShutdownDestroyString(\n" - " $classname$::$default_variable_name$.get_mutable());\n" - ); + printer->Print( + variables_, + "$ns$::$classname$::$default_variable_name$.DefaultConstruct();\n" + "*$ns$::$classname$::$default_variable_name$.get_mutable() = " + "::std::string($default$, $default_length$);\n" + "::google::protobuf::internal::OnShutdownDestroyString(\n" + " $ns$::$classname$::$default_variable_name$.get_mutable());\n" + ); } } @@ -552,55 +552,52 @@ StringOneofFieldGenerator(const FieldDescriptor* descriptor, StringOneofFieldGenerator::~StringOneofFieldGenerator() {} void StringOneofFieldGenerator:: -GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const { - std::map<string, string> variables(variables_); - variables["inline"] = is_inline ? "inline " : ""; +GenerateInlineAccessorDefinitions(io::Printer* printer) const { if (SupportsArenas(descriptor_)) { printer->Print( - variables, - "$inline$const ::std::string& $classname$::$name$() const {\n" + variables_, + "inline const ::std::string& $classname$::$name$() const {\n" " // @@protoc_insertion_point(field_get:$full_name$)\n" " if (has_$name$()) {\n" " return $oneof_prefix$$name$_.Get();\n" " }\n" " return *$default_variable$;\n" "}\n" - "$inline$void $classname$::set_$name$(const ::std::string& value) {\n" + "inline void $classname$::set_$name$(const ::std::string& value) {\n" " if (!has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n" " }\n" - " $oneof_prefix$$name$_.Set($default_variable$, value,\n" + " $oneof_prefix$$name$_.Set$lite$($default_variable$, value,\n" " GetArenaNoVirtual());\n" " // @@protoc_insertion_point(field_set:$full_name$)\n" "}\n" "#if LANG_CXX11\n" - "$inline$void $classname$::set_$name$(::std::string&& value) {\n" + "inline void $classname$::set_$name$(::std::string&& value) {\n" " // @@protoc_insertion_point(field_set:$full_name$)\n" " if (!has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n" " }\n" - " $oneof_prefix$$name$_.Set(\n" + " $oneof_prefix$$name$_.Set$lite$(\n" " $default_variable$, ::std::move(value), GetArenaNoVirtual());\n" " // @@protoc_insertion_point(field_set_rvalue:$full_name$)\n" "}\n" "#endif\n" - "$inline$void $classname$::set_$name$(const char* value) {\n" + "inline void $classname$::set_$name$(const char* value) {\n" " $null_check$" " if (!has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n" " }\n" - " $oneof_prefix$$name$_.Set($default_variable$,\n" + " $oneof_prefix$$name$_.Set$lite$($default_variable$,\n" " $string_piece$(value), GetArenaNoVirtual());\n" " // @@protoc_insertion_point(field_set_char:$full_name$)\n" "}\n" - "$inline$" + "inline " "void $classname$::set_$name$(const $pointer_type$* value,\n" " size_t size) {\n" " if (!has_$name$()) {\n" @@ -608,12 +605,13 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, " set_has_$name$();\n" " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n" " }\n" - " $oneof_prefix$$name$_.Set($default_variable$, $string_piece$(\n" + " $oneof_prefix$$name$_.Set$lite$(\n" + " $default_variable$, $string_piece$(\n" " reinterpret_cast<const char*>(value), size),\n" " GetArenaNoVirtual());\n" " // @@protoc_insertion_point(field_set_pointer:$full_name$)\n" "}\n" - "$inline$::std::string* $classname$::mutable_$name$() {\n" + "inline ::std::string* $classname$::mutable_$name$() {\n" " if (!has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" @@ -623,7 +621,7 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, " GetArenaNoVirtual());\n" " // @@protoc_insertion_point(field_mutable:$full_name$)\n" "}\n" - "$inline$::std::string* $classname$::$release_name$() {\n" + "inline ::std::string* $classname$::$release_name$() {\n" " // @@protoc_insertion_point(field_release:$full_name$)\n" " if (has_$name$()) {\n" " clear_has_$oneof_name$();\n" @@ -633,19 +631,7 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, " return NULL;\n" " }\n" "}\n" - "$inline$::std::string* $classname$::unsafe_arena_release_$name$() {\n" - " // " - "@@protoc_insertion_point(field_unsafe_arena_release:$full_name$)\n" - " GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);\n" - " if (has_$name$()) {\n" - " clear_has_$oneof_name$();\n" - " return $oneof_prefix$$name$_.UnsafeArenaRelease(\n" - " $default_variable$, GetArenaNoVirtual());\n" - " } else {\n" - " return NULL;\n" - " }\n" - "}\n" - "$inline$void $classname$::set_allocated_$name$(::std::string* $name$) {\n" + "inline void $classname$::set_allocated_$name$(::std::string* $name$) {\n" " if (!has_$name$()) {\n" " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n" " }\n" @@ -657,7 +643,19 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, " }\n" " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" "}\n" - "$inline$void $classname$::unsafe_arena_set_allocated_$name$(" + "inline ::std::string* $classname$::unsafe_arena_release_$name$() {\n" + " // " + "@@protoc_insertion_point(field_unsafe_arena_release:$full_name$)\n" + " GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);\n" + " if (has_$name$()) {\n" + " clear_has_$oneof_name$();\n" + " return $oneof_prefix$$name$_.UnsafeArenaRelease(\n" + " $default_variable$, GetArenaNoVirtual());\n" + " } else {\n" + " return NULL;\n" + " }\n" + "}\n" + "inline void $classname$::unsafe_arena_set_allocated_$name$(" "::std::string* $name$) {\n" " GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);\n" " if (!has_$name$()) {\n" @@ -675,15 +673,15 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, } else { // No-arena case. printer->Print( - variables, - "$inline$const ::std::string& $classname$::$name$() const {\n" + variables_, + "inline const ::std::string& $classname$::$name$() const {\n" " // @@protoc_insertion_point(field_get:$full_name$)\n" " if (has_$name$()) {\n" " return $oneof_prefix$$name$_.GetNoArena();\n" " }\n" " return *$default_variable$;\n" "}\n" - "$inline$void $classname$::set_$name$(const ::std::string& value) {\n" + "inline void $classname$::set_$name$(const ::std::string& value) {\n" " // @@protoc_insertion_point(field_set:$full_name$)\n" " if (!has_$name$()) {\n" " clear_$oneof_name$();\n" @@ -694,7 +692,7 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, " // @@protoc_insertion_point(field_set:$full_name$)\n" "}\n" "#if LANG_CXX11\n" - "$inline$void $classname$::set_$name$(::std::string&& value) {\n" + "inline void $classname$::set_$name$(::std::string&& value) {\n" " // @@protoc_insertion_point(field_set:$full_name$)\n" " if (!has_$name$()) {\n" " clear_$oneof_name$();\n" @@ -706,7 +704,7 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, " // @@protoc_insertion_point(field_set_rvalue:$full_name$)\n" "}\n" "#endif\n" - "$inline$void $classname$::set_$name$(const char* value) {\n" + "inline void $classname$::set_$name$(const char* value) {\n" " $null_check$" " if (!has_$name$()) {\n" " clear_$oneof_name$();\n" @@ -717,7 +715,7 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, " $string_piece$(value));\n" " // @@protoc_insertion_point(field_set_char:$full_name$)\n" "}\n" - "$inline$" + "inline " "void $classname$::set_$name$(const $pointer_type$* value, size_t " "size) {\n" " if (!has_$name$()) {\n" @@ -730,7 +728,7 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, " reinterpret_cast<const char*>(value), size));\n" " // @@protoc_insertion_point(field_set_pointer:$full_name$)\n" "}\n" - "$inline$::std::string* $classname$::mutable_$name$() {\n" + "inline ::std::string* $classname$::mutable_$name$() {\n" " if (!has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" @@ -739,7 +737,7 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, " // @@protoc_insertion_point(field_mutable:$full_name$)\n" " return $oneof_prefix$$name$_.MutableNoArena($default_variable$);\n" "}\n" - "$inline$::std::string* $classname$::$release_name$() {\n" + "inline ::std::string* $classname$::$release_name$() {\n" " // @@protoc_insertion_point(field_release:$full_name$)\n" " if (has_$name$()) {\n" " clear_has_$oneof_name$();\n" @@ -748,7 +746,7 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, " return NULL;\n" " }\n" "}\n" - "$inline$void $classname$::set_allocated_$name$(::std::string* $name$) {\n" + "inline void $classname$::set_allocated_$name$(::std::string* $name$) {\n" " if (!has_$name$()) {\n" " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n" " }\n" @@ -765,29 +763,13 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, void StringOneofFieldGenerator:: GenerateClearingCode(io::Printer* printer) const { - std::map<string, string> variables(variables_); - if (dependent_field_) { - variables["this_message"] = DependentBaseDownCast(); - // This clearing code may be in the dependent base class. If the default - // value is an empty string, then the $default_variable$ is a global - // singleton. If the default is not empty, we need to down-cast to get the - // default value's global singleton instance. See SetStringVariables() for - // possible values of default_variable. - if (!descriptor_->default_value_string().empty()) { - variables["default_variable"] = "&" + DependentBaseDownCast() + - variables["default_variable_name"] + - ".get()"; - } - } else { - variables["this_message"] = ""; - } if (SupportsArenas(descriptor_)) { - printer->Print(variables, - "$this_message$$oneof_prefix$$name$_.Destroy($default_variable$,\n" - " $this_message$GetArenaNoVirtual());\n"); + printer->Print(variables_, + "$oneof_prefix$$name$_.Destroy($default_variable$,\n" + " GetArenaNoVirtual());\n"); } else { - printer->Print(variables, - "$this_message$$oneof_prefix$$name$_." + printer->Print(variables_, + "$oneof_prefix$$name$_." "DestroyNoArena($default_variable$);\n"); } } @@ -806,24 +788,16 @@ void StringOneofFieldGenerator:: GenerateConstructorCode(io::Printer* printer) const { printer->Print( variables_, - "_$classname$_default_instance_.$name$_.UnsafeSetDefault(\n" + "$ns$::_$classname$_default_instance_.$name$_.UnsafeSetDefault(\n" " $default_variable$);\n"); } void StringOneofFieldGenerator:: GenerateDestructorCode(io::Printer* printer) const { - if (SupportsArenas(descriptor_)) { - printer->Print(variables_, - "if (has_$name$()) {\n" - " $oneof_prefix$$name$_.Destroy($default_variable$,\n" - " GetArenaNoVirtual());\n" - "}\n"); - } else { - printer->Print(variables_, - "if (has_$name$()) {\n" - " $oneof_prefix$$name$_.DestroyNoArena($default_variable$);\n" - "}\n"); - } + printer->Print(variables_, + "if (has_$name$()) {\n" + " $oneof_prefix$$name$_.DestroyNoArena($default_variable$);\n" + "}\n"); } void StringOneofFieldGenerator:: @@ -937,71 +911,68 @@ GenerateAccessorDeclarations(io::Printer* printer) const { } void RepeatedStringFieldGenerator:: -GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const { - std::map<string, string> variables(variables_); - variables["inline"] = is_inline ? "inline " : ""; - printer->Print(variables, - "$inline$const ::std::string& $classname$::$name$(int index) const {\n" +GenerateInlineAccessorDefinitions(io::Printer* printer) const { + printer->Print(variables_, + "inline const ::std::string& $classname$::$name$(int index) const {\n" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return $name$_.$cppget$(index);\n" "}\n" - "$inline$::std::string* $classname$::mutable_$name$(int index) {\n" + "inline ::std::string* $classname$::mutable_$name$(int index) {\n" " // @@protoc_insertion_point(field_mutable:$full_name$)\n" " return $name$_.Mutable(index);\n" "}\n" - "$inline$void $classname$::set_$name$(int index, const ::std::string& value) {\n" + "inline void $classname$::set_$name$(int index, const ::std::string& value) {\n" " // @@protoc_insertion_point(field_set:$full_name$)\n" " $name$_.Mutable(index)->assign(value);\n" "}\n" "#if LANG_CXX11\n" - "$inline$void $classname$::set_$name$(int index, ::std::string&& value) {\n" + "inline void $classname$::set_$name$(int index, ::std::string&& value) {\n" " // @@protoc_insertion_point(field_set:$full_name$)\n" " $name$_.Mutable(index)->assign(std::move(value));\n" "}\n" "#endif\n" - "$inline$void $classname$::set_$name$(int index, const char* value) {\n" + "inline void $classname$::set_$name$(int index, const char* value) {\n" " $null_check$" " $name$_.Mutable(index)->assign(value);\n" " // @@protoc_insertion_point(field_set_char:$full_name$)\n" "}\n" - "$inline$void " + "inline void " "$classname$::set_$name$" "(int index, const $pointer_type$* value, size_t size) {\n" " $name$_.Mutable(index)->assign(\n" " reinterpret_cast<const char*>(value), size);\n" " // @@protoc_insertion_point(field_set_pointer:$full_name$)\n" "}\n" - "$inline$::std::string* $classname$::add_$name$() {\n" + "inline ::std::string* $classname$::add_$name$() {\n" " // @@protoc_insertion_point(field_add_mutable:$full_name$)\n" " return $name$_.Add();\n" "}\n" - "$inline$void $classname$::add_$name$(const ::std::string& value) {\n" + "inline void $classname$::add_$name$(const ::std::string& value) {\n" " $name$_.Add()->assign(value);\n" " // @@protoc_insertion_point(field_add:$full_name$)\n" "}\n" "#if LANG_CXX11\n" - "$inline$void $classname$::add_$name$(::std::string&& value) {\n" + "inline void $classname$::add_$name$(::std::string&& value) {\n" " $name$_.Add(std::move(value));\n" " // @@protoc_insertion_point(field_add:$full_name$)\n" "}\n" "#endif\n" - "$inline$void $classname$::add_$name$(const char* value) {\n" + "inline void $classname$::add_$name$(const char* value) {\n" " $null_check$" " $name$_.Add()->assign(value);\n" " // @@protoc_insertion_point(field_add_char:$full_name$)\n" "}\n" - "$inline$void " + "inline void " "$classname$::add_$name$(const $pointer_type$* value, size_t size) {\n" " $name$_.Add()->assign(reinterpret_cast<const char*>(value), size);\n" " // @@protoc_insertion_point(field_add_pointer:$full_name$)\n" "}\n" - "$inline$const ::google::protobuf::RepeatedPtrField< ::std::string>&\n" + "inline const ::google::protobuf::RepeatedPtrField< ::std::string>&\n" "$classname$::$name$() const {\n" " // @@protoc_insertion_point(field_list:$full_name$)\n" " return $name$_;\n" "}\n" - "$inline$::google::protobuf::RepeatedPtrField< ::std::string>*\n" + "inline ::google::protobuf::RepeatedPtrField< ::std::string>*\n" "$classname$::mutable_$name$() {\n" " // @@protoc_insertion_point(field_mutable_list:$full_name$)\n" " return &$name$_;\n" diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.h b/src/google/protobuf/compiler/cpp/cpp_string_field.h index 531252b0..f56f0721 100644 --- a/src/google/protobuf/compiler/cpp/cpp_string_field.h +++ b/src/google/protobuf/compiler/cpp/cpp_string_field.h @@ -54,8 +54,7 @@ class StringFieldGenerator : public FieldGenerator { void GeneratePrivateMembers(io::Printer* printer) const; void GenerateStaticMembers(io::Printer* printer) const; void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const; void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const; void GenerateClearingCode(io::Printer* printer) const; void GenerateMessageClearingCode(io::Printer* printer) const; @@ -73,6 +72,7 @@ class StringFieldGenerator : public FieldGenerator { protected: const FieldDescriptor* descriptor_; std::map<string, string> variables_; + const bool lite_; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringFieldGenerator); @@ -85,8 +85,7 @@ class StringOneofFieldGenerator : public StringFieldGenerator { ~StringOneofFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const; void GenerateClearingCode(io::Printer* printer) const; // StringFieldGenerator, from which we inherit, overrides this so we need to @@ -111,8 +110,7 @@ class RepeatedStringFieldGenerator : public FieldGenerator { // implements FieldGenerator --------------------------------------- void GeneratePrivateMembers(io::Printer* printer) const; void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer, - bool is_inline) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const; void GenerateClearingCode(io::Printer* printer) const; void GenerateMergingCode(io::Printer* printer) const; void GenerateSwappingCode(io::Printer* printer) const; diff --git a/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto b/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto index 4e25b2ea..7fe98759 100644 --- a/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto +++ b/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto @@ -151,6 +151,10 @@ enum ConflictingEnum { // NO_PROTO3 message DummyMessage {} +// Message names that could conflict. +message Shutdown {} +message TableStruct {} + service TestConflictingMethodNames { rpc Closure(DummyMessage) returns (DummyMessage); } diff --git a/src/google/protobuf/compiler/cpp/cpp_unittest.cc b/src/google/protobuf/compiler/cpp/cpp_unittest.cc index fdde771b..61cc32a4 100644 --- a/src/google/protobuf/compiler/cpp/cpp_unittest.cc +++ b/src/google/protobuf/compiler/cpp/cpp_unittest.cc @@ -744,21 +744,6 @@ TEST(GeneratedMessageTest, NonEmptyMergeFrom) { TestUtil::ExpectAllFieldsSet(message1); } -#if !defined(PROTOBUF_TEST_NO_DESCRIPTORS) || \ - !defined(GOOGLE_PROTOBUF_NO_RTTI) -#ifdef PROTOBUF_HAS_DEATH_TEST -#ifndef NDEBUG - -TEST(GeneratedMessageTest, MergeFromSelf) { - unittest::TestAllTypes message; - EXPECT_DEATH(message.MergeFrom(message), "pb[.]cc.*Check failed:"); - EXPECT_DEATH(message.MergeFrom(implicit_cast<const Message&>(message)), - "pb[.]cc.*Check failed:"); -} - -#endif // NDEBUG -#endif // PROTOBUF_HAS_DEATH_TEST -#endif // !PROTOBUF_TEST_NO_DESCRIPTORS || !GOOGLE_PROTOBUF_NO_RTTI // Test the generated SerializeWithCachedSizesToArray(), TEST(GeneratedMessageTest, SerializationToArray) { diff --git a/src/google/protobuf/compiler/cpp/metadata_test.cc b/src/google/protobuf/compiler/cpp/metadata_test.cc index 03f6b12b..d1bb3194 100644 --- a/src/google/protobuf/compiler/cpp/metadata_test.cc +++ b/src/google/protobuf/compiler/cpp/metadata_test.cc @@ -35,10 +35,8 @@ #include <google/protobuf/compiler/cpp/cpp_helpers.h> #include <google/protobuf/compiler/cpp/cpp_generator.h> +#include <google/protobuf/compiler/annotation_test_util.h> #include <google/protobuf/compiler/command_line_interface.h> -#include <google/protobuf/io/zero_copy_stream.h> -#include <google/protobuf/io/zero_copy_stream_impl_lite.h> -#include <google/protobuf/io/printer.h> #include <google/protobuf/descriptor.pb.h> #include <google/protobuf/testing/file.h> @@ -47,37 +45,15 @@ #include <gtest/gtest.h> namespace google { +namespace atu = ::google::protobuf::compiler::annotation_test_util; + namespace protobuf { namespace compiler { namespace cpp { namespace { -// A CodeGenerator that captures the FileDescriptor it's passed as a -// FileDescriptorProto. -class DescriptorCapturingGenerator : public CodeGenerator { - public: - // Does not own file; file must outlive the Generator. - explicit DescriptorCapturingGenerator(FileDescriptorProto* file) - : file_(file) {} - - virtual bool Generate(const FileDescriptor* file, const string& parameter, - GeneratorContext* context, string* error) const { - file->CopyTo(file_); - return true; - } - - private: - FileDescriptorProto* file_; -}; - class CppMetadataTest : public ::testing::Test { public: - // Adds a file with name `filename` and content `data`. - void AddFile(const string& filename, const string& data) { - GOOGLE_CHECK_OK(File::SetContents(TestTempDir() + "/" + filename, data, - true)); - } - // Tries to capture a FileDescriptorProto, GeneratedCodeInfo, and output // code from the previously added file with name `filename`. Returns true on // success. If pb_h is non-null, expects a .pb.h and a .pb.h.meta (copied to @@ -87,26 +63,21 @@ class CppMetadataTest : public ::testing::Test { string* proto_h, GeneratedCodeInfo* proto_h_info, string* pb_cc) { google::protobuf::compiler::CommandLineInterface cli; - cli.SetInputsAreProtoPathRelative(true); - CppGenerator cpp_generator; - DescriptorCapturingGenerator capturing_generator(file); cli.RegisterGenerator("--cpp_out", &cpp_generator, ""); - cli.RegisterGenerator("--capture_out", &capturing_generator, ""); - - string proto_path = "-I" + TestTempDir(); string cpp_out = "--cpp_out=annotate_headers=true," "annotation_pragma_name=pragma_name," "annotation_guard_name=guard_name:" + TestTempDir(); - string capture_out = "--capture_out=" + TestTempDir(); - const char* argv[] = {"protoc", proto_path.c_str(), cpp_out.c_str(), - capture_out.c_str(), filename.c_str()}; + const bool result = + atu::CaptureMetadata(filename, cpp_out, + /* meta_file_suffix */ "", &cli, file, + /* outputs */ NULL); - if (cli.Run(5, argv) != 0) { - return false; + if (!result) { + return result; } string output_base = TestTempDir() + "/" + StripProto(filename); @@ -119,7 +90,7 @@ class CppMetadataTest : public ::testing::Test { if (pb_h != NULL && pb_h_info != NULL) { GOOGLE_CHECK_OK( File::GetContents(output_base + ".pb.h", pb_h, true)); - if (!DecodeMetadata(output_base + ".pb.h.meta", pb_h_info)) { + if (!atu::DecodeMetadata(output_base + ".pb.h.meta", pb_h_info)) { return false; } } @@ -127,23 +98,13 @@ class CppMetadataTest : public ::testing::Test { if (proto_h != NULL && proto_h_info != NULL) { GOOGLE_CHECK_OK(File::GetContents(output_base + ".proto.h", proto_h, true)); - if (!DecodeMetadata(output_base + ".proto.h.meta", proto_h_info)) { + if (!atu::DecodeMetadata(output_base + ".proto.h.meta", proto_h_info)) { return false; } } return true; } - - private: - // Decodes GeneratedCodeInfo stored in path and copies it to info. - // Returns true on success. - bool DecodeMetadata(const string& path, GeneratedCodeInfo* info) { - string data; - GOOGLE_CHECK_OK(File::GetContents(path, &data, true)); - io::ArrayInputStream input(data.data(), data.size()); - return info->ParseFromZeroCopyStream(&input); - } }; const char kSmallTestFile[] = @@ -152,48 +113,11 @@ const char kSmallTestFile[] = "enum Enum { VALUE = 0; }\n" "message Message { }\n"; -// Finds the Annotation for a given source file and path (or returns null if it -// couldn't). -const GeneratedCodeInfo::Annotation* FindAnnotationOnPath( - const GeneratedCodeInfo& info, const string& source_file, - const std::vector<int>& path) { - for (int i = 0; i < info.annotation_size(); ++i) { - const GeneratedCodeInfo::Annotation* annotation = &info.annotation(i); - if (annotation->source_file() != source_file || - annotation->path_size() != path.size()) { - continue; - } - int node = 0; - for (; node < path.size(); ++node) { - if (annotation->path(node) != path[node]) { - break; - } - } - if (node == path.size()) { - return annotation; - } - } - return NULL; -} - -// Returns true if the provided annotation covers a given substring in -// file_content. -bool AnnotationMatchesSubstring(const string& file_content, - const GeneratedCodeInfo::Annotation* annotation, - const string& expected_text) { - uint32 begin = annotation->begin(); - uint32 end = annotation->end(); - if (end < begin || end > file_content.size()) { - return false; - } - return file_content.substr(begin, end - begin) == expected_text; -} - TEST_F(CppMetadataTest, CapturesEnumNames) { FileDescriptorProto file; GeneratedCodeInfo info; string pb_h; - AddFile("test.proto", kSmallTestFile); + atu::AddFile("test.proto", kSmallTestFile); EXPECT_TRUE( CaptureMetadata("test.proto", &file, &pb_h, &info, NULL, NULL, NULL)); EXPECT_EQ("Enum", file.enum_type(0).name()); @@ -201,16 +125,16 @@ TEST_F(CppMetadataTest, CapturesEnumNames) { enum_path.push_back(FileDescriptorProto::kEnumTypeFieldNumber); enum_path.push_back(0); const GeneratedCodeInfo::Annotation* enum_annotation = - FindAnnotationOnPath(info, "test.proto", enum_path); + atu::FindAnnotationOnPath(info, "test.proto", enum_path); EXPECT_TRUE(NULL != enum_annotation); - EXPECT_TRUE(AnnotationMatchesSubstring(pb_h, enum_annotation, "Enum")); + EXPECT_TRUE(atu::AnnotationMatchesSubstring(pb_h, enum_annotation, "Enum")); } TEST_F(CppMetadataTest, AddsPragma) { FileDescriptorProto file; GeneratedCodeInfo info; string pb_h; - AddFile("test.proto", kSmallTestFile); + atu::AddFile("test.proto", kSmallTestFile); EXPECT_TRUE( CaptureMetadata("test.proto", &file, &pb_h, &info, NULL, NULL, NULL)); EXPECT_TRUE(pb_h.find("#ifdef guard_name") != string::npos); @@ -222,7 +146,7 @@ TEST_F(CppMetadataTest, CapturesMessageNames) { FileDescriptorProto file; GeneratedCodeInfo info; string pb_h; - AddFile("test.proto", kSmallTestFile); + atu::AddFile("test.proto", kSmallTestFile); EXPECT_TRUE( CaptureMetadata("test.proto", &file, &pb_h, &info, NULL, NULL, NULL)); EXPECT_EQ("Message", file.message_type(0).name()); @@ -230,9 +154,10 @@ TEST_F(CppMetadataTest, CapturesMessageNames) { message_path.push_back(FileDescriptorProto::kMessageTypeFieldNumber); message_path.push_back(0); const GeneratedCodeInfo::Annotation* message_annotation = - FindAnnotationOnPath(info, "test.proto", message_path); + atu::FindAnnotationOnPath(info, "test.proto", message_path); EXPECT_TRUE(NULL != message_annotation); - EXPECT_TRUE(AnnotationMatchesSubstring(pb_h, message_annotation, "Message")); + EXPECT_TRUE( + atu::AnnotationMatchesSubstring(pb_h, message_annotation, "Message")); } } // namespace diff --git a/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc b/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc index 5c54270e..8c38e52f 100644 --- a/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc +++ b/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc @@ -184,11 +184,6 @@ TEST(CsharpBootstrapTest, GeneratedCsharpDescriptorMatches) { "../csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs"); generate_test.SetParameter(""); - source_tree.MapPath("", TestSourceDir() + "/../examples"); - generate_test.Run(importer.Import("addressbook.proto"), - "Addressbook.cs", - "../csharp/src/AddressBook/Addressbook.cs"); - source_tree.MapPath("", TestSourceDir() + "/../conformance"); generate_test.Run(importer.Import("conformance.proto"), "Conformance.cs", diff --git a/src/google/protobuf/compiler/importer.cc b/src/google/protobuf/compiler/importer.cc index 4c357aa0..9792ffe8 100644 --- a/src/google/protobuf/compiler/importer.cc +++ b/src/google/protobuf/compiler/importer.cc @@ -54,13 +54,17 @@ #include <google/protobuf/compiler/parser.h> #include <google/protobuf/io/tokenizer.h> #include <google/protobuf/io/zero_copy_stream_impl.h> -#include <google/protobuf/stubs/io_win32.h> #include <google/protobuf/stubs/strutil.h> +#include <google/protobuf/stubs/io_win32.h> #ifdef _WIN32 #include <ctype.h> #endif +namespace google { +namespace protobuf { +namespace compiler { + #ifdef _MSC_VER // DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import // them like we do below. @@ -68,10 +72,6 @@ using google::protobuf::internal::win32::access; using google::protobuf::internal::win32::open; #endif -namespace google { -namespace protobuf { -namespace compiler { - // Returns true if the text looks like a Windows-style absolute path, starting // with a drive letter. Example: "C:\foo". TODO(kenton): Share this with // copy in command_line_interface.cc? diff --git a/src/google/protobuf/compiler/java/java_helpers.cc b/src/google/protobuf/compiler/java/java_helpers.cc index d8ac2db3..dbb86b87 100644 --- a/src/google/protobuf/compiler/java/java_helpers.cc +++ b/src/google/protobuf/compiler/java/java_helpers.cc @@ -37,6 +37,7 @@ #include <limits> #include <vector> +#include <google/protobuf/stubs/stringprintf.h> #include <google/protobuf/compiler/java/java_helpers.h> #include <google/protobuf/compiler/java/java_name_resolver.h> #include <google/protobuf/descriptor.pb.h> @@ -783,6 +784,137 @@ bool HasRepeatedFields(const Descriptor* descriptor) { return false; } +// Encode an unsigned 32-bit value into a sequence of UTF-16 characters. +// +// If the value is in [0x0000, 0xD7FF], we encode it with a single character +// with the same numeric value. +// +// If the value is larger than 0xD7FF, we encode its lowest 13 bits into a +// character in the range [0xE000, 0xFFFF] by combining these 13 bits with +// 0xE000 using logic-or. Then we shift the value to the right by 13 bits, and +// encode the remaining value by repeating this same process until we get to +// a value in [0x0000, 0xD7FF] where we will encode it using a character with +// the same numeric value. +// +// Note that we only use code points in [0x0000, 0xD7FF] and [0xE000, 0xFFFF]. +// There will be no surrogate pairs in the encoded character sequence. +void WriteUInt32ToUtf16CharSequence(uint32 number, + std::vector<uint16>* output) { + // For values in [0x0000, 0xD7FF], only use one char to encode it. + if (number < 0xD800) { + output->push_back(static_cast<uint16>(number)); + return; + } + // Encode into multiple chars. All except the last char will be in the range + // [0xE000, 0xFFFF], and the last char will be in the range [0x0000, 0xD7FF]. + // Note that we don't use any value in range [0xD800, 0xDFFF] because they + // have to come in pairs and the encoding is just more space-efficient w/o + // them. + while (number >= 0xD800) { + // [0xE000, 0xFFFF] can represent 13 bits of info. + output->push_back(static_cast<uint16>(0xE000 | (number & 0x1FFF))); + number >>= 13; + } + output->push_back(static_cast<uint16>(number)); +} + +int GetExperimentalJavaFieldTypeForSingular(const FieldDescriptor* field) { + // j/c/g/protobuf/FieldType.java lists field types in a slightly different + // order from FieldDescriptor::Type so we can't do a simple cast. + // + // TODO(xiaofeng): Make j/c/g/protobuf/FieldType.java follow the same order. + int result = field->type(); + if (result == FieldDescriptor::TYPE_GROUP) { + return 17; + } else if (result < FieldDescriptor::TYPE_GROUP) { + return result - 1; + } else { + return result - 2; + } +} + +int GetExperimentalJavaFieldTypeForRepeated(const FieldDescriptor* field) { + if (field->type() == FieldDescriptor::TYPE_GROUP) { + return 49; + } else { + return GetExperimentalJavaFieldTypeForSingular(field) + 18; + } +} + +int GetExperimentalJavaFieldTypeForPacked(const FieldDescriptor* field) { + int result = field->type(); + if (result < FieldDescriptor::TYPE_STRING) { + return result + 34; + } else if (result > FieldDescriptor::TYPE_BYTES) { + return result + 30; + } else { + GOOGLE_LOG(FATAL) << field->full_name() << " can't be packed."; + return 0; + } +} + +int GetExperimentalJavaFieldType(const FieldDescriptor* field) { + static const int kMapFieldType = 50; + static const int kOneofFieldTypeOffset = 51; + static const int kRequiredBit = 0x100; + static const int kUtf8CheckBit = 0x200; + static const int kCheckInitialized = 0x400; + static const int kMapWithProto2EnumValue = 0x800; + int extra_bits = field->is_required() ? kRequiredBit : 0; + if (field->type() == FieldDescriptor::TYPE_STRING && CheckUtf8(field)) { + extra_bits |= kUtf8CheckBit; + } + if (field->is_required() || (GetJavaType(field) == JAVATYPE_MESSAGE && + HasRequiredFields(field->message_type()))) { + extra_bits |= kCheckInitialized; + } + + if (field->is_map()) { + if (SupportFieldPresence(field->file())) { + const FieldDescriptor* value = + field->message_type()->FindFieldByName("value"); + if (GetJavaType(value) == JAVATYPE_ENUM) { + extra_bits |= kMapWithProto2EnumValue; + } + } + return kMapFieldType | extra_bits; + } else if (field->is_packed()) { + return GetExperimentalJavaFieldTypeForPacked(field); + } else if (field->is_repeated()) { + return GetExperimentalJavaFieldTypeForRepeated(field) | extra_bits; + } else if (field->containing_oneof() != NULL) { + return (GetExperimentalJavaFieldTypeForSingular(field) + + kOneofFieldTypeOffset) | + extra_bits; + } else { + return GetExperimentalJavaFieldTypeForSingular(field) | extra_bits; + } +} + +// Escape a UTF-16 character to be embedded in a Java string. +void EscapeUtf16ToString(uint16 code, string* output) { + if (code == '\t') { + output->append("\\t"); + } else if (code == '\b') { + output->append("\\b"); + } else if (code == '\n') { + output->append("\\n"); + } else if (code == '\r') { + output->append("\\r"); + } else if (code == '\f') { + output->append("\\f"); + } else if (code == '\'') { + output->append("\\'"); + } else if (code == '\"') { + output->append("\\\""); + } else if (code == '\\') { + output->append("\\\\"); + } else if (code >= 0x20 && code <= 0x7f) { + output->push_back(static_cast<char>(code)); + } else { + output->append(StringPrintf("\\u%04x", code)); + } +} } // namespace java } // namespace compiler } // namespace protobuf diff --git a/src/google/protobuf/compiler/java/java_helpers.h b/src/google/protobuf/compiler/java/java_helpers.h index bd565ced..00d683db 100644 --- a/src/google/protobuf/compiler/java/java_helpers.h +++ b/src/google/protobuf/compiler/java/java_helpers.h @@ -136,6 +136,13 @@ inline string ShortMutableJavaClassName(const Descriptor* descriptor) { return descriptor->name(); } +// Whether the given descriptor is for one of the core descriptor protos. We +// cannot currently use the new runtime with core protos since there is a +// bootstrapping problem with obtaining their descriptors. +inline bool IsDescriptorProto(const Descriptor* descriptor) { + return descriptor->file()->name() == "google/protobuf/descriptor.proto"; +} + // Whether we should generate multiple java files for messages. inline bool MultipleJavaFiles( @@ -371,6 +378,10 @@ inline bool IsAnyMessage(const Descriptor* descriptor) { return descriptor->full_name() == "google.protobuf.Any"; } +inline bool IsWrappersProtoFile(const FileDescriptor* descriptor) { + return descriptor->name() == "google/protobuf/wrappers.proto"; +} + inline bool CheckUtf8(const FieldDescriptor* descriptor) { return descriptor->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 || descriptor->file()->options().java_string_check_utf8(); @@ -379,6 +390,30 @@ inline bool CheckUtf8(const FieldDescriptor* descriptor) { inline string GeneratedCodeVersionSuffix() { return "V3"; } + +inline bool EnableExperimentalRuntime(Context* context) { + return false; +} + +void WriteUInt32ToUtf16CharSequence(uint32 number, std::vector<uint16>* output); + +inline void WriteIntToUtf16CharSequence(int value, + std::vector<uint16>* output) { + WriteUInt32ToUtf16CharSequence(static_cast<uint32>(value), output); +} + +// Escape a UTF-16 character so it can be embedded in a Java string literal. +void EscapeUtf16ToString(uint16 code, string* output); + +// Only the lowest two bytes of the return value are used. The lowest byte +// is the integer value of a j/c/g/protobuf/FieldType enum. For the other +// byte: +// bit 0: whether the field is required. +// bit 1: whether the field requires UTF-8 validation. +// bit 2: whether the field needs isInitialized check. +// bit 3: whether the field is a map field with proto2 enum value. +// bits 4-7: unused +int GetExperimentalJavaFieldType(const FieldDescriptor* field); } // namespace java } // namespace compiler } // namespace protobuf diff --git a/src/google/protobuf/compiler/java/java_message.cc b/src/google/protobuf/compiler/java/java_message.cc index ecc67575..2486b739 100644 --- a/src/google/protobuf/compiler/java/java_message.cc +++ b/src/google/protobuf/compiler/java/java_message.cc @@ -371,6 +371,7 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) { "}\n" "\n"); + printer->Print( "@java.lang.Override\n" "public final com.google.protobuf.UnknownFieldSet\n" @@ -379,7 +380,10 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) { "}\n"); if (context_->HasGeneratedMethods(descriptor_)) { - GenerateParsingConstructor(printer); + if (!EnableExperimentalRuntime(context_) || + IsDescriptorProto(descriptor_)) { + GenerateParsingConstructor(printer); + } } GenerateDescriptorMethods(printer); @@ -537,6 +541,17 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) { "\n", "classname", name_resolver_->GetImmutableClassName(descriptor_)); + // 'of' method for Wrappers + if (IsWrappersProtoFile(descriptor_->file())) { + printer->Print( + "public static $classname$ of($field_type$ value) {\n" + " return newBuilder().setValue(value).build();\n" + "}\n" + "\n", + "classname", name_resolver_->GetImmutableClassName(descriptor_), + "field_type", PrimitiveTypeName(GetJavaType(descriptor_->field(0)))); + } + GenerateParser(printer); printer->Print( @@ -576,95 +591,103 @@ GenerateMessageSerializationMethods(io::Printer* printer) { "public void writeTo(com.google.protobuf.CodedOutputStream output)\n" " throws java.io.IOException {\n"); printer->Indent(); - if (HasPackedFields(descriptor_)) { - // writeTo(CodedOutputStream output) might be invoked without - // getSerializedSize() ever being called, but we need the memoized - // sizes in case this message has packed fields. Rather than emit checks for - // each packed field, just call getSerializedSize() up front. - // In most cases, getSerializedSize() will have already been called anyway - // by one of the wrapper writeTo() methods, making this call cheap. - printer->Print( - "getSerializedSize();\n"); - } - if (descriptor_->extension_range_count() > 0) { - if (descriptor_->options().message_set_wire_format()) { - printer->Print( - "com.google.protobuf.GeneratedMessage$ver$\n" - " .ExtendableMessage<$classname$>.ExtensionWriter\n" - " extensionWriter = newMessageSetExtensionWriter();\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_), - "ver", GeneratedCodeVersionSuffix()); - } else { - printer->Print( - "com.google.protobuf.GeneratedMessage$ver$\n" - " .ExtendableMessage<$classname$>.ExtensionWriter\n" - " extensionWriter = newExtensionWriter();\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_), - "ver", GeneratedCodeVersionSuffix()); + if (EnableExperimentalRuntime(context_) && !IsDescriptorProto(descriptor_)) { + printer->Print("writeToInternal(output);\n"); + } else { + if (HasPackedFields(descriptor_)) { + // writeTo(CodedOutputStream output) might be invoked without + // getSerializedSize() ever being called, but we need the memoized + // sizes in case this message has packed fields. Rather than emit checks + // for each packed field, just call getSerializedSize() up front. In most + // cases, getSerializedSize() will have already been called anyway by one + // of the wrapper writeTo() methods, making this call cheap. + printer->Print("getSerializedSize();\n"); } - } - // Merge the fields and the extension ranges, both sorted by field number. - for (int i = 0, j = 0; - i < descriptor_->field_count() || j < sorted_extensions.size(); - ) { - if (i == descriptor_->field_count()) { - GenerateSerializeOneExtensionRange(printer, sorted_extensions[j++]); - } else if (j == sorted_extensions.size()) { - GenerateSerializeOneField(printer, sorted_fields[i++]); - } else if (sorted_fields[i]->number() < sorted_extensions[j]->start) { - GenerateSerializeOneField(printer, sorted_fields[i++]); - } else { - GenerateSerializeOneExtensionRange(printer, sorted_extensions[j++]); + if (descriptor_->extension_range_count() > 0) { + if (descriptor_->options().message_set_wire_format()) { + printer->Print( + "com.google.protobuf.GeneratedMessage$ver$\n" + " .ExtendableMessage<$classname$>.ExtensionWriter\n" + " extensionWriter = newMessageSetExtensionWriter();\n", + "classname", name_resolver_->GetImmutableClassName(descriptor_), + "ver", GeneratedCodeVersionSuffix()); + } else { + printer->Print( + "com.google.protobuf.GeneratedMessage$ver$\n" + " .ExtendableMessage<$classname$>.ExtensionWriter\n" + " extensionWriter = newExtensionWriter();\n", + "classname", name_resolver_->GetImmutableClassName(descriptor_), + "ver", GeneratedCodeVersionSuffix()); + } } - } - if (descriptor_->options().message_set_wire_format()) { - printer->Print( - "unknownFields.writeAsMessageSetTo(output);\n"); - } else { - printer->Print( - "unknownFields.writeTo(output);\n"); + // Merge the fields and the extension ranges, both sorted by field number. + for (int i = 0, j = 0; + i < descriptor_->field_count() || j < sorted_extensions.size();) { + if (i == descriptor_->field_count()) { + GenerateSerializeOneExtensionRange(printer, sorted_extensions[j++]); + } else if (j == sorted_extensions.size()) { + GenerateSerializeOneField(printer, sorted_fields[i++]); + } else if (sorted_fields[i]->number() < sorted_extensions[j]->start) { + GenerateSerializeOneField(printer, sorted_fields[i++]); + } else { + GenerateSerializeOneExtensionRange(printer, sorted_extensions[j++]); + } + } + + if (descriptor_->options().message_set_wire_format()) { + printer->Print("unknownFields.writeAsMessageSetTo(output);\n"); + } else { + printer->Print("unknownFields.writeTo(output);\n"); + } } printer->Outdent(); printer->Print( - "}\n" - "\n" - "public int getSerializedSize() {\n" - " int size = memoizedSize;\n" - " if (size != -1) return size;\n" - "\n" - " size = 0;\n"); + "}\n" + "\n" + "public int getSerializedSize() {\n" + " int size = memoizedSize;\n" + " if (size != -1) return size;\n" + "\n"); printer->Indent(); + if (EnableExperimentalRuntime(context_) && !IsDescriptorProto(descriptor_)) { + printer->Print( + "memoizedSize = getSerializedSizeInternal();\n" + "return memoizedSize;\n"); + } else { - for (int i = 0; i < descriptor_->field_count(); i++) { - field_generators_.get(sorted_fields[i]).GenerateSerializedSizeCode(printer); - } + printer->Print("size = 0;\n"); + + for (int i = 0; i < descriptor_->field_count(); i++) { + field_generators_.get(sorted_fields[i]) + .GenerateSerializedSizeCode(printer); + } + + if (descriptor_->extension_range_count() > 0) { + if (descriptor_->options().message_set_wire_format()) { + printer->Print("size += extensionsSerializedSizeAsMessageSet();\n"); + } else { + printer->Print("size += extensionsSerializedSize();\n"); + } + } - if (descriptor_->extension_range_count() > 0) { if (descriptor_->options().message_set_wire_format()) { printer->Print( - "size += extensionsSerializedSizeAsMessageSet();\n"); + "size += unknownFields.getSerializedSizeAsMessageSet();\n"); } else { - printer->Print( - "size += extensionsSerializedSize();\n"); + printer->Print("size += unknownFields.getSerializedSize();\n"); } - } - if (descriptor_->options().message_set_wire_format()) { - printer->Print( - "size += unknownFields.getSerializedSizeAsMessageSet();\n"); - } else { printer->Print( - "size += unknownFields.getSerializedSize();\n"); + "memoizedSize = size;\n" + "return size;\n"); } printer->Outdent(); printer->Print( - " memoizedSize = size;\n" - " return size;\n" "}\n" "\n"); } @@ -1199,7 +1222,10 @@ GenerateParsingConstructor(io::Printer* printer) { // Initialize all fields to default. printer->Print( - "this();\n"); + "this();\n" + "if (extensionRegistry == null) {\n" + " throw new java.lang.NullPointerException();\n" + "}\n"); // Use builder bits to track mutable repeated fields. int totalBuilderBits = 0; @@ -1335,10 +1361,18 @@ void ImmutableMessageGenerator::GenerateParser(io::Printer* printer) { " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" " throws com.google.protobuf.InvalidProtocolBufferException {\n", "classname", descriptor_->name()); - if (context_->HasGeneratedMethods(descriptor_)) { + if (EnableExperimentalRuntime(context_) && !IsDescriptorProto(descriptor_)) { + printer->Indent(); printer->Print( - " return new $classname$(input, extensionRegistry);\n", + "$classname$ msg = new $classname$();\n" + "msg.mergeFromInternal(input, extensionRegistry);\n" + "msg.makeImmutableInternal();\n" + "return msg;\n", "classname", descriptor_->name()); + printer->Outdent(); + } else if (context_->HasGeneratedMethods(descriptor_)) { + printer->Print(" return new $classname$(input, extensionRegistry);\n", + "classname", descriptor_->name()); } else { // When parsing constructor isn't generated, use builder to parse // messages. Note, will fallback to use reflection based mergeFieldFrom() diff --git a/src/google/protobuf/compiler/java/java_message_lite.cc b/src/google/protobuf/compiler/java/java_message_lite.cc index 26f16439..d828be43 100644 --- a/src/google/protobuf/compiler/java/java_message_lite.cc +++ b/src/google/protobuf/compiler/java/java_message_lite.cc @@ -69,6 +69,14 @@ using internal::WireFormat; using internal::WireFormatLite; namespace { +bool EnableExperimentalRuntimeForLite() { +#ifdef PROTOBUF_EXPERIMENT + return PROTOBUF_EXPERIMENT; +#else // PROTOBUF_EXPERIMENT + return false; +#endif // !PROTOBUF_EXPERIMENT +} + bool GenerateHasBits(const Descriptor* descriptor) { return SupportFieldPresence(descriptor->file()) || HasRepeatedFields(descriptor); @@ -332,17 +340,19 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { printer->Print("\n"); } - GenerateMessageSerializationMethods(printer); + if (!EnableExperimentalRuntime(context_)) { + GenerateMessageSerializationMethods(printer); + } GenerateParseFromMethods(printer); GenerateBuilder(printer); if (HasRequiredFields(descriptor_)) { // Memoizes whether the protocol buffer is fully initialized (has all - // required fields). -1 means not yet computed. 0 means false and 1 means - // true. + // required fields). 0 means false, 1 means true, and all other values + // mean not yet computed. printer->Print( - "private byte memoizedIsInitialized = -1;\n"); + "private byte memoizedIsInitialized = 2;\n"); } printer->Print( @@ -359,14 +369,14 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { printer->Indent(); printer->Indent(); - printer->Print( - "case IS_INITIALIZED: {\n"); + printer->Print("case IS_INITIALIZED: {\n"); printer->Indent(); GenerateDynamicMethodIsInitialized(printer); printer->Outdent(); + printer->Print("}\n"); + printer->Print( - "}\n" "case MAKE_IMMUTABLE: {\n"); printer->Indent(); @@ -381,13 +391,15 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { GenerateDynamicMethodNewBuilder(printer); printer->Outdent(); - printer->Print( - "}\n" - "case VISIT: {\n"); + if (!EnableExperimentalRuntimeForLite()) { + printer->Print( + "}\n" + "case VISIT: {\n"); - printer->Indent(); - GenerateDynamicMethodVisit(printer); - printer->Outdent(); + printer->Indent(); + GenerateDynamicMethodVisit(printer); + printer->Outdent(); + } printer->Print( "}\n" @@ -415,13 +427,33 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { " }\n" " }\n" " }\n" - " return PARSER;\n" - "}\n", + " return PARSER;\n", "classname", name_resolver_->GetImmutableClassName(descriptor_)); printer->Outdent(); - printer->Outdent(); + if (HasRequiredFields(descriptor_)) { + printer->Print( + "}\n" + "case GET_MEMOIZED_IS_INITIALIZED: {\n" + " return memoizedIsInitialized;\n" + "}\n" + "case SET_MEMOIZED_IS_INITIALIZED: {\n" + " memoizedIsInitialized = (byte) (arg0 == null ? 0 : 1);\n" + " return null;\n" + "}\n"); + } else { + printer->Print( + "}\n" + "case GET_MEMOIZED_IS_INITIALIZED: {\n" + " return (byte) 1;\n" + "}\n" + "case SET_MEMOIZED_IS_INITIALIZED: {\n" + " return null;\n" + "}\n"); + } + + printer->Outdent(); printer->Print( " }\n" " throw new UnsupportedOperationException();\n" @@ -448,6 +480,17 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { "}\n" "\n", "classname", descriptor_->name()); + if (EnableExperimentalRuntimeForLite()) { + // Register the default instance in a map. This map will be used by + // experimental runtime to lookup default instance given a class instance + // without using Java reflection. + printer->Print( + "static {\n" + " com.google.protobuf.GeneratedMessageLite.registerDefaultInstance(\n" + " $classname$.class, DEFAULT_INSTANCE);\n" + "}\n", + "classname", descriptor_->name()); + } printer->Print( "public static $classname$ getDefaultInstance() {\n" " return DEFAULT_INSTANCE;\n" @@ -455,6 +498,17 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { "\n", "classname", name_resolver_->GetImmutableClassName(descriptor_)); + // 'of' method for Wrappers + if (IsWrappersProtoFile(descriptor_->file())) { + printer->Print( + "public static $classname$ of($field_type$ value) {\n" + " return newBuilder().setValue(value).build();\n" + "}\n" + "\n", + "classname", name_resolver_->GetImmutableClassName(descriptor_), + "field_type", PrimitiveTypeName(GetJavaType(descriptor_->field(0)))); + } + GenerateParser(printer); // Extensions must be declared after the DEFAULT_INSTANCE is initialized @@ -469,6 +523,7 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { printer->Print("}\n\n"); } + // =================================================================== void ImmutableMessageLiteGenerator:: @@ -490,36 +545,34 @@ GenerateMessageSerializationMethods(io::Printer* printer) { if (HasPackedFields(descriptor_)) { // writeTo(CodedOutputStream output) might be invoked without // getSerializedSize() ever being called, but we need the memoized - // sizes in case this message has packed fields. Rather than emit checks for - // each packed field, just call getSerializedSize() up front. - // In most cases, getSerializedSize() will have already been called anyway - // by one of the wrapper writeTo() methods, making this call cheap. - printer->Print( - "getSerializedSize();\n"); + // sizes in case this message has packed fields. Rather than emit checks + // for each packed field, just call getSerializedSize() up front. In most + // cases, getSerializedSize() will have already been called anyway by one + // of the wrapper writeTo() methods, making this call cheap. + printer->Print("getSerializedSize();\n"); } if (descriptor_->extension_range_count() > 0) { if (descriptor_->options().message_set_wire_format()) { printer->Print( - "com.google.protobuf.GeneratedMessageLite\n" - " .ExtendableMessage<$classname$, $classname$.Builder>\n" - " .ExtensionWriter extensionWriter =\n" - " newMessageSetExtensionWriter();\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); + "com.google.protobuf.GeneratedMessageLite\n" + " .ExtendableMessage<$classname$, $classname$.Builder>\n" + " .ExtensionWriter extensionWriter =\n" + " newMessageSetExtensionWriter();\n", + "classname", name_resolver_->GetImmutableClassName(descriptor_)); } else { printer->Print( - "com.google.protobuf.GeneratedMessageLite\n" - " .ExtendableMessage<$classname$, $classname$.Builder>\n" - " .ExtensionWriter extensionWriter =\n" - " newExtensionWriter();\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); + "com.google.protobuf.GeneratedMessageLite\n" + " .ExtendableMessage<$classname$, $classname$.Builder>\n" + " .ExtensionWriter extensionWriter =\n" + " newExtensionWriter();\n", + "classname", name_resolver_->GetImmutableClassName(descriptor_)); } } // Merge the fields and the extension ranges, both sorted by field number. for (int i = 0, j = 0; - i < descriptor_->field_count() || j < sorted_extensions.size(); - ) { + i < descriptor_->field_count() || j < sorted_extensions.size();) { if (i == descriptor_->field_count()) { GenerateSerializeOneExtensionRange(printer, sorted_extensions[j++]); } else if (j == sorted_extensions.size()) { @@ -532,23 +585,22 @@ GenerateMessageSerializationMethods(io::Printer* printer) { } if (descriptor_->options().message_set_wire_format()) { - printer->Print( - "unknownFields.writeAsMessageSetTo(output);\n"); + printer->Print("unknownFields.writeAsMessageSetTo(output);\n"); } else { - printer->Print( - "unknownFields.writeTo(output);\n"); + printer->Print("unknownFields.writeTo(output);\n"); } printer->Outdent(); printer->Print( - "}\n" - "\n" - "public int getSerializedSize() {\n" - " int size = memoizedSerializedSize;\n" - " if (size != -1) return size;\n" - "\n" - " size = 0;\n"); + "}\n" + "\n" + "public int getSerializedSize() {\n" + " int size = memoizedSerializedSize;\n" + " if (size != -1) return size;\n" + "\n"); printer->Indent(); + printer->Print( + "size = 0;\n"); for (int i = 0; i < descriptor_->field_count(); i++) { field_generators_.get(sorted_fields[i]).GenerateSerializedSizeCode(printer); @@ -556,26 +608,24 @@ GenerateMessageSerializationMethods(io::Printer* printer) { if (descriptor_->extension_range_count() > 0) { if (descriptor_->options().message_set_wire_format()) { - printer->Print( - "size += extensionsSerializedSizeAsMessageSet();\n"); + printer->Print("size += extensionsSerializedSizeAsMessageSet();\n"); } else { - printer->Print( - "size += extensionsSerializedSize();\n"); + printer->Print("size += extensionsSerializedSize();\n"); } } if (descriptor_->options().message_set_wire_format()) { - printer->Print( - "size += unknownFields.getSerializedSizeAsMessageSet();\n"); + printer->Print("size += unknownFields.getSerializedSizeAsMessageSet();\n"); } else { - printer->Print( - "size += unknownFields.getSerializedSize();\n"); + printer->Print("size += unknownFields.getSerializedSize();\n"); } + printer->Print( + "memoizedSerializedSize = size;\n" + "return size;\n"); + printer->Outdent(); printer->Print( - " memoizedSerializedSize = size;\n" - " return size;\n" "}\n" "\n"); } @@ -680,10 +730,10 @@ void ImmutableMessageLiteGenerator::GenerateSerializeOneExtensionRange( void ImmutableMessageLiteGenerator::GenerateBuilder(io::Printer* printer) { printer->Print( "public static Builder newBuilder() {\n" - " return DEFAULT_INSTANCE.toBuilder();\n" + " return (Builder) DEFAULT_INSTANCE.createBuilder();\n" "}\n" "public static Builder newBuilder($classname$ prototype) {\n" - " return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);\n" + " return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);\n" "}\n" "\n", "classname", name_resolver_->GetImmutableClassName(descriptor_)); @@ -702,7 +752,10 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodIsInitialized( return; } - // Don't directly compare to -1 to avoid an Android x86 JIT bug. + // TODO(xiaofeng): Remove this when b/64445758 is fixed. We don't need to + // check memoizedIsInitialized here because the caller does that already, + // but right now proguard proto shrinker asserts on the bytecode layout of + // this code so it can't be removed until proguard is updated. printer->Print( "byte isInitialized = memoizedIsInitialized;\n" "if (isInitialized == 1) return DEFAULT_INSTANCE;\n" @@ -720,9 +773,6 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodIsInitialized( if (field->is_required()) { printer->Print( "if (!has$name$()) {\n" - " if (shouldMemoize) {\n" - " memoizedIsInitialized = 0;\n" - " }\n" " return null;\n" "}\n", "name", info->capitalized_name); @@ -739,9 +789,6 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodIsInitialized( case FieldDescriptor::LABEL_REQUIRED: printer->Print( "if (!get$name$().isInitialized()) {\n" - " if (shouldMemoize) {\n" - " memoizedIsInitialized = 0;\n" - " }\n" " return null;\n" "}\n", "type", name_resolver_->GetImmutableClassName( @@ -765,9 +812,6 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodIsInitialized( } printer->Print( " if (!get$name$().isInitialized()) {\n" - " if (shouldMemoize) {\n" - " memoizedIsInitialized = 0;\n" - " }\n" " return null;\n" " }\n" "}\n", @@ -778,9 +822,6 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodIsInitialized( printer->Print( "for ($type$ item : get$name$Map().values()) {\n" " if (!item.isInitialized()) {\n" - " if (shouldMemoize) {\n" - " memoizedIsInitialized = 0;\n" - " }\n" " return null;\n" " }\n" "}\n", @@ -791,9 +832,6 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodIsInitialized( printer->Print( "for (int i = 0; i < get$name$Count(); i++) {\n" " if (!get$name$(i).isInitialized()) {\n" - " if (shouldMemoize) {\n" - " memoizedIsInitialized = 0;\n" - " }\n" " return null;\n" " }\n" "}\n", @@ -809,17 +847,11 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodIsInitialized( if (descriptor_->extension_range_count() > 0) { printer->Print( "if (!extensionsAreInitialized()) {\n" - " if (shouldMemoize) {\n" - " memoizedIsInitialized = 0;\n" - " }\n" " return null;\n" "}\n"); } printer->Print( - "if (shouldMemoize) memoizedIsInitialized = 1;\n"); - - printer->Print( "return DEFAULT_INSTANCE;\n" "\n"); } @@ -946,99 +978,107 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodMergeFromStream( "com.google.protobuf.CodedInputStream input =\n" " (com.google.protobuf.CodedInputStream) arg0;\n" "com.google.protobuf.ExtensionRegistryLite extensionRegistry =\n" - " (com.google.protobuf.ExtensionRegistryLite) arg1;\n"); + " (com.google.protobuf.ExtensionRegistryLite) arg1;\n" + "if (extensionRegistry == null) {\n" + " throw new java.lang.NullPointerException();\n" + "}\n"); printer->Print( "try {\n"); printer->Indent(); - printer->Print( - "boolean done = false;\n" - "while (!done) {\n"); - printer->Indent(); - - printer->Print( - "int tag = input.readTag();\n" - "switch (tag) {\n"); - printer->Indent(); + if (EnableExperimentalRuntime(context_)) { + printer->Print( + "mergeFromInternal(input, extensionRegistry);\n" + "return DEFAULT_INSTANCE;\n"); + } else { + printer->Print( + "boolean done = false;\n" + "while (!done) {\n"); + printer->Indent(); - printer->Print( - "case 0:\n" // zero signals EOF / limit reached - " done = true;\n" - " break;\n"); + printer->Print( + "int tag = input.readTag();\n" + "switch (tag) {\n"); + printer->Indent(); - if (descriptor_->extension_range_count() > 0) { - if (descriptor_->options().message_set_wire_format()) { - printer->Print( - "default: {\n" - " if (!parseUnknownFieldAsMessageSet(\n" - " getDefaultInstanceForType(), input, extensionRegistry,\n" - " tag)) {\n" - " done = true;\n" // it's an endgroup tag - " }\n" - " break;\n" - "}\n"); + printer->Print( + "case 0:\n" // zero signals EOF / limit reached + " done = true;\n" + " break;\n"); + + if (descriptor_->extension_range_count() > 0) { + if (descriptor_->options().message_set_wire_format()) { + printer->Print( + "default: {\n" + " if (!parseUnknownFieldAsMessageSet(\n" + " getDefaultInstanceForType(), input, extensionRegistry,\n" + " tag)) {\n" + " done = true;\n" // it's an endgroup tag + " }\n" + " break;\n" + "}\n"); + } else { + printer->Print( + "default: {\n" + " if (!parseUnknownField(getDefaultInstanceForType(),\n" + " input, extensionRegistry, tag)) {\n" + " done = true;\n" // it's an endgroup tag + " }\n" + " break;\n" + "}\n"); + } } else { printer->Print( "default: {\n" - " if (!parseUnknownField(getDefaultInstanceForType(),\n" - " input, extensionRegistry, tag)) {\n" + " if (!parseUnknownField(tag, input)) {\n" " done = true;\n" // it's an endgroup tag " }\n" " break;\n" "}\n"); } - } else { - printer->Print( - "default: {\n" - " if (!parseUnknownField(tag, input)) {\n" - " done = true;\n" // it's an endgroup tag - " }\n" - " break;\n" - "}\n"); - } - - google::protobuf::scoped_array<const FieldDescriptor * > sorted_fields( - SortFieldsByNumber(descriptor_)); - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = sorted_fields[i]; - uint32 tag = WireFormatLite::MakeTag(field->number(), - WireFormat::WireTypeForFieldType(field->type())); - printer->Print( - "case $tag$: {\n", - "tag", SimpleItoa(static_cast<int32>(tag))); - printer->Indent(); - - field_generators_.get(field).GenerateParsingCode(printer); - - printer->Outdent(); - printer->Print( - " break;\n" - "}\n"); + google::protobuf::scoped_array<const FieldDescriptor* > sorted_fields( + SortFieldsByNumber(descriptor_)); + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = sorted_fields[i]; + uint32 tag = WireFormatLite::MakeTag( + field->number(), WireFormat::WireTypeForFieldType(field->type())); - if (field->is_packable()) { - // To make packed = true wire compatible, we generate parsing code from a - // packed version of this field regardless of field->options().packed(). - uint32 packed_tag = WireFormatLite::MakeTag(field->number(), - WireFormatLite::WIRETYPE_LENGTH_DELIMITED); - printer->Print( - "case $tag$: {\n", - "tag", SimpleItoa(static_cast<int32>(packed_tag))); + printer->Print("case $tag$: {\n", "tag", + SimpleItoa(static_cast<int32>(tag))); printer->Indent(); - field_generators_.get(field).GenerateParsingCodeFromPacked(printer); + field_generators_.get(field).GenerateParsingCode(printer); printer->Outdent(); printer->Print( " break;\n" "}\n"); + + if (field->is_packable()) { + // To make packed = true wire compatible, we generate parsing code from + // a packed version of this field regardless of + // field->options().packed(). + uint32 packed_tag = WireFormatLite::MakeTag( + field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED); + printer->Print("case $tag$: {\n", "tag", + SimpleItoa(static_cast<int32>(packed_tag))); + printer->Indent(); + + field_generators_.get(field).GenerateParsingCodeFromPacked(printer); + + printer->Outdent(); + printer->Print( + " break;\n" + "}\n"); + } } - } - printer->Outdent(); - printer->Outdent(); - printer->Print( - " }\n" // switch (tag) - "}\n"); // while (!done) + printer->Outdent(); + printer->Outdent(); + printer->Print( + " }\n" // switch (tag) + "}\n"); // while (!done) + } printer->Outdent(); printer->Print( diff --git a/src/google/protobuf/compiler/java/java_shared_code_generator.cc b/src/google/protobuf/compiler/java/java_shared_code_generator.cc index f73bfb04..9a42aba9 100644 --- a/src/google/protobuf/compiler/java/java_shared_code_generator.cc +++ b/src/google/protobuf/compiler/java/java_shared_code_generator.cc @@ -140,13 +140,16 @@ void SharedCodeGenerator::GenerateDescriptors(io::Printer* printer) { "java.lang.String[] descriptorData = {\n"); printer->Indent(); - // Only write 40 bytes per line. + // Limit the number of bytes per line. static const int kBytesPerLine = 40; + // Limit the number of lines per string part. + static const int kLinesPerPart = 400; + // Every block of bytes, start a new string literal, in order to avoid the + // 64k length limit. Note that this value needs to be <64k. + static const int kBytesPerPart = kBytesPerLine * kLinesPerPart; for (int i = 0; i < file_data.size(); i += kBytesPerLine) { if (i > 0) { - // Every 400 lines, start a new string literal, in order to avoid the - // 64k length limit. - if (i % 400 == 0) { + if (i % kBytesPerPart == 0) { printer->Print(",\n"); } else { printer->Print(" +\n"); diff --git a/src/google/protobuf/compiler/js/js_generator.cc b/src/google/protobuf/compiler/js/js_generator.cc index 73d32762..16fe19ad 100755 --- a/src/google/protobuf/compiler/js/js_generator.cc +++ b/src/google/protobuf/compiler/js/js_generator.cc @@ -244,22 +244,35 @@ string GetPrefix(const GeneratorOptions& options, return prefix; } +// Returns the fully normalized JavaScript path prefix for the given +// message descriptor. +string GetMessagePathPrefix(const GeneratorOptions& options, + const Descriptor* descriptor) { + return GetPrefix( + options, descriptor->file(), + descriptor->containing_type()); +} + // Returns the fully normalized JavaScript path for the given // message descriptor. string GetMessagePath(const GeneratorOptions& options, const Descriptor* descriptor) { - return GetPrefix( - options, descriptor->file(), - descriptor->containing_type()) + descriptor->name(); + return GetMessagePathPrefix(options, descriptor) + descriptor->name(); +} + +// Returns the fully normalized JavaScript path prefix for the given +// enumeration descriptor. +string GetEnumPathPrefix(const GeneratorOptions& options, + const EnumDescriptor* enum_descriptor) { + return GetPrefix(options, enum_descriptor->file(), + enum_descriptor->containing_type()); } // Returns the fully normalized JavaScript path for the given // enumeration descriptor. string GetEnumPath(const GeneratorOptions& options, const EnumDescriptor* enum_descriptor) { - return GetPrefix( - options, enum_descriptor->file(), - enum_descriptor->containing_type()) + enum_descriptor->name(); + return GetEnumPathPrefix(options, enum_descriptor) + enum_descriptor->name(); } string MaybeCrossFileRef(const GeneratorOptions& options, @@ -1082,6 +1095,40 @@ string JSReturnClause(const FieldDescriptor* desc) { return ""; } +string JSTypeTag(const FieldDescriptor* desc) { + switch (desc->type()) { + case FieldDescriptor::TYPE_DOUBLE: + case FieldDescriptor::TYPE_FLOAT: + return "Float"; + case FieldDescriptor::TYPE_INT32: + case FieldDescriptor::TYPE_UINT32: + case FieldDescriptor::TYPE_INT64: + case FieldDescriptor::TYPE_UINT64: + case FieldDescriptor::TYPE_FIXED32: + case FieldDescriptor::TYPE_FIXED64: + case FieldDescriptor::TYPE_SINT32: + case FieldDescriptor::TYPE_SINT64: + case FieldDescriptor::TYPE_SFIXED32: + case FieldDescriptor::TYPE_SFIXED64: + if (IsIntegralFieldWithStringJSType(desc)) { + return "StringInt"; + } else { + return "Int"; + } + case FieldDescriptor::TYPE_BOOL: + return "Boolean"; + case FieldDescriptor::TYPE_STRING: + return "String"; + case FieldDescriptor::TYPE_BYTES: + return "Bytes"; + case FieldDescriptor::TYPE_ENUM: + return "Enum"; + default: + assert(false); + } + return ""; +} + string JSReturnDoc(const GeneratorOptions& options, const FieldDescriptor* desc) { return ""; @@ -1896,8 +1943,10 @@ void Generator::GenerateClassConstructor(const GeneratorOptions& options, " * @extends {jspb.Message}\n" " * @constructor\n" " */\n" - "$classname$ = function(opt_data) {\n", - "classname", GetMessagePath(options, desc)); + "$classprefix$$classname$ = function(opt_data) {\n", + "classprefix", GetMessagePathPrefix(options, desc), + "classname", desc->name()); + printer->Annotate("classname", desc); string message_id = GetMessageId(desc); printer->Print( " jspb.Message.initialize(this, opt_data, $messageId$, $pivot$, " @@ -2379,12 +2428,13 @@ void Generator::GenerateClassField(const GeneratorOptions& options, "keytype", key_type, "valuetype", value_type); printer->Print( - "$class$.prototype.get$name$ = function(opt_noLazyCreate) {\n" + "$class$.prototype.$gettername$ = function(opt_noLazyCreate) {\n" " return /** @type {!jspb.Map<$keytype$,$valuetype$>} */ (\n", "class", GetMessagePath(options, field->containing_type()), - "name", JSGetterName(options, field), + "gettername", "get" + JSGetterName(options, field), "keytype", key_type, "valuetype", value_type); + printer->Annotate("gettername", field); printer->Print( " jspb.Message.getMapField(this, $index$, opt_noLazyCreate", "index", JSFieldIndex(field)); @@ -2423,7 +2473,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, /* force_present = */ false, /* singular_if_not_packed = */ false)); printer->Print( - "$class$.prototype.get$name$ = function() {\n" + "$class$.prototype.$gettername$ = function() {\n" " return /** @type{$type$} */ (\n" " jspb.Message.get$rpt$WrapperField(this, $wrapperclass$, " "$index$$required$));\n" @@ -2431,7 +2481,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, "\n" "\n", "class", GetMessagePath(options, field->containing_type()), - "name", JSGetterName(options, field), + "gettername", "get" + JSGetterName(options, field), "type", JSFieldTypeAnnotation(options, field, /* is_setter_argument = */ false, /* force_present = */ false, @@ -2441,9 +2491,10 @@ void Generator::GenerateClassField(const GeneratorOptions& options, "wrapperclass", SubmessageTypeRef(options, field), "required", (field->label() == FieldDescriptor::LABEL_REQUIRED ? ", 1" : "")); + printer->Annotate("gettername", field); printer->Print( "/** @param {$optionaltype$} value$returndoc$ */\n" - "$class$.prototype.set$name$ = function(value) {\n" + "$class$.prototype.$settername$ = function(value) {\n" " jspb.Message.set$oneoftag$$repeatedtag$WrapperField(", "optionaltype", JSFieldTypeAnnotation(options, field, @@ -2452,9 +2503,10 @@ void Generator::GenerateClassField(const GeneratorOptions& options, /* singular_if_not_packed = */ false), "returndoc", JSReturnDoc(options, field), "class", GetMessagePath(options, field->containing_type()), - "name", JSGetterName(options, field), + "settername", "set" + JSGetterName(options, field), "oneoftag", (field->containing_oneof() ? "Oneof" : ""), "repeatedtag", (field->is_repeated() ? "Repeated" : "")); + printer->Annotate("settername", field); printer->Print( "this, $index$$oneofgroup$, value);$returnvalue$\n" @@ -2506,9 +2558,10 @@ void Generator::GenerateClassField(const GeneratorOptions& options, } printer->Print( - "$class$.prototype.get$name$ = function() {\n", + "$class$.prototype.$gettername$ = function() {\n", "class", GetMessagePath(options, field->containing_type()), - "name", JSGetterName(options, field)); + "gettername", "get" + JSGetterName(options, field)); + printer->Annotate("gettername", field); if (untyped) { printer->Print( @@ -2569,26 +2622,47 @@ void Generator::GenerateClassField(const GeneratorOptions& options, /* singular_if_not_packed = */ false), "returndoc", JSReturnDoc(options, field)); } - printer->Print( - "$class$.prototype.set$name$ = function(value) {\n" - " jspb.Message.set$oneoftag$Field(this, $index$", - "class", GetMessagePath(options, field->containing_type()), - "name", JSGetterName(options, field), - "oneoftag", (field->containing_oneof() ? "Oneof" : ""), - "index", JSFieldIndex(field)); - printer->Print( - "$oneofgroup$, $type$value$rptvalueinit$$typeclose$);$returnvalue$\n" - "};\n" - "\n" - "\n", - "type", - untyped ? "/** @type{string|number|boolean|Array|undefined} */(" : "", - "typeclose", untyped ? ")" : "", - "oneofgroup", - (field->containing_oneof() ? (", " + JSOneofArray(options, field)) - : ""), - "returnvalue", JSReturnClause(field), "rptvalueinit", - (field->is_repeated() ? " || []" : "")); + + if (field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 && + !field->is_repeated() && !field->is_map() && + !HasFieldPresence(options, field)) { + // Proto3 non-repeated and non-map fields without presence use the + // setProto3*Field function. + printer->Print( + "$class$.prototype.$settername$ = function(value) {\n" + " jspb.Message.setProto3$typetag$Field(this, $index$, " + "value);$returnvalue$\n" + "};\n" + "\n" + "\n", + "class", GetMessagePath(options, field->containing_type()), + "settername", "set" + JSGetterName(options, field), "typetag", + JSTypeTag(field), "index", JSFieldIndex(field), "returnvalue", + JSReturnClause(field)); + printer->Annotate("settername", field); + } else { + // Otherwise, use the regular setField function. + printer->Print( + "$class$.prototype.$settername$ = function(value) {\n" + " jspb.Message.set$oneoftag$Field(this, $index$", + "class", GetMessagePath(options, field->containing_type()), + "settername", "set" + JSGetterName(options, field), "oneoftag", + (field->containing_oneof() ? "Oneof" : ""), "index", + JSFieldIndex(field)); + printer->Annotate("settername", field); + printer->Print( + "$oneofgroup$, $type$value$rptvalueinit$$typeclose$);$returnvalue$\n" + "};\n" + "\n" + "\n", + "type", + untyped ? "/** @type{string|number|boolean|Array|undefined} */(" : "", + "typeclose", untyped ? ")" : "", "oneofgroup", + (field->containing_oneof() ? (", " + JSOneofArray(options, field)) + : ""), + "returnvalue", JSReturnClause(field), "rptvalueinit", + (field->is_repeated() ? " || []" : "")); + } if (untyped) { printer->Print( @@ -2608,41 +2682,46 @@ void Generator::GenerateClassField(const GeneratorOptions& options, // fields with presence. if (IsMap(options, field)) { printer->Print( - "$class$.prototype.clear$name$ = function() {\n" - " this.get$name$().clear();$returnvalue$\n" + "$class$.prototype.$clearername$ = function() {\n" + " this.$gettername$().clear();$returnvalue$\n" "};\n" "\n" "\n", "class", GetMessagePath(options, field->containing_type()), - "name", JSGetterName(options, field), + "clearername", "clear" + JSGetterName(options, field), + "gettername", "get" + JSGetterName(options, field), "returnvalue", JSReturnClause(field)); + printer->Annotate("clearername", field); } else if (field->is_repeated() || (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && !field->is_required())) { // Fields where we can delegate to the regular setter. printer->Print( - "$class$.prototype.clear$name$ = function() {\n" - " this.set$name$($clearedvalue$);$returnvalue$\n" + "$class$.prototype.$clearername$ = function() {\n" + " this.$settername$($clearedvalue$);$returnvalue$\n" "};\n" "\n" "\n", "class", GetMessagePath(options, field->containing_type()), - "name", JSGetterName(options, field), + "clearername", "clear" + JSGetterName(options, field), + "settername", "set" + JSGetterName(options, field), "clearedvalue", (field->is_repeated() ? "[]" : "undefined"), "returnvalue", JSReturnClause(field)); + printer->Annotate("clearername", field); } else if (HasFieldPresence(options, field)) { // Fields where we can't delegate to the regular setter because it doesn't // accept "undefined" as an argument. printer->Print( - "$class$.prototype.clear$name$ = function() {\n" + "$class$.prototype.$clearername$ = function() {\n" " jspb.Message.set$maybeoneof$Field(this, " "$index$$maybeoneofgroup$, ", "class", GetMessagePath(options, field->containing_type()), - "name", JSGetterName(options, field), + "clearername", "clear" + JSGetterName(options, field), "maybeoneof", (field->containing_oneof() ? "Oneof" : ""), "maybeoneofgroup", (field->containing_oneof() ? (", " + JSOneofArray(options, field)) : ""), "index", JSFieldIndex(field)); + printer->Annotate("clearername", field); printer->Print( "$clearedvalue$);$returnvalue$\n" "};\n" @@ -2658,14 +2737,15 @@ void Generator::GenerateClassField(const GeneratorOptions& options, " * Returns whether this field is set.\n" " * @return {!boolean}\n" " */\n" - "$class$.prototype.has$name$ = function() {\n" + "$class$.prototype.$hasername$ = function() {\n" " return jspb.Message.getField(this, $index$) != null;\n" "};\n" "\n" "\n", "class", GetMessagePath(options, field->containing_type()), - "name", JSGetterName(options, field), + "hasername", "has" + JSGetterName(options, field), "index", JSFieldIndex(field)); + printer->Annotate("hasername", field); } } @@ -2677,13 +2757,14 @@ void Generator::GenerateRepeatedPrimitiveHelperMethods( " * @param {!$optionaltype$} value\n" " * @param {number=} opt_index\n" " */\n" - "$class$.prototype.add$name$ = function(value, opt_index) {\n" + "$class$.prototype.$addername$ = function(value, opt_index) {\n" " jspb.Message.addToRepeatedField(this, $index$", - "class", GetMessagePath(options, field->containing_type()), - "name", JSGetterName(options, field, BYTES_DEFAULT, - /* drop_list = */ true), + "class", GetMessagePath(options, field->containing_type()), "addername", + "add" + JSGetterName(options, field, BYTES_DEFAULT, + /* drop_list = */ true), "optionaltype", JSTypeName(options, field, BYTES_DEFAULT), "index", JSFieldIndex(field)); + printer->Annotate("addername", field); printer->Print( "$oneofgroup$, $type$value$rptvalueinit$$typeclose$, opt_index);\n" "};\n" @@ -3081,8 +3162,10 @@ void Generator::GenerateEnum(const GeneratorOptions& options, "/**\n" " * @enum {number}\n" " */\n" - "$name$ = {\n", - "name", GetEnumPath(options, enumdesc)); + "$enumprefix$$name$ = {\n", + "enumprefix", GetEnumPathPrefix(options, enumdesc), + "name", enumdesc->name()); + printer->Annotate("name", enumdesc); for (int i = 0; i < enumdesc->value_count(); i++) { const EnumValueDescriptor* value = enumdesc->value(i); @@ -3091,6 +3174,7 @@ void Generator::GenerateEnum(const GeneratorOptions& options, "name", ToEnumCase(value->name()), "value", SimpleItoa(value->number()), "comma", (i == enumdesc->value_count() - 1) ? "" : ","); + printer->Annotate("name", value); } printer->Print( @@ -3230,6 +3314,12 @@ bool GeneratorOptions::ParseFromOptions( return false; } one_output_file_per_input_file = true; + } else if (options[i].first == "annotate_code") { + if (!options[i].second.empty()) { + *error = "Unexpected option value for annotate_code"; + return false; + } + annotate_code = true; } else { // Assume any other option is an output directory, as long as it is a bare // `key` rather than a `key=value` option. @@ -3530,16 +3620,27 @@ bool Generator::GenerateAll(const std::vector<const FileDescriptor*>& files, options.output_dir + "/" + GetJSFilename(options, file->name()); google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(context->Open(filename)); GOOGLE_CHECK(output.get()); - io::Printer printer(output.get(), '$'); + GeneratedCodeInfo annotations; + io::AnnotationProtoCollector<GeneratedCodeInfo> annotation_collector( + &annotations); + io::Printer printer(output.get(), '$', + options.annotate_code ? &annotation_collector : NULL); + GenerateFile(options, &printer, file); if (printer.failed()) { return false; } + + if (options.annotate_code) { + const string meta_file = filename + ".meta"; + google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> info_output( + context->Open(meta_file)); + annotations.SerializeToZeroCopyStream(info_output.get()); + } } } - return true; } diff --git a/src/google/protobuf/compiler/js/js_generator.h b/src/google/protobuf/compiler/js/js_generator.h index 6e932d7f..3cc60e22 100755 --- a/src/google/protobuf/compiler/js/js_generator.h +++ b/src/google/protobuf/compiler/js/js_generator.h @@ -79,7 +79,8 @@ struct GeneratorOptions { library(""), error_on_name_conflict(false), extension(".js"), - one_output_file_per_input_file(false) {} + one_output_file_per_input_file(false), + annotate_code(false) {} bool ParseFromOptions( const std::vector< std::pair< string, string > >& options, @@ -118,6 +119,9 @@ struct GeneratorOptions { string extension; // Create a separate output file for each input file? bool one_output_file_per_input_file; + // If true, we should build .meta files that contain annotations for + // generated code. See GeneratedCodeInfo in descriptor.proto. + bool annotate_code; }; // CodeGenerator implementation which generates a JavaScript source file and diff --git a/src/google/protobuf/compiler/mock_code_generator.cc b/src/google/protobuf/compiler/mock_code_generator.cc index cc660f4a..bfcb83df 100644 --- a/src/google/protobuf/compiler/mock_code_generator.cc +++ b/src/google/protobuf/compiler/mock_code_generator.cc @@ -57,12 +57,12 @@ #include <google/protobuf/stubs/substitute.h> #include <gtest/gtest.h> -#ifdef major -#undef major -#endif -#ifdef minor -#undef minor -#endif +#ifdef major +#undef major +#endif +#ifdef minor +#undef minor +#endif namespace google { namespace protobuf { diff --git a/src/google/protobuf/compiler/parser.cc b/src/google/protobuf/compiler/parser.cc index bb4a44c3..03d05ad4 100644 --- a/src/google/protobuf/compiler/parser.cc +++ b/src/google/protobuf/compiler/parser.cc @@ -1540,7 +1540,6 @@ bool Parser::ParseReserved(DescriptorProto* message, } } - bool Parser::ParseReservedNames(DescriptorProto* message, const LocationRecorder& parent_location) { do { @@ -1601,6 +1600,81 @@ bool Parser::ParseReservedNumbers(DescriptorProto* message, return true; } +bool Parser::ParseReserved(EnumDescriptorProto* message, + const LocationRecorder& message_location) { + // Parse the declaration. + DO(Consume("reserved")); + if (LookingAtType(io::Tokenizer::TYPE_STRING)) { + LocationRecorder location(message_location, + DescriptorProto::kReservedNameFieldNumber); + return ParseReservedNames(message, location); + } else { + LocationRecorder location(message_location, + DescriptorProto::kReservedRangeFieldNumber); + return ParseReservedNumbers(message, location); + } +} + +bool Parser::ParseReservedNames(EnumDescriptorProto* message, + const LocationRecorder& parent_location) { + do { + LocationRecorder location(parent_location, message->reserved_name_size()); + DO(ConsumeString(message->add_reserved_name(), "Expected enum value.")); + } while (TryConsume(",")); + DO(ConsumeEndOfDeclaration(";", &parent_location)); + return true; +} + +bool Parser::ParseReservedNumbers(EnumDescriptorProto* message, + const LocationRecorder& parent_location) { + bool first = true; + do { + LocationRecorder location(parent_location, message->reserved_range_size()); + + EnumDescriptorProto::EnumReservedRange* range = + message->add_reserved_range(); + int start, end; + io::Tokenizer::Token start_token; + { + LocationRecorder start_location( + location, EnumDescriptorProto::EnumReservedRange::kStartFieldNumber); + start_token = input_->current(); + DO(ConsumeSignedInteger(&start, (first ? + "Expected enum value or number range." : + "Expected enum number range."))); + } + + if (TryConsume("to")) { + LocationRecorder end_location( + location, EnumDescriptorProto::EnumReservedRange::kEndFieldNumber); + if (TryConsume("max")) { + // This is in the enum descriptor path, which doesn't have the message + // set duality to fix up, so it doesn't integrate with the sentinel. + + // Evaluate 'max' to INT_MAX - 1 so that incrementing to create the + // exclusive range end doesn't cause an overflow. + // Note, this prevents reserving the actual INT_MAX enum value. + end = INT_MAX; + } else { + DO(ConsumeSignedInteger(&end, "Expected integer.")); + } + } else { + LocationRecorder end_location( + location, EnumDescriptorProto::EnumReservedRange::kEndFieldNumber); + end_location.StartAt(start_token); + end_location.EndAt(start_token); + end = start; + } + + range->set_start(start); + range->set_end(end); + first = false; + } while (TryConsume(",")); + + DO(ConsumeEndOfDeclaration(";", &parent_location)); + return true; +} + bool Parser::ParseExtend(RepeatedPtrField<FieldDescriptorProto>* extensions, RepeatedPtrField<DescriptorProto>* messages, const LocationRecorder& parent_location, @@ -1781,6 +1855,8 @@ bool Parser::ParseEnumStatement(EnumDescriptorProto* enum_type, EnumDescriptorProto::kOptionsFieldNumber); return ParseOption(enum_type->mutable_options(), location, containing_file, OPTION_STATEMENT); + } else if (LookingAt("reserved")) { + return ParseReserved(enum_type, enum_location); } else { LocationRecorder location(enum_location, EnumDescriptorProto::kValueFieldNumber, enum_type->value_size()); @@ -2167,4 +2243,5 @@ void SourceLocationTable::Clear() { } // namespace compiler } // namespace protobuf + } // namespace google diff --git a/src/google/protobuf/compiler/parser.h b/src/google/protobuf/compiler/parser.h index dd8b6586..33b4c700 100644 --- a/src/google/protobuf/compiler/parser.h +++ b/src/google/protobuf/compiler/parser.h @@ -371,6 +371,12 @@ class LIBPROTOBUF_EXPORT Parser { const LocationRecorder& parent_location); bool ParseReservedNumbers(DescriptorProto* message, const LocationRecorder& parent_location); + bool ParseReserved(EnumDescriptorProto* message, + const LocationRecorder& message_location); + bool ParseReservedNames(EnumDescriptorProto* message, + const LocationRecorder& parent_location); + bool ParseReservedNumbers(EnumDescriptorProto* message, + const LocationRecorder& parent_location); // Parse an "extend" declaration. (See also comments for // ParseMessageField().) diff --git a/src/google/protobuf/compiler/parser_unittest.cc b/src/google/protobuf/compiler/parser_unittest.cc index 97831f71..9b59842e 100644 --- a/src/google/protobuf/compiler/parser_unittest.cc +++ b/src/google/protobuf/compiler/parser_unittest.cc @@ -994,6 +994,42 @@ TEST_F(ParseEnumTest, ValueOptions) { "}"); } +TEST_F(ParseEnumTest, ReservedRange) { + ExpectParsesTo( + "enum TestEnum {\n" + " FOO = 0;\n" + " reserved -2147483648, -6 to -4, -1 to 1, 2, 15, 9 to 11, 3, 20 to max;\n" + "}\n", + + "enum_type {" + " name: \"TestEnum\"" + " value { name:\"FOO\" number:0 }" + " reserved_range { start:-2147483648 end:-2147483648 }" + " reserved_range { start:-6 end:-4 }" + " reserved_range { start:-1 end:1 }" + " reserved_range { start:2 end:2 }" + " reserved_range { start:15 end:15 }" + " reserved_range { start:9 end:11 }" + " reserved_range { start:3 end:3 }" + " reserved_range { start:20 end:2147483647 }" + "}"); +} + +TEST_F(ParseEnumTest, ReservedNames) { + ExpectParsesTo( + "enum TestEnum {\n" + " FOO = 0;\n" + " reserved \"foo\", \"bar\";\n" + "}\n", + + "enum_type {" + " name: \"TestEnum\"" + " value { name:\"FOO\" number:0 }" + " reserved_name: \"foo\"" + " reserved_name: \"bar\"" + "}"); +} + // =================================================================== typedef ParserTest ParseServiceTest; @@ -1488,6 +1524,51 @@ TEST_F(ParseErrorTest, EnumValueMissingNumber) { "1:5: Missing numeric value for enum constant.\n"); } +TEST_F(ParseErrorTest, EnumReservedStandaloneMaxNotAllowed) { + ExpectHasErrors( + "enum TestEnum {\n" + " FOO = 1;\n" + " reserved max;\n" + "}\n", + "2:11: Expected enum value or number range.\n"); +} + +TEST_F(ParseErrorTest, EnumReservedMixNameAndNumber) { + ExpectHasErrors( + "enum TestEnum {\n" + " FOO = 1;\n" + " reserved 10, \"foo\";\n" + "}\n", + "2:15: Expected enum number range.\n"); +} + +TEST_F(ParseErrorTest, EnumReservedPositiveNumberOutOfRange) { + ExpectHasErrors( + "enum TestEnum {\n" + "FOO = 1;\n" + " reserved 2147483648;\n" + "}\n", + "2:11: Integer out of range.\n"); +} + +TEST_F(ParseErrorTest, EnumReservedNegativeNumberOutOfRange) { + ExpectHasErrors( + "enum TestEnum {\n" + "FOO = 1;\n" + " reserved -2147483649;\n" + "}\n", + "2:12: Integer out of range.\n"); +} + +TEST_F(ParseErrorTest, EnumReservedMissingQuotes) { + ExpectHasErrors( + "enum TestEnum {\n" + " FOO = 1;\n" + " reserved foo;\n" + "}\n", + "2:11: Expected enum value or number range.\n"); +} + // ------------------------------------------------------------------- // Reserved field number errors @@ -1515,6 +1596,23 @@ TEST_F(ParseErrorTest, ReservedMissingQuotes) { "1:11: Expected field name or number range.\n"); } +TEST_F(ParseErrorTest, ReservedNegativeNumber) { + ExpectHasErrors( + "message Foo {\n" + " reserved -10;\n" + "}\n", + "1:11: Expected field name or number range.\n"); +} + +TEST_F(ParseErrorTest, ReservedNumberOutOfRange) { + ExpectHasErrors( + "message Foo {\n" + " reserved 2147483648;\n" + "}\n", + "1:11: Integer out of range.\n"); +} + + // ------------------------------------------------------------------- // Service errors diff --git a/src/google/protobuf/compiler/plugin.cc b/src/google/protobuf/compiler/plugin.cc index cb5e37bb..7f975510 100644 --- a/src/google/protobuf/compiler/plugin.cc +++ b/src/google/protobuf/compiler/plugin.cc @@ -41,13 +41,18 @@ #include <unistd.h> #endif -#include <google/protobuf/stubs/io_win32.h> #include <google/protobuf/stubs/logging.h> #include <google/protobuf/stubs/common.h> #include <google/protobuf/compiler/plugin.pb.h> #include <google/protobuf/compiler/code_generator.h> #include <google/protobuf/descriptor.h> #include <google/protobuf/io/zero_copy_stream_impl.h> +#include <google/protobuf/stubs/io_win32.h> + + +namespace google { +namespace protobuf { +namespace compiler { #if defined(_MSC_VER) // DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import @@ -55,10 +60,6 @@ using google::protobuf::internal::win32::setmode; #endif -namespace google { -namespace protobuf { -namespace compiler { - class GeneratorResponseContext : public GeneratorContext { public: GeneratorResponseContext( diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index 07883a37..80c8c625 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/compiler/plugin.proto -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #include <google/protobuf/compiler/plugin.pb.h> #include <algorithm> @@ -15,122 +14,189 @@ #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> +// This is a temporary google only hack +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS +#include "third_party/protobuf/version.h" +#endif // @@protoc_insertion_point(includes) - namespace google { namespace protobuf { namespace compiler { class VersionDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<Version> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<Version> + _instance; } _Version_default_instance_; class CodeGeneratorRequestDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<CodeGeneratorRequest> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<CodeGeneratorRequest> + _instance; } _CodeGeneratorRequest_default_instance_; class CodeGeneratorResponse_FileDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<CodeGeneratorResponse_File> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<CodeGeneratorResponse_File> + _instance; } _CodeGeneratorResponse_File_default_instance_; class CodeGeneratorResponseDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<CodeGeneratorResponse> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<CodeGeneratorResponse> + _instance; } _CodeGeneratorResponse_default_instance_; - +} // namespace compiler +} // namespace protobuf +} // namespace google namespace protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto { +void InitDefaultsVersionImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::compiler::_Version_default_instance_; + new (ptr) ::google::protobuf::compiler::Version(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::compiler::Version::InitAsDefaultInstance(); +} -namespace { +void InitDefaultsVersion() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsVersionImpl); +} -::google::protobuf::Metadata file_level_metadata[4]; +void InitDefaultsCodeGeneratorRequestImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; -} // namespace +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFileDescriptorProto(); + protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaultsVersion(); + { + void* ptr = &::google::protobuf::compiler::_CodeGeneratorRequest_default_instance_; + new (ptr) ::google::protobuf::compiler::CodeGeneratorRequest(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::compiler::CodeGeneratorRequest::InitAsDefaultInstance(); +} -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField - const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0}, -}; +void InitDefaultsCodeGeneratorRequest() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsCodeGeneratorRequestImpl); +} -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField - const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - ::google::protobuf::internal::AuxillaryParseTableField(), -}; -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const - TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, -}; +void InitDefaultsCodeGeneratorResponse_FileImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; -const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Version, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Version, _internal_metadata_), +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::compiler::_CodeGeneratorResponse_File_default_instance_; + new (ptr) ::google::protobuf::compiler::CodeGeneratorResponse_File(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::compiler::CodeGeneratorResponse_File::InitAsDefaultInstance(); +} + +void InitDefaultsCodeGeneratorResponse_File() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsCodeGeneratorResponse_FileImpl); +} + +void InitDefaultsCodeGeneratorResponseImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaultsCodeGeneratorResponse_File(); + { + void* ptr = &::google::protobuf::compiler::_CodeGeneratorResponse_default_instance_; + new (ptr) ::google::protobuf::compiler::CodeGeneratorResponse(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::compiler::CodeGeneratorResponse::InitAsDefaultInstance(); +} + +void InitDefaultsCodeGeneratorResponse() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsCodeGeneratorResponseImpl); +} + +::google::protobuf::Metadata file_level_metadata[4]; + +const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::Version, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::Version, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Version, major_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Version, minor_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Version, patch_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Version, suffix_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::Version, major_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::Version, minor_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::Version, patch_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::Version, suffix_), 1, 2, 3, 0, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorRequest, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorRequest, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorRequest, file_to_generate_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorRequest, parameter_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorRequest, proto_file_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorRequest, compiler_version_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, file_to_generate_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, parameter_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, proto_file_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, compiler_version_), ~0u, 0, ~0u, 1, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse_File, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse_File, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse_File, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse_File, insertion_point_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse_File, content_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, insertion_point_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, content_), 0, 1, 2, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse, error_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CodeGeneratorResponse, file_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse, error_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse, file_), 0, ~0u, }; -static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { 0, 9, sizeof(Version)}, - { 13, 22, sizeof(CodeGeneratorRequest)}, - { 26, 34, sizeof(CodeGeneratorResponse_File)}, - { 37, 44, sizeof(CodeGeneratorResponse)}, +static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + { 0, 9, sizeof(::google::protobuf::compiler::Version)}, + { 13, 22, sizeof(::google::protobuf::compiler::CodeGeneratorRequest)}, + { 26, 34, sizeof(::google::protobuf::compiler::CodeGeneratorResponse_File)}, + { 37, 44, sizeof(::google::protobuf::compiler::CodeGeneratorResponse)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { - reinterpret_cast<const ::google::protobuf::Message*>(&_Version_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_CodeGeneratorRequest_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_CodeGeneratorResponse_File_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_CodeGeneratorResponse_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::compiler::_Version_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::compiler::_CodeGeneratorRequest_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::compiler::_CodeGeneratorResponse_File_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::compiler::_CodeGeneratorResponse_default_instance_), }; -namespace { - void protobuf_AssignDescriptors() { AddDescriptors(); ::google::protobuf::MessageFactory* factory = NULL; @@ -144,38 +210,15 @@ void protobuf_AssignDescriptorsOnce() { ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); } -void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; +void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 4); } -} // namespace -void TableStruct::InitDefaultsImpl() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::internal::InitProtobufDefaults(); - ::google::protobuf::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); - _Version_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_Version_default_instance_);_CodeGeneratorRequest_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_CodeGeneratorRequest_default_instance_);_CodeGeneratorResponse_File_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_CodeGeneratorResponse_File_default_instance_);_CodeGeneratorResponse_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_CodeGeneratorResponse_default_instance_);_CodeGeneratorRequest_default_instance_._instance.get_mutable()->compiler_version_ = const_cast< ::google::protobuf::compiler::Version*>( - ::google::protobuf::compiler::Version::internal_default_instance()); -} - -void InitDefaults() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl); -} -namespace { void AddDescriptorsImpl() { InitDefaults(); - static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { "\n%google/protobuf/compiler/plugin.proto\022" "\030google.protobuf.compiler\032 google/protob" "uf/descriptor.proto\"F\n\007Version\022\r\n\005major\030" @@ -197,9 +240,8 @@ void AddDescriptorsImpl() { descriptor, 638); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/compiler/plugin.proto", &protobuf_RegisterTypes); - ::google::protobuf::protobuf_google_2fprotobuf_2fdescriptor_2eproto::AddDescriptors(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::AddDescriptors(); } -} // anonymous namespace void AddDescriptors() { static GOOGLE_PROTOBUF_DECLARE_ONCE(once); @@ -211,12 +253,15 @@ struct StaticDescriptorInitializer { AddDescriptors(); } } static_descriptor_initializer; - } // namespace protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto - +namespace google { +namespace protobuf { +namespace compiler { // =================================================================== +void Version::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int Version::kMajorFieldNumber; const int Version::kMinorFieldNumber; @@ -227,7 +272,7 @@ const int Version::kSuffixFieldNumber; Version::Version() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaultsVersion(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.compiler.Version) @@ -271,12 +316,12 @@ void Version::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* Version::descriptor() { - protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const Version& Version::default_instance() { - protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaultsVersion(); return *internal_default_instance(); } @@ -294,11 +339,11 @@ void Version::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - if (has_suffix()) { + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(!suffix_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); (*suffix_.UnsafeRawStringPointer())->clear(); } - cached_has_bits = _has_bits_[0]; if (cached_has_bits & 14u) { ::memset(&major_, 0, static_cast<size_t>( reinterpret_cast<char*>(&patch_) - @@ -599,151 +644,19 @@ void Version::InternalSwap(Version* other) { ::google::protobuf::Metadata Version::GetMetadata() const { protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// Version - -// optional int32 major = 1; -bool Version::has_major() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void Version::set_has_major() { - _has_bits_[0] |= 0x00000002u; -} -void Version::clear_has_major() { - _has_bits_[0] &= ~0x00000002u; -} -void Version::clear_major() { - major_ = 0; - clear_has_major(); -} -::google::protobuf::int32 Version::major() const { - // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.major) - return major_; -} -void Version::set_major(::google::protobuf::int32 value) { - set_has_major(); - major_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.major) + return ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages]; } -// optional int32 minor = 2; -bool Version::has_minor() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void Version::set_has_minor() { - _has_bits_[0] |= 0x00000004u; -} -void Version::clear_has_minor() { - _has_bits_[0] &= ~0x00000004u; -} -void Version::clear_minor() { - minor_ = 0; - clear_has_minor(); -} -::google::protobuf::int32 Version::minor() const { - // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.minor) - return minor_; -} -void Version::set_minor(::google::protobuf::int32 value) { - set_has_minor(); - minor_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.minor) -} -// optional int32 patch = 3; -bool Version::has_patch() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -void Version::set_has_patch() { - _has_bits_[0] |= 0x00000008u; -} -void Version::clear_has_patch() { - _has_bits_[0] &= ~0x00000008u; -} -void Version::clear_patch() { - patch_ = 0; - clear_has_patch(); -} -::google::protobuf::int32 Version::patch() const { - // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.patch) - return patch_; -} -void Version::set_patch(::google::protobuf::int32 value) { - set_has_patch(); - patch_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.patch) -} +// =================================================================== -// optional string suffix = 4; -bool Version::has_suffix() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void Version::set_has_suffix() { - _has_bits_[0] |= 0x00000001u; -} -void Version::clear_has_suffix() { - _has_bits_[0] &= ~0x00000001u; -} -void Version::clear_suffix() { - suffix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_suffix(); -} -const ::std::string& Version::suffix() const { - // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.suffix) - return suffix_.GetNoArena(); -} -void Version::set_suffix(const ::std::string& value) { - set_has_suffix(); - suffix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.suffix) -} -#if LANG_CXX11 -void Version::set_suffix(::std::string&& value) { - set_has_suffix(); - suffix_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.Version.suffix) +void CodeGeneratorRequest::InitAsDefaultInstance() { + ::google::protobuf::compiler::_CodeGeneratorRequest_default_instance_._instance.get_mutable()->compiler_version_ = const_cast< ::google::protobuf::compiler::Version*>( + ::google::protobuf::compiler::Version::internal_default_instance()); } -#endif -void Version::set_suffix(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_suffix(); - suffix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.Version.suffix) -} -void Version::set_suffix(const char* value, size_t size) { - set_has_suffix(); - suffix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.Version.suffix) -} -::std::string* Version::mutable_suffix() { - set_has_suffix(); - // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.Version.suffix) - return suffix_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* Version::release_suffix() { - // @@protoc_insertion_point(field_release:google.protobuf.compiler.Version.suffix) - clear_has_suffix(); - return suffix_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void Version::set_allocated_suffix(::std::string* suffix) { - if (suffix != NULL) { - set_has_suffix(); - } else { - clear_has_suffix(); - } - suffix_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), suffix); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.Version.suffix) +void CodeGeneratorRequest::clear_proto_file() { + proto_file_.Clear(); } - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int CodeGeneratorRequest::kFileToGenerateFieldNumber; const int CodeGeneratorRequest::kParameterFieldNumber; @@ -754,7 +667,7 @@ const int CodeGeneratorRequest::kCompilerVersionFieldNumber; CodeGeneratorRequest::CodeGeneratorRequest() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaultsCodeGeneratorRequest(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.compiler.CodeGeneratorRequest) @@ -801,12 +714,12 @@ void CodeGeneratorRequest::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* CodeGeneratorRequest::descriptor() { - protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const CodeGeneratorRequest& CodeGeneratorRequest::default_instance() { - protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaultsCodeGeneratorRequest(); return *internal_default_instance(); } @@ -834,7 +747,7 @@ void CodeGeneratorRequest::Clear() { } if (cached_has_bits & 0x00000002u) { GOOGLE_DCHECK(compiler_version_ != NULL); - compiler_version_->::google::protobuf::compiler::Version::Clear(); + compiler_version_->Clear(); } } _has_bits_.Clear(); @@ -888,7 +801,7 @@ bool CodeGeneratorRequest::MergePartialFromCodedStream( case 3: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_compiler_version())); } else { goto handle_unusual; @@ -900,8 +813,7 @@ bool CodeGeneratorRequest::MergePartialFromCodedStream( case 15: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(122u /* 122 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_proto_file())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_proto_file())); } else { goto handle_unusual; } @@ -1007,7 +919,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes( // optional .google.protobuf.compiler.Version compiler_version = 3; if (cached_has_bits & 0x00000002u) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 3, *this->compiler_version_, deterministic, target); } @@ -1015,7 +927,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->proto_file_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 15, this->proto_file(static_cast<int>(i)), deterministic, target); } @@ -1050,7 +962,7 @@ size_t CodeGeneratorRequest::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->proto_file(static_cast<int>(i))); } } @@ -1066,7 +978,7 @@ size_t CodeGeneratorRequest::ByteSizeLong() const { // optional .google.protobuf.compiler.Version compiler_version = 3; if (has_compiler_version()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *this->compiler_version_); } @@ -1150,224 +1062,14 @@ void CodeGeneratorRequest::InternalSwap(CodeGeneratorRequest* other) { ::google::protobuf::Metadata CodeGeneratorRequest::GetMetadata() const { protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// CodeGeneratorRequest - -// repeated string file_to_generate = 1; -int CodeGeneratorRequest::file_to_generate_size() const { - return file_to_generate_.size(); -} -void CodeGeneratorRequest::clear_file_to_generate() { - file_to_generate_.Clear(); -} -const ::std::string& CodeGeneratorRequest::file_to_generate(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) - return file_to_generate_.Get(index); -} -::std::string* CodeGeneratorRequest::mutable_file_to_generate(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) - return file_to_generate_.Mutable(index); -} -void CodeGeneratorRequest::set_file_to_generate(int index, const ::std::string& value) { - // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) - file_to_generate_.Mutable(index)->assign(value); -} -#if LANG_CXX11 -void CodeGeneratorRequest::set_file_to_generate(int index, ::std::string&& value) { - // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) - file_to_generate_.Mutable(index)->assign(std::move(value)); -} -#endif -void CodeGeneratorRequest::set_file_to_generate(int index, const char* value) { - GOOGLE_DCHECK(value != NULL); - file_to_generate_.Mutable(index)->assign(value); - // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) -} -void CodeGeneratorRequest::set_file_to_generate(int index, const char* value, size_t size) { - file_to_generate_.Mutable(index)->assign( - reinterpret_cast<const char*>(value), size); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) -} -::std::string* CodeGeneratorRequest::add_file_to_generate() { - // @@protoc_insertion_point(field_add_mutable:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) - return file_to_generate_.Add(); -} -void CodeGeneratorRequest::add_file_to_generate(const ::std::string& value) { - file_to_generate_.Add()->assign(value); - // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) -} -#if LANG_CXX11 -void CodeGeneratorRequest::add_file_to_generate(::std::string&& value) { - file_to_generate_.Add(std::move(value)); - // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) -} -#endif -void CodeGeneratorRequest::add_file_to_generate(const char* value) { - GOOGLE_DCHECK(value != NULL); - file_to_generate_.Add()->assign(value); - // @@protoc_insertion_point(field_add_char:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) -} -void CodeGeneratorRequest::add_file_to_generate(const char* value, size_t size) { - file_to_generate_.Add()->assign(reinterpret_cast<const char*>(value), size); - // @@protoc_insertion_point(field_add_pointer:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) -} -const ::google::protobuf::RepeatedPtrField< ::std::string>& -CodeGeneratorRequest::file_to_generate() const { - // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) - return file_to_generate_; -} -::google::protobuf::RepeatedPtrField< ::std::string>* -CodeGeneratorRequest::mutable_file_to_generate() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) - return &file_to_generate_; -} - -// optional string parameter = 2; -bool CodeGeneratorRequest::has_parameter() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void CodeGeneratorRequest::set_has_parameter() { - _has_bits_[0] |= 0x00000001u; -} -void CodeGeneratorRequest::clear_has_parameter() { - _has_bits_[0] &= ~0x00000001u; -} -void CodeGeneratorRequest::clear_parameter() { - parameter_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_parameter(); -} -const ::std::string& CodeGeneratorRequest::parameter() const { - // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.parameter) - return parameter_.GetNoArena(); -} -void CodeGeneratorRequest::set_parameter(const ::std::string& value) { - set_has_parameter(); - parameter_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.parameter) -} -#if LANG_CXX11 -void CodeGeneratorRequest::set_parameter(::std::string&& value) { - set_has_parameter(); - parameter_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorRequest.parameter) -} -#endif -void CodeGeneratorRequest::set_parameter(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_parameter(); - parameter_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorRequest.parameter) -} -void CodeGeneratorRequest::set_parameter(const char* value, size_t size) { - set_has_parameter(); - parameter_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorRequest.parameter) -} -::std::string* CodeGeneratorRequest::mutable_parameter() { - set_has_parameter(); - // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.parameter) - return parameter_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* CodeGeneratorRequest::release_parameter() { - // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.parameter) - clear_has_parameter(); - return parameter_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void CodeGeneratorRequest::set_allocated_parameter(::std::string* parameter) { - if (parameter != NULL) { - set_has_parameter(); - } else { - clear_has_parameter(); - } - parameter_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), parameter); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.parameter) -} - -// repeated .google.protobuf.FileDescriptorProto proto_file = 15; -int CodeGeneratorRequest::proto_file_size() const { - return proto_file_.size(); -} -void CodeGeneratorRequest::clear_proto_file() { - proto_file_.Clear(); -} -const ::google::protobuf::FileDescriptorProto& CodeGeneratorRequest::proto_file(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.proto_file) - return proto_file_.Get(index); -} -::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::mutable_proto_file(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.proto_file) - return proto_file_.Mutable(index); -} -::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() { - // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.proto_file) - return proto_file_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >* -CodeGeneratorRequest::mutable_proto_file() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file) - return &proto_file_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >& -CodeGeneratorRequest::proto_file() const { - // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file) - return proto_file_; -} - -// optional .google.protobuf.compiler.Version compiler_version = 3; -bool CodeGeneratorRequest::has_compiler_version() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void CodeGeneratorRequest::set_has_compiler_version() { - _has_bits_[0] |= 0x00000002u; -} -void CodeGeneratorRequest::clear_has_compiler_version() { - _has_bits_[0] &= ~0x00000002u; -} -void CodeGeneratorRequest::clear_compiler_version() { - if (compiler_version_ != NULL) compiler_version_->::google::protobuf::compiler::Version::Clear(); - clear_has_compiler_version(); -} -const ::google::protobuf::compiler::Version& CodeGeneratorRequest::compiler_version() const { - const ::google::protobuf::compiler::Version* p = compiler_version_; - // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) - return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::compiler::Version*>( - &::google::protobuf::compiler::_Version_default_instance_); -} -::google::protobuf::compiler::Version* CodeGeneratorRequest::mutable_compiler_version() { - set_has_compiler_version(); - if (compiler_version_ == NULL) { - compiler_version_ = new ::google::protobuf::compiler::Version; - } - // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) - return compiler_version_; -} -::google::protobuf::compiler::Version* CodeGeneratorRequest::release_compiler_version() { - // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) - clear_has_compiler_version(); - ::google::protobuf::compiler::Version* temp = compiler_version_; - compiler_version_ = NULL; - return temp; -} -void CodeGeneratorRequest::set_allocated_compiler_version(::google::protobuf::compiler::Version* compiler_version) { - delete compiler_version_; - compiler_version_ = compiler_version; - if (compiler_version) { - set_has_compiler_version(); - } else { - clear_has_compiler_version(); - } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void CodeGeneratorResponse_File::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int CodeGeneratorResponse_File::kNameFieldNumber; const int CodeGeneratorResponse_File::kInsertionPointFieldNumber; @@ -1377,7 +1079,7 @@ const int CodeGeneratorResponse_File::kContentFieldNumber; CodeGeneratorResponse_File::CodeGeneratorResponse_File() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaultsCodeGeneratorResponse_File(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.compiler.CodeGeneratorResponse.File) @@ -1427,12 +1129,12 @@ void CodeGeneratorResponse_File::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* CodeGeneratorResponse_File::descriptor() { - protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const CodeGeneratorResponse_File& CodeGeneratorResponse_File::default_instance() { - protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaultsCodeGeneratorResponse_File(); return *internal_default_instance(); } @@ -1752,205 +1454,14 @@ void CodeGeneratorResponse_File::InternalSwap(CodeGeneratorResponse_File* other) ::google::protobuf::Metadata CodeGeneratorResponse_File::GetMetadata() const { protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// CodeGeneratorResponse_File - -// optional string name = 1; -bool CodeGeneratorResponse_File::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void CodeGeneratorResponse_File::set_has_name() { - _has_bits_[0] |= 0x00000001u; -} -void CodeGeneratorResponse_File::clear_has_name() { - _has_bits_[0] &= ~0x00000001u; -} -void CodeGeneratorResponse_File::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_name(); -} -const ::std::string& CodeGeneratorResponse_File::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.name) - return name_.GetNoArena(); -} -void CodeGeneratorResponse_File::set_name(const ::std::string& value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.name) -} -#if LANG_CXX11 -void CodeGeneratorResponse_File::set_name(::std::string&& value) { - set_has_name(); - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorResponse.File.name) -} -#endif -void CodeGeneratorResponse_File::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.File.name) -} -void CodeGeneratorResponse_File::set_name(const char* value, size_t size) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.File.name) -} -::std::string* CodeGeneratorResponse_File::mutable_name() { - set_has_name(); - // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* CodeGeneratorResponse_File::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.name) - clear_has_name(); - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void CodeGeneratorResponse_File::set_allocated_name(::std::string* name) { - if (name != NULL) { - set_has_name(); - } else { - clear_has_name(); - } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.name) -} - -// optional string insertion_point = 2; -bool CodeGeneratorResponse_File::has_insertion_point() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void CodeGeneratorResponse_File::set_has_insertion_point() { - _has_bits_[0] |= 0x00000002u; -} -void CodeGeneratorResponse_File::clear_has_insertion_point() { - _has_bits_[0] &= ~0x00000002u; -} -void CodeGeneratorResponse_File::clear_insertion_point() { - insertion_point_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_insertion_point(); -} -const ::std::string& CodeGeneratorResponse_File::insertion_point() const { - // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) - return insertion_point_.GetNoArena(); -} -void CodeGeneratorResponse_File::set_insertion_point(const ::std::string& value) { - set_has_insertion_point(); - insertion_point_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) -} -#if LANG_CXX11 -void CodeGeneratorResponse_File::set_insertion_point(::std::string&& value) { - set_has_insertion_point(); - insertion_point_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) -} -#endif -void CodeGeneratorResponse_File::set_insertion_point(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_insertion_point(); - insertion_point_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) -} -void CodeGeneratorResponse_File::set_insertion_point(const char* value, size_t size) { - set_has_insertion_point(); - insertion_point_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) -} -::std::string* CodeGeneratorResponse_File::mutable_insertion_point() { - set_has_insertion_point(); - // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) - return insertion_point_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* CodeGeneratorResponse_File::release_insertion_point() { - // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) - clear_has_insertion_point(); - return insertion_point_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void CodeGeneratorResponse_File::set_allocated_insertion_point(::std::string* insertion_point) { - if (insertion_point != NULL) { - set_has_insertion_point(); - } else { - clear_has_insertion_point(); - } - insertion_point_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), insertion_point); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) -} - -// optional string content = 15; -bool CodeGeneratorResponse_File::has_content() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void CodeGeneratorResponse_File::set_has_content() { - _has_bits_[0] |= 0x00000004u; -} -void CodeGeneratorResponse_File::clear_has_content() { - _has_bits_[0] &= ~0x00000004u; -} -void CodeGeneratorResponse_File::clear_content() { - content_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_content(); -} -const ::std::string& CodeGeneratorResponse_File::content() const { - // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.content) - return content_.GetNoArena(); -} -void CodeGeneratorResponse_File::set_content(const ::std::string& value) { - set_has_content(); - content_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.content) -} -#if LANG_CXX11 -void CodeGeneratorResponse_File::set_content(::std::string&& value) { - set_has_content(); - content_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorResponse.File.content) -} -#endif -void CodeGeneratorResponse_File::set_content(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_content(); - content_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.File.content) -} -void CodeGeneratorResponse_File::set_content(const char* value, size_t size) { - set_has_content(); - content_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.File.content) -} -::std::string* CodeGeneratorResponse_File::mutable_content() { - set_has_content(); - // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.content) - return content_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* CodeGeneratorResponse_File::release_content() { - // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.content) - clear_has_content(); - return content_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void CodeGeneratorResponse_File::set_allocated_content(::std::string* content) { - if (content != NULL) { - set_has_content(); - } else { - clear_has_content(); - } - content_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), content); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.content) + return ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages]; } -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void CodeGeneratorResponse::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int CodeGeneratorResponse::kErrorFieldNumber; const int CodeGeneratorResponse::kFileFieldNumber; @@ -1959,7 +1470,7 @@ const int CodeGeneratorResponse::kFileFieldNumber; CodeGeneratorResponse::CodeGeneratorResponse() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaultsCodeGeneratorResponse(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.compiler.CodeGeneratorResponse) @@ -1998,12 +1509,12 @@ void CodeGeneratorResponse::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* CodeGeneratorResponse::descriptor() { - protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const CodeGeneratorResponse& CodeGeneratorResponse::default_instance() { - protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaultsCodeGeneratorResponse(); return *internal_default_instance(); } @@ -2022,7 +1533,8 @@ void CodeGeneratorResponse::Clear() { (void) cached_has_bits; file_.Clear(); - if (has_error()) { + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(!error_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); (*error_.UnsafeRawStringPointer())->clear(); } @@ -2060,8 +1572,7 @@ bool CodeGeneratorResponse::MergePartialFromCodedStream( case 15: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(122u /* 122 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_file())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_file())); } else { goto handle_unusual; } @@ -2142,7 +1653,7 @@ void CodeGeneratorResponse::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->file_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 15, this->file(static_cast<int>(i)), deterministic, target); } @@ -2169,7 +1680,7 @@ size_t CodeGeneratorResponse::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->file(static_cast<int>(i))); } } @@ -2250,109 +1761,11 @@ void CodeGeneratorResponse::InternalSwap(CodeGeneratorResponse* other) { ::google::protobuf::Metadata CodeGeneratorResponse::GetMetadata() const { protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// CodeGeneratorResponse - -// optional string error = 1; -bool CodeGeneratorResponse::has_error() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void CodeGeneratorResponse::set_has_error() { - _has_bits_[0] |= 0x00000001u; -} -void CodeGeneratorResponse::clear_has_error() { - _has_bits_[0] &= ~0x00000001u; -} -void CodeGeneratorResponse::clear_error() { - error_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_error(); -} -const ::std::string& CodeGeneratorResponse::error() const { - // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.error) - return error_.GetNoArena(); -} -void CodeGeneratorResponse::set_error(const ::std::string& value) { - set_has_error(); - error_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.error) -} -#if LANG_CXX11 -void CodeGeneratorResponse::set_error(::std::string&& value) { - set_has_error(); - error_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorResponse.error) -} -#endif -void CodeGeneratorResponse::set_error(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_error(); - error_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.error) -} -void CodeGeneratorResponse::set_error(const char* value, size_t size) { - set_has_error(); - error_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.error) -} -::std::string* CodeGeneratorResponse::mutable_error() { - set_has_error(); - // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.error) - return error_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* CodeGeneratorResponse::release_error() { - // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.error) - clear_has_error(); - return error_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void CodeGeneratorResponse::set_allocated_error(::std::string* error) { - if (error != NULL) { - set_has_error(); - } else { - clear_has_error(); - } - error_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), error); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.error) -} - -// repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; -int CodeGeneratorResponse::file_size() const { - return file_.size(); -} -void CodeGeneratorResponse::clear_file() { - file_.Clear(); -} -const ::google::protobuf::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::file(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.file) - return file_.Get(index); -} -::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::mutable_file(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.file) - return file_.Mutable(index); -} -::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() { - // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorResponse.file) - return file_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File >* -CodeGeneratorResponse::mutable_file() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorResponse.file) - return &file_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File >& -CodeGeneratorResponse::file() const { - // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorResponse.file) - return file_; + return ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::file_level_metadata[kIndexInFileMessages]; } -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace compiler } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index 2d66f035..8f92b6ae 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -37,6 +37,33 @@ #ifdef minor #undef minor #endif + +namespace protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto { +// Internal implementation detail -- do not use these members. +struct LIBPROTOC_EXPORT TableStruct { + static const ::google::protobuf::internal::ParseTableField entries[]; + static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; + static const ::google::protobuf::internal::ParseTable schema[4]; + static const ::google::protobuf::internal::FieldMetadata field_metadata[]; + static const ::google::protobuf::internal::SerializationTable serialization_table[]; + static const ::google::protobuf::uint32 offsets[]; +}; +void LIBPROTOC_EXPORT AddDescriptors(); +void LIBPROTOC_EXPORT InitDefaultsVersionImpl(); +void LIBPROTOC_EXPORT InitDefaultsVersion(); +void LIBPROTOC_EXPORT InitDefaultsCodeGeneratorRequestImpl(); +void LIBPROTOC_EXPORT InitDefaultsCodeGeneratorRequest(); +void LIBPROTOC_EXPORT InitDefaultsCodeGeneratorResponse_FileImpl(); +void LIBPROTOC_EXPORT InitDefaultsCodeGeneratorResponse_File(); +void LIBPROTOC_EXPORT InitDefaultsCodeGeneratorResponseImpl(); +void LIBPROTOC_EXPORT InitDefaultsCodeGeneratorResponse(); +inline void LIBPROTOC_EXPORT InitDefaults() { + InitDefaultsVersion(); + InitDefaultsCodeGeneratorRequest(); + InitDefaultsCodeGeneratorResponse_File(); + InitDefaultsCodeGeneratorResponse(); +} +} // namespace protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto namespace google { namespace protobuf { namespace compiler { @@ -55,26 +82,10 @@ LIBPROTOC_EXPORT extern VersionDefaultTypeInternal _Version_default_instance_; } // namespace compiler } // namespace protobuf } // namespace google - namespace google { namespace protobuf { namespace compiler { -namespace protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto { -// Internal implementation detail -- do not call these. -struct LIBPROTOC_EXPORT TableStruct { - static const ::google::protobuf::internal::ParseTableField entries[]; - static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; - static const ::google::protobuf::internal::ParseTable schema[]; - static const ::google::protobuf::uint32 offsets[]; - static const ::google::protobuf::internal::FieldMetadata field_metadata[]; - static const ::google::protobuf::internal::SerializationTable serialization_table[]; - static void InitDefaultsImpl(); -}; -void LIBPROTOC_EXPORT AddDescriptors(); -void LIBPROTOC_EXPORT InitDefaults(); -} // namespace protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto - // =================================================================== class LIBPROTOC_EXPORT Version : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.Version) */ { @@ -113,6 +124,7 @@ class LIBPROTOC_EXPORT Version : public ::google::protobuf::Message /* @@protoc_ static const ::google::protobuf::Descriptor* descriptor(); static const Version& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Version* internal_default_instance() { return reinterpret_cast<const Version*>( &_Version_default_instance_); @@ -219,7 +231,8 @@ class LIBPROTOC_EXPORT Version : public ::google::protobuf::Message /* @@protoc_ ::google::protobuf::int32 major_; ::google::protobuf::int32 minor_; ::google::protobuf::int32 patch_; - friend struct protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaultsVersionImpl(); }; // ------------------------------------------------------------------- @@ -259,6 +272,7 @@ class LIBPROTOC_EXPORT CodeGeneratorRequest : public ::google::protobuf::Message static const ::google::protobuf::Descriptor* descriptor(); static const CodeGeneratorRequest& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const CodeGeneratorRequest* internal_default_instance() { return reinterpret_cast<const CodeGeneratorRequest*>( &_CodeGeneratorRequest_default_instance_); @@ -365,8 +379,8 @@ class LIBPROTOC_EXPORT CodeGeneratorRequest : public ::google::protobuf::Message void clear_compiler_version(); static const int kCompilerVersionFieldNumber = 3; const ::google::protobuf::compiler::Version& compiler_version() const; - ::google::protobuf::compiler::Version* mutable_compiler_version(); ::google::protobuf::compiler::Version* release_compiler_version(); + ::google::protobuf::compiler::Version* mutable_compiler_version(); void set_allocated_compiler_version(::google::protobuf::compiler::Version* compiler_version); // @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorRequest) @@ -383,7 +397,8 @@ class LIBPROTOC_EXPORT CodeGeneratorRequest : public ::google::protobuf::Message ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto > proto_file_; ::google::protobuf::internal::ArenaStringPtr parameter_; ::google::protobuf::compiler::Version* compiler_version_; - friend struct protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaultsCodeGeneratorRequestImpl(); }; // ------------------------------------------------------------------- @@ -423,6 +438,7 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse_File : public ::google::protobuf::M static const ::google::protobuf::Descriptor* descriptor(); static const CodeGeneratorResponse_File& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const CodeGeneratorResponse_File* internal_default_instance() { return reinterpret_cast<const CodeGeneratorResponse_File*>( &_CodeGeneratorResponse_File_default_instance_); @@ -535,7 +551,8 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse_File : public ::google::protobuf::M ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::internal::ArenaStringPtr insertion_point_; ::google::protobuf::internal::ArenaStringPtr content_; - friend struct protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaultsCodeGeneratorResponse_FileImpl(); }; // ------------------------------------------------------------------- @@ -575,6 +592,7 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse : public ::google::protobuf::Messag static const ::google::protobuf::Descriptor* descriptor(); static const CodeGeneratorResponse& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const CodeGeneratorResponse* internal_default_instance() { return reinterpret_cast<const CodeGeneratorResponse*>( &_CodeGeneratorResponse_default_instance_); @@ -666,14 +684,14 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse : public ::google::protobuf::Messag mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File > file_; ::google::protobuf::internal::ArenaStringPtr error_; - friend struct protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::InitDefaultsCodeGeneratorResponseImpl(); }; // =================================================================== // =================================================================== -#if !PROTOBUF_INLINE_NOT_IN_HEADERS #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" @@ -955,9 +973,6 @@ inline void CodeGeneratorRequest::set_allocated_parameter(::std::string* paramet inline int CodeGeneratorRequest::proto_file_size() const { return proto_file_.size(); } -inline void CodeGeneratorRequest::clear_proto_file() { - proto_file_.Clear(); -} inline const ::google::protobuf::FileDescriptorProto& CodeGeneratorRequest::proto_file(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return proto_file_.Get(index); @@ -992,7 +1007,7 @@ inline void CodeGeneratorRequest::clear_has_compiler_version() { _has_bits_[0] &= ~0x00000002u; } inline void CodeGeneratorRequest::clear_compiler_version() { - if (compiler_version_ != NULL) compiler_version_->::google::protobuf::compiler::Version::Clear(); + if (compiler_version_ != NULL) compiler_version_->Clear(); clear_has_compiler_version(); } inline const ::google::protobuf::compiler::Version& CodeGeneratorRequest::compiler_version() const { @@ -1001,6 +1016,13 @@ inline const ::google::protobuf::compiler::Version& CodeGeneratorRequest::compil return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::compiler::Version*>( &::google::protobuf::compiler::_Version_default_instance_); } +inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::release_compiler_version() { + // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) + clear_has_compiler_version(); + ::google::protobuf::compiler::Version* temp = compiler_version_; + compiler_version_ = NULL; + return temp; +} inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::mutable_compiler_version() { set_has_compiler_version(); if (compiler_version_ == NULL) { @@ -1009,21 +1031,22 @@ inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::mutable_comp // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) return compiler_version_; } -inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::release_compiler_version() { - // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) - clear_has_compiler_version(); - ::google::protobuf::compiler::Version* temp = compiler_version_; - compiler_version_ = NULL; - return temp; -} inline void CodeGeneratorRequest::set_allocated_compiler_version(::google::protobuf::compiler::Version* compiler_version) { - delete compiler_version_; - compiler_version_ = compiler_version; + ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); + if (message_arena == NULL) { + delete compiler_version_; + } if (compiler_version) { + ::google::protobuf::Arena* submessage_arena = NULL; + if (message_arena != submessage_arena) { + compiler_version = ::google::protobuf::internal::GetOwnedMessage( + message_arena, compiler_version, submessage_arena); + } set_has_compiler_version(); } else { clear_has_compiler_version(); } + compiler_version_ = compiler_version; // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) } @@ -1320,7 +1343,6 @@ CodeGeneratorResponse::file() const { #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ -#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // ------------------------------------------------------------------- // ------------------------------------------------------------------- @@ -1330,7 +1352,6 @@ CodeGeneratorResponse::file() const { // @@protoc_insertion_point(namespace_scope) - } // namespace compiler } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/compiler/python/python_generator.cc b/src/google/protobuf/compiler/python/python_generator.cc index 97769835..5ca6b4ee 100644 --- a/src/google/protobuf/compiler/python/python_generator.cc +++ b/src/google/protobuf/compiler/python/python_generator.cc @@ -1151,7 +1151,7 @@ void Generator::PrintFieldDescriptor( " has_default_value=$has_default_value$, default_value=$default_value$,\n" " message_type=None, enum_type=None, containing_type=None,\n" " is_extension=$is_extension$, extension_scope=None,\n" - " options=$options$$json_name$)"; + " options=$options$$json_name$, file=DESCRIPTOR)"; printer_->Print(m, field_descriptor_decl); } diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc index 89b37ee3..3f54b848 100644 --- a/src/google/protobuf/descriptor.cc +++ b/src/google/protobuf/descriptor.cc @@ -593,7 +593,7 @@ class DescriptorPool::Tables { // These return NULL if not found. inline const FileDescriptor* FindFile(const string& key) const; inline const FieldDescriptor* FindExtension(const Descriptor* extendee, - int number); + int number) const; inline void FindAllExtensions(const Descriptor* extendee, std::vector<const FieldDescriptor*>* out) const; @@ -752,11 +752,27 @@ class FileDescriptorTables { const SourceCodeInfo_Location* GetSourceLocation( const std::vector<int>& path, const SourceCodeInfo* info) const; + // Must be called after BuildFileImpl(), even if the build failed and + // we are going to roll back to the last checkpoint. + void FinalizeTables(); + private: - SymbolsByParentMap symbols_by_parent_; - FieldsByNameMap fields_by_lowercase_name_; - FieldsByNameMap fields_by_camelcase_name_; - FieldsByNumberMap fields_by_number_; // Not including extensions. + const void* FindParentForFieldsByMap(const FieldDescriptor* field) const; + static void FieldsByLowercaseNamesLazyInitStatic( + const FileDescriptorTables* tables); + void FieldsByLowercaseNamesLazyInitInternal() const; + static void FieldsByCamelcaseNamesLazyInitStatic( + const FileDescriptorTables* tables); + void FieldsByCamelcaseNamesLazyInitInternal() const; + + SymbolsByParentMap symbols_by_parent_; + mutable FieldsByNameMap fields_by_lowercase_name_; + mutable FieldsByNameMap* fields_by_lowercase_name_tmp_; + mutable GoogleOnceDynamic fields_by_lowercase_name_once_; + mutable FieldsByNameMap fields_by_camelcase_name_; + mutable FieldsByNameMap* fields_by_camelcase_name_tmp_; + mutable GoogleOnceDynamic fields_by_camelcase_name_once_; + FieldsByNumberMap fields_by_number_; // Not including extensions. EnumValuesByNumberMap enum_values_by_number_; mutable EnumValuesByNumberMap unknown_enum_values_by_number_ GOOGLE_GUARDED_BY(unknown_enum_values_mu_); @@ -793,14 +809,16 @@ DescriptorPool::Tables::~Tables() { } FileDescriptorTables::FileDescriptorTables() - // Initialize all the hash tables to start out with a small # of buckets + // Initialize all the hash tables to start out with a small # of buckets. : symbols_by_parent_(3), fields_by_lowercase_name_(3), + fields_by_lowercase_name_tmp_(new FieldsByNameMap()), fields_by_camelcase_name_(3), + fields_by_camelcase_name_tmp_(new FieldsByNameMap()), fields_by_number_(3), enum_values_by_number_(3), - unknown_enum_values_by_number_(3) { -} + unknown_enum_values_by_number_(3), + locations_by_path_(3) {} FileDescriptorTables::~FileDescriptorTables() {} @@ -960,14 +978,59 @@ inline const FieldDescriptor* FileDescriptorTables::FindFieldByNumber( return FindPtrOrNull(fields_by_number_, std::make_pair(parent, number)); } +const void* FileDescriptorTables::FindParentForFieldsByMap( + const FieldDescriptor* field) const { + if (field->is_extension()) { + if (field->extension_scope() == NULL) { + return field->file(); + } else { + return field->extension_scope(); + } + } else { + return field->containing_type(); + } +} + +void FileDescriptorTables::FieldsByLowercaseNamesLazyInitStatic( + const FileDescriptorTables* tables) { + tables->FieldsByLowercaseNamesLazyInitInternal(); +} + +void FileDescriptorTables::FieldsByLowercaseNamesLazyInitInternal() const { + for (FieldsByNumberMap::const_iterator it = fields_by_number_.begin(); + it != fields_by_number_.end(); it++) { + PointerStringPair lowercase_key(FindParentForFieldsByMap(it->second), + it->second->lowercase_name().c_str()); + InsertIfNotPresent(&fields_by_lowercase_name_, lowercase_key, it->second); + } +} + inline const FieldDescriptor* FileDescriptorTables::FindFieldByLowercaseName( const void* parent, const string& lowercase_name) const { + fields_by_lowercase_name_once_.Init( + &FileDescriptorTables::FieldsByLowercaseNamesLazyInitStatic, this); return FindPtrOrNull(fields_by_lowercase_name_, PointerStringPair(parent, lowercase_name.c_str())); } +void FileDescriptorTables::FieldsByCamelcaseNamesLazyInitStatic( + const FileDescriptorTables* tables) { + tables->FieldsByCamelcaseNamesLazyInitInternal(); +} + +void FileDescriptorTables::FieldsByCamelcaseNamesLazyInitInternal() const { + for (FieldsByNumberMap::const_iterator it = fields_by_number_.begin(); + it != fields_by_number_.end(); it++) { + PointerStringPair camelcase_key(FindParentForFieldsByMap(it->second), + it->second->camelcase_name().c_str()); + InsertIfNotPresent(&fields_by_camelcase_name_, camelcase_key, it->second); + } +} + inline const FieldDescriptor* FileDescriptorTables::FindFieldByCamelcaseName( const void* parent, const string& camelcase_name) const { + fields_by_camelcase_name_once_.Init( + &FileDescriptorTables::FieldsByCamelcaseNamesLazyInitStatic, this); return FindPtrOrNull(fields_by_camelcase_name_, PointerStringPair(parent, camelcase_name.c_str())); } @@ -1031,7 +1094,7 @@ FileDescriptorTables::FindEnumValueByNumberCreatingIfUnknown( inline const FieldDescriptor* DescriptorPool::Tables::FindExtension( - const Descriptor* extendee, int number) { + const Descriptor* extendee, int number) const { return FindPtrOrNull(extensions_, std::make_pair(extendee, number)); } @@ -1072,24 +1135,40 @@ bool DescriptorPool::Tables::AddFile(const FileDescriptor* file) { } } +void FileDescriptorTables::FinalizeTables() { + // Clean up the temporary maps used by AddFieldByStylizedNames(). + delete fields_by_lowercase_name_tmp_; + fields_by_lowercase_name_tmp_ = NULL; + delete fields_by_camelcase_name_tmp_; + fields_by_camelcase_name_tmp_ = NULL; +} + void FileDescriptorTables::AddFieldByStylizedNames( const FieldDescriptor* field) { - const void* parent; - if (field->is_extension()) { - if (field->extension_scope() == NULL) { - parent = field->file(); - } else { - parent = field->extension_scope(); - } - } else { - parent = field->containing_type(); - } + const void* parent = FindParentForFieldsByMap(field); + + // We want fields_by_{lower,camel}case_name_ to be lazily built, but + // cross-link order determines which entry will be present in the case of a + // conflict. So we use the temporary maps that get destroyed after + // BuildFileImpl() to detect the conflicts, and only store the conflicts in + // the map that will persist. We will then lazily populate the rest of the + // entries from fields_by_number_. PointerStringPair lowercase_key(parent, field->lowercase_name().c_str()); - InsertIfNotPresent(&fields_by_lowercase_name_, lowercase_key, field); + if (!InsertIfNotPresent(fields_by_lowercase_name_tmp_, lowercase_key, + field)) { + InsertIfNotPresent( + &fields_by_lowercase_name_, lowercase_key, + FindPtrOrNull(*fields_by_lowercase_name_tmp_, lowercase_key)); + } PointerStringPair camelcase_key(parent, field->camelcase_name().c_str()); - InsertIfNotPresent(&fields_by_camelcase_name_, camelcase_key, field); + if (!InsertIfNotPresent(fields_by_camelcase_name_tmp_, camelcase_key, + field)) { + InsertIfNotPresent( + &fields_by_camelcase_name_, camelcase_key, + FindPtrOrNull(*fields_by_camelcase_name_tmp_, camelcase_key)); + } } bool FileDescriptorTables::AddFieldByNumber(const FieldDescriptor* field) { @@ -1419,6 +1498,15 @@ const MethodDescriptor* DescriptorPool::FindMethodByName( const FieldDescriptor* DescriptorPool::FindExtensionByNumber( const Descriptor* extendee, int number) const { + // A faster path to reduce lock contention in finding extensions, assuming + // most extensions will be cache hit. + if (mutex_ != NULL) { + ReaderMutexLock lock(mutex_); + const FieldDescriptor* result = tables_->FindExtension(extendee, number); + if (result != NULL) { + return result; + } + } MutexLockMaybe lock(mutex_); tables_->known_bad_symbols_.clear(); tables_->known_bad_files_.clear(); @@ -1721,6 +1809,18 @@ Descriptor::FindReservedRangeContainingNumber(int number) const { return NULL; } +const EnumDescriptor::ReservedRange* +EnumDescriptor::FindReservedRangeContainingNumber(int number) const { + // TODO(chrisn): Consider a non-linear search. + for (int i = 0; i < reserved_range_count(); i++) { + if (number >= reserved_range(i)->start && + number <= reserved_range(i)->end) { + return reserved_range(i); + } + } + return NULL; +} + // ------------------------------------------------------------------- bool DescriptorPool::TryFindFileInFallbackDatabase(const string& name) const { @@ -1826,8 +1926,8 @@ bool DescriptorPool::TryFindExtensionInFallbackDatabase( // =================================================================== -bool FieldDescriptor::is_map() const { - return type() == TYPE_MESSAGE && message_type()->options().map_entry(); +bool FieldDescriptor::is_map_message_type() const { + return message_type_->options().map_entry(); } string FieldDescriptor::DefaultValueAsString(bool quote_string_type) const { @@ -2063,6 +2163,14 @@ void EnumDescriptor::CopyTo(EnumDescriptorProto* proto) const { for (int i = 0; i < value_count(); i++) { value(i)->CopyTo(proto->add_value()); } + for (int i = 0; i < reserved_range_count(); i++) { + EnumDescriptorProto::EnumReservedRange* range = proto->add_reserved_range(); + range->set_start(reserved_range(i)->start); + range->set_end(reserved_range(i)->end); + } + for (int i = 0; i < reserved_name_count(); i++) { + proto->add_reserved_name(reserved_name(i)); + } if (&options() != &EnumOptions::default_instance()) { proto->mutable_options()->CopyFrom(options()); @@ -2695,6 +2803,30 @@ void EnumDescriptor::DebugString(int depth, string *contents, for (int i = 0; i < value_count(); i++) { value(i)->DebugString(depth, contents, debug_string_options); } + + if (reserved_range_count() > 0) { + strings::SubstituteAndAppend(contents, "$0 reserved ", prefix); + for (int i = 0; i < reserved_range_count(); i++) { + const EnumDescriptor::ReservedRange* range = reserved_range(i); + if (range->end == range->start) { + strings::SubstituteAndAppend(contents, "$0, ", range->start); + } else { + strings::SubstituteAndAppend(contents, "$0 to $1, ", + range->start, range->end); + } + } + contents->replace(contents->size() - 2, 2, ";\n"); + } + + if (reserved_name_count() > 0) { + strings::SubstituteAndAppend(contents, "$0 reserved ", prefix); + for (int i = 0; i < reserved_name_count(); i++) { + strings::SubstituteAndAppend(contents, "\"$0\", ", + CEscape(reserved_name(i))); + } + contents->replace(contents->size() - 2, 2, ";\n"); + } + strings::SubstituteAndAppend(contents, "$0}\n", prefix); comment_printer.AddPostComment(contents); @@ -2994,7 +3126,7 @@ class DescriptorBuilder { friend class OptionInterpreter; // Non-recursive part of BuildFile functionality. - const FileDescriptor* BuildFileImpl(const FileDescriptorProto& proto); + FileDescriptor* BuildFileImpl(const FileDescriptorProto& proto); const DescriptorPool* pool_; DescriptorPool::Tables* tables_; // for convenience @@ -3178,6 +3310,9 @@ class DescriptorBuilder { void BuildReservedRange(const DescriptorProto::ReservedRange& proto, const Descriptor* parent, Descriptor::ReservedRange* result); + void BuildReservedRange(const EnumDescriptorProto::EnumReservedRange& proto, + const EnumDescriptor* parent, + EnumDescriptor::ReservedRange* result); void BuildOneof(const OneofDescriptorProto& proto, Descriptor* parent, OneofDescriptor* result); @@ -4089,14 +4224,25 @@ const FileDescriptor* DescriptorBuilder::BuildFile( tables_->pending_files_.pop_back(); } } - return BuildFileImpl(proto); -} -const FileDescriptor* DescriptorBuilder::BuildFileImpl( - const FileDescriptorProto& proto) { // Checkpoint the tables so that we can roll back if something goes wrong. tables_->AddCheckpoint(); + FileDescriptor* result = BuildFileImpl(proto); + + file_tables_->FinalizeTables(); + if (result) { + tables_->ClearLastCheckpoint(); + result->finished_building_ = true; + } else { + tables_->RollbackToLastCheckpoint(); + } + + return result; +} + +FileDescriptor* DescriptorBuilder::BuildFileImpl( + const FileDescriptorProto& proto) { FileDescriptor* result = tables_->Allocate<FileDescriptor>(); file_ = result; @@ -4148,7 +4294,6 @@ const FileDescriptor* DescriptorBuilder::BuildFileImpl( "A file with this name is already in the pool."); // Bail out early so that if this is actually the exact same file, we // don't end up reporting that every single symbol is already defined. - tables_->RollbackToLastCheckpoint(); return NULL; } if (!result->package().empty()) { @@ -4164,8 +4309,10 @@ const FileDescriptor* DescriptorBuilder::BuildFileImpl( result->dependencies_once_ = tables_->AllocateOnceDynamic(); result->dependencies_names_ = tables_->AllocateArray<const string*>(proto.dependency_size()); - memset(result->dependencies_names_, 0, - sizeof(*result->dependencies_names_) * proto.dependency_size()); + if (proto.dependency_size() > 0) { + memset(result->dependencies_names_, 0, + sizeof(*result->dependencies_names_) * proto.dependency_size()); + } } else { result->dependencies_once_ = NULL; result->dependencies_names_ = NULL; @@ -4189,17 +4336,16 @@ const FileDescriptor* DescriptorBuilder::BuildFileImpl( // Recursive import. dependency/result is not fully initialized, and it's // dangerous to try to do anything with it. The recursive import error // will be detected and reported in DescriptorBuilder::BuildFile(). - tables_->RollbackToLastCheckpoint(); return NULL; } if (dependency == NULL) { - if (pool_->allow_unknown_ || - (!pool_->enforce_weak_ && weak_deps.find(i) != weak_deps.end())) { - dependency = - pool_->NewPlaceholderFileWithMutexHeld(proto.dependency(i)); - } else { - if (!pool_->lazily_build_dependencies_) { + if (!pool_->lazily_build_dependencies_) { + if (pool_->allow_unknown_ || + (!pool_->enforce_weak_ && weak_deps.find(i) != weak_deps.end())) { + dependency = + pool_->NewPlaceholderFileWithMutexHeld(proto.dependency(i)); + } else { AddImportError(proto, i); } } @@ -4325,11 +4471,8 @@ const FileDescriptor* DescriptorBuilder::BuildFileImpl( } if (had_errors_) { - tables_->RollbackToLastCheckpoint(); return NULL; } else { - tables_->ClearLastCheckpoint(); - result->finished_building_ = true; return result; } } @@ -4807,6 +4950,19 @@ void DescriptorBuilder::BuildReservedRange( } } +void DescriptorBuilder::BuildReservedRange( + const EnumDescriptorProto::EnumReservedRange& proto, + const EnumDescriptor* parent, EnumDescriptor::ReservedRange* result) { + result->start = proto.start(); + result->end = proto.end(); + + if (result->start > result->end) { + AddError(parent->full_name(), proto, + DescriptorPool::ErrorCollector::NUMBER, + "Reserved range end number must be greater than start number."); + } +} + void DescriptorBuilder::BuildOneof(const OneofDescriptorProto& proto, Descriptor* parent, OneofDescriptor* result) { @@ -4928,6 +5084,17 @@ void DescriptorBuilder::BuildEnum(const EnumDescriptorProto& proto, } BUILD_ARRAY(proto, result, value, BuildEnumValue, result); + BUILD_ARRAY(proto, result, reserved_range, BuildReservedRange, result); + + // Copy reserved names. + int reserved_name_count = proto.reserved_name_size(); + result->reserved_name_count_ = reserved_name_count; + result->reserved_names_ = + tables_->AllocateArray<const string*>(reserved_name_count); + for (int i = 0; i < reserved_name_count; ++i) { + result->reserved_names_[i] = + tables_->AllocateString(proto.reserved_name(i)); + } CheckEnumValueUniqueness(proto, result); @@ -4940,6 +5107,56 @@ void DescriptorBuilder::BuildEnum(const EnumDescriptorProto& proto, AddSymbol(result->full_name(), parent, result->name(), proto, Symbol(result)); + + for (int i = 0; i < proto.reserved_range_size(); i++) { + const EnumDescriptorProto_EnumReservedRange& range1 = + proto.reserved_range(i); + for (int j = i + 1; j < proto.reserved_range_size(); j++) { + const EnumDescriptorProto_EnumReservedRange& range2 = + proto.reserved_range(j); + if (range1.end() > range2.start() && range2.end() > range1.start()) { + AddError(result->full_name(), proto.reserved_range(i), + DescriptorPool::ErrorCollector::NUMBER, + strings::Substitute("Reserved range $0 to $1 overlaps with " + "already-defined range $2 to $3.", + range2.start(), range2.end() - 1, + range1.start(), range1.end() - 1)); + } + } + } + + hash_set<string> reserved_name_set; + for (int i = 0; i < proto.reserved_name_size(); i++) { + const string& name = proto.reserved_name(i); + if (reserved_name_set.find(name) == reserved_name_set.end()) { + reserved_name_set.insert(name); + } else { + AddError(name, proto, DescriptorPool::ErrorCollector::NAME, + strings::Substitute( + "Enum value \"$0\" is reserved multiple times.", + name)); + } + } + + for (int i = 0; i < result->value_count(); i++) { + const EnumValueDescriptor* value = result->value(i); + for (int j = 0; j < result->reserved_range_count(); j++) { + const EnumDescriptor::ReservedRange* range = result->reserved_range(j); + if (range->start <= value->number() && value->number() <= range->end) { + AddError(value->full_name(), proto.reserved_range(j), + DescriptorPool::ErrorCollector::NUMBER, + strings::Substitute( + "Enum value \"$0\" uses reserved number $1.", + value->name(), value->number())); + } + } + if (reserved_name_set.find(value->name()) != reserved_name_set.end()) { + AddError(value->full_name(), proto.value(i), + DescriptorPool::ErrorCollector::NAME, + strings::Substitute( + "Enum value \"$0\" is reserved.", value->name())); + } + } } void DescriptorBuilder::BuildEnumValue(const EnumValueDescriptorProto& proto, @@ -5248,25 +5465,27 @@ void DescriptorBuilder::CrossLinkField( bool expecting_enum = (proto.type() == FieldDescriptorProto::TYPE_ENUM) || proto.has_default_value(); + // In case of weak fields we force building the dependency. We need to know + // if the type exist or not. If it doesnt exist we substitute Empty which + // should only be done if the type can't be found in the generated pool. + // TODO(gerbens) Ideally we should query the database directly to check + // if weak fields exist or not so that we don't need to force building + // weak dependencies. However the name lookup rules for symbols are + // somewhat complicated, so I defer it too another CL. + bool is_weak = !pool_->enforce_weak_ && proto.options().weak(); + bool is_lazy = pool_->lazily_build_dependencies_ && !is_weak; + Symbol type = LookupSymbol(proto.type_name(), field->full_name(), expecting_enum ? DescriptorPool::PLACEHOLDER_ENUM : DescriptorPool::PLACEHOLDER_MESSAGE, - LOOKUP_TYPES, !pool_->lazily_build_dependencies_); - - // If the type is a weak type, we change the type to a google.protobuf.Empty field. - if (type.IsNull() && !pool_->enforce_weak_ && proto.options().weak()) { - type = FindSymbol(kNonLinkedWeakMessageReplacementName); - } + LOOKUP_TYPES, !is_lazy); if (type.IsNull()) { - if (pool_->lazily_build_dependencies_) { + if (is_lazy) { // Save the symbol names for later for lookup, and allocate the once // object needed for the accessors. string name = proto.type_name(); - if (!pool_->enforce_weak_ && proto.options().weak()) { - name = kNonLinkedWeakMessageReplacementName; - } field->type_once_ = tables_->AllocateOnceDynamic(); field->type_name_ = tables_->AllocateString(name); if (proto.has_default_value()) { @@ -5284,10 +5503,17 @@ void DescriptorBuilder::CrossLinkField( } return; } else { - AddNotDefinedError(field->full_name(), proto, - DescriptorPool::ErrorCollector::TYPE, - proto.type_name()); - return; + // If the type is a weak type, we change the type to a google.protobuf.Empty + // field. + if (is_weak) { + type = FindSymbol(kNonLinkedWeakMessageReplacementName); + } + if (type.IsNull()) { + AddNotDefinedError(field->full_name(), proto, + DescriptorPool::ErrorCollector::TYPE, + proto.type_name()); + return; + } } } @@ -6835,13 +7061,6 @@ const EnumValueDescriptor* FieldDescriptor::default_value_enum() const { return default_value_enum_; } -FieldDescriptor::Type FieldDescriptor::type() const { - if (type_once_) { - type_once_->Init(&FieldDescriptor::TypeOnceInit, this); - } - return type_; -} - void FileDescriptor::InternalDependenciesOnceInit() const { GOOGLE_CHECK(finished_building_ == true); for (int i = 0; i < dependency_count(); i++) { diff --git a/src/google/protobuf/descriptor.h b/src/google/protobuf/descriptor.h index 57128e6b..5f5159a8 100644 --- a/src/google/protobuf/descriptor.h +++ b/src/google/protobuf/descriptor.h @@ -741,6 +741,9 @@ class LIBPROTOBUF_EXPORT FieldDescriptor { // to this descriptor from the file root. void GetLocationPath(std::vector<int>* output) const; + // Returns true if this is a map message type. + bool is_map_message_type() const; + const string* name_; const string* full_name_; const string* lowercase_name_; @@ -924,12 +927,42 @@ class LIBPROTOBUF_EXPORT EnumDescriptor { // See Descriptor::DebugStringWithOptions(). string DebugStringWithOptions(const DebugStringOptions& options) const; - // Returns true if this is a placeholder for an unknown enum. This will // only be the case if this descriptor comes from a DescriptorPool // with AllowUnknownDependencies() set. bool is_placeholder() const; + // Reserved fields ------------------------------------------------- + + // A range of reserved field numbers. + struct ReservedRange { + int start; // inclusive + int end; // inclusive + }; + + // The number of reserved ranges in this message type. + int reserved_range_count() const; + // Gets an reserved range by index, where 0 <= index < + // reserved_range_count(). These are returned in the order they were defined + // in the .proto file. + const EnumDescriptor::ReservedRange* reserved_range(int index) const; + + // Returns true if the number is in one of the reserved ranges. + bool IsReservedNumber(int number) const; + + // Returns NULL if no reserved range contains the given number. + const EnumDescriptor::ReservedRange* + FindReservedRangeContainingNumber(int number) const; + + // The number of reserved field names in this message type. + int reserved_name_count() const; + + // Gets a reserved name by index, where 0 <= index < reserved_name_count(). + const string& reserved_name(int index) const; + + // Returns true if the field name is reserved. + bool IsReservedName(const string& name) const; + // Source Location --------------------------------------------------- // Updates |*out_location| to the source location of the complete @@ -976,6 +1009,12 @@ class LIBPROTOBUF_EXPORT EnumDescriptor { int value_count_; EnumValueDescriptor* values_; + + int reserved_range_count_; + int reserved_name_count_; + EnumDescriptor::ReservedRange* reserved_ranges_; + const string** reserved_names_; + // IMPORTANT: If you add a new field, make sure to search for all instances // of Allocate<EnumDescriptor>() and AllocateArray<EnumDescriptor>() in // descriptor.cc and update them to initialize the field. @@ -1864,6 +1903,10 @@ PROTOBUF_DEFINE_ARRAY_ACCESSOR(EnumDescriptor, value, const EnumValueDescriptor*) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(EnumDescriptor, EnumOptions) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, is_placeholder, bool) +PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, reserved_range_count, int) +PROTOBUF_DEFINE_ARRAY_ACCESSOR(EnumDescriptor, reserved_range, + const EnumDescriptor::ReservedRange*) +PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, reserved_name_count, int) PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, name) PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, full_name) @@ -1935,6 +1978,32 @@ inline const string& Descriptor::reserved_name(int index) const { return *reserved_names_[index]; } +inline bool EnumDescriptor::IsReservedNumber(int number) const { + return FindReservedRangeContainingNumber(number) != NULL; +} + +inline bool EnumDescriptor::IsReservedName(const string& name) const { + for (int i = 0; i < reserved_name_count(); i++) { + if (name == reserved_name(i)) { + return true; + } + } + return false; +} + +// Can't use PROTOBUF_DEFINE_ARRAY_ACCESSOR because reserved_names_ is actually +// an array of pointers rather than the usual array of objects. +inline const string& EnumDescriptor::reserved_name(int index) const { + return *reserved_names_[index]; +} + +inline FieldDescriptor::Type FieldDescriptor::type() const { + if (type_once_) { + type_once_->Init(&FieldDescriptor::TypeOnceInit, this); + } + return type_; +} + inline bool FieldDescriptor::is_required() const { return label() == LABEL_REQUIRED; } @@ -1951,6 +2020,10 @@ inline bool FieldDescriptor::is_packable() const { return is_repeated() && IsTypePackable(type()); } +inline bool FieldDescriptor::is_map() const { + return type() == TYPE_MESSAGE && is_map_message_type(); +} + // To save space, index() is computed by looking at the descriptor's position // in the parent's array of children. inline int FieldDescriptor::index() const { diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 1827b97d..ab1b4992 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/descriptor.proto -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #include <google/protobuf/descriptor.pb.h> #include <algorithm> @@ -15,215 +14,781 @@ #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> +// This is a temporary google only hack +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS +#include "third_party/protobuf/version.h" +#endif // @@protoc_insertion_point(includes) - namespace google { namespace protobuf { class FileDescriptorSetDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<FileDescriptorSet> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<FileDescriptorSet> + _instance; } _FileDescriptorSet_default_instance_; class FileDescriptorProtoDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<FileDescriptorProto> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<FileDescriptorProto> + _instance; } _FileDescriptorProto_default_instance_; class DescriptorProto_ExtensionRangeDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<DescriptorProto_ExtensionRange> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<DescriptorProto_ExtensionRange> + _instance; } _DescriptorProto_ExtensionRange_default_instance_; class DescriptorProto_ReservedRangeDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<DescriptorProto_ReservedRange> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<DescriptorProto_ReservedRange> + _instance; } _DescriptorProto_ReservedRange_default_instance_; class DescriptorProtoDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<DescriptorProto> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<DescriptorProto> + _instance; } _DescriptorProto_default_instance_; class ExtensionRangeOptionsDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<ExtensionRangeOptions> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<ExtensionRangeOptions> + _instance; } _ExtensionRangeOptions_default_instance_; class FieldDescriptorProtoDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<FieldDescriptorProto> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<FieldDescriptorProto> + _instance; } _FieldDescriptorProto_default_instance_; class OneofDescriptorProtoDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<OneofDescriptorProto> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<OneofDescriptorProto> + _instance; } _OneofDescriptorProto_default_instance_; +class EnumDescriptorProto_EnumReservedRangeDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed<EnumDescriptorProto_EnumReservedRange> + _instance; +} _EnumDescriptorProto_EnumReservedRange_default_instance_; class EnumDescriptorProtoDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<EnumDescriptorProto> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<EnumDescriptorProto> + _instance; } _EnumDescriptorProto_default_instance_; class EnumValueDescriptorProtoDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<EnumValueDescriptorProto> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<EnumValueDescriptorProto> + _instance; } _EnumValueDescriptorProto_default_instance_; class ServiceDescriptorProtoDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<ServiceDescriptorProto> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<ServiceDescriptorProto> + _instance; } _ServiceDescriptorProto_default_instance_; class MethodDescriptorProtoDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<MethodDescriptorProto> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<MethodDescriptorProto> + _instance; } _MethodDescriptorProto_default_instance_; class FileOptionsDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<FileOptions> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<FileOptions> + _instance; } _FileOptions_default_instance_; class MessageOptionsDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<MessageOptions> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<MessageOptions> + _instance; } _MessageOptions_default_instance_; class FieldOptionsDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<FieldOptions> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<FieldOptions> + _instance; } _FieldOptions_default_instance_; class OneofOptionsDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<OneofOptions> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<OneofOptions> + _instance; } _OneofOptions_default_instance_; class EnumOptionsDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<EnumOptions> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<EnumOptions> + _instance; } _EnumOptions_default_instance_; class EnumValueOptionsDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<EnumValueOptions> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<EnumValueOptions> + _instance; } _EnumValueOptions_default_instance_; class ServiceOptionsDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<ServiceOptions> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<ServiceOptions> + _instance; } _ServiceOptions_default_instance_; class MethodOptionsDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<MethodOptions> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<MethodOptions> + _instance; } _MethodOptions_default_instance_; class UninterpretedOption_NamePartDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<UninterpretedOption_NamePart> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<UninterpretedOption_NamePart> + _instance; } _UninterpretedOption_NamePart_default_instance_; class UninterpretedOptionDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<UninterpretedOption> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<UninterpretedOption> + _instance; } _UninterpretedOption_default_instance_; class SourceCodeInfo_LocationDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<SourceCodeInfo_Location> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<SourceCodeInfo_Location> + _instance; } _SourceCodeInfo_Location_default_instance_; class SourceCodeInfoDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<SourceCodeInfo> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<SourceCodeInfo> + _instance; } _SourceCodeInfo_default_instance_; class GeneratedCodeInfo_AnnotationDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<GeneratedCodeInfo_Annotation> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<GeneratedCodeInfo_Annotation> + _instance; } _GeneratedCodeInfo_Annotation_default_instance_; class GeneratedCodeInfoDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<GeneratedCodeInfo> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<GeneratedCodeInfo> + _instance; } _GeneratedCodeInfo_default_instance_; - +} // namespace protobuf +} // namespace google namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto { +void InitDefaultsFileDescriptorSetImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFileDescriptorProto(); + { + void* ptr = &::google::protobuf::_FileDescriptorSet_default_instance_; + new (ptr) ::google::protobuf::FileDescriptorSet(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::FileDescriptorSet::InitAsDefaultInstance(); +} -namespace { +void InitDefaultsFileDescriptorSet() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsFileDescriptorSetImpl); +} -::google::protobuf::Metadata file_level_metadata[26]; -const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[6]; +void InitDefaultsFileDescriptorProtoImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsDescriptorProto(); + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumDescriptorProto(); + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsServiceDescriptorProto(); + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFieldDescriptorProto(); + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFileOptions(); + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsSourceCodeInfo(); + { + void* ptr = &::google::protobuf::_FileDescriptorProto_default_instance_; + new (ptr) ::google::protobuf::FileDescriptorProto(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::FileDescriptorProto::InitAsDefaultInstance(); +} -} // namespace +void InitDefaultsFileDescriptorProto() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsFileDescriptorProtoImpl); +} -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField - const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0}, -}; +void InitDefaultsDescriptorProto_ExtensionRangeImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField - const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - ::google::protobuf::internal::AuxillaryParseTableField(), -}; -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const - TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, -}; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsExtensionRangeOptions(); + { + void* ptr = &::google::protobuf::_DescriptorProto_ExtensionRange_default_instance_; + new (ptr) ::google::protobuf::DescriptorProto_ExtensionRange(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::DescriptorProto_ExtensionRange::InitAsDefaultInstance(); +} + +void InitDefaultsDescriptorProto_ExtensionRange() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsDescriptorProto_ExtensionRangeImpl); +} + +void InitDefaultsDescriptorProto_ReservedRangeImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_DescriptorProto_ReservedRange_default_instance_; + new (ptr) ::google::protobuf::DescriptorProto_ReservedRange(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::DescriptorProto_ReservedRange::InitAsDefaultInstance(); +} + +void InitDefaultsDescriptorProto_ReservedRange() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsDescriptorProto_ReservedRangeImpl); +} + +void InitDefaultsDescriptorProtoImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFieldDescriptorProto(); + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumDescriptorProto(); + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsDescriptorProto_ExtensionRange(); + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsOneofDescriptorProto(); + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsMessageOptions(); + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsDescriptorProto_ReservedRange(); + { + void* ptr = &::google::protobuf::_DescriptorProto_default_instance_; + new (ptr) ::google::protobuf::DescriptorProto(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::DescriptorProto::InitAsDefaultInstance(); +} + +void InitDefaultsDescriptorProto() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsDescriptorProtoImpl); +} + +void InitDefaultsExtensionRangeOptionsImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsUninterpretedOption(); + { + void* ptr = &::google::protobuf::_ExtensionRangeOptions_default_instance_; + new (ptr) ::google::protobuf::ExtensionRangeOptions(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::ExtensionRangeOptions::InitAsDefaultInstance(); +} + +void InitDefaultsExtensionRangeOptions() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsExtensionRangeOptionsImpl); +} + +void InitDefaultsFieldDescriptorProtoImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFieldOptions(); + { + void* ptr = &::google::protobuf::_FieldDescriptorProto_default_instance_; + new (ptr) ::google::protobuf::FieldDescriptorProto(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::FieldDescriptorProto::InitAsDefaultInstance(); +} + +void InitDefaultsFieldDescriptorProto() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsFieldDescriptorProtoImpl); +} + +void InitDefaultsOneofDescriptorProtoImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsOneofOptions(); + { + void* ptr = &::google::protobuf::_OneofDescriptorProto_default_instance_; + new (ptr) ::google::protobuf::OneofDescriptorProto(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::OneofDescriptorProto::InitAsDefaultInstance(); +} + +void InitDefaultsOneofDescriptorProto() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsOneofDescriptorProtoImpl); +} + +void InitDefaultsEnumDescriptorProto_EnumReservedRangeImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_EnumDescriptorProto_EnumReservedRange_default_instance_; + new (ptr) ::google::protobuf::EnumDescriptorProto_EnumReservedRange(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::EnumDescriptorProto_EnumReservedRange::InitAsDefaultInstance(); +} + +void InitDefaultsEnumDescriptorProto_EnumReservedRange() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsEnumDescriptorProto_EnumReservedRangeImpl); +} + +void InitDefaultsEnumDescriptorProtoImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumValueDescriptorProto(); + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumOptions(); + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumDescriptorProto_EnumReservedRange(); + { + void* ptr = &::google::protobuf::_EnumDescriptorProto_default_instance_; + new (ptr) ::google::protobuf::EnumDescriptorProto(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::EnumDescriptorProto::InitAsDefaultInstance(); +} + +void InitDefaultsEnumDescriptorProto() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsEnumDescriptorProtoImpl); +} + +void InitDefaultsEnumValueDescriptorProtoImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumValueOptions(); + { + void* ptr = &::google::protobuf::_EnumValueDescriptorProto_default_instance_; + new (ptr) ::google::protobuf::EnumValueDescriptorProto(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::EnumValueDescriptorProto::InitAsDefaultInstance(); +} + +void InitDefaultsEnumValueDescriptorProto() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsEnumValueDescriptorProtoImpl); +} + +void InitDefaultsServiceDescriptorProtoImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsMethodDescriptorProto(); + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsServiceOptions(); + { + void* ptr = &::google::protobuf::_ServiceDescriptorProto_default_instance_; + new (ptr) ::google::protobuf::ServiceDescriptorProto(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::ServiceDescriptorProto::InitAsDefaultInstance(); +} + +void InitDefaultsServiceDescriptorProto() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsServiceDescriptorProtoImpl); +} + +void InitDefaultsMethodDescriptorProtoImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsMethodOptions(); + { + void* ptr = &::google::protobuf::_MethodDescriptorProto_default_instance_; + new (ptr) ::google::protobuf::MethodDescriptorProto(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::MethodDescriptorProto::InitAsDefaultInstance(); +} + +void InitDefaultsMethodDescriptorProto() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsMethodDescriptorProtoImpl); +} + +void InitDefaultsFileOptionsImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsUninterpretedOption(); + { + void* ptr = &::google::protobuf::_FileOptions_default_instance_; + new (ptr) ::google::protobuf::FileOptions(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::FileOptions::InitAsDefaultInstance(); +} + +void InitDefaultsFileOptions() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsFileOptionsImpl); +} + +void InitDefaultsMessageOptionsImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsUninterpretedOption(); + { + void* ptr = &::google::protobuf::_MessageOptions_default_instance_; + new (ptr) ::google::protobuf::MessageOptions(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::MessageOptions::InitAsDefaultInstance(); +} + +void InitDefaultsMessageOptions() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsMessageOptionsImpl); +} + +void InitDefaultsFieldOptionsImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsUninterpretedOption(); + { + void* ptr = &::google::protobuf::_FieldOptions_default_instance_; + new (ptr) ::google::protobuf::FieldOptions(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::FieldOptions::InitAsDefaultInstance(); +} + +void InitDefaultsFieldOptions() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsFieldOptionsImpl); +} + +void InitDefaultsOneofOptionsImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsUninterpretedOption(); + { + void* ptr = &::google::protobuf::_OneofOptions_default_instance_; + new (ptr) ::google::protobuf::OneofOptions(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::OneofOptions::InitAsDefaultInstance(); +} + +void InitDefaultsOneofOptions() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsOneofOptionsImpl); +} + +void InitDefaultsEnumOptionsImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsUninterpretedOption(); + { + void* ptr = &::google::protobuf::_EnumOptions_default_instance_; + new (ptr) ::google::protobuf::EnumOptions(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::EnumOptions::InitAsDefaultInstance(); +} + +void InitDefaultsEnumOptions() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsEnumOptionsImpl); +} + +void InitDefaultsEnumValueOptionsImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsUninterpretedOption(); + { + void* ptr = &::google::protobuf::_EnumValueOptions_default_instance_; + new (ptr) ::google::protobuf::EnumValueOptions(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::EnumValueOptions::InitAsDefaultInstance(); +} + +void InitDefaultsEnumValueOptions() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsEnumValueOptionsImpl); +} + +void InitDefaultsServiceOptionsImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsUninterpretedOption(); + { + void* ptr = &::google::protobuf::_ServiceOptions_default_instance_; + new (ptr) ::google::protobuf::ServiceOptions(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::ServiceOptions::InitAsDefaultInstance(); +} + +void InitDefaultsServiceOptions() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsServiceOptionsImpl); +} + +void InitDefaultsMethodOptionsImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsUninterpretedOption(); + { + void* ptr = &::google::protobuf::_MethodOptions_default_instance_; + new (ptr) ::google::protobuf::MethodOptions(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::MethodOptions::InitAsDefaultInstance(); +} + +void InitDefaultsMethodOptions() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsMethodOptionsImpl); +} + +void InitDefaultsUninterpretedOption_NamePartImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_UninterpretedOption_NamePart_default_instance_; + new (ptr) ::google::protobuf::UninterpretedOption_NamePart(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::UninterpretedOption_NamePart::InitAsDefaultInstance(); +} + +void InitDefaultsUninterpretedOption_NamePart() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsUninterpretedOption_NamePartImpl); +} + +void InitDefaultsUninterpretedOptionImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsUninterpretedOption_NamePart(); + { + void* ptr = &::google::protobuf::_UninterpretedOption_default_instance_; + new (ptr) ::google::protobuf::UninterpretedOption(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::UninterpretedOption::InitAsDefaultInstance(); +} + +void InitDefaultsUninterpretedOption() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsUninterpretedOptionImpl); +} + +void InitDefaultsSourceCodeInfo_LocationImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_SourceCodeInfo_Location_default_instance_; + new (ptr) ::google::protobuf::SourceCodeInfo_Location(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::SourceCodeInfo_Location::InitAsDefaultInstance(); +} + +void InitDefaultsSourceCodeInfo_Location() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsSourceCodeInfo_LocationImpl); +} + +void InitDefaultsSourceCodeInfoImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsSourceCodeInfo_Location(); + { + void* ptr = &::google::protobuf::_SourceCodeInfo_default_instance_; + new (ptr) ::google::protobuf::SourceCodeInfo(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::SourceCodeInfo::InitAsDefaultInstance(); +} + +void InitDefaultsSourceCodeInfo() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsSourceCodeInfoImpl); +} + +void InitDefaultsGeneratedCodeInfo_AnnotationImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_GeneratedCodeInfo_Annotation_default_instance_; + new (ptr) ::google::protobuf::GeneratedCodeInfo_Annotation(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::GeneratedCodeInfo_Annotation::InitAsDefaultInstance(); +} + +void InitDefaultsGeneratedCodeInfo_Annotation() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsGeneratedCodeInfo_AnnotationImpl); +} + +void InitDefaultsGeneratedCodeInfoImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsGeneratedCodeInfo_Annotation(); + { + void* ptr = &::google::protobuf::_GeneratedCodeInfo_default_instance_; + new (ptr) ::google::protobuf::GeneratedCodeInfo(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::GeneratedCodeInfo::InitAsDefaultInstance(); +} + +void InitDefaultsGeneratedCodeInfo() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsGeneratedCodeInfoImpl); +} -const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorSet, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorSet, _internal_metadata_), +::google::protobuf::Metadata file_level_metadata[27]; +const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[6]; + +const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorSet, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorSet, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorSet, file_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorSet, file_), ~0u, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, package_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, dependency_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, public_dependency_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, weak_dependency_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, message_type_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, enum_type_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, service_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, extension_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, options_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, source_code_info_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorProto, syntax_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, package_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, dependency_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, public_dependency_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, weak_dependency_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, message_type_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, enum_type_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, service_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, extension_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, source_code_info_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileDescriptorProto, syntax_), 0, 1, ~0u, @@ -236,41 +801,41 @@ const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION 3, 4, 2, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ExtensionRange, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ExtensionRange, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto_ExtensionRange, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto_ExtensionRange, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ExtensionRange, start_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ExtensionRange, end_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ExtensionRange, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto_ExtensionRange, start_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto_ExtensionRange, end_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto_ExtensionRange, options_), 1, 2, 0, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ReservedRange, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ReservedRange, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto_ReservedRange, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto_ReservedRange, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ReservedRange, start_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto_ReservedRange, end_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto_ReservedRange, start_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto_ReservedRange, end_), 0, 1, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, field_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, extension_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, nested_type_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, enum_type_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, extension_range_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, oneof_decl_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, options_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, reserved_range_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorProto, reserved_name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, field_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, extension_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, nested_type_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, enum_type_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, extension_range_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, oneof_decl_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, reserved_range_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DescriptorProto, reserved_name_), 0, ~0u, ~0u, @@ -281,28 +846,28 @@ const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION 1, ~0u, ~0u, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRangeOptions, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRangeOptions, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRangeOptions, _extensions_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ExtensionRangeOptions, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ExtensionRangeOptions, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ExtensionRangeOptions, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRangeOptions, uninterpreted_option_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ExtensionRangeOptions, uninterpreted_option_), ~0u, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, number_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, label_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, type_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, type_name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, extendee_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, default_value_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, oneof_index_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, json_name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldDescriptorProto, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, number_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, label_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, type_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, type_name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, extendee_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, default_value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, oneof_index_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, json_name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldDescriptorProto, options_), 0, 6, 8, @@ -313,89 +878,102 @@ const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION 7, 4, 5, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofDescriptorProto, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofDescriptorProto, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::OneofDescriptorProto, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::OneofDescriptorProto, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::OneofDescriptorProto, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::OneofDescriptorProto, options_), + 0, + 1, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto_EnumReservedRange, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto_EnumReservedRange, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofDescriptorProto, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofDescriptorProto, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto_EnumReservedRange, start_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto_EnumReservedRange, end_), 0, 1, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, value_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumDescriptorProto, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto, value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto, reserved_range_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumDescriptorProto, reserved_name_), 0, ~0u, 1, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, _internal_metadata_), + ~0u, + ~0u, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueDescriptorProto, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueDescriptorProto, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, number_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueDescriptorProto, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueDescriptorProto, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueDescriptorProto, number_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueDescriptorProto, options_), 0, 2, 1, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceDescriptorProto, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceDescriptorProto, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, method_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceDescriptorProto, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceDescriptorProto, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceDescriptorProto, method_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceDescriptorProto, options_), 0, ~0u, 1, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodDescriptorProto, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodDescriptorProto, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, input_type_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, output_type_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, options_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, client_streaming_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, server_streaming_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodDescriptorProto, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodDescriptorProto, input_type_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodDescriptorProto, output_type_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodDescriptorProto, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodDescriptorProto, client_streaming_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodDescriptorProto, server_streaming_), 0, 1, 2, 3, 4, 5, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, _extensions_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_package_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_outer_classname_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_multiple_files_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_generate_equals_and_hash_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_string_check_utf8_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, optimize_for_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, go_package_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, cc_generic_services_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_generic_services_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, py_generic_services_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, php_generic_services_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, deprecated_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, cc_enable_arenas_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, objc_class_prefix_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, csharp_namespace_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, swift_prefix_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, php_class_prefix_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, php_namespace_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, uninterpreted_option_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, java_package_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, java_outer_classname_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, java_multiple_files_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, java_generate_equals_and_hash_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, java_string_check_utf8_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, optimize_for_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, go_package_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, cc_generic_services_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, java_generic_services_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, py_generic_services_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, php_generic_services_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, deprecated_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, cc_enable_arenas_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, objc_class_prefix_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, csharp_namespace_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, swift_prefix_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, php_class_prefix_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, php_namespace_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FileOptions, uninterpreted_option_), 0, 1, 9, @@ -415,33 +993,33 @@ const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION 6, 7, ~0u, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, _extensions_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MessageOptions, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MessageOptions, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MessageOptions, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, message_set_wire_format_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, no_standard_descriptor_accessor_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, deprecated_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, map_entry_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, uninterpreted_option_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MessageOptions, message_set_wire_format_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MessageOptions, no_standard_descriptor_accessor_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MessageOptions, deprecated_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MessageOptions, map_entry_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MessageOptions, uninterpreted_option_), 0, 1, 2, 3, ~0u, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, _extensions_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, ctype_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, packed_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, jstype_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, lazy_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, deprecated_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, weak_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldOptions, uninterpreted_option_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, ctype_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, packed_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, jstype_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, lazy_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, deprecated_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, weak_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldOptions, uninterpreted_option_), 0, 1, 5, @@ -449,74 +1027,74 @@ const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION 3, 4, ~0u, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofOptions, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofOptions, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofOptions, _extensions_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::OneofOptions, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::OneofOptions, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::OneofOptions, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OneofOptions, uninterpreted_option_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::OneofOptions, uninterpreted_option_), ~0u, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, _extensions_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumOptions, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumOptions, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumOptions, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, allow_alias_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, deprecated_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumOptions, uninterpreted_option_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumOptions, allow_alias_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumOptions, deprecated_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumOptions, uninterpreted_option_), 0, 1, ~0u, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, _extensions_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueOptions, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueOptions, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueOptions, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, deprecated_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValueOptions, uninterpreted_option_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueOptions, deprecated_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValueOptions, uninterpreted_option_), 0, ~0u, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, _extensions_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceOptions, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceOptions, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceOptions, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, deprecated_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceOptions, uninterpreted_option_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceOptions, deprecated_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ServiceOptions, uninterpreted_option_), 0, ~0u, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, _extensions_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodOptions, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodOptions, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodOptions, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, deprecated_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, idempotency_level_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodOptions, uninterpreted_option_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodOptions, deprecated_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodOptions, idempotency_level_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::MethodOptions, uninterpreted_option_), 0, 1, ~0u, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption_NamePart, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption_NamePart, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption_NamePart, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption_NamePart, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption_NamePart, name_part_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption_NamePart, is_extension_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption_NamePart, name_part_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption_NamePart, is_extension_), 0, 1, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, identifier_value_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, positive_int_value_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, negative_int_value_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, double_value_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, string_value_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UninterpretedOption, aggregate_value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption, identifier_value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption, positive_int_value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption, negative_int_value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption, double_value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption, string_value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UninterpretedOption, aggregate_value_), ~0u, 0, 3, @@ -524,109 +1102,109 @@ const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION 5, 1, 2, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo_Location, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo_Location, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, path_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, span_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, leading_comments_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, trailing_comments_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, leading_detached_comments_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo_Location, path_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo_Location, span_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo_Location, leading_comments_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo_Location, trailing_comments_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo_Location, leading_detached_comments_), ~0u, ~0u, 0, 1, ~0u, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo, location_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceCodeInfo, location_), ~0u, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::GeneratedCodeInfo_Annotation, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::GeneratedCodeInfo_Annotation, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, path_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, source_file_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, begin_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, end_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::GeneratedCodeInfo_Annotation, path_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::GeneratedCodeInfo_Annotation, source_file_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::GeneratedCodeInfo_Annotation, begin_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::GeneratedCodeInfo_Annotation, end_), ~0u, 0, 1, 2, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::GeneratedCodeInfo, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::GeneratedCodeInfo, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo, annotation_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::GeneratedCodeInfo, annotation_), ~0u, }; -static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { 0, 6, sizeof(FileDescriptorSet)}, - { 7, 24, sizeof(FileDescriptorProto)}, - { 36, 44, sizeof(DescriptorProto_ExtensionRange)}, - { 47, 54, sizeof(DescriptorProto_ReservedRange)}, - { 56, 71, sizeof(DescriptorProto)}, - { 81, 87, sizeof(ExtensionRangeOptions)}, - { 88, 103, sizeof(FieldDescriptorProto)}, - { 113, 120, sizeof(OneofDescriptorProto)}, - { 122, 130, sizeof(EnumDescriptorProto)}, - { 133, 141, sizeof(EnumValueDescriptorProto)}, - { 144, 152, sizeof(ServiceDescriptorProto)}, - { 155, 166, sizeof(MethodDescriptorProto)}, - { 172, 196, sizeof(FileOptions)}, - { 215, 225, sizeof(MessageOptions)}, - { 230, 242, sizeof(FieldOptions)}, - { 249, 255, sizeof(OneofOptions)}, - { 256, 264, sizeof(EnumOptions)}, - { 267, 274, sizeof(EnumValueOptions)}, - { 276, 283, sizeof(ServiceOptions)}, - { 285, 293, sizeof(MethodOptions)}, - { 296, 303, sizeof(UninterpretedOption_NamePart)}, - { 305, 317, sizeof(UninterpretedOption)}, - { 324, 334, sizeof(SourceCodeInfo_Location)}, - { 339, 345, sizeof(SourceCodeInfo)}, - { 346, 355, sizeof(GeneratedCodeInfo_Annotation)}, - { 359, 365, sizeof(GeneratedCodeInfo)}, +static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + { 0, 6, sizeof(::google::protobuf::FileDescriptorSet)}, + { 7, 24, sizeof(::google::protobuf::FileDescriptorProto)}, + { 36, 44, sizeof(::google::protobuf::DescriptorProto_ExtensionRange)}, + { 47, 54, sizeof(::google::protobuf::DescriptorProto_ReservedRange)}, + { 56, 71, sizeof(::google::protobuf::DescriptorProto)}, + { 81, 87, sizeof(::google::protobuf::ExtensionRangeOptions)}, + { 88, 103, sizeof(::google::protobuf::FieldDescriptorProto)}, + { 113, 120, sizeof(::google::protobuf::OneofDescriptorProto)}, + { 122, 129, sizeof(::google::protobuf::EnumDescriptorProto_EnumReservedRange)}, + { 131, 141, sizeof(::google::protobuf::EnumDescriptorProto)}, + { 146, 154, sizeof(::google::protobuf::EnumValueDescriptorProto)}, + { 157, 165, sizeof(::google::protobuf::ServiceDescriptorProto)}, + { 168, 179, sizeof(::google::protobuf::MethodDescriptorProto)}, + { 185, 209, sizeof(::google::protobuf::FileOptions)}, + { 228, 238, sizeof(::google::protobuf::MessageOptions)}, + { 243, 255, sizeof(::google::protobuf::FieldOptions)}, + { 262, 268, sizeof(::google::protobuf::OneofOptions)}, + { 269, 277, sizeof(::google::protobuf::EnumOptions)}, + { 280, 287, sizeof(::google::protobuf::EnumValueOptions)}, + { 289, 296, sizeof(::google::protobuf::ServiceOptions)}, + { 298, 306, sizeof(::google::protobuf::MethodOptions)}, + { 309, 316, sizeof(::google::protobuf::UninterpretedOption_NamePart)}, + { 318, 330, sizeof(::google::protobuf::UninterpretedOption)}, + { 337, 347, sizeof(::google::protobuf::SourceCodeInfo_Location)}, + { 352, 358, sizeof(::google::protobuf::SourceCodeInfo)}, + { 359, 368, sizeof(::google::protobuf::GeneratedCodeInfo_Annotation)}, + { 372, 378, sizeof(::google::protobuf::GeneratedCodeInfo)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { - reinterpret_cast<const ::google::protobuf::Message*>(&_FileDescriptorSet_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_FileDescriptorProto_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_DescriptorProto_ExtensionRange_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_DescriptorProto_ReservedRange_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_DescriptorProto_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_ExtensionRangeOptions_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_FieldDescriptorProto_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_OneofDescriptorProto_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_EnumDescriptorProto_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_EnumValueDescriptorProto_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_ServiceDescriptorProto_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_MethodDescriptorProto_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_FileOptions_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_MessageOptions_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_FieldOptions_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_OneofOptions_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_EnumOptions_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_EnumValueOptions_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_ServiceOptions_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_MethodOptions_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_UninterpretedOption_NamePart_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_UninterpretedOption_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_SourceCodeInfo_Location_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_SourceCodeInfo_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_GeneratedCodeInfo_Annotation_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_GeneratedCodeInfo_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_FileDescriptorSet_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_FileDescriptorProto_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_DescriptorProto_ExtensionRange_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_DescriptorProto_ReservedRange_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_DescriptorProto_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_ExtensionRangeOptions_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_FieldDescriptorProto_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_OneofDescriptorProto_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_EnumDescriptorProto_EnumReservedRange_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_EnumDescriptorProto_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_EnumValueDescriptorProto_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_ServiceDescriptorProto_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_MethodDescriptorProto_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_FileOptions_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_MessageOptions_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_FieldOptions_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_OneofOptions_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_EnumOptions_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_EnumValueOptions_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_ServiceOptions_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_MethodOptions_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_UninterpretedOption_NamePart_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_UninterpretedOption_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_SourceCodeInfo_Location_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_SourceCodeInfo_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_GeneratedCodeInfo_Annotation_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_GeneratedCodeInfo_default_instance_), }; -namespace { - void protobuf_AssignDescriptors() { AddDescriptors(); ::google::protobuf::MessageFactory* factory = NULL; @@ -640,99 +1218,15 @@ void protobuf_AssignDescriptorsOnce() { ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); } -void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; +void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); - ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 26); -} - -} // namespace -void TableStruct::InitDefaultsImpl() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::internal::InitProtobufDefaults(); - _FileDescriptorSet_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_FileDescriptorSet_default_instance_);_FileDescriptorProto_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_FileDescriptorProto_default_instance_);_DescriptorProto_ExtensionRange_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_DescriptorProto_ExtensionRange_default_instance_);_DescriptorProto_ReservedRange_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_DescriptorProto_ReservedRange_default_instance_);_DescriptorProto_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_DescriptorProto_default_instance_);_ExtensionRangeOptions_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_ExtensionRangeOptions_default_instance_);_FieldDescriptorProto_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_FieldDescriptorProto_default_instance_);_OneofDescriptorProto_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_OneofDescriptorProto_default_instance_);_EnumDescriptorProto_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_EnumDescriptorProto_default_instance_);_EnumValueDescriptorProto_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_EnumValueDescriptorProto_default_instance_);_ServiceDescriptorProto_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_ServiceDescriptorProto_default_instance_);_MethodDescriptorProto_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_MethodDescriptorProto_default_instance_);_FileOptions_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_FileOptions_default_instance_);_MessageOptions_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_MessageOptions_default_instance_);_FieldOptions_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_FieldOptions_default_instance_);_OneofOptions_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_OneofOptions_default_instance_);_EnumOptions_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_EnumOptions_default_instance_);_EnumValueOptions_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_EnumValueOptions_default_instance_);_ServiceOptions_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_ServiceOptions_default_instance_);_MethodOptions_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_MethodOptions_default_instance_);_UninterpretedOption_NamePart_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_UninterpretedOption_NamePart_default_instance_);_UninterpretedOption_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_UninterpretedOption_default_instance_);_SourceCodeInfo_Location_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_SourceCodeInfo_Location_default_instance_);_SourceCodeInfo_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_SourceCodeInfo_default_instance_);_GeneratedCodeInfo_Annotation_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_GeneratedCodeInfo_Annotation_default_instance_);_GeneratedCodeInfo_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_GeneratedCodeInfo_default_instance_);_FileDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::FileOptions*>( - ::google::protobuf::FileOptions::internal_default_instance()); - _FileDescriptorProto_default_instance_._instance.get_mutable()->source_code_info_ = const_cast< ::google::protobuf::SourceCodeInfo*>( - ::google::protobuf::SourceCodeInfo::internal_default_instance()); - _DescriptorProto_ExtensionRange_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::ExtensionRangeOptions*>( - ::google::protobuf::ExtensionRangeOptions::internal_default_instance()); - _DescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::MessageOptions*>( - ::google::protobuf::MessageOptions::internal_default_instance()); - _FieldDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::FieldOptions*>( - ::google::protobuf::FieldOptions::internal_default_instance()); - _OneofDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::OneofOptions*>( - ::google::protobuf::OneofOptions::internal_default_instance()); - _EnumDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::EnumOptions*>( - ::google::protobuf::EnumOptions::internal_default_instance()); - _EnumValueDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::EnumValueOptions*>( - ::google::protobuf::EnumValueOptions::internal_default_instance()); - _ServiceDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::ServiceOptions*>( - ::google::protobuf::ServiceOptions::internal_default_instance()); - _MethodDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::MethodOptions*>( - ::google::protobuf::MethodOptions::internal_default_instance()); + ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 27); } -void InitDefaults() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl); -} -namespace { void AddDescriptorsImpl() { InitDefaults(); - static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { "\n google/protobuf/descriptor.proto\022\017goog" "le.protobuf\"G\n\021FileDescriptorSet\0222\n\004file" "\030\001 \003(\0132$.google.protobuf.FileDescriptorP" @@ -787,105 +1281,108 @@ void AddDescriptorsImpl() { "BEL_OPTIONAL\020\001\022\022\n\016LABEL_REQUIRED\020\002\022\022\n\016LA" "BEL_REPEATED\020\003\"T\n\024OneofDescriptorProto\022\014" "\n\004name\030\001 \001(\t\022.\n\007options\030\002 \001(\0132\035.google.p" - "rotobuf.OneofOptions\"\214\001\n\023EnumDescriptorP" + "rotobuf.OneofOptions\"\244\002\n\023EnumDescriptorP" "roto\022\014\n\004name\030\001 \001(\t\0228\n\005value\030\002 \003(\0132).goog" "le.protobuf.EnumValueDescriptorProto\022-\n\007" "options\030\003 \001(\0132\034.google.protobuf.EnumOpti" - "ons\"l\n\030EnumValueDescriptorProto\022\014\n\004name\030" - "\001 \001(\t\022\016\n\006number\030\002 \001(\005\0222\n\007options\030\003 \001(\0132!" - ".google.protobuf.EnumValueOptions\"\220\001\n\026Se" - "rviceDescriptorProto\022\014\n\004name\030\001 \001(\t\0226\n\006me" - "thod\030\002 \003(\0132&.google.protobuf.MethodDescr" - "iptorProto\0220\n\007options\030\003 \001(\0132\037.google.pro" - "tobuf.ServiceOptions\"\301\001\n\025MethodDescripto" - "rProto\022\014\n\004name\030\001 \001(\t\022\022\n\ninput_type\030\002 \001(\t" - "\022\023\n\013output_type\030\003 \001(\t\022/\n\007options\030\004 \001(\0132\036" - ".google.protobuf.MethodOptions\022\037\n\020client" - "_streaming\030\005 \001(\010:\005false\022\037\n\020server_stream" - "ing\030\006 \001(\010:\005false\"\360\005\n\013FileOptions\022\024\n\014java" - "_package\030\001 \001(\t\022\034\n\024java_outer_classname\030\010" - " \001(\t\022\"\n\023java_multiple_files\030\n \001(\010:\005false" - "\022)\n\035java_generate_equals_and_hash\030\024 \001(\010B" - "\002\030\001\022%\n\026java_string_check_utf8\030\033 \001(\010:\005fal" - "se\022F\n\014optimize_for\030\t \001(\0162).google.protob" - "uf.FileOptions.OptimizeMode:\005SPEED\022\022\n\ngo" - "_package\030\013 \001(\t\022\"\n\023cc_generic_services\030\020 " - "\001(\010:\005false\022$\n\025java_generic_services\030\021 \001(" - "\010:\005false\022\"\n\023py_generic_services\030\022 \001(\010:\005f" - "alse\022#\n\024php_generic_services\030* \001(\010:\005fals" - "e\022\031\n\ndeprecated\030\027 \001(\010:\005false\022\037\n\020cc_enabl" - "e_arenas\030\037 \001(\010:\005false\022\031\n\021objc_class_pref" - "ix\030$ \001(\t\022\030\n\020csharp_namespace\030% \001(\t\022\024\n\014sw" - "ift_prefix\030\' \001(\t\022\030\n\020php_class_prefix\030( \001" - "(\t\022\025\n\rphp_namespace\030) \001(\t\022C\n\024uninterpret" + "ons\022N\n\016reserved_range\030\004 \003(\01326.google.pro" + "tobuf.EnumDescriptorProto.EnumReservedRa" + "nge\022\025\n\rreserved_name\030\005 \003(\t\032/\n\021EnumReserv" + "edRange\022\r\n\005start\030\001 \001(\005\022\013\n\003end\030\002 \001(\005\"l\n\030E" + "numValueDescriptorProto\022\014\n\004name\030\001 \001(\t\022\016\n" + "\006number\030\002 \001(\005\0222\n\007options\030\003 \001(\0132!.google." + "protobuf.EnumValueOptions\"\220\001\n\026ServiceDes" + "criptorProto\022\014\n\004name\030\001 \001(\t\0226\n\006method\030\002 \003" + "(\0132&.google.protobuf.MethodDescriptorPro" + "to\0220\n\007options\030\003 \001(\0132\037.google.protobuf.Se" + "rviceOptions\"\301\001\n\025MethodDescriptorProto\022\014" + "\n\004name\030\001 \001(\t\022\022\n\ninput_type\030\002 \001(\t\022\023\n\013outp" + "ut_type\030\003 \001(\t\022/\n\007options\030\004 \001(\0132\036.google." + "protobuf.MethodOptions\022\037\n\020client_streami" + "ng\030\005 \001(\010:\005false\022\037\n\020server_streaming\030\006 \001(" + "\010:\005false\"\360\005\n\013FileOptions\022\024\n\014java_package" + "\030\001 \001(\t\022\034\n\024java_outer_classname\030\010 \001(\t\022\"\n\023" + "java_multiple_files\030\n \001(\010:\005false\022)\n\035java" + "_generate_equals_and_hash\030\024 \001(\010B\002\030\001\022%\n\026j" + "ava_string_check_utf8\030\033 \001(\010:\005false\022F\n\014op" + "timize_for\030\t \001(\0162).google.protobuf.FileO" + "ptions.OptimizeMode:\005SPEED\022\022\n\ngo_package" + "\030\013 \001(\t\022\"\n\023cc_generic_services\030\020 \001(\010:\005fal" + "se\022$\n\025java_generic_services\030\021 \001(\010:\005false" + "\022\"\n\023py_generic_services\030\022 \001(\010:\005false\022#\n\024" + "php_generic_services\030* \001(\010:\005false\022\031\n\ndep" + "recated\030\027 \001(\010:\005false\022\037\n\020cc_enable_arenas" + "\030\037 \001(\010:\005false\022\031\n\021objc_class_prefix\030$ \001(\t" + "\022\030\n\020csharp_namespace\030% \001(\t\022\024\n\014swift_pref" + "ix\030\' \001(\t\022\030\n\020php_class_prefix\030( \001(\t\022\025\n\rph" + "p_namespace\030) \001(\t\022C\n\024uninterpreted_optio" + "n\030\347\007 \003(\0132$.google.protobuf.Uninterpreted" + "Option\":\n\014OptimizeMode\022\t\n\005SPEED\020\001\022\r\n\tCOD" + "E_SIZE\020\002\022\020\n\014LITE_RUNTIME\020\003*\t\010\350\007\020\200\200\200\200\002J\004\010" + "&\020\'\"\362\001\n\016MessageOptions\022&\n\027message_set_wi" + "re_format\030\001 \001(\010:\005false\022.\n\037no_standard_de" + "scriptor_accessor\030\002 \001(\010:\005false\022\031\n\ndeprec" + "ated\030\003 \001(\010:\005false\022\021\n\tmap_entry\030\007 \001(\010\022C\n\024" + "uninterpreted_option\030\347\007 \003(\0132$.google.pro" + "tobuf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002J\004\010\010" + "\020\tJ\004\010\t\020\n\"\236\003\n\014FieldOptions\022:\n\005ctype\030\001 \001(\016" + "2#.google.protobuf.FieldOptions.CType:\006S" + "TRING\022\016\n\006packed\030\002 \001(\010\022\?\n\006jstype\030\006 \001(\0162$." + "google.protobuf.FieldOptions.JSType:\tJS_" + "NORMAL\022\023\n\004lazy\030\005 \001(\010:\005false\022\031\n\ndeprecate" + "d\030\003 \001(\010:\005false\022\023\n\004weak\030\n \001(\010:\005false\022C\n\024u" + "ninterpreted_option\030\347\007 \003(\0132$.google.prot" + "obuf.UninterpretedOption\"/\n\005CType\022\n\n\006STR" + "ING\020\000\022\010\n\004CORD\020\001\022\020\n\014STRING_PIECE\020\002\"5\n\006JST" + "ype\022\r\n\tJS_NORMAL\020\000\022\r\n\tJS_STRING\020\001\022\r\n\tJS_" + "NUMBER\020\002*\t\010\350\007\020\200\200\200\200\002J\004\010\004\020\005\"^\n\014OneofOption" + "s\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.googl" + "e.protobuf.UninterpretedOption*\t\010\350\007\020\200\200\200\200" + "\002\"\223\001\n\013EnumOptions\022\023\n\013allow_alias\030\002 \001(\010\022\031" + "\n\ndeprecated\030\003 \001(\010:\005false\022C\n\024uninterpret" "ed_option\030\347\007 \003(\0132$.google.protobuf.Unint" - "erpretedOption\":\n\014OptimizeMode\022\t\n\005SPEED\020" - "\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014LITE_RUNTIME\020\003*\t\010\350\007\020" - "\200\200\200\200\002J\004\010&\020\'\"\362\001\n\016MessageOptions\022&\n\027messag" - "e_set_wire_format\030\001 \001(\010:\005false\022.\n\037no_sta" - "ndard_descriptor_accessor\030\002 \001(\010:\005false\022\031" - "\n\ndeprecated\030\003 \001(\010:\005false\022\021\n\tmap_entry\030\007" - " \001(\010\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.go" - "ogle.protobuf.UninterpretedOption*\t\010\350\007\020\200" - "\200\200\200\002J\004\010\010\020\tJ\004\010\t\020\n\"\236\003\n\014FieldOptions\022:\n\005cty" - "pe\030\001 \001(\0162#.google.protobuf.FieldOptions." - "CType:\006STRING\022\016\n\006packed\030\002 \001(\010\022\?\n\006jstype\030" - "\006 \001(\0162$.google.protobuf.FieldOptions.JST" - "ype:\tJS_NORMAL\022\023\n\004lazy\030\005 \001(\010:\005false\022\031\n\nd" - "eprecated\030\003 \001(\010:\005false\022\023\n\004weak\030\n \001(\010:\005fa" + "erpretedOption*\t\010\350\007\020\200\200\200\200\002J\004\010\005\020\006\"}\n\020EnumV" + "alueOptions\022\031\n\ndeprecated\030\001 \001(\010:\005false\022C" + "\n\024uninterpreted_option\030\347\007 \003(\0132$.google.p" + "rotobuf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"{" + "\n\016ServiceOptions\022\031\n\ndeprecated\030! \001(\010:\005fa" "lse\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.goo" - "gle.protobuf.UninterpretedOption\"/\n\005CTyp" - "e\022\n\n\006STRING\020\000\022\010\n\004CORD\020\001\022\020\n\014STRING_PIECE\020" - "\002\"5\n\006JSType\022\r\n\tJS_NORMAL\020\000\022\r\n\tJS_STRING\020" - "\001\022\r\n\tJS_NUMBER\020\002*\t\010\350\007\020\200\200\200\200\002J\004\010\004\020\005\"^\n\014One" - "ofOptions\022C\n\024uninterpreted_option\030\347\007 \003(\013" - "2$.google.protobuf.UninterpretedOption*\t" - "\010\350\007\020\200\200\200\200\002\"\223\001\n\013EnumOptions\022\023\n\013allow_alias" - "\030\002 \001(\010\022\031\n\ndeprecated\030\003 \001(\010:\005false\022C\n\024uni" - "nterpreted_option\030\347\007 \003(\0132$.google.protob" - "uf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002J\004\010\005\020\006\"" - "}\n\020EnumValueOptions\022\031\n\ndeprecated\030\001 \001(\010:" - "\005false\022C\n\024uninterpreted_option\030\347\007 \003(\0132$." - "google.protobuf.UninterpretedOption*\t\010\350\007" - "\020\200\200\200\200\002\"{\n\016ServiceOptions\022\031\n\ndeprecated\030!" - " \001(\010:\005false\022C\n\024uninterpreted_option\030\347\007 \003" - "(\0132$.google.protobuf.UninterpretedOption" - "*\t\010\350\007\020\200\200\200\200\002\"\255\002\n\rMethodOptions\022\031\n\ndepreca" - "ted\030! \001(\010:\005false\022_\n\021idempotency_level\030\" " - "\001(\0162/.google.protobuf.MethodOptions.Idem" - "potencyLevel:\023IDEMPOTENCY_UNKNOWN\022C\n\024uni" - "nterpreted_option\030\347\007 \003(\0132$.google.protob" - "uf.UninterpretedOption\"P\n\020IdempotencyLev" - "el\022\027\n\023IDEMPOTENCY_UNKNOWN\020\000\022\023\n\017NO_SIDE_E" - "FFECTS\020\001\022\016\n\nIDEMPOTENT\020\002*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023" - "UninterpretedOption\022;\n\004name\030\002 \003(\0132-.goog" - "le.protobuf.UninterpretedOption.NamePart" - "\022\030\n\020identifier_value\030\003 \001(\t\022\032\n\022positive_i" - "nt_value\030\004 \001(\004\022\032\n\022negative_int_value\030\005 \001" - "(\003\022\024\n\014double_value\030\006 \001(\001\022\024\n\014string_value" - "\030\007 \001(\014\022\027\n\017aggregate_value\030\010 \001(\t\0323\n\010NameP" - "art\022\021\n\tname_part\030\001 \002(\t\022\024\n\014is_extension\030\002" - " \002(\010\"\325\001\n\016SourceCodeInfo\022:\n\010location\030\001 \003(" - "\0132(.google.protobuf.SourceCodeInfo.Locat" - "ion\032\206\001\n\010Location\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004sp" - "an\030\002 \003(\005B\002\020\001\022\030\n\020leading_comments\030\003 \001(\t\022\031" - "\n\021trailing_comments\030\004 \001(\t\022!\n\031leading_det" - "ached_comments\030\006 \003(\t\"\247\001\n\021GeneratedCodeIn" - "fo\022A\n\nannotation\030\001 \003(\0132-.google.protobuf" - ".GeneratedCodeInfo.Annotation\032O\n\nAnnotat" - "ion\022\020\n\004path\030\001 \003(\005B\002\020\001\022\023\n\013source_file\030\002 \001" - "(\t\022\r\n\005begin\030\003 \001(\005\022\013\n\003end\030\004 \001(\005B\214\001\n\023com.g" - "oogle.protobufB\020DescriptorProtosH\001Z>gith" - "ub.com/golang/protobuf/protoc-gen-go/des" - "criptor;descriptor\242\002\003GPB\252\002\032Google.Protob" - "uf.Reflection" + "gle.protobuf.UninterpretedOption*\t\010\350\007\020\200\200" + "\200\200\002\"\255\002\n\rMethodOptions\022\031\n\ndeprecated\030! \001(" + "\010:\005false\022_\n\021idempotency_level\030\" \001(\0162/.go" + "ogle.protobuf.MethodOptions.IdempotencyL" + "evel:\023IDEMPOTENCY_UNKNOWN\022C\n\024uninterpret" + "ed_option\030\347\007 \003(\0132$.google.protobuf.Unint" + "erpretedOption\"P\n\020IdempotencyLevel\022\027\n\023ID" + "EMPOTENCY_UNKNOWN\020\000\022\023\n\017NO_SIDE_EFFECTS\020\001" + "\022\016\n\nIDEMPOTENT\020\002*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023Uninterp" + "retedOption\022;\n\004name\030\002 \003(\0132-.google.proto" + "buf.UninterpretedOption.NamePart\022\030\n\020iden" + "tifier_value\030\003 \001(\t\022\032\n\022positive_int_value" + "\030\004 \001(\004\022\032\n\022negative_int_value\030\005 \001(\003\022\024\n\014do" + "uble_value\030\006 \001(\001\022\024\n\014string_value\030\007 \001(\014\022\027" + "\n\017aggregate_value\030\010 \001(\t\0323\n\010NamePart\022\021\n\tn" + "ame_part\030\001 \002(\t\022\024\n\014is_extension\030\002 \002(\010\"\325\001\n" + "\016SourceCodeInfo\022:\n\010location\030\001 \003(\0132(.goog" + "le.protobuf.SourceCodeInfo.Location\032\206\001\n\010" + "Location\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005" + "B\002\020\001\022\030\n\020leading_comments\030\003 \001(\t\022\031\n\021traili" + "ng_comments\030\004 \001(\t\022!\n\031leading_detached_co" + "mments\030\006 \003(\t\"\247\001\n\021GeneratedCodeInfo\022A\n\nan" + "notation\030\001 \003(\0132-.google.protobuf.Generat" + "edCodeInfo.Annotation\032O\n\nAnnotation\022\020\n\004p" + "ath\030\001 \003(\005B\002\020\001\022\023\n\013source_file\030\002 \001(\t\022\r\n\005be" + "gin\030\003 \001(\005\022\013\n\003end\030\004 \001(\005B\217\001\n\023com.google.pr" + "otobufB\020DescriptorProtosH\001Z>github.com/g" + "olang/protobuf/protoc-gen-go/descriptor;" + "descriptor\370\001\001\242\002\003GPB\252\002\032Google.Protobuf.Re" + "flection" }; ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( - descriptor, 5813); + descriptor, 5968); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/descriptor.proto", &protobuf_RegisterTypes); } -} // anonymous namespace void AddDescriptors() { static GOOGLE_PROTOBUF_DECLARE_ONCE(once); @@ -897,9 +1394,9 @@ struct StaticDescriptorInitializer { AddDescriptors(); } } static_descriptor_initializer; - } // namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto - +namespace google { +namespace protobuf { const ::google::protobuf::EnumDescriptor* FieldDescriptorProto_Type_descriptor() { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_enum_descriptors[0]; @@ -1071,6 +1568,8 @@ const int MethodOptions::IdempotencyLevel_ARRAYSIZE; // =================================================================== +void FileDescriptorSet::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int FileDescriptorSet::kFileFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -1078,11 +1577,20 @@ const int FileDescriptorSet::kFileFieldNumber; FileDescriptorSet::FileDescriptorSet() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFileDescriptorSet(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.FileDescriptorSet) } +FileDescriptorSet::FileDescriptorSet(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _internal_metadata_(arena), + file_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFileDescriptorSet(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.FileDescriptorSet) +} FileDescriptorSet::FileDescriptorSet(const FileDescriptorSet& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -1103,29 +1611,32 @@ FileDescriptorSet::~FileDescriptorSet() { } void FileDescriptorSet::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } +void FileDescriptorSet::ArenaDtor(void* object) { + FileDescriptorSet* _this = reinterpret_cast< FileDescriptorSet* >(object); + (void)_this; +} +void FileDescriptorSet::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void FileDescriptorSet::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* FileDescriptorSet::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const FileDescriptorSet& FileDescriptorSet::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFileDescriptorSet(); return *internal_default_instance(); } FileDescriptorSet* FileDescriptorSet::New(::google::protobuf::Arena* arena) const { - FileDescriptorSet* n = new FileDescriptorSet; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<FileDescriptorSet>(arena); } void FileDescriptorSet::Clear() { @@ -1153,8 +1664,7 @@ bool FileDescriptorSet::MergePartialFromCodedStream( case 1: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_file())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_file())); } else { goto handle_unusual; } @@ -1212,7 +1722,7 @@ void FileDescriptorSet::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->file_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 1, this->file(static_cast<int>(i)), deterministic, target); } @@ -1239,7 +1749,7 @@ size_t FileDescriptorSet::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->file(static_cast<int>(i))); } } @@ -1297,6 +1807,21 @@ bool FileDescriptorSet::IsInitialized() const { void FileDescriptorSet::Swap(FileDescriptorSet* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + FileDescriptorSet* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void FileDescriptorSet::UnsafeArenaSwap(FileDescriptorSet* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void FileDescriptorSet::InternalSwap(FileDescriptorSet* other) { @@ -1309,46 +1834,52 @@ void FileDescriptorSet::InternalSwap(FileDescriptorSet* other) { ::google::protobuf::Metadata FileDescriptorSet::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// FileDescriptorSet -// repeated .google.protobuf.FileDescriptorProto file = 1; -int FileDescriptorSet::file_size() const { - return file_.size(); -} -void FileDescriptorSet::clear_file() { - file_.Clear(); -} -const ::google::protobuf::FileDescriptorProto& FileDescriptorSet::file(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorSet.file) - return file_.Get(index); +// =================================================================== + +void FileDescriptorProto::InitAsDefaultInstance() { + ::google::protobuf::_FileDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::FileOptions*>( + ::google::protobuf::FileOptions::internal_default_instance()); + ::google::protobuf::_FileDescriptorProto_default_instance_._instance.get_mutable()->source_code_info_ = const_cast< ::google::protobuf::SourceCodeInfo*>( + ::google::protobuf::SourceCodeInfo::internal_default_instance()); } -::google::protobuf::FileDescriptorProto* FileDescriptorSet::mutable_file(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorSet.file) - return file_.Mutable(index); +void FileDescriptorProto::_slow_mutable_options() { + options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::FileOptions >( + GetArenaNoVirtual()); } -::google::protobuf::FileDescriptorProto* FileDescriptorSet::add_file() { - // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorSet.file) - return file_.Add(); +void FileDescriptorProto::unsafe_arena_set_allocated_options( + ::google::protobuf::FileOptions* options) { + if (GetArenaNoVirtual() == NULL) { + delete options_; + } + options_ = options; + if (options) { + set_has_options(); + } else { + clear_has_options(); + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileDescriptorProto.options) } -::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >* -FileDescriptorSet::mutable_file() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorSet.file) - return &file_; +void FileDescriptorProto::_slow_mutable_source_code_info() { + source_code_info_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::SourceCodeInfo >( + GetArenaNoVirtual()); } -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >& -FileDescriptorSet::file() const { - // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorSet.file) - return file_; +void FileDescriptorProto::unsafe_arena_set_allocated_source_code_info( + ::google::protobuf::SourceCodeInfo* source_code_info) { + if (GetArenaNoVirtual() == NULL) { + delete source_code_info_; + } + source_code_info_ = source_code_info; + if (source_code_info) { + set_has_source_code_info(); + } else { + clear_has_source_code_info(); + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileDescriptorProto.source_code_info) } - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int FileDescriptorProto::kNameFieldNumber; const int FileDescriptorProto::kPackageFieldNumber; @@ -1367,11 +1898,26 @@ const int FileDescriptorProto::kSyntaxFieldNumber; FileDescriptorProto::FileDescriptorProto() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFileDescriptorProto(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.FileDescriptorProto) } +FileDescriptorProto::FileDescriptorProto(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _internal_metadata_(arena), + dependency_(arena), + message_type_(arena), + enum_type_(arena), + service_(arena), + extension_(arena), + public_dependency_(arena), + weak_dependency_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFileDescriptorProto(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.FileDescriptorProto) +} FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -1387,15 +1933,18 @@ FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from) _internal_metadata_.MergeFrom(from._internal_metadata_); name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_name()) { - name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(), + GetArenaNoVirtual()); } package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_package()) { - package_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.package_); + package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.package(), + GetArenaNoVirtual()); } syntax_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_syntax()) { - syntax_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.syntax_); + syntax_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.syntax(), + GetArenaNoVirtual()); } if (from.has_options()) { options_ = new ::google::protobuf::FileOptions(*from.options_); @@ -1426,6 +1975,7 @@ FileDescriptorProto::~FileDescriptorProto() { } void FileDescriptorProto::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); package_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); syntax_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -1433,27 +1983,29 @@ void FileDescriptorProto::SharedDtor() { if (this != internal_default_instance()) delete source_code_info_; } +void FileDescriptorProto::ArenaDtor(void* object) { + FileDescriptorProto* _this = reinterpret_cast< FileDescriptorProto* >(object); + (void)_this; +} +void FileDescriptorProto::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void FileDescriptorProto::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* FileDescriptorProto::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const FileDescriptorProto& FileDescriptorProto::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFileDescriptorProto(); return *internal_default_instance(); } FileDescriptorProto* FileDescriptorProto::New(::google::protobuf::Arena* arena) const { - FileDescriptorProto* n = new FileDescriptorProto; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<FileDescriptorProto>(arena); } void FileDescriptorProto::Clear() { @@ -1473,23 +2025,23 @@ void FileDescriptorProto::Clear() { if (cached_has_bits & 31u) { if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*name_.UnsafeRawStringPointer())->clear(); + name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000002u) { GOOGLE_DCHECK(!package_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*package_.UnsafeRawStringPointer())->clear(); + package_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000004u) { GOOGLE_DCHECK(!syntax_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*syntax_.UnsafeRawStringPointer())->clear(); + syntax_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000008u) { GOOGLE_DCHECK(options_ != NULL); - options_->::google::protobuf::FileOptions::Clear(); + options_->Clear(); } if (cached_has_bits & 0x00000010u) { GOOGLE_DCHECK(source_code_info_ != NULL); - source_code_info_->::google::protobuf::SourceCodeInfo::Clear(); + source_code_info_->Clear(); } } _has_bits_.Clear(); @@ -1559,8 +2111,7 @@ bool FileDescriptorProto::MergePartialFromCodedStream( case 4: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_message_type())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_message_type())); } else { goto handle_unusual; } @@ -1571,8 +2122,7 @@ bool FileDescriptorProto::MergePartialFromCodedStream( case 5: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_enum_type())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_enum_type())); } else { goto handle_unusual; } @@ -1583,8 +2133,7 @@ bool FileDescriptorProto::MergePartialFromCodedStream( case 6: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(50u /* 50 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_service())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_service())); } else { goto handle_unusual; } @@ -1595,8 +2144,7 @@ bool FileDescriptorProto::MergePartialFromCodedStream( case 7: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(58u /* 58 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_extension())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_extension())); } else { goto handle_unusual; } @@ -1607,7 +2155,7 @@ bool FileDescriptorProto::MergePartialFromCodedStream( case 8: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(66u /* 66 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_options())); } else { goto handle_unusual; @@ -1619,7 +2167,7 @@ bool FileDescriptorProto::MergePartialFromCodedStream( case 9: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(74u /* 74 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_source_code_info())); } else { goto handle_unusual; @@ -1851,7 +2399,7 @@ void FileDescriptorProto::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->message_type_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 4, this->message_type(static_cast<int>(i)), deterministic, target); } @@ -1859,7 +2407,7 @@ void FileDescriptorProto::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->enum_type_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 5, this->enum_type(static_cast<int>(i)), deterministic, target); } @@ -1867,7 +2415,7 @@ void FileDescriptorProto::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->service_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 6, this->service(static_cast<int>(i)), deterministic, target); } @@ -1875,21 +2423,21 @@ void FileDescriptorProto::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->extension_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 7, this->extension(static_cast<int>(i)), deterministic, target); } // optional .google.protobuf.FileOptions options = 8; if (cached_has_bits & 0x00000008u) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 8, *this->options_, deterministic, target); } // optional .google.protobuf.SourceCodeInfo source_code_info = 9; if (cached_has_bits & 0x00000010u) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 9, *this->source_code_info_, deterministic, target); } @@ -1943,7 +2491,7 @@ size_t FileDescriptorProto::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->message_type(static_cast<int>(i))); } } @@ -1954,7 +2502,7 @@ size_t FileDescriptorProto::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->enum_type(static_cast<int>(i))); } } @@ -1965,7 +2513,7 @@ size_t FileDescriptorProto::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->service(static_cast<int>(i))); } } @@ -1976,7 +2524,7 @@ size_t FileDescriptorProto::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->extension(static_cast<int>(i))); } } @@ -2024,14 +2572,14 @@ size_t FileDescriptorProto::ByteSizeLong() const { // optional .google.protobuf.FileOptions options = 8; if (has_options()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *this->options_); } // optional .google.protobuf.SourceCodeInfo source_code_info = 9; if (has_source_code_info()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *this->source_code_info_); } @@ -2075,16 +2623,13 @@ void FileDescriptorProto::MergeFrom(const FileDescriptorProto& from) { cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 31u) { if (cached_has_bits & 0x00000001u) { - set_has_name(); - name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + set_name(from.name()); } if (cached_has_bits & 0x00000002u) { - set_has_package(); - package_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.package_); + set_package(from.package()); } if (cached_has_bits & 0x00000004u) { - set_has_syntax(); - syntax_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.syntax_); + set_syntax(from.syntax()); } if (cached_has_bits & 0x00000008u) { mutable_options()->::google::protobuf::FileOptions::MergeFrom(from.options()); @@ -2122,6 +2667,21 @@ bool FileDescriptorProto::IsInitialized() const { void FileDescriptorProto::Swap(FileDescriptorProto* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + FileDescriptorProto* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void FileDescriptorProto::UnsafeArenaSwap(FileDescriptorProto* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void FileDescriptorProto::InternalSwap(FileDescriptorProto* other) { @@ -2145,546 +2705,33 @@ void FileDescriptorProto::InternalSwap(FileDescriptorProto* other) { ::google::protobuf::Metadata FileDescriptorProto::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// FileDescriptorProto - -// optional string name = 1; -bool FileDescriptorProto::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void FileDescriptorProto::set_has_name() { - _has_bits_[0] |= 0x00000001u; -} -void FileDescriptorProto::clear_has_name() { - _has_bits_[0] &= ~0x00000001u; -} -void FileDescriptorProto::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_name(); -} -const ::std::string& FileDescriptorProto::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.name) - return name_.GetNoArena(); -} -void FileDescriptorProto::set_name(const ::std::string& value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.name) -} -#if LANG_CXX11 -void FileDescriptorProto::set_name(::std::string&& value) { - set_has_name(); - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileDescriptorProto.name) -} -#endif -void FileDescriptorProto::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.name) -} -void FileDescriptorProto::set_name(const char* value, size_t size) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.name) -} -::std::string* FileDescriptorProto::mutable_name() { - set_has_name(); - // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* FileDescriptorProto::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.name) - clear_has_name(); - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void FileDescriptorProto::set_allocated_name(::std::string* name) { - if (name != NULL) { - set_has_name(); - } else { - clear_has_name(); - } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.name) -} - -// optional string package = 2; -bool FileDescriptorProto::has_package() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void FileDescriptorProto::set_has_package() { - _has_bits_[0] |= 0x00000002u; -} -void FileDescriptorProto::clear_has_package() { - _has_bits_[0] &= ~0x00000002u; -} -void FileDescriptorProto::clear_package() { - package_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_package(); -} -const ::std::string& FileDescriptorProto::package() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.package) - return package_.GetNoArena(); -} -void FileDescriptorProto::set_package(const ::std::string& value) { - set_has_package(); - package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.package) -} -#if LANG_CXX11 -void FileDescriptorProto::set_package(::std::string&& value) { - set_has_package(); - package_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileDescriptorProto.package) -} -#endif -void FileDescriptorProto::set_package(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_package(); - package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.package) -} -void FileDescriptorProto::set_package(const char* value, size_t size) { - set_has_package(); - package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.package) -} -::std::string* FileDescriptorProto::mutable_package() { - set_has_package(); - // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.package) - return package_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* FileDescriptorProto::release_package() { - // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.package) - clear_has_package(); - return package_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void FileDescriptorProto::set_allocated_package(::std::string* package) { - if (package != NULL) { - set_has_package(); - } else { - clear_has_package(); - } - package_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), package); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.package) -} - -// repeated string dependency = 3; -int FileDescriptorProto::dependency_size() const { - return dependency_.size(); -} -void FileDescriptorProto::clear_dependency() { - dependency_.Clear(); -} -const ::std::string& FileDescriptorProto::dependency(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.dependency) - return dependency_.Get(index); -} -::std::string* FileDescriptorProto::mutable_dependency(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.dependency) - return dependency_.Mutable(index); -} -void FileDescriptorProto::set_dependency(int index, const ::std::string& value) { - // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.dependency) - dependency_.Mutable(index)->assign(value); -} -#if LANG_CXX11 -void FileDescriptorProto::set_dependency(int index, ::std::string&& value) { - // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.dependency) - dependency_.Mutable(index)->assign(std::move(value)); -} -#endif -void FileDescriptorProto::set_dependency(int index, const char* value) { - GOOGLE_DCHECK(value != NULL); - dependency_.Mutable(index)->assign(value); - // @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.dependency) -} -void FileDescriptorProto::set_dependency(int index, const char* value, size_t size) { - dependency_.Mutable(index)->assign( - reinterpret_cast<const char*>(value), size); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.dependency) -} -::std::string* FileDescriptorProto::add_dependency() { - // @@protoc_insertion_point(field_add_mutable:google.protobuf.FileDescriptorProto.dependency) - return dependency_.Add(); -} -void FileDescriptorProto::add_dependency(const ::std::string& value) { - dependency_.Add()->assign(value); - // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.dependency) -} -#if LANG_CXX11 -void FileDescriptorProto::add_dependency(::std::string&& value) { - dependency_.Add(std::move(value)); - // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.dependency) -} -#endif -void FileDescriptorProto::add_dependency(const char* value) { - GOOGLE_DCHECK(value != NULL); - dependency_.Add()->assign(value); - // @@protoc_insertion_point(field_add_char:google.protobuf.FileDescriptorProto.dependency) -} -void FileDescriptorProto::add_dependency(const char* value, size_t size) { - dependency_.Add()->assign(reinterpret_cast<const char*>(value), size); - // @@protoc_insertion_point(field_add_pointer:google.protobuf.FileDescriptorProto.dependency) -} -const ::google::protobuf::RepeatedPtrField< ::std::string>& -FileDescriptorProto::dependency() const { - // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.dependency) - return dependency_; -} -::google::protobuf::RepeatedPtrField< ::std::string>* -FileDescriptorProto::mutable_dependency() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.dependency) - return &dependency_; -} - -// repeated int32 public_dependency = 10; -int FileDescriptorProto::public_dependency_size() const { - return public_dependency_.size(); -} -void FileDescriptorProto::clear_public_dependency() { - public_dependency_.Clear(); -} -::google::protobuf::int32 FileDescriptorProto::public_dependency(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.public_dependency) - return public_dependency_.Get(index); -} -void FileDescriptorProto::set_public_dependency(int index, ::google::protobuf::int32 value) { - public_dependency_.Set(index, value); - // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.public_dependency) -} -void FileDescriptorProto::add_public_dependency(::google::protobuf::int32 value) { - public_dependency_.Add(value); - // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.public_dependency) -} -const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& -FileDescriptorProto::public_dependency() const { - // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.public_dependency) - return public_dependency_; -} -::google::protobuf::RepeatedField< ::google::protobuf::int32 >* -FileDescriptorProto::mutable_public_dependency() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.public_dependency) - return &public_dependency_; -} - -// repeated int32 weak_dependency = 11; -int FileDescriptorProto::weak_dependency_size() const { - return weak_dependency_.size(); -} -void FileDescriptorProto::clear_weak_dependency() { - weak_dependency_.Clear(); -} -::google::protobuf::int32 FileDescriptorProto::weak_dependency(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.weak_dependency) - return weak_dependency_.Get(index); -} -void FileDescriptorProto::set_weak_dependency(int index, ::google::protobuf::int32 value) { - weak_dependency_.Set(index, value); - // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.weak_dependency) -} -void FileDescriptorProto::add_weak_dependency(::google::protobuf::int32 value) { - weak_dependency_.Add(value); - // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.weak_dependency) -} -const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& -FileDescriptorProto::weak_dependency() const { - // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.weak_dependency) - return weak_dependency_; -} -::google::protobuf::RepeatedField< ::google::protobuf::int32 >* -FileDescriptorProto::mutable_weak_dependency() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.weak_dependency) - return &weak_dependency_; -} - -// repeated .google.protobuf.DescriptorProto message_type = 4; -int FileDescriptorProto::message_type_size() const { - return message_type_.size(); -} -void FileDescriptorProto::clear_message_type() { - message_type_.Clear(); -} -const ::google::protobuf::DescriptorProto& FileDescriptorProto::message_type(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.message_type) - return message_type_.Get(index); -} -::google::protobuf::DescriptorProto* FileDescriptorProto::mutable_message_type(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.message_type) - return message_type_.Mutable(index); -} -::google::protobuf::DescriptorProto* FileDescriptorProto::add_message_type() { - // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.message_type) - return message_type_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >* -FileDescriptorProto::mutable_message_type() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.message_type) - return &message_type_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >& -FileDescriptorProto::message_type() const { - // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.message_type) - return message_type_; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -// repeated .google.protobuf.EnumDescriptorProto enum_type = 5; -int FileDescriptorProto::enum_type_size() const { - return enum_type_.size(); -} -void FileDescriptorProto::clear_enum_type() { - enum_type_.Clear(); -} -const ::google::protobuf::EnumDescriptorProto& FileDescriptorProto::enum_type(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.enum_type) - return enum_type_.Get(index); -} -::google::protobuf::EnumDescriptorProto* FileDescriptorProto::mutable_enum_type(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.enum_type) - return enum_type_.Mutable(index); -} -::google::protobuf::EnumDescriptorProto* FileDescriptorProto::add_enum_type() { - // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.enum_type) - return enum_type_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >* -FileDescriptorProto::mutable_enum_type() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.enum_type) - return &enum_type_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >& -FileDescriptorProto::enum_type() const { - // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.enum_type) - return enum_type_; -} - -// repeated .google.protobuf.ServiceDescriptorProto service = 6; -int FileDescriptorProto::service_size() const { - return service_.size(); -} -void FileDescriptorProto::clear_service() { - service_.Clear(); -} -const ::google::protobuf::ServiceDescriptorProto& FileDescriptorProto::service(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.service) - return service_.Get(index); -} -::google::protobuf::ServiceDescriptorProto* FileDescriptorProto::mutable_service(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.service) - return service_.Mutable(index); -} -::google::protobuf::ServiceDescriptorProto* FileDescriptorProto::add_service() { - // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.service) - return service_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto >* -FileDescriptorProto::mutable_service() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.service) - return &service_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto >& -FileDescriptorProto::service() const { - // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.service) - return service_; -} -// repeated .google.protobuf.FieldDescriptorProto extension = 7; -int FileDescriptorProto::extension_size() const { - return extension_.size(); -} -void FileDescriptorProto::clear_extension() { - extension_.Clear(); -} -const ::google::protobuf::FieldDescriptorProto& FileDescriptorProto::extension(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.extension) - return extension_.Get(index); -} -::google::protobuf::FieldDescriptorProto* FileDescriptorProto::mutable_extension(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.extension) - return extension_.Mutable(index); -} -::google::protobuf::FieldDescriptorProto* FileDescriptorProto::add_extension() { - // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.extension) - return extension_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >* -FileDescriptorProto::mutable_extension() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.extension) - return &extension_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >& -FileDescriptorProto::extension() const { - // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.extension) - return extension_; -} +// =================================================================== -// optional .google.protobuf.FileOptions options = 8; -bool FileDescriptorProto::has_options() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -void FileDescriptorProto::set_has_options() { - _has_bits_[0] |= 0x00000008u; -} -void FileDescriptorProto::clear_has_options() { - _has_bits_[0] &= ~0x00000008u; -} -void FileDescriptorProto::clear_options() { - if (options_ != NULL) options_->::google::protobuf::FileOptions::Clear(); - clear_has_options(); +void DescriptorProto_ExtensionRange::InitAsDefaultInstance() { + ::google::protobuf::_DescriptorProto_ExtensionRange_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::ExtensionRangeOptions*>( + ::google::protobuf::ExtensionRangeOptions::internal_default_instance()); } -const ::google::protobuf::FileOptions& FileDescriptorProto::options() const { - const ::google::protobuf::FileOptions* p = options_; - // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.options) - return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::FileOptions*>( - &::google::protobuf::_FileOptions_default_instance_); +void DescriptorProto_ExtensionRange::_slow_mutable_options() { + options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::ExtensionRangeOptions >( + GetArenaNoVirtual()); } -::google::protobuf::FileOptions* FileDescriptorProto::mutable_options() { - set_has_options(); - if (options_ == NULL) { - options_ = new ::google::protobuf::FileOptions; +void DescriptorProto_ExtensionRange::unsafe_arena_set_allocated_options( + ::google::protobuf::ExtensionRangeOptions* options) { + if (GetArenaNoVirtual() == NULL) { + delete options_; } - // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.options) - return options_; -} -::google::protobuf::FileOptions* FileDescriptorProto::release_options() { - // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.options) - clear_has_options(); - ::google::protobuf::FileOptions* temp = options_; - options_ = NULL; - return temp; -} -void FileDescriptorProto::set_allocated_options(::google::protobuf::FileOptions* options) { - delete options_; options_ = options; if (options) { set_has_options(); } else { clear_has_options(); } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.options) -} - -// optional .google.protobuf.SourceCodeInfo source_code_info = 9; -bool FileDescriptorProto::has_source_code_info() const { - return (_has_bits_[0] & 0x00000010u) != 0; -} -void FileDescriptorProto::set_has_source_code_info() { - _has_bits_[0] |= 0x00000010u; + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.DescriptorProto.ExtensionRange.options) } -void FileDescriptorProto::clear_has_source_code_info() { - _has_bits_[0] &= ~0x00000010u; -} -void FileDescriptorProto::clear_source_code_info() { - if (source_code_info_ != NULL) source_code_info_->::google::protobuf::SourceCodeInfo::Clear(); - clear_has_source_code_info(); -} -const ::google::protobuf::SourceCodeInfo& FileDescriptorProto::source_code_info() const { - const ::google::protobuf::SourceCodeInfo* p = source_code_info_; - // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.source_code_info) - return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::SourceCodeInfo*>( - &::google::protobuf::_SourceCodeInfo_default_instance_); -} -::google::protobuf::SourceCodeInfo* FileDescriptorProto::mutable_source_code_info() { - set_has_source_code_info(); - if (source_code_info_ == NULL) { - source_code_info_ = new ::google::protobuf::SourceCodeInfo; - } - // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.source_code_info) - return source_code_info_; -} -::google::protobuf::SourceCodeInfo* FileDescriptorProto::release_source_code_info() { - // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.source_code_info) - clear_has_source_code_info(); - ::google::protobuf::SourceCodeInfo* temp = source_code_info_; - source_code_info_ = NULL; - return temp; -} -void FileDescriptorProto::set_allocated_source_code_info(::google::protobuf::SourceCodeInfo* source_code_info) { - delete source_code_info_; - source_code_info_ = source_code_info; - if (source_code_info) { - set_has_source_code_info(); - } else { - clear_has_source_code_info(); - } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.source_code_info) -} - -// optional string syntax = 12; -bool FileDescriptorProto::has_syntax() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void FileDescriptorProto::set_has_syntax() { - _has_bits_[0] |= 0x00000004u; -} -void FileDescriptorProto::clear_has_syntax() { - _has_bits_[0] &= ~0x00000004u; -} -void FileDescriptorProto::clear_syntax() { - syntax_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_syntax(); -} -const ::std::string& FileDescriptorProto::syntax() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.syntax) - return syntax_.GetNoArena(); -} -void FileDescriptorProto::set_syntax(const ::std::string& value) { - set_has_syntax(); - syntax_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.syntax) -} -#if LANG_CXX11 -void FileDescriptorProto::set_syntax(::std::string&& value) { - set_has_syntax(); - syntax_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileDescriptorProto.syntax) -} -#endif -void FileDescriptorProto::set_syntax(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_syntax(); - syntax_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.syntax) -} -void FileDescriptorProto::set_syntax(const char* value, size_t size) { - set_has_syntax(); - syntax_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.syntax) -} -::std::string* FileDescriptorProto::mutable_syntax() { - set_has_syntax(); - // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.syntax) - return syntax_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* FileDescriptorProto::release_syntax() { - // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.syntax) - clear_has_syntax(); - return syntax_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void FileDescriptorProto::set_allocated_syntax(::std::string* syntax) { - if (syntax != NULL) { - set_has_syntax(); - } else { - clear_has_syntax(); - } - syntax_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), syntax); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.syntax) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int DescriptorProto_ExtensionRange::kStartFieldNumber; const int DescriptorProto_ExtensionRange::kEndFieldNumber; @@ -2694,11 +2741,19 @@ const int DescriptorProto_ExtensionRange::kOptionsFieldNumber; DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsDescriptorProto_ExtensionRange(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.DescriptorProto.ExtensionRange) } +DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _internal_metadata_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsDescriptorProto_ExtensionRange(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.DescriptorProto.ExtensionRange) +} DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(const DescriptorProto_ExtensionRange& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -2729,30 +2784,33 @@ DescriptorProto_ExtensionRange::~DescriptorProto_ExtensionRange() { } void DescriptorProto_ExtensionRange::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); if (this != internal_default_instance()) delete options_; } +void DescriptorProto_ExtensionRange::ArenaDtor(void* object) { + DescriptorProto_ExtensionRange* _this = reinterpret_cast< DescriptorProto_ExtensionRange* >(object); + (void)_this; +} +void DescriptorProto_ExtensionRange::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void DescriptorProto_ExtensionRange::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* DescriptorProto_ExtensionRange::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const DescriptorProto_ExtensionRange& DescriptorProto_ExtensionRange::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsDescriptorProto_ExtensionRange(); return *internal_default_instance(); } DescriptorProto_ExtensionRange* DescriptorProto_ExtensionRange::New(::google::protobuf::Arena* arena) const { - DescriptorProto_ExtensionRange* n = new DescriptorProto_ExtensionRange; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<DescriptorProto_ExtensionRange>(arena); } void DescriptorProto_ExtensionRange::Clear() { @@ -2761,11 +2819,11 @@ void DescriptorProto_ExtensionRange::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - if (has_options()) { + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(options_ != NULL); - options_->::google::protobuf::ExtensionRangeOptions::Clear(); + options_->Clear(); } - cached_has_bits = _has_bits_[0]; if (cached_has_bits & 6u) { ::memset(&start_, 0, static_cast<size_t>( reinterpret_cast<char*>(&end_) - @@ -2817,7 +2875,7 @@ bool DescriptorProto_ExtensionRange::MergePartialFromCodedStream( case 3: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_options())); } else { goto handle_unusual; @@ -2896,7 +2954,7 @@ void DescriptorProto_ExtensionRange::SerializeWithCachedSizes( // optional .google.protobuf.ExtensionRangeOptions options = 3; if (cached_has_bits & 0x00000001u) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 3, *this->options_, deterministic, target); } @@ -2921,7 +2979,7 @@ size_t DescriptorProto_ExtensionRange::ByteSizeLong() const { // optional .google.protobuf.ExtensionRangeOptions options = 3; if (has_options()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *this->options_); } @@ -3007,6 +3065,21 @@ bool DescriptorProto_ExtensionRange::IsInitialized() const { void DescriptorProto_ExtensionRange::Swap(DescriptorProto_ExtensionRange* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + DescriptorProto_ExtensionRange* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void DescriptorProto_ExtensionRange::UnsafeArenaSwap(DescriptorProto_ExtensionRange* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void DescriptorProto_ExtensionRange::InternalSwap(DescriptorProto_ExtensionRange* other) { @@ -3021,110 +3094,14 @@ void DescriptorProto_ExtensionRange::InternalSwap(DescriptorProto_ExtensionRange ::google::protobuf::Metadata DescriptorProto_ExtensionRange::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// DescriptorProto_ExtensionRange - -// optional int32 start = 1; -bool DescriptorProto_ExtensionRange::has_start() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void DescriptorProto_ExtensionRange::set_has_start() { - _has_bits_[0] |= 0x00000002u; -} -void DescriptorProto_ExtensionRange::clear_has_start() { - _has_bits_[0] &= ~0x00000002u; -} -void DescriptorProto_ExtensionRange::clear_start() { - start_ = 0; - clear_has_start(); -} -::google::protobuf::int32 DescriptorProto_ExtensionRange::start() const { - // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.start) - return start_; -} -void DescriptorProto_ExtensionRange::set_start(::google::protobuf::int32 value) { - set_has_start(); - start_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ExtensionRange.start) -} - -// optional int32 end = 2; -bool DescriptorProto_ExtensionRange::has_end() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void DescriptorProto_ExtensionRange::set_has_end() { - _has_bits_[0] |= 0x00000004u; -} -void DescriptorProto_ExtensionRange::clear_has_end() { - _has_bits_[0] &= ~0x00000004u; -} -void DescriptorProto_ExtensionRange::clear_end() { - end_ = 0; - clear_has_end(); -} -::google::protobuf::int32 DescriptorProto_ExtensionRange::end() const { - // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.end) - return end_; -} -void DescriptorProto_ExtensionRange::set_end(::google::protobuf::int32 value) { - set_has_end(); - end_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ExtensionRange.end) -} - -// optional .google.protobuf.ExtensionRangeOptions options = 3; -bool DescriptorProto_ExtensionRange::has_options() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void DescriptorProto_ExtensionRange::set_has_options() { - _has_bits_[0] |= 0x00000001u; -} -void DescriptorProto_ExtensionRange::clear_has_options() { - _has_bits_[0] &= ~0x00000001u; -} -void DescriptorProto_ExtensionRange::clear_options() { - if (options_ != NULL) options_->::google::protobuf::ExtensionRangeOptions::Clear(); - clear_has_options(); -} -const ::google::protobuf::ExtensionRangeOptions& DescriptorProto_ExtensionRange::options() const { - const ::google::protobuf::ExtensionRangeOptions* p = options_; - // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.options) - return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::ExtensionRangeOptions*>( - &::google::protobuf::_ExtensionRangeOptions_default_instance_); -} -::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange::mutable_options() { - set_has_options(); - if (options_ == NULL) { - options_ = new ::google::protobuf::ExtensionRangeOptions; - } - // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.ExtensionRange.options) - return options_; -} -::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange::release_options() { - // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.ExtensionRange.options) - clear_has_options(); - ::google::protobuf::ExtensionRangeOptions* temp = options_; - options_ = NULL; - return temp; -} -void DescriptorProto_ExtensionRange::set_allocated_options(::google::protobuf::ExtensionRangeOptions* options) { - delete options_; - options_ = options; - if (options) { - set_has_options(); - } else { - clear_has_options(); - } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.ExtensionRange.options) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void DescriptorProto_ReservedRange::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int DescriptorProto_ReservedRange::kStartFieldNumber; const int DescriptorProto_ReservedRange::kEndFieldNumber; @@ -3133,11 +3110,19 @@ const int DescriptorProto_ReservedRange::kEndFieldNumber; DescriptorProto_ReservedRange::DescriptorProto_ReservedRange() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsDescriptorProto_ReservedRange(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.DescriptorProto.ReservedRange) } +DescriptorProto_ReservedRange::DescriptorProto_ReservedRange(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _internal_metadata_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsDescriptorProto_ReservedRange(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.DescriptorProto.ReservedRange) +} DescriptorProto_ReservedRange::DescriptorProto_ReservedRange(const DescriptorProto_ReservedRange& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -3163,29 +3148,32 @@ DescriptorProto_ReservedRange::~DescriptorProto_ReservedRange() { } void DescriptorProto_ReservedRange::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } +void DescriptorProto_ReservedRange::ArenaDtor(void* object) { + DescriptorProto_ReservedRange* _this = reinterpret_cast< DescriptorProto_ReservedRange* >(object); + (void)_this; +} +void DescriptorProto_ReservedRange::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void DescriptorProto_ReservedRange::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* DescriptorProto_ReservedRange::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const DescriptorProto_ReservedRange& DescriptorProto_ReservedRange::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsDescriptorProto_ReservedRange(); return *internal_default_instance(); } DescriptorProto_ReservedRange* DescriptorProto_ReservedRange::New(::google::protobuf::Arena* arena) const { - DescriptorProto_ReservedRange* n = new DescriptorProto_ReservedRange; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<DescriptorProto_ReservedRange>(arena); } void DescriptorProto_ReservedRange::Clear() { @@ -3398,6 +3386,21 @@ bool DescriptorProto_ReservedRange::IsInitialized() const { void DescriptorProto_ReservedRange::Swap(DescriptorProto_ReservedRange* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + DescriptorProto_ReservedRange* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void DescriptorProto_ReservedRange::UnsafeArenaSwap(DescriptorProto_ReservedRange* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void DescriptorProto_ReservedRange::InternalSwap(DescriptorProto_ReservedRange* other) { @@ -3411,64 +3414,33 @@ void DescriptorProto_ReservedRange::InternalSwap(DescriptorProto_ReservedRange* ::google::protobuf::Metadata DescriptorProto_ReservedRange::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// DescriptorProto_ReservedRange -// optional int32 start = 1; -bool DescriptorProto_ReservedRange::has_start() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void DescriptorProto_ReservedRange::set_has_start() { - _has_bits_[0] |= 0x00000001u; -} -void DescriptorProto_ReservedRange::clear_has_start() { - _has_bits_[0] &= ~0x00000001u; -} -void DescriptorProto_ReservedRange::clear_start() { - start_ = 0; - clear_has_start(); -} -::google::protobuf::int32 DescriptorProto_ReservedRange::start() const { - // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ReservedRange.start) - return start_; -} -void DescriptorProto_ReservedRange::set_start(::google::protobuf::int32 value) { - set_has_start(); - start_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ReservedRange.start) -} +// =================================================================== -// optional int32 end = 2; -bool DescriptorProto_ReservedRange::has_end() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void DescriptorProto_ReservedRange::set_has_end() { - _has_bits_[0] |= 0x00000002u; -} -void DescriptorProto_ReservedRange::clear_has_end() { - _has_bits_[0] &= ~0x00000002u; -} -void DescriptorProto_ReservedRange::clear_end() { - end_ = 0; - clear_has_end(); +void DescriptorProto::InitAsDefaultInstance() { + ::google::protobuf::_DescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::MessageOptions*>( + ::google::protobuf::MessageOptions::internal_default_instance()); } -::google::protobuf::int32 DescriptorProto_ReservedRange::end() const { - // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ReservedRange.end) - return end_; +void DescriptorProto::_slow_mutable_options() { + options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::MessageOptions >( + GetArenaNoVirtual()); } -void DescriptorProto_ReservedRange::set_end(::google::protobuf::int32 value) { - set_has_end(); - end_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ReservedRange.end) +void DescriptorProto::unsafe_arena_set_allocated_options( + ::google::protobuf::MessageOptions* options) { + if (GetArenaNoVirtual() == NULL) { + delete options_; + } + options_ = options; + if (options) { + set_has_options(); + } else { + clear_has_options(); + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.DescriptorProto.options) } - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int DescriptorProto::kNameFieldNumber; const int DescriptorProto::kFieldFieldNumber; @@ -3485,11 +3457,27 @@ const int DescriptorProto::kReservedNameFieldNumber; DescriptorProto::DescriptorProto() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsDescriptorProto(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.DescriptorProto) } +DescriptorProto::DescriptorProto(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _internal_metadata_(arena), + field_(arena), + nested_type_(arena), + enum_type_(arena), + extension_range_(arena), + extension_(arena), + oneof_decl_(arena), + reserved_range_(arena), + reserved_name_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsDescriptorProto(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.DescriptorProto) +} DescriptorProto::DescriptorProto(const DescriptorProto& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -3506,7 +3494,8 @@ DescriptorProto::DescriptorProto(const DescriptorProto& from) _internal_metadata_.MergeFrom(from._internal_metadata_); name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_name()) { - name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(), + GetArenaNoVirtual()); } if (from.has_options()) { options_ = new ::google::protobuf::MessageOptions(*from.options_); @@ -3528,31 +3517,34 @@ DescriptorProto::~DescriptorProto() { } void DescriptorProto::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (this != internal_default_instance()) delete options_; } +void DescriptorProto::ArenaDtor(void* object) { + DescriptorProto* _this = reinterpret_cast< DescriptorProto* >(object); + (void)_this; +} +void DescriptorProto::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void DescriptorProto::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* DescriptorProto::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const DescriptorProto& DescriptorProto::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsDescriptorProto(); return *internal_default_instance(); } DescriptorProto* DescriptorProto::New(::google::protobuf::Arena* arena) const { - DescriptorProto* n = new DescriptorProto; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<DescriptorProto>(arena); } void DescriptorProto::Clear() { @@ -3573,11 +3565,11 @@ void DescriptorProto::Clear() { if (cached_has_bits & 3u) { if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*name_.UnsafeRawStringPointer())->clear(); + name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000002u) { GOOGLE_DCHECK(options_ != NULL); - options_->::google::protobuf::MessageOptions::Clear(); + options_->Clear(); } } _has_bits_.Clear(); @@ -3614,8 +3606,7 @@ bool DescriptorProto::MergePartialFromCodedStream( case 2: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_field())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_field())); } else { goto handle_unusual; } @@ -3626,8 +3617,7 @@ bool DescriptorProto::MergePartialFromCodedStream( case 3: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_nested_type())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_nested_type())); } else { goto handle_unusual; } @@ -3638,8 +3628,7 @@ bool DescriptorProto::MergePartialFromCodedStream( case 4: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_enum_type())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_enum_type())); } else { goto handle_unusual; } @@ -3650,8 +3639,7 @@ bool DescriptorProto::MergePartialFromCodedStream( case 5: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_extension_range())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_extension_range())); } else { goto handle_unusual; } @@ -3662,8 +3650,7 @@ bool DescriptorProto::MergePartialFromCodedStream( case 6: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(50u /* 50 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_extension())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_extension())); } else { goto handle_unusual; } @@ -3674,7 +3661,7 @@ bool DescriptorProto::MergePartialFromCodedStream( case 7: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(58u /* 58 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_options())); } else { goto handle_unusual; @@ -3686,8 +3673,7 @@ bool DescriptorProto::MergePartialFromCodedStream( case 8: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(66u /* 66 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_oneof_decl())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_oneof_decl())); } else { goto handle_unusual; } @@ -3698,8 +3684,7 @@ bool DescriptorProto::MergePartialFromCodedStream( case 9: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(74u /* 74 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_reserved_range())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_reserved_range())); } else { goto handle_unusual; } @@ -3855,7 +3840,7 @@ void DescriptorProto::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->field_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 2, this->field(static_cast<int>(i)), deterministic, target); } @@ -3863,7 +3848,7 @@ void DescriptorProto::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->nested_type_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 3, this->nested_type(static_cast<int>(i)), deterministic, target); } @@ -3871,7 +3856,7 @@ void DescriptorProto::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->enum_type_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 4, this->enum_type(static_cast<int>(i)), deterministic, target); } @@ -3879,7 +3864,7 @@ void DescriptorProto::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->extension_range_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 5, this->extension_range(static_cast<int>(i)), deterministic, target); } @@ -3887,14 +3872,14 @@ void DescriptorProto::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->extension_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 6, this->extension(static_cast<int>(i)), deterministic, target); } // optional .google.protobuf.MessageOptions options = 7; if (cached_has_bits & 0x00000002u) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 7, *this->options_, deterministic, target); } @@ -3902,7 +3887,7 @@ void DescriptorProto::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->oneof_decl_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 8, this->oneof_decl(static_cast<int>(i)), deterministic, target); } @@ -3910,7 +3895,7 @@ void DescriptorProto::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->reserved_range_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 9, this->reserved_range(static_cast<int>(i)), deterministic, target); } @@ -3947,7 +3932,7 @@ size_t DescriptorProto::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->field(static_cast<int>(i))); } } @@ -3958,7 +3943,7 @@ size_t DescriptorProto::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->nested_type(static_cast<int>(i))); } } @@ -3969,7 +3954,7 @@ size_t DescriptorProto::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->enum_type(static_cast<int>(i))); } } @@ -3980,7 +3965,7 @@ size_t DescriptorProto::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->extension_range(static_cast<int>(i))); } } @@ -3991,7 +3976,7 @@ size_t DescriptorProto::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->extension(static_cast<int>(i))); } } @@ -4002,7 +3987,7 @@ size_t DescriptorProto::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->oneof_decl(static_cast<int>(i))); } } @@ -4013,7 +3998,7 @@ size_t DescriptorProto::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->reserved_range(static_cast<int>(i))); } } @@ -4037,7 +4022,7 @@ size_t DescriptorProto::ByteSizeLong() const { // optional .google.protobuf.MessageOptions options = 7; if (has_options()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *this->options_); } @@ -4082,8 +4067,7 @@ void DescriptorProto::MergeFrom(const DescriptorProto& from) { cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 3u) { if (cached_has_bits & 0x00000001u) { - set_has_name(); - name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + set_name(from.name()); } if (cached_has_bits & 0x00000002u) { mutable_options()->::google::protobuf::MessageOptions::MergeFrom(from.options()); @@ -4120,6 +4104,21 @@ bool DescriptorProto::IsInitialized() const { void DescriptorProto::Swap(DescriptorProto* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + DescriptorProto* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void DescriptorProto::UnsafeArenaSwap(DescriptorProto* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void DescriptorProto::InternalSwap(DescriptorProto* other) { @@ -4141,404 +4140,14 @@ void DescriptorProto::InternalSwap(DescriptorProto* other) { ::google::protobuf::Metadata DescriptorProto::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// DescriptorProto - -// optional string name = 1; -bool DescriptorProto::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void DescriptorProto::set_has_name() { - _has_bits_[0] |= 0x00000001u; -} -void DescriptorProto::clear_has_name() { - _has_bits_[0] &= ~0x00000001u; -} -void DescriptorProto::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_name(); -} -const ::std::string& DescriptorProto::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.name) - return name_.GetNoArena(); -} -void DescriptorProto::set_name(const ::std::string& value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.name) -} -#if LANG_CXX11 -void DescriptorProto::set_name(::std::string&& value) { - set_has_name(); - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.DescriptorProto.name) -} -#endif -void DescriptorProto::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.DescriptorProto.name) -} -void DescriptorProto::set_name(const char* value, size_t size) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.DescriptorProto.name) -} -::std::string* DescriptorProto::mutable_name() { - set_has_name(); - // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* DescriptorProto::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.name) - clear_has_name(); - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void DescriptorProto::set_allocated_name(::std::string* name) { - if (name != NULL) { - set_has_name(); - } else { - clear_has_name(); - } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.name) -} - -// repeated .google.protobuf.FieldDescriptorProto field = 2; -int DescriptorProto::field_size() const { - return field_.size(); -} -void DescriptorProto::clear_field() { - field_.Clear(); -} -const ::google::protobuf::FieldDescriptorProto& DescriptorProto::field(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.field) - return field_.Get(index); -} -::google::protobuf::FieldDescriptorProto* DescriptorProto::mutable_field(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.field) - return field_.Mutable(index); -} -::google::protobuf::FieldDescriptorProto* DescriptorProto::add_field() { - // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.field) - return field_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >* -DescriptorProto::mutable_field() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.field) - return &field_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >& -DescriptorProto::field() const { - // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.field) - return field_; -} - -// repeated .google.protobuf.FieldDescriptorProto extension = 6; -int DescriptorProto::extension_size() const { - return extension_.size(); -} -void DescriptorProto::clear_extension() { - extension_.Clear(); -} -const ::google::protobuf::FieldDescriptorProto& DescriptorProto::extension(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.extension) - return extension_.Get(index); -} -::google::protobuf::FieldDescriptorProto* DescriptorProto::mutable_extension(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.extension) - return extension_.Mutable(index); -} -::google::protobuf::FieldDescriptorProto* DescriptorProto::add_extension() { - // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension) - return extension_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >* -DescriptorProto::mutable_extension() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.extension) - return &extension_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >& -DescriptorProto::extension() const { - // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.extension) - return extension_; -} - -// repeated .google.protobuf.DescriptorProto nested_type = 3; -int DescriptorProto::nested_type_size() const { - return nested_type_.size(); -} -void DescriptorProto::clear_nested_type() { - nested_type_.Clear(); -} -const ::google::protobuf::DescriptorProto& DescriptorProto::nested_type(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.nested_type) - return nested_type_.Get(index); -} -::google::protobuf::DescriptorProto* DescriptorProto::mutable_nested_type(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.nested_type) - return nested_type_.Mutable(index); -} -::google::protobuf::DescriptorProto* DescriptorProto::add_nested_type() { - // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.nested_type) - return nested_type_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >* -DescriptorProto::mutable_nested_type() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.nested_type) - return &nested_type_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >& -DescriptorProto::nested_type() const { - // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.nested_type) - return nested_type_; -} - -// repeated .google.protobuf.EnumDescriptorProto enum_type = 4; -int DescriptorProto::enum_type_size() const { - return enum_type_.size(); -} -void DescriptorProto::clear_enum_type() { - enum_type_.Clear(); -} -const ::google::protobuf::EnumDescriptorProto& DescriptorProto::enum_type(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.enum_type) - return enum_type_.Get(index); -} -::google::protobuf::EnumDescriptorProto* DescriptorProto::mutable_enum_type(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.enum_type) - return enum_type_.Mutable(index); -} -::google::protobuf::EnumDescriptorProto* DescriptorProto::add_enum_type() { - // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.enum_type) - return enum_type_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >* -DescriptorProto::mutable_enum_type() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.enum_type) - return &enum_type_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >& -DescriptorProto::enum_type() const { - // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.enum_type) - return enum_type_; -} - -// repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; -int DescriptorProto::extension_range_size() const { - return extension_range_.size(); -} -void DescriptorProto::clear_extension_range() { - extension_range_.Clear(); -} -const ::google::protobuf::DescriptorProto_ExtensionRange& DescriptorProto::extension_range(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.extension_range) - return extension_range_.Get(index); -} -::google::protobuf::DescriptorProto_ExtensionRange* DescriptorProto::mutable_extension_range(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.extension_range) - return extension_range_.Mutable(index); -} -::google::protobuf::DescriptorProto_ExtensionRange* DescriptorProto::add_extension_range() { - // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension_range) - return extension_range_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange >* -DescriptorProto::mutable_extension_range() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.extension_range) - return &extension_range_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange >& -DescriptorProto::extension_range() const { - // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.extension_range) - return extension_range_; -} - -// repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; -int DescriptorProto::oneof_decl_size() const { - return oneof_decl_.size(); -} -void DescriptorProto::clear_oneof_decl() { - oneof_decl_.Clear(); -} -const ::google::protobuf::OneofDescriptorProto& DescriptorProto::oneof_decl(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.oneof_decl) - return oneof_decl_.Get(index); -} -::google::protobuf::OneofDescriptorProto* DescriptorProto::mutable_oneof_decl(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.oneof_decl) - return oneof_decl_.Mutable(index); -} -::google::protobuf::OneofDescriptorProto* DescriptorProto::add_oneof_decl() { - // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.oneof_decl) - return oneof_decl_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::OneofDescriptorProto >* -DescriptorProto::mutable_oneof_decl() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.oneof_decl) - return &oneof_decl_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::OneofDescriptorProto >& -DescriptorProto::oneof_decl() const { - // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.oneof_decl) - return oneof_decl_; -} - -// optional .google.protobuf.MessageOptions options = 7; -bool DescriptorProto::has_options() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void DescriptorProto::set_has_options() { - _has_bits_[0] |= 0x00000002u; -} -void DescriptorProto::clear_has_options() { - _has_bits_[0] &= ~0x00000002u; -} -void DescriptorProto::clear_options() { - if (options_ != NULL) options_->::google::protobuf::MessageOptions::Clear(); - clear_has_options(); -} -const ::google::protobuf::MessageOptions& DescriptorProto::options() const { - const ::google::protobuf::MessageOptions* p = options_; - // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.options) - return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::MessageOptions*>( - &::google::protobuf::_MessageOptions_default_instance_); -} -::google::protobuf::MessageOptions* DescriptorProto::mutable_options() { - set_has_options(); - if (options_ == NULL) { - options_ = new ::google::protobuf::MessageOptions; - } - // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.options) - return options_; -} -::google::protobuf::MessageOptions* DescriptorProto::release_options() { - // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.options) - clear_has_options(); - ::google::protobuf::MessageOptions* temp = options_; - options_ = NULL; - return temp; -} -void DescriptorProto::set_allocated_options(::google::protobuf::MessageOptions* options) { - delete options_; - options_ = options; - if (options) { - set_has_options(); - } else { - clear_has_options(); - } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.options) -} - -// repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; -int DescriptorProto::reserved_range_size() const { - return reserved_range_.size(); -} -void DescriptorProto::clear_reserved_range() { - reserved_range_.Clear(); -} -const ::google::protobuf::DescriptorProto_ReservedRange& DescriptorProto::reserved_range(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.reserved_range) - return reserved_range_.Get(index); -} -::google::protobuf::DescriptorProto_ReservedRange* DescriptorProto::mutable_reserved_range(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.reserved_range) - return reserved_range_.Mutable(index); -} -::google::protobuf::DescriptorProto_ReservedRange* DescriptorProto::add_reserved_range() { - // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_range) - return reserved_range_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ReservedRange >* -DescriptorProto::mutable_reserved_range() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.reserved_range) - return &reserved_range_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ReservedRange >& -DescriptorProto::reserved_range() const { - // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.reserved_range) - return reserved_range_; -} - -// repeated string reserved_name = 10; -int DescriptorProto::reserved_name_size() const { - return reserved_name_.size(); -} -void DescriptorProto::clear_reserved_name() { - reserved_name_.Clear(); -} -const ::std::string& DescriptorProto::reserved_name(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.reserved_name) - return reserved_name_.Get(index); -} -::std::string* DescriptorProto::mutable_reserved_name(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.reserved_name) - return reserved_name_.Mutable(index); -} -void DescriptorProto::set_reserved_name(int index, const ::std::string& value) { - // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.reserved_name) - reserved_name_.Mutable(index)->assign(value); -} -#if LANG_CXX11 -void DescriptorProto::set_reserved_name(int index, ::std::string&& value) { - // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.reserved_name) - reserved_name_.Mutable(index)->assign(std::move(value)); -} -#endif -void DescriptorProto::set_reserved_name(int index, const char* value) { - GOOGLE_DCHECK(value != NULL); - reserved_name_.Mutable(index)->assign(value); - // @@protoc_insertion_point(field_set_char:google.protobuf.DescriptorProto.reserved_name) -} -void DescriptorProto::set_reserved_name(int index, const char* value, size_t size) { - reserved_name_.Mutable(index)->assign( - reinterpret_cast<const char*>(value), size); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.DescriptorProto.reserved_name) -} -::std::string* DescriptorProto::add_reserved_name() { - // @@protoc_insertion_point(field_add_mutable:google.protobuf.DescriptorProto.reserved_name) - return reserved_name_.Add(); -} -void DescriptorProto::add_reserved_name(const ::std::string& value) { - reserved_name_.Add()->assign(value); - // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_name) -} -#if LANG_CXX11 -void DescriptorProto::add_reserved_name(::std::string&& value) { - reserved_name_.Add(std::move(value)); - // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_name) -} -#endif -void DescriptorProto::add_reserved_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - reserved_name_.Add()->assign(value); - // @@protoc_insertion_point(field_add_char:google.protobuf.DescriptorProto.reserved_name) -} -void DescriptorProto::add_reserved_name(const char* value, size_t size) { - reserved_name_.Add()->assign(reinterpret_cast<const char*>(value), size); - // @@protoc_insertion_point(field_add_pointer:google.protobuf.DescriptorProto.reserved_name) -} -const ::google::protobuf::RepeatedPtrField< ::std::string>& -DescriptorProto::reserved_name() const { - // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.reserved_name) - return reserved_name_; -} -::google::protobuf::RepeatedPtrField< ::std::string>* -DescriptorProto::mutable_reserved_name() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.reserved_name) - return &reserved_name_; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void ExtensionRangeOptions::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int ExtensionRangeOptions::kUninterpretedOptionFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -4546,11 +4155,21 @@ const int ExtensionRangeOptions::kUninterpretedOptionFieldNumber; ExtensionRangeOptions::ExtensionRangeOptions() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsExtensionRangeOptions(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.ExtensionRangeOptions) } +ExtensionRangeOptions::ExtensionRangeOptions(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _extensions_(arena), + _internal_metadata_(arena), + uninterpreted_option_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsExtensionRangeOptions(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.ExtensionRangeOptions) +} ExtensionRangeOptions::ExtensionRangeOptions(const ExtensionRangeOptions& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -4572,29 +4191,32 @@ ExtensionRangeOptions::~ExtensionRangeOptions() { } void ExtensionRangeOptions::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } +void ExtensionRangeOptions::ArenaDtor(void* object) { + ExtensionRangeOptions* _this = reinterpret_cast< ExtensionRangeOptions* >(object); + (void)_this; +} +void ExtensionRangeOptions::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void ExtensionRangeOptions::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* ExtensionRangeOptions::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const ExtensionRangeOptions& ExtensionRangeOptions::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsExtensionRangeOptions(); return *internal_default_instance(); } ExtensionRangeOptions* ExtensionRangeOptions::New(::google::protobuf::Arena* arena) const { - ExtensionRangeOptions* n = new ExtensionRangeOptions; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<ExtensionRangeOptions>(arena); } void ExtensionRangeOptions::Clear() { @@ -4623,8 +4245,7 @@ bool ExtensionRangeOptions::MergePartialFromCodedStream( case 999: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_uninterpreted_option())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_uninterpreted_option())); } else { goto handle_unusual; } @@ -4692,7 +4313,7 @@ void ExtensionRangeOptions::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 999, this->uninterpreted_option(static_cast<int>(i)), deterministic, target); } @@ -4725,7 +4346,7 @@ size_t ExtensionRangeOptions::ByteSizeLong() const { total_size += 2UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->uninterpreted_option(static_cast<int>(i))); } } @@ -4788,6 +4409,21 @@ bool ExtensionRangeOptions::IsInitialized() const { void ExtensionRangeOptions::Swap(ExtensionRangeOptions* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + ExtensionRangeOptions* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void ExtensionRangeOptions::UnsafeArenaSwap(ExtensionRangeOptions* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void ExtensionRangeOptions::InternalSwap(ExtensionRangeOptions* other) { @@ -4801,46 +4437,33 @@ void ExtensionRangeOptions::InternalSwap(ExtensionRangeOptions* other) { ::google::protobuf::Metadata ExtensionRangeOptions::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// ExtensionRangeOptions -// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; -int ExtensionRangeOptions::uninterpreted_option_size() const { - return uninterpreted_option_.size(); -} -void ExtensionRangeOptions::clear_uninterpreted_option() { - uninterpreted_option_.Clear(); -} -const ::google::protobuf::UninterpretedOption& ExtensionRangeOptions::uninterpreted_option(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.ExtensionRangeOptions.uninterpreted_option) - return uninterpreted_option_.Get(index); -} -::google::protobuf::UninterpretedOption* ExtensionRangeOptions::mutable_uninterpreted_option(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.ExtensionRangeOptions.uninterpreted_option) - return uninterpreted_option_.Mutable(index); -} -::google::protobuf::UninterpretedOption* ExtensionRangeOptions::add_uninterpreted_option() { - // @@protoc_insertion_point(field_add:google.protobuf.ExtensionRangeOptions.uninterpreted_option) - return uninterpreted_option_.Add(); +// =================================================================== + +void FieldDescriptorProto::InitAsDefaultInstance() { + ::google::protobuf::_FieldDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::FieldOptions*>( + ::google::protobuf::FieldOptions::internal_default_instance()); } -::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* -ExtensionRangeOptions::mutable_uninterpreted_option() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.ExtensionRangeOptions.uninterpreted_option) - return &uninterpreted_option_; +void FieldDescriptorProto::_slow_mutable_options() { + options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::FieldOptions >( + GetArenaNoVirtual()); } -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& -ExtensionRangeOptions::uninterpreted_option() const { - // @@protoc_insertion_point(field_list:google.protobuf.ExtensionRangeOptions.uninterpreted_option) - return uninterpreted_option_; +void FieldDescriptorProto::unsafe_arena_set_allocated_options( + ::google::protobuf::FieldOptions* options) { + if (GetArenaNoVirtual() == NULL) { + delete options_; + } + options_ = options; + if (options) { + set_has_options(); + } else { + clear_has_options(); + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.options) } - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int FieldDescriptorProto::kNameFieldNumber; const int FieldDescriptorProto::kNumberFieldNumber; @@ -4857,11 +4480,19 @@ const int FieldDescriptorProto::kOptionsFieldNumber; FieldDescriptorProto::FieldDescriptorProto() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFieldDescriptorProto(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.FieldDescriptorProto) } +FieldDescriptorProto::FieldDescriptorProto(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _internal_metadata_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFieldDescriptorProto(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.FieldDescriptorProto) +} FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -4870,23 +4501,28 @@ FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from) _internal_metadata_.MergeFrom(from._internal_metadata_); name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_name()) { - name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(), + GetArenaNoVirtual()); } extendee_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_extendee()) { - extendee_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.extendee_); + extendee_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.extendee(), + GetArenaNoVirtual()); } type_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_type_name()) { - type_name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.type_name_); + type_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.type_name(), + GetArenaNoVirtual()); } default_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_default_value()) { - default_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.default_value_); + default_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.default_value(), + GetArenaNoVirtual()); } json_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_json_name()) { - json_name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.json_name_); + json_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.json_name(), + GetArenaNoVirtual()); } if (from.has_options()) { options_ = new ::google::protobuf::FieldOptions(*from.options_); @@ -4919,6 +4555,7 @@ FieldDescriptorProto::~FieldDescriptorProto() { } void FieldDescriptorProto::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); extendee_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); type_name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -4927,27 +4564,29 @@ void FieldDescriptorProto::SharedDtor() { if (this != internal_default_instance()) delete options_; } +void FieldDescriptorProto::ArenaDtor(void* object) { + FieldDescriptorProto* _this = reinterpret_cast< FieldDescriptorProto* >(object); + (void)_this; +} +void FieldDescriptorProto::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void FieldDescriptorProto::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* FieldDescriptorProto::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const FieldDescriptorProto& FieldDescriptorProto::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFieldDescriptorProto(); return *internal_default_instance(); } FieldDescriptorProto* FieldDescriptorProto::New(::google::protobuf::Arena* arena) const { - FieldDescriptorProto* n = new FieldDescriptorProto; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<FieldDescriptorProto>(arena); } void FieldDescriptorProto::Clear() { @@ -4960,27 +4599,27 @@ void FieldDescriptorProto::Clear() { if (cached_has_bits & 63u) { if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*name_.UnsafeRawStringPointer())->clear(); + name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000002u) { GOOGLE_DCHECK(!extendee_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*extendee_.UnsafeRawStringPointer())->clear(); + extendee_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000004u) { GOOGLE_DCHECK(!type_name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*type_name_.UnsafeRawStringPointer())->clear(); + type_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000008u) { GOOGLE_DCHECK(!default_value_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*default_value_.UnsafeRawStringPointer())->clear(); + default_value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000010u) { GOOGLE_DCHECK(!json_name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*json_name_.UnsafeRawStringPointer())->clear(); + json_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000020u) { GOOGLE_DCHECK(options_ != NULL); - options_->::google::protobuf::FieldOptions::Clear(); + options_->Clear(); } } if (cached_has_bits & 192u) { @@ -5128,7 +4767,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( case 8: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(66u /* 66 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_options())); } else { goto handle_unusual; @@ -5350,7 +4989,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes( // optional .google.protobuf.FieldOptions options = 8; if (cached_has_bits & 0x00000020u) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 8, *this->options_, deterministic, target); } @@ -5426,7 +5065,7 @@ size_t FieldDescriptorProto::ByteSizeLong() const { // optional .google.protobuf.FieldOptions options = 8; if (has_options()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *this->options_); } @@ -5491,24 +5130,19 @@ void FieldDescriptorProto::MergeFrom(const FieldDescriptorProto& from) { cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 255u) { if (cached_has_bits & 0x00000001u) { - set_has_name(); - name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + set_name(from.name()); } if (cached_has_bits & 0x00000002u) { - set_has_extendee(); - extendee_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.extendee_); + set_extendee(from.extendee()); } if (cached_has_bits & 0x00000004u) { - set_has_type_name(); - type_name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.type_name_); + set_type_name(from.type_name()); } if (cached_has_bits & 0x00000008u) { - set_has_default_value(); - default_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.default_value_); + set_default_value(from.default_value()); } if (cached_has_bits & 0x00000010u) { - set_has_json_name(); - json_name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.json_name_); + set_json_name(from.json_name()); } if (cached_has_bits & 0x00000020u) { mutable_options()->::google::protobuf::FieldOptions::MergeFrom(from.options()); @@ -5555,6 +5189,21 @@ bool FieldDescriptorProto::IsInitialized() const { void FieldDescriptorProto::Swap(FieldDescriptorProto* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + FieldDescriptorProto* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void FieldDescriptorProto::UnsafeArenaSwap(FieldDescriptorProto* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void FieldDescriptorProto::InternalSwap(FieldDescriptorProto* other) { @@ -5576,475 +5225,33 @@ void FieldDescriptorProto::InternalSwap(FieldDescriptorProto* other) { ::google::protobuf::Metadata FieldDescriptorProto::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// FieldDescriptorProto -// optional string name = 1; -bool FieldDescriptorProto::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void FieldDescriptorProto::set_has_name() { - _has_bits_[0] |= 0x00000001u; -} -void FieldDescriptorProto::clear_has_name() { - _has_bits_[0] &= ~0x00000001u; -} -void FieldDescriptorProto::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_name(); -} -const ::std::string& FieldDescriptorProto::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.name) - return name_.GetNoArena(); -} -void FieldDescriptorProto::set_name(const ::std::string& value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.name) -} -#if LANG_CXX11 -void FieldDescriptorProto::set_name(::std::string&& value) { - set_has_name(); - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.name) -} -#endif -void FieldDescriptorProto::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.name) -} -void FieldDescriptorProto::set_name(const char* value, size_t size) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.name) -} -::std::string* FieldDescriptorProto::mutable_name() { - set_has_name(); - // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* FieldDescriptorProto::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.name) - clear_has_name(); - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void FieldDescriptorProto::set_allocated_name(::std::string* name) { - if (name != NULL) { - set_has_name(); - } else { - clear_has_name(); - } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.name) -} - -// optional int32 number = 3; -bool FieldDescriptorProto::has_number() const { - return (_has_bits_[0] & 0x00000040u) != 0; -} -void FieldDescriptorProto::set_has_number() { - _has_bits_[0] |= 0x00000040u; -} -void FieldDescriptorProto::clear_has_number() { - _has_bits_[0] &= ~0x00000040u; -} -void FieldDescriptorProto::clear_number() { - number_ = 0; - clear_has_number(); -} -::google::protobuf::int32 FieldDescriptorProto::number() const { - // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.number) - return number_; -} -void FieldDescriptorProto::set_number(::google::protobuf::int32 value) { - set_has_number(); - number_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.number) -} - -// optional .google.protobuf.FieldDescriptorProto.Label label = 4; -bool FieldDescriptorProto::has_label() const { - return (_has_bits_[0] & 0x00000100u) != 0; -} -void FieldDescriptorProto::set_has_label() { - _has_bits_[0] |= 0x00000100u; -} -void FieldDescriptorProto::clear_has_label() { - _has_bits_[0] &= ~0x00000100u; -} -void FieldDescriptorProto::clear_label() { - label_ = 1; - clear_has_label(); -} -::google::protobuf::FieldDescriptorProto_Label FieldDescriptorProto::label() const { - // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.label) - return static_cast< ::google::protobuf::FieldDescriptorProto_Label >(label_); -} -void FieldDescriptorProto::set_label(::google::protobuf::FieldDescriptorProto_Label value) { - assert(::google::protobuf::FieldDescriptorProto_Label_IsValid(value)); - set_has_label(); - label_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.label) -} - -// optional .google.protobuf.FieldDescriptorProto.Type type = 5; -bool FieldDescriptorProto::has_type() const { - return (_has_bits_[0] & 0x00000200u) != 0; -} -void FieldDescriptorProto::set_has_type() { - _has_bits_[0] |= 0x00000200u; -} -void FieldDescriptorProto::clear_has_type() { - _has_bits_[0] &= ~0x00000200u; -} -void FieldDescriptorProto::clear_type() { - type_ = 1; - clear_has_type(); -} -::google::protobuf::FieldDescriptorProto_Type FieldDescriptorProto::type() const { - // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.type) - return static_cast< ::google::protobuf::FieldDescriptorProto_Type >(type_); -} -void FieldDescriptorProto::set_type(::google::protobuf::FieldDescriptorProto_Type value) { - assert(::google::protobuf::FieldDescriptorProto_Type_IsValid(value)); - set_has_type(); - type_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.type) -} - -// optional string type_name = 6; -bool FieldDescriptorProto::has_type_name() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void FieldDescriptorProto::set_has_type_name() { - _has_bits_[0] |= 0x00000004u; -} -void FieldDescriptorProto::clear_has_type_name() { - _has_bits_[0] &= ~0x00000004u; -} -void FieldDescriptorProto::clear_type_name() { - type_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_type_name(); -} -const ::std::string& FieldDescriptorProto::type_name() const { - // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.type_name) - return type_name_.GetNoArena(); -} -void FieldDescriptorProto::set_type_name(const ::std::string& value) { - set_has_type_name(); - type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.type_name) -} -#if LANG_CXX11 -void FieldDescriptorProto::set_type_name(::std::string&& value) { - set_has_type_name(); - type_name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.type_name) -} -#endif -void FieldDescriptorProto::set_type_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_type_name(); - type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.type_name) -} -void FieldDescriptorProto::set_type_name(const char* value, size_t size) { - set_has_type_name(); - type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.type_name) -} -::std::string* FieldDescriptorProto::mutable_type_name() { - set_has_type_name(); - // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.type_name) - return type_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* FieldDescriptorProto::release_type_name() { - // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.type_name) - clear_has_type_name(); - return type_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void FieldDescriptorProto::set_allocated_type_name(::std::string* type_name) { - if (type_name != NULL) { - set_has_type_name(); - } else { - clear_has_type_name(); - } - type_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), type_name); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.type_name) -} - -// optional string extendee = 2; -bool FieldDescriptorProto::has_extendee() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void FieldDescriptorProto::set_has_extendee() { - _has_bits_[0] |= 0x00000002u; -} -void FieldDescriptorProto::clear_has_extendee() { - _has_bits_[0] &= ~0x00000002u; -} -void FieldDescriptorProto::clear_extendee() { - extendee_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_extendee(); -} -const ::std::string& FieldDescriptorProto::extendee() const { - // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.extendee) - return extendee_.GetNoArena(); -} -void FieldDescriptorProto::set_extendee(const ::std::string& value) { - set_has_extendee(); - extendee_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.extendee) -} -#if LANG_CXX11 -void FieldDescriptorProto::set_extendee(::std::string&& value) { - set_has_extendee(); - extendee_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.extendee) -} -#endif -void FieldDescriptorProto::set_extendee(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_extendee(); - extendee_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.extendee) -} -void FieldDescriptorProto::set_extendee(const char* value, size_t size) { - set_has_extendee(); - extendee_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.extendee) -} -::std::string* FieldDescriptorProto::mutable_extendee() { - set_has_extendee(); - // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.extendee) - return extendee_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* FieldDescriptorProto::release_extendee() { - // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.extendee) - clear_has_extendee(); - return extendee_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void FieldDescriptorProto::set_allocated_extendee(::std::string* extendee) { - if (extendee != NULL) { - set_has_extendee(); - } else { - clear_has_extendee(); - } - extendee_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), extendee); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.extendee) -} - -// optional string default_value = 7; -bool FieldDescriptorProto::has_default_value() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -void FieldDescriptorProto::set_has_default_value() { - _has_bits_[0] |= 0x00000008u; -} -void FieldDescriptorProto::clear_has_default_value() { - _has_bits_[0] &= ~0x00000008u; -} -void FieldDescriptorProto::clear_default_value() { - default_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_default_value(); -} -const ::std::string& FieldDescriptorProto::default_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.default_value) - return default_value_.GetNoArena(); -} -void FieldDescriptorProto::set_default_value(const ::std::string& value) { - set_has_default_value(); - default_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.default_value) -} -#if LANG_CXX11 -void FieldDescriptorProto::set_default_value(::std::string&& value) { - set_has_default_value(); - default_value_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.default_value) -} -#endif -void FieldDescriptorProto::set_default_value(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_default_value(); - default_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.default_value) -} -void FieldDescriptorProto::set_default_value(const char* value, size_t size) { - set_has_default_value(); - default_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.default_value) -} -::std::string* FieldDescriptorProto::mutable_default_value() { - set_has_default_value(); - // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.default_value) - return default_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* FieldDescriptorProto::release_default_value() { - // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.default_value) - clear_has_default_value(); - return default_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void FieldDescriptorProto::set_allocated_default_value(::std::string* default_value) { - if (default_value != NULL) { - set_has_default_value(); - } else { - clear_has_default_value(); - } - default_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), default_value); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.default_value) -} - -// optional int32 oneof_index = 9; -bool FieldDescriptorProto::has_oneof_index() const { - return (_has_bits_[0] & 0x00000080u) != 0; -} -void FieldDescriptorProto::set_has_oneof_index() { - _has_bits_[0] |= 0x00000080u; -} -void FieldDescriptorProto::clear_has_oneof_index() { - _has_bits_[0] &= ~0x00000080u; -} -void FieldDescriptorProto::clear_oneof_index() { - oneof_index_ = 0; - clear_has_oneof_index(); -} -::google::protobuf::int32 FieldDescriptorProto::oneof_index() const { - // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.oneof_index) - return oneof_index_; -} -void FieldDescriptorProto::set_oneof_index(::google::protobuf::int32 value) { - set_has_oneof_index(); - oneof_index_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.oneof_index) -} - -// optional string json_name = 10; -bool FieldDescriptorProto::has_json_name() const { - return (_has_bits_[0] & 0x00000010u) != 0; -} -void FieldDescriptorProto::set_has_json_name() { - _has_bits_[0] |= 0x00000010u; -} -void FieldDescriptorProto::clear_has_json_name() { - _has_bits_[0] &= ~0x00000010u; -} -void FieldDescriptorProto::clear_json_name() { - json_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_json_name(); -} -const ::std::string& FieldDescriptorProto::json_name() const { - // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.json_name) - return json_name_.GetNoArena(); -} -void FieldDescriptorProto::set_json_name(const ::std::string& value) { - set_has_json_name(); - json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.json_name) -} -#if LANG_CXX11 -void FieldDescriptorProto::set_json_name(::std::string&& value) { - set_has_json_name(); - json_name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.json_name) -} -#endif -void FieldDescriptorProto::set_json_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_json_name(); - json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.json_name) -} -void FieldDescriptorProto::set_json_name(const char* value, size_t size) { - set_has_json_name(); - json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.json_name) -} -::std::string* FieldDescriptorProto::mutable_json_name() { - set_has_json_name(); - // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.json_name) - return json_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* FieldDescriptorProto::release_json_name() { - // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.json_name) - clear_has_json_name(); - return json_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void FieldDescriptorProto::set_allocated_json_name(::std::string* json_name) { - if (json_name != NULL) { - set_has_json_name(); - } else { - clear_has_json_name(); - } - json_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), json_name); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.json_name) -} +// =================================================================== -// optional .google.protobuf.FieldOptions options = 8; -bool FieldDescriptorProto::has_options() const { - return (_has_bits_[0] & 0x00000020u) != 0; -} -void FieldDescriptorProto::set_has_options() { - _has_bits_[0] |= 0x00000020u; -} -void FieldDescriptorProto::clear_has_options() { - _has_bits_[0] &= ~0x00000020u; -} -void FieldDescriptorProto::clear_options() { - if (options_ != NULL) options_->::google::protobuf::FieldOptions::Clear(); - clear_has_options(); +void OneofDescriptorProto::InitAsDefaultInstance() { + ::google::protobuf::_OneofDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::OneofOptions*>( + ::google::protobuf::OneofOptions::internal_default_instance()); } -const ::google::protobuf::FieldOptions& FieldDescriptorProto::options() const { - const ::google::protobuf::FieldOptions* p = options_; - // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.options) - return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::FieldOptions*>( - &::google::protobuf::_FieldOptions_default_instance_); +void OneofDescriptorProto::_slow_mutable_options() { + options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::OneofOptions >( + GetArenaNoVirtual()); } -::google::protobuf::FieldOptions* FieldDescriptorProto::mutable_options() { - set_has_options(); - if (options_ == NULL) { - options_ = new ::google::protobuf::FieldOptions; +void OneofDescriptorProto::unsafe_arena_set_allocated_options( + ::google::protobuf::OneofOptions* options) { + if (GetArenaNoVirtual() == NULL) { + delete options_; } - // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.options) - return options_; -} -::google::protobuf::FieldOptions* FieldDescriptorProto::release_options() { - // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.options) - clear_has_options(); - ::google::protobuf::FieldOptions* temp = options_; - options_ = NULL; - return temp; -} -void FieldDescriptorProto::set_allocated_options(::google::protobuf::FieldOptions* options) { - delete options_; options_ = options; if (options) { set_has_options(); } else { clear_has_options(); } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.options) + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.OneofDescriptorProto.options) } - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int OneofDescriptorProto::kNameFieldNumber; const int OneofDescriptorProto::kOptionsFieldNumber; @@ -6053,11 +5260,19 @@ const int OneofDescriptorProto::kOptionsFieldNumber; OneofDescriptorProto::OneofDescriptorProto() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsOneofDescriptorProto(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.OneofDescriptorProto) } +OneofDescriptorProto::OneofDescriptorProto(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _internal_metadata_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsOneofDescriptorProto(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.OneofDescriptorProto) +} OneofDescriptorProto::OneofDescriptorProto(const OneofDescriptorProto& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -6066,7 +5281,8 @@ OneofDescriptorProto::OneofDescriptorProto(const OneofDescriptorProto& from) _internal_metadata_.MergeFrom(from._internal_metadata_); name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_name()) { - name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(), + GetArenaNoVirtual()); } if (from.has_options()) { options_ = new ::google::protobuf::OneofOptions(*from.options_); @@ -6088,31 +5304,34 @@ OneofDescriptorProto::~OneofDescriptorProto() { } void OneofDescriptorProto::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (this != internal_default_instance()) delete options_; } +void OneofDescriptorProto::ArenaDtor(void* object) { + OneofDescriptorProto* _this = reinterpret_cast< OneofDescriptorProto* >(object); + (void)_this; +} +void OneofDescriptorProto::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void OneofDescriptorProto::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* OneofDescriptorProto::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const OneofDescriptorProto& OneofDescriptorProto::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsOneofDescriptorProto(); return *internal_default_instance(); } OneofDescriptorProto* OneofDescriptorProto::New(::google::protobuf::Arena* arena) const { - OneofDescriptorProto* n = new OneofDescriptorProto; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<OneofDescriptorProto>(arena); } void OneofDescriptorProto::Clear() { @@ -6125,11 +5344,11 @@ void OneofDescriptorProto::Clear() { if (cached_has_bits & 3u) { if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*name_.UnsafeRawStringPointer())->clear(); + name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000002u) { GOOGLE_DCHECK(options_ != NULL); - options_->::google::protobuf::OneofOptions::Clear(); + options_->Clear(); } } _has_bits_.Clear(); @@ -6166,7 +5385,7 @@ bool OneofDescriptorProto::MergePartialFromCodedStream( case 2: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_options())); } else { goto handle_unusual; @@ -6246,7 +5465,7 @@ void OneofDescriptorProto::SerializeWithCachedSizes( // optional .google.protobuf.OneofOptions options = 2; if (cached_has_bits & 0x00000002u) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 2, *this->options_, deterministic, target); } @@ -6278,7 +5497,7 @@ size_t OneofDescriptorProto::ByteSizeLong() const { // optional .google.protobuf.OneofOptions options = 2; if (has_options()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *this->options_); } @@ -6315,8 +5534,7 @@ void OneofDescriptorProto::MergeFrom(const OneofDescriptorProto& from) { cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 3u) { if (cached_has_bits & 0x00000001u) { - set_has_name(); - name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + set_name(from.name()); } if (cached_has_bits & 0x00000002u) { mutable_options()->::google::protobuf::OneofOptions::MergeFrom(from.options()); @@ -6347,6 +5565,21 @@ bool OneofDescriptorProto::IsInitialized() const { void OneofDescriptorProto::Swap(OneofDescriptorProto* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + OneofDescriptorProto* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void OneofDescriptorProto::UnsafeArenaSwap(OneofDescriptorProto* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void OneofDescriptorProto::InternalSwap(OneofDescriptorProto* other) { @@ -6360,149 +5593,393 @@ void OneofDescriptorProto::InternalSwap(OneofDescriptorProto* other) { ::google::protobuf::Metadata OneofDescriptorProto::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// OneofDescriptorProto -// optional string name = 1; -bool OneofDescriptorProto::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; +// =================================================================== + +void EnumDescriptorProto_EnumReservedRange::InitAsDefaultInstance() { } -void OneofDescriptorProto::set_has_name() { - _has_bits_[0] |= 0x00000001u; +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int EnumDescriptorProto_EnumReservedRange::kStartFieldNumber; +const int EnumDescriptorProto_EnumReservedRange::kEndFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +EnumDescriptorProto_EnumReservedRange::EnumDescriptorProto_EnumReservedRange() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumDescriptorProto_EnumReservedRange(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.EnumDescriptorProto.EnumReservedRange) } -void OneofDescriptorProto::clear_has_name() { - _has_bits_[0] &= ~0x00000001u; +EnumDescriptorProto_EnumReservedRange::EnumDescriptorProto_EnumReservedRange(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _internal_metadata_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumDescriptorProto_EnumReservedRange(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.EnumDescriptorProto.EnumReservedRange) } -void OneofDescriptorProto::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_name(); +EnumDescriptorProto_EnumReservedRange::EnumDescriptorProto_EnumReservedRange(const EnumDescriptorProto_EnumReservedRange& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL), + _has_bits_(from._has_bits_), + _cached_size_(0) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&start_, &from.start_, + static_cast<size_t>(reinterpret_cast<char*>(&end_) - + reinterpret_cast<char*>(&start_)) + sizeof(end_)); + // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumDescriptorProto.EnumReservedRange) } -const ::std::string& OneofDescriptorProto::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.OneofDescriptorProto.name) - return name_.GetNoArena(); + +void EnumDescriptorProto_EnumReservedRange::SharedCtor() { + _cached_size_ = 0; + ::memset(&start_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&end_) - + reinterpret_cast<char*>(&start_)) + sizeof(end_)); } -void OneofDescriptorProto::set_name(const ::std::string& value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.OneofDescriptorProto.name) + +EnumDescriptorProto_EnumReservedRange::~EnumDescriptorProto_EnumReservedRange() { + // @@protoc_insertion_point(destructor:google.protobuf.EnumDescriptorProto.EnumReservedRange) + SharedDtor(); } -#if LANG_CXX11 -void OneofDescriptorProto::set_name(::std::string&& value) { - set_has_name(); - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.OneofDescriptorProto.name) + +void EnumDescriptorProto_EnumReservedRange::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } -#endif -void OneofDescriptorProto::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.OneofDescriptorProto.name) -} -void OneofDescriptorProto::set_name(const char* value, size_t size) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.OneofDescriptorProto.name) -} -::std::string* OneofDescriptorProto::mutable_name() { - set_has_name(); - // @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* OneofDescriptorProto::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.name) - clear_has_name(); - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void OneofDescriptorProto::set_allocated_name(::std::string* name) { - if (name != NULL) { - set_has_name(); - } else { - clear_has_name(); + +void EnumDescriptorProto_EnumReservedRange::ArenaDtor(void* object) { + EnumDescriptorProto_EnumReservedRange* _this = reinterpret_cast< EnumDescriptorProto_EnumReservedRange* >(object); + (void)_this; +} +void EnumDescriptorProto_EnumReservedRange::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} +void EnumDescriptorProto_EnumReservedRange::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* EnumDescriptorProto_EnumReservedRange::descriptor() { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; +} + +const EnumDescriptorProto_EnumReservedRange& EnumDescriptorProto_EnumReservedRange::default_instance() { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumDescriptorProto_EnumReservedRange(); + return *internal_default_instance(); +} + +EnumDescriptorProto_EnumReservedRange* EnumDescriptorProto_EnumReservedRange::New(::google::protobuf::Arena* arena) const { + return ::google::protobuf::Arena::CreateMessage<EnumDescriptorProto_EnumReservedRange>(arena); +} + +void EnumDescriptorProto_EnumReservedRange::Clear() { +// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 3u) { + ::memset(&start_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&end_) - + reinterpret_cast<char*>(&start_)) + sizeof(end_)); } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.OneofDescriptorProto.name) + _has_bits_.Clear(); + _internal_metadata_.Clear(); } -// optional .google.protobuf.OneofOptions options = 2; -bool OneofDescriptorProto::has_options() const { - return (_has_bits_[0] & 0x00000002u) != 0; +bool EnumDescriptorProto_EnumReservedRange::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional int32 start = 1; + case 1: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) { + set_has_start(); + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &start_))); + } else { + goto handle_unusual; + } + break; + } + + // optional int32 end = 2; + case 2: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) { + set_has_end(); + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &end_))); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, _internal_metadata_.mutable_unknown_fields())); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.EnumDescriptorProto.EnumReservedRange) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.EnumDescriptorProto.EnumReservedRange) + return false; +#undef DO_ } -void OneofDescriptorProto::set_has_options() { - _has_bits_[0] |= 0x00000002u; + +void EnumDescriptorProto_EnumReservedRange::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int32 start = 1; + if (cached_has_bits & 0x00000001u) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->start(), output); + } + + // optional int32 end = 2; + if (cached_has_bits & 0x00000002u) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->end(), output); + } + + if (_internal_metadata_.have_unknown_fields()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + _internal_metadata_.unknown_fields(), output); + } + // @@protoc_insertion_point(serialize_end:google.protobuf.EnumDescriptorProto.EnumReservedRange) } -void OneofDescriptorProto::clear_has_options() { - _has_bits_[0] &= ~0x00000002u; + +::google::protobuf::uint8* EnumDescriptorProto_EnumReservedRange::InternalSerializeWithCachedSizesToArray( + bool deterministic, ::google::protobuf::uint8* target) const { + (void)deterministic; // Unused + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int32 start = 1; + if (cached_has_bits & 0x00000001u) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->start(), target); + } + + // optional int32 end = 2; + if (cached_has_bits & 0x00000002u) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->end(), target); + } + + if (_internal_metadata_.have_unknown_fields()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields(), target); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumDescriptorProto.EnumReservedRange) + return target; } -void OneofDescriptorProto::clear_options() { - if (options_ != NULL) options_->::google::protobuf::OneofOptions::Clear(); - clear_has_options(); + +size_t EnumDescriptorProto_EnumReservedRange::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) + size_t total_size = 0; + + if (_internal_metadata_.have_unknown_fields()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + _internal_metadata_.unknown_fields()); + } + if (_has_bits_[0 / 32] & 3u) { + // optional int32 start = 1; + if (has_start()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->start()); + } + + // optional int32 end = 2; + if (has_end()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->end()); + } + + } + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; } -const ::google::protobuf::OneofOptions& OneofDescriptorProto::options() const { - const ::google::protobuf::OneofOptions* p = options_; - // @@protoc_insertion_point(field_get:google.protobuf.OneofDescriptorProto.options) - return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::OneofOptions*>( - &::google::protobuf::_OneofOptions_default_instance_); + +void EnumDescriptorProto_EnumReservedRange::MergeFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) + GOOGLE_DCHECK_NE(&from, this); + const EnumDescriptorProto_EnumReservedRange* source = + ::google::protobuf::internal::DynamicCastToGenerated<const EnumDescriptorProto_EnumReservedRange>( + &from); + if (source == NULL) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.EnumDescriptorProto.EnumReservedRange) + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.EnumDescriptorProto.EnumReservedRange) + MergeFrom(*source); + } } -::google::protobuf::OneofOptions* OneofDescriptorProto::mutable_options() { - set_has_options(); - if (options_ == NULL) { - options_ = new ::google::protobuf::OneofOptions; + +void EnumDescriptorProto_EnumReservedRange::MergeFrom(const EnumDescriptorProto_EnumReservedRange& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 3u) { + if (cached_has_bits & 0x00000001u) { + start_ = from.start_; + } + if (cached_has_bits & 0x00000002u) { + end_ = from.end_; + } + _has_bits_[0] |= cached_has_bits; } - // @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.options) - return options_; } -::google::protobuf::OneofOptions* OneofDescriptorProto::release_options() { - // @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.options) - clear_has_options(); - ::google::protobuf::OneofOptions* temp = options_; - options_ = NULL; - return temp; + +void EnumDescriptorProto_EnumReservedRange::CopyFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) + if (&from == this) return; + Clear(); + MergeFrom(from); } -void OneofDescriptorProto::set_allocated_options(::google::protobuf::OneofOptions* options) { - delete options_; - options_ = options; - if (options) { - set_has_options(); + +void EnumDescriptorProto_EnumReservedRange::CopyFrom(const EnumDescriptorProto_EnumReservedRange& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool EnumDescriptorProto_EnumReservedRange::IsInitialized() const { + return true; +} + +void EnumDescriptorProto_EnumReservedRange::Swap(EnumDescriptorProto_EnumReservedRange* other) { + if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); } else { - clear_has_options(); + EnumDescriptorProto_EnumReservedRange* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.OneofDescriptorProto.options) +} +void EnumDescriptorProto_EnumReservedRange::UnsafeArenaSwap(EnumDescriptorProto_EnumReservedRange* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); + InternalSwap(other); +} +void EnumDescriptorProto_EnumReservedRange::InternalSwap(EnumDescriptorProto_EnumReservedRange* other) { + using std::swap; + swap(start_, other->start_); + swap(end_, other->end_); + swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata EnumDescriptorProto_EnumReservedRange::GetMetadata() const { + protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void EnumDescriptorProto::InitAsDefaultInstance() { + ::google::protobuf::_EnumDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::EnumOptions*>( + ::google::protobuf::EnumOptions::internal_default_instance()); +} +void EnumDescriptorProto::_slow_mutable_options() { + options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::EnumOptions >( + GetArenaNoVirtual()); +} +void EnumDescriptorProto::unsafe_arena_set_allocated_options( + ::google::protobuf::EnumOptions* options) { + if (GetArenaNoVirtual() == NULL) { + delete options_; + } + options_ = options; + if (options) { + set_has_options(); + } else { + clear_has_options(); + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumDescriptorProto.options) +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int EnumDescriptorProto::kNameFieldNumber; const int EnumDescriptorProto::kValueFieldNumber; const int EnumDescriptorProto::kOptionsFieldNumber; +const int EnumDescriptorProto::kReservedRangeFieldNumber; +const int EnumDescriptorProto::kReservedNameFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 EnumDescriptorProto::EnumDescriptorProto() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumDescriptorProto(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.EnumDescriptorProto) } +EnumDescriptorProto::EnumDescriptorProto(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _internal_metadata_(arena), + value_(arena), + reserved_range_(arena), + reserved_name_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumDescriptorProto(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.EnumDescriptorProto) +} EnumDescriptorProto::EnumDescriptorProto(const EnumDescriptorProto& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), _has_bits_(from._has_bits_), _cached_size_(0), - value_(from.value_) { + value_(from.value_), + reserved_range_(from.reserved_range_), + reserved_name_(from.reserved_name_) { _internal_metadata_.MergeFrom(from._internal_metadata_); name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_name()) { - name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(), + GetArenaNoVirtual()); } if (from.has_options()) { options_ = new ::google::protobuf::EnumOptions(*from.options_); @@ -6524,31 +6001,34 @@ EnumDescriptorProto::~EnumDescriptorProto() { } void EnumDescriptorProto::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (this != internal_default_instance()) delete options_; } +void EnumDescriptorProto::ArenaDtor(void* object) { + EnumDescriptorProto* _this = reinterpret_cast< EnumDescriptorProto* >(object); + (void)_this; +} +void EnumDescriptorProto::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void EnumDescriptorProto::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* EnumDescriptorProto::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const EnumDescriptorProto& EnumDescriptorProto::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumDescriptorProto(); return *internal_default_instance(); } EnumDescriptorProto* EnumDescriptorProto::New(::google::protobuf::Arena* arena) const { - EnumDescriptorProto* n = new EnumDescriptorProto; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<EnumDescriptorProto>(arena); } void EnumDescriptorProto::Clear() { @@ -6558,15 +6038,17 @@ void EnumDescriptorProto::Clear() { (void) cached_has_bits; value_.Clear(); + reserved_range_.Clear(); + reserved_name_.Clear(); cached_has_bits = _has_bits_[0]; if (cached_has_bits & 3u) { if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*name_.UnsafeRawStringPointer())->clear(); + name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000002u) { GOOGLE_DCHECK(options_ != NULL); - options_->::google::protobuf::EnumOptions::Clear(); + options_->Clear(); } } _has_bits_.Clear(); @@ -6603,8 +6085,7 @@ bool EnumDescriptorProto::MergePartialFromCodedStream( case 2: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_value())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_value())); } else { goto handle_unusual; } @@ -6615,7 +6096,7 @@ bool EnumDescriptorProto::MergePartialFromCodedStream( case 3: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_options())); } else { goto handle_unusual; @@ -6623,6 +6104,34 @@ bool EnumDescriptorProto::MergePartialFromCodedStream( break; } + // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; + 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_reserved_range())); + } else { + goto handle_unusual; + } + break; + } + + // repeated string reserved_name = 5; + case 5: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->add_reserved_name())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->reserved_name(this->reserved_name_size() - 1).data(), + static_cast<int>(this->reserved_name(this->reserved_name_size() - 1).length()), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.EnumDescriptorProto.reserved_name"); + } else { + goto handle_unusual; + } + break; + } + default: { handle_unusual: if (tag == 0) { @@ -6673,6 +6182,23 @@ void EnumDescriptorProto::SerializeWithCachedSizes( 3, *this->options_, output); } + // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; + for (unsigned int i = 0, + n = static_cast<unsigned int>(this->reserved_range_size()); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 4, this->reserved_range(static_cast<int>(i)), output); + } + + // repeated string reserved_name = 5; + for (int i = 0, n = this->reserved_name_size(); i < n; i++) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->reserved_name(i).data(), static_cast<int>(this->reserved_name(i).length()), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.EnumDescriptorProto.reserved_name"); + ::google::protobuf::internal::WireFormatLite::WriteString( + 5, this->reserved_name(i), output); + } + if (_internal_metadata_.have_unknown_fields()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( _internal_metadata_.unknown_fields(), output); @@ -6703,17 +6229,35 @@ void EnumDescriptorProto::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->value_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 2, this->value(static_cast<int>(i)), deterministic, target); } // optional .google.protobuf.EnumOptions options = 3; if (cached_has_bits & 0x00000002u) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 3, *this->options_, deterministic, target); } + // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; + for (unsigned int i = 0, + n = static_cast<unsigned int>(this->reserved_range_size()); i < n; i++) { + target = ::google::protobuf::internal::WireFormatLite:: + InternalWriteMessageToArray( + 4, this->reserved_range(static_cast<int>(i)), deterministic, target); + } + + // repeated string reserved_name = 5; + for (int i = 0, n = this->reserved_name_size(); i < n; i++) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->reserved_name(i).data(), static_cast<int>(this->reserved_name(i).length()), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.EnumDescriptorProto.reserved_name"); + target = ::google::protobuf::internal::WireFormatLite:: + WriteStringToArray(5, this->reserved_name(i), target); + } + if (_internal_metadata_.have_unknown_fields()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields(), target); @@ -6737,11 +6281,30 @@ size_t EnumDescriptorProto::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->value(static_cast<int>(i))); } } + // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; + { + unsigned int count = static_cast<unsigned int>(this->reserved_range_size()); + total_size += 1UL * count; + for (unsigned int i = 0; i < count; i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSize( + this->reserved_range(static_cast<int>(i))); + } + } + + // repeated string reserved_name = 5; + total_size += 1 * + ::google::protobuf::internal::FromIntSize(this->reserved_name_size()); + for (int i = 0, n = this->reserved_name_size(); i < n; i++) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this->reserved_name(i)); + } + if (_has_bits_[0 / 32] & 3u) { // optional string name = 1; if (has_name()) { @@ -6753,7 +6316,7 @@ size_t EnumDescriptorProto::ByteSizeLong() const { // optional .google.protobuf.EnumOptions options = 3; if (has_options()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *this->options_); } @@ -6788,11 +6351,12 @@ void EnumDescriptorProto::MergeFrom(const EnumDescriptorProto& from) { (void) cached_has_bits; value_.MergeFrom(from.value_); + reserved_range_.MergeFrom(from.reserved_range_); + reserved_name_.MergeFrom(from.reserved_name_); cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 3u) { if (cached_has_bits & 0x00000001u) { - set_has_name(); - name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + set_name(from.name()); } if (cached_has_bits & 0x00000002u) { mutable_options()->::google::protobuf::EnumOptions::MergeFrom(from.options()); @@ -6824,11 +6388,28 @@ bool EnumDescriptorProto::IsInitialized() const { void EnumDescriptorProto::Swap(EnumDescriptorProto* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + EnumDescriptorProto* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void EnumDescriptorProto::UnsafeArenaSwap(EnumDescriptorProto* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void EnumDescriptorProto::InternalSwap(EnumDescriptorProto* other) { using std::swap; value_.InternalSwap(&other->value_); + reserved_range_.InternalSwap(&other->reserved_range_); + reserved_name_.InternalSwap(&other->reserved_name_); name_.Swap(&other->name_); swap(options_, other->options_); swap(_has_bits_[0], other->_has_bits_[0]); @@ -6838,155 +6419,33 @@ void EnumDescriptorProto::InternalSwap(EnumDescriptorProto* other) { ::google::protobuf::Metadata EnumDescriptorProto::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// EnumDescriptorProto -// optional string name = 1; -bool EnumDescriptorProto::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void EnumDescriptorProto::set_has_name() { - _has_bits_[0] |= 0x00000001u; -} -void EnumDescriptorProto::clear_has_name() { - _has_bits_[0] &= ~0x00000001u; -} -void EnumDescriptorProto::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_name(); -} -const ::std::string& EnumDescriptorProto::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.name) - return name_.GetNoArena(); -} -void EnumDescriptorProto::set_name(const ::std::string& value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.name) -} -#if LANG_CXX11 -void EnumDescriptorProto::set_name(::std::string&& value) { - set_has_name(); - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.EnumDescriptorProto.name) -} -#endif -void EnumDescriptorProto::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.EnumDescriptorProto.name) -} -void EnumDescriptorProto::set_name(const char* value, size_t size) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumDescriptorProto.name) -} -::std::string* EnumDescriptorProto::mutable_name() { - set_has_name(); - // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* EnumDescriptorProto::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.name) - clear_has_name(); - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void EnumDescriptorProto::set_allocated_name(::std::string* name) { - if (name != NULL) { - set_has_name(); - } else { - clear_has_name(); - } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumDescriptorProto.name) -} - -// repeated .google.protobuf.EnumValueDescriptorProto value = 2; -int EnumDescriptorProto::value_size() const { - return value_.size(); -} -void EnumDescriptorProto::clear_value() { - value_.Clear(); -} -const ::google::protobuf::EnumValueDescriptorProto& EnumDescriptorProto::value(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.value) - return value_.Get(index); -} -::google::protobuf::EnumValueDescriptorProto* EnumDescriptorProto::mutable_value(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.value) - return value_.Mutable(index); -} -::google::protobuf::EnumValueDescriptorProto* EnumDescriptorProto::add_value() { - // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.value) - return value_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >* -EnumDescriptorProto::mutable_value() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumDescriptorProto.value) - return &value_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >& -EnumDescriptorProto::value() const { - // @@protoc_insertion_point(field_list:google.protobuf.EnumDescriptorProto.value) - return value_; -} +// =================================================================== -// optional .google.protobuf.EnumOptions options = 3; -bool EnumDescriptorProto::has_options() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void EnumDescriptorProto::set_has_options() { - _has_bits_[0] |= 0x00000002u; -} -void EnumDescriptorProto::clear_has_options() { - _has_bits_[0] &= ~0x00000002u; -} -void EnumDescriptorProto::clear_options() { - if (options_ != NULL) options_->::google::protobuf::EnumOptions::Clear(); - clear_has_options(); +void EnumValueDescriptorProto::InitAsDefaultInstance() { + ::google::protobuf::_EnumValueDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::EnumValueOptions*>( + ::google::protobuf::EnumValueOptions::internal_default_instance()); } -const ::google::protobuf::EnumOptions& EnumDescriptorProto::options() const { - const ::google::protobuf::EnumOptions* p = options_; - // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.options) - return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::EnumOptions*>( - &::google::protobuf::_EnumOptions_default_instance_); +void EnumValueDescriptorProto::_slow_mutable_options() { + options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::EnumValueOptions >( + GetArenaNoVirtual()); } -::google::protobuf::EnumOptions* EnumDescriptorProto::mutable_options() { - set_has_options(); - if (options_ == NULL) { - options_ = new ::google::protobuf::EnumOptions; +void EnumValueDescriptorProto::unsafe_arena_set_allocated_options( + ::google::protobuf::EnumValueOptions* options) { + if (GetArenaNoVirtual() == NULL) { + delete options_; } - // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.options) - return options_; -} -::google::protobuf::EnumOptions* EnumDescriptorProto::release_options() { - // @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.options) - clear_has_options(); - ::google::protobuf::EnumOptions* temp = options_; - options_ = NULL; - return temp; -} -void EnumDescriptorProto::set_allocated_options(::google::protobuf::EnumOptions* options) { - delete options_; options_ = options; if (options) { set_has_options(); } else { clear_has_options(); } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumDescriptorProto.options) + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumValueDescriptorProto.options) } - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int EnumValueDescriptorProto::kNameFieldNumber; const int EnumValueDescriptorProto::kNumberFieldNumber; @@ -6996,11 +6455,19 @@ const int EnumValueDescriptorProto::kOptionsFieldNumber; EnumValueDescriptorProto::EnumValueDescriptorProto() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumValueDescriptorProto(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.EnumValueDescriptorProto) } +EnumValueDescriptorProto::EnumValueDescriptorProto(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _internal_metadata_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumValueDescriptorProto(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.EnumValueDescriptorProto) +} EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProto& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -7009,7 +6476,8 @@ EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProt _internal_metadata_.MergeFrom(from._internal_metadata_); name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_name()) { - name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(), + GetArenaNoVirtual()); } if (from.has_options()) { options_ = new ::google::protobuf::EnumValueOptions(*from.options_); @@ -7034,31 +6502,34 @@ EnumValueDescriptorProto::~EnumValueDescriptorProto() { } void EnumValueDescriptorProto::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (this != internal_default_instance()) delete options_; } +void EnumValueDescriptorProto::ArenaDtor(void* object) { + EnumValueDescriptorProto* _this = reinterpret_cast< EnumValueDescriptorProto* >(object); + (void)_this; +} +void EnumValueDescriptorProto::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void EnumValueDescriptorProto::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* EnumValueDescriptorProto::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const EnumValueDescriptorProto& EnumValueDescriptorProto::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumValueDescriptorProto(); return *internal_default_instance(); } EnumValueDescriptorProto* EnumValueDescriptorProto::New(::google::protobuf::Arena* arena) const { - EnumValueDescriptorProto* n = new EnumValueDescriptorProto; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<EnumValueDescriptorProto>(arena); } void EnumValueDescriptorProto::Clear() { @@ -7071,11 +6542,11 @@ void EnumValueDescriptorProto::Clear() { if (cached_has_bits & 3u) { if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*name_.UnsafeRawStringPointer())->clear(); + name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000002u) { GOOGLE_DCHECK(options_ != NULL); - options_->::google::protobuf::EnumValueOptions::Clear(); + options_->Clear(); } } number_ = 0; @@ -7127,7 +6598,7 @@ bool EnumValueDescriptorProto::MergePartialFromCodedStream( case 3: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_options())); } else { goto handle_unusual; @@ -7217,7 +6688,7 @@ void EnumValueDescriptorProto::SerializeWithCachedSizes( // optional .google.protobuf.EnumValueOptions options = 3; if (cached_has_bits & 0x00000002u) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 3, *this->options_, deterministic, target); } @@ -7249,7 +6720,7 @@ size_t EnumValueDescriptorProto::ByteSizeLong() const { // optional .google.protobuf.EnumValueOptions options = 3; if (has_options()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *this->options_); } @@ -7293,8 +6764,7 @@ void EnumValueDescriptorProto::MergeFrom(const EnumValueDescriptorProto& from) { cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 7u) { if (cached_has_bits & 0x00000001u) { - set_has_name(); - name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + set_name(from.name()); } if (cached_has_bits & 0x00000002u) { mutable_options()->::google::protobuf::EnumValueOptions::MergeFrom(from.options()); @@ -7329,6 +6799,21 @@ bool EnumValueDescriptorProto::IsInitialized() const { void EnumValueDescriptorProto::Swap(EnumValueDescriptorProto* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + EnumValueDescriptorProto* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void EnumValueDescriptorProto::UnsafeArenaSwap(EnumValueDescriptorProto* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void EnumValueDescriptorProto::InternalSwap(EnumValueDescriptorProto* other) { @@ -7343,149 +6828,33 @@ void EnumValueDescriptorProto::InternalSwap(EnumValueDescriptorProto* other) { ::google::protobuf::Metadata EnumValueDescriptorProto::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// EnumValueDescriptorProto - -// optional string name = 1; -bool EnumValueDescriptorProto::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void EnumValueDescriptorProto::set_has_name() { - _has_bits_[0] |= 0x00000001u; -} -void EnumValueDescriptorProto::clear_has_name() { - _has_bits_[0] &= ~0x00000001u; -} -void EnumValueDescriptorProto::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_name(); -} -const ::std::string& EnumValueDescriptorProto::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.name) - return name_.GetNoArena(); -} -void EnumValueDescriptorProto::set_name(const ::std::string& value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.EnumValueDescriptorProto.name) -} -#if LANG_CXX11 -void EnumValueDescriptorProto::set_name(::std::string&& value) { - set_has_name(); - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.EnumValueDescriptorProto.name) -} -#endif -void EnumValueDescriptorProto::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.EnumValueDescriptorProto.name) -} -void EnumValueDescriptorProto::set_name(const char* value, size_t size) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumValueDescriptorProto.name) -} -::std::string* EnumValueDescriptorProto::mutable_name() { - set_has_name(); - // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* EnumValueDescriptorProto::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.name) - clear_has_name(); - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void EnumValueDescriptorProto::set_allocated_name(::std::string* name) { - if (name != NULL) { - set_has_name(); - } else { - clear_has_name(); - } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValueDescriptorProto.name) -} -// optional int32 number = 2; -bool EnumValueDescriptorProto::has_number() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void EnumValueDescriptorProto::set_has_number() { - _has_bits_[0] |= 0x00000004u; -} -void EnumValueDescriptorProto::clear_has_number() { - _has_bits_[0] &= ~0x00000004u; -} -void EnumValueDescriptorProto::clear_number() { - number_ = 0; - clear_has_number(); -} -::google::protobuf::int32 EnumValueDescriptorProto::number() const { - // @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.number) - return number_; -} -void EnumValueDescriptorProto::set_number(::google::protobuf::int32 value) { - set_has_number(); - number_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.EnumValueDescriptorProto.number) -} +// =================================================================== -// optional .google.protobuf.EnumValueOptions options = 3; -bool EnumValueDescriptorProto::has_options() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void EnumValueDescriptorProto::set_has_options() { - _has_bits_[0] |= 0x00000002u; -} -void EnumValueDescriptorProto::clear_has_options() { - _has_bits_[0] &= ~0x00000002u; -} -void EnumValueDescriptorProto::clear_options() { - if (options_ != NULL) options_->::google::protobuf::EnumValueOptions::Clear(); - clear_has_options(); +void ServiceDescriptorProto::InitAsDefaultInstance() { + ::google::protobuf::_ServiceDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::ServiceOptions*>( + ::google::protobuf::ServiceOptions::internal_default_instance()); } -const ::google::protobuf::EnumValueOptions& EnumValueDescriptorProto::options() const { - const ::google::protobuf::EnumValueOptions* p = options_; - // @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.options) - return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::EnumValueOptions*>( - &::google::protobuf::_EnumValueOptions_default_instance_); +void ServiceDescriptorProto::_slow_mutable_options() { + options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::ServiceOptions >( + GetArenaNoVirtual()); } -::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::mutable_options() { - set_has_options(); - if (options_ == NULL) { - options_ = new ::google::protobuf::EnumValueOptions; +void ServiceDescriptorProto::unsafe_arena_set_allocated_options( + ::google::protobuf::ServiceOptions* options) { + if (GetArenaNoVirtual() == NULL) { + delete options_; } - // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.options) - return options_; -} -::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::release_options() { - // @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.options) - clear_has_options(); - ::google::protobuf::EnumValueOptions* temp = options_; - options_ = NULL; - return temp; -} -void EnumValueDescriptorProto::set_allocated_options(::google::protobuf::EnumValueOptions* options) { - delete options_; options_ = options; if (options) { set_has_options(); } else { clear_has_options(); } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValueDescriptorProto.options) + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.ServiceDescriptorProto.options) } - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int ServiceDescriptorProto::kNameFieldNumber; const int ServiceDescriptorProto::kMethodFieldNumber; @@ -7495,11 +6864,20 @@ const int ServiceDescriptorProto::kOptionsFieldNumber; ServiceDescriptorProto::ServiceDescriptorProto() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsServiceDescriptorProto(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.ServiceDescriptorProto) } +ServiceDescriptorProto::ServiceDescriptorProto(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _internal_metadata_(arena), + method_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsServiceDescriptorProto(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.ServiceDescriptorProto) +} ServiceDescriptorProto::ServiceDescriptorProto(const ServiceDescriptorProto& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -7509,7 +6887,8 @@ ServiceDescriptorProto::ServiceDescriptorProto(const ServiceDescriptorProto& fro _internal_metadata_.MergeFrom(from._internal_metadata_); name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_name()) { - name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(), + GetArenaNoVirtual()); } if (from.has_options()) { options_ = new ::google::protobuf::ServiceOptions(*from.options_); @@ -7531,31 +6910,34 @@ ServiceDescriptorProto::~ServiceDescriptorProto() { } void ServiceDescriptorProto::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (this != internal_default_instance()) delete options_; } +void ServiceDescriptorProto::ArenaDtor(void* object) { + ServiceDescriptorProto* _this = reinterpret_cast< ServiceDescriptorProto* >(object); + (void)_this; +} +void ServiceDescriptorProto::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void ServiceDescriptorProto::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* ServiceDescriptorProto::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const ServiceDescriptorProto& ServiceDescriptorProto::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsServiceDescriptorProto(); return *internal_default_instance(); } ServiceDescriptorProto* ServiceDescriptorProto::New(::google::protobuf::Arena* arena) const { - ServiceDescriptorProto* n = new ServiceDescriptorProto; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<ServiceDescriptorProto>(arena); } void ServiceDescriptorProto::Clear() { @@ -7569,11 +6951,11 @@ void ServiceDescriptorProto::Clear() { if (cached_has_bits & 3u) { if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*name_.UnsafeRawStringPointer())->clear(); + name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000002u) { GOOGLE_DCHECK(options_ != NULL); - options_->::google::protobuf::ServiceOptions::Clear(); + options_->Clear(); } } _has_bits_.Clear(); @@ -7610,8 +6992,7 @@ bool ServiceDescriptorProto::MergePartialFromCodedStream( case 2: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_method())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_method())); } else { goto handle_unusual; } @@ -7622,7 +7003,7 @@ bool ServiceDescriptorProto::MergePartialFromCodedStream( case 3: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_options())); } else { goto handle_unusual; @@ -7710,14 +7091,14 @@ void ServiceDescriptorProto::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->method_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 2, this->method(static_cast<int>(i)), deterministic, target); } // optional .google.protobuf.ServiceOptions options = 3; if (cached_has_bits & 0x00000002u) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 3, *this->options_, deterministic, target); } @@ -7744,7 +7125,7 @@ size_t ServiceDescriptorProto::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->method(static_cast<int>(i))); } } @@ -7760,7 +7141,7 @@ size_t ServiceDescriptorProto::ByteSizeLong() const { // optional .google.protobuf.ServiceOptions options = 3; if (has_options()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *this->options_); } @@ -7798,8 +7179,7 @@ void ServiceDescriptorProto::MergeFrom(const ServiceDescriptorProto& from) { cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 3u) { if (cached_has_bits & 0x00000001u) { - set_has_name(); - name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + set_name(from.name()); } if (cached_has_bits & 0x00000002u) { mutable_options()->::google::protobuf::ServiceOptions::MergeFrom(from.options()); @@ -7831,6 +7211,21 @@ bool ServiceDescriptorProto::IsInitialized() const { void ServiceDescriptorProto::Swap(ServiceDescriptorProto* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + ServiceDescriptorProto* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void ServiceDescriptorProto::UnsafeArenaSwap(ServiceDescriptorProto* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void ServiceDescriptorProto::InternalSwap(ServiceDescriptorProto* other) { @@ -7845,155 +7240,33 @@ void ServiceDescriptorProto::InternalSwap(ServiceDescriptorProto* other) { ::google::protobuf::Metadata ServiceDescriptorProto::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// ServiceDescriptorProto - -// optional string name = 1; -bool ServiceDescriptorProto::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void ServiceDescriptorProto::set_has_name() { - _has_bits_[0] |= 0x00000001u; -} -void ServiceDescriptorProto::clear_has_name() { - _has_bits_[0] &= ~0x00000001u; -} -void ServiceDescriptorProto::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_name(); -} -const ::std::string& ServiceDescriptorProto::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.name) - return name_.GetNoArena(); -} -void ServiceDescriptorProto::set_name(const ::std::string& value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.ServiceDescriptorProto.name) -} -#if LANG_CXX11 -void ServiceDescriptorProto::set_name(::std::string&& value) { - set_has_name(); - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.ServiceDescriptorProto.name) -} -#endif -void ServiceDescriptorProto::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.ServiceDescriptorProto.name) -} -void ServiceDescriptorProto::set_name(const char* value, size_t size) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.ServiceDescriptorProto.name) -} -::std::string* ServiceDescriptorProto::mutable_name() { - set_has_name(); - // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* ServiceDescriptorProto::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.name) - clear_has_name(); - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void ServiceDescriptorProto::set_allocated_name(::std::string* name) { - if (name != NULL) { - set_has_name(); - } else { - clear_has_name(); - } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.ServiceDescriptorProto.name) -} -// repeated .google.protobuf.MethodDescriptorProto method = 2; -int ServiceDescriptorProto::method_size() const { - return method_.size(); -} -void ServiceDescriptorProto::clear_method() { - method_.Clear(); -} -const ::google::protobuf::MethodDescriptorProto& ServiceDescriptorProto::method(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.method) - return method_.Get(index); -} -::google::protobuf::MethodDescriptorProto* ServiceDescriptorProto::mutable_method(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.method) - return method_.Mutable(index); -} -::google::protobuf::MethodDescriptorProto* ServiceDescriptorProto::add_method() { - // @@protoc_insertion_point(field_add:google.protobuf.ServiceDescriptorProto.method) - return method_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto >* -ServiceDescriptorProto::mutable_method() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.ServiceDescriptorProto.method) - return &method_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto >& -ServiceDescriptorProto::method() const { - // @@protoc_insertion_point(field_list:google.protobuf.ServiceDescriptorProto.method) - return method_; -} +// =================================================================== -// optional .google.protobuf.ServiceOptions options = 3; -bool ServiceDescriptorProto::has_options() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void ServiceDescriptorProto::set_has_options() { - _has_bits_[0] |= 0x00000002u; -} -void ServiceDescriptorProto::clear_has_options() { - _has_bits_[0] &= ~0x00000002u; -} -void ServiceDescriptorProto::clear_options() { - if (options_ != NULL) options_->::google::protobuf::ServiceOptions::Clear(); - clear_has_options(); +void MethodDescriptorProto::InitAsDefaultInstance() { + ::google::protobuf::_MethodDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::MethodOptions*>( + ::google::protobuf::MethodOptions::internal_default_instance()); } -const ::google::protobuf::ServiceOptions& ServiceDescriptorProto::options() const { - const ::google::protobuf::ServiceOptions* p = options_; - // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.options) - return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::ServiceOptions*>( - &::google::protobuf::_ServiceOptions_default_instance_); +void MethodDescriptorProto::_slow_mutable_options() { + options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::MethodOptions >( + GetArenaNoVirtual()); } -::google::protobuf::ServiceOptions* ServiceDescriptorProto::mutable_options() { - set_has_options(); - if (options_ == NULL) { - options_ = new ::google::protobuf::ServiceOptions; +void MethodDescriptorProto::unsafe_arena_set_allocated_options( + ::google::protobuf::MethodOptions* options) { + if (GetArenaNoVirtual() == NULL) { + delete options_; } - // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.options) - return options_; -} -::google::protobuf::ServiceOptions* ServiceDescriptorProto::release_options() { - // @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.options) - clear_has_options(); - ::google::protobuf::ServiceOptions* temp = options_; - options_ = NULL; - return temp; -} -void ServiceDescriptorProto::set_allocated_options(::google::protobuf::ServiceOptions* options) { - delete options_; options_ = options; if (options) { set_has_options(); } else { clear_has_options(); } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.ServiceDescriptorProto.options) + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.MethodDescriptorProto.options) } - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int MethodDescriptorProto::kNameFieldNumber; const int MethodDescriptorProto::kInputTypeFieldNumber; @@ -8006,11 +7279,19 @@ const int MethodDescriptorProto::kServerStreamingFieldNumber; MethodDescriptorProto::MethodDescriptorProto() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsMethodDescriptorProto(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.MethodDescriptorProto) } +MethodDescriptorProto::MethodDescriptorProto(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _internal_metadata_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsMethodDescriptorProto(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.MethodDescriptorProto) +} MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -8019,15 +7300,18 @@ MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from) _internal_metadata_.MergeFrom(from._internal_metadata_); name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_name()) { - name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(), + GetArenaNoVirtual()); } input_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_input_type()) { - input_type_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.input_type_); + input_type_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.input_type(), + GetArenaNoVirtual()); } output_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_output_type()) { - output_type_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.output_type_); + output_type_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.output_type(), + GetArenaNoVirtual()); } if (from.has_options()) { options_ = new ::google::protobuf::MethodOptions(*from.options_); @@ -8056,33 +7340,36 @@ MethodDescriptorProto::~MethodDescriptorProto() { } void MethodDescriptorProto::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); input_type_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); output_type_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (this != internal_default_instance()) delete options_; } +void MethodDescriptorProto::ArenaDtor(void* object) { + MethodDescriptorProto* _this = reinterpret_cast< MethodDescriptorProto* >(object); + (void)_this; +} +void MethodDescriptorProto::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void MethodDescriptorProto::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* MethodDescriptorProto::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const MethodDescriptorProto& MethodDescriptorProto::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsMethodDescriptorProto(); return *internal_default_instance(); } MethodDescriptorProto* MethodDescriptorProto::New(::google::protobuf::Arena* arena) const { - MethodDescriptorProto* n = new MethodDescriptorProto; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<MethodDescriptorProto>(arena); } void MethodDescriptorProto::Clear() { @@ -8095,26 +7382,24 @@ void MethodDescriptorProto::Clear() { if (cached_has_bits & 15u) { if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*name_.UnsafeRawStringPointer())->clear(); + name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000002u) { GOOGLE_DCHECK(!input_type_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*input_type_.UnsafeRawStringPointer())->clear(); + input_type_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000004u) { GOOGLE_DCHECK(!output_type_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*output_type_.UnsafeRawStringPointer())->clear(); + output_type_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000008u) { GOOGLE_DCHECK(options_ != NULL); - options_->::google::protobuf::MethodOptions::Clear(); + options_->Clear(); } } - if (cached_has_bits & 48u) { - ::memset(&client_streaming_, 0, static_cast<size_t>( - reinterpret_cast<char*>(&server_streaming_) - - reinterpret_cast<char*>(&client_streaming_)) + sizeof(server_streaming_)); - } + ::memset(&client_streaming_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&server_streaming_) - + reinterpret_cast<char*>(&client_streaming_)) + sizeof(server_streaming_)); _has_bits_.Clear(); _internal_metadata_.Clear(); } @@ -8181,7 +7466,7 @@ bool MethodDescriptorProto::MergePartialFromCodedStream( case 4: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_options())); } else { goto handle_unusual; @@ -8341,7 +7626,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes( // optional .google.protobuf.MethodOptions options = 4; if (cached_has_bits & 0x00000008u) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 4, *this->options_, deterministic, target); } @@ -8397,7 +7682,7 @@ size_t MethodDescriptorProto::ByteSizeLong() const { // optional .google.protobuf.MethodOptions options = 4; if (has_options()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *this->options_); } @@ -8444,16 +7729,13 @@ void MethodDescriptorProto::MergeFrom(const MethodDescriptorProto& from) { cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 63u) { if (cached_has_bits & 0x00000001u) { - set_has_name(); - name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + set_name(from.name()); } if (cached_has_bits & 0x00000002u) { - set_has_input_type(); - input_type_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.input_type_); + set_input_type(from.input_type()); } if (cached_has_bits & 0x00000004u) { - set_has_output_type(); - output_type_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.output_type_); + set_output_type(from.output_type()); } if (cached_has_bits & 0x00000008u) { mutable_options()->::google::protobuf::MethodOptions::MergeFrom(from.options()); @@ -8491,6 +7773,21 @@ bool MethodDescriptorProto::IsInitialized() const { void MethodDescriptorProto::Swap(MethodDescriptorProto* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + MethodDescriptorProto* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void MethodDescriptorProto::UnsafeArenaSwap(MethodDescriptorProto* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void MethodDescriptorProto::InternalSwap(MethodDescriptorProto* other) { @@ -8508,299 +7805,14 @@ void MethodDescriptorProto::InternalSwap(MethodDescriptorProto* other) { ::google::protobuf::Metadata MethodDescriptorProto::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// MethodDescriptorProto - -// optional string name = 1; -bool MethodDescriptorProto::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void MethodDescriptorProto::set_has_name() { - _has_bits_[0] |= 0x00000001u; -} -void MethodDescriptorProto::clear_has_name() { - _has_bits_[0] &= ~0x00000001u; -} -void MethodDescriptorProto::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_name(); -} -const ::std::string& MethodDescriptorProto::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.name) - return name_.GetNoArena(); -} -void MethodDescriptorProto::set_name(const ::std::string& value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.name) -} -#if LANG_CXX11 -void MethodDescriptorProto::set_name(::std::string&& value) { - set_has_name(); - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.MethodDescriptorProto.name) -} -#endif -void MethodDescriptorProto::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.MethodDescriptorProto.name) -} -void MethodDescriptorProto::set_name(const char* value, size_t size) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.name) -} -::std::string* MethodDescriptorProto::mutable_name() { - set_has_name(); - // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* MethodDescriptorProto::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.name) - clear_has_name(); - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void MethodDescriptorProto::set_allocated_name(::std::string* name) { - if (name != NULL) { - set_has_name(); - } else { - clear_has_name(); - } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.name) -} - -// optional string input_type = 2; -bool MethodDescriptorProto::has_input_type() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void MethodDescriptorProto::set_has_input_type() { - _has_bits_[0] |= 0x00000002u; -} -void MethodDescriptorProto::clear_has_input_type() { - _has_bits_[0] &= ~0x00000002u; -} -void MethodDescriptorProto::clear_input_type() { - input_type_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_input_type(); -} -const ::std::string& MethodDescriptorProto::input_type() const { - // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.input_type) - return input_type_.GetNoArena(); -} -void MethodDescriptorProto::set_input_type(const ::std::string& value) { - set_has_input_type(); - input_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.input_type) -} -#if LANG_CXX11 -void MethodDescriptorProto::set_input_type(::std::string&& value) { - set_has_input_type(); - input_type_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.MethodDescriptorProto.input_type) -} -#endif -void MethodDescriptorProto::set_input_type(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_input_type(); - input_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.MethodDescriptorProto.input_type) -} -void MethodDescriptorProto::set_input_type(const char* value, size_t size) { - set_has_input_type(); - input_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.input_type) -} -::std::string* MethodDescriptorProto::mutable_input_type() { - set_has_input_type(); - // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.input_type) - return input_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* MethodDescriptorProto::release_input_type() { - // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.input_type) - clear_has_input_type(); - return input_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void MethodDescriptorProto::set_allocated_input_type(::std::string* input_type) { - if (input_type != NULL) { - set_has_input_type(); - } else { - clear_has_input_type(); - } - input_type_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), input_type); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.input_type) -} - -// optional string output_type = 3; -bool MethodDescriptorProto::has_output_type() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void MethodDescriptorProto::set_has_output_type() { - _has_bits_[0] |= 0x00000004u; -} -void MethodDescriptorProto::clear_has_output_type() { - _has_bits_[0] &= ~0x00000004u; -} -void MethodDescriptorProto::clear_output_type() { - output_type_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_output_type(); -} -const ::std::string& MethodDescriptorProto::output_type() const { - // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.output_type) - return output_type_.GetNoArena(); -} -void MethodDescriptorProto::set_output_type(const ::std::string& value) { - set_has_output_type(); - output_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.output_type) -} -#if LANG_CXX11 -void MethodDescriptorProto::set_output_type(::std::string&& value) { - set_has_output_type(); - output_type_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.MethodDescriptorProto.output_type) -} -#endif -void MethodDescriptorProto::set_output_type(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_output_type(); - output_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.MethodDescriptorProto.output_type) -} -void MethodDescriptorProto::set_output_type(const char* value, size_t size) { - set_has_output_type(); - output_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.output_type) -} -::std::string* MethodDescriptorProto::mutable_output_type() { - set_has_output_type(); - // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.output_type) - return output_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* MethodDescriptorProto::release_output_type() { - // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.output_type) - clear_has_output_type(); - return output_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void MethodDescriptorProto::set_allocated_output_type(::std::string* output_type) { - if (output_type != NULL) { - set_has_output_type(); - } else { - clear_has_output_type(); - } - output_type_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), output_type); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.output_type) -} - -// optional .google.protobuf.MethodOptions options = 4; -bool MethodDescriptorProto::has_options() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -void MethodDescriptorProto::set_has_options() { - _has_bits_[0] |= 0x00000008u; -} -void MethodDescriptorProto::clear_has_options() { - _has_bits_[0] &= ~0x00000008u; -} -void MethodDescriptorProto::clear_options() { - if (options_ != NULL) options_->::google::protobuf::MethodOptions::Clear(); - clear_has_options(); -} -const ::google::protobuf::MethodOptions& MethodDescriptorProto::options() const { - const ::google::protobuf::MethodOptions* p = options_; - // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.options) - return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::MethodOptions*>( - &::google::protobuf::_MethodOptions_default_instance_); -} -::google::protobuf::MethodOptions* MethodDescriptorProto::mutable_options() { - set_has_options(); - if (options_ == NULL) { - options_ = new ::google::protobuf::MethodOptions; - } - // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.options) - return options_; -} -::google::protobuf::MethodOptions* MethodDescriptorProto::release_options() { - // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.options) - clear_has_options(); - ::google::protobuf::MethodOptions* temp = options_; - options_ = NULL; - return temp; -} -void MethodDescriptorProto::set_allocated_options(::google::protobuf::MethodOptions* options) { - delete options_; - options_ = options; - if (options) { - set_has_options(); - } else { - clear_has_options(); - } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.options) -} - -// optional bool client_streaming = 5 [default = false]; -bool MethodDescriptorProto::has_client_streaming() const { - return (_has_bits_[0] & 0x00000010u) != 0; -} -void MethodDescriptorProto::set_has_client_streaming() { - _has_bits_[0] |= 0x00000010u; -} -void MethodDescriptorProto::clear_has_client_streaming() { - _has_bits_[0] &= ~0x00000010u; -} -void MethodDescriptorProto::clear_client_streaming() { - client_streaming_ = false; - clear_has_client_streaming(); -} -bool MethodDescriptorProto::client_streaming() const { - // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.client_streaming) - return client_streaming_; -} -void MethodDescriptorProto::set_client_streaming(bool value) { - set_has_client_streaming(); - client_streaming_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.client_streaming) -} - -// optional bool server_streaming = 6 [default = false]; -bool MethodDescriptorProto::has_server_streaming() const { - return (_has_bits_[0] & 0x00000020u) != 0; -} -void MethodDescriptorProto::set_has_server_streaming() { - _has_bits_[0] |= 0x00000020u; -} -void MethodDescriptorProto::clear_has_server_streaming() { - _has_bits_[0] &= ~0x00000020u; -} -void MethodDescriptorProto::clear_server_streaming() { - server_streaming_ = false; - clear_has_server_streaming(); -} -bool MethodDescriptorProto::server_streaming() const { - // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.server_streaming) - return server_streaming_; -} -void MethodDescriptorProto::set_server_streaming(bool value) { - set_has_server_streaming(); - server_streaming_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.server_streaming) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void FileOptions::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int FileOptions::kJavaPackageFieldNumber; const int FileOptions::kJavaOuterClassnameFieldNumber; @@ -8826,11 +7838,21 @@ const int FileOptions::kUninterpretedOptionFieldNumber; FileOptions::FileOptions() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFileOptions(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.FileOptions) } +FileOptions::FileOptions(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _extensions_(arena), + _internal_metadata_(arena), + uninterpreted_option_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFileOptions(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.FileOptions) +} FileOptions::FileOptions(const FileOptions& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -8841,35 +7863,43 @@ FileOptions::FileOptions(const FileOptions& from) _extensions_.MergeFrom(from._extensions_); java_package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_java_package()) { - java_package_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.java_package_); + java_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.java_package(), + GetArenaNoVirtual()); } java_outer_classname_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_java_outer_classname()) { - java_outer_classname_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.java_outer_classname_); + java_outer_classname_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.java_outer_classname(), + GetArenaNoVirtual()); } go_package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_go_package()) { - go_package_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.go_package_); + go_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.go_package(), + GetArenaNoVirtual()); } objc_class_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_objc_class_prefix()) { - objc_class_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.objc_class_prefix_); + objc_class_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.objc_class_prefix(), + GetArenaNoVirtual()); } csharp_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_csharp_namespace()) { - csharp_namespace_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.csharp_namespace_); + csharp_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.csharp_namespace(), + GetArenaNoVirtual()); } swift_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_swift_prefix()) { - swift_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.swift_prefix_); + swift_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.swift_prefix(), + GetArenaNoVirtual()); } php_class_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_php_class_prefix()) { - php_class_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_class_prefix_); + php_class_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_class_prefix(), + GetArenaNoVirtual()); } php_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_php_namespace()) { - php_namespace_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_namespace_); + php_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_namespace(), + GetArenaNoVirtual()); } ::memcpy(&cc_enable_arenas_, &from.cc_enable_arenas_, static_cast<size_t>(reinterpret_cast<char*>(&optimize_for_) - @@ -8899,6 +7929,7 @@ FileOptions::~FileOptions() { } void FileOptions::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); java_package_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); java_outer_classname_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); go_package_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -8909,27 +7940,29 @@ void FileOptions::SharedDtor() { php_namespace_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } +void FileOptions::ArenaDtor(void* object) { + FileOptions* _this = reinterpret_cast< FileOptions* >(object); + (void)_this; +} +void FileOptions::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void FileOptions::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* FileOptions::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const FileOptions& FileOptions::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFileOptions(); return *internal_default_instance(); } FileOptions* FileOptions::New(::google::protobuf::Arena* arena) const { - FileOptions* n = new FileOptions; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<FileOptions>(arena); } void FileOptions::Clear() { @@ -8944,35 +7977,35 @@ void FileOptions::Clear() { if (cached_has_bits & 255u) { if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(!java_package_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*java_package_.UnsafeRawStringPointer())->clear(); + java_package_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000002u) { GOOGLE_DCHECK(!java_outer_classname_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*java_outer_classname_.UnsafeRawStringPointer())->clear(); + java_outer_classname_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000004u) { GOOGLE_DCHECK(!go_package_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*go_package_.UnsafeRawStringPointer())->clear(); + go_package_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000008u) { GOOGLE_DCHECK(!objc_class_prefix_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*objc_class_prefix_.UnsafeRawStringPointer())->clear(); + objc_class_prefix_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000010u) { GOOGLE_DCHECK(!csharp_namespace_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*csharp_namespace_.UnsafeRawStringPointer())->clear(); + csharp_namespace_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000020u) { GOOGLE_DCHECK(!swift_prefix_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*swift_prefix_.UnsafeRawStringPointer())->clear(); + swift_prefix_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000040u) { GOOGLE_DCHECK(!php_class_prefix_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*php_class_prefix_.UnsafeRawStringPointer())->clear(); + php_class_prefix_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000080u) { GOOGLE_DCHECK(!php_namespace_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*php_namespace_.UnsafeRawStringPointer())->clear(); + php_namespace_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } } if (cached_has_bits & 65280u) { @@ -9276,8 +8309,7 @@ bool FileOptions::MergePartialFromCodedStream( case 999: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_uninterpreted_option())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_uninterpreted_option())); } else { goto handle_unusual; } @@ -9617,7 +8649,7 @@ void FileOptions::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 999, this->uninterpreted_option(static_cast<int>(i)), deterministic, target); } @@ -9650,7 +8682,7 @@ size_t FileOptions::ByteSizeLong() const { total_size += 2UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->uninterpreted_option(static_cast<int>(i))); } } @@ -9802,36 +8834,28 @@ void FileOptions::MergeFrom(const FileOptions& from) { cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 255u) { if (cached_has_bits & 0x00000001u) { - set_has_java_package(); - java_package_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.java_package_); + set_java_package(from.java_package()); } if (cached_has_bits & 0x00000002u) { - set_has_java_outer_classname(); - java_outer_classname_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.java_outer_classname_); + set_java_outer_classname(from.java_outer_classname()); } if (cached_has_bits & 0x00000004u) { - set_has_go_package(); - go_package_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.go_package_); + set_go_package(from.go_package()); } if (cached_has_bits & 0x00000008u) { - set_has_objc_class_prefix(); - objc_class_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.objc_class_prefix_); + set_objc_class_prefix(from.objc_class_prefix()); } if (cached_has_bits & 0x00000010u) { - set_has_csharp_namespace(); - csharp_namespace_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.csharp_namespace_); + set_csharp_namespace(from.csharp_namespace()); } if (cached_has_bits & 0x00000020u) { - set_has_swift_prefix(); - swift_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.swift_prefix_); + set_swift_prefix(from.swift_prefix()); } if (cached_has_bits & 0x00000040u) { - set_has_php_class_prefix(); - php_class_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_class_prefix_); + set_php_class_prefix(from.php_class_prefix()); } if (cached_has_bits & 0x00000080u) { - set_has_php_namespace(); - php_namespace_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_namespace_); + set_php_namespace(from.php_namespace()); } } if (cached_has_bits & 65280u) { @@ -9897,6 +8921,21 @@ bool FileOptions::IsInitialized() const { void FileOptions::Swap(FileOptions* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + FileOptions* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void FileOptions::UnsafeArenaSwap(FileOptions* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void FileOptions::InternalSwap(FileOptions* other) { @@ -9928,791 +8967,14 @@ void FileOptions::InternalSwap(FileOptions* other) { ::google::protobuf::Metadata FileOptions::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// FileOptions - -// optional string java_package = 1; -bool FileOptions::has_java_package() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void FileOptions::set_has_java_package() { - _has_bits_[0] |= 0x00000001u; -} -void FileOptions::clear_has_java_package() { - _has_bits_[0] &= ~0x00000001u; -} -void FileOptions::clear_java_package() { - java_package_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_java_package(); -} -const ::std::string& FileOptions::java_package() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_package) - return java_package_.GetNoArena(); -} -void FileOptions::set_java_package(const ::std::string& value) { - set_has_java_package(); - java_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_package) -} -#if LANG_CXX11 -void FileOptions::set_java_package(::std::string&& value) { - set_has_java_package(); - java_package_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.java_package) -} -#endif -void FileOptions::set_java_package(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_java_package(); - java_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.java_package) -} -void FileOptions::set_java_package(const char* value, size_t size) { - set_has_java_package(); - java_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.java_package) -} -::std::string* FileOptions::mutable_java_package() { - set_has_java_package(); - // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.java_package) - return java_package_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* FileOptions::release_java_package() { - // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.java_package) - clear_has_java_package(); - return java_package_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void FileOptions::set_allocated_java_package(::std::string* java_package) { - if (java_package != NULL) { - set_has_java_package(); - } else { - clear_has_java_package(); - } - java_package_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), java_package); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_package) -} - -// optional string java_outer_classname = 8; -bool FileOptions::has_java_outer_classname() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void FileOptions::set_has_java_outer_classname() { - _has_bits_[0] |= 0x00000002u; -} -void FileOptions::clear_has_java_outer_classname() { - _has_bits_[0] &= ~0x00000002u; -} -void FileOptions::clear_java_outer_classname() { - java_outer_classname_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_java_outer_classname(); -} -const ::std::string& FileOptions::java_outer_classname() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_outer_classname) - return java_outer_classname_.GetNoArena(); -} -void FileOptions::set_java_outer_classname(const ::std::string& value) { - set_has_java_outer_classname(); - java_outer_classname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_outer_classname) -} -#if LANG_CXX11 -void FileOptions::set_java_outer_classname(::std::string&& value) { - set_has_java_outer_classname(); - java_outer_classname_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.java_outer_classname) -} -#endif -void FileOptions::set_java_outer_classname(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_java_outer_classname(); - java_outer_classname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.java_outer_classname) -} -void FileOptions::set_java_outer_classname(const char* value, size_t size) { - set_has_java_outer_classname(); - java_outer_classname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.java_outer_classname) -} -::std::string* FileOptions::mutable_java_outer_classname() { - set_has_java_outer_classname(); - // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.java_outer_classname) - return java_outer_classname_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* FileOptions::release_java_outer_classname() { - // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.java_outer_classname) - clear_has_java_outer_classname(); - return java_outer_classname_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void FileOptions::set_allocated_java_outer_classname(::std::string* java_outer_classname) { - if (java_outer_classname != NULL) { - set_has_java_outer_classname(); - } else { - clear_has_java_outer_classname(); - } - java_outer_classname_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), java_outer_classname); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_outer_classname) -} - -// optional bool java_multiple_files = 10 [default = false]; -bool FileOptions::has_java_multiple_files() const { - return (_has_bits_[0] & 0x00000200u) != 0; -} -void FileOptions::set_has_java_multiple_files() { - _has_bits_[0] |= 0x00000200u; -} -void FileOptions::clear_has_java_multiple_files() { - _has_bits_[0] &= ~0x00000200u; -} -void FileOptions::clear_java_multiple_files() { - java_multiple_files_ = false; - clear_has_java_multiple_files(); -} -bool FileOptions::java_multiple_files() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_multiple_files) - return java_multiple_files_; -} -void FileOptions::set_java_multiple_files(bool value) { - set_has_java_multiple_files(); - java_multiple_files_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_multiple_files) -} - -// optional bool java_generate_equals_and_hash = 20 [deprecated = true]; -bool FileOptions::has_java_generate_equals_and_hash() const { - return (_has_bits_[0] & 0x00000400u) != 0; -} -void FileOptions::set_has_java_generate_equals_and_hash() { - _has_bits_[0] |= 0x00000400u; -} -void FileOptions::clear_has_java_generate_equals_and_hash() { - _has_bits_[0] &= ~0x00000400u; -} -void FileOptions::clear_java_generate_equals_and_hash() { - java_generate_equals_and_hash_ = false; - clear_has_java_generate_equals_and_hash(); -} -bool FileOptions::java_generate_equals_and_hash() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_generate_equals_and_hash) - return java_generate_equals_and_hash_; -} -void FileOptions::set_java_generate_equals_and_hash(bool value) { - set_has_java_generate_equals_and_hash(); - java_generate_equals_and_hash_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_generate_equals_and_hash) -} - -// optional bool java_string_check_utf8 = 27 [default = false]; -bool FileOptions::has_java_string_check_utf8() const { - return (_has_bits_[0] & 0x00000800u) != 0; -} -void FileOptions::set_has_java_string_check_utf8() { - _has_bits_[0] |= 0x00000800u; -} -void FileOptions::clear_has_java_string_check_utf8() { - _has_bits_[0] &= ~0x00000800u; -} -void FileOptions::clear_java_string_check_utf8() { - java_string_check_utf8_ = false; - clear_has_java_string_check_utf8(); -} -bool FileOptions::java_string_check_utf8() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_string_check_utf8) - return java_string_check_utf8_; -} -void FileOptions::set_java_string_check_utf8(bool value) { - set_has_java_string_check_utf8(); - java_string_check_utf8_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_string_check_utf8) -} - -// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; -bool FileOptions::has_optimize_for() const { - return (_has_bits_[0] & 0x00020000u) != 0; -} -void FileOptions::set_has_optimize_for() { - _has_bits_[0] |= 0x00020000u; -} -void FileOptions::clear_has_optimize_for() { - _has_bits_[0] &= ~0x00020000u; -} -void FileOptions::clear_optimize_for() { - optimize_for_ = 1; - clear_has_optimize_for(); -} -::google::protobuf::FileOptions_OptimizeMode FileOptions::optimize_for() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.optimize_for) - return static_cast< ::google::protobuf::FileOptions_OptimizeMode >(optimize_for_); -} -void FileOptions::set_optimize_for(::google::protobuf::FileOptions_OptimizeMode value) { - assert(::google::protobuf::FileOptions_OptimizeMode_IsValid(value)); - set_has_optimize_for(); - optimize_for_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.optimize_for) -} - -// optional string go_package = 11; -bool FileOptions::has_go_package() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void FileOptions::set_has_go_package() { - _has_bits_[0] |= 0x00000004u; -} -void FileOptions::clear_has_go_package() { - _has_bits_[0] &= ~0x00000004u; -} -void FileOptions::clear_go_package() { - go_package_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_go_package(); -} -const ::std::string& FileOptions::go_package() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.go_package) - return go_package_.GetNoArena(); -} -void FileOptions::set_go_package(const ::std::string& value) { - set_has_go_package(); - go_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.go_package) -} -#if LANG_CXX11 -void FileOptions::set_go_package(::std::string&& value) { - set_has_go_package(); - go_package_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.go_package) -} -#endif -void FileOptions::set_go_package(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_go_package(); - go_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.go_package) -} -void FileOptions::set_go_package(const char* value, size_t size) { - set_has_go_package(); - go_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.go_package) -} -::std::string* FileOptions::mutable_go_package() { - set_has_go_package(); - // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.go_package) - return go_package_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* FileOptions::release_go_package() { - // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.go_package) - clear_has_go_package(); - return go_package_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void FileOptions::set_allocated_go_package(::std::string* go_package) { - if (go_package != NULL) { - set_has_go_package(); - } else { - clear_has_go_package(); - } - go_package_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), go_package); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.go_package) -} - -// optional bool cc_generic_services = 16 [default = false]; -bool FileOptions::has_cc_generic_services() const { - return (_has_bits_[0] & 0x00001000u) != 0; -} -void FileOptions::set_has_cc_generic_services() { - _has_bits_[0] |= 0x00001000u; -} -void FileOptions::clear_has_cc_generic_services() { - _has_bits_[0] &= ~0x00001000u; -} -void FileOptions::clear_cc_generic_services() { - cc_generic_services_ = false; - clear_has_cc_generic_services(); -} -bool FileOptions::cc_generic_services() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.cc_generic_services) - return cc_generic_services_; -} -void FileOptions::set_cc_generic_services(bool value) { - set_has_cc_generic_services(); - cc_generic_services_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.cc_generic_services) -} - -// optional bool java_generic_services = 17 [default = false]; -bool FileOptions::has_java_generic_services() const { - return (_has_bits_[0] & 0x00002000u) != 0; -} -void FileOptions::set_has_java_generic_services() { - _has_bits_[0] |= 0x00002000u; -} -void FileOptions::clear_has_java_generic_services() { - _has_bits_[0] &= ~0x00002000u; -} -void FileOptions::clear_java_generic_services() { - java_generic_services_ = false; - clear_has_java_generic_services(); -} -bool FileOptions::java_generic_services() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_generic_services) - return java_generic_services_; -} -void FileOptions::set_java_generic_services(bool value) { - set_has_java_generic_services(); - java_generic_services_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_generic_services) -} - -// optional bool py_generic_services = 18 [default = false]; -bool FileOptions::has_py_generic_services() const { - return (_has_bits_[0] & 0x00004000u) != 0; -} -void FileOptions::set_has_py_generic_services() { - _has_bits_[0] |= 0x00004000u; -} -void FileOptions::clear_has_py_generic_services() { - _has_bits_[0] &= ~0x00004000u; -} -void FileOptions::clear_py_generic_services() { - py_generic_services_ = false; - clear_has_py_generic_services(); -} -bool FileOptions::py_generic_services() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.py_generic_services) - return py_generic_services_; -} -void FileOptions::set_py_generic_services(bool value) { - set_has_py_generic_services(); - py_generic_services_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.py_generic_services) -} - -// optional bool php_generic_services = 42 [default = false]; -bool FileOptions::has_php_generic_services() const { - return (_has_bits_[0] & 0x00008000u) != 0; -} -void FileOptions::set_has_php_generic_services() { - _has_bits_[0] |= 0x00008000u; -} -void FileOptions::clear_has_php_generic_services() { - _has_bits_[0] &= ~0x00008000u; -} -void FileOptions::clear_php_generic_services() { - php_generic_services_ = false; - clear_has_php_generic_services(); -} -bool FileOptions::php_generic_services() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_generic_services) - return php_generic_services_; -} -void FileOptions::set_php_generic_services(bool value) { - set_has_php_generic_services(); - php_generic_services_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_generic_services) -} - -// optional bool deprecated = 23 [default = false]; -bool FileOptions::has_deprecated() const { - return (_has_bits_[0] & 0x00010000u) != 0; -} -void FileOptions::set_has_deprecated() { - _has_bits_[0] |= 0x00010000u; -} -void FileOptions::clear_has_deprecated() { - _has_bits_[0] &= ~0x00010000u; -} -void FileOptions::clear_deprecated() { - deprecated_ = false; - clear_has_deprecated(); -} -bool FileOptions::deprecated() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.deprecated) - return deprecated_; -} -void FileOptions::set_deprecated(bool value) { - set_has_deprecated(); - deprecated_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.deprecated) -} - -// optional bool cc_enable_arenas = 31 [default = false]; -bool FileOptions::has_cc_enable_arenas() const { - return (_has_bits_[0] & 0x00000100u) != 0; -} -void FileOptions::set_has_cc_enable_arenas() { - _has_bits_[0] |= 0x00000100u; -} -void FileOptions::clear_has_cc_enable_arenas() { - _has_bits_[0] &= ~0x00000100u; -} -void FileOptions::clear_cc_enable_arenas() { - cc_enable_arenas_ = false; - clear_has_cc_enable_arenas(); -} -bool FileOptions::cc_enable_arenas() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.cc_enable_arenas) - return cc_enable_arenas_; -} -void FileOptions::set_cc_enable_arenas(bool value) { - set_has_cc_enable_arenas(); - cc_enable_arenas_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.cc_enable_arenas) -} - -// optional string objc_class_prefix = 36; -bool FileOptions::has_objc_class_prefix() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -void FileOptions::set_has_objc_class_prefix() { - _has_bits_[0] |= 0x00000008u; -} -void FileOptions::clear_has_objc_class_prefix() { - _has_bits_[0] &= ~0x00000008u; -} -void FileOptions::clear_objc_class_prefix() { - objc_class_prefix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_objc_class_prefix(); -} -const ::std::string& FileOptions::objc_class_prefix() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.objc_class_prefix) - return objc_class_prefix_.GetNoArena(); -} -void FileOptions::set_objc_class_prefix(const ::std::string& value) { - set_has_objc_class_prefix(); - objc_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.objc_class_prefix) -} -#if LANG_CXX11 -void FileOptions::set_objc_class_prefix(::std::string&& value) { - set_has_objc_class_prefix(); - objc_class_prefix_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.objc_class_prefix) -} -#endif -void FileOptions::set_objc_class_prefix(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_objc_class_prefix(); - objc_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.objc_class_prefix) -} -void FileOptions::set_objc_class_prefix(const char* value, size_t size) { - set_has_objc_class_prefix(); - objc_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.objc_class_prefix) -} -::std::string* FileOptions::mutable_objc_class_prefix() { - set_has_objc_class_prefix(); - // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.objc_class_prefix) - return objc_class_prefix_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* FileOptions::release_objc_class_prefix() { - // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.objc_class_prefix) - clear_has_objc_class_prefix(); - return objc_class_prefix_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void FileOptions::set_allocated_objc_class_prefix(::std::string* objc_class_prefix) { - if (objc_class_prefix != NULL) { - set_has_objc_class_prefix(); - } else { - clear_has_objc_class_prefix(); - } - objc_class_prefix_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), objc_class_prefix); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.objc_class_prefix) -} - -// optional string csharp_namespace = 37; -bool FileOptions::has_csharp_namespace() const { - return (_has_bits_[0] & 0x00000010u) != 0; -} -void FileOptions::set_has_csharp_namespace() { - _has_bits_[0] |= 0x00000010u; -} -void FileOptions::clear_has_csharp_namespace() { - _has_bits_[0] &= ~0x00000010u; -} -void FileOptions::clear_csharp_namespace() { - csharp_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_csharp_namespace(); -} -const ::std::string& FileOptions::csharp_namespace() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.csharp_namespace) - return csharp_namespace_.GetNoArena(); -} -void FileOptions::set_csharp_namespace(const ::std::string& value) { - set_has_csharp_namespace(); - csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.csharp_namespace) -} -#if LANG_CXX11 -void FileOptions::set_csharp_namespace(::std::string&& value) { - set_has_csharp_namespace(); - csharp_namespace_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.csharp_namespace) -} -#endif -void FileOptions::set_csharp_namespace(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_csharp_namespace(); - csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.csharp_namespace) -} -void FileOptions::set_csharp_namespace(const char* value, size_t size) { - set_has_csharp_namespace(); - csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.csharp_namespace) -} -::std::string* FileOptions::mutable_csharp_namespace() { - set_has_csharp_namespace(); - // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.csharp_namespace) - return csharp_namespace_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* FileOptions::release_csharp_namespace() { - // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.csharp_namespace) - clear_has_csharp_namespace(); - return csharp_namespace_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void FileOptions::set_allocated_csharp_namespace(::std::string* csharp_namespace) { - if (csharp_namespace != NULL) { - set_has_csharp_namespace(); - } else { - clear_has_csharp_namespace(); - } - csharp_namespace_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), csharp_namespace); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace) -} - -// optional string swift_prefix = 39; -bool FileOptions::has_swift_prefix() const { - return (_has_bits_[0] & 0x00000020u) != 0; -} -void FileOptions::set_has_swift_prefix() { - _has_bits_[0] |= 0x00000020u; -} -void FileOptions::clear_has_swift_prefix() { - _has_bits_[0] &= ~0x00000020u; -} -void FileOptions::clear_swift_prefix() { - swift_prefix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_swift_prefix(); -} -const ::std::string& FileOptions::swift_prefix() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.swift_prefix) - return swift_prefix_.GetNoArena(); -} -void FileOptions::set_swift_prefix(const ::std::string& value) { - set_has_swift_prefix(); - swift_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.swift_prefix) -} -#if LANG_CXX11 -void FileOptions::set_swift_prefix(::std::string&& value) { - set_has_swift_prefix(); - swift_prefix_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.swift_prefix) -} -#endif -void FileOptions::set_swift_prefix(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_swift_prefix(); - swift_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.swift_prefix) -} -void FileOptions::set_swift_prefix(const char* value, size_t size) { - set_has_swift_prefix(); - swift_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.swift_prefix) -} -::std::string* FileOptions::mutable_swift_prefix() { - set_has_swift_prefix(); - // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.swift_prefix) - return swift_prefix_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* FileOptions::release_swift_prefix() { - // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.swift_prefix) - clear_has_swift_prefix(); - return swift_prefix_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void FileOptions::set_allocated_swift_prefix(::std::string* swift_prefix) { - if (swift_prefix != NULL) { - set_has_swift_prefix(); - } else { - clear_has_swift_prefix(); - } - swift_prefix_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), swift_prefix); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.swift_prefix) -} - -// optional string php_class_prefix = 40; -bool FileOptions::has_php_class_prefix() const { - return (_has_bits_[0] & 0x00000040u) != 0; -} -void FileOptions::set_has_php_class_prefix() { - _has_bits_[0] |= 0x00000040u; -} -void FileOptions::clear_has_php_class_prefix() { - _has_bits_[0] &= ~0x00000040u; -} -void FileOptions::clear_php_class_prefix() { - php_class_prefix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_php_class_prefix(); -} -const ::std::string& FileOptions::php_class_prefix() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_class_prefix) - return php_class_prefix_.GetNoArena(); -} -void FileOptions::set_php_class_prefix(const ::std::string& value) { - set_has_php_class_prefix(); - php_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_class_prefix) -} -#if LANG_CXX11 -void FileOptions::set_php_class_prefix(::std::string&& value) { - set_has_php_class_prefix(); - php_class_prefix_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.php_class_prefix) -} -#endif -void FileOptions::set_php_class_prefix(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_php_class_prefix(); - php_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.php_class_prefix) -} -void FileOptions::set_php_class_prefix(const char* value, size_t size) { - set_has_php_class_prefix(); - php_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.php_class_prefix) -} -::std::string* FileOptions::mutable_php_class_prefix() { - set_has_php_class_prefix(); - // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_class_prefix) - return php_class_prefix_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* FileOptions::release_php_class_prefix() { - // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_class_prefix) - clear_has_php_class_prefix(); - return php_class_prefix_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void FileOptions::set_allocated_php_class_prefix(::std::string* php_class_prefix) { - if (php_class_prefix != NULL) { - set_has_php_class_prefix(); - } else { - clear_has_php_class_prefix(); - } - php_class_prefix_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), php_class_prefix); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_class_prefix) -} - -// optional string php_namespace = 41; -bool FileOptions::has_php_namespace() const { - return (_has_bits_[0] & 0x00000080u) != 0; -} -void FileOptions::set_has_php_namespace() { - _has_bits_[0] |= 0x00000080u; -} -void FileOptions::clear_has_php_namespace() { - _has_bits_[0] &= ~0x00000080u; -} -void FileOptions::clear_php_namespace() { - php_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_php_namespace(); -} -const ::std::string& FileOptions::php_namespace() const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_namespace) - return php_namespace_.GetNoArena(); -} -void FileOptions::set_php_namespace(const ::std::string& value) { - set_has_php_namespace(); - php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_namespace) -} -#if LANG_CXX11 -void FileOptions::set_php_namespace(::std::string&& value) { - set_has_php_namespace(); - php_namespace_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.php_namespace) -} -#endif -void FileOptions::set_php_namespace(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_php_namespace(); - php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.php_namespace) -} -void FileOptions::set_php_namespace(const char* value, size_t size) { - set_has_php_namespace(); - php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.php_namespace) -} -::std::string* FileOptions::mutable_php_namespace() { - set_has_php_namespace(); - // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_namespace) - return php_namespace_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* FileOptions::release_php_namespace() { - // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_namespace) - clear_has_php_namespace(); - return php_namespace_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void FileOptions::set_allocated_php_namespace(::std::string* php_namespace) { - if (php_namespace != NULL) { - set_has_php_namespace(); - } else { - clear_has_php_namespace(); - } - php_namespace_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), php_namespace); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_namespace) -} - -// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; -int FileOptions::uninterpreted_option_size() const { - return uninterpreted_option_.size(); -} -void FileOptions::clear_uninterpreted_option() { - uninterpreted_option_.Clear(); -} -const ::google::protobuf::UninterpretedOption& FileOptions::uninterpreted_option(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.uninterpreted_option) - return uninterpreted_option_.Get(index); -} -::google::protobuf::UninterpretedOption* FileOptions::mutable_uninterpreted_option(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.uninterpreted_option) - return uninterpreted_option_.Mutable(index); -} -::google::protobuf::UninterpretedOption* FileOptions::add_uninterpreted_option() { - // @@protoc_insertion_point(field_add:google.protobuf.FileOptions.uninterpreted_option) - return uninterpreted_option_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* -FileOptions::mutable_uninterpreted_option() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileOptions.uninterpreted_option) - return &uninterpreted_option_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& -FileOptions::uninterpreted_option() const { - // @@protoc_insertion_point(field_list:google.protobuf.FileOptions.uninterpreted_option) - return uninterpreted_option_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void MessageOptions::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int MessageOptions::kMessageSetWireFormatFieldNumber; const int MessageOptions::kNoStandardDescriptorAccessorFieldNumber; @@ -10724,11 +8986,21 @@ const int MessageOptions::kUninterpretedOptionFieldNumber; MessageOptions::MessageOptions() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsMessageOptions(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.MessageOptions) } +MessageOptions::MessageOptions(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _extensions_(arena), + _internal_metadata_(arena), + uninterpreted_option_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsMessageOptions(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.MessageOptions) +} MessageOptions::MessageOptions(const MessageOptions& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -10756,29 +9028,32 @@ MessageOptions::~MessageOptions() { } void MessageOptions::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } +void MessageOptions::ArenaDtor(void* object) { + MessageOptions* _this = reinterpret_cast< MessageOptions* >(object); + (void)_this; +} +void MessageOptions::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void MessageOptions::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* MessageOptions::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const MessageOptions& MessageOptions::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsMessageOptions(); return *internal_default_instance(); } MessageOptions* MessageOptions::New(::google::protobuf::Arena* arena) const { - MessageOptions* n = new MessageOptions; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<MessageOptions>(arena); } void MessageOptions::Clear() { @@ -10789,12 +9064,9 @@ void MessageOptions::Clear() { _extensions_.Clear(); uninterpreted_option_.Clear(); - cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 15u) { - ::memset(&message_set_wire_format_, 0, static_cast<size_t>( - reinterpret_cast<char*>(&map_entry_) - - reinterpret_cast<char*>(&message_set_wire_format_)) + sizeof(map_entry_)); - } + ::memset(&message_set_wire_format_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&map_entry_) - + reinterpret_cast<char*>(&message_set_wire_format_)) + sizeof(map_entry_)); _has_bits_.Clear(); _internal_metadata_.Clear(); } @@ -10869,8 +9141,7 @@ bool MessageOptions::MergePartialFromCodedStream( case 999: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_uninterpreted_option())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_uninterpreted_option())); } else { goto handle_unusual; } @@ -10980,7 +9251,7 @@ void MessageOptions::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 999, this->uninterpreted_option(static_cast<int>(i)), deterministic, target); } @@ -11013,7 +9284,7 @@ size_t MessageOptions::ByteSizeLong() const { total_size += 2UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->uninterpreted_option(static_cast<int>(i))); } } @@ -11114,6 +9385,21 @@ bool MessageOptions::IsInitialized() const { void MessageOptions::Swap(MessageOptions* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + MessageOptions* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void MessageOptions::UnsafeArenaSwap(MessageOptions* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void MessageOptions::InternalSwap(MessageOptions* other) { @@ -11131,142 +9417,14 @@ void MessageOptions::InternalSwap(MessageOptions* other) { ::google::protobuf::Metadata MessageOptions::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// MessageOptions - -// optional bool message_set_wire_format = 1 [default = false]; -bool MessageOptions::has_message_set_wire_format() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void MessageOptions::set_has_message_set_wire_format() { - _has_bits_[0] |= 0x00000001u; -} -void MessageOptions::clear_has_message_set_wire_format() { - _has_bits_[0] &= ~0x00000001u; -} -void MessageOptions::clear_message_set_wire_format() { - message_set_wire_format_ = false; - clear_has_message_set_wire_format(); -} -bool MessageOptions::message_set_wire_format() const { - // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.message_set_wire_format) - return message_set_wire_format_; -} -void MessageOptions::set_message_set_wire_format(bool value) { - set_has_message_set_wire_format(); - message_set_wire_format_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.message_set_wire_format) -} - -// optional bool no_standard_descriptor_accessor = 2 [default = false]; -bool MessageOptions::has_no_standard_descriptor_accessor() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void MessageOptions::set_has_no_standard_descriptor_accessor() { - _has_bits_[0] |= 0x00000002u; -} -void MessageOptions::clear_has_no_standard_descriptor_accessor() { - _has_bits_[0] &= ~0x00000002u; -} -void MessageOptions::clear_no_standard_descriptor_accessor() { - no_standard_descriptor_accessor_ = false; - clear_has_no_standard_descriptor_accessor(); -} -bool MessageOptions::no_standard_descriptor_accessor() const { - // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.no_standard_descriptor_accessor) - return no_standard_descriptor_accessor_; -} -void MessageOptions::set_no_standard_descriptor_accessor(bool value) { - set_has_no_standard_descriptor_accessor(); - no_standard_descriptor_accessor_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.no_standard_descriptor_accessor) -} - -// optional bool deprecated = 3 [default = false]; -bool MessageOptions::has_deprecated() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void MessageOptions::set_has_deprecated() { - _has_bits_[0] |= 0x00000004u; -} -void MessageOptions::clear_has_deprecated() { - _has_bits_[0] &= ~0x00000004u; -} -void MessageOptions::clear_deprecated() { - deprecated_ = false; - clear_has_deprecated(); -} -bool MessageOptions::deprecated() const { - // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.deprecated) - return deprecated_; -} -void MessageOptions::set_deprecated(bool value) { - set_has_deprecated(); - deprecated_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.deprecated) -} - -// optional bool map_entry = 7; -bool MessageOptions::has_map_entry() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -void MessageOptions::set_has_map_entry() { - _has_bits_[0] |= 0x00000008u; -} -void MessageOptions::clear_has_map_entry() { - _has_bits_[0] &= ~0x00000008u; -} -void MessageOptions::clear_map_entry() { - map_entry_ = false; - clear_has_map_entry(); -} -bool MessageOptions::map_entry() const { - // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.map_entry) - return map_entry_; -} -void MessageOptions::set_map_entry(bool value) { - set_has_map_entry(); - map_entry_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.map_entry) + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; -int MessageOptions::uninterpreted_option_size() const { - return uninterpreted_option_.size(); -} -void MessageOptions::clear_uninterpreted_option() { - uninterpreted_option_.Clear(); -} -const ::google::protobuf::UninterpretedOption& MessageOptions::uninterpreted_option(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.uninterpreted_option) - return uninterpreted_option_.Get(index); -} -::google::protobuf::UninterpretedOption* MessageOptions::mutable_uninterpreted_option(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.MessageOptions.uninterpreted_option) - return uninterpreted_option_.Mutable(index); -} -::google::protobuf::UninterpretedOption* MessageOptions::add_uninterpreted_option() { - // @@protoc_insertion_point(field_add:google.protobuf.MessageOptions.uninterpreted_option) - return uninterpreted_option_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* -MessageOptions::mutable_uninterpreted_option() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.MessageOptions.uninterpreted_option) - return &uninterpreted_option_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& -MessageOptions::uninterpreted_option() const { - // @@protoc_insertion_point(field_list:google.protobuf.MessageOptions.uninterpreted_option) - return uninterpreted_option_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void FieldOptions::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int FieldOptions::kCtypeFieldNumber; const int FieldOptions::kPackedFieldNumber; @@ -11280,11 +9438,21 @@ const int FieldOptions::kUninterpretedOptionFieldNumber; FieldOptions::FieldOptions() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFieldOptions(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.FieldOptions) } +FieldOptions::FieldOptions(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _extensions_(arena), + _internal_metadata_(arena), + uninterpreted_option_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFieldOptions(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.FieldOptions) +} FieldOptions::FieldOptions(const FieldOptions& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -11312,29 +9480,32 @@ FieldOptions::~FieldOptions() { } void FieldOptions::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } +void FieldOptions::ArenaDtor(void* object) { + FieldOptions* _this = reinterpret_cast< FieldOptions* >(object); + (void)_this; +} +void FieldOptions::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void FieldOptions::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* FieldOptions::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const FieldOptions& FieldOptions::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFieldOptions(); return *internal_default_instance(); } FieldOptions* FieldOptions::New(::google::protobuf::Arena* arena) const { - FieldOptions* n = new FieldOptions; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<FieldOptions>(arena); } void FieldOptions::Clear() { @@ -11465,8 +9636,7 @@ bool FieldOptions::MergePartialFromCodedStream( case 999: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_uninterpreted_option())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_uninterpreted_option())); } else { goto handle_unusual; } @@ -11600,7 +9770,7 @@ void FieldOptions::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 999, this->uninterpreted_option(static_cast<int>(i)), deterministic, target); } @@ -11633,7 +9803,7 @@ size_t FieldOptions::ByteSizeLong() const { total_size += 2UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->uninterpreted_option(static_cast<int>(i))); } } @@ -11752,6 +9922,21 @@ bool FieldOptions::IsInitialized() const { void FieldOptions::Swap(FieldOptions* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + FieldOptions* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void FieldOptions::UnsafeArenaSwap(FieldOptions* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void FieldOptions::InternalSwap(FieldOptions* other) { @@ -11771,192 +9956,14 @@ void FieldOptions::InternalSwap(FieldOptions* other) { ::google::protobuf::Metadata FieldOptions::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// FieldOptions - -// optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; -bool FieldOptions::has_ctype() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void FieldOptions::set_has_ctype() { - _has_bits_[0] |= 0x00000001u; -} -void FieldOptions::clear_has_ctype() { - _has_bits_[0] &= ~0x00000001u; -} -void FieldOptions::clear_ctype() { - ctype_ = 0; - clear_has_ctype(); -} -::google::protobuf::FieldOptions_CType FieldOptions::ctype() const { - // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.ctype) - return static_cast< ::google::protobuf::FieldOptions_CType >(ctype_); -} -void FieldOptions::set_ctype(::google::protobuf::FieldOptions_CType value) { - assert(::google::protobuf::FieldOptions_CType_IsValid(value)); - set_has_ctype(); - ctype_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.ctype) -} - -// optional bool packed = 2; -bool FieldOptions::has_packed() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void FieldOptions::set_has_packed() { - _has_bits_[0] |= 0x00000002u; -} -void FieldOptions::clear_has_packed() { - _has_bits_[0] &= ~0x00000002u; -} -void FieldOptions::clear_packed() { - packed_ = false; - clear_has_packed(); -} -bool FieldOptions::packed() const { - // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.packed) - return packed_; -} -void FieldOptions::set_packed(bool value) { - set_has_packed(); - packed_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.packed) -} - -// optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; -bool FieldOptions::has_jstype() const { - return (_has_bits_[0] & 0x00000020u) != 0; -} -void FieldOptions::set_has_jstype() { - _has_bits_[0] |= 0x00000020u; -} -void FieldOptions::clear_has_jstype() { - _has_bits_[0] &= ~0x00000020u; -} -void FieldOptions::clear_jstype() { - jstype_ = 0; - clear_has_jstype(); -} -::google::protobuf::FieldOptions_JSType FieldOptions::jstype() const { - // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.jstype) - return static_cast< ::google::protobuf::FieldOptions_JSType >(jstype_); -} -void FieldOptions::set_jstype(::google::protobuf::FieldOptions_JSType value) { - assert(::google::protobuf::FieldOptions_JSType_IsValid(value)); - set_has_jstype(); - jstype_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.jstype) -} - -// optional bool lazy = 5 [default = false]; -bool FieldOptions::has_lazy() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void FieldOptions::set_has_lazy() { - _has_bits_[0] |= 0x00000004u; -} -void FieldOptions::clear_has_lazy() { - _has_bits_[0] &= ~0x00000004u; -} -void FieldOptions::clear_lazy() { - lazy_ = false; - clear_has_lazy(); -} -bool FieldOptions::lazy() const { - // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.lazy) - return lazy_; -} -void FieldOptions::set_lazy(bool value) { - set_has_lazy(); - lazy_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.lazy) + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -// optional bool deprecated = 3 [default = false]; -bool FieldOptions::has_deprecated() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -void FieldOptions::set_has_deprecated() { - _has_bits_[0] |= 0x00000008u; -} -void FieldOptions::clear_has_deprecated() { - _has_bits_[0] &= ~0x00000008u; -} -void FieldOptions::clear_deprecated() { - deprecated_ = false; - clear_has_deprecated(); -} -bool FieldOptions::deprecated() const { - // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.deprecated) - return deprecated_; -} -void FieldOptions::set_deprecated(bool value) { - set_has_deprecated(); - deprecated_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.deprecated) -} - -// optional bool weak = 10 [default = false]; -bool FieldOptions::has_weak() const { - return (_has_bits_[0] & 0x00000010u) != 0; -} -void FieldOptions::set_has_weak() { - _has_bits_[0] |= 0x00000010u; -} -void FieldOptions::clear_has_weak() { - _has_bits_[0] &= ~0x00000010u; -} -void FieldOptions::clear_weak() { - weak_ = false; - clear_has_weak(); -} -bool FieldOptions::weak() const { - // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.weak) - return weak_; -} -void FieldOptions::set_weak(bool value) { - set_has_weak(); - weak_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.weak) -} - -// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; -int FieldOptions::uninterpreted_option_size() const { - return uninterpreted_option_.size(); -} -void FieldOptions::clear_uninterpreted_option() { - uninterpreted_option_.Clear(); -} -const ::google::protobuf::UninterpretedOption& FieldOptions::uninterpreted_option(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.uninterpreted_option) - return uninterpreted_option_.Get(index); -} -::google::protobuf::UninterpretedOption* FieldOptions::mutable_uninterpreted_option(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.FieldOptions.uninterpreted_option) - return uninterpreted_option_.Mutable(index); -} -::google::protobuf::UninterpretedOption* FieldOptions::add_uninterpreted_option() { - // @@protoc_insertion_point(field_add:google.protobuf.FieldOptions.uninterpreted_option) - return uninterpreted_option_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* -FieldOptions::mutable_uninterpreted_option() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.FieldOptions.uninterpreted_option) - return &uninterpreted_option_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& -FieldOptions::uninterpreted_option() const { - // @@protoc_insertion_point(field_list:google.protobuf.FieldOptions.uninterpreted_option) - return uninterpreted_option_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void OneofOptions::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int OneofOptions::kUninterpretedOptionFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -11964,11 +9971,21 @@ const int OneofOptions::kUninterpretedOptionFieldNumber; OneofOptions::OneofOptions() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsOneofOptions(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.OneofOptions) } +OneofOptions::OneofOptions(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _extensions_(arena), + _internal_metadata_(arena), + uninterpreted_option_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsOneofOptions(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.OneofOptions) +} OneofOptions::OneofOptions(const OneofOptions& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -11990,29 +10007,32 @@ OneofOptions::~OneofOptions() { } void OneofOptions::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } +void OneofOptions::ArenaDtor(void* object) { + OneofOptions* _this = reinterpret_cast< OneofOptions* >(object); + (void)_this; +} +void OneofOptions::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void OneofOptions::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* OneofOptions::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const OneofOptions& OneofOptions::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsOneofOptions(); return *internal_default_instance(); } OneofOptions* OneofOptions::New(::google::protobuf::Arena* arena) const { - OneofOptions* n = new OneofOptions; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<OneofOptions>(arena); } void OneofOptions::Clear() { @@ -12041,8 +10061,7 @@ bool OneofOptions::MergePartialFromCodedStream( case 999: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_uninterpreted_option())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_uninterpreted_option())); } else { goto handle_unusual; } @@ -12110,7 +10129,7 @@ void OneofOptions::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 999, this->uninterpreted_option(static_cast<int>(i)), deterministic, target); } @@ -12143,7 +10162,7 @@ size_t OneofOptions::ByteSizeLong() const { total_size += 2UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->uninterpreted_option(static_cast<int>(i))); } } @@ -12206,6 +10225,21 @@ bool OneofOptions::IsInitialized() const { void OneofOptions::Swap(OneofOptions* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + OneofOptions* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void OneofOptions::UnsafeArenaSwap(OneofOptions* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void OneofOptions::InternalSwap(OneofOptions* other) { @@ -12219,46 +10253,14 @@ void OneofOptions::InternalSwap(OneofOptions* other) { ::google::protobuf::Metadata OneofOptions::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// OneofOptions - -// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; -int OneofOptions::uninterpreted_option_size() const { - return uninterpreted_option_.size(); -} -void OneofOptions::clear_uninterpreted_option() { - uninterpreted_option_.Clear(); -} -const ::google::protobuf::UninterpretedOption& OneofOptions::uninterpreted_option(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.OneofOptions.uninterpreted_option) - return uninterpreted_option_.Get(index); -} -::google::protobuf::UninterpretedOption* OneofOptions::mutable_uninterpreted_option(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.OneofOptions.uninterpreted_option) - return uninterpreted_option_.Mutable(index); -} -::google::protobuf::UninterpretedOption* OneofOptions::add_uninterpreted_option() { - // @@protoc_insertion_point(field_add:google.protobuf.OneofOptions.uninterpreted_option) - return uninterpreted_option_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* -OneofOptions::mutable_uninterpreted_option() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.OneofOptions.uninterpreted_option) - return &uninterpreted_option_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& -OneofOptions::uninterpreted_option() const { - // @@protoc_insertion_point(field_list:google.protobuf.OneofOptions.uninterpreted_option) - return uninterpreted_option_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void EnumOptions::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int EnumOptions::kAllowAliasFieldNumber; const int EnumOptions::kDeprecatedFieldNumber; @@ -12268,11 +10270,21 @@ const int EnumOptions::kUninterpretedOptionFieldNumber; EnumOptions::EnumOptions() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumOptions(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.EnumOptions) } +EnumOptions::EnumOptions(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _extensions_(arena), + _internal_metadata_(arena), + uninterpreted_option_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumOptions(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.EnumOptions) +} EnumOptions::EnumOptions(const EnumOptions& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -12300,29 +10312,32 @@ EnumOptions::~EnumOptions() { } void EnumOptions::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } +void EnumOptions::ArenaDtor(void* object) { + EnumOptions* _this = reinterpret_cast< EnumOptions* >(object); + (void)_this; +} +void EnumOptions::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void EnumOptions::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* EnumOptions::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const EnumOptions& EnumOptions::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumOptions(); return *internal_default_instance(); } EnumOptions* EnumOptions::New(::google::protobuf::Arena* arena) const { - EnumOptions* n = new EnumOptions; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<EnumOptions>(arena); } void EnumOptions::Clear() { @@ -12333,12 +10348,9 @@ void EnumOptions::Clear() { _extensions_.Clear(); uninterpreted_option_.Clear(); - cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 3u) { - ::memset(&allow_alias_, 0, static_cast<size_t>( - reinterpret_cast<char*>(&deprecated_) - - reinterpret_cast<char*>(&allow_alias_)) + sizeof(deprecated_)); - } + ::memset(&allow_alias_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&deprecated_) - + reinterpret_cast<char*>(&allow_alias_)) + sizeof(deprecated_)); _has_bits_.Clear(); _internal_metadata_.Clear(); } @@ -12385,8 +10397,7 @@ bool EnumOptions::MergePartialFromCodedStream( case 999: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_uninterpreted_option())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_uninterpreted_option())); } else { goto handle_unusual; } @@ -12476,7 +10487,7 @@ void EnumOptions::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 999, this->uninterpreted_option(static_cast<int>(i)), deterministic, target); } @@ -12509,7 +10520,7 @@ size_t EnumOptions::ByteSizeLong() const { total_size += 2UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->uninterpreted_option(static_cast<int>(i))); } } @@ -12594,6 +10605,21 @@ bool EnumOptions::IsInitialized() const { void EnumOptions::Swap(EnumOptions* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + EnumOptions* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void EnumOptions::UnsafeArenaSwap(EnumOptions* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void EnumOptions::InternalSwap(EnumOptions* other) { @@ -12609,94 +10635,14 @@ void EnumOptions::InternalSwap(EnumOptions* other) { ::google::protobuf::Metadata EnumOptions::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// EnumOptions - -// optional bool allow_alias = 2; -bool EnumOptions::has_allow_alias() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void EnumOptions::set_has_allow_alias() { - _has_bits_[0] |= 0x00000001u; -} -void EnumOptions::clear_has_allow_alias() { - _has_bits_[0] &= ~0x00000001u; -} -void EnumOptions::clear_allow_alias() { - allow_alias_ = false; - clear_has_allow_alias(); -} -bool EnumOptions::allow_alias() const { - // @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.allow_alias) - return allow_alias_; -} -void EnumOptions::set_allow_alias(bool value) { - set_has_allow_alias(); - allow_alias_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.EnumOptions.allow_alias) -} - -// optional bool deprecated = 3 [default = false]; -bool EnumOptions::has_deprecated() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void EnumOptions::set_has_deprecated() { - _has_bits_[0] |= 0x00000002u; -} -void EnumOptions::clear_has_deprecated() { - _has_bits_[0] &= ~0x00000002u; -} -void EnumOptions::clear_deprecated() { - deprecated_ = false; - clear_has_deprecated(); -} -bool EnumOptions::deprecated() const { - // @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.deprecated) - return deprecated_; -} -void EnumOptions::set_deprecated(bool value) { - set_has_deprecated(); - deprecated_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.EnumOptions.deprecated) + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; -int EnumOptions::uninterpreted_option_size() const { - return uninterpreted_option_.size(); -} -void EnumOptions::clear_uninterpreted_option() { - uninterpreted_option_.Clear(); -} -const ::google::protobuf::UninterpretedOption& EnumOptions::uninterpreted_option(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.uninterpreted_option) - return uninterpreted_option_.Get(index); -} -::google::protobuf::UninterpretedOption* EnumOptions::mutable_uninterpreted_option(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.EnumOptions.uninterpreted_option) - return uninterpreted_option_.Mutable(index); -} -::google::protobuf::UninterpretedOption* EnumOptions::add_uninterpreted_option() { - // @@protoc_insertion_point(field_add:google.protobuf.EnumOptions.uninterpreted_option) - return uninterpreted_option_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* -EnumOptions::mutable_uninterpreted_option() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumOptions.uninterpreted_option) - return &uninterpreted_option_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& -EnumOptions::uninterpreted_option() const { - // @@protoc_insertion_point(field_list:google.protobuf.EnumOptions.uninterpreted_option) - return uninterpreted_option_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void EnumValueOptions::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int EnumValueOptions::kDeprecatedFieldNumber; const int EnumValueOptions::kUninterpretedOptionFieldNumber; @@ -12705,11 +10651,21 @@ const int EnumValueOptions::kUninterpretedOptionFieldNumber; EnumValueOptions::EnumValueOptions() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumValueOptions(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.EnumValueOptions) } +EnumValueOptions::EnumValueOptions(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _extensions_(arena), + _internal_metadata_(arena), + uninterpreted_option_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumValueOptions(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.EnumValueOptions) +} EnumValueOptions::EnumValueOptions(const EnumValueOptions& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -12733,29 +10689,32 @@ EnumValueOptions::~EnumValueOptions() { } void EnumValueOptions::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } +void EnumValueOptions::ArenaDtor(void* object) { + EnumValueOptions* _this = reinterpret_cast< EnumValueOptions* >(object); + (void)_this; +} +void EnumValueOptions::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void EnumValueOptions::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* EnumValueOptions::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const EnumValueOptions& EnumValueOptions::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumValueOptions(); return *internal_default_instance(); } EnumValueOptions* EnumValueOptions::New(::google::protobuf::Arena* arena) const { - EnumValueOptions* n = new EnumValueOptions; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<EnumValueOptions>(arena); } void EnumValueOptions::Clear() { @@ -12799,8 +10758,7 @@ bool EnumValueOptions::MergePartialFromCodedStream( case 999: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_uninterpreted_option())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_uninterpreted_option())); } else { goto handle_unusual; } @@ -12880,7 +10838,7 @@ void EnumValueOptions::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 999, this->uninterpreted_option(static_cast<int>(i)), deterministic, target); } @@ -12913,7 +10871,7 @@ size_t EnumValueOptions::ByteSizeLong() const { total_size += 2UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->uninterpreted_option(static_cast<int>(i))); } } @@ -12984,6 +10942,21 @@ bool EnumValueOptions::IsInitialized() const { void EnumValueOptions::Swap(EnumValueOptions* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + EnumValueOptions* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void EnumValueOptions::UnsafeArenaSwap(EnumValueOptions* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void EnumValueOptions::InternalSwap(EnumValueOptions* other) { @@ -12998,70 +10971,14 @@ void EnumValueOptions::InternalSwap(EnumValueOptions* other) { ::google::protobuf::Metadata EnumValueOptions::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// EnumValueOptions - -// optional bool deprecated = 1 [default = false]; -bool EnumValueOptions::has_deprecated() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void EnumValueOptions::set_has_deprecated() { - _has_bits_[0] |= 0x00000001u; -} -void EnumValueOptions::clear_has_deprecated() { - _has_bits_[0] &= ~0x00000001u; -} -void EnumValueOptions::clear_deprecated() { - deprecated_ = false; - clear_has_deprecated(); -} -bool EnumValueOptions::deprecated() const { - // @@protoc_insertion_point(field_get:google.protobuf.EnumValueOptions.deprecated) - return deprecated_; -} -void EnumValueOptions::set_deprecated(bool value) { - set_has_deprecated(); - deprecated_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.EnumValueOptions.deprecated) + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; -int EnumValueOptions::uninterpreted_option_size() const { - return uninterpreted_option_.size(); -} -void EnumValueOptions::clear_uninterpreted_option() { - uninterpreted_option_.Clear(); -} -const ::google::protobuf::UninterpretedOption& EnumValueOptions::uninterpreted_option(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.EnumValueOptions.uninterpreted_option) - return uninterpreted_option_.Get(index); -} -::google::protobuf::UninterpretedOption* EnumValueOptions::mutable_uninterpreted_option(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueOptions.uninterpreted_option) - return uninterpreted_option_.Mutable(index); -} -::google::protobuf::UninterpretedOption* EnumValueOptions::add_uninterpreted_option() { - // @@protoc_insertion_point(field_add:google.protobuf.EnumValueOptions.uninterpreted_option) - return uninterpreted_option_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* -EnumValueOptions::mutable_uninterpreted_option() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumValueOptions.uninterpreted_option) - return &uninterpreted_option_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& -EnumValueOptions::uninterpreted_option() const { - // @@protoc_insertion_point(field_list:google.protobuf.EnumValueOptions.uninterpreted_option) - return uninterpreted_option_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void ServiceOptions::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int ServiceOptions::kDeprecatedFieldNumber; const int ServiceOptions::kUninterpretedOptionFieldNumber; @@ -13070,11 +10987,21 @@ const int ServiceOptions::kUninterpretedOptionFieldNumber; ServiceOptions::ServiceOptions() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsServiceOptions(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.ServiceOptions) } +ServiceOptions::ServiceOptions(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _extensions_(arena), + _internal_metadata_(arena), + uninterpreted_option_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsServiceOptions(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.ServiceOptions) +} ServiceOptions::ServiceOptions(const ServiceOptions& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -13098,29 +11025,32 @@ ServiceOptions::~ServiceOptions() { } void ServiceOptions::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } +void ServiceOptions::ArenaDtor(void* object) { + ServiceOptions* _this = reinterpret_cast< ServiceOptions* >(object); + (void)_this; +} +void ServiceOptions::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void ServiceOptions::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* ServiceOptions::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const ServiceOptions& ServiceOptions::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsServiceOptions(); return *internal_default_instance(); } ServiceOptions* ServiceOptions::New(::google::protobuf::Arena* arena) const { - ServiceOptions* n = new ServiceOptions; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<ServiceOptions>(arena); } void ServiceOptions::Clear() { @@ -13164,8 +11094,7 @@ bool ServiceOptions::MergePartialFromCodedStream( case 999: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_uninterpreted_option())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_uninterpreted_option())); } else { goto handle_unusual; } @@ -13245,7 +11174,7 @@ void ServiceOptions::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 999, this->uninterpreted_option(static_cast<int>(i)), deterministic, target); } @@ -13278,7 +11207,7 @@ size_t ServiceOptions::ByteSizeLong() const { total_size += 2UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->uninterpreted_option(static_cast<int>(i))); } } @@ -13349,6 +11278,21 @@ bool ServiceOptions::IsInitialized() const { void ServiceOptions::Swap(ServiceOptions* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + ServiceOptions* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void ServiceOptions::UnsafeArenaSwap(ServiceOptions* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void ServiceOptions::InternalSwap(ServiceOptions* other) { @@ -13363,70 +11307,14 @@ void ServiceOptions::InternalSwap(ServiceOptions* other) { ::google::protobuf::Metadata ServiceOptions::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// ServiceOptions - -// optional bool deprecated = 33 [default = false]; -bool ServiceOptions::has_deprecated() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void ServiceOptions::set_has_deprecated() { - _has_bits_[0] |= 0x00000001u; -} -void ServiceOptions::clear_has_deprecated() { - _has_bits_[0] &= ~0x00000001u; -} -void ServiceOptions::clear_deprecated() { - deprecated_ = false; - clear_has_deprecated(); -} -bool ServiceOptions::deprecated() const { - // @@protoc_insertion_point(field_get:google.protobuf.ServiceOptions.deprecated) - return deprecated_; -} -void ServiceOptions::set_deprecated(bool value) { - set_has_deprecated(); - deprecated_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.ServiceOptions.deprecated) -} - -// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; -int ServiceOptions::uninterpreted_option_size() const { - return uninterpreted_option_.size(); -} -void ServiceOptions::clear_uninterpreted_option() { - uninterpreted_option_.Clear(); -} -const ::google::protobuf::UninterpretedOption& ServiceOptions::uninterpreted_option(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.ServiceOptions.uninterpreted_option) - return uninterpreted_option_.Get(index); -} -::google::protobuf::UninterpretedOption* ServiceOptions::mutable_uninterpreted_option(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceOptions.uninterpreted_option) - return uninterpreted_option_.Mutable(index); -} -::google::protobuf::UninterpretedOption* ServiceOptions::add_uninterpreted_option() { - // @@protoc_insertion_point(field_add:google.protobuf.ServiceOptions.uninterpreted_option) - return uninterpreted_option_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* -ServiceOptions::mutable_uninterpreted_option() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.ServiceOptions.uninterpreted_option) - return &uninterpreted_option_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& -ServiceOptions::uninterpreted_option() const { - // @@protoc_insertion_point(field_list:google.protobuf.ServiceOptions.uninterpreted_option) - return uninterpreted_option_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void MethodOptions::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int MethodOptions::kDeprecatedFieldNumber; const int MethodOptions::kIdempotencyLevelFieldNumber; @@ -13436,11 +11324,21 @@ const int MethodOptions::kUninterpretedOptionFieldNumber; MethodOptions::MethodOptions() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsMethodOptions(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.MethodOptions) } +MethodOptions::MethodOptions(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _extensions_(arena), + _internal_metadata_(arena), + uninterpreted_option_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsMethodOptions(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.MethodOptions) +} MethodOptions::MethodOptions(const MethodOptions& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -13468,29 +11366,32 @@ MethodOptions::~MethodOptions() { } void MethodOptions::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } +void MethodOptions::ArenaDtor(void* object) { + MethodOptions* _this = reinterpret_cast< MethodOptions* >(object); + (void)_this; +} +void MethodOptions::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void MethodOptions::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* MethodOptions::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const MethodOptions& MethodOptions::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsMethodOptions(); return *internal_default_instance(); } MethodOptions* MethodOptions::New(::google::protobuf::Arena* arena) const { - MethodOptions* n = new MethodOptions; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<MethodOptions>(arena); } void MethodOptions::Clear() { @@ -13559,8 +11460,7 @@ bool MethodOptions::MergePartialFromCodedStream( case 999: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_uninterpreted_option())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_uninterpreted_option())); } else { goto handle_unusual; } @@ -13652,7 +11552,7 @@ void MethodOptions::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 999, this->uninterpreted_option(static_cast<int>(i)), deterministic, target); } @@ -13685,7 +11585,7 @@ size_t MethodOptions::ByteSizeLong() const { total_size += 2UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->uninterpreted_option(static_cast<int>(i))); } } @@ -13771,6 +11671,21 @@ bool MethodOptions::IsInitialized() const { void MethodOptions::Swap(MethodOptions* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + MethodOptions* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void MethodOptions::UnsafeArenaSwap(MethodOptions* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void MethodOptions::InternalSwap(MethodOptions* other) { @@ -13786,95 +11701,14 @@ void MethodOptions::InternalSwap(MethodOptions* other) { ::google::protobuf::Metadata MethodOptions::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// MethodOptions - -// optional bool deprecated = 33 [default = false]; -bool MethodOptions::has_deprecated() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void MethodOptions::set_has_deprecated() { - _has_bits_[0] |= 0x00000001u; -} -void MethodOptions::clear_has_deprecated() { - _has_bits_[0] &= ~0x00000001u; -} -void MethodOptions::clear_deprecated() { - deprecated_ = false; - clear_has_deprecated(); -} -bool MethodOptions::deprecated() const { - // @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.deprecated) - return deprecated_; -} -void MethodOptions::set_deprecated(bool value) { - set_has_deprecated(); - deprecated_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.MethodOptions.deprecated) -} - -// optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; -bool MethodOptions::has_idempotency_level() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void MethodOptions::set_has_idempotency_level() { - _has_bits_[0] |= 0x00000002u; -} -void MethodOptions::clear_has_idempotency_level() { - _has_bits_[0] &= ~0x00000002u; -} -void MethodOptions::clear_idempotency_level() { - idempotency_level_ = 0; - clear_has_idempotency_level(); -} -::google::protobuf::MethodOptions_IdempotencyLevel MethodOptions::idempotency_level() const { - // @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.idempotency_level) - return static_cast< ::google::protobuf::MethodOptions_IdempotencyLevel >(idempotency_level_); -} -void MethodOptions::set_idempotency_level(::google::protobuf::MethodOptions_IdempotencyLevel value) { - assert(::google::protobuf::MethodOptions_IdempotencyLevel_IsValid(value)); - set_has_idempotency_level(); - idempotency_level_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.MethodOptions.idempotency_level) -} - -// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; -int MethodOptions::uninterpreted_option_size() const { - return uninterpreted_option_.size(); -} -void MethodOptions::clear_uninterpreted_option() { - uninterpreted_option_.Clear(); -} -const ::google::protobuf::UninterpretedOption& MethodOptions::uninterpreted_option(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.uninterpreted_option) - return uninterpreted_option_.Get(index); -} -::google::protobuf::UninterpretedOption* MethodOptions::mutable_uninterpreted_option(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.MethodOptions.uninterpreted_option) - return uninterpreted_option_.Mutable(index); -} -::google::protobuf::UninterpretedOption* MethodOptions::add_uninterpreted_option() { - // @@protoc_insertion_point(field_add:google.protobuf.MethodOptions.uninterpreted_option) - return uninterpreted_option_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >* -MethodOptions::mutable_uninterpreted_option() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.MethodOptions.uninterpreted_option) - return &uninterpreted_option_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >& -MethodOptions::uninterpreted_option() const { - // @@protoc_insertion_point(field_list:google.protobuf.MethodOptions.uninterpreted_option) - return uninterpreted_option_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void UninterpretedOption_NamePart::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int UninterpretedOption_NamePart::kNamePartFieldNumber; const int UninterpretedOption_NamePart::kIsExtensionFieldNumber; @@ -13883,11 +11717,19 @@ const int UninterpretedOption_NamePart::kIsExtensionFieldNumber; UninterpretedOption_NamePart::UninterpretedOption_NamePart() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsUninterpretedOption_NamePart(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.UninterpretedOption.NamePart) } +UninterpretedOption_NamePart::UninterpretedOption_NamePart(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _internal_metadata_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsUninterpretedOption_NamePart(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.UninterpretedOption.NamePart) +} UninterpretedOption_NamePart::UninterpretedOption_NamePart(const UninterpretedOption_NamePart& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -13896,7 +11738,8 @@ UninterpretedOption_NamePart::UninterpretedOption_NamePart(const UninterpretedOp _internal_metadata_.MergeFrom(from._internal_metadata_); name_part_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_name_part()) { - name_part_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_part_); + name_part_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_part(), + GetArenaNoVirtual()); } is_extension_ = from.is_extension_; // @@protoc_insertion_point(copy_constructor:google.protobuf.UninterpretedOption.NamePart) @@ -13914,30 +11757,33 @@ UninterpretedOption_NamePart::~UninterpretedOption_NamePart() { } void UninterpretedOption_NamePart::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); name_part_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } +void UninterpretedOption_NamePart::ArenaDtor(void* object) { + UninterpretedOption_NamePart* _this = reinterpret_cast< UninterpretedOption_NamePart* >(object); + (void)_this; +} +void UninterpretedOption_NamePart::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void UninterpretedOption_NamePart::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* UninterpretedOption_NamePart::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const UninterpretedOption_NamePart& UninterpretedOption_NamePart::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsUninterpretedOption_NamePart(); return *internal_default_instance(); } UninterpretedOption_NamePart* UninterpretedOption_NamePart::New(::google::protobuf::Arena* arena) const { - UninterpretedOption_NamePart* n = new UninterpretedOption_NamePart; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<UninterpretedOption_NamePart>(arena); } void UninterpretedOption_NamePart::Clear() { @@ -13946,9 +11792,10 @@ void UninterpretedOption_NamePart::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - if (has_name_part()) { + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(!name_part_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*name_part_.UnsafeRawStringPointer())->clear(); + name_part_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } is_extension_ = false; _has_bits_.Clear(); @@ -14147,8 +11994,7 @@ void UninterpretedOption_NamePart::MergeFrom(const UninterpretedOption_NamePart& cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 3u) { if (cached_has_bits & 0x00000001u) { - set_has_name_part(); - name_part_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_part_); + set_name_part(from.name_part()); } if (cached_has_bits & 0x00000002u) { is_extension_ = from.is_extension_; @@ -14178,6 +12024,21 @@ bool UninterpretedOption_NamePart::IsInitialized() const { void UninterpretedOption_NamePart::Swap(UninterpretedOption_NamePart* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + UninterpretedOption_NamePart* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void UninterpretedOption_NamePart::UnsafeArenaSwap(UninterpretedOption_NamePart* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void UninterpretedOption_NamePart::InternalSwap(UninterpretedOption_NamePart* other) { @@ -14191,103 +12052,14 @@ void UninterpretedOption_NamePart::InternalSwap(UninterpretedOption_NamePart* ot ::google::protobuf::Metadata UninterpretedOption_NamePart::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// UninterpretedOption_NamePart - -// required string name_part = 1; -bool UninterpretedOption_NamePart::has_name_part() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void UninterpretedOption_NamePart::set_has_name_part() { - _has_bits_[0] |= 0x00000001u; -} -void UninterpretedOption_NamePart::clear_has_name_part() { - _has_bits_[0] &= ~0x00000001u; -} -void UninterpretedOption_NamePart::clear_name_part() { - name_part_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_name_part(); -} -const ::std::string& UninterpretedOption_NamePart::name_part() const { - // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.NamePart.name_part) - return name_part_.GetNoArena(); -} -void UninterpretedOption_NamePart::set_name_part(const ::std::string& value) { - set_has_name_part(); - name_part_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.NamePart.name_part) -} -#if LANG_CXX11 -void UninterpretedOption_NamePart::set_name_part(::std::string&& value) { - set_has_name_part(); - name_part_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.NamePart.name_part) -} -#endif -void UninterpretedOption_NamePart::set_name_part(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_name_part(); - name_part_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.NamePart.name_part) -} -void UninterpretedOption_NamePart::set_name_part(const char* value, size_t size) { - set_has_name_part(); - name_part_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.NamePart.name_part) -} -::std::string* UninterpretedOption_NamePart::mutable_name_part() { - set_has_name_part(); - // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.NamePart.name_part) - return name_part_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* UninterpretedOption_NamePart::release_name_part() { - // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.NamePart.name_part) - clear_has_name_part(); - return name_part_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void UninterpretedOption_NamePart::set_allocated_name_part(::std::string* name_part) { - if (name_part != NULL) { - set_has_name_part(); - } else { - clear_has_name_part(); - } - name_part_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name_part); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.NamePart.name_part) -} - -// required bool is_extension = 2; -bool UninterpretedOption_NamePart::has_is_extension() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void UninterpretedOption_NamePart::set_has_is_extension() { - _has_bits_[0] |= 0x00000002u; -} -void UninterpretedOption_NamePart::clear_has_is_extension() { - _has_bits_[0] &= ~0x00000002u; -} -void UninterpretedOption_NamePart::clear_is_extension() { - is_extension_ = false; - clear_has_is_extension(); -} -bool UninterpretedOption_NamePart::is_extension() const { - // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.NamePart.is_extension) - return is_extension_; -} -void UninterpretedOption_NamePart::set_is_extension(bool value) { - set_has_is_extension(); - is_extension_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.NamePart.is_extension) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void UninterpretedOption::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int UninterpretedOption::kNameFieldNumber; const int UninterpretedOption::kIdentifierValueFieldNumber; @@ -14301,11 +12073,20 @@ const int UninterpretedOption::kAggregateValueFieldNumber; UninterpretedOption::UninterpretedOption() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsUninterpretedOption(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.UninterpretedOption) } +UninterpretedOption::UninterpretedOption(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _internal_metadata_(arena), + name_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsUninterpretedOption(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.UninterpretedOption) +} UninterpretedOption::UninterpretedOption(const UninterpretedOption& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -14315,15 +12096,18 @@ UninterpretedOption::UninterpretedOption(const UninterpretedOption& from) _internal_metadata_.MergeFrom(from._internal_metadata_); identifier_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_identifier_value()) { - identifier_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.identifier_value_); + identifier_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.identifier_value(), + GetArenaNoVirtual()); } string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_string_value()) { - string_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.string_value_); + string_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.string_value(), + GetArenaNoVirtual()); } aggregate_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_aggregate_value()) { - aggregate_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.aggregate_value_); + aggregate_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.aggregate_value(), + GetArenaNoVirtual()); } ::memcpy(&positive_int_value_, &from.positive_int_value_, static_cast<size_t>(reinterpret_cast<char*>(&double_value_) - @@ -14347,32 +12131,35 @@ UninterpretedOption::~UninterpretedOption() { } void UninterpretedOption::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); identifier_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); string_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); aggregate_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } +void UninterpretedOption::ArenaDtor(void* object) { + UninterpretedOption* _this = reinterpret_cast< UninterpretedOption* >(object); + (void)_this; +} +void UninterpretedOption::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void UninterpretedOption::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* UninterpretedOption::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const UninterpretedOption& UninterpretedOption::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsUninterpretedOption(); return *internal_default_instance(); } UninterpretedOption* UninterpretedOption::New(::google::protobuf::Arena* arena) const { - UninterpretedOption* n = new UninterpretedOption; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<UninterpretedOption>(arena); } void UninterpretedOption::Clear() { @@ -14386,15 +12173,15 @@ void UninterpretedOption::Clear() { if (cached_has_bits & 7u) { if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(!identifier_value_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*identifier_value_.UnsafeRawStringPointer())->clear(); + identifier_value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000002u) { GOOGLE_DCHECK(!string_value_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*string_value_.UnsafeRawStringPointer())->clear(); + string_value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000004u) { GOOGLE_DCHECK(!aggregate_value_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*aggregate_value_.UnsafeRawStringPointer())->clear(); + aggregate_value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } } if (cached_has_bits & 56u) { @@ -14420,8 +12207,7 @@ bool UninterpretedOption::MergePartialFromCodedStream( case 2: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_name())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_name())); } else { goto handle_unusual; } @@ -14607,7 +12393,7 @@ void UninterpretedOption::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->name_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 2, this->name(static_cast<int>(i)), deterministic, target); } @@ -14679,7 +12465,7 @@ size_t UninterpretedOption::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->name(static_cast<int>(i))); } } @@ -14759,16 +12545,13 @@ void UninterpretedOption::MergeFrom(const UninterpretedOption& from) { cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 63u) { if (cached_has_bits & 0x00000001u) { - set_has_identifier_value(); - identifier_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.identifier_value_); + set_identifier_value(from.identifier_value()); } if (cached_has_bits & 0x00000002u) { - set_has_string_value(); - string_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.string_value_); + set_string_value(from.string_value()); } if (cached_has_bits & 0x00000004u) { - set_has_aggregate_value(); - aggregate_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.aggregate_value_); + set_aggregate_value(from.aggregate_value()); } if (cached_has_bits & 0x00000008u) { positive_int_value_ = from.positive_int_value_; @@ -14804,6 +12587,21 @@ bool UninterpretedOption::IsInitialized() const { void UninterpretedOption::Swap(UninterpretedOption* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + UninterpretedOption* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void UninterpretedOption::UnsafeArenaSwap(UninterpretedOption* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void UninterpretedOption::InternalSwap(UninterpretedOption* other) { @@ -14822,307 +12620,14 @@ void UninterpretedOption::InternalSwap(UninterpretedOption* other) { ::google::protobuf::Metadata UninterpretedOption::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// UninterpretedOption - -// repeated .google.protobuf.UninterpretedOption.NamePart name = 2; -int UninterpretedOption::name_size() const { - return name_.size(); -} -void UninterpretedOption::clear_name() { - name_.Clear(); -} -const ::google::protobuf::UninterpretedOption_NamePart& UninterpretedOption::name(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.name) - return name_.Get(index); -} -::google::protobuf::UninterpretedOption_NamePart* UninterpretedOption::mutable_name(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.name) - return name_.Mutable(index); -} -::google::protobuf::UninterpretedOption_NamePart* UninterpretedOption::add_name() { - // @@protoc_insertion_point(field_add:google.protobuf.UninterpretedOption.name) - return name_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart >* -UninterpretedOption::mutable_name() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.UninterpretedOption.name) - return &name_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart >& -UninterpretedOption::name() const { - // @@protoc_insertion_point(field_list:google.protobuf.UninterpretedOption.name) - return name_; -} - -// optional string identifier_value = 3; -bool UninterpretedOption::has_identifier_value() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void UninterpretedOption::set_has_identifier_value() { - _has_bits_[0] |= 0x00000001u; -} -void UninterpretedOption::clear_has_identifier_value() { - _has_bits_[0] &= ~0x00000001u; -} -void UninterpretedOption::clear_identifier_value() { - identifier_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_identifier_value(); -} -const ::std::string& UninterpretedOption::identifier_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.identifier_value) - return identifier_value_.GetNoArena(); -} -void UninterpretedOption::set_identifier_value(const ::std::string& value) { - set_has_identifier_value(); - identifier_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.identifier_value) -} -#if LANG_CXX11 -void UninterpretedOption::set_identifier_value(::std::string&& value) { - set_has_identifier_value(); - identifier_value_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.identifier_value) -} -#endif -void UninterpretedOption::set_identifier_value(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_identifier_value(); - identifier_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.identifier_value) -} -void UninterpretedOption::set_identifier_value(const char* value, size_t size) { - set_has_identifier_value(); - identifier_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.identifier_value) -} -::std::string* UninterpretedOption::mutable_identifier_value() { - set_has_identifier_value(); - // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.identifier_value) - return identifier_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* UninterpretedOption::release_identifier_value() { - // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.identifier_value) - clear_has_identifier_value(); - return identifier_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void UninterpretedOption::set_allocated_identifier_value(::std::string* identifier_value) { - if (identifier_value != NULL) { - set_has_identifier_value(); - } else { - clear_has_identifier_value(); - } - identifier_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), identifier_value); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.identifier_value) -} - -// optional uint64 positive_int_value = 4; -bool UninterpretedOption::has_positive_int_value() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -void UninterpretedOption::set_has_positive_int_value() { - _has_bits_[0] |= 0x00000008u; -} -void UninterpretedOption::clear_has_positive_int_value() { - _has_bits_[0] &= ~0x00000008u; -} -void UninterpretedOption::clear_positive_int_value() { - positive_int_value_ = GOOGLE_ULONGLONG(0); - clear_has_positive_int_value(); -} -::google::protobuf::uint64 UninterpretedOption::positive_int_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.positive_int_value) - return positive_int_value_; -} -void UninterpretedOption::set_positive_int_value(::google::protobuf::uint64 value) { - set_has_positive_int_value(); - positive_int_value_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.positive_int_value) + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -// optional int64 negative_int_value = 5; -bool UninterpretedOption::has_negative_int_value() const { - return (_has_bits_[0] & 0x00000010u) != 0; -} -void UninterpretedOption::set_has_negative_int_value() { - _has_bits_[0] |= 0x00000010u; -} -void UninterpretedOption::clear_has_negative_int_value() { - _has_bits_[0] &= ~0x00000010u; -} -void UninterpretedOption::clear_negative_int_value() { - negative_int_value_ = GOOGLE_LONGLONG(0); - clear_has_negative_int_value(); -} -::google::protobuf::int64 UninterpretedOption::negative_int_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.negative_int_value) - return negative_int_value_; -} -void UninterpretedOption::set_negative_int_value(::google::protobuf::int64 value) { - set_has_negative_int_value(); - negative_int_value_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.negative_int_value) -} - -// optional double double_value = 6; -bool UninterpretedOption::has_double_value() const { - return (_has_bits_[0] & 0x00000020u) != 0; -} -void UninterpretedOption::set_has_double_value() { - _has_bits_[0] |= 0x00000020u; -} -void UninterpretedOption::clear_has_double_value() { - _has_bits_[0] &= ~0x00000020u; -} -void UninterpretedOption::clear_double_value() { - double_value_ = 0; - clear_has_double_value(); -} -double UninterpretedOption::double_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.double_value) - return double_value_; -} -void UninterpretedOption::set_double_value(double value) { - set_has_double_value(); - double_value_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.double_value) -} - -// optional bytes string_value = 7; -bool UninterpretedOption::has_string_value() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void UninterpretedOption::set_has_string_value() { - _has_bits_[0] |= 0x00000002u; -} -void UninterpretedOption::clear_has_string_value() { - _has_bits_[0] &= ~0x00000002u; -} -void UninterpretedOption::clear_string_value() { - string_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_string_value(); -} -const ::std::string& UninterpretedOption::string_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.string_value) - return string_value_.GetNoArena(); -} -void UninterpretedOption::set_string_value(const ::std::string& value) { - set_has_string_value(); - string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.string_value) -} -#if LANG_CXX11 -void UninterpretedOption::set_string_value(::std::string&& value) { - set_has_string_value(); - string_value_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.string_value) -} -#endif -void UninterpretedOption::set_string_value(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_string_value(); - string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.string_value) -} -void UninterpretedOption::set_string_value(const void* value, size_t size) { - set_has_string_value(); - string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.string_value) -} -::std::string* UninterpretedOption::mutable_string_value() { - set_has_string_value(); - // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.string_value) - return string_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* UninterpretedOption::release_string_value() { - // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.string_value) - clear_has_string_value(); - return string_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void UninterpretedOption::set_allocated_string_value(::std::string* string_value) { - if (string_value != NULL) { - set_has_string_value(); - } else { - clear_has_string_value(); - } - string_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), string_value); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.string_value) -} - -// optional string aggregate_value = 8; -bool UninterpretedOption::has_aggregate_value() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void UninterpretedOption::set_has_aggregate_value() { - _has_bits_[0] |= 0x00000004u; -} -void UninterpretedOption::clear_has_aggregate_value() { - _has_bits_[0] &= ~0x00000004u; -} -void UninterpretedOption::clear_aggregate_value() { - aggregate_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_aggregate_value(); -} -const ::std::string& UninterpretedOption::aggregate_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.aggregate_value) - return aggregate_value_.GetNoArena(); -} -void UninterpretedOption::set_aggregate_value(const ::std::string& value) { - set_has_aggregate_value(); - aggregate_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.aggregate_value) -} -#if LANG_CXX11 -void UninterpretedOption::set_aggregate_value(::std::string&& value) { - set_has_aggregate_value(); - aggregate_value_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.aggregate_value) -} -#endif -void UninterpretedOption::set_aggregate_value(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_aggregate_value(); - aggregate_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.aggregate_value) -} -void UninterpretedOption::set_aggregate_value(const char* value, size_t size) { - set_has_aggregate_value(); - aggregate_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.aggregate_value) -} -::std::string* UninterpretedOption::mutable_aggregate_value() { - set_has_aggregate_value(); - // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.aggregate_value) - return aggregate_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* UninterpretedOption::release_aggregate_value() { - // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.aggregate_value) - clear_has_aggregate_value(); - return aggregate_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void UninterpretedOption::set_allocated_aggregate_value(::std::string* aggregate_value) { - if (aggregate_value != NULL) { - set_has_aggregate_value(); - } else { - clear_has_aggregate_value(); - } - aggregate_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), aggregate_value); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.aggregate_value) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void SourceCodeInfo_Location::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int SourceCodeInfo_Location::kPathFieldNumber; const int SourceCodeInfo_Location::kSpanFieldNumber; @@ -15134,11 +12639,22 @@ const int SourceCodeInfo_Location::kLeadingDetachedCommentsFieldNumber; SourceCodeInfo_Location::SourceCodeInfo_Location() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsSourceCodeInfo_Location(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.SourceCodeInfo.Location) } +SourceCodeInfo_Location::SourceCodeInfo_Location(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _internal_metadata_(arena), + path_(arena), + span_(arena), + leading_detached_comments_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsSourceCodeInfo_Location(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.SourceCodeInfo.Location) +} SourceCodeInfo_Location::SourceCodeInfo_Location(const SourceCodeInfo_Location& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -15150,11 +12666,13 @@ SourceCodeInfo_Location::SourceCodeInfo_Location(const SourceCodeInfo_Location& _internal_metadata_.MergeFrom(from._internal_metadata_); leading_comments_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_leading_comments()) { - leading_comments_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.leading_comments_); + leading_comments_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.leading_comments(), + GetArenaNoVirtual()); } trailing_comments_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_trailing_comments()) { - trailing_comments_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.trailing_comments_); + trailing_comments_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.trailing_comments(), + GetArenaNoVirtual()); } // @@protoc_insertion_point(copy_constructor:google.protobuf.SourceCodeInfo.Location) } @@ -15171,31 +12689,34 @@ SourceCodeInfo_Location::~SourceCodeInfo_Location() { } void SourceCodeInfo_Location::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); leading_comments_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); trailing_comments_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } +void SourceCodeInfo_Location::ArenaDtor(void* object) { + SourceCodeInfo_Location* _this = reinterpret_cast< SourceCodeInfo_Location* >(object); + (void)_this; +} +void SourceCodeInfo_Location::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void SourceCodeInfo_Location::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* SourceCodeInfo_Location::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const SourceCodeInfo_Location& SourceCodeInfo_Location::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsSourceCodeInfo_Location(); return *internal_default_instance(); } SourceCodeInfo_Location* SourceCodeInfo_Location::New(::google::protobuf::Arena* arena) const { - SourceCodeInfo_Location* n = new SourceCodeInfo_Location; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<SourceCodeInfo_Location>(arena); } void SourceCodeInfo_Location::Clear() { @@ -15211,11 +12732,11 @@ void SourceCodeInfo_Location::Clear() { if (cached_has_bits & 3u) { if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(!leading_comments_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*leading_comments_.UnsafeRawStringPointer())->clear(); + leading_comments_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } if (cached_has_bits & 0x00000002u) { GOOGLE_DCHECK(!trailing_comments_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*trailing_comments_.UnsafeRawStringPointer())->clear(); + trailing_comments_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } } _has_bits_.Clear(); @@ -15419,7 +12940,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, target); target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( - static_cast< ::google::protobuf::uint32>( + static_cast< ::google::protobuf::int32>( _path_cached_byte_size_), target); target = ::google::protobuf::internal::WireFormatLite:: WriteInt32NoTagToArray(this->path_, target); @@ -15432,7 +12953,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, target); target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( - static_cast< ::google::protobuf::uint32>( + static_cast< ::google::protobuf::int32>( _span_cached_byte_size_), target); target = ::google::protobuf::internal::WireFormatLite:: WriteInt32NoTagToArray(this->span_, target); @@ -15579,12 +13100,10 @@ void SourceCodeInfo_Location::MergeFrom(const SourceCodeInfo_Location& from) { cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 3u) { if (cached_has_bits & 0x00000001u) { - set_has_leading_comments(); - leading_comments_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.leading_comments_); + set_leading_comments(from.leading_comments()); } if (cached_has_bits & 0x00000002u) { - set_has_trailing_comments(); - trailing_comments_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.trailing_comments_); + set_trailing_comments(from.trailing_comments()); } } } @@ -15609,6 +13128,21 @@ bool SourceCodeInfo_Location::IsInitialized() const { void SourceCodeInfo_Location::Swap(SourceCodeInfo_Location* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + SourceCodeInfo_Location* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void SourceCodeInfo_Location::UnsafeArenaSwap(SourceCodeInfo_Location* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void SourceCodeInfo_Location::InternalSwap(SourceCodeInfo_Location* other) { @@ -15625,271 +13159,14 @@ void SourceCodeInfo_Location::InternalSwap(SourceCodeInfo_Location* other) { ::google::protobuf::Metadata SourceCodeInfo_Location::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// SourceCodeInfo_Location - -// repeated int32 path = 1 [packed = true]; -int SourceCodeInfo_Location::path_size() const { - return path_.size(); -} -void SourceCodeInfo_Location::clear_path() { - path_.Clear(); -} -::google::protobuf::int32 SourceCodeInfo_Location::path(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.path) - return path_.Get(index); -} -void SourceCodeInfo_Location::set_path(int index, ::google::protobuf::int32 value) { - path_.Set(index, value); - // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.path) -} -void SourceCodeInfo_Location::add_path(::google::protobuf::int32 value) { - path_.Add(value); - // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.path) -} -const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& -SourceCodeInfo_Location::path() const { - // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.path) - return path_; -} -::google::protobuf::RepeatedField< ::google::protobuf::int32 >* -SourceCodeInfo_Location::mutable_path() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.path) - return &path_; -} - -// repeated int32 span = 2 [packed = true]; -int SourceCodeInfo_Location::span_size() const { - return span_.size(); -} -void SourceCodeInfo_Location::clear_span() { - span_.Clear(); -} -::google::protobuf::int32 SourceCodeInfo_Location::span(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.span) - return span_.Get(index); -} -void SourceCodeInfo_Location::set_span(int index, ::google::protobuf::int32 value) { - span_.Set(index, value); - // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.span) -} -void SourceCodeInfo_Location::add_span(::google::protobuf::int32 value) { - span_.Add(value); - // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.span) -} -const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& -SourceCodeInfo_Location::span() const { - // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.span) - return span_; -} -::google::protobuf::RepeatedField< ::google::protobuf::int32 >* -SourceCodeInfo_Location::mutable_span() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.span) - return &span_; -} - -// optional string leading_comments = 3; -bool SourceCodeInfo_Location::has_leading_comments() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void SourceCodeInfo_Location::set_has_leading_comments() { - _has_bits_[0] |= 0x00000001u; -} -void SourceCodeInfo_Location::clear_has_leading_comments() { - _has_bits_[0] &= ~0x00000001u; -} -void SourceCodeInfo_Location::clear_leading_comments() { - leading_comments_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_leading_comments(); -} -const ::std::string& SourceCodeInfo_Location::leading_comments() const { - // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.leading_comments) - return leading_comments_.GetNoArena(); -} -void SourceCodeInfo_Location::set_leading_comments(const ::std::string& value) { - set_has_leading_comments(); - leading_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_comments) -} -#if LANG_CXX11 -void SourceCodeInfo_Location::set_leading_comments(::std::string&& value) { - set_has_leading_comments(); - leading_comments_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.SourceCodeInfo.Location.leading_comments) -} -#endif -void SourceCodeInfo_Location::set_leading_comments(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_leading_comments(); - leading_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.SourceCodeInfo.Location.leading_comments) -} -void SourceCodeInfo_Location::set_leading_comments(const char* value, size_t size) { - set_has_leading_comments(); - leading_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceCodeInfo.Location.leading_comments) -} -::std::string* SourceCodeInfo_Location::mutable_leading_comments() { - set_has_leading_comments(); - // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.leading_comments) - return leading_comments_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* SourceCodeInfo_Location::release_leading_comments() { - // @@protoc_insertion_point(field_release:google.protobuf.SourceCodeInfo.Location.leading_comments) - clear_has_leading_comments(); - return leading_comments_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void SourceCodeInfo_Location::set_allocated_leading_comments(::std::string* leading_comments) { - if (leading_comments != NULL) { - set_has_leading_comments(); - } else { - clear_has_leading_comments(); - } - leading_comments_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), leading_comments); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.leading_comments) -} - -// optional string trailing_comments = 4; -bool SourceCodeInfo_Location::has_trailing_comments() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void SourceCodeInfo_Location::set_has_trailing_comments() { - _has_bits_[0] |= 0x00000002u; -} -void SourceCodeInfo_Location::clear_has_trailing_comments() { - _has_bits_[0] &= ~0x00000002u; -} -void SourceCodeInfo_Location::clear_trailing_comments() { - trailing_comments_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_trailing_comments(); -} -const ::std::string& SourceCodeInfo_Location::trailing_comments() const { - // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.trailing_comments) - return trailing_comments_.GetNoArena(); -} -void SourceCodeInfo_Location::set_trailing_comments(const ::std::string& value) { - set_has_trailing_comments(); - trailing_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.trailing_comments) -} -#if LANG_CXX11 -void SourceCodeInfo_Location::set_trailing_comments(::std::string&& value) { - set_has_trailing_comments(); - trailing_comments_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.SourceCodeInfo.Location.trailing_comments) -} -#endif -void SourceCodeInfo_Location::set_trailing_comments(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_trailing_comments(); - trailing_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.SourceCodeInfo.Location.trailing_comments) -} -void SourceCodeInfo_Location::set_trailing_comments(const char* value, size_t size) { - set_has_trailing_comments(); - trailing_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceCodeInfo.Location.trailing_comments) -} -::std::string* SourceCodeInfo_Location::mutable_trailing_comments() { - set_has_trailing_comments(); - // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.trailing_comments) - return trailing_comments_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* SourceCodeInfo_Location::release_trailing_comments() { - // @@protoc_insertion_point(field_release:google.protobuf.SourceCodeInfo.Location.trailing_comments) - clear_has_trailing_comments(); - return trailing_comments_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void SourceCodeInfo_Location::set_allocated_trailing_comments(::std::string* trailing_comments) { - if (trailing_comments != NULL) { - set_has_trailing_comments(); - } else { - clear_has_trailing_comments(); - } - trailing_comments_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), trailing_comments); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.trailing_comments) -} - -// repeated string leading_detached_comments = 6; -int SourceCodeInfo_Location::leading_detached_comments_size() const { - return leading_detached_comments_.size(); -} -void SourceCodeInfo_Location::clear_leading_detached_comments() { - leading_detached_comments_.Clear(); -} -const ::std::string& SourceCodeInfo_Location::leading_detached_comments(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) - return leading_detached_comments_.Get(index); -} -::std::string* SourceCodeInfo_Location::mutable_leading_detached_comments(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) - return leading_detached_comments_.Mutable(index); -} -void SourceCodeInfo_Location::set_leading_detached_comments(int index, const ::std::string& value) { - // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) - leading_detached_comments_.Mutable(index)->assign(value); -} -#if LANG_CXX11 -void SourceCodeInfo_Location::set_leading_detached_comments(int index, ::std::string&& value) { - // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) - leading_detached_comments_.Mutable(index)->assign(std::move(value)); -} -#endif -void SourceCodeInfo_Location::set_leading_detached_comments(int index, const char* value) { - GOOGLE_DCHECK(value != NULL); - leading_detached_comments_.Mutable(index)->assign(value); - // @@protoc_insertion_point(field_set_char:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) -} -void SourceCodeInfo_Location::set_leading_detached_comments(int index, const char* value, size_t size) { - leading_detached_comments_.Mutable(index)->assign( - reinterpret_cast<const char*>(value), size); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) -} -::std::string* SourceCodeInfo_Location::add_leading_detached_comments() { - // @@protoc_insertion_point(field_add_mutable:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) - return leading_detached_comments_.Add(); -} -void SourceCodeInfo_Location::add_leading_detached_comments(const ::std::string& value) { - leading_detached_comments_.Add()->assign(value); - // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) -} -#if LANG_CXX11 -void SourceCodeInfo_Location::add_leading_detached_comments(::std::string&& value) { - leading_detached_comments_.Add(std::move(value)); - // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) -} -#endif -void SourceCodeInfo_Location::add_leading_detached_comments(const char* value) { - GOOGLE_DCHECK(value != NULL); - leading_detached_comments_.Add()->assign(value); - // @@protoc_insertion_point(field_add_char:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) -} -void SourceCodeInfo_Location::add_leading_detached_comments(const char* value, size_t size) { - leading_detached_comments_.Add()->assign(reinterpret_cast<const char*>(value), size); - // @@protoc_insertion_point(field_add_pointer:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) -} -const ::google::protobuf::RepeatedPtrField< ::std::string>& -SourceCodeInfo_Location::leading_detached_comments() const { - // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) - return leading_detached_comments_; -} -::google::protobuf::RepeatedPtrField< ::std::string>* -SourceCodeInfo_Location::mutable_leading_detached_comments() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) - return &leading_detached_comments_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void SourceCodeInfo::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int SourceCodeInfo::kLocationFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -15897,11 +13174,20 @@ const int SourceCodeInfo::kLocationFieldNumber; SourceCodeInfo::SourceCodeInfo() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsSourceCodeInfo(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.SourceCodeInfo) } +SourceCodeInfo::SourceCodeInfo(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _internal_metadata_(arena), + location_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsSourceCodeInfo(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.SourceCodeInfo) +} SourceCodeInfo::SourceCodeInfo(const SourceCodeInfo& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -15922,29 +13208,32 @@ SourceCodeInfo::~SourceCodeInfo() { } void SourceCodeInfo::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } +void SourceCodeInfo::ArenaDtor(void* object) { + SourceCodeInfo* _this = reinterpret_cast< SourceCodeInfo* >(object); + (void)_this; +} +void SourceCodeInfo::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void SourceCodeInfo::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* SourceCodeInfo::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const SourceCodeInfo& SourceCodeInfo::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsSourceCodeInfo(); return *internal_default_instance(); } SourceCodeInfo* SourceCodeInfo::New(::google::protobuf::Arena* arena) const { - SourceCodeInfo* n = new SourceCodeInfo; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<SourceCodeInfo>(arena); } void SourceCodeInfo::Clear() { @@ -15972,8 +13261,7 @@ bool SourceCodeInfo::MergePartialFromCodedStream( case 1: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_location())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_location())); } else { goto handle_unusual; } @@ -16031,7 +13319,7 @@ void SourceCodeInfo::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->location_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 1, this->location(static_cast<int>(i)), deterministic, target); } @@ -16058,7 +13346,7 @@ size_t SourceCodeInfo::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->location(static_cast<int>(i))); } } @@ -16115,6 +13403,21 @@ bool SourceCodeInfo::IsInitialized() const { void SourceCodeInfo::Swap(SourceCodeInfo* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + SourceCodeInfo* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void SourceCodeInfo::UnsafeArenaSwap(SourceCodeInfo* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void SourceCodeInfo::InternalSwap(SourceCodeInfo* other) { @@ -16127,46 +13430,14 @@ void SourceCodeInfo::InternalSwap(SourceCodeInfo* other) { ::google::protobuf::Metadata SourceCodeInfo::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// SourceCodeInfo - -// repeated .google.protobuf.SourceCodeInfo.Location location = 1; -int SourceCodeInfo::location_size() const { - return location_.size(); -} -void SourceCodeInfo::clear_location() { - location_.Clear(); -} -const ::google::protobuf::SourceCodeInfo_Location& SourceCodeInfo::location(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.location) - return location_.Get(index); -} -::google::protobuf::SourceCodeInfo_Location* SourceCodeInfo::mutable_location(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.location) - return location_.Mutable(index); -} -::google::protobuf::SourceCodeInfo_Location* SourceCodeInfo::add_location() { - // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.location) - return location_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location >* -SourceCodeInfo::mutable_location() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.location) - return &location_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location >& -SourceCodeInfo::location() const { - // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.location) - return location_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void GeneratedCodeInfo_Annotation::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int GeneratedCodeInfo_Annotation::kPathFieldNumber; const int GeneratedCodeInfo_Annotation::kSourceFileFieldNumber; @@ -16177,11 +13448,20 @@ const int GeneratedCodeInfo_Annotation::kEndFieldNumber; GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsGeneratedCodeInfo_Annotation(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.GeneratedCodeInfo.Annotation) } +GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _internal_metadata_(arena), + path_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsGeneratedCodeInfo_Annotation(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.GeneratedCodeInfo.Annotation) +} GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(const GeneratedCodeInfo_Annotation& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -16191,7 +13471,8 @@ GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(const GeneratedCodeIn _internal_metadata_.MergeFrom(from._internal_metadata_); source_file_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (from.has_source_file()) { - source_file_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.source_file_); + source_file_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.source_file(), + GetArenaNoVirtual()); } ::memcpy(&begin_, &from.begin_, static_cast<size_t>(reinterpret_cast<char*>(&end_) - @@ -16213,30 +13494,33 @@ GeneratedCodeInfo_Annotation::~GeneratedCodeInfo_Annotation() { } void GeneratedCodeInfo_Annotation::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); source_file_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } +void GeneratedCodeInfo_Annotation::ArenaDtor(void* object) { + GeneratedCodeInfo_Annotation* _this = reinterpret_cast< GeneratedCodeInfo_Annotation* >(object); + (void)_this; +} +void GeneratedCodeInfo_Annotation::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void GeneratedCodeInfo_Annotation::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* GeneratedCodeInfo_Annotation::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const GeneratedCodeInfo_Annotation& GeneratedCodeInfo_Annotation::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsGeneratedCodeInfo_Annotation(); return *internal_default_instance(); } GeneratedCodeInfo_Annotation* GeneratedCodeInfo_Annotation::New(::google::protobuf::Arena* arena) const { - GeneratedCodeInfo_Annotation* n = new GeneratedCodeInfo_Annotation; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<GeneratedCodeInfo_Annotation>(arena); } void GeneratedCodeInfo_Annotation::Clear() { @@ -16246,11 +13530,11 @@ void GeneratedCodeInfo_Annotation::Clear() { (void) cached_has_bits; path_.Clear(); - if (has_source_file()) { + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(!source_file_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*source_file_.UnsafeRawStringPointer())->clear(); + source_file_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } - cached_has_bits = _has_bits_[0]; if (cached_has_bits & 6u) { ::memset(&begin_, 0, static_cast<size_t>( reinterpret_cast<char*>(&end_) - @@ -16412,7 +13696,7 @@ void GeneratedCodeInfo_Annotation::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, target); target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( - static_cast< ::google::protobuf::uint32>( + static_cast< ::google::protobuf::int32>( _path_cached_byte_size_), target); target = ::google::protobuf::internal::WireFormatLite:: WriteInt32NoTagToArray(this->path_, target); @@ -16529,8 +13813,7 @@ void GeneratedCodeInfo_Annotation::MergeFrom(const GeneratedCodeInfo_Annotation& cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 7u) { if (cached_has_bits & 0x00000001u) { - set_has_source_file(); - source_file_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.source_file_); + set_source_file(from.source_file()); } if (cached_has_bits & 0x00000002u) { begin_ = from.begin_; @@ -16562,6 +13845,21 @@ bool GeneratedCodeInfo_Annotation::IsInitialized() const { void GeneratedCodeInfo_Annotation::Swap(GeneratedCodeInfo_Annotation* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + GeneratedCodeInfo_Annotation* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void GeneratedCodeInfo_Annotation::UnsafeArenaSwap(GeneratedCodeInfo_Annotation* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void GeneratedCodeInfo_Annotation::InternalSwap(GeneratedCodeInfo_Annotation* other) { @@ -16577,157 +13875,14 @@ void GeneratedCodeInfo_Annotation::InternalSwap(GeneratedCodeInfo_Annotation* ot ::google::protobuf::Metadata GeneratedCodeInfo_Annotation::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// GeneratedCodeInfo_Annotation - -// repeated int32 path = 1 [packed = true]; -int GeneratedCodeInfo_Annotation::path_size() const { - return path_.size(); -} -void GeneratedCodeInfo_Annotation::clear_path() { - path_.Clear(); -} -::google::protobuf::int32 GeneratedCodeInfo_Annotation::path(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.path) - return path_.Get(index); -} -void GeneratedCodeInfo_Annotation::set_path(int index, ::google::protobuf::int32 value) { - path_.Set(index, value); - // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.path) -} -void GeneratedCodeInfo_Annotation::add_path(::google::protobuf::int32 value) { - path_.Add(value); - // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.Annotation.path) -} -const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& -GeneratedCodeInfo_Annotation::path() const { - // @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.Annotation.path) - return path_; -} -::google::protobuf::RepeatedField< ::google::protobuf::int32 >* -GeneratedCodeInfo_Annotation::mutable_path() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.Annotation.path) - return &path_; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -// optional string source_file = 2; -bool GeneratedCodeInfo_Annotation::has_source_file() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void GeneratedCodeInfo_Annotation::set_has_source_file() { - _has_bits_[0] |= 0x00000001u; -} -void GeneratedCodeInfo_Annotation::clear_has_source_file() { - _has_bits_[0] &= ~0x00000001u; -} -void GeneratedCodeInfo_Annotation::clear_source_file() { - source_file_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_source_file(); -} -const ::std::string& GeneratedCodeInfo_Annotation::source_file() const { - // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.source_file) - return source_file_.GetNoArena(); -} -void GeneratedCodeInfo_Annotation::set_source_file(const ::std::string& value) { - set_has_source_file(); - source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.source_file) -} -#if LANG_CXX11 -void GeneratedCodeInfo_Annotation::set_source_file(::std::string&& value) { - set_has_source_file(); - source_file_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.GeneratedCodeInfo.Annotation.source_file) -} -#endif -void GeneratedCodeInfo_Annotation::set_source_file(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_source_file(); - source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.GeneratedCodeInfo.Annotation.source_file) -} -void GeneratedCodeInfo_Annotation::set_source_file(const char* value, size_t size) { - set_has_source_file(); - source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.GeneratedCodeInfo.Annotation.source_file) -} -::std::string* GeneratedCodeInfo_Annotation::mutable_source_file() { - set_has_source_file(); - // @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.Annotation.source_file) - return source_file_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* GeneratedCodeInfo_Annotation::release_source_file() { - // @@protoc_insertion_point(field_release:google.protobuf.GeneratedCodeInfo.Annotation.source_file) - clear_has_source_file(); - return source_file_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void GeneratedCodeInfo_Annotation::set_allocated_source_file(::std::string* source_file) { - if (source_file != NULL) { - set_has_source_file(); - } else { - clear_has_source_file(); - } - source_file_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), source_file); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.GeneratedCodeInfo.Annotation.source_file) -} - -// optional int32 begin = 3; -bool GeneratedCodeInfo_Annotation::has_begin() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void GeneratedCodeInfo_Annotation::set_has_begin() { - _has_bits_[0] |= 0x00000002u; -} -void GeneratedCodeInfo_Annotation::clear_has_begin() { - _has_bits_[0] &= ~0x00000002u; -} -void GeneratedCodeInfo_Annotation::clear_begin() { - begin_ = 0; - clear_has_begin(); -} -::google::protobuf::int32 GeneratedCodeInfo_Annotation::begin() const { - // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.begin) - return begin_; -} -void GeneratedCodeInfo_Annotation::set_begin(::google::protobuf::int32 value) { - set_has_begin(); - begin_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.begin) -} - -// optional int32 end = 4; -bool GeneratedCodeInfo_Annotation::has_end() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void GeneratedCodeInfo_Annotation::set_has_end() { - _has_bits_[0] |= 0x00000004u; -} -void GeneratedCodeInfo_Annotation::clear_has_end() { - _has_bits_[0] &= ~0x00000004u; -} -void GeneratedCodeInfo_Annotation::clear_end() { - end_ = 0; - clear_has_end(); -} -::google::protobuf::int32 GeneratedCodeInfo_Annotation::end() const { - // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.end) - return end_; -} -void GeneratedCodeInfo_Annotation::set_end(::google::protobuf::int32 value) { - set_has_end(); - end_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.end) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void GeneratedCodeInfo::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int GeneratedCodeInfo::kAnnotationFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -16735,11 +13890,20 @@ const int GeneratedCodeInfo::kAnnotationFieldNumber; GeneratedCodeInfo::GeneratedCodeInfo() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsGeneratedCodeInfo(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.GeneratedCodeInfo) } +GeneratedCodeInfo::GeneratedCodeInfo(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(), + _internal_metadata_(arena), + annotation_(arena) { + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsGeneratedCodeInfo(); + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:google.protobuf.GeneratedCodeInfo) +} GeneratedCodeInfo::GeneratedCodeInfo(const GeneratedCodeInfo& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), @@ -16760,29 +13924,32 @@ GeneratedCodeInfo::~GeneratedCodeInfo() { } void GeneratedCodeInfo::SharedDtor() { + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } +void GeneratedCodeInfo::ArenaDtor(void* object) { + GeneratedCodeInfo* _this = reinterpret_cast< GeneratedCodeInfo* >(object); + (void)_this; +} +void GeneratedCodeInfo::RegisterArenaDtor(::google::protobuf::Arena* arena) { +} void GeneratedCodeInfo::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* GeneratedCodeInfo::descriptor() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const GeneratedCodeInfo& GeneratedCodeInfo::default_instance() { - protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsGeneratedCodeInfo(); return *internal_default_instance(); } GeneratedCodeInfo* GeneratedCodeInfo::New(::google::protobuf::Arena* arena) const { - GeneratedCodeInfo* n = new GeneratedCodeInfo; - if (arena != NULL) { - arena->Own(n); - } - return n; + return ::google::protobuf::Arena::CreateMessage<GeneratedCodeInfo>(arena); } void GeneratedCodeInfo::Clear() { @@ -16810,8 +13977,7 @@ bool GeneratedCodeInfo::MergePartialFromCodedStream( case 1: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_annotation())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_annotation())); } else { goto handle_unusual; } @@ -16869,7 +14035,7 @@ void GeneratedCodeInfo::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->annotation_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 1, this->annotation(static_cast<int>(i)), deterministic, target); } @@ -16896,7 +14062,7 @@ size_t GeneratedCodeInfo::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->annotation(static_cast<int>(i))); } } @@ -16953,6 +14119,21 @@ bool GeneratedCodeInfo::IsInitialized() const { void GeneratedCodeInfo::Swap(GeneratedCodeInfo* other) { if (other == this) return; + if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { + InternalSwap(other); + } else { + GeneratedCodeInfo* temp = New(GetArenaNoVirtual()); + temp->MergeFrom(*other); + other->CopyFrom(*this); + InternalSwap(temp); + if (GetArenaNoVirtual() == NULL) { + delete temp; + } + } +} +void GeneratedCodeInfo::UnsafeArenaSwap(GeneratedCodeInfo* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); InternalSwap(other); } void GeneratedCodeInfo::InternalSwap(GeneratedCodeInfo* other) { @@ -16965,46 +14146,11 @@ void GeneratedCodeInfo::InternalSwap(GeneratedCodeInfo* other) { ::google::protobuf::Metadata GeneratedCodeInfo::GetMetadata() const { protobuf_google_2fprotobuf_2fdescriptor_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// GeneratedCodeInfo - -// repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; -int GeneratedCodeInfo::annotation_size() const { - return annotation_.size(); -} -void GeneratedCodeInfo::clear_annotation() { - annotation_.Clear(); -} -const ::google::protobuf::GeneratedCodeInfo_Annotation& GeneratedCodeInfo::annotation(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.annotation) - return annotation_.Get(index); -} -::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::mutable_annotation(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.annotation) - return annotation_.Mutable(index); -} -::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::add_annotation() { - // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.annotation) - return annotation_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >* -GeneratedCodeInfo::mutable_annotation() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.annotation) - return &annotation_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >& -GeneratedCodeInfo::annotation() const { - // @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.annotation) - return annotation_; + return ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::file_level_metadata[kIndexInFileMessages]; } -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index c67d748b..ee3ad7d7 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -31,6 +31,102 @@ #include <google/protobuf/generated_enum_reflection.h> #include <google/protobuf/unknown_field_set.h> // @@protoc_insertion_point(includes) + +namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto { +// Internal implementation detail -- do not use these members. +struct LIBPROTOBUF_EXPORT TableStruct { + static const ::google::protobuf::internal::ParseTableField entries[]; + static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; + static const ::google::protobuf::internal::ParseTable schema[27]; + static const ::google::protobuf::internal::FieldMetadata field_metadata[]; + static const ::google::protobuf::internal::SerializationTable serialization_table[]; + static const ::google::protobuf::uint32 offsets[]; +}; +void LIBPROTOBUF_EXPORT AddDescriptors(); +void LIBPROTOBUF_EXPORT InitDefaultsFileDescriptorSetImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsFileDescriptorSet(); +void LIBPROTOBUF_EXPORT InitDefaultsFileDescriptorProtoImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsFileDescriptorProto(); +void LIBPROTOBUF_EXPORT InitDefaultsDescriptorProto_ExtensionRangeImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsDescriptorProto_ExtensionRange(); +void LIBPROTOBUF_EXPORT InitDefaultsDescriptorProto_ReservedRangeImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsDescriptorProto_ReservedRange(); +void LIBPROTOBUF_EXPORT InitDefaultsDescriptorProtoImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsDescriptorProto(); +void LIBPROTOBUF_EXPORT InitDefaultsExtensionRangeOptionsImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsExtensionRangeOptions(); +void LIBPROTOBUF_EXPORT InitDefaultsFieldDescriptorProtoImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsFieldDescriptorProto(); +void LIBPROTOBUF_EXPORT InitDefaultsOneofDescriptorProtoImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsOneofDescriptorProto(); +void LIBPROTOBUF_EXPORT InitDefaultsEnumDescriptorProto_EnumReservedRangeImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsEnumDescriptorProto_EnumReservedRange(); +void LIBPROTOBUF_EXPORT InitDefaultsEnumDescriptorProtoImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsEnumDescriptorProto(); +void LIBPROTOBUF_EXPORT InitDefaultsEnumValueDescriptorProtoImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsEnumValueDescriptorProto(); +void LIBPROTOBUF_EXPORT InitDefaultsServiceDescriptorProtoImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsServiceDescriptorProto(); +void LIBPROTOBUF_EXPORT InitDefaultsMethodDescriptorProtoImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsMethodDescriptorProto(); +void LIBPROTOBUF_EXPORT InitDefaultsFileOptionsImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsFileOptions(); +void LIBPROTOBUF_EXPORT InitDefaultsMessageOptionsImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsMessageOptions(); +void LIBPROTOBUF_EXPORT InitDefaultsFieldOptionsImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsFieldOptions(); +void LIBPROTOBUF_EXPORT InitDefaultsOneofOptionsImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsOneofOptions(); +void LIBPROTOBUF_EXPORT InitDefaultsEnumOptionsImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsEnumOptions(); +void LIBPROTOBUF_EXPORT InitDefaultsEnumValueOptionsImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsEnumValueOptions(); +void LIBPROTOBUF_EXPORT InitDefaultsServiceOptionsImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsServiceOptions(); +void LIBPROTOBUF_EXPORT InitDefaultsMethodOptionsImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsMethodOptions(); +void LIBPROTOBUF_EXPORT InitDefaultsUninterpretedOption_NamePartImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsUninterpretedOption_NamePart(); +void LIBPROTOBUF_EXPORT InitDefaultsUninterpretedOptionImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsUninterpretedOption(); +void LIBPROTOBUF_EXPORT InitDefaultsSourceCodeInfo_LocationImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsSourceCodeInfo_Location(); +void LIBPROTOBUF_EXPORT InitDefaultsSourceCodeInfoImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsSourceCodeInfo(); +void LIBPROTOBUF_EXPORT InitDefaultsGeneratedCodeInfo_AnnotationImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsGeneratedCodeInfo_Annotation(); +void LIBPROTOBUF_EXPORT InitDefaultsGeneratedCodeInfoImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsGeneratedCodeInfo(); +inline void LIBPROTOBUF_EXPORT InitDefaults() { + InitDefaultsFileDescriptorSet(); + InitDefaultsFileDescriptorProto(); + InitDefaultsDescriptorProto_ExtensionRange(); + InitDefaultsDescriptorProto_ReservedRange(); + InitDefaultsDescriptorProto(); + InitDefaultsExtensionRangeOptions(); + InitDefaultsFieldDescriptorProto(); + InitDefaultsOneofDescriptorProto(); + InitDefaultsEnumDescriptorProto_EnumReservedRange(); + InitDefaultsEnumDescriptorProto(); + InitDefaultsEnumValueDescriptorProto(); + InitDefaultsServiceDescriptorProto(); + InitDefaultsMethodDescriptorProto(); + InitDefaultsFileOptions(); + InitDefaultsMessageOptions(); + InitDefaultsFieldOptions(); + InitDefaultsOneofOptions(); + InitDefaultsEnumOptions(); + InitDefaultsEnumValueOptions(); + InitDefaultsServiceOptions(); + InitDefaultsMethodOptions(); + InitDefaultsUninterpretedOption_NamePart(); + InitDefaultsUninterpretedOption(); + InitDefaultsSourceCodeInfo_Location(); + InitDefaultsSourceCodeInfo(); + InitDefaultsGeneratedCodeInfo_Annotation(); + InitDefaultsGeneratedCodeInfo(); +} +} // namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto namespace google { namespace protobuf { class DescriptorProto; @@ -45,6 +141,9 @@ LIBPROTOBUF_EXPORT extern DescriptorProto_ReservedRangeDefaultTypeInternal _Desc class EnumDescriptorProto; class EnumDescriptorProtoDefaultTypeInternal; LIBPROTOBUF_EXPORT extern EnumDescriptorProtoDefaultTypeInternal _EnumDescriptorProto_default_instance_; +class EnumDescriptorProto_EnumReservedRange; +class EnumDescriptorProto_EnumReservedRangeDefaultTypeInternal; +LIBPROTOBUF_EXPORT extern EnumDescriptorProto_EnumReservedRangeDefaultTypeInternal _EnumDescriptorProto_EnumReservedRange_default_instance_; class EnumOptions; class EnumOptionsDefaultTypeInternal; LIBPROTOBUF_EXPORT extern EnumOptionsDefaultTypeInternal _EnumOptions_default_instance_; @@ -113,25 +212,9 @@ class UninterpretedOption_NamePartDefaultTypeInternal; LIBPROTOBUF_EXPORT extern UninterpretedOption_NamePartDefaultTypeInternal _UninterpretedOption_NamePart_default_instance_; } // namespace protobuf } // namespace google - namespace google { namespace protobuf { -namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto { -// Internal implementation detail -- do not call these. -struct LIBPROTOBUF_EXPORT TableStruct { - static const ::google::protobuf::internal::ParseTableField entries[]; - static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; - static const ::google::protobuf::internal::ParseTable schema[]; - static const ::google::protobuf::uint32 offsets[]; - static const ::google::protobuf::internal::FieldMetadata field_metadata[]; - static const ::google::protobuf::internal::SerializationTable serialization_table[]; - static void InitDefaultsImpl(); -}; -void LIBPROTOBUF_EXPORT AddDescriptors(); -void LIBPROTOBUF_EXPORT InitDefaults(); -} // namespace protobuf_google_2fprotobuf_2fdescriptor_2eproto - enum FieldDescriptorProto_Type { FieldDescriptorProto_Type_TYPE_DOUBLE = 1, FieldDescriptorProto_Type_TYPE_FLOAT = 2, @@ -302,9 +385,16 @@ class LIBPROTOBUF_EXPORT FileDescriptorSet : public ::google::protobuf::Message return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const FileDescriptorSet& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const FileDescriptorSet* internal_default_instance() { return reinterpret_cast<const FileDescriptorSet*>( &_FileDescriptorSet_default_instance_); @@ -312,6 +402,7 @@ class LIBPROTOBUF_EXPORT FileDescriptorSet : public ::google::protobuf::Message static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 0; + void UnsafeArenaSwap(FileDescriptorSet* other); void Swap(FileDescriptorSet* other); friend void swap(FileDescriptorSet& a, FileDescriptorSet& b) { a.Swap(&b); @@ -342,12 +433,17 @@ class LIBPROTOBUF_EXPORT FileDescriptorSet : public ::google::protobuf::Message void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(FileDescriptorSet* other); + protected: + explicit FileDescriptorSet(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -373,10 +469,14 @@ class LIBPROTOBUF_EXPORT FileDescriptorSet : public ::google::protobuf::Message private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto > file_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFileDescriptorSetImpl(); }; // ------------------------------------------------------------------- @@ -413,9 +513,16 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const FileDescriptorProto& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const FileDescriptorProto* internal_default_instance() { return reinterpret_cast<const FileDescriptorProto*>( &_FileDescriptorProto_default_instance_); @@ -423,6 +530,7 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 1; + void UnsafeArenaSwap(FileDescriptorProto* other); void Swap(FileDescriptorProto* other); friend void swap(FileDescriptorProto& a, FileDescriptorProto& b) { a.Swap(&b); @@ -453,12 +561,17 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(FileDescriptorProto* other); + protected: + explicit FileDescriptorProto(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -576,6 +689,15 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag ::std::string* mutable_name(); ::std::string* release_name(); void set_allocated_name(::std::string* name); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_name(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_name( + ::std::string* name); // optional string package = 2; bool has_package() const; @@ -591,6 +713,15 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag ::std::string* mutable_package(); ::std::string* release_package(); void set_allocated_package(::std::string* package); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_package(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_package( + ::std::string* package); // optional string syntax = 12; bool has_syntax() const; @@ -606,24 +737,45 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag ::std::string* mutable_syntax(); ::std::string* release_syntax(); void set_allocated_syntax(::std::string* syntax); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_syntax(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_syntax( + ::std::string* syntax); // optional .google.protobuf.FileOptions options = 8; bool has_options() const; void clear_options(); static const int kOptionsFieldNumber = 8; + private: + void _slow_mutable_options(); + public: const ::google::protobuf::FileOptions& options() const; - ::google::protobuf::FileOptions* mutable_options(); ::google::protobuf::FileOptions* release_options(); + ::google::protobuf::FileOptions* mutable_options(); void set_allocated_options(::google::protobuf::FileOptions* options); + void unsafe_arena_set_allocated_options( + ::google::protobuf::FileOptions* options); + ::google::protobuf::FileOptions* unsafe_arena_release_options(); // optional .google.protobuf.SourceCodeInfo source_code_info = 9; bool has_source_code_info() const; void clear_source_code_info(); static const int kSourceCodeInfoFieldNumber = 9; + private: + void _slow_mutable_source_code_info(); + public: const ::google::protobuf::SourceCodeInfo& source_code_info() const; - ::google::protobuf::SourceCodeInfo* mutable_source_code_info(); ::google::protobuf::SourceCodeInfo* release_source_code_info(); + ::google::protobuf::SourceCodeInfo* mutable_source_code_info(); void set_allocated_source_code_info(::google::protobuf::SourceCodeInfo* source_code_info); + void unsafe_arena_set_allocated_source_code_info( + ::google::protobuf::SourceCodeInfo* source_code_info); + ::google::protobuf::SourceCodeInfo* unsafe_arena_release_source_code_info(); // @@protoc_insertion_point(class_scope:google.protobuf.FileDescriptorProto) private: @@ -639,6 +791,9 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag void clear_has_syntax(); ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::std::string> dependency_; @@ -653,7 +808,8 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag ::google::protobuf::internal::ArenaStringPtr syntax_; ::google::protobuf::FileOptions* options_; ::google::protobuf::SourceCodeInfo* source_code_info_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFileDescriptorProtoImpl(); }; // ------------------------------------------------------------------- @@ -690,9 +846,16 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ExtensionRange : public ::google::proto return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const DescriptorProto_ExtensionRange& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const DescriptorProto_ExtensionRange* internal_default_instance() { return reinterpret_cast<const DescriptorProto_ExtensionRange*>( &_DescriptorProto_ExtensionRange_default_instance_); @@ -700,6 +863,7 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ExtensionRange : public ::google::proto static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 2; + void UnsafeArenaSwap(DescriptorProto_ExtensionRange* other); void Swap(DescriptorProto_ExtensionRange* other); friend void swap(DescriptorProto_ExtensionRange& a, DescriptorProto_ExtensionRange& b) { a.Swap(&b); @@ -730,12 +894,17 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ExtensionRange : public ::google::proto void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(DescriptorProto_ExtensionRange* other); + protected: + explicit DescriptorProto_ExtensionRange(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -749,10 +918,16 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ExtensionRange : public ::google::proto bool has_options() const; void clear_options(); static const int kOptionsFieldNumber = 3; + private: + void _slow_mutable_options(); + public: const ::google::protobuf::ExtensionRangeOptions& options() const; - ::google::protobuf::ExtensionRangeOptions* mutable_options(); ::google::protobuf::ExtensionRangeOptions* release_options(); + ::google::protobuf::ExtensionRangeOptions* mutable_options(); void set_allocated_options(::google::protobuf::ExtensionRangeOptions* options); + void unsafe_arena_set_allocated_options( + ::google::protobuf::ExtensionRangeOptions* options); + ::google::protobuf::ExtensionRangeOptions* unsafe_arena_release_options(); // optional int32 start = 1; bool has_start() const; @@ -778,12 +953,16 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ExtensionRange : public ::google::proto void clear_has_options(); ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::ExtensionRangeOptions* options_; ::google::protobuf::int32 start_; ::google::protobuf::int32 end_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsDescriptorProto_ExtensionRangeImpl(); }; // ------------------------------------------------------------------- @@ -820,9 +999,16 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ReservedRange : public ::google::protob return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const DescriptorProto_ReservedRange& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const DescriptorProto_ReservedRange* internal_default_instance() { return reinterpret_cast<const DescriptorProto_ReservedRange*>( &_DescriptorProto_ReservedRange_default_instance_); @@ -830,6 +1016,7 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ReservedRange : public ::google::protob static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 3; + void UnsafeArenaSwap(DescriptorProto_ReservedRange* other); void Swap(DescriptorProto_ReservedRange* other); friend void swap(DescriptorProto_ReservedRange& a, DescriptorProto_ReservedRange& b) { a.Swap(&b); @@ -860,12 +1047,17 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ReservedRange : public ::google::protob void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(DescriptorProto_ReservedRange* other); + protected: + explicit DescriptorProto_ReservedRange(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -897,11 +1089,15 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ReservedRange : public ::google::protob void clear_has_end(); ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::int32 start_; ::google::protobuf::int32 end_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsDescriptorProto_ReservedRangeImpl(); }; // ------------------------------------------------------------------- @@ -938,9 +1134,16 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /* return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const DescriptorProto& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const DescriptorProto* internal_default_instance() { return reinterpret_cast<const DescriptorProto*>( &_DescriptorProto_default_instance_); @@ -948,6 +1151,7 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /* static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 4; + void UnsafeArenaSwap(DescriptorProto* other); void Swap(DescriptorProto* other); friend void swap(DescriptorProto& a, DescriptorProto& b) { a.Swap(&b); @@ -978,12 +1182,17 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /* void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(DescriptorProto* other); + protected: + explicit DescriptorProto(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -1116,15 +1325,30 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /* ::std::string* mutable_name(); ::std::string* release_name(); void set_allocated_name(::std::string* name); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_name(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_name( + ::std::string* name); // optional .google.protobuf.MessageOptions options = 7; bool has_options() const; void clear_options(); static const int kOptionsFieldNumber = 7; + private: + void _slow_mutable_options(); + public: const ::google::protobuf::MessageOptions& options() const; - ::google::protobuf::MessageOptions* mutable_options(); ::google::protobuf::MessageOptions* release_options(); + ::google::protobuf::MessageOptions* mutable_options(); void set_allocated_options(::google::protobuf::MessageOptions* options); + void unsafe_arena_set_allocated_options( + ::google::protobuf::MessageOptions* options); + ::google::protobuf::MessageOptions* unsafe_arena_release_options(); // @@protoc_insertion_point(class_scope:google.protobuf.DescriptorProto) private: @@ -1134,6 +1358,9 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /* void clear_has_options(); ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto > field_; @@ -1146,7 +1373,8 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /* ::google::protobuf::RepeatedPtrField< ::std::string> reserved_name_; ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::MessageOptions* options_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsDescriptorProtoImpl(); }; // ------------------------------------------------------------------- @@ -1183,9 +1411,16 @@ class LIBPROTOBUF_EXPORT ExtensionRangeOptions : public ::google::protobuf::Mess return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const ExtensionRangeOptions& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const ExtensionRangeOptions* internal_default_instance() { return reinterpret_cast<const ExtensionRangeOptions*>( &_ExtensionRangeOptions_default_instance_); @@ -1193,6 +1428,7 @@ class LIBPROTOBUF_EXPORT ExtensionRangeOptions : public ::google::protobuf::Mess static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 5; + void UnsafeArenaSwap(ExtensionRangeOptions* other); void Swap(ExtensionRangeOptions* other); friend void swap(ExtensionRangeOptions& a, ExtensionRangeOptions& b) { a.Swap(&b); @@ -1223,12 +1459,17 @@ class LIBPROTOBUF_EXPORT ExtensionRangeOptions : public ::google::protobuf::Mess void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(ExtensionRangeOptions* other); + protected: + explicit ExtensionRangeOptions(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -1257,10 +1498,14 @@ class LIBPROTOBUF_EXPORT ExtensionRangeOptions : public ::google::protobuf::Mess ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsExtensionRangeOptionsImpl(); }; // ------------------------------------------------------------------- @@ -1297,9 +1542,16 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const FieldDescriptorProto& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const FieldDescriptorProto* internal_default_instance() { return reinterpret_cast<const FieldDescriptorProto*>( &_FieldDescriptorProto_default_instance_); @@ -1307,6 +1559,7 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 6; + void UnsafeArenaSwap(FieldDescriptorProto* other); void Swap(FieldDescriptorProto* other); friend void swap(FieldDescriptorProto& a, FieldDescriptorProto& b) { a.Swap(&b); @@ -1337,12 +1590,17 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(FieldDescriptorProto* other); + protected: + explicit FieldDescriptorProto(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -1452,6 +1710,15 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa ::std::string* mutable_name(); ::std::string* release_name(); void set_allocated_name(::std::string* name); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_name(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_name( + ::std::string* name); // optional string extendee = 2; bool has_extendee() const; @@ -1467,6 +1734,15 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa ::std::string* mutable_extendee(); ::std::string* release_extendee(); void set_allocated_extendee(::std::string* extendee); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_extendee(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_extendee( + ::std::string* extendee); // optional string type_name = 6; bool has_type_name() const; @@ -1482,6 +1758,15 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa ::std::string* mutable_type_name(); ::std::string* release_type_name(); void set_allocated_type_name(::std::string* type_name); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_type_name(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_type_name( + ::std::string* type_name); // optional string default_value = 7; bool has_default_value() const; @@ -1497,6 +1782,15 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa ::std::string* mutable_default_value(); ::std::string* release_default_value(); void set_allocated_default_value(::std::string* default_value); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_default_value(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_default_value( + ::std::string* default_value); // optional string json_name = 10; bool has_json_name() const; @@ -1512,15 +1806,30 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa ::std::string* mutable_json_name(); ::std::string* release_json_name(); void set_allocated_json_name(::std::string* json_name); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_json_name(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_json_name( + ::std::string* json_name); // optional .google.protobuf.FieldOptions options = 8; bool has_options() const; void clear_options(); static const int kOptionsFieldNumber = 8; + private: + void _slow_mutable_options(); + public: const ::google::protobuf::FieldOptions& options() const; - ::google::protobuf::FieldOptions* mutable_options(); ::google::protobuf::FieldOptions* release_options(); + ::google::protobuf::FieldOptions* mutable_options(); void set_allocated_options(::google::protobuf::FieldOptions* options); + void unsafe_arena_set_allocated_options( + ::google::protobuf::FieldOptions* options); + ::google::protobuf::FieldOptions* unsafe_arena_release_options(); // optional int32 number = 3; bool has_number() const; @@ -1574,6 +1883,9 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa void clear_has_options(); ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::internal::ArenaStringPtr name_; @@ -1586,7 +1898,8 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa ::google::protobuf::int32 oneof_index_; int label_; int type_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFieldDescriptorProtoImpl(); }; // ------------------------------------------------------------------- @@ -1623,9 +1936,16 @@ class LIBPROTOBUF_EXPORT OneofDescriptorProto : public ::google::protobuf::Messa return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const OneofDescriptorProto& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const OneofDescriptorProto* internal_default_instance() { return reinterpret_cast<const OneofDescriptorProto*>( &_OneofDescriptorProto_default_instance_); @@ -1633,6 +1953,7 @@ class LIBPROTOBUF_EXPORT OneofDescriptorProto : public ::google::protobuf::Messa static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 7; + void UnsafeArenaSwap(OneofDescriptorProto* other); void Swap(OneofDescriptorProto* other); friend void swap(OneofDescriptorProto& a, OneofDescriptorProto& b) { a.Swap(&b); @@ -1663,12 +1984,17 @@ class LIBPROTOBUF_EXPORT OneofDescriptorProto : public ::google::protobuf::Messa void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(OneofDescriptorProto* other); + protected: + explicit OneofDescriptorProto(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -1692,15 +2018,30 @@ class LIBPROTOBUF_EXPORT OneofDescriptorProto : public ::google::protobuf::Messa ::std::string* mutable_name(); ::std::string* release_name(); void set_allocated_name(::std::string* name); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_name(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_name( + ::std::string* name); // optional .google.protobuf.OneofOptions options = 2; bool has_options() const; void clear_options(); static const int kOptionsFieldNumber = 2; + private: + void _slow_mutable_options(); + public: const ::google::protobuf::OneofOptions& options() const; - ::google::protobuf::OneofOptions* mutable_options(); ::google::protobuf::OneofOptions* release_options(); + ::google::protobuf::OneofOptions* mutable_options(); void set_allocated_options(::google::protobuf::OneofOptions* options); + void unsafe_arena_set_allocated_options( + ::google::protobuf::OneofOptions* options); + ::google::protobuf::OneofOptions* unsafe_arena_release_options(); // @@protoc_insertion_point(class_scope:google.protobuf.OneofDescriptorProto) private: @@ -1710,11 +2051,150 @@ class LIBPROTOBUF_EXPORT OneofDescriptorProto : public ::google::protobuf::Messa void clear_has_options(); ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::OneofOptions* options_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsOneofDescriptorProtoImpl(); +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumDescriptorProto.EnumReservedRange) */ { + public: + EnumDescriptorProto_EnumReservedRange(); + virtual ~EnumDescriptorProto_EnumReservedRange(); + + EnumDescriptorProto_EnumReservedRange(const EnumDescriptorProto_EnumReservedRange& from); + + inline EnumDescriptorProto_EnumReservedRange& operator=(const EnumDescriptorProto_EnumReservedRange& from) { + CopyFrom(from); + return *this; + } + #if LANG_CXX11 + EnumDescriptorProto_EnumReservedRange(EnumDescriptorProto_EnumReservedRange&& from) noexcept + : EnumDescriptorProto_EnumReservedRange() { + *this = ::std::move(from); + } + + inline EnumDescriptorProto_EnumReservedRange& operator=(EnumDescriptorProto_EnumReservedRange&& from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + #endif + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } + static const ::google::protobuf::Descriptor* descriptor(); + static const EnumDescriptorProto_EnumReservedRange& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const EnumDescriptorProto_EnumReservedRange* internal_default_instance() { + return reinterpret_cast<const EnumDescriptorProto_EnumReservedRange*>( + &_EnumDescriptorProto_EnumReservedRange_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = + 8; + + void UnsafeArenaSwap(EnumDescriptorProto_EnumReservedRange* other); + void Swap(EnumDescriptorProto_EnumReservedRange* other); + friend void swap(EnumDescriptorProto_EnumReservedRange& a, EnumDescriptorProto_EnumReservedRange& b) { + a.Swap(&b); + } + + // implements Message ---------------------------------------------- + + inline EnumDescriptorProto_EnumReservedRange* New() const PROTOBUF_FINAL { return New(NULL); } + + EnumDescriptorProto_EnumReservedRange* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; + void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; + void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; + void CopyFrom(const EnumDescriptorProto_EnumReservedRange& from); + void MergeFrom(const EnumDescriptorProto_EnumReservedRange& from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; + ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( + bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; + int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const PROTOBUF_FINAL; + void InternalSwap(EnumDescriptorProto_EnumReservedRange* other); + protected: + explicit EnumDescriptorProto_EnumReservedRange(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional int32 start = 1; + bool has_start() const; + void clear_start(); + static const int kStartFieldNumber = 1; + ::google::protobuf::int32 start() const; + void set_start(::google::protobuf::int32 value); + + // optional int32 end = 2; + bool has_end() const; + void clear_end(); + static const int kEndFieldNumber = 2; + ::google::protobuf::int32 end() const; + void set_end(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:google.protobuf.EnumDescriptorProto.EnumReservedRange) + private: + void set_has_start(); + void clear_has_start(); + void set_has_end(); + void clear_has_end(); + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable int _cached_size_; + ::google::protobuf::int32 start_; + ::google::protobuf::int32 end_; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumDescriptorProto_EnumReservedRangeImpl(); }; // ------------------------------------------------------------------- @@ -1751,16 +2231,24 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const EnumDescriptorProto& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const EnumDescriptorProto* internal_default_instance() { return reinterpret_cast<const EnumDescriptorProto*>( &_EnumDescriptorProto_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 8; + 9; + void UnsafeArenaSwap(EnumDescriptorProto* other); void Swap(EnumDescriptorProto* other); friend void swap(EnumDescriptorProto& a, EnumDescriptorProto& b) { a.Swap(&b); @@ -1791,12 +2279,17 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(EnumDescriptorProto* other); + protected: + explicit EnumDescriptorProto(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -1804,6 +2297,8 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag // nested types ---------------------------------------------------- + typedef EnumDescriptorProto_EnumReservedRange EnumReservedRange; + // accessors ------------------------------------------------------- // repeated .google.protobuf.EnumValueDescriptorProto value = 2; @@ -1818,6 +2313,40 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >& value() const; + // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; + int reserved_range_size() const; + void clear_reserved_range(); + static const int kReservedRangeFieldNumber = 4; + const ::google::protobuf::EnumDescriptorProto_EnumReservedRange& reserved_range(int index) const; + ::google::protobuf::EnumDescriptorProto_EnumReservedRange* mutable_reserved_range(int index); + ::google::protobuf::EnumDescriptorProto_EnumReservedRange* add_reserved_range(); + ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto_EnumReservedRange >* + mutable_reserved_range(); + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto_EnumReservedRange >& + reserved_range() const; + + // repeated string reserved_name = 5; + int reserved_name_size() const; + void clear_reserved_name(); + static const int kReservedNameFieldNumber = 5; + const ::std::string& reserved_name(int index) const; + ::std::string* mutable_reserved_name(int index); + void set_reserved_name(int index, const ::std::string& value); + #if LANG_CXX11 + void set_reserved_name(int index, ::std::string&& value); + #endif + void set_reserved_name(int index, const char* value); + void set_reserved_name(int index, const char* value, size_t size); + ::std::string* add_reserved_name(); + void add_reserved_name(const ::std::string& value); + #if LANG_CXX11 + void add_reserved_name(::std::string&& value); + #endif + void add_reserved_name(const char* value); + void add_reserved_name(const char* value, size_t size); + const ::google::protobuf::RepeatedPtrField< ::std::string>& reserved_name() const; + ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_reserved_name(); + // optional string name = 1; bool has_name() const; void clear_name(); @@ -1832,15 +2361,30 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag ::std::string* mutable_name(); ::std::string* release_name(); void set_allocated_name(::std::string* name); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_name(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_name( + ::std::string* name); // optional .google.protobuf.EnumOptions options = 3; bool has_options() const; void clear_options(); static const int kOptionsFieldNumber = 3; + private: + void _slow_mutable_options(); + public: const ::google::protobuf::EnumOptions& options() const; - ::google::protobuf::EnumOptions* mutable_options(); ::google::protobuf::EnumOptions* release_options(); + ::google::protobuf::EnumOptions* mutable_options(); void set_allocated_options(::google::protobuf::EnumOptions* options); + void unsafe_arena_set_allocated_options( + ::google::protobuf::EnumOptions* options); + ::google::protobuf::EnumOptions* unsafe_arena_release_options(); // @@protoc_insertion_point(class_scope:google.protobuf.EnumDescriptorProto) private: @@ -1850,12 +2394,18 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag void clear_has_options(); ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto > value_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto_EnumReservedRange > reserved_range_; + ::google::protobuf::RepeatedPtrField< ::std::string> reserved_name_; ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::EnumOptions* options_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumDescriptorProtoImpl(); }; // ------------------------------------------------------------------- @@ -1892,16 +2442,24 @@ class LIBPROTOBUF_EXPORT EnumValueDescriptorProto : public ::google::protobuf::M return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const EnumValueDescriptorProto& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const EnumValueDescriptorProto* internal_default_instance() { return reinterpret_cast<const EnumValueDescriptorProto*>( &_EnumValueDescriptorProto_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 9; + 10; + void UnsafeArenaSwap(EnumValueDescriptorProto* other); void Swap(EnumValueDescriptorProto* other); friend void swap(EnumValueDescriptorProto& a, EnumValueDescriptorProto& b) { a.Swap(&b); @@ -1932,12 +2490,17 @@ class LIBPROTOBUF_EXPORT EnumValueDescriptorProto : public ::google::protobuf::M void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(EnumValueDescriptorProto* other); + protected: + explicit EnumValueDescriptorProto(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -1961,15 +2524,30 @@ class LIBPROTOBUF_EXPORT EnumValueDescriptorProto : public ::google::protobuf::M ::std::string* mutable_name(); ::std::string* release_name(); void set_allocated_name(::std::string* name); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_name(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_name( + ::std::string* name); // optional .google.protobuf.EnumValueOptions options = 3; bool has_options() const; void clear_options(); static const int kOptionsFieldNumber = 3; + private: + void _slow_mutable_options(); + public: const ::google::protobuf::EnumValueOptions& options() const; - ::google::protobuf::EnumValueOptions* mutable_options(); ::google::protobuf::EnumValueOptions* release_options(); + ::google::protobuf::EnumValueOptions* mutable_options(); void set_allocated_options(::google::protobuf::EnumValueOptions* options); + void unsafe_arena_set_allocated_options( + ::google::protobuf::EnumValueOptions* options); + ::google::protobuf::EnumValueOptions* unsafe_arena_release_options(); // optional int32 number = 2; bool has_number() const; @@ -1988,12 +2566,16 @@ class LIBPROTOBUF_EXPORT EnumValueDescriptorProto : public ::google::protobuf::M void clear_has_options(); ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::EnumValueOptions* options_; ::google::protobuf::int32 number_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumValueDescriptorProtoImpl(); }; // ------------------------------------------------------------------- @@ -2030,16 +2612,24 @@ class LIBPROTOBUF_EXPORT ServiceDescriptorProto : public ::google::protobuf::Mes return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const ServiceDescriptorProto& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const ServiceDescriptorProto* internal_default_instance() { return reinterpret_cast<const ServiceDescriptorProto*>( &_ServiceDescriptorProto_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 10; + 11; + void UnsafeArenaSwap(ServiceDescriptorProto* other); void Swap(ServiceDescriptorProto* other); friend void swap(ServiceDescriptorProto& a, ServiceDescriptorProto& b) { a.Swap(&b); @@ -2070,12 +2660,17 @@ class LIBPROTOBUF_EXPORT ServiceDescriptorProto : public ::google::protobuf::Mes void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(ServiceDescriptorProto* other); + protected: + explicit ServiceDescriptorProto(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -2111,15 +2706,30 @@ class LIBPROTOBUF_EXPORT ServiceDescriptorProto : public ::google::protobuf::Mes ::std::string* mutable_name(); ::std::string* release_name(); void set_allocated_name(::std::string* name); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_name(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_name( + ::std::string* name); // optional .google.protobuf.ServiceOptions options = 3; bool has_options() const; void clear_options(); static const int kOptionsFieldNumber = 3; + private: + void _slow_mutable_options(); + public: const ::google::protobuf::ServiceOptions& options() const; - ::google::protobuf::ServiceOptions* mutable_options(); ::google::protobuf::ServiceOptions* release_options(); + ::google::protobuf::ServiceOptions* mutable_options(); void set_allocated_options(::google::protobuf::ServiceOptions* options); + void unsafe_arena_set_allocated_options( + ::google::protobuf::ServiceOptions* options); + ::google::protobuf::ServiceOptions* unsafe_arena_release_options(); // @@protoc_insertion_point(class_scope:google.protobuf.ServiceDescriptorProto) private: @@ -2129,12 +2739,16 @@ class LIBPROTOBUF_EXPORT ServiceDescriptorProto : public ::google::protobuf::Mes void clear_has_options(); ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto > method_; ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::ServiceOptions* options_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsServiceDescriptorProtoImpl(); }; // ------------------------------------------------------------------- @@ -2171,16 +2785,24 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const MethodDescriptorProto& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const MethodDescriptorProto* internal_default_instance() { return reinterpret_cast<const MethodDescriptorProto*>( &_MethodDescriptorProto_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 11; + 12; + void UnsafeArenaSwap(MethodDescriptorProto* other); void Swap(MethodDescriptorProto* other); friend void swap(MethodDescriptorProto& a, MethodDescriptorProto& b) { a.Swap(&b); @@ -2211,12 +2833,17 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(MethodDescriptorProto* other); + protected: + explicit MethodDescriptorProto(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -2240,6 +2867,15 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess ::std::string* mutable_name(); ::std::string* release_name(); void set_allocated_name(::std::string* name); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_name(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_name( + ::std::string* name); // optional string input_type = 2; bool has_input_type() const; @@ -2255,6 +2891,15 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess ::std::string* mutable_input_type(); ::std::string* release_input_type(); void set_allocated_input_type(::std::string* input_type); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_input_type(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_input_type( + ::std::string* input_type); // optional string output_type = 3; bool has_output_type() const; @@ -2270,15 +2915,30 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess ::std::string* mutable_output_type(); ::std::string* release_output_type(); void set_allocated_output_type(::std::string* output_type); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_output_type(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_output_type( + ::std::string* output_type); // optional .google.protobuf.MethodOptions options = 4; bool has_options() const; void clear_options(); static const int kOptionsFieldNumber = 4; + private: + void _slow_mutable_options(); + public: const ::google::protobuf::MethodOptions& options() const; - ::google::protobuf::MethodOptions* mutable_options(); ::google::protobuf::MethodOptions* release_options(); + ::google::protobuf::MethodOptions* mutable_options(); void set_allocated_options(::google::protobuf::MethodOptions* options); + void unsafe_arena_set_allocated_options( + ::google::protobuf::MethodOptions* options); + ::google::protobuf::MethodOptions* unsafe_arena_release_options(); // optional bool client_streaming = 5 [default = false]; bool has_client_streaming() const; @@ -2310,6 +2970,9 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess void clear_has_server_streaming(); ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::internal::ArenaStringPtr name_; @@ -2318,7 +2981,8 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess ::google::protobuf::MethodOptions* options_; bool client_streaming_; bool server_streaming_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsMethodDescriptorProtoImpl(); }; // ------------------------------------------------------------------- @@ -2355,16 +3019,24 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const FileOptions& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const FileOptions* internal_default_instance() { return reinterpret_cast<const FileOptions*>( &_FileOptions_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 12; + 13; + void UnsafeArenaSwap(FileOptions* other); void Swap(FileOptions* other); friend void swap(FileOptions& a, FileOptions& b) { a.Swap(&b); @@ -2395,12 +3067,17 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(FileOptions* other); + protected: + explicit FileOptions(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -2464,6 +3141,15 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p ::std::string* mutable_java_package(); ::std::string* release_java_package(); void set_allocated_java_package(::std::string* java_package); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_java_package(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_java_package( + ::std::string* java_package); // optional string java_outer_classname = 8; bool has_java_outer_classname() const; @@ -2479,6 +3165,15 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p ::std::string* mutable_java_outer_classname(); ::std::string* release_java_outer_classname(); void set_allocated_java_outer_classname(::std::string* java_outer_classname); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_java_outer_classname(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_java_outer_classname( + ::std::string* java_outer_classname); // optional string go_package = 11; bool has_go_package() const; @@ -2494,6 +3189,15 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p ::std::string* mutable_go_package(); ::std::string* release_go_package(); void set_allocated_go_package(::std::string* go_package); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_go_package(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_go_package( + ::std::string* go_package); // optional string objc_class_prefix = 36; bool has_objc_class_prefix() const; @@ -2509,6 +3213,15 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p ::std::string* mutable_objc_class_prefix(); ::std::string* release_objc_class_prefix(); void set_allocated_objc_class_prefix(::std::string* objc_class_prefix); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_objc_class_prefix(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_objc_class_prefix( + ::std::string* objc_class_prefix); // optional string csharp_namespace = 37; bool has_csharp_namespace() const; @@ -2524,6 +3237,15 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p ::std::string* mutable_csharp_namespace(); ::std::string* release_csharp_namespace(); void set_allocated_csharp_namespace(::std::string* csharp_namespace); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_csharp_namespace(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_csharp_namespace( + ::std::string* csharp_namespace); // optional string swift_prefix = 39; bool has_swift_prefix() const; @@ -2539,6 +3261,15 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p ::std::string* mutable_swift_prefix(); ::std::string* release_swift_prefix(); void set_allocated_swift_prefix(::std::string* swift_prefix); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_swift_prefix(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_swift_prefix( + ::std::string* swift_prefix); // optional string php_class_prefix = 40; bool has_php_class_prefix() const; @@ -2554,6 +3285,15 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p ::std::string* mutable_php_class_prefix(); ::std::string* release_php_class_prefix(); void set_allocated_php_class_prefix(::std::string* php_class_prefix); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_php_class_prefix(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_php_class_prefix( + ::std::string* php_class_prefix); // optional string php_namespace = 41; bool has_php_namespace() const; @@ -2569,6 +3309,15 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p ::std::string* mutable_php_namespace(); ::std::string* release_php_namespace(); void set_allocated_php_namespace(::std::string* php_namespace); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_php_namespace(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_php_namespace( + ::std::string* php_namespace); // optional bool cc_enable_arenas = 31 [default = false]; bool has_cc_enable_arenas() const; @@ -2683,6 +3432,9 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; @@ -2704,7 +3456,8 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p bool php_generic_services_; bool deprecated_; int optimize_for_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFileOptionsImpl(); }; // ------------------------------------------------------------------- @@ -2741,16 +3494,24 @@ class LIBPROTOBUF_EXPORT MessageOptions : public ::google::protobuf::Message /* return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const MessageOptions& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const MessageOptions* internal_default_instance() { return reinterpret_cast<const MessageOptions*>( &_MessageOptions_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 13; + 14; + void UnsafeArenaSwap(MessageOptions* other); void Swap(MessageOptions* other); friend void swap(MessageOptions& a, MessageOptions& b) { a.Swap(&b); @@ -2781,12 +3542,17 @@ class LIBPROTOBUF_EXPORT MessageOptions : public ::google::protobuf::Message /* void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(MessageOptions* other); + protected: + explicit MessageOptions(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -2851,6 +3617,9 @@ class LIBPROTOBUF_EXPORT MessageOptions : public ::google::protobuf::Message /* ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; @@ -2858,7 +3627,8 @@ class LIBPROTOBUF_EXPORT MessageOptions : public ::google::protobuf::Message /* bool no_standard_descriptor_accessor_; bool deprecated_; bool map_entry_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsMessageOptionsImpl(); }; // ------------------------------------------------------------------- @@ -2895,16 +3665,24 @@ class LIBPROTOBUF_EXPORT FieldOptions : public ::google::protobuf::Message /* @@ return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const FieldOptions& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const FieldOptions* internal_default_instance() { return reinterpret_cast<const FieldOptions*>( &_FieldOptions_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 14; + 15; + void UnsafeArenaSwap(FieldOptions* other); void Swap(FieldOptions* other); friend void swap(FieldOptions& a, FieldOptions& b) { a.Swap(&b); @@ -2935,12 +3713,17 @@ class LIBPROTOBUF_EXPORT FieldOptions : public ::google::protobuf::Message /* @@ void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(FieldOptions* other); + protected: + explicit FieldOptions(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -3079,6 +3862,9 @@ class LIBPROTOBUF_EXPORT FieldOptions : public ::google::protobuf::Message /* @@ ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; @@ -3088,7 +3874,8 @@ class LIBPROTOBUF_EXPORT FieldOptions : public ::google::protobuf::Message /* @@ bool deprecated_; bool weak_; int jstype_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsFieldOptionsImpl(); }; // ------------------------------------------------------------------- @@ -3125,16 +3912,24 @@ class LIBPROTOBUF_EXPORT OneofOptions : public ::google::protobuf::Message /* @@ return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const OneofOptions& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const OneofOptions* internal_default_instance() { return reinterpret_cast<const OneofOptions*>( &_OneofOptions_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 15; + 16; + void UnsafeArenaSwap(OneofOptions* other); void Swap(OneofOptions* other); friend void swap(OneofOptions& a, OneofOptions& b) { a.Swap(&b); @@ -3165,12 +3960,17 @@ class LIBPROTOBUF_EXPORT OneofOptions : public ::google::protobuf::Message /* @@ void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(OneofOptions* other); + protected: + explicit OneofOptions(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -3199,10 +3999,14 @@ class LIBPROTOBUF_EXPORT OneofOptions : public ::google::protobuf::Message /* @@ ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsOneofOptionsImpl(); }; // ------------------------------------------------------------------- @@ -3239,16 +4043,24 @@ class LIBPROTOBUF_EXPORT EnumOptions : public ::google::protobuf::Message /* @@p return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const EnumOptions& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const EnumOptions* internal_default_instance() { return reinterpret_cast<const EnumOptions*>( &_EnumOptions_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 16; + 17; + void UnsafeArenaSwap(EnumOptions* other); void Swap(EnumOptions* other); friend void swap(EnumOptions& a, EnumOptions& b) { a.Swap(&b); @@ -3279,12 +4091,17 @@ class LIBPROTOBUF_EXPORT EnumOptions : public ::google::protobuf::Message /* @@p void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(EnumOptions* other); + protected: + explicit EnumOptions(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -3331,12 +4148,16 @@ class LIBPROTOBUF_EXPORT EnumOptions : public ::google::protobuf::Message /* @@p ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; bool allow_alias_; bool deprecated_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumOptionsImpl(); }; // ------------------------------------------------------------------- @@ -3373,16 +4194,24 @@ class LIBPROTOBUF_EXPORT EnumValueOptions : public ::google::protobuf::Message / return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const EnumValueOptions& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const EnumValueOptions* internal_default_instance() { return reinterpret_cast<const EnumValueOptions*>( &_EnumValueOptions_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 17; + 18; + void UnsafeArenaSwap(EnumValueOptions* other); void Swap(EnumValueOptions* other); friend void swap(EnumValueOptions& a, EnumValueOptions& b) { a.Swap(&b); @@ -3413,12 +4242,17 @@ class LIBPROTOBUF_EXPORT EnumValueOptions : public ::google::protobuf::Message / void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(EnumValueOptions* other); + protected: + explicit EnumValueOptions(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -3456,11 +4290,15 @@ class LIBPROTOBUF_EXPORT EnumValueOptions : public ::google::protobuf::Message / ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; bool deprecated_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsEnumValueOptionsImpl(); }; // ------------------------------------------------------------------- @@ -3497,16 +4335,24 @@ class LIBPROTOBUF_EXPORT ServiceOptions : public ::google::protobuf::Message /* return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const ServiceOptions& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const ServiceOptions* internal_default_instance() { return reinterpret_cast<const ServiceOptions*>( &_ServiceOptions_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 18; + 19; + void UnsafeArenaSwap(ServiceOptions* other); void Swap(ServiceOptions* other); friend void swap(ServiceOptions& a, ServiceOptions& b) { a.Swap(&b); @@ -3537,12 +4383,17 @@ class LIBPROTOBUF_EXPORT ServiceOptions : public ::google::protobuf::Message /* void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(ServiceOptions* other); + protected: + explicit ServiceOptions(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -3580,11 +4431,15 @@ class LIBPROTOBUF_EXPORT ServiceOptions : public ::google::protobuf::Message /* ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; bool deprecated_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsServiceOptionsImpl(); }; // ------------------------------------------------------------------- @@ -3621,16 +4476,24 @@ class LIBPROTOBUF_EXPORT MethodOptions : public ::google::protobuf::Message /* @ return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const MethodOptions& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const MethodOptions* internal_default_instance() { return reinterpret_cast<const MethodOptions*>( &_MethodOptions_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 19; + 20; + void UnsafeArenaSwap(MethodOptions* other); void Swap(MethodOptions* other); friend void swap(MethodOptions& a, MethodOptions& b) { a.Swap(&b); @@ -3661,12 +4524,17 @@ class LIBPROTOBUF_EXPORT MethodOptions : public ::google::protobuf::Message /* @ void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(MethodOptions* other); + protected: + explicit MethodOptions(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -3741,12 +4609,16 @@ class LIBPROTOBUF_EXPORT MethodOptions : public ::google::protobuf::Message /* @ ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; bool deprecated_; int idempotency_level_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsMethodOptionsImpl(); }; // ------------------------------------------------------------------- @@ -3783,16 +4655,24 @@ class LIBPROTOBUF_EXPORT UninterpretedOption_NamePart : public ::google::protobu return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const UninterpretedOption_NamePart& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const UninterpretedOption_NamePart* internal_default_instance() { return reinterpret_cast<const UninterpretedOption_NamePart*>( &_UninterpretedOption_NamePart_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 20; + 21; + void UnsafeArenaSwap(UninterpretedOption_NamePart* other); void Swap(UninterpretedOption_NamePart* other); friend void swap(UninterpretedOption_NamePart& a, UninterpretedOption_NamePart& b) { a.Swap(&b); @@ -3823,12 +4703,17 @@ class LIBPROTOBUF_EXPORT UninterpretedOption_NamePart : public ::google::protobu void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(UninterpretedOption_NamePart* other); + protected: + explicit UninterpretedOption_NamePart(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -3852,6 +4737,15 @@ class LIBPROTOBUF_EXPORT UninterpretedOption_NamePart : public ::google::protobu ::std::string* mutable_name_part(); ::std::string* release_name_part(); void set_allocated_name_part(::std::string* name_part); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_name_part(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_name_part( + ::std::string* name_part); // required bool is_extension = 2; bool has_is_extension() const; @@ -3871,11 +4765,15 @@ class LIBPROTOBUF_EXPORT UninterpretedOption_NamePart : public ::google::protobu size_t RequiredFieldsByteSizeFallback() const; ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::internal::ArenaStringPtr name_part_; bool is_extension_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsUninterpretedOption_NamePartImpl(); }; // ------------------------------------------------------------------- @@ -3912,16 +4810,24 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const UninterpretedOption& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const UninterpretedOption* internal_default_instance() { return reinterpret_cast<const UninterpretedOption*>( &_UninterpretedOption_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 21; + 22; + void UnsafeArenaSwap(UninterpretedOption* other); void Swap(UninterpretedOption* other); friend void swap(UninterpretedOption& a, UninterpretedOption& b) { a.Swap(&b); @@ -3952,12 +4858,17 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(UninterpretedOption* other); + protected: + explicit UninterpretedOption(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -3995,6 +4906,15 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag ::std::string* mutable_identifier_value(); ::std::string* release_identifier_value(); void set_allocated_identifier_value(::std::string* identifier_value); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_identifier_value(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_identifier_value( + ::std::string* identifier_value); // optional bytes string_value = 7; bool has_string_value() const; @@ -4010,6 +4930,15 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag ::std::string* mutable_string_value(); ::std::string* release_string_value(); void set_allocated_string_value(::std::string* string_value); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_string_value(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_string_value( + ::std::string* string_value); // optional string aggregate_value = 8; bool has_aggregate_value() const; @@ -4025,6 +4954,15 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag ::std::string* mutable_aggregate_value(); ::std::string* release_aggregate_value(); void set_allocated_aggregate_value(::std::string* aggregate_value); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_aggregate_value(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_aggregate_value( + ::std::string* aggregate_value); // optional uint64 positive_int_value = 4; bool has_positive_int_value() const; @@ -4063,6 +5001,9 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag void clear_has_aggregate_value(); ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart > name_; @@ -4072,7 +5013,8 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag ::google::protobuf::uint64 positive_int_value_; ::google::protobuf::int64 negative_int_value_; double double_value_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsUninterpretedOptionImpl(); }; // ------------------------------------------------------------------- @@ -4109,16 +5051,24 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo_Location : public ::google::protobuf::Me return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const SourceCodeInfo_Location& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const SourceCodeInfo_Location* internal_default_instance() { return reinterpret_cast<const SourceCodeInfo_Location*>( &_SourceCodeInfo_Location_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 22; + 23; + void UnsafeArenaSwap(SourceCodeInfo_Location* other); void Swap(SourceCodeInfo_Location* other); friend void swap(SourceCodeInfo_Location& a, SourceCodeInfo_Location& b) { a.Swap(&b); @@ -4149,12 +5099,17 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo_Location : public ::google::protobuf::Me void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(SourceCodeInfo_Location* other); + protected: + explicit SourceCodeInfo_Location(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -4224,6 +5179,15 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo_Location : public ::google::protobuf::Me ::std::string* mutable_leading_comments(); ::std::string* release_leading_comments(); void set_allocated_leading_comments(::std::string* leading_comments); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_leading_comments(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_leading_comments( + ::std::string* leading_comments); // optional string trailing_comments = 4; bool has_trailing_comments() const; @@ -4239,6 +5203,15 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo_Location : public ::google::protobuf::Me ::std::string* mutable_trailing_comments(); ::std::string* release_trailing_comments(); void set_allocated_trailing_comments(::std::string* trailing_comments); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_trailing_comments(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_trailing_comments( + ::std::string* trailing_comments); // @@protoc_insertion_point(class_scope:google.protobuf.SourceCodeInfo.Location) private: @@ -4248,6 +5221,9 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo_Location : public ::google::protobuf::Me void clear_has_trailing_comments(); ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedField< ::google::protobuf::int32 > path_; @@ -4257,7 +5233,8 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo_Location : public ::google::protobuf::Me ::google::protobuf::RepeatedPtrField< ::std::string> leading_detached_comments_; ::google::protobuf::internal::ArenaStringPtr leading_comments_; ::google::protobuf::internal::ArenaStringPtr trailing_comments_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsSourceCodeInfo_LocationImpl(); }; // ------------------------------------------------------------------- @@ -4294,16 +5271,24 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo : public ::google::protobuf::Message /* return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const SourceCodeInfo& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const SourceCodeInfo* internal_default_instance() { return reinterpret_cast<const SourceCodeInfo*>( &_SourceCodeInfo_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 23; + 24; + void UnsafeArenaSwap(SourceCodeInfo* other); void Swap(SourceCodeInfo* other); friend void swap(SourceCodeInfo& a, SourceCodeInfo& b) { a.Swap(&b); @@ -4334,12 +5319,17 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo : public ::google::protobuf::Message /* void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(SourceCodeInfo* other); + protected: + explicit SourceCodeInfo(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -4367,10 +5357,14 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo : public ::google::protobuf::Message /* private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location > location_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsSourceCodeInfoImpl(); }; // ------------------------------------------------------------------- @@ -4407,16 +5401,24 @@ class LIBPROTOBUF_EXPORT GeneratedCodeInfo_Annotation : public ::google::protobu return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const GeneratedCodeInfo_Annotation& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const GeneratedCodeInfo_Annotation* internal_default_instance() { return reinterpret_cast<const GeneratedCodeInfo_Annotation*>( &_GeneratedCodeInfo_Annotation_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 24; + 25; + void UnsafeArenaSwap(GeneratedCodeInfo_Annotation* other); void Swap(GeneratedCodeInfo_Annotation* other); friend void swap(GeneratedCodeInfo_Annotation& a, GeneratedCodeInfo_Annotation& b) { a.Swap(&b); @@ -4447,12 +5449,17 @@ class LIBPROTOBUF_EXPORT GeneratedCodeInfo_Annotation : public ::google::protobu void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(GeneratedCodeInfo_Annotation* other); + protected: + explicit GeneratedCodeInfo_Annotation(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -4488,6 +5495,15 @@ class LIBPROTOBUF_EXPORT GeneratedCodeInfo_Annotation : public ::google::protobu ::std::string* mutable_source_file(); ::std::string* release_source_file(); void set_allocated_source_file(::std::string* source_file); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + ::std::string* unsafe_arena_release_source_file(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_source_file( + ::std::string* source_file); // optional int32 begin = 3; bool has_begin() const; @@ -4513,6 +5529,9 @@ class LIBPROTOBUF_EXPORT GeneratedCodeInfo_Annotation : public ::google::protobu void clear_has_end(); ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedField< ::google::protobuf::int32 > path_; @@ -4520,7 +5539,8 @@ class LIBPROTOBUF_EXPORT GeneratedCodeInfo_Annotation : public ::google::protobu ::google::protobuf::internal::ArenaStringPtr source_file_; ::google::protobuf::int32 begin_; ::google::protobuf::int32 end_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsGeneratedCodeInfo_AnnotationImpl(); }; // ------------------------------------------------------------------- @@ -4557,16 +5577,24 @@ class LIBPROTOBUF_EXPORT GeneratedCodeInfo : public ::google::protobuf::Message return _internal_metadata_.mutable_unknown_fields(); } + inline ::google::protobuf::Arena* GetArena() const PROTOBUF_FINAL { + return GetArenaNoVirtual(); + } + inline void* GetMaybeArenaPointer() const PROTOBUF_FINAL { + return MaybeArenaPtr(); + } static const ::google::protobuf::Descriptor* descriptor(); static const GeneratedCodeInfo& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const GeneratedCodeInfo* internal_default_instance() { return reinterpret_cast<const GeneratedCodeInfo*>( &_GeneratedCodeInfo_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = - 25; + 26; + void UnsafeArenaSwap(GeneratedCodeInfo* other); void Swap(GeneratedCodeInfo* other); friend void swap(GeneratedCodeInfo& a, GeneratedCodeInfo& b) { a.Swap(&b); @@ -4597,12 +5625,17 @@ class LIBPROTOBUF_EXPORT GeneratedCodeInfo : public ::google::protobuf::Message void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(GeneratedCodeInfo* other); + protected: + explicit GeneratedCodeInfo(::google::protobuf::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return NULL; + return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { - return NULL; + return _internal_metadata_.raw_arena_ptr(); } public: @@ -4630,17 +5663,20 @@ class LIBPROTOBUF_EXPORT GeneratedCodeInfo : public ::google::protobuf::Message private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + template <typename T> friend class ::google::protobuf::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation > annotation_; - friend struct protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fdescriptor_2eproto::InitDefaultsGeneratedCodeInfoImpl(); }; // =================================================================== // =================================================================== -#if !PROTOBUF_INLINE_NOT_IN_HEADERS #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" @@ -4692,47 +5728,49 @@ inline void FileDescriptorProto::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } inline void FileDescriptorProto::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_name(); } inline const ::std::string& FileDescriptorProto::name() const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.name) - return name_.GetNoArena(); + return name_.Get(); } inline void FileDescriptorProto::set_name(const ::std::string& value) { set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.name) } #if LANG_CXX11 inline void FileDescriptorProto::set_name(::std::string&& value) { set_has_name(); - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + name_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileDescriptorProto.name) } #endif inline void FileDescriptorProto::set_name(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.name) } -inline void FileDescriptorProto::set_name(const char* value, size_t size) { +inline void FileDescriptorProto::set_name(const char* value, + size_t size) { set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.name) } inline ::std::string* FileDescriptorProto::mutable_name() { set_has_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* FileDescriptorProto::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.name) clear_has_name(); - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void FileDescriptorProto::set_allocated_name(::std::string* name) { if (name != NULL) { @@ -4740,9 +5778,29 @@ inline void FileDescriptorProto::set_allocated_name(::std::string* name) { } else { clear_has_name(); } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.name) } +inline ::std::string* FileDescriptorProto::unsafe_arena_release_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileDescriptorProto.name) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_name(); + return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void FileDescriptorProto::unsafe_arena_set_allocated_name( + ::std::string* name) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (name != NULL) { + set_has_name(); + } else { + clear_has_name(); + } + name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + name, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileDescriptorProto.name) +} // optional string package = 2; inline bool FileDescriptorProto::has_package() const { @@ -4755,47 +5813,49 @@ inline void FileDescriptorProto::clear_has_package() { _has_bits_[0] &= ~0x00000002u; } inline void FileDescriptorProto::clear_package() { - package_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + package_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_package(); } inline const ::std::string& FileDescriptorProto::package() const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.package) - return package_.GetNoArena(); + return package_.Get(); } inline void FileDescriptorProto::set_package(const ::std::string& value) { set_has_package(); - package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.package) } #if LANG_CXX11 inline void FileDescriptorProto::set_package(::std::string&& value) { set_has_package(); - package_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + package_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileDescriptorProto.package) } #endif inline void FileDescriptorProto::set_package(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_package(); - package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.package) } -inline void FileDescriptorProto::set_package(const char* value, size_t size) { +inline void FileDescriptorProto::set_package(const char* value, + size_t size) { set_has_package(); - package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.package) } inline ::std::string* FileDescriptorProto::mutable_package() { set_has_package(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.package) - return package_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return package_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* FileDescriptorProto::release_package() { // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.package) clear_has_package(); - return package_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return package_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void FileDescriptorProto::set_allocated_package(::std::string* package) { if (package != NULL) { @@ -4803,9 +5863,29 @@ inline void FileDescriptorProto::set_allocated_package(::std::string* package) { } else { clear_has_package(); } - package_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), package); + package_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), package, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.package) } +inline ::std::string* FileDescriptorProto::unsafe_arena_release_package() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileDescriptorProto.package) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_package(); + return package_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void FileDescriptorProto::unsafe_arena_set_allocated_package( + ::std::string* package) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (package != NULL) { + set_has_package(); + } else { + clear_has_package(); + } + package_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + package, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileDescriptorProto.package) +} // repeated string dependency = 3; inline int FileDescriptorProto::dependency_size() const { @@ -5067,7 +6147,7 @@ inline void FileDescriptorProto::clear_has_options() { _has_bits_[0] &= ~0x00000008u; } inline void FileDescriptorProto::clear_options() { - if (options_ != NULL) options_->::google::protobuf::FileOptions::Clear(); + if (options_ != NULL) options_->Clear(); clear_has_options(); } inline const ::google::protobuf::FileOptions& FileDescriptorProto::options() const { @@ -5076,29 +6156,48 @@ inline const ::google::protobuf::FileOptions& FileDescriptorProto::options() con return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::FileOptions*>( &::google::protobuf::_FileOptions_default_instance_); } -inline ::google::protobuf::FileOptions* FileDescriptorProto::mutable_options() { - set_has_options(); - if (options_ == NULL) { - options_ = new ::google::protobuf::FileOptions; - } - // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.options) - return options_; -} inline ::google::protobuf::FileOptions* FileDescriptorProto::release_options() { // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.options) clear_has_options(); ::google::protobuf::FileOptions* temp = options_; + if (GetArenaNoVirtual() != NULL) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL); + } options_ = NULL; return temp; } +inline ::google::protobuf::FileOptions* FileDescriptorProto::unsafe_arena_release_options() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileDescriptorProto.options) + clear_has_options(); + ::google::protobuf::FileOptions* temp = options_; + options_ = NULL; + return temp; +} +inline ::google::protobuf::FileOptions* FileDescriptorProto::mutable_options() { + set_has_options(); + if (options_ == NULL) { + _slow_mutable_options(); + } + // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.options) + return options_; +} inline void FileDescriptorProto::set_allocated_options(::google::protobuf::FileOptions* options) { - delete options_; - options_ = options; + ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); + if (message_arena == NULL) { + delete options_; + } if (options) { + ::google::protobuf::Arena* submessage_arena = + ::google::protobuf::Arena::GetArena(options); + if (message_arena != submessage_arena) { + options = ::google::protobuf::internal::GetOwnedMessage( + message_arena, options, submessage_arena); + } set_has_options(); } else { clear_has_options(); } + options_ = options; // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.options) } @@ -5113,7 +6212,7 @@ inline void FileDescriptorProto::clear_has_source_code_info() { _has_bits_[0] &= ~0x00000010u; } inline void FileDescriptorProto::clear_source_code_info() { - if (source_code_info_ != NULL) source_code_info_->::google::protobuf::SourceCodeInfo::Clear(); + if (source_code_info_ != NULL) source_code_info_->Clear(); clear_has_source_code_info(); } inline const ::google::protobuf::SourceCodeInfo& FileDescriptorProto::source_code_info() const { @@ -5122,29 +6221,48 @@ inline const ::google::protobuf::SourceCodeInfo& FileDescriptorProto::source_cod return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::SourceCodeInfo*>( &::google::protobuf::_SourceCodeInfo_default_instance_); } -inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::mutable_source_code_info() { - set_has_source_code_info(); - if (source_code_info_ == NULL) { - source_code_info_ = new ::google::protobuf::SourceCodeInfo; - } - // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.source_code_info) - return source_code_info_; -} inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::release_source_code_info() { // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.source_code_info) clear_has_source_code_info(); ::google::protobuf::SourceCodeInfo* temp = source_code_info_; + if (GetArenaNoVirtual() != NULL) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL); + } + source_code_info_ = NULL; + return temp; +} +inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::unsafe_arena_release_source_code_info() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileDescriptorProto.source_code_info) + clear_has_source_code_info(); + ::google::protobuf::SourceCodeInfo* temp = source_code_info_; source_code_info_ = NULL; return temp; } +inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::mutable_source_code_info() { + set_has_source_code_info(); + if (source_code_info_ == NULL) { + _slow_mutable_source_code_info(); + } + // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.source_code_info) + return source_code_info_; +} inline void FileDescriptorProto::set_allocated_source_code_info(::google::protobuf::SourceCodeInfo* source_code_info) { - delete source_code_info_; - source_code_info_ = source_code_info; + ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); + if (message_arena == NULL) { + delete source_code_info_; + } if (source_code_info) { + ::google::protobuf::Arena* submessage_arena = + ::google::protobuf::Arena::GetArena(source_code_info); + if (message_arena != submessage_arena) { + source_code_info = ::google::protobuf::internal::GetOwnedMessage( + message_arena, source_code_info, submessage_arena); + } set_has_source_code_info(); } else { clear_has_source_code_info(); } + source_code_info_ = source_code_info; // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.source_code_info) } @@ -5159,47 +6277,49 @@ inline void FileDescriptorProto::clear_has_syntax() { _has_bits_[0] &= ~0x00000004u; } inline void FileDescriptorProto::clear_syntax() { - syntax_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + syntax_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_syntax(); } inline const ::std::string& FileDescriptorProto::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.syntax) - return syntax_.GetNoArena(); + return syntax_.Get(); } inline void FileDescriptorProto::set_syntax(const ::std::string& value) { set_has_syntax(); - syntax_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + syntax_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.syntax) } #if LANG_CXX11 inline void FileDescriptorProto::set_syntax(::std::string&& value) { set_has_syntax(); - syntax_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + syntax_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileDescriptorProto.syntax) } #endif inline void FileDescriptorProto::set_syntax(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_syntax(); - syntax_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + syntax_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.FileDescriptorProto.syntax) } -inline void FileDescriptorProto::set_syntax(const char* value, size_t size) { +inline void FileDescriptorProto::set_syntax(const char* value, + size_t size) { set_has_syntax(); - syntax_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + syntax_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.syntax) } inline ::std::string* FileDescriptorProto::mutable_syntax() { set_has_syntax(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.syntax) - return syntax_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return syntax_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* FileDescriptorProto::release_syntax() { // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.syntax) clear_has_syntax(); - return syntax_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return syntax_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void FileDescriptorProto::set_allocated_syntax(::std::string* syntax) { if (syntax != NULL) { @@ -5207,9 +6327,29 @@ inline void FileDescriptorProto::set_allocated_syntax(::std::string* syntax) { } else { clear_has_syntax(); } - syntax_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), syntax); + syntax_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), syntax, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.syntax) } +inline ::std::string* FileDescriptorProto::unsafe_arena_release_syntax() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileDescriptorProto.syntax) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_syntax(); + return syntax_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void FileDescriptorProto::unsafe_arena_set_allocated_syntax( + ::std::string* syntax) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (syntax != NULL) { + set_has_syntax(); + } else { + clear_has_syntax(); + } + syntax_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + syntax, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileDescriptorProto.syntax) +} // ------------------------------------------------------------------- @@ -5274,7 +6414,7 @@ inline void DescriptorProto_ExtensionRange::clear_has_options() { _has_bits_[0] &= ~0x00000001u; } inline void DescriptorProto_ExtensionRange::clear_options() { - if (options_ != NULL) options_->::google::protobuf::ExtensionRangeOptions::Clear(); + if (options_ != NULL) options_->Clear(); clear_has_options(); } inline const ::google::protobuf::ExtensionRangeOptions& DescriptorProto_ExtensionRange::options() const { @@ -5283,29 +6423,48 @@ inline const ::google::protobuf::ExtensionRangeOptions& DescriptorProto_Extensio return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::ExtensionRangeOptions*>( &::google::protobuf::_ExtensionRangeOptions_default_instance_); } -inline ::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange::mutable_options() { - set_has_options(); - if (options_ == NULL) { - options_ = new ::google::protobuf::ExtensionRangeOptions; - } - // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.ExtensionRange.options) - return options_; -} inline ::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange::release_options() { // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.ExtensionRange.options) clear_has_options(); ::google::protobuf::ExtensionRangeOptions* temp = options_; + if (GetArenaNoVirtual() != NULL) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL); + } + options_ = NULL; + return temp; +} +inline ::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange::unsafe_arena_release_options() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.DescriptorProto.ExtensionRange.options) + clear_has_options(); + ::google::protobuf::ExtensionRangeOptions* temp = options_; options_ = NULL; return temp; } +inline ::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange::mutable_options() { + set_has_options(); + if (options_ == NULL) { + _slow_mutable_options(); + } + // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.ExtensionRange.options) + return options_; +} inline void DescriptorProto_ExtensionRange::set_allocated_options(::google::protobuf::ExtensionRangeOptions* options) { - delete options_; - options_ = options; + ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); + if (message_arena == NULL) { + delete options_; + } if (options) { + ::google::protobuf::Arena* submessage_arena = + ::google::protobuf::Arena::GetArena(options); + if (message_arena != submessage_arena) { + options = ::google::protobuf::internal::GetOwnedMessage( + message_arena, options, submessage_arena); + } set_has_options(); } else { clear_has_options(); } + options_ = options; // @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.ExtensionRange.options) } @@ -5376,47 +6535,49 @@ inline void DescriptorProto::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } inline void DescriptorProto::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_name(); } inline const ::std::string& DescriptorProto::name() const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.name) - return name_.GetNoArena(); + return name_.Get(); } inline void DescriptorProto::set_name(const ::std::string& value) { set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.name) } #if LANG_CXX11 inline void DescriptorProto::set_name(::std::string&& value) { set_has_name(); - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + name_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.DescriptorProto.name) } #endif inline void DescriptorProto::set_name(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.DescriptorProto.name) } -inline void DescriptorProto::set_name(const char* value, size_t size) { +inline void DescriptorProto::set_name(const char* value, + size_t size) { set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.DescriptorProto.name) } inline ::std::string* DescriptorProto::mutable_name() { set_has_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* DescriptorProto::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.name) clear_has_name(); - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void DescriptorProto::set_allocated_name(::std::string* name) { if (name != NULL) { @@ -5424,9 +6585,29 @@ inline void DescriptorProto::set_allocated_name(::std::string* name) { } else { clear_has_name(); } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.name) } +inline ::std::string* DescriptorProto::unsafe_arena_release_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.DescriptorProto.name) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_name(); + return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void DescriptorProto::unsafe_arena_set_allocated_name( + ::std::string* name) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (name != NULL) { + set_has_name(); + } else { + clear_has_name(); + } + name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + name, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.DescriptorProto.name) +} // repeated .google.protobuf.FieldDescriptorProto field = 2; inline int DescriptorProto::field_size() const { @@ -5619,7 +6800,7 @@ inline void DescriptorProto::clear_has_options() { _has_bits_[0] &= ~0x00000002u; } inline void DescriptorProto::clear_options() { - if (options_ != NULL) options_->::google::protobuf::MessageOptions::Clear(); + if (options_ != NULL) options_->Clear(); clear_has_options(); } inline const ::google::protobuf::MessageOptions& DescriptorProto::options() const { @@ -5628,29 +6809,48 @@ inline const ::google::protobuf::MessageOptions& DescriptorProto::options() cons return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::MessageOptions*>( &::google::protobuf::_MessageOptions_default_instance_); } -inline ::google::protobuf::MessageOptions* DescriptorProto::mutable_options() { - set_has_options(); - if (options_ == NULL) { - options_ = new ::google::protobuf::MessageOptions; - } - // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.options) - return options_; -} inline ::google::protobuf::MessageOptions* DescriptorProto::release_options() { // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.options) clear_has_options(); ::google::protobuf::MessageOptions* temp = options_; + if (GetArenaNoVirtual() != NULL) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL); + } options_ = NULL; return temp; } +inline ::google::protobuf::MessageOptions* DescriptorProto::unsafe_arena_release_options() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.DescriptorProto.options) + clear_has_options(); + ::google::protobuf::MessageOptions* temp = options_; + options_ = NULL; + return temp; +} +inline ::google::protobuf::MessageOptions* DescriptorProto::mutable_options() { + set_has_options(); + if (options_ == NULL) { + _slow_mutable_options(); + } + // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.options) + return options_; +} inline void DescriptorProto::set_allocated_options(::google::protobuf::MessageOptions* options) { - delete options_; - options_ = options; + ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); + if (message_arena == NULL) { + delete options_; + } if (options) { + ::google::protobuf::Arena* submessage_arena = + ::google::protobuf::Arena::GetArena(options); + if (message_arena != submessage_arena) { + options = ::google::protobuf::internal::GetOwnedMessage( + message_arena, options, submessage_arena); + } set_has_options(); } else { clear_has_options(); } + options_ = options; // @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.options) } @@ -5802,47 +7002,49 @@ inline void FieldDescriptorProto::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } inline void FieldDescriptorProto::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_name(); } inline const ::std::string& FieldDescriptorProto::name() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.name) - return name_.GetNoArena(); + return name_.Get(); } inline void FieldDescriptorProto::set_name(const ::std::string& value) { set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.name) } #if LANG_CXX11 inline void FieldDescriptorProto::set_name(::std::string&& value) { set_has_name(); - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + name_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.name) } #endif inline void FieldDescriptorProto::set_name(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.name) } -inline void FieldDescriptorProto::set_name(const char* value, size_t size) { +inline void FieldDescriptorProto::set_name(const char* value, + size_t size) { set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.name) } inline ::std::string* FieldDescriptorProto::mutable_name() { set_has_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* FieldDescriptorProto::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.name) clear_has_name(); - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void FieldDescriptorProto::set_allocated_name(::std::string* name) { if (name != NULL) { @@ -5850,9 +7052,29 @@ inline void FieldDescriptorProto::set_allocated_name(::std::string* name) { } else { clear_has_name(); } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.name) } +inline ::std::string* FieldDescriptorProto::unsafe_arena_release_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FieldDescriptorProto.name) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_name(); + return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void FieldDescriptorProto::unsafe_arena_set_allocated_name( + ::std::string* name) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (name != NULL) { + set_has_name(); + } else { + clear_has_name(); + } + name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + name, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.name) +} // optional int32 number = 3; inline bool FieldDescriptorProto::has_number() const { @@ -5939,47 +7161,49 @@ inline void FieldDescriptorProto::clear_has_type_name() { _has_bits_[0] &= ~0x00000004u; } inline void FieldDescriptorProto::clear_type_name() { - type_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + type_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_type_name(); } inline const ::std::string& FieldDescriptorProto::type_name() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.type_name) - return type_name_.GetNoArena(); + return type_name_.Get(); } inline void FieldDescriptorProto::set_type_name(const ::std::string& value) { set_has_type_name(); - type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + type_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.type_name) } #if LANG_CXX11 inline void FieldDescriptorProto::set_type_name(::std::string&& value) { set_has_type_name(); - type_name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + type_name_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.type_name) } #endif inline void FieldDescriptorProto::set_type_name(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_type_name(); - type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + type_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.type_name) } -inline void FieldDescriptorProto::set_type_name(const char* value, size_t size) { +inline void FieldDescriptorProto::set_type_name(const char* value, + size_t size) { set_has_type_name(); - type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + type_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.type_name) } inline ::std::string* FieldDescriptorProto::mutable_type_name() { set_has_type_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.type_name) - return type_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return type_name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* FieldDescriptorProto::release_type_name() { // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.type_name) clear_has_type_name(); - return type_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return type_name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void FieldDescriptorProto::set_allocated_type_name(::std::string* type_name) { if (type_name != NULL) { @@ -5987,9 +7211,29 @@ inline void FieldDescriptorProto::set_allocated_type_name(::std::string* type_na } else { clear_has_type_name(); } - type_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), type_name); + type_name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), type_name, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.type_name) } +inline ::std::string* FieldDescriptorProto::unsafe_arena_release_type_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FieldDescriptorProto.type_name) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_type_name(); + return type_name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void FieldDescriptorProto::unsafe_arena_set_allocated_type_name( + ::std::string* type_name) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (type_name != NULL) { + set_has_type_name(); + } else { + clear_has_type_name(); + } + type_name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + type_name, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.type_name) +} // optional string extendee = 2; inline bool FieldDescriptorProto::has_extendee() const { @@ -6002,47 +7246,49 @@ inline void FieldDescriptorProto::clear_has_extendee() { _has_bits_[0] &= ~0x00000002u; } inline void FieldDescriptorProto::clear_extendee() { - extendee_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + extendee_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_extendee(); } inline const ::std::string& FieldDescriptorProto::extendee() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.extendee) - return extendee_.GetNoArena(); + return extendee_.Get(); } inline void FieldDescriptorProto::set_extendee(const ::std::string& value) { set_has_extendee(); - extendee_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + extendee_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.extendee) } #if LANG_CXX11 inline void FieldDescriptorProto::set_extendee(::std::string&& value) { set_has_extendee(); - extendee_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + extendee_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.extendee) } #endif inline void FieldDescriptorProto::set_extendee(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_extendee(); - extendee_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + extendee_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.extendee) } -inline void FieldDescriptorProto::set_extendee(const char* value, size_t size) { +inline void FieldDescriptorProto::set_extendee(const char* value, + size_t size) { set_has_extendee(); - extendee_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + extendee_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.extendee) } inline ::std::string* FieldDescriptorProto::mutable_extendee() { set_has_extendee(); // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.extendee) - return extendee_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return extendee_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* FieldDescriptorProto::release_extendee() { // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.extendee) clear_has_extendee(); - return extendee_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return extendee_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void FieldDescriptorProto::set_allocated_extendee(::std::string* extendee) { if (extendee != NULL) { @@ -6050,9 +7296,29 @@ inline void FieldDescriptorProto::set_allocated_extendee(::std::string* extendee } else { clear_has_extendee(); } - extendee_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), extendee); + extendee_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), extendee, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.extendee) } +inline ::std::string* FieldDescriptorProto::unsafe_arena_release_extendee() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FieldDescriptorProto.extendee) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_extendee(); + return extendee_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void FieldDescriptorProto::unsafe_arena_set_allocated_extendee( + ::std::string* extendee) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (extendee != NULL) { + set_has_extendee(); + } else { + clear_has_extendee(); + } + extendee_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + extendee, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.extendee) +} // optional string default_value = 7; inline bool FieldDescriptorProto::has_default_value() const { @@ -6065,47 +7331,49 @@ inline void FieldDescriptorProto::clear_has_default_value() { _has_bits_[0] &= ~0x00000008u; } inline void FieldDescriptorProto::clear_default_value() { - default_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + default_value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_default_value(); } inline const ::std::string& FieldDescriptorProto::default_value() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.default_value) - return default_value_.GetNoArena(); + return default_value_.Get(); } inline void FieldDescriptorProto::set_default_value(const ::std::string& value) { set_has_default_value(); - default_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + default_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.default_value) } #if LANG_CXX11 inline void FieldDescriptorProto::set_default_value(::std::string&& value) { set_has_default_value(); - default_value_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + default_value_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.default_value) } #endif inline void FieldDescriptorProto::set_default_value(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_default_value(); - default_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + default_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.default_value) } -inline void FieldDescriptorProto::set_default_value(const char* value, size_t size) { +inline void FieldDescriptorProto::set_default_value(const char* value, + size_t size) { set_has_default_value(); - default_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + default_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.default_value) } inline ::std::string* FieldDescriptorProto::mutable_default_value() { set_has_default_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.default_value) - return default_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return default_value_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* FieldDescriptorProto::release_default_value() { // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.default_value) clear_has_default_value(); - return default_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return default_value_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void FieldDescriptorProto::set_allocated_default_value(::std::string* default_value) { if (default_value != NULL) { @@ -6113,9 +7381,29 @@ inline void FieldDescriptorProto::set_allocated_default_value(::std::string* def } else { clear_has_default_value(); } - default_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), default_value); + default_value_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), default_value, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.default_value) } +inline ::std::string* FieldDescriptorProto::unsafe_arena_release_default_value() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FieldDescriptorProto.default_value) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_default_value(); + return default_value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void FieldDescriptorProto::unsafe_arena_set_allocated_default_value( + ::std::string* default_value) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (default_value != NULL) { + set_has_default_value(); + } else { + clear_has_default_value(); + } + default_value_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + default_value, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.default_value) +} // optional int32 oneof_index = 9; inline bool FieldDescriptorProto::has_oneof_index() const { @@ -6152,47 +7440,49 @@ inline void FieldDescriptorProto::clear_has_json_name() { _has_bits_[0] &= ~0x00000010u; } inline void FieldDescriptorProto::clear_json_name() { - json_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + json_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_json_name(); } inline const ::std::string& FieldDescriptorProto::json_name() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.json_name) - return json_name_.GetNoArena(); + return json_name_.Get(); } inline void FieldDescriptorProto::set_json_name(const ::std::string& value) { set_has_json_name(); - json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + json_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.json_name) } #if LANG_CXX11 inline void FieldDescriptorProto::set_json_name(::std::string&& value) { set_has_json_name(); - json_name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + json_name_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FieldDescriptorProto.json_name) } #endif inline void FieldDescriptorProto::set_json_name(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_json_name(); - json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + json_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.FieldDescriptorProto.json_name) } -inline void FieldDescriptorProto::set_json_name(const char* value, size_t size) { +inline void FieldDescriptorProto::set_json_name(const char* value, + size_t size) { set_has_json_name(); - json_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + json_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.json_name) } inline ::std::string* FieldDescriptorProto::mutable_json_name() { set_has_json_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.json_name) - return json_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return json_name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* FieldDescriptorProto::release_json_name() { // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.json_name) clear_has_json_name(); - return json_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return json_name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void FieldDescriptorProto::set_allocated_json_name(::std::string* json_name) { if (json_name != NULL) { @@ -6200,9 +7490,29 @@ inline void FieldDescriptorProto::set_allocated_json_name(::std::string* json_na } else { clear_has_json_name(); } - json_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), json_name); + json_name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), json_name, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.json_name) } +inline ::std::string* FieldDescriptorProto::unsafe_arena_release_json_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FieldDescriptorProto.json_name) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_json_name(); + return json_name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void FieldDescriptorProto::unsafe_arena_set_allocated_json_name( + ::std::string* json_name) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (json_name != NULL) { + set_has_json_name(); + } else { + clear_has_json_name(); + } + json_name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + json_name, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.json_name) +} // optional .google.protobuf.FieldOptions options = 8; inline bool FieldDescriptorProto::has_options() const { @@ -6215,7 +7525,7 @@ inline void FieldDescriptorProto::clear_has_options() { _has_bits_[0] &= ~0x00000020u; } inline void FieldDescriptorProto::clear_options() { - if (options_ != NULL) options_->::google::protobuf::FieldOptions::Clear(); + if (options_ != NULL) options_->Clear(); clear_has_options(); } inline const ::google::protobuf::FieldOptions& FieldDescriptorProto::options() const { @@ -6224,29 +7534,48 @@ inline const ::google::protobuf::FieldOptions& FieldDescriptorProto::options() c return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::FieldOptions*>( &::google::protobuf::_FieldOptions_default_instance_); } -inline ::google::protobuf::FieldOptions* FieldDescriptorProto::mutable_options() { - set_has_options(); - if (options_ == NULL) { - options_ = new ::google::protobuf::FieldOptions; - } - // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.options) - return options_; -} inline ::google::protobuf::FieldOptions* FieldDescriptorProto::release_options() { // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.options) clear_has_options(); ::google::protobuf::FieldOptions* temp = options_; + if (GetArenaNoVirtual() != NULL) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL); + } options_ = NULL; return temp; } +inline ::google::protobuf::FieldOptions* FieldDescriptorProto::unsafe_arena_release_options() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FieldDescriptorProto.options) + clear_has_options(); + ::google::protobuf::FieldOptions* temp = options_; + options_ = NULL; + return temp; +} +inline ::google::protobuf::FieldOptions* FieldDescriptorProto::mutable_options() { + set_has_options(); + if (options_ == NULL) { + _slow_mutable_options(); + } + // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.options) + return options_; +} inline void FieldDescriptorProto::set_allocated_options(::google::protobuf::FieldOptions* options) { - delete options_; - options_ = options; + ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); + if (message_arena == NULL) { + delete options_; + } if (options) { + ::google::protobuf::Arena* submessage_arena = + ::google::protobuf::Arena::GetArena(options); + if (message_arena != submessage_arena) { + options = ::google::protobuf::internal::GetOwnedMessage( + message_arena, options, submessage_arena); + } set_has_options(); } else { clear_has_options(); } + options_ = options; // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.options) } @@ -6265,47 +7594,49 @@ inline void OneofDescriptorProto::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } inline void OneofDescriptorProto::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_name(); } inline const ::std::string& OneofDescriptorProto::name() const { // @@protoc_insertion_point(field_get:google.protobuf.OneofDescriptorProto.name) - return name_.GetNoArena(); + return name_.Get(); } inline void OneofDescriptorProto::set_name(const ::std::string& value) { set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.OneofDescriptorProto.name) } #if LANG_CXX11 inline void OneofDescriptorProto::set_name(::std::string&& value) { set_has_name(); - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + name_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.OneofDescriptorProto.name) } #endif inline void OneofDescriptorProto::set_name(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.OneofDescriptorProto.name) } -inline void OneofDescriptorProto::set_name(const char* value, size_t size) { +inline void OneofDescriptorProto::set_name(const char* value, + size_t size) { set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.OneofDescriptorProto.name) } inline ::std::string* OneofDescriptorProto::mutable_name() { set_has_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* OneofDescriptorProto::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.name) clear_has_name(); - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void OneofDescriptorProto::set_allocated_name(::std::string* name) { if (name != NULL) { @@ -6313,9 +7644,29 @@ inline void OneofDescriptorProto::set_allocated_name(::std::string* name) { } else { clear_has_name(); } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.OneofDescriptorProto.name) } +inline ::std::string* OneofDescriptorProto::unsafe_arena_release_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.OneofDescriptorProto.name) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_name(); + return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void OneofDescriptorProto::unsafe_arena_set_allocated_name( + ::std::string* name) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (name != NULL) { + set_has_name(); + } else { + clear_has_name(); + } + name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + name, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.OneofDescriptorProto.name) +} // optional .google.protobuf.OneofOptions options = 2; inline bool OneofDescriptorProto::has_options() const { @@ -6328,7 +7679,7 @@ inline void OneofDescriptorProto::clear_has_options() { _has_bits_[0] &= ~0x00000002u; } inline void OneofDescriptorProto::clear_options() { - if (options_ != NULL) options_->::google::protobuf::OneofOptions::Clear(); + if (options_ != NULL) options_->Clear(); clear_has_options(); } inline const ::google::protobuf::OneofOptions& OneofDescriptorProto::options() const { @@ -6337,34 +7688,105 @@ inline const ::google::protobuf::OneofOptions& OneofDescriptorProto::options() c return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::OneofOptions*>( &::google::protobuf::_OneofOptions_default_instance_); } -inline ::google::protobuf::OneofOptions* OneofDescriptorProto::mutable_options() { - set_has_options(); - if (options_ == NULL) { - options_ = new ::google::protobuf::OneofOptions; - } - // @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.options) - return options_; -} inline ::google::protobuf::OneofOptions* OneofDescriptorProto::release_options() { // @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.options) clear_has_options(); ::google::protobuf::OneofOptions* temp = options_; + if (GetArenaNoVirtual() != NULL) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL); + } + options_ = NULL; + return temp; +} +inline ::google::protobuf::OneofOptions* OneofDescriptorProto::unsafe_arena_release_options() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.OneofDescriptorProto.options) + clear_has_options(); + ::google::protobuf::OneofOptions* temp = options_; options_ = NULL; return temp; } +inline ::google::protobuf::OneofOptions* OneofDescriptorProto::mutable_options() { + set_has_options(); + if (options_ == NULL) { + _slow_mutable_options(); + } + // @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.options) + return options_; +} inline void OneofDescriptorProto::set_allocated_options(::google::protobuf::OneofOptions* options) { - delete options_; - options_ = options; + ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); + if (message_arena == NULL) { + delete options_; + } if (options) { + ::google::protobuf::Arena* submessage_arena = + ::google::protobuf::Arena::GetArena(options); + if (message_arena != submessage_arena) { + options = ::google::protobuf::internal::GetOwnedMessage( + message_arena, options, submessage_arena); + } set_has_options(); } else { clear_has_options(); } + options_ = options; // @@protoc_insertion_point(field_set_allocated:google.protobuf.OneofDescriptorProto.options) } // ------------------------------------------------------------------- +// EnumDescriptorProto_EnumReservedRange + +// optional int32 start = 1; +inline bool EnumDescriptorProto_EnumReservedRange::has_start() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void EnumDescriptorProto_EnumReservedRange::set_has_start() { + _has_bits_[0] |= 0x00000001u; +} +inline void EnumDescriptorProto_EnumReservedRange::clear_has_start() { + _has_bits_[0] &= ~0x00000001u; +} +inline void EnumDescriptorProto_EnumReservedRange::clear_start() { + start_ = 0; + clear_has_start(); +} +inline ::google::protobuf::int32 EnumDescriptorProto_EnumReservedRange::start() const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.EnumReservedRange.start) + return start_; +} +inline void EnumDescriptorProto_EnumReservedRange::set_start(::google::protobuf::int32 value) { + set_has_start(); + start_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.EnumReservedRange.start) +} + +// optional int32 end = 2; +inline bool EnumDescriptorProto_EnumReservedRange::has_end() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void EnumDescriptorProto_EnumReservedRange::set_has_end() { + _has_bits_[0] |= 0x00000002u; +} +inline void EnumDescriptorProto_EnumReservedRange::clear_has_end() { + _has_bits_[0] &= ~0x00000002u; +} +inline void EnumDescriptorProto_EnumReservedRange::clear_end() { + end_ = 0; + clear_has_end(); +} +inline ::google::protobuf::int32 EnumDescriptorProto_EnumReservedRange::end() const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.EnumReservedRange.end) + return end_; +} +inline void EnumDescriptorProto_EnumReservedRange::set_end(::google::protobuf::int32 value) { + set_has_end(); + end_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.EnumReservedRange.end) +} + +// ------------------------------------------------------------------- + // EnumDescriptorProto // optional string name = 1; @@ -6378,47 +7800,49 @@ inline void EnumDescriptorProto::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } inline void EnumDescriptorProto::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_name(); } inline const ::std::string& EnumDescriptorProto::name() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.name) - return name_.GetNoArena(); + return name_.Get(); } inline void EnumDescriptorProto::set_name(const ::std::string& value) { set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.name) } #if LANG_CXX11 inline void EnumDescriptorProto::set_name(::std::string&& value) { set_has_name(); - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + name_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.EnumDescriptorProto.name) } #endif inline void EnumDescriptorProto::set_name(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.EnumDescriptorProto.name) } -inline void EnumDescriptorProto::set_name(const char* value, size_t size) { +inline void EnumDescriptorProto::set_name(const char* value, + size_t size) { set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumDescriptorProto.name) } inline ::std::string* EnumDescriptorProto::mutable_name() { set_has_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* EnumDescriptorProto::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.name) clear_has_name(); - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void EnumDescriptorProto::set_allocated_name(::std::string* name) { if (name != NULL) { @@ -6426,9 +7850,29 @@ inline void EnumDescriptorProto::set_allocated_name(::std::string* name) { } else { clear_has_name(); } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumDescriptorProto.name) } +inline ::std::string* EnumDescriptorProto::unsafe_arena_release_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumDescriptorProto.name) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_name(); + return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void EnumDescriptorProto::unsafe_arena_set_allocated_name( + ::std::string* name) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (name != NULL) { + set_has_name(); + } else { + clear_has_name(); + } + name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + name, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumDescriptorProto.name) +} // repeated .google.protobuf.EnumValueDescriptorProto value = 2; inline int EnumDescriptorProto::value_size() const { @@ -6471,7 +7915,7 @@ inline void EnumDescriptorProto::clear_has_options() { _has_bits_[0] &= ~0x00000002u; } inline void EnumDescriptorProto::clear_options() { - if (options_ != NULL) options_->::google::protobuf::EnumOptions::Clear(); + if (options_ != NULL) options_->Clear(); clear_has_options(); } inline const ::google::protobuf::EnumOptions& EnumDescriptorProto::options() const { @@ -6480,32 +7924,150 @@ inline const ::google::protobuf::EnumOptions& EnumDescriptorProto::options() con return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::EnumOptions*>( &::google::protobuf::_EnumOptions_default_instance_); } -inline ::google::protobuf::EnumOptions* EnumDescriptorProto::mutable_options() { - set_has_options(); - if (options_ == NULL) { - options_ = new ::google::protobuf::EnumOptions; - } - // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.options) - return options_; -} inline ::google::protobuf::EnumOptions* EnumDescriptorProto::release_options() { // @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.options) clear_has_options(); ::google::protobuf::EnumOptions* temp = options_; + if (GetArenaNoVirtual() != NULL) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL); + } options_ = NULL; return temp; } +inline ::google::protobuf::EnumOptions* EnumDescriptorProto::unsafe_arena_release_options() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumDescriptorProto.options) + clear_has_options(); + ::google::protobuf::EnumOptions* temp = options_; + options_ = NULL; + return temp; +} +inline ::google::protobuf::EnumOptions* EnumDescriptorProto::mutable_options() { + set_has_options(); + if (options_ == NULL) { + _slow_mutable_options(); + } + // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.options) + return options_; +} inline void EnumDescriptorProto::set_allocated_options(::google::protobuf::EnumOptions* options) { - delete options_; - options_ = options; + ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); + if (message_arena == NULL) { + delete options_; + } if (options) { + ::google::protobuf::Arena* submessage_arena = + ::google::protobuf::Arena::GetArena(options); + if (message_arena != submessage_arena) { + options = ::google::protobuf::internal::GetOwnedMessage( + message_arena, options, submessage_arena); + } set_has_options(); } else { clear_has_options(); } + options_ = options; // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumDescriptorProto.options) } +// repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; +inline int EnumDescriptorProto::reserved_range_size() const { + return reserved_range_.size(); +} +inline void EnumDescriptorProto::clear_reserved_range() { + reserved_range_.Clear(); +} +inline const ::google::protobuf::EnumDescriptorProto_EnumReservedRange& EnumDescriptorProto::reserved_range(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.reserved_range) + return reserved_range_.Get(index); +} +inline ::google::protobuf::EnumDescriptorProto_EnumReservedRange* EnumDescriptorProto::mutable_reserved_range(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.reserved_range) + return reserved_range_.Mutable(index); +} +inline ::google::protobuf::EnumDescriptorProto_EnumReservedRange* EnumDescriptorProto::add_reserved_range() { + // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.reserved_range) + return reserved_range_.Add(); +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto_EnumReservedRange >* +EnumDescriptorProto::mutable_reserved_range() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumDescriptorProto.reserved_range) + return &reserved_range_; +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto_EnumReservedRange >& +EnumDescriptorProto::reserved_range() const { + // @@protoc_insertion_point(field_list:google.protobuf.EnumDescriptorProto.reserved_range) + return reserved_range_; +} + +// repeated string reserved_name = 5; +inline int EnumDescriptorProto::reserved_name_size() const { + return reserved_name_.size(); +} +inline void EnumDescriptorProto::clear_reserved_name() { + reserved_name_.Clear(); +} +inline const ::std::string& EnumDescriptorProto::reserved_name(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.reserved_name) + return reserved_name_.Get(index); +} +inline ::std::string* EnumDescriptorProto::mutable_reserved_name(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.reserved_name) + return reserved_name_.Mutable(index); +} +inline void EnumDescriptorProto::set_reserved_name(int index, const ::std::string& value) { + // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.reserved_name) + reserved_name_.Mutable(index)->assign(value); +} +#if LANG_CXX11 +inline void EnumDescriptorProto::set_reserved_name(int index, ::std::string&& value) { + // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.reserved_name) + reserved_name_.Mutable(index)->assign(std::move(value)); +} +#endif +inline void EnumDescriptorProto::set_reserved_name(int index, const char* value) { + GOOGLE_DCHECK(value != NULL); + reserved_name_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.EnumDescriptorProto.reserved_name) +} +inline void EnumDescriptorProto::set_reserved_name(int index, const char* value, size_t size) { + reserved_name_.Mutable(index)->assign( + reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumDescriptorProto.reserved_name) +} +inline ::std::string* EnumDescriptorProto::add_reserved_name() { + // @@protoc_insertion_point(field_add_mutable:google.protobuf.EnumDescriptorProto.reserved_name) + return reserved_name_.Add(); +} +inline void EnumDescriptorProto::add_reserved_name(const ::std::string& value) { + reserved_name_.Add()->assign(value); + // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.reserved_name) +} +#if LANG_CXX11 +inline void EnumDescriptorProto::add_reserved_name(::std::string&& value) { + reserved_name_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.reserved_name) +} +#endif +inline void EnumDescriptorProto::add_reserved_name(const char* value) { + GOOGLE_DCHECK(value != NULL); + reserved_name_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:google.protobuf.EnumDescriptorProto.reserved_name) +} +inline void EnumDescriptorProto::add_reserved_name(const char* value, size_t size) { + reserved_name_.Add()->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_add_pointer:google.protobuf.EnumDescriptorProto.reserved_name) +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +EnumDescriptorProto::reserved_name() const { + // @@protoc_insertion_point(field_list:google.protobuf.EnumDescriptorProto.reserved_name) + return reserved_name_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +EnumDescriptorProto::mutable_reserved_name() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumDescriptorProto.reserved_name) + return &reserved_name_; +} + // ------------------------------------------------------------------- // EnumValueDescriptorProto @@ -6521,47 +8083,49 @@ inline void EnumValueDescriptorProto::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } inline void EnumValueDescriptorProto::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_name(); } inline const ::std::string& EnumValueDescriptorProto::name() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.name) - return name_.GetNoArena(); + return name_.Get(); } inline void EnumValueDescriptorProto::set_name(const ::std::string& value) { set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.EnumValueDescriptorProto.name) } #if LANG_CXX11 inline void EnumValueDescriptorProto::set_name(::std::string&& value) { set_has_name(); - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + name_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.EnumValueDescriptorProto.name) } #endif inline void EnumValueDescriptorProto::set_name(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.EnumValueDescriptorProto.name) } -inline void EnumValueDescriptorProto::set_name(const char* value, size_t size) { +inline void EnumValueDescriptorProto::set_name(const char* value, + size_t size) { set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumValueDescriptorProto.name) } inline ::std::string* EnumValueDescriptorProto::mutable_name() { set_has_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* EnumValueDescriptorProto::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.name) clear_has_name(); - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void EnumValueDescriptorProto::set_allocated_name(::std::string* name) { if (name != NULL) { @@ -6569,9 +8133,29 @@ inline void EnumValueDescriptorProto::set_allocated_name(::std::string* name) { } else { clear_has_name(); } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValueDescriptorProto.name) } +inline ::std::string* EnumValueDescriptorProto::unsafe_arena_release_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumValueDescriptorProto.name) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_name(); + return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void EnumValueDescriptorProto::unsafe_arena_set_allocated_name( + ::std::string* name) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (name != NULL) { + set_has_name(); + } else { + clear_has_name(); + } + name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + name, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumValueDescriptorProto.name) +} // optional int32 number = 2; inline bool EnumValueDescriptorProto::has_number() const { @@ -6608,7 +8192,7 @@ inline void EnumValueDescriptorProto::clear_has_options() { _has_bits_[0] &= ~0x00000002u; } inline void EnumValueDescriptorProto::clear_options() { - if (options_ != NULL) options_->::google::protobuf::EnumValueOptions::Clear(); + if (options_ != NULL) options_->Clear(); clear_has_options(); } inline const ::google::protobuf::EnumValueOptions& EnumValueDescriptorProto::options() const { @@ -6617,29 +8201,48 @@ inline const ::google::protobuf::EnumValueOptions& EnumValueDescriptorProto::opt return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::EnumValueOptions*>( &::google::protobuf::_EnumValueOptions_default_instance_); } -inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::mutable_options() { - set_has_options(); - if (options_ == NULL) { - options_ = new ::google::protobuf::EnumValueOptions; - } - // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.options) - return options_; -} inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::release_options() { // @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.options) clear_has_options(); ::google::protobuf::EnumValueOptions* temp = options_; + if (GetArenaNoVirtual() != NULL) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL); + } options_ = NULL; return temp; } +inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::unsafe_arena_release_options() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumValueDescriptorProto.options) + clear_has_options(); + ::google::protobuf::EnumValueOptions* temp = options_; + options_ = NULL; + return temp; +} +inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::mutable_options() { + set_has_options(); + if (options_ == NULL) { + _slow_mutable_options(); + } + // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.options) + return options_; +} inline void EnumValueDescriptorProto::set_allocated_options(::google::protobuf::EnumValueOptions* options) { - delete options_; - options_ = options; + ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); + if (message_arena == NULL) { + delete options_; + } if (options) { + ::google::protobuf::Arena* submessage_arena = + ::google::protobuf::Arena::GetArena(options); + if (message_arena != submessage_arena) { + options = ::google::protobuf::internal::GetOwnedMessage( + message_arena, options, submessage_arena); + } set_has_options(); } else { clear_has_options(); } + options_ = options; // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValueDescriptorProto.options) } @@ -6658,47 +8261,49 @@ inline void ServiceDescriptorProto::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } inline void ServiceDescriptorProto::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_name(); } inline const ::std::string& ServiceDescriptorProto::name() const { // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.name) - return name_.GetNoArena(); + return name_.Get(); } inline void ServiceDescriptorProto::set_name(const ::std::string& value) { set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.ServiceDescriptorProto.name) } #if LANG_CXX11 inline void ServiceDescriptorProto::set_name(::std::string&& value) { set_has_name(); - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + name_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.ServiceDescriptorProto.name) } #endif inline void ServiceDescriptorProto::set_name(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.ServiceDescriptorProto.name) } -inline void ServiceDescriptorProto::set_name(const char* value, size_t size) { +inline void ServiceDescriptorProto::set_name(const char* value, + size_t size) { set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.ServiceDescriptorProto.name) } inline ::std::string* ServiceDescriptorProto::mutable_name() { set_has_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* ServiceDescriptorProto::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.name) clear_has_name(); - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void ServiceDescriptorProto::set_allocated_name(::std::string* name) { if (name != NULL) { @@ -6706,9 +8311,29 @@ inline void ServiceDescriptorProto::set_allocated_name(::std::string* name) { } else { clear_has_name(); } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.ServiceDescriptorProto.name) } +inline ::std::string* ServiceDescriptorProto::unsafe_arena_release_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.ServiceDescriptorProto.name) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_name(); + return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void ServiceDescriptorProto::unsafe_arena_set_allocated_name( + ::std::string* name) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (name != NULL) { + set_has_name(); + } else { + clear_has_name(); + } + name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + name, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.ServiceDescriptorProto.name) +} // repeated .google.protobuf.MethodDescriptorProto method = 2; inline int ServiceDescriptorProto::method_size() const { @@ -6751,7 +8376,7 @@ inline void ServiceDescriptorProto::clear_has_options() { _has_bits_[0] &= ~0x00000002u; } inline void ServiceDescriptorProto::clear_options() { - if (options_ != NULL) options_->::google::protobuf::ServiceOptions::Clear(); + if (options_ != NULL) options_->Clear(); clear_has_options(); } inline const ::google::protobuf::ServiceOptions& ServiceDescriptorProto::options() const { @@ -6760,29 +8385,48 @@ inline const ::google::protobuf::ServiceOptions& ServiceDescriptorProto::options return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::ServiceOptions*>( &::google::protobuf::_ServiceOptions_default_instance_); } -inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::mutable_options() { - set_has_options(); - if (options_ == NULL) { - options_ = new ::google::protobuf::ServiceOptions; - } - // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.options) - return options_; -} inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::release_options() { // @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.options) clear_has_options(); ::google::protobuf::ServiceOptions* temp = options_; + if (GetArenaNoVirtual() != NULL) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL); + } + options_ = NULL; + return temp; +} +inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::unsafe_arena_release_options() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.ServiceDescriptorProto.options) + clear_has_options(); + ::google::protobuf::ServiceOptions* temp = options_; options_ = NULL; return temp; } +inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::mutable_options() { + set_has_options(); + if (options_ == NULL) { + _slow_mutable_options(); + } + // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.options) + return options_; +} inline void ServiceDescriptorProto::set_allocated_options(::google::protobuf::ServiceOptions* options) { - delete options_; - options_ = options; + ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); + if (message_arena == NULL) { + delete options_; + } if (options) { + ::google::protobuf::Arena* submessage_arena = + ::google::protobuf::Arena::GetArena(options); + if (message_arena != submessage_arena) { + options = ::google::protobuf::internal::GetOwnedMessage( + message_arena, options, submessage_arena); + } set_has_options(); } else { clear_has_options(); } + options_ = options; // @@protoc_insertion_point(field_set_allocated:google.protobuf.ServiceDescriptorProto.options) } @@ -6801,47 +8445,49 @@ inline void MethodDescriptorProto::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } inline void MethodDescriptorProto::clear_name() { - name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_name(); } inline const ::std::string& MethodDescriptorProto::name() const { // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.name) - return name_.GetNoArena(); + return name_.Get(); } inline void MethodDescriptorProto::set_name(const ::std::string& value) { set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.name) } #if LANG_CXX11 inline void MethodDescriptorProto::set_name(::std::string&& value) { set_has_name(); - name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + name_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.MethodDescriptorProto.name) } #endif inline void MethodDescriptorProto::set_name(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.MethodDescriptorProto.name) } -inline void MethodDescriptorProto::set_name(const char* value, size_t size) { +inline void MethodDescriptorProto::set_name(const char* value, + size_t size) { set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.name) } inline ::std::string* MethodDescriptorProto::mutable_name() { set_has_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.name) - return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* MethodDescriptorProto::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.name) clear_has_name(); - return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void MethodDescriptorProto::set_allocated_name(::std::string* name) { if (name != NULL) { @@ -6849,9 +8495,29 @@ inline void MethodDescriptorProto::set_allocated_name(::std::string* name) { } else { clear_has_name(); } - name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.name) } +inline ::std::string* MethodDescriptorProto::unsafe_arena_release_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.MethodDescriptorProto.name) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_name(); + return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void MethodDescriptorProto::unsafe_arena_set_allocated_name( + ::std::string* name) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (name != NULL) { + set_has_name(); + } else { + clear_has_name(); + } + name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + name, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.MethodDescriptorProto.name) +} // optional string input_type = 2; inline bool MethodDescriptorProto::has_input_type() const { @@ -6864,47 +8530,49 @@ inline void MethodDescriptorProto::clear_has_input_type() { _has_bits_[0] &= ~0x00000002u; } inline void MethodDescriptorProto::clear_input_type() { - input_type_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + input_type_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_input_type(); } inline const ::std::string& MethodDescriptorProto::input_type() const { // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.input_type) - return input_type_.GetNoArena(); + return input_type_.Get(); } inline void MethodDescriptorProto::set_input_type(const ::std::string& value) { set_has_input_type(); - input_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + input_type_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.input_type) } #if LANG_CXX11 inline void MethodDescriptorProto::set_input_type(::std::string&& value) { set_has_input_type(); - input_type_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + input_type_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.MethodDescriptorProto.input_type) } #endif inline void MethodDescriptorProto::set_input_type(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_input_type(); - input_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + input_type_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.MethodDescriptorProto.input_type) } -inline void MethodDescriptorProto::set_input_type(const char* value, size_t size) { +inline void MethodDescriptorProto::set_input_type(const char* value, + size_t size) { set_has_input_type(); - input_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + input_type_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.input_type) } inline ::std::string* MethodDescriptorProto::mutable_input_type() { set_has_input_type(); // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.input_type) - return input_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return input_type_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* MethodDescriptorProto::release_input_type() { // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.input_type) clear_has_input_type(); - return input_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return input_type_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void MethodDescriptorProto::set_allocated_input_type(::std::string* input_type) { if (input_type != NULL) { @@ -6912,9 +8580,29 @@ inline void MethodDescriptorProto::set_allocated_input_type(::std::string* input } else { clear_has_input_type(); } - input_type_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), input_type); + input_type_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), input_type, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.input_type) } +inline ::std::string* MethodDescriptorProto::unsafe_arena_release_input_type() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.MethodDescriptorProto.input_type) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_input_type(); + return input_type_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void MethodDescriptorProto::unsafe_arena_set_allocated_input_type( + ::std::string* input_type) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (input_type != NULL) { + set_has_input_type(); + } else { + clear_has_input_type(); + } + input_type_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + input_type, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.MethodDescriptorProto.input_type) +} // optional string output_type = 3; inline bool MethodDescriptorProto::has_output_type() const { @@ -6927,47 +8615,49 @@ inline void MethodDescriptorProto::clear_has_output_type() { _has_bits_[0] &= ~0x00000004u; } inline void MethodDescriptorProto::clear_output_type() { - output_type_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + output_type_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_output_type(); } inline const ::std::string& MethodDescriptorProto::output_type() const { // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.output_type) - return output_type_.GetNoArena(); + return output_type_.Get(); } inline void MethodDescriptorProto::set_output_type(const ::std::string& value) { set_has_output_type(); - output_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + output_type_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.output_type) } #if LANG_CXX11 inline void MethodDescriptorProto::set_output_type(::std::string&& value) { set_has_output_type(); - output_type_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + output_type_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.MethodDescriptorProto.output_type) } #endif inline void MethodDescriptorProto::set_output_type(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_output_type(); - output_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + output_type_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.MethodDescriptorProto.output_type) } -inline void MethodDescriptorProto::set_output_type(const char* value, size_t size) { +inline void MethodDescriptorProto::set_output_type(const char* value, + size_t size) { set_has_output_type(); - output_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + output_type_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.output_type) } inline ::std::string* MethodDescriptorProto::mutable_output_type() { set_has_output_type(); // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.output_type) - return output_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return output_type_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* MethodDescriptorProto::release_output_type() { // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.output_type) clear_has_output_type(); - return output_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return output_type_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void MethodDescriptorProto::set_allocated_output_type(::std::string* output_type) { if (output_type != NULL) { @@ -6975,9 +8665,29 @@ inline void MethodDescriptorProto::set_allocated_output_type(::std::string* outp } else { clear_has_output_type(); } - output_type_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), output_type); + output_type_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), output_type, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.output_type) } +inline ::std::string* MethodDescriptorProto::unsafe_arena_release_output_type() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.MethodDescriptorProto.output_type) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_output_type(); + return output_type_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void MethodDescriptorProto::unsafe_arena_set_allocated_output_type( + ::std::string* output_type) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (output_type != NULL) { + set_has_output_type(); + } else { + clear_has_output_type(); + } + output_type_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + output_type, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.MethodDescriptorProto.output_type) +} // optional .google.protobuf.MethodOptions options = 4; inline bool MethodDescriptorProto::has_options() const { @@ -6990,7 +8700,7 @@ inline void MethodDescriptorProto::clear_has_options() { _has_bits_[0] &= ~0x00000008u; } inline void MethodDescriptorProto::clear_options() { - if (options_ != NULL) options_->::google::protobuf::MethodOptions::Clear(); + if (options_ != NULL) options_->Clear(); clear_has_options(); } inline const ::google::protobuf::MethodOptions& MethodDescriptorProto::options() const { @@ -6999,29 +8709,48 @@ inline const ::google::protobuf::MethodOptions& MethodDescriptorProto::options() return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::MethodOptions*>( &::google::protobuf::_MethodOptions_default_instance_); } -inline ::google::protobuf::MethodOptions* MethodDescriptorProto::mutable_options() { - set_has_options(); - if (options_ == NULL) { - options_ = new ::google::protobuf::MethodOptions; - } - // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.options) - return options_; -} inline ::google::protobuf::MethodOptions* MethodDescriptorProto::release_options() { // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.options) clear_has_options(); ::google::protobuf::MethodOptions* temp = options_; + if (GetArenaNoVirtual() != NULL) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL); + } options_ = NULL; return temp; } +inline ::google::protobuf::MethodOptions* MethodDescriptorProto::unsafe_arena_release_options() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.MethodDescriptorProto.options) + clear_has_options(); + ::google::protobuf::MethodOptions* temp = options_; + options_ = NULL; + return temp; +} +inline ::google::protobuf::MethodOptions* MethodDescriptorProto::mutable_options() { + set_has_options(); + if (options_ == NULL) { + _slow_mutable_options(); + } + // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.options) + return options_; +} inline void MethodDescriptorProto::set_allocated_options(::google::protobuf::MethodOptions* options) { - delete options_; - options_ = options; + ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); + if (message_arena == NULL) { + delete options_; + } if (options) { + ::google::protobuf::Arena* submessage_arena = + ::google::protobuf::Arena::GetArena(options); + if (message_arena != submessage_arena) { + options = ::google::protobuf::internal::GetOwnedMessage( + message_arena, options, submessage_arena); + } set_has_options(); } else { clear_has_options(); } + options_ = options; // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.options) } @@ -7088,47 +8817,49 @@ inline void FileOptions::clear_has_java_package() { _has_bits_[0] &= ~0x00000001u; } inline void FileOptions::clear_java_package() { - java_package_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + java_package_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_java_package(); } inline const ::std::string& FileOptions::java_package() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_package) - return java_package_.GetNoArena(); + return java_package_.Get(); } inline void FileOptions::set_java_package(const ::std::string& value) { set_has_java_package(); - java_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + java_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_package) } #if LANG_CXX11 inline void FileOptions::set_java_package(::std::string&& value) { set_has_java_package(); - java_package_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + java_package_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.java_package) } #endif inline void FileOptions::set_java_package(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_java_package(); - java_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + java_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.java_package) } -inline void FileOptions::set_java_package(const char* value, size_t size) { +inline void FileOptions::set_java_package(const char* value, + size_t size) { set_has_java_package(); - java_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + java_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.java_package) } inline ::std::string* FileOptions::mutable_java_package() { set_has_java_package(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.java_package) - return java_package_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return java_package_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* FileOptions::release_java_package() { // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.java_package) clear_has_java_package(); - return java_package_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return java_package_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void FileOptions::set_allocated_java_package(::std::string* java_package) { if (java_package != NULL) { @@ -7136,9 +8867,29 @@ inline void FileOptions::set_allocated_java_package(::std::string* java_package) } else { clear_has_java_package(); } - java_package_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), java_package); + java_package_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), java_package, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_package) } +inline ::std::string* FileOptions::unsafe_arena_release_java_package() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.java_package) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_java_package(); + return java_package_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void FileOptions::unsafe_arena_set_allocated_java_package( + ::std::string* java_package) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (java_package != NULL) { + set_has_java_package(); + } else { + clear_has_java_package(); + } + java_package_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + java_package, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.java_package) +} // optional string java_outer_classname = 8; inline bool FileOptions::has_java_outer_classname() const { @@ -7151,47 +8902,49 @@ inline void FileOptions::clear_has_java_outer_classname() { _has_bits_[0] &= ~0x00000002u; } inline void FileOptions::clear_java_outer_classname() { - java_outer_classname_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + java_outer_classname_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_java_outer_classname(); } inline const ::std::string& FileOptions::java_outer_classname() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_outer_classname) - return java_outer_classname_.GetNoArena(); + return java_outer_classname_.Get(); } inline void FileOptions::set_java_outer_classname(const ::std::string& value) { set_has_java_outer_classname(); - java_outer_classname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + java_outer_classname_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_outer_classname) } #if LANG_CXX11 inline void FileOptions::set_java_outer_classname(::std::string&& value) { set_has_java_outer_classname(); - java_outer_classname_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + java_outer_classname_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.java_outer_classname) } #endif inline void FileOptions::set_java_outer_classname(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_java_outer_classname(); - java_outer_classname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + java_outer_classname_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.java_outer_classname) } -inline void FileOptions::set_java_outer_classname(const char* value, size_t size) { +inline void FileOptions::set_java_outer_classname(const char* value, + size_t size) { set_has_java_outer_classname(); - java_outer_classname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + java_outer_classname_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.java_outer_classname) } inline ::std::string* FileOptions::mutable_java_outer_classname() { set_has_java_outer_classname(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.java_outer_classname) - return java_outer_classname_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return java_outer_classname_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* FileOptions::release_java_outer_classname() { // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.java_outer_classname) clear_has_java_outer_classname(); - return java_outer_classname_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return java_outer_classname_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void FileOptions::set_allocated_java_outer_classname(::std::string* java_outer_classname) { if (java_outer_classname != NULL) { @@ -7199,9 +8952,29 @@ inline void FileOptions::set_allocated_java_outer_classname(::std::string* java_ } else { clear_has_java_outer_classname(); } - java_outer_classname_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), java_outer_classname); + java_outer_classname_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), java_outer_classname, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_outer_classname) } +inline ::std::string* FileOptions::unsafe_arena_release_java_outer_classname() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.java_outer_classname) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_java_outer_classname(); + return java_outer_classname_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void FileOptions::unsafe_arena_set_allocated_java_outer_classname( + ::std::string* java_outer_classname) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (java_outer_classname != NULL) { + set_has_java_outer_classname(); + } else { + clear_has_java_outer_classname(); + } + java_outer_classname_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + java_outer_classname, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.java_outer_classname) +} // optional bool java_multiple_files = 10 [default = false]; inline bool FileOptions::has_java_multiple_files() const { @@ -7311,47 +9084,49 @@ inline void FileOptions::clear_has_go_package() { _has_bits_[0] &= ~0x00000004u; } inline void FileOptions::clear_go_package() { - go_package_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + go_package_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_go_package(); } inline const ::std::string& FileOptions::go_package() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.go_package) - return go_package_.GetNoArena(); + return go_package_.Get(); } inline void FileOptions::set_go_package(const ::std::string& value) { set_has_go_package(); - go_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + go_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.go_package) } #if LANG_CXX11 inline void FileOptions::set_go_package(::std::string&& value) { set_has_go_package(); - go_package_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + go_package_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.go_package) } #endif inline void FileOptions::set_go_package(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_go_package(); - go_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + go_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.go_package) } -inline void FileOptions::set_go_package(const char* value, size_t size) { +inline void FileOptions::set_go_package(const char* value, + size_t size) { set_has_go_package(); - go_package_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + go_package_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.go_package) } inline ::std::string* FileOptions::mutable_go_package() { set_has_go_package(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.go_package) - return go_package_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return go_package_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* FileOptions::release_go_package() { // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.go_package) clear_has_go_package(); - return go_package_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return go_package_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void FileOptions::set_allocated_go_package(::std::string* go_package) { if (go_package != NULL) { @@ -7359,9 +9134,29 @@ inline void FileOptions::set_allocated_go_package(::std::string* go_package) { } else { clear_has_go_package(); } - go_package_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), go_package); + go_package_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), go_package, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.go_package) } +inline ::std::string* FileOptions::unsafe_arena_release_go_package() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.go_package) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_go_package(); + return go_package_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void FileOptions::unsafe_arena_set_allocated_go_package( + ::std::string* go_package) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (go_package != NULL) { + set_has_go_package(); + } else { + clear_has_go_package(); + } + go_package_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + go_package, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.go_package) +} // optional bool cc_generic_services = 16 [default = false]; inline bool FileOptions::has_cc_generic_services() const { @@ -7518,47 +9313,49 @@ inline void FileOptions::clear_has_objc_class_prefix() { _has_bits_[0] &= ~0x00000008u; } inline void FileOptions::clear_objc_class_prefix() { - objc_class_prefix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + objc_class_prefix_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_objc_class_prefix(); } inline const ::std::string& FileOptions::objc_class_prefix() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.objc_class_prefix) - return objc_class_prefix_.GetNoArena(); + return objc_class_prefix_.Get(); } inline void FileOptions::set_objc_class_prefix(const ::std::string& value) { set_has_objc_class_prefix(); - objc_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + objc_class_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.objc_class_prefix) } #if LANG_CXX11 inline void FileOptions::set_objc_class_prefix(::std::string&& value) { set_has_objc_class_prefix(); - objc_class_prefix_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + objc_class_prefix_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.objc_class_prefix) } #endif inline void FileOptions::set_objc_class_prefix(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_objc_class_prefix(); - objc_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + objc_class_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.objc_class_prefix) } -inline void FileOptions::set_objc_class_prefix(const char* value, size_t size) { +inline void FileOptions::set_objc_class_prefix(const char* value, + size_t size) { set_has_objc_class_prefix(); - objc_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + objc_class_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.objc_class_prefix) } inline ::std::string* FileOptions::mutable_objc_class_prefix() { set_has_objc_class_prefix(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.objc_class_prefix) - return objc_class_prefix_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return objc_class_prefix_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* FileOptions::release_objc_class_prefix() { // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.objc_class_prefix) clear_has_objc_class_prefix(); - return objc_class_prefix_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return objc_class_prefix_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void FileOptions::set_allocated_objc_class_prefix(::std::string* objc_class_prefix) { if (objc_class_prefix != NULL) { @@ -7566,9 +9363,29 @@ inline void FileOptions::set_allocated_objc_class_prefix(::std::string* objc_cla } else { clear_has_objc_class_prefix(); } - objc_class_prefix_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), objc_class_prefix); + objc_class_prefix_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), objc_class_prefix, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.objc_class_prefix) } +inline ::std::string* FileOptions::unsafe_arena_release_objc_class_prefix() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.objc_class_prefix) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_objc_class_prefix(); + return objc_class_prefix_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void FileOptions::unsafe_arena_set_allocated_objc_class_prefix( + ::std::string* objc_class_prefix) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (objc_class_prefix != NULL) { + set_has_objc_class_prefix(); + } else { + clear_has_objc_class_prefix(); + } + objc_class_prefix_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + objc_class_prefix, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.objc_class_prefix) +} // optional string csharp_namespace = 37; inline bool FileOptions::has_csharp_namespace() const { @@ -7581,47 +9398,49 @@ inline void FileOptions::clear_has_csharp_namespace() { _has_bits_[0] &= ~0x00000010u; } inline void FileOptions::clear_csharp_namespace() { - csharp_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + csharp_namespace_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_csharp_namespace(); } inline const ::std::string& FileOptions::csharp_namespace() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.csharp_namespace) - return csharp_namespace_.GetNoArena(); + return csharp_namespace_.Get(); } inline void FileOptions::set_csharp_namespace(const ::std::string& value) { set_has_csharp_namespace(); - csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + csharp_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.csharp_namespace) } #if LANG_CXX11 inline void FileOptions::set_csharp_namespace(::std::string&& value) { set_has_csharp_namespace(); - csharp_namespace_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + csharp_namespace_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.csharp_namespace) } #endif inline void FileOptions::set_csharp_namespace(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_csharp_namespace(); - csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + csharp_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.csharp_namespace) } -inline void FileOptions::set_csharp_namespace(const char* value, size_t size) { +inline void FileOptions::set_csharp_namespace(const char* value, + size_t size) { set_has_csharp_namespace(); - csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + csharp_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.csharp_namespace) } inline ::std::string* FileOptions::mutable_csharp_namespace() { set_has_csharp_namespace(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.csharp_namespace) - return csharp_namespace_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return csharp_namespace_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* FileOptions::release_csharp_namespace() { // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.csharp_namespace) clear_has_csharp_namespace(); - return csharp_namespace_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return csharp_namespace_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void FileOptions::set_allocated_csharp_namespace(::std::string* csharp_namespace) { if (csharp_namespace != NULL) { @@ -7629,9 +9448,29 @@ inline void FileOptions::set_allocated_csharp_namespace(::std::string* csharp_na } else { clear_has_csharp_namespace(); } - csharp_namespace_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), csharp_namespace); + csharp_namespace_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), csharp_namespace, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace) } +inline ::std::string* FileOptions::unsafe_arena_release_csharp_namespace() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.csharp_namespace) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_csharp_namespace(); + return csharp_namespace_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void FileOptions::unsafe_arena_set_allocated_csharp_namespace( + ::std::string* csharp_namespace) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (csharp_namespace != NULL) { + set_has_csharp_namespace(); + } else { + clear_has_csharp_namespace(); + } + csharp_namespace_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + csharp_namespace, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.csharp_namespace) +} // optional string swift_prefix = 39; inline bool FileOptions::has_swift_prefix() const { @@ -7644,47 +9483,49 @@ inline void FileOptions::clear_has_swift_prefix() { _has_bits_[0] &= ~0x00000020u; } inline void FileOptions::clear_swift_prefix() { - swift_prefix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + swift_prefix_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_swift_prefix(); } inline const ::std::string& FileOptions::swift_prefix() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.swift_prefix) - return swift_prefix_.GetNoArena(); + return swift_prefix_.Get(); } inline void FileOptions::set_swift_prefix(const ::std::string& value) { set_has_swift_prefix(); - swift_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + swift_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.swift_prefix) } #if LANG_CXX11 inline void FileOptions::set_swift_prefix(::std::string&& value) { set_has_swift_prefix(); - swift_prefix_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + swift_prefix_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.swift_prefix) } #endif inline void FileOptions::set_swift_prefix(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_swift_prefix(); - swift_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + swift_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.swift_prefix) } -inline void FileOptions::set_swift_prefix(const char* value, size_t size) { +inline void FileOptions::set_swift_prefix(const char* value, + size_t size) { set_has_swift_prefix(); - swift_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + swift_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.swift_prefix) } inline ::std::string* FileOptions::mutable_swift_prefix() { set_has_swift_prefix(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.swift_prefix) - return swift_prefix_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return swift_prefix_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* FileOptions::release_swift_prefix() { // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.swift_prefix) clear_has_swift_prefix(); - return swift_prefix_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return swift_prefix_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void FileOptions::set_allocated_swift_prefix(::std::string* swift_prefix) { if (swift_prefix != NULL) { @@ -7692,9 +9533,29 @@ inline void FileOptions::set_allocated_swift_prefix(::std::string* swift_prefix) } else { clear_has_swift_prefix(); } - swift_prefix_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), swift_prefix); + swift_prefix_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), swift_prefix, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.swift_prefix) } +inline ::std::string* FileOptions::unsafe_arena_release_swift_prefix() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.swift_prefix) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_swift_prefix(); + return swift_prefix_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void FileOptions::unsafe_arena_set_allocated_swift_prefix( + ::std::string* swift_prefix) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (swift_prefix != NULL) { + set_has_swift_prefix(); + } else { + clear_has_swift_prefix(); + } + swift_prefix_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + swift_prefix, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.swift_prefix) +} // optional string php_class_prefix = 40; inline bool FileOptions::has_php_class_prefix() const { @@ -7707,47 +9568,49 @@ inline void FileOptions::clear_has_php_class_prefix() { _has_bits_[0] &= ~0x00000040u; } inline void FileOptions::clear_php_class_prefix() { - php_class_prefix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + php_class_prefix_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_php_class_prefix(); } inline const ::std::string& FileOptions::php_class_prefix() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_class_prefix) - return php_class_prefix_.GetNoArena(); + return php_class_prefix_.Get(); } inline void FileOptions::set_php_class_prefix(const ::std::string& value) { set_has_php_class_prefix(); - php_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + php_class_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_class_prefix) } #if LANG_CXX11 inline void FileOptions::set_php_class_prefix(::std::string&& value) { set_has_php_class_prefix(); - php_class_prefix_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + php_class_prefix_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.php_class_prefix) } #endif inline void FileOptions::set_php_class_prefix(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_php_class_prefix(); - php_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + php_class_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.php_class_prefix) } -inline void FileOptions::set_php_class_prefix(const char* value, size_t size) { +inline void FileOptions::set_php_class_prefix(const char* value, + size_t size) { set_has_php_class_prefix(); - php_class_prefix_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + php_class_prefix_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.php_class_prefix) } inline ::std::string* FileOptions::mutable_php_class_prefix() { set_has_php_class_prefix(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_class_prefix) - return php_class_prefix_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return php_class_prefix_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* FileOptions::release_php_class_prefix() { // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_class_prefix) clear_has_php_class_prefix(); - return php_class_prefix_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return php_class_prefix_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void FileOptions::set_allocated_php_class_prefix(::std::string* php_class_prefix) { if (php_class_prefix != NULL) { @@ -7755,9 +9618,29 @@ inline void FileOptions::set_allocated_php_class_prefix(::std::string* php_class } else { clear_has_php_class_prefix(); } - php_class_prefix_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), php_class_prefix); + php_class_prefix_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), php_class_prefix, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_class_prefix) } +inline ::std::string* FileOptions::unsafe_arena_release_php_class_prefix() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.php_class_prefix) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_php_class_prefix(); + return php_class_prefix_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void FileOptions::unsafe_arena_set_allocated_php_class_prefix( + ::std::string* php_class_prefix) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (php_class_prefix != NULL) { + set_has_php_class_prefix(); + } else { + clear_has_php_class_prefix(); + } + php_class_prefix_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + php_class_prefix, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.php_class_prefix) +} // optional string php_namespace = 41; inline bool FileOptions::has_php_namespace() const { @@ -7770,47 +9653,49 @@ inline void FileOptions::clear_has_php_namespace() { _has_bits_[0] &= ~0x00000080u; } inline void FileOptions::clear_php_namespace() { - php_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + php_namespace_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_php_namespace(); } inline const ::std::string& FileOptions::php_namespace() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_namespace) - return php_namespace_.GetNoArena(); + return php_namespace_.Get(); } inline void FileOptions::set_php_namespace(const ::std::string& value) { set_has_php_namespace(); - php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + php_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_namespace) } #if LANG_CXX11 inline void FileOptions::set_php_namespace(::std::string&& value) { set_has_php_namespace(); - php_namespace_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + php_namespace_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.php_namespace) } #endif inline void FileOptions::set_php_namespace(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_php_namespace(); - php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + php_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.php_namespace) } -inline void FileOptions::set_php_namespace(const char* value, size_t size) { +inline void FileOptions::set_php_namespace(const char* value, + size_t size) { set_has_php_namespace(); - php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + php_namespace_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.php_namespace) } inline ::std::string* FileOptions::mutable_php_namespace() { set_has_php_namespace(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_namespace) - return php_namespace_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return php_namespace_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* FileOptions::release_php_namespace() { // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_namespace) clear_has_php_namespace(); - return php_namespace_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return php_namespace_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void FileOptions::set_allocated_php_namespace(::std::string* php_namespace) { if (php_namespace != NULL) { @@ -7818,9 +9703,29 @@ inline void FileOptions::set_allocated_php_namespace(::std::string* php_namespac } else { clear_has_php_namespace(); } - php_namespace_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), php_namespace); + php_namespace_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), php_namespace, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_namespace) } +inline ::std::string* FileOptions::unsafe_arena_release_php_namespace() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.php_namespace) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_php_namespace(); + return php_namespace_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void FileOptions::unsafe_arena_set_allocated_php_namespace( + ::std::string* php_namespace) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (php_namespace != NULL) { + set_has_php_namespace(); + } else { + clear_has_php_namespace(); + } + php_namespace_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + php_namespace, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.php_namespace) +} // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int FileOptions::uninterpreted_option_size() const { @@ -8492,47 +10397,49 @@ inline void UninterpretedOption_NamePart::clear_has_name_part() { _has_bits_[0] &= ~0x00000001u; } inline void UninterpretedOption_NamePart::clear_name_part() { - name_part_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + name_part_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_name_part(); } inline const ::std::string& UninterpretedOption_NamePart::name_part() const { // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.NamePart.name_part) - return name_part_.GetNoArena(); + return name_part_.Get(); } inline void UninterpretedOption_NamePart::set_name_part(const ::std::string& value) { set_has_name_part(); - name_part_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + name_part_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.NamePart.name_part) } #if LANG_CXX11 inline void UninterpretedOption_NamePart::set_name_part(::std::string&& value) { set_has_name_part(); - name_part_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + name_part_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.NamePart.name_part) } #endif inline void UninterpretedOption_NamePart::set_name_part(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_name_part(); - name_part_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + name_part_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.NamePart.name_part) } -inline void UninterpretedOption_NamePart::set_name_part(const char* value, size_t size) { +inline void UninterpretedOption_NamePart::set_name_part(const char* value, + size_t size) { set_has_name_part(); - name_part_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + name_part_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.NamePart.name_part) } inline ::std::string* UninterpretedOption_NamePart::mutable_name_part() { set_has_name_part(); // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.NamePart.name_part) - return name_part_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return name_part_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* UninterpretedOption_NamePart::release_name_part() { // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.NamePart.name_part) clear_has_name_part(); - return name_part_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return name_part_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void UninterpretedOption_NamePart::set_allocated_name_part(::std::string* name_part) { if (name_part != NULL) { @@ -8540,9 +10447,29 @@ inline void UninterpretedOption_NamePart::set_allocated_name_part(::std::string* } else { clear_has_name_part(); } - name_part_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name_part); + name_part_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name_part, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.NamePart.name_part) } +inline ::std::string* UninterpretedOption_NamePart::unsafe_arena_release_name_part() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.UninterpretedOption.NamePart.name_part) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_name_part(); + return name_part_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void UninterpretedOption_NamePart::unsafe_arena_set_allocated_name_part( + ::std::string* name_part) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (name_part != NULL) { + set_has_name_part(); + } else { + clear_has_name_part(); + } + name_part_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + name_part, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.UninterpretedOption.NamePart.name_part) +} // required bool is_extension = 2; inline bool UninterpretedOption_NamePart::has_is_extension() const { @@ -8613,47 +10540,49 @@ inline void UninterpretedOption::clear_has_identifier_value() { _has_bits_[0] &= ~0x00000001u; } inline void UninterpretedOption::clear_identifier_value() { - identifier_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + identifier_value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_identifier_value(); } inline const ::std::string& UninterpretedOption::identifier_value() const { // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.identifier_value) - return identifier_value_.GetNoArena(); + return identifier_value_.Get(); } inline void UninterpretedOption::set_identifier_value(const ::std::string& value) { set_has_identifier_value(); - identifier_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + identifier_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.identifier_value) } #if LANG_CXX11 inline void UninterpretedOption::set_identifier_value(::std::string&& value) { set_has_identifier_value(); - identifier_value_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + identifier_value_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.identifier_value) } #endif inline void UninterpretedOption::set_identifier_value(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_identifier_value(); - identifier_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + identifier_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.identifier_value) } -inline void UninterpretedOption::set_identifier_value(const char* value, size_t size) { +inline void UninterpretedOption::set_identifier_value(const char* value, + size_t size) { set_has_identifier_value(); - identifier_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + identifier_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.identifier_value) } inline ::std::string* UninterpretedOption::mutable_identifier_value() { set_has_identifier_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.identifier_value) - return identifier_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return identifier_value_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* UninterpretedOption::release_identifier_value() { // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.identifier_value) clear_has_identifier_value(); - return identifier_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return identifier_value_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void UninterpretedOption::set_allocated_identifier_value(::std::string* identifier_value) { if (identifier_value != NULL) { @@ -8661,9 +10590,29 @@ inline void UninterpretedOption::set_allocated_identifier_value(::std::string* i } else { clear_has_identifier_value(); } - identifier_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), identifier_value); + identifier_value_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), identifier_value, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.identifier_value) } +inline ::std::string* UninterpretedOption::unsafe_arena_release_identifier_value() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.UninterpretedOption.identifier_value) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_identifier_value(); + return identifier_value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void UninterpretedOption::unsafe_arena_set_allocated_identifier_value( + ::std::string* identifier_value) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (identifier_value != NULL) { + set_has_identifier_value(); + } else { + clear_has_identifier_value(); + } + identifier_value_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + identifier_value, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.UninterpretedOption.identifier_value) +} // optional uint64 positive_int_value = 4; inline bool UninterpretedOption::has_positive_int_value() const { @@ -8748,47 +10697,49 @@ inline void UninterpretedOption::clear_has_string_value() { _has_bits_[0] &= ~0x00000002u; } inline void UninterpretedOption::clear_string_value() { - string_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + string_value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_string_value(); } inline const ::std::string& UninterpretedOption::string_value() const { // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.string_value) - return string_value_.GetNoArena(); + return string_value_.Get(); } inline void UninterpretedOption::set_string_value(const ::std::string& value) { set_has_string_value(); - string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + string_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.string_value) } #if LANG_CXX11 inline void UninterpretedOption::set_string_value(::std::string&& value) { set_has_string_value(); - string_value_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + string_value_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.string_value) } #endif inline void UninterpretedOption::set_string_value(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_string_value(); - string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + string_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.string_value) } -inline void UninterpretedOption::set_string_value(const void* value, size_t size) { +inline void UninterpretedOption::set_string_value(const void* value, + size_t size) { set_has_string_value(); - string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + string_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.string_value) } inline ::std::string* UninterpretedOption::mutable_string_value() { set_has_string_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.string_value) - return string_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return string_value_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* UninterpretedOption::release_string_value() { // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.string_value) clear_has_string_value(); - return string_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return string_value_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void UninterpretedOption::set_allocated_string_value(::std::string* string_value) { if (string_value != NULL) { @@ -8796,9 +10747,29 @@ inline void UninterpretedOption::set_allocated_string_value(::std::string* strin } else { clear_has_string_value(); } - string_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), string_value); + string_value_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), string_value, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.string_value) } +inline ::std::string* UninterpretedOption::unsafe_arena_release_string_value() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.UninterpretedOption.string_value) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_string_value(); + return string_value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void UninterpretedOption::unsafe_arena_set_allocated_string_value( + ::std::string* string_value) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (string_value != NULL) { + set_has_string_value(); + } else { + clear_has_string_value(); + } + string_value_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + string_value, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.UninterpretedOption.string_value) +} // optional string aggregate_value = 8; inline bool UninterpretedOption::has_aggregate_value() const { @@ -8811,47 +10782,49 @@ inline void UninterpretedOption::clear_has_aggregate_value() { _has_bits_[0] &= ~0x00000004u; } inline void UninterpretedOption::clear_aggregate_value() { - aggregate_value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + aggregate_value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_aggregate_value(); } inline const ::std::string& UninterpretedOption::aggregate_value() const { // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.aggregate_value) - return aggregate_value_.GetNoArena(); + return aggregate_value_.Get(); } inline void UninterpretedOption::set_aggregate_value(const ::std::string& value) { set_has_aggregate_value(); - aggregate_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + aggregate_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.aggregate_value) } #if LANG_CXX11 inline void UninterpretedOption::set_aggregate_value(::std::string&& value) { set_has_aggregate_value(); - aggregate_value_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + aggregate_value_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.UninterpretedOption.aggregate_value) } #endif inline void UninterpretedOption::set_aggregate_value(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_aggregate_value(); - aggregate_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + aggregate_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.UninterpretedOption.aggregate_value) } -inline void UninterpretedOption::set_aggregate_value(const char* value, size_t size) { +inline void UninterpretedOption::set_aggregate_value(const char* value, + size_t size) { set_has_aggregate_value(); - aggregate_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + aggregate_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.aggregate_value) } inline ::std::string* UninterpretedOption::mutable_aggregate_value() { set_has_aggregate_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.aggregate_value) - return aggregate_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return aggregate_value_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* UninterpretedOption::release_aggregate_value() { // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.aggregate_value) clear_has_aggregate_value(); - return aggregate_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return aggregate_value_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void UninterpretedOption::set_allocated_aggregate_value(::std::string* aggregate_value) { if (aggregate_value != NULL) { @@ -8859,9 +10832,29 @@ inline void UninterpretedOption::set_allocated_aggregate_value(::std::string* ag } else { clear_has_aggregate_value(); } - aggregate_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), aggregate_value); + aggregate_value_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), aggregate_value, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.aggregate_value) } +inline ::std::string* UninterpretedOption::unsafe_arena_release_aggregate_value() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.UninterpretedOption.aggregate_value) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_aggregate_value(); + return aggregate_value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void UninterpretedOption::unsafe_arena_set_allocated_aggregate_value( + ::std::string* aggregate_value) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (aggregate_value != NULL) { + set_has_aggregate_value(); + } else { + clear_has_aggregate_value(); + } + aggregate_value_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + aggregate_value, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.UninterpretedOption.aggregate_value) +} // ------------------------------------------------------------------- @@ -8938,47 +10931,49 @@ inline void SourceCodeInfo_Location::clear_has_leading_comments() { _has_bits_[0] &= ~0x00000001u; } inline void SourceCodeInfo_Location::clear_leading_comments() { - leading_comments_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + leading_comments_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_leading_comments(); } inline const ::std::string& SourceCodeInfo_Location::leading_comments() const { // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.leading_comments) - return leading_comments_.GetNoArena(); + return leading_comments_.Get(); } inline void SourceCodeInfo_Location::set_leading_comments(const ::std::string& value) { set_has_leading_comments(); - leading_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + leading_comments_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_comments) } #if LANG_CXX11 inline void SourceCodeInfo_Location::set_leading_comments(::std::string&& value) { set_has_leading_comments(); - leading_comments_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + leading_comments_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.SourceCodeInfo.Location.leading_comments) } #endif inline void SourceCodeInfo_Location::set_leading_comments(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_leading_comments(); - leading_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + leading_comments_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.SourceCodeInfo.Location.leading_comments) } -inline void SourceCodeInfo_Location::set_leading_comments(const char* value, size_t size) { +inline void SourceCodeInfo_Location::set_leading_comments(const char* value, + size_t size) { set_has_leading_comments(); - leading_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + leading_comments_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceCodeInfo.Location.leading_comments) } inline ::std::string* SourceCodeInfo_Location::mutable_leading_comments() { set_has_leading_comments(); // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.leading_comments) - return leading_comments_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return leading_comments_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* SourceCodeInfo_Location::release_leading_comments() { // @@protoc_insertion_point(field_release:google.protobuf.SourceCodeInfo.Location.leading_comments) clear_has_leading_comments(); - return leading_comments_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return leading_comments_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void SourceCodeInfo_Location::set_allocated_leading_comments(::std::string* leading_comments) { if (leading_comments != NULL) { @@ -8986,9 +10981,29 @@ inline void SourceCodeInfo_Location::set_allocated_leading_comments(::std::strin } else { clear_has_leading_comments(); } - leading_comments_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), leading_comments); + leading_comments_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), leading_comments, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.leading_comments) } +inline ::std::string* SourceCodeInfo_Location::unsafe_arena_release_leading_comments() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.SourceCodeInfo.Location.leading_comments) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_leading_comments(); + return leading_comments_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void SourceCodeInfo_Location::unsafe_arena_set_allocated_leading_comments( + ::std::string* leading_comments) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (leading_comments != NULL) { + set_has_leading_comments(); + } else { + clear_has_leading_comments(); + } + leading_comments_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + leading_comments, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.SourceCodeInfo.Location.leading_comments) +} // optional string trailing_comments = 4; inline bool SourceCodeInfo_Location::has_trailing_comments() const { @@ -9001,47 +11016,49 @@ inline void SourceCodeInfo_Location::clear_has_trailing_comments() { _has_bits_[0] &= ~0x00000002u; } inline void SourceCodeInfo_Location::clear_trailing_comments() { - trailing_comments_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + trailing_comments_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_trailing_comments(); } inline const ::std::string& SourceCodeInfo_Location::trailing_comments() const { // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.trailing_comments) - return trailing_comments_.GetNoArena(); + return trailing_comments_.Get(); } inline void SourceCodeInfo_Location::set_trailing_comments(const ::std::string& value) { set_has_trailing_comments(); - trailing_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + trailing_comments_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.trailing_comments) } #if LANG_CXX11 inline void SourceCodeInfo_Location::set_trailing_comments(::std::string&& value) { set_has_trailing_comments(); - trailing_comments_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + trailing_comments_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.SourceCodeInfo.Location.trailing_comments) } #endif inline void SourceCodeInfo_Location::set_trailing_comments(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_trailing_comments(); - trailing_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + trailing_comments_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.SourceCodeInfo.Location.trailing_comments) } -inline void SourceCodeInfo_Location::set_trailing_comments(const char* value, size_t size) { +inline void SourceCodeInfo_Location::set_trailing_comments(const char* value, + size_t size) { set_has_trailing_comments(); - trailing_comments_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + trailing_comments_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceCodeInfo.Location.trailing_comments) } inline ::std::string* SourceCodeInfo_Location::mutable_trailing_comments() { set_has_trailing_comments(); // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.trailing_comments) - return trailing_comments_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return trailing_comments_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* SourceCodeInfo_Location::release_trailing_comments() { // @@protoc_insertion_point(field_release:google.protobuf.SourceCodeInfo.Location.trailing_comments) clear_has_trailing_comments(); - return trailing_comments_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return trailing_comments_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void SourceCodeInfo_Location::set_allocated_trailing_comments(::std::string* trailing_comments) { if (trailing_comments != NULL) { @@ -9049,9 +11066,29 @@ inline void SourceCodeInfo_Location::set_allocated_trailing_comments(::std::stri } else { clear_has_trailing_comments(); } - trailing_comments_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), trailing_comments); + trailing_comments_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), trailing_comments, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.trailing_comments) } +inline ::std::string* SourceCodeInfo_Location::unsafe_arena_release_trailing_comments() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.SourceCodeInfo.Location.trailing_comments) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_trailing_comments(); + return trailing_comments_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void SourceCodeInfo_Location::unsafe_arena_set_allocated_trailing_comments( + ::std::string* trailing_comments) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (trailing_comments != NULL) { + set_has_trailing_comments(); + } else { + clear_has_trailing_comments(); + } + trailing_comments_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + trailing_comments, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.SourceCodeInfo.Location.trailing_comments) +} // repeated string leading_detached_comments = 6; inline int SourceCodeInfo_Location::leading_detached_comments_size() const { @@ -9201,47 +11238,49 @@ inline void GeneratedCodeInfo_Annotation::clear_has_source_file() { _has_bits_[0] &= ~0x00000001u; } inline void GeneratedCodeInfo_Annotation::clear_source_file() { - source_file_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + source_file_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); clear_has_source_file(); } inline const ::std::string& GeneratedCodeInfo_Annotation::source_file() const { // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.source_file) - return source_file_.GetNoArena(); + return source_file_.Get(); } inline void GeneratedCodeInfo_Annotation::set_source_file(const ::std::string& value) { set_has_source_file(); - source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + source_file_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.source_file) } #if LANG_CXX11 inline void GeneratedCodeInfo_Annotation::set_source_file(::std::string&& value) { set_has_source_file(); - source_file_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); + source_file_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_rvalue:google.protobuf.GeneratedCodeInfo.Annotation.source_file) } #endif inline void GeneratedCodeInfo_Annotation::set_source_file(const char* value) { GOOGLE_DCHECK(value != NULL); set_has_source_file(); - source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + source_file_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_char:google.protobuf.GeneratedCodeInfo.Annotation.source_file) } -inline void GeneratedCodeInfo_Annotation::set_source_file(const char* value, size_t size) { +inline void GeneratedCodeInfo_Annotation::set_source_file(const char* value, + size_t size) { set_has_source_file(); - source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); + source_file_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.GeneratedCodeInfo.Annotation.source_file) } inline ::std::string* GeneratedCodeInfo_Annotation::mutable_source_file() { set_has_source_file(); // @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.Annotation.source_file) - return source_file_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return source_file_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline ::std::string* GeneratedCodeInfo_Annotation::release_source_file() { // @@protoc_insertion_point(field_release:google.protobuf.GeneratedCodeInfo.Annotation.source_file) clear_has_source_file(); - return source_file_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return source_file_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } inline void GeneratedCodeInfo_Annotation::set_allocated_source_file(::std::string* source_file) { if (source_file != NULL) { @@ -9249,9 +11288,29 @@ inline void GeneratedCodeInfo_Annotation::set_allocated_source_file(::std::strin } else { clear_has_source_file(); } - source_file_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), source_file); + source_file_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), source_file, + GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.GeneratedCodeInfo.Annotation.source_file) } +inline ::std::string* GeneratedCodeInfo_Annotation::unsafe_arena_release_source_file() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.GeneratedCodeInfo.Annotation.source_file) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + clear_has_source_file(); + return source_file_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} +inline void GeneratedCodeInfo_Annotation::unsafe_arena_set_allocated_source_file( + ::std::string* source_file) { + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (source_file != NULL) { + set_has_source_file(); + } else { + clear_has_source_file(); + } + source_file_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + source_file, GetArenaNoVirtual()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.GeneratedCodeInfo.Annotation.source_file) +} // optional int32 begin = 3; inline bool GeneratedCodeInfo_Annotation::has_begin() const { @@ -9338,7 +11397,6 @@ GeneratedCodeInfo::annotation() const { #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ -#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // ------------------------------------------------------------------- // ------------------------------------------------------------------- @@ -9389,9 +11447,10 @@ GeneratedCodeInfo::annotation() const { // ------------------------------------------------------------------- +// ------------------------------------------------------------------- -// @@protoc_insertion_point(namespace_scope) +// @@protoc_insertion_point(namespace_scope) } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/descriptor.proto b/src/google/protobuf/descriptor.proto index 4d4fb378..8697a50d 100644 --- a/src/google/protobuf/descriptor.proto +++ b/src/google/protobuf/descriptor.proto @@ -45,6 +45,7 @@ option java_package = "com.google.protobuf"; option java_outer_classname = "DescriptorProtos"; option csharp_namespace = "Google.Protobuf.Reflection"; option objc_class_prefix = "GPB"; +option cc_enable_arenas = true; // descriptor.proto must be optimized for speed because reflection-based // algorithms don't work during bootstrapping. @@ -225,6 +226,26 @@ message EnumDescriptorProto { repeated EnumValueDescriptorProto value = 2; optional EnumOptions options = 3; + + // Range of reserved numeric values. Reserved values may not be used by + // entries in the same enum. Reserved ranges may not overlap. + // + // Note that this is distinct from DescriptorProto.ReservedRange in that it + // is inclusive such that it can appropriately represent the entire int32 + // domain. + message EnumReservedRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Inclusive. + } + + // Range of reserved numeric values. Reserved numeric values may not be used + // by enum values in the same enum declaration. Reserved ranges may not + // overlap. + repeated EnumReservedRange reserved_range = 4; + + // Reserved enum value names, which may not be reused. A given name may only + // be reserved once. + repeated string reserved_name = 5; } // Describes a value within an enum. @@ -396,10 +417,12 @@ message FileOptions { // determining the namespace. optional string php_namespace = 41; - // The parser stores options it doesn't recognize here. See above. + // The parser stores options it doesn't recognize here. + // See the documentation for the "Options" section above. repeated UninterpretedOption uninterpreted_option = 999; - // Clients can define custom options in extensions of this message. See above. + // Clients can define custom options in extensions of this message. + // See the documentation for the "Options" section above. extensions 1000 to max; reserved 38; diff --git a/src/google/protobuf/descriptor_database_unittest.cc b/src/google/protobuf/descriptor_database_unittest.cc index 7e81d70a..9d710886 100644 --- a/src/google/protobuf/descriptor_database_unittest.cc +++ b/src/google/protobuf/descriptor_database_unittest.cc @@ -247,6 +247,10 @@ TEST_P(DescriptorDatabaseTest, FindFileContainingSymbol) { FileDescriptorProto file; EXPECT_TRUE(database_->FindFileContainingSymbol("Foo.qux", &file)); EXPECT_EQ("foo.proto", file.name()); + // Non-existent field under a valid top level symbol can also be + // found. + EXPECT_TRUE(database_->FindFileContainingSymbol("Foo.none_field.none", + &file)); } { diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc index 75238931..6cca0ada 100644 --- a/src/google/protobuf/descriptor_unittest.cc +++ b/src/google/protobuf/descriptor_unittest.cc @@ -34,6 +34,7 @@ // // This file makes extensive use of RFC 3092. :) +#include <limits> #include <memory> #ifndef _SHARED_PTR_H #include <google/protobuf/stubs/shared_ptr.h> @@ -62,6 +63,7 @@ #include <google/protobuf/testing/googletest.h> #include <gtest/gtest.h> + namespace google { namespace protobuf { @@ -157,6 +159,14 @@ DescriptorProto::ReservedRange* AddReservedRange(DescriptorProto* parent, return result; } +EnumDescriptorProto::EnumReservedRange* AddReservedRange( + EnumDescriptorProto* parent, int start, int end) { + EnumDescriptorProto::EnumReservedRange* result = parent->add_reserved_range(); + result->set_start(start); + result->set_end(end); + return result; +} + EnumValueDescriptorProto* AddEnumValue(EnumDescriptorProto* enum_proto, const string& name, int number) { EnumValueDescriptorProto* result = enum_proto->add_value(); @@ -2047,6 +2057,137 @@ TEST_F(ReservedDescriptorTest, IsReservedName) { // =================================================================== +// Test reserved enum fields. +class ReservedEnumDescriptorTest : public testing::Test { + protected: + virtual void SetUp() { + // Build descriptors for the following definitions: + // + // enum Foo { + // BAR = 1; + // reserved 2, 9 to 11, 15; + // reserved "foo", "bar"; + // } + + FileDescriptorProto foo_file; + foo_file.set_name("foo.proto"); + + EnumDescriptorProto* foo = AddEnum(&foo_file, "Foo"); + EnumDescriptorProto* edge1 = AddEnum(&foo_file, "Edge1"); + EnumDescriptorProto* edge2 = AddEnum(&foo_file, "Edge2"); + + AddEnumValue(foo, "BAR", 4); + AddReservedRange(foo, -5, -3); + AddReservedRange(foo, -2, 1); + AddReservedRange(foo, 2, 3); + AddReservedRange(foo, 9, 12); + AddReservedRange(foo, 15, 16); + + foo->add_reserved_name("foo"); + foo->add_reserved_name("bar"); + + // Some additional edge cases that cover most or all of the range of enum + // values + + // Note: We use INT_MAX as the maximum reserved range upper bound, + // inclusive. + AddEnumValue(edge1, "EDGE1", 1); + AddReservedRange(edge1, 10, INT_MAX); + AddEnumValue(edge2, "EDGE2", 15); + AddReservedRange(edge2, INT_MIN, 10); + + // Build the descriptors and get the pointers. + foo_file_ = pool_.BuildFile(foo_file); + ASSERT_TRUE(foo_file_ != NULL); + + ASSERT_EQ(3, foo_file_->enum_type_count()); + foo_ = foo_file_->enum_type(0); + edge1_ = foo_file_->enum_type(1); + edge2_ = foo_file_->enum_type(2); + } + + DescriptorPool pool_; + const FileDescriptor* foo_file_; + const EnumDescriptor* foo_; + const EnumDescriptor* edge1_; + const EnumDescriptor* edge2_; +}; + +TEST_F(ReservedEnumDescriptorTest, ReservedRanges) { + ASSERT_EQ(5, foo_->reserved_range_count()); + + EXPECT_EQ(-5, foo_->reserved_range(0)->start); + EXPECT_EQ(-3, foo_->reserved_range(0)->end); + + EXPECT_EQ(-2, foo_->reserved_range(1)->start); + EXPECT_EQ(1, foo_->reserved_range(1)->end); + + EXPECT_EQ(2, foo_->reserved_range(2)->start); + EXPECT_EQ(3, foo_->reserved_range(2)->end); + + EXPECT_EQ(9, foo_->reserved_range(3)->start); + EXPECT_EQ(12, foo_->reserved_range(3)->end); + + EXPECT_EQ(15, foo_->reserved_range(4)->start); + EXPECT_EQ(16, foo_->reserved_range(4)->end); + + ASSERT_EQ(1, edge1_->reserved_range_count()); + EXPECT_EQ(10, edge1_->reserved_range(0)->start); + EXPECT_EQ(INT_MAX, edge1_->reserved_range(0)->end); + + ASSERT_EQ(1, edge2_->reserved_range_count()); + EXPECT_EQ(INT_MIN, edge2_->reserved_range(0)->start); + EXPECT_EQ(10, edge2_->reserved_range(0)->end); +} + +TEST_F(ReservedEnumDescriptorTest, IsReservedNumber) { + EXPECT_TRUE(foo_->IsReservedNumber(-5)); + EXPECT_TRUE(foo_->IsReservedNumber(-4)); + EXPECT_TRUE(foo_->IsReservedNumber(-3)); + EXPECT_TRUE(foo_->IsReservedNumber(-2)); + EXPECT_TRUE(foo_->IsReservedNumber(-1)); + EXPECT_TRUE(foo_->IsReservedNumber(0)); + EXPECT_TRUE(foo_->IsReservedNumber(1)); + EXPECT_TRUE (foo_->IsReservedNumber(2)); + EXPECT_TRUE(foo_->IsReservedNumber(3)); + EXPECT_FALSE(foo_->IsReservedNumber(8)); + EXPECT_TRUE (foo_->IsReservedNumber(9)); + EXPECT_TRUE (foo_->IsReservedNumber(10)); + EXPECT_TRUE (foo_->IsReservedNumber(11)); + EXPECT_TRUE(foo_->IsReservedNumber(12)); + EXPECT_FALSE(foo_->IsReservedNumber(13)); + EXPECT_FALSE(foo_->IsReservedNumber(13)); + EXPECT_FALSE(foo_->IsReservedNumber(14)); + EXPECT_TRUE (foo_->IsReservedNumber(15)); + EXPECT_TRUE(foo_->IsReservedNumber(16)); + EXPECT_FALSE(foo_->IsReservedNumber(17)); + + EXPECT_FALSE(edge1_->IsReservedNumber(9)); + EXPECT_TRUE(edge1_->IsReservedNumber(10)); + EXPECT_TRUE(edge1_->IsReservedNumber(INT_MAX - 1)); + EXPECT_TRUE(edge1_->IsReservedNumber(INT_MAX)); + + EXPECT_TRUE(edge2_->IsReservedNumber(INT_MIN)); + EXPECT_TRUE(edge2_->IsReservedNumber(9)); + EXPECT_TRUE(edge2_->IsReservedNumber(10)); + EXPECT_FALSE(edge2_->IsReservedNumber(11)); +} + +TEST_F(ReservedEnumDescriptorTest, ReservedNames) { + ASSERT_EQ(2, foo_->reserved_name_count()); + + EXPECT_EQ("foo", foo_->reserved_name(0)); + EXPECT_EQ("bar", foo_->reserved_name(1)); +} + +TEST_F(ReservedEnumDescriptorTest, IsReservedName) { + EXPECT_TRUE (foo_->IsReservedName("foo")); + EXPECT_TRUE (foo_->IsReservedName("bar")); + EXPECT_FALSE(foo_->IsReservedName("baz")); +} + +// =================================================================== + class MiscTest : public testing::Test { protected: // Function which makes a field descriptor of the given type. @@ -3774,6 +3915,138 @@ TEST_F(ValidationErrorTest, ReservedFieldsDebugString) { file->DebugString()); } +TEST_F(ValidationErrorTest, EnumReservedFieldError) { + BuildFileWithErrors( + "name: \"foo.proto\" " + "enum_type {" + " name: \"Foo\"" + " value { name:\"BAR\" number:15 }" + " reserved_range { start: 10 end: 20 }" + "}", + + "foo.proto: BAR: NUMBER: Enum value \"BAR\" uses reserved number 15.\n"); +} + +TEST_F(ValidationErrorTest, EnumNegativeReservedFieldError) { + BuildFileWithErrors( + "name: \"foo.proto\" " + "enum_type {" + " name: \"Foo\"" + " value { name:\"BAR\" number:-15 }" + " reserved_range { start: -20 end: -10 }" + "}", + + "foo.proto: BAR: NUMBER: Enum value \"BAR\" uses reserved number -15.\n"); +} + +TEST_F(ValidationErrorTest, EnumReservedRangeOverlap) { + BuildFileWithErrors( + "name: \"foo.proto\" " + "enum_type {" + " name: \"Foo\"" + " value { name:\"BAR\" number:0 }" + " reserved_range { start: 10 end: 20 }" + " reserved_range { start: 5 end: 15 }" + "}", + + "foo.proto: Foo: NUMBER: Reserved range 5 to 14" + " overlaps with already-defined range 10 to 19.\n"); +} + +TEST_F(ValidationErrorTest, EnumNegativeReservedRangeOverlap) { + BuildFileWithErrors( + "name: \"foo.proto\" " + "enum_type {" + " name: \"Foo\"" + " value { name:\"BAR\" number:0 }" + " reserved_range { start: -20 end: -10 }" + " reserved_range { start: -15 end: -5 }" + "}", + + "foo.proto: Foo: NUMBER: Reserved range -15 to -6" + " overlaps with already-defined range -20 to -11.\n"); +} + +TEST_F(ValidationErrorTest, EnumMixedReservedRangeOverlap) { + BuildFileWithErrors( + "name: \"foo.proto\" " + "enum_type {" + " name: \"Foo\"" + " value { name:\"BAR\" number:20 }" + " reserved_range { start: -20 end: 10 }" + " reserved_range { start: -15 end: 5 }" + "}", + + "foo.proto: Foo: NUMBER: Reserved range -15 to 4" + " overlaps with already-defined range -20 to 9.\n"); +} + +TEST_F(ValidationErrorTest, EnumReservedRangeStartGreaterThanEnd) { + BuildFileWithErrors( + "name: \"foo.proto\" " + "enum_type {" + " name: \"Foo\"" + " value { name:\"BAR\" number:20 }" + " reserved_range { start: 11 end: 10 }" + "}", + + "foo.proto: Foo: NUMBER: Reserved range end number must be greater" + " than start number.\n"); +} + +TEST_F(ValidationErrorTest, EnumReservedNameError) { + BuildFileWithErrors( + "name: \"foo.proto\" " + "enum_type {" + " name: \"Foo\"" + " value { name:\"FOO\" number:15 }" + " value { name:\"BAR\" number:15 }" + " reserved_name: \"FOO\"" + " reserved_name: \"BAR\"" + "}", + + "foo.proto: FOO: NAME: Enum value \"FOO\" is reserved.\n" + "foo.proto: BAR: NAME: Enum value \"BAR\" is reserved.\n"); +} + +TEST_F(ValidationErrorTest, EnumReservedNameRedundant) { + BuildFileWithErrors( + "name: \"foo.proto\" " + "enum_type {" + " name: \"Foo\"" + " value { name:\"FOO\" number:15 }" + " reserved_name: \"foo\"" + " reserved_name: \"foo\"" + "}", + + "foo.proto: foo: NAME: Enum value \"foo\" is reserved multiple times.\n"); +} + +TEST_F(ValidationErrorTest, EnumReservedFieldsDebugString) { + const FileDescriptor* file = BuildFile( + "name: \"foo.proto\" " + "enum_type {" + " name: \"Foo\"" + " value { name:\"FOO\" number:3 }" + " reserved_name: \"foo\"" + " reserved_name: \"bar\"" + " reserved_range { start: -6 end: -6 }" + " reserved_range { start: -5 end: -4 }" + " reserved_range { start: -1 end: 1 }" + " reserved_range { start: 5 end: 5 }" + " reserved_range { start: 10 end: 19 }" + "}"); + + ASSERT_EQ( + "syntax = \"proto2\";\n\n" + "enum Foo {\n" + " FOO = 3;\n" + " reserved -6, -5 to -4, -1 to 1, 5, 10 to 19;\n" + " reserved \"foo\", \"bar\";\n" + "}\n\n", + file->DebugString()); +} + TEST_F(ValidationErrorTest, InvalidDefaults) { BuildFileWithErrors( "name: \"foo.proto\" " diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc index ad0eeb45..0a8aad48 100644 --- a/src/google/protobuf/duration.pb.cc +++ b/src/google/protobuf/duration.pb.cc @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/duration.proto -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #include <google/protobuf/duration.pb.h> #include <algorithm> @@ -15,58 +14,61 @@ #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> +// This is a temporary google only hack +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS +#include "third_party/protobuf/version.h" +#endif // @@protoc_insertion_point(includes) - namespace google { namespace protobuf { class DurationDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<Duration> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<Duration> + _instance; } _Duration_default_instance_; - +} // namespace protobuf +} // namespace google namespace protobuf_google_2fprotobuf_2fduration_2eproto { +void InitDefaultsDurationImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_Duration_default_instance_; + new (ptr) ::google::protobuf::Duration(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::Duration::InitAsDefaultInstance(); +} -namespace { +void InitDefaultsDuration() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsDurationImpl); +} ::google::protobuf::Metadata file_level_metadata[1]; -} // namespace - -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField - const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0}, -}; - -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField - const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - ::google::protobuf::internal::AuxillaryParseTableField(), -}; -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const - TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, -}; - -const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { +const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Duration, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Duration, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Duration, seconds_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Duration, nanos_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Duration, seconds_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Duration, nanos_), }; -static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(Duration)}, +static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, sizeof(::google::protobuf::Duration)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { - reinterpret_cast<const ::google::protobuf::Message*>(&_Duration_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Duration_default_instance_), }; -namespace { - void protobuf_AssignDescriptors() { AddDescriptors(); ::google::protobuf::MessageFactory* factory = NULL; @@ -80,29 +82,15 @@ void protobuf_AssignDescriptorsOnce() { ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); } -void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; +void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1); } -} // namespace -void TableStruct::InitDefaultsImpl() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::internal::InitProtobufDefaults(); - _Duration_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_Duration_default_instance_);} - -void InitDefaults() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl); -} -namespace { void AddDescriptorsImpl() { InitDefaults(); - static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { "\n\036google/protobuf/duration.proto\022\017google" ".protobuf\"*\n\010Duration\022\017\n\007seconds\030\001 \001(\003\022\r" "\n\005nanos\030\002 \001(\005B|\n\023com.google.protobufB\rDu" @@ -115,7 +103,6 @@ void AddDescriptorsImpl() { ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/duration.proto", &protobuf_RegisterTypes); } -} // anonymous namespace void AddDescriptors() { static GOOGLE_PROTOBUF_DECLARE_ONCE(once); @@ -127,12 +114,14 @@ struct StaticDescriptorInitializer { AddDescriptors(); } } static_descriptor_initializer; - } // namespace protobuf_google_2fprotobuf_2fduration_2eproto - +namespace google { +namespace protobuf { // =================================================================== +void Duration::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int Duration::kSecondsFieldNumber; const int Duration::kNanosFieldNumber; @@ -141,7 +130,7 @@ const int Duration::kNanosFieldNumber; Duration::Duration() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fduration_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fduration_2eproto::InitDefaultsDuration(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.Duration) @@ -149,7 +138,7 @@ Duration::Duration() Duration::Duration(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena) { - protobuf_google_2fprotobuf_2fduration_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fduration_2eproto::InitDefaultsDuration(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Duration) @@ -178,12 +167,7 @@ Duration::~Duration() { } void Duration::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } void Duration::ArenaDtor(void* object) { @@ -198,12 +182,12 @@ void Duration::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* Duration::descriptor() { - protobuf_google_2fprotobuf_2fduration_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fduration_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fduration_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fduration_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const Duration& Duration::default_instance() { - protobuf_google_2fprotobuf_2fduration_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fduration_2eproto::InitDefaultsDuration(); return *internal_default_instance(); } @@ -436,44 +420,11 @@ void Duration::InternalSwap(Duration* other) { ::google::protobuf::Metadata Duration::GetMetadata() const { protobuf_google_2fprotobuf_2fduration_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fduration_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fduration_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// Duration - -// int64 seconds = 1; -void Duration::clear_seconds() { - seconds_ = GOOGLE_LONGLONG(0); -} -::google::protobuf::int64 Duration::seconds() const { - // @@protoc_insertion_point(field_get:google.protobuf.Duration.seconds) - return seconds_; -} -void Duration::set_seconds(::google::protobuf::int64 value) { - - seconds_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Duration.seconds) -} - -// int32 nanos = 2; -void Duration::clear_nanos() { - nanos_ = 0; -} -::google::protobuf::int32 Duration::nanos() const { - // @@protoc_insertion_point(field_get:google.protobuf.Duration.nanos) - return nanos_; -} -void Duration::set_nanos(::google::protobuf::int32 value) { - - nanos_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Duration.nanos) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h index bed112b5..0489df43 100644 --- a/src/google/protobuf/duration.pb.h +++ b/src/google/protobuf/duration.pb.h @@ -30,31 +30,33 @@ #include <google/protobuf/extension_set.h> // IWYU pragma: export #include <google/protobuf/unknown_field_set.h> // @@protoc_insertion_point(includes) -namespace google { -namespace protobuf { -class Duration; -class DurationDefaultTypeInternal; -LIBPROTOBUF_EXPORT extern DurationDefaultTypeInternal _Duration_default_instance_; -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { namespace protobuf_google_2fprotobuf_2fduration_2eproto { -// Internal implementation detail -- do not call these. +// Internal implementation detail -- do not use these members. struct LIBPROTOBUF_EXPORT TableStruct { static const ::google::protobuf::internal::ParseTableField entries[]; static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; - static const ::google::protobuf::internal::ParseTable schema[]; - static const ::google::protobuf::uint32 offsets[]; + static const ::google::protobuf::internal::ParseTable schema[1]; static const ::google::protobuf::internal::FieldMetadata field_metadata[]; static const ::google::protobuf::internal::SerializationTable serialization_table[]; - static void InitDefaultsImpl(); + static const ::google::protobuf::uint32 offsets[]; }; void LIBPROTOBUF_EXPORT AddDescriptors(); -void LIBPROTOBUF_EXPORT InitDefaults(); +void LIBPROTOBUF_EXPORT InitDefaultsDurationImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsDuration(); +inline void LIBPROTOBUF_EXPORT InitDefaults() { + InitDefaultsDuration(); +} } // namespace protobuf_google_2fprotobuf_2fduration_2eproto +namespace google { +namespace protobuf { +class Duration; +class DurationDefaultTypeInternal; +LIBPROTOBUF_EXPORT extern DurationDefaultTypeInternal _Duration_default_instance_; +} // namespace protobuf +} // namespace google +namespace google { +namespace protobuf { // =================================================================== @@ -93,6 +95,7 @@ class LIBPROTOBUF_EXPORT Duration : public ::google::protobuf::Message /* @@prot static const ::google::protobuf::Descriptor* descriptor(); static const Duration& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Duration* internal_default_instance() { return reinterpret_cast<const Duration*>( &_Duration_default_instance_); @@ -173,14 +176,14 @@ class LIBPROTOBUF_EXPORT Duration : public ::google::protobuf::Message /* @@prot ::google::protobuf::int64 seconds_; ::google::protobuf::int32 nanos_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2fduration_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fduration_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fduration_2eproto::InitDefaultsDurationImpl(); }; // =================================================================== // =================================================================== -#if !PROTOBUF_INLINE_NOT_IN_HEADERS #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" @@ -218,11 +221,9 @@ inline void Duration::set_nanos(::google::protobuf::int32 value) { #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ -#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/empty.pb.cc b/src/google/protobuf/empty.pb.cc index 6d2ea338..caa019e8 100644 --- a/src/google/protobuf/empty.pb.cc +++ b/src/google/protobuf/empty.pb.cc @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/empty.proto -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #include <google/protobuf/empty.pb.h> #include <algorithm> @@ -15,56 +14,59 @@ #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> +// This is a temporary google only hack +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS +#include "third_party/protobuf/version.h" +#endif // @@protoc_insertion_point(includes) - namespace google { namespace protobuf { class EmptyDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<Empty> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<Empty> + _instance; } _Empty_default_instance_; - +} // namespace protobuf +} // namespace google namespace protobuf_google_2fprotobuf_2fempty_2eproto { +void InitDefaultsEmptyImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_Empty_default_instance_; + new (ptr) ::google::protobuf::Empty(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::Empty::InitAsDefaultInstance(); +} -namespace { +void InitDefaultsEmpty() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsEmptyImpl); +} ::google::protobuf::Metadata file_level_metadata[1]; -} // namespace - -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField - const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0}, -}; - -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField - const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - ::google::protobuf::internal::AuxillaryParseTableField(), -}; -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const - TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, -}; - -const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { +const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Empty, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Empty, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ }; -static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(Empty)}, +static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, sizeof(::google::protobuf::Empty)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { - reinterpret_cast<const ::google::protobuf::Message*>(&_Empty_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Empty_default_instance_), }; -namespace { - void protobuf_AssignDescriptors() { AddDescriptors(); ::google::protobuf::MessageFactory* factory = NULL; @@ -78,29 +80,15 @@ void protobuf_AssignDescriptorsOnce() { ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); } -void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; +void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1); } -} // namespace -void TableStruct::InitDefaultsImpl() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::internal::InitProtobufDefaults(); - _Empty_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_Empty_default_instance_);} - -void InitDefaults() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl); -} -namespace { void AddDescriptorsImpl() { InitDefaults(); - static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { "\n\033google/protobuf/empty.proto\022\017google.pr" "otobuf\"\007\n\005EmptyBv\n\023com.google.protobufB\n" "EmptyProtoP\001Z\'github.com/golang/protobuf" @@ -112,7 +100,6 @@ void AddDescriptorsImpl() { ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/empty.proto", &protobuf_RegisterTypes); } -} // anonymous namespace void AddDescriptors() { static GOOGLE_PROTOBUF_DECLARE_ONCE(once); @@ -124,19 +111,21 @@ struct StaticDescriptorInitializer { AddDescriptors(); } } static_descriptor_initializer; - } // namespace protobuf_google_2fprotobuf_2fempty_2eproto - +namespace google { +namespace protobuf { // =================================================================== +void Empty::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 Empty::Empty() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fempty_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fempty_2eproto::InitDefaultsEmpty(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.Empty) @@ -144,7 +133,7 @@ Empty::Empty() Empty::Empty(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena) { - protobuf_google_2fprotobuf_2fempty_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fempty_2eproto::InitDefaultsEmpty(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Empty) @@ -167,12 +156,7 @@ Empty::~Empty() { } void Empty::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } void Empty::ArenaDtor(void* object) { @@ -187,12 +171,12 @@ void Empty::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* Empty::descriptor() { - protobuf_google_2fprotobuf_2fempty_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fempty_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fempty_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fempty_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const Empty& Empty::default_instance() { - protobuf_google_2fprotobuf_2fempty_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fempty_2eproto::InitDefaultsEmpty(); return *internal_default_instance(); } @@ -347,16 +331,11 @@ void Empty::InternalSwap(Empty* other) { ::google::protobuf::Metadata Empty::GetMetadata() const { protobuf_google_2fprotobuf_2fempty_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fempty_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fempty_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// Empty - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h index 1c6e53e6..1d7c5887 100644 --- a/src/google/protobuf/empty.pb.h +++ b/src/google/protobuf/empty.pb.h @@ -30,31 +30,33 @@ #include <google/protobuf/extension_set.h> // IWYU pragma: export #include <google/protobuf/unknown_field_set.h> // @@protoc_insertion_point(includes) -namespace google { -namespace protobuf { -class Empty; -class EmptyDefaultTypeInternal; -LIBPROTOBUF_EXPORT extern EmptyDefaultTypeInternal _Empty_default_instance_; -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { namespace protobuf_google_2fprotobuf_2fempty_2eproto { -// Internal implementation detail -- do not call these. +// Internal implementation detail -- do not use these members. struct LIBPROTOBUF_EXPORT TableStruct { static const ::google::protobuf::internal::ParseTableField entries[]; static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; - static const ::google::protobuf::internal::ParseTable schema[]; - static const ::google::protobuf::uint32 offsets[]; + static const ::google::protobuf::internal::ParseTable schema[1]; static const ::google::protobuf::internal::FieldMetadata field_metadata[]; static const ::google::protobuf::internal::SerializationTable serialization_table[]; - static void InitDefaultsImpl(); + static const ::google::protobuf::uint32 offsets[]; }; void LIBPROTOBUF_EXPORT AddDescriptors(); -void LIBPROTOBUF_EXPORT InitDefaults(); +void LIBPROTOBUF_EXPORT InitDefaultsEmptyImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsEmpty(); +inline void LIBPROTOBUF_EXPORT InitDefaults() { + InitDefaultsEmpty(); +} } // namespace protobuf_google_2fprotobuf_2fempty_2eproto +namespace google { +namespace protobuf { +class Empty; +class EmptyDefaultTypeInternal; +LIBPROTOBUF_EXPORT extern EmptyDefaultTypeInternal _Empty_default_instance_; +} // namespace protobuf +} // namespace google +namespace google { +namespace protobuf { // =================================================================== @@ -93,6 +95,7 @@ class LIBPROTOBUF_EXPORT Empty : public ::google::protobuf::Message /* @@protoc_ static const ::google::protobuf::Descriptor* descriptor(); static const Empty& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Empty* internal_default_instance() { return reinterpret_cast<const Empty*>( &_Empty_default_instance_); @@ -159,14 +162,14 @@ class LIBPROTOBUF_EXPORT Empty : public ::google::protobuf::Message /* @@protoc_ typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2fempty_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fempty_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fempty_2eproto::InitDefaultsEmptyImpl(); }; // =================================================================== // =================================================================== -#if !PROTOBUF_INLINE_NOT_IN_HEADERS #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" @@ -176,11 +179,9 @@ class LIBPROTOBUF_EXPORT Empty : public ::google::protobuf::Message /* @@protoc_ #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ -#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/extension_set.cc b/src/google/protobuf/extension_set.cc index 955c079b..cf6b6fb4 100644 --- a/src/google/protobuf/extension_set.cc +++ b/src/google/protobuf/extension_set.cc @@ -221,7 +221,7 @@ int ExtensionSet::NumExtensions() const { int ExtensionSet::ExtensionSize(int number) const { ExtensionMap::const_iterator iter = extensions_.find(number); - if (iter == extensions_.end()) return false; + if (iter == extensions_.end()) return 0; return iter->second.GetSize(); } diff --git a/src/google/protobuf/extension_set.h b/src/google/protobuf/extension_set.h index 6f47c4a6..0a5d98f2 100644 --- a/src/google/protobuf/extension_set.h +++ b/src/google/protobuf/extension_set.h @@ -697,6 +697,10 @@ inline void ExtensionSet::AddString(int number, FieldType type, // ExtensionSet* set); // static inline void Add(int number, ConstType value, ExtensionSet* set); // static inline MutableType Add(int number, ExtensionSet* set); +// This is used by the ExtensionIdentifier constructor to register +// the extension at dynamic initialization. +// template <typename ExtendeeT> +// static void Register(int number, FieldType type, bool is_packed); // }; // // Not all of these methods make sense for all field types. For example, the @@ -728,6 +732,11 @@ class PrimitiveTypeTraits { ConstType default_value); static inline void Set(int number, FieldType field_type, ConstType value, ExtensionSet* set); + template <typename ExtendeeT> + static void Register(int number, FieldType type, bool is_packed) { + ExtensionSet::RegisterExtension(&ExtendeeT::default_instance(), number, + type, false, is_packed); + } }; template <typename Type> @@ -751,6 +760,11 @@ class RepeatedPrimitiveTypeTraits { bool is_packed, ExtensionSet* set); static const RepeatedFieldType* GetDefaultRepeatedField(); + template <typename ExtendeeT> + static void Register(int number, FieldType type, bool is_packed) { + ExtensionSet::RegisterExtension(&ExtendeeT::default_instance(), number, + type, true, is_packed); + } }; LIBPROTOBUF_EXPORT extern ProtobufOnceType repeated_primitive_generic_type_traits_once_init_; @@ -848,6 +862,11 @@ class LIBPROTOBUF_EXPORT StringTypeTraits { ExtensionSet* set) { return set->MutableString(number, field_type, NULL); } + template <typename ExtendeeT> + static void Register(int number, FieldType type, bool is_packed) { + ExtensionSet::RegisterExtension(&ExtendeeT::default_instance(), number, + type, false, is_packed); + } }; LIBPROTOBUF_EXPORT extern ProtobufOnceType repeated_string_type_traits_once_init_; @@ -900,6 +919,12 @@ class LIBPROTOBUF_EXPORT RepeatedStringTypeTraits { return default_repeated_field_; } + template <typename ExtendeeT> + static void Register(int number, FieldType type, bool is_packed) { + ExtensionSet::RegisterExtension(&ExtendeeT::default_instance(), number, + type, true, is_packed); + } + private: static void InitializeDefaultRepeatedFields(); static void DestroyDefaultRepeatedFields(); @@ -927,6 +952,11 @@ class EnumTypeTraits { GOOGLE_DCHECK(IsValid(value)); set->SetEnum(number, field_type, value, NULL); } + template <typename ExtendeeT> + static void Register(int number, FieldType type, bool is_packed) { + ExtensionSet::RegisterEnumExtension(&ExtendeeT::default_instance(), number, + type, false, is_packed, IsValid); + } }; template <typename Type, bool IsValid(int)> @@ -980,6 +1010,11 @@ class RepeatedEnumTypeTraits { return reinterpret_cast<const RepeatedField<Type>*>( RepeatedPrimitiveTypeTraits<int32>::GetDefaultRepeatedField()); } + template <typename ExtendeeT> + static void Register(int number, FieldType type, bool is_packed) { + ExtensionSet::RegisterEnumExtension(&ExtendeeT::default_instance(), number, + type, true, is_packed, IsValid); + } }; // ------------------------------------------------------------------- @@ -1025,6 +1060,12 @@ class MessageTypeTraits { return static_cast<Type*>(set->UnsafeArenaReleaseMessage( number, Type::default_instance())); } + template <typename ExtendeeT> + static void Register(int number, FieldType type, bool is_packed) { + ExtensionSet::RegisterMessageExtension(&ExtendeeT::default_instance(), + number, type, false, is_packed, + &Type::default_instance()); + } }; // forward declaration @@ -1070,6 +1111,12 @@ class RepeatedMessageTypeTraits { } static const RepeatedFieldType* GetDefaultRepeatedField(); + template <typename ExtendeeT> + static void Register(int number, FieldType type, bool is_packed) { + ExtensionSet::RegisterMessageExtension(&ExtendeeT::default_instance(), + number, type, true, is_packed, + &Type::default_instance()); + } }; LIBPROTOBUF_EXPORT extern ProtobufOnceType repeated_message_generic_type_traits_once_init_; @@ -1121,12 +1168,18 @@ class ExtensionIdentifier { typedef ExtendeeType Extendee; ExtensionIdentifier(int number, typename TypeTraits::ConstType default_value) - : number_(number), default_value_(default_value) {} + : number_(number), default_value_(default_value) { + Register(number); + } inline int number() const { return number_; } typename TypeTraits::ConstType default_value() const { return default_value_; } + static void Register(int number) { + TypeTraits::template Register<ExtendeeType>(number, field_type, is_packed); + } + private: const int number_; typename TypeTraits::ConstType default_value_; diff --git a/src/google/protobuf/extension_set_heavy.cc b/src/google/protobuf/extension_set_heavy.cc index f545fe30..fad31340 100644 --- a/src/google/protobuf/extension_set_heavy.cc +++ b/src/google/protobuf/extension_set_heavy.cc @@ -37,10 +37,12 @@ #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/io/zero_copy_stream_impl_lite.h> +#include <google/protobuf/descriptor.pb.h> #include <google/protobuf/descriptor.h> #include <google/protobuf/extension_set.h> #include <google/protobuf/message.h> #include <google/protobuf/repeated_field.h> +#include <google/protobuf/unknown_field_set.h> #include <google/protobuf/wire_format.h> #include <google/protobuf/wire_format_lite_inl.h> @@ -489,10 +491,10 @@ uint8* ExtensionSet::Extension::InternalSerializeFieldWithCachedSizesToArray( HANDLE_TYPE( ENUM, Enum, enum); #undef HANDLE_TYPE - case WireFormatLite::TYPE_STRING: - case WireFormatLite::TYPE_BYTES: - case WireFormatLite::TYPE_GROUP: - case WireFormatLite::TYPE_MESSAGE: + case FieldDescriptor::TYPE_STRING: + case FieldDescriptor::TYPE_BYTES: + case FieldDescriptor::TYPE_GROUP: + case FieldDescriptor::TYPE_MESSAGE: GOOGLE_LOG(FATAL) << "Non-primitive types can't be packed."; break; } diff --git a/src/google/protobuf/field_mask.pb.cc b/src/google/protobuf/field_mask.pb.cc index afc3db56..c55a697a 100644 --- a/src/google/protobuf/field_mask.pb.cc +++ b/src/google/protobuf/field_mask.pb.cc @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/field_mask.proto -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #include <google/protobuf/field_mask.pb.h> #include <algorithm> @@ -15,57 +14,60 @@ #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> +// This is a temporary google only hack +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS +#include "third_party/protobuf/version.h" +#endif // @@protoc_insertion_point(includes) - namespace google { namespace protobuf { class FieldMaskDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<FieldMask> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<FieldMask> + _instance; } _FieldMask_default_instance_; - +} // namespace protobuf +} // namespace google namespace protobuf_google_2fprotobuf_2ffield_5fmask_2eproto { +void InitDefaultsFieldMaskImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_FieldMask_default_instance_; + new (ptr) ::google::protobuf::FieldMask(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::FieldMask::InitAsDefaultInstance(); +} -namespace { +void InitDefaultsFieldMask() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsFieldMaskImpl); +} ::google::protobuf::Metadata file_level_metadata[1]; -} // namespace - -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField - const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0}, -}; - -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField - const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - ::google::protobuf::internal::AuxillaryParseTableField(), -}; -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const - TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, -}; - -const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { +const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldMask, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldMask, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldMask, paths_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FieldMask, paths_), }; -static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(FieldMask)}, +static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, sizeof(::google::protobuf::FieldMask)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { - reinterpret_cast<const ::google::protobuf::Message*>(&_FieldMask_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_FieldMask_default_instance_), }; -namespace { - void protobuf_AssignDescriptors() { AddDescriptors(); ::google::protobuf::MessageFactory* factory = NULL; @@ -79,29 +81,15 @@ void protobuf_AssignDescriptorsOnce() { ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); } -void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; +void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1); } -} // namespace -void TableStruct::InitDefaultsImpl() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::internal::InitProtobufDefaults(); - _FieldMask_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_FieldMask_default_instance_);} - -void InitDefaults() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl); -} -namespace { void AddDescriptorsImpl() { InitDefaults(); - static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { "\n google/protobuf/field_mask.proto\022\017goog" "le.protobuf\"\032\n\tFieldMask\022\r\n\005paths\030\001 \003(\tB" "\211\001\n\023com.google.protobufB\016FieldMaskProtoP" @@ -114,7 +102,6 @@ void AddDescriptorsImpl() { ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/field_mask.proto", &protobuf_RegisterTypes); } -} // anonymous namespace void AddDescriptors() { static GOOGLE_PROTOBUF_DECLARE_ONCE(once); @@ -126,12 +113,14 @@ struct StaticDescriptorInitializer { AddDescriptors(); } } static_descriptor_initializer; - } // namespace protobuf_google_2fprotobuf_2ffield_5fmask_2eproto - +namespace google { +namespace protobuf { // =================================================================== +void FieldMask::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int FieldMask::kPathsFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -139,7 +128,7 @@ const int FieldMask::kPathsFieldNumber; FieldMask::FieldMask() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::InitDefaultsFieldMask(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.FieldMask) @@ -171,12 +160,12 @@ void FieldMask::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* FieldMask::descriptor() { - protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const FieldMask& FieldMask::default_instance() { - protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::InitDefaultsFieldMask(); return *internal_default_instance(); } @@ -373,85 +362,11 @@ void FieldMask::InternalSwap(FieldMask* other) { ::google::protobuf::Metadata FieldMask::GetMetadata() const { protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// FieldMask - -// repeated string paths = 1; -int FieldMask::paths_size() const { - return paths_.size(); -} -void FieldMask::clear_paths() { - paths_.Clear(); -} -const ::std::string& FieldMask::paths(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.FieldMask.paths) - return paths_.Get(index); -} -::std::string* FieldMask::mutable_paths(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.FieldMask.paths) - return paths_.Mutable(index); -} -void FieldMask::set_paths(int index, const ::std::string& value) { - // @@protoc_insertion_point(field_set:google.protobuf.FieldMask.paths) - paths_.Mutable(index)->assign(value); -} -#if LANG_CXX11 -void FieldMask::set_paths(int index, ::std::string&& value) { - // @@protoc_insertion_point(field_set:google.protobuf.FieldMask.paths) - paths_.Mutable(index)->assign(std::move(value)); -} -#endif -void FieldMask::set_paths(int index, const char* value) { - GOOGLE_DCHECK(value != NULL); - paths_.Mutable(index)->assign(value); - // @@protoc_insertion_point(field_set_char:google.protobuf.FieldMask.paths) -} -void FieldMask::set_paths(int index, const char* value, size_t size) { - paths_.Mutable(index)->assign( - reinterpret_cast<const char*>(value), size); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldMask.paths) -} -::std::string* FieldMask::add_paths() { - // @@protoc_insertion_point(field_add_mutable:google.protobuf.FieldMask.paths) - return paths_.Add(); -} -void FieldMask::add_paths(const ::std::string& value) { - paths_.Add()->assign(value); - // @@protoc_insertion_point(field_add:google.protobuf.FieldMask.paths) -} -#if LANG_CXX11 -void FieldMask::add_paths(::std::string&& value) { - paths_.Add(std::move(value)); - // @@protoc_insertion_point(field_add:google.protobuf.FieldMask.paths) -} -#endif -void FieldMask::add_paths(const char* value) { - GOOGLE_DCHECK(value != NULL); - paths_.Add()->assign(value); - // @@protoc_insertion_point(field_add_char:google.protobuf.FieldMask.paths) -} -void FieldMask::add_paths(const char* value, size_t size) { - paths_.Add()->assign(reinterpret_cast<const char*>(value), size); - // @@protoc_insertion_point(field_add_pointer:google.protobuf.FieldMask.paths) -} -const ::google::protobuf::RepeatedPtrField< ::std::string>& -FieldMask::paths() const { - // @@protoc_insertion_point(field_list:google.protobuf.FieldMask.paths) - return paths_; -} -::google::protobuf::RepeatedPtrField< ::std::string>* -FieldMask::mutable_paths() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.FieldMask.paths) - return &paths_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h index b8f10389..3275dc54 100644 --- a/src/google/protobuf/field_mask.pb.h +++ b/src/google/protobuf/field_mask.pb.h @@ -30,31 +30,33 @@ #include <google/protobuf/extension_set.h> // IWYU pragma: export #include <google/protobuf/unknown_field_set.h> // @@protoc_insertion_point(includes) -namespace google { -namespace protobuf { -class FieldMask; -class FieldMaskDefaultTypeInternal; -LIBPROTOBUF_EXPORT extern FieldMaskDefaultTypeInternal _FieldMask_default_instance_; -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { namespace protobuf_google_2fprotobuf_2ffield_5fmask_2eproto { -// Internal implementation detail -- do not call these. +// Internal implementation detail -- do not use these members. struct LIBPROTOBUF_EXPORT TableStruct { static const ::google::protobuf::internal::ParseTableField entries[]; static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; - static const ::google::protobuf::internal::ParseTable schema[]; - static const ::google::protobuf::uint32 offsets[]; + static const ::google::protobuf::internal::ParseTable schema[1]; static const ::google::protobuf::internal::FieldMetadata field_metadata[]; static const ::google::protobuf::internal::SerializationTable serialization_table[]; - static void InitDefaultsImpl(); + static const ::google::protobuf::uint32 offsets[]; }; void LIBPROTOBUF_EXPORT AddDescriptors(); -void LIBPROTOBUF_EXPORT InitDefaults(); +void LIBPROTOBUF_EXPORT InitDefaultsFieldMaskImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsFieldMask(); +inline void LIBPROTOBUF_EXPORT InitDefaults() { + InitDefaultsFieldMask(); +} } // namespace protobuf_google_2fprotobuf_2ffield_5fmask_2eproto +namespace google { +namespace protobuf { +class FieldMask; +class FieldMaskDefaultTypeInternal; +LIBPROTOBUF_EXPORT extern FieldMaskDefaultTypeInternal _FieldMask_default_instance_; +} // namespace protobuf +} // namespace google +namespace google { +namespace protobuf { // =================================================================== @@ -87,6 +89,7 @@ class LIBPROTOBUF_EXPORT FieldMask : public ::google::protobuf::Message /* @@pro static const ::google::protobuf::Descriptor* descriptor(); static const FieldMask& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const FieldMask* internal_default_instance() { return reinterpret_cast<const FieldMask*>( &_FieldMask_default_instance_); @@ -167,14 +170,14 @@ class LIBPROTOBUF_EXPORT FieldMask : public ::google::protobuf::Message /* @@pro ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::RepeatedPtrField< ::std::string> paths_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2ffield_5fmask_2eproto::InitDefaultsFieldMaskImpl(); }; // =================================================================== // =================================================================== -#if !PROTOBUF_INLINE_NOT_IN_HEADERS #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" @@ -253,11 +256,9 @@ FieldMask::mutable_paths() { #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ -#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/field_mask.proto b/src/google/protobuf/field_mask.proto index c68d247c..eb96ba00 100644 --- a/src/google/protobuf/field_mask.proto +++ b/src/google/protobuf/field_mask.proto @@ -240,6 +240,12 @@ option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask"; // // Note that oneof type names ("test_oneof" in this case) cannot be used in // paths. +// +// ## Field Mask Verification +// +// The implementation of the all the API methods, which have any FieldMask type +// field in the request, should verify the included field paths, and return +// `INVALID_ARGUMENT` error if any path is duplicated or unmappable. message FieldMask { // The set of field mask paths. repeated string paths = 1; diff --git a/src/google/protobuf/generated_message_reflection.cc b/src/google/protobuf/generated_message_reflection.cc index 263d52ab..f0f207ea 100644 --- a/src/google/protobuf/generated_message_reflection.cc +++ b/src/google/protobuf/generated_message_reflection.cc @@ -2250,17 +2250,15 @@ class AssignDescriptorsHelper { file_level_metadata_->descriptor = descriptor; - if (!descriptor->options().map_entry()) { - // Only set reflection for non map types. - file_level_metadata_->reflection = new GeneratedMessageReflection( - descriptor, MigrationToReflectionSchema(default_instance_data_, - offsets_, *schemas_), - ::google::protobuf::DescriptorPool::generated_pool(), factory_); - for (int i = 0; i < descriptor->enum_type_count(); i++) { - AssignEnumDescriptor(descriptor->enum_type(i)); - } - schemas_++; + file_level_metadata_->reflection = new GeneratedMessageReflection( + descriptor, + MigrationToReflectionSchema(default_instance_data_, offsets_, + *schemas_), + ::google::protobuf::DescriptorPool::generated_pool(), factory_); + for (int i = 0; i < descriptor->enum_type_count(); i++) { + AssignEnumDescriptor(descriptor->enum_type(i)); } + schemas_++; default_instance_data_++; file_level_metadata_++; } diff --git a/src/google/protobuf/generated_message_reflection.h b/src/google/protobuf/generated_message_reflection.h index f6ce16a7..02ecba61 100644 --- a/src/google/protobuf/generated_message_reflection.h +++ b/src/google/protobuf/generated_message_reflection.h @@ -45,7 +45,6 @@ // TODO(jasonh): Remove this once the compiler change to directly include this // is released to components. #include <google/protobuf/generated_enum_reflection.h> -#include <google/protobuf/generated_message_util.h> #include <google/protobuf/message.h> #include <google/protobuf/metadata.h> #include <google/protobuf/unknown_field_set.h> diff --git a/src/google/protobuf/generated_message_table_driven.h b/src/google/protobuf/generated_message_table_driven.h index 5eb63dbd..6f3fe666 100644 --- a/src/google/protobuf/generated_message_table_driven.h +++ b/src/google/protobuf/generated_message_table_driven.h @@ -33,6 +33,7 @@ #include <google/protobuf/map.h> #include <google/protobuf/map_entry_lite.h> +#include <google/protobuf/map_field_lite.h> #include <google/protobuf/message_lite.h> #include <google/protobuf/wire_format_lite.h> #include <google/protobuf/wire_format_lite_inl.h> @@ -43,7 +44,8 @@ // We require C++11 and Clang to use constexpr for variables, as GCC 4.8 // requires constexpr to be consistent between declarations of variables // unnecessarily (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58541). -#ifdef __clang__ +// VS 2017 Update 3 also supports this usage of constexpr. +#if defined(__clang__) || (defined(_MSC_VER) && _MSC_VER >= 1911) #define PROTOBUF_CONSTEXPR_VAR constexpr #else // !__clang__ #define PROTOBUF_CONSTEXPR_VAR @@ -197,20 +199,6 @@ bool MergePartialFromCodedStream(MessageLite* msg, const ParseTable& table, bool MergePartialFromCodedStreamLite(MessageLite* msg, const ParseTable& table, io::CodedInputStream* input); -template <typename MEntry> -struct MapEntryToMapField; - -template <typename Key, typename Value, WireFormatLite::FieldType kKeyFieldType, - WireFormatLite::FieldType kValueFieldType, int default_enum_value> -struct MapEntryToMapField<MapEntryLite<Key, Value, kKeyFieldType, - kValueFieldType, default_enum_value> > { - typedef MapFieldLite<MapEntryLite<Key, Value, kKeyFieldType, kValueFieldType, - default_enum_value>, - Key, Value, kKeyFieldType, kValueFieldType, - default_enum_value> - MapFieldType; -}; - template <typename Entry> bool ParseMap(io::CodedInputStream* input, void* map_field) { typedef typename MapEntryToMapField<Entry>::MapFieldType MapFieldType; diff --git a/src/google/protobuf/generated_message_util.cc b/src/google/protobuf/generated_message_util.cc index c9dfe61a..15d84222 100644 --- a/src/google/protobuf/generated_message_util.cc +++ b/src/google/protobuf/generated_message_util.cc @@ -43,14 +43,17 @@ #include <google/protobuf/extension_set.h> #include <google/protobuf/message_lite.h> #include <google/protobuf/metadata_lite.h> +#include <google/protobuf/stubs/port.h> #include <google/protobuf/repeated_field.h> #include <google/protobuf/wire_format_lite.h> #include <google/protobuf/wire_format_lite_inl.h> namespace google { + namespace protobuf { namespace internal { + double Infinity() { return std::numeric_limits<double>::infinity(); } @@ -695,6 +698,33 @@ void UnknownFieldSerializerLite(const uint8* ptr, uint32 offset, uint32 tag, ->unknown_fields()); } +MessageLite* DuplicateIfNonNullInternal(MessageLite* message, Arena* arena) { + if (message) { + MessageLite* ret = message->New(arena); + ret->CheckTypeAndMergeFrom(*message); + return ret; + } else { + return NULL; + } +} + +// Returns a message owned by this Arena. This may require Own()ing or +// duplicating the message. +MessageLite* GetOwnedMessageInternal(Arena* message_arena, + MessageLite* submessage, + Arena* submessage_arena) { + GOOGLE_DCHECK(submessage->GetArena() == submessage_arena); + GOOGLE_DCHECK(message_arena != submessage_arena); + if (message_arena != NULL && submessage_arena == NULL) { + message_arena->Own(submessage); + return submessage; + } else { + MessageLite* ret = submessage->New(message_arena); + ret->CheckTypeAndMergeFrom(*submessage); + return ret; + } +} + } // namespace internal } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/generated_message_util.h b/src/google/protobuf/generated_message_util.h index 096a84cd..8ebfc13b 100644 --- a/src/google/protobuf/generated_message_util.h +++ b/src/google/protobuf/generated_message_util.h @@ -274,6 +274,45 @@ void MapFieldSerializer(const uint8* base, uint32 offset, uint32 tag, } } +LIBPROTOBUF_EXPORT MessageLite* DuplicateIfNonNullInternal(MessageLite* message, Arena* arena); +LIBPROTOBUF_EXPORT MessageLite* GetOwnedMessageInternal(Arena* message_arena, + MessageLite* submessage, + Arena* submessage_arena); + +template <typename T> +T* DuplicateIfNonNull(T* message, Arena* arena) { + // The casts must be reinterpret_cast<> because T might be a forward-declared + // type that the compiler doesn't know is related to MessageLite. + return reinterpret_cast<T*>(DuplicateIfNonNullInternal( + reinterpret_cast<MessageLite*>(message), arena)); +} + +template <typename T> +T* GetOwnedMessage(Arena* message_arena, T* submessage, + Arena* submessage_arena) { + // The casts must be reinterpret_cast<> because T might be a forward-declared + // type that the compiler doesn't know is related to MessageLite. + return reinterpret_cast<T*>(GetOwnedMessageInternal( + message_arena, reinterpret_cast<MessageLite*>(submessage), + submessage_arena)); +} + +// Returns a message owned by this Arena. This may require Own()ing or +// duplicating the message. +template <typename T> +T* GetOwnedMessage(T* message, Arena* arena) { + GOOGLE_DCHECK(message); + Arena* message_arena = google::protobuf::Arena::GetArena(message); + if (message_arena == arena) { + return message; + } else if (arena != NULL && message_arena == NULL) { + arena->Own(message); + return message; + } else { + return DuplicateIfNonNull(message, arena); + } +} + } // namespace internal } // namespace protobuf diff --git a/src/google/protobuf/has_bits.h b/src/google/protobuf/has_bits.h index cb1d7ccc..e3a0149a 100644 --- a/src/google/protobuf/has_bits.h +++ b/src/google/protobuf/has_bits.h @@ -32,6 +32,7 @@ #define GOOGLE_PROTOBUF_HAS_BITS_H__ #include <google/protobuf/stubs/common.h> +#include <google/protobuf/stubs/port.h> namespace google { namespace protobuf { @@ -40,17 +41,18 @@ namespace internal { template<size_t doublewords> class HasBits { public: - HasBits() GOOGLE_ATTRIBUTE_ALWAYS_INLINE { Clear(); } + HasBits() GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE { Clear(); } - void Clear() GOOGLE_ATTRIBUTE_ALWAYS_INLINE { + void Clear() GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE { memset(has_bits_, 0, sizeof(has_bits_)); } - ::google::protobuf::uint32& operator[](int index) GOOGLE_ATTRIBUTE_ALWAYS_INLINE { + ::google::protobuf::uint32& operator[](int index) GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE { return has_bits_[index]; } - const ::google::protobuf::uint32& operator[](int index) const GOOGLE_ATTRIBUTE_ALWAYS_INLINE { + const ::google::protobuf::uint32& operator[](int index) const + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE { return has_bits_[index]; } diff --git a/src/google/protobuf/implicit_weak_message.cc b/src/google/protobuf/implicit_weak_message.cc new file mode 100644 index 00000000..0dd126be --- /dev/null +++ b/src/google/protobuf/implicit_weak_message.cc @@ -0,0 +1,51 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include <google/protobuf/implicit_weak_message.h> + +#include <google/protobuf/io/zero_copy_stream_impl_lite.h> +#include <google/protobuf/wire_format_lite.h> + +namespace google { +namespace protobuf { +namespace internal { + +::google::protobuf::internal::ExplicitlyConstructed<ImplicitWeakMessage> + implicit_weak_message_default_instance; + +bool ImplicitWeakMessage::MergePartialFromCodedStream(io::CodedInputStream* input) { + io::StringOutputStream string_stream(&data_); + io::CodedOutputStream coded_stream(&string_stream, false); + return WireFormatLite::SkipMessage(input, &coded_stream); +} + +} // namespace internal +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/implicit_weak_message.h b/src/google/protobuf/implicit_weak_message.h new file mode 100644 index 00000000..12cc7db9 --- /dev/null +++ b/src/google/protobuf/implicit_weak_message.h @@ -0,0 +1,89 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef GOOGLE_PROTOBUF_IMPLICIT_WEAK_MESSAGE_H__ +#define GOOGLE_PROTOBUF_IMPLICIT_WEAK_MESSAGE_H__ + +#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/arena.h> +#include <google/protobuf/message_lite.h> + +namespace google { +namespace protobuf { +namespace internal { + +class LIBPROTOBUF_EXPORT ImplicitWeakMessage : public MessageLite { + public: + ImplicitWeakMessage() : arena_(NULL) {} + explicit ImplicitWeakMessage(Arena* arena) : arena_(arena) {} + + string GetTypeName() const { return ""; } + + MessageLite* New() const { return new ImplicitWeakMessage; } + MessageLite* New(Arena* arena) const { + return Arena::CreateMessage<ImplicitWeakMessage>(arena); + } + + Arena* GetArena() const { return arena_; } + + void Clear() { data_.clear(); } + + bool IsInitialized() const { return true; } + + void CheckTypeAndMergeFrom(const MessageLite& other) { + data_.append(static_cast<const ImplicitWeakMessage&>(other).data_); + } + + bool MergePartialFromCodedStream(io::CodedInputStream* input); + + size_t ByteSizeLong() const { return data_.size(); } + + void SerializeWithCachedSizes(io::CodedOutputStream* output) const { + output->WriteString(data_); + } + + int GetCachedSize() const { return data_.size(); } + + typedef void InternalArenaConstructable_; + + private: + Arena* const arena_; + string data_; + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImplicitWeakMessage); +}; + +extern ::google::protobuf::internal::ExplicitlyConstructed<ImplicitWeakMessage> + implicit_weak_message_default_instance; + +} // namespace internal +} // namespace protobuf + +} // namespace google +#endif // GOOGLE_PROTOBUF_IMPLICIT_WEAK_MESSAGE_H__ diff --git a/src/google/protobuf/io/coded_stream.cc b/src/google/protobuf/io/coded_stream.cc index 17eb0ffa..79cff2c7 100644 --- a/src/google/protobuf/io/coded_stream.cc +++ b/src/google/protobuf/io/coded_stream.cc @@ -315,7 +315,8 @@ namespace { // The first part of the pair is true iff the read was successful. The second // part is buffer + (number of bytes read). This function is always inlined, // so returning a pair is costless. -GOOGLE_ATTRIBUTE_ALWAYS_INLINE ::std::pair<bool, const uint8*> ReadVarint32FromArray( +GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE +::std::pair<bool, const uint8*> ReadVarint32FromArray( uint32 first_byte, const uint8* buffer, uint32* value); inline ::std::pair<bool, const uint8*> ReadVarint32FromArray( @@ -352,8 +353,8 @@ inline ::std::pair<bool, const uint8*> ReadVarint32FromArray( return std::make_pair(true, ptr); } -GOOGLE_ATTRIBUTE_ALWAYS_INLINE::std::pair<bool, const uint8*> ReadVarint64FromArray( - const uint8* buffer, uint64* value); +GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE::std::pair<bool, const uint8*> +ReadVarint64FromArray(const uint8* buffer, uint64* value); inline ::std::pair<bool, const uint8*> ReadVarint64FromArray( const uint8* buffer, uint64* value) { const uint8* ptr = buffer; diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h index 6d2599fb..02d87ea4 100644 --- a/src/google/protobuf/io/coded_stream.h +++ b/src/google/protobuf/io/coded_stream.h @@ -134,6 +134,7 @@ #include <google/protobuf/stubs/atomicops.h> #include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/port.h> +#include <google/protobuf/stubs/port.h> namespace google { @@ -197,28 +198,23 @@ class LIBPROTOBUF_EXPORT CodedInputStream { // Like GetDirectBufferPointer, but this method is inlined, and does not // attempt to Refresh() if the buffer is currently empty. - GOOGLE_ATTRIBUTE_ALWAYS_INLINE void GetDirectBufferPointerInline(const void** data, - int* size); + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + void GetDirectBufferPointerInline(const void** data, int* size); // Read raw bytes, copying them into the given buffer. bool ReadRaw(void* buffer, int size); // Like the above, with inlined optimizations. This should only be used // by the protobuf implementation. - GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool InternalReadRawInline(void* buffer, int size); + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + bool InternalReadRawInline(void* buffer, int size); // Like ReadRaw, but reads into a string. - // - // Implementation Note: ReadString() grows the string gradually as it - // reads in the data, rather than allocating the entire requested size - // upfront. This prevents denial-of-service attacks in which a client - // could claim that a string is going to be MAX_INT bytes long in order to - // crash the server because it can't allocate this much space at once. bool ReadString(string* buffer, int size); // Like the above, with inlined optimizations. This should only be used // by the protobuf implementation. - GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool InternalReadStringInline(string* buffer, - int size); + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + bool InternalReadStringInline(string* buffer, int size); // Read a 32-bit little-endian integer. @@ -261,11 +257,11 @@ class LIBPROTOBUF_EXPORT CodedInputStream { // Always inline because this is only called in one place per parse loop // but it is called for every iteration of said loop, so it should be fast. // GCC doesn't want to inline this by default. - GOOGLE_ATTRIBUTE_ALWAYS_INLINE uint32 ReadTag() { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE uint32 ReadTag() { return last_tag_ = ReadTagNoLastTag(); } - GOOGLE_ATTRIBUTE_ALWAYS_INLINE uint32 ReadTagNoLastTag(); + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE uint32 ReadTagNoLastTag(); // This usually a faster alternative to ReadTag() when cutoff is a manifest @@ -276,15 +272,15 @@ class LIBPROTOBUF_EXPORT CodedInputStream { // above cutoff or is 0. (There's intentional wiggle room when tag is 0, // because that can arise in several ways, and for best performance we want // to avoid an extra "is tag == 0?" check here.) - GOOGLE_ATTRIBUTE_ALWAYS_INLINE std::pair<uint32, bool> ReadTagWithCutoff( - uint32 cutoff) { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + std::pair<uint32, bool> ReadTagWithCutoff(uint32 cutoff) { std::pair<uint32, bool> result = ReadTagWithCutoffNoLastTag(cutoff); last_tag_ = result.first; return result; } - GOOGLE_ATTRIBUTE_ALWAYS_INLINE std::pair<uint32, bool> ReadTagWithCutoffNoLastTag( - uint32 cutoff); + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + std::pair<uint32, bool> ReadTagWithCutoffNoLastTag(uint32 cutoff); // Usually returns true if calling ReadVarint32() now would produce the given // value. Will always return false if ReadVarint32() would not return the @@ -293,7 +289,7 @@ class LIBPROTOBUF_EXPORT CodedInputStream { // parameter. // Always inline because this collapses to a small number of instructions // when given a constant parameter, but GCC doesn't want to inline by default. - GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool ExpectTag(uint32 expected); + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE bool ExpectTag(uint32 expected); // Like above, except this reads from the specified buffer. The caller is // responsible for ensuring that the buffer is large enough to read a varint @@ -302,9 +298,8 @@ class LIBPROTOBUF_EXPORT CodedInputStream { // // Returns a pointer beyond the expected tag if it was found, or NULL if it // was not. - GOOGLE_ATTRIBUTE_ALWAYS_INLINE static const uint8* ExpectTagFromArray( - const uint8* buffer, - uint32 expected); + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + static const uint8* ExpectTagFromArray(const uint8* buffer, uint32 expected); // Usually returns true if no more bytes can be read. Always returns false // if more bytes can be read. If ExpectAtEnd() returns true, a subsequent @@ -401,9 +396,9 @@ class LIBPROTOBUF_EXPORT CodedInputStream { // Message::ParseFromString(). In this case, you will need to change // your code to instead construct some sort of ZeroCopyInputStream // (e.g. an ArrayInputStream), construct a CodedInputStream around - // that, then call Message::ParseFromCodedStream() instead. Then - // you can adjust the limit. Yes, it's more work, but you're doing - // something unusual. + // that, then you can adjust the limit. Then call + // Message::ParseFromCodedStream() instead. Yes, it's more work, but + // you're doing something unusual. void SetTotalBytesLimit(int total_bytes_limit, int warning_threshold); // The Total Bytes Limit minus the Current Position, or -1 if there @@ -799,8 +794,8 @@ class LIBPROTOBUF_EXPORT CodedOutputStream { // but GCC by default doesn't want to inline this. void WriteTag(uint32 value); // Like WriteTag() but writing directly to the target array. - GOOGLE_ATTRIBUTE_ALWAYS_INLINE static uint8* WriteTagToArray(uint32 value, - uint8* target); + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + static uint8* WriteTagToArray(uint32 value, uint8* target); // Returns the number of bytes needed to encode the given value as a varint. static size_t VarintSize32(uint32 value); @@ -867,11 +862,11 @@ class LIBPROTOBUF_EXPORT CodedOutputStream { bool IsSerializationDeterministic() const { return serialization_deterministic_is_overridden_ ? serialization_deterministic_override_ : - default_serialization_deterministic_; + IsDefaultSerializationDeterministic(); } static bool IsDefaultSerializationDeterministic() { - return google::protobuf::internal::Acquire_Load(&default_serialization_deterministic_); + return google::protobuf::internal::NoBarrier_Load(&default_serialization_deterministic_); } private: @@ -887,6 +882,7 @@ class LIBPROTOBUF_EXPORT CodedOutputStream { bool serialization_deterministic_is_overridden_; bool serialization_deterministic_override_; // Conceptually, default_serialization_deterministic_ is an atomic bool. + // TODO(haberman): replace with std::atomic<bool> when we move to C++11. static google::protobuf::internal::AtomicWord default_serialization_deterministic_; // Advance the buffer by a given number of bytes. @@ -914,7 +910,7 @@ class LIBPROTOBUF_EXPORT CodedOutputStream { // thread has done so. friend void ::google::protobuf::internal::MapTestForceDeterministic(); static void SetDefaultSerializationDeterministic() { - google::protobuf::internal::Release_Store(&default_serialization_deterministic_, 1); + google::protobuf::internal::NoBarrier_Store(&default_serialization_deterministic_, 1); } }; diff --git a/src/google/protobuf/io/zero_copy_stream_impl.cc b/src/google/protobuf/io/zero_copy_stream_impl.cc index 81fb5033..83dec3e6 100644 --- a/src/google/protobuf/io/zero_copy_stream_impl.cc +++ b/src/google/protobuf/io/zero_copy_stream_impl.cc @@ -43,9 +43,9 @@ #include <algorithm> #include <google/protobuf/io/zero_copy_stream_impl.h> #include <google/protobuf/stubs/common.h> -#include <google/protobuf/stubs/io_win32.h> #include <google/protobuf/stubs/logging.h> #include <google/protobuf/stubs/stl_util.h> +#include <google/protobuf/stubs/io_win32.h> namespace google { diff --git a/src/google/protobuf/io/zero_copy_stream_impl_lite.cc b/src/google/protobuf/io/zero_copy_stream_impl_lite.cc index 60c71c80..66ad49bc 100644 --- a/src/google/protobuf/io/zero_copy_stream_impl_lite.cc +++ b/src/google/protobuf/io/zero_copy_stream_impl_lite.cc @@ -196,27 +196,6 @@ void StringOutputStream::SetString(string* target) { // =================================================================== -LazyStringOutputStream::LazyStringOutputStream( - ResultCallback<string*>* callback) - : StringOutputStream(NULL), - callback_(GOOGLE_CHECK_NOTNULL(callback)), - string_is_set_(false) { -} - -bool LazyStringOutputStream::Next(void** data, int* size) { - if (!string_is_set_) { - SetString(callback_->Run()); - string_is_set_ = true; - } - return StringOutputStream::Next(data, size); -} - -int64 LazyStringOutputStream::ByteCount() const { - return string_is_set_ ? StringOutputStream::ByteCount() : 0; -} - -// =================================================================== - int CopyingInputStream::Skip(int count) { char junk[4096]; int skipped = 0; diff --git a/src/google/protobuf/io/zero_copy_stream_impl_lite.h b/src/google/protobuf/io/zero_copy_stream_impl_lite.h index a7bbc625..ab0fd5ac 100644 --- a/src/google/protobuf/io/zero_copy_stream_impl_lite.h +++ b/src/google/protobuf/io/zero_copy_stream_impl_lite.h @@ -156,26 +156,6 @@ class LIBPROTOBUF_EXPORT StringOutputStream : public ZeroCopyOutputStream { GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringOutputStream); }; -// LazyStringOutputStream is a StringOutputStream with lazy acquisition of -// the output string from a callback. The string is owned externally, and not -// deleted in the stream destructor. -class LIBPROTOBUF_EXPORT LazyStringOutputStream : public StringOutputStream { - public: - // Callback should be permanent (non-self-deleting). Ownership is transferred - // to the LazyStringOutputStream. - explicit LazyStringOutputStream(ResultCallback<string*>* callback); - - // implements ZeroCopyOutputStream, overriding StringOutputStream ----------- - bool Next(void** data, int* size); - int64 ByteCount() const; - - private: - const google::protobuf::scoped_ptr<ResultCallback<string*> > callback_; - bool string_is_set_; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(LazyStringOutputStream); -}; - // Note: There is no StringInputStream. Instead, just create an // ArrayInputStream as follows: // ArrayInputStream input(str.data(), str.size()); diff --git a/src/google/protobuf/io/zero_copy_stream_unittest.cc b/src/google/protobuf/io/zero_copy_stream_unittest.cc index 2bca6a90..dfc383a3 100644 --- a/src/google/protobuf/io/zero_copy_stream_unittest.cc +++ b/src/google/protobuf/io/zero_copy_stream_unittest.cc @@ -70,11 +70,11 @@ #endif #include <google/protobuf/stubs/common.h> -#include <google/protobuf/stubs/io_win32.h> #include <google/protobuf/stubs/logging.h> #include <google/protobuf/testing/googletest.h> #include <google/protobuf/testing/file.h> #include <gtest/gtest.h> +#include <google/protobuf/stubs/io_win32.h> namespace google { namespace protobuf { diff --git a/src/google/protobuf/lite_arena_unittest.cc b/src/google/protobuf/lite_arena_unittest.cc index f0bee880..dadaffb6 100644 --- a/src/google/protobuf/lite_arena_unittest.cc +++ b/src/google/protobuf/lite_arena_unittest.cc @@ -37,13 +37,22 @@ namespace google { namespace protobuf { namespace { -TEST(LiteArenaTest, MapNoHeapAllocation) { - // Allocate a large initial block to avoid mallocs during hooked test. - std::vector<char> arena_block(128 * 1024); - google::protobuf::ArenaOptions options; - options.initial_block = &arena_block[0]; - options.initial_block_size = arena_block.size(); - google::protobuf::Arena arena(options); +class LiteArenaTest : public testing::Test { + protected: + LiteArenaTest() { + ArenaOptions options; + options.start_block_size = 128 * 1024; + options.max_block_size = 128 * 1024; + arena_.reset(new Arena(options)); + // Trigger the allocation of the first arena block, so that further use of + // the arena will not require any heap allocations. + google::protobuf::Arena::CreateArray<char>(arena_.get(), 1); + } + + google::protobuf::scoped_ptr<Arena> arena_; +}; + +TEST_F(LiteArenaTest, MapNoHeapAllocation) { string data; data.reserve(128 * 1024); @@ -53,22 +62,21 @@ TEST(LiteArenaTest, MapNoHeapAllocation) { // google::protobuf::internal::NoHeapChecker no_heap; protobuf_unittest::TestArenaMapLite* from = - google::protobuf::Arena::CreateMessage<protobuf_unittest::TestArenaMapLite>(&arena); + Arena::CreateMessage<protobuf_unittest::TestArenaMapLite>(arena_.get()); google::protobuf::MapLiteTestUtil::SetArenaMapFields(from); from->SerializeToString(&data); protobuf_unittest::TestArenaMapLite* to = - google::protobuf::Arena::CreateMessage<protobuf_unittest::TestArenaMapLite>(&arena); + Arena::CreateMessage<protobuf_unittest::TestArenaMapLite>(arena_.get()); to->ParseFromString(data); google::protobuf::MapLiteTestUtil::ExpectArenaMapFieldsSet(*to); } } -TEST(LiteArenaTest, UnknownFieldMemLeak) { - google::protobuf::Arena arena; +TEST_F(LiteArenaTest, UnknownFieldMemLeak) { protobuf_unittest::ForeignMessageArenaLite* message = google::protobuf::Arena::CreateMessage<protobuf_unittest::ForeignMessageArenaLite>( - &arena); + arena_.get()); string data = "\012\000"; int original_capacity = data.capacity(); while (data.capacity() <= original_capacity) { diff --git a/src/google/protobuf/lite_unittest.cc b/src/google/protobuf/lite_unittest.cc index 6cf16629..d6693963 100644 --- a/src/google/protobuf/lite_unittest.cc +++ b/src/google/protobuf/lite_unittest.cc @@ -988,3 +988,18 @@ TEST(Lite, AllLite44) { std::cout << "PASS" << std::endl; } + +TEST(Lite, AllLite45) { + // Test unknown fields are not discarded upon parsing. + string data = "\20\1"; // varint 1 with field number 2 + + protobuf_unittest::ForeignMessageLite a; + EXPECT_TRUE(a.ParseFromString(data)); + google::protobuf::io::CodedInputStream input_stream( + reinterpret_cast<const ::google::protobuf::uint8*>(data.data()), data.size()); + EXPECT_TRUE(a.MergePartialFromCodedStream(&input_stream)); + + string serialized = a.SerializeAsString(); + EXPECT_EQ(serialized.substr(0, 2), data); + EXPECT_EQ(serialized.substr(2), data); +} diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h index 883556a7..7d9cc5c5 100644 --- a/src/google/protobuf/map.h +++ b/src/google/protobuf/map.h @@ -142,6 +142,26 @@ class Map { insert(other.begin(), other.end()); } +#if LANG_CXX11 + Map(Map&& other) noexcept : Map() { + if (other.arena_) { + *this = other; + } else { + swap(other); + } + } + Map& operator=(Map&& other) noexcept { + if (this != &other) { + if (arena_ != other.arena_) { + *this = other; + } else { + swap(other); + } + } + return *this; + } +#endif + template <class InputIt> Map(const InputIt& first, const InputIt& last) : arena_(NULL), default_enum_value_(0) { @@ -1036,12 +1056,12 @@ class Map { } const T& at(const key_type& key) const { const_iterator it = find(key); - GOOGLE_CHECK(it != end()); + GOOGLE_CHECK(it != end()) << "key not found: " << key; return it->second; } T& at(const key_type& key) { iterator it = find(key); - GOOGLE_CHECK(it != end()); + GOOGLE_CHECK(it != end()) << "key not found: " << key; return it->second; } @@ -1142,9 +1162,7 @@ class Map { // Access to hasher. Currently this returns a copy, but it may // be modified to return a const reference in the future. - hasher hash_function() const { - return elements_->hash_function(); - } + hasher hash_function() const { return elements_->hash_function(); } private: // Set default enum value only for proto2 map field whose value is enum type. diff --git a/src/google/protobuf/map_entry.h b/src/google/protobuf/map_entry.h index afe809b2..801def97 100644 --- a/src/google/protobuf/map_entry.h +++ b/src/google/protobuf/map_entry.h @@ -87,29 +87,6 @@ class MapEntry : public MapEntryImpl<Derived, Message, Key, Value, kKeyFieldType, kValueFieldType, default_enum_value> { public: - // Create default MapEntry instance for given descriptor. Descriptor has to be - // given when creating default MapEntry instance because different map field - // may have the same type and MapEntry class. The given descriptor is needed - // to distinguish instances of the same MapEntry class. - static const Reflection* CreateReflection(const Descriptor* descriptor, - const Derived* entry) { - ReflectionSchema schema = { - entry, - offsets_, - has_bits_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MapEntry, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MapEntry, _internal_metadata_), - -1, - -1, - sizeof(MapEntry), - -1, - }; - const Reflection* reflection = new GeneratedMessageReflection( - descriptor, schema, DescriptorPool::generated_pool(), - MessageFactory::generated_factory()); - return reflection; - } - MapEntry() : _internal_metadata_(NULL) {} explicit MapEntry(Arena* arena) : MapEntryImpl<Derived, Message, Key, Value, kKeyFieldType, @@ -118,11 +95,9 @@ class MapEntry typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - private: - static uint32 offsets_[2]; - static uint32 has_bits_[2]; InternalMetadataWithArena _internal_metadata_; + private: friend class ::google::protobuf::Arena; template <typename C, typename K, typename V, WireFormatLite::FieldType k_wire_type, WireFormatLite::FieldType, @@ -133,32 +108,18 @@ class MapEntry GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapEntry); }; -template <typename Derived, typename Key, typename Value, - WireFormatLite::FieldType kKeyFieldType, - WireFormatLite::FieldType kValueFieldType, int default_enum_value> -uint32 MapEntry<Derived, Key, Value, kKeyFieldType, kValueFieldType, - default_enum_value>::offsets_[2] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MapEntry, key_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MapEntry, value_), -}; - -template <typename Derived, typename Key, typename Value, - WireFormatLite::FieldType kKeyFieldType, - WireFormatLite::FieldType kValueFieldType, int default_enum_value> -uint32 MapEntry<Derived, Key, Value, kKeyFieldType, kValueFieldType, - default_enum_value>::has_bits_[2] = {0, 1}; - // Specialization for the full runtime template <typename Derived, typename Key, typename Value, WireFormatLite::FieldType kKeyFieldType, WireFormatLite::FieldType kValueFieldType, int default_enum_value> struct MapEntryHelper<MapEntry<Derived, Key, Value, kKeyFieldType, kValueFieldType, default_enum_value> > - : MapEntryHelper<MapEntryLite<Key, Value, kKeyFieldType, kValueFieldType, - default_enum_value> > { + : MapEntryHelper<MapEntryLite<Derived, Key, Value, kKeyFieldType, + kValueFieldType, default_enum_value> > { explicit MapEntryHelper(const MapPair<Key, Value>& map_pair) - : MapEntryHelper<MapEntryLite<Key, Value, kKeyFieldType, kValueFieldType, - default_enum_value> >(map_pair) {} + : MapEntryHelper<MapEntryLite<Derived, Key, Value, kKeyFieldType, + kValueFieldType, default_enum_value> >( + map_pair) {} }; template <typename Derived, typename K, typename V, diff --git a/src/google/protobuf/map_entry_lite.h b/src/google/protobuf/map_entry_lite.h index 0bccf4d2..7c477c56 100644 --- a/src/google/protobuf/map_entry_lite.h +++ b/src/google/protobuf/map_entry_lite.h @@ -36,6 +36,7 @@ #include <google/protobuf/arena.h> #include <google/protobuf/map.h> #include <google/protobuf/map_type_handler.h> +#include <google/protobuf/stubs/port.h> #include <google/protobuf/wire_format_lite_inl.h> namespace google { @@ -132,14 +133,14 @@ class MapEntryImpl : public Base { static const WireFormatLite::FieldType kEntryValueFieldType = kValueFieldType; static const int kEntryDefaultEnumValue = default_enum_value; - MapEntryImpl() : default_instance_(NULL), arena_(NULL) { + MapEntryImpl() : arena_(NULL) { KeyTypeHandler::Initialize(&key_, NULL); ValueTypeHandler::InitializeMaybeByDefaultEnum(&value_, default_enum_value, NULL); _has_bits_[0] = 0; } - explicit MapEntryImpl(Arena* arena) : default_instance_(NULL), arena_(arena) { + explicit MapEntryImpl(Arena* arena) : arena_(arena) { KeyTypeHandler::Initialize(&key_, arena); ValueTypeHandler::InitializeMaybeByDefaultEnum(&value_, default_enum_value, arena); @@ -147,11 +148,9 @@ class MapEntryImpl : public Base { } ~MapEntryImpl() { - if (this != default_instance_) { - if (GetArenaNoVirtual() != NULL) return; - KeyTypeHandler::DeleteNoArena(key_); - ValueTypeHandler::DeleteNoArena(value_); - } + if (GetArenaNoVirtual() != NULL) return; + KeyTypeHandler::DeleteNoArena(key_); + ValueTypeHandler::DeleteNoArena(value_); } // accessors ====================================================== @@ -160,9 +159,8 @@ class MapEntryImpl : public Base { return KeyTypeHandler::GetExternalReference(key_); } virtual inline const ValueMapEntryAccessorType& value() const { - GOOGLE_CHECK(default_instance_ != NULL); - return ValueTypeHandler::DefaultIfNotInitialized(value_, - default_instance_->value_); + return ValueTypeHandler::DefaultIfNotInitialized( + value_, Derived::internal_default_instance()->value_); } inline KeyMapEntryAccessorType* mutable_key() { set_has_key(); @@ -265,13 +263,11 @@ class MapEntryImpl : public Base { Base* New() const { Derived* entry = new Derived; - entry->default_instance_ = default_instance_; return entry; } Base* New(Arena* arena) const { Derived* entry = Arena::CreateMessage<Derived>(arena); - entry->default_instance_ = default_instance_; return entry; } @@ -309,13 +305,10 @@ class MapEntryImpl : public Base { clear_has_value(); } - void set_default_instance(MapEntryImpl* default_instance) { - default_instance_ = default_instance; - } - - void InitAsDefaultInstance() { - KeyTypeHandler::AssignDefaultValue(&key_); - ValueTypeHandler::AssignDefaultValue(&value_); + static void InitAsDefaultInstance() { + Derived* d = const_cast<Derived*>(Derived::internal_default_instance()); + KeyTypeHandler::AssignDefaultValue(&d->key_); + ValueTypeHandler::AssignDefaultValue(&d->value_); } Arena* GetArena() const { @@ -393,7 +386,7 @@ class MapEntryImpl : public Base { const Value& value() const { return *value_ptr_; } private: - void UseKeyAndValueFromEntry() GOOGLE_ATTRIBUTE_COLD { + void UseKeyAndValueFromEntry() GOOGLE_PROTOBUF_ATTRIBUTE_COLD { // Update key_ in case we need it later (because key() is called). // This is potentially inefficient, especially if the key is // expensive to copy (e.g., a long string), but this is a cold @@ -411,7 +404,7 @@ class MapEntryImpl : public Base { // into map_, we are not at the end of the input. This is unusual, but // allowed by the spec. bool ReadBeyondKeyValuePair(::google::protobuf::io::CodedInputStream* input) - GOOGLE_ATTRIBUTE_COLD { + GOOGLE_PROTOBUF_ATTRIBUTE_COLD { typedef MoveHelper<KeyTypeHandler::kIsEnum, KeyTypeHandler::kIsMessage, KeyTypeHandler::kWireType == @@ -517,13 +510,13 @@ class MapEntryImpl : public Base { return arena_; } - MapEntryImpl* default_instance_; - + public: // Needed for constructing tables KeyOnMemory key_; ValueOnMemory value_; Arena* arena_; uint32 _has_bits_[1]; + private: friend class ::google::protobuf::Arena; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; @@ -537,23 +530,20 @@ class MapEntryImpl : public Base { GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapEntryImpl); }; -template <typename Key, typename Value, WireFormatLite::FieldType kKeyFieldType, +template <typename T, typename Key, typename Value, + WireFormatLite::FieldType kKeyFieldType, WireFormatLite::FieldType kValueFieldType, int default_enum_value> class MapEntryLite - : public MapEntryImpl<MapEntryLite<Key, Value, kKeyFieldType, - kValueFieldType, default_enum_value>, - MessageLite, Key, Value, kKeyFieldType, + : public MapEntryImpl<T, MessageLite, Key, Value, kKeyFieldType, kValueFieldType, default_enum_value> { public: - typedef MapEntryImpl<MapEntryLite, MessageLite, Key, Value, kKeyFieldType, + typedef MapEntryImpl<T, MessageLite, Key, Value, kKeyFieldType, kValueFieldType, default_enum_value> SuperType; MapEntryLite() {} explicit MapEntryLite(Arena* arena) : SuperType(arena) {} - void MergeFrom(const MapEntryLite<Key, Value, kKeyFieldType, kValueFieldType, - default_enum_value>& other) { - MergeFromInternal(other); - } + void MergeFrom(const MapEntryLite& other) { MergeFromInternal(other); } + private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapEntryLite); }; @@ -563,9 +553,9 @@ class MapEntryLite template <typename Derived> struct DeconstructMapEntry; -template <typename K, typename V, WireFormatLite::FieldType key, +template <typename T, typename K, typename V, WireFormatLite::FieldType key, WireFormatLite::FieldType value, int default_enum> -struct DeconstructMapEntry<MapEntryLite<K, V, key, value, default_enum> > { +struct DeconstructMapEntry<MapEntryLite<T, K, V, key, value, default_enum> > { typedef K Key; typedef V Value; static const WireFormatLite::FieldType kKeyFieldType = key; @@ -613,7 +603,7 @@ template <> struct FromHelper<WireFormatLite::TYPE_STRING> { static ArenaStringPtr From(const string& x) { ArenaStringPtr res; - res.UnsafeArenaSetAllocated(NULL, const_cast<string*>(&x), NULL); + *res.UnsafeRawStringPointer() = const_cast<string*>(&x); return res; } }; @@ -621,7 +611,7 @@ template <> struct FromHelper<WireFormatLite::TYPE_BYTES> { static ArenaStringPtr From(const string& x) { ArenaStringPtr res; - res.UnsafeArenaSetAllocated(NULL, const_cast<string*>(&x), NULL); + *res.UnsafeRawStringPointer() = const_cast<string*>(&x); return res; } }; @@ -636,10 +626,11 @@ struct FromHelper<WireFormatLite::TYPE_MESSAGE> { template <typename MapEntryType> struct MapEntryHelper; -template <typename Key, typename Value, WireFormatLite::FieldType kKeyFieldType, +template <typename T, typename Key, typename Value, + WireFormatLite::FieldType kKeyFieldType, WireFormatLite::FieldType kValueFieldType, int default_enum_value> -struct MapEntryHelper<MapEntryLite<Key, Value, kKeyFieldType, kValueFieldType, - default_enum_value> > { +struct MapEntryHelper<MapEntryLite<T, Key, Value, kKeyFieldType, + kValueFieldType, default_enum_value> > { // Provide utilities to parse/serialize key/value. Provide utilities to // manipulate internal stored type. typedef MapTypeHandler<kKeyFieldType, Key> KeyTypeHandler; diff --git a/src/google/protobuf/map_field.h b/src/google/protobuf/map_field.h index bd478901..6c75a6da 100644 --- a/src/google/protobuf/map_field.h +++ b/src/google/protobuf/map_field.h @@ -217,8 +217,9 @@ class MapField : public TypeDefinedMapFieldBase<Key, T> { // Define message type for internal repeated field. typedef Derived EntryType; - typedef MapEntryLite<Key, T, kKeyFieldType, kValueFieldType, - default_enum_value> EntryLiteType; + typedef MapEntryLite<Derived, Key, T, kKeyFieldType, kValueFieldType, + default_enum_value> + EntryLiteType; // Define abbreviation for parent MapFieldLite typedef MapFieldLite<Derived, Key, T, kKeyFieldType, kValueFieldType, @@ -295,11 +296,13 @@ class MapField : public TypeDefinedMapFieldBase<Key, T> { GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapField); }; -template <typename MEntry> -struct MapEntryToMapField { - typedef DeconstructMapEntry<typename MEntry::SuperType> T; - typedef MapField<MEntry, typename T::Key, typename T::Value, T::kKeyFieldType, - T::kValueFieldType, T::default_enum_value> +template <typename T, typename Key, typename Value, + WireFormatLite::FieldType kKeyFieldType, + WireFormatLite::FieldType kValueFieldType, int default_enum_value> +struct MapEntryToMapField<MapEntry<T, Key, Value, kKeyFieldType, + kValueFieldType, default_enum_value> > { + typedef MapField<T, Key, Value, kKeyFieldType, kValueFieldType, + default_enum_value> MapFieldType; }; diff --git a/src/google/protobuf/map_field_lite.h b/src/google/protobuf/map_field_lite.h index 12d4e6ba..f648b430 100644 --- a/src/google/protobuf/map_field_lite.h +++ b/src/google/protobuf/map_field_lite.h @@ -121,6 +121,21 @@ bool AllAreInitialized(const Map<Key, T>& t) { return true; } +template <typename MEntry> +struct MapEntryToMapField : MapEntryToMapField<typename MEntry::SuperType> {}; + +template <typename T, typename Key, typename Value, + WireFormatLite::FieldType kKeyFieldType, + WireFormatLite::FieldType kValueFieldType, int default_enum_value> +struct MapEntryToMapField<MapEntryLite<T, Key, Value, kKeyFieldType, + kValueFieldType, default_enum_value> > { + typedef MapFieldLite<MapEntryLite<T, Key, Value, kKeyFieldType, + kValueFieldType, default_enum_value>, + Key, Value, kKeyFieldType, kValueFieldType, + default_enum_value> + MapFieldType; +}; + } // namespace internal } // namespace protobuf diff --git a/src/google/protobuf/map_field_test.cc b/src/google/protobuf/map_field_test.cc index 8617a366..4e0e751c 100644 --- a/src/google/protobuf/map_field_test.cc +++ b/src/google/protobuf/map_field_test.cc @@ -101,7 +101,7 @@ class MapFieldBaseStub : public MapFieldBase { class MapFieldBasePrimitiveTest : public ::testing::Test { protected: - typedef unittest::TestMap::TestMap_MapInt32Int32Entry EntryType; + typedef unittest::TestMap_MapInt32Int32Entry_DoNotUse EntryType; typedef MapField<EntryType, int32, int32, WireFormatLite::TYPE_INT32, WireFormatLite::TYPE_INT32, false> MapFieldType; @@ -206,7 +206,7 @@ class MapFieldStateTest : public testing::TestWithParam<State> { public: protected: - typedef unittest::TestMap::TestMap_MapInt32Int32Entry EntryType; + typedef unittest::TestMap_MapInt32Int32Entry_DoNotUse EntryType; typedef MapField<EntryType, int32, int32, WireFormatLite::TYPE_INT32, WireFormatLite::TYPE_INT32, false> MapFieldType; diff --git a/src/google/protobuf/map_test.cc b/src/google/protobuf/map_test.cc index 960589ce..080c71a7 100644 --- a/src/google/protobuf/map_test.cc +++ b/src/google/protobuf/map_test.cc @@ -130,7 +130,7 @@ class MapImplTest : public ::testing::Test { EXPECT_EQ(value, map_.at(key)); Map<int32, int32>::iterator it = map_.find(key); - // interator dereferenceable + // iterator dereferenceable EXPECT_EQ(key, (*it).first); EXPECT_EQ(value, (*it).second); EXPECT_EQ(key, it->first); @@ -158,7 +158,7 @@ class MapImplTest : public ::testing::Test { EXPECT_EQ(value, const_map_.at(key)); Map<int32, int32>::const_iterator const_it = const_map_.find(key); - // interator dereferenceable + // iterator dereferenceable EXPECT_EQ(key, (*const_it).first); EXPECT_EQ(value, (*const_it).second); EXPECT_EQ(key, const_it->first); @@ -558,7 +558,7 @@ TEST_F(MapImplTest, IteratorInvalidation) { #endif std::set<int> s; int n = kMaxSizeToTest; - int frog = k1 + n; + unsigned int frog = k1 + n; while (n > 1 && s.size() < 25) { s.insert(n); n = static_cast<int>(n * 100 / (101.0 + (frog & 63))); @@ -3283,6 +3283,44 @@ TEST(ArenaTest, IsInitialized) { EXPECT_EQ(0, (*message->mutable_map_int32_int32())[0]); } +#if LANG_CXX11 +TEST(MoveTest, MoveConstructorWorks) { + Map<int32, TestAllTypes> original_map; + original_map[42].mutable_optional_nested_message()->set_bb(42); + original_map[43].mutable_optional_nested_message()->set_bb(43); + const auto* nested_msg42_ptr = &original_map[42].optional_nested_message(); + const auto* nested_msg43_ptr = &original_map[43].optional_nested_message(); + + Map<int32, TestAllTypes> moved_to_map(std::move(original_map)); + EXPECT_TRUE(original_map.empty()); + EXPECT_EQ(2, moved_to_map.size()); + EXPECT_EQ(42, moved_to_map[42].optional_nested_message().bb()); + EXPECT_EQ(43, moved_to_map[43].optional_nested_message().bb()); + // This test takes advantage of the fact that pointers are swapped, so there + // should be pointer stability. + EXPECT_EQ(nested_msg42_ptr, &moved_to_map[42].optional_nested_message()); + EXPECT_EQ(nested_msg43_ptr, &moved_to_map[43].optional_nested_message()); +} + +TEST(MoveTest, MoveAssignmentWorks) { + Map<int32, TestAllTypes> original_map; + original_map[42].mutable_optional_nested_message()->set_bb(42); + original_map[43].mutable_optional_nested_message()->set_bb(43); + const auto* nested_msg42_ptr = &original_map[42].optional_nested_message(); + const auto* nested_msg43_ptr = &original_map[43].optional_nested_message(); + + Map<int32, TestAllTypes> moved_to_map = std::move(original_map); + EXPECT_TRUE(original_map.empty()); + EXPECT_EQ(2, moved_to_map.size()); + EXPECT_EQ(42, moved_to_map[42].optional_nested_message().bb()); + EXPECT_EQ(43, moved_to_map[43].optional_nested_message().bb()); + // This test takes advantage of the fact that pointers are swapped, so there + // should be pointer stability. + EXPECT_EQ(nested_msg42_ptr, &moved_to_map[42].optional_nested_message()); + EXPECT_EQ(nested_msg43_ptr, &moved_to_map[43].optional_nested_message()); +} +#endif + } // namespace internal } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/message.cc b/src/google/protobuf/message.cc index c01d1974..a0d3feba 100644 --- a/src/google/protobuf/message.cc +++ b/src/google/protobuf/message.cc @@ -463,7 +463,7 @@ namespace internal { template<> #if defined(_MSC_VER) && (_MSC_VER >= 1800) // Note: force noinline to workaround MSVC compiler bug with /Zc:inline, issue #240 -GOOGLE_ATTRIBUTE_NOINLINE +GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE #endif Message* GenericTypeHandler<Message>::NewFromPrototype( const Message* prototype, google::protobuf::Arena* arena) { @@ -472,7 +472,7 @@ Message* GenericTypeHandler<Message>::NewFromPrototype( template<> #if defined(_MSC_VER) && (_MSC_VER >= 1800) // Note: force noinline to workaround MSVC compiler bug with /Zc:inline, issue #240 -GOOGLE_ATTRIBUTE_NOINLINE +GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE #endif google::protobuf::Arena* GenericTypeHandler<Message>::GetArena( Message* value) { @@ -481,7 +481,7 @@ google::protobuf::Arena* GenericTypeHandler<Message>::GetArena( template<> #if defined(_MSC_VER) && (_MSC_VER >= 1800) // Note: force noinline to workaround MSVC compiler bug with /Zc:inline, issue #240 -GOOGLE_ATTRIBUTE_NOINLINE +GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE #endif void* GenericTypeHandler<Message>::GetMaybeArenaPointer( Message* value) { diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h index 44fe0fde..ab018596 100644 --- a/src/google/protobuf/message.h +++ b/src/google/protobuf/message.h @@ -327,18 +327,19 @@ class LIBPROTOBUF_EXPORT Message : public MessageLite { // Typedef for backwards-compatibility. typedef google::protobuf::Reflection Reflection; - // Get a Descriptor for this message's type. This describes what - // fields the message contains, the types of those fields, etc. + // Get a non-owning pointer to a Descriptor for this message's type. This + // describes what fields the message contains, the types of those fields, etc. + // This object remains property of the Message. const Descriptor* GetDescriptor() const { return GetMetadata().descriptor; } - // Get the Reflection interface for this Message, which can be used to - // read and modify the fields of the Message dynamically (in other words, - // without knowing the message type at compile time). This object remains - // property of the Message. + // Get a non-owning pointer to the Reflection interface for this Message, + // which can be used to read and modify the fields of the Message dynamically + // (in other words, without knowing the message type at compile time). This + // object remains property of the Message. // // This method remains virtual in case a subclass does not implement // reflection and wants to override the default behavior. - virtual const Reflection* GetReflection() const { + virtual const Reflection* GetReflection() const PROTOBUF_FINAL { return GetMetadata().reflection; } @@ -496,11 +497,14 @@ class LIBPROTOBUF_EXPORT Reflection { int index1, int index2) const = 0; - // List all fields of the message which are currently set. This includes - // extensions. Singular fields will only be listed if HasField(field) would - // return true and repeated fields will only be listed if FieldSize(field) - // would return non-zero. Fields (both normal fields and extension fields) - // will be listed ordered by field number. + // List all fields of the message which are currently set, except for unknown + // fields, but including extension known to the parser (i.e. compiled in). + // Singular fields will only be listed if HasField(field) would return true + // and repeated fields will only be listed if FieldSize(field) would return + // non-zero. Fields (both normal fields and extension fields) will be listed + // ordered by field number. + // Use Reflection::GetUnknownFields() or message.unknown_fields() to also get + // access to fields/extensions unknown to the parser. virtual void ListFields( const Message& message, std::vector<const FieldDescriptor*>* output) const = 0; @@ -922,7 +926,7 @@ class LIBPROTOBUF_EXPORT Reflection { // Returns a raw pointer to the repeated field // - // "cpp_type" and "message_type" are decuded from the type parameter T passed + // "cpp_type" and "message_type" are deduced from the type parameter T passed // to Get(Mutable)RepeatedFieldRef. If T is a generated message type, // "message_type" should be set to its descriptor. Otherwise "message_type" // should be set to NULL. Implementations of this method should check whether diff --git a/src/google/protobuf/message_lite.cc b/src/google/protobuf/message_lite.cc index 83a92d5a..123b142d 100644 --- a/src/google/protobuf/message_lite.cc +++ b/src/google/protobuf/message_lite.cc @@ -103,15 +103,15 @@ string InitializationErrorMessage(const char* action, // call MergePartialFromCodedStream(). However, when parsing very small // messages, every function call introduces significant overhead. To avoid // this without reproducing code, we use these forced-inline helpers. -GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool InlineMergeFromCodedStream( +GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE bool InlineMergeFromCodedStream( io::CodedInputStream* input, MessageLite* message); -GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool InlineParseFromCodedStream( +GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE bool InlineParseFromCodedStream( io::CodedInputStream* input, MessageLite* message); -GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool InlineParsePartialFromCodedStream( +GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE bool InlineParsePartialFromCodedStream( io::CodedInputStream* input, MessageLite* message); -GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool InlineParseFromArray( +GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE bool InlineParseFromArray( const void* data, int size, MessageLite* message); -GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool InlineParsePartialFromArray( +GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE bool InlineParsePartialFromArray( const void* data, int size, MessageLite* message); inline bool InlineMergeFromCodedStream(io::CodedInputStream* input, @@ -344,10 +344,13 @@ string MessageLite::SerializePartialAsString() const { return output; } -void MessageLite::SerializeWithCachedSizes(io::CodedOutputStream* output) const - { +void MessageLite::SerializeWithCachedSizes( + io::CodedOutputStream* output) const { GOOGLE_DCHECK(InternalGetTable()); - internal::TableSerialize(*this, static_cast<const internal::SerializationTable*>(InternalGetTable()), output); + internal::TableSerialize( + *this, + static_cast<const internal::SerializationTable*>(InternalGetTable()), + output); } // The table driven code optimizes the case that the CodedOutputStream buffer @@ -355,20 +358,20 @@ void MessageLite::SerializeWithCachedSizes(io::CodedOutputStream* output) const // If the proto is optimized for speed, this method will be overridden by // generated code for maximum speed. If the proto is optimized for size or // is lite, then we need to specialize this to avoid infinite recursion. -uint8* MessageLite::InternalSerializeWithCachedSizesToArray(bool deterministic, - uint8* target) const { +uint8* MessageLite::InternalSerializeWithCachedSizesToArray( + bool deterministic, uint8* target) const { const internal::SerializationTable* table = static_cast<const internal::SerializationTable*>(InternalGetTable()); if (table == NULL) { // We only optimize this when using optimize_for = SPEED. In other cases - // we just use the CodedOutputStream path. - int size = GetCachedSize(); - io::ArrayOutputStream out(target, size); - io::CodedOutputStream coded_out(&out); - coded_out.SetSerializationDeterministic(deterministic); - SerializeWithCachedSizes(&coded_out); - GOOGLE_CHECK(!coded_out.HadError()); - return target + size; + // we just use the CodedOutputStream path. + int size = GetCachedSize(); + io::ArrayOutputStream out(target, size); + io::CodedOutputStream coded_out(&out); + coded_out.SetSerializationDeterministic(deterministic); + SerializeWithCachedSizes(&coded_out); + GOOGLE_CHECK(!coded_out.HadError()); + return target + size; } else { return internal::TableSerializeToArray(*this, table, deterministic, target); } @@ -391,7 +394,8 @@ void GenericTypeHandler<string>::Merge(const string& from, *to = from; } -bool proto3_preserve_unknown_ = false; +bool proto3_preserve_unknown_ = true; + void SetProto3PreserveUnknownsDefault(bool preserve) { proto3_preserve_unknown_ = preserve; } diff --git a/src/google/protobuf/message_lite.h b/src/google/protobuf/message_lite.h index 2075f4b6..5cd6babc 100644 --- a/src/google/protobuf/message_lite.h +++ b/src/google/protobuf/message_lite.h @@ -43,25 +43,7 @@ #include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/logging.h> #include <google/protobuf/stubs/once.h> - - -#if LANG_CXX11 && !defined(__NVCC__) -#define PROTOBUF_CXX11 1 -#else -#define PROTOBUF_CXX11 0 -#endif - -#if PROTOBUF_CXX11 -#define PROTOBUF_FINAL final -#else -#define PROTOBUF_FINAL -#endif - -#ifndef LIBPROTOBUF_EXPORT -#define LIBPROTOBUF_EXPORT -#endif - -#define PROTOBUF_RUNTIME_DEPRECATED(message) +#include <google/protobuf/stubs/port.h> namespace google { namespace protobuf { diff --git a/src/google/protobuf/message_unittest.cc b/src/google/protobuf/message_unittest.cc index 06a7f65c..d328f9dd 100644 --- a/src/google/protobuf/message_unittest.cc +++ b/src/google/protobuf/message_unittest.cc @@ -55,10 +55,10 @@ #include <google/protobuf/stubs/logging.h> #include <google/protobuf/stubs/common.h> -#include <google/protobuf/stubs/io_win32.h> #include <google/protobuf/stubs/logging.h> #include <google/protobuf/testing/googletest.h> #include <gtest/gtest.h> +#include <google/protobuf/stubs/io_win32.h> namespace google { namespace protobuf { @@ -409,6 +409,7 @@ TEST(MessageTest, MessageIsStillValidAfterParseFails) { } } + namespace { void ExpectMessageMerged(const unittest::TestAllTypes& message) { diff --git a/src/google/protobuf/metadata_lite.h b/src/google/protobuf/metadata_lite.h index 64fde0c6..454d088c 100644 --- a/src/google/protobuf/metadata_lite.h +++ b/src/google/protobuf/metadata_lite.h @@ -33,7 +33,8 @@ #include <google/protobuf/stubs/common.h> #include <google/protobuf/arena.h> -#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/message_lite.h> +#include <google/protobuf/stubs/port.h> namespace google { namespace protobuf { @@ -62,7 +63,7 @@ class InternalMetadataWithArenaBase { ptr_ = NULL; } - GOOGLE_ATTRIBUTE_ALWAYS_INLINE const T& unknown_fields() const { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE const T& unknown_fields() const { if (GOOGLE_PREDICT_FALSE(have_unknown_fields())) { return PtrValue<Container>()->unknown_fields; } else { @@ -70,7 +71,7 @@ class InternalMetadataWithArenaBase { } } - GOOGLE_ATTRIBUTE_ALWAYS_INLINE T* mutable_unknown_fields() { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE T* mutable_unknown_fields() { if (GOOGLE_PREDICT_TRUE(have_unknown_fields())) { return &PtrValue<Container>()->unknown_fields; } else { @@ -78,7 +79,7 @@ class InternalMetadataWithArenaBase { } } - GOOGLE_ATTRIBUTE_ALWAYS_INLINE Arena* arena() const { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE Arena* arena() const { if (GOOGLE_PREDICT_FALSE(have_unknown_fields())) { return PtrValue<Container>()->arena; } else { @@ -86,11 +87,11 @@ class InternalMetadataWithArenaBase { } } - GOOGLE_ATTRIBUTE_ALWAYS_INLINE bool have_unknown_fields() const { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE bool have_unknown_fields() const { return PtrTag() == kTagContainer; } - GOOGLE_ATTRIBUTE_ALWAYS_INLINE void Swap(Derived* other) { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void Swap(Derived* other) { // Semantics here are that we swap only the unknown fields, not the arena // pointer. We cannot simply swap ptr_ with other->ptr_ because we need to // maintain our own arena ptr. Also, our ptr_ and other's ptr_ may be in @@ -102,19 +103,19 @@ class InternalMetadataWithArenaBase { } } - GOOGLE_ATTRIBUTE_ALWAYS_INLINE void MergeFrom(const Derived& other) { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void MergeFrom(const Derived& other) { if (other.have_unknown_fields()) { static_cast<Derived*>(this)->DoMergeFrom(other.unknown_fields()); } } - GOOGLE_ATTRIBUTE_ALWAYS_INLINE void Clear() { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void Clear() { if (have_unknown_fields()) { static_cast<Derived*>(this)->DoClear(); } } - GOOGLE_ATTRIBUTE_ALWAYS_INLINE void* raw_arena_ptr() const { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void* raw_arena_ptr() const { return ptr_; } @@ -132,7 +133,7 @@ class InternalMetadataWithArenaBase { static const intptr_t kPtrValueMask = ~kPtrTagMask; // Accessors for pointer tag and pointer value. - GOOGLE_ATTRIBUTE_ALWAYS_INLINE int PtrTag() const { + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE int PtrTag() const { return reinterpret_cast<intptr_t>(ptr_) & kPtrTagMask; } @@ -147,11 +148,14 @@ class InternalMetadataWithArenaBase { Arena* arena; }; - GOOGLE_ATTRIBUTE_NOINLINE T* mutable_unknown_fields_slow() { + GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE T* mutable_unknown_fields_slow() { Arena* my_arena = arena(); Container* container = Arena::Create<Container>(my_arena); + // Two-step assignment works around a bug in clang's static analyzer: + // https://bugs.llvm.org/show_bug.cgi?id=34198. + ptr_ = container; ptr_ = reinterpret_cast<void*>( - reinterpret_cast<intptr_t>(container) | kTagContainer); + reinterpret_cast<intptr_t>(ptr_) | kTagContainer); container->arena = my_arena; return &(container->unknown_fields); } @@ -187,6 +191,32 @@ class InternalMetadataWithArenaLite } }; +// This helper RAII class is needed to efficiently parse unknown fields. We +// should only call mutable_unknown_fields if there are actual unknown fields. +// The obvious thing to just use a stack string and swap it at the end of the +// parse won't work, because the destructor of StringOutputStream needs to be +// called before we can modify the string (it check-fails). Using +// LiteUnknownFieldSetter setter(&_internal_metadata_); +// StringOutputStream stream(setter.buffer()); +// guarantees that the string is only swapped after stream is destroyed. +class LIBPROTOBUF_EXPORT LiteUnknownFieldSetter { + public: + explicit LiteUnknownFieldSetter(InternalMetadataWithArenaLite* metadata) + : metadata_(metadata) { + if (metadata->have_unknown_fields()) { + buffer_.swap(*metadata->mutable_unknown_fields()); + } + } + ~LiteUnknownFieldSetter() { + if (!buffer_.empty()) metadata_->mutable_unknown_fields()->swap(buffer_); + } + string* buffer() { return &buffer_; } + + private: + InternalMetadataWithArenaLite* metadata_; + string buffer_; +}; + } // namespace internal } // namespace protobuf diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index d8003b8f..8eb6c795 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -60,6 +60,7 @@ #include <google/protobuf/stubs/type_traits.h> #include <google/protobuf/arena.h> #include <google/protobuf/message_lite.h> +#include <google/protobuf/stubs/port.h> // Forward-declare these so that we can make them friends. @@ -118,6 +119,11 @@ class RepeatedField PROTOBUF_FINAL { RepeatedField& operator=(const RepeatedField& other); +#if LANG_CXX11 + RepeatedField(RepeatedField&& other) noexcept; + RepeatedField& operator=(RepeatedField&& other) noexcept; +#endif + bool empty() const; int size() const; @@ -280,6 +286,10 @@ class RepeatedField PROTOBUF_FINAL { friend class Arena; typedef void InternalArenaConstructable_; + + // Move the contents of |from| into |to|, possibly clobbering |from| in the + // process. For primitive types this is just a memcpy(), but it could be + // specialized for non-primitive types to, say, swap each element instead. void MoveArray(Element* to, Element* from, int size); // Copy the elements of |from| into |to|. @@ -366,7 +376,7 @@ struct TypeImplementsMergeBehaviorProbeForMergeFrom { CheckType<U, bool, &U::MergeFrom>*); template<typename U> static HasNoMerge Check(...); - // Resovles to either google::protobuf::internal::true_type or google::protobuf::internal::false_type. + // Resolves to either google::protobuf::internal::true_type or google::protobuf::internal::false_type. typedef google::protobuf::internal::integral_constant<bool, (sizeof(Check<T>(0)) == sizeof(HasMerge))> type; }; @@ -473,8 +483,8 @@ class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase { template <typename TypeHandler> const typename TypeHandler::Type* const* data() const; - template <typename TypeHandler> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE void Swap(RepeatedPtrFieldBase* other); + template <typename TypeHandler> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + void Swap(RepeatedPtrFieldBase* other); void SwapElements(int index1, int index2); @@ -518,17 +528,15 @@ class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase { inline void InternalSwap(RepeatedPtrFieldBase* other); template <typename TypeHandler> - void AddAllocatedInternal(typename TypeHandler::Type* value, - google::protobuf::internal::true_type); + void AddAllocatedInternal(typename TypeHandler::Type* value, google::protobuf::internal::true_type); template <typename TypeHandler> - void AddAllocatedInternal(typename TypeHandler::Type* value, - google::protobuf::internal::false_type); + void AddAllocatedInternal(typename TypeHandler::Type* value, google::protobuf::internal::false_type); - template <typename TypeHandler> GOOGLE_ATTRIBUTE_NOINLINE + template <typename TypeHandler> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE void AddAllocatedSlowWithCopy(typename TypeHandler::Type* value, Arena* value_arena, Arena* my_arena); - template <typename TypeHandler> GOOGLE_ATTRIBUTE_NOINLINE + template <typename TypeHandler> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE void AddAllocatedSlowWithoutCopy(typename TypeHandler::Type* value); template <typename TypeHandler> @@ -536,7 +544,7 @@ class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase { template <typename TypeHandler> typename TypeHandler::Type* ReleaseLastInternal(google::protobuf::internal::false_type); - template<typename TypeHandler> GOOGLE_ATTRIBUTE_NOINLINE + template<typename TypeHandler> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE void SwapFallback(RepeatedPtrFieldBase* other); inline Arena* GetArenaNoVirtual() const { @@ -623,8 +631,8 @@ class GenericTypeHandler { } static inline void Clear(GenericType* value) { value->Clear(); } - GOOGLE_ATTRIBUTE_NOINLINE static void Merge(const GenericType& from, - GenericType* to); + GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE + static void Merge(const GenericType& from, GenericType* to); static inline size_t SpaceUsedLong(const GenericType& value) { return value.SpaceUsedLong(); } @@ -770,6 +778,11 @@ class RepeatedPtrField PROTOBUF_FINAL : public internal::RepeatedPtrFieldBase { RepeatedPtrField& operator=(const RepeatedPtrField& other); +#if LANG_CXX11 + RepeatedPtrField(RepeatedPtrField&& other) noexcept; + RepeatedPtrField& operator=(RepeatedPtrField&& other) noexcept; +#endif + bool empty() const; int size() const; @@ -1086,6 +1099,37 @@ RepeatedField<Element>::operator=(const RepeatedField& other) { return *this; } +#if LANG_CXX11 + +template <typename Element> +inline RepeatedField<Element>::RepeatedField(RepeatedField&& other) noexcept + : RepeatedField() { + // We don't just call Swap(&other) here because it would perform 3 copies if + // the two fields are on different arenas. + if (other.GetArenaNoVirtual()) { + CopyFrom(other); + } else { + InternalSwap(&other); + } +} + +template <typename Element> +inline RepeatedField<Element>& RepeatedField<Element>::operator=( + RepeatedField&& other) noexcept { + // We don't just call Swap(&other) here because it would perform 3 copies if + // the two fields are on different arenas. + if (this != &other) { + if (this->GetArenaNoVirtual() != other.GetArenaNoVirtual()) { + CopyFrom(other); + } else { + InternalSwap(&other); + } + } + return *this; +} + +#endif // LANG_CXX11 + template <typename Element> inline bool RepeatedField<Element>::empty() const { return current_size_ == 0; @@ -1689,7 +1733,6 @@ void RepeatedPtrFieldBase::AddAllocatedInternal( elems[current_size_] = value; current_size_ = current_size_ + 1; rep_->allocated_size = rep_->allocated_size + 1; - return; } else { AddAllocatedSlowWithCopy<TypeHandler>( value, TypeHandler::GetArena(value), arena); @@ -1736,7 +1779,6 @@ void RepeatedPtrFieldBase::AddAllocatedInternal( elems[current_size_] = value; current_size_ = current_size_ + 1; ++rep_->allocated_size; - return; } else { UnsafeArenaAddAllocated<TypeHandler>(value); } @@ -1900,6 +1942,38 @@ inline RepeatedPtrField<Element>& RepeatedPtrField<Element>::operator=( return *this; } +#if LANG_CXX11 + +template <typename Element> +inline RepeatedPtrField<Element>::RepeatedPtrField( + RepeatedPtrField&& other) noexcept + : RepeatedPtrField() { + // We don't just call Swap(&other) here because it would perform 3 copies if + // the two fields are on different arenas. + if (other.GetArenaNoVirtual()) { + CopyFrom(other); + } else { + InternalSwap(&other); + } +} + +template <typename Element> +inline RepeatedPtrField<Element>& RepeatedPtrField<Element>::operator=( + RepeatedPtrField&& other) noexcept { + // We don't just call Swap(&other) here because it would perform 3 copies if + // the two fields are on different arenas. + if (this != &other) { + if (this->GetArenaNoVirtual() != other.GetArenaNoVirtual()) { + CopyFrom(other); + } else { + InternalSwap(&other); + } + } + return *this; +} + +#endif // LANG_CXX11 + template <typename Element> inline bool RepeatedPtrField<Element>::empty() const { return RepeatedPtrFieldBase::empty(); @@ -2184,7 +2258,7 @@ class RepeatedPtrIterator : it_(other.it_) { // Force a compiler error if the other type is not convertible to ours. if (false) { - implicit_cast<Element*, OtherElement*>(0); + implicit_cast<Element*>(static_cast<OtherElement*>(NULL)); } } diff --git a/src/google/protobuf/repeated_field_unittest.cc b/src/google/protobuf/repeated_field_unittest.cc index ae501465..16919711 100644 --- a/src/google/protobuf/repeated_field_unittest.cc +++ b/src/google/protobuf/repeated_field_unittest.cc @@ -45,17 +45,19 @@ #include <google/protobuf/stubs/logging.h> #include <google/protobuf/stubs/common.h> #include <google/protobuf/unittest.pb.h> +#include <gmock/gmock.h> #include <google/protobuf/testing/googletest.h> #include <gtest/gtest.h> #include <google/protobuf/stubs/strutil.h> #include <google/protobuf/stubs/stl_util.h> namespace google { -using protobuf_unittest::TestAllTypes; - namespace protobuf { namespace { +using ::protobuf_unittest::TestAllTypes; +using ::testing::ElementsAre; + // Test operations on a small RepeatedField. TEST(RepeatedField, Small) { RepeatedField<int> field; @@ -267,15 +269,6 @@ TEST(RepeatedField, MergeFrom) { EXPECT_EQ(5, destination.Get(4)); } -#ifdef PROTOBUF_HAS_DEATH_TEST -#ifndef NDEBUG -TEST(RepeatedField, MergeFromSelf) { - RepeatedField<int> me; - me.Add(3); - EXPECT_DEATH(me.MergeFrom(me), ""); -} -#endif // NDEBUG -#endif // PROTOBUF_HAS_DEATH_TEST TEST(RepeatedField, CopyFrom) { RepeatedField<int> source, destination; @@ -390,6 +383,142 @@ TEST(RepeatedField, SelfAssign) { EXPECT_EQ(8, source.Get(1)); } +#if LANG_CXX11 + +TEST(RepeatedField, MoveConstruct) { + { + RepeatedField<int> source; + source.Add(1); + source.Add(2); + const int* data = source.data(); + RepeatedField<int> destination = std::move(source); + EXPECT_EQ(data, destination.data()); + EXPECT_THAT(destination, ElementsAre(1, 2)); + // This property isn't guaranteed but it's useful to have a test that would + // catch changes in this area. + EXPECT_TRUE(source.empty()); + } + { + Arena arena; + RepeatedField<int>* source = + Arena::CreateMessage<RepeatedField<int>>(&arena); + source->Add(1); + source->Add(2); + RepeatedField<int> destination = std::move(*source); + EXPECT_EQ(NULL, destination.GetArena()); + EXPECT_THAT(destination, ElementsAre(1, 2)); + // This property isn't guaranteed but it's useful to have a test that would + // catch changes in this area. + EXPECT_THAT(*source, ElementsAre(1, 2)); + } +} + +TEST(RepeatedField, MoveAssign) { + { + RepeatedField<int> source; + source.Add(1); + source.Add(2); + RepeatedField<int> destination; + destination.Add(3); + const int* source_data = source.data(); + const int* destination_data = destination.data(); + destination = std::move(source); + EXPECT_EQ(source_data, destination.data()); + EXPECT_THAT(destination, ElementsAre(1, 2)); + // This property isn't guaranteed but it's useful to have a test that would + // catch changes in this area. + EXPECT_EQ(destination_data, source.data()); + EXPECT_THAT(source, ElementsAre(3)); + } + { + Arena arena; + RepeatedField<int>* source = + Arena::CreateMessage<RepeatedField<int>>(&arena); + source->Add(1); + source->Add(2); + RepeatedField<int>* destination = + Arena::CreateMessage<RepeatedField<int>>(&arena); + destination->Add(3); + const int* source_data = source->data(); + const int* destination_data = destination->data(); + *destination = std::move(*source); + EXPECT_EQ(source_data, destination->data()); + EXPECT_THAT(*destination, ElementsAre(1, 2)); + // This property isn't guaranteed but it's useful to have a test that would + // catch changes in this area. + EXPECT_EQ(destination_data, source->data()); + EXPECT_THAT(*source, ElementsAre(3)); + } + { + Arena source_arena; + RepeatedField<int>* source = + Arena::CreateMessage<RepeatedField<int>>(&source_arena); + source->Add(1); + source->Add(2); + Arena destination_arena; + RepeatedField<int>* destination = + Arena::CreateMessage<RepeatedField<int>>(&destination_arena); + destination->Add(3); + *destination = std::move(*source); + EXPECT_THAT(*destination, ElementsAre(1, 2)); + // This property isn't guaranteed but it's useful to have a test that would + // catch changes in this area. + EXPECT_THAT(*source, ElementsAre(1, 2)); + } + { + Arena arena; + RepeatedField<int>* source = + Arena::CreateMessage<RepeatedField<int>>(&arena); + source->Add(1); + source->Add(2); + RepeatedField<int> destination; + destination.Add(3); + destination = std::move(*source); + EXPECT_THAT(destination, ElementsAre(1, 2)); + // This property isn't guaranteed but it's useful to have a test that would + // catch changes in this area. + EXPECT_THAT(*source, ElementsAre(1, 2)); + } + { + RepeatedField<int> source; + source.Add(1); + source.Add(2); + Arena arena; + RepeatedField<int>* destination = + Arena::CreateMessage<RepeatedField<int>>(&arena); + destination->Add(3); + *destination = std::move(source); + EXPECT_THAT(*destination, ElementsAre(1, 2)); + // This property isn't guaranteed but it's useful to have a test that would + // catch changes in this area. + EXPECT_THAT(source, ElementsAre(1, 2)); + } + { + RepeatedField<int> field; + // An alias to defeat -Wself-move. + RepeatedField<int>& alias = field; + field.Add(1); + field.Add(2); + const int* data = field.data(); + field = std::move(alias); + EXPECT_EQ(data, field.data()); + EXPECT_THAT(field, ElementsAre(1, 2)); + } + { + Arena arena; + RepeatedField<int>* field = + Arena::CreateMessage<RepeatedField<int>>(&arena); + field->Add(1); + field->Add(2); + const int* data = field->data(); + *field = std::move(*field); + EXPECT_EQ(data, field->data()); + EXPECT_THAT(*field, ElementsAre(1, 2)); + } +} + +#endif // LANG_CXX11 + TEST(RepeatedField, MutableDataIsMutable) { RepeatedField<int> field; field.Add(1); @@ -783,13 +912,6 @@ TEST(RepeatedPtrField, MergeFrom) { EXPECT_EQ("5", destination.Get(4)); } -#ifdef PROTOBUF_HAS_DEATH_TEST -TEST(RepeatedPtrField, MergeFromSelf) { - RepeatedPtrField<string> me; - me.Add()->assign("1"); - EXPECT_DEATH(me.MergeFrom(me), ""); -} -#endif // PROTOBUF_HAS_DEATH_TEST TEST(RepeatedPtrField, CopyFrom) { RepeatedPtrField<string> source, destination; @@ -923,6 +1045,142 @@ TEST(RepeatedPtrField, SelfAssign) { EXPECT_EQ("8", source.Get(1)); } +#if LANG_CXX11 + +TEST(RepeatedPtrField, MoveConstruct) { + { + RepeatedPtrField<string> source; + *source.Add() = "1"; + *source.Add() = "2"; + const string* const* data = source.data(); + RepeatedPtrField<string> destination = std::move(source); + EXPECT_EQ(data, destination.data()); + EXPECT_THAT(destination, ElementsAre("1", "2")); + // This property isn't guaranteed but it's useful to have a test that would + // catch changes in this area. + EXPECT_TRUE(source.empty()); + } + { + Arena arena; + RepeatedPtrField<string>* source = + Arena::CreateMessage<RepeatedPtrField<string>>(&arena); + *source->Add() = "1"; + *source->Add() = "2"; + RepeatedPtrField<string> destination = std::move(*source); + EXPECT_EQ(NULL, destination.GetArena()); + EXPECT_THAT(destination, ElementsAre("1", "2")); + // This property isn't guaranteed but it's useful to have a test that would + // catch changes in this area. + EXPECT_THAT(*source, ElementsAre("1", "2")); + } +} + +TEST(RepeatedPtrField, MoveAssign) { + { + RepeatedPtrField<string> source; + *source.Add() = "1"; + *source.Add() = "2"; + RepeatedPtrField<string> destination; + *destination.Add() = "3"; + const string* const* source_data = source.data(); + const string* const* destination_data = destination.data(); + destination = std::move(source); + EXPECT_EQ(source_data, destination.data()); + EXPECT_THAT(destination, ElementsAre("1", "2")); + // This property isn't guaranteed but it's useful to have a test that would + // catch changes in this area. + EXPECT_EQ(destination_data, source.data()); + EXPECT_THAT(source, ElementsAre("3")); + } + { + Arena arena; + RepeatedPtrField<string>* source = + Arena::CreateMessage<RepeatedPtrField<string>>(&arena); + *source->Add() = "1"; + *source->Add() = "2"; + RepeatedPtrField<string>* destination = + Arena::CreateMessage<RepeatedPtrField<string>>(&arena); + *destination->Add() = "3"; + const string* const* source_data = source->data(); + const string* const* destination_data = destination->data(); + *destination = std::move(*source); + EXPECT_EQ(source_data, destination->data()); + EXPECT_THAT(*destination, ElementsAre("1", "2")); + // This property isn't guaranteed but it's useful to have a test that would + // catch changes in this area. + EXPECT_EQ(destination_data, source->data()); + EXPECT_THAT(*source, ElementsAre("3")); + } + { + Arena source_arena; + RepeatedPtrField<string>* source = + Arena::CreateMessage<RepeatedPtrField<string>>(&source_arena); + *source->Add() = "1"; + *source->Add() = "2"; + Arena destination_arena; + RepeatedPtrField<string>* destination = + Arena::CreateMessage<RepeatedPtrField<string>>(&destination_arena); + *destination->Add() = "3"; + *destination = std::move(*source); + EXPECT_THAT(*destination, ElementsAre("1", "2")); + // This property isn't guaranteed but it's useful to have a test that would + // catch changes in this area. + EXPECT_THAT(*source, ElementsAre("1", "2")); + } + { + Arena arena; + RepeatedPtrField<string>* source = + Arena::CreateMessage<RepeatedPtrField<string>>(&arena); + *source->Add() = "1"; + *source->Add() = "2"; + RepeatedPtrField<string> destination; + *destination.Add() = "3"; + destination = std::move(*source); + EXPECT_THAT(destination, ElementsAre("1", "2")); + // This property isn't guaranteed but it's useful to have a test that would + // catch changes in this area. + EXPECT_THAT(*source, ElementsAre("1", "2")); + } + { + RepeatedPtrField<string> source; + *source.Add() = "1"; + *source.Add() = "2"; + Arena arena; + RepeatedPtrField<string>* destination = + Arena::CreateMessage<RepeatedPtrField<string>>(&arena); + *destination->Add() = "3"; + *destination = std::move(source); + EXPECT_THAT(*destination, ElementsAre("1", "2")); + // This property isn't guaranteed but it's useful to have a test that would + // catch changes in this area. + EXPECT_THAT(source, ElementsAre("1", "2")); + } + { + RepeatedPtrField<string> field; + // An alias to defeat -Wself-move. + RepeatedPtrField<string>& alias = field; + *field.Add() = "1"; + *field.Add() = "2"; + const string* const* data = field.data(); + field = std::move(alias); + EXPECT_EQ(data, field.data()); + EXPECT_THAT(field, ElementsAre("1", "2")); + } + { + Arena arena; + RepeatedPtrField<string>* field = + Arena::CreateMessage<RepeatedPtrField<string>>(&arena); + *field->Add() = "1"; + *field->Add() = "2"; + const string* const* data = field->data(); + *field = std::move(*field); + EXPECT_EQ(data, field->data()); + EXPECT_THAT(*field, ElementsAre("1", "2")); + } +} + +#endif // LANG_CXX11 + TEST(RepeatedPtrField, MutableDataIsMutable) { RepeatedPtrField<string> field; *field.Add() = "1"; diff --git a/src/google/protobuf/source_context.pb.cc b/src/google/protobuf/source_context.pb.cc index a69739c4..4a290e1e 100644 --- a/src/google/protobuf/source_context.pb.cc +++ b/src/google/protobuf/source_context.pb.cc @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/source_context.proto -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #include <google/protobuf/source_context.pb.h> #include <algorithm> @@ -15,57 +14,60 @@ #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> +// This is a temporary google only hack +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS +#include "third_party/protobuf/version.h" +#endif // @@protoc_insertion_point(includes) - namespace google { namespace protobuf { class SourceContextDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<SourceContext> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<SourceContext> + _instance; } _SourceContext_default_instance_; - +} // namespace protobuf +} // namespace google namespace protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto { +void InitDefaultsSourceContextImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_SourceContext_default_instance_; + new (ptr) ::google::protobuf::SourceContext(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::SourceContext::InitAsDefaultInstance(); +} -namespace { +void InitDefaultsSourceContext() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsSourceContextImpl); +} ::google::protobuf::Metadata file_level_metadata[1]; -} // namespace - -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField - const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0}, -}; - -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField - const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - ::google::protobuf::internal::AuxillaryParseTableField(), -}; -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const - TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, -}; - -const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { +const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceContext, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceContext, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceContext, file_name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::SourceContext, file_name_), }; -static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(SourceContext)}, +static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, sizeof(::google::protobuf::SourceContext)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { - reinterpret_cast<const ::google::protobuf::Message*>(&_SourceContext_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_SourceContext_default_instance_), }; -namespace { - void protobuf_AssignDescriptors() { AddDescriptors(); ::google::protobuf::MessageFactory* factory = NULL; @@ -79,29 +81,15 @@ void protobuf_AssignDescriptorsOnce() { ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); } -void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; +void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1); } -} // namespace -void TableStruct::InitDefaultsImpl() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::internal::InitProtobufDefaults(); - _SourceContext_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_SourceContext_default_instance_);} - -void InitDefaults() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl); -} -namespace { void AddDescriptorsImpl() { InitDefaults(); - static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { "\n$google/protobuf/source_context.proto\022\017" "google.protobuf\"\"\n\rSourceContext\022\021\n\tfile" "_name\030\001 \001(\tB\225\001\n\023com.google.protobufB\022Sou" @@ -115,7 +103,6 @@ void AddDescriptorsImpl() { ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/source_context.proto", &protobuf_RegisterTypes); } -} // anonymous namespace void AddDescriptors() { static GOOGLE_PROTOBUF_DECLARE_ONCE(once); @@ -127,12 +114,14 @@ struct StaticDescriptorInitializer { AddDescriptors(); } } static_descriptor_initializer; - } // namespace protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto - +namespace google { +namespace protobuf { // =================================================================== +void SourceContext::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int SourceContext::kFileNameFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -140,7 +129,7 @@ const int SourceContext::kFileNameFieldNumber; SourceContext::SourceContext() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::InitDefaultsSourceContext(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.SourceContext) @@ -177,12 +166,12 @@ void SourceContext::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* SourceContext::descriptor() { - protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const SourceContext& SourceContext::default_instance() { - protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::InitDefaultsSourceContext(); return *internal_default_instance(); } @@ -381,69 +370,11 @@ void SourceContext::InternalSwap(SourceContext* other) { ::google::protobuf::Metadata SourceContext::GetMetadata() const { protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// SourceContext - -// string file_name = 1; -void SourceContext::clear_file_name() { - file_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -const ::std::string& SourceContext::file_name() const { - // @@protoc_insertion_point(field_get:google.protobuf.SourceContext.file_name) - return file_name_.GetNoArena(); -} -void SourceContext::set_file_name(const ::std::string& value) { - - file_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.SourceContext.file_name) -} -#if LANG_CXX11 -void SourceContext::set_file_name(::std::string&& value) { - - file_name_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.SourceContext.file_name) -} -#endif -void SourceContext::set_file_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - - file_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.SourceContext.file_name) -} -void SourceContext::set_file_name(const char* value, size_t size) { - - file_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceContext.file_name) -} -::std::string* SourceContext::mutable_file_name() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.SourceContext.file_name) - return file_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* SourceContext::release_file_name() { - // @@protoc_insertion_point(field_release:google.protobuf.SourceContext.file_name) - - return file_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void SourceContext::set_allocated_file_name(::std::string* file_name) { - if (file_name != NULL) { - - } else { - - } - file_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), file_name); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceContext.file_name) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h index b4617c57..1e5499ca 100644 --- a/src/google/protobuf/source_context.pb.h +++ b/src/google/protobuf/source_context.pb.h @@ -30,31 +30,33 @@ #include <google/protobuf/extension_set.h> // IWYU pragma: export #include <google/protobuf/unknown_field_set.h> // @@protoc_insertion_point(includes) -namespace google { -namespace protobuf { -class SourceContext; -class SourceContextDefaultTypeInternal; -LIBPROTOBUF_EXPORT extern SourceContextDefaultTypeInternal _SourceContext_default_instance_; -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { namespace protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto { -// Internal implementation detail -- do not call these. +// Internal implementation detail -- do not use these members. struct LIBPROTOBUF_EXPORT TableStruct { static const ::google::protobuf::internal::ParseTableField entries[]; static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; - static const ::google::protobuf::internal::ParseTable schema[]; - static const ::google::protobuf::uint32 offsets[]; + static const ::google::protobuf::internal::ParseTable schema[1]; static const ::google::protobuf::internal::FieldMetadata field_metadata[]; static const ::google::protobuf::internal::SerializationTable serialization_table[]; - static void InitDefaultsImpl(); + static const ::google::protobuf::uint32 offsets[]; }; void LIBPROTOBUF_EXPORT AddDescriptors(); -void LIBPROTOBUF_EXPORT InitDefaults(); +void LIBPROTOBUF_EXPORT InitDefaultsSourceContextImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsSourceContext(); +inline void LIBPROTOBUF_EXPORT InitDefaults() { + InitDefaultsSourceContext(); +} } // namespace protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto +namespace google { +namespace protobuf { +class SourceContext; +class SourceContextDefaultTypeInternal; +LIBPROTOBUF_EXPORT extern SourceContextDefaultTypeInternal _SourceContext_default_instance_; +} // namespace protobuf +} // namespace google +namespace google { +namespace protobuf { // =================================================================== @@ -87,6 +89,7 @@ class LIBPROTOBUF_EXPORT SourceContext : public ::google::protobuf::Message /* @ static const ::google::protobuf::Descriptor* descriptor(); static const SourceContext& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const SourceContext* internal_default_instance() { return reinterpret_cast<const SourceContext*>( &_SourceContext_default_instance_); @@ -159,14 +162,14 @@ class LIBPROTOBUF_EXPORT SourceContext : public ::google::protobuf::Message /* @ ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::internal::ArenaStringPtr file_name_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::InitDefaultsSourceContextImpl(); }; // =================================================================== // =================================================================== -#if !PROTOBUF_INLINE_NOT_IN_HEADERS #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" @@ -229,11 +232,9 @@ inline void SourceContext::set_allocated_file_name(::std::string* file_name) { #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ -#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc index 02d9306e..fe3ba327 100644 --- a/src/google/protobuf/struct.pb.cc +++ b/src/google/protobuf/struct.pb.cc @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/struct.proto -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #include <google/protobuf/struct.pb.h> #include <algorithm> @@ -15,24 +14,27 @@ #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> +// This is a temporary google only hack +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS +#include "third_party/protobuf/version.h" +#endif // @@protoc_insertion_point(includes) - namespace google { namespace protobuf { -class Struct_FieldsEntryDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<Struct::Struct_FieldsEntry> - _instance; -} _Struct_FieldsEntry_default_instance_; +class Struct_FieldsEntry_DoNotUseDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed<Struct_FieldsEntry_DoNotUse> + _instance; +} _Struct_FieldsEntry_DoNotUse_default_instance_; class StructDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<Struct> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<Struct> + _instance; } _Struct_default_instance_; class ValueDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<Value> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<Value> + _instance; int null_value_; double number_value_; ::google::protobuf::internal::ArenaStringPtr string_value_; @@ -41,86 +43,109 @@ public: const ::google::protobuf::ListValue* list_value_; } _Value_default_instance_; class ListValueDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<ListValue> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<ListValue> + _instance; } _ListValue_default_instance_; - +} // namespace protobuf +} // namespace google namespace protobuf_google_2fprotobuf_2fstruct_2eproto { +void InitDefaultsListValueImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_Struct_FieldsEntry_DoNotUse_default_instance_; + new (ptr) ::google::protobuf::Struct_FieldsEntry_DoNotUse(); + } + { + void* ptr = &::google::protobuf::_Struct_default_instance_; + new (ptr) ::google::protobuf::Struct(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + { + void* ptr = &::google::protobuf::_Value_default_instance_; + new (ptr) ::google::protobuf::Value(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + { + void* ptr = &::google::protobuf::_ListValue_default_instance_; + new (ptr) ::google::protobuf::ListValue(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::Struct_FieldsEntry_DoNotUse::InitAsDefaultInstance(); + ::google::protobuf::Struct::InitAsDefaultInstance(); + ::google::protobuf::Value::InitAsDefaultInstance(); + ::google::protobuf::ListValue::InitAsDefaultInstance(); +} -namespace { +void InitDefaultsListValue() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsListValueImpl); +} ::google::protobuf::Metadata file_level_metadata[4]; const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[1]; -} // namespace - -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField - const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0}, -}; - -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField - const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - ::google::protobuf::internal::AuxillaryParseTableField(), -}; -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const - TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, -}; - -const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { +const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, key_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, value_), + 0, + 1, ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Struct, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Struct, fields_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct, fields_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Value, _internal_metadata_), ~0u, // no _extensions_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, _oneof_case_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Value, _oneof_case_[0]), ~0u, // no _weak_field_map_ - offsetof(ValueDefaultTypeInternal, null_value_), - offsetof(ValueDefaultTypeInternal, number_value_), - offsetof(ValueDefaultTypeInternal, string_value_), - offsetof(ValueDefaultTypeInternal, bool_value_), - offsetof(ValueDefaultTypeInternal, struct_value_), - offsetof(ValueDefaultTypeInternal, list_value_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, kind_), + offsetof(::google::protobuf::ValueDefaultTypeInternal, null_value_), + offsetof(::google::protobuf::ValueDefaultTypeInternal, number_value_), + offsetof(::google::protobuf::ValueDefaultTypeInternal, string_value_), + offsetof(::google::protobuf::ValueDefaultTypeInternal, bool_value_), + offsetof(::google::protobuf::ValueDefaultTypeInternal, struct_value_), + offsetof(::google::protobuf::ValueDefaultTypeInternal, list_value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Value, kind_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListValue, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ListValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListValue, values_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ListValue, values_), }; -static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(Struct)}, - { 6, -1, sizeof(Value)}, - { 18, -1, sizeof(ListValue)}, +static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + { 0, 7, sizeof(::google::protobuf::Struct_FieldsEntry_DoNotUse)}, + { 9, -1, sizeof(::google::protobuf::Struct)}, + { 15, -1, sizeof(::google::protobuf::Value)}, + { 27, -1, sizeof(::google::protobuf::ListValue)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { - reinterpret_cast<const ::google::protobuf::Message*>(&_Struct_FieldsEntry_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_Struct_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_Value_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_ListValue_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Struct_FieldsEntry_DoNotUse_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Struct_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Value_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_ListValue_default_instance_), }; -namespace { - void protobuf_AssignDescriptors() { AddDescriptors(); ::google::protobuf::MessageFactory* factory = NULL; AssignDescriptors( "google/protobuf/struct.proto", schemas, file_default_instances, TableStruct::offsets, factory, file_level_metadata, file_level_enum_descriptors, NULL); -file_level_metadata[0].reflection = Struct::Struct_FieldsEntry::CreateReflection(file_level_metadata[0].descriptor, _Struct_FieldsEntry_default_instance_._instance.get_mutable()); } void protobuf_AssignDescriptorsOnce() { @@ -128,46 +153,15 @@ void protobuf_AssignDescriptorsOnce() { ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); } -void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; +void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 4); } -} // namespace -void TableStruct::InitDefaultsImpl() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::internal::InitProtobufDefaults(); - _Struct_FieldsEntry_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_Struct_FieldsEntry_default_instance_);_Struct_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_Struct_default_instance_);_Value_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_Value_default_instance_);_ListValue_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_ListValue_default_instance_);_Struct_FieldsEntry_default_instance_._instance.get_mutable()->set_default_instance(_Struct_FieldsEntry_default_instance_._instance.get_mutable()); - _Struct_FieldsEntry_default_instance_._instance.get_mutable()->InitAsDefaultInstance(); - _Value_default_instance_.null_value_ = 0; - _Value_default_instance_.number_value_ = 0; - _Value_default_instance_.string_value_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - _Value_default_instance_.bool_value_ = false; - _Value_default_instance_.struct_value_ = const_cast< ::google::protobuf::Struct*>( - ::google::protobuf::Struct::internal_default_instance()); - _Value_default_instance_.list_value_ = const_cast< ::google::protobuf::ListValue*>( - ::google::protobuf::ListValue::internal_default_instance()); -} - -void InitDefaults() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl); -} -namespace { void AddDescriptorsImpl() { InitDefaults(); - static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { "\n\034google/protobuf/struct.proto\022\017google.p" "rotobuf\"\204\001\n\006Struct\0223\n\006fields\030\001 \003(\0132#.goo" "gle.protobuf.Struct.FieldsEntry\032E\n\013Field" @@ -191,7 +185,6 @@ void AddDescriptorsImpl() { ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/struct.proto", &protobuf_RegisterTypes); } -} // anonymous namespace void AddDescriptors() { static GOOGLE_PROTOBUF_DECLARE_ONCE(once); @@ -203,9 +196,9 @@ struct StaticDescriptorInitializer { AddDescriptors(); } } static_descriptor_initializer; - } // namespace protobuf_google_2fprotobuf_2fstruct_2eproto - +namespace google { +namespace protobuf { const ::google::protobuf::EnumDescriptor* NullValue_descriptor() { protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce(); return protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_enum_descriptors[0]; @@ -222,25 +215,25 @@ bool NullValue_IsValid(int value) { // =================================================================== -Struct::Struct_FieldsEntry::Struct_FieldsEntry() {} -Struct::Struct_FieldsEntry::Struct_FieldsEntry(::google::protobuf::Arena* arena) : SuperType(arena) {} -::google::protobuf::Metadata Struct::Struct_FieldsEntry::GetMetadata() const { - protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[0]; +Struct_FieldsEntry_DoNotUse::Struct_FieldsEntry_DoNotUse() {} +Struct_FieldsEntry_DoNotUse::Struct_FieldsEntry_DoNotUse(::google::protobuf::Arena* arena) : SuperType(arena) {} +void Struct_FieldsEntry_DoNotUse::MergeFrom(const Struct_FieldsEntry_DoNotUse& other) { + MergeFromInternal(other); +} +::google::protobuf::Metadata Struct_FieldsEntry_DoNotUse::GetMetadata() const { + ::protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[0]; } -void Struct::Struct_FieldsEntry::MergeFrom( +void Struct_FieldsEntry_DoNotUse::MergeFrom( const ::google::protobuf::Message& other) { ::google::protobuf::Message::MergeFrom(other); } -void Struct::Struct_FieldsEntry::MergeFrom(const Struct_FieldsEntry& other) { - MergeFromInternal(other); -} -#if PROTOBUF_INLINE_NOT_IN_HEADERS -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void Struct::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int Struct::kFieldsFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -248,7 +241,7 @@ const int Struct::kFieldsFieldNumber; Struct::Struct() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValue(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.Struct) @@ -257,7 +250,7 @@ Struct::Struct(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena), fields_(arena) { - protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValue(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Struct) @@ -281,12 +274,7 @@ Struct::~Struct() { } void Struct::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } void Struct::ArenaDtor(void* object) { @@ -301,12 +289,12 @@ void Struct::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* Struct::descriptor() { - protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const Struct& Struct::default_instance() { - protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValue(); return *internal_default_instance(); } @@ -338,8 +326,8 @@ bool Struct::MergePartialFromCodedStream( case 1: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - Struct_FieldsEntry::Parser< ::google::protobuf::internal::MapField< - Struct_FieldsEntry, + Struct_FieldsEntry_DoNotUse::Parser< ::google::protobuf::internal::MapField< + Struct_FieldsEntry_DoNotUse, ::std::string, ::google::protobuf::Value, ::google::protobuf::internal::WireFormatLite::TYPE_STRING, ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE, @@ -410,7 +398,7 @@ void Struct::SerializeWithCachedSizes( items[static_cast<ptrdiff_t>(n)] = SortItem(&*it); } ::std::sort(&items[0], &items[static_cast<ptrdiff_t>(n)], Less()); - ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry; + ::google::protobuf::scoped_ptr<Struct_FieldsEntry_DoNotUse> entry; for (size_type i = 0; i < n; i++) { entry.reset(fields_.NewEntryWrapper( items[static_cast<ptrdiff_t>(i)]->first, items[static_cast<ptrdiff_t>(i)]->second)); @@ -422,7 +410,7 @@ void Struct::SerializeWithCachedSizes( Utf8Check::Check(items[static_cast<ptrdiff_t>(i)]); } } else { - ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry; + ::google::protobuf::scoped_ptr<Struct_FieldsEntry_DoNotUse> entry; for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator it = this->fields().begin(); it != this->fields().end(); ++it) { @@ -479,7 +467,7 @@ void Struct::SerializeWithCachedSizes( items[static_cast<ptrdiff_t>(n)] = SortItem(&*it); } ::std::sort(&items[0], &items[static_cast<ptrdiff_t>(n)], Less()); - ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry; + ::google::protobuf::scoped_ptr<Struct_FieldsEntry_DoNotUse> entry; for (size_type i = 0; i < n; i++) { entry.reset(fields_.NewEntryWrapper( items[static_cast<ptrdiff_t>(i)]->first, items[static_cast<ptrdiff_t>(i)]->second)); @@ -493,7 +481,7 @@ void Struct::SerializeWithCachedSizes( Utf8Check::Check(items[static_cast<ptrdiff_t>(i)]); } } else { - ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry; + ::google::protobuf::scoped_ptr<Struct_FieldsEntry_DoNotUse> entry; for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator it = this->fields().begin(); it != this->fields().end(); ++it) { @@ -532,7 +520,7 @@ size_t Struct::ByteSizeLong() const { total_size += 1 * ::google::protobuf::internal::FromIntSize(this->fields_size()); { - ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry; + ::google::protobuf::scoped_ptr<Struct_FieldsEntry_DoNotUse> entry; for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator it = this->fields().begin(); it != this->fields().end(); ++it) { @@ -626,34 +614,53 @@ void Struct::InternalSwap(Struct* other) { ::google::protobuf::Metadata Struct::GetMetadata() const { protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// Struct -// map<string, .google.protobuf.Value> fields = 1; -int Struct::fields_size() const { - return fields_.size(); -} -void Struct::clear_fields() { - fields_.Clear(); +// =================================================================== + +void Value::InitAsDefaultInstance() { + ::google::protobuf::_Value_default_instance_.null_value_ = 0; + ::google::protobuf::_Value_default_instance_.number_value_ = 0; + ::google::protobuf::_Value_default_instance_.string_value_.UnsafeSetDefault( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::google::protobuf::_Value_default_instance_.bool_value_ = false; + ::google::protobuf::_Value_default_instance_.struct_value_ = const_cast< ::google::protobuf::Struct*>( + ::google::protobuf::Struct::internal_default_instance()); + ::google::protobuf::_Value_default_instance_.list_value_ = const_cast< ::google::protobuf::ListValue*>( + ::google::protobuf::ListValue::internal_default_instance()); } - const ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >& -Struct::fields() const { - // @@protoc_insertion_point(field_map:google.protobuf.Struct.fields) - return fields_.GetMap(); +void Value::set_allocated_struct_value(::google::protobuf::Struct* struct_value) { + ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); + clear_kind(); + if (struct_value) { + ::google::protobuf::Arena* submessage_arena = + ::google::protobuf::Arena::GetArena(struct_value); + if (message_arena != submessage_arena) { + struct_value = ::google::protobuf::internal::GetOwnedMessage( + message_arena, struct_value, submessage_arena); + } + set_has_struct_value(); + kind_.struct_value_ = struct_value; + } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.struct_value) } - ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >* -Struct::mutable_fields() { - // @@protoc_insertion_point(field_mutable_map:google.protobuf.Struct.fields) - return fields_.MutableMap(); +void Value::set_allocated_list_value(::google::protobuf::ListValue* list_value) { + ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); + clear_kind(); + if (list_value) { + ::google::protobuf::Arena* submessage_arena = + ::google::protobuf::Arena::GetArena(list_value); + if (message_arena != submessage_arena) { + list_value = ::google::protobuf::internal::GetOwnedMessage( + message_arena, list_value, submessage_arena); + } + set_has_list_value(); + kind_.list_value_ = list_value; + } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.list_value) } - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int Value::kNullValueFieldNumber; const int Value::kNumberValueFieldNumber; @@ -666,7 +673,7 @@ const int Value::kListValueFieldNumber; Value::Value() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValue(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.Value) @@ -674,7 +681,7 @@ Value::Value() Value::Value(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena) { - protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValue(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Value) @@ -728,12 +735,7 @@ Value::~Value() { } void Value::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); if (has_kind()) { clear_kind(); } @@ -751,12 +753,12 @@ void Value::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* Value::descriptor() { - protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const Value& Value::default_instance() { - protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValue(); return *internal_default_instance(); } @@ -889,7 +891,7 @@ bool Value::MergePartialFromCodedStream( case 5: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_struct_value())); } else { goto handle_unusual; @@ -901,7 +903,7 @@ bool Value::MergePartialFromCodedStream( case 6: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(50u /* 50 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_list_value())); } else { goto handle_unusual; @@ -1017,14 +1019,14 @@ void Value::SerializeWithCachedSizes( // .google.protobuf.Struct struct_value = 5; if (has_struct_value()) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 5, *kind_.struct_value_, deterministic, target); } // .google.protobuf.ListValue list_value = 6; if (has_list_value()) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 6, *kind_.list_value_, deterministic, target); } @@ -1072,14 +1074,14 @@ size_t Value::ByteSizeLong() const { // .google.protobuf.Struct struct_value = 5; case kStructValue: { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *kind_.struct_value_); break; } // .google.protobuf.ListValue list_value = 6; case kListValue: { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *kind_.list_value_); break; } @@ -1194,411 +1196,14 @@ void Value::InternalSwap(Value* other) { ::google::protobuf::Metadata Value::GetMetadata() const { protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// Value - -// .google.protobuf.NullValue null_value = 1; -bool Value::has_null_value() const { - return kind_case() == kNullValue; -} -void Value::set_has_null_value() { - _oneof_case_[0] = kNullValue; -} -void Value::clear_null_value() { - if (has_null_value()) { - kind_.null_value_ = 0; - clear_has_kind(); - } -} -::google::protobuf::NullValue Value::null_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.Value.null_value) - if (has_null_value()) { - return static_cast< ::google::protobuf::NullValue >(kind_.null_value_); - } - return static_cast< ::google::protobuf::NullValue >(0); -} -void Value::set_null_value(::google::protobuf::NullValue value) { - if (!has_null_value()) { - clear_kind(); - set_has_null_value(); - } - kind_.null_value_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Value.null_value) -} - -// double number_value = 2; -bool Value::has_number_value() const { - return kind_case() == kNumberValue; -} -void Value::set_has_number_value() { - _oneof_case_[0] = kNumberValue; -} -void Value::clear_number_value() { - if (has_number_value()) { - kind_.number_value_ = 0; - clear_has_kind(); - } -} -double Value::number_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.Value.number_value) - if (has_number_value()) { - return kind_.number_value_; - } - return 0; -} -void Value::set_number_value(double value) { - if (!has_number_value()) { - clear_kind(); - set_has_number_value(); - } - kind_.number_value_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Value.number_value) -} - -// string string_value = 3; -bool Value::has_string_value() const { - return kind_case() == kStringValue; -} -void Value::set_has_string_value() { - _oneof_case_[0] = kStringValue; -} -void Value::clear_string_value() { - if (has_string_value()) { - kind_.string_value_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); - clear_has_kind(); - } -} -const ::std::string& Value::string_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.Value.string_value) - if (has_string_value()) { - return kind_.string_value_.Get(); - } - return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); -} -void Value::set_string_value(const ::std::string& value) { - if (!has_string_value()) { - clear_kind(); - set_has_string_value(); - kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - kind_.string_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set:google.protobuf.Value.string_value) -} -#if LANG_CXX11 -void Value::set_string_value(::std::string&& value) { - // @@protoc_insertion_point(field_set:google.protobuf.Value.string_value) - if (!has_string_value()) { - clear_kind(); - set_has_string_value(); - kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - kind_.string_value_.Set( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Value.string_value) -} -#endif -void Value::set_string_value(const char* value) { - GOOGLE_DCHECK(value != NULL); - if (!has_string_value()) { - clear_kind(); - set_has_string_value(); - kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - kind_.string_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_char:google.protobuf.Value.string_value) -} -void Value::set_string_value(const char* value, - size_t size) { - if (!has_string_value()) { - clear_kind(); - set_has_string_value(); - kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - kind_.string_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( - reinterpret_cast<const char*>(value), size), - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Value.string_value) -} -::std::string* Value::mutable_string_value() { - if (!has_string_value()) { - clear_kind(); - set_has_string_value(); - kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - return kind_.string_value_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_mutable:google.protobuf.Value.string_value) -} -::std::string* Value::release_string_value() { - // @@protoc_insertion_point(field_release:google.protobuf.Value.string_value) - if (has_string_value()) { - clear_has_kind(); - return kind_.string_value_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); - } else { - return NULL; - } -} -::std::string* Value::unsafe_arena_release_string_value() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.string_value) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - if (has_string_value()) { - clear_has_kind(); - return kind_.string_value_.UnsafeArenaRelease( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); - } else { - return NULL; - } -} -void Value::set_allocated_string_value(::std::string* string_value) { - if (!has_string_value()) { - kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - clear_kind(); - if (string_value != NULL) { - set_has_string_value(); - kind_.string_value_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), string_value, - GetArenaNoVirtual()); - } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.string_value) -} -void Value::unsafe_arena_set_allocated_string_value(::std::string* string_value) { - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - if (!has_string_value()) { - kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - clear_kind(); - if (string_value) { - set_has_string_value(); - kind_.string_value_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), string_value, GetArenaNoVirtual()); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.string_value) -} - -// bool bool_value = 4; -bool Value::has_bool_value() const { - return kind_case() == kBoolValue; -} -void Value::set_has_bool_value() { - _oneof_case_[0] = kBoolValue; -} -void Value::clear_bool_value() { - if (has_bool_value()) { - kind_.bool_value_ = false; - clear_has_kind(); - } -} -bool Value::bool_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.Value.bool_value) - if (has_bool_value()) { - return kind_.bool_value_; - } - return false; -} -void Value::set_bool_value(bool value) { - if (!has_bool_value()) { - clear_kind(); - set_has_bool_value(); - } - kind_.bool_value_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Value.bool_value) -} - -// .google.protobuf.Struct struct_value = 5; -bool Value::has_struct_value() const { - return kind_case() == kStructValue; -} -void Value::set_has_struct_value() { - _oneof_case_[0] = kStructValue; -} -void Value::clear_struct_value() { - if (has_struct_value()) { - if (GetArenaNoVirtual() == NULL) { - delete kind_.struct_value_; - } - clear_has_kind(); - } -} - const ::google::protobuf::Struct& Value::struct_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.Value.struct_value) - return has_struct_value() - ? *kind_.struct_value_ - : ::google::protobuf::Struct::default_instance(); -} -::google::protobuf::Struct* Value::mutable_struct_value() { - if (!has_struct_value()) { - clear_kind(); - set_has_struct_value(); - kind_.struct_value_ = - ::google::protobuf::Arena::CreateMessage< ::google::protobuf::Struct >( - GetArenaNoVirtual()); - } - // @@protoc_insertion_point(field_mutable:google.protobuf.Value.struct_value) - return kind_.struct_value_; -} -::google::protobuf::Struct* Value::release_struct_value() { - // @@protoc_insertion_point(field_release:google.protobuf.Value.struct_value) - if (has_struct_value()) { - clear_has_kind(); - if (GetArenaNoVirtual() != NULL) { - ::google::protobuf::Struct* temp = new ::google::protobuf::Struct(*kind_.struct_value_); - kind_.struct_value_ = NULL; - return temp; - } else { - ::google::protobuf::Struct* temp = kind_.struct_value_; - kind_.struct_value_ = NULL; - return temp; - } - } else { - return NULL; - } -} -void Value::set_allocated_struct_value(::google::protobuf::Struct* struct_value) { - clear_kind(); - if (struct_value) { - if (GetArenaNoVirtual() != NULL && - ::google::protobuf::Arena::GetArena(struct_value) == NULL) { - GetArenaNoVirtual()->Own(struct_value); - } else if (GetArenaNoVirtual() != - ::google::protobuf::Arena::GetArena(struct_value)) { - ::google::protobuf::Struct* new_struct_value = - ::google::protobuf::Arena::CreateMessage< ::google::protobuf::Struct >( - GetArenaNoVirtual()); - new_struct_value->CopyFrom(*struct_value); - struct_value = new_struct_value; - } - set_has_struct_value(); - kind_.struct_value_ = struct_value; - } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.struct_value) -} - ::google::protobuf::Struct* Value::unsafe_arena_release_struct_value() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.struct_value) - if (has_struct_value()) { - clear_has_kind(); - ::google::protobuf::Struct* temp = kind_.struct_value_; - kind_.struct_value_ = NULL; - return temp; - } else { - return NULL; - } -} - void Value::unsafe_arena_set_allocated_struct_value(::google::protobuf::Struct* struct_value) { - clear_kind(); - if (struct_value) { - set_has_struct_value(); - kind_.struct_value_ = struct_value; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.struct_value) -} - -// .google.protobuf.ListValue list_value = 6; -bool Value::has_list_value() const { - return kind_case() == kListValue; -} -void Value::set_has_list_value() { - _oneof_case_[0] = kListValue; -} -void Value::clear_list_value() { - if (has_list_value()) { - if (GetArenaNoVirtual() == NULL) { - delete kind_.list_value_; - } - clear_has_kind(); - } -} - const ::google::protobuf::ListValue& Value::list_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.Value.list_value) - return has_list_value() - ? *kind_.list_value_ - : ::google::protobuf::ListValue::default_instance(); -} -::google::protobuf::ListValue* Value::mutable_list_value() { - if (!has_list_value()) { - clear_kind(); - set_has_list_value(); - kind_.list_value_ = - ::google::protobuf::Arena::CreateMessage< ::google::protobuf::ListValue >( - GetArenaNoVirtual()); - } - // @@protoc_insertion_point(field_mutable:google.protobuf.Value.list_value) - return kind_.list_value_; -} -::google::protobuf::ListValue* Value::release_list_value() { - // @@protoc_insertion_point(field_release:google.protobuf.Value.list_value) - if (has_list_value()) { - clear_has_kind(); - if (GetArenaNoVirtual() != NULL) { - ::google::protobuf::ListValue* temp = new ::google::protobuf::ListValue(*kind_.list_value_); - kind_.list_value_ = NULL; - return temp; - } else { - ::google::protobuf::ListValue* temp = kind_.list_value_; - kind_.list_value_ = NULL; - return temp; - } - } else { - return NULL; - } -} -void Value::set_allocated_list_value(::google::protobuf::ListValue* list_value) { - clear_kind(); - if (list_value) { - if (GetArenaNoVirtual() != NULL && - ::google::protobuf::Arena::GetArena(list_value) == NULL) { - GetArenaNoVirtual()->Own(list_value); - } else if (GetArenaNoVirtual() != - ::google::protobuf::Arena::GetArena(list_value)) { - ::google::protobuf::ListValue* new_list_value = - ::google::protobuf::Arena::CreateMessage< ::google::protobuf::ListValue >( - GetArenaNoVirtual()); - new_list_value->CopyFrom(*list_value); - list_value = new_list_value; - } - set_has_list_value(); - kind_.list_value_ = list_value; - } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.list_value) -} - ::google::protobuf::ListValue* Value::unsafe_arena_release_list_value() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.list_value) - if (has_list_value()) { - clear_has_kind(); - ::google::protobuf::ListValue* temp = kind_.list_value_; - kind_.list_value_ = NULL; - return temp; - } else { - return NULL; - } -} - void Value::unsafe_arena_set_allocated_list_value(::google::protobuf::ListValue* list_value) { - clear_kind(); - if (list_value) { - set_has_list_value(); - kind_.list_value_ = list_value; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.list_value) -} - -bool Value::has_kind() const { - return kind_case() != KIND_NOT_SET; -} -void Value::clear_has_kind() { - _oneof_case_[0] = KIND_NOT_SET; -} -Value::KindCase Value::kind_case() const { - return Value::KindCase(_oneof_case_[0]); -} -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void ListValue::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int ListValue::kValuesFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -1606,7 +1211,7 @@ const int ListValue::kValuesFieldNumber; ListValue::ListValue() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValue(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.ListValue) @@ -1615,7 +1220,7 @@ ListValue::ListValue(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena), values_(arena) { - protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValue(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.ListValue) @@ -1639,12 +1244,7 @@ ListValue::~ListValue() { } void ListValue::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } void ListValue::ArenaDtor(void* object) { @@ -1659,12 +1259,12 @@ void ListValue::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* ListValue::descriptor() { - protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const ListValue& ListValue::default_instance() { - protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValue(); return *internal_default_instance(); } @@ -1696,8 +1296,7 @@ bool ListValue::MergePartialFromCodedStream( case 1: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_values())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_values())); } else { goto handle_unusual; } @@ -1755,7 +1354,7 @@ void ListValue::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->values_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 1, this->values(static_cast<int>(i)), deterministic, target); } @@ -1782,7 +1381,7 @@ size_t ListValue::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->values(static_cast<int>(i))); } } @@ -1865,46 +1464,11 @@ void ListValue::InternalSwap(ListValue* other) { ::google::protobuf::Metadata ListValue::GetMetadata() const { protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// ListValue - -// repeated .google.protobuf.Value values = 1; -int ListValue::values_size() const { - return values_.size(); -} -void ListValue::clear_values() { - values_.Clear(); -} -const ::google::protobuf::Value& ListValue::values(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.ListValue.values) - return values_.Get(index); -} -::google::protobuf::Value* ListValue::mutable_values(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.ListValue.values) - return values_.Mutable(index); -} -::google::protobuf::Value* ListValue::add_values() { - // @@protoc_insertion_point(field_add:google.protobuf.ListValue.values) - return values_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >* -ListValue::mutable_values() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.ListValue.values) - return &values_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >& -ListValue::values() const { - // @@protoc_insertion_point(field_list:google.protobuf.ListValue.values) - return values_; + return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages]; } -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h index 57ae7d90..83b7da6d 100644 --- a/src/google/protobuf/struct.pb.h +++ b/src/google/protobuf/struct.pb.h @@ -34,6 +34,24 @@ #include <google/protobuf/generated_enum_reflection.h> #include <google/protobuf/unknown_field_set.h> // @@protoc_insertion_point(includes) + +namespace protobuf_google_2fprotobuf_2fstruct_2eproto { +// Internal implementation detail -- do not use these members. +struct LIBPROTOBUF_EXPORT TableStruct { + static const ::google::protobuf::internal::ParseTableField entries[]; + static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; + static const ::google::protobuf::internal::ParseTable schema[4]; + static const ::google::protobuf::internal::FieldMetadata field_metadata[]; + static const ::google::protobuf::internal::SerializationTable serialization_table[]; + static const ::google::protobuf::uint32 offsets[]; +}; +void LIBPROTOBUF_EXPORT AddDescriptors(); +void LIBPROTOBUF_EXPORT InitDefaultsListValueImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsListValue(); +inline void LIBPROTOBUF_EXPORT InitDefaults() { + InitDefaultsListValue(); +} +} // namespace protobuf_google_2fprotobuf_2fstruct_2eproto namespace google { namespace protobuf { class ListValue; @@ -42,33 +60,17 @@ LIBPROTOBUF_EXPORT extern ListValueDefaultTypeInternal _ListValue_default_instan class Struct; class StructDefaultTypeInternal; LIBPROTOBUF_EXPORT extern StructDefaultTypeInternal _Struct_default_instance_; -class Struct_FieldsEntry; -class Struct_FieldsEntryDefaultTypeInternal; -LIBPROTOBUF_EXPORT extern Struct_FieldsEntryDefaultTypeInternal _Struct_FieldsEntry_default_instance_; +class Struct_FieldsEntry_DoNotUse; +class Struct_FieldsEntry_DoNotUseDefaultTypeInternal; +LIBPROTOBUF_EXPORT extern Struct_FieldsEntry_DoNotUseDefaultTypeInternal _Struct_FieldsEntry_DoNotUse_default_instance_; class Value; class ValueDefaultTypeInternal; LIBPROTOBUF_EXPORT extern ValueDefaultTypeInternal _Value_default_instance_; } // namespace protobuf } // namespace google - namespace google { namespace protobuf { -namespace protobuf_google_2fprotobuf_2fstruct_2eproto { -// Internal implementation detail -- do not call these. -struct LIBPROTOBUF_EXPORT TableStruct { - static const ::google::protobuf::internal::ParseTableField entries[]; - static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; - static const ::google::protobuf::internal::ParseTable schema[]; - static const ::google::protobuf::uint32 offsets[]; - static const ::google::protobuf::internal::FieldMetadata field_metadata[]; - static const ::google::protobuf::internal::SerializationTable serialization_table[]; - static void InitDefaultsImpl(); -}; -void LIBPROTOBUF_EXPORT AddDescriptors(); -void LIBPROTOBUF_EXPORT InitDefaults(); -} // namespace protobuf_google_2fprotobuf_2fstruct_2eproto - enum NullValue { NULL_VALUE = 0, NullValue_INT_MIN_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32min, @@ -91,6 +93,24 @@ inline bool NullValue_Parse( } // =================================================================== +class Struct_FieldsEntry_DoNotUse : public ::google::protobuf::internal::MapEntry<Struct_FieldsEntry_DoNotUse, + ::std::string, ::google::protobuf::Value, + ::google::protobuf::internal::WireFormatLite::TYPE_STRING, + ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE, + 0 > { +public: + typedef ::google::protobuf::internal::MapEntry<Struct_FieldsEntry_DoNotUse, + ::std::string, ::google::protobuf::Value, + ::google::protobuf::internal::WireFormatLite::TYPE_STRING, + ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE, + 0 > SuperType; + Struct_FieldsEntry_DoNotUse(); + Struct_FieldsEntry_DoNotUse(::google::protobuf::Arena* arena); + void MergeFrom(const Struct_FieldsEntry_DoNotUse& other); + static const Struct_FieldsEntry_DoNotUse* internal_default_instance() { return reinterpret_cast<const Struct_FieldsEntry_DoNotUse*>(&_Struct_FieldsEntry_DoNotUse_default_instance_); } + void MergeFrom(const ::google::protobuf::Message& other) PROTOBUF_FINAL; + ::google::protobuf::Metadata GetMetadata() const; +}; // ------------------------------------------------------------------- @@ -129,6 +149,7 @@ class LIBPROTOBUF_EXPORT Struct : public ::google::protobuf::Message /* @@protoc static const ::google::protobuf::Descriptor* descriptor(); static const Struct& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Struct* internal_default_instance() { return reinterpret_cast<const Struct*>( &_Struct_default_instance_); @@ -204,35 +225,15 @@ class LIBPROTOBUF_EXPORT Struct : public ::google::protobuf::Message /* @@protoc template <typename T> friend class ::google::protobuf::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - public: - class Struct_FieldsEntry : public ::google::protobuf::internal::MapEntry<Struct_FieldsEntry, - ::std::string, ::google::protobuf::Value, - ::google::protobuf::internal::WireFormatLite::TYPE_STRING, - ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE, - 0 > { - public: - typedef ::google::protobuf::internal::MapEntry<Struct_FieldsEntry, - ::std::string, ::google::protobuf::Value, - ::google::protobuf::internal::WireFormatLite::TYPE_STRING, - ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE, - 0 > SuperType; - Struct_FieldsEntry(); - Struct_FieldsEntry(::google::protobuf::Arena* arena); - void MergeFrom(const ::google::protobuf::Message& other) PROTOBUF_FINAL; - void MergeFrom(const Struct_FieldsEntry& other); - static const Message* internal_default_instance() { return reinterpret_cast<const Message*>(&_Struct_FieldsEntry_default_instance_); } - ::google::protobuf::Metadata GetMetadata() const; - }; - private: ::google::protobuf::internal::MapField< - Struct_FieldsEntry, + Struct_FieldsEntry_DoNotUse, ::std::string, ::google::protobuf::Value, ::google::protobuf::internal::WireFormatLite::TYPE_STRING, ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE, 0 > fields_; - private: mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2fstruct_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fstruct_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValueImpl(); }; // ------------------------------------------------------------------- @@ -281,6 +282,7 @@ class LIBPROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_ KIND_NOT_SET = 0, }; + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Value* internal_default_instance() { return reinterpret_cast<const Value*>( &_Value_default_instance_); @@ -373,7 +375,13 @@ class LIBPROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_ ::std::string* mutable_string_value(); ::std::string* release_string_value(); void set_allocated_string_value(::std::string* string_value); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") ::std::string* unsafe_arena_release_string_value(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") void unsafe_arena_set_allocated_string_value( ::std::string* string_value); @@ -392,17 +400,14 @@ class LIBPROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_ static const int kStructValueFieldNumber = 5; private: void _slow_mutable_struct_value(); - void _slow_set_allocated_struct_value( - ::google::protobuf::Arena* message_arena, ::google::protobuf::Struct** struct_value); - ::google::protobuf::Struct* _slow_release_struct_value(); public: const ::google::protobuf::Struct& struct_value() const; - ::google::protobuf::Struct* mutable_struct_value(); ::google::protobuf::Struct* release_struct_value(); + ::google::protobuf::Struct* mutable_struct_value(); void set_allocated_struct_value(::google::protobuf::Struct* struct_value); - ::google::protobuf::Struct* unsafe_arena_release_struct_value(); void unsafe_arena_set_allocated_struct_value( ::google::protobuf::Struct* struct_value); + ::google::protobuf::Struct* unsafe_arena_release_struct_value(); // .google.protobuf.ListValue list_value = 6; bool has_list_value() const; @@ -410,17 +415,14 @@ class LIBPROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_ static const int kListValueFieldNumber = 6; private: void _slow_mutable_list_value(); - void _slow_set_allocated_list_value( - ::google::protobuf::Arena* message_arena, ::google::protobuf::ListValue** list_value); - ::google::protobuf::ListValue* _slow_release_list_value(); public: const ::google::protobuf::ListValue& list_value() const; - ::google::protobuf::ListValue* mutable_list_value(); ::google::protobuf::ListValue* release_list_value(); + ::google::protobuf::ListValue* mutable_list_value(); void set_allocated_list_value(::google::protobuf::ListValue* list_value); - ::google::protobuf::ListValue* unsafe_arena_release_list_value(); void unsafe_arena_set_allocated_list_value( ::google::protobuf::ListValue* list_value); + ::google::protobuf::ListValue* unsafe_arena_release_list_value(); KindCase kind_case() const; // @@protoc_insertion_point(class_scope:google.protobuf.Value) @@ -452,7 +454,8 @@ class LIBPROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_ mutable int _cached_size_; ::google::protobuf::uint32 _oneof_case_[1]; - friend struct protobuf_google_2fprotobuf_2fstruct_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fstruct_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValueImpl(); }; // ------------------------------------------------------------------- @@ -491,6 +494,7 @@ class LIBPROTOBUF_EXPORT ListValue : public ::google::protobuf::Message /* @@pro static const ::google::protobuf::Descriptor* descriptor(); static const ListValue& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const ListValue* internal_default_instance() { return reinterpret_cast<const ListValue*>( &_ListValue_default_instance_); @@ -570,14 +574,14 @@ class LIBPROTOBUF_EXPORT ListValue : public ::google::protobuf::Message /* @@pro typedef void DestructorSkippable_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value > values_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2fstruct_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fstruct_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValueImpl(); }; // =================================================================== // =================================================================== -#if !PROTOBUF_INLINE_NOT_IN_HEADERS #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" @@ -728,7 +732,8 @@ inline void Value::set_string_value(const char* value, set_has_string_value(); kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - kind_.string_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + kind_.string_value_.Set( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_pointer:google.protobuf.Value.string_value) @@ -753,17 +758,6 @@ inline ::std::string* Value::release_string_value() { return NULL; } } -inline ::std::string* Value::unsafe_arena_release_string_value() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.string_value) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - if (has_string_value()) { - clear_has_kind(); - return kind_.string_value_.UnsafeArenaRelease( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); - } else { - return NULL; - } -} inline void Value::set_allocated_string_value(::std::string* string_value) { if (!has_string_value()) { kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -776,6 +770,17 @@ inline void Value::set_allocated_string_value(::std::string* string_value) { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.string_value) } +inline ::std::string* Value::unsafe_arena_release_string_value() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.string_value) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + if (has_string_value()) { + clear_has_kind(); + return kind_.string_value_.UnsafeArenaRelease( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); + } else { + return NULL; + } +} inline void Value::unsafe_arena_set_allocated_string_value(::std::string* string_value) { GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); if (!has_string_value()) { @@ -833,60 +838,27 @@ inline void Value::clear_struct_value() { clear_has_kind(); } } -inline const ::google::protobuf::Struct& Value::struct_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.Value.struct_value) - return has_struct_value() - ? *kind_.struct_value_ - : ::google::protobuf::Struct::default_instance(); -} -inline ::google::protobuf::Struct* Value::mutable_struct_value() { - if (!has_struct_value()) { - clear_kind(); - set_has_struct_value(); - kind_.struct_value_ = - ::google::protobuf::Arena::CreateMessage< ::google::protobuf::Struct >( - GetArenaNoVirtual()); - } - // @@protoc_insertion_point(field_mutable:google.protobuf.Value.struct_value) - return kind_.struct_value_; -} inline ::google::protobuf::Struct* Value::release_struct_value() { // @@protoc_insertion_point(field_release:google.protobuf.Value.struct_value) if (has_struct_value()) { clear_has_kind(); - if (GetArenaNoVirtual() != NULL) { - ::google::protobuf::Struct* temp = new ::google::protobuf::Struct(*kind_.struct_value_); - kind_.struct_value_ = NULL; - return temp; - } else { ::google::protobuf::Struct* temp = kind_.struct_value_; - kind_.struct_value_ = NULL; - return temp; + if (GetArenaNoVirtual() != NULL) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL); } + kind_.struct_value_ = NULL; + return temp; } else { return NULL; } } -inline void Value::set_allocated_struct_value(::google::protobuf::Struct* struct_value) { - clear_kind(); - if (struct_value) { - if (GetArenaNoVirtual() != NULL && - ::google::protobuf::Arena::GetArena(struct_value) == NULL) { - GetArenaNoVirtual()->Own(struct_value); - } else if (GetArenaNoVirtual() != - ::google::protobuf::Arena::GetArena(struct_value)) { - ::google::protobuf::Struct* new_struct_value = - ::google::protobuf::Arena::CreateMessage< ::google::protobuf::Struct >( - GetArenaNoVirtual()); - new_struct_value->CopyFrom(*struct_value); - struct_value = new_struct_value; - } - set_has_struct_value(); - kind_.struct_value_ = struct_value; - } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.struct_value) +inline const ::google::protobuf::Struct& Value::struct_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.struct_value) + return has_struct_value() + ? *kind_.struct_value_ + : *reinterpret_cast< ::google::protobuf::Struct*>(&::google::protobuf::_Struct_default_instance_); } -inline ::google::protobuf::Struct* Value::unsafe_arena_release_struct_value() { +inline ::google::protobuf::Struct* Value::unsafe_arena_release_struct_value() { // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.struct_value) if (has_struct_value()) { clear_has_kind(); @@ -897,7 +869,7 @@ inline ::google::protobuf::Struct* Value::unsafe_arena_release_struct_value() { return NULL; } } -inline void Value::unsafe_arena_set_allocated_struct_value(::google::protobuf::Struct* struct_value) { +inline void Value::unsafe_arena_set_allocated_struct_value(::google::protobuf::Struct* struct_value) { clear_kind(); if (struct_value) { set_has_struct_value(); @@ -905,6 +877,17 @@ inline void Value::unsafe_arena_set_allocated_struct_value(::google::protobuf:: } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.struct_value) } +inline ::google::protobuf::Struct* Value::mutable_struct_value() { + if (!has_struct_value()) { + clear_kind(); + set_has_struct_value(); + kind_.struct_value_ = + ::google::protobuf::Arena::CreateMessage< ::google::protobuf::Struct >( + GetArenaNoVirtual()); + } + // @@protoc_insertion_point(field_mutable:google.protobuf.Value.struct_value) + return kind_.struct_value_; +} // .google.protobuf.ListValue list_value = 6; inline bool Value::has_list_value() const { @@ -921,60 +904,27 @@ inline void Value::clear_list_value() { clear_has_kind(); } } -inline const ::google::protobuf::ListValue& Value::list_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.Value.list_value) - return has_list_value() - ? *kind_.list_value_ - : ::google::protobuf::ListValue::default_instance(); -} -inline ::google::protobuf::ListValue* Value::mutable_list_value() { - if (!has_list_value()) { - clear_kind(); - set_has_list_value(); - kind_.list_value_ = - ::google::protobuf::Arena::CreateMessage< ::google::protobuf::ListValue >( - GetArenaNoVirtual()); - } - // @@protoc_insertion_point(field_mutable:google.protobuf.Value.list_value) - return kind_.list_value_; -} inline ::google::protobuf::ListValue* Value::release_list_value() { // @@protoc_insertion_point(field_release:google.protobuf.Value.list_value) if (has_list_value()) { clear_has_kind(); - if (GetArenaNoVirtual() != NULL) { - ::google::protobuf::ListValue* temp = new ::google::protobuf::ListValue(*kind_.list_value_); - kind_.list_value_ = NULL; - return temp; - } else { ::google::protobuf::ListValue* temp = kind_.list_value_; - kind_.list_value_ = NULL; - return temp; + if (GetArenaNoVirtual() != NULL) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL); } + kind_.list_value_ = NULL; + return temp; } else { return NULL; } } -inline void Value::set_allocated_list_value(::google::protobuf::ListValue* list_value) { - clear_kind(); - if (list_value) { - if (GetArenaNoVirtual() != NULL && - ::google::protobuf::Arena::GetArena(list_value) == NULL) { - GetArenaNoVirtual()->Own(list_value); - } else if (GetArenaNoVirtual() != - ::google::protobuf::Arena::GetArena(list_value)) { - ::google::protobuf::ListValue* new_list_value = - ::google::protobuf::Arena::CreateMessage< ::google::protobuf::ListValue >( - GetArenaNoVirtual()); - new_list_value->CopyFrom(*list_value); - list_value = new_list_value; - } - set_has_list_value(); - kind_.list_value_ = list_value; - } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.list_value) +inline const ::google::protobuf::ListValue& Value::list_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.list_value) + return has_list_value() + ? *kind_.list_value_ + : *reinterpret_cast< ::google::protobuf::ListValue*>(&::google::protobuf::_ListValue_default_instance_); } -inline ::google::protobuf::ListValue* Value::unsafe_arena_release_list_value() { +inline ::google::protobuf::ListValue* Value::unsafe_arena_release_list_value() { // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.list_value) if (has_list_value()) { clear_has_kind(); @@ -985,7 +935,7 @@ inline ::google::protobuf::ListValue* Value::unsafe_arena_release_list_value() return NULL; } } -inline void Value::unsafe_arena_set_allocated_list_value(::google::protobuf::ListValue* list_value) { +inline void Value::unsafe_arena_set_allocated_list_value(::google::protobuf::ListValue* list_value) { clear_kind(); if (list_value) { set_has_list_value(); @@ -993,6 +943,17 @@ inline void Value::unsafe_arena_set_allocated_list_value(::google::protobuf::Li } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.list_value) } +inline ::google::protobuf::ListValue* Value::mutable_list_value() { + if (!has_list_value()) { + clear_kind(); + set_has_list_value(); + kind_.list_value_ = + ::google::protobuf::Arena::CreateMessage< ::google::protobuf::ListValue >( + GetArenaNoVirtual()); + } + // @@protoc_insertion_point(field_mutable:google.protobuf.Value.list_value) + return kind_.list_value_; +} inline bool Value::has_kind() const { return kind_case() != KIND_NOT_SET; @@ -1040,7 +1001,6 @@ ListValue::values() const { #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ -#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // ------------------------------------------------------------------- // ------------------------------------------------------------------- @@ -1050,7 +1010,6 @@ ListValue::values() const { // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/stubs/atomicops.h b/src/google/protobuf/stubs/atomicops.h index 75aee306..64c838fb 100644 --- a/src/google/protobuf/stubs/atomicops.h +++ b/src/google/protobuf/stubs/atomicops.h @@ -63,28 +63,21 @@ namespace google { namespace protobuf { namespace internal { -#if defined(GOOGLE_PROTOBUF_ARCH_POWER) -#if defined(_LP64) || defined(__LP64__) -typedef int32 Atomic32; -typedef intptr_t Atomic64; +#ifdef GOOGLE_PROTOBUF_ARCH_32_BIT + typedef intptr_t Atomic32; + typedef int64 Atomic64; #else -typedef intptr_t Atomic32; -typedef int64 Atomic64; -#endif -#else -typedef int32 Atomic32; -#ifdef GOOGLE_PROTOBUF_ARCH_64_BIT -// We need to be able to go between Atomic64 and AtomicWord implicitly. This -// means Atomic64 and AtomicWord should be the same type on 64-bit. -#if defined(__ILP32__) || defined(GOOGLE_PROTOBUF_OS_NACL) -// NaCl's intptr_t is not actually 64-bits on 64-bit! -// http://code.google.com/p/nativeclient/issues/detail?id=1162 -// sparcv9's pointer type is 32bits -typedef int64 Atomic64; -#else -typedef intptr_t Atomic64; -#endif -#endif + typedef int32 Atomic32; + // We need to be able to go between Atomic64 and AtomicWord implicitly. This + // means Atomic64 and AtomicWord should be the same type on 64-bit. + #if defined(__ILP32__) || defined(GOOGLE_PROTOBUF_OS_NACL) + // NaCl's intptr_t is not actually 64-bits on 64-bit! + // http://code.google.com/p/nativeclient/issues/detail?id=1162 + // sparcv9's pointer type is 32bits + typedef int64 Atomic64; + #else + typedef intptr_t Atomic64; + #endif #endif // Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or diff --git a/src/google/protobuf/stubs/hash.h b/src/google/protobuf/stubs/hash.h index 612b5861..218cd948 100644 --- a/src/google/protobuf/stubs/hash.h +++ b/src/google/protobuf/stubs/hash.h @@ -93,10 +93,10 @@ # endif // GCC <= 4.1 does not define std::tr1::hash for `long long int` or `long long unsigned int` -# if __GNUC__ == 4 && __GNUC__MINOR__ <= 1 -# define GOOGLE_PROTOBUF_MISSING_HASH -# include <map> -# include <set> +# if __GNUC__ == 4 && defined(__GNUC__MINOR__) && __GNUC__MINOR__ <= 1 +# undef GOOGLE_PROTOBUF_HAS_TR1 +# undef GOOGLE_PROTOBUF_HAVE_HASH_MAP +# undef GOOGLE_PROTOBUF_HAVE_HASH_SET # endif // Version checks for MSC. diff --git a/src/google/protobuf/stubs/io_win32_unittest.cc b/src/google/protobuf/stubs/io_win32_unittest.cc index 90bd9c96..288f27ab 100644 --- a/src/google/protobuf/stubs/io_win32_unittest.cc +++ b/src/google/protobuf/stubs/io_win32_unittest.cc @@ -34,7 +34,7 @@ // // This file is only used on Windows, it's empty on other platforms. -#if defined(_WIN32) +#if defined(_MSC_VER) #define WIN32_LEAN_AND_MEAN #include <errno.h> @@ -47,6 +47,7 @@ #include <windows.h> #include <google/protobuf/stubs/io_win32.h> +#include <google/protobuf/stubs/scoped_ptr.h> #include <google/protobuf/testing/googletest.h> #include <gtest/gtest.h> @@ -61,13 +62,12 @@ namespace win32 { namespace { using std::string; -using std::unique_ptr; using std::wstring; class IoWin32Test : public ::testing::Test { public: - void SetUp() override; - void TearDown() override; + void SetUp(); + void TearDown(); protected: bool CreateAllUnder(wstring path); @@ -83,21 +83,31 @@ class IoWin32Test : public ::testing::Test { EXPECT_FALSE(wtest_tmpdir.empty()); \ } +namespace { +void StripTrailingSlashes(string* str) { + int i = str->size() - 1; + for (; i >= 0 && ((*str)[i] == '/' || (*str)[i] == '\\'); --i) {} + str->resize(i+1); +} +} // namespace + void IoWin32Test::SetUp() { test_tmpdir = string(TestTempDir()); wtest_tmpdir.clear(); if (test_tmpdir.empty()) { const char* test_tmpdir_env = getenv("TEST_TMPDIR"); - if (test_tmpdir_env != nullptr && *test_tmpdir_env) { + if (test_tmpdir_env != NULL && *test_tmpdir_env) { test_tmpdir = string(test_tmpdir_env); } // Only Bazel defines TEST_TMPDIR, CMake does not, so look for other // suitable environment variables. if (test_tmpdir.empty()) { - for (const char* name : {"TEMP", "TMP"}) { + static const char* names[] = {"TEMP", "TMP"}; + for (int i = 0; i < sizeof(names)/sizeof(names[0]); ++i) { + const char* name = names[i]; test_tmpdir_env = getenv(name); - if (test_tmpdir_env != nullptr && *test_tmpdir_env) { + if (test_tmpdir_env != NULL && *test_tmpdir_env) { test_tmpdir = string(test_tmpdir_env); break; } @@ -113,8 +123,7 @@ void IoWin32Test::SetUp() { // "\\?\" prefix (except on Windows 10 version 1607 and beyond, after // opting in to long paths by default [1]). // - // [1] https://msdn.microsoft.com/en-us/library/windows/ \ - // desktop/aa365247(v=vs.85).aspx#maxpath + // [1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath DWORD result = ::GetCurrentDirectoryA(MAX_PATH, buffer); if (result > 0) { test_tmpdir = string(buffer); @@ -128,14 +137,11 @@ void IoWin32Test::SetUp() { } } - while (test_tmpdir.back() == '/' || test_tmpdir.back() == '\\') { - test_tmpdir.pop_back(); - } + StripTrailingSlashes(&test_tmpdir); test_tmpdir += "\\io_win32_unittest.tmp"; // CreateDirectoryA's limit is 248 chars, see MSDN. - // https://msdn.microsoft.com/en-us/library/windows/ \ - // desktop/aa363855(v=vs.85).aspx + // https://msdn.microsoft.com/en-us/library/windows/desktop/aa363855(v=vs.85).aspx wtest_tmpdir = testonly_path_to_winpath(test_tmpdir); if (!DeleteAllUnder(wtest_tmpdir) || !CreateAllUnder(wtest_tmpdir)) { GOOGLE_CHECK_OK(false); @@ -185,7 +191,7 @@ bool IoWin32Test::DeleteAllUnder(wstring path) { path = wstring(L"\\\\?\\") + path; } // Append "\" if necessary. - if (path.back() != '\\') { + if (path[path.size() - 1] != '\\') { path.push_back('\\'); } @@ -326,7 +332,7 @@ TEST_F(IoWin32Test, ChdirTest) { TEST_F(IoWin32Test, AsWindowsPathTest) { DWORD size = GetCurrentDirectoryW(0, NULL); - unique_ptr<wchar_t[]> cwd_str(new wchar_t[size]); + scoped_array<wchar_t> cwd_str(new wchar_t[size]); EXPECT_GT(GetCurrentDirectoryW(size, cwd_str.get()), 0); wstring cwd = wstring(L"\\\\?\\") + cwd_str.get(); @@ -363,5 +369,5 @@ TEST_F(IoWin32Test, AsWindowsPathTest) { } // namespace protobuf } // namespace google -#endif // defined(_WIN32) +#endif // defined(_MSC_VER) diff --git a/src/google/protobuf/stubs/port.h b/src/google/protobuf/stubs/port.h index 0f304c6b..cecefdcb 100644 --- a/src/google/protobuf/stubs/port.h +++ b/src/google/protobuf/stubs/port.h @@ -97,6 +97,8 @@ #include <byteswap.h> // IWYU pragma: export #endif +#define PROTOBUF_RUNTIME_DEPRECATED(message) + // =================================================================== // from google3/base/port.h @@ -108,6 +110,18 @@ #define LANG_CXX11 1 #endif +#if LANG_CXX11 && !defined(__NVCC__) +#define PROTOBUF_CXX11 1 +#else +#define PROTOBUF_CXX11 0 +#endif + +#if PROTOBUF_CXX11 +#define PROTOBUF_FINAL final +#else +#define PROTOBUF_FINAL +#endif + namespace google { namespace protobuf { @@ -177,6 +191,8 @@ static const uint64 kuint64max = GOOGLE_ULONGLONG(0xFFFFFFFFFFFFFFFF); #endif #endif +#define GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE GOOGLE_ATTRIBUTE_ALWAYS_INLINE + #ifndef GOOGLE_ATTRIBUTE_NOINLINE #if defined(__GNUC__) && (__GNUC__ > 3 ||(__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) // For functions we want to force not inline. @@ -191,23 +207,7 @@ static const uint64 kuint64max = GOOGLE_ULONGLONG(0xFFFFFFFFFFFFFFFF); #endif #endif -#ifndef GOOGLE_ATTRIBUTE_NORETURN -#ifdef __GNUC__ -// Tell the compiler that a given function never returns. -#define GOOGLE_ATTRIBUTE_NORETURN __attribute__((noreturn)) -#else -#define GOOGLE_ATTRIBUTE_NORETURN -#endif -#endif - -#ifndef GOOGLE_ATTRIBUTE_DEPRECATED -#ifdef __GNUC__ -// If the method/variable/type is used anywhere, produce a warning. -#define GOOGLE_ATTRIBUTE_DEPRECATED __attribute__((deprecated)) -#else -#define GOOGLE_ATTRIBUTE_DEPRECATED -#endif -#endif +#define GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE GOOGLE_ATTRIBUTE_NOINLINE #ifndef GOOGLE_PREDICT_TRUE #ifdef __GNUC__ @@ -243,6 +243,8 @@ static const uint64 kuint64max = GOOGLE_ULONGLONG(0xFFFFFFFFFFFFFFFF); __has_cpp_attribute(clang::fallthrough) # define GOOGLE_FALLTHROUGH_INTENDED [[clang::fallthrough]] # endif +#elif defined(__GNUC__) && __GNUC__ > 6 +# define GOOGLE_FALLTHROUGH_INTENDED [[gnu::fallthrough]] #endif #ifndef GOOGLE_FALLTHROUGH_INTENDED @@ -255,7 +257,6 @@ static const uint64 kuint64max = GOOGLE_ULONGLONG(0xFFFFFFFFFFFFFFFF); #ifdef GOOGLE_PROTOBUF_DONT_USE_UNALIGNED # define GOOGLE_PROTOBUF_USE_UNALIGNED 0 #else -// x86 and x86-64 can perform unaligned loads/stores directly. # if defined(_M_X64) || defined(__x86_64__) || defined(_M_IX86) || defined(__i386__) # define GOOGLE_PROTOBUF_USE_UNALIGNED 1 # else @@ -263,7 +264,49 @@ static const uint64 kuint64max = GOOGLE_ULONGLONG(0xFFFFFFFFFFFFFFFF); # endif #endif -#if GOOGLE_PROTOBUF_USE_UNALIGNED +#define GOOGLE_PROTOBUF_ATTRIBUTE_COLD GOOGLE_ATTRIBUTE_COLD + +#if defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) ||\ + defined(MEMORY_SANITIZER) + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus +uint16_t __sanitizer_unaligned_load16(const void *p); +uint32_t __sanitizer_unaligned_load32(const void *p); +uint64_t __sanitizer_unaligned_load64(const void *p); +void __sanitizer_unaligned_store16(void *p, uint16_t v); +void __sanitizer_unaligned_store32(void *p, uint32_t v); +void __sanitizer_unaligned_store64(void *p, uint64_t v); +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +inline uint16 GOOGLE_UNALIGNED_LOAD16(const void *p) { + return __sanitizer_unaligned_load16(p); +} + +inline uint32 GOOGLE_UNALIGNED_LOAD32(const void *p) { + return __sanitizer_unaligned_load32(p); +} + +inline uint64 GOOGLE_UNALIGNED_LOAD64(const void *p) { + return __sanitizer_unaligned_load64(p); +} + +inline void GOOGLE_UNALIGNED_STORE16(void *p, uint16 v) { + __sanitizer_unaligned_store16(p, v); +} + +inline void GOOGLE_UNALIGNED_STORE32(void *p, uint32 v) { + __sanitizer_unaligned_store32(p, v); +} + +inline void GOOGLE_UNALIGNED_STORE64(void *p, uint64 v) { + __sanitizer_unaligned_store64(p, v); +} + +#elif GOOGLE_PROTOBUF_USE_UNALIGNED #define GOOGLE_UNALIGNED_LOAD16(_p) (*reinterpret_cast<const uint16 *>(_p)) #define GOOGLE_UNALIGNED_LOAD32(_p) (*reinterpret_cast<const uint32 *>(_p)) @@ -474,6 +517,8 @@ class BigEndian { #define GOOGLE_ATTRIBUTE_SECTION_VARIABLE(name) #endif +#define GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(name) + } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/test_messages_proto2.proto b/src/google/protobuf/test_messages_proto2.proto index cbe0d170..60dbfc75 100644 --- a/src/google/protobuf/test_messages_proto2.proto +++ b/src/google/protobuf/test_messages_proto2.proto @@ -81,10 +81,10 @@ message TestAllTypesProto2 { optional bytes optional_bytes = 15; optional NestedMessage optional_nested_message = 18; - optional ForeignMessage optional_foreign_message = 19; + optional ForeignMessageProto2 optional_foreign_message = 19; optional NestedEnum optional_nested_enum = 21; - optional ForeignEnum optional_foreign_enum = 22; + optional ForeignEnumProto2 optional_foreign_enum = 22; optional string optional_string_piece = 24 [ctype=STRING_PIECE]; optional string optional_cord = 25 [ctype=CORD]; @@ -109,10 +109,10 @@ message TestAllTypesProto2 { repeated bytes repeated_bytes = 45; repeated NestedMessage repeated_nested_message = 48; - repeated ForeignMessage repeated_foreign_message = 49; + repeated ForeignMessageProto2 repeated_foreign_message = 49; repeated NestedEnum repeated_nested_enum = 51; - repeated ForeignEnum repeated_foreign_enum = 52; + repeated ForeignEnumProto2 repeated_foreign_enum = 52; repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; repeated string repeated_cord = 55 [ctype=CORD]; @@ -134,9 +134,9 @@ message TestAllTypesProto2 { map < string, string> map_string_string = 69; map < string, bytes> map_string_bytes = 70; map < string, NestedMessage> map_string_nested_message = 71; - map < string, ForeignMessage> map_string_foreign_message = 72; + map < string, ForeignMessageProto2> map_string_foreign_message = 72; map < string, NestedEnum> map_string_nested_enum = 73; - map < string, ForeignEnum> map_string_foreign_enum = 74; + map < string, ForeignEnumProto2> map_string_foreign_enum = 74; oneof oneof_field { uint32 oneof_uint32 = 111; @@ -201,11 +201,11 @@ message TestAllTypesProto2 { } } -message ForeignMessage { +message ForeignMessageProto2 { optional int32 c = 1; } -enum ForeignEnum { +enum ForeignEnumProto2 { FOREIGN_FOO = 0; FOREIGN_BAR = 1; FOREIGN_BAZ = 2; diff --git a/src/google/protobuf/testing/googletest.cc b/src/google/protobuf/testing/googletest.cc index 33a75ed6..91f0ef89 100644 --- a/src/google/protobuf/testing/googletest.cc +++ b/src/google/protobuf/testing/googletest.cc @@ -286,6 +286,8 @@ namespace { struct ForceShutdown { ~ForceShutdown() { ShutdownProtobufLibrary(); + // Test to shutdown the library twice, which should succeed. + ShutdownProtobufLibrary(); } } force_shutdown; diff --git a/src/google/protobuf/testing/zcgunzip.cc b/src/google/protobuf/testing/zcgunzip.cc index 76f8cfe1..349ad86e 100644 --- a/src/google/protobuf/testing/zcgunzip.cc +++ b/src/google/protobuf/testing/zcgunzip.cc @@ -72,7 +72,10 @@ int main(int argc, const char** argv) { } if (inlen > 0) { int err = write(STDOUT_FILENO, inptr, inlen); - assert(err == inlen); + if (err != inlen) { + fprintf(stderr, "write unexpectedly returned %d.\n", err); + return 1; + } } } diff --git a/src/google/protobuf/text_format.cc b/src/google/protobuf/text_format.cc index f1d2e8bc..eed2a768 100644 --- a/src/google/protobuf/text_format.cc +++ b/src/google/protobuf/text_format.cc @@ -1216,7 +1216,7 @@ class TextFormat::Printer::TextGenerator Write(text + pos, size - pos); } else { Write(text, size); - if (text[size - 1] == '\n') { + if (size > 0 && text[size - 1] == '\n') { at_start_of_line_ = true; } } @@ -1244,10 +1244,12 @@ class TextFormat::Printer::TextGenerator while (size > buffer_size_) { // Data exceeds space in the buffer. Copy what we can and request a // new buffer. - memcpy(buffer_, data, buffer_size_); - data += buffer_size_; - size -= buffer_size_; - void* void_buffer; + if (buffer_size_ > 0) { + memcpy(buffer_, data, buffer_size_); + data += buffer_size_; + size -= buffer_size_; + } + void* void_buffer = NULL; failed_ = !output_->Next(&void_buffer, &buffer_size_); if (failed_) return; buffer_ = reinterpret_cast<char*>(void_buffer); diff --git a/src/google/protobuf/text_format.h b/src/google/protobuf/text_format.h index cd0e307e..a2670d6b 100644 --- a/src/google/protobuf/text_format.h +++ b/src/google/protobuf/text_format.h @@ -49,6 +49,7 @@ #include <google/protobuf/stubs/common.h> #include <google/protobuf/descriptor.h> #include <google/protobuf/message.h> +#include <google/protobuf/message_lite.h> namespace google { namespace protobuf { @@ -143,8 +144,8 @@ class LIBPROTOBUF_EXPORT TextFormat { GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FastFieldValuePrinter); }; -// DEPRECATED: Please use FastFieldValuePrinter. - class LIBPROTOBUF_EXPORT FieldValuePrinter { + class LIBPROTOBUF_EXPORT PROTOBUF_RUNTIME_DEPRECATED("Please use FastFieldValuePrinter") + FieldValuePrinter { public: FieldValuePrinter(); virtual ~FieldValuePrinter(); @@ -210,7 +211,7 @@ class LIBPROTOBUF_EXPORT TextFormat { single_line_mode_ = single_line_mode; } - bool IsInSingleLineMode() { + bool IsInSingleLineMode() const { return single_line_mode_; } diff --git a/src/google/protobuf/timestamp.pb.cc b/src/google/protobuf/timestamp.pb.cc index 44ddc749..36e3bb36 100644 --- a/src/google/protobuf/timestamp.pb.cc +++ b/src/google/protobuf/timestamp.pb.cc @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/timestamp.proto -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #include <google/protobuf/timestamp.pb.h> #include <algorithm> @@ -15,58 +14,61 @@ #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> +// This is a temporary google only hack +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS +#include "third_party/protobuf/version.h" +#endif // @@protoc_insertion_point(includes) - namespace google { namespace protobuf { class TimestampDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<Timestamp> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<Timestamp> + _instance; } _Timestamp_default_instance_; - +} // namespace protobuf +} // namespace google namespace protobuf_google_2fprotobuf_2ftimestamp_2eproto { +void InitDefaultsTimestampImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_Timestamp_default_instance_; + new (ptr) ::google::protobuf::Timestamp(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::Timestamp::InitAsDefaultInstance(); +} -namespace { +void InitDefaultsTimestamp() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsTimestampImpl); +} ::google::protobuf::Metadata file_level_metadata[1]; -} // namespace - -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField - const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0}, -}; - -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField - const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - ::google::protobuf::internal::AuxillaryParseTableField(), -}; -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const - TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, -}; - -const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { +const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Timestamp, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Timestamp, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Timestamp, seconds_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Timestamp, nanos_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Timestamp, seconds_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Timestamp, nanos_), }; -static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(Timestamp)}, +static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, sizeof(::google::protobuf::Timestamp)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { - reinterpret_cast<const ::google::protobuf::Message*>(&_Timestamp_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Timestamp_default_instance_), }; -namespace { - void protobuf_AssignDescriptors() { AddDescriptors(); ::google::protobuf::MessageFactory* factory = NULL; @@ -80,29 +82,15 @@ void protobuf_AssignDescriptorsOnce() { ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); } -void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; +void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1); } -} // namespace -void TableStruct::InitDefaultsImpl() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::internal::InitProtobufDefaults(); - _Timestamp_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_Timestamp_default_instance_);} - -void InitDefaults() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl); -} -namespace { void AddDescriptorsImpl() { InitDefaults(); - static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { "\n\037google/protobuf/timestamp.proto\022\017googl" "e.protobuf\"+\n\tTimestamp\022\017\n\007seconds\030\001 \001(\003" "\022\r\n\005nanos\030\002 \001(\005B~\n\023com.google.protobufB\016" @@ -115,7 +103,6 @@ void AddDescriptorsImpl() { ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/timestamp.proto", &protobuf_RegisterTypes); } -} // anonymous namespace void AddDescriptors() { static GOOGLE_PROTOBUF_DECLARE_ONCE(once); @@ -127,12 +114,14 @@ struct StaticDescriptorInitializer { AddDescriptors(); } } static_descriptor_initializer; - } // namespace protobuf_google_2fprotobuf_2ftimestamp_2eproto - +namespace google { +namespace protobuf { // =================================================================== +void Timestamp::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int Timestamp::kSecondsFieldNumber; const int Timestamp::kNanosFieldNumber; @@ -141,7 +130,7 @@ const int Timestamp::kNanosFieldNumber; Timestamp::Timestamp() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2ftimestamp_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ftimestamp_2eproto::InitDefaultsTimestamp(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.Timestamp) @@ -149,7 +138,7 @@ Timestamp::Timestamp() Timestamp::Timestamp(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena) { - protobuf_google_2fprotobuf_2ftimestamp_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ftimestamp_2eproto::InitDefaultsTimestamp(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Timestamp) @@ -178,12 +167,7 @@ Timestamp::~Timestamp() { } void Timestamp::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } void Timestamp::ArenaDtor(void* object) { @@ -198,12 +182,12 @@ void Timestamp::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* Timestamp::descriptor() { - protobuf_google_2fprotobuf_2ftimestamp_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2ftimestamp_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2ftimestamp_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2ftimestamp_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const Timestamp& Timestamp::default_instance() { - protobuf_google_2fprotobuf_2ftimestamp_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ftimestamp_2eproto::InitDefaultsTimestamp(); return *internal_default_instance(); } @@ -436,44 +420,11 @@ void Timestamp::InternalSwap(Timestamp* other) { ::google::protobuf::Metadata Timestamp::GetMetadata() const { protobuf_google_2fprotobuf_2ftimestamp_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2ftimestamp_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2ftimestamp_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// Timestamp - -// int64 seconds = 1; -void Timestamp::clear_seconds() { - seconds_ = GOOGLE_LONGLONG(0); -} -::google::protobuf::int64 Timestamp::seconds() const { - // @@protoc_insertion_point(field_get:google.protobuf.Timestamp.seconds) - return seconds_; -} -void Timestamp::set_seconds(::google::protobuf::int64 value) { - - seconds_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Timestamp.seconds) -} - -// int32 nanos = 2; -void Timestamp::clear_nanos() { - nanos_ = 0; -} -::google::protobuf::int32 Timestamp::nanos() const { - // @@protoc_insertion_point(field_get:google.protobuf.Timestamp.nanos) - return nanos_; -} -void Timestamp::set_nanos(::google::protobuf::int32 value) { - - nanos_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Timestamp.nanos) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h index 61596ed4..4ec7f0a0 100644 --- a/src/google/protobuf/timestamp.pb.h +++ b/src/google/protobuf/timestamp.pb.h @@ -30,31 +30,33 @@ #include <google/protobuf/extension_set.h> // IWYU pragma: export #include <google/protobuf/unknown_field_set.h> // @@protoc_insertion_point(includes) -namespace google { -namespace protobuf { -class Timestamp; -class TimestampDefaultTypeInternal; -LIBPROTOBUF_EXPORT extern TimestampDefaultTypeInternal _Timestamp_default_instance_; -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { namespace protobuf_google_2fprotobuf_2ftimestamp_2eproto { -// Internal implementation detail -- do not call these. +// Internal implementation detail -- do not use these members. struct LIBPROTOBUF_EXPORT TableStruct { static const ::google::protobuf::internal::ParseTableField entries[]; static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; - static const ::google::protobuf::internal::ParseTable schema[]; - static const ::google::protobuf::uint32 offsets[]; + static const ::google::protobuf::internal::ParseTable schema[1]; static const ::google::protobuf::internal::FieldMetadata field_metadata[]; static const ::google::protobuf::internal::SerializationTable serialization_table[]; - static void InitDefaultsImpl(); + static const ::google::protobuf::uint32 offsets[]; }; void LIBPROTOBUF_EXPORT AddDescriptors(); -void LIBPROTOBUF_EXPORT InitDefaults(); +void LIBPROTOBUF_EXPORT InitDefaultsTimestampImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsTimestamp(); +inline void LIBPROTOBUF_EXPORT InitDefaults() { + InitDefaultsTimestamp(); +} } // namespace protobuf_google_2fprotobuf_2ftimestamp_2eproto +namespace google { +namespace protobuf { +class Timestamp; +class TimestampDefaultTypeInternal; +LIBPROTOBUF_EXPORT extern TimestampDefaultTypeInternal _Timestamp_default_instance_; +} // namespace protobuf +} // namespace google +namespace google { +namespace protobuf { // =================================================================== @@ -93,6 +95,7 @@ class LIBPROTOBUF_EXPORT Timestamp : public ::google::protobuf::Message /* @@pro static const ::google::protobuf::Descriptor* descriptor(); static const Timestamp& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Timestamp* internal_default_instance() { return reinterpret_cast<const Timestamp*>( &_Timestamp_default_instance_); @@ -173,14 +176,14 @@ class LIBPROTOBUF_EXPORT Timestamp : public ::google::protobuf::Message /* @@pro ::google::protobuf::int64 seconds_; ::google::protobuf::int32 nanos_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2ftimestamp_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2ftimestamp_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2ftimestamp_2eproto::InitDefaultsTimestampImpl(); }; // =================================================================== // =================================================================== -#if !PROTOBUF_INLINE_NOT_IN_HEADERS #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" @@ -218,11 +221,9 @@ inline void Timestamp::set_nanos(::google::protobuf::int32 value) { #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ -#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index abb52395..92f6589c 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/type.proto -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #include <google/protobuf/type.pb.h> #include <algorithm> @@ -15,135 +14,227 @@ #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> +// This is a temporary google only hack +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS +#include "third_party/protobuf/version.h" +#endif // @@protoc_insertion_point(includes) - namespace google { namespace protobuf { class TypeDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<Type> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<Type> + _instance; } _Type_default_instance_; class FieldDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<Field> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<Field> + _instance; } _Field_default_instance_; class EnumDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<Enum> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<Enum> + _instance; } _Enum_default_instance_; class EnumValueDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<EnumValue> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<EnumValue> + _instance; } _EnumValue_default_instance_; class OptionDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<Option> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<Option> + _instance; } _Option_default_instance_; - +} // namespace protobuf +} // namespace google namespace protobuf_google_2fprotobuf_2ftype_2eproto { +void InitDefaultsTypeImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsField(); + protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsOption(); + protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::InitDefaultsSourceContext(); + { + void* ptr = &::google::protobuf::_Type_default_instance_; + new (ptr) ::google::protobuf::Type(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::Type::InitAsDefaultInstance(); +} -namespace { +void InitDefaultsType() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsTypeImpl); +} -::google::protobuf::Metadata file_level_metadata[5]; -const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[3]; +void InitDefaultsFieldImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; -} // namespace +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsOption(); + { + void* ptr = &::google::protobuf::_Field_default_instance_; + new (ptr) ::google::protobuf::Field(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::Field::InitAsDefaultInstance(); +} -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField - const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0}, -}; +void InitDefaultsField() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsFieldImpl); +} -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField - const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - ::google::protobuf::internal::AuxillaryParseTableField(), -}; -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const - TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, -}; +void InitDefaultsEnumImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsEnumValue(); + protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsOption(); + protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::InitDefaultsSourceContext(); + { + void* ptr = &::google::protobuf::_Enum_default_instance_; + new (ptr) ::google::protobuf::Enum(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::Enum::InitAsDefaultInstance(); +} -const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { +void InitDefaultsEnum() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsEnumImpl); +} + +void InitDefaultsEnumValueImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsOption(); + { + void* ptr = &::google::protobuf::_EnumValue_default_instance_; + new (ptr) ::google::protobuf::EnumValue(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::EnumValue::InitAsDefaultInstance(); +} + +void InitDefaultsEnumValue() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsEnumValueImpl); +} + +void InitDefaultsOptionImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_google_2fprotobuf_2fany_2eproto::InitDefaultsAny(); + { + void* ptr = &::google::protobuf::_Option_default_instance_; + new (ptr) ::google::protobuf::Option(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::Option::InitAsDefaultInstance(); +} + +void InitDefaultsOption() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsOptionImpl); +} + +::google::protobuf::Metadata file_level_metadata[5]; +const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[3]; + +const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, fields_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, oneofs_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, options_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, source_context_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, syntax_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, fields_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, oneofs_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, source_context_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, syntax_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, kind_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, cardinality_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, number_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, type_url_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, oneof_index_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, packed_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, options_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, json_name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, default_value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, kind_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, cardinality_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, number_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, type_url_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, oneof_index_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, packed_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, json_name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, default_value_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Enum, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Enum, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Enum, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Enum, enumvalue_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Enum, options_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Enum, source_context_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Enum, syntax_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Enum, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Enum, enumvalue_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Enum, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Enum, source_context_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Enum, syntax_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValue, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValue, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValue, number_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValue, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValue, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValue, number_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValue, options_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Option, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Option, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Option, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Option, value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Option, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Option, value_), }; -static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(Type)}, - { 11, -1, sizeof(Field)}, - { 26, -1, sizeof(Enum)}, - { 36, -1, sizeof(EnumValue)}, - { 44, -1, sizeof(Option)}, +static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, sizeof(::google::protobuf::Type)}, + { 11, -1, sizeof(::google::protobuf::Field)}, + { 26, -1, sizeof(::google::protobuf::Enum)}, + { 36, -1, sizeof(::google::protobuf::EnumValue)}, + { 44, -1, sizeof(::google::protobuf::Option)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { - reinterpret_cast<const ::google::protobuf::Message*>(&_Type_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_Field_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_Enum_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_EnumValue_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_Option_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Type_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Field_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Enum_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_EnumValue_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Option_default_instance_), }; -namespace { - void protobuf_AssignDescriptors() { AddDescriptors(); ::google::protobuf::MessageFactory* factory = NULL; @@ -157,45 +248,15 @@ void protobuf_AssignDescriptorsOnce() { ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); } -void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; +void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 5); } -} // namespace -void TableStruct::InitDefaultsImpl() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::internal::InitProtobufDefaults(); - ::google::protobuf::protobuf_google_2fprotobuf_2fany_2eproto::InitDefaults(); - ::google::protobuf::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::InitDefaults(); - _Type_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_Type_default_instance_);_Field_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_Field_default_instance_);_Enum_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_Enum_default_instance_);_EnumValue_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_EnumValue_default_instance_);_Option_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_Option_default_instance_);_Type_default_instance_._instance.get_mutable()->source_context_ = const_cast< ::google::protobuf::SourceContext*>( - ::google::protobuf::SourceContext::internal_default_instance()); - _Enum_default_instance_._instance.get_mutable()->source_context_ = const_cast< ::google::protobuf::SourceContext*>( - ::google::protobuf::SourceContext::internal_default_instance()); - _Option_default_instance_._instance.get_mutable()->value_ = const_cast< ::google::protobuf::Any*>( - ::google::protobuf::Any::internal_default_instance()); -} - -void InitDefaults() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl); -} -namespace { void AddDescriptorsImpl() { InitDefaults(); - static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { "\n\032google/protobuf/type.proto\022\017google.pro" "tobuf\032\031google/protobuf/any.proto\032$google" "/protobuf/source_context.proto\"\327\001\n\004Type\022" @@ -241,10 +302,9 @@ void AddDescriptorsImpl() { descriptor, 1594); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/type.proto", &protobuf_RegisterTypes); - ::google::protobuf::protobuf_google_2fprotobuf_2fany_2eproto::AddDescriptors(); - ::google::protobuf::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::AddDescriptors(); + ::protobuf_google_2fprotobuf_2fany_2eproto::AddDescriptors(); + ::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::AddDescriptors(); } -} // anonymous namespace void AddDescriptors() { static GOOGLE_PROTOBUF_DECLARE_ONCE(once); @@ -256,9 +316,9 @@ struct StaticDescriptorInitializer { AddDescriptors(); } } static_descriptor_initializer; - } // namespace protobuf_google_2fprotobuf_2ftype_2eproto - +namespace google { +namespace protobuf { const ::google::protobuf::EnumDescriptor* Field_Kind_descriptor() { protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce(); return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_enum_descriptors[0]; @@ -356,26 +416,14 @@ bool Syntax_IsValid(int value) { // =================================================================== +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()); } -::google::protobuf::SourceContext* Type::_slow_release_source_context() { - if (source_context_ == NULL) { - return NULL; - } else { - ::google::protobuf::SourceContext* temp = new ::google::protobuf::SourceContext(*source_context_); - source_context_ = NULL; - return temp; - } -} -::google::protobuf::SourceContext* Type::unsafe_arena_release_source_context() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Type.source_context) - - ::google::protobuf::SourceContext* temp = source_context_; - source_context_ = NULL; - return temp; -} void Type::unsafe_arena_set_allocated_source_context( ::google::protobuf::SourceContext* source_context) { if (GetArenaNoVirtual() == NULL) { @@ -389,6 +437,12 @@ void Type::unsafe_arena_set_allocated_source_context( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Type.source_context) } +void Type::clear_source_context() { + if (GetArenaNoVirtual() == NULL && source_context_ != NULL) { + delete source_context_; + } + source_context_ = NULL; +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int Type::kNameFieldNumber; const int Type::kFieldsFieldNumber; @@ -401,7 +455,7 @@ const int Type::kSyntaxFieldNumber; Type::Type() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsType(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.Type) @@ -412,7 +466,7 @@ Type::Type(::google::protobuf::Arena* arena) fields_(arena), oneofs_(arena), options_(arena) { - protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsType(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Type) @@ -453,13 +507,8 @@ Type::~Type() { } void Type::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - - name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (this != internal_default_instance()) delete source_context_; } @@ -475,12 +524,12 @@ void Type::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* Type::descriptor() { - protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const Type& Type::default_instance() { - protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsType(); return *internal_default_instance(); } @@ -536,8 +585,7 @@ 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::ReadMessageNoVirtual( - input, add_fields())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_fields())); } else { goto handle_unusual; } @@ -565,8 +613,7 @@ 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::ReadMessageNoVirtual( - input, add_options())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options())); } else { goto handle_unusual; } @@ -577,7 +624,7 @@ bool Type::MergePartialFromCodedStream( case 5: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_source_context())); } else { goto handle_unusual; @@ -701,7 +748,7 @@ void Type::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->fields_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 2, this->fields(static_cast<int>(i)), deterministic, target); } @@ -719,14 +766,14 @@ void Type::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 4, this->options(static_cast<int>(i)), deterministic, target); } // .google.protobuf.SourceContext source_context = 5; if (this->has_source_context()) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 5, *this->source_context_, deterministic, target); } @@ -759,7 +806,7 @@ size_t Type::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->fields(static_cast<int>(i))); } } @@ -778,7 +825,7 @@ size_t Type::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->options(static_cast<int>(i))); } } @@ -793,7 +840,7 @@ size_t Type::ByteSizeLong() const { // .google.protobuf.SourceContext source_context = 5; if (this->has_source_context()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *this->source_context_); } @@ -897,286 +944,14 @@ void Type::InternalSwap(Type* other) { ::google::protobuf::Metadata Type::GetMetadata() const { protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// Type - -// string name = 1; -void Type::clear_name() { - name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -const ::std::string& Type::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.Type.name) - return name_.Get(); -} -void Type::set_name(const ::std::string& value) { - - name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set:google.protobuf.Type.name) -} -#if LANG_CXX11 -void Type::set_name(::std::string&& value) { - - name_.Set( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Type.name) -} -#endif -void Type::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - - name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_char:google.protobuf.Type.name) -} -void Type::set_name(const char* value, - size_t size) { - - name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( - reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Type.name) -} -::std::string* Type::mutable_name() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.Type.name) - return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* Type::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.Type.name) - - return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* Type::unsafe_arena_release_name() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Type.name) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} -void Type::set_allocated_name(::std::string* name) { - if (name != NULL) { - - } else { - - } - name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name, - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Type.name) -} -void Type::unsafe_arena_set_allocated_name( - ::std::string* name) { - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - if (name != NULL) { - - } else { - - } - name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - name, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Type.name) -} - -// repeated .google.protobuf.Field fields = 2; -int Type::fields_size() const { - return fields_.size(); -} -void Type::clear_fields() { - fields_.Clear(); -} -const ::google::protobuf::Field& Type::fields(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.Type.fields) - return fields_.Get(index); -} -::google::protobuf::Field* Type::mutable_fields(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.Type.fields) - return fields_.Mutable(index); -} -::google::protobuf::Field* Type::add_fields() { - // @@protoc_insertion_point(field_add:google.protobuf.Type.fields) - return fields_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::Field >* -Type::mutable_fields() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.fields) - return &fields_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Field >& -Type::fields() const { - // @@protoc_insertion_point(field_list:google.protobuf.Type.fields) - return fields_; -} - -// repeated string oneofs = 3; -int Type::oneofs_size() const { - return oneofs_.size(); -} -void Type::clear_oneofs() { - oneofs_.Clear(); -} -const ::std::string& Type::oneofs(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.Type.oneofs) - return oneofs_.Get(index); -} -::std::string* Type::mutable_oneofs(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.Type.oneofs) - return oneofs_.Mutable(index); -} -void Type::set_oneofs(int index, const ::std::string& value) { - // @@protoc_insertion_point(field_set:google.protobuf.Type.oneofs) - oneofs_.Mutable(index)->assign(value); -} -#if LANG_CXX11 -void Type::set_oneofs(int index, ::std::string&& value) { - // @@protoc_insertion_point(field_set:google.protobuf.Type.oneofs) - oneofs_.Mutable(index)->assign(std::move(value)); -} -#endif -void Type::set_oneofs(int index, const char* value) { - GOOGLE_DCHECK(value != NULL); - oneofs_.Mutable(index)->assign(value); - // @@protoc_insertion_point(field_set_char:google.protobuf.Type.oneofs) -} -void Type::set_oneofs(int index, const char* value, size_t size) { - oneofs_.Mutable(index)->assign( - reinterpret_cast<const char*>(value), size); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Type.oneofs) -} -::std::string* Type::add_oneofs() { - // @@protoc_insertion_point(field_add_mutable:google.protobuf.Type.oneofs) - return oneofs_.Add(); -} -void Type::add_oneofs(const ::std::string& value) { - oneofs_.Add()->assign(value); - // @@protoc_insertion_point(field_add:google.protobuf.Type.oneofs) -} -#if LANG_CXX11 -void Type::add_oneofs(::std::string&& value) { - oneofs_.Add(std::move(value)); - // @@protoc_insertion_point(field_add:google.protobuf.Type.oneofs) -} -#endif -void Type::add_oneofs(const char* value) { - GOOGLE_DCHECK(value != NULL); - oneofs_.Add()->assign(value); - // @@protoc_insertion_point(field_add_char:google.protobuf.Type.oneofs) -} -void Type::add_oneofs(const char* value, size_t size) { - oneofs_.Add()->assign(reinterpret_cast<const char*>(value), size); - // @@protoc_insertion_point(field_add_pointer:google.protobuf.Type.oneofs) -} -const ::google::protobuf::RepeatedPtrField< ::std::string>& -Type::oneofs() const { - // @@protoc_insertion_point(field_list:google.protobuf.Type.oneofs) - return oneofs_; -} -::google::protobuf::RepeatedPtrField< ::std::string>* -Type::mutable_oneofs() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.oneofs) - return &oneofs_; -} - -// repeated .google.protobuf.Option options = 4; -int Type::options_size() const { - return options_.size(); -} -void Type::clear_options() { - options_.Clear(); -} -const ::google::protobuf::Option& Type::options(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.Type.options) - return options_.Get(index); -} -::google::protobuf::Option* Type::mutable_options(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.Type.options) - return options_.Mutable(index); -} -::google::protobuf::Option* Type::add_options() { - // @@protoc_insertion_point(field_add:google.protobuf.Type.options) - return options_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* -Type::mutable_options() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.options) - return &options_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& -Type::options() const { - // @@protoc_insertion_point(field_list:google.protobuf.Type.options) - return options_; -} - -// .google.protobuf.SourceContext source_context = 5; -bool Type::has_source_context() const { - return this != internal_default_instance() && source_context_ != NULL; -} -void Type::clear_source_context() { - if (GetArenaNoVirtual() == NULL && source_context_ != NULL) delete source_context_; - source_context_ = NULL; -} -const ::google::protobuf::SourceContext& Type::source_context() const { - const ::google::protobuf::SourceContext* p = source_context_; - // @@protoc_insertion_point(field_get:google.protobuf.Type.source_context) - return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::SourceContext*>( - &::google::protobuf::_SourceContext_default_instance_); -} -::google::protobuf::SourceContext* Type::mutable_source_context() { - - if (source_context_ == NULL) { - _slow_mutable_source_context(); - } - // @@protoc_insertion_point(field_mutable:google.protobuf.Type.source_context) - return source_context_; -} -::google::protobuf::SourceContext* Type::release_source_context() { - // @@protoc_insertion_point(field_release:google.protobuf.Type.source_context) - - if (GetArenaNoVirtual() != NULL) { - return _slow_release_source_context(); - } else { - ::google::protobuf::SourceContext* temp = source_context_; - source_context_ = NULL; - return temp; - } -} - void Type::set_allocated_source_context(::google::protobuf::SourceContext* source_context) { - ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); - if (message_arena == NULL) { - delete source_context_; - } - if (source_context != NULL) { - if (message_arena != NULL) { - message_arena->Own(source_context); - } - } - source_context_ = source_context; - if (source_context) { - - } else { - - } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Type.source_context) -} - -// .google.protobuf.Syntax syntax = 6; -void Type::clear_syntax() { - syntax_ = 0; -} -::google::protobuf::Syntax Type::syntax() const { - // @@protoc_insertion_point(field_get:google.protobuf.Type.syntax) - return static_cast< ::google::protobuf::Syntax >(syntax_); -} -void Type::set_syntax(::google::protobuf::Syntax value) { - - syntax_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Type.syntax) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void Field::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int Field::kKindFieldNumber; const int Field::kCardinalityFieldNumber; @@ -1193,7 +968,7 @@ const int Field::kDefaultValueFieldNumber; Field::Field() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsField(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.Field) @@ -1202,7 +977,7 @@ Field::Field(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena), options_(arena) { - protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsField(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Field) @@ -1256,16 +1031,11 @@ Field::~Field() { } void Field::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - - name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); - type_url_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); - json_name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); - default_value_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + type_url_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + json_name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + default_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } void Field::ArenaDtor(void* object) { @@ -1280,12 +1050,12 @@ void Field::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* Field::descriptor() { - protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const Field& Field::default_instance() { - protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsField(); return *internal_default_instance(); } @@ -1428,8 +1198,7 @@ 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::ReadMessageNoVirtual( - input, add_options())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options())); } else { goto handle_unusual; } @@ -1635,7 +1404,7 @@ void Field::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 9, this->options(static_cast<int>(i)), deterministic, target); } @@ -1684,7 +1453,7 @@ size_t Field::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->options(static_cast<int>(i))); } } @@ -1862,436 +1631,20 @@ void Field::InternalSwap(Field* other) { ::google::protobuf::Metadata Field::GetMetadata() const { protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// Field - -// .google.protobuf.Field.Kind kind = 1; -void Field::clear_kind() { - kind_ = 0; -} -::google::protobuf::Field_Kind Field::kind() const { - // @@protoc_insertion_point(field_get:google.protobuf.Field.kind) - return static_cast< ::google::protobuf::Field_Kind >(kind_); -} -void Field::set_kind(::google::protobuf::Field_Kind value) { - - kind_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Field.kind) -} - -// .google.protobuf.Field.Cardinality cardinality = 2; -void Field::clear_cardinality() { - cardinality_ = 0; -} -::google::protobuf::Field_Cardinality Field::cardinality() const { - // @@protoc_insertion_point(field_get:google.protobuf.Field.cardinality) - return static_cast< ::google::protobuf::Field_Cardinality >(cardinality_); -} -void Field::set_cardinality(::google::protobuf::Field_Cardinality value) { - - cardinality_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Field.cardinality) -} - -// int32 number = 3; -void Field::clear_number() { - number_ = 0; -} -::google::protobuf::int32 Field::number() const { - // @@protoc_insertion_point(field_get:google.protobuf.Field.number) - return number_; -} -void Field::set_number(::google::protobuf::int32 value) { - - number_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Field.number) -} - -// string name = 4; -void Field::clear_name() { - name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -const ::std::string& Field::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.Field.name) - return name_.Get(); -} -void Field::set_name(const ::std::string& value) { - - name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set:google.protobuf.Field.name) -} -#if LANG_CXX11 -void Field::set_name(::std::string&& value) { - - name_.Set( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Field.name) -} -#endif -void Field::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - - name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_char:google.protobuf.Field.name) -} -void Field::set_name(const char* value, - size_t size) { - - name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( - reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Field.name) -} -::std::string* Field::mutable_name() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.Field.name) - return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* Field::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.Field.name) - - return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* Field::unsafe_arena_release_name() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.name) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} -void Field::set_allocated_name(::std::string* name) { - if (name != NULL) { - - } else { - - } - name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name, - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.name) -} -void Field::unsafe_arena_set_allocated_name( - ::std::string* name) { - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - if (name != NULL) { - - } else { - - } - name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - name, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Field.name) -} - -// string type_url = 6; -void Field::clear_type_url() { - type_url_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -const ::std::string& Field::type_url() const { - // @@protoc_insertion_point(field_get:google.protobuf.Field.type_url) - return type_url_.Get(); -} -void Field::set_type_url(const ::std::string& value) { - - type_url_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set:google.protobuf.Field.type_url) -} -#if LANG_CXX11 -void Field::set_type_url(::std::string&& value) { - - type_url_.Set( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Field.type_url) -} -#endif -void Field::set_type_url(const char* value) { - GOOGLE_DCHECK(value != NULL); - - type_url_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_char:google.protobuf.Field.type_url) -} -void Field::set_type_url(const char* value, - size_t size) { - - type_url_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( - reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Field.type_url) -} -::std::string* Field::mutable_type_url() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.Field.type_url) - return type_url_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* Field::release_type_url() { - // @@protoc_insertion_point(field_release:google.protobuf.Field.type_url) - - return type_url_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* Field::unsafe_arena_release_type_url() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.type_url) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return type_url_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} -void Field::set_allocated_type_url(::std::string* type_url) { - if (type_url != NULL) { - - } else { - - } - type_url_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), type_url, - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.type_url) -} -void Field::unsafe_arena_set_allocated_type_url( - ::std::string* type_url) { - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - if (type_url != NULL) { - - } else { - - } - type_url_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - type_url, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Field.type_url) -} - -// int32 oneof_index = 7; -void Field::clear_oneof_index() { - oneof_index_ = 0; -} -::google::protobuf::int32 Field::oneof_index() const { - // @@protoc_insertion_point(field_get:google.protobuf.Field.oneof_index) - return oneof_index_; -} -void Field::set_oneof_index(::google::protobuf::int32 value) { - - oneof_index_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Field.oneof_index) -} - -// bool packed = 8; -void Field::clear_packed() { - packed_ = false; -} -bool Field::packed() const { - // @@protoc_insertion_point(field_get:google.protobuf.Field.packed) - return packed_; -} -void Field::set_packed(bool value) { - - packed_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Field.packed) -} - -// repeated .google.protobuf.Option options = 9; -int Field::options_size() const { - return options_.size(); -} -void Field::clear_options() { - options_.Clear(); -} -const ::google::protobuf::Option& Field::options(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.Field.options) - return options_.Get(index); -} -::google::protobuf::Option* Field::mutable_options(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.Field.options) - return options_.Mutable(index); -} -::google::protobuf::Option* Field::add_options() { - // @@protoc_insertion_point(field_add:google.protobuf.Field.options) - return options_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* -Field::mutable_options() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.Field.options) - return &options_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& -Field::options() const { - // @@protoc_insertion_point(field_list:google.protobuf.Field.options) - return options_; -} - -// string json_name = 10; -void Field::clear_json_name() { - json_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -const ::std::string& Field::json_name() const { - // @@protoc_insertion_point(field_get:google.protobuf.Field.json_name) - return json_name_.Get(); -} -void Field::set_json_name(const ::std::string& value) { - - json_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set:google.protobuf.Field.json_name) -} -#if LANG_CXX11 -void Field::set_json_name(::std::string&& value) { - - json_name_.Set( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Field.json_name) -} -#endif -void Field::set_json_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - - json_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_char:google.protobuf.Field.json_name) -} -void Field::set_json_name(const char* value, - size_t size) { - - json_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( - reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Field.json_name) -} -::std::string* Field::mutable_json_name() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.Field.json_name) - return json_name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* Field::release_json_name() { - // @@protoc_insertion_point(field_release:google.protobuf.Field.json_name) - - return json_name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* Field::unsafe_arena_release_json_name() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.json_name) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return json_name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} -void Field::set_allocated_json_name(::std::string* json_name) { - if (json_name != NULL) { - - } else { - - } - json_name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), json_name, - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.json_name) -} -void Field::unsafe_arena_set_allocated_json_name( - ::std::string* json_name) { - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - if (json_name != NULL) { - - } else { - - } - json_name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - json_name, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Field.json_name) -} - -// string default_value = 11; -void Field::clear_default_value() { - default_value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -const ::std::string& Field::default_value() const { - // @@protoc_insertion_point(field_get:google.protobuf.Field.default_value) - return default_value_.Get(); -} -void Field::set_default_value(const ::std::string& value) { - - default_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set:google.protobuf.Field.default_value) -} -#if LANG_CXX11 -void Field::set_default_value(::std::string&& value) { - - default_value_.Set( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Field.default_value) -} -#endif -void Field::set_default_value(const char* value) { - GOOGLE_DCHECK(value != NULL); - - default_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_char:google.protobuf.Field.default_value) -} -void Field::set_default_value(const char* value, - size_t size) { - - default_value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( - reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Field.default_value) -} -::std::string* Field::mutable_default_value() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.Field.default_value) - return default_value_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* Field::release_default_value() { - // @@protoc_insertion_point(field_release:google.protobuf.Field.default_value) - - return default_value_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* Field::unsafe_arena_release_default_value() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.default_value) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return default_value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} -void Field::set_allocated_default_value(::std::string* default_value) { - if (default_value != NULL) { - - } else { - - } - default_value_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), default_value, - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.default_value) -} -void Field::unsafe_arena_set_allocated_default_value( - ::std::string* default_value) { - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - if (default_value != NULL) { - - } else { - - } - default_value_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - default_value, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Field.default_value) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +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()); } -::google::protobuf::SourceContext* Enum::_slow_release_source_context() { - if (source_context_ == NULL) { - return NULL; - } else { - ::google::protobuf::SourceContext* temp = new ::google::protobuf::SourceContext(*source_context_); - source_context_ = NULL; - return temp; - } -} -::google::protobuf::SourceContext* Enum::unsafe_arena_release_source_context() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Enum.source_context) - - ::google::protobuf::SourceContext* temp = source_context_; - source_context_ = NULL; - return temp; -} void Enum::unsafe_arena_set_allocated_source_context( ::google::protobuf::SourceContext* source_context) { if (GetArenaNoVirtual() == NULL) { @@ -2305,6 +1658,12 @@ void Enum::unsafe_arena_set_allocated_source_context( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Enum.source_context) } +void Enum::clear_source_context() { + if (GetArenaNoVirtual() == NULL && source_context_ != NULL) { + delete source_context_; + } + source_context_ = NULL; +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int Enum::kNameFieldNumber; const int Enum::kEnumvalueFieldNumber; @@ -2316,7 +1675,7 @@ const int Enum::kSyntaxFieldNumber; Enum::Enum() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsEnum(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.Enum) @@ -2326,7 +1685,7 @@ Enum::Enum(::google::protobuf::Arena* arena) _internal_metadata_(arena), enumvalue_(arena), options_(arena) { - protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsEnum(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Enum) @@ -2366,13 +1725,8 @@ Enum::~Enum() { } void Enum::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - - name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (this != internal_default_instance()) delete source_context_; } @@ -2388,12 +1742,12 @@ void Enum::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* Enum::descriptor() { - protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const Enum& Enum::default_instance() { - protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsEnum(); return *internal_default_instance(); } @@ -2448,8 +1802,7 @@ 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::ReadMessageNoVirtual( - input, add_enumvalue())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_enumvalue())); } else { goto handle_unusual; } @@ -2460,8 +1813,7 @@ 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::ReadMessageNoVirtual( - input, add_options())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options())); } else { goto handle_unusual; } @@ -2472,7 +1824,7 @@ bool Enum::MergePartialFromCodedStream( case 4: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_source_context())); } else { goto handle_unusual; @@ -2586,7 +1938,7 @@ void Enum::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->enumvalue_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 2, this->enumvalue(static_cast<int>(i)), deterministic, target); } @@ -2594,14 +1946,14 @@ void Enum::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 3, this->options(static_cast<int>(i)), deterministic, target); } // .google.protobuf.SourceContext source_context = 4; if (this->has_source_context()) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 4, *this->source_context_, deterministic, target); } @@ -2634,7 +1986,7 @@ size_t Enum::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->enumvalue(static_cast<int>(i))); } } @@ -2645,7 +1997,7 @@ size_t Enum::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->options(static_cast<int>(i))); } } @@ -2660,7 +2012,7 @@ size_t Enum::ByteSizeLong() const { // .google.protobuf.SourceContext source_context = 4; if (this->has_source_context()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *this->source_context_); } @@ -2762,217 +2114,14 @@ void Enum::InternalSwap(Enum* other) { ::google::protobuf::Metadata Enum::GetMetadata() const { protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// Enum - -// string name = 1; -void Enum::clear_name() { - name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -const ::std::string& Enum::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.Enum.name) - return name_.Get(); -} -void Enum::set_name(const ::std::string& value) { - - name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set:google.protobuf.Enum.name) -} -#if LANG_CXX11 -void Enum::set_name(::std::string&& value) { - - name_.Set( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Enum.name) -} -#endif -void Enum::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - - name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_char:google.protobuf.Enum.name) -} -void Enum::set_name(const char* value, - size_t size) { - - name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( - reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Enum.name) -} -::std::string* Enum::mutable_name() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.name) - return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* Enum::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.Enum.name) - - return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* Enum::unsafe_arena_release_name() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Enum.name) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} -void Enum::set_allocated_name(::std::string* name) { - if (name != NULL) { - - } else { - - } - name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name, - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Enum.name) -} -void Enum::unsafe_arena_set_allocated_name( - ::std::string* name) { - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - if (name != NULL) { - - } else { - - } - name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - name, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Enum.name) -} - -// repeated .google.protobuf.EnumValue enumvalue = 2; -int Enum::enumvalue_size() const { - return enumvalue_.size(); -} -void Enum::clear_enumvalue() { - enumvalue_.Clear(); -} -const ::google::protobuf::EnumValue& Enum::enumvalue(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.Enum.enumvalue) - return enumvalue_.Get(index); -} -::google::protobuf::EnumValue* Enum::mutable_enumvalue(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.enumvalue) - return enumvalue_.Mutable(index); -} -::google::protobuf::EnumValue* Enum::add_enumvalue() { - // @@protoc_insertion_point(field_add:google.protobuf.Enum.enumvalue) - return enumvalue_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValue >* -Enum::mutable_enumvalue() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.Enum.enumvalue) - return &enumvalue_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValue >& -Enum::enumvalue() const { - // @@protoc_insertion_point(field_list:google.protobuf.Enum.enumvalue) - return enumvalue_; -} - -// repeated .google.protobuf.Option options = 3; -int Enum::options_size() const { - return options_.size(); -} -void Enum::clear_options() { - options_.Clear(); -} -const ::google::protobuf::Option& Enum::options(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.Enum.options) - return options_.Get(index); -} -::google::protobuf::Option* Enum::mutable_options(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.options) - return options_.Mutable(index); -} -::google::protobuf::Option* Enum::add_options() { - // @@protoc_insertion_point(field_add:google.protobuf.Enum.options) - return options_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* -Enum::mutable_options() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.Enum.options) - return &options_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& -Enum::options() const { - // @@protoc_insertion_point(field_list:google.protobuf.Enum.options) - return options_; -} - -// .google.protobuf.SourceContext source_context = 4; -bool Enum::has_source_context() const { - return this != internal_default_instance() && source_context_ != NULL; -} -void Enum::clear_source_context() { - if (GetArenaNoVirtual() == NULL && source_context_ != NULL) delete source_context_; - source_context_ = NULL; -} -const ::google::protobuf::SourceContext& Enum::source_context() const { - const ::google::protobuf::SourceContext* p = source_context_; - // @@protoc_insertion_point(field_get:google.protobuf.Enum.source_context) - return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::SourceContext*>( - &::google::protobuf::_SourceContext_default_instance_); -} -::google::protobuf::SourceContext* Enum::mutable_source_context() { - - if (source_context_ == NULL) { - _slow_mutable_source_context(); - } - // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.source_context) - return source_context_; -} -::google::protobuf::SourceContext* Enum::release_source_context() { - // @@protoc_insertion_point(field_release:google.protobuf.Enum.source_context) - - if (GetArenaNoVirtual() != NULL) { - return _slow_release_source_context(); - } else { - ::google::protobuf::SourceContext* temp = source_context_; - source_context_ = NULL; - return temp; - } -} - void Enum::set_allocated_source_context(::google::protobuf::SourceContext* source_context) { - ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); - if (message_arena == NULL) { - delete source_context_; - } - if (source_context != NULL) { - if (message_arena != NULL) { - message_arena->Own(source_context); - } - } - source_context_ = source_context; - if (source_context) { - - } else { - - } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Enum.source_context) + return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages]; } -// .google.protobuf.Syntax syntax = 5; -void Enum::clear_syntax() { - syntax_ = 0; -} -::google::protobuf::Syntax Enum::syntax() const { - // @@protoc_insertion_point(field_get:google.protobuf.Enum.syntax) - return static_cast< ::google::protobuf::Syntax >(syntax_); -} -void Enum::set_syntax(::google::protobuf::Syntax value) { - - syntax_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Enum.syntax) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void EnumValue::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int EnumValue::kNameFieldNumber; const int EnumValue::kNumberFieldNumber; @@ -2982,7 +2131,7 @@ const int EnumValue::kOptionsFieldNumber; EnumValue::EnumValue() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsEnumValue(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.EnumValue) @@ -2991,7 +2140,7 @@ EnumValue::EnumValue(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena), options_(arena) { - protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsEnumValue(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.EnumValue) @@ -3023,13 +2172,8 @@ EnumValue::~EnumValue() { } void EnumValue::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - - name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } void EnumValue::ArenaDtor(void* object) { @@ -3044,12 +2188,12 @@ void EnumValue::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* EnumValue::descriptor() { - protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const EnumValue& EnumValue::default_instance() { - protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsEnumValue(); return *internal_default_instance(); } @@ -3113,8 +2257,7 @@ 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::ReadMessageNoVirtual( - input, add_options())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options())); } else { goto handle_unusual; } @@ -3203,7 +2346,7 @@ void EnumValue::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 3, this->options(static_cast<int>(i)), deterministic, target); } @@ -3230,7 +2373,7 @@ size_t EnumValue::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->options(static_cast<int>(i))); } } @@ -3335,155 +2478,20 @@ void EnumValue::InternalSwap(EnumValue* other) { ::google::protobuf::Metadata EnumValue::GetMetadata() const { protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// EnumValue - -// string name = 1; -void EnumValue::clear_name() { - name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -const ::std::string& EnumValue::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.name) - return name_.Get(); -} -void EnumValue::set_name(const ::std::string& value) { - - name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set:google.protobuf.EnumValue.name) -} -#if LANG_CXX11 -void EnumValue::set_name(::std::string&& value) { - - name_.Set( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.EnumValue.name) -} -#endif -void EnumValue::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - - name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_char:google.protobuf.EnumValue.name) -} -void EnumValue::set_name(const char* value, - size_t size) { - - name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( - reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumValue.name) -} -::std::string* EnumValue::mutable_name() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValue.name) - return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* EnumValue::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.EnumValue.name) - - return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* EnumValue::unsafe_arena_release_name() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumValue.name) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} -void EnumValue::set_allocated_name(::std::string* name) { - if (name != NULL) { - - } else { - - } - name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name, - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValue.name) -} -void EnumValue::unsafe_arena_set_allocated_name( - ::std::string* name) { - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - if (name != NULL) { - - } else { - - } - name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - name, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumValue.name) + return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages]; } -// int32 number = 2; -void EnumValue::clear_number() { - number_ = 0; -} -::google::protobuf::int32 EnumValue::number() const { - // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.number) - return number_; -} -void EnumValue::set_number(::google::protobuf::int32 value) { - - number_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.EnumValue.number) -} - -// repeated .google.protobuf.Option options = 3; -int EnumValue::options_size() const { - return options_.size(); -} -void EnumValue::clear_options() { - options_.Clear(); -} -const ::google::protobuf::Option& EnumValue::options(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.options) - return options_.Get(index); -} -::google::protobuf::Option* EnumValue::mutable_options(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValue.options) - return options_.Mutable(index); -} -::google::protobuf::Option* EnumValue::add_options() { - // @@protoc_insertion_point(field_add:google.protobuf.EnumValue.options) - return options_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* -EnumValue::mutable_options() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumValue.options) - return &options_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& -EnumValue::options() const { - // @@protoc_insertion_point(field_list:google.protobuf.EnumValue.options) - return options_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +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()); } -::google::protobuf::Any* Option::_slow_release_value() { - if (value_ == NULL) { - return NULL; - } else { - ::google::protobuf::Any* temp = new ::google::protobuf::Any(*value_); - value_ = NULL; - return temp; - } -} -::google::protobuf::Any* Option::unsafe_arena_release_value() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Option.value) - - ::google::protobuf::Any* temp = value_; - value_ = NULL; - return temp; -} void Option::unsafe_arena_set_allocated_value( ::google::protobuf::Any* value) { if (GetArenaNoVirtual() == NULL) { @@ -3497,6 +2505,12 @@ void Option::unsafe_arena_set_allocated_value( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Option.value) } +void Option::clear_value() { + if (GetArenaNoVirtual() == NULL && value_ != NULL) { + delete value_; + } + value_ = NULL; +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int Option::kNameFieldNumber; const int Option::kValueFieldNumber; @@ -3505,7 +2519,7 @@ const int Option::kValueFieldNumber; Option::Option() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsOption(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.Option) @@ -3513,7 +2527,7 @@ Option::Option() Option::Option(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena) { - protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsOption(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Option) @@ -3548,13 +2562,8 @@ Option::~Option() { } void Option::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - - name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (this != internal_default_instance()) delete value_; } @@ -3570,12 +2579,12 @@ void Option::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* Option::descriptor() { - protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const Option& Option::default_instance() { - protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsOption(); return *internal_default_instance(); } @@ -3627,7 +2636,7 @@ bool Option::MergePartialFromCodedStream( case 2: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_value())); } else { goto handle_unusual; @@ -3705,7 +2714,7 @@ void Option::SerializeWithCachedSizes( // .google.protobuf.Any value = 2; if (this->has_value()) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 2, *this->value_, deterministic, target); } @@ -3736,7 +2745,7 @@ size_t Option::ByteSizeLong() const { // .google.protobuf.Any value = 2; if (this->has_value()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *this->value_); } @@ -3824,143 +2833,11 @@ void Option::InternalSwap(Option* other) { ::google::protobuf::Metadata Option::GetMetadata() const { protobuf_google_2fprotobuf_2ftype_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// Option - -// string name = 1; -void Option::clear_name() { - name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -const ::std::string& Option::name() const { - // @@protoc_insertion_point(field_get:google.protobuf.Option.name) - return name_.Get(); -} -void Option::set_name(const ::std::string& value) { - - name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set:google.protobuf.Option.name) -} -#if LANG_CXX11 -void Option::set_name(::std::string&& value) { - - name_.Set( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Option.name) -} -#endif -void Option::set_name(const char* value) { - GOOGLE_DCHECK(value != NULL); - - name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_char:google.protobuf.Option.name) -} -void Option::set_name(const char* value, - size_t size) { - - name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( - reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Option.name) -} -::std::string* Option::mutable_name() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.Option.name) - return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* Option::release_name() { - // @@protoc_insertion_point(field_release:google.protobuf.Option.name) - - return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* Option::unsafe_arena_release_name() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Option.name) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} -void Option::set_allocated_name(::std::string* name) { - if (name != NULL) { - - } else { - - } - name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name, - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Option.name) -} -void Option::unsafe_arena_set_allocated_name( - ::std::string* name) { - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - if (name != NULL) { - - } else { - - } - name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - name, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Option.name) + return ::protobuf_google_2fprotobuf_2ftype_2eproto::file_level_metadata[kIndexInFileMessages]; } -// .google.protobuf.Any value = 2; -bool Option::has_value() const { - return this != internal_default_instance() && value_ != NULL; -} -void Option::clear_value() { - if (GetArenaNoVirtual() == NULL && value_ != NULL) delete value_; - value_ = NULL; -} -const ::google::protobuf::Any& Option::value() const { - const ::google::protobuf::Any* p = value_; - // @@protoc_insertion_point(field_get:google.protobuf.Option.value) - return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::Any*>( - &::google::protobuf::_Any_default_instance_); -} -::google::protobuf::Any* Option::mutable_value() { - - if (value_ == NULL) { - _slow_mutable_value(); - } - // @@protoc_insertion_point(field_mutable:google.protobuf.Option.value) - return value_; -} -::google::protobuf::Any* Option::release_value() { - // @@protoc_insertion_point(field_release:google.protobuf.Option.value) - - if (GetArenaNoVirtual() != NULL) { - return _slow_release_value(); - } else { - ::google::protobuf::Any* temp = value_; - value_ = NULL; - return temp; - } -} - void Option::set_allocated_value(::google::protobuf::Any* value) { - ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); - if (message_arena == NULL) { - delete value_; - } - if (value != NULL) { - if (message_arena != NULL) { - message_arena->Own(value); - } - } - value_ = value; - if (value) { - - } else { - - } - // @@protoc_insertion_point(field_set_allocated:google.protobuf.Option.value) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h index cc76cc97..85bd660f 100644 --- a/src/google/protobuf/type.pb.h +++ b/src/google/protobuf/type.pb.h @@ -33,6 +33,36 @@ #include <google/protobuf/any.pb.h> #include <google/protobuf/source_context.pb.h> // @@protoc_insertion_point(includes) + +namespace protobuf_google_2fprotobuf_2ftype_2eproto { +// Internal implementation detail -- do not use these members. +struct LIBPROTOBUF_EXPORT TableStruct { + static const ::google::protobuf::internal::ParseTableField entries[]; + static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; + static const ::google::protobuf::internal::ParseTable schema[5]; + static const ::google::protobuf::internal::FieldMetadata field_metadata[]; + static const ::google::protobuf::internal::SerializationTable serialization_table[]; + static const ::google::protobuf::uint32 offsets[]; +}; +void LIBPROTOBUF_EXPORT AddDescriptors(); +void LIBPROTOBUF_EXPORT InitDefaultsTypeImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsType(); +void LIBPROTOBUF_EXPORT InitDefaultsFieldImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsField(); +void LIBPROTOBUF_EXPORT InitDefaultsEnumImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsEnum(); +void LIBPROTOBUF_EXPORT InitDefaultsEnumValueImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsEnumValue(); +void LIBPROTOBUF_EXPORT InitDefaultsOptionImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsOption(); +inline void LIBPROTOBUF_EXPORT InitDefaults() { + InitDefaultsType(); + InitDefaultsField(); + InitDefaultsEnum(); + InitDefaultsEnumValue(); + InitDefaultsOption(); +} +} // namespace protobuf_google_2fprotobuf_2ftype_2eproto namespace google { namespace protobuf { class Enum; @@ -52,25 +82,9 @@ class TypeDefaultTypeInternal; LIBPROTOBUF_EXPORT extern TypeDefaultTypeInternal _Type_default_instance_; } // namespace protobuf } // namespace google - namespace google { namespace protobuf { -namespace protobuf_google_2fprotobuf_2ftype_2eproto { -// Internal implementation detail -- do not call these. -struct LIBPROTOBUF_EXPORT TableStruct { - static const ::google::protobuf::internal::ParseTableField entries[]; - static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; - static const ::google::protobuf::internal::ParseTable schema[]; - static const ::google::protobuf::uint32 offsets[]; - static const ::google::protobuf::internal::FieldMetadata field_metadata[]; - static const ::google::protobuf::internal::SerializationTable serialization_table[]; - static void InitDefaultsImpl(); -}; -void LIBPROTOBUF_EXPORT AddDescriptors(); -void LIBPROTOBUF_EXPORT InitDefaults(); -} // namespace protobuf_google_2fprotobuf_2ftype_2eproto - enum Field_Kind { Field_Kind_TYPE_UNKNOWN = 0, Field_Kind_TYPE_DOUBLE = 1, @@ -190,6 +204,7 @@ class LIBPROTOBUF_EXPORT Type : public ::google::protobuf::Message /* @@protoc_i static const ::google::protobuf::Descriptor* descriptor(); static const Type& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Type* internal_default_instance() { return reinterpret_cast<const Type*>( &_Type_default_instance_); @@ -307,7 +322,13 @@ class LIBPROTOBUF_EXPORT Type : public ::google::protobuf::Message /* @@protoc_i ::std::string* mutable_name(); ::std::string* release_name(); void set_allocated_name(::std::string* name); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") ::std::string* unsafe_arena_release_name(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") void unsafe_arena_set_allocated_name( ::std::string* name); @@ -317,15 +338,14 @@ class LIBPROTOBUF_EXPORT Type : public ::google::protobuf::Message /* @@protoc_i static const int kSourceContextFieldNumber = 5; private: void _slow_mutable_source_context(); - ::google::protobuf::SourceContext* _slow_release_source_context(); public: const ::google::protobuf::SourceContext& source_context() const; - ::google::protobuf::SourceContext* mutable_source_context(); ::google::protobuf::SourceContext* release_source_context(); + ::google::protobuf::SourceContext* mutable_source_context(); void set_allocated_source_context(::google::protobuf::SourceContext* source_context); - ::google::protobuf::SourceContext* unsafe_arena_release_source_context(); void unsafe_arena_set_allocated_source_context( ::google::protobuf::SourceContext* source_context); + ::google::protobuf::SourceContext* unsafe_arena_release_source_context(); // .google.protobuf.Syntax syntax = 6; void clear_syntax(); @@ -347,7 +367,8 @@ class LIBPROTOBUF_EXPORT Type : public ::google::protobuf::Message /* @@protoc_i ::google::protobuf::SourceContext* source_context_; int syntax_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsTypeImpl(); }; // ------------------------------------------------------------------- @@ -386,6 +407,7 @@ class LIBPROTOBUF_EXPORT Field : public ::google::protobuf::Message /* @@protoc_ static const ::google::protobuf::Descriptor* descriptor(); static const Field& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Field* internal_default_instance() { return reinterpret_cast<const Field*>( &_Field_default_instance_); @@ -559,7 +581,13 @@ class LIBPROTOBUF_EXPORT Field : public ::google::protobuf::Message /* @@protoc_ ::std::string* mutable_name(); ::std::string* release_name(); void set_allocated_name(::std::string* name); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") ::std::string* unsafe_arena_release_name(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") void unsafe_arena_set_allocated_name( ::std::string* name); @@ -576,7 +604,13 @@ class LIBPROTOBUF_EXPORT Field : public ::google::protobuf::Message /* @@protoc_ ::std::string* mutable_type_url(); ::std::string* release_type_url(); void set_allocated_type_url(::std::string* type_url); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") ::std::string* unsafe_arena_release_type_url(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") void unsafe_arena_set_allocated_type_url( ::std::string* type_url); @@ -593,7 +627,13 @@ class LIBPROTOBUF_EXPORT Field : public ::google::protobuf::Message /* @@protoc_ ::std::string* mutable_json_name(); ::std::string* release_json_name(); void set_allocated_json_name(::std::string* json_name); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") ::std::string* unsafe_arena_release_json_name(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") void unsafe_arena_set_allocated_json_name( ::std::string* json_name); @@ -610,7 +650,13 @@ class LIBPROTOBUF_EXPORT Field : public ::google::protobuf::Message /* @@protoc_ ::std::string* mutable_default_value(); ::std::string* release_default_value(); void set_allocated_default_value(::std::string* default_value); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") ::std::string* unsafe_arena_release_default_value(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") void unsafe_arena_set_allocated_default_value( ::std::string* default_value); @@ -662,7 +708,8 @@ class LIBPROTOBUF_EXPORT Field : public ::google::protobuf::Message /* @@protoc_ ::google::protobuf::int32 oneof_index_; bool packed_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsFieldImpl(); }; // ------------------------------------------------------------------- @@ -701,6 +748,7 @@ class LIBPROTOBUF_EXPORT Enum : public ::google::protobuf::Message /* @@protoc_i static const ::google::protobuf::Descriptor* descriptor(); static const Enum& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Enum* internal_default_instance() { return reinterpret_cast<const Enum*>( &_Enum_default_instance_); @@ -796,7 +844,13 @@ class LIBPROTOBUF_EXPORT Enum : public ::google::protobuf::Message /* @@protoc_i ::std::string* mutable_name(); ::std::string* release_name(); void set_allocated_name(::std::string* name); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") ::std::string* unsafe_arena_release_name(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") void unsafe_arena_set_allocated_name( ::std::string* name); @@ -806,15 +860,14 @@ class LIBPROTOBUF_EXPORT Enum : public ::google::protobuf::Message /* @@protoc_i static const int kSourceContextFieldNumber = 4; private: void _slow_mutable_source_context(); - ::google::protobuf::SourceContext* _slow_release_source_context(); public: const ::google::protobuf::SourceContext& source_context() const; - ::google::protobuf::SourceContext* mutable_source_context(); ::google::protobuf::SourceContext* release_source_context(); + ::google::protobuf::SourceContext* mutable_source_context(); void set_allocated_source_context(::google::protobuf::SourceContext* source_context); - ::google::protobuf::SourceContext* unsafe_arena_release_source_context(); void unsafe_arena_set_allocated_source_context( ::google::protobuf::SourceContext* source_context); + ::google::protobuf::SourceContext* unsafe_arena_release_source_context(); // .google.protobuf.Syntax syntax = 5; void clear_syntax(); @@ -835,7 +888,8 @@ class LIBPROTOBUF_EXPORT Enum : public ::google::protobuf::Message /* @@protoc_i ::google::protobuf::SourceContext* source_context_; int syntax_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsEnumImpl(); }; // ------------------------------------------------------------------- @@ -874,6 +928,7 @@ class LIBPROTOBUF_EXPORT EnumValue : public ::google::protobuf::Message /* @@pro static const ::google::protobuf::Descriptor* descriptor(); static const EnumValue& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const EnumValue* internal_default_instance() { return reinterpret_cast<const EnumValue*>( &_EnumValue_default_instance_); @@ -957,7 +1012,13 @@ class LIBPROTOBUF_EXPORT EnumValue : public ::google::protobuf::Message /* @@pro ::std::string* mutable_name(); ::std::string* release_name(); void set_allocated_name(::std::string* name); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") ::std::string* unsafe_arena_release_name(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") void unsafe_arena_set_allocated_name( ::std::string* name); @@ -978,7 +1039,8 @@ class LIBPROTOBUF_EXPORT EnumValue : public ::google::protobuf::Message /* @@pro ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::int32 number_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsEnumValueImpl(); }; // ------------------------------------------------------------------- @@ -1017,6 +1079,7 @@ class LIBPROTOBUF_EXPORT Option : public ::google::protobuf::Message /* @@protoc static const ::google::protobuf::Descriptor* descriptor(); static const Option& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Option* internal_default_instance() { return reinterpret_cast<const Option*>( &_Option_default_instance_); @@ -1088,7 +1151,13 @@ class LIBPROTOBUF_EXPORT Option : public ::google::protobuf::Message /* @@protoc ::std::string* mutable_name(); ::std::string* release_name(); void set_allocated_name(::std::string* name); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") ::std::string* unsafe_arena_release_name(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") void unsafe_arena_set_allocated_name( ::std::string* name); @@ -1098,15 +1167,14 @@ class LIBPROTOBUF_EXPORT Option : public ::google::protobuf::Message /* @@protoc static const int kValueFieldNumber = 2; private: void _slow_mutable_value(); - ::google::protobuf::Any* _slow_release_value(); public: const ::google::protobuf::Any& value() const; - ::google::protobuf::Any* mutable_value(); ::google::protobuf::Any* release_value(); + ::google::protobuf::Any* mutable_value(); void set_allocated_value(::google::protobuf::Any* value); - ::google::protobuf::Any* unsafe_arena_release_value(); void unsafe_arena_set_allocated_value( ::google::protobuf::Any* value); + ::google::protobuf::Any* unsafe_arena_release_value(); // @@protoc_insertion_point(class_scope:google.protobuf.Option) private: @@ -1118,14 +1186,14 @@ class LIBPROTOBUF_EXPORT Option : public ::google::protobuf::Message /* @@protoc ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::Any* value_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2ftype_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsOptionImpl(); }; // =================================================================== // =================================================================== -#if !PROTOBUF_INLINE_NOT_IN_HEADERS #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" @@ -1177,13 +1245,6 @@ inline ::std::string* Type::release_name() { return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } -inline ::std::string* Type::unsafe_arena_release_name() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Type.name) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} inline void Type::set_allocated_name(::std::string* name) { if (name != NULL) { @@ -1194,6 +1255,13 @@ inline void Type::set_allocated_name(::std::string* name) { GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.Type.name) } +inline ::std::string* Type::unsafe_arena_release_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Type.name) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + + return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} inline void Type::unsafe_arena_set_allocated_name( ::std::string* name) { GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); @@ -1340,16 +1408,29 @@ Type::options() const { inline bool Type::has_source_context() const { return this != internal_default_instance() && source_context_ != NULL; } -inline void Type::clear_source_context() { - if (GetArenaNoVirtual() == NULL && source_context_ != NULL) delete source_context_; - source_context_ = NULL; -} inline const ::google::protobuf::SourceContext& Type::source_context() const { const ::google::protobuf::SourceContext* p = source_context_; // @@protoc_insertion_point(field_get:google.protobuf.Type.source_context) return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::SourceContext*>( &::google::protobuf::_SourceContext_default_instance_); } +inline ::google::protobuf::SourceContext* Type::release_source_context() { + // @@protoc_insertion_point(field_release:google.protobuf.Type.source_context) + + ::google::protobuf::SourceContext* temp = source_context_; + if (GetArenaNoVirtual() != NULL) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL); + } + source_context_ = NULL; + return temp; +} +inline ::google::protobuf::SourceContext* Type::unsafe_arena_release_source_context() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Type.source_context) + + ::google::protobuf::SourceContext* temp = source_context_; + source_context_ = NULL; + return temp; +} inline ::google::protobuf::SourceContext* Type::mutable_source_context() { if (source_context_ == NULL) { @@ -1358,33 +1439,22 @@ inline ::google::protobuf::SourceContext* Type::mutable_source_context() { // @@protoc_insertion_point(field_mutable:google.protobuf.Type.source_context) return source_context_; } -inline ::google::protobuf::SourceContext* Type::release_source_context() { - // @@protoc_insertion_point(field_release:google.protobuf.Type.source_context) - - if (GetArenaNoVirtual() != NULL) { - return _slow_release_source_context(); - } else { - ::google::protobuf::SourceContext* temp = source_context_; - source_context_ = NULL; - return temp; - } -} -inline void Type::set_allocated_source_context(::google::protobuf::SourceContext* source_context) { +inline void Type::set_allocated_source_context(::google::protobuf::SourceContext* source_context) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { - delete source_context_; - } - if (source_context != NULL) { - if (message_arena != NULL) { - message_arena->Own(source_context); - } + delete reinterpret_cast< ::google::protobuf::MessageLite*>(source_context_); } - source_context_ = source_context; if (source_context) { + ::google::protobuf::Arena* submessage_arena = NULL; + if (message_arena != submessage_arena) { + source_context = ::google::protobuf::internal::GetOwnedMessage( + message_arena, source_context, submessage_arena); + } } else { } + source_context_ = source_context; // @@protoc_insertion_point(field_set_allocated:google.protobuf.Type.source_context) } @@ -1493,13 +1563,6 @@ inline ::std::string* Field::release_name() { return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } -inline ::std::string* Field::unsafe_arena_release_name() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.name) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} inline void Field::set_allocated_name(::std::string* name) { if (name != NULL) { @@ -1510,6 +1573,13 @@ inline void Field::set_allocated_name(::std::string* name) { GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.name) } +inline ::std::string* Field::unsafe_arena_release_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.name) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + + return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} inline void Field::unsafe_arena_set_allocated_name( ::std::string* name) { GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); @@ -1568,13 +1638,6 @@ inline ::std::string* Field::release_type_url() { return type_url_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } -inline ::std::string* Field::unsafe_arena_release_type_url() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.type_url) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return type_url_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} inline void Field::set_allocated_type_url(::std::string* type_url) { if (type_url != NULL) { @@ -1585,6 +1648,13 @@ inline void Field::set_allocated_type_url(::std::string* type_url) { GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.type_url) } +inline ::std::string* Field::unsafe_arena_release_type_url() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.type_url) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + + return type_url_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} inline void Field::unsafe_arena_set_allocated_type_url( ::std::string* type_url) { GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); @@ -1701,13 +1771,6 @@ inline ::std::string* Field::release_json_name() { return json_name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } -inline ::std::string* Field::unsafe_arena_release_json_name() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.json_name) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return json_name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} inline void Field::set_allocated_json_name(::std::string* json_name) { if (json_name != NULL) { @@ -1718,6 +1781,13 @@ inline void Field::set_allocated_json_name(::std::string* json_name) { GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.json_name) } +inline ::std::string* Field::unsafe_arena_release_json_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.json_name) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + + return json_name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} inline void Field::unsafe_arena_set_allocated_json_name( ::std::string* json_name) { GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); @@ -1776,13 +1846,6 @@ inline ::std::string* Field::release_default_value() { return default_value_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } -inline ::std::string* Field::unsafe_arena_release_default_value() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.default_value) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return default_value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} inline void Field::set_allocated_default_value(::std::string* default_value) { if (default_value != NULL) { @@ -1793,6 +1856,13 @@ inline void Field::set_allocated_default_value(::std::string* default_value) { GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.default_value) } +inline ::std::string* Field::unsafe_arena_release_default_value() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.default_value) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + + return default_value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} inline void Field::unsafe_arena_set_allocated_default_value( ::std::string* default_value) { GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); @@ -1855,13 +1925,6 @@ inline ::std::string* Enum::release_name() { return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } -inline ::std::string* Enum::unsafe_arena_release_name() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Enum.name) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} inline void Enum::set_allocated_name(::std::string* name) { if (name != NULL) { @@ -1872,6 +1935,13 @@ inline void Enum::set_allocated_name(::std::string* name) { GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.Enum.name) } +inline ::std::string* Enum::unsafe_arena_release_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Enum.name) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + + return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} inline void Enum::unsafe_arena_set_allocated_name( ::std::string* name) { GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); @@ -1949,16 +2019,29 @@ Enum::options() const { inline bool Enum::has_source_context() const { return this != internal_default_instance() && source_context_ != NULL; } -inline void Enum::clear_source_context() { - if (GetArenaNoVirtual() == NULL && source_context_ != NULL) delete source_context_; - source_context_ = NULL; -} inline const ::google::protobuf::SourceContext& Enum::source_context() const { const ::google::protobuf::SourceContext* p = source_context_; // @@protoc_insertion_point(field_get:google.protobuf.Enum.source_context) return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::SourceContext*>( &::google::protobuf::_SourceContext_default_instance_); } +inline ::google::protobuf::SourceContext* Enum::release_source_context() { + // @@protoc_insertion_point(field_release:google.protobuf.Enum.source_context) + + ::google::protobuf::SourceContext* temp = source_context_; + if (GetArenaNoVirtual() != NULL) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL); + } + source_context_ = NULL; + return temp; +} +inline ::google::protobuf::SourceContext* Enum::unsafe_arena_release_source_context() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Enum.source_context) + + ::google::protobuf::SourceContext* temp = source_context_; + source_context_ = NULL; + return temp; +} inline ::google::protobuf::SourceContext* Enum::mutable_source_context() { if (source_context_ == NULL) { @@ -1967,33 +2050,22 @@ inline ::google::protobuf::SourceContext* Enum::mutable_source_context() { // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.source_context) return source_context_; } -inline ::google::protobuf::SourceContext* Enum::release_source_context() { - // @@protoc_insertion_point(field_release:google.protobuf.Enum.source_context) - - if (GetArenaNoVirtual() != NULL) { - return _slow_release_source_context(); - } else { - ::google::protobuf::SourceContext* temp = source_context_; - source_context_ = NULL; - return temp; - } -} -inline void Enum::set_allocated_source_context(::google::protobuf::SourceContext* source_context) { +inline void Enum::set_allocated_source_context(::google::protobuf::SourceContext* source_context) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { - delete source_context_; + delete reinterpret_cast< ::google::protobuf::MessageLite*>(source_context_); } - if (source_context != NULL) { - if (message_arena != NULL) { - message_arena->Own(source_context); - } - } - source_context_ = source_context; if (source_context) { + ::google::protobuf::Arena* submessage_arena = NULL; + if (message_arena != submessage_arena) { + source_context = ::google::protobuf::internal::GetOwnedMessage( + message_arena, source_context, submessage_arena); + } } else { } + source_context_ = source_context; // @@protoc_insertion_point(field_set_allocated:google.protobuf.Enum.source_context) } @@ -2060,13 +2132,6 @@ inline ::std::string* EnumValue::release_name() { return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } -inline ::std::string* EnumValue::unsafe_arena_release_name() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumValue.name) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} inline void EnumValue::set_allocated_name(::std::string* name) { if (name != NULL) { @@ -2077,6 +2142,13 @@ inline void EnumValue::set_allocated_name(::std::string* name) { GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValue.name) } +inline ::std::string* EnumValue::unsafe_arena_release_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumValue.name) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + + return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} inline void EnumValue::unsafe_arena_set_allocated_name( ::std::string* name) { GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); @@ -2183,13 +2255,6 @@ inline ::std::string* Option::release_name() { return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } -inline ::std::string* Option::unsafe_arena_release_name() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Option.name) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} inline void Option::set_allocated_name(::std::string* name) { if (name != NULL) { @@ -2200,6 +2265,13 @@ inline void Option::set_allocated_name(::std::string* name) { GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.Option.name) } +inline ::std::string* Option::unsafe_arena_release_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Option.name) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + + return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} inline void Option::unsafe_arena_set_allocated_name( ::std::string* name) { GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); @@ -2217,16 +2289,29 @@ inline void Option::unsafe_arena_set_allocated_name( inline bool Option::has_value() const { return this != internal_default_instance() && value_ != NULL; } -inline void Option::clear_value() { - if (GetArenaNoVirtual() == NULL && value_ != NULL) delete value_; - value_ = NULL; -} inline const ::google::protobuf::Any& Option::value() const { const ::google::protobuf::Any* p = value_; // @@protoc_insertion_point(field_get:google.protobuf.Option.value) return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::Any*>( &::google::protobuf::_Any_default_instance_); } +inline ::google::protobuf::Any* Option::release_value() { + // @@protoc_insertion_point(field_release:google.protobuf.Option.value) + + ::google::protobuf::Any* temp = value_; + if (GetArenaNoVirtual() != NULL) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL); + } + value_ = NULL; + return temp; +} +inline ::google::protobuf::Any* Option::unsafe_arena_release_value() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Option.value) + + ::google::protobuf::Any* temp = value_; + value_ = NULL; + return temp; +} inline ::google::protobuf::Any* Option::mutable_value() { if (value_ == NULL) { @@ -2235,40 +2320,28 @@ inline ::google::protobuf::Any* Option::mutable_value() { // @@protoc_insertion_point(field_mutable:google.protobuf.Option.value) return value_; } -inline ::google::protobuf::Any* Option::release_value() { - // @@protoc_insertion_point(field_release:google.protobuf.Option.value) - - if (GetArenaNoVirtual() != NULL) { - return _slow_release_value(); - } else { - ::google::protobuf::Any* temp = value_; - value_ = NULL; - return temp; - } -} -inline void Option::set_allocated_value(::google::protobuf::Any* value) { +inline void Option::set_allocated_value(::google::protobuf::Any* value) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { - delete value_; + delete reinterpret_cast< ::google::protobuf::MessageLite*>(value_); } - if (value != NULL) { - if (message_arena != NULL) { - message_arena->Own(value); - } - } - value_ = value; if (value) { + ::google::protobuf::Arena* submessage_arena = NULL; + if (message_arena != submessage_arena) { + value = ::google::protobuf::internal::GetOwnedMessage( + message_arena, value, submessage_arena); + } } else { } + value_ = value; // @@protoc_insertion_point(field_set_allocated:google.protobuf.Option.value) } #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ -#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // ------------------------------------------------------------------- // ------------------------------------------------------------------- @@ -2280,7 +2353,6 @@ inline void Option::set_allocated_value(::google::protobuf::Any* value) { // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/unittest_proto3_arena.proto b/src/google/protobuf/unittest_proto3_arena.proto index 9375d85a..ea88ec90 100644 --- a/src/google/protobuf/unittest_proto3_arena.proto +++ b/src/google/protobuf/unittest_proto3_arena.proto @@ -187,6 +187,7 @@ message TestUnpackedTypes { message NestedTestAllTypes { NestedTestAllTypes child = 1; TestAllTypes payload = 2; + repeated NestedTestAllTypes repeated_child = 3; } // Define these after TestAllTypes to make sure the compiler can handle @@ -205,4 +206,3 @@ enum ForeignEnum { // TestEmptyMessage is used to test behavior of unknown fields. message TestEmptyMessage { } - diff --git a/src/google/protobuf/unknown_field_set.h b/src/google/protobuf/unknown_field_set.h index beb4c9ec..619855ed 100644 --- a/src/google/protobuf/unknown_field_set.h +++ b/src/google/protobuf/unknown_field_set.h @@ -43,7 +43,7 @@ #include <vector> #include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/logging.h> -#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/message_lite.h> namespace google { namespace protobuf { diff --git a/src/google/protobuf/util/field_mask_util.cc b/src/google/protobuf/util/field_mask_util.cc index 982d6407..4d0d3a46 100644 --- a/src/google/protobuf/util/field_mask_util.cc +++ b/src/google/protobuf/util/field_mask_util.cc @@ -192,6 +192,13 @@ class FieldMaskTree { // children removed because the path matches all the node's children. void AddPath(const string& path); + // Remove a path from the tree. + // If the path is a sub-path of an existing field path in the tree, it means + // we need remove the existing fied path and add all sub-paths except + // specified path. If the path matches an existing node in the tree, this node + // will be moved. + void RemovePath(const string& path, const Descriptor* descriptor); + // Calculate the intersection part of a field path with this tree and add // the intersection field path into out. void IntersectPath(const string& path, FieldMaskTree* out); @@ -333,6 +340,59 @@ void FieldMaskTree::AddPath(const string& path) { } } +void FieldMaskTree::RemovePath(const string& path, + const Descriptor* descriptor) { + std::vector<string> parts = Split(path, "."); + if (parts.empty()) { + return; + } + std::vector<Node*> nodes(parts.size()); + Node* node = &root_; + const Descriptor* current_descriptor = descriptor; + Node* new_branch_node = NULL; + for (int i = 0; i < parts.size(); ++i) { + nodes[i] = node; + const FieldDescriptor* field_descriptor = + current_descriptor->FindFieldByName(parts[i]); + if (field_descriptor == NULL || + (field_descriptor->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE && + i != parts.size() - 1)) { + // Invalid path. + if (new_branch_node != NULL) { + // If add any new nodes, cleanup. + new_branch_node->ClearChildren(); + } + return; + } + + if (node->children.empty()) { + if (new_branch_node == NULL) { + new_branch_node = node; + } + for (int i = 0; i < current_descriptor->field_count(); ++i) { + node->children[current_descriptor->field(i)->name()] = new Node(); + } + } + if (ContainsKey(node->children, parts[i])) { + node = node->children.at(parts[i]); + if (field_descriptor->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + current_descriptor = field_descriptor->message_type(); + } + } else { + // Path does not exist. + return; + } + } + // Remove path. + for (int i = parts.size() - 1; i >= 0; i--) { + delete nodes[i]->children[parts[i]]; + nodes[i]->children.erase(parts[i]); + if (!nodes[i]->children.empty()) { + break; + } + } +} + void FieldMaskTree::IntersectPath(const string& path, FieldMaskTree* out) { std::vector<string> parts = Split(path, "."); if (parts.empty()) { @@ -560,6 +620,22 @@ void FieldMaskUtil::Intersect(const FieldMask& mask1, const FieldMask& mask2, intersection.MergeToFieldMask(out); } +void FieldMaskUtil::InternalSubtract(const Descriptor* descriptor, + const FieldMask& mask1, + const FieldMask& mask2, FieldMask* out) { + if (mask1.paths().empty()) { + out->Clear(); + return; + } + FieldMaskTree tree; + tree.MergeFromFieldMask(mask1); + for (int i = 0; i < mask2.paths_size(); ++i) { + tree.RemovePath(mask2.paths(i), descriptor); + } + out->Clear(); + tree.MergeToFieldMask(out); +} + bool FieldMaskUtil::IsPathInFieldMask(StringPiece path, const FieldMask& mask) { for (int i = 0; i < mask.paths_size(); ++i) { const string& mask_path = mask.paths(i); diff --git a/src/google/protobuf/util/field_mask_util.h b/src/google/protobuf/util/field_mask_util.h index 71c68fec..01642c6f 100644 --- a/src/google/protobuf/util/field_mask_util.h +++ b/src/google/protobuf/util/field_mask_util.h @@ -113,6 +113,13 @@ class LIBPROTOBUF_EXPORT FieldMaskUtil { static void Intersect(const FieldMask& mask1, const FieldMask& mask2, FieldMask* out); + // Subtracts mask2 from mask1 base of type T. + template <typename T> + static void Subtract(const FieldMask& mask1, const FieldMask& mask2, + FieldMask* out) { + InternalSubtract(T::descriptor(), mask1, mask2, out); + } + // Returns true if path is covered by the given FieldMask. Note that path // "foo.bar" covers all paths like "foo.bar.baz", "foo.bar.quz.x", etc. static bool IsPathInFieldMask(StringPiece path, const FieldMask& mask); @@ -167,6 +174,10 @@ class LIBPROTOBUF_EXPORT FieldMaskUtil { static void InternalGetFieldMaskForAllFields(const Descriptor* descriptor, FieldMask* out); + + static void InternalSubtract(const Descriptor* descriptor, + const FieldMask& mask1, const FieldMask& mask2, + FieldMask* out); }; // Note that for compatibility with the defined behaviour for FieldMask in diff --git a/src/google/protobuf/util/field_mask_util_test.cc b/src/google/protobuf/util/field_mask_util_test.cc index 24943ed1..7939f733 100644 --- a/src/google/protobuf/util/field_mask_util_test.cc +++ b/src/google/protobuf/util/field_mask_util_test.cc @@ -348,6 +348,46 @@ TEST(FieldMaskUtilTest, TestIntersect) { EXPECT_EQ("foo.bar.baz", FieldMaskUtil::ToString(out)); } +TEST(FieldMaskUtilTest, TestSubtract) { + FieldMask mask1, mask2, out; + // Normal case. + FieldMaskUtil::FromString( + "optional_int32,optional_uint64,optional_nested_message,optional_foreign_" + "message,repeated_int32,repeated_foreign_message,repeated_nested_message." + "bb", + &mask1); + + FieldMaskUtil::FromString( + "optional_int32,optional_nested_message.bb,optional_foreign_message.c," + "repeated_int32,repeated_nested_message.bb,repeated_foreign_message.f," + "repeated_foreign_message.d,repeated_nested_message.bb,repeated_uint32", + &mask2); + + FieldMaskUtil::Subtract<TestAllTypes>(mask1, mask2, &out); + EXPECT_EQ( + "optional_foreign_message.d,optional_uint64,repeated_foreign_message.c", + FieldMaskUtil::ToString(out)); + + // mask1 is empty. + FieldMaskUtil::FromString("", &mask1); + FieldMaskUtil::Subtract<TestAllTypes>(mask1, mask2, &out); + EXPECT_EQ("", FieldMaskUtil::ToString(out)); + + // mask1 is "optional_nested_message" and mask2 is + // "optional_nested_message.nonexist_field". + FieldMaskUtil::FromString("optional_nested_message", &mask1); + FieldMaskUtil::FromString("optional_nested_message.nonexist_field", &mask2); + FieldMaskUtil::Subtract<TestAllTypes>(mask1, mask2, &out); + EXPECT_EQ("optional_nested_message", FieldMaskUtil::ToString(out)); + + // mask1 is "optional_nested_message" and mask2 is + // "optional_nested_message". + FieldMaskUtil::FromString("optional_nested_message", &mask1); + FieldMaskUtil::FromString("optional_nested_message", &mask2); + FieldMaskUtil::Subtract<TestAllTypes>(mask1, mask2, &out); + EXPECT_EQ("", FieldMaskUtil::ToString(out)); +} + TEST(FieldMaskUtilTest, TestIspathInFieldMask) { FieldMask mask; FieldMaskUtil::FromString("foo.bar", &mask); diff --git a/src/google/protobuf/util/internal/json_escaping.cc b/src/google/protobuf/util/internal/json_escaping.cc index 18b7f923..06b9a7f2 100644 --- a/src/google/protobuf/util/internal/json_escaping.cc +++ b/src/google/protobuf/util/internal/json_escaping.cc @@ -207,7 +207,7 @@ StringPiece ToHex(uint16 cp, char* buffer) { buffer[3] = kHex[cp & 0x0f]; cp >>= 4; buffer[2] = kHex[cp & 0x0f]; - return StringPiece(buffer).substr(0, 6); + return StringPiece(buffer, 6); } // Stores the 32-bit unicode code point as its hexadecimal digits in buffer diff --git a/src/google/protobuf/util/internal/json_escaping.h b/src/google/protobuf/util/internal/json_escaping.h index e3e329fc..9b8b2afd 100644 --- a/src/google/protobuf/util/internal/json_escaping.h +++ b/src/google/protobuf/util/internal/json_escaping.h @@ -86,6 +86,6 @@ class JsonEscaping { } // namespace converter } // namespace util } // namespace protobuf +} // namespace google #endif // NET_PROTO2_UTIL_CONVERTER_STRINGS_JSON_ESCAPING_H_ -} // namespace google diff --git a/src/google/protobuf/util/internal/json_stream_parser.cc b/src/google/protobuf/util/internal/json_stream_parser.cc index 047c14e1..2ada3583 100644 --- a/src/google/protobuf/util/internal/json_stream_parser.cc +++ b/src/google/protobuf/util/internal/json_stream_parser.cc @@ -498,6 +498,19 @@ util::Status JsonStreamParser::ParseNumber() { return result; } +util::Status JsonStreamParser::ParseDoubleHelper( + const string& number, NumberResult* result) { + if (!safe_strtod(number, &result->double_val)) { + return ReportFailure("Unable to parse number."); + } + if (!loose_float_number_conversion_ && + !MathLimits<double>::IsFinite(result->double_val)) { + return ReportFailure("Number exceeds the range of double."); + } + result->type = NumberResult::DOUBLE; + return util::Status(); +} + util::Status JsonStreamParser::ParseNumberHelper(NumberResult* result) { const char* data = p_.data(); int length = p_.length(); @@ -533,16 +546,11 @@ util::Status JsonStreamParser::ParseNumberHelper(NumberResult* result) { // Floating point number, parse as a double. if (floating) { - if (!safe_strtod(number, &result->double_val)) { - return ReportFailure("Unable to parse number."); + util::Status status = ParseDoubleHelper(number, result); + if (status.ok()) { + p_.remove_prefix(index); } - if (!loose_float_number_conversion_ && - !MathLimits<double>::IsFinite(result->double_val)) { - return ReportFailure("Number exceeds the range of double."); - } - result->type = NumberResult::DOUBLE; - p_.remove_prefix(index); - return util::Status(); + return status; } // Positive non-floating point number, parse as a uint64. @@ -551,12 +559,18 @@ util::Status JsonStreamParser::ParseNumberHelper(NumberResult* result) { if (number.length() >= 2 && number[0] == '0') { return ReportFailure("Octal/hex numbers are not valid JSON values."); } - if (!safe_strtou64(number, &result->uint_val)) { - return ReportFailure("Unable to parse number."); + if (safe_strtou64(number, &result->uint_val)) { + result->type = NumberResult::UINT; + p_.remove_prefix(index); + return util::Status(); + } else { + // If the value is too large, parse it as double. + util::Status status = ParseDoubleHelper(number, result); + if (status.ok()) { + p_.remove_prefix(index); + } + return status; } - result->type = NumberResult::UINT; - p_.remove_prefix(index); - return util::Status(); } // Octal/Hex numbers are not valid JSON values. @@ -564,12 +578,18 @@ util::Status JsonStreamParser::ParseNumberHelper(NumberResult* result) { return ReportFailure("Octal/hex numbers are not valid JSON values."); } // Negative non-floating point number, parse as an int64. - if (!safe_strto64(number, &result->int_val)) { - return ReportFailure("Unable to parse number."); + if (safe_strto64(number, &result->int_val)) { + result->type = NumberResult::INT; + p_.remove_prefix(index); + return util::Status(); + } else { + // If the value is too large, parse it as double. + util::Status status = ParseDoubleHelper(number, result); + if (status.ok()) { + p_.remove_prefix(index); + } + return status; } - result->type = NumberResult::INT; - p_.remove_prefix(index); - return util::Status(); } util::Status JsonStreamParser::HandleBeginObject() { diff --git a/src/google/protobuf/util/internal/json_stream_parser.h b/src/google/protobuf/util/internal/json_stream_parser.h index 6b9d46ee..31933b67 100644 --- a/src/google/protobuf/util/internal/json_stream_parser.h +++ b/src/google/protobuf/util/internal/json_stream_parser.h @@ -154,6 +154,9 @@ class LIBPROTOBUF_EXPORT JsonStreamParser { // component. util::Status ParseNumberHelper(NumberResult* result); + // Parse a number as double into a NumberResult. + util::Status ParseDoubleHelper(const string& number, NumberResult* result); + // Handles a { during parsing of a value. util::Status HandleBeginObject(); diff --git a/src/google/protobuf/util/internal/json_stream_parser_test.cc b/src/google/protobuf/util/internal/json_stream_parser_test.cc index ca71ff24..a11e9be0 100644 --- a/src/google/protobuf/util/internal/json_stream_parser_test.cc +++ b/src/google/protobuf/util/internal/json_stream_parser_test.cc @@ -694,20 +694,19 @@ TEST_F(JsonStreamParserTest, ExtraCharactersAfterObject) { } } -// numbers too large -TEST_F(JsonStreamParserTest, PositiveNumberTooBig) { - StringPiece str = "[18446744073709551616]"; // 2^64 +TEST_F(JsonStreamParserTest, PositiveNumberTooBigIsDouble) { + StringPiece str = "18446744073709551616"; // 2^64 for (int i = 0; i <= str.length(); ++i) { - ow_.StartList(""); - DoErrorTest(str, i, "Unable to parse number."); + ow_.RenderDouble("", 18446744073709552000.0); + DoTest(str, i); } } -TEST_F(JsonStreamParserTest, NegativeNumberTooBig) { - StringPiece str = "[-18446744073709551616]"; +TEST_F(JsonStreamParserTest, NegativeNumberTooBigIsDouble) { + StringPiece str = "-18446744073709551616"; for (int i = 0; i <= str.length(); ++i) { - ow_.StartList(""); - DoErrorTest(str, i, "Unable to parse number."); + ow_.RenderDouble("", -18446744073709551616.0); + DoTest(str, i); } } diff --git a/src/google/protobuf/util/json_util.cc b/src/google/protobuf/util/json_util.cc index c85f1899..ce3569ce 100644 --- a/src/google/protobuf/util/json_util.cc +++ b/src/google/protobuf/util/json_util.cc @@ -61,9 +61,11 @@ void ZeroCopyStreamByteSink::Append(const char* bytes, size_t len) { buffer_size_ -= len; return; } - memcpy(buffer_, bytes, buffer_size_); - bytes += buffer_size_; - len -= buffer_size_; + if (buffer_size_ > 0) { + memcpy(buffer_, bytes, buffer_size_); + bytes += buffer_size_; + len -= buffer_size_; + } if (!stream_->Next(&buffer_, &buffer_size_)) { // There isn't a way for ByteSink to report errors. buffer_size_ = 0; diff --git a/src/google/protobuf/util/json_util.h b/src/google/protobuf/util/json_util.h index f4f4380a..dee3ddba 100644 --- a/src/google/protobuf/util/json_util.h +++ b/src/google/protobuf/util/json_util.h @@ -179,7 +179,7 @@ namespace internal { class LIBPROTOBUF_EXPORT ZeroCopyStreamByteSink : public strings::ByteSink { public: explicit ZeroCopyStreamByteSink(io::ZeroCopyOutputStream* stream) - : stream_(stream), buffer_size_(0) {} + : stream_(stream), buffer_(NULL), buffer_size_(0) {} ~ZeroCopyStreamByteSink(); virtual void Append(const char* bytes, size_t len); diff --git a/src/google/protobuf/util/message_differencer.cc b/src/google/protobuf/util/message_differencer.cc index d62038ad..e964e041 100644 --- a/src/google/protobuf/util/message_differencer.cc +++ b/src/google/protobuf/util/message_differencer.cc @@ -1440,9 +1440,6 @@ bool MessageDifferencer::MatchRepeatedFieldIndices( match_list1->assign(count1, -1); match_list2->assign(count2, -1); - SpecificField specific_field; - specific_field.field = repeated_field; - bool success = true; // Find potential match if this is a special repeated field. if (key_comparator != NULL || IsTreatedAsSet(repeated_field)) { @@ -1469,20 +1466,15 @@ bool MessageDifferencer::MatchRepeatedFieldIndices( // Indicates any matched elements for this repeated field. bool match = false; - specific_field.index = i; - specific_field.new_index = i; - for (int j = 0; j < count2; j++) { if (match_list2->at(j) != -1) continue; - specific_field.index = i; - specific_field.new_index = j; match = IsMatch(repeated_field, key_comparator, &message1, &message2, parent_fields, i, j); if (match) { - match_list1->at(specific_field.index) = specific_field.new_index; - match_list2->at(specific_field.new_index) = specific_field.index; + match_list1->at(i) = j; + match_list2->at(j) = i; break; } } diff --git a/src/google/protobuf/wire_format.h b/src/google/protobuf/wire_format.h index 01ee1337..d602d214 100644 --- a/src/google/protobuf/wire_format.h +++ b/src/google/protobuf/wire_format.h @@ -41,7 +41,6 @@ #include <string> #include <google/protobuf/stubs/common.h> -#include <google/protobuf/descriptor.pb.h> #include <google/protobuf/descriptor.h> #include <google/protobuf/message.h> #include <google/protobuf/wire_format_lite.h> diff --git a/src/google/protobuf/wire_format_lite.cc b/src/google/protobuf/wire_format_lite.cc index 359353c3..cd343b74 100644 --- a/src/google/protobuf/wire_format_lite.cc +++ b/src/google/protobuf/wire_format_lite.cc @@ -586,7 +586,7 @@ void WireFormatLite::WriteMessageMaybeToArray(int field_number, } } -GOOGLE_ATTRIBUTE_ALWAYS_INLINE static bool ReadBytesToString( +GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static bool ReadBytesToString( io::CodedInputStream* input, string* value); inline static bool ReadBytesToString(io::CodedInputStream* input, string* value) { diff --git a/src/google/protobuf/wire_format_lite.h b/src/google/protobuf/wire_format_lite.h index 3e079ea5..cf614c02 100644 --- a/src/google/protobuf/wire_format_lite.h +++ b/src/google/protobuf/wire_format_lite.h @@ -41,10 +41,12 @@ #define GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_H__ #include <string> + #include <google/protobuf/stubs/common.h> -#include <google/protobuf/repeated_field.h> +#include <google/protobuf/io/coded_stream.h> #include <google/protobuf/message_lite.h> -#include <google/protobuf/io/coded_stream.h> // for CodedOutputStream::Varint32Size +#include <google/protobuf/stubs/port.h> +#include <google/protobuf/repeated_field.h> // Do UTF-8 validation on string type in Debug build only #ifndef NDEBUG @@ -149,7 +151,7 @@ class LIBPROTOBUF_EXPORT WireFormatLite { // Helper method to get the CppType for a particular Type. static CppType FieldTypeToCppType(FieldType type); - // Given a FieldSescriptor::Type return its WireType + // Given a FieldDescriptor::Type return its WireType static inline WireFormatLite::WireType WireTypeForFieldType( WireFormatLite::FieldType type) { return kWireTypeForFieldType[type]; @@ -256,7 +258,7 @@ class LIBPROTOBUF_EXPORT WireFormatLite { // that file to use these. #ifdef NDEBUG -#define INL GOOGLE_ATTRIBUTE_ALWAYS_INLINE +#define INL GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE #else // Avoid excessive inlining in non-optimized builds. Without other optimizations // the inlining is not going to provide benefits anyway and the huge resulting @@ -334,7 +336,6 @@ class LIBPROTOBUF_EXPORT WireFormatLite { static bool ReadBytes(io::CodedInputStream* input, string* value); static bool ReadBytes(io::CodedInputStream* input, string** p); - enum Operation { PARSE = 0, SERIALIZE = 1, @@ -712,7 +713,8 @@ class LIBPROTOBUF_EXPORT WireFormatLite { // A helper method for the repeated primitive reader. This method has // optimizations for primitive types that have fixed size on the wire, and // can be read using potentially faster paths. - template <typename CType, enum FieldType DeclaredType> GOOGLE_ATTRIBUTE_ALWAYS_INLINE + template <typename CType, enum FieldType DeclaredType> + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static bool ReadRepeatedFixedSizePrimitive( int tag_size, uint32 tag, @@ -721,7 +723,8 @@ class LIBPROTOBUF_EXPORT WireFormatLite { // Like ReadRepeatedFixedSizePrimitive but for packed primitive fields. template <typename CType, enum FieldType DeclaredType> - GOOGLE_ATTRIBUTE_ALWAYS_INLINE static bool ReadPackedFixedSizePrimitive( + GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE + static bool ReadPackedFixedSizePrimitive( google::protobuf::io::CodedInputStream* input, RepeatedField<CType>* value); static const CppType kFieldTypeToCppTypeMap[]; @@ -851,20 +854,24 @@ inline double WireFormatLite::DecodeDouble(uint64 value) { inline uint32 WireFormatLite::ZigZagEncode32(int32 n) { // Note: the right-shift must be arithmetic - return static_cast<uint32>((n << 1) ^ (n >> 31)); + // Note: left shift must be unsigned because of overflow + return (static_cast<uint32>(n) << 1) ^ static_cast<uint32>(n >> 31); } inline int32 WireFormatLite::ZigZagDecode32(uint32 n) { - return static_cast<int32>(n >> 1) ^ -static_cast<int32>(n & 1); + // Note: Using unsigned types prevent undefined behavior + return static_cast<int32>((n >> 1) ^ -(n & 1)); } inline uint64 WireFormatLite::ZigZagEncode64(int64 n) { // Note: the right-shift must be arithmetic - return static_cast<uint64>((n << 1) ^ (n >> 63)); + // Note: left shift must be unsigned because of overflow + return (static_cast<uint64>(n) << 1) ^ static_cast<uint64>(n >> 63); } inline int64 WireFormatLite::ZigZagDecode64(uint64 n) { - return static_cast<int64>(n >> 1) ^ -static_cast<int64>(n & 1); + // Note: Using unsigned types prevent undefined behavior + return static_cast<int64>((n >> 1) ^ -(n & 1)); } // String is for UTF-8 text only, but, even so, ReadString() can simply diff --git a/src/google/protobuf/wire_format_lite_inl.h b/src/google/protobuf/wire_format_lite_inl.h index c044def8..b264bd7e 100644 --- a/src/google/protobuf/wire_format_lite_inl.h +++ b/src/google/protobuf/wire_format_lite_inl.h @@ -426,7 +426,6 @@ bool WireFormatLite::ReadPackedPrimitiveNoInline(io::CodedInputStream* input, } - inline bool WireFormatLite::ReadGroup(int field_number, io::CodedInputStream* input, MessageLite* value) { diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc index d76e8aa6..00e01256 100644 --- a/src/google/protobuf/wrappers.pb.cc +++ b/src/google/protobuf/wrappers.pb.cc @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/wrappers.proto -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #include <google/protobuf/wrappers.pb.h> #include <algorithm> @@ -15,169 +14,332 @@ #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> +// This is a temporary google only hack +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS +#include "third_party/protobuf/version.h" +#endif // @@protoc_insertion_point(includes) - namespace google { namespace protobuf { class DoubleValueDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<DoubleValue> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<DoubleValue> + _instance; } _DoubleValue_default_instance_; class FloatValueDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<FloatValue> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<FloatValue> + _instance; } _FloatValue_default_instance_; class Int64ValueDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<Int64Value> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<Int64Value> + _instance; } _Int64Value_default_instance_; class UInt64ValueDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<UInt64Value> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<UInt64Value> + _instance; } _UInt64Value_default_instance_; class Int32ValueDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<Int32Value> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<Int32Value> + _instance; } _Int32Value_default_instance_; class UInt32ValueDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<UInt32Value> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<UInt32Value> + _instance; } _UInt32Value_default_instance_; class BoolValueDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<BoolValue> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<BoolValue> + _instance; } _BoolValue_default_instance_; class StringValueDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<StringValue> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<StringValue> + _instance; } _StringValue_default_instance_; class BytesValueDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed<BytesValue> - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed<BytesValue> + _instance; } _BytesValue_default_instance_; - +} // namespace protobuf +} // namespace google namespace protobuf_google_2fprotobuf_2fwrappers_2eproto { +void InitDefaultsDoubleValueImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_DoubleValue_default_instance_; + new (ptr) ::google::protobuf::DoubleValue(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::DoubleValue::InitAsDefaultInstance(); +} -namespace { +void InitDefaultsDoubleValue() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsDoubleValueImpl); +} -::google::protobuf::Metadata file_level_metadata[9]; +void InitDefaultsFloatValueImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; -} // namespace +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_FloatValue_default_instance_; + new (ptr) ::google::protobuf::FloatValue(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::FloatValue::InitAsDefaultInstance(); +} -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField - const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0}, -}; +void InitDefaultsFloatValue() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsFloatValueImpl); +} -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField - const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - ::google::protobuf::internal::AuxillaryParseTableField(), -}; -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const - TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, - { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, -}; +void InitDefaultsInt64ValueImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_Int64Value_default_instance_; + new (ptr) ::google::protobuf::Int64Value(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::Int64Value::InitAsDefaultInstance(); +} + +void InitDefaultsInt64Value() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsInt64ValueImpl); +} + +void InitDefaultsUInt64ValueImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_UInt64Value_default_instance_; + new (ptr) ::google::protobuf::UInt64Value(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::UInt64Value::InitAsDefaultInstance(); +} + +void InitDefaultsUInt64Value() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsUInt64ValueImpl); +} + +void InitDefaultsInt32ValueImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_Int32Value_default_instance_; + new (ptr) ::google::protobuf::Int32Value(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::Int32Value::InitAsDefaultInstance(); +} + +void InitDefaultsInt32Value() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsInt32ValueImpl); +} + +void InitDefaultsUInt32ValueImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_UInt32Value_default_instance_; + new (ptr) ::google::protobuf::UInt32Value(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::UInt32Value::InitAsDefaultInstance(); +} + +void InitDefaultsUInt32Value() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsUInt32ValueImpl); +} + +void InitDefaultsBoolValueImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_BoolValue_default_instance_; + new (ptr) ::google::protobuf::BoolValue(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::BoolValue::InitAsDefaultInstance(); +} + +void InitDefaultsBoolValue() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsBoolValueImpl); +} + +void InitDefaultsStringValueImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_StringValue_default_instance_; + new (ptr) ::google::protobuf::StringValue(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::StringValue::InitAsDefaultInstance(); +} + +void InitDefaultsStringValue() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsStringValueImpl); +} + +void InitDefaultsBytesValueImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::google::protobuf::_BytesValue_default_instance_; + new (ptr) ::google::protobuf::BytesValue(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::google::protobuf::BytesValue::InitAsDefaultInstance(); +} + +void InitDefaultsBytesValue() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsBytesValueImpl); +} + +::google::protobuf::Metadata file_level_metadata[9]; -const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { +const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DoubleValue, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DoubleValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DoubleValue, value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::DoubleValue, value_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FloatValue, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FloatValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FloatValue, value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::FloatValue, value_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Int64Value, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Int64Value, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Int64Value, value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Int64Value, value_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UInt64Value, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UInt64Value, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UInt64Value, value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UInt64Value, value_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Int32Value, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Int32Value, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Int32Value, value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Int32Value, value_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UInt32Value, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UInt32Value, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UInt32Value, value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::UInt32Value, value_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BoolValue, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::BoolValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BoolValue, value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::BoolValue, value_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StringValue, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::StringValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StringValue, value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::StringValue, value_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BytesValue, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::BytesValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BytesValue, value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::BytesValue, value_), }; -static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(DoubleValue)}, - { 6, -1, sizeof(FloatValue)}, - { 12, -1, sizeof(Int64Value)}, - { 18, -1, sizeof(UInt64Value)}, - { 24, -1, sizeof(Int32Value)}, - { 30, -1, sizeof(UInt32Value)}, - { 36, -1, sizeof(BoolValue)}, - { 42, -1, sizeof(StringValue)}, - { 48, -1, sizeof(BytesValue)}, +static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, sizeof(::google::protobuf::DoubleValue)}, + { 6, -1, sizeof(::google::protobuf::FloatValue)}, + { 12, -1, sizeof(::google::protobuf::Int64Value)}, + { 18, -1, sizeof(::google::protobuf::UInt64Value)}, + { 24, -1, sizeof(::google::protobuf::Int32Value)}, + { 30, -1, sizeof(::google::protobuf::UInt32Value)}, + { 36, -1, sizeof(::google::protobuf::BoolValue)}, + { 42, -1, sizeof(::google::protobuf::StringValue)}, + { 48, -1, sizeof(::google::protobuf::BytesValue)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { - reinterpret_cast<const ::google::protobuf::Message*>(&_DoubleValue_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_FloatValue_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_Int64Value_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_UInt64Value_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_Int32Value_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_UInt32Value_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_BoolValue_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_StringValue_default_instance_), - reinterpret_cast<const ::google::protobuf::Message*>(&_BytesValue_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_DoubleValue_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_FloatValue_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Int64Value_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_UInt64Value_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Int32Value_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_UInt32Value_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_BoolValue_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_StringValue_default_instance_), + reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_BytesValue_default_instance_), }; -namespace { - void protobuf_AssignDescriptors() { AddDescriptors(); ::google::protobuf::MessageFactory* factory = NULL; @@ -191,45 +353,15 @@ void protobuf_AssignDescriptorsOnce() { ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); } -void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; +void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 9); } -} // namespace -void TableStruct::InitDefaultsImpl() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::internal::InitProtobufDefaults(); - _DoubleValue_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_DoubleValue_default_instance_);_FloatValue_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_FloatValue_default_instance_);_Int64Value_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_Int64Value_default_instance_);_UInt64Value_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_UInt64Value_default_instance_);_Int32Value_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_Int32Value_default_instance_);_UInt32Value_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_UInt32Value_default_instance_);_BoolValue_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_BoolValue_default_instance_);_StringValue_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_StringValue_default_instance_);_BytesValue_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_BytesValue_default_instance_);} - -void InitDefaults() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl); -} -namespace { void AddDescriptorsImpl() { InitDefaults(); - static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { "\n\036google/protobuf/wrappers.proto\022\017google" ".protobuf\"\034\n\013DoubleValue\022\r\n\005value\030\001 \001(\001\"" "\033\n\nFloatValue\022\r\n\005value\030\001 \001(\002\"\033\n\nInt64Val" @@ -248,7 +380,6 @@ void AddDescriptorsImpl() { ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/wrappers.proto", &protobuf_RegisterTypes); } -} // anonymous namespace void AddDescriptors() { static GOOGLE_PROTOBUF_DECLARE_ONCE(once); @@ -260,12 +391,14 @@ struct StaticDescriptorInitializer { AddDescriptors(); } } static_descriptor_initializer; - } // namespace protobuf_google_2fprotobuf_2fwrappers_2eproto - +namespace google { +namespace protobuf { // =================================================================== +void DoubleValue::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int DoubleValue::kValueFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -273,7 +406,7 @@ const int DoubleValue::kValueFieldNumber; DoubleValue::DoubleValue() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsDoubleValue(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.DoubleValue) @@ -281,7 +414,7 @@ DoubleValue::DoubleValue() DoubleValue::DoubleValue(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena) { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsDoubleValue(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.DoubleValue) @@ -306,12 +439,7 @@ DoubleValue::~DoubleValue() { } void DoubleValue::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } void DoubleValue::ArenaDtor(void* object) { @@ -326,12 +454,12 @@ void DoubleValue::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* DoubleValue::descriptor() { - protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const DoubleValue& DoubleValue::default_instance() { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsDoubleValue(); return *internal_default_instance(); } @@ -525,30 +653,14 @@ void DoubleValue::InternalSwap(DoubleValue* other) { ::google::protobuf::Metadata DoubleValue::GetMetadata() const { protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// DoubleValue - -// double value = 1; -void DoubleValue::clear_value() { - value_ = 0; -} -double DoubleValue::value() const { - // @@protoc_insertion_point(field_get:google.protobuf.DoubleValue.value) - return value_; -} -void DoubleValue::set_value(double value) { - - value_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.DoubleValue.value) + return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages]; } -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void FloatValue::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int FloatValue::kValueFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -556,7 +668,7 @@ const int FloatValue::kValueFieldNumber; FloatValue::FloatValue() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsFloatValue(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.FloatValue) @@ -564,7 +676,7 @@ FloatValue::FloatValue() FloatValue::FloatValue(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena) { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsFloatValue(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.FloatValue) @@ -589,12 +701,7 @@ FloatValue::~FloatValue() { } void FloatValue::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } void FloatValue::ArenaDtor(void* object) { @@ -609,12 +716,12 @@ void FloatValue::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* FloatValue::descriptor() { - protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const FloatValue& FloatValue::default_instance() { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsFloatValue(); return *internal_default_instance(); } @@ -808,30 +915,14 @@ void FloatValue::InternalSwap(FloatValue* other) { ::google::protobuf::Metadata FloatValue::GetMetadata() const { protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// FloatValue - -// float value = 1; -void FloatValue::clear_value() { - value_ = 0; -} -float FloatValue::value() const { - // @@protoc_insertion_point(field_get:google.protobuf.FloatValue.value) - return value_; -} -void FloatValue::set_value(float value) { - - value_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.FloatValue.value) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void Int64Value::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int Int64Value::kValueFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -839,7 +930,7 @@ const int Int64Value::kValueFieldNumber; Int64Value::Int64Value() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsInt64Value(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.Int64Value) @@ -847,7 +938,7 @@ Int64Value::Int64Value() Int64Value::Int64Value(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena) { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsInt64Value(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Int64Value) @@ -872,12 +963,7 @@ Int64Value::~Int64Value() { } void Int64Value::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } void Int64Value::ArenaDtor(void* object) { @@ -892,12 +978,12 @@ void Int64Value::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* Int64Value::descriptor() { - protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const Int64Value& Int64Value::default_instance() { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsInt64Value(); return *internal_default_instance(); } @@ -1093,30 +1179,14 @@ void Int64Value::InternalSwap(Int64Value* other) { ::google::protobuf::Metadata Int64Value::GetMetadata() const { protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// Int64Value - -// int64 value = 1; -void Int64Value::clear_value() { - value_ = GOOGLE_LONGLONG(0); -} -::google::protobuf::int64 Int64Value::value() const { - // @@protoc_insertion_point(field_get:google.protobuf.Int64Value.value) - return value_; -} -void Int64Value::set_value(::google::protobuf::int64 value) { - - value_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Int64Value.value) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void UInt64Value::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int UInt64Value::kValueFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -1124,7 +1194,7 @@ const int UInt64Value::kValueFieldNumber; UInt64Value::UInt64Value() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsUInt64Value(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.UInt64Value) @@ -1132,7 +1202,7 @@ UInt64Value::UInt64Value() UInt64Value::UInt64Value(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena) { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsUInt64Value(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.UInt64Value) @@ -1157,12 +1227,7 @@ UInt64Value::~UInt64Value() { } void UInt64Value::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } void UInt64Value::ArenaDtor(void* object) { @@ -1177,12 +1242,12 @@ void UInt64Value::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* UInt64Value::descriptor() { - protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const UInt64Value& UInt64Value::default_instance() { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsUInt64Value(); return *internal_default_instance(); } @@ -1378,30 +1443,14 @@ void UInt64Value::InternalSwap(UInt64Value* other) { ::google::protobuf::Metadata UInt64Value::GetMetadata() const { protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// UInt64Value - -// uint64 value = 1; -void UInt64Value::clear_value() { - value_ = GOOGLE_ULONGLONG(0); -} -::google::protobuf::uint64 UInt64Value::value() const { - // @@protoc_insertion_point(field_get:google.protobuf.UInt64Value.value) - return value_; -} -void UInt64Value::set_value(::google::protobuf::uint64 value) { - - value_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.UInt64Value.value) + return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages]; } -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void Int32Value::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int Int32Value::kValueFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -1409,7 +1458,7 @@ const int Int32Value::kValueFieldNumber; Int32Value::Int32Value() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsInt32Value(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.Int32Value) @@ -1417,7 +1466,7 @@ Int32Value::Int32Value() Int32Value::Int32Value(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena) { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsInt32Value(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Int32Value) @@ -1442,12 +1491,7 @@ Int32Value::~Int32Value() { } void Int32Value::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } void Int32Value::ArenaDtor(void* object) { @@ -1462,12 +1506,12 @@ void Int32Value::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* Int32Value::descriptor() { - protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const Int32Value& Int32Value::default_instance() { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsInt32Value(); return *internal_default_instance(); } @@ -1663,30 +1707,14 @@ void Int32Value::InternalSwap(Int32Value* other) { ::google::protobuf::Metadata Int32Value::GetMetadata() const { protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// Int32Value - -// int32 value = 1; -void Int32Value::clear_value() { - value_ = 0; -} -::google::protobuf::int32 Int32Value::value() const { - // @@protoc_insertion_point(field_get:google.protobuf.Int32Value.value) - return value_; -} -void Int32Value::set_value(::google::protobuf::int32 value) { - - value_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.Int32Value.value) + return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages]; } -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void UInt32Value::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int UInt32Value::kValueFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -1694,7 +1722,7 @@ const int UInt32Value::kValueFieldNumber; UInt32Value::UInt32Value() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsUInt32Value(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.UInt32Value) @@ -1702,7 +1730,7 @@ UInt32Value::UInt32Value() UInt32Value::UInt32Value(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena) { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsUInt32Value(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.UInt32Value) @@ -1727,12 +1755,7 @@ UInt32Value::~UInt32Value() { } void UInt32Value::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } void UInt32Value::ArenaDtor(void* object) { @@ -1747,12 +1770,12 @@ void UInt32Value::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* UInt32Value::descriptor() { - protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const UInt32Value& UInt32Value::default_instance() { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsUInt32Value(); return *internal_default_instance(); } @@ -1948,30 +1971,14 @@ void UInt32Value::InternalSwap(UInt32Value* other) { ::google::protobuf::Metadata UInt32Value::GetMetadata() const { protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// UInt32Value - -// uint32 value = 1; -void UInt32Value::clear_value() { - value_ = 0u; -} -::google::protobuf::uint32 UInt32Value::value() const { - // @@protoc_insertion_point(field_get:google.protobuf.UInt32Value.value) - return value_; -} -void UInt32Value::set_value(::google::protobuf::uint32 value) { - - value_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.UInt32Value.value) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void BoolValue::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int BoolValue::kValueFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -1979,7 +1986,7 @@ const int BoolValue::kValueFieldNumber; BoolValue::BoolValue() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsBoolValue(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.BoolValue) @@ -1987,7 +1994,7 @@ BoolValue::BoolValue() BoolValue::BoolValue(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena) { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsBoolValue(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.BoolValue) @@ -2012,12 +2019,7 @@ BoolValue::~BoolValue() { } void BoolValue::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); } void BoolValue::ArenaDtor(void* object) { @@ -2032,12 +2034,12 @@ void BoolValue::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* BoolValue::descriptor() { - protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const BoolValue& BoolValue::default_instance() { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsBoolValue(); return *internal_default_instance(); } @@ -2231,30 +2233,14 @@ void BoolValue::InternalSwap(BoolValue* other) { ::google::protobuf::Metadata BoolValue::GetMetadata() const { protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// BoolValue - -// bool value = 1; -void BoolValue::clear_value() { - value_ = false; -} -bool BoolValue::value() const { - // @@protoc_insertion_point(field_get:google.protobuf.BoolValue.value) - return value_; -} -void BoolValue::set_value(bool value) { - - value_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.BoolValue.value) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void StringValue::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int StringValue::kValueFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -2262,7 +2248,7 @@ const int StringValue::kValueFieldNumber; StringValue::StringValue() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsStringValue(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.StringValue) @@ -2270,7 +2256,7 @@ StringValue::StringValue() StringValue::StringValue(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena) { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsStringValue(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.StringValue) @@ -2299,13 +2285,8 @@ StringValue::~StringValue() { } void StringValue::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - - value_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); + value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } void StringValue::ArenaDtor(void* object) { @@ -2320,12 +2301,12 @@ void StringValue::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* StringValue::descriptor() { - protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const StringValue& StringValue::default_instance() { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsStringValue(); return *internal_default_instance(); } @@ -2534,91 +2515,14 @@ void StringValue::InternalSwap(StringValue* other) { ::google::protobuf::Metadata StringValue::GetMetadata() const { protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// StringValue - -// string value = 1; -void StringValue::clear_value() { - value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -const ::std::string& StringValue::value() const { - // @@protoc_insertion_point(field_get:google.protobuf.StringValue.value) - return value_.Get(); -} -void StringValue::set_value(const ::std::string& value) { - - value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set:google.protobuf.StringValue.value) -} -#if LANG_CXX11 -void StringValue::set_value(::std::string&& value) { - - value_.Set( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.StringValue.value) -} -#endif -void StringValue::set_value(const char* value) { - GOOGLE_DCHECK(value != NULL); - - value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_char:google.protobuf.StringValue.value) -} -void StringValue::set_value(const char* value, - size_t size) { - - value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( - reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.StringValue.value) -} -::std::string* StringValue::mutable_value() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.StringValue.value) - return value_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* StringValue::release_value() { - // @@protoc_insertion_point(field_release:google.protobuf.StringValue.value) - - return value_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* StringValue::unsafe_arena_release_value() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.StringValue.value) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} -void StringValue::set_allocated_value(::std::string* value) { - if (value != NULL) { - - } else { - - } - value_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.StringValue.value) -} -void StringValue::unsafe_arena_set_allocated_value( - ::std::string* value) { - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - if (value != NULL) { - - } else { - - } - value_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - value, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.StringValue.value) + return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages]; } -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void BytesValue::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int BytesValue::kValueFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -2626,7 +2530,7 @@ const int BytesValue::kValueFieldNumber; BytesValue::BytesValue() : ::google::protobuf::Message(), _internal_metadata_(NULL) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsBytesValue(); } SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.BytesValue) @@ -2634,7 +2538,7 @@ BytesValue::BytesValue() BytesValue::BytesValue(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena) { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsBytesValue(); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.BytesValue) @@ -2663,13 +2567,8 @@ BytesValue::~BytesValue() { } void BytesValue::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - - value_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); + value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } void BytesValue::ArenaDtor(void* object) { @@ -2684,12 +2583,12 @@ void BytesValue::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* BytesValue::descriptor() { - protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const BytesValue& BytesValue::default_instance() { - protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaults(); + ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsBytesValue(); return *internal_default_instance(); } @@ -2886,91 +2785,11 @@ void BytesValue::InternalSwap(BytesValue* other) { ::google::protobuf::Metadata BytesValue::GetMetadata() const { protobuf_google_2fprotobuf_2fwrappers_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages]; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// BytesValue - -// bytes value = 1; -void BytesValue::clear_value() { - value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -const ::std::string& BytesValue::value() const { - // @@protoc_insertion_point(field_get:google.protobuf.BytesValue.value) - return value_.Get(); -} -void BytesValue::set_value(const ::std::string& value) { - - value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set:google.protobuf.BytesValue.value) -} -#if LANG_CXX11 -void BytesValue::set_value(::std::string&& value) { - - value_.Set( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.BytesValue.value) -} -#endif -void BytesValue::set_value(const char* value) { - GOOGLE_DCHECK(value != NULL); - - value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_char:google.protobuf.BytesValue.value) -} -void BytesValue::set_value(const void* value, - size_t size) { - - value_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( - reinterpret_cast<const char*>(value), size), GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.BytesValue.value) -} -::std::string* BytesValue::mutable_value() { - - // @@protoc_insertion_point(field_mutable:google.protobuf.BytesValue.value) - return value_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* BytesValue::release_value() { - // @@protoc_insertion_point(field_release:google.protobuf.BytesValue.value) - - return value_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); -} -::std::string* BytesValue::unsafe_arena_release_value() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.BytesValue.value) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} -void BytesValue::set_allocated_value(::std::string* value) { - if (value != NULL) { - - } else { - - } - value_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, - GetArenaNoVirtual()); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.BytesValue.value) -} -void BytesValue::unsafe_arena_set_allocated_value( - ::std::string* value) { - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - if (value != NULL) { - - } else { - - } - value_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - value, GetArenaNoVirtual()); - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.BytesValue.value) + return ::protobuf_google_2fprotobuf_2fwrappers_2eproto::file_level_metadata[kIndexInFileMessages]; } -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h index 29d6b738..be49c3ec 100644 --- a/src/google/protobuf/wrappers.pb.h +++ b/src/google/protobuf/wrappers.pb.h @@ -30,6 +30,48 @@ #include <google/protobuf/extension_set.h> // IWYU pragma: export #include <google/protobuf/unknown_field_set.h> // @@protoc_insertion_point(includes) + +namespace protobuf_google_2fprotobuf_2fwrappers_2eproto { +// Internal implementation detail -- do not use these members. +struct LIBPROTOBUF_EXPORT TableStruct { + static const ::google::protobuf::internal::ParseTableField entries[]; + static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; + static const ::google::protobuf::internal::ParseTable schema[9]; + static const ::google::protobuf::internal::FieldMetadata field_metadata[]; + static const ::google::protobuf::internal::SerializationTable serialization_table[]; + static const ::google::protobuf::uint32 offsets[]; +}; +void LIBPROTOBUF_EXPORT AddDescriptors(); +void LIBPROTOBUF_EXPORT InitDefaultsDoubleValueImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsDoubleValue(); +void LIBPROTOBUF_EXPORT InitDefaultsFloatValueImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsFloatValue(); +void LIBPROTOBUF_EXPORT InitDefaultsInt64ValueImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsInt64Value(); +void LIBPROTOBUF_EXPORT InitDefaultsUInt64ValueImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsUInt64Value(); +void LIBPROTOBUF_EXPORT InitDefaultsInt32ValueImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsInt32Value(); +void LIBPROTOBUF_EXPORT InitDefaultsUInt32ValueImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsUInt32Value(); +void LIBPROTOBUF_EXPORT InitDefaultsBoolValueImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsBoolValue(); +void LIBPROTOBUF_EXPORT InitDefaultsStringValueImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsStringValue(); +void LIBPROTOBUF_EXPORT InitDefaultsBytesValueImpl(); +void LIBPROTOBUF_EXPORT InitDefaultsBytesValue(); +inline void LIBPROTOBUF_EXPORT InitDefaults() { + InitDefaultsDoubleValue(); + InitDefaultsFloatValue(); + InitDefaultsInt64Value(); + InitDefaultsUInt64Value(); + InitDefaultsInt32Value(); + InitDefaultsUInt32Value(); + InitDefaultsBoolValue(); + InitDefaultsStringValue(); + InitDefaultsBytesValue(); +} +} // namespace protobuf_google_2fprotobuf_2fwrappers_2eproto namespace google { namespace protobuf { class BoolValue; @@ -61,25 +103,9 @@ class UInt64ValueDefaultTypeInternal; LIBPROTOBUF_EXPORT extern UInt64ValueDefaultTypeInternal _UInt64Value_default_instance_; } // namespace protobuf } // namespace google - namespace google { namespace protobuf { -namespace protobuf_google_2fprotobuf_2fwrappers_2eproto { -// Internal implementation detail -- do not call these. -struct LIBPROTOBUF_EXPORT TableStruct { - static const ::google::protobuf::internal::ParseTableField entries[]; - static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; - static const ::google::protobuf::internal::ParseTable schema[]; - static const ::google::protobuf::uint32 offsets[]; - static const ::google::protobuf::internal::FieldMetadata field_metadata[]; - static const ::google::protobuf::internal::SerializationTable serialization_table[]; - static void InitDefaultsImpl(); -}; -void LIBPROTOBUF_EXPORT AddDescriptors(); -void LIBPROTOBUF_EXPORT InitDefaults(); -} // namespace protobuf_google_2fprotobuf_2fwrappers_2eproto - // =================================================================== class LIBPROTOBUF_EXPORT DoubleValue : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.DoubleValue) */ { @@ -117,6 +143,7 @@ class LIBPROTOBUF_EXPORT DoubleValue : public ::google::protobuf::Message /* @@p static const ::google::protobuf::Descriptor* descriptor(); static const DoubleValue& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const DoubleValue* internal_default_instance() { return reinterpret_cast<const DoubleValue*>( &_DoubleValue_default_instance_); @@ -190,7 +217,8 @@ class LIBPROTOBUF_EXPORT DoubleValue : public ::google::protobuf::Message /* @@p typedef void DestructorSkippable_; double value_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsDoubleValueImpl(); }; // ------------------------------------------------------------------- @@ -229,6 +257,7 @@ class LIBPROTOBUF_EXPORT FloatValue : public ::google::protobuf::Message /* @@pr static const ::google::protobuf::Descriptor* descriptor(); static const FloatValue& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const FloatValue* internal_default_instance() { return reinterpret_cast<const FloatValue*>( &_FloatValue_default_instance_); @@ -302,7 +331,8 @@ class LIBPROTOBUF_EXPORT FloatValue : public ::google::protobuf::Message /* @@pr typedef void DestructorSkippable_; float value_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsFloatValueImpl(); }; // ------------------------------------------------------------------- @@ -341,6 +371,7 @@ class LIBPROTOBUF_EXPORT Int64Value : public ::google::protobuf::Message /* @@pr static const ::google::protobuf::Descriptor* descriptor(); static const Int64Value& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Int64Value* internal_default_instance() { return reinterpret_cast<const Int64Value*>( &_Int64Value_default_instance_); @@ -414,7 +445,8 @@ class LIBPROTOBUF_EXPORT Int64Value : public ::google::protobuf::Message /* @@pr typedef void DestructorSkippable_; ::google::protobuf::int64 value_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsInt64ValueImpl(); }; // ------------------------------------------------------------------- @@ -453,6 +485,7 @@ class LIBPROTOBUF_EXPORT UInt64Value : public ::google::protobuf::Message /* @@p static const ::google::protobuf::Descriptor* descriptor(); static const UInt64Value& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const UInt64Value* internal_default_instance() { return reinterpret_cast<const UInt64Value*>( &_UInt64Value_default_instance_); @@ -526,7 +559,8 @@ class LIBPROTOBUF_EXPORT UInt64Value : public ::google::protobuf::Message /* @@p typedef void DestructorSkippable_; ::google::protobuf::uint64 value_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsUInt64ValueImpl(); }; // ------------------------------------------------------------------- @@ -565,6 +599,7 @@ class LIBPROTOBUF_EXPORT Int32Value : public ::google::protobuf::Message /* @@pr static const ::google::protobuf::Descriptor* descriptor(); static const Int32Value& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Int32Value* internal_default_instance() { return reinterpret_cast<const Int32Value*>( &_Int32Value_default_instance_); @@ -638,7 +673,8 @@ class LIBPROTOBUF_EXPORT Int32Value : public ::google::protobuf::Message /* @@pr typedef void DestructorSkippable_; ::google::protobuf::int32 value_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsInt32ValueImpl(); }; // ------------------------------------------------------------------- @@ -677,6 +713,7 @@ class LIBPROTOBUF_EXPORT UInt32Value : public ::google::protobuf::Message /* @@p static const ::google::protobuf::Descriptor* descriptor(); static const UInt32Value& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const UInt32Value* internal_default_instance() { return reinterpret_cast<const UInt32Value*>( &_UInt32Value_default_instance_); @@ -750,7 +787,8 @@ class LIBPROTOBUF_EXPORT UInt32Value : public ::google::protobuf::Message /* @@p typedef void DestructorSkippable_; ::google::protobuf::uint32 value_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsUInt32ValueImpl(); }; // ------------------------------------------------------------------- @@ -789,6 +827,7 @@ class LIBPROTOBUF_EXPORT BoolValue : public ::google::protobuf::Message /* @@pro static const ::google::protobuf::Descriptor* descriptor(); static const BoolValue& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const BoolValue* internal_default_instance() { return reinterpret_cast<const BoolValue*>( &_BoolValue_default_instance_); @@ -862,7 +901,8 @@ class LIBPROTOBUF_EXPORT BoolValue : public ::google::protobuf::Message /* @@pro typedef void DestructorSkippable_; bool value_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsBoolValueImpl(); }; // ------------------------------------------------------------------- @@ -901,6 +941,7 @@ class LIBPROTOBUF_EXPORT StringValue : public ::google::protobuf::Message /* @@p static const ::google::protobuf::Descriptor* descriptor(); static const StringValue& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const StringValue* internal_default_instance() { return reinterpret_cast<const StringValue*>( &_StringValue_default_instance_); @@ -972,7 +1013,13 @@ class LIBPROTOBUF_EXPORT StringValue : public ::google::protobuf::Message /* @@p ::std::string* mutable_value(); ::std::string* release_value(); void set_allocated_value(::std::string* value); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") ::std::string* unsafe_arena_release_value(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") void unsafe_arena_set_allocated_value( ::std::string* value); @@ -985,7 +1032,8 @@ class LIBPROTOBUF_EXPORT StringValue : public ::google::protobuf::Message /* @@p typedef void DestructorSkippable_; ::google::protobuf::internal::ArenaStringPtr value_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsStringValueImpl(); }; // ------------------------------------------------------------------- @@ -1024,6 +1072,7 @@ class LIBPROTOBUF_EXPORT BytesValue : public ::google::protobuf::Message /* @@pr static const ::google::protobuf::Descriptor* descriptor(); static const BytesValue& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const BytesValue* internal_default_instance() { return reinterpret_cast<const BytesValue*>( &_BytesValue_default_instance_); @@ -1095,7 +1144,13 @@ class LIBPROTOBUF_EXPORT BytesValue : public ::google::protobuf::Message /* @@pr ::std::string* mutable_value(); ::std::string* release_value(); void set_allocated_value(::std::string* value); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") ::std::string* unsafe_arena_release_value(); + PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") void unsafe_arena_set_allocated_value( ::std::string* value); @@ -1108,14 +1163,14 @@ class LIBPROTOBUF_EXPORT BytesValue : public ::google::protobuf::Message /* @@pr typedef void DestructorSkippable_; ::google::protobuf::internal::ArenaStringPtr value_; mutable int _cached_size_; - friend struct protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct; + friend struct ::protobuf_google_2fprotobuf_2fwrappers_2eproto::TableStruct; + friend void ::protobuf_google_2fprotobuf_2fwrappers_2eproto::InitDefaultsBytesValueImpl(); }; // =================================================================== // =================================================================== -#if !PROTOBUF_INLINE_NOT_IN_HEADERS #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" @@ -1293,13 +1348,6 @@ inline ::std::string* StringValue::release_value() { return value_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } -inline ::std::string* StringValue::unsafe_arena_release_value() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.StringValue.value) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} inline void StringValue::set_allocated_value(::std::string* value) { if (value != NULL) { @@ -1310,6 +1358,13 @@ inline void StringValue::set_allocated_value(::std::string* value) { GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.StringValue.value) } +inline ::std::string* StringValue::unsafe_arena_release_value() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.StringValue.value) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + + return value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} inline void StringValue::unsafe_arena_set_allocated_value( ::std::string* value) { GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); @@ -1372,13 +1427,6 @@ inline ::std::string* BytesValue::release_value() { return value_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); } -inline ::std::string* BytesValue::unsafe_arena_release_value() { - // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.BytesValue.value) - GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); - - return value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} inline void BytesValue::set_allocated_value(::std::string* value) { if (value != NULL) { @@ -1389,6 +1437,13 @@ inline void BytesValue::set_allocated_value(::std::string* value) { GetArenaNoVirtual()); // @@protoc_insertion_point(field_set_allocated:google.protobuf.BytesValue.value) } +inline ::std::string* BytesValue::unsafe_arena_release_value() { + // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.BytesValue.value) + GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); + + return value_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + GetArenaNoVirtual()); +} inline void BytesValue::unsafe_arena_set_allocated_value( ::std::string* value) { GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); @@ -1405,7 +1460,6 @@ inline void BytesValue::unsafe_arena_set_allocated_value( #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ -#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // ------------------------------------------------------------------- // ------------------------------------------------------------------- @@ -1425,7 +1479,6 @@ inline void BytesValue::unsafe_arena_set_allocated_value( // @@protoc_insertion_point(namespace_scope) - } // namespace protobuf } // namespace google |