1 // Generated by the protocol buffer compiler.  DO NOT EDIT!
2 // source: protos/perfetto/trace/extension_descriptor.proto
3 
4 #include "protos/perfetto/trace/extension_descriptor.pb.h"
5 
6 #include <algorithm>
7 #include <cstdint>
8 
9 #include <google/protobuf/io/coded_stream.h>
10 #include <google/protobuf/extension_set.h>
11 #include <google/protobuf/wire_format_lite.h>
12 #include <google/protobuf/io/zero_copy_stream_impl_lite.h>
13 // @@protoc_insertion_point(includes)
14 #include <google/protobuf/port_def.inc>
15 
16 PROTOBUF_PRAGMA_INIT_SEG
17 
18 namespace _pb = ::PROTOBUF_NAMESPACE_ID;
19 namespace _pbi = _pb::internal;
20 
21 namespace perfetto {
22 namespace protos {
ExtensionDescriptor(::_pbi::ConstantInitialized)23 PROTOBUF_CONSTEXPR ExtensionDescriptor::ExtensionDescriptor(
24     ::_pbi::ConstantInitialized): _impl_{
25     /*decltype(_impl_._has_bits_)*/{}
26   , /*decltype(_impl_._cached_size_)*/{}
27   , /*decltype(_impl_.extension_set_)*/nullptr} {}
28 struct ExtensionDescriptorDefaultTypeInternal {
ExtensionDescriptorDefaultTypeInternalperfetto::protos::ExtensionDescriptorDefaultTypeInternal29   PROTOBUF_CONSTEXPR ExtensionDescriptorDefaultTypeInternal()
30       : _instance(::_pbi::ConstantInitialized{}) {}
~ExtensionDescriptorDefaultTypeInternalperfetto::protos::ExtensionDescriptorDefaultTypeInternal31   ~ExtensionDescriptorDefaultTypeInternal() {}
32   union {  // NOLINT(misc-non-private-member-variables-in-classes)
33     ExtensionDescriptor _instance;
34   };
35 };
36 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ExtensionDescriptorDefaultTypeInternal _ExtensionDescriptor_default_instance_;
37 }  // namespace protos
38 }  // namespace perfetto
39 namespace perfetto {
40 namespace protos {
41 
42 // ===================================================================
43 
44 class ExtensionDescriptor::_Internal {
45  public:
46   using HasBits = decltype(std::declval<ExtensionDescriptor>()._impl_._has_bits_);
47   static const ::perfetto::protos::FileDescriptorSet& extension_set(const ExtensionDescriptor* msg);
set_has_extension_set(HasBits * has_bits)48   static void set_has_extension_set(HasBits* has_bits) {
49     (*has_bits)[0] |= 1u;
50   }
51 };
52 
53 const ::perfetto::protos::FileDescriptorSet&
extension_set(const ExtensionDescriptor * msg)54 ExtensionDescriptor::_Internal::extension_set(const ExtensionDescriptor* msg) {
55   return *msg->_impl_.extension_set_;
56 }
clear_extension_set()57 void ExtensionDescriptor::clear_extension_set() {
58   if (_impl_.extension_set_ != nullptr) _impl_.extension_set_->Clear();
59   _impl_._has_bits_[0] &= ~0x00000001u;
60 }
ExtensionDescriptor(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)61 ExtensionDescriptor::ExtensionDescriptor(::PROTOBUF_NAMESPACE_ID::Arena* arena,
62                          bool is_message_owned)
63   : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
64   SharedCtor(arena, is_message_owned);
65   // @@protoc_insertion_point(arena_constructor:perfetto.protos.ExtensionDescriptor)
66 }
ExtensionDescriptor(const ExtensionDescriptor & from)67 ExtensionDescriptor::ExtensionDescriptor(const ExtensionDescriptor& from)
68   : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
69   ExtensionDescriptor* const _this = this; (void)_this;
70   new (&_impl_) Impl_{
71       decltype(_impl_._has_bits_){from._impl_._has_bits_}
72     , /*decltype(_impl_._cached_size_)*/{}
73     , decltype(_impl_.extension_set_){nullptr}};
74 
75   _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
76   if (from._internal_has_extension_set()) {
77     _this->_impl_.extension_set_ = new ::perfetto::protos::FileDescriptorSet(*from._impl_.extension_set_);
78   }
79   // @@protoc_insertion_point(copy_constructor:perfetto.protos.ExtensionDescriptor)
80 }
81 
SharedCtor(::_pb::Arena * arena,bool is_message_owned)82 inline void ExtensionDescriptor::SharedCtor(
83     ::_pb::Arena* arena, bool is_message_owned) {
84   (void)arena;
85   (void)is_message_owned;
86   new (&_impl_) Impl_{
87       decltype(_impl_._has_bits_){}
88     , /*decltype(_impl_._cached_size_)*/{}
89     , decltype(_impl_.extension_set_){nullptr}
90   };
91 }
92 
~ExtensionDescriptor()93 ExtensionDescriptor::~ExtensionDescriptor() {
94   // @@protoc_insertion_point(destructor:perfetto.protos.ExtensionDescriptor)
95   if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
96   (void)arena;
97     return;
98   }
99   SharedDtor();
100 }
101 
SharedDtor()102 inline void ExtensionDescriptor::SharedDtor() {
103   GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
104   if (this != internal_default_instance()) delete _impl_.extension_set_;
105 }
106 
SetCachedSize(int size) const107 void ExtensionDescriptor::SetCachedSize(int size) const {
108   _impl_._cached_size_.Set(size);
109 }
110 
Clear()111 void ExtensionDescriptor::Clear() {
112 // @@protoc_insertion_point(message_clear_start:perfetto.protos.ExtensionDescriptor)
113   ::uint32_t cached_has_bits = 0;
114   // Prevent compiler warnings about cached_has_bits being unused
115   (void) cached_has_bits;
116 
117   cached_has_bits = _impl_._has_bits_[0];
118   if (cached_has_bits & 0x00000001u) {
119     GOOGLE_DCHECK(_impl_.extension_set_ != nullptr);
120     _impl_.extension_set_->Clear();
121   }
122   _impl_._has_bits_.Clear();
123   _internal_metadata_.Clear<std::string>();
124 }
125 
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)126 const char* ExtensionDescriptor::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
127 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
128   _Internal::HasBits has_bits{};
129   while (!ctx->Done(&ptr)) {
130     ::uint32_t tag;
131     ptr = ::_pbi::ReadTag(ptr, &tag);
132     switch (tag >> 3) {
133       // optional .perfetto.protos.FileDescriptorSet extension_set = 1;
134       case 1:
135         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 10)) {
136           ptr = ctx->ParseMessage(_internal_mutable_extension_set(), ptr);
137           CHK_(ptr);
138         } else {
139           goto handle_unusual;
140         }
141         continue;
142       default:
143         goto handle_unusual;
144     }  // switch
145   handle_unusual:
146     if ((tag == 0) || ((tag & 7) == 4)) {
147       CHK_(ptr);
148       ctx->SetLastTag(tag);
149       goto message_done;
150     }
151     ptr = UnknownFieldParse(
152         tag,
153         _internal_metadata_.mutable_unknown_fields<std::string>(),
154         ptr, ctx);
155     CHK_(ptr != nullptr);
156   }  // while
157 message_done:
158   _impl_._has_bits_.Or(has_bits);
159   return ptr;
160 failure:
161   ptr = nullptr;
162   goto message_done;
163 #undef CHK_
164 }
165 
_InternalSerialize(::uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const166 ::uint8_t* ExtensionDescriptor::_InternalSerialize(
167     ::uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
168   // @@protoc_insertion_point(serialize_to_array_start:perfetto.protos.ExtensionDescriptor)
169   ::uint32_t cached_has_bits = 0;
170   (void) cached_has_bits;
171 
172   cached_has_bits = _impl_._has_bits_[0];
173   // optional .perfetto.protos.FileDescriptorSet extension_set = 1;
174   if (cached_has_bits & 0x00000001u) {
175     target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
176       InternalWriteMessage(1, _Internal::extension_set(this),
177         _Internal::extension_set(this).GetCachedSize(), target, stream);
178   }
179 
180   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
181     target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
182         static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
183   }
184   // @@protoc_insertion_point(serialize_to_array_end:perfetto.protos.ExtensionDescriptor)
185   return target;
186 }
187 
ByteSizeLong() const188 size_t ExtensionDescriptor::ByteSizeLong() const {
189 // @@protoc_insertion_point(message_byte_size_start:perfetto.protos.ExtensionDescriptor)
190   size_t total_size = 0;
191 
192   ::uint32_t cached_has_bits = 0;
193   // Prevent compiler warnings about cached_has_bits being unused
194   (void) cached_has_bits;
195 
196   // optional .perfetto.protos.FileDescriptorSet extension_set = 1;
197   cached_has_bits = _impl_._has_bits_[0];
198   if (cached_has_bits & 0x00000001u) {
199     total_size += 1 +
200       ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
201         *_impl_.extension_set_);
202   }
203 
204   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
205     total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
206   }
207   int cached_size = ::_pbi::ToCachedSize(total_size);
208   SetCachedSize(cached_size);
209   return total_size;
210 }
211 
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)212 void ExtensionDescriptor::CheckTypeAndMergeFrom(
213     const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
214   MergeFrom(*::_pbi::DownCast<const ExtensionDescriptor*>(
215       &from));
216 }
217 
MergeFrom(const ExtensionDescriptor & from)218 void ExtensionDescriptor::MergeFrom(const ExtensionDescriptor& from) {
219   ExtensionDescriptor* const _this = this;
220   // @@protoc_insertion_point(class_specific_merge_from_start:perfetto.protos.ExtensionDescriptor)
221   GOOGLE_DCHECK_NE(&from, _this);
222   ::uint32_t cached_has_bits = 0;
223   (void) cached_has_bits;
224 
225   if (from._internal_has_extension_set()) {
226     _this->_internal_mutable_extension_set()->::perfetto::protos::FileDescriptorSet::MergeFrom(
227         from._internal_extension_set());
228   }
229   _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
230 }
231 
CopyFrom(const ExtensionDescriptor & from)232 void ExtensionDescriptor::CopyFrom(const ExtensionDescriptor& from) {
233 // @@protoc_insertion_point(class_specific_copy_from_start:perfetto.protos.ExtensionDescriptor)
234   if (&from == this) return;
235   Clear();
236   MergeFrom(from);
237 }
238 
IsInitialized() const239 bool ExtensionDescriptor::IsInitialized() const {
240   if (_internal_has_extension_set()) {
241     if (!_impl_.extension_set_->IsInitialized()) return false;
242   }
243   return true;
244 }
245 
InternalSwap(ExtensionDescriptor * other)246 void ExtensionDescriptor::InternalSwap(ExtensionDescriptor* other) {
247   using std::swap;
248   _internal_metadata_.InternalSwap(&other->_internal_metadata_);
249   swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
250   swap(_impl_.extension_set_, other->_impl_.extension_set_);
251 }
252 
GetTypeName() const253 std::string ExtensionDescriptor::GetTypeName() const {
254   return "perfetto.protos.ExtensionDescriptor";
255 }
256 
257 
258 // @@protoc_insertion_point(namespace_scope)
259 }  // namespace protos
260 }  // namespace perfetto
261 PROTOBUF_NAMESPACE_OPEN
262 template<> PROTOBUF_NOINLINE ::perfetto::protos::ExtensionDescriptor*
CreateMaybeMessage(Arena * arena)263 Arena::CreateMaybeMessage< ::perfetto::protos::ExtensionDescriptor >(Arena* arena) {
264   return Arena::CreateMessageInternal< ::perfetto::protos::ExtensionDescriptor >(arena);
265 }
266 PROTOBUF_NAMESPACE_CLOSE
267 
268 // @@protoc_insertion_point(global_scope)
269 #include <google/protobuf/port_undef.inc>
270