diff --git a/external/bin/protoc.exe b/external/bin/protoc.exe index 052bf85..50c07cd 100644 Binary files a/external/bin/protoc.exe and b/external/bin/protoc.exe differ diff --git a/external/include/google/protobuf/any.h b/external/include/google/protobuf/any.h index 684fbf1..3ec8294 100644 --- a/external/include/google/protobuf/any.h +++ b/external/include/google/protobuf/any.h @@ -67,12 +67,12 @@ class PROTOBUF_EXPORT AnyMetadata { // The resulted type URL will be "type.googleapis.com/". // Returns false if serializing the message failed. template - bool PackFrom(const T& message) { - return InternalPackFrom(message, kTypeGoogleApisComPrefix, + bool PackFrom(Arena* arena, const T& message) { + return InternalPackFrom(arena, message, kTypeGoogleApisComPrefix, T::FullMessageName()); } - bool PackFrom(const Message& message); + bool PackFrom(Arena* arena, const Message& message); // Packs a message using the given type URL prefix. The type URL will be // constructed by concatenating the message type's full name to the prefix @@ -82,11 +82,11 @@ class PROTOBUF_EXPORT AnyMetadata { // URL: "type.googleapis.com/". // Returns false if serializing the message failed. template - bool PackFrom(const T& message, StringPiece type_url_prefix) { - return InternalPackFrom(message, type_url_prefix, T::FullMessageName()); + bool PackFrom(Arena* arena, const T& message, StringPiece type_url_prefix) { + return InternalPackFrom(arena, message, type_url_prefix, T::FullMessageName()); } - bool PackFrom(const Message& message, StringPiece type_url_prefix); + bool PackFrom(Arena* arena, const Message& message, StringPiece type_url_prefix); // Unpacks the payload into the given message. Returns false if the message's // type doesn't match the type specified in the type URL (i.e., the full @@ -108,7 +108,8 @@ class PROTOBUF_EXPORT AnyMetadata { } private: - bool InternalPackFrom(const MessageLite& message, + bool InternalPackFrom(Arena* arena, + const MessageLite& message, StringPiece type_url_prefix, StringPiece type_name); bool InternalUnpackTo(StringPiece type_name, diff --git a/external/include/google/protobuf/any.pb.h b/external/include/google/protobuf/any.pb.h index 494b251..13c5086 100644 --- a/external/include/google/protobuf/any.pb.h +++ b/external/include/google/protobuf/any.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 3017000 +#if PROTOBUF_VERSION < 3018000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -59,7 +59,7 @@ struct AnyDefaultTypeInternal; PROTOBUF_EXPORT extern AnyDefaultTypeInternal _Any_default_instance_; PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Any* Arena::CreateMaybeMessage(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Any* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Any>(Arena*); PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN @@ -84,7 +84,11 @@ class PROTOBUF_EXPORT Any final : } inline Any& operator=(Any&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -114,11 +118,11 @@ class PROTOBUF_EXPORT Any final : // implements Any ----------------------------------------------- bool PackFrom(const ::PROTOBUF_NAMESPACE_ID::Message& message) { - return _any_metadata_.PackFrom(message); + return _any_metadata_.PackFrom(GetArena(), message); } bool PackFrom(const ::PROTOBUF_NAMESPACE_ID::Message& message, ::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url_prefix) { - return _any_metadata_.PackFrom(message, type_url_prefix); + return _any_metadata_.PackFrom(GetArena(), message, type_url_prefix); } bool UnpackTo(::PROTOBUF_NAMESPACE_ID::Message* message) const { return _any_metadata_.UnpackTo(message); @@ -129,12 +133,12 @@ class PROTOBUF_EXPORT Any final : const ::PROTOBUF_NAMESPACE_ID::FieldDescriptor** value_field); template ::value>::type> bool PackFrom(const T& message) { - return _any_metadata_.PackFrom(message); + return _any_metadata_.PackFrom(GetArena(), message); } template ::value>::type> bool PackFrom(const T& message, ::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url_prefix) { - return _any_metadata_.PackFrom(message, type_url_prefix);} + return _any_metadata_.PackFrom(GetArena(), message, type_url_prefix);} template ::value>::type> bool UnpackTo(T* message) const { return _any_metadata_.UnpackTo(message); @@ -175,7 +179,7 @@ class PROTOBUF_EXPORT Any final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Any& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; diff --git a/external/include/google/protobuf/api.pb.h b/external/include/google/protobuf/api.pb.h index 67e9d84..347a9f9 100644 --- a/external/include/google/protobuf/api.pb.h +++ b/external/include/google/protobuf/api.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 3017000 +#if PROTOBUF_VERSION < 3018000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -67,9 +67,9 @@ struct MixinDefaultTypeInternal; PROTOBUF_EXPORT extern MixinDefaultTypeInternal _Mixin_default_instance_; PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Api* Arena::CreateMaybeMessage(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Method* Arena::CreateMaybeMessage(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Mixin* Arena::CreateMaybeMessage(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Api* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Api>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Method* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Method>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Mixin* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Mixin>(Arena*); PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN @@ -94,7 +94,11 @@ class PROTOBUF_EXPORT Api final : } inline Api& operator=(Api&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -152,7 +156,7 @@ class PROTOBUF_EXPORT Api final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Api& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -204,16 +208,16 @@ class PROTOBUF_EXPORT Api final : int _internal_methods_size() const; public: void clear_methods(); - PROTOBUF_NAMESPACE_ID::Method* mutable_methods(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method >* + ::PROTOBUF_NAMESPACE_ID::Method* mutable_methods(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method >* mutable_methods(); private: - const PROTOBUF_NAMESPACE_ID::Method& _internal_methods(int index) const; - PROTOBUF_NAMESPACE_ID::Method* _internal_add_methods(); + const ::PROTOBUF_NAMESPACE_ID::Method& _internal_methods(int index) const; + ::PROTOBUF_NAMESPACE_ID::Method* _internal_add_methods(); public: - const PROTOBUF_NAMESPACE_ID::Method& methods(int index) const; - PROTOBUF_NAMESPACE_ID::Method* add_methods(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method >& + const ::PROTOBUF_NAMESPACE_ID::Method& methods(int index) const; + ::PROTOBUF_NAMESPACE_ID::Method* add_methods(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method >& methods() const; // repeated .google.protobuf.Option options = 3; @@ -222,16 +226,16 @@ class PROTOBUF_EXPORT Api final : int _internal_options_size() const; public: void clear_options(); - PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* + ::PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* mutable_options(); private: - const PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); + const ::PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); public: - const PROTOBUF_NAMESPACE_ID::Option& options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* add_options(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& + const ::PROTOBUF_NAMESPACE_ID::Option& options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* add_options(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& options() const; // repeated .google.protobuf.Mixin mixins = 6; @@ -240,16 +244,16 @@ class PROTOBUF_EXPORT Api final : int _internal_mixins_size() const; public: void clear_mixins(); - PROTOBUF_NAMESPACE_ID::Mixin* mutable_mixins(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin >* + ::PROTOBUF_NAMESPACE_ID::Mixin* mutable_mixins(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin >* mutable_mixins(); private: - const PROTOBUF_NAMESPACE_ID::Mixin& _internal_mixins(int index) const; - PROTOBUF_NAMESPACE_ID::Mixin* _internal_add_mixins(); + const ::PROTOBUF_NAMESPACE_ID::Mixin& _internal_mixins(int index) const; + ::PROTOBUF_NAMESPACE_ID::Mixin* _internal_add_mixins(); public: - const PROTOBUF_NAMESPACE_ID::Mixin& mixins(int index) const; - PROTOBUF_NAMESPACE_ID::Mixin* add_mixins(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin >& + const ::PROTOBUF_NAMESPACE_ID::Mixin& mixins(int index) const; + ::PROTOBUF_NAMESPACE_ID::Mixin* add_mixins(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin >& mixins() const; // string name = 1; @@ -286,25 +290,25 @@ class PROTOBUF_EXPORT Api final : bool _internal_has_source_context() const; public: void clear_source_context(); - const PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context(); - PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context(); - void set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context); + const ::PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context(); + ::PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context(); + void set_allocated_source_context(::PROTOBUF_NAMESPACE_ID::SourceContext* source_context); private: - const PROTOBUF_NAMESPACE_ID::SourceContext& _internal_source_context() const; - PROTOBUF_NAMESPACE_ID::SourceContext* _internal_mutable_source_context(); + const ::PROTOBUF_NAMESPACE_ID::SourceContext& _internal_source_context() const; + ::PROTOBUF_NAMESPACE_ID::SourceContext* _internal_mutable_source_context(); public: void unsafe_arena_set_allocated_source_context( - PROTOBUF_NAMESPACE_ID::SourceContext* source_context); - PROTOBUF_NAMESPACE_ID::SourceContext* unsafe_arena_release_source_context(); + ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context); + ::PROTOBUF_NAMESPACE_ID::SourceContext* unsafe_arena_release_source_context(); // .google.protobuf.Syntax syntax = 7; void clear_syntax(); - PROTOBUF_NAMESPACE_ID::Syntax syntax() const; - void set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + ::PROTOBUF_NAMESPACE_ID::Syntax syntax() const; + void set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value); private: - PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; - void _internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + ::PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; + void _internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value); public: // @@protoc_insertion_point(class_scope:google.protobuf.Api) @@ -314,12 +318,12 @@ class PROTOBUF_EXPORT Api final : template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method > methods_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option > options_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin > mixins_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method > methods_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option > options_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin > mixins_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr version_; - PROTOBUF_NAMESPACE_ID::SourceContext* source_context_; + ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context_; int syntax_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2fapi_2eproto; @@ -345,7 +349,11 @@ class PROTOBUF_EXPORT Method final : } inline Method& operator=(Method&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -403,7 +411,7 @@ class PROTOBUF_EXPORT Method final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Method& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -455,16 +463,16 @@ class PROTOBUF_EXPORT Method final : int _internal_options_size() const; public: void clear_options(); - PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* + ::PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* mutable_options(); private: - const PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); + const ::PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); public: - const PROTOBUF_NAMESPACE_ID::Option& options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* add_options(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& + const ::PROTOBUF_NAMESPACE_ID::Option& options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* add_options(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& options() const; // string name = 1; @@ -529,11 +537,11 @@ class PROTOBUF_EXPORT Method final : // .google.protobuf.Syntax syntax = 7; void clear_syntax(); - PROTOBUF_NAMESPACE_ID::Syntax syntax() const; - void set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + ::PROTOBUF_NAMESPACE_ID::Syntax syntax() const; + void set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value); private: - PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; - void _internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + ::PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; + void _internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value); public: // @@protoc_insertion_point(class_scope:google.protobuf.Method) @@ -543,7 +551,7 @@ class PROTOBUF_EXPORT Method final : template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option > options_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option > options_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr request_type_url_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr response_type_url_; @@ -574,7 +582,11 @@ class PROTOBUF_EXPORT Mixin final : } inline Mixin& operator=(Mixin&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -632,7 +644,7 @@ class PROTOBUF_EXPORT Mixin final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Mixin& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -780,31 +792,31 @@ inline int Api::methods_size() const { inline void Api::clear_methods() { methods_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::Method* Api::mutable_methods(int index) { +inline ::PROTOBUF_NAMESPACE_ID::Method* Api::mutable_methods(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Api.methods) return methods_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method >* Api::mutable_methods() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.methods) return &methods_; } -inline const PROTOBUF_NAMESPACE_ID::Method& Api::_internal_methods(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Method& Api::_internal_methods(int index) const { return methods_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::Method& Api::methods(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Method& Api::methods(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Api.methods) return _internal_methods(index); } -inline PROTOBUF_NAMESPACE_ID::Method* Api::_internal_add_methods() { +inline ::PROTOBUF_NAMESPACE_ID::Method* Api::_internal_add_methods() { return methods_.Add(); } -inline PROTOBUF_NAMESPACE_ID::Method* Api::add_methods() { - PROTOBUF_NAMESPACE_ID::Method* _add = _internal_add_methods(); +inline ::PROTOBUF_NAMESPACE_ID::Method* Api::add_methods() { + ::PROTOBUF_NAMESPACE_ID::Method* _add = _internal_add_methods(); // @@protoc_insertion_point(field_add:google.protobuf.Api.methods) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method >& Api::methods() const { // @@protoc_insertion_point(field_list:google.protobuf.Api.methods) return methods_; @@ -817,31 +829,31 @@ inline int Api::_internal_options_size() const { inline int Api::options_size() const { return _internal_options_size(); } -inline PROTOBUF_NAMESPACE_ID::Option* Api::mutable_options(int index) { +inline ::PROTOBUF_NAMESPACE_ID::Option* Api::mutable_options(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Api.options) return options_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* Api::mutable_options() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.options) return &options_; } -inline const PROTOBUF_NAMESPACE_ID::Option& Api::_internal_options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& Api::_internal_options(int index) const { return options_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::Option& Api::options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& Api::options(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Api.options) return _internal_options(index); } -inline PROTOBUF_NAMESPACE_ID::Option* Api::_internal_add_options() { +inline ::PROTOBUF_NAMESPACE_ID::Option* Api::_internal_add_options() { return options_.Add(); } -inline PROTOBUF_NAMESPACE_ID::Option* Api::add_options() { - PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); +inline ::PROTOBUF_NAMESPACE_ID::Option* Api::add_options() { + ::PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); // @@protoc_insertion_point(field_add:google.protobuf.Api.options) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& Api::options() const { // @@protoc_insertion_point(field_list:google.protobuf.Api.options) return options_; @@ -900,17 +912,17 @@ inline bool Api::_internal_has_source_context() const { inline bool Api::has_source_context() const { return _internal_has_source_context(); } -inline const PROTOBUF_NAMESPACE_ID::SourceContext& Api::_internal_source_context() const { - const PROTOBUF_NAMESPACE_ID::SourceContext* p = source_context_; - return p != nullptr ? *p : reinterpret_cast( - PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::SourceContext& Api::_internal_source_context() const { + const ::PROTOBUF_NAMESPACE_ID::SourceContext* p = source_context_; + return p != nullptr ? *p : reinterpret_cast( + ::PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::SourceContext& Api::source_context() const { +inline const ::PROTOBUF_NAMESPACE_ID::SourceContext& Api::source_context() const { // @@protoc_insertion_point(field_get:google.protobuf.Api.source_context) return _internal_source_context(); } inline void Api::unsafe_arena_set_allocated_source_context( - PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { + ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_); } @@ -922,9 +934,9 @@ inline void Api::unsafe_arena_set_allocated_source_context( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Api.source_context) } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::release_source_context() { +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::release_source_context() { - PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; + ::PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; source_context_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -937,27 +949,27 @@ inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::release_source_context() { #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::unsafe_arena_release_source_context() { +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::unsafe_arena_release_source_context() { // @@protoc_insertion_point(field_release:google.protobuf.Api.source_context) - PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; + ::PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; source_context_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::_internal_mutable_source_context() { +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::_internal_mutable_source_context() { if (source_context_ == nullptr) { - auto* p = CreateMaybeMessage(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::SourceContext>(GetArenaForAllocation()); source_context_ = p; } return source_context_; } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::mutable_source_context() { - PROTOBUF_NAMESPACE_ID::SourceContext* _msg = _internal_mutable_source_context(); +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::mutable_source_context() { + ::PROTOBUF_NAMESPACE_ID::SourceContext* _msg = _internal_mutable_source_context(); // @@protoc_insertion_point(field_mutable:google.protobuf.Api.source_context) return _msg; } -inline void Api::set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { +inline void Api::set_allocated_source_context(::PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_); @@ -989,31 +1001,31 @@ inline int Api::mixins_size() const { inline void Api::clear_mixins() { mixins_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::Mixin* Api::mutable_mixins(int index) { +inline ::PROTOBUF_NAMESPACE_ID::Mixin* Api::mutable_mixins(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Api.mixins) return mixins_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin >* Api::mutable_mixins() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.mixins) return &mixins_; } -inline const PROTOBUF_NAMESPACE_ID::Mixin& Api::_internal_mixins(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Mixin& Api::_internal_mixins(int index) const { return mixins_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::Mixin& Api::mixins(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Mixin& Api::mixins(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Api.mixins) return _internal_mixins(index); } -inline PROTOBUF_NAMESPACE_ID::Mixin* Api::_internal_add_mixins() { +inline ::PROTOBUF_NAMESPACE_ID::Mixin* Api::_internal_add_mixins() { return mixins_.Add(); } -inline PROTOBUF_NAMESPACE_ID::Mixin* Api::add_mixins() { - PROTOBUF_NAMESPACE_ID::Mixin* _add = _internal_add_mixins(); +inline ::PROTOBUF_NAMESPACE_ID::Mixin* Api::add_mixins() { + ::PROTOBUF_NAMESPACE_ID::Mixin* _add = _internal_add_mixins(); // @@protoc_insertion_point(field_add:google.protobuf.Api.mixins) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin >& Api::mixins() const { // @@protoc_insertion_point(field_list:google.protobuf.Api.mixins) return mixins_; @@ -1023,18 +1035,18 @@ Api::mixins() const { inline void Api::clear_syntax() { syntax_ = 0; } -inline PROTOBUF_NAMESPACE_ID::Syntax Api::_internal_syntax() const { - return static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); +inline ::PROTOBUF_NAMESPACE_ID::Syntax Api::_internal_syntax() const { + return static_cast< ::PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); } -inline PROTOBUF_NAMESPACE_ID::Syntax Api::syntax() const { +inline ::PROTOBUF_NAMESPACE_ID::Syntax Api::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Api.syntax) return _internal_syntax(); } -inline void Api::_internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Api::_internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) { syntax_ = value; } -inline void Api::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Api::set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) { _internal_set_syntax(value); // @@protoc_insertion_point(field_set:google.protobuf.Api.syntax) } @@ -1228,31 +1240,31 @@ inline int Method::_internal_options_size() const { inline int Method::options_size() const { return _internal_options_size(); } -inline PROTOBUF_NAMESPACE_ID::Option* Method::mutable_options(int index) { +inline ::PROTOBUF_NAMESPACE_ID::Option* Method::mutable_options(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Method.options) return options_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* Method::mutable_options() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Method.options) return &options_; } -inline const PROTOBUF_NAMESPACE_ID::Option& Method::_internal_options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& Method::_internal_options(int index) const { return options_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::Option& Method::options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& Method::options(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Method.options) return _internal_options(index); } -inline PROTOBUF_NAMESPACE_ID::Option* Method::_internal_add_options() { +inline ::PROTOBUF_NAMESPACE_ID::Option* Method::_internal_add_options() { return options_.Add(); } -inline PROTOBUF_NAMESPACE_ID::Option* Method::add_options() { - PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); +inline ::PROTOBUF_NAMESPACE_ID::Option* Method::add_options() { + ::PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); // @@protoc_insertion_point(field_add:google.protobuf.Method.options) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& Method::options() const { // @@protoc_insertion_point(field_list:google.protobuf.Method.options) return options_; @@ -1262,18 +1274,18 @@ Method::options() const { inline void Method::clear_syntax() { syntax_ = 0; } -inline PROTOBUF_NAMESPACE_ID::Syntax Method::_internal_syntax() const { - return static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); +inline ::PROTOBUF_NAMESPACE_ID::Syntax Method::_internal_syntax() const { + return static_cast< ::PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); } -inline PROTOBUF_NAMESPACE_ID::Syntax Method::syntax() const { +inline ::PROTOBUF_NAMESPACE_ID::Syntax Method::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Method.syntax) return _internal_syntax(); } -inline void Method::_internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Method::_internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) { syntax_ = value; } -inline void Method::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Method::set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) { _internal_set_syntax(value); // @@protoc_insertion_point(field_set:google.protobuf.Method.syntax) } diff --git a/external/include/google/protobuf/arena.h b/external/include/google/protobuf/arena.h index 232cbd4..8b1a6b5 100644 --- a/external/include/google/protobuf/arena.h +++ b/external/include/google/protobuf/arena.h @@ -91,6 +91,7 @@ class ReflectionTester; // defined in test_util.h namespace internal { struct ArenaStringPtr; // defined in arenastring.h +class InlinedStringField; // defined in inlined_string_field.h class LazyField; // defined in lazy_field.h class EpsCopyInputStream; // defined in parse_context.h @@ -298,7 +299,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { // We must delegate to CreateMaybeMessage() and NOT CreateMessageInternal() // because protobuf generated classes specialize CreateMaybeMessage() and we // need to use that specialization for code size reasons. - return Arena::CreateMaybeMessage(arena, std::forward(args)...); + return Arena::CreateMaybeMessage(arena, static_cast(args)...); } // API to create any objects on the arena. Note that only the object will @@ -319,7 +320,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { template PROTOBUF_NDEBUG_INLINE static T* Create(Arena* arena, Args&&... args) { return CreateInternal(arena, std::is_convertible(), - std::forward(args)...); + static_cast(args)...); } // Create an array of object type T on the arena *without* invoking the @@ -350,19 +351,19 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { // policies. Do not use these in unit tests. // Returns the total space allocated by the arena, which is the sum of the // sizes of the underlying blocks. - uint64 SpaceAllocated() const { return impl_.SpaceAllocated(); } + uint64_t SpaceAllocated() const { return impl_.SpaceAllocated(); } // Returns the total space used by the arena. Similar to SpaceAllocated but // does not include free space and block overhead. The total space returned // may not include space used by other threads executing concurrently with // the call to this method. - uint64 SpaceUsed() const { return impl_.SpaceUsed(); } + uint64_t SpaceUsed() const { return impl_.SpaceUsed(); } // Frees all storage allocated by this arena after calling destructors // registered with OwnDestructor() and freeing objects registered with Own(). // 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. - uint64 Reset() { return impl_.Reset(); } + uint64_t Reset() { return impl_.Reset(); } // Adds |object| to a list of heap-allocated objects to be freed with |delete| // when the arena is destroyed or reset. @@ -442,7 +443,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { } static Arena* GetArenaForAllocationForNonMessageNonArenaConstructible( - const T* p, std::false_type /*has_get_arena*/) { + const T* /* p */, std::false_type /*has_get_arena*/) { return nullptr; } @@ -483,7 +484,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { template static T* Construct(void* ptr, Args&&... args) { - return new (ptr) T(std::forward(args)...); + return new (ptr) T(static_cast(args)...); } static T* New() { @@ -527,9 +528,9 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { InternalHelper::is_arena_constructable::value, "CreateMessage can only construct types that are ArenaConstructable"); if (arena == NULL) { - return new T(nullptr, std::forward(args)...); + return new T(nullptr, static_cast(args)...); } else { - return arena->DoCreateMessage(std::forward(args)...); + return arena->DoCreateMessage(static_cast(args)...); } } @@ -632,9 +633,11 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { CreateInArenaStorageInternal(ptr, arena, typename is_arena_constructable::type(), std::forward(args)...); - RegisterDestructorInternal( - ptr, arena, - typename InternalHelper::is_destructor_skippable::type()); + if (arena != nullptr) { + RegisterDestructorInternal( + ptr, arena, + typename InternalHelper::is_destructor_skippable::type()); + } } template @@ -788,6 +791,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { template friend class internal::GenericTypeHandler; friend struct internal::ArenaStringPtr; // For AllocateAligned. + friend class internal::InlinedStringField; // For AllocateAligned. friend class internal::LazyField; // For CreateMaybeMessage. friend class internal::EpsCopyInputStream; // For parser performance friend class MessageLite; diff --git a/external/include/google/protobuf/arena_impl.h b/external/include/google/protobuf/arena_impl.h index 40608df..b47bad7 100644 --- a/external/include/google/protobuf/arena_impl.h +++ b/external/include/google/protobuf/arena_impl.h @@ -66,11 +66,11 @@ class PROTOBUF_EXPORT ArenaMetricsCollector { // Invoked when the arena is about to be destroyed. This method will // typically finalize any metric collection and delete the collector. // space_allocated is the space used by the arena. - virtual void OnDestroy(uint64 space_allocated) = 0; + virtual void OnDestroy(uint64_t space_allocated) = 0; // OnReset() is called when the associated arena is reset. // space_allocated is the space used by the arena just before the reset. - virtual void OnReset(uint64 space_allocated) = 0; + virtual void OnReset(uint64_t space_allocated) = 0; // OnAlloc is called when an allocation happens. // type_info is promised to be static - its lifetime extends to @@ -79,7 +79,7 @@ class PROTOBUF_EXPORT ArenaMetricsCollector { // intentionally want to avoid monitoring an allocation. (i.e. internal // allocations for managing the arena) virtual void OnAlloc(const std::type_info* allocated_type, - uint64 alloc_size) = 0; + uint64_t alloc_size) = 0; // Does OnAlloc() need to be called? If false, metric collection overhead // will be reduced since we will not do extra work per allocation. @@ -141,10 +141,10 @@ class PROTOBUF_EXPORT SerialArena { Memory Free(Deallocator deallocator); void CleanupList(); - uint64 SpaceAllocated() const { + uint64_t SpaceAllocated() const { return space_allocated_.load(std::memory_order_relaxed); } - uint64 SpaceUsed() const; + uint64_t SpaceUsed() const; bool HasSpace(size_t n) { return n <= static_cast(limit_ - ptr_); } @@ -154,6 +154,11 @@ class PROTOBUF_EXPORT SerialArena { if (PROTOBUF_PREDICT_FALSE(!HasSpace(n))) { return AllocateAlignedFallback(n, policy); } + return AllocateFromExisting(n); + } + + private: + void* AllocateFromExisting(size_t n) { void* ret = ptr_; ptr_ += n; #ifdef ADDRESS_SANITIZER @@ -162,17 +167,13 @@ class PROTOBUF_EXPORT SerialArena { return ret; } + public: // Allocate space if the current region provides enough space. bool MaybeAllocateAligned(size_t n, void** out) { GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned. GOOGLE_DCHECK_GE(limit_, ptr_); if (PROTOBUF_PREDICT_FALSE(!HasSpace(n))) return false; - void* ret = ptr_; - ptr_ += n; -#ifdef ADDRESS_SANITIZER - ASAN_UNPOISON_MEMORY_REGION(ret, n); -#endif // ADDRESS_SANITIZER - *out = ret; + *out = AllocateFromExisting(n); return true; } @@ -181,6 +182,12 @@ class PROTOBUF_EXPORT SerialArena { if (PROTOBUF_PREDICT_FALSE(!HasSpace(n + kCleanupSize))) { return AllocateAlignedWithCleanupFallback(n, policy); } + return AllocateFromExistingWithCleanupFallback(n); + } + + private: + std::pair AllocateFromExistingWithCleanupFallback( + size_t n) { void* ret = ptr_; ptr_ += n; limit_ -= kCleanupSize; @@ -191,6 +198,7 @@ class PROTOBUF_EXPORT SerialArena { return CreatePair(ret, reinterpret_cast(limit_)); } + public: void AddCleanup(void* elem, void (*cleanup)(void*), const AllocationPolicy* policy) { auto res = AllocateAlignedWithCleanup(0, policy); @@ -206,13 +214,15 @@ class PROTOBUF_EXPORT SerialArena { // Blocks are variable length malloc-ed objects. The following structure // describes the common header for all blocks. struct Block { + Block(Block* next, size_t size) : next(next), size(size), start(nullptr) {} + char* Pointer(size_t n) { GOOGLE_DCHECK(n <= size); return reinterpret_cast(this) + n; } - Block* next; - size_t size; + Block* const next; + const size_t size; CleanupNode* start; // data follows }; @@ -277,10 +287,10 @@ class PROTOBUF_EXPORT ThreadSafeArena { // if it was passed in. ~ThreadSafeArena(); - uint64 Reset(); + uint64_t Reset(); - uint64 SpaceAllocated() const; - uint64 SpaceUsed() const; + uint64_t SpaceAllocated() const; + uint64_t SpaceUsed() const; void* AllocateAligned(size_t n, const std::type_info* type) { SerialArena* arena; @@ -312,7 +322,7 @@ class PROTOBUF_EXPORT ThreadSafeArena { private: // Unique for each arena. Changes on Reset(). - uint64 tag_and_id_; + uint64_t tag_and_id_; // The LSB of tag_and_id_ indicates if allocs in this arena are recorded. enum { kRecordAllocs = 1 }; @@ -343,7 +353,7 @@ class PROTOBUF_EXPORT ThreadSafeArena { inline bool ShouldRecordAlloc() const { return tag_and_id_ & kRecordAllocs; } - inline uint64 LifeCycleId() const { + inline uint64_t LifeCycleId() const { return tag_and_id_ & (-kRecordAllocs - 1); } @@ -362,7 +372,7 @@ class PROTOBUF_EXPORT ThreadSafeArena { hint_.store(serial, std::memory_order_release); } - PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFast(uint64 lifecycle_id, + PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFast(uint64_t lifecycle_id, SerialArena** arena) { if (GetSerialArenaFromThreadCache(lifecycle_id, arena)) return true; if (lifecycle_id & kRecordAllocs) return false; @@ -379,7 +389,7 @@ class PROTOBUF_EXPORT ThreadSafeArena { } PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFromThreadCache( - uint64 lifecycle_id, SerialArena** arena) { + uint64_t lifecycle_id, SerialArena** arena) { // If this thread already owns a block in this arena then try to use that. // This fast path optimizes the case where multiple threads allocate from // the same arena. @@ -427,10 +437,10 @@ class PROTOBUF_EXPORT ThreadSafeArena { static constexpr size_t kPerThreadIds = 256; // Next lifecycle ID available to this thread. We need to reserve a new // batch, if `next_lifecycle_id & (kPerThreadIds - 1) == 0`. - uint64 next_lifecycle_id; + uint64_t next_lifecycle_id; // The ThreadCache is considered valid as long as this matches the // lifecycle_id of the arena being used. - uint64 last_lifecycle_id_seen; + uint64_t last_lifecycle_id_seen; SerialArena* last_serial_arena; }; diff --git a/external/include/google/protobuf/arenastring.h b/external/include/google/protobuf/arenastring.h index 1fafa69..2477369 100644 --- a/external/include/google/protobuf/arenastring.h +++ b/external/include/google/protobuf/arenastring.h @@ -352,12 +352,15 @@ inline void ArenaStringPtr::UnsafeSetDefault(const std::string* value) { tagged_ptr_.Set(const_cast(value)); } +// Make sure rhs_arena allocated rhs, and lhs_arena allocated lhs. inline PROTOBUF_NDEBUG_INLINE void ArenaStringPtr::InternalSwap( // const std::string* default_value, // ArenaStringPtr* rhs, Arena* rhs_arena, // ArenaStringPtr* lhs, Arena* lhs_arena) { + // Silence unused variable warnings in release buildls. (void)default_value; - std::swap(lhs_arena, rhs_arena); + (void)rhs_arena; + (void)lhs_arena; std::swap(lhs->tagged_ptr_, rhs->tagged_ptr_); #ifdef PROTOBUF_FORCE_COPY_IN_SWAP auto force_realloc = [default_value](ArenaStringPtr* p, Arena* arena) { @@ -370,8 +373,10 @@ inline PROTOBUF_NDEBUG_INLINE void ArenaStringPtr::InternalSwap( // if (arena == nullptr) delete old_value; p->tagged_ptr_.Set(new_value); }; - force_realloc(lhs, lhs_arena); - force_realloc(rhs, rhs_arena); + // Because, at this point, tagged_ptr_ has been swapped, arena should also be + // swapped. + force_realloc(lhs, rhs_arena); + force_realloc(rhs, lhs_arena); #endif // PROTOBUF_FORCE_COPY_IN_SWAP } diff --git a/external/include/google/protobuf/compiler/code_generator.h b/external/include/google/protobuf/compiler/code_generator.h index c8d9e49..2cbda27 100644 --- a/external/include/google/protobuf/compiler/code_generator.h +++ b/external/include/google/protobuf/compiler/code_generator.h @@ -103,14 +103,15 @@ class PROTOC_EXPORT CodeGenerator { GeneratorContext* generator_context, std::string* error) const; - // Sync with plugin.proto. + // This must be kept in sync with plugin.proto. See that file for + // documentation on each value. enum Feature { FEATURE_PROTO3_OPTIONAL = 1, }; // Implement this to indicate what features this code generator supports. - // This should be a bitwise OR of features from the Features enum in - // plugin.proto. + // + // This must be a bitwise OR of values from the Feature enum above (or zero). virtual uint64_t GetSupportedFeatures() const { return 0; } // This is no longer used, but this class is part of the opensource protobuf diff --git a/external/include/google/protobuf/compiler/js/js_generator.h b/external/include/google/protobuf/compiler/js/js_generator.h index e452020..cd9631a 100644 --- a/external/include/google/protobuf/compiler/js/js_generator.h +++ b/external/include/google/protobuf/compiler/js/js_generator.h @@ -83,7 +83,6 @@ struct GeneratorOptions { add_require_for_enums(false), testonly(false), library(""), - error_on_name_conflict(false), extension(".js"), one_output_file_per_input_file(false), annotate_code(false) {} @@ -119,8 +118,6 @@ struct GeneratorOptions { // Create a library with name _lib.js rather than a separate .js file // per type? std::string library; - // Error if there are two types that would generate the same output file? - bool error_on_name_conflict; // The extension to use for output file names. std::string extension; // Create a separate output file for each input file? diff --git a/external/include/google/protobuf/compiler/objectivec/objectivec_helpers.h b/external/include/google/protobuf/compiler/objectivec/objectivec_helpers.h index dd42269..02615e0 100644 --- a/external/include/google/protobuf/compiler/objectivec/objectivec_helpers.h +++ b/external/include/google/protobuf/compiler/objectivec/objectivec_helpers.h @@ -46,6 +46,19 @@ namespace protobuf { namespace compiler { namespace objectivec { +// Get/Set if the proto package should be used to make the default prefix for +// symbols. This will then impact most of the type naming apis below. It is done +// as a global to not break any other generator reusing the methods since they +// are exported. +bool PROTOC_EXPORT UseProtoPackageAsDefaultPrefix(); +void PROTOC_EXPORT SetUseProtoPackageAsDefaultPrefix(bool on_or_off); +// Get/Set the path to a file to load as exceptions when +// `UseProtoPackageAsDefaultPrefixUseProtoPackageAsDefaultPrefix()` is `true`. +// And empty string means there should be no exceptions loaded. +std::string PROTOC_EXPORT GetProtoPackagePrefixExceptionList(); +void PROTOC_EXPORT SetProtoPackagePrefixExceptionList( + const std::string& file_path); + // Generator options (see objectivec_generator.cc for a description of each): struct Options { Options(); @@ -70,7 +83,7 @@ bool PROTOC_EXPORT IsRetainedName(const std::string& name); // handling under ARC. bool PROTOC_EXPORT IsInitName(const std::string& name); -// Gets the objc_class_prefix. +// Gets the objc_class_prefix or the prefix made from the proto package. std::string PROTOC_EXPORT FileClassPrefix(const FileDescriptor* file); // Gets the path of the file we're going to generate (sans the .pb.h @@ -90,7 +103,7 @@ std::string PROTOC_EXPORT FileClassName(const FileDescriptor* file); // descriptor. std::string PROTOC_EXPORT ClassName(const Descriptor* descriptor); std::string PROTOC_EXPORT ClassName(const Descriptor* descriptor, - std::string* out_suffix_added); + std::string* out_suffix_added); std::string PROTOC_EXPORT EnumName(const EnumDescriptor* descriptor); // Returns the fully-qualified name of the enum value corresponding to the @@ -296,7 +309,7 @@ class PROTOC_EXPORT ImportWriter { ProtoFrameworkCollector(std::map* inout_proto_file_to_framework_name) : map_(inout_proto_file_to_framework_name) {} - virtual bool ConsumeLine(const StringPiece& line, std::string* out_error); + virtual bool ConsumeLine(const StringPiece& line, std::string* out_error) override; private: std::map* map_; diff --git a/external/include/google/protobuf/compiler/plugin.h b/external/include/google/protobuf/compiler/plugin.h index de581c1..7d1bf45 100644 --- a/external/include/google/protobuf/compiler/plugin.h +++ b/external/include/google/protobuf/compiler/plugin.h @@ -78,6 +78,7 @@ class CodeGeneratorResponse; PROTOC_EXPORT int PluginMain(int argc, char* argv[], const CodeGenerator* generator); + // Generates code using the given code generator. Returns true if the code // generation is successful. If the code generation fails, error_msg may be // populated to describe the failure cause. diff --git a/external/include/google/protobuf/compiler/plugin.pb.h b/external/include/google/protobuf/compiler/plugin.pb.h index e1ede97..baa72a2 100644 --- a/external/include/google/protobuf/compiler/plugin.pb.h +++ b/external/include/google/protobuf/compiler/plugin.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 3017000 +#if PROTOBUF_VERSION < 3018000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -78,10 +78,10 @@ PROTOC_EXPORT extern VersionDefaultTypeInternal _Version_default_instance_; } // namespace compiler PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOC_EXPORT PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest* Arena::CreateMaybeMessage(Arena*); -template<> PROTOC_EXPORT PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse* Arena::CreateMaybeMessage(Arena*); -template<> PROTOC_EXPORT PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* Arena::CreateMaybeMessage(Arena*); -template<> PROTOC_EXPORT PROTOBUF_NAMESPACE_ID::compiler::Version* Arena::CreateMaybeMessage(Arena*); +template<> PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest>(Arena*); +template<> PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse>(Arena*); +template<> PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File>(Arena*); +template<> PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::compiler::Version* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::compiler::Version>(Arena*); PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN namespace compiler { @@ -130,7 +130,11 @@ class PROTOC_EXPORT Version final : } inline Version& operator=(Version&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -195,7 +199,7 @@ class PROTOC_EXPORT Version final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Version& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -331,7 +335,11 @@ class PROTOC_EXPORT CodeGeneratorRequest final : } inline CodeGeneratorRequest& operator=(CodeGeneratorRequest&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -396,7 +404,7 @@ class PROTOC_EXPORT CodeGeneratorRequest final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const CodeGeneratorRequest& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -469,16 +477,16 @@ class PROTOC_EXPORT CodeGeneratorRequest final : int _internal_proto_file_size() const; public: void clear_proto_file(); - PROTOBUF_NAMESPACE_ID::FileDescriptorProto* mutable_proto_file(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* + ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* mutable_proto_file(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* mutable_proto_file(); private: - const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& _internal_proto_file(int index) const; - PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _internal_add_proto_file(); + const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& _internal_proto_file(int index) const; + ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _internal_add_proto_file(); public: - const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& proto_file(int index) const; - PROTOBUF_NAMESPACE_ID::FileDescriptorProto* add_proto_file(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& + const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& proto_file(int index) const; + ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* add_proto_file(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& proto_file() const; // optional string parameter = 2; @@ -505,17 +513,17 @@ class PROTOC_EXPORT CodeGeneratorRequest final : bool _internal_has_compiler_version() const; public: void clear_compiler_version(); - const PROTOBUF_NAMESPACE_ID::compiler::Version& compiler_version() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::compiler::Version* release_compiler_version(); - PROTOBUF_NAMESPACE_ID::compiler::Version* mutable_compiler_version(); - void set_allocated_compiler_version(PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version); + const ::PROTOBUF_NAMESPACE_ID::compiler::Version& compiler_version() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::compiler::Version* release_compiler_version(); + ::PROTOBUF_NAMESPACE_ID::compiler::Version* mutable_compiler_version(); + void set_allocated_compiler_version(::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version); private: - const PROTOBUF_NAMESPACE_ID::compiler::Version& _internal_compiler_version() const; - PROTOBUF_NAMESPACE_ID::compiler::Version* _internal_mutable_compiler_version(); + const ::PROTOBUF_NAMESPACE_ID::compiler::Version& _internal_compiler_version() const; + ::PROTOBUF_NAMESPACE_ID::compiler::Version* _internal_mutable_compiler_version(); public: void unsafe_arena_set_allocated_compiler_version( - PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version); - PROTOBUF_NAMESPACE_ID::compiler::Version* unsafe_arena_release_compiler_version(); + ::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version); + ::PROTOBUF_NAMESPACE_ID::compiler::Version* unsafe_arena_release_compiler_version(); // @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorRequest) private: @@ -527,9 +535,9 @@ class PROTOC_EXPORT CodeGeneratorRequest final : ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField file_to_generate_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto > proto_file_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto > proto_file_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr parameter_; - PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version_; + ::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version_; friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; }; // ------------------------------------------------------------------- @@ -553,7 +561,11 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : } inline CodeGeneratorResponse_File& operator=(CodeGeneratorResponse_File&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -618,7 +630,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const CodeGeneratorResponse_File& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -721,17 +733,17 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : bool _internal_has_generated_code_info() const; public: void clear_generated_code_info(); - const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& generated_code_info() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* release_generated_code_info(); - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* mutable_generated_code_info(); - void set_allocated_generated_code_info(PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info); + const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& generated_code_info() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* release_generated_code_info(); + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* mutable_generated_code_info(); + void set_allocated_generated_code_info(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info); private: - const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& _internal_generated_code_info() const; - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* _internal_mutable_generated_code_info(); + const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& _internal_generated_code_info() const; + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* _internal_mutable_generated_code_info(); public: void unsafe_arena_set_allocated_generated_code_info( - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info); - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* unsafe_arena_release_generated_code_info(); + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info); + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* unsafe_arena_release_generated_code_info(); // @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse.File) private: @@ -745,7 +757,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr insertion_point_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr content_; - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info_; + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info_; friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; }; // ------------------------------------------------------------------- @@ -769,7 +781,11 @@ class PROTOC_EXPORT CodeGeneratorResponse final : } inline CodeGeneratorResponse& operator=(CodeGeneratorResponse&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -834,7 +850,7 @@ class PROTOC_EXPORT CodeGeneratorResponse final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const CodeGeneratorResponse& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -914,16 +930,16 @@ class PROTOC_EXPORT CodeGeneratorResponse final : int _internal_file_size() const; public: void clear_file(); - PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* mutable_file(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >* + ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* mutable_file(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >* mutable_file(); private: - const PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& _internal_file(int index) const; - PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* _internal_add_file(); + const ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& _internal_file(int index) const; + ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* _internal_add_file(); public: - const PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& file(int index) const; - PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* add_file(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >& + const ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& file(int index) const; + ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* add_file(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >& file() const; // optional string error = 1; @@ -966,7 +982,7 @@ class PROTOC_EXPORT CodeGeneratorResponse final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File > file_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File > file_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr error_; ::PROTOBUF_NAMESPACE_ID::uint64 supported_features_; friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; @@ -1268,31 +1284,31 @@ inline int CodeGeneratorRequest::_internal_proto_file_size() const { inline int CodeGeneratorRequest::proto_file_size() const { return _internal_proto_file_size(); } -inline PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::mutable_proto_file(int index) { +inline ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::mutable_proto_file(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return proto_file_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* CodeGeneratorRequest::mutable_proto_file() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return &proto_file_; } -inline const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& CodeGeneratorRequest::_internal_proto_file(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& CodeGeneratorRequest::_internal_proto_file(int index) const { return proto_file_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& CodeGeneratorRequest::proto_file(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& CodeGeneratorRequest::proto_file(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return _internal_proto_file(index); } -inline PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::_internal_add_proto_file() { +inline ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::_internal_add_proto_file() { return proto_file_.Add(); } -inline PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() { - PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _add = _internal_add_proto_file(); +inline ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() { + ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _add = _internal_add_proto_file(); // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& CodeGeneratorRequest::proto_file() const { // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return proto_file_; @@ -1311,17 +1327,17 @@ inline void CodeGeneratorRequest::clear_compiler_version() { if (compiler_version_ != nullptr) compiler_version_->Clear(); _has_bits_[0] &= ~0x00000002u; } -inline const PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::_internal_compiler_version() const { - const PROTOBUF_NAMESPACE_ID::compiler::Version* p = compiler_version_; - return p != nullptr ? *p : reinterpret_cast( - PROTOBUF_NAMESPACE_ID::compiler::_Version_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::_internal_compiler_version() const { + const ::PROTOBUF_NAMESPACE_ID::compiler::Version* p = compiler_version_; + return p != nullptr ? *p : reinterpret_cast( + ::PROTOBUF_NAMESPACE_ID::compiler::_Version_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::compiler_version() const { +inline const ::PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::compiler_version() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) return _internal_compiler_version(); } inline void CodeGeneratorRequest::unsafe_arena_set_allocated_compiler_version( - PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version) { + ::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(compiler_version_); } @@ -1333,9 +1349,9 @@ inline void CodeGeneratorRequest::unsafe_arena_set_allocated_compiler_version( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) } -inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::release_compiler_version() { +inline ::PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::release_compiler_version() { _has_bits_[0] &= ~0x00000002u; - PROTOBUF_NAMESPACE_ID::compiler::Version* temp = compiler_version_; + ::PROTOBUF_NAMESPACE_ID::compiler::Version* temp = compiler_version_; compiler_version_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -1348,34 +1364,34 @@ inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::release_c #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::unsafe_arena_release_compiler_version() { +inline ::PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::unsafe_arena_release_compiler_version() { // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) _has_bits_[0] &= ~0x00000002u; - PROTOBUF_NAMESPACE_ID::compiler::Version* temp = compiler_version_; + ::PROTOBUF_NAMESPACE_ID::compiler::Version* temp = compiler_version_; compiler_version_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::_internal_mutable_compiler_version() { +inline ::PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::_internal_mutable_compiler_version() { _has_bits_[0] |= 0x00000002u; if (compiler_version_ == nullptr) { - auto* p = CreateMaybeMessage(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::compiler::Version>(GetArenaForAllocation()); compiler_version_ = p; } return compiler_version_; } -inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::mutable_compiler_version() { - PROTOBUF_NAMESPACE_ID::compiler::Version* _msg = _internal_mutable_compiler_version(); +inline ::PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::mutable_compiler_version() { + ::PROTOBUF_NAMESPACE_ID::compiler::Version* _msg = _internal_mutable_compiler_version(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) return _msg; } -inline void CodeGeneratorRequest::set_allocated_compiler_version(PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version) { +inline void CodeGeneratorRequest::set_allocated_compiler_version(::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete compiler_version_; } if (compiler_version) { ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper::GetOwningArena(compiler_version); + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::compiler::Version>::GetOwningArena(compiler_version); if (message_arena != submessage_arena) { compiler_version = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, compiler_version, submessage_arena); @@ -1575,17 +1591,17 @@ inline bool CodeGeneratorResponse_File::_internal_has_generated_code_info() cons inline bool CodeGeneratorResponse_File::has_generated_code_info() const { return _internal_has_generated_code_info(); } -inline const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& CodeGeneratorResponse_File::_internal_generated_code_info() const { - const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* p = generated_code_info_; - return p != nullptr ? *p : reinterpret_cast( - PROTOBUF_NAMESPACE_ID::_GeneratedCodeInfo_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& CodeGeneratorResponse_File::_internal_generated_code_info() const { + const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* p = generated_code_info_; + return p != nullptr ? *p : reinterpret_cast( + ::PROTOBUF_NAMESPACE_ID::_GeneratedCodeInfo_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& CodeGeneratorResponse_File::generated_code_info() const { +inline const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& CodeGeneratorResponse_File::generated_code_info() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) return _internal_generated_code_info(); } inline void CodeGeneratorResponse_File::unsafe_arena_set_allocated_generated_code_info( - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info) { + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(generated_code_info_); } @@ -1597,9 +1613,9 @@ inline void CodeGeneratorResponse_File::unsafe_arena_set_allocated_generated_cod } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) } -inline PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::release_generated_code_info() { +inline ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::release_generated_code_info() { _has_bits_[0] &= ~0x00000008u; - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* temp = generated_code_info_; + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* temp = generated_code_info_; generated_code_info_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -1612,27 +1628,27 @@ inline PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::rel #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::unsafe_arena_release_generated_code_info() { +inline ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::unsafe_arena_release_generated_code_info() { // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) _has_bits_[0] &= ~0x00000008u; - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* temp = generated_code_info_; + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* temp = generated_code_info_; generated_code_info_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::_internal_mutable_generated_code_info() { +inline ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::_internal_mutable_generated_code_info() { _has_bits_[0] |= 0x00000008u; if (generated_code_info_ == nullptr) { - auto* p = CreateMaybeMessage(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo>(GetArenaForAllocation()); generated_code_info_ = p; } return generated_code_info_; } -inline PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::mutable_generated_code_info() { - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* _msg = _internal_mutable_generated_code_info(); +inline ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::mutable_generated_code_info() { + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* _msg = _internal_mutable_generated_code_info(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) return _msg; } -inline void CodeGeneratorResponse_File::set_allocated_generated_code_info(PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info) { +inline void CodeGeneratorResponse_File::set_allocated_generated_code_info(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(generated_code_info_); @@ -1754,31 +1770,31 @@ inline int CodeGeneratorResponse::file_size() const { inline void CodeGeneratorResponse::clear_file() { file_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::mutable_file(int index) { +inline ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::mutable_file(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.file) return file_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >* CodeGeneratorResponse::mutable_file() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorResponse.file) return &file_; } -inline const PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::_internal_file(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::_internal_file(int index) const { return file_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::file(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::file(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.file) return _internal_file(index); } -inline PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::_internal_add_file() { +inline ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::_internal_add_file() { return file_.Add(); } -inline PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() { - PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* _add = _internal_add_file(); +inline ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() { + ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* _add = _internal_add_file(); // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorResponse.file) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >& CodeGeneratorResponse::file() const { // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorResponse.file) return file_; @@ -1801,10 +1817,10 @@ PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template <> struct is_proto_enum< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature> : ::std::true_type {}; +template <> struct is_proto_enum< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature> : ::std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature>() { - return PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature_descriptor(); +inline const EnumDescriptor* GetEnumDescriptor< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature>() { + return ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature_descriptor(); } PROTOBUF_NAMESPACE_CLOSE diff --git a/external/include/google/protobuf/descriptor.h b/external/include/google/protobuf/descriptor.h index 0625b50..67c3f69 100644 --- a/external/include/google/protobuf/descriptor.h +++ b/external/include/google/protobuf/descriptor.h @@ -62,6 +62,7 @@ #include #include +#include #include #include #include @@ -121,7 +122,7 @@ class Reflection; // Defined in descriptor.cc class DescriptorBuilder; class FileDescriptorTables; -struct Symbol; +class Symbol; // Defined in unknown_field_set.h. class UnknownField; @@ -182,15 +183,37 @@ struct DebugStringOptions { // which is needed when a pool has lazily_build_dependencies_ set. // Must be instantiated as mutable in a descriptor. namespace internal { + +// Data required to do lazy initialization. +struct PROTOBUF_EXPORT LazyInitData { +#ifndef SWIG + internal::once_flag once; +#endif + struct Field { + const std::string* type_name; + const std::string* default_value_enum_name; + }; + struct Descriptor { + const std::string* name; + const FileDescriptor* file; + }; + struct File { + const std::string** dependencies_names; + }; + union { + Field field; + Descriptor descriptor; + File file; + }; +}; + class PROTOBUF_EXPORT LazyDescriptor { public: // Init function to be called at init time of a descriptor containing // a LazyDescriptor. void Init() { descriptor_ = nullptr; - name_ = nullptr; once_ = nullptr; - file_ = nullptr; } // Sets the value of the descriptor if it is known during the descriptor @@ -220,10 +243,22 @@ class PROTOBUF_EXPORT LazyDescriptor { void Once(); const Descriptor* descriptor_; - const std::string* name_; - internal::once_flag* once_; - const FileDescriptor* file_; + LazyInitData* once_; }; + +class PROTOBUF_EXPORT SymbolBase { + private: + friend class google::protobuf::Symbol; + uint8_t symbol_type_; +}; + +// Some types have more than one SymbolBase because they have multiple +// identities in the table. We can't have duplicate direct bases, so we use this +// intermediate base to do so. +// See BuildEnumValue for details. +template +class PROTOBUF_EXPORT SymbolBaseN : public SymbolBase {}; + } // namespace internal // Describes a type of protocol message, or a particular group within a @@ -231,7 +266,7 @@ class PROTOBUF_EXPORT LazyDescriptor { // Message::GetDescriptor(). Generated message classes also have a // static method called descriptor() which returns the type's descriptor. // Use DescriptorPool to construct your own descriptors. -class PROTOBUF_EXPORT Descriptor { +class PROTOBUF_EXPORT Descriptor : private internal::SymbolBase { public: typedef DescriptorProto Proto; @@ -500,6 +535,7 @@ class PROTOBUF_EXPORT Descriptor { const FieldDescriptor* map_value() const; private: + friend class Symbol; typedef MessageOptions OptionsType; // Allows tests to test CopyTo(proto, true). @@ -524,8 +560,16 @@ class PROTOBUF_EXPORT Descriptor { // to this descriptor from the file root. void GetLocationPath(std::vector* output) const; - const std::string* name_; - const std::string* full_name_; + // True if this is a placeholder for an unknown type. + bool is_placeholder_ : 1; + // True if this is a placeholder and the type name wasn't fully-qualified. + bool is_unqualified_placeholder_ : 1; + // Well known type. Stored as char to conserve space. + char well_known_type_; + int field_count_; + + // all_names_ = [name, full_name] + const std::string* all_names_; const FileDescriptor* file_; const Descriptor* containing_type_; const MessageOptions* options_; @@ -540,7 +584,6 @@ class PROTOBUF_EXPORT Descriptor { ReservedRange* reserved_ranges_; const std::string** reserved_names_; - int field_count_; int oneof_decl_count_; int real_oneof_decl_count_; int nested_type_count_; @@ -550,13 +593,6 @@ class PROTOBUF_EXPORT Descriptor { int reserved_range_count_; int reserved_name_count_; - // True if this is a placeholder for an unknown type. - bool is_placeholder_; - // True if this is a placeholder and the type name wasn't fully-qualified. - bool is_unqualified_placeholder_; - // Well known type. Stored as char to conserve space. - char well_known_type_; - // IMPORTANT: If you add a new field, make sure to search for all instances // of Allocate() and AllocateArray() in descriptor.cc // and update them to initialize the field. @@ -584,7 +620,7 @@ class PROTOBUF_EXPORT Descriptor { // - Given a DescriptorPool, call DescriptorPool::FindExtensionByNumber() or // DescriptorPool::FindExtensionByPrintableName(). // Use DescriptorPool to construct your own descriptors. -class PROTOBUF_EXPORT FieldDescriptor { +class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase { public: typedef FieldDescriptorProto Proto; @@ -727,16 +763,20 @@ class PROTOBUF_EXPORT FieldDescriptor { // Get the field default value if cpp_type() == CPPTYPE_INT32. If no // explicit default was defined, the default is 0. - int32 default_value_int32() const; + int32_t default_value_int32_t() const; + int32_t default_value_int32() const { return default_value_int32_t(); } // Get the field default value if cpp_type() == CPPTYPE_INT64. If no // explicit default was defined, the default is 0. - int64 default_value_int64() const; + int64_t default_value_int64_t() const; + int64_t default_value_int64() const { return default_value_int64_t(); } // Get the field default value if cpp_type() == CPPTYPE_UINT32. If no // explicit default was defined, the default is 0. - uint32 default_value_uint32() const; + uint32_t default_value_uint32_t() const; + uint32_t default_value_uint32() const { return default_value_uint32_t(); } // Get the field default value if cpp_type() == CPPTYPE_UINT64. If no // explicit default was defined, the default is 0. - uint64 default_value_uint64() const; + uint64_t default_value_uint64_t() const; + uint64_t default_value_uint64() const { return default_value_uint64_t(); } // Get the field default value if cpp_type() == CPPTYPE_FLOAT. If no // explicit default was defined, the default is 0.0. float default_value_float() const; @@ -835,6 +875,7 @@ class PROTOBUF_EXPORT FieldDescriptor { bool GetSourceLocation(SourceLocation* out_location) const; private: + friend class Symbol; typedef FieldOptions OptionsType; // Allows access to GetLocationPath for annotations. @@ -864,44 +905,57 @@ class PROTOBUF_EXPORT FieldDescriptor { // Returns true if this is a map message type. bool is_map_message_type() const; - const std::string* name_; - const std::string* full_name_; - const std::string* lowercase_name_; - const std::string* camelcase_name_; - // If has_json_name_ is true, it's the value specified by the user. - // Otherwise, it has the same value as camelcase_name_. - const std::string* json_name_; - const FileDescriptor* file_; - internal::once_flag* type_once_; - static void TypeOnceInit(const FieldDescriptor* to_init); - void InternalTypeOnceInit() const; - mutable Type type_; - Label label_; bool has_default_value_; bool proto3_optional_; // Whether the user has specified the json_name field option in the .proto // file. bool has_json_name_; bool is_extension_; + + // Actually a `Type`, but stored as uint8_t to save space. + mutable uint8_t type_; + // Actually a `Label` but stored as uint8_t to save space. + uint8_t label_; + + bool is_oneof_ : 1; + + // Logically: + // all_names_ = [name, full_name, lower, camel, json] + // However: + // duplicates will be omitted, so lower/camel/json might be in the same + // position. + // We store the true offset for each name here, and the bit width must be + // large enough to account for the worst case where all names are present. + uint8_t lowercase_name_index_ : 2; + uint8_t camelcase_name_index_ : 2; + uint8_t json_name_index_ : 3; + const std::string* all_names_; + const FileDescriptor* file_; + + internal::LazyInitData* type_once_; + static void TypeOnceInit(const FieldDescriptor* to_init); + void InternalTypeOnceInit() const; int number_; int index_in_oneof_; const Descriptor* containing_type_; - const OneofDescriptor* containing_oneof_; - const Descriptor* extension_scope_; - mutable const Descriptor* message_type_; - mutable const EnumDescriptor* enum_type_; + union { + const OneofDescriptor* containing_oneof; + const Descriptor* extension_scope; + } scope_; + union { + mutable const Descriptor* message_type; + mutable const EnumDescriptor* enum_type; + } type_descriptor_; const FieldOptions* options_; - const std::string* type_name_; - const std::string* default_value_enum_name_; // IMPORTANT: If you add a new field, make sure to search for all instances // of Allocate() and AllocateArray() in // descriptor.cc and update them to initialize the field. union { - int32 default_value_int32_; - int64 default_value_int64_; - uint32 default_value_uint32_; - uint64 default_value_uint64_; + int32_t default_value_int32_t_; + int64_t default_value_int64_t_; + uint32_t default_value_uint32_t_; + uint64_t default_value_uint64_t_; float default_value_float_; double default_value_double_; bool default_value_bool_; @@ -930,7 +984,7 @@ class PROTOBUF_EXPORT FieldDescriptor { // Describes a oneof defined in a message type. -class PROTOBUF_EXPORT OneofDescriptor { +class PROTOBUF_EXPORT OneofDescriptor : private internal::SymbolBase { public: typedef OneofDescriptorProto Proto; @@ -974,6 +1028,7 @@ class PROTOBUF_EXPORT OneofDescriptor { bool GetSourceLocation(SourceLocation* out_location) const; private: + friend class Symbol; typedef OneofOptions OptionsType; // Allows access to GetLocationPath for annotations. @@ -988,10 +1043,11 @@ class PROTOBUF_EXPORT OneofDescriptor { // to this descriptor from the file root. void GetLocationPath(std::vector* output) const; - const std::string* name_; - const std::string* full_name_; - const Descriptor* containing_type_; int field_count_; + + // all_names_ = [name, full_name] + const std::string* all_names_; + const Descriptor* containing_type_; const FieldDescriptor** fields_; const OneofOptions* options_; @@ -1009,7 +1065,7 @@ class PROTOBUF_EXPORT OneofDescriptor { // Describes an enum type defined in a .proto file. To get the EnumDescriptor // for a generated enum type, call TypeName_descriptor(). Use DescriptorPool // to construct your own descriptors. -class PROTOBUF_EXPORT EnumDescriptor { +class PROTOBUF_EXPORT EnumDescriptor : private internal::SymbolBase { public: typedef EnumDescriptorProto Proto; @@ -1101,6 +1157,7 @@ class PROTOBUF_EXPORT EnumDescriptor { bool GetSourceLocation(SourceLocation* out_location) const; private: + friend class Symbol; typedef EnumOptions OptionsType; // Allows access to GetLocationPath for annotations. @@ -1126,18 +1183,18 @@ class PROTOBUF_EXPORT EnumDescriptor { // to this descriptor from the file root. void GetLocationPath(std::vector* output) const; - const std::string* name_; - const std::string* full_name_; - const FileDescriptor* file_; - const Descriptor* containing_type_; - const EnumOptions* options_; - // True if this is a placeholder for an unknown type. bool is_placeholder_; // True if this is a placeholder and the type name wasn't fully-qualified. bool is_unqualified_placeholder_; int value_count_; + + // all_names_ = [name, full_name] + const std::string* all_names_; + const FileDescriptor* file_; + const Descriptor* containing_type_; + const EnumOptions* options_; EnumValueDescriptor* values_; int reserved_range_count_; @@ -1166,7 +1223,8 @@ class PROTOBUF_EXPORT EnumDescriptor { // for its type, then use EnumDescriptor::FindValueByName() or // EnumDescriptor::FindValueByNumber(). Use DescriptorPool to construct // your own descriptors. -class PROTOBUF_EXPORT EnumValueDescriptor { +class PROTOBUF_EXPORT EnumValueDescriptor : private internal::SymbolBaseN<0>, + private internal::SymbolBaseN<1> { public: typedef EnumValueDescriptorProto Proto; @@ -1209,6 +1267,7 @@ class PROTOBUF_EXPORT EnumValueDescriptor { bool GetSourceLocation(SourceLocation* out_location) const; private: + friend class Symbol; typedef EnumValueOptions OptionsType; // Allows access to GetLocationPath for annotations. @@ -1223,9 +1282,9 @@ class PROTOBUF_EXPORT EnumValueDescriptor { // to this descriptor from the file root. void GetLocationPath(std::vector* output) const; - const std::string* name_; - const std::string* full_name_; int number_; + // all_names_ = [name, full_name] + const std::string* all_names_; const EnumDescriptor* type_; const EnumValueOptions* options_; // IMPORTANT: If you add a new field, make sure to search for all instances @@ -1244,7 +1303,7 @@ class PROTOBUF_EXPORT EnumValueDescriptor { // Describes an RPC service. Use DescriptorPool to construct your own // descriptors. -class PROTOBUF_EXPORT ServiceDescriptor { +class PROTOBUF_EXPORT ServiceDescriptor : private internal::SymbolBase { public: typedef ServiceDescriptorProto Proto; @@ -1289,6 +1348,7 @@ class PROTOBUF_EXPORT ServiceDescriptor { bool GetSourceLocation(SourceLocation* out_location) const; private: + friend class Symbol; typedef ServiceOptions OptionsType; // Allows access to GetLocationPath for annotations. @@ -1303,8 +1363,8 @@ class PROTOBUF_EXPORT ServiceDescriptor { // to this descriptor from the file root. void GetLocationPath(std::vector* output) const; - const std::string* name_; - const std::string* full_name_; + // all_names_ = [name, full_name] + const std::string* all_names_; const FileDescriptor* file_; const ServiceOptions* options_; MethodDescriptor* methods_; @@ -1326,7 +1386,7 @@ class PROTOBUF_EXPORT ServiceDescriptor { // a service, first get its ServiceDescriptor, then call // ServiceDescriptor::FindMethodByName(). Use DescriptorPool to construct your // own descriptors. -class PROTOBUF_EXPORT MethodDescriptor { +class PROTOBUF_EXPORT MethodDescriptor : private internal::SymbolBase { public: typedef MethodDescriptorProto Proto; @@ -1375,6 +1435,7 @@ class PROTOBUF_EXPORT MethodDescriptor { bool GetSourceLocation(SourceLocation* out_location) const; private: + friend class Symbol; typedef MethodOptions OptionsType; // Allows access to GetLocationPath for annotations. @@ -1389,14 +1450,14 @@ class PROTOBUF_EXPORT MethodDescriptor { // to this descriptor from the file root. void GetLocationPath(std::vector* output) const; - const std::string* name_; - const std::string* full_name_; + bool client_streaming_; + bool server_streaming_; + // all_names_ = [name, full_name] + const std::string* all_names_; const ServiceDescriptor* service_; mutable internal::LazyDescriptor input_type_; mutable internal::LazyDescriptor output_type_; const MethodOptions* options_; - bool client_streaming_; - bool server_streaming_; // IMPORTANT: If you add a new field, make sure to search for all instances // of Allocate() and AllocateArray() in // descriptor.cc and update them to initialize the field. @@ -1554,7 +1615,7 @@ class PROTOBUF_EXPORT FileDescriptor { const std::string* name_; const std::string* package_; const DescriptorPool* pool_; - internal::once_flag* dependencies_once_; + internal::LazyInitData* dependencies_once_; static void DependenciesOnceInit(const FileDescriptor* to_init); void InternalDependenciesOnceInit() const; @@ -1565,17 +1626,18 @@ class PROTOBUF_EXPORT FileDescriptor { int message_type_count_; int enum_type_count_; int service_count_; - int extension_count_; - Syntax syntax_; - bool is_placeholder_; + bool is_placeholder_; // Indicates the FileDescriptor is completed building. Used to verify // that type accessor functions that can possibly build a dependent file // aren't called during the process of building the file. bool finished_building_; + // Actually a `Syntax` but stored as uint8_t to save space. + uint8_t syntax_; + // This one is here to fill the padding. + int extension_count_; mutable const FileDescriptor** dependencies_; - const std::string** dependencies_names_; int* public_dependencies_; int* weak_dependencies_; Descriptor* message_types_; @@ -1988,6 +2050,11 @@ class PROTOBUF_EXPORT DescriptorPool { #define PROTOBUF_DEFINE_STRING_ACCESSOR(CLASS, FIELD) \ inline const std::string& CLASS::FIELD() const { return *FIELD##_; } +// Name and full name are stored in a single array to save space. +#define PROTOBUF_DEFINE_NAME_ACCESSOR(CLASS) \ + inline const std::string& CLASS::name() const { return all_names_[0]; } \ + inline const std::string& CLASS::full_name() const { return all_names_[1]; } + // Arrays take an index parameter, obviously. #define PROTOBUF_DEFINE_ARRAY_ACCESSOR(CLASS, FIELD, TYPE) \ inline TYPE CLASS::FIELD(int index) const { return FIELD##s_ + index; } @@ -1995,8 +2062,7 @@ class PROTOBUF_EXPORT DescriptorPool { #define PROTOBUF_DEFINE_OPTIONS_ACCESSOR(CLASS, TYPE) \ inline const TYPE& CLASS::options() const { return *options_; } -PROTOBUF_DEFINE_STRING_ACCESSOR(Descriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(Descriptor, full_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(Descriptor) PROTOBUF_DEFINE_ACCESSOR(Descriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(Descriptor, containing_type, const Descriptor*) @@ -2025,40 +2091,30 @@ PROTOBUF_DEFINE_ACCESSOR(Descriptor, reserved_name_count, int) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(Descriptor, MessageOptions) PROTOBUF_DEFINE_ACCESSOR(Descriptor, is_placeholder, bool) -PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, full_name) -PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, json_name) -PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, lowercase_name) -PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, camelcase_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(FieldDescriptor) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, number, int) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, is_extension, bool) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, label, FieldDescriptor::Label) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_type, const Descriptor*) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_oneof, - const OneofDescriptor*) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, index_in_oneof, int) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, extension_scope, const Descriptor*) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FieldDescriptor, FieldOptions) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_default_value, bool) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_json_name, bool) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int32, int32) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int64, int64) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint32, uint32) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint64, uint64) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int32_t, int32_t) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int64_t, int64_t) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint32_t, uint32_t) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint64_t, uint64_t) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_float, float) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_double, double) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_bool, bool) PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, default_value_string) -PROTOBUF_DEFINE_STRING_ACCESSOR(OneofDescriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(OneofDescriptor, full_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(OneofDescriptor) PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, containing_type, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, field_count, int) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(OneofDescriptor, OneofOptions) -PROTOBUF_DEFINE_STRING_ACCESSOR(EnumDescriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(EnumDescriptor, full_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(EnumDescriptor) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, containing_type, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, value_count, int) @@ -2071,22 +2127,19 @@ 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) +PROTOBUF_DEFINE_NAME_ACCESSOR(EnumValueDescriptor) PROTOBUF_DEFINE_ACCESSOR(EnumValueDescriptor, number, int) PROTOBUF_DEFINE_ACCESSOR(EnumValueDescriptor, type, const EnumDescriptor*) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(EnumValueDescriptor, EnumValueOptions) -PROTOBUF_DEFINE_STRING_ACCESSOR(ServiceDescriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(ServiceDescriptor, full_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(ServiceDescriptor) PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, method_count, int) PROTOBUF_DEFINE_ARRAY_ACCESSOR(ServiceDescriptor, method, const MethodDescriptor*) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(ServiceDescriptor, ServiceOptions) -PROTOBUF_DEFINE_STRING_ACCESSOR(MethodDescriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(MethodDescriptor, full_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(MethodDescriptor) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, service, const ServiceDescriptor*) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(MethodDescriptor, MethodOptions) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, client_streaming, bool) @@ -2164,11 +2217,36 @@ inline const std::string& EnumDescriptor::reserved_name(int index) const { return *reserved_names_[index]; } +inline const std::string& FieldDescriptor::lowercase_name() const { + return all_names_[lowercase_name_index_]; +} + +inline const std::string& FieldDescriptor::camelcase_name() const { + return all_names_[camelcase_name_index_]; +} + +inline const std::string& FieldDescriptor::json_name() const { + return all_names_[json_name_index_]; +} + +inline const OneofDescriptor* FieldDescriptor::containing_oneof() const { + return is_oneof_ ? scope_.containing_oneof : nullptr; +} + +inline const Descriptor* FieldDescriptor::extension_scope() const { + GOOGLE_CHECK(is_extension_); + return scope_.extension_scope; +} + +inline FieldDescriptor::Label FieldDescriptor::label() const { + return static_cast