updated protobuf to 3.18.1

This commit is contained in:
Sven Czarnian
2021-10-10 20:51:05 +02:00
parent ea460b1aaf
commit 7d69203486
69 changed files with 6374 additions and 3669 deletions

Binary file not shown.

View File

@@ -67,12 +67,12 @@ class PROTOBUF_EXPORT AnyMetadata {
// The resulted type URL will be "type.googleapis.com/<message_full_name>". // The resulted type URL will be "type.googleapis.com/<message_full_name>".
// Returns false if serializing the message failed. // Returns false if serializing the message failed.
template <typename T> template <typename T>
bool PackFrom(const T& message) { bool PackFrom(Arena* arena, const T& message) {
return InternalPackFrom(message, kTypeGoogleApisComPrefix, return InternalPackFrom(arena, message, kTypeGoogleApisComPrefix,
T::FullMessageName()); 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 // 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 // constructed by concatenating the message type's full name to the prefix
@@ -82,11 +82,11 @@ class PROTOBUF_EXPORT AnyMetadata {
// URL: "type.googleapis.com/<message_full_name>". // URL: "type.googleapis.com/<message_full_name>".
// Returns false if serializing the message failed. // Returns false if serializing the message failed.
template <typename T> template <typename T>
bool PackFrom(const T& message, StringPiece type_url_prefix) { bool PackFrom(Arena* arena, const T& message, StringPiece type_url_prefix) {
return InternalPackFrom(message, type_url_prefix, T::FullMessageName()); 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 // 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 // type doesn't match the type specified in the type URL (i.e., the full
@@ -108,7 +108,8 @@ class PROTOBUF_EXPORT AnyMetadata {
} }
private: private:
bool InternalPackFrom(const MessageLite& message, bool InternalPackFrom(Arena* arena,
const MessageLite& message,
StringPiece type_url_prefix, StringPiece type_url_prefix,
StringPiece type_name); StringPiece type_name);
bool InternalUnpackTo(StringPiece type_name, bool InternalUnpackTo(StringPiece type_name,

View File

@@ -8,12 +8,12 @@
#include <string> #include <string>
#include <google/protobuf/port_def.inc> #include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3017000 #if PROTOBUF_VERSION < 3018000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #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 This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.
@@ -59,7 +59,7 @@ struct AnyDefaultTypeInternal;
PROTOBUF_EXPORT extern AnyDefaultTypeInternal _Any_default_instance_; PROTOBUF_EXPORT extern AnyDefaultTypeInternal _Any_default_instance_;
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Any* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Any>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Any* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Any>(Arena*);
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
@@ -84,7 +84,11 @@ class PROTOBUF_EXPORT Any final :
} }
inline Any& operator=(Any&& from) noexcept { inline Any& operator=(Any&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -114,11 +118,11 @@ class PROTOBUF_EXPORT Any final :
// implements Any ----------------------------------------------- // implements Any -----------------------------------------------
bool PackFrom(const ::PROTOBUF_NAMESPACE_ID::Message& message) { 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, bool PackFrom(const ::PROTOBUF_NAMESPACE_ID::Message& message,
::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url_prefix) { ::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 { bool UnpackTo(::PROTOBUF_NAMESPACE_ID::Message* message) const {
return _any_metadata_.UnpackTo(message); return _any_metadata_.UnpackTo(message);
@@ -129,12 +133,12 @@ class PROTOBUF_EXPORT Any final :
const ::PROTOBUF_NAMESPACE_ID::FieldDescriptor** value_field); const ::PROTOBUF_NAMESPACE_ID::FieldDescriptor** value_field);
template <typename T, class = typename std::enable_if<!std::is_convertible<T, const ::PROTOBUF_NAMESPACE_ID::Message&>::value>::type> template <typename T, class = typename std::enable_if<!std::is_convertible<T, const ::PROTOBUF_NAMESPACE_ID::Message&>::value>::type>
bool PackFrom(const T& message) { bool PackFrom(const T& message) {
return _any_metadata_.PackFrom<T>(message); return _any_metadata_.PackFrom<T>(GetArena(), message);
} }
template <typename T, class = typename std::enable_if<!std::is_convertible<T, const ::PROTOBUF_NAMESPACE_ID::Message&>::value>::type> template <typename T, class = typename std::enable_if<!std::is_convertible<T, const ::PROTOBUF_NAMESPACE_ID::Message&>::value>::type>
bool PackFrom(const T& message, bool PackFrom(const T& message,
::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url_prefix) { ::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url_prefix) {
return _any_metadata_.PackFrom<T>(message, type_url_prefix);} return _any_metadata_.PackFrom<T>(GetArena(), message, type_url_prefix);}
template <typename T, class = typename std::enable_if<!std::is_convertible<T, const ::PROTOBUF_NAMESPACE_ID::Message&>::value>::type> template <typename T, class = typename std::enable_if<!std::is_convertible<T, const ::PROTOBUF_NAMESPACE_ID::Message&>::value>::type>
bool UnpackTo(T* message) const { bool UnpackTo(T* message) const {
return _any_metadata_.UnpackTo<T>(message); return _any_metadata_.UnpackTo<T>(message);
@@ -175,7 +179,7 @@ class PROTOBUF_EXPORT Any final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const Any& from); void MergeFrom(const Any& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;

View File

@@ -8,12 +8,12 @@
#include <string> #include <string>
#include <google/protobuf/port_def.inc> #include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3017000 #if PROTOBUF_VERSION < 3018000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #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 This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.
@@ -67,9 +67,9 @@ struct MixinDefaultTypeInternal;
PROTOBUF_EXPORT extern MixinDefaultTypeInternal _Mixin_default_instance_; PROTOBUF_EXPORT extern MixinDefaultTypeInternal _Mixin_default_instance_;
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Api* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Api>(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::Method* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Method>(Arena*);
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Mixin* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Mixin>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Mixin* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Mixin>(Arena*);
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
@@ -94,7 +94,11 @@ class PROTOBUF_EXPORT Api final :
} }
inline Api& operator=(Api&& from) noexcept { inline Api& operator=(Api&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -152,7 +156,7 @@ class PROTOBUF_EXPORT Api final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const Api& from); void MergeFrom(const Api& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;
@@ -204,16 +208,16 @@ class PROTOBUF_EXPORT Api final :
int _internal_methods_size() const; int _internal_methods_size() const;
public: public:
void clear_methods(); void clear_methods();
PROTOBUF_NAMESPACE_ID::Method* mutable_methods(int index); ::PROTOBUF_NAMESPACE_ID::Method* mutable_methods(int index);
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method >* ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method >*
mutable_methods(); mutable_methods();
private: private:
const PROTOBUF_NAMESPACE_ID::Method& _internal_methods(int index) const; const ::PROTOBUF_NAMESPACE_ID::Method& _internal_methods(int index) const;
PROTOBUF_NAMESPACE_ID::Method* _internal_add_methods(); ::PROTOBUF_NAMESPACE_ID::Method* _internal_add_methods();
public: public:
const PROTOBUF_NAMESPACE_ID::Method& methods(int index) const; const ::PROTOBUF_NAMESPACE_ID::Method& methods(int index) const;
PROTOBUF_NAMESPACE_ID::Method* add_methods(); ::PROTOBUF_NAMESPACE_ID::Method* add_methods();
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method >& const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method >&
methods() const; methods() const;
// repeated .google.protobuf.Option options = 3; // repeated .google.protobuf.Option options = 3;
@@ -222,16 +226,16 @@ class PROTOBUF_EXPORT Api final :
int _internal_options_size() const; int _internal_options_size() const;
public: public:
void clear_options(); void clear_options();
PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); ::PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index);
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >*
mutable_options(); mutable_options();
private: private:
const PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; const ::PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const;
PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); ::PROTOBUF_NAMESPACE_ID::Option* _internal_add_options();
public: public:
const PROTOBUF_NAMESPACE_ID::Option& options(int index) const; const ::PROTOBUF_NAMESPACE_ID::Option& options(int index) const;
PROTOBUF_NAMESPACE_ID::Option* add_options(); ::PROTOBUF_NAMESPACE_ID::Option* add_options();
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >&
options() const; options() const;
// repeated .google.protobuf.Mixin mixins = 6; // repeated .google.protobuf.Mixin mixins = 6;
@@ -240,16 +244,16 @@ class PROTOBUF_EXPORT Api final :
int _internal_mixins_size() const; int _internal_mixins_size() const;
public: public:
void clear_mixins(); void clear_mixins();
PROTOBUF_NAMESPACE_ID::Mixin* mutable_mixins(int index); ::PROTOBUF_NAMESPACE_ID::Mixin* mutable_mixins(int index);
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin >* ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin >*
mutable_mixins(); mutable_mixins();
private: private:
const PROTOBUF_NAMESPACE_ID::Mixin& _internal_mixins(int index) const; const ::PROTOBUF_NAMESPACE_ID::Mixin& _internal_mixins(int index) const;
PROTOBUF_NAMESPACE_ID::Mixin* _internal_add_mixins(); ::PROTOBUF_NAMESPACE_ID::Mixin* _internal_add_mixins();
public: public:
const PROTOBUF_NAMESPACE_ID::Mixin& mixins(int index) const; const ::PROTOBUF_NAMESPACE_ID::Mixin& mixins(int index) const;
PROTOBUF_NAMESPACE_ID::Mixin* add_mixins(); ::PROTOBUF_NAMESPACE_ID::Mixin* add_mixins();
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin >& const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin >&
mixins() const; mixins() const;
// string name = 1; // string name = 1;
@@ -286,25 +290,25 @@ class PROTOBUF_EXPORT Api final :
bool _internal_has_source_context() const; bool _internal_has_source_context() const;
public: public:
void clear_source_context(); void clear_source_context();
const PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const; const ::PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const;
PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context(); PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context();
PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context(); ::PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context();
void set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context); void set_allocated_source_context(::PROTOBUF_NAMESPACE_ID::SourceContext* source_context);
private: private:
const PROTOBUF_NAMESPACE_ID::SourceContext& _internal_source_context() const; const ::PROTOBUF_NAMESPACE_ID::SourceContext& _internal_source_context() const;
PROTOBUF_NAMESPACE_ID::SourceContext* _internal_mutable_source_context(); ::PROTOBUF_NAMESPACE_ID::SourceContext* _internal_mutable_source_context();
public: public:
void unsafe_arena_set_allocated_source_context( void unsafe_arena_set_allocated_source_context(
PROTOBUF_NAMESPACE_ID::SourceContext* source_context); ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context);
PROTOBUF_NAMESPACE_ID::SourceContext* unsafe_arena_release_source_context(); ::PROTOBUF_NAMESPACE_ID::SourceContext* unsafe_arena_release_source_context();
// .google.protobuf.Syntax syntax = 7; // .google.protobuf.Syntax syntax = 7;
void clear_syntax(); void clear_syntax();
PROTOBUF_NAMESPACE_ID::Syntax syntax() const; ::PROTOBUF_NAMESPACE_ID::Syntax syntax() const;
void set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); void set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value);
private: private:
PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; ::PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const;
void _internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); void _internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value);
public: public:
// @@protoc_insertion_point(class_scope:google.protobuf.Api) // @@protoc_insertion_point(class_scope:google.protobuf.Api)
@@ -314,12 +318,12 @@ class PROTOBUF_EXPORT Api final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_; typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_; typedef void DestructorSkippable_;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method > methods_; ::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::Option > options_;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin > mixins_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin > mixins_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr version_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr version_;
PROTOBUF_NAMESPACE_ID::SourceContext* source_context_; ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context_;
int syntax_; int syntax_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_google_2fprotobuf_2fapi_2eproto; friend struct ::TableStruct_google_2fprotobuf_2fapi_2eproto;
@@ -345,7 +349,11 @@ class PROTOBUF_EXPORT Method final :
} }
inline Method& operator=(Method&& from) noexcept { inline Method& operator=(Method&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -403,7 +411,7 @@ class PROTOBUF_EXPORT Method final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const Method& from); void MergeFrom(const Method& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;
@@ -455,16 +463,16 @@ class PROTOBUF_EXPORT Method final :
int _internal_options_size() const; int _internal_options_size() const;
public: public:
void clear_options(); void clear_options();
PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); ::PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index);
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >*
mutable_options(); mutable_options();
private: private:
const PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; const ::PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const;
PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); ::PROTOBUF_NAMESPACE_ID::Option* _internal_add_options();
public: public:
const PROTOBUF_NAMESPACE_ID::Option& options(int index) const; const ::PROTOBUF_NAMESPACE_ID::Option& options(int index) const;
PROTOBUF_NAMESPACE_ID::Option* add_options(); ::PROTOBUF_NAMESPACE_ID::Option* add_options();
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >&
options() const; options() const;
// string name = 1; // string name = 1;
@@ -529,11 +537,11 @@ class PROTOBUF_EXPORT Method final :
// .google.protobuf.Syntax syntax = 7; // .google.protobuf.Syntax syntax = 7;
void clear_syntax(); void clear_syntax();
PROTOBUF_NAMESPACE_ID::Syntax syntax() const; ::PROTOBUF_NAMESPACE_ID::Syntax syntax() const;
void set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); void set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value);
private: private:
PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; ::PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const;
void _internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); void _internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value);
public: public:
// @@protoc_insertion_point(class_scope:google.protobuf.Method) // @@protoc_insertion_point(class_scope:google.protobuf.Method)
@@ -543,7 +551,7 @@ class PROTOBUF_EXPORT Method final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_; typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_; 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 name_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr request_type_url_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr request_type_url_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr response_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 { inline Mixin& operator=(Mixin&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -632,7 +644,7 @@ class PROTOBUF_EXPORT Mixin final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const Mixin& from); void MergeFrom(const Mixin& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;
@@ -780,31 +792,31 @@ inline int Api::methods_size() const {
inline void Api::clear_methods() { inline void Api::clear_methods() {
methods_.Clear(); 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) // @@protoc_insertion_point(field_mutable:google.protobuf.Api.methods)
return methods_.Mutable(index); 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() { Api::mutable_methods() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.methods) // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.methods)
return &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); 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) // @@protoc_insertion_point(field_get:google.protobuf.Api.methods)
return _internal_methods(index); 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(); return methods_.Add();
} }
inline PROTOBUF_NAMESPACE_ID::Method* Api::add_methods() { inline ::PROTOBUF_NAMESPACE_ID::Method* Api::add_methods() {
PROTOBUF_NAMESPACE_ID::Method* _add = _internal_add_methods(); ::PROTOBUF_NAMESPACE_ID::Method* _add = _internal_add_methods();
// @@protoc_insertion_point(field_add:google.protobuf.Api.methods) // @@protoc_insertion_point(field_add:google.protobuf.Api.methods)
return _add; 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 { Api::methods() const {
// @@protoc_insertion_point(field_list:google.protobuf.Api.methods) // @@protoc_insertion_point(field_list:google.protobuf.Api.methods)
return methods_; return methods_;
@@ -817,31 +829,31 @@ inline int Api::_internal_options_size() const {
inline int Api::options_size() const { inline int Api::options_size() const {
return _internal_options_size(); 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) // @@protoc_insertion_point(field_mutable:google.protobuf.Api.options)
return options_.Mutable(index); 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() { Api::mutable_options() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.options) // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.options)
return &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); 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) // @@protoc_insertion_point(field_get:google.protobuf.Api.options)
return _internal_options(index); 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(); return options_.Add();
} }
inline PROTOBUF_NAMESPACE_ID::Option* Api::add_options() { inline ::PROTOBUF_NAMESPACE_ID::Option* Api::add_options() {
PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); ::PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options();
// @@protoc_insertion_point(field_add:google.protobuf.Api.options) // @@protoc_insertion_point(field_add:google.protobuf.Api.options)
return _add; 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 { Api::options() const {
// @@protoc_insertion_point(field_list:google.protobuf.Api.options) // @@protoc_insertion_point(field_list:google.protobuf.Api.options)
return options_; return options_;
@@ -900,17 +912,17 @@ inline bool Api::_internal_has_source_context() const {
inline bool Api::has_source_context() const { inline bool Api::has_source_context() const {
return _internal_has_source_context(); return _internal_has_source_context();
} }
inline const PROTOBUF_NAMESPACE_ID::SourceContext& Api::_internal_source_context() const { inline const ::PROTOBUF_NAMESPACE_ID::SourceContext& Api::_internal_source_context() const {
const PROTOBUF_NAMESPACE_ID::SourceContext* p = source_context_; const ::PROTOBUF_NAMESPACE_ID::SourceContext* p = source_context_;
return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::SourceContext&>( return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::SourceContext&>(
PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_); ::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) // @@protoc_insertion_point(field_get:google.protobuf.Api.source_context)
return _internal_source_context(); return _internal_source_context();
} }
inline void Api::unsafe_arena_set_allocated_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) { if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_); 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) // @@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; source_context_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); 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 #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
return temp; 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) // @@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; source_context_ = nullptr;
return temp; 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) { if (source_context_ == nullptr) {
auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::SourceContext>(GetArenaForAllocation()); auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::SourceContext>(GetArenaForAllocation());
source_context_ = p; source_context_ = p;
} }
return source_context_; return source_context_;
} }
inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::mutable_source_context() { inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::mutable_source_context() {
PROTOBUF_NAMESPACE_ID::SourceContext* _msg = _internal_mutable_source_context(); ::PROTOBUF_NAMESPACE_ID::SourceContext* _msg = _internal_mutable_source_context();
// @@protoc_insertion_point(field_mutable:google.protobuf.Api.source_context) // @@protoc_insertion_point(field_mutable:google.protobuf.Api.source_context)
return _msg; 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(); ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) { if (message_arena == nullptr) {
delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_); delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_);
@@ -989,31 +1001,31 @@ inline int Api::mixins_size() const {
inline void Api::clear_mixins() { inline void Api::clear_mixins() {
mixins_.Clear(); 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) // @@protoc_insertion_point(field_mutable:google.protobuf.Api.mixins)
return mixins_.Mutable(index); 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() { Api::mutable_mixins() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.mixins) // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.mixins)
return &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); 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) // @@protoc_insertion_point(field_get:google.protobuf.Api.mixins)
return _internal_mixins(index); 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(); return mixins_.Add();
} }
inline PROTOBUF_NAMESPACE_ID::Mixin* Api::add_mixins() { inline ::PROTOBUF_NAMESPACE_ID::Mixin* Api::add_mixins() {
PROTOBUF_NAMESPACE_ID::Mixin* _add = _internal_add_mixins(); ::PROTOBUF_NAMESPACE_ID::Mixin* _add = _internal_add_mixins();
// @@protoc_insertion_point(field_add:google.protobuf.Api.mixins) // @@protoc_insertion_point(field_add:google.protobuf.Api.mixins)
return _add; 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 { Api::mixins() const {
// @@protoc_insertion_point(field_list:google.protobuf.Api.mixins) // @@protoc_insertion_point(field_list:google.protobuf.Api.mixins)
return mixins_; return mixins_;
@@ -1023,18 +1035,18 @@ Api::mixins() const {
inline void Api::clear_syntax() { inline void Api::clear_syntax() {
syntax_ = 0; syntax_ = 0;
} }
inline PROTOBUF_NAMESPACE_ID::Syntax Api::_internal_syntax() const { inline ::PROTOBUF_NAMESPACE_ID::Syntax Api::_internal_syntax() const {
return static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); 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) // @@protoc_insertion_point(field_get:google.protobuf.Api.syntax)
return _internal_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; 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); _internal_set_syntax(value);
// @@protoc_insertion_point(field_set:google.protobuf.Api.syntax) // @@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 { inline int Method::options_size() const {
return _internal_options_size(); 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) // @@protoc_insertion_point(field_mutable:google.protobuf.Method.options)
return options_.Mutable(index); 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() { Method::mutable_options() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.Method.options) // @@protoc_insertion_point(field_mutable_list:google.protobuf.Method.options)
return &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); 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) // @@protoc_insertion_point(field_get:google.protobuf.Method.options)
return _internal_options(index); 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(); return options_.Add();
} }
inline PROTOBUF_NAMESPACE_ID::Option* Method::add_options() { inline ::PROTOBUF_NAMESPACE_ID::Option* Method::add_options() {
PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); ::PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options();
// @@protoc_insertion_point(field_add:google.protobuf.Method.options) // @@protoc_insertion_point(field_add:google.protobuf.Method.options)
return _add; 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 { Method::options() const {
// @@protoc_insertion_point(field_list:google.protobuf.Method.options) // @@protoc_insertion_point(field_list:google.protobuf.Method.options)
return options_; return options_;
@@ -1262,18 +1274,18 @@ Method::options() const {
inline void Method::clear_syntax() { inline void Method::clear_syntax() {
syntax_ = 0; syntax_ = 0;
} }
inline PROTOBUF_NAMESPACE_ID::Syntax Method::_internal_syntax() const { inline ::PROTOBUF_NAMESPACE_ID::Syntax Method::_internal_syntax() const {
return static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); 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) // @@protoc_insertion_point(field_get:google.protobuf.Method.syntax)
return _internal_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; 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); _internal_set_syntax(value);
// @@protoc_insertion_point(field_set:google.protobuf.Method.syntax) // @@protoc_insertion_point(field_set:google.protobuf.Method.syntax)
} }

View File

@@ -91,6 +91,7 @@ class ReflectionTester; // defined in test_util.h
namespace internal { namespace internal {
struct ArenaStringPtr; // defined in arenastring.h struct ArenaStringPtr; // defined in arenastring.h
class InlinedStringField; // defined in inlined_string_field.h
class LazyField; // defined in lazy_field.h class LazyField; // defined in lazy_field.h
class EpsCopyInputStream; // defined in parse_context.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() // We must delegate to CreateMaybeMessage() and NOT CreateMessageInternal()
// because protobuf generated classes specialize CreateMaybeMessage() and we // because protobuf generated classes specialize CreateMaybeMessage() and we
// need to use that specialization for code size reasons. // need to use that specialization for code size reasons.
return Arena::CreateMaybeMessage<T>(arena, std::forward<Args>(args)...); return Arena::CreateMaybeMessage<T>(arena, static_cast<Args&&>(args)...);
} }
// API to create any objects on the arena. Note that only the object will // 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 <typename T, typename... Args> template <typename T, typename... Args>
PROTOBUF_NDEBUG_INLINE static T* Create(Arena* arena, Args&&... args) { PROTOBUF_NDEBUG_INLINE static T* Create(Arena* arena, Args&&... args) {
return CreateInternal<T>(arena, std::is_convertible<T*, MessageLite*>(), return CreateInternal<T>(arena, std::is_convertible<T*, MessageLite*>(),
std::forward<Args>(args)...); static_cast<Args&&>(args)...);
} }
// Create an array of object type T on the arena *without* invoking the // 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. // policies. Do not use these in unit tests.
// Returns the total space allocated by the arena, which is the sum of the // Returns the total space allocated by the arena, which is the sum of the
// sizes of the underlying blocks. // 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 // Returns the total space used by the arena. Similar to SpaceAllocated but
// does not include free space and block overhead. The total space returned // does not include free space and block overhead. The total space returned
// may not include space used by other threads executing concurrently with // may not include space used by other threads executing concurrently with
// the call to this method. // 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 // Frees all storage allocated by this arena after calling destructors
// registered with OwnDestructor() and freeing objects registered with Own(). // registered with OwnDestructor() and freeing objects registered with Own().
// Any objects allocated on this arena are unusable after this call. It also // 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 // 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. // 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| // Adds |object| to a list of heap-allocated objects to be freed with |delete|
// when the arena is destroyed or reset. // when the arena is destroyed or reset.
@@ -442,7 +443,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
} }
static Arena* GetArenaForAllocationForNonMessageNonArenaConstructible( static Arena* GetArenaForAllocationForNonMessageNonArenaConstructible(
const T* p, std::false_type /*has_get_arena*/) { const T* /* p */, std::false_type /*has_get_arena*/) {
return nullptr; return nullptr;
} }
@@ -483,7 +484,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
template <typename... Args> template <typename... Args>
static T* Construct(void* ptr, Args&&... args) { static T* Construct(void* ptr, Args&&... args) {
return new (ptr) T(std::forward<Args>(args)...); return new (ptr) T(static_cast<Args&&>(args)...);
} }
static T* New() { static T* New() {
@@ -527,9 +528,9 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
InternalHelper<T>::is_arena_constructable::value, InternalHelper<T>::is_arena_constructable::value,
"CreateMessage can only construct types that are ArenaConstructable"); "CreateMessage can only construct types that are ArenaConstructable");
if (arena == NULL) { if (arena == NULL) {
return new T(nullptr, std::forward<Args>(args)...); return new T(nullptr, static_cast<Args&&>(args)...);
} else { } else {
return arena->DoCreateMessage<T>(std::forward<Args>(args)...); return arena->DoCreateMessage<T>(static_cast<Args&&>(args)...);
} }
} }
@@ -632,10 +633,12 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
CreateInArenaStorageInternal(ptr, arena, CreateInArenaStorageInternal(ptr, arena,
typename is_arena_constructable<T>::type(), typename is_arena_constructable<T>::type(),
std::forward<Args>(args)...); std::forward<Args>(args)...);
if (arena != nullptr) {
RegisterDestructorInternal( RegisterDestructorInternal(
ptr, arena, ptr, arena,
typename InternalHelper<T>::is_destructor_skippable::type()); typename InternalHelper<T>::is_destructor_skippable::type());
} }
}
template <typename T, typename... Args> template <typename T, typename... Args>
static void CreateInArenaStorageInternal(T* ptr, Arena* arena, static void CreateInArenaStorageInternal(T* ptr, Arena* arena,
@@ -788,6 +791,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
template <typename Type> template <typename Type>
friend class internal::GenericTypeHandler; friend class internal::GenericTypeHandler;
friend struct internal::ArenaStringPtr; // For AllocateAligned. friend struct internal::ArenaStringPtr; // For AllocateAligned.
friend class internal::InlinedStringField; // For AllocateAligned.
friend class internal::LazyField; // For CreateMaybeMessage. friend class internal::LazyField; // For CreateMaybeMessage.
friend class internal::EpsCopyInputStream; // For parser performance friend class internal::EpsCopyInputStream; // For parser performance
friend class MessageLite; friend class MessageLite;

View File

@@ -66,11 +66,11 @@ class PROTOBUF_EXPORT ArenaMetricsCollector {
// Invoked when the arena is about to be destroyed. This method will // Invoked when the arena is about to be destroyed. This method will
// typically finalize any metric collection and delete the collector. // typically finalize any metric collection and delete the collector.
// space_allocated is the space used by the arena. // 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. // OnReset() is called when the associated arena is reset.
// space_allocated is the space used by the arena just before the 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. // OnAlloc is called when an allocation happens.
// type_info is promised to be static - its lifetime extends to // 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 // intentionally want to avoid monitoring an allocation. (i.e. internal
// allocations for managing the arena) // allocations for managing the arena)
virtual void OnAlloc(const std::type_info* allocated_type, 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 // Does OnAlloc() need to be called? If false, metric collection overhead
// will be reduced since we will not do extra work per allocation. // will be reduced since we will not do extra work per allocation.
@@ -141,10 +141,10 @@ class PROTOBUF_EXPORT SerialArena {
Memory Free(Deallocator deallocator); Memory Free(Deallocator deallocator);
void CleanupList(); void CleanupList();
uint64 SpaceAllocated() const { uint64_t SpaceAllocated() const {
return space_allocated_.load(std::memory_order_relaxed); return space_allocated_.load(std::memory_order_relaxed);
} }
uint64 SpaceUsed() const; uint64_t SpaceUsed() const;
bool HasSpace(size_t n) { return n <= static_cast<size_t>(limit_ - ptr_); } bool HasSpace(size_t n) { return n <= static_cast<size_t>(limit_ - ptr_); }
@@ -154,6 +154,11 @@ class PROTOBUF_EXPORT SerialArena {
if (PROTOBUF_PREDICT_FALSE(!HasSpace(n))) { if (PROTOBUF_PREDICT_FALSE(!HasSpace(n))) {
return AllocateAlignedFallback(n, policy); return AllocateAlignedFallback(n, policy);
} }
return AllocateFromExisting(n);
}
private:
void* AllocateFromExisting(size_t n) {
void* ret = ptr_; void* ret = ptr_;
ptr_ += n; ptr_ += n;
#ifdef ADDRESS_SANITIZER #ifdef ADDRESS_SANITIZER
@@ -162,17 +167,13 @@ class PROTOBUF_EXPORT SerialArena {
return ret; return ret;
} }
public:
// Allocate space if the current region provides enough space. // Allocate space if the current region provides enough space.
bool MaybeAllocateAligned(size_t n, void** out) { bool MaybeAllocateAligned(size_t n, void** out) {
GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned. GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned.
GOOGLE_DCHECK_GE(limit_, ptr_); GOOGLE_DCHECK_GE(limit_, ptr_);
if (PROTOBUF_PREDICT_FALSE(!HasSpace(n))) return false; if (PROTOBUF_PREDICT_FALSE(!HasSpace(n))) return false;
void* ret = ptr_; *out = AllocateFromExisting(n);
ptr_ += n;
#ifdef ADDRESS_SANITIZER
ASAN_UNPOISON_MEMORY_REGION(ret, n);
#endif // ADDRESS_SANITIZER
*out = ret;
return true; return true;
} }
@@ -181,6 +182,12 @@ class PROTOBUF_EXPORT SerialArena {
if (PROTOBUF_PREDICT_FALSE(!HasSpace(n + kCleanupSize))) { if (PROTOBUF_PREDICT_FALSE(!HasSpace(n + kCleanupSize))) {
return AllocateAlignedWithCleanupFallback(n, policy); return AllocateAlignedWithCleanupFallback(n, policy);
} }
return AllocateFromExistingWithCleanupFallback(n);
}
private:
std::pair<void*, CleanupNode*> AllocateFromExistingWithCleanupFallback(
size_t n) {
void* ret = ptr_; void* ret = ptr_;
ptr_ += n; ptr_ += n;
limit_ -= kCleanupSize; limit_ -= kCleanupSize;
@@ -191,6 +198,7 @@ class PROTOBUF_EXPORT SerialArena {
return CreatePair(ret, reinterpret_cast<CleanupNode*>(limit_)); return CreatePair(ret, reinterpret_cast<CleanupNode*>(limit_));
} }
public:
void AddCleanup(void* elem, void (*cleanup)(void*), void AddCleanup(void* elem, void (*cleanup)(void*),
const AllocationPolicy* policy) { const AllocationPolicy* policy) {
auto res = AllocateAlignedWithCleanup(0, policy); auto res = AllocateAlignedWithCleanup(0, policy);
@@ -206,13 +214,15 @@ class PROTOBUF_EXPORT SerialArena {
// Blocks are variable length malloc-ed objects. The following structure // Blocks are variable length malloc-ed objects. The following structure
// describes the common header for all blocks. // describes the common header for all blocks.
struct Block { struct Block {
Block(Block* next, size_t size) : next(next), size(size), start(nullptr) {}
char* Pointer(size_t n) { char* Pointer(size_t n) {
GOOGLE_DCHECK(n <= size); GOOGLE_DCHECK(n <= size);
return reinterpret_cast<char*>(this) + n; return reinterpret_cast<char*>(this) + n;
} }
Block* next; Block* const next;
size_t size; const size_t size;
CleanupNode* start; CleanupNode* start;
// data follows // data follows
}; };
@@ -277,10 +287,10 @@ class PROTOBUF_EXPORT ThreadSafeArena {
// if it was passed in. // if it was passed in.
~ThreadSafeArena(); ~ThreadSafeArena();
uint64 Reset(); uint64_t Reset();
uint64 SpaceAllocated() const; uint64_t SpaceAllocated() const;
uint64 SpaceUsed() const; uint64_t SpaceUsed() const;
void* AllocateAligned(size_t n, const std::type_info* type) { void* AllocateAligned(size_t n, const std::type_info* type) {
SerialArena* arena; SerialArena* arena;
@@ -312,7 +322,7 @@ class PROTOBUF_EXPORT ThreadSafeArena {
private: private:
// Unique for each arena. Changes on Reset(). // 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. // The LSB of tag_and_id_ indicates if allocs in this arena are recorded.
enum { kRecordAllocs = 1 }; enum { kRecordAllocs = 1 };
@@ -343,7 +353,7 @@ class PROTOBUF_EXPORT ThreadSafeArena {
inline bool ShouldRecordAlloc() const { return tag_and_id_ & kRecordAllocs; } inline bool ShouldRecordAlloc() const { return tag_and_id_ & kRecordAllocs; }
inline uint64 LifeCycleId() const { inline uint64_t LifeCycleId() const {
return tag_and_id_ & (-kRecordAllocs - 1); return tag_and_id_ & (-kRecordAllocs - 1);
} }
@@ -362,7 +372,7 @@ class PROTOBUF_EXPORT ThreadSafeArena {
hint_.store(serial, std::memory_order_release); 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) { SerialArena** arena) {
if (GetSerialArenaFromThreadCache(lifecycle_id, arena)) return true; if (GetSerialArenaFromThreadCache(lifecycle_id, arena)) return true;
if (lifecycle_id & kRecordAllocs) return false; if (lifecycle_id & kRecordAllocs) return false;
@@ -379,7 +389,7 @@ class PROTOBUF_EXPORT ThreadSafeArena {
} }
PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFromThreadCache( 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. // 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 // This fast path optimizes the case where multiple threads allocate from
// the same arena. // the same arena.
@@ -427,10 +437,10 @@ class PROTOBUF_EXPORT ThreadSafeArena {
static constexpr size_t kPerThreadIds = 256; static constexpr size_t kPerThreadIds = 256;
// Next lifecycle ID available to this thread. We need to reserve a new // Next lifecycle ID available to this thread. We need to reserve a new
// batch, if `next_lifecycle_id & (kPerThreadIds - 1) == 0`. // 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 // The ThreadCache is considered valid as long as this matches the
// lifecycle_id of the arena being used. // lifecycle_id of the arena being used.
uint64 last_lifecycle_id_seen; uint64_t last_lifecycle_id_seen;
SerialArena* last_serial_arena; SerialArena* last_serial_arena;
}; };

View File

@@ -352,12 +352,15 @@ inline void ArenaStringPtr::UnsafeSetDefault(const std::string* value) {
tagged_ptr_.Set(const_cast<std::string*>(value)); tagged_ptr_.Set(const_cast<std::string*>(value));
} }
// Make sure rhs_arena allocated rhs, and lhs_arena allocated lhs.
inline PROTOBUF_NDEBUG_INLINE void ArenaStringPtr::InternalSwap( // inline PROTOBUF_NDEBUG_INLINE void ArenaStringPtr::InternalSwap( //
const std::string* default_value, // const std::string* default_value, //
ArenaStringPtr* rhs, Arena* rhs_arena, // ArenaStringPtr* rhs, Arena* rhs_arena, //
ArenaStringPtr* lhs, Arena* lhs_arena) { ArenaStringPtr* lhs, Arena* lhs_arena) {
// Silence unused variable warnings in release buildls.
(void)default_value; (void)default_value;
std::swap(lhs_arena, rhs_arena); (void)rhs_arena;
(void)lhs_arena;
std::swap(lhs->tagged_ptr_, rhs->tagged_ptr_); std::swap(lhs->tagged_ptr_, rhs->tagged_ptr_);
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
auto force_realloc = [default_value](ArenaStringPtr* p, Arena* arena) { 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; if (arena == nullptr) delete old_value;
p->tagged_ptr_.Set(new_value); p->tagged_ptr_.Set(new_value);
}; };
force_realloc(lhs, lhs_arena); // Because, at this point, tagged_ptr_ has been swapped, arena should also be
force_realloc(rhs, rhs_arena); // swapped.
force_realloc(lhs, rhs_arena);
force_realloc(rhs, lhs_arena);
#endif // PROTOBUF_FORCE_COPY_IN_SWAP #endif // PROTOBUF_FORCE_COPY_IN_SWAP
} }

View File

@@ -103,14 +103,15 @@ class PROTOC_EXPORT CodeGenerator {
GeneratorContext* generator_context, GeneratorContext* generator_context,
std::string* error) const; 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 { enum Feature {
FEATURE_PROTO3_OPTIONAL = 1, FEATURE_PROTO3_OPTIONAL = 1,
}; };
// Implement this to indicate what features this code generator supports. // 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; } virtual uint64_t GetSupportedFeatures() const { return 0; }
// This is no longer used, but this class is part of the opensource protobuf // This is no longer used, but this class is part of the opensource protobuf

View File

@@ -83,7 +83,6 @@ struct GeneratorOptions {
add_require_for_enums(false), add_require_for_enums(false),
testonly(false), testonly(false),
library(""), library(""),
error_on_name_conflict(false),
extension(".js"), extension(".js"),
one_output_file_per_input_file(false), one_output_file_per_input_file(false),
annotate_code(false) {} annotate_code(false) {}
@@ -119,8 +118,6 @@ struct GeneratorOptions {
// Create a library with name <name>_lib.js rather than a separate .js file // Create a library with name <name>_lib.js rather than a separate .js file
// per type? // per type?
std::string library; 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. // The extension to use for output file names.
std::string extension; std::string extension;
// Create a separate output file for each input file? // Create a separate output file for each input file?

View File

@@ -46,6 +46,19 @@ namespace protobuf {
namespace compiler { namespace compiler {
namespace objectivec { 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): // Generator options (see objectivec_generator.cc for a description of each):
struct Options { struct Options {
Options(); Options();
@@ -70,7 +83,7 @@ bool PROTOC_EXPORT IsRetainedName(const std::string& name);
// handling under ARC. // handling under ARC.
bool PROTOC_EXPORT IsInitName(const std::string& name); 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); std::string PROTOC_EXPORT FileClassPrefix(const FileDescriptor* file);
// Gets the path of the file we're going to generate (sans the .pb.h // Gets the path of the file we're going to generate (sans the .pb.h
@@ -296,7 +309,7 @@ class PROTOC_EXPORT ImportWriter {
ProtoFrameworkCollector(std::map<std::string, std::string>* inout_proto_file_to_framework_name) ProtoFrameworkCollector(std::map<std::string, std::string>* inout_proto_file_to_framework_name)
: 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: private:
std::map<std::string, std::string>* map_; std::map<std::string, std::string>* map_;

View File

@@ -78,6 +78,7 @@ class CodeGeneratorResponse;
PROTOC_EXPORT int PluginMain(int argc, char* argv[], PROTOC_EXPORT int PluginMain(int argc, char* argv[],
const CodeGenerator* generator); const CodeGenerator* generator);
// Generates code using the given code generator. Returns true if the code // Generates code using the given code generator. Returns true if the code
// generation is successful. If the code generation fails, error_msg may be // generation is successful. If the code generation fails, error_msg may be
// populated to describe the failure cause. // populated to describe the failure cause.

View File

@@ -8,12 +8,12 @@
#include <string> #include <string>
#include <google/protobuf/port_def.inc> #include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3017000 #if PROTOBUF_VERSION < 3018000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #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 This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.
@@ -78,10 +78,10 @@ PROTOC_EXPORT extern VersionDefaultTypeInternal _Version_default_instance_;
} // namespace compiler } // namespace compiler
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
template<> PROTOC_EXPORT PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest>(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* 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::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*); template<> PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::compiler::Version* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::compiler::Version>(Arena*);
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
namespace compiler { namespace compiler {
@@ -130,7 +130,11 @@ class PROTOC_EXPORT Version final :
} }
inline Version& operator=(Version&& from) noexcept { inline Version& operator=(Version&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -195,7 +199,7 @@ class PROTOC_EXPORT Version final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const Version& from); void MergeFrom(const Version& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;
@@ -331,7 +335,11 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
} }
inline CodeGeneratorRequest& operator=(CodeGeneratorRequest&& from) noexcept { inline CodeGeneratorRequest& operator=(CodeGeneratorRequest&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -396,7 +404,7 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const CodeGeneratorRequest& from); void MergeFrom(const CodeGeneratorRequest& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;
@@ -469,16 +477,16 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
int _internal_proto_file_size() const; int _internal_proto_file_size() const;
public: public:
void clear_proto_file(); void clear_proto_file();
PROTOBUF_NAMESPACE_ID::FileDescriptorProto* mutable_proto_file(int index); ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* mutable_proto_file(int index);
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >*
mutable_proto_file(); mutable_proto_file();
private: private:
const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& _internal_proto_file(int index) const; const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& _internal_proto_file(int index) const;
PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _internal_add_proto_file(); ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _internal_add_proto_file();
public: public:
const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& proto_file(int index) const; const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& proto_file(int index) const;
PROTOBUF_NAMESPACE_ID::FileDescriptorProto* add_proto_file(); ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* add_proto_file();
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >&
proto_file() const; proto_file() const;
// optional string parameter = 2; // optional string parameter = 2;
@@ -505,17 +513,17 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
bool _internal_has_compiler_version() const; bool _internal_has_compiler_version() const;
public: public:
void clear_compiler_version(); void clear_compiler_version();
const PROTOBUF_NAMESPACE_ID::compiler::Version& compiler_version() const; const ::PROTOBUF_NAMESPACE_ID::compiler::Version& compiler_version() const;
PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::compiler::Version* release_compiler_version(); PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::compiler::Version* release_compiler_version();
PROTOBUF_NAMESPACE_ID::compiler::Version* mutable_compiler_version(); ::PROTOBUF_NAMESPACE_ID::compiler::Version* mutable_compiler_version();
void set_allocated_compiler_version(PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version); void set_allocated_compiler_version(::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version);
private: private:
const PROTOBUF_NAMESPACE_ID::compiler::Version& _internal_compiler_version() const; const ::PROTOBUF_NAMESPACE_ID::compiler::Version& _internal_compiler_version() const;
PROTOBUF_NAMESPACE_ID::compiler::Version* _internal_mutable_compiler_version(); ::PROTOBUF_NAMESPACE_ID::compiler::Version* _internal_mutable_compiler_version();
public: public:
void unsafe_arena_set_allocated_compiler_version( void unsafe_arena_set_allocated_compiler_version(
PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version); ::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version);
PROTOBUF_NAMESPACE_ID::compiler::Version* unsafe_arena_release_compiler_version(); ::PROTOBUF_NAMESPACE_ID::compiler::Version* unsafe_arena_release_compiler_version();
// @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorRequest) // @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorRequest)
private: private:
@@ -527,9 +535,9 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string> file_to_generate_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string> 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::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; 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 { inline CodeGeneratorResponse_File& operator=(CodeGeneratorResponse_File&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -618,7 +630,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const CodeGeneratorResponse_File& from); void MergeFrom(const CodeGeneratorResponse_File& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;
@@ -721,17 +733,17 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
bool _internal_has_generated_code_info() const; bool _internal_has_generated_code_info() const;
public: public:
void clear_generated_code_info(); void clear_generated_code_info();
const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& generated_code_info() const; const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& generated_code_info() const;
PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* release_generated_code_info(); PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* release_generated_code_info();
PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* mutable_generated_code_info(); ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* mutable_generated_code_info();
void set_allocated_generated_code_info(PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info); void set_allocated_generated_code_info(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info);
private: private:
const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& _internal_generated_code_info() const; const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& _internal_generated_code_info() const;
PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* _internal_mutable_generated_code_info(); ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* _internal_mutable_generated_code_info();
public: public:
void unsafe_arena_set_allocated_generated_code_info( void unsafe_arena_set_allocated_generated_code_info(
PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info); ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info);
PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* unsafe_arena_release_generated_code_info(); ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* unsafe_arena_release_generated_code_info();
// @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse.File) // @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse.File)
private: private:
@@ -745,7 +757,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr insertion_point_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr insertion_point_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr content_; ::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; friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto;
}; };
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@@ -769,7 +781,11 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
} }
inline CodeGeneratorResponse& operator=(CodeGeneratorResponse&& from) noexcept { inline CodeGeneratorResponse& operator=(CodeGeneratorResponse&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -834,7 +850,7 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const CodeGeneratorResponse& from); void MergeFrom(const CodeGeneratorResponse& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;
@@ -914,16 +930,16 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
int _internal_file_size() const; int _internal_file_size() const;
public: public:
void clear_file(); void clear_file();
PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* mutable_file(int index); ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* mutable_file(int index);
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >* ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >*
mutable_file(); mutable_file();
private: private:
const PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& _internal_file(int index) const; const ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& _internal_file(int index) const;
PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* _internal_add_file(); ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* _internal_add_file();
public: public:
const PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& file(int index) const; const ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& file(int index) const;
PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* add_file(); ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* add_file();
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >& const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >&
file() const; file() const;
// optional string error = 1; // optional string error = 1;
@@ -966,7 +982,7 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
typedef void DestructorSkippable_; typedef void DestructorSkippable_;
::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; 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::internal::ArenaStringPtr error_;
::PROTOBUF_NAMESPACE_ID::uint64 supported_features_; ::PROTOBUF_NAMESPACE_ID::uint64 supported_features_;
friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; 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 { inline int CodeGeneratorRequest::proto_file_size() const {
return _internal_proto_file_size(); 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) // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
return proto_file_.Mutable(index); 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() { CodeGeneratorRequest::mutable_proto_file() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file) // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
return &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); 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) // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
return _internal_proto_file(index); 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(); return proto_file_.Add();
} }
inline PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() { inline ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() {
PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _add = _internal_add_proto_file(); ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _add = _internal_add_proto_file();
// @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.proto_file) // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
return _add; 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 { CodeGeneratorRequest::proto_file() const {
// @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file) // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
return proto_file_; return proto_file_;
@@ -1311,17 +1327,17 @@ inline void CodeGeneratorRequest::clear_compiler_version() {
if (compiler_version_ != nullptr) compiler_version_->Clear(); if (compiler_version_ != nullptr) compiler_version_->Clear();
_has_bits_[0] &= ~0x00000002u; _has_bits_[0] &= ~0x00000002u;
} }
inline const PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::_internal_compiler_version() const { inline const ::PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::_internal_compiler_version() const {
const PROTOBUF_NAMESPACE_ID::compiler::Version* p = compiler_version_; const ::PROTOBUF_NAMESPACE_ID::compiler::Version* p = compiler_version_;
return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::compiler::Version&>( return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::compiler::Version&>(
PROTOBUF_NAMESPACE_ID::compiler::_Version_default_instance_); ::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) // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.compiler_version)
return _internal_compiler_version(); return _internal_compiler_version();
} }
inline void CodeGeneratorRequest::unsafe_arena_set_allocated_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) { if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(compiler_version_); 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) // @@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; _has_bits_[0] &= ~0x00000002u;
PROTOBUF_NAMESPACE_ID::compiler::Version* temp = compiler_version_; ::PROTOBUF_NAMESPACE_ID::compiler::Version* temp = compiler_version_;
compiler_version_ = nullptr; compiler_version_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); 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 #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
return temp; 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) // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.compiler_version)
_has_bits_[0] &= ~0x00000002u; _has_bits_[0] &= ~0x00000002u;
PROTOBUF_NAMESPACE_ID::compiler::Version* temp = compiler_version_; ::PROTOBUF_NAMESPACE_ID::compiler::Version* temp = compiler_version_;
compiler_version_ = nullptr; compiler_version_ = nullptr;
return temp; 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; _has_bits_[0] |= 0x00000002u;
if (compiler_version_ == nullptr) { if (compiler_version_ == nullptr) {
auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::compiler::Version>(GetArenaForAllocation()); auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::compiler::Version>(GetArenaForAllocation());
compiler_version_ = p; compiler_version_ = p;
} }
return compiler_version_; return compiler_version_;
} }
inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::mutable_compiler_version() { inline ::PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::mutable_compiler_version() {
PROTOBUF_NAMESPACE_ID::compiler::Version* _msg = _internal_mutable_compiler_version(); ::PROTOBUF_NAMESPACE_ID::compiler::Version* _msg = _internal_mutable_compiler_version();
// @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.compiler_version)
return _msg; 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(); ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) { if (message_arena == nullptr) {
delete compiler_version_; delete compiler_version_;
} }
if (compiler_version) { if (compiler_version) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::compiler::Version>::GetOwningArena(compiler_version); ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::compiler::Version>::GetOwningArena(compiler_version);
if (message_arena != submessage_arena) { if (message_arena != submessage_arena) {
compiler_version = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( compiler_version = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, compiler_version, submessage_arena); 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 { inline bool CodeGeneratorResponse_File::has_generated_code_info() const {
return _internal_has_generated_code_info(); return _internal_has_generated_code_info();
} }
inline const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& CodeGeneratorResponse_File::_internal_generated_code_info() const { inline const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& CodeGeneratorResponse_File::_internal_generated_code_info() const {
const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* p = generated_code_info_; const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* p = generated_code_info_;
return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo&>( return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo&>(
PROTOBUF_NAMESPACE_ID::_GeneratedCodeInfo_default_instance_); ::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) // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info)
return _internal_generated_code_info(); return _internal_generated_code_info();
} }
inline void CodeGeneratorResponse_File::unsafe_arena_set_allocated_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) { if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(generated_code_info_); 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) // @@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; _has_bits_[0] &= ~0x00000008u;
PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* temp = generated_code_info_; ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* temp = generated_code_info_;
generated_code_info_ = nullptr; generated_code_info_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); 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 #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
return temp; 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) // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info)
_has_bits_[0] &= ~0x00000008u; _has_bits_[0] &= ~0x00000008u;
PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* temp = generated_code_info_; ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* temp = generated_code_info_;
generated_code_info_ = nullptr; generated_code_info_ = nullptr;
return temp; 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; _has_bits_[0] |= 0x00000008u;
if (generated_code_info_ == nullptr) { if (generated_code_info_ == nullptr) {
auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo>(GetArenaForAllocation()); auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo>(GetArenaForAllocation());
generated_code_info_ = p; generated_code_info_ = p;
} }
return generated_code_info_; return generated_code_info_;
} }
inline PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::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(); ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* _msg = _internal_mutable_generated_code_info();
// @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info)
return _msg; 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(); ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) { if (message_arena == nullptr) {
delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(generated_code_info_); 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() { inline void CodeGeneratorResponse::clear_file() {
file_.Clear(); 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) // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.file)
return file_.Mutable(index); 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() { CodeGeneratorResponse::mutable_file() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorResponse.file) // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorResponse.file)
return &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); 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) // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.file)
return _internal_file(index); 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(); return file_.Add();
} }
inline PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() { inline ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() {
PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* _add = _internal_add_file(); ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* _add = _internal_add_file();
// @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorResponse.file) // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorResponse.file)
return _add; 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 { CodeGeneratorResponse::file() const {
// @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorResponse.file) // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorResponse.file)
return file_; return file_;
@@ -1801,10 +1817,10 @@ PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN 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 <> template <>
inline const EnumDescriptor* GetEnumDescriptor< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature>() { inline const EnumDescriptor* GetEnumDescriptor< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature>() {
return PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature_descriptor(); return ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature_descriptor();
} }
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE

View File

@@ -62,6 +62,7 @@
#include <vector> #include <vector>
#include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/mutex.h> #include <google/protobuf/stubs/mutex.h>
#include <google/protobuf/stubs/once.h> #include <google/protobuf/stubs/once.h>
#include <google/protobuf/port.h> #include <google/protobuf/port.h>
@@ -121,7 +122,7 @@ class Reflection;
// Defined in descriptor.cc // Defined in descriptor.cc
class DescriptorBuilder; class DescriptorBuilder;
class FileDescriptorTables; class FileDescriptorTables;
struct Symbol; class Symbol;
// Defined in unknown_field_set.h. // Defined in unknown_field_set.h.
class UnknownField; class UnknownField;
@@ -182,15 +183,37 @@ struct DebugStringOptions {
// which is needed when a pool has lazily_build_dependencies_ set. // which is needed when a pool has lazily_build_dependencies_ set.
// Must be instantiated as mutable in a descriptor. // Must be instantiated as mutable in a descriptor.
namespace internal { 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 { class PROTOBUF_EXPORT LazyDescriptor {
public: public:
// Init function to be called at init time of a descriptor containing // Init function to be called at init time of a descriptor containing
// a LazyDescriptor. // a LazyDescriptor.
void Init() { void Init() {
descriptor_ = nullptr; descriptor_ = nullptr;
name_ = nullptr;
once_ = nullptr; once_ = nullptr;
file_ = nullptr;
} }
// Sets the value of the descriptor if it is known during the descriptor // Sets the value of the descriptor if it is known during the descriptor
@@ -220,10 +243,22 @@ class PROTOBUF_EXPORT LazyDescriptor {
void Once(); void Once();
const Descriptor* descriptor_; const Descriptor* descriptor_;
const std::string* name_; LazyInitData* once_;
internal::once_flag* once_;
const FileDescriptor* file_;
}; };
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 <int N>
class PROTOBUF_EXPORT SymbolBaseN : public SymbolBase {};
} // namespace internal } // namespace internal
// Describes a type of protocol message, or a particular group within a // 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 // Message::GetDescriptor(). Generated message classes also have a
// static method called descriptor() which returns the type's descriptor. // static method called descriptor() which returns the type's descriptor.
// Use DescriptorPool to construct your own descriptors. // Use DescriptorPool to construct your own descriptors.
class PROTOBUF_EXPORT Descriptor { class PROTOBUF_EXPORT Descriptor : private internal::SymbolBase {
public: public:
typedef DescriptorProto Proto; typedef DescriptorProto Proto;
@@ -500,6 +535,7 @@ class PROTOBUF_EXPORT Descriptor {
const FieldDescriptor* map_value() const; const FieldDescriptor* map_value() const;
private: private:
friend class Symbol;
typedef MessageOptions OptionsType; typedef MessageOptions OptionsType;
// Allows tests to test CopyTo(proto, true). // Allows tests to test CopyTo(proto, true).
@@ -524,8 +560,16 @@ class PROTOBUF_EXPORT Descriptor {
// to this descriptor from the file root. // to this descriptor from the file root.
void GetLocationPath(std::vector<int>* output) const; void GetLocationPath(std::vector<int>* output) const;
const std::string* name_; // True if this is a placeholder for an unknown type.
const std::string* full_name_; 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 FileDescriptor* file_;
const Descriptor* containing_type_; const Descriptor* containing_type_;
const MessageOptions* options_; const MessageOptions* options_;
@@ -540,7 +584,6 @@ class PROTOBUF_EXPORT Descriptor {
ReservedRange* reserved_ranges_; ReservedRange* reserved_ranges_;
const std::string** reserved_names_; const std::string** reserved_names_;
int field_count_;
int oneof_decl_count_; int oneof_decl_count_;
int real_oneof_decl_count_; int real_oneof_decl_count_;
int nested_type_count_; int nested_type_count_;
@@ -550,13 +593,6 @@ class PROTOBUF_EXPORT Descriptor {
int reserved_range_count_; int reserved_range_count_;
int reserved_name_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 // IMPORTANT: If you add a new field, make sure to search for all instances
// of Allocate<Descriptor>() and AllocateArray<Descriptor>() in descriptor.cc // of Allocate<Descriptor>() and AllocateArray<Descriptor>() in descriptor.cc
// and update them to initialize the field. // and update them to initialize the field.
@@ -584,7 +620,7 @@ class PROTOBUF_EXPORT Descriptor {
// - Given a DescriptorPool, call DescriptorPool::FindExtensionByNumber() or // - Given a DescriptorPool, call DescriptorPool::FindExtensionByNumber() or
// DescriptorPool::FindExtensionByPrintableName(). // DescriptorPool::FindExtensionByPrintableName().
// Use DescriptorPool to construct your own descriptors. // Use DescriptorPool to construct your own descriptors.
class PROTOBUF_EXPORT FieldDescriptor { class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase {
public: public:
typedef FieldDescriptorProto Proto; typedef FieldDescriptorProto Proto;
@@ -727,16 +763,20 @@ class PROTOBUF_EXPORT FieldDescriptor {
// Get the field default value if cpp_type() == CPPTYPE_INT32. If no // Get the field default value if cpp_type() == CPPTYPE_INT32. If no
// explicit default was defined, the default is 0. // 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 // Get the field default value if cpp_type() == CPPTYPE_INT64. If no
// explicit default was defined, the default is 0. // 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 // Get the field default value if cpp_type() == CPPTYPE_UINT32. If no
// explicit default was defined, the default is 0. // 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 // Get the field default value if cpp_type() == CPPTYPE_UINT64. If no
// explicit default was defined, the default is 0. // 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 // Get the field default value if cpp_type() == CPPTYPE_FLOAT. If no
// explicit default was defined, the default is 0.0. // explicit default was defined, the default is 0.0.
float default_value_float() const; float default_value_float() const;
@@ -835,6 +875,7 @@ class PROTOBUF_EXPORT FieldDescriptor {
bool GetSourceLocation(SourceLocation* out_location) const; bool GetSourceLocation(SourceLocation* out_location) const;
private: private:
friend class Symbol;
typedef FieldOptions OptionsType; typedef FieldOptions OptionsType;
// Allows access to GetLocationPath for annotations. // Allows access to GetLocationPath for annotations.
@@ -864,44 +905,57 @@ class PROTOBUF_EXPORT FieldDescriptor {
// Returns true if this is a map message type. // Returns true if this is a map message type.
bool is_map_message_type() const; 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 has_default_value_;
bool proto3_optional_; bool proto3_optional_;
// Whether the user has specified the json_name field option in the .proto // Whether the user has specified the json_name field option in the .proto
// file. // file.
bool has_json_name_; bool has_json_name_;
bool is_extension_; 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 number_;
int index_in_oneof_; int index_in_oneof_;
const Descriptor* containing_type_; const Descriptor* containing_type_;
const OneofDescriptor* containing_oneof_; union {
const Descriptor* extension_scope_; const OneofDescriptor* containing_oneof;
mutable const Descriptor* message_type_; const Descriptor* extension_scope;
mutable const EnumDescriptor* enum_type_; } scope_;
union {
mutable const Descriptor* message_type;
mutable const EnumDescriptor* enum_type;
} type_descriptor_;
const FieldOptions* options_; 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 // IMPORTANT: If you add a new field, make sure to search for all instances
// of Allocate<FieldDescriptor>() and AllocateArray<FieldDescriptor>() in // of Allocate<FieldDescriptor>() and AllocateArray<FieldDescriptor>() in
// descriptor.cc and update them to initialize the field. // descriptor.cc and update them to initialize the field.
union { union {
int32 default_value_int32_; int32_t default_value_int32_t_;
int64 default_value_int64_; int64_t default_value_int64_t_;
uint32 default_value_uint32_; uint32_t default_value_uint32_t_;
uint64 default_value_uint64_; uint64_t default_value_uint64_t_;
float default_value_float_; float default_value_float_;
double default_value_double_; double default_value_double_;
bool default_value_bool_; bool default_value_bool_;
@@ -930,7 +984,7 @@ class PROTOBUF_EXPORT FieldDescriptor {
// Describes a oneof defined in a message type. // Describes a oneof defined in a message type.
class PROTOBUF_EXPORT OneofDescriptor { class PROTOBUF_EXPORT OneofDescriptor : private internal::SymbolBase {
public: public:
typedef OneofDescriptorProto Proto; typedef OneofDescriptorProto Proto;
@@ -974,6 +1028,7 @@ class PROTOBUF_EXPORT OneofDescriptor {
bool GetSourceLocation(SourceLocation* out_location) const; bool GetSourceLocation(SourceLocation* out_location) const;
private: private:
friend class Symbol;
typedef OneofOptions OptionsType; typedef OneofOptions OptionsType;
// Allows access to GetLocationPath for annotations. // Allows access to GetLocationPath for annotations.
@@ -988,10 +1043,11 @@ class PROTOBUF_EXPORT OneofDescriptor {
// to this descriptor from the file root. // to this descriptor from the file root.
void GetLocationPath(std::vector<int>* output) const; void GetLocationPath(std::vector<int>* output) const;
const std::string* name_;
const std::string* full_name_;
const Descriptor* containing_type_;
int field_count_; int field_count_;
// all_names_ = [name, full_name]
const std::string* all_names_;
const Descriptor* containing_type_;
const FieldDescriptor** fields_; const FieldDescriptor** fields_;
const OneofOptions* options_; const OneofOptions* options_;
@@ -1009,7 +1065,7 @@ class PROTOBUF_EXPORT OneofDescriptor {
// Describes an enum type defined in a .proto file. To get the EnumDescriptor // Describes an enum type defined in a .proto file. To get the EnumDescriptor
// for a generated enum type, call TypeName_descriptor(). Use DescriptorPool // for a generated enum type, call TypeName_descriptor(). Use DescriptorPool
// to construct your own descriptors. // to construct your own descriptors.
class PROTOBUF_EXPORT EnumDescriptor { class PROTOBUF_EXPORT EnumDescriptor : private internal::SymbolBase {
public: public:
typedef EnumDescriptorProto Proto; typedef EnumDescriptorProto Proto;
@@ -1101,6 +1157,7 @@ class PROTOBUF_EXPORT EnumDescriptor {
bool GetSourceLocation(SourceLocation* out_location) const; bool GetSourceLocation(SourceLocation* out_location) const;
private: private:
friend class Symbol;
typedef EnumOptions OptionsType; typedef EnumOptions OptionsType;
// Allows access to GetLocationPath for annotations. // Allows access to GetLocationPath for annotations.
@@ -1126,18 +1183,18 @@ class PROTOBUF_EXPORT EnumDescriptor {
// to this descriptor from the file root. // to this descriptor from the file root.
void GetLocationPath(std::vector<int>* output) const; void GetLocationPath(std::vector<int>* 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. // True if this is a placeholder for an unknown type.
bool is_placeholder_; bool is_placeholder_;
// True if this is a placeholder and the type name wasn't fully-qualified. // True if this is a placeholder and the type name wasn't fully-qualified.
bool is_unqualified_placeholder_; bool is_unqualified_placeholder_;
int value_count_; 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_; EnumValueDescriptor* values_;
int reserved_range_count_; int reserved_range_count_;
@@ -1166,7 +1223,8 @@ class PROTOBUF_EXPORT EnumDescriptor {
// for its type, then use EnumDescriptor::FindValueByName() or // for its type, then use EnumDescriptor::FindValueByName() or
// EnumDescriptor::FindValueByNumber(). Use DescriptorPool to construct // EnumDescriptor::FindValueByNumber(). Use DescriptorPool to construct
// your own descriptors. // your own descriptors.
class PROTOBUF_EXPORT EnumValueDescriptor { class PROTOBUF_EXPORT EnumValueDescriptor : private internal::SymbolBaseN<0>,
private internal::SymbolBaseN<1> {
public: public:
typedef EnumValueDescriptorProto Proto; typedef EnumValueDescriptorProto Proto;
@@ -1209,6 +1267,7 @@ class PROTOBUF_EXPORT EnumValueDescriptor {
bool GetSourceLocation(SourceLocation* out_location) const; bool GetSourceLocation(SourceLocation* out_location) const;
private: private:
friend class Symbol;
typedef EnumValueOptions OptionsType; typedef EnumValueOptions OptionsType;
// Allows access to GetLocationPath for annotations. // Allows access to GetLocationPath for annotations.
@@ -1223,9 +1282,9 @@ class PROTOBUF_EXPORT EnumValueDescriptor {
// to this descriptor from the file root. // to this descriptor from the file root.
void GetLocationPath(std::vector<int>* output) const; void GetLocationPath(std::vector<int>* output) const;
const std::string* name_;
const std::string* full_name_;
int number_; int number_;
// all_names_ = [name, full_name]
const std::string* all_names_;
const EnumDescriptor* type_; const EnumDescriptor* type_;
const EnumValueOptions* options_; const EnumValueOptions* options_;
// IMPORTANT: If you add a new field, make sure to search for all instances // 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 // Describes an RPC service. Use DescriptorPool to construct your own
// descriptors. // descriptors.
class PROTOBUF_EXPORT ServiceDescriptor { class PROTOBUF_EXPORT ServiceDescriptor : private internal::SymbolBase {
public: public:
typedef ServiceDescriptorProto Proto; typedef ServiceDescriptorProto Proto;
@@ -1289,6 +1348,7 @@ class PROTOBUF_EXPORT ServiceDescriptor {
bool GetSourceLocation(SourceLocation* out_location) const; bool GetSourceLocation(SourceLocation* out_location) const;
private: private:
friend class Symbol;
typedef ServiceOptions OptionsType; typedef ServiceOptions OptionsType;
// Allows access to GetLocationPath for annotations. // Allows access to GetLocationPath for annotations.
@@ -1303,8 +1363,8 @@ class PROTOBUF_EXPORT ServiceDescriptor {
// to this descriptor from the file root. // to this descriptor from the file root.
void GetLocationPath(std::vector<int>* output) const; void GetLocationPath(std::vector<int>* output) const;
const std::string* name_; // all_names_ = [name, full_name]
const std::string* full_name_; const std::string* all_names_;
const FileDescriptor* file_; const FileDescriptor* file_;
const ServiceOptions* options_; const ServiceOptions* options_;
MethodDescriptor* methods_; MethodDescriptor* methods_;
@@ -1326,7 +1386,7 @@ class PROTOBUF_EXPORT ServiceDescriptor {
// a service, first get its ServiceDescriptor, then call // a service, first get its ServiceDescriptor, then call
// ServiceDescriptor::FindMethodByName(). Use DescriptorPool to construct your // ServiceDescriptor::FindMethodByName(). Use DescriptorPool to construct your
// own descriptors. // own descriptors.
class PROTOBUF_EXPORT MethodDescriptor { class PROTOBUF_EXPORT MethodDescriptor : private internal::SymbolBase {
public: public:
typedef MethodDescriptorProto Proto; typedef MethodDescriptorProto Proto;
@@ -1375,6 +1435,7 @@ class PROTOBUF_EXPORT MethodDescriptor {
bool GetSourceLocation(SourceLocation* out_location) const; bool GetSourceLocation(SourceLocation* out_location) const;
private: private:
friend class Symbol;
typedef MethodOptions OptionsType; typedef MethodOptions OptionsType;
// Allows access to GetLocationPath for annotations. // Allows access to GetLocationPath for annotations.
@@ -1389,14 +1450,14 @@ class PROTOBUF_EXPORT MethodDescriptor {
// to this descriptor from the file root. // to this descriptor from the file root.
void GetLocationPath(std::vector<int>* output) const; void GetLocationPath(std::vector<int>* output) const;
const std::string* name_; bool client_streaming_;
const std::string* full_name_; bool server_streaming_;
// all_names_ = [name, full_name]
const std::string* all_names_;
const ServiceDescriptor* service_; const ServiceDescriptor* service_;
mutable internal::LazyDescriptor input_type_; mutable internal::LazyDescriptor input_type_;
mutable internal::LazyDescriptor output_type_; mutable internal::LazyDescriptor output_type_;
const MethodOptions* options_; const MethodOptions* options_;
bool client_streaming_;
bool server_streaming_;
// IMPORTANT: If you add a new field, make sure to search for all instances // IMPORTANT: If you add a new field, make sure to search for all instances
// of Allocate<MethodDescriptor>() and AllocateArray<MethodDescriptor>() in // of Allocate<MethodDescriptor>() and AllocateArray<MethodDescriptor>() in
// descriptor.cc and update them to initialize the field. // descriptor.cc and update them to initialize the field.
@@ -1554,7 +1615,7 @@ class PROTOBUF_EXPORT FileDescriptor {
const std::string* name_; const std::string* name_;
const std::string* package_; const std::string* package_;
const DescriptorPool* pool_; const DescriptorPool* pool_;
internal::once_flag* dependencies_once_; internal::LazyInitData* dependencies_once_;
static void DependenciesOnceInit(const FileDescriptor* to_init); static void DependenciesOnceInit(const FileDescriptor* to_init);
void InternalDependenciesOnceInit() const; void InternalDependenciesOnceInit() const;
@@ -1565,17 +1626,18 @@ class PROTOBUF_EXPORT FileDescriptor {
int message_type_count_; int message_type_count_;
int enum_type_count_; int enum_type_count_;
int service_count_; int service_count_;
int extension_count_;
Syntax syntax_;
bool is_placeholder_;
bool is_placeholder_;
// Indicates the FileDescriptor is completed building. Used to verify // Indicates the FileDescriptor is completed building. Used to verify
// that type accessor functions that can possibly build a dependent file // that type accessor functions that can possibly build a dependent file
// aren't called during the process of building the file. // aren't called during the process of building the file.
bool finished_building_; 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_; mutable const FileDescriptor** dependencies_;
const std::string** dependencies_names_;
int* public_dependencies_; int* public_dependencies_;
int* weak_dependencies_; int* weak_dependencies_;
Descriptor* message_types_; Descriptor* message_types_;
@@ -1988,6 +2050,11 @@ class PROTOBUF_EXPORT DescriptorPool {
#define PROTOBUF_DEFINE_STRING_ACCESSOR(CLASS, FIELD) \ #define PROTOBUF_DEFINE_STRING_ACCESSOR(CLASS, FIELD) \
inline const std::string& CLASS::FIELD() const { return *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. // Arrays take an index parameter, obviously.
#define PROTOBUF_DEFINE_ARRAY_ACCESSOR(CLASS, FIELD, TYPE) \ #define PROTOBUF_DEFINE_ARRAY_ACCESSOR(CLASS, FIELD, TYPE) \
inline TYPE CLASS::FIELD(int index) const { return FIELD##s_ + index; } 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) \ #define PROTOBUF_DEFINE_OPTIONS_ACCESSOR(CLASS, TYPE) \
inline const TYPE& CLASS::options() const { return *options_; } inline const TYPE& CLASS::options() const { return *options_; }
PROTOBUF_DEFINE_STRING_ACCESSOR(Descriptor, name) PROTOBUF_DEFINE_NAME_ACCESSOR(Descriptor)
PROTOBUF_DEFINE_STRING_ACCESSOR(Descriptor, full_name)
PROTOBUF_DEFINE_ACCESSOR(Descriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(Descriptor, file, const FileDescriptor*)
PROTOBUF_DEFINE_ACCESSOR(Descriptor, containing_type, const Descriptor*) 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_OPTIONS_ACCESSOR(Descriptor, MessageOptions)
PROTOBUF_DEFINE_ACCESSOR(Descriptor, is_placeholder, bool) PROTOBUF_DEFINE_ACCESSOR(Descriptor, is_placeholder, bool)
PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, name) PROTOBUF_DEFINE_NAME_ACCESSOR(FieldDescriptor)
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_ACCESSOR(FieldDescriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, file, const FileDescriptor*)
PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, number, int) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, number, int)
PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, is_extension, bool) 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_type, const Descriptor*)
PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_oneof,
const OneofDescriptor*)
PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, index_in_oneof, int) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, index_in_oneof, int)
PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, extension_scope, const Descriptor*)
PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FieldDescriptor, FieldOptions) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FieldDescriptor, FieldOptions)
PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_default_value, bool) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_default_value, bool)
PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_json_name, bool) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_json_name, bool)
PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int32, int32) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int32_t, int32_t)
PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int64, int64) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int64_t, int64_t)
PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint32, uint32) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint32_t, uint32_t)
PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint64, uint64) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint64_t, uint64_t)
PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_float, float) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_float, float)
PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_double, double) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_double, double)
PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_bool, bool) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_bool, bool)
PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, default_value_string) PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, default_value_string)
PROTOBUF_DEFINE_STRING_ACCESSOR(OneofDescriptor, name) PROTOBUF_DEFINE_NAME_ACCESSOR(OneofDescriptor)
PROTOBUF_DEFINE_STRING_ACCESSOR(OneofDescriptor, full_name)
PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, containing_type, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, containing_type, const Descriptor*)
PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, field_count, int) PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, field_count, int)
PROTOBUF_DEFINE_OPTIONS_ACCESSOR(OneofDescriptor, OneofOptions) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(OneofDescriptor, OneofOptions)
PROTOBUF_DEFINE_STRING_ACCESSOR(EnumDescriptor, name) PROTOBUF_DEFINE_NAME_ACCESSOR(EnumDescriptor)
PROTOBUF_DEFINE_STRING_ACCESSOR(EnumDescriptor, full_name)
PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, file, const FileDescriptor*)
PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, containing_type, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, containing_type, const Descriptor*)
PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, value_count, int) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, value_count, int)
@@ -2071,22 +2127,19 @@ PROTOBUF_DEFINE_ARRAY_ACCESSOR(EnumDescriptor, reserved_range,
const EnumDescriptor::ReservedRange*) const EnumDescriptor::ReservedRange*)
PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, reserved_name_count, int) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, reserved_name_count, int)
PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, name) PROTOBUF_DEFINE_NAME_ACCESSOR(EnumValueDescriptor)
PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, full_name)
PROTOBUF_DEFINE_ACCESSOR(EnumValueDescriptor, number, int) PROTOBUF_DEFINE_ACCESSOR(EnumValueDescriptor, number, int)
PROTOBUF_DEFINE_ACCESSOR(EnumValueDescriptor, type, const EnumDescriptor*) PROTOBUF_DEFINE_ACCESSOR(EnumValueDescriptor, type, const EnumDescriptor*)
PROTOBUF_DEFINE_OPTIONS_ACCESSOR(EnumValueDescriptor, EnumValueOptions) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(EnumValueDescriptor, EnumValueOptions)
PROTOBUF_DEFINE_STRING_ACCESSOR(ServiceDescriptor, name) PROTOBUF_DEFINE_NAME_ACCESSOR(ServiceDescriptor)
PROTOBUF_DEFINE_STRING_ACCESSOR(ServiceDescriptor, full_name)
PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, file, const FileDescriptor*)
PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, method_count, int) PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, method_count, int)
PROTOBUF_DEFINE_ARRAY_ACCESSOR(ServiceDescriptor, method, PROTOBUF_DEFINE_ARRAY_ACCESSOR(ServiceDescriptor, method,
const MethodDescriptor*) const MethodDescriptor*)
PROTOBUF_DEFINE_OPTIONS_ACCESSOR(ServiceDescriptor, ServiceOptions) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(ServiceDescriptor, ServiceOptions)
PROTOBUF_DEFINE_STRING_ACCESSOR(MethodDescriptor, name) PROTOBUF_DEFINE_NAME_ACCESSOR(MethodDescriptor)
PROTOBUF_DEFINE_STRING_ACCESSOR(MethodDescriptor, full_name)
PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, service, const ServiceDescriptor*) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, service, const ServiceDescriptor*)
PROTOBUF_DEFINE_OPTIONS_ACCESSOR(MethodDescriptor, MethodOptions) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(MethodDescriptor, MethodOptions)
PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, client_streaming, bool) 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]; 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<Label>(label_);
}
inline FieldDescriptor::Type FieldDescriptor::type() const { inline FieldDescriptor::Type FieldDescriptor::type() const {
if (type_once_) { if (type_once_) {
internal::call_once(*type_once_, &FieldDescriptor::TypeOnceInit, this); internal::call_once(type_once_->once, &FieldDescriptor::TypeOnceInit, this);
} }
return type_; return static_cast<Type>(type_);
} }
inline bool FieldDescriptor::is_required() const { inline bool FieldDescriptor::is_required() const {
@@ -2198,9 +2276,8 @@ inline bool FieldDescriptor::has_optional_keyword() const {
} }
inline const OneofDescriptor* FieldDescriptor::real_containing_oneof() const { inline const OneofDescriptor* FieldDescriptor::real_containing_oneof() const {
return containing_oneof_ && !containing_oneof_->is_synthetic() auto* oneof = containing_oneof();
? containing_oneof_ return oneof && !oneof->is_synthetic() ? oneof : nullptr;
: nullptr;
} }
inline bool FieldDescriptor::has_presence() const { inline bool FieldDescriptor::has_presence() const {
@@ -2214,8 +2291,8 @@ inline bool FieldDescriptor::has_presence() const {
inline int FieldDescriptor::index() const { inline int FieldDescriptor::index() const {
if (!is_extension_) { if (!is_extension_) {
return static_cast<int>(this - containing_type()->fields_); return static_cast<int>(this - containing_type()->fields_);
} else if (extension_scope_ != nullptr) { } else if (extension_scope() != nullptr) {
return static_cast<int>(this - extension_scope_->extensions_); return static_cast<int>(this - extension_scope()->extensions_);
} else { } else {
return static_cast<int>(this - file_->extensions_); return static_cast<int>(this - file_->extensions_);
} }
@@ -2309,7 +2386,9 @@ inline const FileDescriptor* FileDescriptor::weak_dependency(int index) const {
return dependency(weak_dependencies_[index]); return dependency(weak_dependencies_[index]);
} }
inline FileDescriptor::Syntax FileDescriptor::syntax() const { return syntax_; } inline FileDescriptor::Syntax FileDescriptor::syntax() const {
return static_cast<Syntax>(syntax_);
}
// Can't use PROTOBUF_DEFINE_ARRAY_ACCESSOR because fields_ is actually an array // Can't use PROTOBUF_DEFINE_ARRAY_ACCESSOR because fields_ is actually an array
// of pointers rather than the usual array of objects. // of pointers rather than the usual array of objects.

File diff suppressed because it is too large Load Diff

View File

@@ -8,12 +8,12 @@
#include <string> #include <string>
#include <google/protobuf/port_def.inc> #include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3017000 #if PROTOBUF_VERSION < 3018000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #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 This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.
@@ -59,7 +59,7 @@ struct DurationDefaultTypeInternal;
PROTOBUF_EXPORT extern DurationDefaultTypeInternal _Duration_default_instance_; PROTOBUF_EXPORT extern DurationDefaultTypeInternal _Duration_default_instance_;
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Duration* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Duration>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Duration* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Duration>(Arena*);
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
@@ -84,7 +84,11 @@ class PROTOBUF_EXPORT Duration final :
} }
inline Duration& operator=(Duration&& from) noexcept { inline Duration& operator=(Duration&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -142,7 +146,7 @@ class PROTOBUF_EXPORT Duration final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const Duration& from); void MergeFrom(const Duration& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;

View File

@@ -182,23 +182,23 @@ class PROTOBUF_EXPORT DynamicMapSorter {
return first < second; return first < second;
} }
case FieldDescriptor::CPPTYPE_INT32: { case FieldDescriptor::CPPTYPE_INT32: {
int32 first = reflection->GetInt32(*a, field_); int32_t first = reflection->GetInt32(*a, field_);
int32 second = reflection->GetInt32(*b, field_); int32_t second = reflection->GetInt32(*b, field_);
return first < second; return first < second;
} }
case FieldDescriptor::CPPTYPE_INT64: { case FieldDescriptor::CPPTYPE_INT64: {
int64 first = reflection->GetInt64(*a, field_); int64_t first = reflection->GetInt64(*a, field_);
int64 second = reflection->GetInt64(*b, field_); int64_t second = reflection->GetInt64(*b, field_);
return first < second; return first < second;
} }
case FieldDescriptor::CPPTYPE_UINT32: { case FieldDescriptor::CPPTYPE_UINT32: {
uint32 first = reflection->GetUInt32(*a, field_); uint32_t first = reflection->GetUInt32(*a, field_);
uint32 second = reflection->GetUInt32(*b, field_); uint32_t second = reflection->GetUInt32(*b, field_);
return first < second; return first < second;
} }
case FieldDescriptor::CPPTYPE_UINT64: { case FieldDescriptor::CPPTYPE_UINT64: {
uint64 first = reflection->GetUInt64(*a, field_); uint64_t first = reflection->GetUInt64(*a, field_);
uint64 second = reflection->GetUInt64(*b, field_); uint64_t second = reflection->GetUInt64(*b, field_);
return first < second; return first < second;
} }
case FieldDescriptor::CPPTYPE_STRING: { case FieldDescriptor::CPPTYPE_STRING: {

View File

@@ -8,12 +8,12 @@
#include <string> #include <string>
#include <google/protobuf/port_def.inc> #include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3017000 #if PROTOBUF_VERSION < 3018000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #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 This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.
@@ -23,6 +23,7 @@
#include <google/protobuf/io/coded_stream.h> #include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/arena.h> #include <google/protobuf/arena.h>
#include <google/protobuf/arenastring.h> #include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_bases.h>
#include <google/protobuf/generated_message_table_driven.h> #include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h> #include <google/protobuf/generated_message_util.h>
#include <google/protobuf/metadata_lite.h> #include <google/protobuf/metadata_lite.h>
@@ -59,17 +60,16 @@ struct EmptyDefaultTypeInternal;
PROTOBUF_EXPORT extern EmptyDefaultTypeInternal _Empty_default_instance_; PROTOBUF_EXPORT extern EmptyDefaultTypeInternal _Empty_default_instance_;
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Empty* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Empty>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Empty* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Empty>(Arena*);
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
// =================================================================== // ===================================================================
class PROTOBUF_EXPORT Empty final : class PROTOBUF_EXPORT Empty final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Empty) */ { public ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase /* @@protoc_insertion_point(class_definition:google.protobuf.Empty) */ {
public: public:
inline Empty() : Empty(nullptr) {} inline Empty() : Empty(nullptr) {}
~Empty() override;
explicit constexpr Empty(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); explicit constexpr Empty(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
Empty(const Empty& from); Empty(const Empty& from);
@@ -84,7 +84,11 @@ class PROTOBUF_EXPORT Empty final :
} }
inline Empty& operator=(Empty&& from) noexcept { inline Empty& operator=(Empty&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -137,27 +141,15 @@ class PROTOBUF_EXPORT Empty final :
Empty* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { Empty* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<Empty>(arena); return CreateMaybeMessage<Empty>(arena);
} }
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; using ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::CopyFrom;
void CopyFrom(const Empty& from); inline void CopyFrom(const Empty& from) {
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::CopyImpl(this, from);
void MergeFrom(const Empty& from); }
private: using ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::MergeFrom;
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); void MergeFrom(const Empty& from) {
::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::MergeImpl(this, from);
}
public: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Empty* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "google.protobuf.Empty"; return "google.protobuf.Empty";
@@ -166,8 +158,6 @@ class PROTOBUF_EXPORT Empty final :
explicit Empty(::PROTOBUF_NAMESPACE_ID::Arena* arena, explicit Empty(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false); bool is_message_owned = false);
private: private:
static void ArenaDtor(void* object);
inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public: public:
static const ClassData _class_data_; static const ClassData _class_data_;

View File

@@ -53,7 +53,9 @@
#include <google/protobuf/repeated_field.h> #include <google/protobuf/repeated_field.h>
#include <google/protobuf/wire_format_lite.h> #include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/port_def.inc> // clang-format off
#include <google/protobuf/port_def.inc> // Must be last
// clang-format on
#ifdef SWIG #ifdef SWIG
#error "You cannot SWIG proto headers" #error "You cannot SWIG proto headers"
@@ -85,7 +87,7 @@ class InternalMetadata;
// #include wire_format_lite.h. Also, ensures that we use only one byte to // #include wire_format_lite.h. Also, ensures that we use only one byte to
// store these values, which is important to keep the layout of // store these values, which is important to keep the layout of
// ExtensionSet::Extension small. // ExtensionSet::Extension small.
typedef uint8 FieldType; typedef uint8_t FieldType;
// A function which, given an integer value, returns true if the number // A function which, given an integer value, returns true if the number
// matches one of the defined values for the corresponding enum type. This // matches one of the defined values for the corresponding enum type. This
@@ -99,12 +101,18 @@ typedef bool EnumValidityFuncWithArg(const void* arg, int number);
// Information about a registered extension. // Information about a registered extension.
struct ExtensionInfo { struct ExtensionInfo {
inline ExtensionInfo() {} inline ExtensionInfo() {}
inline ExtensionInfo(FieldType type_param, bool isrepeated, bool ispacked) inline ExtensionInfo(const MessageLite* extendee, int param_number,
: type(type_param), FieldType type_param, bool isrepeated, bool ispacked)
: message(extendee),
number(param_number),
type(type_param),
is_repeated(isrepeated), is_repeated(isrepeated),
is_packed(ispacked), is_packed(ispacked),
descriptor(NULL) {} descriptor(NULL) {}
const MessageLite* message;
int number;
FieldType type; FieldType type;
bool is_repeated; bool is_repeated;
bool is_packed; bool is_packed;
@@ -143,15 +151,15 @@ class PROTOBUF_EXPORT ExtensionFinder {
// files which have been compiled into the binary. // files which have been compiled into the binary.
class PROTOBUF_EXPORT GeneratedExtensionFinder : public ExtensionFinder { class PROTOBUF_EXPORT GeneratedExtensionFinder : public ExtensionFinder {
public: public:
GeneratedExtensionFinder(const MessageLite* containing_type) explicit GeneratedExtensionFinder(const MessageLite* extendee)
: containing_type_(containing_type) {} : extendee_(extendee) {}
~GeneratedExtensionFinder() override {} ~GeneratedExtensionFinder() override {}
// Returns true and fills in *output if found, otherwise returns false. // Returns true and fills in *output if found, otherwise returns false.
bool Find(int number, ExtensionInfo* output) override; bool Find(int number, ExtensionInfo* output) override;
private: private:
const MessageLite* containing_type_; const MessageLite* extendee_;
}; };
// A FieldSkipper used for parsing MessageSet. // A FieldSkipper used for parsing MessageSet.
@@ -182,24 +190,22 @@ class PROTOBUF_EXPORT ExtensionSet {
// to look up extensions for parsed field numbers. Note that dynamic parsing // to look up extensions for parsed field numbers. Note that dynamic parsing
// does not use ParseField(); only protocol-compiler-generated parsing // does not use ParseField(); only protocol-compiler-generated parsing
// methods do. // methods do.
static void RegisterExtension(const MessageLite* containing_type, int number, static void RegisterExtension(const MessageLite* extendee, int number,
FieldType type, bool is_repeated, FieldType type, bool is_repeated,
bool is_packed); bool is_packed);
static void RegisterEnumExtension(const MessageLite* containing_type, static void RegisterEnumExtension(const MessageLite* extendee, int number,
int number, FieldType type, FieldType type, bool is_repeated,
bool is_repeated, bool is_packed, bool is_packed, EnumValidityFunc* is_valid);
EnumValidityFunc* is_valid); static void RegisterMessageExtension(const MessageLite* extendee, int number,
static void RegisterMessageExtension(const MessageLite* containing_type, FieldType type, bool is_repeated,
int number, FieldType type, bool is_packed,
bool is_repeated, bool is_packed,
const MessageLite* prototype); const MessageLite* prototype);
// ================================================================= // =================================================================
// Add all fields which are currently present to the given vector. This // Add all fields which are currently present to the given vector. This
// is useful to implement Reflection::ListFields(). // is useful to implement Reflection::ListFields().
void AppendToList(const Descriptor* containing_type, void AppendToList(const Descriptor* extendee, const DescriptorPool* pool,
const DescriptorPool* pool,
std::vector<const FieldDescriptor*>* output) const; std::vector<const FieldDescriptor*>* output) const;
// ================================================================= // =================================================================
@@ -240,10 +246,10 @@ class PROTOBUF_EXPORT ExtensionSet {
// singular fields ------------------------------------------------- // singular fields -------------------------------------------------
int32 GetInt32(int number, int32 default_value) const; int32_t GetInt32(int number, int32_t default_value) const;
int64 GetInt64(int number, int64 default_value) const; int64_t GetInt64(int number, int64_t default_value) const;
uint32 GetUInt32(int number, uint32 default_value) const; uint32_t GetUInt32(int number, uint32_t default_value) const;
uint64 GetUInt64(int number, uint64 default_value) const; uint64_t GetUInt64(int number, uint64_t default_value) const;
float GetFloat(int number, float default_value) const; float GetFloat(int number, float default_value) const;
double GetDouble(int number, double default_value) const; double GetDouble(int number, double default_value) const;
bool GetBool(int number, bool default_value) const; bool GetBool(int number, bool default_value) const;
@@ -259,10 +265,10 @@ class PROTOBUF_EXPORT ExtensionSet {
// the extension lives in the same pool as the descriptor for the containing // the extension lives in the same pool as the descriptor for the containing
// type. // type.
#define desc const FieldDescriptor* descriptor // avoid line wrapping #define desc const FieldDescriptor* descriptor // avoid line wrapping
void SetInt32(int number, FieldType type, int32 value, desc); void SetInt32(int number, FieldType type, int32_t value, desc);
void SetInt64(int number, FieldType type, int64 value, desc); void SetInt64(int number, FieldType type, int64_t value, desc);
void SetUInt32(int number, FieldType type, uint32 value, desc); void SetUInt32(int number, FieldType type, uint32_t value, desc);
void SetUInt64(int number, FieldType type, uint64 value, desc); void SetUInt64(int number, FieldType type, uint64_t value, desc);
void SetFloat(int number, FieldType type, float value, desc); void SetFloat(int number, FieldType type, float value, desc);
void SetDouble(int number, FieldType type, double value, desc); void SetDouble(int number, FieldType type, double value, desc);
void SetBool(int number, FieldType type, bool value, desc); void SetBool(int number, FieldType type, bool value, desc);
@@ -312,10 +318,10 @@ class PROTOBUF_EXPORT ExtensionSet {
// (E.g.: borg/clients/internal/proto1/proto2_reflection.cc.) // (E.g.: borg/clients/internal/proto1/proto2_reflection.cc.)
void* MutableRawRepeatedField(int number); void* MutableRawRepeatedField(int number);
int32 GetRepeatedInt32(int number, int index) const; int32_t GetRepeatedInt32(int number, int index) const;
int64 GetRepeatedInt64(int number, int index) const; int64_t GetRepeatedInt64(int number, int index) const;
uint32 GetRepeatedUInt32(int number, int index) const; uint32_t GetRepeatedUInt32(int number, int index) const;
uint64 GetRepeatedUInt64(int number, int index) const; uint64_t GetRepeatedUInt64(int number, int index) const;
float GetRepeatedFloat(int number, int index) const; float GetRepeatedFloat(int number, int index) const;
double GetRepeatedDouble(int number, int index) const; double GetRepeatedDouble(int number, int index) const;
bool GetRepeatedBool(int number, int index) const; bool GetRepeatedBool(int number, int index) const;
@@ -323,10 +329,10 @@ class PROTOBUF_EXPORT ExtensionSet {
const std::string& GetRepeatedString(int number, int index) const; const std::string& GetRepeatedString(int number, int index) const;
const MessageLite& GetRepeatedMessage(int number, int index) const; const MessageLite& GetRepeatedMessage(int number, int index) const;
void SetRepeatedInt32(int number, int index, int32 value); void SetRepeatedInt32(int number, int index, int32_t value);
void SetRepeatedInt64(int number, int index, int64 value); void SetRepeatedInt64(int number, int index, int64_t value);
void SetRepeatedUInt32(int number, int index, uint32 value); void SetRepeatedUInt32(int number, int index, uint32_t value);
void SetRepeatedUInt64(int number, int index, uint64 value); void SetRepeatedUInt64(int number, int index, uint64_t value);
void SetRepeatedFloat(int number, int index, float value); void SetRepeatedFloat(int number, int index, float value);
void SetRepeatedDouble(int number, int index, double value); void SetRepeatedDouble(int number, int index, double value);
void SetRepeatedBool(int number, int index, bool value); void SetRepeatedBool(int number, int index, bool value);
@@ -336,10 +342,10 @@ class PROTOBUF_EXPORT ExtensionSet {
MessageLite* MutableRepeatedMessage(int number, int index); MessageLite* MutableRepeatedMessage(int number, int index);
#define desc const FieldDescriptor* descriptor // avoid line wrapping #define desc const FieldDescriptor* descriptor // avoid line wrapping
void AddInt32(int number, FieldType type, bool packed, int32 value, desc); void AddInt32(int number, FieldType type, bool packed, int32_t value, desc);
void AddInt64(int number, FieldType type, bool packed, int64 value, desc); void AddInt64(int number, FieldType type, bool packed, int64_t value, desc);
void AddUInt32(int number, FieldType type, bool packed, uint32 value, desc); void AddUInt32(int number, FieldType type, bool packed, uint32_t value, desc);
void AddUInt64(int number, FieldType type, bool packed, uint64 value, desc); void AddUInt64(int number, FieldType type, bool packed, uint64_t value, desc);
void AddFloat(int number, FieldType type, bool packed, float value, desc); void AddFloat(int number, FieldType type, bool packed, float value, desc);
void AddDouble(int number, FieldType type, bool packed, double value, desc); void AddDouble(int number, FieldType type, bool packed, double value, desc);
void AddBool(int number, FieldType type, bool packed, bool value, desc); void AddBool(int number, FieldType type, bool packed, bool value, desc);
@@ -352,10 +358,13 @@ class PROTOBUF_EXPORT ExtensionSet {
MessageFactory* factory); MessageFactory* factory);
void AddAllocatedMessage(const FieldDescriptor* descriptor, void AddAllocatedMessage(const FieldDescriptor* descriptor,
MessageLite* new_entry); MessageLite* new_entry);
void UnsafeArenaAddAllocatedMessage(const FieldDescriptor* descriptor,
MessageLite* new_entry);
#undef desc #undef desc
void RemoveLast(int number); void RemoveLast(int number);
PROTOBUF_MUST_USE_RESULT MessageLite* ReleaseLast(int number); PROTOBUF_MUST_USE_RESULT MessageLite* ReleaseLast(int number);
MessageLite* UnsafeArenaReleaseLast(int number);
void SwapElements(int number, int index1, int index2); void SwapElements(int number, int index1, int index2);
// ----------------------------------------------------------------- // -----------------------------------------------------------------
@@ -377,49 +386,47 @@ class PROTOBUF_EXPORT ExtensionSet {
// Parses a single extension from the input. The input should start out // Parses a single extension from the input. The input should start out
// positioned immediately after the tag. // positioned immediately after the tag.
bool ParseField(uint32 tag, io::CodedInputStream* input, bool ParseField(uint32_t tag, io::CodedInputStream* input,
ExtensionFinder* extension_finder, ExtensionFinder* extension_finder,
FieldSkipper* field_skipper); FieldSkipper* field_skipper);
// Specific versions for lite or full messages (constructs the appropriate // Specific versions for lite or full messages (constructs the appropriate
// FieldSkipper automatically). |containing_type| is the default // FieldSkipper automatically). |extendee| is the default
// instance for the containing message; it is used only to look up the // instance for the containing message; it is used only to look up the
// extension by number. See RegisterExtension(), above. Unlike the other // extension by number. See RegisterExtension(), above. Unlike the other
// methods of ExtensionSet, this only works for generated message types -- // methods of ExtensionSet, this only works for generated message types --
// it looks up extensions registered using RegisterExtension(). // it looks up extensions registered using RegisterExtension().
bool ParseField(uint32 tag, io::CodedInputStream* input, bool ParseField(uint32_t tag, io::CodedInputStream* input,
const MessageLite* containing_type); const MessageLite* extendee);
bool ParseField(uint32 tag, io::CodedInputStream* input, bool ParseField(uint32_t tag, io::CodedInputStream* input,
const Message* containing_type, const Message* extendee, UnknownFieldSet* unknown_fields);
UnknownFieldSet* unknown_fields); bool ParseField(uint32_t tag, io::CodedInputStream* input,
bool ParseField(uint32 tag, io::CodedInputStream* input, const MessageLite* extendee,
const MessageLite* containing_type,
io::CodedOutputStream* unknown_fields); io::CodedOutputStream* unknown_fields);
// Lite parser // Lite parser
const char* ParseField(uint64 tag, const char* ptr, const char* ParseField(uint64_t tag, const char* ptr,
const MessageLite* containing_type, const MessageLite* extendee,
internal::InternalMetadata* metadata, internal::InternalMetadata* metadata,
internal::ParseContext* ctx); internal::ParseContext* ctx);
// Full parser // Full parser
const char* ParseField(uint64 tag, const char* ptr, const char* ParseField(uint64_t tag, const char* ptr, const Message* extendee,
const Message* containing_type,
internal::InternalMetadata* metadata, internal::InternalMetadata* metadata,
internal::ParseContext* ctx); internal::ParseContext* ctx);
template <typename Msg> template <typename Msg>
const char* ParseMessageSet(const char* ptr, const Msg* containing_type, const char* ParseMessageSet(const char* ptr, const Msg* extendee,
InternalMetadata* metadata, InternalMetadata* metadata,
internal::ParseContext* ctx) { internal::ParseContext* ctx) {
struct MessageSetItem { struct MessageSetItem {
const char* _InternalParse(const char* ptr, ParseContext* ctx) { const char* _InternalParse(const char* ptr, ParseContext* ctx) {
return me->ParseMessageSetItem(ptr, containing_type, metadata, ctx); return me->ParseMessageSetItem(ptr, extendee, metadata, ctx);
} }
ExtensionSet* me; ExtensionSet* me;
const Msg* containing_type; const Msg* extendee;
InternalMetadata* metadata; InternalMetadata* metadata;
} item{this, containing_type, metadata}; } item{this, extendee, metadata};
while (!ctx->Done(&ptr)) { while (!ctx->Done(&ptr)) {
uint32 tag; uint32_t tag;
ptr = ReadTag(ptr, &tag); ptr = ReadTag(ptr, &tag);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
if (tag == WireFormatLite::kMessageSetItemStartTag) { if (tag == WireFormatLite::kMessageSetItemStartTag) {
@@ -430,7 +437,7 @@ class PROTOBUF_EXPORT ExtensionSet {
ctx->SetLastTag(tag); ctx->SetLastTag(tag);
return ptr; return ptr;
} }
ptr = ParseField(tag, ptr, containing_type, metadata, ctx); ptr = ParseField(tag, ptr, extendee, metadata, ctx);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
} }
} }
@@ -448,21 +455,21 @@ class PROTOBUF_EXPORT ExtensionSet {
// Specific versions for lite or full messages (constructs the appropriate // Specific versions for lite or full messages (constructs the appropriate
// FieldSkipper automatically). // FieldSkipper automatically).
bool ParseMessageSet(io::CodedInputStream* input, bool ParseMessageSet(io::CodedInputStream* input, const MessageLite* extendee,
const MessageLite* containing_type,
std::string* unknown_fields); std::string* unknown_fields);
bool ParseMessageSet(io::CodedInputStream* input, bool ParseMessageSet(io::CodedInputStream* input, const Message* extendee,
const Message* containing_type,
UnknownFieldSet* unknown_fields); UnknownFieldSet* unknown_fields);
// Write all extension fields with field numbers in the range // Write all extension fields with field numbers in the range
// [start_field_number, end_field_number) // [start_field_number, end_field_number)
// to the output stream, using the cached sizes computed when ByteSize() was // to the output stream, using the cached sizes computed when ByteSize() was
// last called. Note that the range bounds are inclusive-exclusive. // last called. Note that the range bounds are inclusive-exclusive.
void SerializeWithCachedSizes(int start_field_number, int end_field_number, void SerializeWithCachedSizes(const MessageLite* extendee,
int start_field_number, int end_field_number,
io::CodedOutputStream* output) const { io::CodedOutputStream* output) const {
output->SetCur(_InternalSerialize(start_field_number, end_field_number, output->SetCur(_InternalSerialize(extendee, start_field_number,
output->Cur(), output->EpsCopy())); end_field_number, output->Cur(),
output->EpsCopy()));
} }
// Same as SerializeWithCachedSizes, but without any bounds checking. // Same as SerializeWithCachedSizes, but without any bounds checking.
@@ -470,32 +477,37 @@ class PROTOBUF_EXPORT ExtensionSet {
// serialized extensions. // serialized extensions.
// //
// Returns a pointer past the last written byte. // Returns a pointer past the last written byte.
uint8* _InternalSerialize(int start_field_number, int end_field_number,
uint8* target, uint8_t* _InternalSerialize(const MessageLite* extendee,
int start_field_number, int end_field_number,
uint8_t* target,
io::EpsCopyOutputStream* stream) const { io::EpsCopyOutputStream* stream) const {
if (flat_size_ == 0) { if (flat_size_ == 0) {
assert(!is_large()); assert(!is_large());
return target; return target;
} }
return _InternalSerializeImpl(start_field_number, end_field_number, target, return _InternalSerializeImpl(extendee, start_field_number,
stream); end_field_number, target, stream);
} }
// Like above but serializes in MessageSet format. // Like above but serializes in MessageSet format.
void SerializeMessageSetWithCachedSizes(io::CodedOutputStream* output) const { void SerializeMessageSetWithCachedSizes(const MessageLite* extendee,
io::CodedOutputStream* output) const {
output->SetCur(InternalSerializeMessageSetWithCachedSizesToArray( output->SetCur(InternalSerializeMessageSetWithCachedSizesToArray(
output->Cur(), output->EpsCopy())); extendee, output->Cur(), output->EpsCopy()));
} }
uint8* InternalSerializeMessageSetWithCachedSizesToArray( uint8_t* InternalSerializeMessageSetWithCachedSizesToArray(
uint8* target, io::EpsCopyOutputStream* stream) const; const MessageLite* extendee, uint8_t* target,
io::EpsCopyOutputStream* stream) const;
// For backward-compatibility, versions of two of the above methods that // For backward-compatibility, versions of two of the above methods that
// serialize deterministically iff SetDefaultSerializationDeterministic() // serialize deterministically iff SetDefaultSerializationDeterministic()
// has been called. // has been called.
uint8* SerializeWithCachedSizesToArray(int start_field_number, uint8_t* SerializeWithCachedSizesToArray(int start_field_number,
int end_field_number, int end_field_number,
uint8* target) const; uint8_t* target) const;
uint8* SerializeMessageSetWithCachedSizesToArray(uint8* target) const; uint8_t* SerializeMessageSetWithCachedSizesToArray(
const MessageLite* extendee, uint8_t* target) const;
// Returns the total serialized size of all the extensions. // Returns the total serialized size of all the extensions.
size_t ByteSize() const; size_t ByteSize() const;
@@ -520,9 +532,39 @@ class PROTOBUF_EXPORT ExtensionSet {
int SpaceUsedExcludingSelf() const; int SpaceUsedExcludingSelf() const;
private: private:
template <typename Type>
friend class PrimitiveTypeTraits;
template <typename Type>
friend class RepeatedPrimitiveTypeTraits;
template <typename Type, bool IsValid(int)>
friend class EnumTypeTraits;
template <typename Type, bool IsValid(int)>
friend class RepeatedEnumTypeTraits;
const int32_t& GetRefInt32(int number, const int32_t& default_value) const;
const int64_t& GetRefInt64(int number, const int64_t& default_value) const;
const uint32_t& GetRefUInt32(int number, const uint32_t& default_value) const;
const uint64_t& GetRefUInt64(int number, const uint64_t& default_value) const;
const float& GetRefFloat(int number, const float& default_value) const;
const double& GetRefDouble(int number, const double& default_value) const;
const bool& GetRefBool(int number, const bool& default_value) const;
const int& GetRefEnum(int number, const int& default_value) const;
const int32_t& GetRefRepeatedInt32(int number, int index) const;
const int64_t& GetRefRepeatedInt64(int number, int index) const;
const uint32_t& GetRefRepeatedUInt32(int number, int index) const;
const uint64_t& GetRefRepeatedUInt64(int number, int index) const;
const float& GetRefRepeatedFloat(int number, int index) const;
const double& GetRefRepeatedDouble(int number, int index) const;
const bool& GetRefRepeatedBool(int number, int index) const;
const int& GetRefRepeatedEnum(int number, int index) const;
// Implementation of _InternalSerialize for non-empty map_. // Implementation of _InternalSerialize for non-empty map_.
uint8* _InternalSerializeImpl(int start_field_number, int end_field_number, uint8_t* _InternalSerializeImpl(const MessageLite* extendee,
uint8* target, int start_field_number, int end_field_number,
uint8_t* target,
io::EpsCopyOutputStream* stream) const; io::EpsCopyOutputStream* stream) const;
// Interface of a lazily parsed singular message extension. // Interface of a lazily parsed singular message extension.
class PROTOBUF_EXPORT LazyMessageExtension { class PROTOBUF_EXPORT LazyMessageExtension {
@@ -533,7 +575,8 @@ class PROTOBUF_EXPORT ExtensionSet {
virtual LazyMessageExtension* New(Arena* arena) const = 0; virtual LazyMessageExtension* New(Arena* arena) const = 0;
virtual const MessageLite& GetMessage( virtual const MessageLite& GetMessage(
const MessageLite& prototype) const = 0; const MessageLite& prototype) const = 0;
virtual MessageLite* MutableMessage(const MessageLite& prototype) = 0; virtual MessageLite* MutableMessage(const MessageLite& prototype,
Arena* arena) = 0;
virtual void SetAllocatedMessage(MessageLite* message) = 0; virtual void SetAllocatedMessage(MessageLite* message) = 0;
virtual void UnsafeArenaSetAllocatedMessage(MessageLite* message) = 0; virtual void UnsafeArenaSetAllocatedMessage(MessageLite* message) = 0;
virtual PROTOBUF_MUST_USE_RESULT MessageLite* ReleaseMessage( virtual PROTOBUF_MUST_USE_RESULT MessageLite* ReleaseMessage(
@@ -548,28 +591,32 @@ class PROTOBUF_EXPORT ExtensionSet {
virtual size_t ByteSizeLong() const = 0; virtual size_t ByteSizeLong() const = 0;
virtual size_t SpaceUsedLong() const = 0; virtual size_t SpaceUsedLong() const = 0;
virtual void MergeFrom(const LazyMessageExtension& other) = 0; virtual void MergeFrom(const LazyMessageExtension& other, Arena* arena) = 0;
virtual void MergeFromMessage(const MessageLite& msg, Arena* arena) = 0;
virtual void Clear() = 0; virtual void Clear() = 0;
virtual bool ReadMessage(const MessageLite& prototype, virtual bool ReadMessage(const MessageLite& prototype,
io::CodedInputStream* input) = 0; io::CodedInputStream* input) = 0;
virtual const char* _InternalParse(const char* ptr, ParseContext* ctx) = 0; virtual const char* _InternalParse(const char* ptr, ParseContext* ctx) = 0;
virtual uint8* WriteMessageToArray( virtual uint8_t* WriteMessageToArray(
int number, uint8* target, io::EpsCopyOutputStream* stream) const = 0; const MessageLite* prototype, int number, uint8_t* target,
io::EpsCopyOutputStream* stream) const = 0;
private: private:
virtual void UnusedKeyMethod(); // Dummy key method to avoid weak vtable. virtual void UnusedKeyMethod(); // Dummy key method to avoid weak vtable.
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(LazyMessageExtension); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(LazyMessageExtension);
}; };
// Give access to function defined below to see LazyMessageExtension.
friend LazyMessageExtension* MaybeCreateLazyExtension(Arena* arena);
struct Extension { struct Extension {
// The order of these fields packs Extension into 24 bytes when using 8 // The order of these fields packs Extension into 24 bytes when using 8
// byte alignment. Consider this when adding or removing fields here. // byte alignment. Consider this when adding or removing fields here.
union { union {
int32 int32_value; int32_t int32_t_value;
int64 int64_value; int64_t int64_t_value;
uint32 uint32_value; uint32_t uint32_t_value;
uint64 uint64_value; uint64_t uint64_t_value;
float float_value; float float_value;
double double_value; double double_value;
bool bool_value; bool bool_value;
@@ -578,10 +625,10 @@ class PROTOBUF_EXPORT ExtensionSet {
MessageLite* message_value; MessageLite* message_value;
LazyMessageExtension* lazymessage_value; LazyMessageExtension* lazymessage_value;
RepeatedField<int32>* repeated_int32_value; RepeatedField<int32_t>* repeated_int32_t_value;
RepeatedField<int64>* repeated_int64_value; RepeatedField<int64_t>* repeated_int64_t_value;
RepeatedField<uint32>* repeated_uint32_value; RepeatedField<uint32_t>* repeated_uint32_t_value;
RepeatedField<uint64>* repeated_uint64_value; RepeatedField<uint64_t>* repeated_uint64_t_value;
RepeatedField<float>* repeated_float_value; RepeatedField<float>* repeated_float_value;
RepeatedField<double>* repeated_double_value; RepeatedField<double>* repeated_double_value;
RepeatedField<bool>* repeated_bool_value; RepeatedField<bool>* repeated_bool_value;
@@ -622,10 +669,12 @@ class PROTOBUF_EXPORT ExtensionSet {
const FieldDescriptor* descriptor; const FieldDescriptor* descriptor;
// Some helper methods for operations on a single Extension. // Some helper methods for operations on a single Extension.
uint8* InternalSerializeFieldWithCachedSizesToArray( uint8_t* InternalSerializeFieldWithCachedSizesToArray(
int number, uint8* target, io::EpsCopyOutputStream* stream) const; const MessageLite* extendee, const ExtensionSet* extension_set,
uint8* InternalSerializeMessageSetItemWithCachedSizesToArray( int number, uint8_t* target, io::EpsCopyOutputStream* stream) const;
int number, uint8* target, io::EpsCopyOutputStream* stream) const; uint8_t* InternalSerializeMessageSetItemWithCachedSizesToArray(
const MessageLite* extendee, const ExtensionSet* extension_set,
int number, uint8_t* target, io::EpsCopyOutputStream* stream) const;
size_t ByteSize(int number) const; size_t ByteSize(int number) const;
size_t MessageSetItemByteSize(int number) const; size_t MessageSetItemByteSize(int number) const;
void Clear(); void Clear();
@@ -678,8 +727,8 @@ class PROTOBUF_EXPORT ExtensionSet {
// Grows the flat_capacity_. // Grows the flat_capacity_.
// If flat_capacity_ > kMaximumFlatCapacity, converts to LargeMap. // If flat_capacity_ > kMaximumFlatCapacity, converts to LargeMap.
void GrowCapacity(size_t minimum_new_capacity); void GrowCapacity(size_t minimum_new_capacity);
static constexpr uint16 kMaximumFlatCapacity = 256; static constexpr uint16_t kMaximumFlatCapacity = 256;
bool is_large() const { return flat_capacity_ > kMaximumFlatCapacity; } bool is_large() const { return static_cast<int16_t>(flat_size_) < 0; }
// Removes a key from the ExtensionSet. // Removes a key from the ExtensionSet.
void Erase(int key); void Erase(int key);
@@ -723,7 +772,7 @@ class PROTOBUF_EXPORT ExtensionSet {
// Note to support packed repeated field compatibility, it also fills whether // Note to support packed repeated field compatibility, it also fills whether
// the tag on wire is packed, which can be different from // the tag on wire is packed, which can be different from
// extension->is_packed (whether packed=true is specified). // extension->is_packed (whether packed=true is specified).
bool FindExtensionInfoFromTag(uint32 tag, ExtensionFinder* extension_finder, bool FindExtensionInfoFromTag(uint32_t tag, ExtensionFinder* extension_finder,
int* field_number, ExtensionInfo* extension, int* field_number, ExtensionInfo* extension,
bool* was_packed_on_wire); bool* was_packed_on_wire);
@@ -734,7 +783,12 @@ class PROTOBUF_EXPORT ExtensionSet {
bool FindExtensionInfoFromFieldNumber(int wire_type, int field_number, bool FindExtensionInfoFromFieldNumber(int wire_type, int field_number,
ExtensionFinder* extension_finder, ExtensionFinder* extension_finder,
ExtensionInfo* extension, ExtensionInfo* extension,
bool* was_packed_on_wire); bool* was_packed_on_wire) const;
// Find the prototype for a LazyMessage from the extension registry. Returns
// null if the extension is not found.
const MessageLite* GetPrototypeForLazyMessage(const MessageLite* extendee,
int number) const;
// Parses a single extension from the input. The input should start out // Parses a single extension from the input. The input should start out
// positioned immediately after the wire tag. This method is called in // positioned immediately after the wire tag. This method is called in
@@ -772,36 +826,33 @@ class PROTOBUF_EXPORT ExtensionSet {
ExtensionFinder* extension_finder, ExtensionFinder* extension_finder,
MessageSetFieldSkipper* field_skipper); MessageSetFieldSkipper* field_skipper);
bool FindExtension(int wire_type, uint32 field, bool FindExtension(int wire_type, uint32_t field, const MessageLite* extendee,
const MessageLite* containing_type,
const internal::ParseContext* /*ctx*/, const internal::ParseContext* /*ctx*/,
ExtensionInfo* extension, bool* was_packed_on_wire) { ExtensionInfo* extension, bool* was_packed_on_wire) {
GeneratedExtensionFinder finder(containing_type); GeneratedExtensionFinder finder(extendee);
return FindExtensionInfoFromFieldNumber(wire_type, field, &finder, return FindExtensionInfoFromFieldNumber(wire_type, field, &finder,
extension, was_packed_on_wire); extension, was_packed_on_wire);
} }
inline bool FindExtension(int wire_type, uint32 field, inline bool FindExtension(int wire_type, uint32_t field,
const Message* containing_type, const Message* extendee,
const internal::ParseContext* ctx, const internal::ParseContext* ctx,
ExtensionInfo* extension, bool* was_packed_on_wire); ExtensionInfo* extension, bool* was_packed_on_wire);
// Used for MessageSet only // Used for MessageSet only
const char* ParseFieldMaybeLazily(uint64 tag, const char* ptr, const char* ParseFieldMaybeLazily(uint64_t tag, const char* ptr,
const MessageLite* containing_type, const MessageLite* extendee,
internal::InternalMetadata* metadata, internal::InternalMetadata* metadata,
internal::ParseContext* ctx) { internal::ParseContext* ctx) {
// Lite MessageSet doesn't implement lazy. // Lite MessageSet doesn't implement lazy.
return ParseField(tag, ptr, containing_type, metadata, ctx); return ParseField(tag, ptr, extendee, metadata, ctx);
} }
const char* ParseFieldMaybeLazily(uint64 tag, const char* ptr, const char* ParseFieldMaybeLazily(uint64_t tag, const char* ptr,
const Message* containing_type, const Message* extendee,
internal::InternalMetadata* metadata, internal::InternalMetadata* metadata,
internal::ParseContext* ctx); internal::ParseContext* ctx);
const char* ParseMessageSetItem(const char* ptr, const char* ParseMessageSetItem(const char* ptr, const MessageLite* extendee,
const MessageLite* containing_type,
internal::InternalMetadata* metadata, internal::InternalMetadata* metadata,
internal::ParseContext* ctx); internal::ParseContext* ctx);
const char* ParseMessageSetItem(const char* ptr, const char* ParseMessageSetItem(const char* ptr, const Message* extendee,
const Message* containing_type,
internal::InternalMetadata* metadata, internal::InternalMetadata* metadata,
internal::ParseContext* ctx); internal::ParseContext* ctx);
@@ -813,8 +864,7 @@ class PROTOBUF_EXPORT ExtensionSet {
const char* ptr, const char* ptr,
internal::ParseContext* ctx); internal::ParseContext* ctx);
template <typename Msg, typename T> template <typename Msg, typename T>
const char* ParseMessageSetItemTmpl(const char* ptr, const char* ParseMessageSetItemTmpl(const char* ptr, const Msg* extendee,
const Msg* containing_type,
internal::InternalMetadata* metadata, internal::InternalMetadata* metadata,
internal::ParseContext* ctx); internal::ParseContext* ctx);
@@ -850,8 +900,8 @@ class PROTOBUF_EXPORT ExtensionSet {
// Manual memory-management: // Manual memory-management:
// map_.flat is an allocated array of flat_capacity_ elements. // map_.flat is an allocated array of flat_capacity_ elements.
// [map_.flat, map_.flat + flat_size_) is the currently-in-use prefix. // [map_.flat, map_.flat + flat_size_) is the currently-in-use prefix.
uint16 flat_capacity_; uint16_t flat_capacity_;
uint16 flat_size_; uint16_t flat_size_; // negative int16_t(flat_size_) indicates is_large()
union AllocatedData { union AllocatedData {
KeyValue* flat; KeyValue* flat;
@@ -860,7 +910,7 @@ class PROTOBUF_EXPORT ExtensionSet {
LargeMap* large; LargeMap* large;
} map_; } map_;
static void DeleteFlatMap(const KeyValue* flat, uint16 flat_capacity); static void DeleteFlatMap(const KeyValue* flat, uint16_t flat_capacity);
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionSet); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionSet);
}; };
@@ -937,7 +987,7 @@ inline void ExtensionSet::AddString(int number, FieldType type,
// For example, if "foo" is an extension of type "optional int32", then if you // For example, if "foo" is an extension of type "optional int32", then if you
// try to write code like: // try to write code like:
// my_message.MutableExtension(foo) // my_message.MutableExtension(foo)
// you will get a compile error because PrimitiveTypeTraits<int32> does not // you will get a compile error because PrimitiveTypeTraits<int32_t> does not
// have a "Mutable()" method. // have a "Mutable()" method.
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@@ -955,6 +1005,9 @@ class PrimitiveTypeTraits {
static inline ConstType Get(int number, const ExtensionSet& set, static inline ConstType Get(int number, const ExtensionSet& set,
ConstType default_value); ConstType default_value);
static inline const ConstType* GetPtr(int number, const ExtensionSet& set,
const ConstType& default_value);
static inline void Set(int number, FieldType field_type, ConstType value, static inline void Set(int number, FieldType field_type, ConstType value,
ExtensionSet* set); ExtensionSet* set);
template <typename ExtendeeT> template <typename ExtendeeT>
@@ -974,6 +1027,10 @@ class RepeatedPrimitiveTypeTraits {
typedef RepeatedField<Type> RepeatedFieldType; typedef RepeatedField<Type> RepeatedFieldType;
static inline Type Get(int number, const ExtensionSet& set, int index); static inline Type Get(int number, const ExtensionSet& set, int index);
static inline const Type* GetPtr(int number, const ExtensionSet& set,
int index);
static inline const RepeatedField<ConstType>* GetRepeatedPtr(
int number, const ExtensionSet& set);
static inline void Set(int number, int index, Type value, ExtensionSet* set); static inline void Set(int number, int index, Type value, ExtensionSet* set);
static inline void Add(int number, FieldType field_type, bool is_packed, static inline void Add(int number, FieldType field_type, bool is_packed,
Type value, ExtensionSet* set); Type value, ExtensionSet* set);
@@ -998,10 +1055,10 @@ class PROTOBUF_EXPORT RepeatedPrimitiveDefaults {
template <typename Type> template <typename Type>
friend class RepeatedPrimitiveTypeTraits; friend class RepeatedPrimitiveTypeTraits;
static const RepeatedPrimitiveDefaults* default_instance(); static const RepeatedPrimitiveDefaults* default_instance();
RepeatedField<int32> default_repeated_field_int32_; RepeatedField<int32_t> default_repeated_field_int32_t_;
RepeatedField<int64> default_repeated_field_int64_; RepeatedField<int64_t> default_repeated_field_int64_t_;
RepeatedField<uint32> default_repeated_field_uint32_; RepeatedField<uint32_t> default_repeated_field_uint32_t_;
RepeatedField<uint64> default_repeated_field_uint64_; RepeatedField<uint64_t> default_repeated_field_uint64_t_;
RepeatedField<double> default_repeated_field_double_; RepeatedField<double> default_repeated_field_double_;
RepeatedField<float> default_repeated_field_float_; RepeatedField<float> default_repeated_field_float_;
RepeatedField<bool> default_repeated_field_bool_; RepeatedField<bool> default_repeated_field_bool_;
@@ -1014,6 +1071,11 @@ class PROTOBUF_EXPORT RepeatedPrimitiveDefaults {
return set.Get##METHOD(number, default_value); \ return set.Get##METHOD(number, default_value); \
} \ } \
template <> \ template <> \
inline const TYPE* PrimitiveTypeTraits<TYPE>::GetPtr( \
int number, const ExtensionSet& set, const TYPE& default_value) { \
return &set.GetRef##METHOD(number, default_value); \
} \
template <> \
inline void PrimitiveTypeTraits<TYPE>::Set(int number, FieldType field_type, \ inline void PrimitiveTypeTraits<TYPE>::Set(int number, FieldType field_type, \
TYPE value, ExtensionSet* set) { \ TYPE value, ExtensionSet* set) { \
set->Set##METHOD(number, field_type, value, NULL); \ set->Set##METHOD(number, field_type, value, NULL); \
@@ -1025,6 +1087,11 @@ class PROTOBUF_EXPORT RepeatedPrimitiveDefaults {
return set.GetRepeated##METHOD(number, index); \ return set.GetRepeated##METHOD(number, index); \
} \ } \
template <> \ template <> \
inline const TYPE* RepeatedPrimitiveTypeTraits<TYPE>::GetPtr( \
int number, const ExtensionSet& set, int index) { \
return &set.GetRefRepeated##METHOD(number, index); \
} \
template <> \
inline void RepeatedPrimitiveTypeTraits<TYPE>::Set( \ inline void RepeatedPrimitiveTypeTraits<TYPE>::Set( \
int number, int index, TYPE value, ExtensionSet* set) { \ int number, int index, TYPE value, ExtensionSet* set) { \
set->SetRepeated##METHOD(number, index, value); \ set->SetRepeated##METHOD(number, index, value); \
@@ -1049,6 +1116,12 @@ class PROTOBUF_EXPORT RepeatedPrimitiveDefaults {
set.GetRawRepeatedField(number, GetDefaultRepeatedField())); \ set.GetRawRepeatedField(number, GetDefaultRepeatedField())); \
} \ } \
template <> \ template <> \
inline const RepeatedField<TYPE>* \
RepeatedPrimitiveTypeTraits<TYPE>::GetRepeatedPtr(int number, \
const ExtensionSet& set) { \
return &GetRepeated(number, set); \
} \
template <> \
inline RepeatedField<TYPE>* \ inline RepeatedField<TYPE>* \
RepeatedPrimitiveTypeTraits<TYPE>::MutableRepeated( \ RepeatedPrimitiveTypeTraits<TYPE>::MutableRepeated( \
int number, FieldType field_type, bool is_packed, ExtensionSet* set) { \ int number, FieldType field_type, bool is_packed, ExtensionSet* set) { \
@@ -1056,10 +1129,10 @@ class PROTOBUF_EXPORT RepeatedPrimitiveDefaults {
set->MutableRawRepeatedField(number, field_type, is_packed, NULL)); \ set->MutableRawRepeatedField(number, field_type, is_packed, NULL)); \
} }
PROTOBUF_DEFINE_PRIMITIVE_TYPE(int32, Int32) PROTOBUF_DEFINE_PRIMITIVE_TYPE(int32_t, Int32)
PROTOBUF_DEFINE_PRIMITIVE_TYPE(int64, Int64) PROTOBUF_DEFINE_PRIMITIVE_TYPE(int64_t, Int64)
PROTOBUF_DEFINE_PRIMITIVE_TYPE(uint32, UInt32) PROTOBUF_DEFINE_PRIMITIVE_TYPE(uint32_t, UInt32)
PROTOBUF_DEFINE_PRIMITIVE_TYPE(uint64, UInt64) PROTOBUF_DEFINE_PRIMITIVE_TYPE(uint64_t, UInt64)
PROTOBUF_DEFINE_PRIMITIVE_TYPE(float, Float) PROTOBUF_DEFINE_PRIMITIVE_TYPE(float, Float)
PROTOBUF_DEFINE_PRIMITIVE_TYPE(double, Double) PROTOBUF_DEFINE_PRIMITIVE_TYPE(double, Double)
PROTOBUF_DEFINE_PRIMITIVE_TYPE(bool, Bool) PROTOBUF_DEFINE_PRIMITIVE_TYPE(bool, Bool)
@@ -1080,6 +1153,10 @@ class PROTOBUF_EXPORT StringTypeTraits {
ConstType default_value) { ConstType default_value) {
return set.GetString(number, default_value); return set.GetString(number, default_value);
} }
static inline const std::string* GetPtr(int number, const ExtensionSet& set,
ConstType default_value) {
return &Get(number, set, default_value);
}
static inline void Set(int number, FieldType field_type, static inline void Set(int number, FieldType field_type,
const std::string& value, ExtensionSet* set) { const std::string& value, ExtensionSet* set) {
set->SetString(number, field_type, value, NULL); set->SetString(number, field_type, value, NULL);
@@ -1107,6 +1184,14 @@ class PROTOBUF_EXPORT RepeatedStringTypeTraits {
int index) { int index) {
return set.GetRepeatedString(number, index); return set.GetRepeatedString(number, index);
} }
static inline const std::string* GetPtr(int number, const ExtensionSet& set,
int index) {
return &Get(number, set, index);
}
static inline const RepeatedPtrField<std::string>* GetRepeatedPtr(
int number, const ExtensionSet& set) {
return &GetRepeated(number, set);
}
static inline void Set(int number, int index, const std::string& value, static inline void Set(int number, int index, const std::string& value,
ExtensionSet* set) { ExtensionSet* set) {
set->SetRepeatedString(number, index, value); set->SetRepeatedString(number, index, value);
@@ -1163,6 +1248,11 @@ class EnumTypeTraits {
ConstType default_value) { ConstType default_value) {
return static_cast<Type>(set.GetEnum(number, default_value)); return static_cast<Type>(set.GetEnum(number, default_value));
} }
static inline const ConstType* GetPtr(int number, const ExtensionSet& set,
const ConstType& default_value) {
return reinterpret_cast<const Type*>(
&set.GetRefEnum(number, default_value));
}
static inline void Set(int number, FieldType field_type, ConstType value, static inline void Set(int number, FieldType field_type, ConstType value,
ExtensionSet* set) { ExtensionSet* set) {
GOOGLE_DCHECK(IsValid(value)); GOOGLE_DCHECK(IsValid(value));
@@ -1187,6 +1277,11 @@ class RepeatedEnumTypeTraits {
static inline ConstType Get(int number, const ExtensionSet& set, int index) { static inline ConstType Get(int number, const ExtensionSet& set, int index) {
return static_cast<Type>(set.GetRepeatedEnum(number, index)); return static_cast<Type>(set.GetRepeatedEnum(number, index));
} }
static inline const ConstType* GetPtr(int number, const ExtensionSet& set,
int index) {
return reinterpret_cast<const Type*>(
&set.GetRefRepeatedEnum(number, index));
}
static inline void Set(int number, int index, ConstType value, static inline void Set(int number, int index, ConstType value,
ExtensionSet* set) { ExtensionSet* set) {
GOOGLE_DCHECK(IsValid(value)); GOOGLE_DCHECK(IsValid(value));
@@ -1206,7 +1301,10 @@ class RepeatedEnumTypeTraits {
return *reinterpret_cast<const RepeatedField<Type>*>( return *reinterpret_cast<const RepeatedField<Type>*>(
set.GetRawRepeatedField(number, GetDefaultRepeatedField())); set.GetRawRepeatedField(number, GetDefaultRepeatedField()));
} }
static inline const RepeatedField<Type>* GetRepeatedPtr(
int number, const ExtensionSet& set) {
return &GetRepeated(number, set);
}
static inline RepeatedField<Type>* MutableRepeated(int number, static inline RepeatedField<Type>* MutableRepeated(int number,
FieldType field_type, FieldType field_type,
bool is_packed, bool is_packed,
@@ -1220,10 +1318,10 @@ class RepeatedEnumTypeTraits {
// RepeatedField<int>. We need to be able to instantiate global static // RepeatedField<int>. We need to be able to instantiate global static
// objects to return as default (empty) repeated fields on non-existent // objects to return as default (empty) repeated fields on non-existent
// extensions. We would not be able to know a-priori all of the enum types // extensions. We would not be able to know a-priori all of the enum types
// (values of |Type|) to instantiate all of these, so we just re-use int32's // (values of |Type|) to instantiate all of these, so we just re-use
// default repeated field object. // int32_t's default repeated field object.
return reinterpret_cast<const RepeatedField<Type>*>( return reinterpret_cast<const RepeatedField<Type>*>(
RepeatedPrimitiveTypeTraits<int32>::GetDefaultRepeatedField()); RepeatedPrimitiveTypeTraits<int32_t>::GetDefaultRepeatedField());
} }
template <typename ExtendeeT> template <typename ExtendeeT>
static void Register(int number, FieldType type, bool is_packed) { static void Register(int number, FieldType type, bool is_packed) {
@@ -1249,6 +1347,11 @@ class MessageTypeTraits {
ConstType default_value) { ConstType default_value) {
return static_cast<const Type&>(set.GetMessage(number, default_value)); return static_cast<const Type&>(set.GetMessage(number, default_value));
} }
static inline std::nullptr_t GetPtr(int number, const ExtensionSet& set,
ConstType default_value) {
// Cannot be implemented because of forward declared messages?
return nullptr;
}
static inline MutableType Mutable(int number, FieldType field_type, static inline MutableType Mutable(int number, FieldType field_type,
ExtensionSet* set) { ExtensionSet* set) {
return static_cast<Type*>(set->MutableMessage( return static_cast<Type*>(set->MutableMessage(
@@ -1282,7 +1385,7 @@ class MessageTypeTraits {
} }
}; };
// forward declaration // forward declaration.
class RepeatedMessageGenericTypeTraits; class RepeatedMessageGenericTypeTraits;
template <typename Type> template <typename Type>
@@ -1297,6 +1400,16 @@ class RepeatedMessageTypeTraits {
static inline ConstType Get(int number, const ExtensionSet& set, int index) { static inline ConstType Get(int number, const ExtensionSet& set, int index) {
return static_cast<const Type&>(set.GetRepeatedMessage(number, index)); return static_cast<const Type&>(set.GetRepeatedMessage(number, index));
} }
static inline std::nullptr_t GetPtr(int number, const ExtensionSet& set,
int index) {
// Cannot be implemented because of forward declared messages?
return nullptr;
}
static inline std::nullptr_t GetRepeatedPtr(int number,
const ExtensionSet& set) {
// Cannot be implemented because of forward declared messages?
return nullptr;
}
static inline MutableType Mutable(int number, int index, ExtensionSet* set) { static inline MutableType Mutable(int number, int index, ExtensionSet* set) {
return static_cast<Type*>(set->MutableRepeatedMessage(number, index)); return static_cast<Type*>(set->MutableRepeatedMessage(number, index));
} }
@@ -1347,7 +1460,7 @@ RepeatedMessageTypeTraits<Type>::GetDefaultRepeatedField() {
// optional int32 bar = 1234; // optional int32 bar = 1234;
// } // }
// then "bar" will be defined in C++ as: // then "bar" will be defined in C++ as:
// ExtensionIdentifier<Foo, PrimitiveTypeTraits<int32>, 5, false> bar(1234); // ExtensionIdentifier<Foo, PrimitiveTypeTraits<int32_t>, 5, false> bar(1234);
// //
// Note that we could, in theory, supply the field number as a template // Note that we could, in theory, supply the field number as a template
// parameter, and thus make an instance of ExtensionIdentifier have no // parameter, and thus make an instance of ExtensionIdentifier have no
@@ -1378,6 +1491,10 @@ class ExtensionIdentifier {
TypeTraits::template Register<ExtendeeType>(number, field_type, is_packed); TypeTraits::template Register<ExtendeeType>(number, field_type, is_packed);
} }
typename TypeTraits::ConstType const& default_value_ref() const {
return default_value_;
}
private: private:
const int number_; const int number_;
typename TypeTraits::ConstType default_value_; typename TypeTraits::ConstType default_value_;
@@ -1386,189 +1503,10 @@ class ExtensionIdentifier {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Generated accessors // Generated accessors
// This macro should be expanded in the context of a generated type which
// has extensions. // Used to retrieve a lazy extension, may return nullptr in some environments.
// extern PROTOBUF_ATTRIBUTE_WEAK ExtensionSet::LazyMessageExtension*
// We use "_proto_TypeTraits" as a type name below because "TypeTraits" MaybeCreateLazyExtension(Arena* arena);
// causes problems if the class has a nested message or enum type with that
// name and "_TypeTraits" is technically reserved for the C++ library since
// it starts with an underscore followed by a capital letter.
//
// For similar reason, we use "_field_type" and "_is_packed" as parameter names
// below, so that "field_type" and "is_packed" can be used as field names.
#define GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(CLASSNAME) \
/* Has, Size, Clear */ \
template <typename _proto_TypeTraits, \
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \
bool _is_packed> \
inline bool HasExtension( \
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) const { \
return _extensions_.Has(id.number()); \
} \
\
template <typename _proto_TypeTraits, \
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \
bool _is_packed> \
inline void ClearExtension( \
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) { \
_extensions_.ClearExtension(id.number()); \
} \
\
template <typename _proto_TypeTraits, \
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \
bool _is_packed> \
inline int ExtensionSize( \
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) const { \
return _extensions_.ExtensionSize(id.number()); \
} \
\
/* Singular accessors */ \
template <typename _proto_TypeTraits, \
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \
bool _is_packed> \
inline typename _proto_TypeTraits::Singular::ConstType GetExtension( \
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) const { \
return _proto_TypeTraits::Get(id.number(), _extensions_, \
id.default_value()); \
} \
\
template <typename _proto_TypeTraits, \
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \
bool _is_packed> \
inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( \
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) { \
return _proto_TypeTraits::Mutable(id.number(), _field_type, \
&_extensions_); \
} \
\
template <typename _proto_TypeTraits, \
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \
bool _is_packed> \
inline void SetExtension( \
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \
typename _proto_TypeTraits::Singular::ConstType value) { \
_proto_TypeTraits::Set(id.number(), _field_type, value, &_extensions_); \
} \
\
template <typename _proto_TypeTraits, \
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \
bool _is_packed> \
inline void SetAllocatedExtension( \
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \
typename _proto_TypeTraits::Singular::MutableType value) { \
_proto_TypeTraits::SetAllocated(id.number(), _field_type, value, \
&_extensions_); \
} \
template <typename _proto_TypeTraits, \
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \
bool _is_packed> \
inline void UnsafeArenaSetAllocatedExtension( \
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \
typename _proto_TypeTraits::Singular::MutableType value) { \
_proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, \
value, &_extensions_); \
} \
template <typename _proto_TypeTraits, \
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \
bool _is_packed> \
inline PROTOBUF_MUST_USE_RESULT \
typename _proto_TypeTraits::Singular::MutableType \
ReleaseExtension( \
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) { \
return _proto_TypeTraits::Release(id.number(), _field_type, \
&_extensions_); \
} \
template <typename _proto_TypeTraits, \
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \
bool _is_packed> \
inline typename _proto_TypeTraits::Singular::MutableType \
UnsafeArenaReleaseExtension( \
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) { \
return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, \
&_extensions_); \
} \
\
/* Repeated accessors */ \
template <typename _proto_TypeTraits, \
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \
bool _is_packed> \
inline typename _proto_TypeTraits::Repeated::ConstType GetExtension( \
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \
int index) const { \
return _proto_TypeTraits::Get(id.number(), _extensions_, index); \
} \
\
template <typename _proto_TypeTraits, \
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \
bool _is_packed> \
inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( \
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \
int index) { \
return _proto_TypeTraits::Mutable(id.number(), index, &_extensions_); \
} \
\
template <typename _proto_TypeTraits, \
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \
bool _is_packed> \
inline void SetExtension( \
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \
int index, typename _proto_TypeTraits::Repeated::ConstType value) { \
_proto_TypeTraits::Set(id.number(), index, value, &_extensions_); \
} \
\
template <typename _proto_TypeTraits, \
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \
bool _is_packed> \
inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( \
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) { \
return _proto_TypeTraits::Add(id.number(), _field_type, &_extensions_); \
} \
\
template <typename _proto_TypeTraits, \
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \
bool _is_packed> \
inline void AddExtension( \
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \
typename _proto_TypeTraits::Repeated::ConstType value) { \
_proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, \
&_extensions_); \
} \
\
template <typename _proto_TypeTraits, \
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \
bool _is_packed> \
inline const typename _proto_TypeTraits::Repeated::RepeatedFieldType& \
GetRepeatedExtension( \
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) const { \
return _proto_TypeTraits::GetRepeated(id.number(), _extensions_); \
} \
\
template <typename _proto_TypeTraits, \
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \
bool _is_packed> \
inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* \
MutableRepeatedExtension( \
const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) { \
return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, \
_is_packed, &_extensions_); \
}
} // namespace internal } // namespace internal

View File

@@ -83,7 +83,7 @@ const char* ExtensionSet::ParseFieldWithExtensionInfo(
switch (extension.type) { switch (extension.type) {
#define HANDLE_VARINT_TYPE(UPPERCASE, CPP_CAMELCASE) \ #define HANDLE_VARINT_TYPE(UPPERCASE, CPP_CAMELCASE) \
case WireFormatLite::TYPE_##UPPERCASE: { \ case WireFormatLite::TYPE_##UPPERCASE: { \
uint64 value; \ uint64_t value; \
ptr = VarintParse(ptr, &value); \ ptr = VarintParse(ptr, &value); \
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); \ GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); \
if (extension.is_repeated) { \ if (extension.is_repeated) { \
@@ -103,7 +103,7 @@ const char* ExtensionSet::ParseFieldWithExtensionInfo(
#undef HANDLE_VARINT_TYPE #undef HANDLE_VARINT_TYPE
#define HANDLE_SVARINT_TYPE(UPPERCASE, CPP_CAMELCASE, SIZE) \ #define HANDLE_SVARINT_TYPE(UPPERCASE, CPP_CAMELCASE, SIZE) \
case WireFormatLite::TYPE_##UPPERCASE: { \ case WireFormatLite::TYPE_##UPPERCASE: { \
uint64 val; \ uint64_t val; \
ptr = VarintParse(ptr, &val); \ ptr = VarintParse(ptr, &val); \
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); \ GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); \
auto value = WireFormatLite::ZigZagDecode##SIZE(val); \ auto value = WireFormatLite::ZigZagDecode##SIZE(val); \
@@ -132,16 +132,16 @@ const char* ExtensionSet::ParseFieldWithExtensionInfo(
} \ } \
} break } break
HANDLE_FIXED_TYPE(FIXED32, UInt32, uint32); HANDLE_FIXED_TYPE(FIXED32, UInt32, uint32_t);
HANDLE_FIXED_TYPE(FIXED64, UInt64, uint64); HANDLE_FIXED_TYPE(FIXED64, UInt64, uint64_t);
HANDLE_FIXED_TYPE(SFIXED32, Int32, int32); HANDLE_FIXED_TYPE(SFIXED32, Int32, int32_t);
HANDLE_FIXED_TYPE(SFIXED64, Int64, int64); HANDLE_FIXED_TYPE(SFIXED64, Int64, int64_t);
HANDLE_FIXED_TYPE(FLOAT, Float, float); HANDLE_FIXED_TYPE(FLOAT, Float, float);
HANDLE_FIXED_TYPE(DOUBLE, Double, double); HANDLE_FIXED_TYPE(DOUBLE, Double, double);
#undef HANDLE_FIXED_TYPE #undef HANDLE_FIXED_TYPE
case WireFormatLite::TYPE_ENUM: { case WireFormatLite::TYPE_ENUM: {
uint64 val; uint64_t val;
ptr = VarintParse(ptr, &val); ptr = VarintParse(ptr, &val);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
int value = val; int value = val;
@@ -181,7 +181,7 @@ const char* ExtensionSet::ParseFieldWithExtensionInfo(
: MutableMessage(number, WireFormatLite::TYPE_GROUP, : MutableMessage(number, WireFormatLite::TYPE_GROUP,
*extension.message_info.prototype, *extension.message_info.prototype,
extension.descriptor); extension.descriptor);
uint32 tag = (number << 3) + WireFormatLite::WIRETYPE_START_GROUP; uint32_t tag = (number << 3) + WireFormatLite::WIRETYPE_START_GROUP;
return ctx->ParseGroup(value, ptr, tag); return ctx->ParseGroup(value, ptr, tag);
} }
@@ -203,22 +203,22 @@ const char* ExtensionSet::ParseFieldWithExtensionInfo(
template <typename Msg, typename T> template <typename Msg, typename T>
const char* ExtensionSet::ParseMessageSetItemTmpl( const char* ExtensionSet::ParseMessageSetItemTmpl(
const char* ptr, const Msg* containing_type, const char* ptr, const Msg* extendee, internal::InternalMetadata* metadata,
internal::InternalMetadata* metadata, internal::ParseContext* ctx) { internal::ParseContext* ctx) {
std::string payload; std::string payload;
uint32 type_id = 0; uint32_t type_id = 0;
bool payload_read = false; bool payload_read = false;
while (!ctx->Done(&ptr)) { while (!ctx->Done(&ptr)) {
uint32 tag = static_cast<uint8>(*ptr++); uint32_t tag = static_cast<uint8_t>(*ptr++);
if (tag == WireFormatLite::kMessageSetTypeIdTag) { if (tag == WireFormatLite::kMessageSetTypeIdTag) {
uint64 tmp; uint64_t tmp;
ptr = ParseBigVarint(ptr, &tmp); ptr = ParseBigVarint(ptr, &tmp);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
type_id = tmp; type_id = tmp;
if (payload_read) { if (payload_read) {
ExtensionInfo extension; ExtensionInfo extension;
bool was_packed_on_wire; bool was_packed_on_wire;
if (!FindExtension(2, type_id, containing_type, ctx, &extension, if (!FindExtension(2, type_id, extendee, ctx, &extension,
&was_packed_on_wire)) { &was_packed_on_wire)) {
WriteLengthDelimited(type_id, payload, WriteLengthDelimited(type_id, payload,
metadata->mutable_unknown_fields<T>()); metadata->mutable_unknown_fields<T>());
@@ -245,12 +245,12 @@ const char* ExtensionSet::ParseMessageSetItemTmpl(
} }
} else if (tag == WireFormatLite::kMessageSetMessageTag) { } else if (tag == WireFormatLite::kMessageSetMessageTag) {
if (type_id != 0) { if (type_id != 0) {
ptr = ParseFieldMaybeLazily(static_cast<uint64>(type_id) * 8 + 2, ptr, ptr = ParseFieldMaybeLazily(static_cast<uint64_t>(type_id) * 8 + 2, ptr,
containing_type, metadata, ctx); extendee, metadata, ctx);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr != nullptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr != nullptr);
type_id = 0; type_id = 0;
} else { } else {
int32 size = ReadSize(&ptr); int32_t size = ReadSize(&ptr);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ptr = ctx->ReadString(ptr, size, &payload); ptr = ctx->ReadString(ptr, size, &payload);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
@@ -262,7 +262,7 @@ const char* ExtensionSet::ParseMessageSetItemTmpl(
ctx->SetLastTag(tag); ctx->SetLastTag(tag);
return ptr; return ptr;
} }
ptr = ParseField(tag, ptr, containing_type, metadata, ctx); ptr = ParseField(tag, ptr, extendee, metadata, ctx);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
} }
} }

View File

@@ -32,215 +32,141 @@
#define GOOGLE_PROTOBUF_FIELD_ACCESS_LISTENER_H__ #define GOOGLE_PROTOBUF_FIELD_ACCESS_LISTENER_H__
#include <cstddef> #include <cstddef>
#include <functional>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/common.h>
#include <google/protobuf/arenastring.h> #include <google/protobuf/message_lite.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/map.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/repeated_field.h>
namespace google { namespace google {
namespace protobuf { namespace protobuf {
namespace internal {
template <typename T> // A default/no-op implementation of message hooks.
struct ResolvedType { //
using type = T; // See go/statically-dispatched-message-hooks for details.
template <typename Proto>
struct NoOpAccessListener {
// Number of fields are provided at compile time for the trackers to be able
// to have stack allocated bitmaps for the fields. This is useful for
// performance critical trackers. This is also to avoid cyclic dependencies
// if the number of fields is needed.
static constexpr int kFields = Proto::_kInternalFieldNumber;
// Default constructor is called during the static global initialization of
// the program.
// We provide a pointer to extract the name of the proto not to get cyclic
// dependencies on GetDescriptor() and OnGetMetadata() calls. If you want
// to differentiate the protos during the runtime before the start of the
// program, use this functor to get its name. We either way need it for
// LITE_RUNTIME protos as they don't have descriptors at all.
explicit NoOpAccessListener(StringPiece (*name_extractor)()) {}
// called repeatedly during serialization/deserialization/ByteSize of
// Reflection as:
// AccessListener<MessageT>::OnSerialize(this);
static void OnSerialize(const MessageLite* msg) {}
static void OnDeserialize(const MessageLite* msg) {}
static void OnByteSize(const MessageLite* msg) {}
static void OnMergeFrom(const MessageLite* to, const MessageLite* from) {}
// NOTE: This function can be called pre-main. Make sure it does not make
// the state of the listener invalid.
static void OnGetMetadata() {}
// called from accessors as:
// AccessListener<MessageT>::On$operation(this, &field_storage_);
// If you need to override this with type, in your hook implementation
// introduce
// template <int kFieldNum, typename T>
// static void On$operation(const MessageLite* msg,
// const T* field) {}
// And overloads for std::nullptr_t for incomplete types such as Messages,
// Maps. Extract them using reflection if you need. Consequently, second
// argument can be null pointer.
// For an example, see proto_hooks/testing/memory_test_field_listener.h
// And argument template deduction will deduce the type itself without
// changing the generated code.
// add_<field>(f)
template <int kFieldNum>
static void OnAdd(const MessageLite* msg, const void* field) {}
// add_<field>()
template <int kFieldNum>
static void OnAddMutable(const MessageLite* msg, const void* field) {}
// <field>() and <repeated_field>(i)
template <int kFieldNum>
static void OnGet(const MessageLite* msg, const void* field) {}
// clear_<field>()
template <int kFieldNum>
static void OnClear(const MessageLite* msg, const void* field) {}
// has_<field>()
template <int kFieldNum>
static void OnHas(const MessageLite* msg, const void* field) {}
// <repeated_field>()
template <int kFieldNum>
static void OnList(const MessageLite* msg, const void* field) {}
// mutable_<field>()
template <int kFieldNum>
static void OnMutable(const MessageLite* msg, const void* field) {}
// mutable_<repeated_field>()
template <int kFieldNum>
static void OnMutableList(const MessageLite* msg, const void* field) {}
// release_<field>()
template <int kFieldNum>
static void OnRelease(const MessageLite* msg, const void* field) {}
// set_<field>() and set_<repeated_field>(i)
template <int kFieldNum>
static void OnSet(const MessageLite* msg, const void* field) {}
// <repeated_field>_size()
template <int kFieldNum>
static void OnSize(const MessageLite* msg, const void* field) {}
static void OnHasExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
// TODO(b/190614678): Support clear in the proto compiler.
static void OnClearExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnExtensionSize(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnGetExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnMutableExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnSetExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnReleaseExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnAddExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnAddMutableExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnListExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnMutableListExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
}; };
} // namespace internal
// Tracks the events of field accesses for all protos
// that are built with --inject_field_listener_events. This is a global
// interface which you must implement yourself and register with
// RegisterListener() function. All events consist of Descriptors,
// FieldAccessTypes and the underlying storage for tracking the memory which is
// accessed where possible and makes sense. Users are responsible for the
// implementations to be thread safe.
class FieldAccessListener {
public:
FieldAccessListener() = default;
virtual ~FieldAccessListener() = default;
// The memory annotations of the proto fields that are touched by the
// accessors. They are returned as if the operation completes.
struct DataAnnotation {
DataAnnotation() = default;
DataAnnotation(const void* other_address, size_t other_size)
: address(other_address), size(other_size) {}
const void* address = nullptr;
size_t size = 0;
};
using AddressInfo = std::vector<DataAnnotation>;
using AddressInfoExtractor = std::function<AddressInfo()>;
enum class FieldAccessType {
kAdd, // add_<field>(f)
kAddMutable, // add_<field>()
kGet, // <field>() and <repeated_field>(i)
kClear, // clear_<field>()
kHas, // has_<field>()
kList, // <repeated_field>()
kMutable, // mutable_<field>()
kMutableList, // mutable_<repeated_field>()
kRelease, // release_<field>()
kSet, // set_<field>() and set_<repeated_field>(i)
kSize, // <repeated_field>_size()
};
static FieldAccessListener* GetListener();
// Registers the field listener, can be called only once, |listener| must
// outlive all proto accesses (in most cases, the lifetime of the program).
static void RegisterListener(FieldAccessListener* listener);
// All field accessors noted in FieldAccessType have this call.
// |extractor| extracts the address info from the field
virtual void OnFieldAccess(const AddressInfoExtractor& extractor,
const FieldDescriptor* descriptor,
FieldAccessType access_type) = 0;
// Side effect calls.
virtual void OnDeserializationAccess(const Message* message) = 0;
virtual void OnSerializationAccess(const Message* message) = 0;
virtual void OnReflectionAccess(const Descriptor* descriptor) = 0;
virtual void OnByteSizeAccess(const Message* message) = 0;
// We can probably add more if we need to, like {Merge,Copy}{From}Access.
// Extracts all the addresses from the underlying fields.
template <typename T>
AddressInfo ExtractFieldInfo(const T* field_value);
private:
template <typename T>
AddressInfo ExtractFieldInfoSpecific(const T* field_value,
internal::ResolvedType<T>);
AddressInfo ExtractFieldInfoSpecific(const Message* field_value,
internal::ResolvedType<Message>);
AddressInfo ExtractFieldInfoSpecific(const std::string* field_value,
internal::ResolvedType<std::string>);
AddressInfo ExtractFieldInfoSpecific(
const internal::ArenaStringPtr* field_value,
internal::ResolvedType<internal::ArenaStringPtr>);
template <typename T>
AddressInfo ExtractFieldInfoSpecific(
const RepeatedField<T>* field_value,
internal::ResolvedType<RepeatedField<T>>);
template <typename T>
AddressInfo ExtractFieldInfoSpecific(
const RepeatedPtrField<T>* field_value,
internal::ResolvedType<RepeatedPtrField<T>>);
template <typename K, typename V>
AddressInfo ExtractFieldInfoSpecific(const Map<K, V>* field_value,
internal::ResolvedType<Map<K, V>>);
static internal::once_flag register_once_;
static FieldAccessListener* field_listener_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldAccessListener);
};
template <typename T>
inline FieldAccessListener::AddressInfo FieldAccessListener::ExtractFieldInfo(
const T* field_value) {
return ExtractFieldInfoSpecific(field_value, internal::ResolvedType<T>());
}
template <typename T>
inline FieldAccessListener::AddressInfo
FieldAccessListener::ExtractFieldInfoSpecific(const T* field_value,
internal::ResolvedType<T>) {
static_assert(std::is_trivial<T>::value,
"This overload should be chosen only for trivial types");
return FieldAccessListener::AddressInfo{FieldAccessListener::DataAnnotation(
static_cast<const void*>(field_value), sizeof(*field_value))};
}
inline FieldAccessListener::AddressInfo
FieldAccessListener::ExtractFieldInfoSpecific(
const std::string* field_value, internal::ResolvedType<std::string>) {
return FieldAccessListener::AddressInfo{FieldAccessListener::DataAnnotation(
static_cast<const void*>(field_value->c_str()), field_value->length())};
}
inline FieldAccessListener::AddressInfo
FieldAccessListener::ExtractFieldInfoSpecific(
const internal::ArenaStringPtr* field_value,
internal::ResolvedType<internal::ArenaStringPtr>) {
return FieldAccessListener::ExtractFieldInfoSpecific(
field_value->GetPointer(), internal::ResolvedType<std::string>());
}
template <typename T>
inline FieldAccessListener::AddressInfo
FieldAccessListener::ExtractFieldInfoSpecific(
const RepeatedField<T>* field_value,
internal::ResolvedType<RepeatedField<T>>) {
// TODO(jianzhouzh): This can cause data races. Synchronize this if needed.
FieldAccessListener::AddressInfo address_info;
address_info.reserve(field_value->size());
for (int i = 0, ie = field_value->size(); i < ie; ++i) {
auto sub = ExtractFieldInfoSpecific(&field_value->Get(i),
internal::ResolvedType<T>());
address_info.insert(address_info.end(), sub.begin(), sub.end());
}
return address_info;
}
template <typename T>
inline FieldAccessListener::AddressInfo
FieldAccessListener::ExtractFieldInfoSpecific(
const RepeatedPtrField<T>* field_value,
internal::ResolvedType<RepeatedPtrField<T>>) {
FieldAccessListener::AddressInfo address_info;
// TODO(jianzhouzh): This can cause data races. Synchronize this if needed.
address_info.reserve(field_value->size());
for (int i = 0, ie = field_value->size(); i < ie; ++i) {
auto sub = ExtractFieldInfoSpecific(&field_value->Get(i),
internal::ResolvedType<T>());
address_info.insert(address_info.end(), sub.begin(), sub.end());
}
return address_info;
}
template <typename K, typename V>
inline FieldAccessListener::AddressInfo
FieldAccessListener::ExtractFieldInfoSpecific(
const Map<K, V>* field_value, internal::ResolvedType<Map<K, V>>) {
// TODO(jianzhouzh): This can cause data races. Synchronize this if needed.
FieldAccessListener::AddressInfo address_info;
address_info.reserve(field_value->size());
for (auto it = field_value->begin(); it != field_value->end(); ++it) {
auto sub_first =
ExtractFieldInfoSpecific(&it->first, internal::ResolvedType<K>());
auto sub_second =
ExtractFieldInfoSpecific(&it->second, internal::ResolvedType<V>());
address_info.insert(address_info.end(), sub_first.begin(), sub_first.end());
address_info.insert(address_info.end(), sub_second.begin(),
sub_second.end());
}
return address_info;
}
inline FieldAccessListener::AddressInfo
FieldAccessListener::ExtractFieldInfoSpecific(const Message* field_value,
internal::ResolvedType<Message>) {
// TODO(jianzhouzh): implement and adjust all annotations in the compiler.
return {};
}
} // namespace protobuf } // namespace protobuf
} // namespace google } // namespace google
#ifndef REPLACE_PROTO_LISTENER_IMPL
namespace google {
namespace protobuf {
template <class T>
using AccessListener = NoOpAccessListener<T>;
} // namespace protobuf
} // namespace google
#else
// You can put your implementations of hooks/listeners here.
// All hooks are subject to approval by protobuf-team@.
#endif // !REPLACE_PROTO_LISTENER_IMPL
#endif // GOOGLE_PROTOBUF_FIELD_ACCESS_LISTENER_H__ #endif // GOOGLE_PROTOBUF_FIELD_ACCESS_LISTENER_H__

View File

@@ -8,12 +8,12 @@
#include <string> #include <string>
#include <google/protobuf/port_def.inc> #include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3017000 #if PROTOBUF_VERSION < 3018000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #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 This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.
@@ -59,7 +59,7 @@ struct FieldMaskDefaultTypeInternal;
PROTOBUF_EXPORT extern FieldMaskDefaultTypeInternal _FieldMask_default_instance_; PROTOBUF_EXPORT extern FieldMaskDefaultTypeInternal _FieldMask_default_instance_;
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::FieldMask* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::FieldMask>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::FieldMask* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::FieldMask>(Arena*);
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
@@ -84,7 +84,11 @@ class PROTOBUF_EXPORT FieldMask final :
} }
inline FieldMask& operator=(FieldMask&& from) noexcept { inline FieldMask& operator=(FieldMask&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -142,7 +146,7 @@ class PROTOBUF_EXPORT FieldMask final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const FieldMask& from); void MergeFrom(const FieldMask& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;

View File

@@ -0,0 +1,87 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This file contains helpers for generated code.
//
// Nothing in this file should be directly referenced by users of protobufs.
#ifndef GOOGLE_PROTOBUF_GENERATED_MESSAGE_BASES_H__
#define GOOGLE_PROTOBUF_GENERATED_MESSAGE_BASES_H__
#include <google/protobuf/parse_context.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/arena.h>
#include <google/protobuf/generated_message_util.h>
#include <google/protobuf/message.h>
// Must come last:
#include <google/protobuf/port_def.inc>
namespace google {
namespace protobuf {
namespace internal {
// To save code size, protos without any fields are derived from ZeroFieldsBase
// rather than Message.
class PROTOBUF_EXPORT ZeroFieldsBase : public Message {
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final { return true; }
size_t ByteSizeLong() const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
const char* _InternalParse(const char* ptr,
internal::ParseContext* ctx) final;
::uint8_t* _InternalSerialize(::uint8_t* target,
io::EpsCopyOutputStream* stream) const final;
protected:
constexpr ZeroFieldsBase() {}
explicit ZeroFieldsBase(Arena* arena, bool is_message_owned)
: Message(arena, is_message_owned) {}
ZeroFieldsBase(const ZeroFieldsBase&) = delete;
ZeroFieldsBase& operator=(const ZeroFieldsBase&) = delete;
~ZeroFieldsBase() override;
void SetCachedSize(int size) const final { _cached_size_.Set(size); }
static void MergeImpl(Message* to, const Message& from);
static void CopyImpl(Message* to, const Message& from);
void InternalSwap(ZeroFieldsBase* other);
mutable internal::CachedSize _cached_size_;
};
} // namespace internal
} // namespace protobuf
} // namespace google
#include <google/protobuf/port_undef.inc>
#endif // GOOGLE_PROTOBUF_GENERATED_MESSAGE_BASES_H__

View File

@@ -107,7 +107,7 @@ class WeakFieldMap; // weak_field_map.h
// message, or -1 if the message type has no extension // message, or -1 if the message type has no extension
// ranges. // ranges.
// oneof_case_offset: Offset in the message of an array of uint32s of // oneof_case_offset: Offset in the message of an array of uint32s of
// size descriptor->oneof_decl_count(). Each uint32 // size descriptor->oneof_decl_count(). Each uint32_t
// indicates what field is set for each oneof. // indicates what field is set for each oneof.
// object_size: The size of a message object of this type, as measured // object_size: The size of a message object of this type, as measured
// by sizeof(). // by sizeof().
@@ -119,7 +119,7 @@ class WeakFieldMap; // weak_field_map.h
struct ReflectionSchema { struct ReflectionSchema {
public: public:
// Size of a google::protobuf::Message object of this type. // Size of a google::protobuf::Message object of this type.
uint32 GetObjectSize() const { return static_cast<uint32>(object_size_); } uint32_t GetObjectSize() const { return static_cast<uint32_t>(object_size_); }
bool InRealOneof(const FieldDescriptor* field) const { bool InRealOneof(const FieldDescriptor* field) const {
return field->containing_oneof() && return field->containing_oneof() &&
@@ -128,13 +128,13 @@ struct ReflectionSchema {
// Offset of a non-oneof field. Getting a field offset is slightly more // Offset of a non-oneof field. Getting a field offset is slightly more
// efficient when we know statically that it is not a oneof field. // efficient when we know statically that it is not a oneof field.
uint32 GetFieldOffsetNonOneof(const FieldDescriptor* field) const { uint32_t GetFieldOffsetNonOneof(const FieldDescriptor* field) const {
GOOGLE_DCHECK(!InRealOneof(field)); GOOGLE_DCHECK(!InRealOneof(field));
return OffsetValue(offsets_[field->index()], field->type()); return OffsetValue(offsets_[field->index()], field->type());
} }
// Offset of any field. // Offset of any field.
uint32 GetFieldOffset(const FieldDescriptor* field) const { uint32_t GetFieldOffset(const FieldDescriptor* field) const {
if (InRealOneof(field)) { if (InRealOneof(field)) {
size_t offset = size_t offset =
static_cast<size_t>(field->containing_type()->field_count() + static_cast<size_t>(field->containing_type()->field_count() +
@@ -145,42 +145,62 @@ struct ReflectionSchema {
} }
} }
uint32 GetOneofCaseOffset(const OneofDescriptor* oneof_descriptor) const { bool IsFieldInlined(const FieldDescriptor* field) const {
return static_cast<uint32>(oneof_case_offset_) + return Inlined(offsets_[field->index()], field->type());
static_cast<uint32>(static_cast<size_t>(oneof_descriptor->index()) * }
sizeof(uint32));
uint32_t GetOneofCaseOffset(const OneofDescriptor* oneof_descriptor) const {
return static_cast<uint32_t>(oneof_case_offset_) +
static_cast<uint32_t>(
static_cast<size_t>(oneof_descriptor->index()) *
sizeof(uint32_t));
} }
bool HasHasbits() const { return has_bits_offset_ != -1; } bool HasHasbits() const { return has_bits_offset_ != -1; }
// Bit index within the bit array of hasbits. Bit order is low-to-high. // Bit index within the bit array of hasbits. Bit order is low-to-high.
uint32 HasBitIndex(const FieldDescriptor* field) const { uint32_t HasBitIndex(const FieldDescriptor* field) const {
if (has_bits_offset_ == -1) return static_cast<uint32>(-1); if (has_bits_offset_ == -1) return static_cast<uint32_t>(-1);
GOOGLE_DCHECK(HasHasbits()); GOOGLE_DCHECK(HasHasbits());
return has_bit_indices_[field->index()]; return has_bit_indices_[field->index()];
} }
// Byte offset of the hasbits array. // Byte offset of the hasbits array.
uint32 HasBitsOffset() const { uint32_t HasBitsOffset() const {
GOOGLE_DCHECK(HasHasbits()); GOOGLE_DCHECK(HasHasbits());
return static_cast<uint32>(has_bits_offset_); return static_cast<uint32_t>(has_bits_offset_);
}
bool HasInlinedString() const { return inlined_string_donated_offset_ != -1; }
// Bit index within the bit array of _inlined_string_donated_. Bit order is
// low-to-high.
uint32_t InlinedStringIndex(const FieldDescriptor* field) const {
GOOGLE_DCHECK(HasInlinedString());
return inlined_string_indices_[field->index()];
}
// Byte offset of the _inlined_string_donated_ array.
uint32_t InlinedStringDonatedOffset() const {
GOOGLE_DCHECK(HasInlinedString());
return static_cast<uint32_t>(inlined_string_donated_offset_);
} }
// The offset of the InternalMetadataWithArena member. // The offset of the InternalMetadataWithArena member.
// For Lite this will actually be an InternalMetadataWithArenaLite. // For Lite this will actually be an InternalMetadataWithArenaLite.
// The schema doesn't contain enough information to distinguish between // The schema doesn't contain enough information to distinguish between
// these two cases. // these two cases.
uint32 GetMetadataOffset() const { uint32_t GetMetadataOffset() const {
return static_cast<uint32>(metadata_offset_); return static_cast<uint32_t>(metadata_offset_);
} }
// Whether this message has an ExtensionSet. // Whether this message has an ExtensionSet.
bool HasExtensionSet() const { return extensions_offset_ != -1; } bool HasExtensionSet() const { return extensions_offset_ != -1; }
// The offset of the ExtensionSet in this message. // The offset of the ExtensionSet in this message.
uint32 GetExtensionSetOffset() const { uint32_t GetExtensionSetOffset() const {
GOOGLE_DCHECK(HasExtensionSet()); GOOGLE_DCHECK(HasExtensionSet());
return static_cast<uint32>(extensions_offset_); return static_cast<uint32_t>(extensions_offset_);
} }
// The off set of WeakFieldMap when the message contains weak fields. // The off set of WeakFieldMap when the message contains weak fields.
@@ -194,7 +214,7 @@ struct ReflectionSchema {
// Returns a pointer to the default value for this field. The size and type // Returns a pointer to the default value for this field. The size and type
// of the underlying data depends on the field's type. // of the underlying data depends on the field's type.
const void* GetFieldDefault(const FieldDescriptor* field) const { const void* GetFieldDefault(const FieldDescriptor* field) const {
return reinterpret_cast<const uint8*>(default_instance_) + return reinterpret_cast<const uint8_t*>(default_instance_) +
OffsetValue(offsets_[field->index()], field->type()); OffsetValue(offsets_[field->index()], field->type());
} }
@@ -232,23 +252,37 @@ struct ReflectionSchema {
// ReflectionSchema schema = {a, b, c, d, e, ...}; // ReflectionSchema schema = {a, b, c, d, e, ...};
// private: // private:
const Message* default_instance_; const Message* default_instance_;
const uint32* offsets_; const uint32_t* offsets_;
const uint32* has_bit_indices_; const uint32_t* has_bit_indices_;
int has_bits_offset_; int has_bits_offset_;
int metadata_offset_; int metadata_offset_;
int extensions_offset_; int extensions_offset_;
int oneof_case_offset_; int oneof_case_offset_;
int object_size_; int object_size_;
int weak_field_map_offset_; int weak_field_map_offset_;
const uint32_t* inlined_string_indices_;
int inlined_string_donated_offset_;
// We tag offset values to provide additional data about fields (such as // We tag offset values to provide additional data about fields (such as
// "unused" or "lazy"). // "unused" or "lazy" or "inlined").
static uint32 OffsetValue(uint32 v, FieldDescriptor::Type type) { static uint32_t OffsetValue(uint32_t v, FieldDescriptor::Type type) {
if (type == FieldDescriptor::TYPE_MESSAGE) { if (type == FieldDescriptor::TYPE_MESSAGE ||
type == FieldDescriptor::TYPE_STRING ||
type == FieldDescriptor::TYPE_BYTES) {
return v & 0x7FFFFFFEu; return v & 0x7FFFFFFEu;
} }
return v & 0x7FFFFFFFu; return v & 0x7FFFFFFFu;
} }
static bool Inlined(uint32_t v, FieldDescriptor::Type type) {
if (type == FieldDescriptor::TYPE_STRING ||
type == FieldDescriptor::TYPE_BYTES) {
return (v & 1u) != 0u;
} else {
// Non string/byte fields are not inlined.
return false;
}
}
}; };
// Structs that the code generator emits directly to describe a message. // Structs that the code generator emits directly to describe a message.
@@ -258,8 +292,9 @@ struct ReflectionSchema {
// EXPERIMENTAL: these are changing rapidly, and may completely disappear // EXPERIMENTAL: these are changing rapidly, and may completely disappear
// or merge with ReflectionSchema. // or merge with ReflectionSchema.
struct MigrationSchema { struct MigrationSchema {
int32 offsets_index; int32_t offsets_index;
int32 has_bit_indices_index; int32_t has_bit_indices_index;
int32_t inlined_string_indices_index;
int object_size; int object_size;
}; };
@@ -278,7 +313,7 @@ struct PROTOBUF_EXPORT DescriptorTable {
int num_messages; int num_messages;
const MigrationSchema* schemas; const MigrationSchema* schemas;
const Message* const* default_instances; const Message* const* default_instances;
const uint32* offsets; const uint32_t* offsets;
// update the following descriptor arrays. // update the following descriptor arrays.
Metadata* file_level_metadata; Metadata* file_level_metadata;
const EnumDescriptor** file_level_enum_descriptors; const EnumDescriptor** file_level_enum_descriptors;
@@ -309,8 +344,9 @@ Metadata PROTOBUF_EXPORT AssignDescriptors(const DescriptorTable* (*table)(),
const Metadata& metadata); const Metadata& metadata);
// These cannot be in lite so we put them in the reflection. // These cannot be in lite so we put them in the reflection.
PROTOBUF_EXPORT void UnknownFieldSetSerializer(const uint8* base, uint32 offset, PROTOBUF_EXPORT void UnknownFieldSetSerializer(const uint8_t* base,
uint32 tag, uint32 has_offset, uint32_t offset, uint32_t tag,
uint32_t has_offset,
io::CodedOutputStream* output); io::CodedOutputStream* output);
struct PROTOBUF_EXPORT AddDescriptorsRunner { struct PROTOBUF_EXPORT AddDescriptorsRunner {

View File

@@ -73,19 +73,21 @@ enum ProcessingTypes {
TYPE_STRING_STRING_PIECE = 20, TYPE_STRING_STRING_PIECE = 20,
TYPE_BYTES_CORD = 21, TYPE_BYTES_CORD = 21,
TYPE_BYTES_STRING_PIECE = 22, TYPE_BYTES_STRING_PIECE = 22,
TYPE_MAP = 23, TYPE_STRING_INLINED = 23,
TYPE_BYTES_INLINED = 24,
TYPE_MAP = 25,
}; };
static_assert(TYPE_MAP < kRepeatedMask, "Invalid enum"); static_assert(TYPE_MAP < kRepeatedMask, "Invalid enum");
struct PROTOBUF_EXPORT FieldMetadata { struct PROTOBUF_EXPORT FieldMetadata {
uint32 offset; // offset of this field in the struct uint32_t offset; // offset of this field in the struct
uint32 tag; // field * 8 + wire_type uint32_t tag; // field * 8 + wire_type
// byte offset * 8 + bit_offset; // byte offset * 8 + bit_offset;
// if the high bit is set then this is the byte offset of the oneof_case // if the high bit is set then this is the byte offset of the oneof_case
// for this field. // for this field.
uint32 has_offset; uint32_t has_offset;
uint32 type; // the type of this field. uint32_t type; // the type of this field.
const void* ptr; // auxiliary data const void* ptr; // auxiliary data
// From the serializer point of view each fundamental type can occur in // From the serializer point of view each fundamental type can occur in
@@ -104,7 +106,8 @@ struct PROTOBUF_EXPORT FieldMetadata {
enum { enum {
kCordType = 19, kCordType = 19,
kStringPieceType = 20, kStringPieceType = 20,
kNumTypes = 20, kInlinedType = 21,
kNumTypes = 21,
kSpecial = kNumTypes * kNumTypeClasses, kSpecial = kNumTypes * kNumTypeClasses,
}; };
@@ -119,10 +122,10 @@ struct PROTOBUF_EXPORT FieldMetadata {
// Additional data, needed for some types, is stored in // Additional data, needed for some types, is stored in
// AuxiliaryParseTableField. // AuxiliaryParseTableField.
struct ParseTableField { struct ParseTableField {
uint32 offset; uint32_t offset;
// The presence_index ordinarily represents a has_bit index, but for fields // The presence_index ordinarily represents a has_bit index, but for fields
// inside a oneof it represents the index in _oneof_case_. // inside a oneof it represents the index in _oneof_case_.
uint32 presence_index; uint32_t presence_index;
unsigned char normal_wiretype; unsigned char normal_wiretype;
unsigned char packed_wiretype; unsigned char packed_wiretype;
@@ -184,10 +187,10 @@ struct ParseTable {
// TODO(ckennelly): Do something with this padding. // TODO(ckennelly): Do something with this padding.
// TODO(ckennelly): Vet these for sign extension. // TODO(ckennelly): Vet these for sign extension.
int64 has_bits_offset; int64_t has_bits_offset;
int64 oneof_case_offset; int64_t oneof_case_offset;
int64 extension_offset; int64_t extension_offset;
int64 arena_offset; int64_t arena_offset;
// ExplicitlyInitialized<T> -> T requires a reinterpret_cast, which prevents // ExplicitlyInitialized<T> -> T requires a reinterpret_cast, which prevents
// the tables from being constructed as a constexpr. We use void to avoid // the tables from being constructed as a constexpr. We use void to avoid
@@ -243,9 +246,9 @@ struct SerializationTable {
const FieldMetadata* field_table; const FieldMetadata* field_table;
}; };
PROTOBUF_EXPORT void SerializeInternal(const uint8* base, PROTOBUF_EXPORT void SerializeInternal(const uint8_t* base,
const FieldMetadata* table, const FieldMetadata* table,
int32 num_fields, int32_t num_fields,
io::CodedOutputStream* output); io::CodedOutputStream* output);
inline void TableSerialize(const MessageLite& msg, inline void TableSerialize(const MessageLite& msg,
@@ -253,24 +256,25 @@ inline void TableSerialize(const MessageLite& msg,
io::CodedOutputStream* output) { io::CodedOutputStream* output) {
const FieldMetadata* field_table = table->field_table; const FieldMetadata* field_table = table->field_table;
int num_fields = table->num_fields - 1; int num_fields = table->num_fields - 1;
const uint8* base = reinterpret_cast<const uint8*>(&msg); const uint8_t* base = reinterpret_cast<const uint8_t*>(&msg);
// TODO(gerbens) This skips the first test if we could use the fast // TODO(gerbens) This skips the first test if we could use the fast
// array serialization path, we should make this // array serialization path, we should make this
// int cached_size = // int cached_size =
// *reinterpret_cast<const int32*>(base + field_table->offset); // *reinterpret_cast<const int32_t*>(base + field_table->offset);
// SerializeWithCachedSize(msg, field_table + 1, num_fields, cached_size, ...) // SerializeWithCachedSize(msg, field_table + 1, num_fields, cached_size, ...)
// But we keep conformance with the old way for now. // But we keep conformance with the old way for now.
SerializeInternal(base, field_table + 1, num_fields, output); SerializeInternal(base, field_table + 1, num_fields, output);
} }
PROTOBUF_EXPORT uint8* SerializeInternalToArray(const uint8* base, const FieldMetadata* table, PROTOBUF_EXPORT uint8_t* SerializeInternalToArray(const uint8_t* base,
int32 num_fields, bool is_deterministic, const FieldMetadata* table,
uint8* buffer); int32_t num_fields, bool is_deterministic,
uint8_t* buffer);
inline uint8* TableSerializeToArray(const MessageLite& msg, inline uint8_t* TableSerializeToArray(const MessageLite& msg,
const SerializationTable* table, const SerializationTable* table,
bool is_deterministic, uint8* buffer) { bool is_deterministic, uint8_t* buffer) {
const uint8* base = reinterpret_cast<const uint8*>(&msg); const uint8_t* base = reinterpret_cast<const uint8_t*>(&msg);
const FieldMetadata* field_table = table->field_table + 1; const FieldMetadata* field_table = table->field_table + 1;
int num_fields = table->num_fields - 1; int num_fields = table->num_fields - 1;
return SerializeInternalToArray(base, field_table, num_fields, return SerializeInternalToArray(base, field_table, num_fields,
@@ -302,8 +306,8 @@ struct CompareMapKey {
}; };
template <typename MapFieldType, const SerializationTable* table> template <typename MapFieldType, const SerializationTable* table>
void MapFieldSerializer(const uint8* base, uint32 offset, uint32 tag, void MapFieldSerializer(const uint8_t* base, uint32_t offset, uint32_t tag,
uint32 has_offset, io::CodedOutputStream* output) { uint32_t has_offset, io::CodedOutputStream* output) {
typedef MapEntryHelper<typename MapFieldType::EntryTypeTrait> Entry; typedef MapEntryHelper<typename MapFieldType::EntryTypeTrait> Entry;
typedef typename MapFieldType::MapType::const_iterator Iter; typedef typename MapFieldType::MapType::const_iterator Iter;
@@ -318,7 +322,7 @@ void MapFieldSerializer(const uint8* base, uint32 offset, uint32 tag,
Entry map_entry(*it); Entry map_entry(*it);
output->WriteVarint32(tag); output->WriteVarint32(tag);
output->WriteVarint32(map_entry._cached_size_); output->WriteVarint32(map_entry._cached_size_);
SerializeInternal(reinterpret_cast<const uint8*>(&map_entry), SerializeInternal(reinterpret_cast<const uint8_t*>(&map_entry),
t->field_table, t->num_fields, output); t->field_table, t->num_fields, output);
} }
} else { } else {
@@ -331,7 +335,7 @@ void MapFieldSerializer(const uint8* base, uint32 offset, uint32 tag,
for (int i = 0; i < v.size(); i++) { for (int i = 0; i < v.size(); i++) {
output->WriteVarint32(tag); output->WriteVarint32(tag);
output->WriteVarint32(v[i]._cached_size_); output->WriteVarint32(v[i]._cached_size_);
SerializeInternal(reinterpret_cast<const uint8*>(&v[i]), t->field_table, SerializeInternal(reinterpret_cast<const uint8_t*>(&v[i]), t->field_table,
t->num_fields, output); t->num_fields, output);
} }
} }

View File

@@ -41,6 +41,9 @@
#include <google/protobuf/parse_context.h> #include <google/protobuf/parse_context.h>
#include <google/protobuf/message_lite.h> #include <google/protobuf/message_lite.h>
// Must come last:
#include <google/protobuf/port_def.inc>
namespace google { namespace google {
namespace protobuf { namespace protobuf {
namespace internal { namespace internal {
@@ -52,7 +55,10 @@ struct TcFieldData {
: data(static_cast<uint64_t>(offset) << 48 | : data(static_cast<uint64_t>(offset) << 48 |
static_cast<uint64_t>(hasbit_idx) << 16 | coded_tag) {} static_cast<uint64_t>(hasbit_idx) << 16 | coded_tag) {}
uint16_t coded_tag() const { return static_cast<uint16_t>(data); } template <typename TagType = uint16_t>
TagType coded_tag() const {
return static_cast<TagType>(data);
}
uint8_t hasbit_idx() const { return static_cast<uint8_t>(data >> 16); } uint8_t hasbit_idx() const { return static_cast<uint8_t>(data >> 16); }
uint16_t offset() const { return static_cast<uint16_t>(data >> 48); } uint16_t offset() const { return static_cast<uint16_t>(data >> 48); }
@@ -62,19 +68,21 @@ struct TcFieldData {
struct TailCallParseTableBase; struct TailCallParseTableBase;
// TailCallParseFunc is the function pointer type used in the tailcall table. // TailCallParseFunc is the function pointer type used in the tailcall table.
typedef const char* (*TailCallParseFunc)(MessageLite* msg, const char* ptr, typedef const char* (*TailCallParseFunc)(PROTOBUF_TC_PARAM_DECL);
ParseContext* ctx,
const TailCallParseTableBase* table, #if defined(_MSC_VER) && !defined(_WIN64)
uint64_t hasbits, TcFieldData data); #pragma warning(push)
// TailCallParseTableBase is intentionally overaligned on 32 bit targets.
#pragma warning(disable : 4324)
#endif
// Base class for message-level table with info for the tail-call parser. // Base class for message-level table with info for the tail-call parser.
struct TailCallParseTableBase { struct alignas(uint64_t) TailCallParseTableBase {
// Common attributes for message layout: // Common attributes for message layout:
uint16_t has_bits_offset; uint16_t has_bits_offset;
uint16_t extension_offset; uint16_t extension_offset;
uint32_t extension_range_low; uint32_t extension_range_low;
uint32_t extension_range_high; uint32_t extension_range_high;
uint32_t has_bits_required_mask;
const MessageLite* default_instance; const MessageLite* default_instance;
// Handler for fields which are not handled by table dispatch. // Handler for fields which are not handled by table dispatch.
@@ -93,6 +101,10 @@ struct TailCallParseTableBase {
} }
}; };
#if defined(_MSC_VER) && !defined(_WIN64)
#pragma warning(pop)
#endif
static_assert(sizeof(TailCallParseTableBase::FieldEntry) <= 16, static_assert(sizeof(TailCallParseTableBase::FieldEntry) <= 16,
"Field entry is too big."); "Field entry is too big.");
@@ -120,4 +132,6 @@ static_assert(offsetof(TailCallParseTable<1>, entries) ==
} // namespace protobuf } // namespace protobuf
} // namespace google } // namespace google
#include <google/protobuf/port_undef.inc>
#endif // GOOGLE_PROTOBUF_GENERATED_MESSAGE_TCTABLE_DECL_H__ #endif // GOOGLE_PROTOBUF_GENERATED_MESSAGE_TCTABLE_DECL_H__

View File

@@ -53,20 +53,59 @@ class UnknownFieldSet;
namespace internal { namespace internal {
// PROTOBUF_TC_PARAM_DECL are the parameters for tailcall functions. // PROTOBUF_TC_PARAM_DECL are the parameters for tailcall functions, it is
// defined in port_def.inc.
// //
// Note that this is performance sensitive: changing the parameters will change // Note that this is performance sensitive: changing the parameters will change
// the registers used by the ABI calling convention, which subsequently affects // the registers used by the ABI calling convention, which subsequently affects
// register selection logic inside the function. // register selection logic inside the function.
#define PROTOBUF_TC_PARAM_DECL \
::google::protobuf::MessageLite *msg, const char *ptr, \
::google::protobuf::internal::ParseContext *ctx, \
const ::google::protobuf::internal::TailCallParseTableBase *table, \
uint64_t hasbits, ::google::protobuf::internal::TcFieldData data
// PROTOBUF_TC_PARAM_PASS passes values to match PROTOBUF_TC_PARAM_DECL. // PROTOBUF_TC_PARAM_PASS passes values to match PROTOBUF_TC_PARAM_DECL.
#define PROTOBUF_TC_PARAM_PASS msg, ptr, ctx, table, hasbits, data #define PROTOBUF_TC_PARAM_PASS msg, ptr, ctx, table, hasbits, data
// PROTOBUF_TC_PARSE_* decide which function is used to parse message-typed
// fields. The guard macros are defined in port_def.inc.
#if PROTOBUF_TC_STATIC_PARSE_SINGULAR1
#define PROTOBUF_TC_PARSE_SINGULAR1(MESSAGE) MESSAGE::Tct_ParseS1
#else
#define PROTOBUF_TC_PARSE_SINGULAR1(MESSAGE) \
::google::protobuf::internal::TcParserBase::SingularParseMessage<MESSAGE, uint8_t>
#endif // PROTOBUF_TC_STATIC_PARSE_SINGULAR1
#if PROTOBUF_TC_STATIC_PARSE_SINGULAR2
#define PROTOBUF_TC_PARSE_SINGULAR2(MESSAGE) MESSAGE::Tct_ParseS2
#else
#define PROTOBUF_TC_PARSE_SINGULAR2(MESSAGE) \
::google::protobuf::internal::TcParserBase::SingularParseMessage<MESSAGE, uint16_t>
#endif // PROTOBUF_TC_STATIC_PARSE_SINGULAR2
#if PROTOBUF_TC_STATIC_PARSE_REPEATED1
#define PROTOBUF_TC_PARSE_REPEATED1(MESSAGE) MESSAGE::Tct_ParseR1
#else
#define PROTOBUF_TC_PARSE_REPEATED1(MESSAGE) \
::google::protobuf::internal::TcParserBase::RepeatedParseMessage<MESSAGE, uint8_t>
#endif // PROTOBUF_TC_STATIC_PARSE_REPEATED1
#if PROTOBUF_TC_STATIC_PARSE_REPEATED2
#define PROTOBUF_TC_PARSE_REPEATED2(MESSAGE) MESSAGE::Tct_ParseR2
#else
#define PROTOBUF_TC_PARSE_REPEATED2(MESSAGE) \
::google::protobuf::internal::TcParserBase::RepeatedParseMessage<MESSAGE, uint16_t>
#endif // PROTOBUF_TC_STATIC_PARSE_REPEATED2
#ifndef NDEBUG
template <size_t align>
#ifndef _MSC_VER
[[noreturn]]
#endif
void AlignFail(uintptr_t address) {
GOOGLE_LOG(FATAL) << "Unaligned (" << align << ") access at " << address;
}
extern template void AlignFail<4>(uintptr_t);
extern template void AlignFail<8>(uintptr_t);
#endif
class TcParserBase { class TcParserBase {
public: public:
static const char* GenericFallback(PROTOBUF_TC_PARAM_DECL); static const char* GenericFallback(PROTOBUF_TC_PARAM_DECL);
@@ -75,7 +114,7 @@ class TcParserBase {
template <typename FieldType, typename TagType> template <typename FieldType, typename TagType>
PROTOBUF_NOINLINE static const char* SingularParseMessage( PROTOBUF_NOINLINE static const char* SingularParseMessage(
PROTOBUF_TC_PARAM_DECL) { PROTOBUF_TC_PARAM_DECL) {
if (PROTOBUF_PREDICT_FALSE(static_cast<TagType>(data.coded_tag()) != 0)) { if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) {
return table->fallback(PROTOBUF_TC_PARAM_PASS); return table->fallback(PROTOBUF_TC_PARAM_PASS);
} }
ptr += sizeof(TagType); ptr += sizeof(TagType);
@@ -96,7 +135,7 @@ class TcParserBase {
template <typename FieldType, typename TagType> template <typename FieldType, typename TagType>
PROTOBUF_NOINLINE static const char* RepeatedParseMessage( PROTOBUF_NOINLINE static const char* RepeatedParseMessage(
PROTOBUF_TC_PARAM_DECL) { PROTOBUF_TC_PARAM_DECL) {
if (PROTOBUF_PREDICT_FALSE(static_cast<TagType>(data.coded_tag()) != 0)) { if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) {
return table->fallback(PROTOBUF_TC_PARAM_PASS); return table->fallback(PROTOBUF_TC_PARAM_PASS);
} }
ptr += sizeof(TagType); ptr += sizeof(TagType);
@@ -123,11 +162,15 @@ class TcParserBase {
template <typename TagType, Utf8Type utf8> template <typename TagType, Utf8Type utf8>
static const char* RepeatedString(PROTOBUF_TC_PARAM_DECL); static const char* RepeatedString(PROTOBUF_TC_PARAM_DECL);
protected:
template <typename T> template <typename T>
static T& RefAt(void* x, size_t offset) { static inline T& RefAt(void* x, size_t offset) {
T* target = reinterpret_cast<T*>(static_cast<char*>(x) + offset); T* target = reinterpret_cast<T*>(static_cast<char*>(x) + offset);
GOOGLE_DCHECK_EQ(0, reinterpret_cast<uintptr_t>(target) % alignof(T)); #ifndef NDEBUG
if (PROTOBUF_PREDICT_FALSE(
reinterpret_cast<uintptr_t>(target) % alignof(T) != 0)) {
AlignFail<alignof(T)>(reinterpret_cast<uintptr_t>(target));
}
#endif
return *target; return *target;
} }
@@ -141,6 +184,7 @@ class TcParserBase {
} }
} }
protected:
static inline PROTOBUF_ALWAYS_INLINE const char* Return( static inline PROTOBUF_ALWAYS_INLINE const char* Return(
PROTOBUF_TC_PARAM_DECL) { PROTOBUF_TC_PARAM_DECL) {
SyncHasbits(msg, hasbits, table); SyncHasbits(msg, hasbits, table);

View File

@@ -30,226 +30,124 @@
// clang-format off // clang-format off
#ifdef PROTOBUF_TCT_SOURCE #ifdef PROTOBUF_TCT_SOURCE
template const char* TcParser<1>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); #define PROTOBUF_TCT_EXTERN
template const char* TcParser<2>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<3>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<4>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<5>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::PackedFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<1>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<2>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<3>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<4>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<5>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::PackedFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<1>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<2>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<3>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<4>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<5>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::PackedVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<1>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<2>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<3>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<4>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<5>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::PackedVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<1>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<2>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<3>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<4>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<5>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::PackedVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<1>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<2>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<3>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<4>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<5>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::PackedVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<1>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<2>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<3>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<4>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<5>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::PackedVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<1>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<2>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<3>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<4>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<5>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::PackedFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<1>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<2>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<3>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<4>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<5>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::PackedFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<1>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<2>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<3>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<4>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<5>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::PackedVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<1>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<2>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<3>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<4>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<5>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::PackedVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<1>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<2>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<3>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<4>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<5>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::PackedVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<1>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<2>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<3>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<4>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<5>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::PackedVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<1>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<2>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<3>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<4>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParser<5>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::PackedVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
#else #else
extern template const char* TcParser<1>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); #define PROTOBUF_TCT_EXTERN extern
extern template const char* TcParser<2>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<3>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<4>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<5>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::PackedFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<1>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<2>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<3>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<4>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<5>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::PackedFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<1>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<2>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<3>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<4>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<5>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::PackedVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<1>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<2>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<3>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<4>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<5>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::PackedVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<1>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<2>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<3>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<4>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<5>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::PackedVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<1>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<2>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<3>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<4>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<5>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::PackedVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<1>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<2>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<3>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<4>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<5>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::PackedVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<1>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<2>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<3>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<4>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<5>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::PackedFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<1>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<2>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<3>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<4>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<5>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::PackedFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<1>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<2>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<3>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<4>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<5>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::PackedVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<1>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<2>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<3>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<4>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<5>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::PackedVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<1>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<2>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<3>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<4>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<5>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::PackedVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<1>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<2>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<3>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<4>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<5>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::PackedVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<1>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<2>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<3>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<4>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParser<5>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::PackedVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
extern template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
#endif #endif
PROTOBUF_TCT_EXTERN template const char *TcParser<1>::ParseLoop(::PROTOBUF_NAMESPACE_ID::MessageLite*, char const*, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext*, ::PROTOBUF_NAMESPACE_ID::internal::TailCallParseTableBase const*);
PROTOBUF_TCT_EXTERN template const char *TcParser<2>::ParseLoop(::PROTOBUF_NAMESPACE_ID::MessageLite*, char const*, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext*, ::PROTOBUF_NAMESPACE_ID::internal::TailCallParseTableBase const*);
PROTOBUF_TCT_EXTERN template const char *TcParser<3>::ParseLoop(::PROTOBUF_NAMESPACE_ID::MessageLite*, char const*, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext*, ::PROTOBUF_NAMESPACE_ID::internal::TailCallParseTableBase const*);
PROTOBUF_TCT_EXTERN template const char *TcParser<4>::ParseLoop(::PROTOBUF_NAMESPACE_ID::MessageLite*, char const*, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext*, ::PROTOBUF_NAMESPACE_ID::internal::TailCallParseTableBase const*);
PROTOBUF_TCT_EXTERN template const char *TcParser<5>::ParseLoop(::PROTOBUF_NAMESPACE_ID::MessageLite*, char const*, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext*, ::PROTOBUF_NAMESPACE_ID::internal::TailCallParseTableBase const*);
PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
#undef PROTOBUF_TCT_EXTERN
// clang-format on // clang-format on

View File

@@ -132,27 +132,28 @@ bool AllAreInitializedWeak(const RepeatedPtrField<T>& t) {
return true; return true;
} }
inline bool IsPresent(const void* base, uint32 hasbit) { inline bool IsPresent(const void* base, uint32_t hasbit) {
const uint32* has_bits_array = static_cast<const uint32*>(base); const uint32_t* has_bits_array = static_cast<const uint32_t*>(base);
return (has_bits_array[hasbit / 32] & (1u << (hasbit & 31))) != 0; return (has_bits_array[hasbit / 32] & (1u << (hasbit & 31))) != 0;
} }
inline bool IsOneofPresent(const void* base, uint32 offset, uint32 tag) { inline bool IsOneofPresent(const void* base, uint32_t offset, uint32_t tag) {
const uint32* oneof = const uint32_t* oneof = reinterpret_cast<const uint32_t*>(
reinterpret_cast<const uint32*>(static_cast<const uint8*>(base) + offset); static_cast<const uint8_t*>(base) + offset);
return *oneof == tag >> 3; return *oneof == tag >> 3;
} }
typedef void (*SpecialSerializer)(const uint8* base, uint32 offset, uint32 tag, typedef void (*SpecialSerializer)(const uint8_t* base, uint32_t offset,
uint32 has_offset, uint32_t tag, uint32_t has_offset,
io::CodedOutputStream* output); io::CodedOutputStream* output);
PROTOBUF_EXPORT void ExtensionSerializer(const uint8* base, uint32 offset, PROTOBUF_EXPORT void ExtensionSerializer(const MessageLite* extendee,
uint32 tag, uint32 has_offset, const uint8_t* ptr, uint32_t offset,
uint32_t tag, uint32_t has_offset,
io::CodedOutputStream* output); io::CodedOutputStream* output);
PROTOBUF_EXPORT void UnknownFieldSerializerLite(const uint8* base, PROTOBUF_EXPORT void UnknownFieldSerializerLite(const uint8_t* base,
uint32 offset, uint32 tag, uint32_t offset, uint32_t tag,
uint32 has_offset, uint32_t has_offset,
io::CodedOutputStream* output); io::CodedOutputStream* output);
PROTOBUF_EXPORT MessageLite* DuplicateIfNonNullInternal(MessageLite* message); PROTOBUF_EXPORT MessageLite* DuplicateIfNonNullInternal(MessageLite* message);

View File

@@ -53,11 +53,11 @@ class HasBits {
memset(has_bits_, 0, sizeof(has_bits_)); memset(has_bits_, 0, sizeof(has_bits_));
} }
PROTOBUF_NDEBUG_INLINE uint32& operator[](int index) { PROTOBUF_NDEBUG_INLINE uint32_t& operator[](int index) {
return has_bits_[index]; return has_bits_[index];
} }
PROTOBUF_NDEBUG_INLINE const uint32& operator[](int index) const { PROTOBUF_NDEBUG_INLINE const uint32_t& operator[](int index) const {
return has_bits_[index]; return has_bits_[index];
} }
@@ -76,7 +76,7 @@ class HasBits {
bool empty() const; bool empty() const;
private: private:
uint32 has_bits_[doublewords]; uint32_t has_bits_[doublewords];
}; };
template <> template <>

View File

@@ -80,7 +80,7 @@ class PROTOBUF_EXPORT ImplicitWeakMessage : public MessageLite {
size_t ByteSizeLong() const override { return data_.size(); } size_t ByteSizeLong() const override { return data_.size(); }
uint8* _InternalSerialize(uint8* target, uint8_t* _InternalSerialize(uint8_t* target,
io::EpsCopyOutputStream* stream) const final { io::EpsCopyOutputStream* stream) const final {
return stream->WriteRaw(data_.data(), static_cast<int>(data_.size()), return stream->WriteRaw(data_.data(), static_cast<int>(data_.size()),
target); target);

View File

@@ -0,0 +1,384 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef GOOGLE_PROTOBUF_INLINED_STRING_FIELD_H__
#define GOOGLE_PROTOBUF_INLINED_STRING_FIELD_H__
#include <string>
#include <utility>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/arenastring.h>
#include <google/protobuf/message_lite.h>
#include <google/protobuf/port.h>
#include <google/protobuf/stubs/strutil.h>
// Must be included last.
#include <google/protobuf/port_def.inc>
#ifdef SWIG
#error "You cannot SWIG proto headers"
#endif
namespace google {
namespace protobuf {
class Arena;
namespace internal {
// InlinedStringField wraps a std::string instance and exposes an API similar to
// ArenaStringPtr's wrapping of a std::string* instance.
//
// default_value parameters are taken for consistency with ArenaStringPtr, but
// are not used for most methods. With inlining, these should be removed from
// the generated binary.
//
// InlinedStringField has a donating mechanism that allows string buffer
// allocated on arena. A string is donated means both the string container and
// the data buffer are on arena. The donating mechanism here is similar to the
// one in ArenaStringPtr with some differences:
//
// When an InlinedStringField is constructed, the donating state is true. This
// is because the string container is directly stored in the message on the
// arena:
//
// Construction: donated=true
// Arena:
// +-----------------------+
// |Message foo: |
// | +-------------------+ |
// | |InlinedStringField:| |
// | | +-----+ | |
// | | | | | | | |
// | | +-----+ | |
// | +-------------------+ |
// +-----------------------+
//
// When lvalue Set is called, the donating state is still true. String data will
// be allocated on the arena:
//
// Lvalue Set: donated=true
// Arena:
// +-----------------------+
// |Message foo: |
// | +-------------------+ |
// | |InlinedStringField:| |
// | | +-----+ | |
// | | | | | | | |
// | | +|----+ | |
// | +--|----------------+ |
// | V |
// | +----------------+ |
// | |'f','o','o',... | |
// | +----------------+ |
// +-----------------------+
//
// Some operations will undonate a donated string, including: Mutable,
// SetAllocated, Rvalue Set, and Swap with a non-donated string.
//
// For more details of the donating states transitions, go/pd-inlined-string.
class PROTOBUF_EXPORT InlinedStringField {
public:
InlinedStringField() { Init(); }
inline void Init() { new (get_mutable()) std::string(); }
// Add the dummy parameter just to make InlinedStringField(nullptr)
// unambiguous.
constexpr InlinedStringField(
const ExplicitlyConstructed<std::string>* /*default_value*/,
bool /*dummy*/)
: value_{} {}
explicit InlinedStringField(const std::string& default_value);
explicit InlinedStringField(Arena* arena);
~InlinedStringField() { Destruct(); }
// Lvalue Set. To save space, we pack the donating states of multiple
// InlinedStringFields into an uint32_t `donating_states`. The `mask`
// indicates the position of the bit for this InlinedStringField. `donated` is
// whether this field is donated.
//
// The caller should guarantee that:
//
// `donated == ((donating_states & ~mask) != 0)`
//
// This method never changes the `donating_states`.
void Set(const std::string* default_value, ConstStringParam value,
Arena* arena, bool donated, uint32_t* /*donating_states*/,
uint32_t /*mask*/) {
(void)arena;
(void)donated;
SetNoArena(default_value, value);
}
// Rvalue Set. If this field is donated, this method will undonate this field
// by mutating the `donating_states` according to `mask`.
void Set(const std::string* default_value, std::string&& value, Arena* arena,
bool donated, uint32_t* donating_states, uint32_t mask);
template <typename FirstParam>
void Set(FirstParam p1, const char* str, ::google::protobuf::Arena* arena, bool donated,
uint32_t* donating_states, uint32_t mask) {
Set(p1, ConstStringParam(str), arena, donated, donating_states, mask);
}
template <typename FirstParam>
void Set(FirstParam p1, const char* str, size_t size, ::google::protobuf::Arena* arena,
bool donated, uint32_t* donating_states, uint32_t mask) {
ConstStringParam sp{str, size}; // for string_view and `const string &`
Set(p1, sp, arena, donated, donating_states, mask);
}
template <typename FirstParam, typename RefWrappedType>
void Set(FirstParam p1,
std::reference_wrapper<RefWrappedType> const_string_ref,
::google::protobuf::Arena* arena, bool donated, uint32_t* donating_states,
uint32_t mask) {
Set(p1, const_string_ref.get(), arena, donated, donating_states, mask);
}
template <typename FirstParam, typename SecondParam>
void SetBytes(FirstParam p1, SecondParam&& p2, ::google::protobuf::Arena* arena,
bool donated, uint32_t* donating_states, uint32_t mask) {
Set(p1, static_cast<SecondParam&&>(p2), arena, donated, donating_states,
mask);
}
template <typename FirstParam>
void SetBytes(FirstParam p1, const void* str, size_t size,
::google::protobuf::Arena* arena, bool donated, uint32_t* donating_states,
uint32_t mask) {
// Must work whether ConstStringParam is string_view or `const string &`
ConstStringParam sp{static_cast<const char*>(str), size};
Set(p1, sp, arena, donated, donating_states, mask);
}
PROTOBUF_NDEBUG_INLINE void SetNoArena(const std::string* default_value,
StringPiece value);
PROTOBUF_NDEBUG_INLINE void SetNoArena(const std::string* default_value,
std::string&& value);
// Basic accessors.
PROTOBUF_NDEBUG_INLINE const std::string& Get() const { return GetNoArena(); }
PROTOBUF_NDEBUG_INLINE const std::string& GetNoArena() const;
// Mutable returns a std::string* instance that is heap-allocated. If this
// field is donated, this method undonates this field by mutating the
// `donating_states` according to `mask`, and copies the content of the
// original string to the returning string.
std::string* Mutable(const LazyString& default_value, Arena* arena,
bool donated, uint32_t* donating_states, uint32_t mask);
std::string* Mutable(ArenaStringPtr::EmptyDefault, Arena* arena, bool donated,
uint32_t* donating_states, uint32_t mask);
// Release returns a std::string* instance that is heap-allocated and is not
// Own()'d by any arena. If the field is not set, this returns NULL. The
// caller retains ownership. Clears this field back to NULL state. Used to
// implement release_<field>() methods on generated classes.
PROTOBUF_MUST_USE_RESULT std::string* Release(
const std::string* default_value, Arena* arena, bool donated);
PROTOBUF_MUST_USE_RESULT std::string* ReleaseNonDefault(
const std::string* default_value, Arena* arena);
std::string* ReleaseNonDefaultNoArena(const std::string* default_value);
// Takes a std::string that is heap-allocated, and takes ownership. The
// std::string's destructor is registered with the arena. Used to implement
// set_allocated_<field> in generated classes.
//
// If this field is donated, this method undonates this field by mutating the
// `donating_states` according to `mask`.
void SetAllocated(const std::string* default_value, std::string* value,
Arena* arena, bool donated, uint32_t* donating_states,
uint32_t mask);
void SetAllocatedNoArena(const std::string* default_value,
std::string* value);
// When one of `this` and `from` is donated and the other is not donated, this
// method will undonate the donated one and swap the two heap-allocated
// strings.
PROTOBUF_NDEBUG_INLINE void Swap(InlinedStringField* from,
const std::string* default_value,
Arena* arena, bool donated,
bool from_donated, uint32_t* donating_states,
uint32_t* from_donating_states,
uint32_t mask);
// Frees storage (if not on an arena).
PROTOBUF_NDEBUG_INLINE void Destroy(const std::string* default_value,
Arena* arena) {
if (arena == nullptr) {
DestroyNoArena(default_value);
}
}
PROTOBUF_NDEBUG_INLINE void DestroyNoArena(const std::string* default_value);
// Clears content, but keeps allocated std::string, to avoid the overhead of
// heap operations. After this returns, the content (as seen by the user) will
// always be the empty std::string.
PROTOBUF_NDEBUG_INLINE void ClearToEmpty() { ClearNonDefaultToEmpty(); }
PROTOBUF_NDEBUG_INLINE void ClearNonDefaultToEmpty() {
get_mutable()->clear();
}
// Clears content, but keeps allocated std::string if arena != NULL, to avoid
// the overhead of heap operations. After this returns, the content (as seen
// by the user) will always be equal to |default_value|.
void ClearToDefault(const LazyString& default_value, Arena* arena,
bool donated);
// Returns a mutable pointer, but doesn't initialize the string to the
// default value.
PROTOBUF_NDEBUG_INLINE std::string* MutableNoArenaNoDefault(
const std::string* /*default_value*/);
// Generated code / reflection only! Returns a mutable pointer to the string.
PROTOBUF_NDEBUG_INLINE std::string* UnsafeMutablePointer();
// InlinedStringField doesn't have things like the `default_value` pointer in
// ArenaStringPtr.
bool IsDefault(const std::string* /*default_value*/) const { return false; }
private:
void Destruct() { get_mutable()->~basic_string(); }
PROTOBUF_NDEBUG_INLINE std::string* get_mutable();
PROTOBUF_NDEBUG_INLINE const std::string* get_const() const;
alignas(std::string) char value_[sizeof(std::string)];
std::string* MutableSlow(::google::protobuf::Arena* arena, bool donated,
uint32_t* donating_states, uint32_t mask);
// When constructed in an Arena, we want our destructor to be skipped.
friend class ::google::protobuf::Arena;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
};
inline std::string* InlinedStringField::get_mutable() {
return reinterpret_cast<std::string*>(&value_);
}
inline const std::string* InlinedStringField::get_const() const {
return reinterpret_cast<const std::string*>(&value_);
}
inline InlinedStringField::InlinedStringField(
const std::string& default_value) {
new (get_mutable()) std::string(default_value);
}
inline InlinedStringField::InlinedStringField(Arena* arena) {
Init();
if (arena != nullptr) {
arena->OwnDestructor(get_mutable());
}
}
inline const std::string& InlinedStringField::GetNoArena() const {
return *get_const();
}
inline void InlinedStringField::SetAllocatedNoArena(
const std::string* /*default_value*/, std::string* value) {
if (value == nullptr) {
// Currently, inlined string field can't have non empty default.
get_mutable()->clear();
} else {
get_mutable()->assign(std::move(*value));
delete value;
}
}
inline void InlinedStringField::DestroyNoArena(const std::string*) {
// This is invoked from the generated message's ArenaDtor, which is used to
// clean up objects not allocated on the Arena.
this->~InlinedStringField();
}
inline std::string* InlinedStringField::ReleaseNonDefaultNoArena(
const std::string* /*default_value*/) {
// Currently, inlined string field can't have non empty default.
auto* released = new std::string();
get_mutable()->swap(*released);
return released;
}
inline void InlinedStringField::SetNoArena(const std::string* /*default_value*/,
StringPiece value) {
get_mutable()->assign(value.data(), value.length());
}
inline void InlinedStringField::SetNoArena(const std::string* /*default_value*/,
std::string&& value) {
get_mutable()->assign(std::move(value));
}
inline void InlinedStringField::Swap(
InlinedStringField* from, const std::string* /*default_value*/,
Arena* arena, bool donated, bool from_donated, uint32_t* donating_states,
uint32_t* from_donating_states, uint32_t mask) {
#if GOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE
// If one is donated and the other is not, undonate the donated one.
if (donated && !from_donated) {
MutableSlow(arena, donated, donating_states, mask);
} else if (!donated && from_donated) {
from->MutableSlow(arena, from_donated, from_donating_states, mask);
}
// Then, swap the two undonated strings.
#else
(void)arena;
(void)donated;
(void)from_donated;
(void)donating_states;
(void)from_donating_states;
(void)mask;
#endif
get_mutable()->swap(*from->get_mutable());
}
inline std::string* InlinedStringField::MutableNoArenaNoDefault(
const std::string*) {
return get_mutable();
}
inline std::string* InlinedStringField::UnsafeMutablePointer() {
return get_mutable();
}
} // namespace internal
} // namespace protobuf
} // namespace google
#include <google/protobuf/port_undef.inc>
#endif // GOOGLE_PROTOBUF_INLINED_STRING_FIELD_H__

File diff suppressed because it is too large Load Diff

View File

@@ -80,10 +80,10 @@ class PROTOBUF_EXPORT GzipInputStream : public ZeroCopyInputStream {
inline int ZlibErrorCode() const { return zerror_; } inline int ZlibErrorCode() const { return zerror_; }
// implements ZeroCopyInputStream ---------------------------------- // implements ZeroCopyInputStream ----------------------------------
bool Next(const void** data, int* size); bool Next(const void** data, int* size) override;
void BackUp(int count); void BackUp(int count) override;
bool Skip(int count); bool Skip(int count) override;
int64_t ByteCount() const; int64_t ByteCount() const override;
private: private:
Format format_; Format format_;
@@ -96,7 +96,7 @@ class PROTOBUF_EXPORT GzipInputStream : public ZeroCopyInputStream {
void* output_buffer_; void* output_buffer_;
void* output_position_; void* output_position_;
size_t output_buffer_length_; size_t output_buffer_length_;
int64 byte_count_; int64_t byte_count_;
int Inflate(int flush); int Inflate(int flush);
void DoNextOutput(const void** data, int* size); void DoNextOutput(const void** data, int* size);
@@ -167,9 +167,9 @@ class PROTOBUF_EXPORT GzipOutputStream : public ZeroCopyOutputStream {
bool Close(); bool Close();
// implements ZeroCopyOutputStream --------------------------------- // implements ZeroCopyOutputStream ---------------------------------
bool Next(void** data, int* size); bool Next(void** data, int* size) override;
void BackUp(int count); void BackUp(int count) override;
int64_t ByteCount() const; int64_t ByteCount() const override;
private: private:
ZeroCopyOutputStream* sub_stream_; ZeroCopyOutputStream* sub_stream_;

View File

@@ -84,7 +84,7 @@ class AnnotationProtoCollector : public AnnotationCollector {
// Override for AnnotationCollector::AddAnnotation. // Override for AnnotationCollector::AddAnnotation.
virtual void AddAnnotation(size_t begin_offset, size_t end_offset, virtual void AddAnnotation(size_t begin_offset, size_t end_offset,
const std::string& file_path, const std::string& file_path,
const std::vector<int>& path) { const std::vector<int>& path) override {
typename AnnotationProto::Annotation* annotation = typename AnnotationProto::Annotation* annotation =
annotation_proto_->add_annotation(); annotation_proto_->add_annotation();
for (int i = 0; i < path.size(); ++i) { for (int i = 0; i < path.size(); ++i) {
@@ -95,7 +95,7 @@ class AnnotationProtoCollector : public AnnotationCollector {
annotation->set_end(end_offset); annotation->set_end(end_offset);
} }
// Override for AnnotationCollector::AddAnnotation. // Override for AnnotationCollector::AddAnnotation.
virtual void AddAnnotationNew(Annotation& a) { virtual void AddAnnotationNew(Annotation& a) override {
auto* annotation = annotation_proto_->add_annotation(); auto* annotation = annotation_proto_->add_annotation();
annotation->ParseFromString(a.second); annotation->ParseFromString(a.second);
annotation->set_begin(a.first.first); annotation->set_begin(a.first.first);

View File

@@ -217,8 +217,8 @@ class PROTOBUF_EXPORT Tokenizer {
// result. If the text is not from a Token of type TYPE_INTEGER originally // result. If the text is not from a Token of type TYPE_INTEGER originally
// parsed by a Tokenizer, the result is undefined (possibly an assert // parsed by a Tokenizer, the result is undefined (possibly an assert
// failure). // failure).
static bool ParseInteger(const std::string& text, uint64 max_value, static bool ParseInteger(const std::string& text, uint64_t max_value,
uint64* output); uint64_t* output);
// Options --------------------------------------------------------- // Options ---------------------------------------------------------

View File

@@ -311,7 +311,7 @@ class PROTOBUF_EXPORT ConcatenatingInputStream : public ZeroCopyInputStream {
// decremented. // decremented.
ZeroCopyInputStream* const* streams_; ZeroCopyInputStream* const* streams_;
int stream_count_; int stream_count_;
int64 bytes_retired_; // Bytes read from previous streams. int64_t bytes_retired_; // Bytes read from previous streams.
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ConcatenatingInputStream); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ConcatenatingInputStream);
}; };

View File

@@ -84,7 +84,7 @@ class PROTOBUF_EXPORT ArrayInputStream : public ZeroCopyInputStream {
private: private:
const uint8* const data_; // The byte array. const uint8_t* const data_; // The byte array.
const int size_; // Total size of the array. const int size_; // Total size of the array.
const int block_size_; // How many bytes to return at a time. const int block_size_; // How many bytes to return at a time.
@@ -116,7 +116,7 @@ class PROTOBUF_EXPORT ArrayOutputStream : public ZeroCopyOutputStream {
int64_t ByteCount() const override; int64_t ByteCount() const override;
private: private:
uint8* const data_; // The byte array. uint8_t* const data_; // The byte array.
const int size_; // Total size of the array. const int size_; // Total size of the array.
const int block_size_; // How many bytes to return at a time. const int block_size_; // How many bytes to return at a time.
@@ -236,11 +236,11 @@ class PROTOBUF_EXPORT CopyingInputStreamAdaptor : public ZeroCopyInputStream {
// The current position of copying_stream_, relative to the point where // The current position of copying_stream_, relative to the point where
// we started reading. // we started reading.
int64 position_; int64_t position_;
// Data is read into this buffer. It may be NULL if no buffer is currently // Data is read into this buffer. It may be NULL if no buffer is currently
// in use. Otherwise, it points to an array of size buffer_size_. // in use. Otherwise, it points to an array of size buffer_size_.
std::unique_ptr<uint8[]> buffer_; std::unique_ptr<uint8_t[]> buffer_;
const int buffer_size_; const int buffer_size_;
// Number of valid bytes currently in the buffer (i.e. the size last // Number of valid bytes currently in the buffer (i.e. the size last
@@ -327,11 +327,11 @@ class PROTOBUF_EXPORT CopyingOutputStreamAdaptor : public ZeroCopyOutputStream {
// The current position of copying_stream_, relative to the point where // The current position of copying_stream_, relative to the point where
// we started writing. // we started writing.
int64 position_; int64_t position_;
// Data is written from this buffer. It may be NULL if no buffer is // Data is written from this buffer. It may be NULL if no buffer is
// currently in use. Otherwise, it points to an array of size buffer_size_. // currently in use. Otherwise, it points to an array of size buffer_size_.
std::unique_ptr<uint8[]> buffer_; std::unique_ptr<uint8_t[]> buffer_;
const int buffer_size_; const int buffer_size_;
// Number of valid bytes currently in the buffer (i.e. the size last // Number of valid bytes currently in the buffer (i.e. the size last
@@ -348,7 +348,7 @@ class PROTOBUF_EXPORT CopyingOutputStreamAdaptor : public ZeroCopyOutputStream {
// a particular byte count. // a particular byte count.
class PROTOBUF_EXPORT LimitingInputStream : public ZeroCopyInputStream { class PROTOBUF_EXPORT LimitingInputStream : public ZeroCopyInputStream {
public: public:
LimitingInputStream(ZeroCopyInputStream* input, int64 limit); LimitingInputStream(ZeroCopyInputStream* input, int64_t limit);
~LimitingInputStream() override; ~LimitingInputStream() override;
// implements ZeroCopyInputStream ---------------------------------- // implements ZeroCopyInputStream ----------------------------------
@@ -360,8 +360,8 @@ class PROTOBUF_EXPORT LimitingInputStream : public ZeroCopyInputStream {
private: private:
ZeroCopyInputStream* input_; ZeroCopyInputStream* input_;
int64 limit_; // Decreases as we go, becomes negative if we overshoot. int64_t limit_; // Decreases as we go, becomes negative if we overshoot.
int64 prior_bytes_read_; // Bytes read on underlying stream at construction int64_t prior_bytes_read_; // Bytes read on underlying stream at construction
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(LimitingInputStream); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(LimitingInputStream);
}; };

View File

@@ -118,7 +118,7 @@ class MapAllocator {
return static_cast<pointer>(::operator new(n * sizeof(value_type))); return static_cast<pointer>(::operator new(n * sizeof(value_type)));
} else { } else {
return reinterpret_cast<pointer>( return reinterpret_cast<pointer>(
Arena::CreateArray<uint8>(arena_, n * sizeof(value_type))); Arena::CreateArray<uint8_t>(arena_, n * sizeof(value_type)));
} }
} }
@@ -698,21 +698,18 @@ class Map {
p = FindHelper(k); p = FindHelper(k);
} }
const size_type b = p.second; // bucket number const size_type b = p.second; // bucket number
Node* node;
// If K is not key_type, make the conversion to key_type explicit. // If K is not key_type, make the conversion to key_type explicit.
using TypeToInit = typename std::conditional< using TypeToInit = typename std::conditional<
std::is_same<typename std::decay<K>::type, key_type>::value, K&&, std::is_same<typename std::decay<K>::type, key_type>::value, K&&,
key_type>::type; key_type>::type;
if (alloc_.arena() == nullptr) { Node* node = Alloc<Node>(1);
node = new Node{value_type(static_cast<TypeToInit>(std::forward<K>(k))), // Even when arena is nullptr, CreateInArenaStorage is still used to
nullptr}; // ensure the arena of submessage will be consistent. Otherwise,
} else { // submessage may have its own arena when message-owned arena is enabled.
node = Alloc<Node>(1); Arena::CreateInArenaStorage(const_cast<Key*>(&node->kv.first),
Arena::CreateInArenaStorage( alloc_.arena(),
const_cast<Key*>(&node->kv.first), alloc_.arena(),
static_cast<TypeToInit>(std::forward<K>(k))); static_cast<TypeToInit>(std::forward<K>(k)));
Arena::CreateInArenaStorage(&node->kv.second, alloc_.arena()); Arena::CreateInArenaStorage(&node->kv.second, alloc_.arena());
}
iterator result = InsertUnique(b, node); iterator result = InsertUnique(b, node);
++num_elements_; ++num_elements_;
@@ -1026,12 +1023,12 @@ class Map {
size_type BucketNumber(const K& k) const { size_type BucketNumber(const K& k) const {
// We xor the hash value against the random seed so that we effectively // We xor the hash value against the random seed so that we effectively
// have a random hash function. // have a random hash function.
uint64 h = hash_function()(k) ^ seed_; uint64_t h = hash_function()(k) ^ seed_;
// We use the multiplication method to determine the bucket number from // We use the multiplication method to determine the bucket number from
// the hash value. The constant kPhi (suggested by Knuth) is roughly // the hash value. The constant kPhi (suggested by Knuth) is roughly
// (sqrt(5) - 1) / 2 * 2^64. // (sqrt(5) - 1) / 2 * 2^64.
constexpr uint64 kPhi = uint64{0x9e3779b97f4a7c15}; constexpr uint64_t kPhi = uint64_t{0x9e3779b97f4a7c15};
return ((kPhi * h) >> 32) & (num_buckets_ - 1); return ((kPhi * h) >> 32) & (num_buckets_ - 1);
} }
@@ -1071,7 +1068,7 @@ class Map {
void** CreateEmptyTable(size_type n) { void** CreateEmptyTable(size_type n) {
GOOGLE_DCHECK(n >= kMinTableSize); GOOGLE_DCHECK(n >= kMinTableSize);
GOOGLE_DCHECK_EQ(n & (n - 1), 0); GOOGLE_DCHECK_EQ(n & (n - 1), 0u);
void** result = Alloc<void*>(n); void** result = Alloc<void*>(n);
memset(result, 0, n * sizeof(result[0])); memset(result, 0, n * sizeof(result[0]));
return result; return result;
@@ -1082,12 +1079,12 @@ class Map {
// We get a little bit of randomness from the address of the map. The // We get a little bit of randomness from the address of the map. The
// lower bits are not very random, due to alignment, so we discard them // lower bits are not very random, due to alignment, so we discard them
// and shift the higher bits into their place. // and shift the higher bits into their place.
size_type s = reinterpret_cast<uintptr_t>(this) >> 12; size_type s = reinterpret_cast<uintptr_t>(this) >> 4;
#if defined(__x86_64__) && defined(__GNUC__) && \ #if defined(__x86_64__) && defined(__GNUC__) && \
!defined(GOOGLE_PROTOBUF_NO_RDTSC) !defined(GOOGLE_PROTOBUF_NO_RDTSC)
uint32 hi, lo; uint32_t hi, lo;
asm volatile("rdtsc" : "=a"(lo), "=d"(hi)); asm volatile("rdtsc" : "=a"(lo), "=d"(hi));
s += ((static_cast<uint64>(hi) << 32) | lo); s += ((static_cast<uint64_t>(hi) << 32) | lo);
#endif #endif
return s; return s;
} }

View File

@@ -78,8 +78,8 @@ namespace internal {
// field. // field.
// //
// cpp type | proto type | in-memory type | MapEntry accessor type // cpp type | proto type | in-memory type | MapEntry accessor type
// int32 TYPE_INT32 int32 int32 // int32_t TYPE_INT32 int32_t int32_t
// int32 TYPE_FIXED32 int32 int32 // int32_t TYPE_FIXED32 int32_t int32_t
// string TYPE_STRING ArenaStringPtr string // string TYPE_STRING ArenaStringPtr string
// FooEnum TYPE_ENUM int int // FooEnum TYPE_ENUM int int
// FooMessage TYPE_MESSAGE FooMessage* FooMessage // FooMessage TYPE_MESSAGE FooMessage* FooMessage

View File

@@ -107,8 +107,8 @@ struct MapEntryFuncs {
static const int kKeyFieldNumber = 1; static const int kKeyFieldNumber = 1;
static const int kValueFieldNumber = 2; static const int kValueFieldNumber = 2;
static uint8* InternalSerialize(int field_number, const Key& key, static uint8_t* InternalSerialize(int field_number, const Key& key,
const Value& value, uint8* ptr, const Value& value, uint8_t* ptr,
io::EpsCopyOutputStream* stream) { io::EpsCopyOutputStream* stream) {
ptr = stream->EnsureSpace(ptr); ptr = stream->EnsureSpace(ptr);
ptr = WireFormatLite::WriteTagToArray( ptr = WireFormatLite::WriteTagToArray(
@@ -125,7 +125,7 @@ struct MapEntryFuncs {
size_t inner_length = size_t inner_length =
2 + KeyTypeHandler::ByteSize(key) + ValueTypeHandler::ByteSize(value); 2 + KeyTypeHandler::ByteSize(key) + ValueTypeHandler::ByteSize(value);
return inner_length + io::CodedOutputStream::VarintSize32( return inner_length + io::CodedOutputStream::VarintSize32(
static_cast<uint32>(inner_length)); static_cast<uint32_t>(inner_length));
} }
static int GetCachedSize(const Key& key, const Value& value) { static int GetCachedSize(const Key& key, const Value& value) {
@@ -167,9 +167,9 @@ class MapEntryImpl : public Base {
static const int kValueFieldNumber = 2; static const int kValueFieldNumber = 2;
// Constants for field tag. // Constants for field tag.
static const uint8 kKeyTag = static const uint8_t kKeyTag =
GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(kKeyFieldNumber, KeyTypeHandler::kWireType); GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(kKeyFieldNumber, KeyTypeHandler::kWireType);
static const uint8 kValueTag = GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG( static const uint8_t kValueTag = GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(
kValueFieldNumber, ValueTypeHandler::kWireType); kValueFieldNumber, ValueTypeHandler::kWireType);
static const size_t kTagSize = 1; static const size_t kTagSize = 1;
@@ -229,7 +229,7 @@ class MapEntryImpl : public Base {
const char* _InternalParse(const char* ptr, ParseContext* ctx) final { const char* _InternalParse(const char* ptr, ParseContext* ctx) final {
while (!ctx->Done(&ptr)) { while (!ctx->Done(&ptr)) {
uint32 tag; uint32_t tag;
ptr = ReadTag(ptr, &tag); ptr = ReadTag(ptr, &tag);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
if (tag == kKeyTag) { if (tag == kKeyTag) {
@@ -263,8 +263,8 @@ class MapEntryImpl : public Base {
return size; return size;
} }
::google::protobuf::uint8* _InternalSerialize(::google::protobuf::uint8* ptr, ::uint8_t* _InternalSerialize(
io::EpsCopyOutputStream* stream) const override { ::uint8_t* ptr, io::EpsCopyOutputStream* stream) const override {
ptr = KeyTypeHandler::Write(kKeyFieldNumber, key(), ptr, stream); ptr = KeyTypeHandler::Write(kKeyFieldNumber, key(), ptr, stream);
return ValueTypeHandler::Write(kValueFieldNumber, value(), ptr, stream); return ValueTypeHandler::Write(kValueFieldNumber, value(), ptr, stream);
} }
@@ -422,7 +422,8 @@ class MapEntryImpl : public Base {
template <typename UnknownType> template <typename UnknownType>
const char* ParseWithEnumValidation(const char* ptr, ParseContext* ctx, const char* ParseWithEnumValidation(const char* ptr, ParseContext* ctx,
bool (*is_valid)(int), uint32 field_num, bool (*is_valid)(int),
uint32_t field_num,
InternalMetadata* metadata) { InternalMetadata* metadata) {
auto entry = NewEntry(); auto entry = NewEntry();
ptr = entry->_InternalParse(ptr, ctx); ptr = entry->_InternalParse(ptr, ctx);
@@ -500,7 +501,7 @@ class MapEntryImpl : public Base {
public: // Needed for constructing tables public: // Needed for constructing tables
KeyOnMemory key_; KeyOnMemory key_;
ValueOnMemory value_; ValueOnMemory value_;
uint32 _has_bits_[1]; uint32_t _has_bits_[1];
private: private:
friend class ::PROTOBUF_NAMESPACE_ID::Arena; friend class ::PROTOBUF_NAMESPACE_ID::Arena;
@@ -641,8 +642,8 @@ struct MapEntryHelper<
// The proto compiler generates the offsets in this struct as if this was // The proto compiler generates the offsets in this struct as if this was
// a regular message. This way the table driven code barely notices it's // a regular message. This way the table driven code barely notices it's
// dealing with a map field. // dealing with a map field.
uint32 _has_bits_; // NOLINT uint32_t _has_bits_; // NOLINT
uint32 _cached_size_; // NOLINT uint32_t _cached_size_; // NOLINT
KeyOnMemory key_; // NOLINT KeyOnMemory key_; // NOLINT
ValueOnMemory value_; // NOLINT ValueOnMemory value_; // NOLINT
}; };

View File

@@ -95,19 +95,19 @@ class PROTOBUF_EXPORT MapKey {
return type_; return type_;
} }
void SetInt64Value(int64 value) { void SetInt64Value(int64_t value) {
SetType(FieldDescriptor::CPPTYPE_INT64); SetType(FieldDescriptor::CPPTYPE_INT64);
val_.int64_value_ = value; val_.int64_value_ = value;
} }
void SetUInt64Value(uint64 value) { void SetUInt64Value(uint64_t value) {
SetType(FieldDescriptor::CPPTYPE_UINT64); SetType(FieldDescriptor::CPPTYPE_UINT64);
val_.uint64_value_ = value; val_.uint64_value_ = value;
} }
void SetInt32Value(int32 value) { void SetInt32Value(int32_t value) {
SetType(FieldDescriptor::CPPTYPE_INT32); SetType(FieldDescriptor::CPPTYPE_INT32);
val_.int32_value_ = value; val_.int32_value_ = value;
} }
void SetUInt32Value(uint32 value) { void SetUInt32Value(uint32_t value) {
SetType(FieldDescriptor::CPPTYPE_UINT32); SetType(FieldDescriptor::CPPTYPE_UINT32);
val_.uint32_value_ = value; val_.uint32_value_ = value;
} }
@@ -120,19 +120,19 @@ class PROTOBUF_EXPORT MapKey {
*val_.string_value_.get_mutable() = std::move(val); *val_.string_value_.get_mutable() = std::move(val);
} }
int64 GetInt64Value() const { int64_t GetInt64Value() const {
TYPE_CHECK(FieldDescriptor::CPPTYPE_INT64, "MapKey::GetInt64Value"); TYPE_CHECK(FieldDescriptor::CPPTYPE_INT64, "MapKey::GetInt64Value");
return val_.int64_value_; return val_.int64_value_;
} }
uint64 GetUInt64Value() const { uint64_t GetUInt64Value() const {
TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT64, "MapKey::GetUInt64Value"); TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT64, "MapKey::GetUInt64Value");
return val_.uint64_value_; return val_.uint64_value_;
} }
int32 GetInt32Value() const { int32_t GetInt32Value() const {
TYPE_CHECK(FieldDescriptor::CPPTYPE_INT32, "MapKey::GetInt32Value"); TYPE_CHECK(FieldDescriptor::CPPTYPE_INT32, "MapKey::GetInt32Value");
return val_.int32_value_; return val_.int32_value_;
} }
uint32 GetUInt32Value() const { uint32_t GetUInt32Value() const {
TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT32, "MapKey::GetUInt32Value"); TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT32, "MapKey::GetUInt32Value");
return val_.uint32_value_; return val_.uint32_value_;
} }
@@ -242,10 +242,10 @@ class PROTOBUF_EXPORT MapKey {
union KeyValue { union KeyValue {
KeyValue() {} KeyValue() {}
internal::ExplicitlyConstructed<std::string> string_value_; internal::ExplicitlyConstructed<std::string> string_value_;
int64 int64_value_; int64_t int64_value_;
int32 int32_value_; int32_t int32_value_;
uint64 uint64_value_; uint64_t uint64_value_;
uint32 uint32_value_; uint32_t uint32_value_;
bool bool_value_; bool bool_value_;
} val_; } val_;
@@ -591,7 +591,7 @@ class MapField : public TypeDefinedMapFieldBase<Key, T> {
} }
template <typename UnknownType> template <typename UnknownType>
const char* ParseWithEnumValidation(const char* ptr, ParseContext* ctx, const char* ParseWithEnumValidation(const char* ptr, ParseContext* ctx,
bool (*is_valid)(int), uint32 field_num, bool (*is_valid)(int), uint32_t field_num,
InternalMetadata* metadata) { InternalMetadata* metadata) {
return impl_.template ParseWithEnumValidation<UnknownType>( return impl_.template ParseWithEnumValidation<UnknownType>(
ptr, ctx, is_valid, field_num, metadata); ptr, ctx, is_valid, field_num, metadata);
@@ -682,25 +682,25 @@ class PROTOBUF_EXPORT MapValueConstRef {
public: public:
MapValueConstRef() : data_(nullptr), type_() {} MapValueConstRef() : data_(nullptr), type_() {}
int64 GetInt64Value() const { int64_t GetInt64Value() const {
TYPE_CHECK(FieldDescriptor::CPPTYPE_INT64, TYPE_CHECK(FieldDescriptor::CPPTYPE_INT64,
"MapValueConstRef::GetInt64Value"); "MapValueConstRef::GetInt64Value");
return *reinterpret_cast<int64*>(data_); return *reinterpret_cast<int64_t*>(data_);
} }
uint64 GetUInt64Value() const { uint64_t GetUInt64Value() const {
TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT64, TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT64,
"MapValueConstRef::GetUInt64Value"); "MapValueConstRef::GetUInt64Value");
return *reinterpret_cast<uint64*>(data_); return *reinterpret_cast<uint64_t*>(data_);
} }
int32 GetInt32Value() const { int32_t GetInt32Value() const {
TYPE_CHECK(FieldDescriptor::CPPTYPE_INT32, TYPE_CHECK(FieldDescriptor::CPPTYPE_INT32,
"MapValueConstRef::GetInt32Value"); "MapValueConstRef::GetInt32Value");
return *reinterpret_cast<int32*>(data_); return *reinterpret_cast<int32_t*>(data_);
} }
uint32 GetUInt32Value() const { uint32_t GetUInt32Value() const {
TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT32, TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT32,
"MapValueConstRef::GetUInt32Value"); "MapValueConstRef::GetUInt32Value");
return *reinterpret_cast<uint32*>(data_); return *reinterpret_cast<uint32_t*>(data_);
} }
bool GetBoolValue() const { bool GetBoolValue() const {
TYPE_CHECK(FieldDescriptor::CPPTYPE_BOOL, "MapValueConstRef::GetBoolValue"); TYPE_CHECK(FieldDescriptor::CPPTYPE_BOOL, "MapValueConstRef::GetBoolValue");
@@ -774,21 +774,21 @@ class PROTOBUF_EXPORT MapValueRef final : public MapValueConstRef {
public: public:
MapValueRef() {} MapValueRef() {}
void SetInt64Value(int64 value) { void SetInt64Value(int64_t value) {
TYPE_CHECK(FieldDescriptor::CPPTYPE_INT64, "MapValueRef::SetInt64Value"); TYPE_CHECK(FieldDescriptor::CPPTYPE_INT64, "MapValueRef::SetInt64Value");
*reinterpret_cast<int64*>(data_) = value; *reinterpret_cast<int64_t*>(data_) = value;
} }
void SetUInt64Value(uint64 value) { void SetUInt64Value(uint64_t value) {
TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT64, "MapValueRef::SetUInt64Value"); TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT64, "MapValueRef::SetUInt64Value");
*reinterpret_cast<uint64*>(data_) = value; *reinterpret_cast<uint64_t*>(data_) = value;
} }
void SetInt32Value(int32 value) { void SetInt32Value(int32_t value) {
TYPE_CHECK(FieldDescriptor::CPPTYPE_INT32, "MapValueRef::SetInt32Value"); TYPE_CHECK(FieldDescriptor::CPPTYPE_INT32, "MapValueRef::SetInt32Value");
*reinterpret_cast<int32*>(data_) = value; *reinterpret_cast<int32_t*>(data_) = value;
} }
void SetUInt32Value(uint32 value) { void SetUInt32Value(uint32_t value) {
TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT32, "MapValueRef::SetUInt32Value"); TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT32, "MapValueRef::SetUInt32Value");
*reinterpret_cast<uint32*>(data_) = value; *reinterpret_cast<uint32_t*>(data_) = value;
} }
void SetBoolValue(bool value) { void SetBoolValue(bool value) {
TYPE_CHECK(FieldDescriptor::CPPTYPE_BOOL, "MapValueRef::SetBoolValue"); TYPE_CHECK(FieldDescriptor::CPPTYPE_BOOL, "MapValueRef::SetBoolValue");
@@ -829,15 +829,15 @@ class PROTOBUF_EXPORT MapValueRef final : public MapValueConstRef {
delete reinterpret_cast<TYPE*>(data_); \ delete reinterpret_cast<TYPE*>(data_); \
break; \ break; \
} }
HANDLE_TYPE(INT32, int32); HANDLE_TYPE(INT32, int32_t);
HANDLE_TYPE(INT64, int64); HANDLE_TYPE(INT64, int64_t);
HANDLE_TYPE(UINT32, uint32); HANDLE_TYPE(UINT32, uint32_t);
HANDLE_TYPE(UINT64, uint64); HANDLE_TYPE(UINT64, uint64_t);
HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(DOUBLE, double);
HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(FLOAT, float);
HANDLE_TYPE(BOOL, bool); HANDLE_TYPE(BOOL, bool);
HANDLE_TYPE(STRING, std::string); HANDLE_TYPE(STRING, std::string);
HANDLE_TYPE(ENUM, int32); HANDLE_TYPE(ENUM, int32_t);
HANDLE_TYPE(MESSAGE, Message); HANDLE_TYPE(MESSAGE, Message);
#undef HANDLE_TYPE #undef HANDLE_TYPE
} }

View File

@@ -49,19 +49,19 @@ namespace internal {
template <typename T> template <typename T>
T UnwrapMapKey(const MapKey& map_key); T UnwrapMapKey(const MapKey& map_key);
template <> template <>
inline int32 UnwrapMapKey<int32>(const MapKey& map_key) { inline int32_t UnwrapMapKey<int32_t>(const MapKey& map_key) {
return map_key.GetInt32Value(); return map_key.GetInt32Value();
} }
template <> template <>
inline uint32 UnwrapMapKey<uint32>(const MapKey& map_key) { inline uint32_t UnwrapMapKey<uint32_t>(const MapKey& map_key) {
return map_key.GetUInt32Value(); return map_key.GetUInt32Value();
} }
template <> template <>
inline int64 UnwrapMapKey<int64>(const MapKey& map_key) { inline int64_t UnwrapMapKey<int64_t>(const MapKey& map_key) {
return map_key.GetInt64Value(); return map_key.GetInt64Value();
} }
template <> template <>
inline uint64 UnwrapMapKey<uint64>(const MapKey& map_key) { inline uint64_t UnwrapMapKey<uint64_t>(const MapKey& map_key) {
return map_key.GetUInt64Value(); return map_key.GetUInt64Value();
} }
template <> template <>
@@ -77,19 +77,19 @@ inline std::string UnwrapMapKey<std::string>(const MapKey& map_key) {
template <typename T> template <typename T>
inline void SetMapKey(MapKey* map_key, const T& value); inline void SetMapKey(MapKey* map_key, const T& value);
template <> template <>
inline void SetMapKey<int32>(MapKey* map_key, const int32& value) { inline void SetMapKey<int32_t>(MapKey* map_key, const int32_t& value) {
map_key->SetInt32Value(value); map_key->SetInt32Value(value);
} }
template <> template <>
inline void SetMapKey<uint32>(MapKey* map_key, const uint32& value) { inline void SetMapKey<uint32_t>(MapKey* map_key, const uint32_t& value) {
map_key->SetUInt32Value(value); map_key->SetUInt32Value(value);
} }
template <> template <>
inline void SetMapKey<int64>(MapKey* map_key, const int64& value) { inline void SetMapKey<int64_t>(MapKey* map_key, const int64_t& value) {
map_key->SetInt64Value(value); map_key->SetInt64Value(value);
} }
template <> template <>
inline void SetMapKey<uint64>(MapKey* map_key, const uint64& value) { inline void SetMapKey<uint64_t>(MapKey* map_key, const uint64_t& value) {
map_key->SetUInt64Value(value); map_key->SetUInt64Value(value);
} }
template <> template <>

View File

@@ -106,7 +106,7 @@ class MapFieldLite {
template <typename UnknownType> template <typename UnknownType>
const char* ParseWithEnumValidation(const char* ptr, ParseContext* ctx, const char* ParseWithEnumValidation(const char* ptr, ParseContext* ctx,
bool (*is_valid)(int), uint32 field_num, bool (*is_valid)(int), uint32_t field_num,
InternalMetadata* metadata) { InternalMetadata* metadata) {
typename Derived::template Parser<MapFieldLite, Map<Key, T>> parser(this); typename Derived::template Parser<MapFieldLite, Map<Key, T>> parser(this);
return parser.template ParseWithEnumValidation<UnknownType>( return parser.template ParseWithEnumValidation<UnknownType>(
@@ -129,7 +129,7 @@ struct EnumParseWrapper {
} }
T* map_field; T* map_field;
bool (*is_valid)(int); bool (*is_valid)(int);
uint32 field_num; uint32_t field_num;
InternalMetadata* metadata; InternalMetadata* metadata;
}; };
@@ -138,7 +138,7 @@ struct EnumParseWrapper {
// generated code // generated code
template <typename UnknownType, typename T> template <typename UnknownType, typename T>
EnumParseWrapper<UnknownType, T> InitEnumParseWrapper( EnumParseWrapper<UnknownType, T> InitEnumParseWrapper(
T* map_field, bool (*is_valid)(int), uint32 field_num, T* map_field, bool (*is_valid)(int), uint32_t field_num,
InternalMetadata* metadata) { InternalMetadata* metadata) {
return EnumParseWrapper<UnknownType, T>{map_field, is_valid, field_num, return EnumParseWrapper<UnknownType, T>{map_field, is_valid, field_num,
metadata}; metadata};

View File

@@ -28,8 +28,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef GOOGLE_PROTOBUF_TYPE_HANDLER_H__ #ifndef GOOGLE_PROTOBUF_MAP_TYPE_HANDLER_H__
#define GOOGLE_PROTOBUF_TYPE_HANDLER_H__ #define GOOGLE_PROTOBUF_MAP_TYPE_HANDLER_H__
#include <google/protobuf/parse_context.h> #include <google/protobuf/parse_context.h>
#include <google/protobuf/io/coded_stream.h> #include <google/protobuf/io/coded_stream.h>
@@ -100,19 +100,19 @@ class MapWireFieldTypeTraits {};
TYPE_TRAITS(MESSAGE, Type, LENGTH_DELIMITED, true, false) TYPE_TRAITS(MESSAGE, Type, LENGTH_DELIMITED, true, false)
TYPE_TRAITS(STRING, ArenaStringPtr, LENGTH_DELIMITED, false, false) TYPE_TRAITS(STRING, ArenaStringPtr, LENGTH_DELIMITED, false, false)
TYPE_TRAITS(BYTES, ArenaStringPtr, LENGTH_DELIMITED, false, false) TYPE_TRAITS(BYTES, ArenaStringPtr, LENGTH_DELIMITED, false, false)
TYPE_TRAITS(INT64, int64, VARINT, false, false) TYPE_TRAITS(INT64, int64_t, VARINT, false, false)
TYPE_TRAITS(UINT64, uint64, VARINT, false, false) TYPE_TRAITS(UINT64, uint64_t, VARINT, false, false)
TYPE_TRAITS(INT32, int32, VARINT, false, false) TYPE_TRAITS(INT32, int32_t, VARINT, false, false)
TYPE_TRAITS(UINT32, uint32, VARINT, false, false) TYPE_TRAITS(UINT32, uint32_t, VARINT, false, false)
TYPE_TRAITS(SINT64, int64, VARINT, false, false) TYPE_TRAITS(SINT64, int64_t, VARINT, false, false)
TYPE_TRAITS(SINT32, int32, VARINT, false, false) TYPE_TRAITS(SINT32, int32_t, VARINT, false, false)
TYPE_TRAITS(ENUM, int, VARINT, false, true) TYPE_TRAITS(ENUM, int, VARINT, false, true)
TYPE_TRAITS(DOUBLE, double, FIXED64, false, false) TYPE_TRAITS(DOUBLE, double, FIXED64, false, false)
TYPE_TRAITS(FLOAT, float, FIXED32, false, false) TYPE_TRAITS(FLOAT, float, FIXED32, false, false)
TYPE_TRAITS(FIXED64, uint64, FIXED64, false, false) TYPE_TRAITS(FIXED64, uint64_t, FIXED64, false, false)
TYPE_TRAITS(FIXED32, uint32, FIXED32, false, false) TYPE_TRAITS(FIXED32, uint32_t, FIXED32, false, false)
TYPE_TRAITS(SFIXED64, int64, FIXED64, false, false) TYPE_TRAITS(SFIXED64, int64_t, FIXED64, false, false)
TYPE_TRAITS(SFIXED32, int32, FIXED32, false, false) TYPE_TRAITS(SFIXED32, int32_t, FIXED32, false, false)
TYPE_TRAITS(BOOL, bool, VARINT, false, false) TYPE_TRAITS(BOOL, bool, VARINT, false, false)
#undef TYPE_TRAITS #undef TYPE_TRAITS
@@ -149,8 +149,8 @@ class MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type> {
static inline const char* Read(const char* ptr, ParseContext* ctx, static inline const char* Read(const char* ptr, ParseContext* ctx,
MapEntryAccessorType* value); MapEntryAccessorType* value);
static inline uint8* Write(int field, const MapEntryAccessorType& value, static inline uint8_t* Write(int field, const MapEntryAccessorType& value,
uint8* ptr, io::EpsCopyOutputStream* stream); uint8_t* ptr, io::EpsCopyOutputStream* stream);
// Functions to manipulate data on memory. ======================== // Functions to manipulate data on memory. ========================
static inline const Type& GetExternalReference(const Type* value); static inline const Type& GetExternalReference(const Type* value);
@@ -194,8 +194,9 @@ class MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type> {
MapEntryAccessorType* value); \ MapEntryAccessorType* value); \
static inline const char* Read(const char* begin, ParseContext* ctx, \ static inline const char* Read(const char* begin, ParseContext* ctx, \
MapEntryAccessorType* value); \ MapEntryAccessorType* value); \
static inline uint8* Write(int field, const MapEntryAccessorType& value, \ static inline uint8_t* Write(int field, const MapEntryAccessorType& value, \
uint8* ptr, io::EpsCopyOutputStream* stream); \ uint8_t* ptr, \
io::EpsCopyOutputStream* stream); \
static inline const MapEntryAccessorType& GetExternalReference( \ static inline const MapEntryAccessorType& GetExternalReference( \
const TypeOnMemory& value); \ const TypeOnMemory& value); \
static inline void DeleteNoArena(const TypeOnMemory& x); \ static inline void DeleteNoArena(const TypeOnMemory& x); \
@@ -317,8 +318,8 @@ GET_FIXED_CACHED_SIZE(BOOL, Bool)
#undef GET_FIXED_CACHED_SIZE #undef GET_FIXED_CACHED_SIZE
template <typename Type> template <typename Type>
inline uint8* MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::Write( inline uint8_t* MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::Write(
int field, const MapEntryAccessorType& value, uint8* ptr, int field, const MapEntryAccessorType& value, uint8_t* ptr,
io::EpsCopyOutputStream* stream) { io::EpsCopyOutputStream* stream) {
ptr = stream->EnsureSpace(ptr); ptr = stream->EnsureSpace(ptr);
return WireFormatLite::InternalWriteMessage(field, value, ptr, stream); return WireFormatLite::InternalWriteMessage(field, value, ptr, stream);
@@ -326,8 +327,9 @@ inline uint8* MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::Write(
#define WRITE_METHOD(FieldType, DeclaredType) \ #define WRITE_METHOD(FieldType, DeclaredType) \
template <typename Type> \ template <typename Type> \
inline uint8* MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Write( \ inline uint8_t* \
int field, const MapEntryAccessorType& value, uint8* ptr, \ MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Write( \
int field, const MapEntryAccessorType& value, uint8_t* ptr, \
io::EpsCopyOutputStream* stream) { \ io::EpsCopyOutputStream* stream) { \
ptr = stream->EnsureSpace(ptr); \ ptr = stream->EnsureSpace(ptr); \
return stream->Write##DeclaredType(field, value, ptr); \ return stream->Write##DeclaredType(field, value, ptr); \
@@ -339,8 +341,9 @@ WRITE_METHOD(BYTES, Bytes)
#undef WRITE_METHOD #undef WRITE_METHOD
#define WRITE_METHOD(FieldType, DeclaredType) \ #define WRITE_METHOD(FieldType, DeclaredType) \
template <typename Type> \ template <typename Type> \
inline uint8* MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Write( \ inline uint8_t* \
int field, const MapEntryAccessorType& value, uint8* ptr, \ MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Write( \
int field, const MapEntryAccessorType& value, uint8_t* ptr, \
io::EpsCopyOutputStream* stream) { \ io::EpsCopyOutputStream* stream) { \
ptr = stream->EnsureSpace(ptr); \ ptr = stream->EnsureSpace(ptr); \
return WireFormatLite::Write##DeclaredType##ToArray(field, value, ptr); \ return WireFormatLite::Write##DeclaredType##ToArray(field, value, ptr); \
@@ -403,23 +406,23 @@ const char* MapTypeHandler<WireFormatLite::TYPE_BYTES, Type>::Read(
return ctx->ReadString(ptr, size, value); return ctx->ReadString(ptr, size, value);
} }
inline const char* ReadINT64(const char* ptr, int64* value) { inline const char* ReadINT64(const char* ptr, int64_t* value) {
return VarintParse(ptr, reinterpret_cast<uint64*>(value)); return VarintParse(ptr, reinterpret_cast<uint64_t*>(value));
} }
inline const char* ReadUINT64(const char* ptr, uint64* value) { inline const char* ReadUINT64(const char* ptr, uint64_t* value) {
return VarintParse(ptr, value); return VarintParse(ptr, value);
} }
inline const char* ReadINT32(const char* ptr, int32* value) { inline const char* ReadINT32(const char* ptr, int32_t* value) {
return VarintParse(ptr, reinterpret_cast<uint32*>(value)); return VarintParse(ptr, reinterpret_cast<uint32_t*>(value));
} }
inline const char* ReadUINT32(const char* ptr, uint32* value) { inline const char* ReadUINT32(const char* ptr, uint32_t* value) {
return VarintParse(ptr, value); return VarintParse(ptr, value);
} }
inline const char* ReadSINT64(const char* ptr, int64* value) { inline const char* ReadSINT64(const char* ptr, int64_t* value) {
*value = ReadVarintZigZag64(&ptr); *value = ReadVarintZigZag64(&ptr);
return ptr; return ptr;
} }
inline const char* ReadSINT32(const char* ptr, int32* value) { inline const char* ReadSINT32(const char* ptr, int32_t* value) {
*value = ReadVarintZigZag32(&ptr); *value = ReadVarintZigZag32(&ptr);
return ptr; return ptr;
} }
@@ -444,16 +447,16 @@ inline const char* ReadFLOAT(const char* ptr, float* value) {
inline const char* ReadDOUBLE(const char* ptr, double* value) { inline const char* ReadDOUBLE(const char* ptr, double* value) {
return ReadUnaligned(ptr, value); return ReadUnaligned(ptr, value);
} }
inline const char* ReadFIXED64(const char* ptr, uint64* value) { inline const char* ReadFIXED64(const char* ptr, uint64_t* value) {
return ReadUnaligned(ptr, value); return ReadUnaligned(ptr, value);
} }
inline const char* ReadFIXED32(const char* ptr, uint32* value) { inline const char* ReadFIXED32(const char* ptr, uint32_t* value) {
return ReadUnaligned(ptr, value); return ReadUnaligned(ptr, value);
} }
inline const char* ReadSFIXED64(const char* ptr, int64* value) { inline const char* ReadSFIXED64(const char* ptr, int64_t* value) {
return ReadUnaligned(ptr, value); return ReadUnaligned(ptr, value);
} }
inline const char* ReadSFIXED32(const char* ptr, int32* value) { inline const char* ReadSFIXED32(const char* ptr, int32_t* value) {
return ReadUnaligned(ptr, value); return ReadUnaligned(ptr, value);
} }
@@ -685,4 +688,4 @@ PRIMITIVE_HANDLER_FUNCTIONS(BOOL)
} // namespace protobuf } // namespace protobuf
} // namespace google } // namespace google
#endif // GOOGLE_PROTOBUF_TYPE_HANDLER_H__ #endif // GOOGLE_PROTOBUF_MAP_TYPE_HANDLER_H__

View File

@@ -120,6 +120,7 @@
#include <google/protobuf/arena.h> #include <google/protobuf/arena.h>
#include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/generated_message_util.h>
#include <google/protobuf/message_lite.h> #include <google/protobuf/message_lite.h>
#include <google/protobuf/port.h> #include <google/protobuf/port.h>
@@ -144,6 +145,7 @@ class MessageFactory;
// Defined in other files. // Defined in other files.
class AssignDescriptorsHelper; class AssignDescriptorsHelper;
class DynamicMessageFactory; class DynamicMessageFactory;
class DynamicMessageReflectionHelper;
class GeneratedMessageReflectionTestHelper; class GeneratedMessageReflectionTestHelper;
class MapKey; class MapKey;
class MapValueConstRef; class MapValueConstRef;
@@ -155,6 +157,7 @@ namespace internal {
struct DescriptorTable; struct DescriptorTable;
class MapFieldBase; class MapFieldBase;
class SwapFieldHelper; class SwapFieldHelper;
class CachedSize;
} }
class UnknownFieldSet; // unknown_field_set.h class UnknownFieldSet; // unknown_field_set.h
namespace io { namespace io {
@@ -201,18 +204,18 @@ struct Metadata {
namespace internal { namespace internal {
template <class To> template <class To>
inline To* GetPointerAtOffset(Message* message, uint32 offset) { inline To* GetPointerAtOffset(Message* message, uint32_t offset) {
return reinterpret_cast<To*>(reinterpret_cast<char*>(message) + offset); return reinterpret_cast<To*>(reinterpret_cast<char*>(message) + offset);
} }
template <class To> template <class To>
const To* GetConstPointerAtOffset(const Message* message, uint32 offset) { const To* GetConstPointerAtOffset(const Message* message, uint32_t offset) {
return reinterpret_cast<const To*>(reinterpret_cast<const char*>(message) + return reinterpret_cast<const To*>(reinterpret_cast<const char*>(message) +
offset); offset);
} }
template <class To> template <class To>
const To& GetConstRefAtOffset(const Message& message, uint32 offset) { const To& GetConstRefAtOffset(const Message& message, uint32_t offset) {
return *GetConstPointerAtOffset<To>(&message, offset); return *GetConstPointerAtOffset<To>(&message, offset);
} }
@@ -333,7 +336,7 @@ class PROTOBUF_EXPORT Message : public MessageLite {
const char* _InternalParse(const char* ptr, const char* _InternalParse(const char* ptr,
internal::ParseContext* ctx) override; internal::ParseContext* ctx) override;
size_t ByteSizeLong() const override; size_t ByteSizeLong() const override;
uint8* _InternalSerialize(uint8* target, uint8_t* _InternalSerialize(uint8_t* target,
io::EpsCopyOutputStream* stream) const override; io::EpsCopyOutputStream* stream) const override;
private: private:
@@ -388,10 +391,14 @@ class PROTOBUF_EXPORT Message : public MessageLite {
inline explicit Message(Arena* arena, bool is_message_owned = false) inline explicit Message(Arena* arena, bool is_message_owned = false)
: MessageLite(arena, is_message_owned) {} : MessageLite(arena, is_message_owned) {}
size_t ComputeUnknownFieldsSize(size_t total_size,
internal::CachedSize* cached_size) const;
size_t MaybeComputeUnknownFieldsSize(size_t total_size,
internal::CachedSize* cached_size) const;
protected: protected:
static uint64 GetInvariantPerBuild(uint64 salt); static uint64_t GetInvariantPerBuild(uint64_t salt);
private: private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Message); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Message);
@@ -503,6 +510,12 @@ class PROTOBUF_EXPORT Reflection final {
PROTOBUF_MUST_USE_RESULT Message* ReleaseLast( PROTOBUF_MUST_USE_RESULT Message* ReleaseLast(
Message* message, const FieldDescriptor* field) const; Message* message, const FieldDescriptor* field) const;
// Similar to ReleaseLast() without internal safety and ownershp checks. This
// method should only be used when the objects are on the same arena or paired
// with a call to `UnsafeArenaAddAllocatedMessage`.
Message* UnsafeArenaReleaseLast(Message* message,
const FieldDescriptor* field) const;
// Swap the complete contents of two messages. // Swap the complete contents of two messages.
void Swap(Message* message1, Message* message2) const; void Swap(Message* message1, Message* message2) const;
@@ -514,6 +527,16 @@ class PROTOBUF_EXPORT Reflection final {
void SwapElements(Message* message, const FieldDescriptor* field, int index1, void SwapElements(Message* message, const FieldDescriptor* field, int index1,
int index2) const; int index2) const;
// Swap without internal safety and ownership checks. This method should only
// be used when the objects are on the same arena.
void UnsafeArenaSwap(Message* lhs, Message* rhs) const;
// SwapFields without internal safety and ownership checks. This method should
// only be used when the objects are on the same arena.
void UnsafeArenaSwapFields(
Message* lhs, Message* rhs,
const std::vector<const FieldDescriptor*>& fields) const;
// List all fields of the message which are currently set, except for unknown // List all fields of the message which are currently set, except for unknown
// fields, but including extension known to the parser (i.e. compiled in). // fields, but including extension known to the parser (i.e. compiled in).
// Singular fields will only be listed if HasField(field) would return true // Singular fields will only be listed if HasField(field) would return true
@@ -529,10 +552,12 @@ class PROTOBUF_EXPORT Reflection final {
// These get the value of a non-repeated field. They return the default // These get the value of a non-repeated field. They return the default
// value for fields that aren't set. // value for fields that aren't set.
int32 GetInt32(const Message& message, const FieldDescriptor* field) const; int32_t GetInt32(const Message& message, const FieldDescriptor* field) const;
int64 GetInt64(const Message& message, const FieldDescriptor* field) const; int64_t GetInt64(const Message& message, const FieldDescriptor* field) const;
uint32 GetUInt32(const Message& message, const FieldDescriptor* field) const; uint32_t GetUInt32(const Message& message,
uint64 GetUInt64(const Message& message, const FieldDescriptor* field) const; const FieldDescriptor* field) const;
uint64_t GetUInt64(const Message& message,
const FieldDescriptor* field) const;
float GetFloat(const Message& message, const FieldDescriptor* field) const; float GetFloat(const Message& message, const FieldDescriptor* field) const;
double GetDouble(const Message& message, const FieldDescriptor* field) const; double GetDouble(const Message& message, const FieldDescriptor* field) const;
bool GetBool(const Message& message, const FieldDescriptor* field) const; bool GetBool(const Message& message, const FieldDescriptor* field) const;
@@ -577,13 +602,13 @@ class PROTOBUF_EXPORT Reflection final {
// These mutate the value of a non-repeated field. // These mutate the value of a non-repeated field.
void SetInt32(Message* message, const FieldDescriptor* field, void SetInt32(Message* message, const FieldDescriptor* field,
int32 value) const; int32_t value) const;
void SetInt64(Message* message, const FieldDescriptor* field, void SetInt64(Message* message, const FieldDescriptor* field,
int64 value) const; int64_t value) const;
void SetUInt32(Message* message, const FieldDescriptor* field, void SetUInt32(Message* message, const FieldDescriptor* field,
uint32 value) const; uint32_t value) const;
void SetUInt64(Message* message, const FieldDescriptor* field, void SetUInt64(Message* message, const FieldDescriptor* field,
uint64 value) const; uint64_t value) const;
void SetFloat(Message* message, const FieldDescriptor* field, void SetFloat(Message* message, const FieldDescriptor* field,
float value) const; float value) const;
void SetDouble(Message* message, const FieldDescriptor* field, void SetDouble(Message* message, const FieldDescriptor* field,
@@ -652,14 +677,14 @@ class PROTOBUF_EXPORT Reflection final {
// Repeated field getters ------------------------------------------ // Repeated field getters ------------------------------------------
// These get the value of one element of a repeated field. // These get the value of one element of a repeated field.
int32 GetRepeatedInt32(const Message& message, const FieldDescriptor* field, int32_t GetRepeatedInt32(const Message& message, const FieldDescriptor* field,
int index) const; int index) const;
int64 GetRepeatedInt64(const Message& message, const FieldDescriptor* field, int64_t GetRepeatedInt64(const Message& message, const FieldDescriptor* field,
int index) const;
uint32 GetRepeatedUInt32(const Message& message, const FieldDescriptor* field,
int index) const;
uint64 GetRepeatedUInt64(const Message& message, const FieldDescriptor* field,
int index) const; int index) const;
uint32_t GetRepeatedUInt32(const Message& message,
const FieldDescriptor* field, int index) const;
uint64_t GetRepeatedUInt64(const Message& message,
const FieldDescriptor* field, int index) const;
float GetRepeatedFloat(const Message& message, const FieldDescriptor* field, float GetRepeatedFloat(const Message& message, const FieldDescriptor* field,
int index) const; int index) const;
double GetRepeatedDouble(const Message& message, const FieldDescriptor* field, double GetRepeatedDouble(const Message& message, const FieldDescriptor* field,
@@ -693,13 +718,13 @@ class PROTOBUF_EXPORT Reflection final {
// These mutate the value of one element of a repeated field. // These mutate the value of one element of a repeated field.
void SetRepeatedInt32(Message* message, const FieldDescriptor* field, void SetRepeatedInt32(Message* message, const FieldDescriptor* field,
int index, int32 value) const; int index, int32_t value) const;
void SetRepeatedInt64(Message* message, const FieldDescriptor* field, void SetRepeatedInt64(Message* message, const FieldDescriptor* field,
int index, int64 value) const; int index, int64_t value) const;
void SetRepeatedUInt32(Message* message, const FieldDescriptor* field, void SetRepeatedUInt32(Message* message, const FieldDescriptor* field,
int index, uint32 value) const; int index, uint32_t value) const;
void SetRepeatedUInt64(Message* message, const FieldDescriptor* field, void SetRepeatedUInt64(Message* message, const FieldDescriptor* field,
int index, uint64 value) const; int index, uint64_t value) const;
void SetRepeatedFloat(Message* message, const FieldDescriptor* field, void SetRepeatedFloat(Message* message, const FieldDescriptor* field,
int index, float value) const; int index, float value) const;
void SetRepeatedDouble(Message* message, const FieldDescriptor* field, void SetRepeatedDouble(Message* message, const FieldDescriptor* field,
@@ -730,13 +755,13 @@ class PROTOBUF_EXPORT Reflection final {
// These add an element to a repeated field. // These add an element to a repeated field.
void AddInt32(Message* message, const FieldDescriptor* field, void AddInt32(Message* message, const FieldDescriptor* field,
int32 value) const; int32_t value) const;
void AddInt64(Message* message, const FieldDescriptor* field, void AddInt64(Message* message, const FieldDescriptor* field,
int64 value) const; int64_t value) const;
void AddUInt32(Message* message, const FieldDescriptor* field, void AddUInt32(Message* message, const FieldDescriptor* field,
uint32 value) const; uint32_t value) const;
void AddUInt64(Message* message, const FieldDescriptor* field, void AddUInt64(Message* message, const FieldDescriptor* field,
uint64 value) const; uint64_t value) const;
void AddFloat(Message* message, const FieldDescriptor* field, void AddFloat(Message* message, const FieldDescriptor* field,
float value) const; float value) const;
void AddDouble(Message* message, const FieldDescriptor* field, void AddDouble(Message* message, const FieldDescriptor* field,
@@ -765,6 +790,13 @@ class PROTOBUF_EXPORT Reflection final {
void AddAllocatedMessage(Message* message, const FieldDescriptor* field, void AddAllocatedMessage(Message* message, const FieldDescriptor* field,
Message* new_entry) const; Message* new_entry) const;
// Similar to AddAllocatedMessage() without internal safety and ownership
// checks. This method should only be used when the objects are on the same
// arena or paired with a call to `UnsafeArenaReleaseLast`.
void UnsafeArenaAddAllocatedMessage(Message* message,
const FieldDescriptor* field,
Message* new_entry) const;
// Get a RepeatedFieldRef object that can be used to read the underlying // Get a RepeatedFieldRef object that can be used to read the underlying
// repeated field. The type parameter T must be set according to the // repeated field. The type parameter T must be set according to the
@@ -772,14 +804,14 @@ class PROTOBUF_EXPORT Reflection final {
// to acceptable T. // to acceptable T.
// //
// field->cpp_type() T // field->cpp_type() T
// CPPTYPE_INT32 int32 // CPPTYPE_INT32 int32_t
// CPPTYPE_UINT32 uint32 // CPPTYPE_UINT32 uint32_t
// CPPTYPE_INT64 int64 // CPPTYPE_INT64 int64_t
// CPPTYPE_UINT64 uint64 // CPPTYPE_UINT64 uint64_t
// CPPTYPE_DOUBLE double // CPPTYPE_DOUBLE double
// CPPTYPE_FLOAT float // CPPTYPE_FLOAT float
// CPPTYPE_BOOL bool // CPPTYPE_BOOL bool
// CPPTYPE_ENUM generated enum type or int32 // CPPTYPE_ENUM generated enum type or int32_t
// CPPTYPE_STRING std::string // CPPTYPE_STRING std::string
// CPPTYPE_MESSAGE generated message type or google::protobuf::Message // CPPTYPE_MESSAGE generated message type or google::protobuf::Message
// //
@@ -1010,6 +1042,7 @@ class PROTOBUF_EXPORT Reflection final {
friend class ::PROTOBUF_NAMESPACE_ID::MessageLayoutInspector; friend class ::PROTOBUF_NAMESPACE_ID::MessageLayoutInspector;
friend class ::PROTOBUF_NAMESPACE_ID::AssignDescriptorsHelper; friend class ::PROTOBUF_NAMESPACE_ID::AssignDescriptorsHelper;
friend class DynamicMessageFactory; friend class DynamicMessageFactory;
friend class DynamicMessageReflectionHelper;
friend class GeneratedMessageReflectionTestHelper; friend class GeneratedMessageReflectionTestHelper;
friend class python::MapReflectionFriend; friend class python::MapReflectionFriend;
friend class python::MessageReflectionFriend; friend class python::MessageReflectionFriend;
@@ -1101,11 +1134,11 @@ class PROTOBUF_EXPORT Reflection final {
const Message* GetDefaultMessageInstance(const FieldDescriptor* field) const; const Message* GetDefaultMessageInstance(const FieldDescriptor* field) const;
inline const uint32* GetHasBits(const Message& message) const; inline const uint32_t* GetHasBits(const Message& message) const;
inline uint32* MutableHasBits(Message* message) const; inline uint32_t* MutableHasBits(Message* message) const;
inline uint32 GetOneofCase(const Message& message, inline uint32_t GetOneofCase(const Message& message,
const OneofDescriptor* oneof_descriptor) const; const OneofDescriptor* oneof_descriptor) const;
inline uint32* MutableOneofCase( inline uint32_t* MutableOneofCase(
Message* message, const OneofDescriptor* oneof_descriptor) const; Message* message, const OneofDescriptor* oneof_descriptor) const;
inline bool HasExtensionSet(const Message& /* message */) const { inline bool HasExtensionSet(const Message& /* message */) const {
return schema_.HasExtensionSet(); return schema_.HasExtensionSet();
@@ -1118,6 +1151,8 @@ class PROTOBUF_EXPORT Reflection final {
internal::InternalMetadata* MutableInternalMetadata(Message* message) const; internal::InternalMetadata* MutableInternalMetadata(Message* message) const;
inline bool IsInlined(const FieldDescriptor* field) const;
inline bool HasBit(const Message& message, inline bool HasBit(const Message& message,
const FieldDescriptor* field) const; const FieldDescriptor* field) const;
inline void SetBit(Message* message, const FieldDescriptor* field) const; inline void SetBit(Message* message, const FieldDescriptor* field) const;
@@ -1125,6 +1160,12 @@ class PROTOBUF_EXPORT Reflection final {
inline void SwapBit(Message* message1, Message* message2, inline void SwapBit(Message* message1, Message* message2,
const FieldDescriptor* field) const; const FieldDescriptor* field) const;
inline const uint32_t* GetInlinedStringDonatedArray(
const Message& message) const;
inline uint32_t* MutableInlinedStringDonatedArray(Message* message) const;
inline bool IsInlinedStringDonated(const Message& message,
const FieldDescriptor* field) const;
// Shallow-swap fields listed in fields vector of two messages. It is the // Shallow-swap fields listed in fields vector of two messages. It is the
// caller's responsibility to make sure shallow swap is safe. // caller's responsibility to make sure shallow swap is safe.
void UnsafeShallowSwapFields( void UnsafeShallowSwapFields(
@@ -1144,12 +1185,8 @@ class PROTOBUF_EXPORT Reflection final {
void SwapFieldsImpl(Message* message1, Message* message2, void SwapFieldsImpl(Message* message1, Message* message2,
const std::vector<const FieldDescriptor*>& fields) const; const std::vector<const FieldDescriptor*>& fields) const;
void SwapOneofField(Message* message1, Message* message2, template <bool unsafe_shallow_swap>
const OneofDescriptor* oneof_descriptor) const; void SwapOneofField(Message* lhs, Message* rhs,
// Unsafe but shallow version of SwapOneofField.
void UnsafeShallowSwapOneofField(
Message* message1, Message* message2,
const OneofDescriptor* oneof_descriptor) const; const OneofDescriptor* oneof_descriptor) const;
inline bool HasOneofField(const Message& message, inline bool HasOneofField(const Message& message,
@@ -1294,10 +1331,10 @@ class PROTOBUF_EXPORT MessageFactory {
Reflection::MutableRepeatedFieldInternal<TYPE>( \ Reflection::MutableRepeatedFieldInternal<TYPE>( \
Message * message, const FieldDescriptor* field) const; Message * message, const FieldDescriptor* field) const;
DECLARE_GET_REPEATED_FIELD(int32) DECLARE_GET_REPEATED_FIELD(int32_t)
DECLARE_GET_REPEATED_FIELD(int64) DECLARE_GET_REPEATED_FIELD(int64_t)
DECLARE_GET_REPEATED_FIELD(uint32) DECLARE_GET_REPEATED_FIELD(uint32_t)
DECLARE_GET_REPEATED_FIELD(uint64) DECLARE_GET_REPEATED_FIELD(uint64_t)
DECLARE_GET_REPEATED_FIELD(float) DECLARE_GET_REPEATED_FIELD(float)
DECLARE_GET_REPEATED_FIELD(double) DECLARE_GET_REPEATED_FIELD(double)
DECLARE_GET_REPEATED_FIELD(bool) DECLARE_GET_REPEATED_FIELD(bool)
@@ -1422,6 +1459,28 @@ template <typename Type>
const Type& Reflection::DefaultRaw(const FieldDescriptor* field) const { const Type& Reflection::DefaultRaw(const FieldDescriptor* field) const {
return *reinterpret_cast<const Type*>(schema_.GetFieldDefault(field)); return *reinterpret_cast<const Type*>(schema_.GetFieldDefault(field));
} }
uint32_t Reflection::GetOneofCase(
const Message& message, const OneofDescriptor* oneof_descriptor) const {
GOOGLE_DCHECK(!oneof_descriptor->is_synthetic());
return internal::GetConstRefAtOffset<uint32_t>(
message, schema_.GetOneofCaseOffset(oneof_descriptor));
}
bool Reflection::HasOneofField(const Message& message,
const FieldDescriptor* field) const {
return (GetOneofCase(message, field->containing_oneof()) ==
static_cast<uint32_t>(field->number()));
}
template <typename Type>
const Type& Reflection::GetRaw(const Message& message,
const FieldDescriptor* field) const {
GOOGLE_DCHECK(!schema_.InRealOneof(field) || HasOneofField(message, field))
<< "Field = " << field->full_name();
return internal::GetConstRefAtOffset<Type>(message,
schema_.GetFieldOffset(field));
}
} // namespace protobuf } // namespace protobuf
} // namespace google } // namespace google

View File

@@ -158,7 +158,7 @@ class ExplicitlyConstructed {
// Prefer c++14 aligned_storage, but for compatibility this will do. // Prefer c++14 aligned_storage, but for compatibility this will do.
union AlignedUnion { union AlignedUnion {
alignas(T) char space[sizeof(T)]; alignas(T) char space[sizeof(T)];
int64 align_to_int64; int64_t align_to_int64;
void* align_to_ptr; void* align_to_ptr;
} union_; } union_;
}; };
@@ -449,7 +449,7 @@ class PROTOBUF_EXPORT MessageLite {
// must point at a byte array of at least ByteSize() bytes. Whether to use // must point at a byte array of at least ByteSize() bytes. Whether to use
// deterministic serialization, e.g., maps in sorted order, is determined by // deterministic serialization, e.g., maps in sorted order, is determined by
// CodedOutputStream::IsDefaultSerializationDeterministic(). // CodedOutputStream::IsDefaultSerializationDeterministic().
uint8* SerializeWithCachedSizesToArray(uint8* target) const; uint8_t* SerializeWithCachedSizesToArray(uint8_t* target) const;
// Returns the result of the last call to ByteSize(). An embedded message's // Returns the result of the last call to ByteSize(). An embedded message's
// size is needed both to serialize it (because embedded messages are // size is needed both to serialize it (because embedded messages are
@@ -507,9 +507,9 @@ class PROTOBUF_EXPORT MessageLite {
bool ParseFrom(const T& input); bool ParseFrom(const T& input);
// Fast path when conditions match (ie. non-deterministic) // Fast path when conditions match (ie. non-deterministic)
// uint8* _InternalSerialize(uint8* ptr) const; // uint8_t* _InternalSerialize(uint8_t* ptr) const;
virtual uint8* _InternalSerialize(uint8* ptr, virtual uint8_t* _InternalSerialize(
io::EpsCopyOutputStream* stream) const = 0; uint8_t* ptr, io::EpsCopyOutputStream* stream) const = 0;
// Identical to IsInitialized() except that it logs an error message. // Identical to IsInitialized() except that it logs an error message.
bool IsInitializedWithErrors() const { bool IsInitializedWithErrors() const {

View File

@@ -40,6 +40,7 @@
#include <google/protobuf/arena.h> #include <google/protobuf/arena.h>
#include <google/protobuf/arenastring.h> #include <google/protobuf/arenastring.h>
#include <google/protobuf/implicit_weak_message.h> #include <google/protobuf/implicit_weak_message.h>
#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/metadata_lite.h> #include <google/protobuf/metadata_lite.h>
#include <google/protobuf/port.h> #include <google/protobuf/port.h>
#include <google/protobuf/repeated_field.h> #include <google/protobuf/repeated_field.h>
@@ -59,12 +60,12 @@ class MessageFactory;
namespace internal { namespace internal {
// Template code below needs to know about the existence of these functions. // Template code below needs to know about the existence of these functions.
PROTOBUF_EXPORT void WriteVarint(uint32 num, uint64 val, std::string* s); PROTOBUF_EXPORT void WriteVarint(uint32_t num, uint64_t val, std::string* s);
PROTOBUF_EXPORT void WriteLengthDelimited(uint32 num, StringPiece val, PROTOBUF_EXPORT void WriteLengthDelimited(uint32_t num, StringPiece val,
std::string* s); std::string* s);
// Inline because it is just forwarding to s->WriteVarint // Inline because it is just forwarding to s->WriteVarint
inline void WriteVarint(uint32 num, uint64 val, UnknownFieldSet* s); inline void WriteVarint(uint32_t num, uint64_t val, UnknownFieldSet* s);
inline void WriteLengthDelimited(uint32 num, StringPiece val, inline void WriteLengthDelimited(uint32_t num, StringPiece val,
UnknownFieldSet* s); UnknownFieldSet* s);
@@ -184,15 +185,15 @@ class PROTOBUF_EXPORT EpsCopyInputStream {
PROTOBUF_MUST_USE_RESULT const char* ReadPackedVarint(const char* ptr, PROTOBUF_MUST_USE_RESULT const char* ReadPackedVarint(const char* ptr,
Add add); Add add);
uint32 LastTag() const { return last_tag_minus_1_ + 1; } uint32_t LastTag() const { return last_tag_minus_1_ + 1; }
bool ConsumeEndGroup(uint32 start_tag) { bool ConsumeEndGroup(uint32_t start_tag) {
bool res = last_tag_minus_1_ == start_tag; bool res = last_tag_minus_1_ == start_tag;
last_tag_minus_1_ = 0; last_tag_minus_1_ = 0;
return res; return res;
} }
bool EndedAtLimit() const { return last_tag_minus_1_ == 0; } bool EndedAtLimit() const { return last_tag_minus_1_ == 0; }
bool EndedAtEndOfStream() const { return last_tag_minus_1_ == 1; } bool EndedAtEndOfStream() const { return last_tag_minus_1_ == 1; }
void SetLastTag(uint32 tag) { last_tag_minus_1_ = tag - 1; } void SetLastTag(uint32_t tag) { last_tag_minus_1_ = tag - 1; }
void SetEndOfStream() { last_tag_minus_1_ = 1; } void SetEndOfStream() { last_tag_minus_1_ = 1; }
bool IsExceedingLimit(const char* ptr) { bool IsExceedingLimit(const char* ptr) {
return ptr > limit_end_ && return ptr > limit_end_ &&
@@ -281,7 +282,7 @@ class PROTOBUF_EXPORT EpsCopyInputStream {
// This var doesn't really belong in EpsCopyInputStream and should be part of // This var doesn't really belong in EpsCopyInputStream and should be part of
// the ParseContext, but case 2 is most easily and optimally implemented in // the ParseContext, but case 2 is most easily and optimally implemented in
// DoneFallback. // DoneFallback.
uint32 last_tag_minus_1_ = 0; uint32_t last_tag_minus_1_ = 0;
int overall_limit_ = INT_MAX; // Overall limit independent of pushed limits. int overall_limit_ = INT_MAX; // Overall limit independent of pushed limits.
// Pretty random large number that seems like a safe allocation on most // Pretty random large number that seems like a safe allocation on most
// systems. TODO(gerbens) do we need to set this as build flag? // systems. TODO(gerbens) do we need to set this as build flag?
@@ -398,15 +399,19 @@ class PROTOBUF_EXPORT ParseContext : public EpsCopyInputStream {
Data& data() { return data_; } Data& data() { return data_; }
const Data& data() const { return data_; } const Data& data() const { return data_; }
template <typename T>
PROTOBUF_MUST_USE_RESULT const char* ParseMessage(T* msg, const char* ptr);
// We outline when the type is generic and we go through a virtual
const char* ParseMessage(MessageLite* msg, const char* ptr); const char* ParseMessage(MessageLite* msg, const char* ptr);
const char* ParseMessage(Message* msg, const char* ptr);
// This overload supports those few cases where ParseMessage is called
// on a class that is not actually a proto message.
// TODO(jorg): Eliminate this use case.
template <typename T,
typename std::enable_if<!std::is_base_of<MessageLite, T>::value,
bool>::type = true>
PROTOBUF_MUST_USE_RESULT const char* ParseMessage(T* msg, const char* ptr);
template <typename T> template <typename T>
PROTOBUF_MUST_USE_RESULT PROTOBUF_NDEBUG_INLINE const char* ParseGroup( PROTOBUF_MUST_USE_RESULT PROTOBUF_NDEBUG_INLINE const char* ParseGroup(
T* msg, const char* ptr, uint32 tag) { T* msg, const char* ptr, uint32_t tag) {
if (--depth_ < 0) return nullptr; if (--depth_ < 0) return nullptr;
group_depth_++; group_depth_++;
ptr = msg->_InternalParse(ptr, this); ptr = msg->_InternalParse(ptr, this);
@@ -440,7 +445,7 @@ class PROTOBUF_EXPORT ParseContext : public EpsCopyInputStream {
Data data_; Data data_;
}; };
template <uint32 tag> template <uint32_t tag>
bool ExpectTag(const char* ptr) { bool ExpectTag(const char* ptr) {
if (tag < 128) { if (tag < 128) {
return *ptr == static_cast<char>(tag); return *ptr == static_cast<char>(tag);
@@ -456,13 +461,13 @@ struct EndianHelper;
template <> template <>
struct EndianHelper<1> { struct EndianHelper<1> {
static uint8 Load(const void* p) { return *static_cast<const uint8*>(p); } static uint8_t Load(const void* p) { return *static_cast<const uint8_t*>(p); }
}; };
template <> template <>
struct EndianHelper<2> { struct EndianHelper<2> {
static uint16 Load(const void* p) { static uint16_t Load(const void* p) {
uint16 tmp; uint16_t tmp;
std::memcpy(&tmp, p, 2); std::memcpy(&tmp, p, 2);
#ifndef PROTOBUF_LITTLE_ENDIAN #ifndef PROTOBUF_LITTLE_ENDIAN
tmp = bswap_16(tmp); tmp = bswap_16(tmp);
@@ -473,8 +478,8 @@ struct EndianHelper<2> {
template <> template <>
struct EndianHelper<4> { struct EndianHelper<4> {
static uint32 Load(const void* p) { static uint32_t Load(const void* p) {
uint32 tmp; uint32_t tmp;
std::memcpy(&tmp, p, 4); std::memcpy(&tmp, p, 4);
#ifndef PROTOBUF_LITTLE_ENDIAN #ifndef PROTOBUF_LITTLE_ENDIAN
tmp = bswap_32(tmp); tmp = bswap_32(tmp);
@@ -485,8 +490,8 @@ struct EndianHelper<4> {
template <> template <>
struct EndianHelper<8> { struct EndianHelper<8> {
static uint64 Load(const void* p) { static uint64_t Load(const void* p) {
uint64 tmp; uint64_t tmp;
std::memcpy(&tmp, p, 8); std::memcpy(&tmp, p, 8);
#ifndef PROTOBUF_LITTLE_ENDIAN #ifndef PROTOBUF_LITTLE_ENDIAN
tmp = bswap_64(tmp); tmp = bswap_64(tmp);
@@ -504,17 +509,17 @@ T UnalignedLoad(const char* p) {
} }
PROTOBUF_EXPORT PROTOBUF_EXPORT
std::pair<const char*, uint32> VarintParseSlow32(const char* p, uint32 res); std::pair<const char*, uint32_t> VarintParseSlow32(const char* p, uint32_t res);
PROTOBUF_EXPORT PROTOBUF_EXPORT
std::pair<const char*, uint64> VarintParseSlow64(const char* p, uint32 res); std::pair<const char*, uint64_t> VarintParseSlow64(const char* p, uint32_t res);
inline const char* VarintParseSlow(const char* p, uint32 res, uint32* out) { inline const char* VarintParseSlow(const char* p, uint32_t res, uint32_t* out) {
auto tmp = VarintParseSlow32(p, res); auto tmp = VarintParseSlow32(p, res);
*out = tmp.second; *out = tmp.second;
return tmp.first; return tmp.first;
} }
inline const char* VarintParseSlow(const char* p, uint32 res, uint64* out) { inline const char* VarintParseSlow(const char* p, uint32_t res, uint64_t* out) {
auto tmp = VarintParseSlow64(p, res); auto tmp = VarintParseSlow64(p, res);
*out = tmp.second; *out = tmp.second;
return tmp.first; return tmp.first;
@@ -522,13 +527,13 @@ inline const char* VarintParseSlow(const char* p, uint32 res, uint64* out) {
template <typename T> template <typename T>
PROTOBUF_MUST_USE_RESULT const char* VarintParse(const char* p, T* out) { PROTOBUF_MUST_USE_RESULT const char* VarintParse(const char* p, T* out) {
auto ptr = reinterpret_cast<const uint8*>(p); auto ptr = reinterpret_cast<const uint8_t*>(p);
uint32 res = ptr[0]; uint32_t res = ptr[0];
if (!(res & 0x80)) { if (!(res & 0x80)) {
*out = res; *out = res;
return p + 1; return p + 1;
} }
uint32 byte = ptr[1]; uint32_t byte = ptr[1];
res += (byte - 1) << 7; res += (byte - 1) << 7;
if (!(byte & 0x80)) { if (!(byte & 0x80)) {
*out = res; *out = res;
@@ -541,16 +546,17 @@ PROTOBUF_MUST_USE_RESULT const char* VarintParse(const char* p, T* out) {
// Caller must ensure its safe to call. // Caller must ensure its safe to call.
PROTOBUF_EXPORT PROTOBUF_EXPORT
std::pair<const char*, uint32> ReadTagFallback(const char* p, uint32 res); std::pair<const char*, uint32_t> ReadTagFallback(const char* p, uint32_t res);
// Same as ParseVarint but only accept 5 bytes at most. // Same as ParseVarint but only accept 5 bytes at most.
inline const char* ReadTag(const char* p, uint32* out, uint32 /*max_tag*/ = 0) { inline const char* ReadTag(const char* p, uint32_t* out,
uint32 res = static_cast<uint8>(p[0]); uint32_t /*max_tag*/ = 0) {
uint32_t res = static_cast<uint8_t>(p[0]);
if (res < 128) { if (res < 128) {
*out = res; *out = res;
return p + 1; return p + 1;
} }
uint32 second = static_cast<uint8>(p[1]); uint32_t second = static_cast<uint8_t>(p[1]);
res += (second - 1) << 7; res += (second - 1) << 7;
if (second < 128) { if (second < 128) {
*out = res; *out = res;
@@ -571,8 +577,8 @@ inline const char* ReadTag(const char* p, uint32* out, uint32 /*max_tag*/ = 0) {
// adc [rsi], 1 // adc [rsi], 1
// add eax, eax // add eax, eax
// and eax, edi // and eax, edi
inline uint32 DecodeTwoBytes(const char** ptr) { inline uint32_t DecodeTwoBytes(const char** ptr) {
uint32 value = UnalignedLoad<uint16>(*ptr); uint32_t value = UnalignedLoad<uint16_t>(*ptr);
// Sign extend the low byte continuation bit // Sign extend the low byte continuation bit
uint32_t x = static_cast<int8_t>(value); uint32_t x = static_cast<int8_t>(value);
// This add is an amazing operation, it cancels the low byte continuation bit // This add is an amazing operation, it cancels the low byte continuation bit
@@ -586,11 +592,11 @@ inline uint32 DecodeTwoBytes(const char** ptr) {
} }
// More efficient varint parsing for big varints // More efficient varint parsing for big varints
inline const char* ParseBigVarint(const char* p, uint64* out) { inline const char* ParseBigVarint(const char* p, uint64_t* out) {
auto pnew = p; auto pnew = p;
auto tmp = DecodeTwoBytes(&pnew); auto tmp = DecodeTwoBytes(&pnew);
uint64 res = tmp >> 1; uint64_t res = tmp >> 1;
if (PROTOBUF_PREDICT_TRUE(std::int16_t(tmp) >= 0)) { if (PROTOBUF_PREDICT_TRUE(static_cast<std::int16_t>(tmp) >= 0)) {
*out = res; *out = res;
return pnew; return pnew;
} }
@@ -598,7 +604,7 @@ inline const char* ParseBigVarint(const char* p, uint64* out) {
pnew = p + 2 * i; pnew = p + 2 * i;
tmp = DecodeTwoBytes(&pnew); tmp = DecodeTwoBytes(&pnew);
res += (static_cast<std::uint64_t>(tmp) - 2) << (14 * i - 1); res += (static_cast<std::uint64_t>(tmp) - 2) << (14 * i - 1);
if (PROTOBUF_PREDICT_TRUE(std::int16_t(tmp) >= 0)) { if (PROTOBUF_PREDICT_TRUE(static_cast<std::int16_t>(tmp) >= 0)) {
*out = res; *out = res;
return pnew; return pnew;
} }
@@ -607,13 +613,13 @@ inline const char* ParseBigVarint(const char* p, uint64* out) {
} }
PROTOBUF_EXPORT PROTOBUF_EXPORT
std::pair<const char*, int32> ReadSizeFallback(const char* p, uint32 first); std::pair<const char*, int32_t> ReadSizeFallback(const char* p, uint32_t first);
// Used for tags, could read up to 5 bytes which must be available. Additionally // Used for tags, could read up to 5 bytes which must be available. Additionally
// it makes sure the unsigned value fits a int32, otherwise returns nullptr. // it makes sure the unsigned value fits a int32_t, otherwise returns nullptr.
// Caller must ensure its safe to call. // Caller must ensure its safe to call.
inline uint32 ReadSize(const char** pp) { inline uint32_t ReadSize(const char** pp) {
auto p = *pp; auto p = *pp;
uint32 res = static_cast<uint8>(p[0]); uint32_t res = static_cast<uint8_t>(p[0]);
if (res < 128) { if (res < 128) {
*pp = p + 1; *pp = p + 1;
return res; return res;
@@ -628,31 +634,32 @@ inline uint32 ReadSize(const char** pp) {
// function composition. We rely on the compiler to inline this. // function composition. We rely on the compiler to inline this.
// Also in debug compiles having local scoped variables tend to generated // Also in debug compiles having local scoped variables tend to generated
// stack frames that scale as O(num fields). // stack frames that scale as O(num fields).
inline uint64 ReadVarint64(const char** p) { inline uint64_t ReadVarint64(const char** p) {
uint64 tmp; uint64_t tmp;
*p = VarintParse(*p, &tmp); *p = VarintParse(*p, &tmp);
return tmp; return tmp;
} }
inline uint32 ReadVarint32(const char** p) { inline uint32_t ReadVarint32(const char** p) {
uint32 tmp; uint32_t tmp;
*p = VarintParse(*p, &tmp); *p = VarintParse(*p, &tmp);
return tmp; return tmp;
} }
inline int64 ReadVarintZigZag64(const char** p) { inline int64_t ReadVarintZigZag64(const char** p) {
uint64 tmp; uint64_t tmp;
*p = VarintParse(*p, &tmp); *p = VarintParse(*p, &tmp);
return WireFormatLite::ZigZagDecode64(tmp); return WireFormatLite::ZigZagDecode64(tmp);
} }
inline int32 ReadVarintZigZag32(const char** p) { inline int32_t ReadVarintZigZag32(const char** p) {
uint64 tmp; uint64_t tmp;
*p = VarintParse(*p, &tmp); *p = VarintParse(*p, &tmp);
return WireFormatLite::ZigZagDecode32(static_cast<uint32>(tmp)); return WireFormatLite::ZigZagDecode32(static_cast<uint32_t>(tmp));
} }
template <typename T> template <typename T, typename std::enable_if<
!std::is_base_of<MessageLite, T>::value, bool>::type>
PROTOBUF_MUST_USE_RESULT const char* ParseContext::ParseMessage( PROTOBUF_MUST_USE_RESULT const char* ParseContext::ParseMessage(
T* msg, const char* ptr) { T* msg, const char* ptr) {
int old; int old;
@@ -716,7 +723,7 @@ const char* EpsCopyInputStream::ReadPackedFixed(const char* ptr, int size,
template <typename Add> template <typename Add>
const char* ReadPackedVarintArray(const char* ptr, const char* end, Add add) { const char* ReadPackedVarintArray(const char* ptr, const char* end, Add add) {
while (ptr < end) { while (ptr < end) {
uint64 varint; uint64_t varint;
ptr = VarintParse(ptr, &varint); ptr = VarintParse(ptr, &varint);
if (ptr == nullptr) return nullptr; if (ptr == nullptr) return nullptr;
add(varint); add(varint);
@@ -786,22 +793,22 @@ PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* InlineGreedyStringParser(
GOOGLE_PROTOBUF_ASSERT_RETURN(predicate, nullptr) GOOGLE_PROTOBUF_ASSERT_RETURN(predicate, nullptr)
template <typename T> template <typename T>
PROTOBUF_MUST_USE_RESULT const char* FieldParser(uint64 tag, T& field_parser, PROTOBUF_MUST_USE_RESULT const char* FieldParser(uint64_t tag, T& field_parser,
const char* ptr, const char* ptr,
ParseContext* ctx) { ParseContext* ctx) {
uint32 number = tag >> 3; uint32_t number = tag >> 3;
GOOGLE_PROTOBUF_PARSER_ASSERT(number != 0); GOOGLE_PROTOBUF_PARSER_ASSERT(number != 0);
using WireType = internal::WireFormatLite::WireType; using WireType = internal::WireFormatLite::WireType;
switch (tag & 7) { switch (tag & 7) {
case WireType::WIRETYPE_VARINT: { case WireType::WIRETYPE_VARINT: {
uint64 value; uint64_t value;
ptr = VarintParse(ptr, &value); ptr = VarintParse(ptr, &value);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
field_parser.AddVarint(number, value); field_parser.AddVarint(number, value);
break; break;
} }
case WireType::WIRETYPE_FIXED64: { case WireType::WIRETYPE_FIXED64: {
uint64 value = UnalignedLoad<uint64>(ptr); uint64_t value = UnalignedLoad<uint64_t>(ptr);
ptr += 8; ptr += 8;
field_parser.AddFixed64(number, value); field_parser.AddFixed64(number, value);
break; break;
@@ -821,7 +828,7 @@ PROTOBUF_MUST_USE_RESULT const char* FieldParser(uint64 tag, T& field_parser,
break; break;
} }
case WireType::WIRETYPE_FIXED32: { case WireType::WIRETYPE_FIXED32: {
uint32 value = UnalignedLoad<uint32>(ptr); uint32_t value = UnalignedLoad<uint32_t>(ptr);
ptr += 4; ptr += 4;
field_parser.AddFixed32(number, value); field_parser.AddFixed32(number, value);
break; break;
@@ -837,7 +844,7 @@ PROTOBUF_MUST_USE_RESULT const char* WireFormatParser(T& field_parser,
const char* ptr, const char* ptr,
ParseContext* ctx) { ParseContext* ctx) {
while (!ctx->Done(&ptr)) { while (!ctx->Done(&ptr)) {
uint32 tag; uint32_t tag;
ptr = ReadTag(ptr, &tag); ptr = ReadTag(ptr, &tag);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr != nullptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr != nullptr);
if (tag == 0 || (tag & 7) == 4) { if (tag == 0 || (tag & 7) == 4) {
@@ -874,7 +881,7 @@ PROTOBUF_MUST_USE_RESULT const char* PackedEnumParser(
void* object, const char* ptr, ParseContext* ctx, bool (*is_valid)(int), void* object, const char* ptr, ParseContext* ctx, bool (*is_valid)(int),
InternalMetadata* metadata, int field_num) { InternalMetadata* metadata, int field_num) {
return ctx->ReadPackedVarint( return ctx->ReadPackedVarint(
ptr, [object, is_valid, metadata, field_num](uint64 val) { ptr, [object, is_valid, metadata, field_num](uint64_t val) {
if (is_valid(val)) { if (is_valid(val)) {
static_cast<RepeatedField<int>*>(object)->Add(val); static_cast<RepeatedField<int>*>(object)->Add(val);
} else { } else {
@@ -889,7 +896,7 @@ PROTOBUF_MUST_USE_RESULT const char* PackedEnumParserArg(
bool (*is_valid)(const void*, int), const void* data, bool (*is_valid)(const void*, int), const void* data,
InternalMetadata* metadata, int field_num) { InternalMetadata* metadata, int field_num) {
return ctx->ReadPackedVarint( return ctx->ReadPackedVarint(
ptr, [object, is_valid, data, metadata, field_num](uint64 val) { ptr, [object, is_valid, data, metadata, field_num](uint64_t val) {
if (is_valid(data, val)) { if (is_valid(data, val)) {
static_cast<RepeatedField<int>*>(object)->Add(val); static_cast<RepeatedField<int>*>(object)->Add(val);
} else { } else {
@@ -920,7 +927,7 @@ PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* UnknownGroupLiteParse(
// useful in the generated code. It uses overload on std::string* vs // useful in the generated code. It uses overload on std::string* vs
// UnknownFieldSet* to make the generated code isomorphic between full and lite. // UnknownFieldSet* to make the generated code isomorphic between full and lite.
PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* UnknownFieldParse( PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* UnknownFieldParse(
uint32 tag, std::string* unknown, const char* ptr, ParseContext* ctx); uint32_t tag, std::string* unknown, const char* ptr, ParseContext* ctx);
} // namespace internal } // namespace internal
} // namespace protobuf } // namespace protobuf

View File

@@ -52,6 +52,35 @@
// GCC, and MSVC. Function-like macros are usable without an #ifdef guard. // GCC, and MSVC. Function-like macros are usable without an #ifdef guard.
// Syntax macros (for example, attributes) are always defined, although // Syntax macros (for example, attributes) are always defined, although
// they may be empty. // they may be empty.
//
// Some definitions rely on the NDEBUG macro and/or (in MSVC) _DEBUG:
// - https://en.cppreference.com/w/c/error/assert
// - https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros#microsoft-specific-predefined-macros
//
// References for predefined macros:
// - Standard: https://en.cppreference.com/w/cpp/preprocessor/replace
// - Clang: https://clang.llvm.org/docs/LanguageExtensions.html
// (see also GCC predefined macros)
// - GCC: https://gcc.gnu.org/onlinedocs/cpp/Predefined-Macros.html
// - MSVC: https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
// - Interactive (Clang/GCC only): https://www.compiler-explorer.com/z/hc6jKd3sj
//
// References for attributes (and extension attributes):
// - Standard: https://en.cppreference.com/w/cpp/language/attributes
// - Clang: https://clang.llvm.org/docs/AttributeReference.html
// - GCC: https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html
// (see Clang attribute docs as well)
//
// References for standard C++ language conformance (and minimum versions):
// - Clang: https://clang.llvm.org/cxx_status.html
// - GCC: https://gcc.gnu.org/projects/cxx-status.html
// - MSVC: https://docs.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance
//
// Historical release notes (which can help to determine minimum versions):
// - Clang: https://releases.llvm.org/
// - GCC: https://gcc.gnu.org/releases.html
// - MSVC: https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes-history
// https://docs.microsoft.com/en-us/visualstudio/releasenotes/vs2017-relnotes-history
// Portable fallbacks for C++20 feature test macros: // Portable fallbacks for C++20 feature test macros:
// https://en.cppreference.com/w/cpp/feature_test // https://en.cppreference.com/w/cpp/feature_test
@@ -99,6 +128,23 @@
# define PROTOBUF_GNUC_MIN(x, y) 0 # define PROTOBUF_GNUC_MIN(x, y) 0
#endif #endif
// Portable check for MSVC minimum version:
// https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
#if defined(_MSC_VER)
#define PROTOBUF_MSC_VER_MIN(x) (_MSC_VER >= x)
#else
#define PROTOBUF_MSC_VER_MIN(x) 0
#endif
// Portable check for minimum C++ language version:
// https://en.cppreference.com/w/cpp/preprocessor/replace
// https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
#if !defined(_MSVC_LANG)
#define PROTOBUF_CPLUSPLUS_MIN(x) (__cplusplus >= x)
#else
#define PROTOBUF_CPLUSPLUS_MIN(x) (_MSVC_LANG >= x)
#endif
// Future versions of protobuf will include breaking changes to some APIs. // Future versions of protobuf will include breaking changes to some APIs.
// This macro can be set to enable these API changes ahead of time, so that // This macro can be set to enable these API changes ahead of time, so that
// user code can be updated before upgrading versions of protobuf. // user code can be updated before upgrading versions of protobuf.
@@ -107,17 +153,17 @@
#ifdef PROTOBUF_VERSION #ifdef PROTOBUF_VERSION
#error PROTOBUF_VERSION was previously defined #error PROTOBUF_VERSION was previously defined
#endif #endif
#define PROTOBUF_VERSION 3017003 #define PROTOBUF_VERSION 3018001
#ifdef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC #ifdef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC
#error PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC was previously defined #error PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC was previously defined
#endif #endif
#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3017000 #define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3018000
#ifdef PROTOBUF_MIN_PROTOC_VERSION #ifdef PROTOBUF_MIN_PROTOC_VERSION
#error PROTOBUF_MIN_PROTOC_VERSION was previously defined #error PROTOBUF_MIN_PROTOC_VERSION was previously defined
#endif #endif
#define PROTOBUF_MIN_PROTOC_VERSION 3017000 #define PROTOBUF_MIN_PROTOC_VERSION 3018000
#ifdef PROTOBUF_VERSION_SUFFIX #ifdef PROTOBUF_VERSION_SUFFIX
#error PROTOBUF_VERSION_SUFFIX was previously defined #error PROTOBUF_VERSION_SUFFIX was previously defined
@@ -184,8 +230,9 @@
#error PROTOBUF_TAILCALL was previously defined #error PROTOBUF_TAILCALL was previously defined
#endif #endif
#if __has_cpp_attribute(clang::musttail) && \ #if __has_cpp_attribute(clang::musttail) && \
!defined(_ARCH_PPC) && !defined(__wasm__) !defined(__arm__) && !defined(_ARCH_PPC) && !defined(__wasm__)
# ifndef PROTO2_OPENSOURCE # ifndef PROTO2_OPENSOURCE
// Compilation fails on ARM32: b/195943306
// Compilation fails on powerpc64le: b/187985113 // Compilation fails on powerpc64le: b/187985113
# endif # endif
#define PROTOBUF_MUSTTAIL [[clang::musttail]] #define PROTOBUF_MUSTTAIL [[clang::musttail]]
@@ -304,7 +351,7 @@
// The minimum library version which works with the current version of the // The minimum library version which works with the current version of the
// headers. // headers.
#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3017000 #define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3018000
#ifdef PROTOBUF_RTTI #ifdef PROTOBUF_RTTI
#error PROTOBUF_RTTI was previously defined #error PROTOBUF_RTTI was previously defined
@@ -397,8 +444,8 @@
#error PROTOBUF_PREDICT_(TRUE|FALSE) was previously defined #error PROTOBUF_PREDICT_(TRUE|FALSE) was previously defined
#endif #endif
#if PROTOBUF_GNUC_MIN(3, 0) #if PROTOBUF_GNUC_MIN(3, 0)
# define PROTOBUF_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1)) # define PROTOBUF_PREDICT_TRUE(x) (__builtin_expect(false || (x), true))
# define PROTOBUF_PREDICT_FALSE(x) (__builtin_expect((x), 0)) # define PROTOBUF_PREDICT_FALSE(x) (__builtin_expect(false || (x), false))
#else #else
# define PROTOBUF_PREDICT_TRUE(x) (x) # define PROTOBUF_PREDICT_TRUE(x) (x)
# define PROTOBUF_PREDICT_FALSE(x) (x) # define PROTOBUF_PREDICT_FALSE(x) (x)
@@ -409,10 +456,6 @@
#endif #endif
# define PROTOBUF_MUST_USE_RESULT # define PROTOBUF_MUST_USE_RESULT
#ifdef PROTOBUF_MUST_USE_EXTRACT_RESULT
#error PROTOBUF_MUST_USE_EXTRACT_RESULT was previously defined
#endif
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
#error PROTOBUF_FORCE_COPY_IN_RELEASE was previously defined #error PROTOBUF_FORCE_COPY_IN_RELEASE was previously defined
#endif #endif
@@ -421,10 +464,16 @@
#error PROTOBUF_FORCE_COPY_IN_SWAP was previously defined #error PROTOBUF_FORCE_COPY_IN_SWAP was previously defined
#endif #endif
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
#error PROTOBUF_FORCE_COPY_IN_MOVE was previously defined
#endif
#ifdef PROTOBUF_FALLTHROUGH_INTENDED #ifdef PROTOBUF_FALLTHROUGH_INTENDED
#error PROTOBUF_FALLTHROUGH_INTENDED was previously defined #error PROTOBUF_FALLTHROUGH_INTENDED was previously defined
#endif #endif
#if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough") #if __has_cpp_attribute(fallthrough)
#define PROTOBUF_FALLTHROUGH_INTENDED [[fallthrough]]
#elif __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
#define PROTOBUF_FALLTHROUGH_INTENDED [[clang::fallthrough]] #define PROTOBUF_FALLTHROUGH_INTENDED [[clang::fallthrough]]
#elif PROTOBUF_GNUC_MIN(7, 0) #elif PROTOBUF_GNUC_MIN(7, 0)
#define PROTOBUF_FALLTHROUGH_INTENDED [[gnu::fallthrough]] #define PROTOBUF_FALLTHROUGH_INTENDED [[gnu::fallthrough]]
@@ -559,10 +608,15 @@
#ifdef PROTOBUF_ATTRIBUTE_WEAK #ifdef PROTOBUF_ATTRIBUTE_WEAK
#error PROTOBUF_ATTRIBUTE_WEAK was previously defined #error PROTOBUF_ATTRIBUTE_WEAK was previously defined
#endif #endif
#if __has_attribute(weak) && !defined(__MINGW32__) #if __has_attribute(weak) && \
!defined(__APPLE__) && \
(!defined(_WIN32) || __clang_major__ < 9) && \
!defined(__MINGW32__)
#define PROTOBUF_ATTRIBUTE_WEAK __attribute__((weak)) #define PROTOBUF_ATTRIBUTE_WEAK __attribute__((weak))
#define PROTOBUF_HAVE_ATTRIBUTE_WEAK 1
#else #else
#define PROTOBUF_ATTRIBUTE_WEAK #define PROTOBUF_ATTRIBUTE_WEAK
#define PROTOBUF_HAVE_ATTRIBUTE_WEAK 0
#endif #endif
// Macros to detect sanitizers. // Macros to detect sanitizers.
@@ -590,11 +644,42 @@
# define PROTOBUF_TSAN __SANITIZE_THREAD__ # define PROTOBUF_TSAN __SANITIZE_THREAD__
#endif #endif
// Tail call table-driven parsing can be enabled by defining
// PROTOBUF_EXPERIMENTAL_USE_TAIL_CALL_TABLE_PARSER at compilation time. Note
// that this macro is for small-scale testing only, and is not supported.
#ifdef PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED
#error PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED was previously declared
#endif
#if defined(PROTOBUF_EXPERIMENTAL_USE_TAIL_CALL_TABLE_PARSER)
#define PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED 1
// Selectively use static member functions instead of templates:
#ifndef PROTOBUF_TC_STATIC_PARSE_SINGULAR1
# define PROTOBUF_TC_STATIC_PARSE_SINGULAR1 1
#endif
#ifndef PROTOBUF_TC_STATIC_PARSE_SINGULAR2
# define PROTOBUF_TC_STATIC_PARSE_SINGULAR2 0
#endif
#ifndef PROTOBUF_TC_STATIC_PARSE_REPEATED1
# define PROTOBUF_TC_STATIC_PARSE_REPEATED1 0
#endif
#ifndef PROTOBUF_TC_STATIC_PARSE_REPEATED2
# define PROTOBUF_TC_STATIC_PARSE_REPEATED2 0
#endif
#endif
#define PROTOBUF_TC_PARAM_DECL \
::google::protobuf::MessageLite *msg, const char *ptr, \
::google::protobuf::internal::ParseContext *ctx, \
const ::google::protobuf::internal::TailCallParseTableBase *table, \
uint64_t hasbits, ::google::protobuf::internal::TcFieldData data
#ifdef PROTOBUF_UNUSED #ifdef PROTOBUF_UNUSED
#error PROTOBUF_UNUSED was previously defined #error PROTOBUF_UNUSED was previously defined
#endif #endif
#if __has_cpp_attribute(unused) || \ #if __has_cpp_attribute(maybe_unused) || \
(PROTOBUF_GNUC_MIN(3, 0) && !defined(__clang__)) (PROTOBUF_MSC_VER_MIN(1911) && PROTOBUF_CPLUSPLUS_MIN(201703L))
#define PROTOBUF_UNUSED [[maybe_unused]]
#elif __has_attribute(unused) || PROTOBUF_GNUC_MIN(3, 0)
#define PROTOBUF_UNUSED __attribute__((__unused__)) #define PROTOBUF_UNUSED __attribute__((__unused__))
#else #else
#define PROTOBUF_UNUSED #define PROTOBUF_UNUSED
@@ -706,4 +791,3 @@
# undef __has_builtin # undef __has_builtin
# undef PROTOBUF_has_builtin_DEFINED_ # undef PROTOBUF_has_builtin_DEFINED_
#endif #endif
#undef PROTOBUF_GNUC_MIN

View File

@@ -34,6 +34,9 @@
#ifndef PROTOBUF_NAMESPACE #ifndef PROTOBUF_NAMESPACE
#error "port_undef.inc must be included after port_def.inc" #error "port_undef.inc must be included after port_def.inc"
#endif #endif
#undef PROTOBUF_GNUC_MIN
#undef PROTOBUF_MSC_VER_MIN
#undef PROTOBUF_CPLUSPLUS_MIN
#undef PROTOBUF_NAMESPACE #undef PROTOBUF_NAMESPACE
#undef PROTOBUF_NAMESPACE_ID #undef PROTOBUF_NAMESPACE_ID
#undef PROTOBUF_ALWAYS_INLINE #undef PROTOBUF_ALWAYS_INLINE
@@ -61,9 +64,9 @@
#undef PROTOBUF_EXPORT #undef PROTOBUF_EXPORT
#undef PROTOC_EXPORT #undef PROTOC_EXPORT
#undef PROTOBUF_MUST_USE_RESULT #undef PROTOBUF_MUST_USE_RESULT
#undef PROTOBUF_MUST_USE_EXTRACT_RESULT
#undef PROTOBUF_FORCE_COPY_IN_RELEASE #undef PROTOBUF_FORCE_COPY_IN_RELEASE
#undef PROTOBUF_FORCE_COPY_IN_SWAP #undef PROTOBUF_FORCE_COPY_IN_SWAP
#undef PROTOBUF_FORCE_COPY_IN_MOVE
#undef PROTOBUF_NAMESPACE_OPEN #undef PROTOBUF_NAMESPACE_OPEN
#undef PROTOBUF_NAMESPACE_CLOSE #undef PROTOBUF_NAMESPACE_CLOSE
#undef PROTOBUF_UNUSED #undef PROTOBUF_UNUSED
@@ -76,12 +79,19 @@
#undef PROTOBUF_MESSAGE_OWNED_ARENA_EXPERIMENT #undef PROTOBUF_MESSAGE_OWNED_ARENA_EXPERIMENT
#undef PROTOBUF_CONSTINIT #undef PROTOBUF_CONSTINIT
#undef PROTOBUF_ATTRIBUTE_WEAK #undef PROTOBUF_ATTRIBUTE_WEAK
#undef PROTOBUF_HAVE_ATTRIBUTE_WEAK
#undef PROTOBUF_ATTRIBUTE_NO_DESTROY #undef PROTOBUF_ATTRIBUTE_NO_DESTROY
#undef PROTOBUF_ATTRIBUTE_INIT_PRIORITY #undef PROTOBUF_ATTRIBUTE_INIT_PRIORITY
#undef PROTOBUF_PRAGMA_INIT_SEG #undef PROTOBUF_PRAGMA_INIT_SEG
#undef PROTOBUF_ASAN #undef PROTOBUF_ASAN
#undef PROTOBUF_MSAN #undef PROTOBUF_MSAN
#undef PROTOBUF_TSAN #undef PROTOBUF_TSAN
#undef PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED
#undef PROTOBUF_TC_STATIC_PARSE_SINGULAR1
#undef PROTOBUF_TC_STATIC_PARSE_SINGULAR2
#undef PROTOBUF_TC_STATIC_PARSE_REPEATED1
#undef PROTOBUF_TC_STATIC_PARSE_REPEATED2
#undef PROTOBUF_TC_PARAM_DECL
#undef PROTOBUF_EXCLUSIVE_LOCKS_REQUIRED #undef PROTOBUF_EXCLUSIVE_LOCKS_REQUIRED
#undef PROTOBUF_LOCKS_EXCLUDED #undef PROTOBUF_LOCKS_EXCLUDED
#undef PROTOBUF_NO_THREAD_SAFETY_ANALYSIS #undef PROTOBUF_NO_THREAD_SAFETY_ANALYSIS

View File

@@ -282,19 +282,19 @@ namespace internal {
// cpp_type to the type that should be used in this interface: // cpp_type to the type that should be used in this interface:
// //
// field->cpp_type() T Actual type of void* // field->cpp_type() T Actual type of void*
// CPPTYPE_INT32 int32 int32 // CPPTYPE_INT32 int32_t int32_t
// CPPTYPE_UINT32 uint32 uint32 // CPPTYPE_UINT32 uint32_t uint32_t
// CPPTYPE_INT64 int64 int64 // CPPTYPE_INT64 int64_t int64_t
// CPPTYPE_UINT64 uint64 uint64 // CPPTYPE_UINT64 uint64_t uint64_t
// CPPTYPE_DOUBLE double double // CPPTYPE_DOUBLE double double
// CPPTYPE_FLOAT float float // CPPTYPE_FLOAT float float
// CPPTYPE_BOOL bool bool // CPPTYPE_BOOL bool bool
// CPPTYPE_ENUM generated enum type int32 // CPPTYPE_ENUM generated enum type int32_t
// CPPTYPE_STRING string std::string // CPPTYPE_STRING string std::string
// CPPTYPE_MESSAGE generated message type google::protobuf::Message // CPPTYPE_MESSAGE generated message type google::protobuf::Message
// or google::protobuf::Message // or google::protobuf::Message
// //
// Note that for enums we use int32 in the interface. // Note that for enums we use int32_t in the interface.
// //
// You can map from T to the actual type using RefTypeTraits: // You can map from T to the actual type using RefTypeTraits:
// typedef RefTypeTraits<T>::AccessorValueType ActualType; // typedef RefTypeTraits<T>::AccessorValueType ActualType;
@@ -362,7 +362,7 @@ class PROTOBUF_EXPORT RepeatedFieldAccessor {
// be ActualType. Here we have a ValueType object and want a ActualType // be ActualType. Here we have a ValueType object and want a ActualType
// pointer. We can't cast a ValueType pointer to an ActualType pointer // pointer. We can't cast a ValueType pointer to an ActualType pointer
// directly because their type might be different (for enums ValueType // directly because their type might be different (for enums ValueType
// may be a generated enum type while ActualType is int32). To be safe // may be a generated enum type while ActualType is int32_t). To be safe
// we make a copy to get a temporary ActualType object and use it. // we make a copy to get a temporary ActualType object and use it.
ActualType tmp = static_cast<ActualType>(value); ActualType tmp = static_cast<ActualType>(value);
Set(data, index, static_cast<const Value*>(&tmp)); Set(data, index, static_cast<const Value*>(&tmp));
@@ -376,7 +376,7 @@ class PROTOBUF_EXPORT RepeatedFieldAccessor {
// be ActualType. Here we have a ValueType object and want a ActualType // be ActualType. Here we have a ValueType object and want a ActualType
// pointer. We can't cast a ValueType pointer to an ActualType pointer // pointer. We can't cast a ValueType pointer to an ActualType pointer
// directly because their type might be different (for enums ValueType // directly because their type might be different (for enums ValueType
// may be a generated enum type while ActualType is int32). To be safe // may be a generated enum type while ActualType is int32_t). To be safe
// we make a copy to get a temporary ActualType object and use it. // we make a copy to get a temporary ActualType object and use it.
ActualType tmp = static_cast<ActualType>(value); ActualType tmp = static_cast<ActualType>(value);
Add(data, static_cast<const Value*>(&tmp)); Add(data, static_cast<const Value*>(&tmp));
@@ -392,13 +392,18 @@ class PROTOBUF_EXPORT RepeatedFieldAccessor {
// Implement (Mutable)RepeatedFieldRef::iterator // Implement (Mutable)RepeatedFieldRef::iterator
template <typename T> template <typename T>
class RepeatedFieldRefIterator class RepeatedFieldRefIterator {
: public std::iterator<std::forward_iterator_tag, T> {
typedef typename RefTypeTraits<T>::AccessorValueType AccessorValueType; typedef typename RefTypeTraits<T>::AccessorValueType AccessorValueType;
typedef typename RefTypeTraits<T>::IteratorValueType IteratorValueType; typedef typename RefTypeTraits<T>::IteratorValueType IteratorValueType;
typedef typename RefTypeTraits<T>::IteratorPointerType IteratorPointerType; typedef typename RefTypeTraits<T>::IteratorPointerType IteratorPointerType;
public: public:
using iterator_category = std::forward_iterator_tag;
using value_type = T;
using pointer = T*;
using reference = T&;
using difference_type = std::ptrdiff_t;
// Constructor for non-message fields. // Constructor for non-message fields.
RepeatedFieldRefIterator(const void* data, RepeatedFieldRefIterator(const void* data,
const RepeatedFieldAccessor* accessor, bool begin) const RepeatedFieldAccessor* accessor, bool begin)
@@ -480,10 +485,10 @@ struct PrimitiveTraits {
static const FieldDescriptor::CppType cpp_type = \ static const FieldDescriptor::CppType cpp_type = \
FieldDescriptor::CPPTYPE_##TYPE; \ FieldDescriptor::CPPTYPE_##TYPE; \
}; };
DEFINE_PRIMITIVE(INT32, int32) DEFINE_PRIMITIVE(INT32, int32_t)
DEFINE_PRIMITIVE(UINT32, uint32) DEFINE_PRIMITIVE(UINT32, uint32_t)
DEFINE_PRIMITIVE(INT64, int64) DEFINE_PRIMITIVE(INT64, int64_t)
DEFINE_PRIMITIVE(UINT64, uint64) DEFINE_PRIMITIVE(UINT64, uint64_t)
DEFINE_PRIMITIVE(FLOAT, float) DEFINE_PRIMITIVE(FLOAT, float)
DEFINE_PRIMITIVE(DOUBLE, double) DEFINE_PRIMITIVE(DOUBLE, double)
DEFINE_PRIMITIVE(BOOL, bool) DEFINE_PRIMITIVE(BOOL, bool)
@@ -507,10 +512,10 @@ struct RefTypeTraits<
T, typename std::enable_if<is_proto_enum<T>::value>::type> { T, typename std::enable_if<is_proto_enum<T>::value>::type> {
typedef RepeatedFieldRefIterator<T> iterator; typedef RepeatedFieldRefIterator<T> iterator;
typedef RepeatedFieldAccessor AccessorType; typedef RepeatedFieldAccessor AccessorType;
// We use int32 for repeated enums in RepeatedFieldAccessor. // We use int32_t for repeated enums in RepeatedFieldAccessor.
typedef int32 AccessorValueType; typedef int32_t AccessorValueType;
typedef T IteratorValueType; typedef T IteratorValueType;
typedef int32* IteratorPointerType; typedef int32_t* IteratorPointerType;
static constexpr FieldDescriptor::CppType cpp_type = static constexpr FieldDescriptor::CppType cpp_type =
FieldDescriptor::CPPTYPE_ENUM; FieldDescriptor::CPPTYPE_ENUM;
static const Descriptor* GetMessageFieldDescriptor() { return NULL; } static const Descriptor* GetMessageFieldDescriptor() { return NULL; }

View File

@@ -144,15 +144,15 @@ inline typename std::enable_if<(kSize == 0), void>::type memswap(char*, char*) {
q + sizeof(reg_type)); \ q + sizeof(reg_type)); \
} }
PROTO_MEMSWAP_DEF_SIZE(uint8, 2) PROTO_MEMSWAP_DEF_SIZE(uint8_t, 2)
PROTO_MEMSWAP_DEF_SIZE(uint16, 4) PROTO_MEMSWAP_DEF_SIZE(uint16_t, 4)
PROTO_MEMSWAP_DEF_SIZE(uint32, 8) PROTO_MEMSWAP_DEF_SIZE(uint32_t, 8)
#ifdef __SIZEOF_INT128__ #ifdef __SIZEOF_INT128__
PROTO_MEMSWAP_DEF_SIZE(uint64, 16) PROTO_MEMSWAP_DEF_SIZE(uint64_t, 16)
PROTO_MEMSWAP_DEF_SIZE(__uint128_t, (1u << 31)) PROTO_MEMSWAP_DEF_SIZE(__uint128_t, (1u << 31))
#else #else
PROTO_MEMSWAP_DEF_SIZE(uint64, (1u << 31)) PROTO_MEMSWAP_DEF_SIZE(uint64_t, (1u << 31))
#endif #endif
#undef PROTO_MEMSWAP_DEF_SIZE #undef PROTO_MEMSWAP_DEF_SIZE
@@ -218,13 +218,13 @@ class RepeatedField final {
// Calling this routine inside a loop can cause quadratic behavior. // Calling this routine inside a loop can cause quadratic behavior.
void ExtractSubrange(int start, int num, Element* elements); void ExtractSubrange(int start, int num, Element* elements);
void Clear(); PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear();
void MergeFrom(const RepeatedField& other); void MergeFrom(const RepeatedField& other);
void CopyFrom(const RepeatedField& other); PROTOBUF_ATTRIBUTE_REINITIALIZES void CopyFrom(const RepeatedField& other);
// Replaces the contents with RepeatedField(begin, end). // Replaces the contents with RepeatedField(begin, end).
template <typename Iter> template <typename Iter>
void Assign(Iter begin, Iter end); PROTOBUF_ATTRIBUTE_REINITIALIZES void Assign(Iter begin, Iter end);
// Reserve space to expand the field to at least the given size. If the // Reserve space to expand the field to at least the given size. If the
// array is grown, it will always be at least doubled in size. // array is grown, it will always be at least doubled in size.
@@ -975,13 +975,13 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
// Calling this routine inside a loop can cause quadratic behavior. // Calling this routine inside a loop can cause quadratic behavior.
void DeleteSubrange(int start, int num); void DeleteSubrange(int start, int num);
void Clear(); PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear();
void MergeFrom(const RepeatedPtrField& other); void MergeFrom(const RepeatedPtrField& other);
void CopyFrom(const RepeatedPtrField& other); PROTOBUF_ATTRIBUTE_REINITIALIZES void CopyFrom(const RepeatedPtrField& other);
// Replaces the contents with RepeatedPtrField(begin, end). // Replaces the contents with RepeatedPtrField(begin, end).
template <typename Iter> template <typename Iter>
void Assign(Iter begin, Iter end); PROTOBUF_ATTRIBUTE_REINITIALIZES void Assign(Iter begin, Iter end);
// Reserve space to expand the field to at least the given size. This only // Reserve space to expand the field to at least the given size. This only
// resizes the pointer array; it doesn't allocate any objects. If the // resizes the pointer array; it doesn't allocate any objects. If the
@@ -1089,17 +1089,17 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
// It is also useful in legacy code that uses temporary ownership to avoid // It is also useful in legacy code that uses temporary ownership to avoid
// copies. Example: // copies. Example:
// RepeatedPtrField<T> temp_field; // RepeatedPtrField<T> temp_field;
// temp_field.AddAllocated(new T); // temp_field.UnsafeArenaAddAllocated(new T);
// ... // Do something with temp_field // ... // Do something with temp_field
// temp_field.ExtractSubrange(0, temp_field.size(), nullptr); // temp_field.UnsafeArenaExtractSubrange(0, temp_field.size(), nullptr);
// If you put temp_field on the arena this fails, because the ownership // If you put temp_field on the arena this fails, because the ownership
// transfers to the arena at the "AddAllocated" call and is not released // transfers to the arena at the "AddAllocated" call and is not released
// anymore causing a double delete. UnsafeArenaAddAllocated prevents this. // anymore causing a double delete. UnsafeArenaAddAllocated prevents this.
void UnsafeArenaAddAllocated(Element* value); void UnsafeArenaAddAllocated(Element* value);
// Remove the last element and return it. Works only when operating on an // Remove the last element and return it. Unlike ReleaseLast, the returned
// arena. The returned pointer is to the original object in the arena, hence // pointer is always to the original object. This may be in an arena, and
// has the arena's lifetime. // therefore have the arena's lifetime.
// Requires: current_size_ > 0 // Requires: current_size_ > 0
Element* UnsafeArenaReleaseLast(); Element* UnsafeArenaReleaseLast();
@@ -1120,10 +1120,10 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
// UnsafeArenaExtractSubrange(). // UnsafeArenaExtractSubrange().
void ExtractSubrange(int start, int num, Element** elements); void ExtractSubrange(int start, int num, Element** elements);
// Identical to ExtractSubrange() described above, except that when this // Identical to ExtractSubrange() described above, except that no object
// repeated field is on an arena, no object copies are performed. Instead, the // copies are ever performed. Instead, the raw object pointers are returned.
// raw object pointers are returned. Thus, if on an arena, the returned // Thus, if on an arena, the returned objects must not be freed, because they
// objects must not be freed, because they will not be heap-allocated objects. // will not be heap-allocated objects.
void UnsafeArenaExtractSubrange(int start, int num, Element** elements); void UnsafeArenaExtractSubrange(int start, int num, Element** elements);
// When elements are removed by calls to RemoveLast() or Clear(), they // When elements are removed by calls to RemoveLast() or Clear(), they
@@ -1250,6 +1250,9 @@ inline RepeatedField<Element>& RepeatedField<Element>::operator=(
template <typename Element> template <typename Element>
inline RepeatedField<Element>::RepeatedField(RepeatedField&& other) noexcept inline RepeatedField<Element>::RepeatedField(RepeatedField&& other) noexcept
: RepeatedField() { : RepeatedField() {
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
CopyFrom(other);
#else // PROTOBUF_FORCE_COPY_IN_MOVE
// We don't just call Swap(&other) here because it would perform 3 copies if // We don't just call Swap(&other) here because it would perform 3 copies if
// other is on an arena. This field can't be on an arena because arena // other is on an arena. This field can't be on an arena because arena
// construction always uses the Arena* accepting constructor. // construction always uses the Arena* accepting constructor.
@@ -1258,6 +1261,7 @@ inline RepeatedField<Element>::RepeatedField(RepeatedField&& other) noexcept
} else { } else {
InternalSwap(&other); InternalSwap(&other);
} }
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
} }
template <typename Element> template <typename Element>
@@ -1266,7 +1270,11 @@ inline RepeatedField<Element>& RepeatedField<Element>::operator=(
// We don't just call Swap(&other) here because it would perform 3 copies if // We don't just call Swap(&other) here because it would perform 3 copies if
// the two fields are on different arenas. // the two fields are on different arenas.
if (this != &other) { if (this != &other) {
if (this->GetArena() != other.GetArena()) { if (GetArena() != other.GetArena()
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|| GetArena() == nullptr
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
) {
CopyFrom(other); CopyFrom(other);
} else { } else {
InternalSwap(&other); InternalSwap(&other);
@@ -1362,7 +1370,7 @@ inline void RepeatedField<Element>::Set(int index, const Element& value) {
template <typename Element> template <typename Element>
inline void RepeatedField<Element>::Add(const Element& value) { inline void RepeatedField<Element>::Add(const Element& value) {
uint32 size = current_size_; uint32_t size = current_size_;
if (static_cast<int>(size) == total_size_) { if (static_cast<int>(size) == total_size_) {
// value could reference an element of the array. Reserving new space will // value could reference an element of the array. Reserving new space will
// invalidate the reference. So we must make a copy first. // invalidate the reference. So we must make a copy first.
@@ -1377,7 +1385,7 @@ inline void RepeatedField<Element>::Add(const Element& value) {
template <typename Element> template <typename Element>
inline Element* RepeatedField<Element>::Add() { inline Element* RepeatedField<Element>::Add() {
uint32 size = current_size_; uint32_t size = current_size_;
if (static_cast<int>(size) == total_size_) Reserve(total_size_ + 1); if (static_cast<int>(size) == total_size_) Reserve(total_size_ + 1);
auto ptr = &elements()[size]; auto ptr = &elements()[size];
current_size_ = size + 1; current_size_ = size + 1;
@@ -1624,7 +1632,7 @@ void RepeatedField<Element>::Reserve(int new_size) {
// this, since Element is supposed to be POD, but a previous version of this // this, since Element is supposed to be POD, but a previous version of this
// code allocated storage with "new Element[size]" and some code uses // code allocated storage with "new Element[size]" and some code uses
// RepeatedField with non-POD types, relying on constructor invocation. If // RepeatedField with non-POD types, relying on constructor invocation. If
// Element has a trivial constructor (e.g., int32), gcc (tested with -O2) // Element has a trivial constructor (e.g., int32_t), gcc (tested with -O2)
// completely removes this loop because the loop body is empty, so this has no // completely removes this loop because the loop body is empty, so this has no
// effect unless its side-effects are required for correctness. // effect unless its side-effects are required for correctness.
// Note that we do this before MoveArray() below because Element's copy // Note that we do this before MoveArray() below because Element's copy
@@ -1978,9 +1986,6 @@ void RepeatedPtrFieldBase::AddAllocatedSlowWithCopy(
// Pass value_arena and my_arena to avoid duplicate virtual call (value) or // Pass value_arena and my_arena to avoid duplicate virtual call (value) or
// load (mine). // load (mine).
typename TypeHandler::Type* value, Arena* value_arena, Arena* my_arena) { typename TypeHandler::Type* value, Arena* value_arena, Arena* my_arena) {
#ifdef PROTOBUF_INTERNAL_USE_MUST_USE_RESULT
GOOGLE_DCHECK(value_arena == nullptr || value_arena == my_arena);
#endif // PROTOBUF_INTERNAL_USE_MUST_USE_RESULT
// Ensure that either the value is in the same arena, or if not, we do the // Ensure that either the value is in the same arena, or if not, we do the
// appropriate thing: Own() it (if it's on heap and we're in an arena) or copy // appropriate thing: Own() it (if it's on heap and we're in an arena) or copy
// it to our arena/heap (otherwise). // it to our arena/heap (otherwise).
@@ -2172,6 +2177,9 @@ template <typename Element>
inline RepeatedPtrField<Element>::RepeatedPtrField( inline RepeatedPtrField<Element>::RepeatedPtrField(
RepeatedPtrField&& other) noexcept RepeatedPtrField&& other) noexcept
: RepeatedPtrField() { : RepeatedPtrField() {
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
CopyFrom(other);
#else // PROTOBUF_FORCE_COPY_IN_MOVE
// We don't just call Swap(&other) here because it would perform 3 copies if // We don't just call Swap(&other) here because it would perform 3 copies if
// other is on an arena. This field can't be on an arena because arena // other is on an arena. This field can't be on an arena because arena
// construction always uses the Arena* accepting constructor. // construction always uses the Arena* accepting constructor.
@@ -2180,6 +2188,7 @@ inline RepeatedPtrField<Element>::RepeatedPtrField(
} else { } else {
InternalSwap(&other); InternalSwap(&other);
} }
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
} }
template <typename Element> template <typename Element>
@@ -2188,7 +2197,11 @@ inline RepeatedPtrField<Element>& RepeatedPtrField<Element>::operator=(
// We don't just call Swap(&other) here because it would perform 3 copies if // We don't just call Swap(&other) here because it would perform 3 copies if
// the two fields are on different arenas. // the two fields are on different arenas.
if (this != &other) { if (this != &other) {
if (this->GetArena() != other.GetArena()) { if (GetArena() != other.GetArena()
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|| GetArena() == nullptr
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
) {
CopyFrom(other); CopyFrom(other);
} else { } else {
InternalSwap(&other); InternalSwap(&other);
@@ -2285,11 +2298,9 @@ inline void RepeatedPtrField<Element>::ExtractSubrangeInternal(
if (num == 0) return; if (num == 0) return;
#ifdef PROTOBUF_MUST_USE_EXTRACT_RESULT
GOOGLE_DCHECK_NE(elements, nullptr) GOOGLE_DCHECK_NE(elements, nullptr)
<< "Releasing elements without transferring ownership is an unsafe " << "Releasing elements without transferring ownership is an unsafe "
"operation. Use UnsafeArenaExtractSubrange."; "operation. Use UnsafeArenaExtractSubrange.";
#endif
if (elements == nullptr) { if (elements == nullptr) {
CloseGap(start, num); CloseGap(start, num);
return; return;
@@ -2740,9 +2751,14 @@ RepeatedPtrField<Element>::pointer_end() const {
namespace internal { namespace internal {
// A back inserter for RepeatedField objects. // A back inserter for RepeatedField objects.
template <typename T> template <typename T>
class RepeatedFieldBackInsertIterator class RepeatedFieldBackInsertIterator {
: public std::iterator<std::output_iterator_tag, T> {
public: public:
using iterator_category = std::output_iterator_tag;
using value_type = T;
using pointer = void;
using reference = void;
using difference_type = std::ptrdiff_t;
explicit RepeatedFieldBackInsertIterator( explicit RepeatedFieldBackInsertIterator(
RepeatedField<T>* const mutable_field) RepeatedField<T>* const mutable_field)
: field_(mutable_field) {} : field_(mutable_field) {}
@@ -2762,9 +2778,14 @@ class RepeatedFieldBackInsertIterator
// A back inserter for RepeatedPtrField objects. // A back inserter for RepeatedPtrField objects.
template <typename T> template <typename T>
class RepeatedPtrFieldBackInsertIterator class RepeatedPtrFieldBackInsertIterator {
: public std::iterator<std::output_iterator_tag, T> {
public: public:
using iterator_category = std::output_iterator_tag;
using value_type = T;
using pointer = void;
using reference = void;
using difference_type = std::ptrdiff_t;
RepeatedPtrFieldBackInsertIterator(RepeatedPtrField<T>* const mutable_field) RepeatedPtrFieldBackInsertIterator(RepeatedPtrField<T>* const mutable_field)
: field_(mutable_field) {} : field_(mutable_field) {}
RepeatedPtrFieldBackInsertIterator<T>& operator=(const T& value) { RepeatedPtrFieldBackInsertIterator<T>& operator=(const T& value) {
@@ -2793,9 +2814,14 @@ class RepeatedPtrFieldBackInsertIterator
// A back inserter for RepeatedPtrFields that inserts by transferring ownership // A back inserter for RepeatedPtrFields that inserts by transferring ownership
// of a pointer. // of a pointer.
template <typename T> template <typename T>
class AllocatedRepeatedPtrFieldBackInsertIterator class AllocatedRepeatedPtrFieldBackInsertIterator {
: public std::iterator<std::output_iterator_tag, T> {
public: public:
using iterator_category = std::output_iterator_tag;
using value_type = T;
using pointer = void;
using reference = void;
using difference_type = std::ptrdiff_t;
explicit AllocatedRepeatedPtrFieldBackInsertIterator( explicit AllocatedRepeatedPtrFieldBackInsertIterator(
RepeatedPtrField<T>* const mutable_field) RepeatedPtrField<T>* const mutable_field)
: field_(mutable_field) {} : field_(mutable_field) {}
@@ -2817,9 +2843,14 @@ class AllocatedRepeatedPtrFieldBackInsertIterator
// Almost identical to AllocatedRepeatedPtrFieldBackInsertIterator. This one // Almost identical to AllocatedRepeatedPtrFieldBackInsertIterator. This one
// uses the UnsafeArenaAddAllocated instead. // uses the UnsafeArenaAddAllocated instead.
template <typename T> template <typename T>
class UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator class UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator {
: public std::iterator<std::output_iterator_tag, T> {
public: public:
using iterator_category = std::output_iterator_tag;
using value_type = T;
using pointer = void;
using reference = void;
using difference_type = std::ptrdiff_t;
explicit UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator( explicit UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator(
RepeatedPtrField<T>* const mutable_field) RepeatedPtrField<T>* const mutable_field)
: field_(mutable_field) {} : field_(mutable_field) {}
@@ -2886,9 +2917,9 @@ AllocatedRepeatedPtrFieldBackInserter(
// This is slightly faster if that matters. It is also useful in legacy code // This is slightly faster if that matters. It is also useful in legacy code
// that uses temporary ownership to avoid copies. Example: // that uses temporary ownership to avoid copies. Example:
// RepeatedPtrField<T> temp_field; // RepeatedPtrField<T> temp_field;
// temp_field.AddAllocated(new T); // temp_field.UnsafeArenaAddAllocated(new T);
// ... // Do something with temp_field // ... // Do something with temp_field
// temp_field.ExtractSubrange(0, temp_field.size(), nullptr); // temp_field.UnsafeArenaExtractSubrange(0, temp_field.size(), nullptr);
// If you put temp_field on the arena this fails, because the ownership // If you put temp_field on the arena this fails, because the ownership
// transfers to the arena at the "AddAllocated" call and is not released anymore // transfers to the arena at the "AddAllocated" call and is not released anymore
// causing a double delete. Using UnsafeArenaAddAllocated prevents this. // causing a double delete. Using UnsafeArenaAddAllocated prevents this.
@@ -2902,10 +2933,10 @@ UnsafeArenaAllocatedRepeatedPtrFieldBackInserter(
// Extern declarations of common instantiations to reduce library bloat. // Extern declarations of common instantiations to reduce library bloat.
extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<bool>; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<bool>;
extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<int32>; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<int32_t>;
extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<uint32>; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<uint32_t>;
extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<int64>; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<int64_t>;
extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<uint64>; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<uint64_t>;
extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<float>; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<float>;
extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<double>; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<double>;
extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE

View File

@@ -8,12 +8,12 @@
#include <string> #include <string>
#include <google/protobuf/port_def.inc> #include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3017000 #if PROTOBUF_VERSION < 3018000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #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 This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.
@@ -59,7 +59,7 @@ struct SourceContextDefaultTypeInternal;
PROTOBUF_EXPORT extern SourceContextDefaultTypeInternal _SourceContext_default_instance_; PROTOBUF_EXPORT extern SourceContextDefaultTypeInternal _SourceContext_default_instance_;
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::SourceContext* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::SourceContext>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::SourceContext* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::SourceContext>(Arena*);
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
@@ -84,7 +84,11 @@ class PROTOBUF_EXPORT SourceContext final :
} }
inline SourceContext& operator=(SourceContext&& from) noexcept { inline SourceContext& operator=(SourceContext&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -142,7 +146,7 @@ class PROTOBUF_EXPORT SourceContext final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const SourceContext& from); void MergeFrom(const SourceContext& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;

View File

@@ -0,0 +1,38 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef GOOGLE_PROTOBUF_STRING_MEMBER_ROBBER_H__
#define GOOGLE_PROTOBUF_STRING_MEMBER_ROBBER_H__
#include <string>
#include <type_traits>
#endif // GOOGLE_PROTOBUF_STRING_MEMBER_ROBBER_H__

View File

@@ -8,12 +8,12 @@
#include <string> #include <string>
#include <google/protobuf/port_def.inc> #include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3017000 #if PROTOBUF_VERSION < 3018000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #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 This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.
@@ -72,10 +72,10 @@ struct ValueDefaultTypeInternal;
PROTOBUF_EXPORT extern ValueDefaultTypeInternal _Value_default_instance_; PROTOBUF_EXPORT extern ValueDefaultTypeInternal _Value_default_instance_;
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::ListValue* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::ListValue>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::ListValue* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::ListValue>(Arena*);
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Struct* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Struct>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Struct* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Struct>(Arena*);
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse>(Arena*);
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Value* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Value>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Value* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Value>(Arena*);
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
@@ -106,12 +106,12 @@ inline bool NullValue_Parse(
// =================================================================== // ===================================================================
class Struct_FieldsEntry_DoNotUse : public ::PROTOBUF_NAMESPACE_ID::internal::MapEntry<Struct_FieldsEntry_DoNotUse, class Struct_FieldsEntry_DoNotUse : public ::PROTOBUF_NAMESPACE_ID::internal::MapEntry<Struct_FieldsEntry_DoNotUse,
std::string, PROTOBUF_NAMESPACE_ID::Value, std::string, ::PROTOBUF_NAMESPACE_ID::Value,
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_STRING, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_STRING,
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_MESSAGE> { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_MESSAGE> {
public: public:
typedef ::PROTOBUF_NAMESPACE_ID::internal::MapEntry<Struct_FieldsEntry_DoNotUse, typedef ::PROTOBUF_NAMESPACE_ID::internal::MapEntry<Struct_FieldsEntry_DoNotUse,
std::string, PROTOBUF_NAMESPACE_ID::Value, std::string, ::PROTOBUF_NAMESPACE_ID::Value,
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_STRING, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_STRING,
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_MESSAGE> SuperType; ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_MESSAGE> SuperType;
Struct_FieldsEntry_DoNotUse(); Struct_FieldsEntry_DoNotUse();
@@ -149,7 +149,11 @@ class PROTOBUF_EXPORT Struct final :
} }
inline Struct& operator=(Struct&& from) noexcept { inline Struct& operator=(Struct&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -207,7 +211,7 @@ class PROTOBUF_EXPORT Struct final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const Struct& from); void MergeFrom(const Struct& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;
@@ -255,14 +259,14 @@ class PROTOBUF_EXPORT Struct final :
public: public:
void clear_fields(); void clear_fields();
private: private:
const ::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >& const ::PROTOBUF_NAMESPACE_ID::Map< std::string, ::PROTOBUF_NAMESPACE_ID::Value >&
_internal_fields() const; _internal_fields() const;
::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >* ::PROTOBUF_NAMESPACE_ID::Map< std::string, ::PROTOBUF_NAMESPACE_ID::Value >*
_internal_mutable_fields(); _internal_mutable_fields();
public: public:
const ::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >& const ::PROTOBUF_NAMESPACE_ID::Map< std::string, ::PROTOBUF_NAMESPACE_ID::Value >&
fields() const; fields() const;
::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >* ::PROTOBUF_NAMESPACE_ID::Map< std::string, ::PROTOBUF_NAMESPACE_ID::Value >*
mutable_fields(); mutable_fields();
// @@protoc_insertion_point(class_scope:google.protobuf.Struct) // @@protoc_insertion_point(class_scope:google.protobuf.Struct)
@@ -274,7 +278,7 @@ class PROTOBUF_EXPORT Struct final :
typedef void DestructorSkippable_; typedef void DestructorSkippable_;
::PROTOBUF_NAMESPACE_ID::internal::MapField< ::PROTOBUF_NAMESPACE_ID::internal::MapField<
Struct_FieldsEntry_DoNotUse, Struct_FieldsEntry_DoNotUse,
std::string, PROTOBUF_NAMESPACE_ID::Value, std::string, ::PROTOBUF_NAMESPACE_ID::Value,
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_STRING, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_STRING,
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_MESSAGE> fields_; ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_MESSAGE> fields_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
@@ -301,7 +305,11 @@ class PROTOBUF_EXPORT Value final :
} }
inline Value& operator=(Value&& from) noexcept { inline Value& operator=(Value&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -369,7 +377,7 @@ class PROTOBUF_EXPORT Value final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const Value& from); void MergeFrom(const Value& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;
@@ -420,11 +428,11 @@ class PROTOBUF_EXPORT Value final :
bool _internal_has_null_value() const; bool _internal_has_null_value() const;
public: public:
void clear_null_value(); void clear_null_value();
PROTOBUF_NAMESPACE_ID::NullValue null_value() const; ::PROTOBUF_NAMESPACE_ID::NullValue null_value() const;
void set_null_value(PROTOBUF_NAMESPACE_ID::NullValue value); void set_null_value(::PROTOBUF_NAMESPACE_ID::NullValue value);
private: private:
PROTOBUF_NAMESPACE_ID::NullValue _internal_null_value() const; ::PROTOBUF_NAMESPACE_ID::NullValue _internal_null_value() const;
void _internal_set_null_value(PROTOBUF_NAMESPACE_ID::NullValue value); void _internal_set_null_value(::PROTOBUF_NAMESPACE_ID::NullValue value);
public: public:
// double number_value = 2; // double number_value = 2;
@@ -477,17 +485,17 @@ class PROTOBUF_EXPORT Value final :
bool _internal_has_struct_value() const; bool _internal_has_struct_value() const;
public: public:
void clear_struct_value(); void clear_struct_value();
const PROTOBUF_NAMESPACE_ID::Struct& struct_value() const; const ::PROTOBUF_NAMESPACE_ID::Struct& struct_value() const;
PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::Struct* release_struct_value(); PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::Struct* release_struct_value();
PROTOBUF_NAMESPACE_ID::Struct* mutable_struct_value(); ::PROTOBUF_NAMESPACE_ID::Struct* mutable_struct_value();
void set_allocated_struct_value(PROTOBUF_NAMESPACE_ID::Struct* struct_value); void set_allocated_struct_value(::PROTOBUF_NAMESPACE_ID::Struct* struct_value);
private: private:
const PROTOBUF_NAMESPACE_ID::Struct& _internal_struct_value() const; const ::PROTOBUF_NAMESPACE_ID::Struct& _internal_struct_value() const;
PROTOBUF_NAMESPACE_ID::Struct* _internal_mutable_struct_value(); ::PROTOBUF_NAMESPACE_ID::Struct* _internal_mutable_struct_value();
public: public:
void unsafe_arena_set_allocated_struct_value( void unsafe_arena_set_allocated_struct_value(
PROTOBUF_NAMESPACE_ID::Struct* struct_value); ::PROTOBUF_NAMESPACE_ID::Struct* struct_value);
PROTOBUF_NAMESPACE_ID::Struct* unsafe_arena_release_struct_value(); ::PROTOBUF_NAMESPACE_ID::Struct* unsafe_arena_release_struct_value();
// .google.protobuf.ListValue list_value = 6; // .google.protobuf.ListValue list_value = 6;
bool has_list_value() const; bool has_list_value() const;
@@ -495,17 +503,17 @@ class PROTOBUF_EXPORT Value final :
bool _internal_has_list_value() const; bool _internal_has_list_value() const;
public: public:
void clear_list_value(); void clear_list_value();
const PROTOBUF_NAMESPACE_ID::ListValue& list_value() const; const ::PROTOBUF_NAMESPACE_ID::ListValue& list_value() const;
PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::ListValue* release_list_value(); PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::ListValue* release_list_value();
PROTOBUF_NAMESPACE_ID::ListValue* mutable_list_value(); ::PROTOBUF_NAMESPACE_ID::ListValue* mutable_list_value();
void set_allocated_list_value(PROTOBUF_NAMESPACE_ID::ListValue* list_value); void set_allocated_list_value(::PROTOBUF_NAMESPACE_ID::ListValue* list_value);
private: private:
const PROTOBUF_NAMESPACE_ID::ListValue& _internal_list_value() const; const ::PROTOBUF_NAMESPACE_ID::ListValue& _internal_list_value() const;
PROTOBUF_NAMESPACE_ID::ListValue* _internal_mutable_list_value(); ::PROTOBUF_NAMESPACE_ID::ListValue* _internal_mutable_list_value();
public: public:
void unsafe_arena_set_allocated_list_value( void unsafe_arena_set_allocated_list_value(
PROTOBUF_NAMESPACE_ID::ListValue* list_value); ::PROTOBUF_NAMESPACE_ID::ListValue* list_value);
PROTOBUF_NAMESPACE_ID::ListValue* unsafe_arena_release_list_value(); ::PROTOBUF_NAMESPACE_ID::ListValue* unsafe_arena_release_list_value();
void clear_kind(); void clear_kind();
KindCase kind_case() const; KindCase kind_case() const;
@@ -532,8 +540,8 @@ class PROTOBUF_EXPORT Value final :
double number_value_; double number_value_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr string_value_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr string_value_;
bool bool_value_; bool bool_value_;
PROTOBUF_NAMESPACE_ID::Struct* struct_value_; ::PROTOBUF_NAMESPACE_ID::Struct* struct_value_;
PROTOBUF_NAMESPACE_ID::ListValue* list_value_; ::PROTOBUF_NAMESPACE_ID::ListValue* list_value_;
} kind_; } kind_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
::PROTOBUF_NAMESPACE_ID::uint32 _oneof_case_[1]; ::PROTOBUF_NAMESPACE_ID::uint32 _oneof_case_[1];
@@ -561,7 +569,11 @@ class PROTOBUF_EXPORT ListValue final :
} }
inline ListValue& operator=(ListValue&& from) noexcept { inline ListValue& operator=(ListValue&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -619,7 +631,7 @@ class PROTOBUF_EXPORT ListValue final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const ListValue& from); void MergeFrom(const ListValue& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;
@@ -665,16 +677,16 @@ class PROTOBUF_EXPORT ListValue final :
int _internal_values_size() const; int _internal_values_size() const;
public: public:
void clear_values(); void clear_values();
PROTOBUF_NAMESPACE_ID::Value* mutable_values(int index); ::PROTOBUF_NAMESPACE_ID::Value* mutable_values(int index);
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Value >* ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Value >*
mutable_values(); mutable_values();
private: private:
const PROTOBUF_NAMESPACE_ID::Value& _internal_values(int index) const; const ::PROTOBUF_NAMESPACE_ID::Value& _internal_values(int index) const;
PROTOBUF_NAMESPACE_ID::Value* _internal_add_values(); ::PROTOBUF_NAMESPACE_ID::Value* _internal_add_values();
public: public:
const PROTOBUF_NAMESPACE_ID::Value& values(int index) const; const ::PROTOBUF_NAMESPACE_ID::Value& values(int index) const;
PROTOBUF_NAMESPACE_ID::Value* add_values(); ::PROTOBUF_NAMESPACE_ID::Value* add_values();
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Value >& const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Value >&
values() const; values() const;
// @@protoc_insertion_point(class_scope:google.protobuf.ListValue) // @@protoc_insertion_point(class_scope:google.protobuf.ListValue)
@@ -684,7 +696,7 @@ class PROTOBUF_EXPORT ListValue final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_; typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_; typedef void DestructorSkippable_;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Value > values_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Value > values_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_google_2fprotobuf_2fstruct_2eproto; friend struct ::TableStruct_google_2fprotobuf_2fstruct_2eproto;
}; };
@@ -711,20 +723,20 @@ inline int Struct::fields_size() const {
inline void Struct::clear_fields() { inline void Struct::clear_fields() {
fields_.Clear(); fields_.Clear();
} }
inline const ::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >& inline const ::PROTOBUF_NAMESPACE_ID::Map< std::string, ::PROTOBUF_NAMESPACE_ID::Value >&
Struct::_internal_fields() const { Struct::_internal_fields() const {
return fields_.GetMap(); return fields_.GetMap();
} }
inline const ::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >& inline const ::PROTOBUF_NAMESPACE_ID::Map< std::string, ::PROTOBUF_NAMESPACE_ID::Value >&
Struct::fields() const { Struct::fields() const {
// @@protoc_insertion_point(field_map:google.protobuf.Struct.fields) // @@protoc_insertion_point(field_map:google.protobuf.Struct.fields)
return _internal_fields(); return _internal_fields();
} }
inline ::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >* inline ::PROTOBUF_NAMESPACE_ID::Map< std::string, ::PROTOBUF_NAMESPACE_ID::Value >*
Struct::_internal_mutable_fields() { Struct::_internal_mutable_fields() {
return fields_.MutableMap(); return fields_.MutableMap();
} }
inline ::PROTOBUF_NAMESPACE_ID::Map< std::string, PROTOBUF_NAMESPACE_ID::Value >* inline ::PROTOBUF_NAMESPACE_ID::Map< std::string, ::PROTOBUF_NAMESPACE_ID::Value >*
Struct::mutable_fields() { Struct::mutable_fields() {
// @@protoc_insertion_point(field_mutable_map:google.protobuf.Struct.fields) // @@protoc_insertion_point(field_mutable_map:google.protobuf.Struct.fields)
return _internal_mutable_fields(); return _internal_mutable_fields();
@@ -750,24 +762,24 @@ inline void Value::clear_null_value() {
clear_has_kind(); clear_has_kind();
} }
} }
inline PROTOBUF_NAMESPACE_ID::NullValue Value::_internal_null_value() const { inline ::PROTOBUF_NAMESPACE_ID::NullValue Value::_internal_null_value() const {
if (_internal_has_null_value()) { if (_internal_has_null_value()) {
return static_cast< PROTOBUF_NAMESPACE_ID::NullValue >(kind_.null_value_); return static_cast< ::PROTOBUF_NAMESPACE_ID::NullValue >(kind_.null_value_);
} }
return static_cast< PROTOBUF_NAMESPACE_ID::NullValue >(0); return static_cast< ::PROTOBUF_NAMESPACE_ID::NullValue >(0);
} }
inline PROTOBUF_NAMESPACE_ID::NullValue Value::null_value() const { inline ::PROTOBUF_NAMESPACE_ID::NullValue Value::null_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.Value.null_value) // @@protoc_insertion_point(field_get:google.protobuf.Value.null_value)
return _internal_null_value(); return _internal_null_value();
} }
inline void Value::_internal_set_null_value(PROTOBUF_NAMESPACE_ID::NullValue value) { inline void Value::_internal_set_null_value(::PROTOBUF_NAMESPACE_ID::NullValue value) {
if (!_internal_has_null_value()) { if (!_internal_has_null_value()) {
clear_kind(); clear_kind();
set_has_null_value(); set_has_null_value();
} }
kind_.null_value_ = value; kind_.null_value_ = value;
} }
inline void Value::set_null_value(PROTOBUF_NAMESPACE_ID::NullValue value) { inline void Value::set_null_value(::PROTOBUF_NAMESPACE_ID::NullValue value) {
_internal_set_null_value(value); _internal_set_null_value(value);
// @@protoc_insertion_point(field_set:google.protobuf.Value.null_value) // @@protoc_insertion_point(field_set:google.protobuf.Value.null_value)
} }
@@ -948,11 +960,11 @@ inline void Value::clear_struct_value() {
clear_has_kind(); clear_has_kind();
} }
} }
inline PROTOBUF_NAMESPACE_ID::Struct* Value::release_struct_value() { inline ::PROTOBUF_NAMESPACE_ID::Struct* Value::release_struct_value() {
// @@protoc_insertion_point(field_release:google.protobuf.Value.struct_value) // @@protoc_insertion_point(field_release:google.protobuf.Value.struct_value)
if (_internal_has_struct_value()) { if (_internal_has_struct_value()) {
clear_has_kind(); clear_has_kind();
PROTOBUF_NAMESPACE_ID::Struct* temp = kind_.struct_value_; ::PROTOBUF_NAMESPACE_ID::Struct* temp = kind_.struct_value_;
if (GetArenaForAllocation() != nullptr) { if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
} }
@@ -962,27 +974,27 @@ inline PROTOBUF_NAMESPACE_ID::Struct* Value::release_struct_value() {
return nullptr; return nullptr;
} }
} }
inline const PROTOBUF_NAMESPACE_ID::Struct& Value::_internal_struct_value() const { inline const ::PROTOBUF_NAMESPACE_ID::Struct& Value::_internal_struct_value() const {
return _internal_has_struct_value() return _internal_has_struct_value()
? *kind_.struct_value_ ? *kind_.struct_value_
: reinterpret_cast< PROTOBUF_NAMESPACE_ID::Struct&>(PROTOBUF_NAMESPACE_ID::_Struct_default_instance_); : reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::Struct&>(::PROTOBUF_NAMESPACE_ID::_Struct_default_instance_);
} }
inline const PROTOBUF_NAMESPACE_ID::Struct& Value::struct_value() const { inline const ::PROTOBUF_NAMESPACE_ID::Struct& Value::struct_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.Value.struct_value) // @@protoc_insertion_point(field_get:google.protobuf.Value.struct_value)
return _internal_struct_value(); return _internal_struct_value();
} }
inline PROTOBUF_NAMESPACE_ID::Struct* Value::unsafe_arena_release_struct_value() { inline ::PROTOBUF_NAMESPACE_ID::Struct* Value::unsafe_arena_release_struct_value() {
// @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.struct_value) // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.struct_value)
if (_internal_has_struct_value()) { if (_internal_has_struct_value()) {
clear_has_kind(); clear_has_kind();
PROTOBUF_NAMESPACE_ID::Struct* temp = kind_.struct_value_; ::PROTOBUF_NAMESPACE_ID::Struct* temp = kind_.struct_value_;
kind_.struct_value_ = nullptr; kind_.struct_value_ = nullptr;
return temp; return temp;
} else { } else {
return nullptr; return nullptr;
} }
} }
inline void Value::unsafe_arena_set_allocated_struct_value(PROTOBUF_NAMESPACE_ID::Struct* struct_value) { inline void Value::unsafe_arena_set_allocated_struct_value(::PROTOBUF_NAMESPACE_ID::Struct* struct_value) {
clear_kind(); clear_kind();
if (struct_value) { if (struct_value) {
set_has_struct_value(); set_has_struct_value();
@@ -990,16 +1002,16 @@ inline void Value::unsafe_arena_set_allocated_struct_value(PROTOBUF_NAMESPACE_ID
} }
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.struct_value) // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.struct_value)
} }
inline PROTOBUF_NAMESPACE_ID::Struct* Value::_internal_mutable_struct_value() { inline ::PROTOBUF_NAMESPACE_ID::Struct* Value::_internal_mutable_struct_value() {
if (!_internal_has_struct_value()) { if (!_internal_has_struct_value()) {
clear_kind(); clear_kind();
set_has_struct_value(); set_has_struct_value();
kind_.struct_value_ = CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Struct >(GetArenaForAllocation()); kind_.struct_value_ = CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Struct >(GetArenaForAllocation());
} }
return kind_.struct_value_; return kind_.struct_value_;
} }
inline PROTOBUF_NAMESPACE_ID::Struct* Value::mutable_struct_value() { inline ::PROTOBUF_NAMESPACE_ID::Struct* Value::mutable_struct_value() {
PROTOBUF_NAMESPACE_ID::Struct* _msg = _internal_mutable_struct_value(); ::PROTOBUF_NAMESPACE_ID::Struct* _msg = _internal_mutable_struct_value();
// @@protoc_insertion_point(field_mutable:google.protobuf.Value.struct_value) // @@protoc_insertion_point(field_mutable:google.protobuf.Value.struct_value)
return _msg; return _msg;
} }
@@ -1022,11 +1034,11 @@ inline void Value::clear_list_value() {
clear_has_kind(); clear_has_kind();
} }
} }
inline PROTOBUF_NAMESPACE_ID::ListValue* Value::release_list_value() { inline ::PROTOBUF_NAMESPACE_ID::ListValue* Value::release_list_value() {
// @@protoc_insertion_point(field_release:google.protobuf.Value.list_value) // @@protoc_insertion_point(field_release:google.protobuf.Value.list_value)
if (_internal_has_list_value()) { if (_internal_has_list_value()) {
clear_has_kind(); clear_has_kind();
PROTOBUF_NAMESPACE_ID::ListValue* temp = kind_.list_value_; ::PROTOBUF_NAMESPACE_ID::ListValue* temp = kind_.list_value_;
if (GetArenaForAllocation() != nullptr) { if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
} }
@@ -1036,27 +1048,27 @@ inline PROTOBUF_NAMESPACE_ID::ListValue* Value::release_list_value() {
return nullptr; return nullptr;
} }
} }
inline const PROTOBUF_NAMESPACE_ID::ListValue& Value::_internal_list_value() const { inline const ::PROTOBUF_NAMESPACE_ID::ListValue& Value::_internal_list_value() const {
return _internal_has_list_value() return _internal_has_list_value()
? *kind_.list_value_ ? *kind_.list_value_
: reinterpret_cast< PROTOBUF_NAMESPACE_ID::ListValue&>(PROTOBUF_NAMESPACE_ID::_ListValue_default_instance_); : reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::ListValue&>(::PROTOBUF_NAMESPACE_ID::_ListValue_default_instance_);
} }
inline const PROTOBUF_NAMESPACE_ID::ListValue& Value::list_value() const { inline const ::PROTOBUF_NAMESPACE_ID::ListValue& Value::list_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.Value.list_value) // @@protoc_insertion_point(field_get:google.protobuf.Value.list_value)
return _internal_list_value(); return _internal_list_value();
} }
inline PROTOBUF_NAMESPACE_ID::ListValue* Value::unsafe_arena_release_list_value() { inline ::PROTOBUF_NAMESPACE_ID::ListValue* Value::unsafe_arena_release_list_value() {
// @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.list_value) // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.list_value)
if (_internal_has_list_value()) { if (_internal_has_list_value()) {
clear_has_kind(); clear_has_kind();
PROTOBUF_NAMESPACE_ID::ListValue* temp = kind_.list_value_; ::PROTOBUF_NAMESPACE_ID::ListValue* temp = kind_.list_value_;
kind_.list_value_ = nullptr; kind_.list_value_ = nullptr;
return temp; return temp;
} else { } else {
return nullptr; return nullptr;
} }
} }
inline void Value::unsafe_arena_set_allocated_list_value(PROTOBUF_NAMESPACE_ID::ListValue* list_value) { inline void Value::unsafe_arena_set_allocated_list_value(::PROTOBUF_NAMESPACE_ID::ListValue* list_value) {
clear_kind(); clear_kind();
if (list_value) { if (list_value) {
set_has_list_value(); set_has_list_value();
@@ -1064,16 +1076,16 @@ inline void Value::unsafe_arena_set_allocated_list_value(PROTOBUF_NAMESPACE_ID::
} }
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.list_value) // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.list_value)
} }
inline PROTOBUF_NAMESPACE_ID::ListValue* Value::_internal_mutable_list_value() { inline ::PROTOBUF_NAMESPACE_ID::ListValue* Value::_internal_mutable_list_value() {
if (!_internal_has_list_value()) { if (!_internal_has_list_value()) {
clear_kind(); clear_kind();
set_has_list_value(); set_has_list_value();
kind_.list_value_ = CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::ListValue >(GetArenaForAllocation()); kind_.list_value_ = CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::ListValue >(GetArenaForAllocation());
} }
return kind_.list_value_; return kind_.list_value_;
} }
inline PROTOBUF_NAMESPACE_ID::ListValue* Value::mutable_list_value() { inline ::PROTOBUF_NAMESPACE_ID::ListValue* Value::mutable_list_value() {
PROTOBUF_NAMESPACE_ID::ListValue* _msg = _internal_mutable_list_value(); ::PROTOBUF_NAMESPACE_ID::ListValue* _msg = _internal_mutable_list_value();
// @@protoc_insertion_point(field_mutable:google.protobuf.Value.list_value) // @@protoc_insertion_point(field_mutable:google.protobuf.Value.list_value)
return _msg; return _msg;
} }
@@ -1101,31 +1113,31 @@ inline int ListValue::values_size() const {
inline void ListValue::clear_values() { inline void ListValue::clear_values() {
values_.Clear(); values_.Clear();
} }
inline PROTOBUF_NAMESPACE_ID::Value* ListValue::mutable_values(int index) { inline ::PROTOBUF_NAMESPACE_ID::Value* ListValue::mutable_values(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.ListValue.values) // @@protoc_insertion_point(field_mutable:google.protobuf.ListValue.values)
return values_.Mutable(index); return values_.Mutable(index);
} }
inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Value >* inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Value >*
ListValue::mutable_values() { ListValue::mutable_values() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.ListValue.values) // @@protoc_insertion_point(field_mutable_list:google.protobuf.ListValue.values)
return &values_; return &values_;
} }
inline const PROTOBUF_NAMESPACE_ID::Value& ListValue::_internal_values(int index) const { inline const ::PROTOBUF_NAMESPACE_ID::Value& ListValue::_internal_values(int index) const {
return values_.Get(index); return values_.Get(index);
} }
inline const PROTOBUF_NAMESPACE_ID::Value& ListValue::values(int index) const { inline const ::PROTOBUF_NAMESPACE_ID::Value& ListValue::values(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.ListValue.values) // @@protoc_insertion_point(field_get:google.protobuf.ListValue.values)
return _internal_values(index); return _internal_values(index);
} }
inline PROTOBUF_NAMESPACE_ID::Value* ListValue::_internal_add_values() { inline ::PROTOBUF_NAMESPACE_ID::Value* ListValue::_internal_add_values() {
return values_.Add(); return values_.Add();
} }
inline PROTOBUF_NAMESPACE_ID::Value* ListValue::add_values() { inline ::PROTOBUF_NAMESPACE_ID::Value* ListValue::add_values() {
PROTOBUF_NAMESPACE_ID::Value* _add = _internal_add_values(); ::PROTOBUF_NAMESPACE_ID::Value* _add = _internal_add_values();
// @@protoc_insertion_point(field_add:google.protobuf.ListValue.values) // @@protoc_insertion_point(field_add:google.protobuf.ListValue.values)
return _add; return _add;
} }
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Value >& inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Value >&
ListValue::values() const { ListValue::values() const {
// @@protoc_insertion_point(field_list:google.protobuf.ListValue.values) // @@protoc_insertion_point(field_list:google.protobuf.ListValue.values)
return values_; return values_;
@@ -1147,10 +1159,10 @@ PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
template <> struct is_proto_enum< PROTOBUF_NAMESPACE_ID::NullValue> : ::std::true_type {}; template <> struct is_proto_enum< ::PROTOBUF_NAMESPACE_ID::NullValue> : ::std::true_type {};
template <> template <>
inline const EnumDescriptor* GetEnumDescriptor< PROTOBUF_NAMESPACE_ID::NullValue>() { inline const EnumDescriptor* GetEnumDescriptor< ::PROTOBUF_NAMESPACE_ID::NullValue>() {
return PROTOBUF_NAMESPACE_ID::NullValue_descriptor(); return ::PROTOBUF_NAMESPACE_ID::NullValue_descriptor();
} }
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE

View File

@@ -82,7 +82,7 @@ namespace internal {
// The current version, represented as a single integer to make comparison // The current version, represented as a single integer to make comparison
// easier: major * 10^6 + minor * 10^3 + micro // easier: major * 10^6 + minor * 10^3 + micro
#define GOOGLE_PROTOBUF_VERSION 3017003 #define GOOGLE_PROTOBUF_VERSION 3018001
// A suffix string for alpha, beta or rc releases. Empty for stable releases. // A suffix string for alpha, beta or rc releases. Empty for stable releases.
#define GOOGLE_PROTOBUF_VERSION_SUFFIX "" #define GOOGLE_PROTOBUF_VERSION_SUFFIX ""
@@ -90,15 +90,15 @@ namespace internal {
// The minimum header version which works with the current version of // The minimum header version which works with the current version of
// the library. This constant should only be used by protoc's C++ code // the library. This constant should only be used by protoc's C++ code
// generator. // generator.
static const int kMinHeaderVersionForLibrary = 3017000; static const int kMinHeaderVersionForLibrary = 3018000;
// The minimum protoc version which works with the current version of the // The minimum protoc version which works with the current version of the
// headers. // headers.
#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3017000 #define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3018000
// The minimum header version which works with the current version of // The minimum header version which works with the current version of
// protoc. This constant should only be used in VerifyVersion(). // protoc. This constant should only be used in VerifyVersion().
static const int kMinHeaderVersionForProtoc = 3017000; static const int kMinHeaderVersionForProtoc = 3018000;
// Verifies that the headers and libraries are compatible. Use the macro // Verifies that the headers and libraries are compatible. Use the macro
// below to call this. // below to call this.
@@ -176,7 +176,7 @@ class FatalException : public std::exception {
: filename_(filename), line_(line), message_(message) {} : filename_(filename), line_(line), message_(message) {}
virtual ~FatalException() throw(); virtual ~FatalException() throw();
virtual const char* what() const throw(); virtual const char* what() const throw() override;
const char* filename() const { return filename_; } const char* filename() const { return filename_; }
int line() const { return line_; } int line() const { return line_; }

View File

@@ -52,10 +52,12 @@
__attribute__((acquire_capability(__VA_ARGS__))) __attribute__((acquire_capability(__VA_ARGS__)))
#define GOOGLE_PROTOBUF_RELEASE(...) \ #define GOOGLE_PROTOBUF_RELEASE(...) \
__attribute__((release_capability(__VA_ARGS__))) __attribute__((release_capability(__VA_ARGS__)))
#define GOOGLE_PROTOBUF_SCOPED_CAPABILITY __attribute__((scoped_lockable))
#define GOOGLE_PROTOBUF_CAPABILITY(x) __attribute__((capability(x))) #define GOOGLE_PROTOBUF_CAPABILITY(x) __attribute__((capability(x)))
#else #else
#define GOOGLE_PROTOBUF_ACQUIRE(...) #define GOOGLE_PROTOBUF_ACQUIRE(...)
#define GOOGLE_PROTOBUF_RELEASE(...) #define GOOGLE_PROTOBUF_RELEASE(...)
#define GOOGLE_PROTOBUF_SCOPED_CAPABILITY
#define GOOGLE_PROTOBUF_CAPABILITY(x) #define GOOGLE_PROTOBUF_CAPABILITY(x)
#endif #endif
@@ -140,10 +142,12 @@ class GOOGLE_PROTOBUF_CAPABILITY("mutex") PROTOBUF_EXPORT WrappedMutex {
using Mutex = WrappedMutex; using Mutex = WrappedMutex;
// MutexLock(mu) acquires mu when constructed and releases it when destroyed. // MutexLock(mu) acquires mu when constructed and releases it when destroyed.
class PROTOBUF_EXPORT MutexLock { class GOOGLE_PROTOBUF_SCOPED_CAPABILITY PROTOBUF_EXPORT MutexLock {
public: public:
explicit MutexLock(Mutex *mu) : mu_(mu) { this->mu_->Lock(); } explicit MutexLock(Mutex *mu) GOOGLE_PROTOBUF_ACQUIRE(mu) : mu_(mu) {
~MutexLock() { this->mu_->Unlock(); } this->mu_->Lock();
}
~MutexLock() GOOGLE_PROTOBUF_RELEASE() { this->mu_->Unlock(); }
private: private:
Mutex *const mu_; Mutex *const mu_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MutexLock); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MutexLock);

View File

@@ -35,6 +35,8 @@
#include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/common.h>
#include <algorithm>
namespace google { namespace google {
namespace protobuf { namespace protobuf {
@@ -48,6 +50,18 @@ inline void STLStringResizeUninitialized(std::string* s, size_t new_size) {
s->resize(new_size); s->resize(new_size);
} }
// As above, but we make sure to follow amortized growth in which we always
// increase the capacity by at least a constant factor >1.
inline void STLStringResizeUninitializedAmortized(std::string* s,
size_t new_size) {
const size_t cap = s->capacity();
if (new_size > cap) {
// Make sure to always grow by at least a factor of 2x.
s->reserve(std::max(new_size, 2 * cap));
}
STLStringResizeUninitialized(s, new_size);
}
// Return a mutable char* pointing to a string's internal buffer, // Return a mutable char* pointing to a string's internal buffer,
// which may not be null-terminated. Writing through this pointer will // which may not be null-terminated. Writing through this pointer will
// modify the string. // modify the string.

View File

@@ -148,6 +148,10 @@
#include <limits> #include <limits>
#include <string> #include <string>
#if defined(__cpp_lib_string_view)
#include <string_view>
#endif
#include <google/protobuf/stubs/hash.h> #include <google/protobuf/stubs/hash.h>
#include <google/protobuf/port_def.inc> #include <google/protobuf/port_def.inc>
@@ -215,6 +219,14 @@ class PROTOBUF_EXPORT StringPiece {
length_ = CheckSize(str.size()); length_ = CheckSize(str.size());
} }
#if defined(__cpp_lib_string_view)
StringPiece( // NOLINT(runtime/explicit)
std::string_view str)
: ptr_(str.data()), length_(0) {
length_ = CheckSize(str.size());
}
#endif
StringPiece(const char* offset, size_type len) StringPiece(const char* offset, size_type len)
: ptr_(offset), length_(CheckSize(len)) {} : ptr_(offset), length_(CheckSize(len)) {}

View File

@@ -126,17 +126,17 @@ class PROTOBUF_EXPORT TextFormat {
FastFieldValuePrinter(); FastFieldValuePrinter();
virtual ~FastFieldValuePrinter(); virtual ~FastFieldValuePrinter();
virtual void PrintBool(bool val, BaseTextGenerator* generator) const; virtual void PrintBool(bool val, BaseTextGenerator* generator) const;
virtual void PrintInt32(int32 val, BaseTextGenerator* generator) const; virtual void PrintInt32(int32_t val, BaseTextGenerator* generator) const;
virtual void PrintUInt32(uint32 val, BaseTextGenerator* generator) const; virtual void PrintUInt32(uint32_t val, BaseTextGenerator* generator) const;
virtual void PrintInt64(int64 val, BaseTextGenerator* generator) const; virtual void PrintInt64(int64_t val, BaseTextGenerator* generator) const;
virtual void PrintUInt64(uint64 val, BaseTextGenerator* generator) const; virtual void PrintUInt64(uint64_t val, BaseTextGenerator* generator) const;
virtual void PrintFloat(float val, BaseTextGenerator* generator) const; virtual void PrintFloat(float val, BaseTextGenerator* generator) const;
virtual void PrintDouble(double val, BaseTextGenerator* generator) const; virtual void PrintDouble(double val, BaseTextGenerator* generator) const;
virtual void PrintString(const std::string& val, virtual void PrintString(const std::string& val,
BaseTextGenerator* generator) const; BaseTextGenerator* generator) const;
virtual void PrintBytes(const std::string& val, virtual void PrintBytes(const std::string& val,
BaseTextGenerator* generator) const; BaseTextGenerator* generator) const;
virtual void PrintEnum(int32 val, const std::string& name, virtual void PrintEnum(int32_t val, const std::string& name,
BaseTextGenerator* generator) const; BaseTextGenerator* generator) const;
virtual void PrintFieldName(const Message& message, int field_index, virtual void PrintFieldName(const Message& message, int field_index,
int field_count, const Reflection* reflection, int field_count, const Reflection* reflection,
@@ -171,15 +171,15 @@ class PROTOBUF_EXPORT TextFormat {
FieldValuePrinter(); FieldValuePrinter();
virtual ~FieldValuePrinter(); virtual ~FieldValuePrinter();
virtual std::string PrintBool(bool val) const; virtual std::string PrintBool(bool val) const;
virtual std::string PrintInt32(int32 val) const; virtual std::string PrintInt32(int32_t val) const;
virtual std::string PrintUInt32(uint32 val) const; virtual std::string PrintUInt32(uint32_t val) const;
virtual std::string PrintInt64(int64 val) const; virtual std::string PrintInt64(int64_t val) const;
virtual std::string PrintUInt64(uint64 val) const; virtual std::string PrintUInt64(uint64_t val) const;
virtual std::string PrintFloat(float val) const; virtual std::string PrintFloat(float val) const;
virtual std::string PrintDouble(double val) const; virtual std::string PrintDouble(double val) const;
virtual std::string PrintString(const std::string& val) const; virtual std::string PrintString(const std::string& val) const;
virtual std::string PrintBytes(const std::string& val) const; virtual std::string PrintBytes(const std::string& val) const;
virtual std::string PrintEnum(int32 val, const std::string& name) const; virtual std::string PrintEnum(int32_t val, const std::string& name) const;
virtual std::string PrintFieldName(const Message& message, virtual std::string PrintFieldName(const Message& message,
const Reflection* reflection, const Reflection* reflection,
const FieldDescriptor* field) const; const FieldDescriptor* field) const;
@@ -341,7 +341,7 @@ class PROTOBUF_EXPORT TextFormat {
// property of TextFormat::Printer. That is, from the printed message, we // property of TextFormat::Printer. That is, from the printed message, we
// cannot fully recover the original string field any more. // cannot fully recover the original string field any more.
void SetTruncateStringFieldLongerThan( void SetTruncateStringFieldLongerThan(
const int64 truncate_string_field_longer_than) { const int64_t truncate_string_field_longer_than) {
truncate_string_field_longer_than_ = truncate_string_field_longer_than; truncate_string_field_longer_than_ = truncate_string_field_longer_than;
} }
@@ -431,7 +431,7 @@ class PROTOBUF_EXPORT TextFormat {
bool hide_unknown_fields_; bool hide_unknown_fields_;
bool print_message_fields_in_index_order_; bool print_message_fields_in_index_order_;
bool expand_any_; bool expand_any_;
int64 truncate_string_field_longer_than_; int64_t truncate_string_field_longer_than_;
std::unique_ptr<const FastFieldValuePrinter> default_field_value_printer_; std::unique_ptr<const FastFieldValuePrinter> default_field_value_printer_;
typedef std::map<const FieldDescriptor*, typedef std::map<const FieldDescriptor*,
@@ -488,6 +488,16 @@ class PROTOBUF_EXPORT TextFormat {
: line(line_param), column(column_param) {} : line(line_param), column(column_param) {}
}; };
// A range of locations in the parsed text, including `start` and excluding
// `end`.
struct ParseLocationRange {
ParseLocation start;
ParseLocation end;
ParseLocationRange() : start(), end() {}
ParseLocationRange(ParseLocation start_param, ParseLocation end_param)
: start(start_param), end(end_param) {}
};
// Data structure which is populated with the locations of each field // Data structure which is populated with the locations of each field
// value parsed from the text. // value parsed from the text.
class PROTOBUF_EXPORT ParseInfoTree { class PROTOBUF_EXPORT ParseInfoTree {
@@ -496,10 +506,18 @@ class PROTOBUF_EXPORT TextFormat {
ParseInfoTree(const ParseInfoTree&) = delete; ParseInfoTree(const ParseInfoTree&) = delete;
ParseInfoTree& operator=(const ParseInfoTree&) = delete; ParseInfoTree& operator=(const ParseInfoTree&) = delete;
// Returns the parse location for index-th value of the field in the parsed // Returns the parse location range for index-th value of the field in
// text. If none exists, returns a location with line = -1. Index should be // the parsed text. If none exists, returns a location with start and end
// -1 for not-repeated fields. // line -1. Index should be -1 for not-repeated fields.
ParseLocation GetLocation(const FieldDescriptor* field, int index) const; ParseLocationRange GetLocationRange(const FieldDescriptor* field,
int index) const;
// Returns the starting parse location for index-th value of the field in
// the parsed text. If none exists, returns a location with line = -1. Index
// should be -1 for not-repeated fields.
ParseLocation GetLocation(const FieldDescriptor* field, int index) const {
return GetLocationRange(field, index).start;
}
// Returns the parse info tree for the given field, which must be a message // Returns the parse info tree for the given field, which must be a message
// type. The nested information tree is owned by the root tree and will be // type. The nested information tree is owned by the root tree and will be
@@ -511,14 +529,14 @@ class PROTOBUF_EXPORT TextFormat {
// Allow the text format parser to record information into the tree. // Allow the text format parser to record information into the tree.
friend class TextFormat; friend class TextFormat;
// Records the starting location of a single value for a field. // Records the starting and ending locations of a single value for a field.
void RecordLocation(const FieldDescriptor* field, ParseLocation location); void RecordLocation(const FieldDescriptor* field, ParseLocationRange range);
// Create and records a nested tree for a nested message field. // Create and records a nested tree for a nested message field.
ParseInfoTree* CreateNested(const FieldDescriptor* field); ParseInfoTree* CreateNested(const FieldDescriptor* field);
// Defines the map from the index-th field descriptor to its parse location. // Defines the map from the index-th field descriptor to its parse location.
typedef std::map<const FieldDescriptor*, std::vector<ParseLocation> > typedef std::map<const FieldDescriptor*, std::vector<ParseLocationRange>>
LocationMap; LocationMap;
// Defines the map from the index-th field descriptor to the nested parse // Defines the map from the index-th field descriptor to the nested parse
@@ -635,7 +653,7 @@ class PROTOBUF_EXPORT TextFormat {
// helpers for ParserImpl to call methods of ParseInfoTree. // helpers for ParserImpl to call methods of ParseInfoTree.
static inline void RecordLocation(ParseInfoTree* info_tree, static inline void RecordLocation(ParseInfoTree* info_tree,
const FieldDescriptor* field, const FieldDescriptor* field,
ParseLocation location); ParseLocationRange location);
static inline ParseInfoTree* CreateNested(ParseInfoTree* info_tree, static inline ParseInfoTree* CreateNested(ParseInfoTree* info_tree,
const FieldDescriptor* field); const FieldDescriptor* field);
@@ -644,7 +662,7 @@ class PROTOBUF_EXPORT TextFormat {
inline void TextFormat::RecordLocation(ParseInfoTree* info_tree, inline void TextFormat::RecordLocation(ParseInfoTree* info_tree,
const FieldDescriptor* field, const FieldDescriptor* field,
ParseLocation location) { ParseLocationRange location) {
info_tree->RecordLocation(field, location); info_tree->RecordLocation(field, location);
} }

View File

@@ -8,12 +8,12 @@
#include <string> #include <string>
#include <google/protobuf/port_def.inc> #include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3017000 #if PROTOBUF_VERSION < 3018000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #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 This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.
@@ -59,7 +59,7 @@ struct TimestampDefaultTypeInternal;
PROTOBUF_EXPORT extern TimestampDefaultTypeInternal _Timestamp_default_instance_; PROTOBUF_EXPORT extern TimestampDefaultTypeInternal _Timestamp_default_instance_;
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Timestamp* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Timestamp>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Timestamp* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Timestamp>(Arena*);
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
@@ -84,7 +84,11 @@ class PROTOBUF_EXPORT Timestamp final :
} }
inline Timestamp& operator=(Timestamp&& from) noexcept { inline Timestamp& operator=(Timestamp&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -142,7 +146,7 @@ class PROTOBUF_EXPORT Timestamp final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const Timestamp& from); void MergeFrom(const Timestamp& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;

File diff suppressed because it is too large Load Diff

View File

@@ -136,9 +136,9 @@ class PROTOBUF_EXPORT UnknownFieldSet {
// Adding fields --------------------------------------------------- // Adding fields ---------------------------------------------------
void AddVarint(int number, uint64 value); void AddVarint(int number, uint64_t value);
void AddFixed32(int number, uint32 value); void AddFixed32(int number, uint32_t value);
void AddFixed64(int number, uint64 value); void AddFixed64(int number, uint64_t value);
void AddLengthDelimited(int number, const std::string& value); void AddLengthDelimited(int number, const std::string& value);
std::string* AddLengthDelimited(int number); std::string* AddLengthDelimited(int number);
UnknownFieldSet* AddGroup(int number); UnknownFieldSet* AddGroup(int number);
@@ -209,10 +209,10 @@ class PROTOBUF_EXPORT UnknownFieldSet {
namespace internal { namespace internal {
inline void WriteVarint(uint32 num, uint64 val, UnknownFieldSet* unknown) { inline void WriteVarint(uint32_t num, uint64_t val, UnknownFieldSet* unknown) {
unknown->AddVarint(num, val); unknown->AddVarint(num, val);
} }
inline void WriteLengthDelimited(uint32 num, StringPiece val, inline void WriteLengthDelimited(uint32_t num, StringPiece val,
UnknownFieldSet* unknown) { UnknownFieldSet* unknown) {
unknown->AddLengthDelimited(num)->assign(val.data(), val.size()); unknown->AddLengthDelimited(num)->assign(val.data(), val.size());
} }
@@ -221,7 +221,7 @@ PROTOBUF_EXPORT
const char* UnknownGroupParse(UnknownFieldSet* unknown, const char* ptr, const char* UnknownGroupParse(UnknownFieldSet* unknown, const char* ptr,
ParseContext* ctx); ParseContext* ctx);
PROTOBUF_EXPORT PROTOBUF_EXPORT
const char* UnknownFieldParse(uint64 tag, UnknownFieldSet* unknown, const char* UnknownFieldParse(uint64_t tag, UnknownFieldSet* unknown,
const char* ptr, ParseContext* ctx); const char* ptr, ParseContext* ctx);
} // namespace internal } // namespace internal
@@ -246,15 +246,15 @@ class PROTOBUF_EXPORT UnknownField {
// Accessors ------------------------------------------------------- // Accessors -------------------------------------------------------
// Each method works only for UnknownFields of the corresponding type. // Each method works only for UnknownFields of the corresponding type.
inline uint64 varint() const; inline uint64_t varint() const;
inline uint32 fixed32() const; inline uint32_t fixed32() const;
inline uint64 fixed64() const; inline uint64_t fixed64() const;
inline const std::string& length_delimited() const; inline const std::string& length_delimited() const;
inline const UnknownFieldSet& group() const; inline const UnknownFieldSet& group() const;
inline void set_varint(uint64 value); inline void set_varint(uint64_t value);
inline void set_fixed32(uint32 value); inline void set_fixed32(uint32_t value);
inline void set_fixed64(uint64 value); inline void set_fixed64(uint64_t value);
inline void set_length_delimited(const std::string& value); inline void set_length_delimited(const std::string& value);
inline std::string* mutable_length_delimited(); inline std::string* mutable_length_delimited();
inline UnknownFieldSet* mutable_group(); inline UnknownFieldSet* mutable_group();
@@ -269,8 +269,8 @@ class PROTOBUF_EXPORT UnknownField {
} }
inline size_t GetLengthDelimitedSize() const; inline size_t GetLengthDelimitedSize() const;
uint8* InternalSerializeLengthDelimitedNoTag( uint8_t* InternalSerializeLengthDelimitedNoTag(
uint8* target, io::EpsCopyOutputStream* stream) const; uint8_t* target, io::EpsCopyOutputStream* stream) const;
// If this UnknownField contains a pointer, delete it. // If this UnknownField contains a pointer, delete it.
@@ -287,12 +287,12 @@ class PROTOBUF_EXPORT UnknownField {
std::string* string_value; std::string* string_value;
}; };
uint32 number_; uint32_t number_;
uint32 type_; uint32_t type_;
union { union {
uint64 varint_; uint64_t varint_;
uint32 fixed32_; uint32_t fixed32_;
uint64 fixed64_; uint64_t fixed64_;
mutable union LengthDelimited length_delimited_; mutable union LengthDelimited length_delimited_;
UnknownFieldSet* group_; UnknownFieldSet* group_;
} data_; } data_;
@@ -342,15 +342,15 @@ inline UnknownField::Type UnknownField::type() const {
return static_cast<Type>(type_); return static_cast<Type>(type_);
} }
inline uint64 UnknownField::varint() const { inline uint64_t UnknownField::varint() const {
assert(type() == TYPE_VARINT); assert(type() == TYPE_VARINT);
return data_.varint_; return data_.varint_;
} }
inline uint32 UnknownField::fixed32() const { inline uint32_t UnknownField::fixed32() const {
assert(type() == TYPE_FIXED32); assert(type() == TYPE_FIXED32);
return data_.fixed32_; return data_.fixed32_;
} }
inline uint64 UnknownField::fixed64() const { inline uint64_t UnknownField::fixed64() const {
assert(type() == TYPE_FIXED64); assert(type() == TYPE_FIXED64);
return data_.fixed64_; return data_.fixed64_;
} }
@@ -363,15 +363,15 @@ inline const UnknownFieldSet& UnknownField::group() const {
return *data_.group_; return *data_.group_;
} }
inline void UnknownField::set_varint(uint64 value) { inline void UnknownField::set_varint(uint64_t value) {
assert(type() == TYPE_VARINT); assert(type() == TYPE_VARINT);
data_.varint_ = value; data_.varint_ = value;
} }
inline void UnknownField::set_fixed32(uint32 value) { inline void UnknownField::set_fixed32(uint32_t value) {
assert(type() == TYPE_FIXED32); assert(type() == TYPE_FIXED32);
data_.fixed32_ = value; data_.fixed32_ = value;
} }
inline void UnknownField::set_fixed64(uint64 value) { inline void UnknownField::set_fixed64(uint64_t value) {
assert(type() == TYPE_FIXED64); assert(type() == TYPE_FIXED64);
data_.fixed64_ = value; data_.fixed64_ = value;
} }

View File

@@ -194,6 +194,10 @@ class PROTOBUF_EXPORT MessageDifferencer {
// has not moved, "new_index" will have the same value as "index". // has not moved, "new_index" will have the same value as "index".
int new_index = -1; int new_index = -1;
// If "field" is a map field, point to the map entry.
const Message* map_entry1 = nullptr;
const Message* map_entry2 = nullptr;
// For unknown fields, these are the pointers to the UnknownFieldSet // For unknown fields, these are the pointers to the UnknownFieldSet
// containing the unknown fields. In certain cases (e.g. proto1's // containing the unknown fields. In certain cases (e.g. proto1's
// MessageSet, or nested groups of unknown fields), these may differ from // MessageSet, or nested groups of unknown fields), these may differ from
@@ -695,12 +699,10 @@ class PROTOBUF_EXPORT MessageDifferencer {
// Just print a string // Just print a string
void Print(const std::string& str); void Print(const std::string& str);
// helper function for PrintPath that contains logic for printing maps
void PrintMapKey(const std::vector<SpecificField>& field_path,
bool left_side, const SpecificField& specific_field,
size_t target_field_index);
private: private:
// helper function for PrintPath that contains logic for printing maps
void PrintMapKey(bool left_side, const SpecificField& specific_field);
io::Printer* printer_; io::Printer* printer_;
bool delete_printer_; bool delete_printer_;
bool report_modified_aggregates_; bool report_modified_aggregates_;

View File

@@ -132,7 +132,7 @@ class PROTOBUF_EXPORT WireFormat {
"originally expected. Perhaps it was modified by another thread " "originally expected. Perhaps it was modified by another thread "
"during serialization?"; "during serialization?";
} }
static uint8* _InternalSerialize(const Message& message, uint8* target, static uint8_t* _InternalSerialize(const Message& message, uint8_t* target,
io::EpsCopyOutputStream* stream); io::EpsCopyOutputStream* stream);
// Implements Message::ByteSize() via reflection. WARNING: The result // Implements Message::ByteSize() via reflection. WARNING: The result
@@ -148,7 +148,7 @@ class PROTOBUF_EXPORT WireFormat {
// Skips a field value of the given WireType. The input should start // Skips a field value of the given WireType. The input should start
// positioned immediately after the tag. If unknown_fields is non-NULL, // positioned immediately after the tag. If unknown_fields is non-NULL,
// the contents of the field will be added to it. // the contents of the field will be added to it.
static bool SkipField(io::CodedInputStream* input, uint32 tag, static bool SkipField(io::CodedInputStream* input, uint32_t tag,
UnknownFieldSet* unknown_fields); UnknownFieldSet* unknown_fields);
// Reads and ignores a message from the input. If unknown_fields is // Reads and ignores a message from the input. If unknown_fields is
@@ -160,7 +160,7 @@ class PROTOBUF_EXPORT WireFormat {
// for which is_valid(value) returns false are appended to // for which is_valid(value) returns false are appended to
// unknown_fields_stream. // unknown_fields_stream.
static bool ReadPackedEnumPreserveUnknowns(io::CodedInputStream* input, static bool ReadPackedEnumPreserveUnknowns(io::CodedInputStream* input,
uint32 field_number, uint32_t field_number,
bool (*is_valid)(int), bool (*is_valid)(int),
UnknownFieldSet* unknown_fields, UnknownFieldSet* unknown_fields,
RepeatedField<int>* values); RepeatedField<int>* values);
@@ -176,16 +176,16 @@ class PROTOBUF_EXPORT WireFormat {
// ComputeUnknownFieldsSize(unknown_fields). // ComputeUnknownFieldsSize(unknown_fields).
// //
// Returns a pointer past the last written byte. // Returns a pointer past the last written byte.
static uint8* SerializeUnknownFieldsToArray( static uint8_t* SerializeUnknownFieldsToArray(
const UnknownFieldSet& unknown_fields, uint8* target) { const UnknownFieldSet& unknown_fields, uint8_t* target) {
io::EpsCopyOutputStream stream( io::EpsCopyOutputStream stream(
target, static_cast<int>(ComputeUnknownFieldsSize(unknown_fields)), target, static_cast<int>(ComputeUnknownFieldsSize(unknown_fields)),
io::CodedOutputStream::IsDefaultSerializationDeterministic()); io::CodedOutputStream::IsDefaultSerializationDeterministic());
return InternalSerializeUnknownFieldsToArray(unknown_fields, target, return InternalSerializeUnknownFieldsToArray(unknown_fields, target,
&stream); &stream);
} }
static uint8* InternalSerializeUnknownFieldsToArray( static uint8_t* InternalSerializeUnknownFieldsToArray(
const UnknownFieldSet& unknown_fields, uint8* target, const UnknownFieldSet& unknown_fields, uint8_t* target,
io::EpsCopyOutputStream* stream); io::EpsCopyOutputStream* stream);
// Same thing except for messages that have the message_set_wire_format // Same thing except for messages that have the message_set_wire_format
@@ -200,10 +200,10 @@ class PROTOBUF_EXPORT WireFormat {
// ComputeUnknownMessageSetItemsSize(unknown_fields). // ComputeUnknownMessageSetItemsSize(unknown_fields).
// //
// Returns a pointer past the last written byte. // Returns a pointer past the last written byte.
static uint8* SerializeUnknownMessageSetItemsToArray( static uint8_t* SerializeUnknownMessageSetItemsToArray(
const UnknownFieldSet& unknown_fields, uint8* target); const UnknownFieldSet& unknown_fields, uint8_t* target);
static uint8* InternalSerializeUnknownMessageSetItemsToArray( static uint8_t* InternalSerializeUnknownMessageSetItemsToArray(
const UnknownFieldSet& unknown_fields, uint8* target, const UnknownFieldSet& unknown_fields, uint8_t* target,
io::EpsCopyOutputStream* stream); io::EpsCopyOutputStream* stream);
// Compute the size of the UnknownFieldSet on the wire. // Compute the size of the UnknownFieldSet on the wire.
@@ -219,12 +219,12 @@ class PROTOBUF_EXPORT WireFormat {
// //
// This is different from MakeTag(field->number(), field->type()) in the // This is different from MakeTag(field->number(), field->type()) in the
// case of packed repeated fields. // case of packed repeated fields.
static uint32 MakeTag(const FieldDescriptor* field); static uint32_t MakeTag(const FieldDescriptor* field);
// Parse a single field. The input should start out positioned immediately // Parse a single field. The input should start out positioned immediately
// after the tag. // after the tag.
static bool ParseAndMergeField( static bool ParseAndMergeField(
uint32 tag, uint32_t tag,
const FieldDescriptor* field, // May be NULL for unknown const FieldDescriptor* field, // May be NULL for unknown
Message* message, io::CodedInputStream* input); Message* message, io::CodedInputStream* input);
@@ -235,9 +235,9 @@ class PROTOBUF_EXPORT WireFormat {
output->SetCur(InternalSerializeField(field, message, output->Cur(), output->SetCur(InternalSerializeField(field, message, output->Cur(),
output->EpsCopy())); output->EpsCopy()));
} }
static uint8* InternalSerializeField( static uint8_t* InternalSerializeField(
const FieldDescriptor* field, // Cannot be NULL const FieldDescriptor* field, // Cannot be NULL
const Message& message, uint8* target, io::EpsCopyOutputStream* stream); const Message& message, uint8_t* target, io::EpsCopyOutputStream* stream);
// Compute size of a single field. If the field is a message type, this // Compute size of a single field. If the field is a message type, this
// will call ByteSize() for the embedded message, insuring that it caches // will call ByteSize() for the embedded message, insuring that it caches
@@ -255,8 +255,8 @@ class PROTOBUF_EXPORT WireFormat {
output->SetCur(InternalSerializeMessageSetItem( output->SetCur(InternalSerializeMessageSetItem(
field, message, output->Cur(), output->EpsCopy())); field, message, output->Cur(), output->EpsCopy()));
} }
static uint8* InternalSerializeMessageSetItem( static uint8_t* InternalSerializeMessageSetItem(
const FieldDescriptor* field, const Message& message, uint8* target, const FieldDescriptor* field, const Message& message, uint8_t* target,
io::EpsCopyOutputStream* stream); io::EpsCopyOutputStream* stream);
static size_t MessageSetItemByteSize(const FieldDescriptor* field, static size_t MessageSetItemByteSize(const FieldDescriptor* field,
const Message& message); const Message& message);
@@ -287,18 +287,18 @@ class PROTOBUF_EXPORT WireFormat {
struct MessageSetParser; struct MessageSetParser;
// Skip a MessageSet field. // Skip a MessageSet field.
static bool SkipMessageSetField(io::CodedInputStream* input, static bool SkipMessageSetField(io::CodedInputStream* input,
uint32 field_number, uint32_t field_number,
UnknownFieldSet* unknown_fields); UnknownFieldSet* unknown_fields);
// Parse a MessageSet field. // Parse a MessageSet field.
static bool ParseAndMergeMessageSetField(uint32 field_number, static bool ParseAndMergeMessageSetField(uint32_t field_number,
const FieldDescriptor* field, const FieldDescriptor* field,
Message* message, Message* message,
io::CodedInputStream* input); io::CodedInputStream* input);
// Parses the value from the wire that belongs to tag. // Parses the value from the wire that belongs to tag.
static const char* _InternalParseAndMergeField(Message* msg, const char* ptr, static const char* _InternalParseAndMergeField(Message* msg, const char* ptr,
internal::ParseContext* ctx, internal::ParseContext* ctx,
uint64 tag, uint64_t tag,
const Reflection* reflection, const Reflection* reflection,
const FieldDescriptor* field); const FieldDescriptor* field);
@@ -313,7 +313,7 @@ class PROTOBUF_EXPORT UnknownFieldSetFieldSkipper : public FieldSkipper {
~UnknownFieldSetFieldSkipper() override {} ~UnknownFieldSetFieldSkipper() override {}
// implements FieldSkipper ----------------------------------------- // implements FieldSkipper -----------------------------------------
bool SkipField(io::CodedInputStream* input, uint32 tag) override; bool SkipField(io::CodedInputStream* input, uint32_t tag) override;
bool SkipMessage(io::CodedInputStream* input) override; bool SkipMessage(io::CodedInputStream* input) override;
void SkipUnknownEnum(int field_number, int value) override; void SkipUnknownEnum(int field_number, int value) override;
@@ -340,7 +340,7 @@ inline WireFormatLite::WireType WireFormat::WireTypeForFieldType(
static_cast<WireFormatLite::FieldType>(implicit_cast<int>(type))); static_cast<WireFormatLite::FieldType>(implicit_cast<int>(type)));
} }
inline uint32 WireFormat::MakeTag(const FieldDescriptor* field) { inline uint32_t WireFormat::MakeTag(const FieldDescriptor* field) {
return WireFormatLite::MakeTag(field->number(), WireTypeForField(field)); return WireFormatLite::MakeTag(field->number(), WireTypeForField(field));
} }
@@ -382,8 +382,8 @@ inline void WireFormat::VerifyUTF8StringNamedField(const char* data, int size,
} }
inline uint8* InternalSerializeUnknownMessageSetItemsToArray( inline uint8_t* InternalSerializeUnknownMessageSetItemsToArray(
const UnknownFieldSet& unknown_fields, uint8* target, const UnknownFieldSet& unknown_fields, uint8_t* target,
io::EpsCopyOutputStream* stream) { io::EpsCopyOutputStream* stream) {
return WireFormat::InternalSerializeUnknownMessageSetItemsToArray( return WireFormat::InternalSerializeUnknownMessageSetItemsToArray(
unknown_fields, target, stream); unknown_fields, target, stream);
@@ -402,8 +402,8 @@ size_t ComputeUnknownFieldsSize(const InternalMetadata& metadata, size_t size,
size_t MapKeyDataOnlyByteSize(const FieldDescriptor* field, size_t MapKeyDataOnlyByteSize(const FieldDescriptor* field,
const MapKey& value); const MapKey& value);
uint8* SerializeMapKeyWithCachedSizes(const FieldDescriptor* field, uint8_t* SerializeMapKeyWithCachedSizes(const FieldDescriptor* field,
const MapKey& value, uint8* target, const MapKey& value, uint8_t* target,
io::EpsCopyOutputStream* stream); io::EpsCopyOutputStream* stream);
} // namespace internal } // namespace internal
} // namespace protobuf } // namespace protobuf

File diff suppressed because it is too large Load Diff

View File

@@ -8,12 +8,12 @@
#include <string> #include <string>
#include <google/protobuf/port_def.inc> #include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3017000 #if PROTOBUF_VERSION < 3018000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #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 This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.
@@ -83,15 +83,15 @@ struct UInt64ValueDefaultTypeInternal;
PROTOBUF_EXPORT extern UInt64ValueDefaultTypeInternal _UInt64Value_default_instance_; PROTOBUF_EXPORT extern UInt64ValueDefaultTypeInternal _UInt64Value_default_instance_;
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::BoolValue* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::BoolValue>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::BoolValue* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::BoolValue>(Arena*);
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::BytesValue* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::BytesValue>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::BytesValue* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::BytesValue>(Arena*);
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::DoubleValue* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::DoubleValue>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::DoubleValue* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::DoubleValue>(Arena*);
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::FloatValue* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::FloatValue>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::FloatValue* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::FloatValue>(Arena*);
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Int32Value* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Int32Value>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Int32Value* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Int32Value>(Arena*);
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Int64Value* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Int64Value>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Int64Value* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Int64Value>(Arena*);
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::StringValue* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::StringValue>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::StringValue* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::StringValue>(Arena*);
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::UInt32Value* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::UInt32Value>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::UInt32Value* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::UInt32Value>(Arena*);
template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::UInt64Value* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::UInt64Value>(Arena*); template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::UInt64Value* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::UInt64Value>(Arena*);
PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN PROTOBUF_NAMESPACE_OPEN
@@ -116,7 +116,11 @@ class PROTOBUF_EXPORT DoubleValue final :
} }
inline DoubleValue& operator=(DoubleValue&& from) noexcept { inline DoubleValue& operator=(DoubleValue&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -174,7 +178,7 @@ class PROTOBUF_EXPORT DoubleValue final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const DoubleValue& from); void MergeFrom(const DoubleValue& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;
@@ -255,7 +259,11 @@ class PROTOBUF_EXPORT FloatValue final :
} }
inline FloatValue& operator=(FloatValue&& from) noexcept { inline FloatValue& operator=(FloatValue&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -313,7 +321,7 @@ class PROTOBUF_EXPORT FloatValue final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const FloatValue& from); void MergeFrom(const FloatValue& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;
@@ -394,7 +402,11 @@ class PROTOBUF_EXPORT Int64Value final :
} }
inline Int64Value& operator=(Int64Value&& from) noexcept { inline Int64Value& operator=(Int64Value&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -452,7 +464,7 @@ class PROTOBUF_EXPORT Int64Value final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const Int64Value& from); void MergeFrom(const Int64Value& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;
@@ -533,7 +545,11 @@ class PROTOBUF_EXPORT UInt64Value final :
} }
inline UInt64Value& operator=(UInt64Value&& from) noexcept { inline UInt64Value& operator=(UInt64Value&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -591,7 +607,7 @@ class PROTOBUF_EXPORT UInt64Value final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const UInt64Value& from); void MergeFrom(const UInt64Value& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;
@@ -672,7 +688,11 @@ class PROTOBUF_EXPORT Int32Value final :
} }
inline Int32Value& operator=(Int32Value&& from) noexcept { inline Int32Value& operator=(Int32Value&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -730,7 +750,7 @@ class PROTOBUF_EXPORT Int32Value final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const Int32Value& from); void MergeFrom(const Int32Value& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;
@@ -811,7 +831,11 @@ class PROTOBUF_EXPORT UInt32Value final :
} }
inline UInt32Value& operator=(UInt32Value&& from) noexcept { inline UInt32Value& operator=(UInt32Value&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -869,7 +893,7 @@ class PROTOBUF_EXPORT UInt32Value final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const UInt32Value& from); void MergeFrom(const UInt32Value& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;
@@ -950,7 +974,11 @@ class PROTOBUF_EXPORT BoolValue final :
} }
inline BoolValue& operator=(BoolValue&& from) noexcept { inline BoolValue& operator=(BoolValue&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -1008,7 +1036,7 @@ class PROTOBUF_EXPORT BoolValue final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const BoolValue& from); void MergeFrom(const BoolValue& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;
@@ -1089,7 +1117,11 @@ class PROTOBUF_EXPORT StringValue final :
} }
inline StringValue& operator=(StringValue&& from) noexcept { inline StringValue& operator=(StringValue&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -1147,7 +1179,7 @@ class PROTOBUF_EXPORT StringValue final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const StringValue& from); void MergeFrom(const StringValue& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;
@@ -1233,7 +1265,11 @@ class PROTOBUF_EXPORT BytesValue final :
} }
inline BytesValue& operator=(BytesValue&& from) noexcept { inline BytesValue& operator=(BytesValue&& from) noexcept {
if (this == &from) return *this; 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); InternalSwap(&from);
} else { } else {
CopyFrom(from); CopyFrom(from);
@@ -1291,7 +1327,7 @@ class PROTOBUF_EXPORT BytesValue final :
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom(const BytesValue& from); void MergeFrom(const BytesValue& from);
private: 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: public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final; bool IsInitialized() const final;

Binary file not shown.

Binary file not shown.