Bug Summary

File:root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/google/protobuf/parse_context.h
Warning:line 218, column 41
Subtraction of a null pointer and a probably non-null pointer (via field 'buffer_end_') may result in undefined behavior

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -O2 -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name CoreDump.pb.cc -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -relaxed-aliasing -ffp-contract=off -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/devtools/shared/heapsnapshot -fcoverage-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/devtools/shared/heapsnapshot -resource-dir /usr/lib/llvm-22/lib/clang/22 -include /root/firefox-clang/config/gcc_hidden.h -include /root/firefox-clang/obj-x86_64-pc-linux-gnu/mozilla-config.h -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/stl_wrappers -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/system_wrappers -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -D _GLIBCXX_ASSERTIONS -D DEBUG=1 -D GOOGLE_PROTOBUF_NO_RTTI -D MOZ_HAS_MOZGLUE -D MOZILLA_INTERNAL_API -D IMPL_LIBXUL -D MOZ_SUPPORT_LEAKCHECKING -D STATIC_EXPORTABLE_JS_API -I /root/firefox-clang/devtools/shared/heapsnapshot -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/devtools/shared/heapsnapshot -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/ipc/ipdl/_ipdlheaders -I /root/firefox-clang/ipc/chromium/src -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nspr -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nss -D MOZILLA_CLIENT -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/x86_64-linux-gnu/c++/15 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/backward -internal-isystem /usr/lib/llvm-22/lib/clang/22/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/15/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-error=pessimizing-move -Wno-error=large-by-value-copy=128 -Wno-error=implicit-int-float-conversion -Wno-error=thread-safety-analysis -Wno-error=tautological-type-limit-compare -Wno-invalid-offsetof -Wno-range-loop-analysis -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-deprecated-this-capture -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-error=atomic-alignment -Wno-error=deprecated-builtins -Wno-psabi -Wno-error=builtin-macro-redefined -Wno-vla-cxx-extension -Wno-unknown-warning-option -Wno-character-conversion -fdeprecated-macro -ferror-limit 19 -fstrict-flex-arrays=1 -stack-protector 2 -fstack-clash-protection -ftrivial-auto-var-init=pattern -fno-rtti -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fno-sized-deallocation -fno-aligned-allocation -vectorize-loops -vectorize-slp -analyzer-checker optin.performance.Padding -analyzer-output=html -analyzer-config stable-report-filename=true -faddrsig -fdwarf2-cfi-asm -o /tmp/scan-build-2026-01-17-100050-2808198-1 -x c++ /root/firefox-clang/devtools/shared/heapsnapshot/CoreDump.pb.cc

/root/firefox-clang/devtools/shared/heapsnapshot/CoreDump.pb.cc

1// Generated by the protocol buffer compiler. DO NOT EDIT!
2// source: CoreDump.proto
3
4#include "CoreDump.pb.h"
5
6#include <algorithm>
7
8#include <google/protobuf/io/coded_stream.h>
9#include <google/protobuf/extension_set.h>
10#include <google/protobuf/wire_format_lite.h>
11#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
12// @@protoc_insertion_point(includes)
13#include <google/protobuf/port_def.inc>
14
15PROTOBUF_PRAGMA_INIT_SEG
16
17namespace _pb = ::PROTOBUF_NAMESPACE_ID;
18namespace _pbi = _pb::internal;
19
20namespace mozilla {
21namespace devtools {
22namespace protobuf {
23PROTOBUF_CONSTEXPR Metadata::Metadata(
24 ::_pbi::ConstantInitialized): _impl_{
25 /*decltype(_impl_._has_bits_)*/{}
26 , /*decltype(_impl_._cached_size_)*/{}
27 , /*decltype(_impl_.timestamp_)*/uint64_t{0u}} {}
28struct MetadataDefaultTypeInternal {
29 PROTOBUF_CONSTEXPR MetadataDefaultTypeInternal()
30 : _instance(::_pbi::ConstantInitialized{}) {}
31 ~MetadataDefaultTypeInternal() {}
32 union {
33 Metadata _instance;
34 };
35};
36PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MetadataDefaultTypeInternal _Metadata_default_instance_;
37PROTOBUF_CONSTEXPR StackFrame_Data::StackFrame_Data(
38 ::_pbi::ConstantInitialized): _impl_{
39 /*decltype(_impl_._has_bits_)*/{}
40 , /*decltype(_impl_._cached_size_)*/{}
41 , /*decltype(_impl_.parent_)*/nullptr
42 , /*decltype(_impl_.id_)*/uint64_t{0u}
43 , /*decltype(_impl_.line_)*/0u
44 , /*decltype(_impl_.column_)*/0u
45 , /*decltype(_impl_.issystem_)*/false
46 , /*decltype(_impl_.isselfhosted_)*/false
47 , /*decltype(_impl_.SourceOrRef_)*/{}
48 , /*decltype(_impl_.FunctionDisplayNameOrRef_)*/{}
49 , /*decltype(_impl_._oneof_case_)*/{}} {}
50struct StackFrame_DataDefaultTypeInternal {
51 PROTOBUF_CONSTEXPR StackFrame_DataDefaultTypeInternal()
52 : _instance(::_pbi::ConstantInitialized{}) {}
53 ~StackFrame_DataDefaultTypeInternal() {}
54 union {
55 StackFrame_Data _instance;
56 };
57};
58PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 StackFrame_DataDefaultTypeInternal _StackFrame_Data_default_instance_;
59PROTOBUF_CONSTEXPR StackFrame::StackFrame(
60 ::_pbi::ConstantInitialized): _impl_{
61 /*decltype(_impl_.StackFrameType_)*/{}
62 , /*decltype(_impl_._cached_size_)*/{}
63 , /*decltype(_impl_._oneof_case_)*/{}} {}
64struct StackFrameDefaultTypeInternal {
65 PROTOBUF_CONSTEXPR StackFrameDefaultTypeInternal()
66 : _instance(::_pbi::ConstantInitialized{}) {}
67 ~StackFrameDefaultTypeInternal() {}
68 union {
69 StackFrame _instance;
70 };
71};
72PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 StackFrameDefaultTypeInternal _StackFrame_default_instance_;
73PROTOBUF_CONSTEXPR Node::Node(
74 ::_pbi::ConstantInitialized): _impl_{
75 /*decltype(_impl_._has_bits_)*/{}
76 , /*decltype(_impl_._cached_size_)*/{}
77 , /*decltype(_impl_.edges_)*/{}
78 , /*decltype(_impl_.allocationstack_)*/nullptr
79 , /*decltype(_impl_.id_)*/uint64_t{0u}
80 , /*decltype(_impl_.size_)*/uint64_t{0u}
81 , /*decltype(_impl_.coarsetype_)*/0u
82 , /*decltype(_impl_.TypeNameOrRef_)*/{}
83 , /*decltype(_impl_.JSObjectClassNameOrRef_)*/{}
84 , /*decltype(_impl_.ScriptFilenameOrRef_)*/{}
85 , /*decltype(_impl_.descriptiveTypeNameOrRef_)*/{}
86 , /*decltype(_impl_._oneof_case_)*/{}} {}
87struct NodeDefaultTypeInternal {
88 PROTOBUF_CONSTEXPR NodeDefaultTypeInternal()
89 : _instance(::_pbi::ConstantInitialized{}) {}
90 ~NodeDefaultTypeInternal() {}
91 union {
92 Node _instance;
93 };
94};
95PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 NodeDefaultTypeInternal _Node_default_instance_;
96PROTOBUF_CONSTEXPR Edge::Edge(
97 ::_pbi::ConstantInitialized): _impl_{
98 /*decltype(_impl_._has_bits_)*/{}
99 , /*decltype(_impl_._cached_size_)*/{}
100 , /*decltype(_impl_.referent_)*/uint64_t{0u}
101 , /*decltype(_impl_.EdgeNameOrRef_)*/{}
102 , /*decltype(_impl_._oneof_case_)*/{}} {}
103struct EdgeDefaultTypeInternal {
104 PROTOBUF_CONSTEXPR EdgeDefaultTypeInternal()
105 : _instance(::_pbi::ConstantInitialized{}) {}
106 ~EdgeDefaultTypeInternal() {}
107 union {
108 Edge _instance;
109 };
110};
111PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 EdgeDefaultTypeInternal _Edge_default_instance_;
112} // namespace protobuf
113} // namespace devtools
114} // namespace mozilla
115namespace mozilla {
116namespace devtools {
117namespace protobuf {
118
119// ===================================================================
120
121class Metadata::_Internal {
122 public:
123 using HasBits = decltype(std::declval<Metadata>()._impl_._has_bits_);
124 static void set_has_timestamp(HasBits* has_bits) {
125 (*has_bits)[0] |= 1u;
126 }
127};
128
129Metadata::Metadata(::PROTOBUF_NAMESPACE_ID::Arena* arena,
130 bool is_message_owned)
131 : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
132 SharedCtor(arena, is_message_owned);
133 // @@protoc_insertion_point(arena_constructor:mozilla.devtools.protobuf.Metadata)
134}
135Metadata::Metadata(const Metadata& from)
136 : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
137 Metadata* const _this = this; (void)_this;
138 new (&_impl_) Impl_{
139 decltype(_impl_._has_bits_){from._impl_._has_bits_}
140 , /*decltype(_impl_._cached_size_)*/{}
141 , decltype(_impl_.timestamp_){}};
142
143 _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
144 _this->_impl_.timestamp_ = from._impl_.timestamp_;
145 // @@protoc_insertion_point(copy_constructor:mozilla.devtools.protobuf.Metadata)
146}
147
148inline void Metadata::SharedCtor(
149 ::_pb::Arena* arena, bool is_message_owned) {
150 (void)arena;
151 (void)is_message_owned;
152 new (&_impl_) Impl_{
153 decltype(_impl_._has_bits_){}
154 , /*decltype(_impl_._cached_size_)*/{}
155 , decltype(_impl_.timestamp_){uint64_t{0u}}
156 };
157}
158
159Metadata::~Metadata() {
160 // @@protoc_insertion_point(destructor:mozilla.devtools.protobuf.Metadata)
161 if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
162 (void)arena;
163 return;
164 }
165 SharedDtor();
166}
167
168inline void Metadata::SharedDtor() {
169 GOOGLE_DCHECK(GetArenaForAllocation() == nullptr)!(!(GetArenaForAllocation() == nullptr)) ? (void)0 : ::google
::protobuf::internal::LogFinisher() = ::google::protobuf::internal
::LogMessage( ::google::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/devtools/shared/heapsnapshot/CoreDump.pb.cc"
, 169) << "CHECK failed: " "GetArenaForAllocation() == nullptr"
": "
;
170}
171
172void Metadata::SetCachedSize(int size) const {
173 _impl_._cached_size_.Set(size);
174}
175
176void Metadata::Clear() {
177// @@protoc_insertion_point(message_clear_start:mozilla.devtools.protobuf.Metadata)
178 uint32_t cached_has_bits = 0;
179 // Prevent compiler warnings about cached_has_bits being unused
180 (void) cached_has_bits;
181
182 _impl_.timestamp_ = uint64_t{0u};
183 _impl_._has_bits_.Clear();
184 _internal_metadata_.Clear<std::string>();
185}
186
187const char* Metadata::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
188#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
189 _Internal::HasBits has_bits{};
190 while (!ctx->Done(&ptr)) {
191 uint32_t tag;
192 ptr = ::_pbi::ReadTag(ptr, &tag);
193 switch (tag >> 3) {
194 // optional uint64 timeStamp = 1;
195 case 1:
196 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
197 _Internal::set_has_timestamp(&has_bits);
198 _impl_.timestamp_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
199 CHK_(ptr);
200 } else
201 goto handle_unusual;
202 continue;
203 default:
204 goto handle_unusual;
205 } // switch
206 handle_unusual:
207 if ((tag == 0) || ((tag & 7) == 4)) {
208 CHK_(ptr);
209 ctx->SetLastTag(tag);
210 goto message_done;
211 }
212 ptr = UnknownFieldParse(
213 tag,
214 _internal_metadata_.mutable_unknown_fields<std::string>(),
215 ptr, ctx);
216 CHK_(ptr != nullptr);
217 } // while
218message_done:
219 _impl_._has_bits_.Or(has_bits);
220 return ptr;
221failure:
222 ptr = nullptr;
223 goto message_done;
224#undef CHK_
225}
226
227uint8_t* Metadata::_InternalSerialize(
228 uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
229 // @@protoc_insertion_point(serialize_to_array_start:mozilla.devtools.protobuf.Metadata)
230 uint32_t cached_has_bits = 0;
231 (void) cached_has_bits;
232
233 cached_has_bits = _impl_._has_bits_[0];
234 // optional uint64 timeStamp = 1;
235 if (cached_has_bits & 0x00000001u) {
236 target = stream->EnsureSpace(target);
237 target = ::_pbi::WireFormatLite::WriteUInt64ToArray(1, this->_internal_timestamp(), target);
238 }
239
240 if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
241 target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
242 static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
243 }
244 // @@protoc_insertion_point(serialize_to_array_end:mozilla.devtools.protobuf.Metadata)
245 return target;
246}
247
248size_t Metadata::ByteSizeLong() const {
249// @@protoc_insertion_point(message_byte_size_start:mozilla.devtools.protobuf.Metadata)
250 size_t total_size = 0;
251
252 uint32_t cached_has_bits = 0;
253 // Prevent compiler warnings about cached_has_bits being unused
254 (void) cached_has_bits;
255
256 // optional uint64 timeStamp = 1;
257 cached_has_bits = _impl_._has_bits_[0];
258 if (cached_has_bits & 0x00000001u) {
259 total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_timestamp());
260 }
261
262 if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
263 total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
264 }
265 int cached_size = ::_pbi::ToCachedSize(total_size);
266 SetCachedSize(cached_size);
267 return total_size;
268}
269
270void Metadata::CheckTypeAndMergeFrom(
271 const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
272 MergeFrom(*::_pbi::DownCast<const Metadata*>(
273 &from));
274}
275
276void Metadata::MergeFrom(const Metadata& from) {
277 Metadata* const _this = this;
278 // @@protoc_insertion_point(class_specific_merge_from_start:mozilla.devtools.protobuf.Metadata)
279 GOOGLE_DCHECK_NE(&from, _this)!(!((&from) != (_this))) ? (void)0 : ::google::protobuf::
internal::LogFinisher() = ::google::protobuf::internal::LogMessage
( ::google::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/devtools/shared/heapsnapshot/CoreDump.pb.cc"
, 279) << "CHECK failed: " "(&from) != (_this)" ": "
;
280 uint32_t cached_has_bits = 0;
281 (void) cached_has_bits;
282
283 if (from._internal_has_timestamp()) {
284 _this->_internal_set_timestamp(from._internal_timestamp());
285 }
286 _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
287}
288
289void Metadata::CopyFrom(const Metadata& from) {
290// @@protoc_insertion_point(class_specific_copy_from_start:mozilla.devtools.protobuf.Metadata)
291 if (&from == this) return;
292 Clear();
293 MergeFrom(from);
294}
295
296bool Metadata::IsInitialized() const {
297 return true;
298}
299
300void Metadata::InternalSwap(Metadata* other) {
301 using std::swap;
302 _internal_metadata_.InternalSwap(&other->_internal_metadata_);
303 swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
304 swap(_impl_.timestamp_, other->_impl_.timestamp_);
305}
306
307std::string Metadata::GetTypeName() const {
308 return "mozilla.devtools.protobuf.Metadata";
309}
310
311
312// ===================================================================
313
314class StackFrame_Data::_Internal {
315 public:
316 using HasBits = decltype(std::declval<StackFrame_Data>()._impl_._has_bits_);
317 static void set_has_id(HasBits* has_bits) {
318 (*has_bits)[0] |= 2u;
319 }
320 static const ::mozilla::devtools::protobuf::StackFrame& parent(const StackFrame_Data* msg);
321 static void set_has_parent(HasBits* has_bits) {
322 (*has_bits)[0] |= 1u;
323 }
324 static void set_has_line(HasBits* has_bits) {
325 (*has_bits)[0] |= 4u;
326 }
327 static void set_has_column(HasBits* has_bits) {
328 (*has_bits)[0] |= 8u;
329 }
330 static void set_has_issystem(HasBits* has_bits) {
331 (*has_bits)[0] |= 16u;
332 }
333 static void set_has_isselfhosted(HasBits* has_bits) {
334 (*has_bits)[0] |= 32u;
335 }
336};
337
338const ::mozilla::devtools::protobuf::StackFrame&
339StackFrame_Data::_Internal::parent(const StackFrame_Data* msg) {
340 return *msg->_impl_.parent_;
341}
342StackFrame_Data::StackFrame_Data(::PROTOBUF_NAMESPACE_ID::Arena* arena,
343 bool is_message_owned)
344 : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
345 SharedCtor(arena, is_message_owned);
346 // @@protoc_insertion_point(arena_constructor:mozilla.devtools.protobuf.StackFrame.Data)
347}
348StackFrame_Data::StackFrame_Data(const StackFrame_Data& from)
349 : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
350 StackFrame_Data* const _this = this; (void)_this;
351 new (&_impl_) Impl_{
352 decltype(_impl_._has_bits_){from._impl_._has_bits_}
353 , /*decltype(_impl_._cached_size_)*/{}
354 , decltype(_impl_.parent_){nullptr}
355 , decltype(_impl_.id_){}
356 , decltype(_impl_.line_){}
357 , decltype(_impl_.column_){}
358 , decltype(_impl_.issystem_){}
359 , decltype(_impl_.isselfhosted_){}
360 , decltype(_impl_.SourceOrRef_){}
361 , decltype(_impl_.FunctionDisplayNameOrRef_){}
362 , /*decltype(_impl_._oneof_case_)*/{}};
363
364 _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
365 if (from._internal_has_parent()) {
366 _this->_impl_.parent_ = new ::mozilla::devtools::protobuf::StackFrame(*from._impl_.parent_);
367 }
368 ::memcpy(&_impl_.id_, &from._impl_.id_,
369 static_cast<size_t>(reinterpret_cast<char*>(&_impl_.isselfhosted_) -
370 reinterpret_cast<char*>(&_impl_.id_)) + sizeof(_impl_.isselfhosted_));
371 clear_has_SourceOrRef();
372 switch (from.SourceOrRef_case()) {
373 case kSource: {
374 _this->_internal_set_source(from._internal_source());
375 break;
376 }
377 case kSourceRef: {
378 _this->_internal_set_sourceref(from._internal_sourceref());
379 break;
380 }
381 case SOURCEORREF_NOT_SET: {
382 break;
383 }
384 }
385 clear_has_FunctionDisplayNameOrRef();
386 switch (from.FunctionDisplayNameOrRef_case()) {
387 case kFunctionDisplayName: {
388 _this->_internal_set_functiondisplayname(from._internal_functiondisplayname());
389 break;
390 }
391 case kFunctionDisplayNameRef: {
392 _this->_internal_set_functiondisplaynameref(from._internal_functiondisplaynameref());
393 break;
394 }
395 case FUNCTIONDISPLAYNAMEORREF_NOT_SET: {
396 break;
397 }
398 }
399 // @@protoc_insertion_point(copy_constructor:mozilla.devtools.protobuf.StackFrame.Data)
400}
401
402inline void StackFrame_Data::SharedCtor(
403 ::_pb::Arena* arena, bool is_message_owned) {
404 (void)arena;
405 (void)is_message_owned;
406 new (&_impl_) Impl_{
407 decltype(_impl_._has_bits_){}
408 , /*decltype(_impl_._cached_size_)*/{}
409 , decltype(_impl_.parent_){nullptr}
410 , decltype(_impl_.id_){uint64_t{0u}}
411 , decltype(_impl_.line_){0u}
412 , decltype(_impl_.column_){0u}
413 , decltype(_impl_.issystem_){false}
414 , decltype(_impl_.isselfhosted_){false}
415 , decltype(_impl_.SourceOrRef_){}
416 , decltype(_impl_.FunctionDisplayNameOrRef_){}
417 , /*decltype(_impl_._oneof_case_)*/{}
418 };
419 clear_has_SourceOrRef();
420 clear_has_FunctionDisplayNameOrRef();
421}
422
423StackFrame_Data::~StackFrame_Data() {
424 // @@protoc_insertion_point(destructor:mozilla.devtools.protobuf.StackFrame.Data)
425 if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
426 (void)arena;
427 return;
428 }
429 SharedDtor();
430}
431
432inline void StackFrame_Data::SharedDtor() {
433 GOOGLE_DCHECK(GetArenaForAllocation() == nullptr)!(!(GetArenaForAllocation() == nullptr)) ? (void)0 : ::google
::protobuf::internal::LogFinisher() = ::google::protobuf::internal
::LogMessage( ::google::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/devtools/shared/heapsnapshot/CoreDump.pb.cc"
, 433) << "CHECK failed: " "GetArenaForAllocation() == nullptr"
": "
;
434 if (this != internal_default_instance()) delete _impl_.parent_;
435 if (has_SourceOrRef()) {
436 clear_SourceOrRef();
437 }
438 if (has_FunctionDisplayNameOrRef()) {
439 clear_FunctionDisplayNameOrRef();
440 }
441}
442
443void StackFrame_Data::SetCachedSize(int size) const {
444 _impl_._cached_size_.Set(size);
445}
446
447void StackFrame_Data::clear_SourceOrRef() {
448// @@protoc_insertion_point(one_of_clear_start:mozilla.devtools.protobuf.StackFrame.Data)
449 switch (SourceOrRef_case()) {
450 case kSource: {
451 _impl_.SourceOrRef_.source_.Destroy();
452 break;
453 }
454 case kSourceRef: {
455 // No need to clear
456 break;
457 }
458 case SOURCEORREF_NOT_SET: {
459 break;
460 }
461 }
462 _impl_._oneof_case_[0] = SOURCEORREF_NOT_SET;
463}
464
465void StackFrame_Data::clear_FunctionDisplayNameOrRef() {
466// @@protoc_insertion_point(one_of_clear_start:mozilla.devtools.protobuf.StackFrame.Data)
467 switch (FunctionDisplayNameOrRef_case()) {
468 case kFunctionDisplayName: {
469 _impl_.FunctionDisplayNameOrRef_.functiondisplayname_.Destroy();
470 break;
471 }
472 case kFunctionDisplayNameRef: {
473 // No need to clear
474 break;
475 }
476 case FUNCTIONDISPLAYNAMEORREF_NOT_SET: {
477 break;
478 }
479 }
480 _impl_._oneof_case_[1] = FUNCTIONDISPLAYNAMEORREF_NOT_SET;
481}
482
483
484void StackFrame_Data::Clear() {
485// @@protoc_insertion_point(message_clear_start:mozilla.devtools.protobuf.StackFrame.Data)
486 uint32_t cached_has_bits = 0;
487 // Prevent compiler warnings about cached_has_bits being unused
488 (void) cached_has_bits;
489
490 cached_has_bits = _impl_._has_bits_[0];
491 if (cached_has_bits & 0x00000001u) {
492 GOOGLE_DCHECK(_impl_.parent_ != nullptr)!(!(_impl_.parent_ != nullptr)) ? (void)0 : ::google::protobuf
::internal::LogFinisher() = ::google::protobuf::internal::LogMessage
( ::google::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/devtools/shared/heapsnapshot/CoreDump.pb.cc"
, 492) << "CHECK failed: " "_impl_.parent_ != nullptr" ": "
;
493 _impl_.parent_->Clear();
494 }
495 if (cached_has_bits & 0x0000003eu) {
496 ::memset(&_impl_.id_, 0, static_cast<size_t>(
497 reinterpret_cast<char*>(&_impl_.isselfhosted_) -
498 reinterpret_cast<char*>(&_impl_.id_)) + sizeof(_impl_.isselfhosted_));
499 }
500 clear_SourceOrRef();
501 clear_FunctionDisplayNameOrRef();
502 _impl_._has_bits_.Clear();
503 _internal_metadata_.Clear<std::string>();
504}
505
506const char* StackFrame_Data::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
507#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
508 _Internal::HasBits has_bits{};
509 while (!ctx->Done(&ptr)) {
510 uint32_t tag;
511 ptr = ::_pbi::ReadTag(ptr, &tag);
512 switch (tag >> 3) {
513 // optional uint64 id = 1;
514 case 1:
515 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
516 _Internal::set_has_id(&has_bits);
517 _impl_.id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
518 CHK_(ptr);
519 } else
520 goto handle_unusual;
521 continue;
522 // optional .mozilla.devtools.protobuf.StackFrame parent = 2;
523 case 2:
524 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
525 ptr = ctx->ParseMessage(_internal_mutable_parent(), ptr);
526 CHK_(ptr);
527 } else
528 goto handle_unusual;
529 continue;
530 // optional uint32 line = 3;
531 case 3:
532 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
533 _Internal::set_has_line(&has_bits);
534 _impl_.line_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
535 CHK_(ptr);
536 } else
537 goto handle_unusual;
538 continue;
539 // optional uint32 column = 4;
540 case 4:
541 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) {
542 _Internal::set_has_column(&has_bits);
543 _impl_.column_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
544 CHK_(ptr);
545 } else
546 goto handle_unusual;
547 continue;
548 // bytes source = 5;
549 case 5:
550 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
551 auto str = _internal_mutable_source();
552 ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
553 CHK_(ptr);
554 } else
555 goto handle_unusual;
556 continue;
557 // uint64 sourceRef = 6;
558 case 6:
559 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 48)) {
560 _internal_set_sourceref(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
561 CHK_(ptr);
562 } else
563 goto handle_unusual;
564 continue;
565 // bytes functionDisplayName = 7;
566 case 7:
567 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
568 auto str = _internal_mutable_functiondisplayname();
569 ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
570 CHK_(ptr);
571 } else
572 goto handle_unusual;
573 continue;
574 // uint64 functionDisplayNameRef = 8;
575 case 8:
576 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 64)) {
577 _internal_set_functiondisplaynameref(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
578 CHK_(ptr);
579 } else
580 goto handle_unusual;
581 continue;
582 // optional bool isSystem = 9;
583 case 9:
584 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 72)) {
585 _Internal::set_has_issystem(&has_bits);
586 _impl_.issystem_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
587 CHK_(ptr);
588 } else
589 goto handle_unusual;
590 continue;
591 // optional bool isSelfHosted = 10;
592 case 10:
593 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 80)) {
594 _Internal::set_has_isselfhosted(&has_bits);
595 _impl_.isselfhosted_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
596 CHK_(ptr);
597 } else
598 goto handle_unusual;
599 continue;
600 default:
601 goto handle_unusual;
602 } // switch
603 handle_unusual:
604 if ((tag == 0) || ((tag & 7) == 4)) {
605 CHK_(ptr);
606 ctx->SetLastTag(tag);
607 goto message_done;
608 }
609 ptr = UnknownFieldParse(
610 tag,
611 _internal_metadata_.mutable_unknown_fields<std::string>(),
612 ptr, ctx);
613 CHK_(ptr != nullptr);
614 } // while
615message_done:
616 _impl_._has_bits_.Or(has_bits);
617 return ptr;
618failure:
619 ptr = nullptr;
620 goto message_done;
621#undef CHK_
622}
623
624uint8_t* StackFrame_Data::_InternalSerialize(
625 uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
626 // @@protoc_insertion_point(serialize_to_array_start:mozilla.devtools.protobuf.StackFrame.Data)
627 uint32_t cached_has_bits = 0;
628 (void) cached_has_bits;
629
630 cached_has_bits = _impl_._has_bits_[0];
631 // optional uint64 id = 1;
632 if (cached_has_bits & 0x00000002u) {
633 target = stream->EnsureSpace(target);
634 target = ::_pbi::WireFormatLite::WriteUInt64ToArray(1, this->_internal_id(), target);
635 }
636
637 // optional .mozilla.devtools.protobuf.StackFrame parent = 2;
638 if (cached_has_bits & 0x00000001u) {
639 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
640 InternalWriteMessage(2, _Internal::parent(this),
641 _Internal::parent(this).GetCachedSize(), target, stream);
642 }
643
644 // optional uint32 line = 3;
645 if (cached_has_bits & 0x00000004u) {
646 target = stream->EnsureSpace(target);
647 target = ::_pbi::WireFormatLite::WriteUInt32ToArray(3, this->_internal_line(), target);
648 }
649
650 // optional uint32 column = 4;
651 if (cached_has_bits & 0x00000008u) {
652 target = stream->EnsureSpace(target);
653 target = ::_pbi::WireFormatLite::WriteUInt32ToArray(4, this->_internal_column(), target);
654 }
655
656 switch (SourceOrRef_case()) {
657 case kSource: {
658 target = stream->WriteBytesMaybeAliased(
659 5, this->_internal_source(), target);
660 break;
661 }
662 case kSourceRef: {
663 target = stream->EnsureSpace(target);
664 target = ::_pbi::WireFormatLite::WriteUInt64ToArray(6, this->_internal_sourceref(), target);
665 break;
666 }
667 default: ;
668 }
669 switch (FunctionDisplayNameOrRef_case()) {
670 case kFunctionDisplayName: {
671 target = stream->WriteBytesMaybeAliased(
672 7, this->_internal_functiondisplayname(), target);
673 break;
674 }
675 case kFunctionDisplayNameRef: {
676 target = stream->EnsureSpace(target);
677 target = ::_pbi::WireFormatLite::WriteUInt64ToArray(8, this->_internal_functiondisplaynameref(), target);
678 break;
679 }
680 default: ;
681 }
682 // optional bool isSystem = 9;
683 if (cached_has_bits & 0x00000010u) {
684 target = stream->EnsureSpace(target);
685 target = ::_pbi::WireFormatLite::WriteBoolToArray(9, this->_internal_issystem(), target);
686 }
687
688 // optional bool isSelfHosted = 10;
689 if (cached_has_bits & 0x00000020u) {
690 target = stream->EnsureSpace(target);
691 target = ::_pbi::WireFormatLite::WriteBoolToArray(10, this->_internal_isselfhosted(), target);
692 }
693
694 if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
695 target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
696 static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
697 }
698 // @@protoc_insertion_point(serialize_to_array_end:mozilla.devtools.protobuf.StackFrame.Data)
699 return target;
700}
701
702size_t StackFrame_Data::ByteSizeLong() const {
703// @@protoc_insertion_point(message_byte_size_start:mozilla.devtools.protobuf.StackFrame.Data)
704 size_t total_size = 0;
705
706 uint32_t cached_has_bits = 0;
707 // Prevent compiler warnings about cached_has_bits being unused
708 (void) cached_has_bits;
709
710 cached_has_bits = _impl_._has_bits_[0];
711 if (cached_has_bits & 0x0000003fu) {
712 // optional .mozilla.devtools.protobuf.StackFrame parent = 2;
713 if (cached_has_bits & 0x00000001u) {
714 total_size += 1 +
715 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
716 *_impl_.parent_);
717 }
718
719 // optional uint64 id = 1;
720 if (cached_has_bits & 0x00000002u) {
721 total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_id());
722 }
723
724 // optional uint32 line = 3;
725 if (cached_has_bits & 0x00000004u) {
726 total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_line());
727 }
728
729 // optional uint32 column = 4;
730 if (cached_has_bits & 0x00000008u) {
731 total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_column());
732 }
733
734 // optional bool isSystem = 9;
735 if (cached_has_bits & 0x00000010u) {
736 total_size += 1 + 1;
737 }
738
739 // optional bool isSelfHosted = 10;
740 if (cached_has_bits & 0x00000020u) {
741 total_size += 1 + 1;
742 }
743
744 }
745 switch (SourceOrRef_case()) {
746 // bytes source = 5;
747 case kSource: {
748 total_size += 1 +
749 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
750 this->_internal_source());
751 break;
752 }
753 // uint64 sourceRef = 6;
754 case kSourceRef: {
755 total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_sourceref());
756 break;
757 }
758 case SOURCEORREF_NOT_SET: {
759 break;
760 }
761 }
762 switch (FunctionDisplayNameOrRef_case()) {
763 // bytes functionDisplayName = 7;
764 case kFunctionDisplayName: {
765 total_size += 1 +
766 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
767 this->_internal_functiondisplayname());
768 break;
769 }
770 // uint64 functionDisplayNameRef = 8;
771 case kFunctionDisplayNameRef: {
772 total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_functiondisplaynameref());
773 break;
774 }
775 case FUNCTIONDISPLAYNAMEORREF_NOT_SET: {
776 break;
777 }
778 }
779 if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
780 total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
781 }
782 int cached_size = ::_pbi::ToCachedSize(total_size);
783 SetCachedSize(cached_size);
784 return total_size;
785}
786
787void StackFrame_Data::CheckTypeAndMergeFrom(
788 const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
789 MergeFrom(*::_pbi::DownCast<const StackFrame_Data*>(
790 &from));
791}
792
793void StackFrame_Data::MergeFrom(const StackFrame_Data& from) {
794 StackFrame_Data* const _this = this;
795 // @@protoc_insertion_point(class_specific_merge_from_start:mozilla.devtools.protobuf.StackFrame.Data)
796 GOOGLE_DCHECK_NE(&from, _this)!(!((&from) != (_this))) ? (void)0 : ::google::protobuf::
internal::LogFinisher() = ::google::protobuf::internal::LogMessage
( ::google::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/devtools/shared/heapsnapshot/CoreDump.pb.cc"
, 796) << "CHECK failed: " "(&from) != (_this)" ": "
;
797 uint32_t cached_has_bits = 0;
798 (void) cached_has_bits;
799
800 cached_has_bits = from._impl_._has_bits_[0];
801 if (cached_has_bits & 0x0000003fu) {
802 if (cached_has_bits & 0x00000001u) {
803 _this->_internal_mutable_parent()->::mozilla::devtools::protobuf::StackFrame::MergeFrom(
804 from._internal_parent());
805 }
806 if (cached_has_bits & 0x00000002u) {
807 _this->_impl_.id_ = from._impl_.id_;
808 }
809 if (cached_has_bits & 0x00000004u) {
810 _this->_impl_.line_ = from._impl_.line_;
811 }
812 if (cached_has_bits & 0x00000008u) {
813 _this->_impl_.column_ = from._impl_.column_;
814 }
815 if (cached_has_bits & 0x00000010u) {
816 _this->_impl_.issystem_ = from._impl_.issystem_;
817 }
818 if (cached_has_bits & 0x00000020u) {
819 _this->_impl_.isselfhosted_ = from._impl_.isselfhosted_;
820 }
821 _this->_impl_._has_bits_[0] |= cached_has_bits;
822 }
823 switch (from.SourceOrRef_case()) {
824 case kSource: {
825 _this->_internal_set_source(from._internal_source());
826 break;
827 }
828 case kSourceRef: {
829 _this->_internal_set_sourceref(from._internal_sourceref());
830 break;
831 }
832 case SOURCEORREF_NOT_SET: {
833 break;
834 }
835 }
836 switch (from.FunctionDisplayNameOrRef_case()) {
837 case kFunctionDisplayName: {
838 _this->_internal_set_functiondisplayname(from._internal_functiondisplayname());
839 break;
840 }
841 case kFunctionDisplayNameRef: {
842 _this->_internal_set_functiondisplaynameref(from._internal_functiondisplaynameref());
843 break;
844 }
845 case FUNCTIONDISPLAYNAMEORREF_NOT_SET: {
846 break;
847 }
848 }
849 _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
850}
851
852void StackFrame_Data::CopyFrom(const StackFrame_Data& from) {
853// @@protoc_insertion_point(class_specific_copy_from_start:mozilla.devtools.protobuf.StackFrame.Data)
854 if (&from == this) return;
855 Clear();
856 MergeFrom(from);
857}
858
859bool StackFrame_Data::IsInitialized() const {
860 return true;
861}
862
863void StackFrame_Data::InternalSwap(StackFrame_Data* other) {
864 using std::swap;
865 _internal_metadata_.InternalSwap(&other->_internal_metadata_);
866 swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
867 ::PROTOBUF_NAMESPACE_ID::internal::memswap<
868 PROTOBUF_FIELD_OFFSET(StackFrame_Data, _impl_.isselfhosted_)
869 + sizeof(StackFrame_Data::_impl_.isselfhosted_)
870 - PROTOBUF_FIELD_OFFSET(StackFrame_Data, _impl_.parent_)>(
871 reinterpret_cast<char*>(&_impl_.parent_),
872 reinterpret_cast<char*>(&other->_impl_.parent_));
873 swap(_impl_.SourceOrRef_, other->_impl_.SourceOrRef_);
874 swap(_impl_.FunctionDisplayNameOrRef_, other->_impl_.FunctionDisplayNameOrRef_);
875 swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]);
876 swap(_impl_._oneof_case_[1], other->_impl_._oneof_case_[1]);
877}
878
879std::string StackFrame_Data::GetTypeName() const {
880 return "mozilla.devtools.protobuf.StackFrame.Data";
881}
882
883
884// ===================================================================
885
886class StackFrame::_Internal {
887 public:
888 static const ::mozilla::devtools::protobuf::StackFrame_Data& data(const StackFrame* msg);
889};
890
891const ::mozilla::devtools::protobuf::StackFrame_Data&
892StackFrame::_Internal::data(const StackFrame* msg) {
893 return *msg->_impl_.StackFrameType_.data_;
894}
895void StackFrame::set_allocated_data(::mozilla::devtools::protobuf::StackFrame_Data* data) {
896 ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
897 clear_StackFrameType();
898 if (data) {
899 ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
900 ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(data);
901 if (message_arena != submessage_arena) {
902 data = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
903 message_arena, data, submessage_arena);
904 }
905 set_has_data();
906 _impl_.StackFrameType_.data_ = data;
907 }
908 // @@protoc_insertion_point(field_set_allocated:mozilla.devtools.protobuf.StackFrame.data)
909}
910StackFrame::StackFrame(::PROTOBUF_NAMESPACE_ID::Arena* arena,
911 bool is_message_owned)
912 : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
913 SharedCtor(arena, is_message_owned);
914 // @@protoc_insertion_point(arena_constructor:mozilla.devtools.protobuf.StackFrame)
915}
916StackFrame::StackFrame(const StackFrame& from)
917 : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
918 StackFrame* const _this = this; (void)_this;
919 new (&_impl_) Impl_{
920 decltype(_impl_.StackFrameType_){}
921 , /*decltype(_impl_._cached_size_)*/{}
922 , /*decltype(_impl_._oneof_case_)*/{}};
923
924 _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
925 clear_has_StackFrameType();
926 switch (from.StackFrameType_case()) {
927 case kData: {
928 _this->_internal_mutable_data()->::mozilla::devtools::protobuf::StackFrame_Data::MergeFrom(
929 from._internal_data());
930 break;
931 }
932 case kRef: {
933 _this->_internal_set_ref(from._internal_ref());
934 break;
935 }
936 case STACKFRAMETYPE_NOT_SET: {
937 break;
938 }
939 }
940 // @@protoc_insertion_point(copy_constructor:mozilla.devtools.protobuf.StackFrame)
941}
942
943inline void StackFrame::SharedCtor(
944 ::_pb::Arena* arena, bool is_message_owned) {
945 (void)arena;
946 (void)is_message_owned;
947 new (&_impl_) Impl_{
948 decltype(_impl_.StackFrameType_){}
949 , /*decltype(_impl_._cached_size_)*/{}
950 , /*decltype(_impl_._oneof_case_)*/{}
951 };
952 clear_has_StackFrameType();
953}
954
955StackFrame::~StackFrame() {
956 // @@protoc_insertion_point(destructor:mozilla.devtools.protobuf.StackFrame)
957 if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
958 (void)arena;
959 return;
960 }
961 SharedDtor();
962}
963
964inline void StackFrame::SharedDtor() {
965 GOOGLE_DCHECK(GetArenaForAllocation() == nullptr)!(!(GetArenaForAllocation() == nullptr)) ? (void)0 : ::google
::protobuf::internal::LogFinisher() = ::google::protobuf::internal
::LogMessage( ::google::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/devtools/shared/heapsnapshot/CoreDump.pb.cc"
, 965) << "CHECK failed: " "GetArenaForAllocation() == nullptr"
": "
;
966 if (has_StackFrameType()) {
967 clear_StackFrameType();
968 }
969}
970
971void StackFrame::SetCachedSize(int size) const {
972 _impl_._cached_size_.Set(size);
973}
974
975void StackFrame::clear_StackFrameType() {
976// @@protoc_insertion_point(one_of_clear_start:mozilla.devtools.protobuf.StackFrame)
977 switch (StackFrameType_case()) {
978 case kData: {
979 if (GetArenaForAllocation() == nullptr) {
980 delete _impl_.StackFrameType_.data_;
981 }
982 break;
983 }
984 case kRef: {
985 // No need to clear
986 break;
987 }
988 case STACKFRAMETYPE_NOT_SET: {
989 break;
990 }
991 }
992 _impl_._oneof_case_[0] = STACKFRAMETYPE_NOT_SET;
993}
994
995
996void StackFrame::Clear() {
997// @@protoc_insertion_point(message_clear_start:mozilla.devtools.protobuf.StackFrame)
998 uint32_t cached_has_bits = 0;
999 // Prevent compiler warnings about cached_has_bits being unused
1000 (void) cached_has_bits;
1001
1002 clear_StackFrameType();
1003 _internal_metadata_.Clear<std::string>();
1004}
1005
1006const char* StackFrame::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
1007#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
1008 while (!ctx->Done(&ptr)) {
1009 uint32_t tag;
1010 ptr = ::_pbi::ReadTag(ptr, &tag);
1011 switch (tag >> 3) {
1012 // .mozilla.devtools.protobuf.StackFrame.Data data = 1;
1013 case 1:
1014 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
1015 ptr = ctx->ParseMessage(_internal_mutable_data(), ptr);
1016 CHK_(ptr);
1017 } else
1018 goto handle_unusual;
1019 continue;
1020 // uint64 ref = 2;
1021 case 2:
1022 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
1023 _internal_set_ref(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
1024 CHK_(ptr);
1025 } else
1026 goto handle_unusual;
1027 continue;
1028 default:
1029 goto handle_unusual;
1030 } // switch
1031 handle_unusual:
1032 if ((tag == 0) || ((tag & 7) == 4)) {
1033 CHK_(ptr);
1034 ctx->SetLastTag(tag);
1035 goto message_done;
1036 }
1037 ptr = UnknownFieldParse(
1038 tag,
1039 _internal_metadata_.mutable_unknown_fields<std::string>(),
1040 ptr, ctx);
1041 CHK_(ptr != nullptr);
1042 } // while
1043message_done:
1044 return ptr;
1045failure:
1046 ptr = nullptr;
1047 goto message_done;
1048#undef CHK_
1049}
1050
1051uint8_t* StackFrame::_InternalSerialize(
1052 uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
1053 // @@protoc_insertion_point(serialize_to_array_start:mozilla.devtools.protobuf.StackFrame)
1054 uint32_t cached_has_bits = 0;
1055 (void) cached_has_bits;
1056
1057 switch (StackFrameType_case()) {
1058 case kData: {
1059 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
1060 InternalWriteMessage(1, _Internal::data(this),
1061 _Internal::data(this).GetCachedSize(), target, stream);
1062 break;
1063 }
1064 case kRef: {
1065 target = stream->EnsureSpace(target);
1066 target = ::_pbi::WireFormatLite::WriteUInt64ToArray(2, this->_internal_ref(), target);
1067 break;
1068 }
1069 default: ;
1070 }
1071 if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
1072 target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
1073 static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
1074 }
1075 // @@protoc_insertion_point(serialize_to_array_end:mozilla.devtools.protobuf.StackFrame)
1076 return target;
1077}
1078
1079size_t StackFrame::ByteSizeLong() const {
1080// @@protoc_insertion_point(message_byte_size_start:mozilla.devtools.protobuf.StackFrame)
1081 size_t total_size = 0;
1082
1083 uint32_t cached_has_bits = 0;
1084 // Prevent compiler warnings about cached_has_bits being unused
1085 (void) cached_has_bits;
1086
1087 switch (StackFrameType_case()) {
1088 // .mozilla.devtools.protobuf.StackFrame.Data data = 1;
1089 case kData: {
1090 total_size += 1 +
1091 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
1092 *_impl_.StackFrameType_.data_);
1093 break;
1094 }
1095 // uint64 ref = 2;
1096 case kRef: {
1097 total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_ref());
1098 break;
1099 }
1100 case STACKFRAMETYPE_NOT_SET: {
1101 break;
1102 }
1103 }
1104 if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
1105 total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
1106 }
1107 int cached_size = ::_pbi::ToCachedSize(total_size);
1108 SetCachedSize(cached_size);
1109 return total_size;
1110}
1111
1112void StackFrame::CheckTypeAndMergeFrom(
1113 const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
1114 MergeFrom(*::_pbi::DownCast<const StackFrame*>(
1115 &from));
1116}
1117
1118void StackFrame::MergeFrom(const StackFrame& from) {
1119 StackFrame* const _this = this;
1120 // @@protoc_insertion_point(class_specific_merge_from_start:mozilla.devtools.protobuf.StackFrame)
1121 GOOGLE_DCHECK_NE(&from, _this)!(!((&from) != (_this))) ? (void)0 : ::google::protobuf::
internal::LogFinisher() = ::google::protobuf::internal::LogMessage
( ::google::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/devtools/shared/heapsnapshot/CoreDump.pb.cc"
, 1121) << "CHECK failed: " "(&from) != (_this)" ": "
;
1122 uint32_t cached_has_bits = 0;
1123 (void) cached_has_bits;
1124
1125 switch (from.StackFrameType_case()) {
1126 case kData: {
1127 _this->_internal_mutable_data()->::mozilla::devtools::protobuf::StackFrame_Data::MergeFrom(
1128 from._internal_data());
1129 break;
1130 }
1131 case kRef: {
1132 _this->_internal_set_ref(from._internal_ref());
1133 break;
1134 }
1135 case STACKFRAMETYPE_NOT_SET: {
1136 break;
1137 }
1138 }
1139 _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
1140}
1141
1142void StackFrame::CopyFrom(const StackFrame& from) {
1143// @@protoc_insertion_point(class_specific_copy_from_start:mozilla.devtools.protobuf.StackFrame)
1144 if (&from == this) return;
1145 Clear();
1146 MergeFrom(from);
1147}
1148
1149bool StackFrame::IsInitialized() const {
1150 return true;
1151}
1152
1153void StackFrame::InternalSwap(StackFrame* other) {
1154 using std::swap;
1155 _internal_metadata_.InternalSwap(&other->_internal_metadata_);
1156 swap(_impl_.StackFrameType_, other->_impl_.StackFrameType_);
1157 swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]);
1158}
1159
1160std::string StackFrame::GetTypeName() const {
1161 return "mozilla.devtools.protobuf.StackFrame";
1162}
1163
1164
1165// ===================================================================
1166
1167class Node::_Internal {
1168 public:
1169 using HasBits = decltype(std::declval<Node>()._impl_._has_bits_);
1170 static void set_has_id(HasBits* has_bits) {
1171 (*has_bits)[0] |= 2u;
1172 }
1173 static void set_has_size(HasBits* has_bits) {
1174 (*has_bits)[0] |= 4u;
1175 }
1176 static const ::mozilla::devtools::protobuf::StackFrame& allocationstack(const Node* msg);
1177 static void set_has_allocationstack(HasBits* has_bits) {
1178 (*has_bits)[0] |= 1u;
1179 }
1180 static void set_has_coarsetype(HasBits* has_bits) {
1181 (*has_bits)[0] |= 8u;
1182 }
1183};
1184
1185const ::mozilla::devtools::protobuf::StackFrame&
1186Node::_Internal::allocationstack(const Node* msg) {
1187 return *msg->_impl_.allocationstack_;
1188}
1189Node::Node(::PROTOBUF_NAMESPACE_ID::Arena* arena,
1190 bool is_message_owned)
1191 : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
1192 SharedCtor(arena, is_message_owned);
1193 // @@protoc_insertion_point(arena_constructor:mozilla.devtools.protobuf.Node)
1194}
1195Node::Node(const Node& from)
1196 : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
1197 Node* const _this = this; (void)_this;
1198 new (&_impl_) Impl_{
1199 decltype(_impl_._has_bits_){from._impl_._has_bits_}
1200 , /*decltype(_impl_._cached_size_)*/{}
1201 , decltype(_impl_.edges_){from._impl_.edges_}
1202 , decltype(_impl_.allocationstack_){nullptr}
1203 , decltype(_impl_.id_){}
1204 , decltype(_impl_.size_){}
1205 , decltype(_impl_.coarsetype_){}
1206 , decltype(_impl_.TypeNameOrRef_){}
1207 , decltype(_impl_.JSObjectClassNameOrRef_){}
1208 , decltype(_impl_.ScriptFilenameOrRef_){}
1209 , decltype(_impl_.descriptiveTypeNameOrRef_){}
1210 , /*decltype(_impl_._oneof_case_)*/{}};
1211
1212 _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
1213 if (from._internal_has_allocationstack()) {
1214 _this->_impl_.allocationstack_ = new ::mozilla::devtools::protobuf::StackFrame(*from._impl_.allocationstack_);
1215 }
1216 ::memcpy(&_impl_.id_, &from._impl_.id_,
1217 static_cast<size_t>(reinterpret_cast<char*>(&_impl_.coarsetype_) -
1218 reinterpret_cast<char*>(&_impl_.id_)) + sizeof(_impl_.coarsetype_));
1219 clear_has_TypeNameOrRef();
1220 switch (from.TypeNameOrRef_case()) {
1221 case kTypeName: {
1222 _this->_internal_set_typename_(from._internal_typename_());
1223 break;
1224 }
1225 case kTypeNameRef: {
1226 _this->_internal_set_typenameref(from._internal_typenameref());
1227 break;
1228 }
1229 case TYPENAMEORREF_NOT_SET: {
1230 break;
1231 }
1232 }
1233 clear_has_JSObjectClassNameOrRef();
1234 switch (from.JSObjectClassNameOrRef_case()) {
1235 case kJsObjectClassName: {
1236 _this->_internal_set_jsobjectclassname(from._internal_jsobjectclassname());
1237 break;
1238 }
1239 case kJsObjectClassNameRef: {
1240 _this->_internal_set_jsobjectclassnameref(from._internal_jsobjectclassnameref());
1241 break;
1242 }
1243 case JSOBJECTCLASSNAMEORREF_NOT_SET: {
1244 break;
1245 }
1246 }
1247 clear_has_ScriptFilenameOrRef();
1248 switch (from.ScriptFilenameOrRef_case()) {
1249 case kScriptFilename: {
1250 _this->_internal_set_scriptfilename(from._internal_scriptfilename());
1251 break;
1252 }
1253 case kScriptFilenameRef: {
1254 _this->_internal_set_scriptfilenameref(from._internal_scriptfilenameref());
1255 break;
1256 }
1257 case SCRIPTFILENAMEORREF_NOT_SET: {
1258 break;
1259 }
1260 }
1261 clear_has_descriptiveTypeNameOrRef();
1262 switch (from.descriptiveTypeNameOrRef_case()) {
1263 case kDescriptiveTypeName: {
1264 _this->_internal_set_descriptivetypename(from._internal_descriptivetypename());
1265 break;
1266 }
1267 case kDescriptiveTypeNameRef: {
1268 _this->_internal_set_descriptivetypenameref(from._internal_descriptivetypenameref());
1269 break;
1270 }
1271 case DESCRIPTIVETYPENAMEORREF_NOT_SET: {
1272 break;
1273 }
1274 }
1275 // @@protoc_insertion_point(copy_constructor:mozilla.devtools.protobuf.Node)
1276}
1277
1278inline void Node::SharedCtor(
1279 ::_pb::Arena* arena, bool is_message_owned) {
1280 (void)arena;
1281 (void)is_message_owned;
1282 new (&_impl_) Impl_{
1283 decltype(_impl_._has_bits_){}
1284 , /*decltype(_impl_._cached_size_)*/{}
1285 , decltype(_impl_.edges_){arena}
1286 , decltype(_impl_.allocationstack_){nullptr}
1287 , decltype(_impl_.id_){uint64_t{0u}}
1288 , decltype(_impl_.size_){uint64_t{0u}}
1289 , decltype(_impl_.coarsetype_){0u}
1290 , decltype(_impl_.TypeNameOrRef_){}
1291 , decltype(_impl_.JSObjectClassNameOrRef_){}
1292 , decltype(_impl_.ScriptFilenameOrRef_){}
1293 , decltype(_impl_.descriptiveTypeNameOrRef_){}
1294 , /*decltype(_impl_._oneof_case_)*/{}
1295 };
1296 clear_has_TypeNameOrRef();
1297 clear_has_JSObjectClassNameOrRef();
1298 clear_has_ScriptFilenameOrRef();
1299 clear_has_descriptiveTypeNameOrRef();
1300}
1301
1302Node::~Node() {
1303 // @@protoc_insertion_point(destructor:mozilla.devtools.protobuf.Node)
1304 if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
1305 (void)arena;
1306 return;
1307 }
1308 SharedDtor();
1309}
1310
1311inline void Node::SharedDtor() {
1312 GOOGLE_DCHECK(GetArenaForAllocation() == nullptr)!(!(GetArenaForAllocation() == nullptr)) ? (void)0 : ::google
::protobuf::internal::LogFinisher() = ::google::protobuf::internal
::LogMessage( ::google::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/devtools/shared/heapsnapshot/CoreDump.pb.cc"
, 1312) << "CHECK failed: " "GetArenaForAllocation() == nullptr"
": "
;
1313 _impl_.edges_.~RepeatedPtrField();
1314 if (this != internal_default_instance()) delete _impl_.allocationstack_;
1315 if (has_TypeNameOrRef()) {
1316 clear_TypeNameOrRef();
1317 }
1318 if (has_JSObjectClassNameOrRef()) {
1319 clear_JSObjectClassNameOrRef();
1320 }
1321 if (has_ScriptFilenameOrRef()) {
1322 clear_ScriptFilenameOrRef();
1323 }
1324 if (has_descriptiveTypeNameOrRef()) {
1325 clear_descriptiveTypeNameOrRef();
1326 }
1327}
1328
1329void Node::SetCachedSize(int size) const {
1330 _impl_._cached_size_.Set(size);
1331}
1332
1333void Node::clear_TypeNameOrRef() {
1334// @@protoc_insertion_point(one_of_clear_start:mozilla.devtools.protobuf.Node)
1335 switch (TypeNameOrRef_case()) {
1336 case kTypeName: {
1337 _impl_.TypeNameOrRef_.typename__.Destroy();
1338 break;
1339 }
1340 case kTypeNameRef: {
1341 // No need to clear
1342 break;
1343 }
1344 case TYPENAMEORREF_NOT_SET: {
1345 break;
1346 }
1347 }
1348 _impl_._oneof_case_[0] = TYPENAMEORREF_NOT_SET;
1349}
1350
1351void Node::clear_JSObjectClassNameOrRef() {
1352// @@protoc_insertion_point(one_of_clear_start:mozilla.devtools.protobuf.Node)
1353 switch (JSObjectClassNameOrRef_case()) {
1354 case kJsObjectClassName: {
1355 _impl_.JSObjectClassNameOrRef_.jsobjectclassname_.Destroy();
1356 break;
1357 }
1358 case kJsObjectClassNameRef: {
1359 // No need to clear
1360 break;
1361 }
1362 case JSOBJECTCLASSNAMEORREF_NOT_SET: {
1363 break;
1364 }
1365 }
1366 _impl_._oneof_case_[1] = JSOBJECTCLASSNAMEORREF_NOT_SET;
1367}
1368
1369void Node::clear_ScriptFilenameOrRef() {
1370// @@protoc_insertion_point(one_of_clear_start:mozilla.devtools.protobuf.Node)
1371 switch (ScriptFilenameOrRef_case()) {
1372 case kScriptFilename: {
1373 _impl_.ScriptFilenameOrRef_.scriptfilename_.Destroy();
1374 break;
1375 }
1376 case kScriptFilenameRef: {
1377 // No need to clear
1378 break;
1379 }
1380 case SCRIPTFILENAMEORREF_NOT_SET: {
1381 break;
1382 }
1383 }
1384 _impl_._oneof_case_[2] = SCRIPTFILENAMEORREF_NOT_SET;
1385}
1386
1387void Node::clear_descriptiveTypeNameOrRef() {
1388// @@protoc_insertion_point(one_of_clear_start:mozilla.devtools.protobuf.Node)
1389 switch (descriptiveTypeNameOrRef_case()) {
1390 case kDescriptiveTypeName: {
1391 _impl_.descriptiveTypeNameOrRef_.descriptivetypename_.Destroy();
1392 break;
1393 }
1394 case kDescriptiveTypeNameRef: {
1395 // No need to clear
1396 break;
1397 }
1398 case DESCRIPTIVETYPENAMEORREF_NOT_SET: {
1399 break;
1400 }
1401 }
1402 _impl_._oneof_case_[3] = DESCRIPTIVETYPENAMEORREF_NOT_SET;
1403}
1404
1405
1406void Node::Clear() {
1407// @@protoc_insertion_point(message_clear_start:mozilla.devtools.protobuf.Node)
1408 uint32_t cached_has_bits = 0;
1409 // Prevent compiler warnings about cached_has_bits being unused
1410 (void) cached_has_bits;
1411
1412 _impl_.edges_.Clear();
1413 cached_has_bits = _impl_._has_bits_[0];
1414 if (cached_has_bits & 0x00000001u) {
1415 GOOGLE_DCHECK(_impl_.allocationstack_ != nullptr)!(!(_impl_.allocationstack_ != nullptr)) ? (void)0 : ::google
::protobuf::internal::LogFinisher() = ::google::protobuf::internal
::LogMessage( ::google::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/devtools/shared/heapsnapshot/CoreDump.pb.cc"
, 1415) << "CHECK failed: " "_impl_.allocationstack_ != nullptr"
": "
;
1416 _impl_.allocationstack_->Clear();
1417 }
1418 if (cached_has_bits & 0x0000000eu) {
1419 ::memset(&_impl_.id_, 0, static_cast<size_t>(
1420 reinterpret_cast<char*>(&_impl_.coarsetype_) -
1421 reinterpret_cast<char*>(&_impl_.id_)) + sizeof(_impl_.coarsetype_));
1422 }
1423 clear_TypeNameOrRef();
1424 clear_JSObjectClassNameOrRef();
1425 clear_ScriptFilenameOrRef();
1426 clear_descriptiveTypeNameOrRef();
1427 _impl_._has_bits_.Clear();
1428 _internal_metadata_.Clear<std::string>();
1429}
1430
1431const char* Node::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
1432#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
1433 _Internal::HasBits has_bits{};
1434 while (!ctx->Done(&ptr)) {
1435 uint32_t tag;
1436 ptr = ::_pbi::ReadTag(ptr, &tag);
1437 switch (tag >> 3) {
1438 // optional uint64 id = 1;
1439 case 1:
1440 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
1441 _Internal::set_has_id(&has_bits);
1442 _impl_.id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
1443 CHK_(ptr);
1444 } else
1445 goto handle_unusual;
1446 continue;
1447 // bytes typeName = 2;
1448 case 2:
1449 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
1450 auto str = _internal_mutable_typename_();
1451 ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
1452 CHK_(ptr);
1453 } else
1454 goto handle_unusual;
1455 continue;
1456 // uint64 typeNameRef = 3;
1457 case 3:
1458 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
1459 _internal_set_typenameref(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
1460 CHK_(ptr);
1461 } else
1462 goto handle_unusual;
1463 continue;
1464 // optional uint64 size = 4;
1465 case 4:
1466 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) {
1467 _Internal::set_has_size(&has_bits);
1468 _impl_.size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
1469 CHK_(ptr);
1470 } else
1471 goto handle_unusual;
1472 continue;
1473 // repeated .mozilla.devtools.protobuf.Edge edges = 5;
1474 case 5:
1475 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
1476 ptr -= 1;
1477 do {
1478 ptr += 1;
1479 ptr = ctx->ParseMessage(_internal_add_edges(), ptr);
1480 CHK_(ptr);
1481 if (!ctx->DataAvailable(ptr)) break;
1482 } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<42>(ptr));
1483 } else
1484 goto handle_unusual;
1485 continue;
1486 // optional .mozilla.devtools.protobuf.StackFrame allocationStack = 6;
1487 case 6:
1488 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
1489 ptr = ctx->ParseMessage(_internal_mutable_allocationstack(), ptr);
1490 CHK_(ptr);
1491 } else
1492 goto handle_unusual;
1493 continue;
1494 // bytes jsObjectClassName = 7;
1495 case 7:
1496 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
1497 auto str = _internal_mutable_jsobjectclassname();
1498 ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
1499 CHK_(ptr);
1500 } else
1501 goto handle_unusual;
1502 continue;
1503 // uint64 jsObjectClassNameRef = 8;
1504 case 8:
1505 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 64)) {
1506 _internal_set_jsobjectclassnameref(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
1507 CHK_(ptr);
1508 } else
1509 goto handle_unusual;
1510 continue;
1511 // optional uint32 coarseType = 9 [default = 0];
1512 case 9:
1513 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 72)) {
1514 _Internal::set_has_coarsetype(&has_bits);
1515 _impl_.coarsetype_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
1516 CHK_(ptr);
1517 } else
1518 goto handle_unusual;
1519 continue;
1520 // bytes scriptFilename = 10;
1521 case 10:
1522 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 82)) {
1523 auto str = _internal_mutable_scriptfilename();
1524 ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
1525 CHK_(ptr);
1526 } else
1527 goto handle_unusual;
1528 continue;
1529 // uint64 scriptFilenameRef = 11;
1530 case 11:
1531 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 88)) {
1532 _internal_set_scriptfilenameref(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
1533 CHK_(ptr);
1534 } else
1535 goto handle_unusual;
1536 continue;
1537 // bytes descriptiveTypeName = 12;
1538 case 12:
1539 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 98)) {
1540 auto str = _internal_mutable_descriptivetypename();
1541 ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
1542 CHK_(ptr);
1543 } else
1544 goto handle_unusual;
1545 continue;
1546 // uint64 descriptiveTypeNameRef = 13;
1547 case 13:
1548 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 104)) {
1549 _internal_set_descriptivetypenameref(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
1550 CHK_(ptr);
1551 } else
1552 goto handle_unusual;
1553 continue;
1554 default:
1555 goto handle_unusual;
1556 } // switch
1557 handle_unusual:
1558 if ((tag == 0) || ((tag & 7) == 4)) {
1559 CHK_(ptr);
1560 ctx->SetLastTag(tag);
1561 goto message_done;
1562 }
1563 ptr = UnknownFieldParse(
1564 tag,
1565 _internal_metadata_.mutable_unknown_fields<std::string>(),
1566 ptr, ctx);
1567 CHK_(ptr != nullptr);
1568 } // while
1569message_done:
1570 _impl_._has_bits_.Or(has_bits);
1571 return ptr;
1572failure:
1573 ptr = nullptr;
1574 goto message_done;
1575#undef CHK_
1576}
1577
1578uint8_t* Node::_InternalSerialize(
1579 uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
1580 // @@protoc_insertion_point(serialize_to_array_start:mozilla.devtools.protobuf.Node)
1581 uint32_t cached_has_bits = 0;
1582 (void) cached_has_bits;
1583
1584 cached_has_bits = _impl_._has_bits_[0];
1585 // optional uint64 id = 1;
1586 if (cached_has_bits & 0x00000002u) {
1587 target = stream->EnsureSpace(target);
1588 target = ::_pbi::WireFormatLite::WriteUInt64ToArray(1, this->_internal_id(), target);
1589 }
1590
1591 switch (TypeNameOrRef_case()) {
1592 case kTypeName: {
1593 target = stream->WriteBytesMaybeAliased(
1594 2, this->_internal_typename_(), target);
1595 break;
1596 }
1597 case kTypeNameRef: {
1598 target = stream->EnsureSpace(target);
1599 target = ::_pbi::WireFormatLite::WriteUInt64ToArray(3, this->_internal_typenameref(), target);
1600 break;
1601 }
1602 default: ;
1603 }
1604 // optional uint64 size = 4;
1605 if (cached_has_bits & 0x00000004u) {
1606 target = stream->EnsureSpace(target);
1607 target = ::_pbi::WireFormatLite::WriteUInt64ToArray(4, this->_internal_size(), target);
1608 }
1609
1610 // repeated .mozilla.devtools.protobuf.Edge edges = 5;
1611 for (unsigned i = 0,
1612 n = static_cast<unsigned>(this->_internal_edges_size()); i < n; i++) {
1613 const auto& repfield = this->_internal_edges(i);
1614 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
1615 InternalWriteMessage(5, repfield, repfield.GetCachedSize(), target, stream);
1616 }
1617
1618 // optional .mozilla.devtools.protobuf.StackFrame allocationStack = 6;
1619 if (cached_has_bits & 0x00000001u) {
1620 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
1621 InternalWriteMessage(6, _Internal::allocationstack(this),
1622 _Internal::allocationstack(this).GetCachedSize(), target, stream);
1623 }
1624
1625 switch (JSObjectClassNameOrRef_case()) {
1626 case kJsObjectClassName: {
1627 target = stream->WriteBytesMaybeAliased(
1628 7, this->_internal_jsobjectclassname(), target);
1629 break;
1630 }
1631 case kJsObjectClassNameRef: {
1632 target = stream->EnsureSpace(target);
1633 target = ::_pbi::WireFormatLite::WriteUInt64ToArray(8, this->_internal_jsobjectclassnameref(), target);
1634 break;
1635 }
1636 default: ;
1637 }
1638 // optional uint32 coarseType = 9 [default = 0];
1639 if (cached_has_bits & 0x00000008u) {
1640 target = stream->EnsureSpace(target);
1641 target = ::_pbi::WireFormatLite::WriteUInt32ToArray(9, this->_internal_coarsetype(), target);
1642 }
1643
1644 switch (ScriptFilenameOrRef_case()) {
1645 case kScriptFilename: {
1646 target = stream->WriteBytesMaybeAliased(
1647 10, this->_internal_scriptfilename(), target);
1648 break;
1649 }
1650 case kScriptFilenameRef: {
1651 target = stream->EnsureSpace(target);
1652 target = ::_pbi::WireFormatLite::WriteUInt64ToArray(11, this->_internal_scriptfilenameref(), target);
1653 break;
1654 }
1655 default: ;
1656 }
1657 switch (descriptiveTypeNameOrRef_case()) {
1658 case kDescriptiveTypeName: {
1659 target = stream->WriteBytesMaybeAliased(
1660 12, this->_internal_descriptivetypename(), target);
1661 break;
1662 }
1663 case kDescriptiveTypeNameRef: {
1664 target = stream->EnsureSpace(target);
1665 target = ::_pbi::WireFormatLite::WriteUInt64ToArray(13, this->_internal_descriptivetypenameref(), target);
1666 break;
1667 }
1668 default: ;
1669 }
1670 if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
1671 target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
1672 static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
1673 }
1674 // @@protoc_insertion_point(serialize_to_array_end:mozilla.devtools.protobuf.Node)
1675 return target;
1676}
1677
1678size_t Node::ByteSizeLong() const {
1679// @@protoc_insertion_point(message_byte_size_start:mozilla.devtools.protobuf.Node)
1680 size_t total_size = 0;
1681
1682 uint32_t cached_has_bits = 0;
1683 // Prevent compiler warnings about cached_has_bits being unused
1684 (void) cached_has_bits;
1685
1686 // repeated .mozilla.devtools.protobuf.Edge edges = 5;
1687 total_size += 1UL * this->_internal_edges_size();
1688 for (const auto& msg : this->_impl_.edges_) {
1689 total_size +=
1690 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
1691 }
1692
1693 cached_has_bits = _impl_._has_bits_[0];
1694 if (cached_has_bits & 0x0000000fu) {
1695 // optional .mozilla.devtools.protobuf.StackFrame allocationStack = 6;
1696 if (cached_has_bits & 0x00000001u) {
1697 total_size += 1 +
1698 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
1699 *_impl_.allocationstack_);
1700 }
1701
1702 // optional uint64 id = 1;
1703 if (cached_has_bits & 0x00000002u) {
1704 total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_id());
1705 }
1706
1707 // optional uint64 size = 4;
1708 if (cached_has_bits & 0x00000004u) {
1709 total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_size());
1710 }
1711
1712 // optional uint32 coarseType = 9 [default = 0];
1713 if (cached_has_bits & 0x00000008u) {
1714 total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_coarsetype());
1715 }
1716
1717 }
1718 switch (TypeNameOrRef_case()) {
1719 // bytes typeName = 2;
1720 case kTypeName: {
1721 total_size += 1 +
1722 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
1723 this->_internal_typename_());
1724 break;
1725 }
1726 // uint64 typeNameRef = 3;
1727 case kTypeNameRef: {
1728 total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_typenameref());
1729 break;
1730 }
1731 case TYPENAMEORREF_NOT_SET: {
1732 break;
1733 }
1734 }
1735 switch (JSObjectClassNameOrRef_case()) {
1736 // bytes jsObjectClassName = 7;
1737 case kJsObjectClassName: {
1738 total_size += 1 +
1739 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
1740 this->_internal_jsobjectclassname());
1741 break;
1742 }
1743 // uint64 jsObjectClassNameRef = 8;
1744 case kJsObjectClassNameRef: {
1745 total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_jsobjectclassnameref());
1746 break;
1747 }
1748 case JSOBJECTCLASSNAMEORREF_NOT_SET: {
1749 break;
1750 }
1751 }
1752 switch (ScriptFilenameOrRef_case()) {
1753 // bytes scriptFilename = 10;
1754 case kScriptFilename: {
1755 total_size += 1 +
1756 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
1757 this->_internal_scriptfilename());
1758 break;
1759 }
1760 // uint64 scriptFilenameRef = 11;
1761 case kScriptFilenameRef: {
1762 total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_scriptfilenameref());
1763 break;
1764 }
1765 case SCRIPTFILENAMEORREF_NOT_SET: {
1766 break;
1767 }
1768 }
1769 switch (descriptiveTypeNameOrRef_case()) {
1770 // bytes descriptiveTypeName = 12;
1771 case kDescriptiveTypeName: {
1772 total_size += 1 +
1773 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
1774 this->_internal_descriptivetypename());
1775 break;
1776 }
1777 // uint64 descriptiveTypeNameRef = 13;
1778 case kDescriptiveTypeNameRef: {
1779 total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_descriptivetypenameref());
1780 break;
1781 }
1782 case DESCRIPTIVETYPENAMEORREF_NOT_SET: {
1783 break;
1784 }
1785 }
1786 if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
1787 total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
1788 }
1789 int cached_size = ::_pbi::ToCachedSize(total_size);
1790 SetCachedSize(cached_size);
1791 return total_size;
1792}
1793
1794void Node::CheckTypeAndMergeFrom(
1795 const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
1796 MergeFrom(*::_pbi::DownCast<const Node*>(
1797 &from));
1798}
1799
1800void Node::MergeFrom(const Node& from) {
1801 Node* const _this = this;
1802 // @@protoc_insertion_point(class_specific_merge_from_start:mozilla.devtools.protobuf.Node)
1803 GOOGLE_DCHECK_NE(&from, _this)!(!((&from) != (_this))) ? (void)0 : ::google::protobuf::
internal::LogFinisher() = ::google::protobuf::internal::LogMessage
( ::google::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/devtools/shared/heapsnapshot/CoreDump.pb.cc"
, 1803) << "CHECK failed: " "(&from) != (_this)" ": "
;
1804 uint32_t cached_has_bits = 0;
1805 (void) cached_has_bits;
1806
1807 _this->_impl_.edges_.MergeFrom(from._impl_.edges_);
1808 cached_has_bits = from._impl_._has_bits_[0];
1809 if (cached_has_bits & 0x0000000fu) {
1810 if (cached_has_bits & 0x00000001u) {
1811 _this->_internal_mutable_allocationstack()->::mozilla::devtools::protobuf::StackFrame::MergeFrom(
1812 from._internal_allocationstack());
1813 }
1814 if (cached_has_bits & 0x00000002u) {
1815 _this->_impl_.id_ = from._impl_.id_;
1816 }
1817 if (cached_has_bits & 0x00000004u) {
1818 _this->_impl_.size_ = from._impl_.size_;
1819 }
1820 if (cached_has_bits & 0x00000008u) {
1821 _this->_impl_.coarsetype_ = from._impl_.coarsetype_;
1822 }
1823 _this->_impl_._has_bits_[0] |= cached_has_bits;
1824 }
1825 switch (from.TypeNameOrRef_case()) {
1826 case kTypeName: {
1827 _this->_internal_set_typename_(from._internal_typename_());
1828 break;
1829 }
1830 case kTypeNameRef: {
1831 _this->_internal_set_typenameref(from._internal_typenameref());
1832 break;
1833 }
1834 case TYPENAMEORREF_NOT_SET: {
1835 break;
1836 }
1837 }
1838 switch (from.JSObjectClassNameOrRef_case()) {
1839 case kJsObjectClassName: {
1840 _this->_internal_set_jsobjectclassname(from._internal_jsobjectclassname());
1841 break;
1842 }
1843 case kJsObjectClassNameRef: {
1844 _this->_internal_set_jsobjectclassnameref(from._internal_jsobjectclassnameref());
1845 break;
1846 }
1847 case JSOBJECTCLASSNAMEORREF_NOT_SET: {
1848 break;
1849 }
1850 }
1851 switch (from.ScriptFilenameOrRef_case()) {
1852 case kScriptFilename: {
1853 _this->_internal_set_scriptfilename(from._internal_scriptfilename());
1854 break;
1855 }
1856 case kScriptFilenameRef: {
1857 _this->_internal_set_scriptfilenameref(from._internal_scriptfilenameref());
1858 break;
1859 }
1860 case SCRIPTFILENAMEORREF_NOT_SET: {
1861 break;
1862 }
1863 }
1864 switch (from.descriptiveTypeNameOrRef_case()) {
1865 case kDescriptiveTypeName: {
1866 _this->_internal_set_descriptivetypename(from._internal_descriptivetypename());
1867 break;
1868 }
1869 case kDescriptiveTypeNameRef: {
1870 _this->_internal_set_descriptivetypenameref(from._internal_descriptivetypenameref());
1871 break;
1872 }
1873 case DESCRIPTIVETYPENAMEORREF_NOT_SET: {
1874 break;
1875 }
1876 }
1877 _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
1878}
1879
1880void Node::CopyFrom(const Node& from) {
1881// @@protoc_insertion_point(class_specific_copy_from_start:mozilla.devtools.protobuf.Node)
1882 if (&from == this) return;
1883 Clear();
1884 MergeFrom(from);
1885}
1886
1887bool Node::IsInitialized() const {
1888 return true;
1889}
1890
1891void Node::InternalSwap(Node* other) {
1892 using std::swap;
1893 _internal_metadata_.InternalSwap(&other->_internal_metadata_);
1894 swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
1895 _impl_.edges_.InternalSwap(&other->_impl_.edges_);
1896 ::PROTOBUF_NAMESPACE_ID::internal::memswap<
1897 PROTOBUF_FIELD_OFFSET(Node, _impl_.coarsetype_)
1898 + sizeof(Node::_impl_.coarsetype_)
1899 - PROTOBUF_FIELD_OFFSET(Node, _impl_.allocationstack_)>(
1900 reinterpret_cast<char*>(&_impl_.allocationstack_),
1901 reinterpret_cast<char*>(&other->_impl_.allocationstack_));
1902 swap(_impl_.TypeNameOrRef_, other->_impl_.TypeNameOrRef_);
1903 swap(_impl_.JSObjectClassNameOrRef_, other->_impl_.JSObjectClassNameOrRef_);
1904 swap(_impl_.ScriptFilenameOrRef_, other->_impl_.ScriptFilenameOrRef_);
1905 swap(_impl_.descriptiveTypeNameOrRef_, other->_impl_.descriptiveTypeNameOrRef_);
1906 swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]);
1907 swap(_impl_._oneof_case_[1], other->_impl_._oneof_case_[1]);
1908 swap(_impl_._oneof_case_[2], other->_impl_._oneof_case_[2]);
1909 swap(_impl_._oneof_case_[3], other->_impl_._oneof_case_[3]);
1910}
1911
1912std::string Node::GetTypeName() const {
1913 return "mozilla.devtools.protobuf.Node";
1914}
1915
1916
1917// ===================================================================
1918
1919class Edge::_Internal {
1920 public:
1921 using HasBits = decltype(std::declval<Edge>()._impl_._has_bits_);
1922 static void set_has_referent(HasBits* has_bits) {
1923 (*has_bits)[0] |= 1u;
1924 }
1925};
1926
1927Edge::Edge(::PROTOBUF_NAMESPACE_ID::Arena* arena,
1928 bool is_message_owned)
1929 : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
1930 SharedCtor(arena, is_message_owned);
1931 // @@protoc_insertion_point(arena_constructor:mozilla.devtools.protobuf.Edge)
1932}
1933Edge::Edge(const Edge& from)
1934 : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
1935 Edge* const _this = this; (void)_this;
1936 new (&_impl_) Impl_{
1937 decltype(_impl_._has_bits_){from._impl_._has_bits_}
1938 , /*decltype(_impl_._cached_size_)*/{}
1939 , decltype(_impl_.referent_){}
1940 , decltype(_impl_.EdgeNameOrRef_){}
1941 , /*decltype(_impl_._oneof_case_)*/{}};
1942
1943 _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
1944 _this->_impl_.referent_ = from._impl_.referent_;
1945 clear_has_EdgeNameOrRef();
1946 switch (from.EdgeNameOrRef_case()) {
1947 case kName: {
1948 _this->_internal_set_name(from._internal_name());
1949 break;
1950 }
1951 case kNameRef: {
1952 _this->_internal_set_nameref(from._internal_nameref());
1953 break;
1954 }
1955 case EDGENAMEORREF_NOT_SET: {
1956 break;
1957 }
1958 }
1959 // @@protoc_insertion_point(copy_constructor:mozilla.devtools.protobuf.Edge)
1960}
1961
1962inline void Edge::SharedCtor(
1963 ::_pb::Arena* arena, bool is_message_owned) {
1964 (void)arena;
1965 (void)is_message_owned;
1966 new (&_impl_) Impl_{
1967 decltype(_impl_._has_bits_){}
1968 , /*decltype(_impl_._cached_size_)*/{}
1969 , decltype(_impl_.referent_){uint64_t{0u}}
1970 , decltype(_impl_.EdgeNameOrRef_){}
1971 , /*decltype(_impl_._oneof_case_)*/{}
1972 };
1973 clear_has_EdgeNameOrRef();
1974}
1975
1976Edge::~Edge() {
1977 // @@protoc_insertion_point(destructor:mozilla.devtools.protobuf.Edge)
1978 if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
1979 (void)arena;
1980 return;
1981 }
1982 SharedDtor();
1983}
1984
1985inline void Edge::SharedDtor() {
1986 GOOGLE_DCHECK(GetArenaForAllocation() == nullptr)!(!(GetArenaForAllocation() == nullptr)) ? (void)0 : ::google
::protobuf::internal::LogFinisher() = ::google::protobuf::internal
::LogMessage( ::google::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/devtools/shared/heapsnapshot/CoreDump.pb.cc"
, 1986) << "CHECK failed: " "GetArenaForAllocation() == nullptr"
": "
;
1987 if (has_EdgeNameOrRef()) {
1988 clear_EdgeNameOrRef();
1989 }
1990}
1991
1992void Edge::SetCachedSize(int size) const {
1993 _impl_._cached_size_.Set(size);
1994}
1995
1996void Edge::clear_EdgeNameOrRef() {
1997// @@protoc_insertion_point(one_of_clear_start:mozilla.devtools.protobuf.Edge)
1998 switch (EdgeNameOrRef_case()) {
1999 case kName: {
2000 _impl_.EdgeNameOrRef_.name_.Destroy();
2001 break;
2002 }
2003 case kNameRef: {
2004 // No need to clear
2005 break;
2006 }
2007 case EDGENAMEORREF_NOT_SET: {
2008 break;
2009 }
2010 }
2011 _impl_._oneof_case_[0] = EDGENAMEORREF_NOT_SET;
2012}
2013
2014
2015void Edge::Clear() {
2016// @@protoc_insertion_point(message_clear_start:mozilla.devtools.protobuf.Edge)
2017 uint32_t cached_has_bits = 0;
2018 // Prevent compiler warnings about cached_has_bits being unused
2019 (void) cached_has_bits;
2020
2021 _impl_.referent_ = uint64_t{0u};
2022 clear_EdgeNameOrRef();
2023 _impl_._has_bits_.Clear();
2024 _internal_metadata_.Clear<std::string>();
2025}
2026
2027const char* Edge::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
2028#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
2029 _Internal::HasBits has_bits{};
2030 while (!ctx->Done(&ptr)) {
1
Calling 'ParseContext::Done'
2031 uint32_t tag;
2032 ptr = ::_pbi::ReadTag(ptr, &tag);
2033 switch (tag >> 3) {
2034 // optional uint64 referent = 1;
2035 case 1:
2036 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
2037 _Internal::set_has_referent(&has_bits);
2038 _impl_.referent_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
2039 CHK_(ptr);
2040 } else
2041 goto handle_unusual;
2042 continue;
2043 // bytes name = 2;
2044 case 2:
2045 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
2046 auto str = _internal_mutable_name();
2047 ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
2048 CHK_(ptr);
2049 } else
2050 goto handle_unusual;
2051 continue;
2052 // uint64 nameRef = 3;
2053 case 3:
2054 if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
2055 _internal_set_nameref(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
2056 CHK_(ptr);
2057 } else
2058 goto handle_unusual;
2059 continue;
2060 default:
2061 goto handle_unusual;
2062 } // switch
2063 handle_unusual:
2064 if ((tag == 0) || ((tag & 7) == 4)) {
2065 CHK_(ptr);
2066 ctx->SetLastTag(tag);
2067 goto message_done;
2068 }
2069 ptr = UnknownFieldParse(
2070 tag,
2071 _internal_metadata_.mutable_unknown_fields<std::string>(),
2072 ptr, ctx);
2073 CHK_(ptr != nullptr);
2074 } // while
2075message_done:
2076 _impl_._has_bits_.Or(has_bits);
2077 return ptr;
2078failure:
2079 ptr = nullptr;
2080 goto message_done;
2081#undef CHK_
2082}
2083
2084uint8_t* Edge::_InternalSerialize(
2085 uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
2086 // @@protoc_insertion_point(serialize_to_array_start:mozilla.devtools.protobuf.Edge)
2087 uint32_t cached_has_bits = 0;
2088 (void) cached_has_bits;
2089
2090 cached_has_bits = _impl_._has_bits_[0];
2091 // optional uint64 referent = 1;
2092 if (cached_has_bits & 0x00000001u) {
2093 target = stream->EnsureSpace(target);
2094 target = ::_pbi::WireFormatLite::WriteUInt64ToArray(1, this->_internal_referent(), target);
2095 }
2096
2097 switch (EdgeNameOrRef_case()) {
2098 case kName: {
2099 target = stream->WriteBytesMaybeAliased(
2100 2, this->_internal_name(), target);
2101 break;
2102 }
2103 case kNameRef: {
2104 target = stream->EnsureSpace(target);
2105 target = ::_pbi::WireFormatLite::WriteUInt64ToArray(3, this->_internal_nameref(), target);
2106 break;
2107 }
2108 default: ;
2109 }
2110 if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
2111 target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
2112 static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
2113 }
2114 // @@protoc_insertion_point(serialize_to_array_end:mozilla.devtools.protobuf.Edge)
2115 return target;
2116}
2117
2118size_t Edge::ByteSizeLong() const {
2119// @@protoc_insertion_point(message_byte_size_start:mozilla.devtools.protobuf.Edge)
2120 size_t total_size = 0;
2121
2122 uint32_t cached_has_bits = 0;
2123 // Prevent compiler warnings about cached_has_bits being unused
2124 (void) cached_has_bits;
2125
2126 // optional uint64 referent = 1;
2127 cached_has_bits = _impl_._has_bits_[0];
2128 if (cached_has_bits & 0x00000001u) {
2129 total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_referent());
2130 }
2131
2132 switch (EdgeNameOrRef_case()) {
2133 // bytes name = 2;
2134 case kName: {
2135 total_size += 1 +
2136 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
2137 this->_internal_name());
2138 break;
2139 }
2140 // uint64 nameRef = 3;
2141 case kNameRef: {
2142 total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_nameref());
2143 break;
2144 }
2145 case EDGENAMEORREF_NOT_SET: {
2146 break;
2147 }
2148 }
2149 if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
2150 total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
2151 }
2152 int cached_size = ::_pbi::ToCachedSize(total_size);
2153 SetCachedSize(cached_size);
2154 return total_size;
2155}
2156
2157void Edge::CheckTypeAndMergeFrom(
2158 const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
2159 MergeFrom(*::_pbi::DownCast<const Edge*>(
2160 &from));
2161}
2162
2163void Edge::MergeFrom(const Edge& from) {
2164 Edge* const _this = this;
2165 // @@protoc_insertion_point(class_specific_merge_from_start:mozilla.devtools.protobuf.Edge)
2166 GOOGLE_DCHECK_NE(&from, _this)!(!((&from) != (_this))) ? (void)0 : ::google::protobuf::
internal::LogFinisher() = ::google::protobuf::internal::LogMessage
( ::google::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/devtools/shared/heapsnapshot/CoreDump.pb.cc"
, 2166) << "CHECK failed: " "(&from) != (_this)" ": "
;
2167 uint32_t cached_has_bits = 0;
2168 (void) cached_has_bits;
2169
2170 if (from._internal_has_referent()) {
2171 _this->_internal_set_referent(from._internal_referent());
2172 }
2173 switch (from.EdgeNameOrRef_case()) {
2174 case kName: {
2175 _this->_internal_set_name(from._internal_name());
2176 break;
2177 }
2178 case kNameRef: {
2179 _this->_internal_set_nameref(from._internal_nameref());
2180 break;
2181 }
2182 case EDGENAMEORREF_NOT_SET: {
2183 break;
2184 }
2185 }
2186 _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
2187}
2188
2189void Edge::CopyFrom(const Edge& from) {
2190// @@protoc_insertion_point(class_specific_copy_from_start:mozilla.devtools.protobuf.Edge)
2191 if (&from == this) return;
2192 Clear();
2193 MergeFrom(from);
2194}
2195
2196bool Edge::IsInitialized() const {
2197 return true;
2198}
2199
2200void Edge::InternalSwap(Edge* other) {
2201 using std::swap;
2202 _internal_metadata_.InternalSwap(&other->_internal_metadata_);
2203 swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
2204 swap(_impl_.referent_, other->_impl_.referent_);
2205 swap(_impl_.EdgeNameOrRef_, other->_impl_.EdgeNameOrRef_);
2206 swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]);
2207}
2208
2209std::string Edge::GetTypeName() const {
2210 return "mozilla.devtools.protobuf.Edge";
2211}
2212
2213
2214// @@protoc_insertion_point(namespace_scope)
2215} // namespace protobuf
2216} // namespace devtools
2217} // namespace mozilla
2218PROTOBUF_NAMESPACE_OPEN
2219template<> PROTOBUF_NOINLINE ::mozilla::devtools::protobuf::Metadata*
2220Arena::CreateMaybeMessage< ::mozilla::devtools::protobuf::Metadata >(Arena* arena) {
2221 return Arena::CreateMessageInternal< ::mozilla::devtools::protobuf::Metadata >(arena);
2222}
2223template<> PROTOBUF_NOINLINE ::mozilla::devtools::protobuf::StackFrame_Data*
2224Arena::CreateMaybeMessage< ::mozilla::devtools::protobuf::StackFrame_Data >(Arena* arena) {
2225 return Arena::CreateMessageInternal< ::mozilla::devtools::protobuf::StackFrame_Data >(arena);
2226}
2227template<> PROTOBUF_NOINLINE ::mozilla::devtools::protobuf::StackFrame*
2228Arena::CreateMaybeMessage< ::mozilla::devtools::protobuf::StackFrame >(Arena* arena) {
2229 return Arena::CreateMessageInternal< ::mozilla::devtools::protobuf::StackFrame >(arena);
2230}
2231template<> PROTOBUF_NOINLINE ::mozilla::devtools::protobuf::Node*
2232Arena::CreateMaybeMessage< ::mozilla::devtools::protobuf::Node >(Arena* arena) {
2233 return Arena::CreateMessageInternal< ::mozilla::devtools::protobuf::Node >(arena);
2234}
2235template<> PROTOBUF_NOINLINE ::mozilla::devtools::protobuf::Edge*
2236Arena::CreateMaybeMessage< ::mozilla::devtools::protobuf::Edge >(Arena* arena) {
2237 return Arena::CreateMessageInternal< ::mozilla::devtools::protobuf::Edge >(arena);
2238}
2239PROTOBUF_NAMESPACE_CLOSE
2240
2241// @@protoc_insertion_point(global_scope)
2242#include <google/protobuf/port_undef.inc>

/root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/google/protobuf/parse_context.h

1// Protocol Buffers - Google's data interchange format
2// Copyright 2008 Google Inc. All rights reserved.
3// https://developers.google.com/protocol-buffers/
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions are
7// met:
8//
9// * Redistributions of source code must retain the above copyright
10// notice, this list of conditions and the following disclaimer.
11// * Redistributions in binary form must reproduce the above
12// copyright notice, this list of conditions and the following disclaimer
13// in the documentation and/or other materials provided with the
14// distribution.
15// * Neither the name of Google Inc. nor the names of its
16// contributors may be used to endorse or promote products derived from
17// this software without specific prior written permission.
18//
19// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31#ifndef GOOGLE_PROTOBUF_PARSE_CONTEXT_H__
32#define GOOGLE_PROTOBUF_PARSE_CONTEXT_H__
33
34#include <cstdint>
35#include <cstring>
36#include <string>
37#include <type_traits>
38
39#include <google/protobuf/io/coded_stream.h>
40#include <google/protobuf/io/zero_copy_stream.h>
41#include <google/protobuf/arena.h>
42#include <google/protobuf/port.h>
43#include <google/protobuf/stubs/strutil.h>
44#include <google/protobuf/arenastring.h>
45#include <google/protobuf/endian.h>
46#include <google/protobuf/implicit_weak_message.h>
47#include <google/protobuf/inlined_string_field.h>
48#include <google/protobuf/metadata_lite.h>
49#include <google/protobuf/repeated_field.h>
50#include <google/protobuf/wire_format_lite.h>
51
52// Must be included last.
53#include <google/protobuf/port_def.inc>
54
55
56namespace google {
57namespace protobuf {
58
59class UnknownFieldSet;
60class DescriptorPool;
61class MessageFactory;
62
63namespace internal {
64
65// Template code below needs to know about the existence of these functions.
66PROTOBUF_EXPORT void WriteVarint(uint32_t num, uint64_t val, std::string* s);
67PROTOBUF_EXPORT void WriteLengthDelimited(uint32_t num, StringPiece val,
68 std::string* s);
69// Inline because it is just forwarding to s->WriteVarint
70inline void WriteVarint(uint32_t num, uint64_t val, UnknownFieldSet* s);
71inline void WriteLengthDelimited(uint32_t num, StringPiece val,
72 UnknownFieldSet* s);
73
74
75// The basic abstraction the parser is designed for is a slight modification
76// of the ZeroCopyInputStream (ZCIS) abstraction. A ZCIS presents a serialized
77// stream as a series of buffers that concatenate to the full stream.
78// Pictorially a ZCIS presents a stream in chunks like so
79// [---------------------------------------------------------------]
80// [---------------------] chunk 1
81// [----------------------------] chunk 2
82// chunk 3 [--------------]
83//
84// Where the '-' represent the bytes which are vertically lined up with the
85// bytes of the stream. The proto parser requires its input to be presented
86// similarly with the extra
87// property that each chunk has kSlopBytes past its end that overlaps with the
88// first kSlopBytes of the next chunk, or if there is no next chunk at least its
89// still valid to read those bytes. Again, pictorially, we now have
90//
91// [---------------------------------------------------------------]
92// [-------------------....] chunk 1
93// [------------------------....] chunk 2
94// chunk 3 [------------------..**]
95// chunk 4 [--****]
96// Here '-' mean the bytes of the stream or chunk and '.' means bytes past the
97// chunk that match up with the start of the next chunk. Above each chunk has
98// 4 '.' after the chunk. In the case these 'overflow' bytes represents bytes
99// past the stream, indicated by '*' above, their values are unspecified. It is
100// still legal to read them (ie. should not segfault). Reading past the
101// end should be detected by the user and indicated as an error.
102//
103// The reason for this, admittedly, unconventional invariant is to ruthlessly
104// optimize the protobuf parser. Having an overlap helps in two important ways.
105// Firstly it alleviates having to performing bounds checks if a piece of code
106// is guaranteed to not read more than kSlopBytes. Secondly, and more
107// importantly, the protobuf wireformat is such that reading a key/value pair is
108// always less than 16 bytes. This removes the need to change to next buffer in
109// the middle of reading primitive values. Hence there is no need to store and
110// load the current position.
111
112class PROTOBUF_EXPORT EpsCopyInputStream {
113 public:
114 enum { kSlopBytes = 16, kMaxCordBytesToCopy = 512 };
115
116 explicit EpsCopyInputStream(bool enable_aliasing)
117 : aliasing_(enable_aliasing ? kOnPatch : kNoAliasing) {}
118
119 void BackUp(const char* ptr) {
120 GOOGLE_DCHECK(ptr <= buffer_end_ + kSlopBytes)!(!(ptr <= buffer_end_ + kSlopBytes)) ? (void)0 : ::google
::protobuf::internal::LogFinisher() = ::google::protobuf::internal
::LogMessage( ::google::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/google/protobuf/parse_context.h"
, 120) << "CHECK failed: " "ptr <= buffer_end_ + kSlopBytes"
": "
;
121 int count;
122 if (next_chunk_ == buffer_) {
123 count = static_cast<int>(buffer_end_ + kSlopBytes - ptr);
124 } else {
125 count = size_ + static_cast<int>(buffer_end_ - ptr);
126 }
127 if (count > 0) StreamBackUp(count);
128 }
129
130 // If return value is negative it's an error
131 PROTOBUF_NODISCARD int PushLimit(const char* ptr, int limit) {
132 GOOGLE_DCHECK(limit >= 0 && limit <= INT_MAX - kSlopBytes)!(!(limit >= 0 && limit <= 2147483647 - kSlopBytes
)) ? (void)0 : ::google::protobuf::internal::LogFinisher() = ::
google::protobuf::internal::LogMessage( ::google::protobuf::LOGLEVEL_FATAL
, "/root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/google/protobuf/parse_context.h"
, 132) << "CHECK failed: " "limit >= 0 && limit <= INT_MAX - kSlopBytes"
": "
;
133 // This add is safe due to the invariant above, because
134 // ptr - buffer_end_ <= kSlopBytes.
135 limit += static_cast<int>(ptr - buffer_end_);
136 limit_end_ = buffer_end_ + (std::min)(0, limit);
137 auto old_limit = limit_;
138 limit_ = limit;
139 return old_limit - limit;
140 }
141
142 PROTOBUF_NODISCARD bool PopLimit(int delta) {
143 if (PROTOBUF_PREDICT_FALSE(!EndedAtLimit())) return false;
144 limit_ = limit_ + delta;
145 // TODO(gerbens) We could remove this line and hoist the code to
146 // DoneFallback. Study the perf/bin-size effects.
147 limit_end_ = buffer_end_ + (std::min)(0, limit_);
148 return true;
149 }
150
151 PROTOBUF_NODISCARD const char* Skip(const char* ptr, int size) {
152 if (size <= buffer_end_ + kSlopBytes - ptr) {
153 return ptr + size;
154 }
155 return SkipFallback(ptr, size);
156 }
157 PROTOBUF_NODISCARD const char* ReadString(const char* ptr, int size,
158 std::string* s) {
159 if (size <= buffer_end_ + kSlopBytes - ptr) {
160 s->assign(ptr, size);
161 return ptr + size;
162 }
163 return ReadStringFallback(ptr, size, s);
164 }
165 PROTOBUF_NODISCARD const char* AppendString(const char* ptr, int size,
166 std::string* s) {
167 if (size <= buffer_end_ + kSlopBytes - ptr) {
168 s->append(ptr, size);
169 return ptr + size;
170 }
171 return AppendStringFallback(ptr, size, s);
172 }
173 // Implemented in arenastring.cc
174 PROTOBUF_NODISCARD const char* ReadArenaString(const char* ptr,
175 ArenaStringPtr* s,
176 Arena* arena);
177
178 template <typename Tag, typename T>
179 PROTOBUF_NODISCARD const char* ReadRepeatedFixed(const char* ptr,
180 Tag expected_tag,
181 RepeatedField<T>* out);
182
183 template <typename T>
184 PROTOBUF_NODISCARD const char* ReadPackedFixed(const char* ptr, int size,
185 RepeatedField<T>* out);
186 template <typename Add>
187 PROTOBUF_NODISCARD const char* ReadPackedVarint(const char* ptr, Add add);
188
189 uint32_t LastTag() const { return last_tag_minus_1_ + 1; }
190 bool ConsumeEndGroup(uint32_t start_tag) {
191 bool res = last_tag_minus_1_ == start_tag;
192 last_tag_minus_1_ = 0;
193 return res;
194 }
195 bool EndedAtLimit() const { return last_tag_minus_1_ == 0; }
196 bool EndedAtEndOfStream() const { return last_tag_minus_1_ == 1; }
197 void SetLastTag(uint32_t tag) { last_tag_minus_1_ = tag - 1; }
198 void SetEndOfStream() { last_tag_minus_1_ = 1; }
199 bool IsExceedingLimit(const char* ptr) {
200 return ptr > limit_end_ &&
201 (next_chunk_ == nullptr || ptr - buffer_end_ > limit_);
202 }
203 bool AliasingEnabled() const { return aliasing_ != kNoAliasing; }
204 int BytesUntilLimit(const char* ptr) const {
205 return limit_ + static_cast<int>(buffer_end_ - ptr);
206 }
207 // Returns true if more data is available, if false is returned one has to
208 // call Done for further checks.
209 bool DataAvailable(const char* ptr) { return ptr < limit_end_; }
210
211 protected:
212 // Returns true is limit (either an explicit limit or end of stream) is
213 // reached. It aligns *ptr across buffer seams.
214 // If limit is exceeded it returns true and ptr is set to null.
215 bool DoneWithCheck(const char** ptr, int d) {
216 GOOGLE_DCHECK(*ptr)!(!(*ptr)) ? (void)0 : ::google::protobuf::internal::LogFinisher
() = ::google::protobuf::internal::LogMessage( ::google::protobuf
::LOGLEVEL_FATAL, "/root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/google/protobuf/parse_context.h"
, 216) << "CHECK failed: " "*ptr" ": "
;
3
Assuming pointer value is null
4
'?' condition is false
217 if (PROTOBUF_PREDICT_TRUE(*ptr < limit_end_)) return false;
5
Assuming the condition is false
6
Taking false branch
218 int overrun = static_cast<int>(*ptr - buffer_end_);
7
Subtraction of a null pointer and a probably non-null pointer (via field 'buffer_end_') may result in undefined behavior
219 GOOGLE_DCHECK_LE(overrun, kSlopBytes)!(!((overrun) <= (kSlopBytes))) ? (void)0 : ::google::protobuf
::internal::LogFinisher() = ::google::protobuf::internal::LogMessage
( ::google::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/google/protobuf/parse_context.h"
, 219) << "CHECK failed: " "(overrun) <= (kSlopBytes)"
": "
; // Guaranteed by parse loop.
220 if (overrun ==
221 limit_) { // No need to flip buffers if we ended on a limit.
222 // If we actually overrun the buffer and next_chunk_ is null. It means
223 // the stream ended and we passed the stream end.
224 if (overrun > 0 && next_chunk_ == nullptr) *ptr = nullptr;
225 return true;
226 }
227 auto res = DoneFallback(overrun, d);
228 *ptr = res.first;
229 return res.second;
230 }
231
232 const char* InitFrom(StringPiece flat) {
233 overall_limit_ = 0;
234 if (flat.size() > kSlopBytes) {
235 limit_ = kSlopBytes;
236 limit_end_ = buffer_end_ = flat.data() + flat.size() - kSlopBytes;
237 next_chunk_ = buffer_;
238 if (aliasing_ == kOnPatch) aliasing_ = kNoDelta;
239 return flat.data();
240 } else {
241 std::memcpy(buffer_, flat.data(), flat.size());
242 limit_ = 0;
243 limit_end_ = buffer_end_ = buffer_ + flat.size();
244 next_chunk_ = nullptr;
245 if (aliasing_ == kOnPatch) {
246 aliasing_ = reinterpret_cast<std::uintptr_t>(flat.data()) -
247 reinterpret_cast<std::uintptr_t>(buffer_);
248 }
249 return buffer_;
250 }
251 }
252
253 const char* InitFrom(io::ZeroCopyInputStream* zcis);
254
255 const char* InitFrom(io::ZeroCopyInputStream* zcis, int limit) {
256 if (limit == -1) return InitFrom(zcis);
257 overall_limit_ = limit;
258 auto res = InitFrom(zcis);
259 limit_ = limit - static_cast<int>(buffer_end_ - res);
260 limit_end_ = buffer_end_ + (std::min)(0, limit_);
261 return res;
262 }
263
264 private:
265 const char* limit_end_; // buffer_end_ + min(limit_, 0)
266 const char* buffer_end_;
267 const char* next_chunk_;
268 int size_;
269 int limit_; // relative to buffer_end_;
270 io::ZeroCopyInputStream* zcis_ = nullptr;
271 char buffer_[2 * kSlopBytes] = {};
272 enum { kNoAliasing = 0, kOnPatch = 1, kNoDelta = 2 };
273 std::uintptr_t aliasing_ = kNoAliasing;
274 // This variable is used to communicate how the parse ended, in order to
275 // completely verify the parsed data. A wire-format parse can end because of
276 // one of the following conditions:
277 // 1) A parse can end on a pushed limit.
278 // 2) A parse can end on End Of Stream (EOS).
279 // 3) A parse can end on 0 tag (only valid for toplevel message).
280 // 4) A parse can end on an end-group tag.
281 // This variable should always be set to 0, which indicates case 1. If the
282 // parse terminated due to EOS (case 2), it's set to 1. In case the parse
283 // ended due to a terminating tag (case 3 and 4) it's set to (tag - 1).
284 // This var doesn't really belong in EpsCopyInputStream and should be part of
285 // the ParseContext, but case 2 is most easily and optimally implemented in
286 // DoneFallback.
287 uint32_t last_tag_minus_1_ = 0;
288 int overall_limit_ = INT_MAX2147483647; // Overall limit independent of pushed limits.
289 // Pretty random large number that seems like a safe allocation on most
290 // systems. TODO(gerbens) do we need to set this as build flag?
291 enum { kSafeStringSize = 50000000 };
292
293 // Advances to next buffer chunk returns a pointer to the same logical place
294 // in the stream as set by overrun. Overrun indicates the position in the slop
295 // region the parse was left (0 <= overrun <= kSlopBytes). Returns true if at
296 // limit, at which point the returned pointer maybe null if there was an
297 // error. The invariant of this function is that it's guaranteed that
298 // kSlopBytes bytes can be accessed from the returned ptr. This function might
299 // advance more buffers than one in the underlying ZeroCopyInputStream.
300 std::pair<const char*, bool> DoneFallback(int overrun, int depth);
301 // Advances to the next buffer, at most one call to Next() on the underlying
302 // ZeroCopyInputStream is made. This function DOES NOT match the returned
303 // pointer to where in the slop region the parse ends, hence no overrun
304 // parameter. This is useful for string operations where you always copy
305 // to the end of the buffer (including the slop region).
306 const char* Next();
307 // overrun is the location in the slop region the stream currently is
308 // (0 <= overrun <= kSlopBytes). To prevent flipping to the next buffer of
309 // the ZeroCopyInputStream in the case the parse will end in the last
310 // kSlopBytes of the current buffer. depth is the current depth of nested
311 // groups (or negative if the use case does not need careful tracking).
312 inline const char* NextBuffer(int overrun, int depth);
313 const char* SkipFallback(const char* ptr, int size);
314 const char* AppendStringFallback(const char* ptr, int size, std::string* str);
315 const char* ReadStringFallback(const char* ptr, int size, std::string* str);
316 bool StreamNext(const void** data) {
317 bool res = zcis_->Next(data, &size_);
318 if (res) overall_limit_ -= size_;
319 return res;
320 }
321 void StreamBackUp(int count) {
322 zcis_->BackUp(count);
323 overall_limit_ += count;
324 }
325
326 template <typename A>
327 const char* AppendSize(const char* ptr, int size, const A& append) {
328 int chunk_size = buffer_end_ + kSlopBytes - ptr;
329 do {
330 GOOGLE_DCHECK(size > chunk_size)!(!(size > chunk_size)) ? (void)0 : ::google::protobuf::internal
::LogFinisher() = ::google::protobuf::internal::LogMessage( ::
google::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/google/protobuf/parse_context.h"
, 330) << "CHECK failed: " "size > chunk_size" ": "
;
331 if (next_chunk_ == nullptr) return nullptr;
332 append(ptr, chunk_size);
333 ptr += chunk_size;
334 size -= chunk_size;
335 // TODO(gerbens) Next calls NextBuffer which generates buffers with
336 // overlap and thus incurs cost of copying the slop regions. This is not
337 // necessary for reading strings. We should just call Next buffers.
338 if (limit_ <= kSlopBytes) return nullptr;
339 ptr = Next();
340 if (ptr == nullptr) return nullptr; // passed the limit
341 ptr += kSlopBytes;
342 chunk_size = buffer_end_ + kSlopBytes - ptr;
343 } while (size > chunk_size);
344 append(ptr, size);
345 return ptr + size;
346 }
347
348 // AppendUntilEnd appends data until a limit (either a PushLimit or end of
349 // stream. Normal payloads are from length delimited fields which have an
350 // explicit size. Reading until limit only comes when the string takes
351 // the place of a protobuf, ie RawMessage/StringRawMessage, lazy fields and
352 // implicit weak messages. We keep these methods private and friend them.
353 template <typename A>
354 const char* AppendUntilEnd(const char* ptr, const A& append) {
355 if (ptr - buffer_end_ > limit_) return nullptr;
356 while (limit_ > kSlopBytes) {
357 size_t chunk_size = buffer_end_ + kSlopBytes - ptr;
358 append(ptr, chunk_size);
359 ptr = Next();
360 if (ptr == nullptr) return limit_end_;
361 ptr += kSlopBytes;
362 }
363 auto end = buffer_end_ + limit_;
364 GOOGLE_DCHECK(end >= ptr)!(!(end >= ptr)) ? (void)0 : ::google::protobuf::internal::
LogFinisher() = ::google::protobuf::internal::LogMessage( ::google
::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/google/protobuf/parse_context.h"
, 364) << "CHECK failed: " "end >= ptr" ": "
;
365 append(ptr, end - ptr);
366 return end;
367 }
368
369 PROTOBUF_NODISCARD const char* AppendString(const char* ptr,
370 std::string* str) {
371 return AppendUntilEnd(
372 ptr, [str](const char* p, ptrdiff_t s) { str->append(p, s); });
373 }
374 friend class ImplicitWeakMessage;
375};
376
377using LazyEagerVerifyFnType = const char* (*)(const char* ptr,
378 ParseContext* ctx);
379using LazyEagerVerifyFnRef = std::remove_pointer<LazyEagerVerifyFnType>::type&;
380
381// ParseContext holds all data that is global to the entire parse. Most
382// importantly it contains the input stream, but also recursion depth and also
383// stores the end group tag, in case a parser ended on a endgroup, to verify
384// matching start/end group tags.
385class PROTOBUF_EXPORT ParseContext : public EpsCopyInputStream {
386 public:
387 struct Data {
388 const DescriptorPool* pool = nullptr;
389 MessageFactory* factory = nullptr;
390 Arena* arena = nullptr;
391 };
392
393 template <typename... T>
394 ParseContext(int depth, bool aliasing, const char** start, T&&... args)
395 : EpsCopyInputStream(aliasing), depth_(depth) {
396 *start = InitFrom(std::forward<T>(args)...);
397 }
398
399 void TrackCorrectEnding() { group_depth_ = 0; }
400
401 bool Done(const char** ptr) { return DoneWithCheck(ptr, group_depth_); }
2
Calling 'EpsCopyInputStream::DoneWithCheck'
402
403 int depth() const { return depth_; }
404
405 Data& data() { return data_; }
406 const Data& data() const { return data_; }
407
408 const char* ParseMessage(MessageLite* msg, const char* ptr);
409
410 // Spawns a child parsing context that inherits key properties. New context
411 // inherits the following:
412 // --depth_, data_, check_required_fields_, lazy_parse_mode_
413 // The spawned context always disables aliasing (different input).
414 template <typename... T>
415 ParseContext Spawn(const char** start, T&&... args) {
416 ParseContext spawned(depth_, false, start, std::forward<T>(args)...);
417 // Transfer key context states.
418 spawned.data_ = data_;
419 return spawned;
420 }
421
422 // This overload supports those few cases where ParseMessage is called
423 // on a class that is not actually a proto message.
424 // TODO(jorg): Eliminate this use case.
425 template <typename T,
426 typename std::enable_if<!std::is_base_of<MessageLite, T>::value,
427 bool>::type = true>
428 PROTOBUF_NODISCARD const char* ParseMessage(T* msg, const char* ptr);
429
430 template <typename T>
431 PROTOBUF_NODISCARD PROTOBUF_NDEBUG_INLINE const char* ParseGroup(
432 T* msg, const char* ptr, uint32_t tag) {
433 if (--depth_ < 0) return nullptr;
434 group_depth_++;
435 ptr = msg->_InternalParse(ptr, this);
436 group_depth_--;
437 depth_++;
438 if (PROTOBUF_PREDICT_FALSE(!ConsumeEndGroup(tag))) return nullptr;
439 return ptr;
440 }
441
442 private:
443 // Out-of-line routine to save space in ParseContext::ParseMessage<T>
444 // int old;
445 // ptr = ReadSizeAndPushLimitAndDepth(ptr, &old)
446 // is equivalent to:
447 // int size = ReadSize(&ptr);
448 // if (!ptr) return nullptr;
449 // int old = PushLimit(ptr, size);
450 // if (--depth_ < 0) return nullptr;
451 PROTOBUF_NODISCARD const char* ReadSizeAndPushLimitAndDepth(const char* ptr,
452 int* old_limit);
453
454 // The context keeps an internal stack to keep track of the recursive
455 // part of the parse state.
456 // Current depth of the active parser, depth counts down.
457 // This is used to limit recursion depth (to prevent overflow on malicious
458 // data), but is also used to index in stack_ to store the current state.
459 int depth_;
460 // Unfortunately necessary for the fringe case of ending on 0 or end-group tag
461 // in the last kSlopBytes of a ZeroCopyInputStream chunk.
462 int group_depth_ = INT_MIN(-2147483647 -1);
463 Data data_;
464};
465
466template <uint32_t tag>
467bool ExpectTag(const char* ptr) {
468 if (tag < 128) {
469 return *ptr == static_cast<char>(tag);
470 } else {
471 static_assert(tag < 128 * 128, "We only expect tags for 1 or 2 bytes");
472 char buf[2] = {static_cast<char>(tag | 0x80), static_cast<char>(tag >> 7)};
473 return std::memcmp(ptr, buf, 2) == 0;
474 }
475}
476
477template <int>
478struct EndianHelper;
479
480template <>
481struct EndianHelper<1> {
482 static uint8_t Load(const void* p) { return *static_cast<const uint8_t*>(p); }
483};
484
485template <>
486struct EndianHelper<2> {
487 static uint16_t Load(const void* p) {
488 uint16_t tmp;
489 std::memcpy(&tmp, p, 2);
490 return little_endian::ToHost(tmp);
491 }
492};
493
494template <>
495struct EndianHelper<4> {
496 static uint32_t Load(const void* p) {
497 uint32_t tmp;
498 std::memcpy(&tmp, p, 4);
499 return little_endian::ToHost(tmp);
500 }
501};
502
503template <>
504struct EndianHelper<8> {
505 static uint64_t Load(const void* p) {
506 uint64_t tmp;
507 std::memcpy(&tmp, p, 8);
508 return little_endian::ToHost(tmp);
509 }
510};
511
512template <typename T>
513T UnalignedLoad(const char* p) {
514 auto tmp = EndianHelper<sizeof(T)>::Load(p);
515 T res;
516 memcpy(&res, &tmp, sizeof(T));
517 return res;
518}
519
520PROTOBUF_EXPORT
521std::pair<const char*, uint32_t> VarintParseSlow32(const char* p, uint32_t res);
522PROTOBUF_EXPORT
523std::pair<const char*, uint64_t> VarintParseSlow64(const char* p, uint32_t res);
524
525inline const char* VarintParseSlow(const char* p, uint32_t res, uint32_t* out) {
526 auto tmp = VarintParseSlow32(p, res);
527 *out = tmp.second;
528 return tmp.first;
529}
530
531inline const char* VarintParseSlow(const char* p, uint32_t res, uint64_t* out) {
532 auto tmp = VarintParseSlow64(p, res);
533 *out = tmp.second;
534 return tmp.first;
535}
536
537template <typename T>
538PROTOBUF_NODISCARD const char* VarintParse(const char* p, T* out) {
539 auto ptr = reinterpret_cast<const uint8_t*>(p);
540 uint32_t res = ptr[0];
541 if (!(res & 0x80)) {
542 *out = res;
543 return p + 1;
544 }
545 uint32_t byte = ptr[1];
546 res += (byte - 1) << 7;
547 if (!(byte & 0x80)) {
548 *out = res;
549 return p + 2;
550 }
551 return VarintParseSlow(p, res, out);
552}
553
554// Used for tags, could read up to 5 bytes which must be available.
555// Caller must ensure its safe to call.
556
557PROTOBUF_EXPORT
558std::pair<const char*, uint32_t> ReadTagFallback(const char* p, uint32_t res);
559
560// Same as ParseVarint but only accept 5 bytes at most.
561inline const char* ReadTag(const char* p, uint32_t* out,
562 uint32_t /*max_tag*/ = 0) {
563 uint32_t res = static_cast<uint8_t>(p[0]);
564 if (res < 128) {
565 *out = res;
566 return p + 1;
567 }
568 uint32_t second = static_cast<uint8_t>(p[1]);
569 res += (second - 1) << 7;
570 if (second < 128) {
571 *out = res;
572 return p + 2;
573 }
574 auto tmp = ReadTagFallback(p, res);
575 *out = tmp.second;
576 return tmp.first;
577}
578
579// As above, but optimized to consume very few registers while still being fast,
580// ReadTagInlined is useful for callers that don't mind the extra code but would
581// like to avoid an extern function call causing spills into the stack.
582//
583// Two support routines for ReadTagInlined come first...
584template <class T>
585PROTOBUF_NODISCARD PROTOBUF_ALWAYS_INLINE constexpr T RotateLeft(
586 T x, int s) noexcept {
587 return static_cast<T>(x << (s & (std::numeric_limits<T>::digits - 1))) |
588 static_cast<T>(x >> ((-s) & (std::numeric_limits<T>::digits - 1)));
589}
590
591PROTOBUF_NODISCARD inline PROTOBUF_ALWAYS_INLINE uint64_t
592RotRight7AndReplaceLowByte(uint64_t res, const char& byte) {
593#if defined(__x86_64__1) && defined(__GNUC__4)
594 // This will only use one register for `res`.
595 // `byte` comes as a reference to allow the compiler to generate code like:
596 //
597 // rorq $7, %rcx
598 // movb 1(%rax), %cl
599 //
600 // which avoids loading the incoming bytes into a separate register first.
601 asm("ror $7,%0\n\t"
602 "movb %1,%b0"
603 : "+r"(res)
604 : "m"(byte));
605#else
606 res = RotateLeft(res, -7);
607 res = res & ~0xFF;
608 res |= 0xFF & byte;
609#endif
610 return res;
611};
612
613inline PROTOBUF_ALWAYS_INLINE
614const char* ReadTagInlined(const char* ptr, uint32_t* out) {
615 uint64_t res = 0xFF & ptr[0];
616 if (PROTOBUF_PREDICT_FALSE(res >= 128)) {
617 res = RotRight7AndReplaceLowByte(res, ptr[1]);
618 if (PROTOBUF_PREDICT_FALSE(res & 0x80)) {
619 res = RotRight7AndReplaceLowByte(res, ptr[2]);
620 if (PROTOBUF_PREDICT_FALSE(res & 0x80)) {
621 res = RotRight7AndReplaceLowByte(res, ptr[3]);
622 if (PROTOBUF_PREDICT_FALSE(res & 0x80)) {
623 // Note: this wouldn't work if res were 32-bit,
624 // because then replacing the low byte would overwrite
625 // the bottom 4 bits of the result.
626 res = RotRight7AndReplaceLowByte(res, ptr[4]);
627 if (PROTOBUF_PREDICT_FALSE(res & 0x80)) {
628 // The proto format does not permit longer than 5-byte encodings for
629 // tags.
630 *out = 0;
631 return nullptr;
632 }
633 *out = static_cast<uint32_t>(RotateLeft(res, 28));
634#if defined(__GNUC__4)
635 // Note: this asm statement prevents the compiler from
636 // trying to share the "return ptr + constant" among all
637 // branches.
638 asm("" : "+r"(ptr));
639#endif
640 return ptr + 5;
641 }
642 *out = static_cast<uint32_t>(RotateLeft(res, 21));
643 return ptr + 4;
644 }
645 *out = static_cast<uint32_t>(RotateLeft(res, 14));
646 return ptr + 3;
647 }
648 *out = static_cast<uint32_t>(RotateLeft(res, 7));
649 return ptr + 2;
650 }
651 *out = static_cast<uint32_t>(res);
652 return ptr + 1;
653}
654
655// Decode 2 consecutive bytes of a varint and returns the value, shifted left
656// by 1. It simultaneous updates *ptr to *ptr + 1 or *ptr + 2 depending if the
657// first byte's continuation bit is set.
658// If bit 15 of return value is set (equivalent to the continuation bits of both
659// bytes being set) the varint continues, otherwise the parse is done. On x86
660// movsx eax, dil
661// and edi, eax
662// add eax, edi
663// adc [rsi], 1
664inline uint32_t DecodeTwoBytes(const char** ptr) {
665 uint32_t value = UnalignedLoad<uint16_t>(*ptr);
666 // Sign extend the low byte continuation bit
667 uint32_t x = static_cast<int8_t>(value);
668 value &= x; // Mask out the high byte iff no continuation
669 // This add is an amazing operation, it cancels the low byte continuation bit
670 // from y transferring it to the carry. Simultaneously it also shifts the 7
671 // LSB left by one tightly against high byte varint bits. Hence value now
672 // contains the unpacked value shifted left by 1.
673 value += x;
674 // Use the carry to update the ptr appropriately.
675 *ptr += value < x ? 2 : 1;
676 return value;
677}
678
679// More efficient varint parsing for big varints
680inline const char* ParseBigVarint(const char* p, uint64_t* out) {
681 auto pnew = p;
682 auto tmp = DecodeTwoBytes(&pnew);
683 uint64_t res = tmp >> 1;
684 if (PROTOBUF_PREDICT_TRUE(static_cast<std::int16_t>(tmp) >= 0)) {
685 *out = res;
686 return pnew;
687 }
688 for (std::uint32_t i = 1; i < 5; i++) {
689 pnew = p + 2 * i;
690 tmp = DecodeTwoBytes(&pnew);
691 res += (static_cast<std::uint64_t>(tmp) - 2) << (14 * i - 1);
692 if (PROTOBUF_PREDICT_TRUE(static_cast<std::int16_t>(tmp) >= 0)) {
693 *out = res;
694 return pnew;
695 }
696 }
697 return nullptr;
698}
699
700PROTOBUF_EXPORT
701std::pair<const char*, int32_t> ReadSizeFallback(const char* p, uint32_t first);
702// Used for tags, could read up to 5 bytes which must be available. Additionally
703// it makes sure the unsigned value fits a int32_t, otherwise returns nullptr.
704// Caller must ensure its safe to call.
705inline uint32_t ReadSize(const char** pp) {
706 auto p = *pp;
707 uint32_t res = static_cast<uint8_t>(p[0]);
708 if (res < 128) {
709 *pp = p + 1;
710 return res;
711 }
712 auto x = ReadSizeFallback(p, res);
713 *pp = x.first;
714 return x.second;
715}
716
717// Some convenience functions to simplify the generated parse loop code.
718// Returning the value and updating the buffer pointer allows for nicer
719// function composition. We rely on the compiler to inline this.
720// Also in debug compiles having local scoped variables tend to generated
721// stack frames that scale as O(num fields).
722inline uint64_t ReadVarint64(const char** p) {
723 uint64_t tmp;
724 *p = VarintParse(*p, &tmp);
725 return tmp;
726}
727
728inline uint32_t ReadVarint32(const char** p) {
729 uint32_t tmp;
730 *p = VarintParse(*p, &tmp);
731 return tmp;
732}
733
734inline int64_t ReadVarintZigZag64(const char** p) {
735 uint64_t tmp;
736 *p = VarintParse(*p, &tmp);
737 return WireFormatLite::ZigZagDecode64(tmp);
738}
739
740inline int32_t ReadVarintZigZag32(const char** p) {
741 uint64_t tmp;
742 *p = VarintParse(*p, &tmp);
743 return WireFormatLite::ZigZagDecode32(static_cast<uint32_t>(tmp));
744}
745
746template <typename T, typename std::enable_if<
747 !std::is_base_of<MessageLite, T>::value, bool>::type>
748PROTOBUF_NODISCARD const char* ParseContext::ParseMessage(T* msg,
749 const char* ptr) {
750 int old;
751 ptr = ReadSizeAndPushLimitAndDepth(ptr, &old);
752 ptr = ptr ? msg->_InternalParse(ptr, this) : nullptr;
753 depth_++;
754 if (!PopLimit(old)) return nullptr;
755 return ptr;
756}
757
758template <typename Tag, typename T>
759const char* EpsCopyInputStream::ReadRepeatedFixed(const char* ptr,
760 Tag expected_tag,
761 RepeatedField<T>* out) {
762 do {
763 out->Add(UnalignedLoad<T>(ptr));
764 ptr += sizeof(T);
765 if (PROTOBUF_PREDICT_FALSE(ptr >= limit_end_)) return ptr;
766 } while (UnalignedLoad<Tag>(ptr) == expected_tag && (ptr += sizeof(Tag)));
767 return ptr;
768}
769
770// Add any of the following lines to debug which parse function is failing.
771
772#define GOOGLE_PROTOBUF_ASSERT_RETURN(predicate, ret)if (!(predicate)) { return ret; } \
773 if (!(predicate)) { \
774 /* ::raise(SIGINT); */ \
775 /* GOOGLE_LOG(ERROR) << "Parse failure"; */ \
776 return ret; \
777 }
778
779#define GOOGLE_PROTOBUF_PARSER_ASSERT(predicate)if (!(predicate)) { return nullptr; } \
780 GOOGLE_PROTOBUF_ASSERT_RETURN(predicate, nullptr)if (!(predicate)) { return nullptr; }
781
782template <typename T>
783const char* EpsCopyInputStream::ReadPackedFixed(const char* ptr, int size,
784 RepeatedField<T>* out) {
785 GOOGLE_PROTOBUF_PARSER_ASSERT(ptr)if (!(ptr)) { return nullptr; };
786 int nbytes = buffer_end_ + kSlopBytes - ptr;
787 while (size > nbytes) {
788 int num = nbytes / sizeof(T);
789 int old_entries = out->size();
790 out->Reserve(old_entries + num);
791 int block_size = num * sizeof(T);
792 auto dst = out->AddNAlreadyReserved(num);
793#ifdef PROTOBUF_LITTLE_ENDIAN
794 std::memcpy(dst, ptr, block_size);
795#else
796 for (int i = 0; i < num; i++)
797 dst[i] = UnalignedLoad<T>(ptr + i * sizeof(T));
798#endif
799 size -= block_size;
800 if (limit_ <= kSlopBytes) return nullptr;
801 ptr = Next();
802 if (ptr == nullptr) return nullptr;
803 ptr += kSlopBytes - (nbytes - block_size);
804 nbytes = buffer_end_ + kSlopBytes - ptr;
805 }
806 int num = size / sizeof(T);
807 int old_entries = out->size();
808 out->Reserve(old_entries + num);
809 int block_size = num * sizeof(T);
810 auto dst = out->AddNAlreadyReserved(num);
811#ifdef PROTOBUF_LITTLE_ENDIAN
812 std::memcpy(dst, ptr, block_size);
813#else
814 for (int i = 0; i < num; i++) dst[i] = UnalignedLoad<T>(ptr + i * sizeof(T));
815#endif
816 ptr += block_size;
817 if (size != block_size) return nullptr;
818 return ptr;
819}
820
821template <typename Add>
822const char* ReadPackedVarintArray(const char* ptr, const char* end, Add add) {
823 while (ptr < end) {
824 uint64_t varint;
825 ptr = VarintParse(ptr, &varint);
826 if (ptr == nullptr) return nullptr;
827 add(varint);
828 }
829 return ptr;
830}
831
832template <typename Add>
833const char* EpsCopyInputStream::ReadPackedVarint(const char* ptr, Add add) {
834 int size = ReadSize(&ptr);
835 GOOGLE_PROTOBUF_PARSER_ASSERT(ptr)if (!(ptr)) { return nullptr; };
836 int chunk_size = buffer_end_ - ptr;
837 while (size > chunk_size) {
838 ptr = ReadPackedVarintArray(ptr, buffer_end_, add);
839 if (ptr == nullptr) return nullptr;
840 int overrun = ptr - buffer_end_;
841 GOOGLE_DCHECK(overrun >= 0 && overrun <= kSlopBytes)!(!(overrun >= 0 && overrun <= kSlopBytes)) ? (
void)0 : ::google::protobuf::internal::LogFinisher() = ::google
::protobuf::internal::LogMessage( ::google::protobuf::LOGLEVEL_FATAL
, "/root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/google/protobuf/parse_context.h"
, 841) << "CHECK failed: " "overrun >= 0 && overrun <= kSlopBytes"
": "
;
842 if (size - chunk_size <= kSlopBytes) {
843 // The current buffer contains all the information needed, we don't need
844 // to flip buffers. However we must parse from a buffer with enough space
845 // so we are not prone to a buffer overflow.
846 char buf[kSlopBytes + 10] = {};
847 std::memcpy(buf, buffer_end_, kSlopBytes);
848 GOOGLE_CHECK_LE(size - chunk_size, kSlopBytes)!(!((size - chunk_size) <= (kSlopBytes))) ? (void)0 : ::google
::protobuf::internal::LogFinisher() = ::google::protobuf::internal
::LogMessage( ::google::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/google/protobuf/parse_context.h"
, 848) << "CHECK failed: " "(size - chunk_size) <= (kSlopBytes)"
": "
;
849 auto end = buf + (size - chunk_size);
850 auto res = ReadPackedVarintArray(buf + overrun, end, add);
851 if (res == nullptr || res != end) return nullptr;
852 return buffer_end_ + (res - buf);
853 }
854 size -= overrun + chunk_size;
855 GOOGLE_DCHECK_GT(size, 0)!(!((size) > (0))) ? (void)0 : ::google::protobuf::internal
::LogFinisher() = ::google::protobuf::internal::LogMessage( ::
google::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/google/protobuf/parse_context.h"
, 855) << "CHECK failed: " "(size) > (0)" ": "
;
856 // We must flip buffers
857 if (limit_ <= kSlopBytes) return nullptr;
858 ptr = Next();
859 if (ptr == nullptr) return nullptr;
860 ptr += overrun;
861 chunk_size = buffer_end_ - ptr;
862 }
863 auto end = ptr + size;
864 ptr = ReadPackedVarintArray(ptr, end, add);
865 return end == ptr ? ptr : nullptr;
866}
867
868// Helper for verification of utf8
869PROTOBUF_EXPORT
870bool VerifyUTF8(StringPiece s, const char* field_name);
871
872inline bool VerifyUTF8(const std::string* s, const char* field_name) {
873 return VerifyUTF8(*s, field_name);
874}
875
876// All the string parsers with or without UTF checking and for all CTypes.
877PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* InlineGreedyStringParser(
878 std::string* s, const char* ptr, ParseContext* ctx);
879
880
881template <typename T>
882PROTOBUF_NODISCARD const char* FieldParser(uint64_t tag, T& field_parser,
883 const char* ptr, ParseContext* ctx) {
884 uint32_t number = tag >> 3;
885 GOOGLE_PROTOBUF_PARSER_ASSERT(number != 0)if (!(number != 0)) { return nullptr; };
886 using WireType = internal::WireFormatLite::WireType;
887 switch (tag & 7) {
888 case WireType::WIRETYPE_VARINT: {
889 uint64_t value;
890 ptr = VarintParse(ptr, &value);
891 GOOGLE_PROTOBUF_PARSER_ASSERT(ptr)if (!(ptr)) { return nullptr; };
892 field_parser.AddVarint(number, value);
893 break;
894 }
895 case WireType::WIRETYPE_FIXED64: {
896 uint64_t value = UnalignedLoad<uint64_t>(ptr);
897 ptr += 8;
898 field_parser.AddFixed64(number, value);
899 break;
900 }
901 case WireType::WIRETYPE_LENGTH_DELIMITED: {
902 ptr = field_parser.ParseLengthDelimited(number, ptr, ctx);
903 GOOGLE_PROTOBUF_PARSER_ASSERT(ptr)if (!(ptr)) { return nullptr; };
904 break;
905 }
906 case WireType::WIRETYPE_START_GROUP: {
907 ptr = field_parser.ParseGroup(number, ptr, ctx);
908 GOOGLE_PROTOBUF_PARSER_ASSERT(ptr)if (!(ptr)) { return nullptr; };
909 break;
910 }
911 case WireType::WIRETYPE_END_GROUP: {
912 GOOGLE_LOG(FATAL)::google::protobuf::internal::LogFinisher() = ::google::protobuf
::internal::LogMessage( ::google::protobuf::LOGLEVEL_FATAL, "/root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/google/protobuf/parse_context.h"
, 912)
<< "Can't happen";
913 break;
914 }
915 case WireType::WIRETYPE_FIXED32: {
916 uint32_t value = UnalignedLoad<uint32_t>(ptr);
917 ptr += 4;
918 field_parser.AddFixed32(number, value);
919 break;
920 }
921 default:
922 return nullptr;
923 }
924 return ptr;
925}
926
927template <typename T>
928PROTOBUF_NODISCARD const char* WireFormatParser(T& field_parser,
929 const char* ptr,
930 ParseContext* ctx) {
931 while (!ctx->Done(&ptr)) {
932 uint32_t tag;
933 ptr = ReadTag(ptr, &tag);
934 GOOGLE_PROTOBUF_PARSER_ASSERT(ptr != nullptr)if (!(ptr != nullptr)) { return nullptr; };
935 if (tag == 0 || (tag & 7) == 4) {
936 ctx->SetLastTag(tag);
937 return ptr;
938 }
939 ptr = FieldParser(tag, field_parser, ptr, ctx);
940 GOOGLE_PROTOBUF_PARSER_ASSERT(ptr != nullptr)if (!(ptr != nullptr)) { return nullptr; };
941 }
942 return ptr;
943}
944
945// The packed parsers parse repeated numeric primitives directly into the
946// corresponding field
947
948// These are packed varints
949PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedInt32Parser(
950 void* object, const char* ptr, ParseContext* ctx);
951PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedUInt32Parser(
952 void* object, const char* ptr, ParseContext* ctx);
953PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedInt64Parser(
954 void* object, const char* ptr, ParseContext* ctx);
955PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedUInt64Parser(
956 void* object, const char* ptr, ParseContext* ctx);
957PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedSInt32Parser(
958 void* object, const char* ptr, ParseContext* ctx);
959PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedSInt64Parser(
960 void* object, const char* ptr, ParseContext* ctx);
961PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedEnumParser(
962 void* object, const char* ptr, ParseContext* ctx);
963
964template <typename T>
965PROTOBUF_NODISCARD const char* PackedEnumParser(void* object, const char* ptr,
966 ParseContext* ctx,
967 bool (*is_valid)(int),
968 InternalMetadata* metadata,
969 int field_num) {
970 return ctx->ReadPackedVarint(
971 ptr, [object, is_valid, metadata, field_num](uint64_t val) {
972 if (is_valid(val)) {
973 static_cast<RepeatedField<int>*>(object)->Add(val);
974 } else {
975 WriteVarint(field_num, val, metadata->mutable_unknown_fields<T>());
976 }
977 });
978}
979
980template <typename T>
981PROTOBUF_NODISCARD const char* PackedEnumParserArg(
982 void* object, const char* ptr, ParseContext* ctx,
983 bool (*is_valid)(const void*, int), const void* data,
984 InternalMetadata* metadata, int field_num) {
985 return ctx->ReadPackedVarint(
986 ptr, [object, is_valid, data, metadata, field_num](uint64_t val) {
987 if (is_valid(data, val)) {
988 static_cast<RepeatedField<int>*>(object)->Add(val);
989 } else {
990 WriteVarint(field_num, val, metadata->mutable_unknown_fields<T>());
991 }
992 });
993}
994
995PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedBoolParser(
996 void* object, const char* ptr, ParseContext* ctx);
997PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedFixed32Parser(
998 void* object, const char* ptr, ParseContext* ctx);
999PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedSFixed32Parser(
1000 void* object, const char* ptr, ParseContext* ctx);
1001PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedFixed64Parser(
1002 void* object, const char* ptr, ParseContext* ctx);
1003PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedSFixed64Parser(
1004 void* object, const char* ptr, ParseContext* ctx);
1005PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedFloatParser(
1006 void* object, const char* ptr, ParseContext* ctx);
1007PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedDoubleParser(
1008 void* object, const char* ptr, ParseContext* ctx);
1009
1010// This is the only recursive parser.
1011PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* UnknownGroupLiteParse(
1012 std::string* unknown, const char* ptr, ParseContext* ctx);
1013// This is a helper to for the UnknownGroupLiteParse but is actually also
1014// useful in the generated code. It uses overload on std::string* vs
1015// UnknownFieldSet* to make the generated code isomorphic between full and lite.
1016PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* UnknownFieldParse(
1017 uint32_t tag, std::string* unknown, const char* ptr, ParseContext* ctx);
1018
1019} // namespace internal
1020} // namespace protobuf
1021} // namespace google
1022
1023#include <google/protobuf/port_undef.inc>
1024
1025#endif // GOOGLE_PROTOBUF_PARSE_CONTEXT_H__