google-protobuf 3.7.1 → 3.17.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of google-protobuf might be problematic. Click here for more details.

Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/ext/google/protobuf_c/convert.c +349 -0
  3. data/ext/google/protobuf_c/convert.h +72 -0
  4. data/ext/google/protobuf_c/defs.c +1555 -1228
  5. data/ext/google/protobuf_c/defs.h +107 -0
  6. data/ext/google/protobuf_c/extconf.rb +5 -7
  7. data/ext/google/protobuf_c/map.c +312 -470
  8. data/ext/google/protobuf_c/map.h +67 -0
  9. data/ext/google/protobuf_c/message.c +942 -348
  10. data/ext/google/protobuf_c/message.h +101 -0
  11. data/ext/google/protobuf_c/protobuf.c +400 -51
  12. data/ext/google/protobuf_c/protobuf.h +47 -545
  13. data/ext/google/protobuf_c/repeated_field.c +313 -308
  14. data/ext/google/protobuf_c/repeated_field.h +63 -0
  15. data/ext/google/protobuf_c/ruby-upb.c +8858 -0
  16. data/ext/google/protobuf_c/ruby-upb.h +4411 -0
  17. data/ext/google/protobuf_c/third_party/wyhash/wyhash.h +145 -0
  18. data/lib/google/protobuf.rb +70 -0
  19. data/lib/google/protobuf/any_pb.rb +1 -1
  20. data/lib/google/protobuf/api_pb.rb +3 -3
  21. data/lib/google/protobuf/duration_pb.rb +1 -1
  22. data/lib/google/protobuf/empty_pb.rb +1 -1
  23. data/lib/google/protobuf/field_mask_pb.rb +1 -1
  24. data/lib/google/protobuf/source_context_pb.rb +1 -1
  25. data/lib/google/protobuf/struct_pb.rb +4 -4
  26. data/lib/google/protobuf/timestamp_pb.rb +1 -1
  27. data/lib/google/protobuf/type_pb.rb +8 -8
  28. data/lib/google/protobuf/well_known_types.rb +8 -2
  29. data/lib/google/protobuf/wrappers_pb.rb +9 -9
  30. data/tests/basic.rb +320 -70
  31. data/tests/generated_code_test.rb +0 -0
  32. data/tests/stress.rb +0 -0
  33. metadata +27 -15
  34. data/ext/google/protobuf_c/encode_decode.c +0 -1614
  35. data/ext/google/protobuf_c/storage.c +0 -1032
  36. data/ext/google/protobuf_c/upb.c +0 -17480
  37. data/ext/google/protobuf_c/upb.h +0 -10642
@@ -0,0 +1,4411 @@
1
+ /* Amalgamated source file */
2
+ /*
3
+ * Copyright (c) 2009-2021, Google LLC
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are met:
8
+ * * Redistributions of source code must retain the above copyright
9
+ * notice, this list of conditions and the following disclaimer.
10
+ * * Redistributions in binary form must reproduce the above copyright
11
+ * notice, this list of conditions and the following disclaimer in the
12
+ * documentation and/or other materials provided with the distribution.
13
+ * * Neither the name of Google LLC nor the
14
+ * names of its contributors may be used to endorse or promote products
15
+ * derived from this software without specific prior written permission.
16
+ *
17
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ * DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY
21
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ */
28
+
29
+ /*
30
+ * This is where we define macros used across upb.
31
+ *
32
+ * All of these macros are undef'd in port_undef.inc to avoid leaking them to
33
+ * users.
34
+ *
35
+ * The correct usage is:
36
+ *
37
+ * #include "upb/foobar.h"
38
+ * #include "upb/baz.h"
39
+ *
40
+ * // MUST be last included header.
41
+ * #include "upb/port_def.inc"
42
+ *
43
+ * // Code for this file.
44
+ * // <...>
45
+ *
46
+ * // Can be omitted for .c files, required for .h.
47
+ * #include "upb/port_undef.inc"
48
+ *
49
+ * This file is private and must not be included by users!
50
+ */
51
+
52
+ #if !((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
53
+ (defined(__cplusplus) && __cplusplus >= 201103L) || \
54
+ (defined(_MSC_VER) && _MSC_VER >= 1900))
55
+ #error upb requires C99 or C++11 or MSVC >= 2015.
56
+ #endif
57
+
58
+ #include <stdint.h>
59
+ #include <stddef.h>
60
+
61
+ #if UINTPTR_MAX == 0xffffffff
62
+ #define UPB_SIZE(size32, size64) size32
63
+ #else
64
+ #define UPB_SIZE(size32, size64) size64
65
+ #endif
66
+
67
+ /* If we always read/write as a consistent type to each address, this shouldn't
68
+ * violate aliasing.
69
+ */
70
+ #define UPB_PTR_AT(msg, ofs, type) ((type*)((char*)(msg) + (ofs)))
71
+
72
+ #define UPB_READ_ONEOF(msg, fieldtype, offset, case_offset, case_val, default) \
73
+ *UPB_PTR_AT(msg, case_offset, int) == case_val \
74
+ ? *UPB_PTR_AT(msg, offset, fieldtype) \
75
+ : default
76
+
77
+ #define UPB_WRITE_ONEOF(msg, fieldtype, offset, value, case_offset, case_val) \
78
+ *UPB_PTR_AT(msg, case_offset, int) = case_val; \
79
+ *UPB_PTR_AT(msg, offset, fieldtype) = value;
80
+
81
+ #define UPB_MAPTYPE_STRING 0
82
+
83
+ /* UPB_INLINE: inline if possible, emit standalone code if required. */
84
+ #ifdef __cplusplus
85
+ #define UPB_INLINE inline
86
+ #elif defined (__GNUC__) || defined(__clang__)
87
+ #define UPB_INLINE static __inline__
88
+ #else
89
+ #define UPB_INLINE static
90
+ #endif
91
+
92
+ #define UPB_ALIGN_UP(size, align) (((size) + (align) - 1) / (align) * (align))
93
+ #define UPB_ALIGN_DOWN(size, align) ((size) / (align) * (align))
94
+ #define UPB_ALIGN_MALLOC(size) UPB_ALIGN_UP(size, 16)
95
+ #define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member)
96
+
97
+ /* Hints to the compiler about likely/unlikely branches. */
98
+ #if defined (__GNUC__) || defined(__clang__)
99
+ #define UPB_LIKELY(x) __builtin_expect((x),1)
100
+ #define UPB_UNLIKELY(x) __builtin_expect((x),0)
101
+ #else
102
+ #define UPB_LIKELY(x) (x)
103
+ #define UPB_UNLIKELY(x) (x)
104
+ #endif
105
+
106
+ /* Macros for function attributes on compilers that support them. */
107
+ #ifdef __GNUC__
108
+ #define UPB_FORCEINLINE __inline__ __attribute__((always_inline))
109
+ #define UPB_NOINLINE __attribute__((noinline))
110
+ #define UPB_NORETURN __attribute__((__noreturn__))
111
+ #define UPB_PRINTF(str, first_vararg) __attribute__((format (printf, str, first_vararg)))
112
+ #elif defined(_MSC_VER)
113
+ #define UPB_NOINLINE
114
+ #define UPB_FORCEINLINE
115
+ #define UPB_NORETURN __declspec(noreturn)
116
+ #define UPB_PRINTF(str, first_vararg)
117
+ #else /* !defined(__GNUC__) */
118
+ #define UPB_FORCEINLINE
119
+ #define UPB_NOINLINE
120
+ #define UPB_NORETURN
121
+ #define UPB_PRINTF(str, first_vararg)
122
+ #endif
123
+
124
+ #define UPB_MAX(x, y) ((x) > (y) ? (x) : (y))
125
+ #define UPB_MIN(x, y) ((x) < (y) ? (x) : (y))
126
+
127
+ #define UPB_UNUSED(var) (void)var
128
+
129
+ /* UPB_ASSUME(): in release mode, we tell the compiler to assume this is true.
130
+ */
131
+ #ifdef NDEBUG
132
+ #ifdef __GNUC__
133
+ #define UPB_ASSUME(expr) if (!(expr)) __builtin_unreachable()
134
+ #elif defined _MSC_VER
135
+ #define UPB_ASSUME(expr) if (!(expr)) __assume(0)
136
+ #else
137
+ #define UPB_ASSUME(expr) do {} while (false && (expr))
138
+ #endif
139
+ #else
140
+ #define UPB_ASSUME(expr) assert(expr)
141
+ #endif
142
+
143
+ /* UPB_ASSERT(): in release mode, we use the expression without letting it be
144
+ * evaluated. This prevents "unused variable" warnings. */
145
+ #ifdef NDEBUG
146
+ #define UPB_ASSERT(expr) do {} while (false && (expr))
147
+ #else
148
+ #define UPB_ASSERT(expr) assert(expr)
149
+ #endif
150
+
151
+ #if defined(__GNUC__) || defined(__clang__)
152
+ #define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0)
153
+ #else
154
+ #define UPB_UNREACHABLE() do { assert(0); } while(0)
155
+ #endif
156
+
157
+ /* UPB_SETJMP() / UPB_LONGJMP(): avoid setting/restoring signal mask. */
158
+ #ifdef __APPLE__
159
+ #define UPB_SETJMP(buf) _setjmp(buf)
160
+ #define UPB_LONGJMP(buf, val) _longjmp(buf, val)
161
+ #else
162
+ #define UPB_SETJMP(buf) setjmp(buf)
163
+ #define UPB_LONGJMP(buf, val) longjmp(buf, val)
164
+ #endif
165
+
166
+ /* UPB_PTRADD(ptr, ofs): add pointer while avoiding "NULL + 0" UB */
167
+ #define UPB_PTRADD(ptr, ofs) ((ofs) ? (ptr) + (ofs) : (ptr))
168
+
169
+ /* Configure whether fasttable is switched on or not. *************************/
170
+
171
+ #ifdef __has_attribute
172
+ #define UPB_HAS_ATTRIBUTE(x) __has_attribute(x)
173
+ #else
174
+ #define UPB_HAS_ATTRIBUTE(x) 0
175
+ #endif
176
+
177
+ #if UPB_HAS_ATTRIBUTE(musttail)
178
+ #define UPB_MUSTTAIL __attribute__((musttail))
179
+ #else
180
+ #define UPB_MUSTTAIL
181
+ #endif
182
+
183
+ #undef UPB_HAS_ATTRIBUTE
184
+
185
+ /* This check is not fully robust: it does not require that we have "musttail"
186
+ * support available. We need tail calls to avoid consuming arbitrary amounts
187
+ * of stack space.
188
+ *
189
+ * GCC/Clang can mostly be trusted to generate tail calls as long as
190
+ * optimization is enabled, but, debug builds will not generate tail calls
191
+ * unless "musttail" is available.
192
+ *
193
+ * We should probably either:
194
+ * 1. require that the compiler supports musttail.
195
+ * 2. add some fallback code for when musttail isn't available (ie. return
196
+ * instead of tail calling). This is safe and portable, but this comes at
197
+ * a CPU cost.
198
+ */
199
+ #if (defined(__x86_64__) || defined(__aarch64__)) && defined(__GNUC__)
200
+ #define UPB_FASTTABLE_SUPPORTED 1
201
+ #else
202
+ #define UPB_FASTTABLE_SUPPORTED 0
203
+ #endif
204
+
205
+ /* define UPB_ENABLE_FASTTABLE to force fast table support.
206
+ * This is useful when we want to ensure we are really getting fasttable,
207
+ * for example for testing or benchmarking. */
208
+ #if defined(UPB_ENABLE_FASTTABLE)
209
+ #if !UPB_FASTTABLE_SUPPORTED
210
+ #error fasttable is x86-64/ARM64 only and requires GCC or Clang.
211
+ #endif
212
+ #define UPB_FASTTABLE 1
213
+ /* Define UPB_TRY_ENABLE_FASTTABLE to use fasttable if possible.
214
+ * This is useful for releasing code that might be used on multiple platforms,
215
+ * for example the PHP or Ruby C extensions. */
216
+ #elif defined(UPB_TRY_ENABLE_FASTTABLE)
217
+ #define UPB_FASTTABLE UPB_FASTTABLE_SUPPORTED
218
+ #else
219
+ #define UPB_FASTTABLE 0
220
+ #endif
221
+
222
+ /* UPB_FASTTABLE_INIT() allows protos compiled for fasttable to gracefully
223
+ * degrade to non-fasttable if we are using UPB_TRY_ENABLE_FASTTABLE. */
224
+ #if !UPB_FASTTABLE && defined(UPB_TRY_ENABLE_FASTTABLE)
225
+ #define UPB_FASTTABLE_INIT(...)
226
+ #else
227
+ #define UPB_FASTTABLE_INIT(...) __VA_ARGS__
228
+ #endif
229
+
230
+ #undef UPB_FASTTABLE_SUPPORTED
231
+
232
+ /* ASAN poisoning (for arena) *************************************************/
233
+
234
+ #if defined(__SANITIZE_ADDRESS__)
235
+ #define UPB_ASAN 1
236
+ #ifdef __cplusplus
237
+ extern "C" {
238
+ #endif
239
+ void __asan_poison_memory_region(void const volatile *addr, size_t size);
240
+ void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
241
+ #ifdef __cplusplus
242
+ } /* extern "C" */
243
+ #endif
244
+ #define UPB_POISON_MEMORY_REGION(addr, size) \
245
+ __asan_poison_memory_region((addr), (size))
246
+ #define UPB_UNPOISON_MEMORY_REGION(addr, size) \
247
+ __asan_unpoison_memory_region((addr), (size))
248
+ #else
249
+ #define UPB_ASAN 0
250
+ #define UPB_POISON_MEMORY_REGION(addr, size) \
251
+ ((void)(addr), (void)(size))
252
+ #define UPB_UNPOISON_MEMORY_REGION(addr, size) \
253
+ ((void)(addr), (void)(size))
254
+ #endif
255
+
256
+ /** upb/decode.h ************************************************************/
257
+ /*
258
+ * upb_decode: parsing into a upb_msg using a upb_msglayout.
259
+ */
260
+
261
+ #ifndef UPB_DECODE_H_
262
+ #define UPB_DECODE_H_
263
+
264
+
265
+ /** upb/msg.h ************************************************************/
266
+ /*
267
+ * Public APIs for message operations that do not require descriptors.
268
+ * These functions can be used even in build that does not want to depend on
269
+ * reflection or descriptors.
270
+ *
271
+ * Descriptor-based reflection functionality lives in reflection.h.
272
+ */
273
+
274
+ #ifndef UPB_MSG_H_
275
+ #define UPB_MSG_H_
276
+
277
+ #include <stddef.h>
278
+
279
+
280
+ /** upb/upb.h ************************************************************/
281
+ /*
282
+ * This file contains shared definitions that are widely used across upb.
283
+ */
284
+
285
+ #ifndef UPB_H_
286
+ #define UPB_H_
287
+
288
+ #include <assert.h>
289
+ #include <stdarg.h>
290
+ #include <stdbool.h>
291
+ #include <stddef.h>
292
+ #include <stdint.h>
293
+ #include <string.h>
294
+
295
+
296
+ #ifdef __cplusplus
297
+ extern "C" {
298
+ #endif
299
+
300
+ /* upb_status *****************************************************************/
301
+
302
+ #define UPB_STATUS_MAX_MESSAGE 127
303
+
304
+ typedef struct {
305
+ bool ok;
306
+ char msg[UPB_STATUS_MAX_MESSAGE]; /* Error message; NULL-terminated. */
307
+ } upb_status;
308
+
309
+ const char *upb_status_errmsg(const upb_status *status);
310
+ bool upb_ok(const upb_status *status);
311
+
312
+ /* These are no-op if |status| is NULL. */
313
+ void upb_status_clear(upb_status *status);
314
+ void upb_status_seterrmsg(upb_status *status, const char *msg);
315
+ void upb_status_seterrf(upb_status *status, const char *fmt, ...)
316
+ UPB_PRINTF(2, 3);
317
+ void upb_status_vseterrf(upb_status *status, const char *fmt, va_list args)
318
+ UPB_PRINTF(2, 0);
319
+ void upb_status_vappenderrf(upb_status *status, const char *fmt, va_list args)
320
+ UPB_PRINTF(2, 0);
321
+
322
+ /** upb_strview ************************************************************/
323
+
324
+ typedef struct {
325
+ const char *data;
326
+ size_t size;
327
+ } upb_strview;
328
+
329
+ UPB_INLINE upb_strview upb_strview_make(const char *data, size_t size) {
330
+ upb_strview ret;
331
+ ret.data = data;
332
+ ret.size = size;
333
+ return ret;
334
+ }
335
+
336
+ UPB_INLINE upb_strview upb_strview_makez(const char *data) {
337
+ return upb_strview_make(data, strlen(data));
338
+ }
339
+
340
+ UPB_INLINE bool upb_strview_eql(upb_strview a, upb_strview b) {
341
+ return a.size == b.size && memcmp(a.data, b.data, a.size) == 0;
342
+ }
343
+
344
+ #define UPB_STRVIEW_INIT(ptr, len) {ptr, len}
345
+
346
+ #define UPB_STRVIEW_FORMAT "%.*s"
347
+ #define UPB_STRVIEW_ARGS(view) (int)(view).size, (view).data
348
+
349
+ /** upb_alloc *****************************************************************/
350
+
351
+ /* A upb_alloc is a possibly-stateful allocator object.
352
+ *
353
+ * It could either be an arena allocator (which doesn't require individual
354
+ * free() calls) or a regular malloc() (which does). The client must therefore
355
+ * free memory unless it knows that the allocator is an arena allocator. */
356
+
357
+ struct upb_alloc;
358
+ typedef struct upb_alloc upb_alloc;
359
+
360
+ /* A malloc()/free() function.
361
+ * If "size" is 0 then the function acts like free(), otherwise it acts like
362
+ * realloc(). Only "oldsize" bytes from a previous allocation are preserved. */
363
+ typedef void *upb_alloc_func(upb_alloc *alloc, void *ptr, size_t oldsize,
364
+ size_t size);
365
+
366
+ struct upb_alloc {
367
+ upb_alloc_func *func;
368
+ };
369
+
370
+ UPB_INLINE void *upb_malloc(upb_alloc *alloc, size_t size) {
371
+ UPB_ASSERT(alloc);
372
+ return alloc->func(alloc, NULL, 0, size);
373
+ }
374
+
375
+ UPB_INLINE void *upb_realloc(upb_alloc *alloc, void *ptr, size_t oldsize,
376
+ size_t size) {
377
+ UPB_ASSERT(alloc);
378
+ return alloc->func(alloc, ptr, oldsize, size);
379
+ }
380
+
381
+ UPB_INLINE void upb_free(upb_alloc *alloc, void *ptr) {
382
+ assert(alloc);
383
+ alloc->func(alloc, ptr, 0, 0);
384
+ }
385
+
386
+ /* The global allocator used by upb. Uses the standard malloc()/free(). */
387
+
388
+ extern upb_alloc upb_alloc_global;
389
+
390
+ /* Functions that hard-code the global malloc.
391
+ *
392
+ * We still get benefit because we can put custom logic into our global
393
+ * allocator, like injecting out-of-memory faults in debug/testing builds. */
394
+
395
+ UPB_INLINE void *upb_gmalloc(size_t size) {
396
+ return upb_malloc(&upb_alloc_global, size);
397
+ }
398
+
399
+ UPB_INLINE void *upb_grealloc(void *ptr, size_t oldsize, size_t size) {
400
+ return upb_realloc(&upb_alloc_global, ptr, oldsize, size);
401
+ }
402
+
403
+ UPB_INLINE void upb_gfree(void *ptr) {
404
+ upb_free(&upb_alloc_global, ptr);
405
+ }
406
+
407
+ /* upb_arena ******************************************************************/
408
+
409
+ /* upb_arena is a specific allocator implementation that uses arena allocation.
410
+ * The user provides an allocator that will be used to allocate the underlying
411
+ * arena blocks. Arenas by nature do not require the individual allocations
412
+ * to be freed. However the Arena does allow users to register cleanup
413
+ * functions that will run when the arena is destroyed.
414
+ *
415
+ * A upb_arena is *not* thread-safe.
416
+ *
417
+ * You could write a thread-safe arena allocator that satisfies the
418
+ * upb_alloc interface, but it would not be as efficient for the
419
+ * single-threaded case. */
420
+
421
+ typedef void upb_cleanup_func(void *ud);
422
+
423
+ struct upb_arena;
424
+ typedef struct upb_arena upb_arena;
425
+
426
+ typedef struct {
427
+ /* We implement the allocator interface.
428
+ * This must be the first member of upb_arena!
429
+ * TODO(haberman): remove once handlers are gone. */
430
+ upb_alloc alloc;
431
+
432
+ char *ptr, *end;
433
+ } _upb_arena_head;
434
+
435
+ /* Creates an arena from the given initial block (if any -- n may be 0).
436
+ * Additional blocks will be allocated from |alloc|. If |alloc| is NULL, this
437
+ * is a fixed-size arena and cannot grow. */
438
+ upb_arena *upb_arena_init(void *mem, size_t n, upb_alloc *alloc);
439
+ void upb_arena_free(upb_arena *a);
440
+ bool upb_arena_addcleanup(upb_arena *a, void *ud, upb_cleanup_func *func);
441
+ bool upb_arena_fuse(upb_arena *a, upb_arena *b);
442
+ void *_upb_arena_slowmalloc(upb_arena *a, size_t size);
443
+
444
+ UPB_INLINE upb_alloc *upb_arena_alloc(upb_arena *a) { return (upb_alloc*)a; }
445
+
446
+ UPB_INLINE size_t _upb_arenahas(upb_arena *a) {
447
+ _upb_arena_head *h = (_upb_arena_head*)a;
448
+ return (size_t)(h->end - h->ptr);
449
+ }
450
+
451
+ UPB_INLINE void *upb_arena_malloc(upb_arena *a, size_t size) {
452
+ _upb_arena_head *h = (_upb_arena_head*)a;
453
+ void* ret;
454
+ size = UPB_ALIGN_MALLOC(size);
455
+
456
+ if (UPB_UNLIKELY(_upb_arenahas(a) < size)) {
457
+ return _upb_arena_slowmalloc(a, size);
458
+ }
459
+
460
+ ret = h->ptr;
461
+ h->ptr += size;
462
+ UPB_UNPOISON_MEMORY_REGION(ret, size);
463
+
464
+ #if UPB_ASAN
465
+ {
466
+ size_t guard_size = 32;
467
+ if (_upb_arenahas(a) >= guard_size) {
468
+ h->ptr += guard_size;
469
+ } else {
470
+ h->ptr = h->end;
471
+ }
472
+ }
473
+ #endif
474
+
475
+ return ret;
476
+ }
477
+
478
+ UPB_INLINE void *upb_arena_realloc(upb_arena *a, void *ptr, size_t oldsize,
479
+ size_t size) {
480
+ void *ret = upb_arena_malloc(a, size);
481
+
482
+ if (ret && oldsize > 0) {
483
+ memcpy(ret, ptr, oldsize);
484
+ }
485
+
486
+ return ret;
487
+ }
488
+
489
+ UPB_INLINE upb_arena *upb_arena_new(void) {
490
+ return upb_arena_init(NULL, 0, &upb_alloc_global);
491
+ }
492
+
493
+ /* Constants ******************************************************************/
494
+
495
+ /* Generic function type. */
496
+ typedef void upb_func(void);
497
+
498
+ /* A list of types as they are encoded on-the-wire. */
499
+ typedef enum {
500
+ UPB_WIRE_TYPE_VARINT = 0,
501
+ UPB_WIRE_TYPE_64BIT = 1,
502
+ UPB_WIRE_TYPE_DELIMITED = 2,
503
+ UPB_WIRE_TYPE_START_GROUP = 3,
504
+ UPB_WIRE_TYPE_END_GROUP = 4,
505
+ UPB_WIRE_TYPE_32BIT = 5
506
+ } upb_wiretype_t;
507
+
508
+ /* The types a field can have. Note that this list is not identical to the
509
+ * types defined in descriptor.proto, which gives INT32 and SINT32 separate
510
+ * types (we distinguish the two with the "integer encoding" enum below). */
511
+ typedef enum {
512
+ UPB_TYPE_BOOL = 1,
513
+ UPB_TYPE_FLOAT = 2,
514
+ UPB_TYPE_INT32 = 3,
515
+ UPB_TYPE_UINT32 = 4,
516
+ UPB_TYPE_ENUM = 5, /* Enum values are int32. */
517
+ UPB_TYPE_MESSAGE = 6,
518
+ UPB_TYPE_DOUBLE = 7,
519
+ UPB_TYPE_INT64 = 8,
520
+ UPB_TYPE_UINT64 = 9,
521
+ UPB_TYPE_STRING = 10,
522
+ UPB_TYPE_BYTES = 11
523
+ } upb_fieldtype_t;
524
+
525
+ /* The repeated-ness of each field; this matches descriptor.proto. */
526
+ typedef enum {
527
+ UPB_LABEL_OPTIONAL = 1,
528
+ UPB_LABEL_REQUIRED = 2,
529
+ UPB_LABEL_REPEATED = 3
530
+ } upb_label_t;
531
+
532
+ /* Descriptor types, as defined in descriptor.proto. */
533
+ typedef enum {
534
+ /* Old (long) names. TODO(haberman): remove */
535
+ UPB_DESCRIPTOR_TYPE_DOUBLE = 1,
536
+ UPB_DESCRIPTOR_TYPE_FLOAT = 2,
537
+ UPB_DESCRIPTOR_TYPE_INT64 = 3,
538
+ UPB_DESCRIPTOR_TYPE_UINT64 = 4,
539
+ UPB_DESCRIPTOR_TYPE_INT32 = 5,
540
+ UPB_DESCRIPTOR_TYPE_FIXED64 = 6,
541
+ UPB_DESCRIPTOR_TYPE_FIXED32 = 7,
542
+ UPB_DESCRIPTOR_TYPE_BOOL = 8,
543
+ UPB_DESCRIPTOR_TYPE_STRING = 9,
544
+ UPB_DESCRIPTOR_TYPE_GROUP = 10,
545
+ UPB_DESCRIPTOR_TYPE_MESSAGE = 11,
546
+ UPB_DESCRIPTOR_TYPE_BYTES = 12,
547
+ UPB_DESCRIPTOR_TYPE_UINT32 = 13,
548
+ UPB_DESCRIPTOR_TYPE_ENUM = 14,
549
+ UPB_DESCRIPTOR_TYPE_SFIXED32 = 15,
550
+ UPB_DESCRIPTOR_TYPE_SFIXED64 = 16,
551
+ UPB_DESCRIPTOR_TYPE_SINT32 = 17,
552
+ UPB_DESCRIPTOR_TYPE_SINT64 = 18,
553
+
554
+ UPB_DTYPE_DOUBLE = 1,
555
+ UPB_DTYPE_FLOAT = 2,
556
+ UPB_DTYPE_INT64 = 3,
557
+ UPB_DTYPE_UINT64 = 4,
558
+ UPB_DTYPE_INT32 = 5,
559
+ UPB_DTYPE_FIXED64 = 6,
560
+ UPB_DTYPE_FIXED32 = 7,
561
+ UPB_DTYPE_BOOL = 8,
562
+ UPB_DTYPE_STRING = 9,
563
+ UPB_DTYPE_GROUP = 10,
564
+ UPB_DTYPE_MESSAGE = 11,
565
+ UPB_DTYPE_BYTES = 12,
566
+ UPB_DTYPE_UINT32 = 13,
567
+ UPB_DTYPE_ENUM = 14,
568
+ UPB_DTYPE_SFIXED32 = 15,
569
+ UPB_DTYPE_SFIXED64 = 16,
570
+ UPB_DTYPE_SINT32 = 17,
571
+ UPB_DTYPE_SINT64 = 18
572
+ } upb_descriptortype_t;
573
+
574
+ #define UPB_MAP_BEGIN ((size_t)-1)
575
+
576
+ UPB_INLINE bool _upb_isle(void) {
577
+ int x = 1;
578
+ return *(char*)&x == 1;
579
+ }
580
+
581
+ UPB_INLINE uint32_t _upb_be_swap32(uint32_t val) {
582
+ if (_upb_isle()) {
583
+ return val;
584
+ } else {
585
+ return ((val & 0xff) << 24) | ((val & 0xff00) << 8) |
586
+ ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24);
587
+ }
588
+ }
589
+
590
+ UPB_INLINE uint64_t _upb_be_swap64(uint64_t val) {
591
+ if (_upb_isle()) {
592
+ return val;
593
+ } else {
594
+ return ((uint64_t)_upb_be_swap32(val) << 32) | _upb_be_swap32(val >> 32);
595
+ }
596
+ }
597
+
598
+ UPB_INLINE int _upb_lg2ceil(int x) {
599
+ if (x <= 1) return 0;
600
+ #ifdef __GNUC__
601
+ return 32 - __builtin_clz(x - 1);
602
+ #else
603
+ int lg2 = 0;
604
+ while (1 << lg2 < x) lg2++;
605
+ return lg2;
606
+ #endif
607
+ }
608
+
609
+ UPB_INLINE int _upb_lg2ceilsize(int x) {
610
+ return 1 << _upb_lg2ceil(x);
611
+ }
612
+
613
+
614
+ #ifdef __cplusplus
615
+ } /* extern "C" */
616
+ #endif
617
+
618
+ #endif /* UPB_H_ */
619
+
620
+ #ifdef __cplusplus
621
+ extern "C" {
622
+ #endif
623
+
624
+ typedef void upb_msg;
625
+
626
+ /* For users these are opaque. They can be obtained from upb_msgdef_layout()
627
+ * but users cannot access any of the members. */
628
+ struct upb_msglayout;
629
+ typedef struct upb_msglayout upb_msglayout;
630
+
631
+ /* Adds unknown data (serialized protobuf data) to the given message. The data
632
+ * is copied into the message instance. */
633
+ void upb_msg_addunknown(upb_msg *msg, const char *data, size_t len,
634
+ upb_arena *arena);
635
+
636
+ /* Returns a reference to the message's unknown data. */
637
+ const char *upb_msg_getunknown(const upb_msg *msg, size_t *len);
638
+
639
+ #ifdef __cplusplus
640
+ } /* extern "C" */
641
+ #endif
642
+
643
+ #endif /* UPB_MSG_INT_H_ */
644
+
645
+ /* Must be last. */
646
+
647
+ #ifdef __cplusplus
648
+ extern "C" {
649
+ #endif
650
+
651
+ enum {
652
+ /* If set, strings will alias the input buffer instead of copying into the
653
+ * arena. */
654
+ UPB_DECODE_ALIAS = 1,
655
+ };
656
+
657
+ #define UPB_DECODE_MAXDEPTH(depth) ((depth) << 16)
658
+
659
+ bool _upb_decode(const char *buf, size_t size, upb_msg *msg,
660
+ const upb_msglayout *l, upb_arena *arena, int options);
661
+
662
+ UPB_INLINE
663
+ bool upb_decode(const char *buf, size_t size, upb_msg *msg,
664
+ const upb_msglayout *l, upb_arena *arena) {
665
+ return _upb_decode(buf, size, msg, l, arena, 0);
666
+ }
667
+
668
+ #ifdef __cplusplus
669
+ } /* extern "C" */
670
+ #endif
671
+
672
+
673
+ #endif /* UPB_DECODE_H_ */
674
+
675
+ /** upb/decode_internal.h ************************************************************/
676
+ /*
677
+ * Internal implementation details of the decoder that are shared between
678
+ * decode.c and decode_fast.c.
679
+ */
680
+
681
+ #ifndef UPB_DECODE_INT_H_
682
+ #define UPB_DECODE_INT_H_
683
+
684
+ #include <setjmp.h>
685
+
686
+
687
+ /** upb/msg_internal.h ************************************************************//*
688
+ ** Our memory representation for parsing tables and messages themselves.
689
+ ** Functions in this file are used by generated code and possibly reflection.
690
+ **
691
+ ** The definitions in this file are internal to upb.
692
+ **/
693
+
694
+ #ifndef UPB_MSG_INT_H_
695
+ #define UPB_MSG_INT_H_
696
+
697
+ #include <stdint.h>
698
+ #include <stdlib.h>
699
+ #include <string.h>
700
+
701
+
702
+ /** upb/table_internal.h ************************************************************/
703
+ /*
704
+ * upb_table
705
+ *
706
+ * This header is INTERNAL-ONLY! Its interfaces are not public or stable!
707
+ * This file defines very fast int->upb_value (inttable) and string->upb_value
708
+ * (strtable) hash tables.
709
+ *
710
+ * The table uses chained scatter with Brent's variation (inspired by the Lua
711
+ * implementation of hash tables). The hash function for strings is Austin
712
+ * Appleby's "MurmurHash."
713
+ *
714
+ * The inttable uses uintptr_t as its key, which guarantees it can be used to
715
+ * store pointers or integers of at least 32 bits (upb isn't really useful on
716
+ * systems where sizeof(void*) < 4).
717
+ *
718
+ * The table must be homogeneous (all values of the same type). In debug
719
+ * mode, we check this on insert and lookup.
720
+ */
721
+
722
+ #ifndef UPB_TABLE_H_
723
+ #define UPB_TABLE_H_
724
+
725
+ #include <stdint.h>
726
+ #include <string.h>
727
+
728
+
729
+ #ifdef __cplusplus
730
+ extern "C" {
731
+ #endif
732
+
733
+
734
+ /* upb_value ******************************************************************/
735
+
736
+ typedef struct {
737
+ uint64_t val;
738
+ } upb_value;
739
+
740
+ /* Variant that works with a length-delimited rather than NULL-delimited string,
741
+ * as supported by strtable. */
742
+ char *upb_strdup2(const char *s, size_t len, upb_arena *a);
743
+
744
+ UPB_INLINE void _upb_value_setval(upb_value *v, uint64_t val) {
745
+ v->val = val;
746
+ }
747
+
748
+ /* For each value ctype, define the following set of functions:
749
+ *
750
+ * // Get/set an int32 from a upb_value.
751
+ * int32_t upb_value_getint32(upb_value val);
752
+ * void upb_value_setint32(upb_value *val, int32_t cval);
753
+ *
754
+ * // Construct a new upb_value from an int32.
755
+ * upb_value upb_value_int32(int32_t val); */
756
+ #define FUNCS(name, membername, type_t, converter, proto_type) \
757
+ UPB_INLINE void upb_value_set ## name(upb_value *val, type_t cval) { \
758
+ val->val = (converter)cval; \
759
+ } \
760
+ UPB_INLINE upb_value upb_value_ ## name(type_t val) { \
761
+ upb_value ret; \
762
+ upb_value_set ## name(&ret, val); \
763
+ return ret; \
764
+ } \
765
+ UPB_INLINE type_t upb_value_get ## name(upb_value val) { \
766
+ return (type_t)(converter)val.val; \
767
+ }
768
+
769
+ FUNCS(int32, int32, int32_t, int32_t, UPB_CTYPE_INT32)
770
+ FUNCS(int64, int64, int64_t, int64_t, UPB_CTYPE_INT64)
771
+ FUNCS(uint32, uint32, uint32_t, uint32_t, UPB_CTYPE_UINT32)
772
+ FUNCS(uint64, uint64, uint64_t, uint64_t, UPB_CTYPE_UINT64)
773
+ FUNCS(bool, _bool, bool, bool, UPB_CTYPE_BOOL)
774
+ FUNCS(cstr, cstr, char*, uintptr_t, UPB_CTYPE_CSTR)
775
+ FUNCS(ptr, ptr, void*, uintptr_t, UPB_CTYPE_PTR)
776
+ FUNCS(constptr, constptr, const void*, uintptr_t, UPB_CTYPE_CONSTPTR)
777
+ FUNCS(fptr, fptr, upb_func*, uintptr_t, UPB_CTYPE_FPTR)
778
+
779
+ #undef FUNCS
780
+
781
+ UPB_INLINE void upb_value_setfloat(upb_value *val, float cval) {
782
+ memcpy(&val->val, &cval, sizeof(cval));
783
+ }
784
+
785
+ UPB_INLINE void upb_value_setdouble(upb_value *val, double cval) {
786
+ memcpy(&val->val, &cval, sizeof(cval));
787
+ }
788
+
789
+ UPB_INLINE upb_value upb_value_float(float cval) {
790
+ upb_value ret;
791
+ upb_value_setfloat(&ret, cval);
792
+ return ret;
793
+ }
794
+
795
+ UPB_INLINE upb_value upb_value_double(double cval) {
796
+ upb_value ret;
797
+ upb_value_setdouble(&ret, cval);
798
+ return ret;
799
+ }
800
+
801
+ #undef SET_TYPE
802
+
803
+
804
+ /* upb_tabkey *****************************************************************/
805
+
806
+ /* Either:
807
+ * 1. an actual integer key, or
808
+ * 2. a pointer to a string prefixed by its uint32_t length, owned by us.
809
+ *
810
+ * ...depending on whether this is a string table or an int table. We would
811
+ * make this a union of those two types, but C89 doesn't support statically
812
+ * initializing a non-first union member. */
813
+ typedef uintptr_t upb_tabkey;
814
+
815
+ UPB_INLINE char *upb_tabstr(upb_tabkey key, uint32_t *len) {
816
+ char* mem = (char*)key;
817
+ if (len) memcpy(len, mem, sizeof(*len));
818
+ return mem + sizeof(*len);
819
+ }
820
+
821
+ UPB_INLINE upb_strview upb_tabstrview(upb_tabkey key) {
822
+ upb_strview ret;
823
+ uint32_t len;
824
+ ret.data = upb_tabstr(key, &len);
825
+ ret.size = len;
826
+ return ret;
827
+ }
828
+
829
+ /* upb_tabval *****************************************************************/
830
+
831
+ typedef struct upb_tabval {
832
+ uint64_t val;
833
+ } upb_tabval;
834
+
835
+ #define UPB_TABVALUE_EMPTY_INIT {-1}
836
+
837
+ /* upb_table ******************************************************************/
838
+
839
+ typedef struct _upb_tabent {
840
+ upb_tabkey key;
841
+ upb_tabval val;
842
+
843
+ /* Internal chaining. This is const so we can create static initializers for
844
+ * tables. We cast away const sometimes, but *only* when the containing
845
+ * upb_table is known to be non-const. This requires a bit of care, but
846
+ * the subtlety is confined to table.c. */
847
+ const struct _upb_tabent *next;
848
+ } upb_tabent;
849
+
850
+ typedef struct {
851
+ size_t count; /* Number of entries in the hash part. */
852
+ uint32_t mask; /* Mask to turn hash value -> bucket. */
853
+ uint32_t max_count; /* Max count before we hit our load limit. */
854
+ uint8_t size_lg2; /* Size of the hashtable part is 2^size_lg2 entries. */
855
+ upb_tabent *entries;
856
+ } upb_table;
857
+
858
+ typedef struct {
859
+ upb_table t;
860
+ } upb_strtable;
861
+
862
+ typedef struct {
863
+ upb_table t; /* For entries that don't fit in the array part. */
864
+ const upb_tabval *array; /* Array part of the table. See const note above. */
865
+ size_t array_size; /* Array part size. */
866
+ size_t array_count; /* Array part number of elements. */
867
+ } upb_inttable;
868
+
869
+ UPB_INLINE size_t upb_table_size(const upb_table *t) {
870
+ if (t->size_lg2 == 0)
871
+ return 0;
872
+ else
873
+ return 1 << t->size_lg2;
874
+ }
875
+
876
+ /* Internal-only functions, in .h file only out of necessity. */
877
+ UPB_INLINE bool upb_tabent_isempty(const upb_tabent *e) {
878
+ return e->key == 0;
879
+ }
880
+
881
+ /* Initialize and uninitialize a table, respectively. If memory allocation
882
+ * failed, false is returned that the table is uninitialized. */
883
+ bool upb_inttable_init(upb_inttable *table, upb_arena *a);
884
+ bool upb_strtable_init(upb_strtable *table, size_t expected_size, upb_arena *a);
885
+
886
+ /* Returns the number of values in the table. */
887
+ size_t upb_inttable_count(const upb_inttable *t);
888
+ UPB_INLINE size_t upb_strtable_count(const upb_strtable *t) {
889
+ return t->t.count;
890
+ }
891
+
892
+ void upb_strtable_clear(upb_strtable *t);
893
+
894
+ /* Inserts the given key into the hashtable with the given value. The key must
895
+ * not already exist in the hash table. For string tables, the key must be
896
+ * NULL-terminated, and the table will make an internal copy of the key.
897
+ * Inttables must not insert a value of UINTPTR_MAX.
898
+ *
899
+ * If a table resize was required but memory allocation failed, false is
900
+ * returned and the table is unchanged. */
901
+ bool upb_inttable_insert(upb_inttable *t, uintptr_t key, upb_value val,
902
+ upb_arena *a);
903
+ bool upb_strtable_insert(upb_strtable *t, const char *key, size_t len,
904
+ upb_value val, upb_arena *a);
905
+
906
+ /* Looks up key in this table, returning "true" if the key was found.
907
+ * If v is non-NULL, copies the value for this key into *v. */
908
+ bool upb_inttable_lookup(const upb_inttable *t, uintptr_t key, upb_value *v);
909
+ bool upb_strtable_lookup2(const upb_strtable *t, const char *key, size_t len,
910
+ upb_value *v);
911
+
912
+ /* For NULL-terminated strings. */
913
+ UPB_INLINE bool upb_strtable_lookup(const upb_strtable *t, const char *key,
914
+ upb_value *v) {
915
+ return upb_strtable_lookup2(t, key, strlen(key), v);
916
+ }
917
+
918
+ /* Removes an item from the table. Returns true if the remove was successful,
919
+ * and stores the removed item in *val if non-NULL. */
920
+ bool upb_inttable_remove(upb_inttable *t, uintptr_t key, upb_value *val);
921
+ bool upb_strtable_remove(upb_strtable *t, const char *key, size_t len,
922
+ upb_value *val);
923
+
924
+ /* Updates an existing entry in an inttable. If the entry does not exist,
925
+ * returns false and does nothing. Unlike insert/remove, this does not
926
+ * invalidate iterators. */
927
+ bool upb_inttable_replace(upb_inttable *t, uintptr_t key, upb_value val);
928
+
929
+ /* Optimizes the table for the current set of entries, for both memory use and
930
+ * lookup time. Client should call this after all entries have been inserted;
931
+ * inserting more entries is legal, but will likely require a table resize. */
932
+ void upb_inttable_compact(upb_inttable *t, upb_arena *a);
933
+
934
+ /* Exposed for testing only. */
935
+ bool upb_strtable_resize(upb_strtable *t, size_t size_lg2, upb_arena *a);
936
+
937
+ /* Iterators ******************************************************************/
938
+
939
+ /* Iterators for int and string tables. We are subject to some kind of unusual
940
+ * design constraints:
941
+ *
942
+ * For high-level languages:
943
+ * - we must be able to guarantee that we don't crash or corrupt memory even if
944
+ * the program accesses an invalidated iterator.
945
+ *
946
+ * For C++11 range-based for:
947
+ * - iterators must be copyable
948
+ * - iterators must be comparable
949
+ * - it must be possible to construct an "end" value.
950
+ *
951
+ * Iteration order is undefined.
952
+ *
953
+ * Modifying the table invalidates iterators. upb_{str,int}table_done() is
954
+ * guaranteed to work even on an invalidated iterator, as long as the table it
955
+ * is iterating over has not been freed. Calling next() or accessing data from
956
+ * an invalidated iterator yields unspecified elements from the table, but it is
957
+ * guaranteed not to crash and to return real table elements (except when done()
958
+ * is true). */
959
+
960
+
961
+ /* upb_strtable_iter **********************************************************/
962
+
963
+ /* upb_strtable_iter i;
964
+ * upb_strtable_begin(&i, t);
965
+ * for(; !upb_strtable_done(&i); upb_strtable_next(&i)) {
966
+ * const char *key = upb_strtable_iter_key(&i);
967
+ * const upb_value val = upb_strtable_iter_value(&i);
968
+ * // ...
969
+ * }
970
+ */
971
+
972
+ typedef struct {
973
+ const upb_strtable *t;
974
+ size_t index;
975
+ } upb_strtable_iter;
976
+
977
+ void upb_strtable_begin(upb_strtable_iter *i, const upb_strtable *t);
978
+ void upb_strtable_next(upb_strtable_iter *i);
979
+ bool upb_strtable_done(const upb_strtable_iter *i);
980
+ upb_strview upb_strtable_iter_key(const upb_strtable_iter *i);
981
+ upb_value upb_strtable_iter_value(const upb_strtable_iter *i);
982
+ void upb_strtable_iter_setdone(upb_strtable_iter *i);
983
+ bool upb_strtable_iter_isequal(const upb_strtable_iter *i1,
984
+ const upb_strtable_iter *i2);
985
+
986
+
987
+ /* upb_inttable_iter **********************************************************/
988
+
989
+ /* upb_inttable_iter i;
990
+ * upb_inttable_begin(&i, t);
991
+ * for(; !upb_inttable_done(&i); upb_inttable_next(&i)) {
992
+ * uintptr_t key = upb_inttable_iter_key(&i);
993
+ * upb_value val = upb_inttable_iter_value(&i);
994
+ * // ...
995
+ * }
996
+ */
997
+
998
+ typedef struct {
999
+ const upb_inttable *t;
1000
+ size_t index;
1001
+ bool array_part;
1002
+ } upb_inttable_iter;
1003
+
1004
+ UPB_INLINE const upb_tabent *str_tabent(const upb_strtable_iter *i) {
1005
+ return &i->t->t.entries[i->index];
1006
+ }
1007
+
1008
+ void upb_inttable_begin(upb_inttable_iter *i, const upb_inttable *t);
1009
+ void upb_inttable_next(upb_inttable_iter *i);
1010
+ bool upb_inttable_done(const upb_inttable_iter *i);
1011
+ uintptr_t upb_inttable_iter_key(const upb_inttable_iter *i);
1012
+ upb_value upb_inttable_iter_value(const upb_inttable_iter *i);
1013
+ void upb_inttable_iter_setdone(upb_inttable_iter *i);
1014
+ bool upb_inttable_iter_isequal(const upb_inttable_iter *i1,
1015
+ const upb_inttable_iter *i2);
1016
+
1017
+
1018
+ #ifdef __cplusplus
1019
+ } /* extern "C" */
1020
+ #endif
1021
+
1022
+
1023
+ #endif /* UPB_TABLE_H_ */
1024
+
1025
+ /* Must be last. */
1026
+
1027
+ #ifdef __cplusplus
1028
+ extern "C" {
1029
+ #endif
1030
+
1031
+ /** upb_msglayout *************************************************************/
1032
+
1033
+ /* upb_msglayout represents the memory layout of a given upb_msgdef. The
1034
+ * members are public so generated code can initialize them, but users MUST NOT
1035
+ * read or write any of its members. */
1036
+
1037
+ /* These aren't real labels according to descriptor.proto, but in the table we
1038
+ * use these for map/packed fields instead of UPB_LABEL_REPEATED. */
1039
+ enum {
1040
+ _UPB_LABEL_MAP = 4,
1041
+ _UPB_LABEL_PACKED = 7 /* Low 3 bits are common with UPB_LABEL_REPEATED. */
1042
+ };
1043
+
1044
+ typedef struct {
1045
+ uint32_t number;
1046
+ uint16_t offset;
1047
+ int16_t presence; /* If >0, hasbit_index. If <0, ~oneof_index. */
1048
+ uint16_t submsg_index; /* undefined if descriptortype != MESSAGE or GROUP. */
1049
+ uint8_t descriptortype;
1050
+ uint8_t label; /* google.protobuf.Label or _UPB_LABEL_* above. */
1051
+ } upb_msglayout_field;
1052
+
1053
+ struct upb_decstate;
1054
+ struct upb_msglayout;
1055
+
1056
+ typedef const char *_upb_field_parser(struct upb_decstate *d, const char *ptr,
1057
+ upb_msg *msg, intptr_t table,
1058
+ uint64_t hasbits, uint64_t data);
1059
+
1060
+ typedef struct {
1061
+ uint64_t field_data;
1062
+ _upb_field_parser *field_parser;
1063
+ } _upb_fasttable_entry;
1064
+
1065
+ struct upb_msglayout {
1066
+ const struct upb_msglayout *const* submsgs;
1067
+ const upb_msglayout_field *fields;
1068
+ /* Must be aligned to sizeof(void*). Doesn't include internal members like
1069
+ * unknown fields, extension dict, pointer to msglayout, etc. */
1070
+ uint16_t size;
1071
+ uint16_t field_count;
1072
+ bool extendable;
1073
+ uint8_t table_mask;
1074
+ /* To constant-initialize the tables of variable length, we need a flexible
1075
+ * array member, and we need to compile in C99 mode. */
1076
+ _upb_fasttable_entry fasttable[];
1077
+ };
1078
+
1079
+ /** upb_msg *******************************************************************/
1080
+
1081
+ /* Internal members of a upb_msg. We can change this without breaking binary
1082
+ * compatibility. We put these before the user's data. The user's upb_msg*
1083
+ * points after the upb_msg_internal. */
1084
+
1085
+ typedef struct {
1086
+ uint32_t len;
1087
+ uint32_t size;
1088
+ /* Data follows. */
1089
+ } upb_msg_unknowndata;
1090
+
1091
+ /* Used when a message is not extendable. */
1092
+ typedef struct {
1093
+ upb_msg_unknowndata *unknown;
1094
+ } upb_msg_internal;
1095
+
1096
+ /* Maps upb_fieldtype_t -> memory size. */
1097
+ extern char _upb_fieldtype_to_size[12];
1098
+
1099
+ UPB_INLINE size_t upb_msg_sizeof(const upb_msglayout *l) {
1100
+ return l->size + sizeof(upb_msg_internal);
1101
+ }
1102
+
1103
+ UPB_INLINE upb_msg *_upb_msg_new_inl(const upb_msglayout *l, upb_arena *a) {
1104
+ size_t size = upb_msg_sizeof(l);
1105
+ void *mem = upb_arena_malloc(a, size);
1106
+ upb_msg *msg;
1107
+ if (UPB_UNLIKELY(!mem)) return NULL;
1108
+ msg = UPB_PTR_AT(mem, sizeof(upb_msg_internal), upb_msg);
1109
+ memset(mem, 0, size);
1110
+ return msg;
1111
+ }
1112
+
1113
+ /* Creates a new messages with the given layout on the given arena. */
1114
+ upb_msg *_upb_msg_new(const upb_msglayout *l, upb_arena *a);
1115
+
1116
+ UPB_INLINE upb_msg_internal *upb_msg_getinternal(upb_msg *msg) {
1117
+ ptrdiff_t size = sizeof(upb_msg_internal);
1118
+ return (upb_msg_internal*)((char*)msg - size);
1119
+ }
1120
+
1121
+ /* Clears the given message. */
1122
+ void _upb_msg_clear(upb_msg *msg, const upb_msglayout *l);
1123
+
1124
+ /* Discards the unknown fields for this message only. */
1125
+ void _upb_msg_discardunknown_shallow(upb_msg *msg);
1126
+
1127
+ /* Adds unknown data (serialized protobuf data) to the given message. The data
1128
+ * is copied into the message instance. */
1129
+ bool _upb_msg_addunknown(upb_msg *msg, const char *data, size_t len,
1130
+ upb_arena *arena);
1131
+
1132
+ /** Hasbit access *************************************************************/
1133
+
1134
+ UPB_INLINE bool _upb_hasbit(const upb_msg *msg, size_t idx) {
1135
+ return (*UPB_PTR_AT(msg, idx / 8, const char) & (1 << (idx % 8))) != 0;
1136
+ }
1137
+
1138
+ UPB_INLINE void _upb_sethas(const upb_msg *msg, size_t idx) {
1139
+ (*UPB_PTR_AT(msg, idx / 8, char)) |= (char)(1 << (idx % 8));
1140
+ }
1141
+
1142
+ UPB_INLINE void _upb_clearhas(const upb_msg *msg, size_t idx) {
1143
+ (*UPB_PTR_AT(msg, idx / 8, char)) &= (char)(~(1 << (idx % 8)));
1144
+ }
1145
+
1146
+ UPB_INLINE size_t _upb_msg_hasidx(const upb_msglayout_field *f) {
1147
+ UPB_ASSERT(f->presence > 0);
1148
+ return f->presence;
1149
+ }
1150
+
1151
+ UPB_INLINE bool _upb_hasbit_field(const upb_msg *msg,
1152
+ const upb_msglayout_field *f) {
1153
+ return _upb_hasbit(msg, _upb_msg_hasidx(f));
1154
+ }
1155
+
1156
+ UPB_INLINE void _upb_sethas_field(const upb_msg *msg,
1157
+ const upb_msglayout_field *f) {
1158
+ _upb_sethas(msg, _upb_msg_hasidx(f));
1159
+ }
1160
+
1161
+ UPB_INLINE void _upb_clearhas_field(const upb_msg *msg,
1162
+ const upb_msglayout_field *f) {
1163
+ _upb_clearhas(msg, _upb_msg_hasidx(f));
1164
+ }
1165
+
1166
+ /** Oneof case access *********************************************************/
1167
+
1168
+ UPB_INLINE uint32_t *_upb_oneofcase(upb_msg *msg, size_t case_ofs) {
1169
+ return UPB_PTR_AT(msg, case_ofs, uint32_t);
1170
+ }
1171
+
1172
+ UPB_INLINE uint32_t _upb_getoneofcase(const void *msg, size_t case_ofs) {
1173
+ return *UPB_PTR_AT(msg, case_ofs, uint32_t);
1174
+ }
1175
+
1176
+ UPB_INLINE size_t _upb_oneofcase_ofs(const upb_msglayout_field *f) {
1177
+ UPB_ASSERT(f->presence < 0);
1178
+ return ~(ptrdiff_t)f->presence;
1179
+ }
1180
+
1181
+ UPB_INLINE uint32_t *_upb_oneofcase_field(upb_msg *msg,
1182
+ const upb_msglayout_field *f) {
1183
+ return _upb_oneofcase(msg, _upb_oneofcase_ofs(f));
1184
+ }
1185
+
1186
+ UPB_INLINE uint32_t _upb_getoneofcase_field(const upb_msg *msg,
1187
+ const upb_msglayout_field *f) {
1188
+ return _upb_getoneofcase(msg, _upb_oneofcase_ofs(f));
1189
+ }
1190
+
1191
+ UPB_INLINE bool _upb_has_submsg_nohasbit(const upb_msg *msg, size_t ofs) {
1192
+ return *UPB_PTR_AT(msg, ofs, const upb_msg*) != NULL;
1193
+ }
1194
+
1195
+ UPB_INLINE bool _upb_isrepeated(const upb_msglayout_field *field) {
1196
+ return (field->label & 3) == UPB_LABEL_REPEATED;
1197
+ }
1198
+
1199
+ UPB_INLINE bool _upb_repeated_or_map(const upb_msglayout_field *field) {
1200
+ return field->label >= UPB_LABEL_REPEATED;
1201
+ }
1202
+
1203
+ /** upb_array *****************************************************************/
1204
+
1205
+ /* Our internal representation for repeated fields. */
1206
+ typedef struct {
1207
+ uintptr_t data; /* Tagged ptr: low 3 bits of ptr are lg2(elem size). */
1208
+ size_t len; /* Measured in elements. */
1209
+ size_t size; /* Measured in elements. */
1210
+ uint64_t junk;
1211
+ } upb_array;
1212
+
1213
+ UPB_INLINE const void *_upb_array_constptr(const upb_array *arr) {
1214
+ UPB_ASSERT((arr->data & 7) <= 4);
1215
+ return (void*)(arr->data & ~(uintptr_t)7);
1216
+ }
1217
+
1218
+ UPB_INLINE uintptr_t _upb_array_tagptr(void* ptr, int elem_size_lg2) {
1219
+ UPB_ASSERT(elem_size_lg2 <= 4);
1220
+ return (uintptr_t)ptr | elem_size_lg2;
1221
+ }
1222
+
1223
+ UPB_INLINE void *_upb_array_ptr(upb_array *arr) {
1224
+ return (void*)_upb_array_constptr(arr);
1225
+ }
1226
+
1227
+ UPB_INLINE uintptr_t _upb_tag_arrptr(void* ptr, int elem_size_lg2) {
1228
+ UPB_ASSERT(elem_size_lg2 <= 4);
1229
+ UPB_ASSERT(((uintptr_t)ptr & 7) == 0);
1230
+ return (uintptr_t)ptr | (unsigned)elem_size_lg2;
1231
+ }
1232
+
1233
+ UPB_INLINE upb_array *_upb_array_new(upb_arena *a, size_t init_size,
1234
+ int elem_size_lg2) {
1235
+ const size_t arr_size = UPB_ALIGN_UP(sizeof(upb_array), 8);
1236
+ const size_t bytes = sizeof(upb_array) + (init_size << elem_size_lg2);
1237
+ upb_array *arr = (upb_array*)upb_arena_malloc(a, bytes);
1238
+ if (!arr) return NULL;
1239
+ arr->data = _upb_tag_arrptr(UPB_PTR_AT(arr, arr_size, void), elem_size_lg2);
1240
+ arr->len = 0;
1241
+ arr->size = init_size;
1242
+ return arr;
1243
+ }
1244
+
1245
+ /* Resizes the capacity of the array to be at least min_size. */
1246
+ bool _upb_array_realloc(upb_array *arr, size_t min_size, upb_arena *arena);
1247
+
1248
+ /* Fallback functions for when the accessors require a resize. */
1249
+ void *_upb_array_resize_fallback(upb_array **arr_ptr, size_t size,
1250
+ int elem_size_lg2, upb_arena *arena);
1251
+ bool _upb_array_append_fallback(upb_array **arr_ptr, const void *value,
1252
+ int elem_size_lg2, upb_arena *arena);
1253
+
1254
+ UPB_INLINE bool _upb_array_reserve(upb_array *arr, size_t size,
1255
+ upb_arena *arena) {
1256
+ if (arr->size < size) return _upb_array_realloc(arr, size, arena);
1257
+ return true;
1258
+ }
1259
+
1260
+ UPB_INLINE bool _upb_array_resize(upb_array *arr, size_t size,
1261
+ upb_arena *arena) {
1262
+ if (!_upb_array_reserve(arr, size, arena)) return false;
1263
+ arr->len = size;
1264
+ return true;
1265
+ }
1266
+
1267
+ UPB_INLINE const void *_upb_array_accessor(const void *msg, size_t ofs,
1268
+ size_t *size) {
1269
+ const upb_array *arr = *UPB_PTR_AT(msg, ofs, const upb_array*);
1270
+ if (arr) {
1271
+ if (size) *size = arr->len;
1272
+ return _upb_array_constptr(arr);
1273
+ } else {
1274
+ if (size) *size = 0;
1275
+ return NULL;
1276
+ }
1277
+ }
1278
+
1279
+ UPB_INLINE void *_upb_array_mutable_accessor(void *msg, size_t ofs,
1280
+ size_t *size) {
1281
+ upb_array *arr = *UPB_PTR_AT(msg, ofs, upb_array*);
1282
+ if (arr) {
1283
+ if (size) *size = arr->len;
1284
+ return _upb_array_ptr(arr);
1285
+ } else {
1286
+ if (size) *size = 0;
1287
+ return NULL;
1288
+ }
1289
+ }
1290
+
1291
+ UPB_INLINE void *_upb_array_resize_accessor2(void *msg, size_t ofs, size_t size,
1292
+ int elem_size_lg2,
1293
+ upb_arena *arena) {
1294
+ upb_array **arr_ptr = UPB_PTR_AT(msg, ofs, upb_array *);
1295
+ upb_array *arr = *arr_ptr;
1296
+ if (!arr || arr->size < size) {
1297
+ return _upb_array_resize_fallback(arr_ptr, size, elem_size_lg2, arena);
1298
+ }
1299
+ arr->len = size;
1300
+ return _upb_array_ptr(arr);
1301
+ }
1302
+
1303
+ UPB_INLINE bool _upb_array_append_accessor2(void *msg, size_t ofs,
1304
+ int elem_size_lg2,
1305
+ const void *value,
1306
+ upb_arena *arena) {
1307
+ upb_array **arr_ptr = UPB_PTR_AT(msg, ofs, upb_array *);
1308
+ size_t elem_size = 1 << elem_size_lg2;
1309
+ upb_array *arr = *arr_ptr;
1310
+ void *ptr;
1311
+ if (!arr || arr->len == arr->size) {
1312
+ return _upb_array_append_fallback(arr_ptr, value, elem_size_lg2, arena);
1313
+ }
1314
+ ptr = _upb_array_ptr(arr);
1315
+ memcpy(UPB_PTR_AT(ptr, arr->len * elem_size, char), value, elem_size);
1316
+ arr->len++;
1317
+ return true;
1318
+ }
1319
+
1320
+ /* Used by old generated code, remove once all code has been regenerated. */
1321
+ UPB_INLINE int _upb_sizelg2(upb_fieldtype_t type) {
1322
+ switch (type) {
1323
+ case UPB_TYPE_BOOL:
1324
+ return 0;
1325
+ case UPB_TYPE_FLOAT:
1326
+ case UPB_TYPE_INT32:
1327
+ case UPB_TYPE_UINT32:
1328
+ case UPB_TYPE_ENUM:
1329
+ return 2;
1330
+ case UPB_TYPE_MESSAGE:
1331
+ return UPB_SIZE(2, 3);
1332
+ case UPB_TYPE_DOUBLE:
1333
+ case UPB_TYPE_INT64:
1334
+ case UPB_TYPE_UINT64:
1335
+ return 3;
1336
+ case UPB_TYPE_STRING:
1337
+ case UPB_TYPE_BYTES:
1338
+ return UPB_SIZE(3, 4);
1339
+ }
1340
+ UPB_UNREACHABLE();
1341
+ }
1342
+ UPB_INLINE void *_upb_array_resize_accessor(void *msg, size_t ofs, size_t size,
1343
+ upb_fieldtype_t type,
1344
+ upb_arena *arena) {
1345
+ return _upb_array_resize_accessor2(msg, ofs, size, _upb_sizelg2(type), arena);
1346
+ }
1347
+ UPB_INLINE bool _upb_array_append_accessor(void *msg, size_t ofs,
1348
+ size_t elem_size, upb_fieldtype_t type,
1349
+ const void *value,
1350
+ upb_arena *arena) {
1351
+ (void)elem_size;
1352
+ return _upb_array_append_accessor2(msg, ofs, _upb_sizelg2(type), value,
1353
+ arena);
1354
+ }
1355
+
1356
+ /** upb_map *******************************************************************/
1357
+
1358
+ /* Right now we use strmaps for everything. We'll likely want to use
1359
+ * integer-specific maps for integer-keyed maps.*/
1360
+ typedef struct {
1361
+ /* Size of key and val, based on the map type. Strings are represented as '0'
1362
+ * because they must be handled specially. */
1363
+ char key_size;
1364
+ char val_size;
1365
+
1366
+ upb_strtable table;
1367
+ } upb_map;
1368
+
1369
+ /* Map entries aren't actually stored, they are only used during parsing. For
1370
+ * parsing, it helps a lot if all map entry messages have the same layout.
1371
+ * The compiler and def.c must ensure that all map entries have this layout. */
1372
+ typedef struct {
1373
+ upb_msg_internal internal;
1374
+ union {
1375
+ upb_strview str; /* For str/bytes. */
1376
+ upb_value val; /* For all other types. */
1377
+ } k;
1378
+ union {
1379
+ upb_strview str; /* For str/bytes. */
1380
+ upb_value val; /* For all other types. */
1381
+ } v;
1382
+ } upb_map_entry;
1383
+
1384
+ /* Creates a new map on the given arena with this key/value type. */
1385
+ upb_map *_upb_map_new(upb_arena *a, size_t key_size, size_t value_size);
1386
+
1387
+ /* Converting between internal table representation and user values.
1388
+ *
1389
+ * _upb_map_tokey() and _upb_map_fromkey() are inverses.
1390
+ * _upb_map_tovalue() and _upb_map_fromvalue() are inverses.
1391
+ *
1392
+ * These functions account for the fact that strings are treated differently
1393
+ * from other types when stored in a map.
1394
+ */
1395
+
1396
+ UPB_INLINE upb_strview _upb_map_tokey(const void *key, size_t size) {
1397
+ if (size == UPB_MAPTYPE_STRING) {
1398
+ return *(upb_strview*)key;
1399
+ } else {
1400
+ return upb_strview_make((const char*)key, size);
1401
+ }
1402
+ }
1403
+
1404
+ UPB_INLINE void _upb_map_fromkey(upb_strview key, void* out, size_t size) {
1405
+ if (size == UPB_MAPTYPE_STRING) {
1406
+ memcpy(out, &key, sizeof(key));
1407
+ } else {
1408
+ memcpy(out, key.data, size);
1409
+ }
1410
+ }
1411
+
1412
+ UPB_INLINE bool _upb_map_tovalue(const void *val, size_t size, upb_value *msgval,
1413
+ upb_arena *a) {
1414
+ if (size == UPB_MAPTYPE_STRING) {
1415
+ upb_strview *strp = (upb_strview*)upb_arena_malloc(a, sizeof(*strp));
1416
+ if (!strp) return false;
1417
+ *strp = *(upb_strview*)val;
1418
+ *msgval = upb_value_ptr(strp);
1419
+ } else {
1420
+ memcpy(msgval, val, size);
1421
+ }
1422
+ return true;
1423
+ }
1424
+
1425
+ UPB_INLINE void _upb_map_fromvalue(upb_value val, void* out, size_t size) {
1426
+ if (size == UPB_MAPTYPE_STRING) {
1427
+ const upb_strview *strp = (const upb_strview*)upb_value_getptr(val);
1428
+ memcpy(out, strp, sizeof(upb_strview));
1429
+ } else {
1430
+ memcpy(out, &val, size);
1431
+ }
1432
+ }
1433
+
1434
+ /* Map operations, shared by reflection and generated code. */
1435
+
1436
+ UPB_INLINE size_t _upb_map_size(const upb_map *map) {
1437
+ return map->table.t.count;
1438
+ }
1439
+
1440
+ UPB_INLINE bool _upb_map_get(const upb_map *map, const void *key,
1441
+ size_t key_size, void *val, size_t val_size) {
1442
+ upb_value tabval;
1443
+ upb_strview k = _upb_map_tokey(key, key_size);
1444
+ bool ret = upb_strtable_lookup2(&map->table, k.data, k.size, &tabval);
1445
+ if (ret && val) {
1446
+ _upb_map_fromvalue(tabval, val, val_size);
1447
+ }
1448
+ return ret;
1449
+ }
1450
+
1451
+ UPB_INLINE void* _upb_map_next(const upb_map *map, size_t *iter) {
1452
+ upb_strtable_iter it;
1453
+ it.t = &map->table;
1454
+ it.index = *iter;
1455
+ upb_strtable_next(&it);
1456
+ *iter = it.index;
1457
+ if (upb_strtable_done(&it)) return NULL;
1458
+ return (void*)str_tabent(&it);
1459
+ }
1460
+
1461
+ UPB_INLINE bool _upb_map_set(upb_map *map, const void *key, size_t key_size,
1462
+ void *val, size_t val_size, upb_arena *a) {
1463
+ upb_strview strkey = _upb_map_tokey(key, key_size);
1464
+ upb_value tabval = {0};
1465
+ if (!_upb_map_tovalue(val, val_size, &tabval, a)) return false;
1466
+
1467
+ /* TODO(haberman): add overwrite operation to minimize number of lookups. */
1468
+ upb_strtable_remove(&map->table, strkey.data, strkey.size, NULL);
1469
+ return upb_strtable_insert(&map->table, strkey.data, strkey.size, tabval, a);
1470
+ }
1471
+
1472
+ UPB_INLINE bool _upb_map_delete(upb_map *map, const void *key, size_t key_size) {
1473
+ upb_strview k = _upb_map_tokey(key, key_size);
1474
+ return upb_strtable_remove(&map->table, k.data, k.size, NULL);
1475
+ }
1476
+
1477
+ UPB_INLINE void _upb_map_clear(upb_map *map) {
1478
+ upb_strtable_clear(&map->table);
1479
+ }
1480
+
1481
+ /* Message map operations, these get the map from the message first. */
1482
+
1483
+ UPB_INLINE size_t _upb_msg_map_size(const upb_msg *msg, size_t ofs) {
1484
+ upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
1485
+ return map ? _upb_map_size(map) : 0;
1486
+ }
1487
+
1488
+ UPB_INLINE bool _upb_msg_map_get(const upb_msg *msg, size_t ofs,
1489
+ const void *key, size_t key_size, void *val,
1490
+ size_t val_size) {
1491
+ upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
1492
+ if (!map) return false;
1493
+ return _upb_map_get(map, key, key_size, val, val_size);
1494
+ }
1495
+
1496
+ UPB_INLINE void *_upb_msg_map_next(const upb_msg *msg, size_t ofs,
1497
+ size_t *iter) {
1498
+ upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
1499
+ if (!map) return NULL;
1500
+ return _upb_map_next(map, iter);
1501
+ }
1502
+
1503
+ UPB_INLINE bool _upb_msg_map_set(upb_msg *msg, size_t ofs, const void *key,
1504
+ size_t key_size, void *val, size_t val_size,
1505
+ upb_arena *arena) {
1506
+ upb_map **map = UPB_PTR_AT(msg, ofs, upb_map *);
1507
+ if (!*map) {
1508
+ *map = _upb_map_new(arena, key_size, val_size);
1509
+ }
1510
+ return _upb_map_set(*map, key, key_size, val, val_size, arena);
1511
+ }
1512
+
1513
+ UPB_INLINE bool _upb_msg_map_delete(upb_msg *msg, size_t ofs, const void *key,
1514
+ size_t key_size) {
1515
+ upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
1516
+ if (!map) return false;
1517
+ return _upb_map_delete(map, key, key_size);
1518
+ }
1519
+
1520
+ UPB_INLINE void _upb_msg_map_clear(upb_msg *msg, size_t ofs) {
1521
+ upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
1522
+ if (!map) return;
1523
+ _upb_map_clear(map);
1524
+ }
1525
+
1526
+ /* Accessing map key/value from a pointer, used by generated code only. */
1527
+
1528
+ UPB_INLINE void _upb_msg_map_key(const void* msg, void* key, size_t size) {
1529
+ const upb_tabent *ent = (const upb_tabent*)msg;
1530
+ uint32_t u32len;
1531
+ upb_strview k;
1532
+ k.data = upb_tabstr(ent->key, &u32len);
1533
+ k.size = u32len;
1534
+ _upb_map_fromkey(k, key, size);
1535
+ }
1536
+
1537
+ UPB_INLINE void _upb_msg_map_value(const void* msg, void* val, size_t size) {
1538
+ const upb_tabent *ent = (const upb_tabent*)msg;
1539
+ upb_value v = {ent->val.val};
1540
+ _upb_map_fromvalue(v, val, size);
1541
+ }
1542
+
1543
+ UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val, size_t size) {
1544
+ upb_tabent *ent = (upb_tabent*)msg;
1545
+ /* This is like _upb_map_tovalue() except the entry already exists so we can
1546
+ * reuse the allocated upb_strview for string fields. */
1547
+ if (size == UPB_MAPTYPE_STRING) {
1548
+ upb_strview *strp = (upb_strview*)(uintptr_t)ent->val.val;
1549
+ memcpy(strp, val, sizeof(*strp));
1550
+ } else {
1551
+ memcpy(&ent->val.val, val, size);
1552
+ }
1553
+ }
1554
+
1555
+ /** _upb_mapsorter *************************************************************/
1556
+
1557
+ /* _upb_mapsorter sorts maps and provides ordered iteration over the entries.
1558
+ * Since maps can be recursive (map values can be messages which contain other maps).
1559
+ * _upb_mapsorter can contain a stack of maps. */
1560
+
1561
+ typedef struct {
1562
+ upb_tabent const**entries;
1563
+ int size;
1564
+ int cap;
1565
+ } _upb_mapsorter;
1566
+
1567
+ typedef struct {
1568
+ int start;
1569
+ int pos;
1570
+ int end;
1571
+ } _upb_sortedmap;
1572
+
1573
+ UPB_INLINE void _upb_mapsorter_init(_upb_mapsorter *s) {
1574
+ s->entries = NULL;
1575
+ s->size = 0;
1576
+ s->cap = 0;
1577
+ }
1578
+
1579
+ UPB_INLINE void _upb_mapsorter_destroy(_upb_mapsorter *s) {
1580
+ if (s->entries) free(s->entries);
1581
+ }
1582
+
1583
+ bool _upb_mapsorter_pushmap(_upb_mapsorter *s, upb_descriptortype_t key_type,
1584
+ const upb_map *map, _upb_sortedmap *sorted);
1585
+
1586
+ UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter *s, _upb_sortedmap *sorted) {
1587
+ s->size = sorted->start;
1588
+ }
1589
+
1590
+ UPB_INLINE bool _upb_sortedmap_next(_upb_mapsorter *s, const upb_map *map,
1591
+ _upb_sortedmap *sorted,
1592
+ upb_map_entry *ent) {
1593
+ if (sorted->pos == sorted->end) return false;
1594
+ const upb_tabent *tabent = s->entries[sorted->pos++];
1595
+ upb_strview key = upb_tabstrview(tabent->key);
1596
+ _upb_map_fromkey(key, &ent->k, map->key_size);
1597
+ upb_value val = {tabent->val.val};
1598
+ _upb_map_fromvalue(val, &ent->v, map->val_size);
1599
+ return true;
1600
+ }
1601
+
1602
+ #ifdef __cplusplus
1603
+ } /* extern "C" */
1604
+ #endif
1605
+
1606
+
1607
+ #endif /* UPB_MSG_INT_H_ */
1608
+
1609
+ /** upb/upb_internal.h ************************************************************/
1610
+ #ifndef UPB_INT_H_
1611
+ #define UPB_INT_H_
1612
+
1613
+
1614
+ struct mem_block;
1615
+ typedef struct mem_block mem_block;
1616
+
1617
+ struct upb_arena {
1618
+ _upb_arena_head head;
1619
+ /* Stores cleanup metadata for this arena.
1620
+ * - a pointer to the current cleanup counter.
1621
+ * - a boolean indicating if there is an unowned initial block. */
1622
+ uintptr_t cleanup_metadata;
1623
+
1624
+ /* Allocator to allocate arena blocks. We are responsible for freeing these
1625
+ * when we are destroyed. */
1626
+ upb_alloc *block_alloc;
1627
+ uint32_t last_size;
1628
+
1629
+ /* When multiple arenas are fused together, each arena points to a parent
1630
+ * arena (root points to itself). The root tracks how many live arenas
1631
+ * reference it. */
1632
+ uint32_t refcount; /* Only used when a->parent == a */
1633
+ struct upb_arena *parent;
1634
+
1635
+ /* Linked list of blocks to free/cleanup. */
1636
+ mem_block *freelist, *freelist_tail;
1637
+ };
1638
+
1639
+ #endif /* UPB_INT_H_ */
1640
+
1641
+ /* Must be last. */
1642
+
1643
+ #define DECODE_NOGROUP (uint32_t)-1
1644
+
1645
+ typedef struct upb_decstate {
1646
+ const char *end; /* Can read up to 16 bytes slop beyond this. */
1647
+ const char *limit_ptr; /* = end + UPB_MIN(limit, 0) */
1648
+ upb_msg *unknown_msg; /* If non-NULL, add unknown data at buffer flip. */
1649
+ const char *unknown; /* Start of unknown data. */
1650
+ int limit; /* Submessage limit relative to end. */
1651
+ int depth;
1652
+ uint32_t end_group; /* field number of END_GROUP tag, else DECODE_NOGROUP */
1653
+ bool alias;
1654
+ char patch[32];
1655
+ upb_arena arena;
1656
+ jmp_buf err;
1657
+ } upb_decstate;
1658
+
1659
+ /* Error function that will abort decoding with longjmp(). We can't declare this
1660
+ * UPB_NORETURN, even though it is appropriate, because if we do then compilers
1661
+ * will "helpfully" refuse to tailcall to it
1662
+ * (see: https://stackoverflow.com/a/55657013), which will defeat a major goal
1663
+ * of our optimizations. That is also why we must declare it in a separate file,
1664
+ * otherwise the compiler will see that it calls longjmp() and deduce that it is
1665
+ * noreturn. */
1666
+ const char *fastdecode_err(upb_decstate *d);
1667
+
1668
+ extern const uint8_t upb_utf8_offsets[];
1669
+
1670
+ UPB_INLINE
1671
+ bool decode_verifyutf8_inl(const char *buf, int len) {
1672
+ int i, j;
1673
+ uint8_t offset;
1674
+
1675
+ i = 0;
1676
+ while (i < len) {
1677
+ offset = upb_utf8_offsets[(uint8_t)buf[i]];
1678
+ if (offset == 0 || i + offset > len) {
1679
+ return false;
1680
+ }
1681
+ for (j = i + 1; j < i + offset; j++) {
1682
+ if ((buf[j] & 0xc0) != 0x80) {
1683
+ return false;
1684
+ }
1685
+ }
1686
+ i += offset;
1687
+ }
1688
+ return i == len;
1689
+ }
1690
+
1691
+ /* x86-64 pointers always have the high 16 bits matching. So we can shift
1692
+ * left 8 and right 8 without loss of information. */
1693
+ UPB_INLINE intptr_t decode_totable(const upb_msglayout *tablep) {
1694
+ return ((intptr_t)tablep << 8) | tablep->table_mask;
1695
+ }
1696
+
1697
+ UPB_INLINE const upb_msglayout *decode_totablep(intptr_t table) {
1698
+ return (const upb_msglayout*)(table >> 8);
1699
+ }
1700
+
1701
+ UPB_INLINE
1702
+ const char *decode_isdonefallback_inl(upb_decstate *d, const char *ptr,
1703
+ int overrun) {
1704
+ if (overrun < d->limit) {
1705
+ /* Need to copy remaining data into patch buffer. */
1706
+ UPB_ASSERT(overrun < 16);
1707
+ if (d->unknown_msg) {
1708
+ if (!_upb_msg_addunknown(d->unknown_msg, d->unknown, ptr - d->unknown,
1709
+ &d->arena)) {
1710
+ return NULL;
1711
+ }
1712
+ d->unknown = &d->patch[0] + overrun;
1713
+ }
1714
+ memset(d->patch + 16, 0, 16);
1715
+ memcpy(d->patch, d->end, 16);
1716
+ ptr = &d->patch[0] + overrun;
1717
+ d->end = &d->patch[16];
1718
+ d->limit -= 16;
1719
+ d->limit_ptr = d->end + d->limit;
1720
+ d->alias = false;
1721
+ UPB_ASSERT(ptr < d->limit_ptr);
1722
+ return ptr;
1723
+ } else {
1724
+ return NULL;
1725
+ }
1726
+ }
1727
+
1728
+ const char *decode_isdonefallback(upb_decstate *d, const char *ptr,
1729
+ int overrun);
1730
+
1731
+ UPB_INLINE
1732
+ bool decode_isdone(upb_decstate *d, const char **ptr) {
1733
+ int overrun = *ptr - d->end;
1734
+ if (UPB_LIKELY(*ptr < d->limit_ptr)) {
1735
+ return false;
1736
+ } else if (UPB_LIKELY(overrun == d->limit)) {
1737
+ return true;
1738
+ } else {
1739
+ *ptr = decode_isdonefallback(d, *ptr, overrun);
1740
+ return false;
1741
+ }
1742
+ }
1743
+
1744
+ #if UPB_FASTTABLE
1745
+ UPB_INLINE
1746
+ const char *fastdecode_tagdispatch(upb_decstate *d, const char *ptr,
1747
+ upb_msg *msg, intptr_t table,
1748
+ uint64_t hasbits, uint64_t tag) {
1749
+ const upb_msglayout *table_p = decode_totablep(table);
1750
+ uint8_t mask = table;
1751
+ uint64_t data;
1752
+ size_t idx = tag & mask;
1753
+ UPB_ASSUME((idx & 7) == 0);
1754
+ idx >>= 3;
1755
+ data = table_p->fasttable[idx].field_data ^ tag;
1756
+ UPB_MUSTTAIL return table_p->fasttable[idx].field_parser(d, ptr, msg, table,
1757
+ hasbits, data);
1758
+ }
1759
+ #endif
1760
+
1761
+ UPB_INLINE uint32_t fastdecode_loadtag(const char* ptr) {
1762
+ uint16_t tag;
1763
+ memcpy(&tag, ptr, 2);
1764
+ return tag;
1765
+ }
1766
+
1767
+ UPB_INLINE void decode_checklimit(upb_decstate *d) {
1768
+ UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit));
1769
+ }
1770
+
1771
+ UPB_INLINE int decode_pushlimit(upb_decstate *d, const char *ptr, int size) {
1772
+ int limit = size + (int)(ptr - d->end);
1773
+ int delta = d->limit - limit;
1774
+ decode_checklimit(d);
1775
+ d->limit = limit;
1776
+ d->limit_ptr = d->end + UPB_MIN(0, limit);
1777
+ decode_checklimit(d);
1778
+ return delta;
1779
+ }
1780
+
1781
+ UPB_INLINE void decode_poplimit(upb_decstate *d, const char *ptr,
1782
+ int saved_delta) {
1783
+ UPB_ASSERT(ptr - d->end == d->limit);
1784
+ decode_checklimit(d);
1785
+ d->limit += saved_delta;
1786
+ d->limit_ptr = d->end + UPB_MIN(0, d->limit);
1787
+ decode_checklimit(d);
1788
+ }
1789
+
1790
+
1791
+ #endif /* UPB_DECODE_INT_H_ */
1792
+
1793
+ /** upb/encode.h ************************************************************/
1794
+ /*
1795
+ * upb_encode: parsing into a upb_msg using a upb_msglayout.
1796
+ */
1797
+
1798
+ #ifndef UPB_ENCODE_H_
1799
+ #define UPB_ENCODE_H_
1800
+
1801
+
1802
+ /* Must be last. */
1803
+
1804
+ #ifdef __cplusplus
1805
+ extern "C" {
1806
+ #endif
1807
+
1808
+ enum {
1809
+ /* If set, the results of serializing will be deterministic across all
1810
+ * instances of this binary. There are no guarantees across different
1811
+ * binary builds.
1812
+ *
1813
+ * If your proto contains maps, the encoder will need to malloc()/free()
1814
+ * memory during encode. */
1815
+ UPB_ENCODE_DETERMINISTIC = 1,
1816
+
1817
+ /* When set, unknown fields are not printed. */
1818
+ UPB_ENCODE_SKIPUNKNOWN = 2,
1819
+ };
1820
+
1821
+ #define UPB_ENCODE_MAXDEPTH(depth) ((depth) << 16)
1822
+
1823
+ char *upb_encode_ex(const void *msg, const upb_msglayout *l, int options,
1824
+ upb_arena *arena, size_t *size);
1825
+
1826
+ UPB_INLINE char *upb_encode(const void *msg, const upb_msglayout *l,
1827
+ upb_arena *arena, size_t *size) {
1828
+ return upb_encode_ex(msg, l, 0, arena, size);
1829
+ }
1830
+
1831
+
1832
+ #ifdef __cplusplus
1833
+ } /* extern "C" */
1834
+ #endif
1835
+
1836
+ #endif /* UPB_ENCODE_H_ */
1837
+
1838
+ /** upb/decode_fast.h ************************************************************/
1839
+ // These are the specialized field parser functions for the fast parser.
1840
+ // Generated tables will refer to these by name.
1841
+ //
1842
+ // The function names are encoded with names like:
1843
+ //
1844
+ // // 123 4
1845
+ // upb_pss_1bt(); // Parse singular string, 1 byte tag.
1846
+ //
1847
+ // In position 1:
1848
+ // - 'p' for parse, most function use this
1849
+ // - 'c' for copy, for when we are copying strings instead of aliasing
1850
+ //
1851
+ // In position 2 (cardinality):
1852
+ // - 's' for singular, with or without hasbit
1853
+ // - 'o' for oneof
1854
+ // - 'r' for non-packed repeated
1855
+ // - 'p' for packed repeated
1856
+ //
1857
+ // In position 3 (type):
1858
+ // - 'b1' for bool
1859
+ // - 'v4' for 4-byte varint
1860
+ // - 'v8' for 8-byte varint
1861
+ // - 'z4' for zig-zag-encoded 4-byte varint
1862
+ // - 'z8' for zig-zag-encoded 8-byte varint
1863
+ // - 'f4' for 4-byte fixed
1864
+ // - 'f8' for 8-byte fixed
1865
+ // - 'm' for sub-message
1866
+ // - 's' for string (validate UTF-8)
1867
+ // - 'b' for bytes
1868
+ //
1869
+ // In position 4 (tag length):
1870
+ // - '1' for one-byte tags (field numbers 1-15)
1871
+ // - '2' for two-byte tags (field numbers 16-2048)
1872
+
1873
+ #ifndef UPB_DECODE_FAST_H_
1874
+ #define UPB_DECODE_FAST_H_
1875
+
1876
+
1877
+ struct upb_decstate;
1878
+
1879
+ // The fallback, generic parsing function that can handle any field type.
1880
+ // This just uses the regular (non-fast) parser to parse a single field.
1881
+ const char *fastdecode_generic(struct upb_decstate *d, const char *ptr,
1882
+ upb_msg *msg, intptr_t table, uint64_t hasbits,
1883
+ uint64_t data);
1884
+
1885
+ #define UPB_PARSE_PARAMS \
1886
+ struct upb_decstate *d, const char *ptr, upb_msg *msg, intptr_t table, \
1887
+ uint64_t hasbits, uint64_t data
1888
+
1889
+ /* primitive fields ***********************************************************/
1890
+
1891
+ #define F(card, type, valbytes, tagbytes) \
1892
+ const char *upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS);
1893
+
1894
+ #define TYPES(card, tagbytes) \
1895
+ F(card, b, 1, tagbytes) \
1896
+ F(card, v, 4, tagbytes) \
1897
+ F(card, v, 8, tagbytes) \
1898
+ F(card, z, 4, tagbytes) \
1899
+ F(card, z, 8, tagbytes) \
1900
+ F(card, f, 4, tagbytes) \
1901
+ F(card, f, 8, tagbytes)
1902
+
1903
+ #define TAGBYTES(card) \
1904
+ TYPES(card, 1) \
1905
+ TYPES(card, 2)
1906
+
1907
+ TAGBYTES(s)
1908
+ TAGBYTES(o)
1909
+ TAGBYTES(r)
1910
+ TAGBYTES(p)
1911
+
1912
+ #undef F
1913
+ #undef TYPES
1914
+ #undef TAGBYTES
1915
+
1916
+ /* string fields **************************************************************/
1917
+
1918
+ #define F(card, tagbytes, type) \
1919
+ const char *upb_p##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); \
1920
+ const char *upb_c##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS);
1921
+
1922
+ #define UTF8(card, tagbytes) \
1923
+ F(card, tagbytes, s) \
1924
+ F(card, tagbytes, b)
1925
+
1926
+ #define TAGBYTES(card) \
1927
+ UTF8(card, 1) \
1928
+ UTF8(card, 2)
1929
+
1930
+ TAGBYTES(s)
1931
+ TAGBYTES(o)
1932
+ TAGBYTES(r)
1933
+
1934
+ #undef F
1935
+ #undef TAGBYTES
1936
+
1937
+ /* sub-message fields *********************************************************/
1938
+
1939
+ #define F(card, tagbytes, size_ceil, ceil_arg) \
1940
+ const char *upb_p##card##m_##tagbytes##bt_max##size_ceil##b(UPB_PARSE_PARAMS);
1941
+
1942
+ #define SIZES(card, tagbytes) \
1943
+ F(card, tagbytes, 64, 64) \
1944
+ F(card, tagbytes, 128, 128) \
1945
+ F(card, tagbytes, 192, 192) \
1946
+ F(card, tagbytes, 256, 256) \
1947
+ F(card, tagbytes, max, -1)
1948
+
1949
+ #define TAGBYTES(card) \
1950
+ SIZES(card, 1) \
1951
+ SIZES(card, 2)
1952
+
1953
+ TAGBYTES(s)
1954
+ TAGBYTES(o)
1955
+ TAGBYTES(r)
1956
+
1957
+ #undef TAGBYTES
1958
+ #undef SIZES
1959
+ #undef F
1960
+
1961
+ #undef UPB_PARSE_PARAMS
1962
+
1963
+ #endif /* UPB_DECODE_FAST_H_ */
1964
+
1965
+ /** google/protobuf/descriptor.upb.h ************************************************************//* This file was generated by upbc (the upb compiler) from the input
1966
+ * file:
1967
+ *
1968
+ * google/protobuf/descriptor.proto
1969
+ *
1970
+ * Do not edit -- your changes will be discarded when the file is
1971
+ * regenerated. */
1972
+
1973
+ #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
1974
+ #define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
1975
+
1976
+
1977
+
1978
+ #ifdef __cplusplus
1979
+ extern "C" {
1980
+ #endif
1981
+
1982
+ struct google_protobuf_FileDescriptorSet;
1983
+ struct google_protobuf_FileDescriptorProto;
1984
+ struct google_protobuf_DescriptorProto;
1985
+ struct google_protobuf_DescriptorProto_ExtensionRange;
1986
+ struct google_protobuf_DescriptorProto_ReservedRange;
1987
+ struct google_protobuf_ExtensionRangeOptions;
1988
+ struct google_protobuf_FieldDescriptorProto;
1989
+ struct google_protobuf_OneofDescriptorProto;
1990
+ struct google_protobuf_EnumDescriptorProto;
1991
+ struct google_protobuf_EnumDescriptorProto_EnumReservedRange;
1992
+ struct google_protobuf_EnumValueDescriptorProto;
1993
+ struct google_protobuf_ServiceDescriptorProto;
1994
+ struct google_protobuf_MethodDescriptorProto;
1995
+ struct google_protobuf_FileOptions;
1996
+ struct google_protobuf_MessageOptions;
1997
+ struct google_protobuf_FieldOptions;
1998
+ struct google_protobuf_OneofOptions;
1999
+ struct google_protobuf_EnumOptions;
2000
+ struct google_protobuf_EnumValueOptions;
2001
+ struct google_protobuf_ServiceOptions;
2002
+ struct google_protobuf_MethodOptions;
2003
+ struct google_protobuf_UninterpretedOption;
2004
+ struct google_protobuf_UninterpretedOption_NamePart;
2005
+ struct google_protobuf_SourceCodeInfo;
2006
+ struct google_protobuf_SourceCodeInfo_Location;
2007
+ struct google_protobuf_GeneratedCodeInfo;
2008
+ struct google_protobuf_GeneratedCodeInfo_Annotation;
2009
+ typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet;
2010
+ typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto;
2011
+ typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto;
2012
+ typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange;
2013
+ typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange;
2014
+ typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions;
2015
+ typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto;
2016
+ typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto;
2017
+ typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto;
2018
+ typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange;
2019
+ typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto;
2020
+ typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto;
2021
+ typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto;
2022
+ typedef struct google_protobuf_FileOptions google_protobuf_FileOptions;
2023
+ typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions;
2024
+ typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions;
2025
+ typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions;
2026
+ typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions;
2027
+ typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions;
2028
+ typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions;
2029
+ typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions;
2030
+ typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption;
2031
+ typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart;
2032
+ typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo;
2033
+ typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location;
2034
+ typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo;
2035
+ typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation;
2036
+ extern const upb_msglayout google_protobuf_FileDescriptorSet_msginit;
2037
+ extern const upb_msglayout google_protobuf_FileDescriptorProto_msginit;
2038
+ extern const upb_msglayout google_protobuf_DescriptorProto_msginit;
2039
+ extern const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit;
2040
+ extern const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit;
2041
+ extern const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit;
2042
+ extern const upb_msglayout google_protobuf_FieldDescriptorProto_msginit;
2043
+ extern const upb_msglayout google_protobuf_OneofDescriptorProto_msginit;
2044
+ extern const upb_msglayout google_protobuf_EnumDescriptorProto_msginit;
2045
+ extern const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit;
2046
+ extern const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit;
2047
+ extern const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit;
2048
+ extern const upb_msglayout google_protobuf_MethodDescriptorProto_msginit;
2049
+ extern const upb_msglayout google_protobuf_FileOptions_msginit;
2050
+ extern const upb_msglayout google_protobuf_MessageOptions_msginit;
2051
+ extern const upb_msglayout google_protobuf_FieldOptions_msginit;
2052
+ extern const upb_msglayout google_protobuf_OneofOptions_msginit;
2053
+ extern const upb_msglayout google_protobuf_EnumOptions_msginit;
2054
+ extern const upb_msglayout google_protobuf_EnumValueOptions_msginit;
2055
+ extern const upb_msglayout google_protobuf_ServiceOptions_msginit;
2056
+ extern const upb_msglayout google_protobuf_MethodOptions_msginit;
2057
+ extern const upb_msglayout google_protobuf_UninterpretedOption_msginit;
2058
+ extern const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit;
2059
+ extern const upb_msglayout google_protobuf_SourceCodeInfo_msginit;
2060
+ extern const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit;
2061
+ extern const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit;
2062
+ extern const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit;
2063
+
2064
+ typedef enum {
2065
+ google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1,
2066
+ google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2,
2067
+ google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3
2068
+ } google_protobuf_FieldDescriptorProto_Label;
2069
+
2070
+ typedef enum {
2071
+ google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1,
2072
+ google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2,
2073
+ google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3,
2074
+ google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4,
2075
+ google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5,
2076
+ google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6,
2077
+ google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7,
2078
+ google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8,
2079
+ google_protobuf_FieldDescriptorProto_TYPE_STRING = 9,
2080
+ google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10,
2081
+ google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11,
2082
+ google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12,
2083
+ google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13,
2084
+ google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14,
2085
+ google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15,
2086
+ google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16,
2087
+ google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17,
2088
+ google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18
2089
+ } google_protobuf_FieldDescriptorProto_Type;
2090
+
2091
+ typedef enum {
2092
+ google_protobuf_FieldOptions_STRING = 0,
2093
+ google_protobuf_FieldOptions_CORD = 1,
2094
+ google_protobuf_FieldOptions_STRING_PIECE = 2
2095
+ } google_protobuf_FieldOptions_CType;
2096
+
2097
+ typedef enum {
2098
+ google_protobuf_FieldOptions_JS_NORMAL = 0,
2099
+ google_protobuf_FieldOptions_JS_STRING = 1,
2100
+ google_protobuf_FieldOptions_JS_NUMBER = 2
2101
+ } google_protobuf_FieldOptions_JSType;
2102
+
2103
+ typedef enum {
2104
+ google_protobuf_FileOptions_SPEED = 1,
2105
+ google_protobuf_FileOptions_CODE_SIZE = 2,
2106
+ google_protobuf_FileOptions_LITE_RUNTIME = 3
2107
+ } google_protobuf_FileOptions_OptimizeMode;
2108
+
2109
+ typedef enum {
2110
+ google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0,
2111
+ google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1,
2112
+ google_protobuf_MethodOptions_IDEMPOTENT = 2
2113
+ } google_protobuf_MethodOptions_IdempotencyLevel;
2114
+
2115
+
2116
+ /* google.protobuf.FileDescriptorSet */
2117
+
2118
+ UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_new(upb_arena *arena) {
2119
+ return (google_protobuf_FileDescriptorSet *)_upb_msg_new(&google_protobuf_FileDescriptorSet_msginit, arena);
2120
+ }
2121
+ UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parse(const char *buf, size_t size,
2122
+ upb_arena *arena) {
2123
+ google_protobuf_FileDescriptorSet *ret = google_protobuf_FileDescriptorSet_new(arena);
2124
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msginit, arena)) ? ret : NULL;
2125
+ }
2126
+ UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parse_ex(const char *buf, size_t size,
2127
+ upb_arena *arena, int options) {
2128
+ google_protobuf_FileDescriptorSet *ret = google_protobuf_FileDescriptorSet_new(arena);
2129
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msginit, arena, options))
2130
+ ? ret : NULL;
2131
+ }
2132
+ UPB_INLINE char *google_protobuf_FileDescriptorSet_serialize(const google_protobuf_FileDescriptorSet *msg, upb_arena *arena, size_t *len) {
2133
+ return upb_encode(msg, &google_protobuf_FileDescriptorSet_msginit, arena, len);
2134
+ }
2135
+
2136
+ UPB_INLINE bool google_protobuf_FileDescriptorSet_has_file(const google_protobuf_FileDescriptorSet *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(0, 0)); }
2137
+ UPB_INLINE const google_protobuf_FileDescriptorProto* const* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet *msg, size_t *len) { return (const google_protobuf_FileDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
2138
+
2139
+ UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_mutable_file(google_protobuf_FileDescriptorSet *msg, size_t *len) {
2140
+ return (google_protobuf_FileDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
2141
+ }
2142
+ UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_resize_file(google_protobuf_FileDescriptorSet *msg, size_t len, upb_arena *arena) {
2143
+ return (google_protobuf_FileDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena);
2144
+ }
2145
+ UPB_INLINE struct google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorSet_add_file(google_protobuf_FileDescriptorSet *msg, upb_arena *arena) {
2146
+ struct google_protobuf_FileDescriptorProto* sub = (struct google_protobuf_FileDescriptorProto*)_upb_msg_new(&google_protobuf_FileDescriptorProto_msginit, arena);
2147
+ bool ok = _upb_array_append_accessor2(
2148
+ msg, UPB_SIZE(0, 0), UPB_SIZE(2, 3), &sub, arena);
2149
+ if (!ok) return NULL;
2150
+ return sub;
2151
+ }
2152
+
2153
+ /* google.protobuf.FileDescriptorProto */
2154
+
2155
+ UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_new(upb_arena *arena) {
2156
+ return (google_protobuf_FileDescriptorProto *)_upb_msg_new(&google_protobuf_FileDescriptorProto_msginit, arena);
2157
+ }
2158
+ UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parse(const char *buf, size_t size,
2159
+ upb_arena *arena) {
2160
+ google_protobuf_FileDescriptorProto *ret = google_protobuf_FileDescriptorProto_new(arena);
2161
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msginit, arena)) ? ret : NULL;
2162
+ }
2163
+ UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parse_ex(const char *buf, size_t size,
2164
+ upb_arena *arena, int options) {
2165
+ google_protobuf_FileDescriptorProto *ret = google_protobuf_FileDescriptorProto_new(arena);
2166
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msginit, arena, options))
2167
+ ? ret : NULL;
2168
+ }
2169
+ UPB_INLINE char *google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto *msg, upb_arena *arena, size_t *len) {
2170
+ return upb_encode(msg, &google_protobuf_FileDescriptorProto_msginit, arena, len);
2171
+ }
2172
+
2173
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
2174
+ UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
2175
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
2176
+ UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview); }
2177
+ UPB_INLINE upb_strview const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(36, 72), len); }
2178
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_message_type(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(40, 80)); }
2179
+ UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(40, 80), len); }
2180
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_enum_type(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(44, 88)); }
2181
+ UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(44, 88), len); }
2182
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_service(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(48, 96)); }
2183
+ UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_ServiceDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(48, 96), len); }
2184
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_extension(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(52, 104)); }
2185
+ UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(52, 104), len); }
2186
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 3); }
2187
+ UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(28, 56), const google_protobuf_FileOptions*); }
2188
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 4); }
2189
+ UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(32, 64), const google_protobuf_SourceCodeInfo*); }
2190
+ UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(56, 112), len); }
2191
+ UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(60, 120), len); }
2192
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 5); }
2193
+ UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(20, 40), upb_strview); }
2194
+
2195
+ UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_strview value) {
2196
+ _upb_sethas(msg, 1);
2197
+ *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
2198
+ }
2199
+ UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_strview value) {
2200
+ _upb_sethas(msg, 2);
2201
+ *UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview) = value;
2202
+ }
2203
+ UPB_INLINE upb_strview* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) {
2204
+ return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 72), len);
2205
+ }
2206
+ UPB_INLINE upb_strview* google_protobuf_FileDescriptorProto_resize_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
2207
+ return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(36, 72), len, UPB_SIZE(3, 4), arena);
2208
+ }
2209
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto *msg, upb_strview val, upb_arena *arena) {
2210
+ return _upb_array_append_accessor2(msg, UPB_SIZE(36, 72), UPB_SIZE(3, 4), &val,
2211
+ arena);
2212
+ }
2213
+ UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto *msg, size_t *len) {
2214
+ return (google_protobuf_DescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 80), len);
2215
+ }
2216
+ UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_resize_message_type(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
2217
+ return (google_protobuf_DescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(40, 80), len, UPB_SIZE(2, 3), arena);
2218
+ }
2219
+ UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescriptorProto_add_message_type(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
2220
+ struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)_upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena);
2221
+ bool ok = _upb_array_append_accessor2(
2222
+ msg, UPB_SIZE(40, 80), UPB_SIZE(2, 3), &sub, arena);
2223
+ if (!ok) return NULL;
2224
+ return sub;
2225
+ }
2226
+ UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto *msg, size_t *len) {
2227
+ return (google_protobuf_EnumDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 88), len);
2228
+ }
2229
+ UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_resize_enum_type(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
2230
+ return (google_protobuf_EnumDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(44, 88), len, UPB_SIZE(2, 3), arena);
2231
+ }
2232
+ UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescriptorProto_add_enum_type(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
2233
+ struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)_upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena);
2234
+ bool ok = _upb_array_append_accessor2(
2235
+ msg, UPB_SIZE(44, 88), UPB_SIZE(2, 3), &sub, arena);
2236
+ if (!ok) return NULL;
2237
+ return sub;
2238
+ }
2239
+ UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto *msg, size_t *len) {
2240
+ return (google_protobuf_ServiceDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(48, 96), len);
2241
+ }
2242
+ UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_resize_service(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
2243
+ return (google_protobuf_ServiceDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(48, 96), len, UPB_SIZE(2, 3), arena);
2244
+ }
2245
+ UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
2246
+ struct google_protobuf_ServiceDescriptorProto* sub = (struct google_protobuf_ServiceDescriptorProto*)_upb_msg_new(&google_protobuf_ServiceDescriptorProto_msginit, arena);
2247
+ bool ok = _upb_array_append_accessor2(
2248
+ msg, UPB_SIZE(48, 96), UPB_SIZE(2, 3), &sub, arena);
2249
+ if (!ok) return NULL;
2250
+ return sub;
2251
+ }
2252
+ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto *msg, size_t *len) {
2253
+ return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(52, 104), len);
2254
+ }
2255
+ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_resize_extension(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
2256
+ return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(52, 104), len, UPB_SIZE(2, 3), arena);
2257
+ }
2258
+ UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
2259
+ struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
2260
+ bool ok = _upb_array_append_accessor2(
2261
+ msg, UPB_SIZE(52, 104), UPB_SIZE(2, 3), &sub, arena);
2262
+ if (!ok) return NULL;
2263
+ return sub;
2264
+ }
2265
+ UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) {
2266
+ _upb_sethas(msg, 3);
2267
+ *UPB_PTR_AT(msg, UPB_SIZE(28, 56), google_protobuf_FileOptions*) = value;
2268
+ }
2269
+ UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
2270
+ struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg);
2271
+ if (sub == NULL) {
2272
+ sub = (struct google_protobuf_FileOptions*)_upb_msg_new(&google_protobuf_FileOptions_msginit, arena);
2273
+ if (!sub) return NULL;
2274
+ google_protobuf_FileDescriptorProto_set_options(msg, sub);
2275
+ }
2276
+ return sub;
2277
+ }
2278
+ UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) {
2279
+ _upb_sethas(msg, 4);
2280
+ *UPB_PTR_AT(msg, UPB_SIZE(32, 64), google_protobuf_SourceCodeInfo*) = value;
2281
+ }
2282
+ UPB_INLINE struct google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_mutable_source_code_info(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
2283
+ struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg);
2284
+ if (sub == NULL) {
2285
+ sub = (struct google_protobuf_SourceCodeInfo*)_upb_msg_new(&google_protobuf_SourceCodeInfo_msginit, arena);
2286
+ if (!sub) return NULL;
2287
+ google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub);
2288
+ }
2289
+ return sub;
2290
+ }
2291
+ UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) {
2292
+ return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(56, 112), len);
2293
+ }
2294
+ UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_public_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
2295
+ return (int32_t*)_upb_array_resize_accessor2(msg, UPB_SIZE(56, 112), len, 2, arena);
2296
+ }
2297
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google_protobuf_FileDescriptorProto *msg, int32_t val, upb_arena *arena) {
2298
+ return _upb_array_append_accessor2(msg, UPB_SIZE(56, 112), 2, &val,
2299
+ arena);
2300
+ }
2301
+ UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) {
2302
+ return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(60, 120), len);
2303
+ }
2304
+ UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_weak_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
2305
+ return (int32_t*)_upb_array_resize_accessor2(msg, UPB_SIZE(60, 120), len, 2, arena);
2306
+ }
2307
+ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_protobuf_FileDescriptorProto *msg, int32_t val, upb_arena *arena) {
2308
+ return _upb_array_append_accessor2(msg, UPB_SIZE(60, 120), 2, &val,
2309
+ arena);
2310
+ }
2311
+ UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_strview value) {
2312
+ _upb_sethas(msg, 5);
2313
+ *UPB_PTR_AT(msg, UPB_SIZE(20, 40), upb_strview) = value;
2314
+ }
2315
+
2316
+ /* google.protobuf.DescriptorProto */
2317
+
2318
+ UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_new(upb_arena *arena) {
2319
+ return (google_protobuf_DescriptorProto *)_upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena);
2320
+ }
2321
+ UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parse(const char *buf, size_t size,
2322
+ upb_arena *arena) {
2323
+ google_protobuf_DescriptorProto *ret = google_protobuf_DescriptorProto_new(arena);
2324
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_msginit, arena)) ? ret : NULL;
2325
+ }
2326
+ UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parse_ex(const char *buf, size_t size,
2327
+ upb_arena *arena, int options) {
2328
+ google_protobuf_DescriptorProto *ret = google_protobuf_DescriptorProto_new(arena);
2329
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_msginit, arena, options))
2330
+ ? ret : NULL;
2331
+ }
2332
+ UPB_INLINE char *google_protobuf_DescriptorProto_serialize(const google_protobuf_DescriptorProto *msg, upb_arena *arena, size_t *len) {
2333
+ return upb_encode(msg, &google_protobuf_DescriptorProto_msginit, arena, len);
2334
+ }
2335
+
2336
+ UPB_INLINE bool google_protobuf_DescriptorProto_has_name(const google_protobuf_DescriptorProto *msg) { return _upb_hasbit(msg, 1); }
2337
+ UPB_INLINE upb_strview google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
2338
+ UPB_INLINE bool google_protobuf_DescriptorProto_has_field(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(16, 32)); }
2339
+ UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); }
2340
+ UPB_INLINE bool google_protobuf_DescriptorProto_has_nested_type(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(20, 40)); }
2341
+ UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); }
2342
+ UPB_INLINE bool google_protobuf_DescriptorProto_has_enum_type(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(24, 48)); }
2343
+ UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
2344
+ UPB_INLINE bool google_protobuf_DescriptorProto_has_extension_range(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(28, 56)); }
2345
+ UPB_INLINE const google_protobuf_DescriptorProto_ExtensionRange* const* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto_ExtensionRange* const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); }
2346
+ UPB_INLINE bool google_protobuf_DescriptorProto_has_extension(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(32, 64)); }
2347
+ UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(32, 64), len); }
2348
+ UPB_INLINE bool google_protobuf_DescriptorProto_has_options(const google_protobuf_DescriptorProto *msg) { return _upb_hasbit(msg, 2); }
2349
+ UPB_INLINE const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), const google_protobuf_MessageOptions*); }
2350
+ UPB_INLINE bool google_protobuf_DescriptorProto_has_oneof_decl(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(36, 72)); }
2351
+ UPB_INLINE const google_protobuf_OneofDescriptorProto* const* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_OneofDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(36, 72), len); }
2352
+ UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_range(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(40, 80)); }
2353
+ UPB_INLINE const google_protobuf_DescriptorProto_ReservedRange* const* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto_ReservedRange* const*)_upb_array_accessor(msg, UPB_SIZE(40, 80), len); }
2354
+ UPB_INLINE upb_strview const* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(44, 88), len); }
2355
+
2356
+ UPB_INLINE void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_strview value) {
2357
+ _upb_sethas(msg, 1);
2358
+ *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
2359
+ }
2360
+ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto *msg, size_t *len) {
2361
+ return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
2362
+ }
2363
+ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_field(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
2364
+ return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(16, 32), len, UPB_SIZE(2, 3), arena);
2365
+ }
2366
+ UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_field(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
2367
+ struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
2368
+ bool ok = _upb_array_append_accessor2(
2369
+ msg, UPB_SIZE(16, 32), UPB_SIZE(2, 3), &sub, arena);
2370
+ if (!ok) return NULL;
2371
+ return sub;
2372
+ }
2373
+ UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_mutable_nested_type(google_protobuf_DescriptorProto *msg, size_t *len) {
2374
+ return (google_protobuf_DescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
2375
+ }
2376
+ UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_resize_nested_type(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
2377
+ return (google_protobuf_DescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(20, 40), len, UPB_SIZE(2, 3), arena);
2378
+ }
2379
+ UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_add_nested_type(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
2380
+ struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)_upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena);
2381
+ bool ok = _upb_array_append_accessor2(
2382
+ msg, UPB_SIZE(20, 40), UPB_SIZE(2, 3), &sub, arena);
2383
+ if (!ok) return NULL;
2384
+ return sub;
2385
+ }
2386
+ UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_mutable_enum_type(google_protobuf_DescriptorProto *msg, size_t *len) {
2387
+ return (google_protobuf_EnumDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
2388
+ }
2389
+ UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_resize_enum_type(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
2390
+ return (google_protobuf_EnumDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(24, 48), len, UPB_SIZE(2, 3), arena);
2391
+ }
2392
+ UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_DescriptorProto_add_enum_type(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
2393
+ struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)_upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena);
2394
+ bool ok = _upb_array_append_accessor2(
2395
+ msg, UPB_SIZE(24, 48), UPB_SIZE(2, 3), &sub, arena);
2396
+ if (!ok) return NULL;
2397
+ return sub;
2398
+ }
2399
+ UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_mutable_extension_range(google_protobuf_DescriptorProto *msg, size_t *len) {
2400
+ return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len);
2401
+ }
2402
+ UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_resize_extension_range(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
2403
+ return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_resize_accessor2(msg, UPB_SIZE(28, 56), len, UPB_SIZE(2, 3), arena);
2404
+ }
2405
+ UPB_INLINE struct google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_add_extension_range(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
2406
+ struct google_protobuf_DescriptorProto_ExtensionRange* sub = (struct google_protobuf_DescriptorProto_ExtensionRange*)_upb_msg_new(&google_protobuf_DescriptorProto_ExtensionRange_msginit, arena);
2407
+ bool ok = _upb_array_append_accessor2(
2408
+ msg, UPB_SIZE(28, 56), UPB_SIZE(2, 3), &sub, arena);
2409
+ if (!ok) return NULL;
2410
+ return sub;
2411
+ }
2412
+ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_extension(google_protobuf_DescriptorProto *msg, size_t *len) {
2413
+ return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 64), len);
2414
+ }
2415
+ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_extension(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
2416
+ return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(32, 64), len, UPB_SIZE(2, 3), arena);
2417
+ }
2418
+ UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_extension(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
2419
+ struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
2420
+ bool ok = _upb_array_append_accessor2(
2421
+ msg, UPB_SIZE(32, 64), UPB_SIZE(2, 3), &sub, arena);
2422
+ if (!ok) return NULL;
2423
+ return sub;
2424
+ }
2425
+ UPB_INLINE void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) {
2426
+ _upb_sethas(msg, 2);
2427
+ *UPB_PTR_AT(msg, UPB_SIZE(12, 24), google_protobuf_MessageOptions*) = value;
2428
+ }
2429
+ UPB_INLINE struct google_protobuf_MessageOptions* google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
2430
+ struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg);
2431
+ if (sub == NULL) {
2432
+ sub = (struct google_protobuf_MessageOptions*)_upb_msg_new(&google_protobuf_MessageOptions_msginit, arena);
2433
+ if (!sub) return NULL;
2434
+ google_protobuf_DescriptorProto_set_options(msg, sub);
2435
+ }
2436
+ return sub;
2437
+ }
2438
+ UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_mutable_oneof_decl(google_protobuf_DescriptorProto *msg, size_t *len) {
2439
+ return (google_protobuf_OneofDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 72), len);
2440
+ }
2441
+ UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_resize_oneof_decl(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
2442
+ return (google_protobuf_OneofDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(36, 72), len, UPB_SIZE(2, 3), arena);
2443
+ }
2444
+ UPB_INLINE struct google_protobuf_OneofDescriptorProto* google_protobuf_DescriptorProto_add_oneof_decl(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
2445
+ struct google_protobuf_OneofDescriptorProto* sub = (struct google_protobuf_OneofDescriptorProto*)_upb_msg_new(&google_protobuf_OneofDescriptorProto_msginit, arena);
2446
+ bool ok = _upb_array_append_accessor2(
2447
+ msg, UPB_SIZE(36, 72), UPB_SIZE(2, 3), &sub, arena);
2448
+ if (!ok) return NULL;
2449
+ return sub;
2450
+ }
2451
+ UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_mutable_reserved_range(google_protobuf_DescriptorProto *msg, size_t *len) {
2452
+ return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 80), len);
2453
+ }
2454
+ UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_resize_reserved_range(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
2455
+ return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_resize_accessor2(msg, UPB_SIZE(40, 80), len, UPB_SIZE(2, 3), arena);
2456
+ }
2457
+ UPB_INLINE struct google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_add_reserved_range(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
2458
+ struct google_protobuf_DescriptorProto_ReservedRange* sub = (struct google_protobuf_DescriptorProto_ReservedRange*)_upb_msg_new(&google_protobuf_DescriptorProto_ReservedRange_msginit, arena);
2459
+ bool ok = _upb_array_append_accessor2(
2460
+ msg, UPB_SIZE(40, 80), UPB_SIZE(2, 3), &sub, arena);
2461
+ if (!ok) return NULL;
2462
+ return sub;
2463
+ }
2464
+ UPB_INLINE upb_strview* google_protobuf_DescriptorProto_mutable_reserved_name(google_protobuf_DescriptorProto *msg, size_t *len) {
2465
+ return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 88), len);
2466
+ }
2467
+ UPB_INLINE upb_strview* google_protobuf_DescriptorProto_resize_reserved_name(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
2468
+ return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(44, 88), len, UPB_SIZE(3, 4), arena);
2469
+ }
2470
+ UPB_INLINE bool google_protobuf_DescriptorProto_add_reserved_name(google_protobuf_DescriptorProto *msg, upb_strview val, upb_arena *arena) {
2471
+ return _upb_array_append_accessor2(msg, UPB_SIZE(44, 88), UPB_SIZE(3, 4), &val,
2472
+ arena);
2473
+ }
2474
+
2475
+ /* google.protobuf.DescriptorProto.ExtensionRange */
2476
+
2477
+ UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_new(upb_arena *arena) {
2478
+ return (google_protobuf_DescriptorProto_ExtensionRange *)_upb_msg_new(&google_protobuf_DescriptorProto_ExtensionRange_msginit, arena);
2479
+ }
2480
+ UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parse(const char *buf, size_t size,
2481
+ upb_arena *arena) {
2482
+ google_protobuf_DescriptorProto_ExtensionRange *ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
2483
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena)) ? ret : NULL;
2484
+ }
2485
+ UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parse_ex(const char *buf, size_t size,
2486
+ upb_arena *arena, int options) {
2487
+ google_protobuf_DescriptorProto_ExtensionRange *ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
2488
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena, options))
2489
+ ? ret : NULL;
2490
+ }
2491
+ UPB_INLINE char *google_protobuf_DescriptorProto_ExtensionRange_serialize(const google_protobuf_DescriptorProto_ExtensionRange *msg, upb_arena *arena, size_t *len) {
2492
+ return upb_encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena, len);
2493
+ }
2494
+
2495
+ UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_start(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_hasbit(msg, 1); }
2496
+ UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
2497
+ UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_end(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_hasbit(msg, 2); }
2498
+ UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t); }
2499
+ UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_options(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_hasbit(msg, 3); }
2500
+ UPB_INLINE const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 16), const google_protobuf_ExtensionRangeOptions*); }
2501
+
2502
+ UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
2503
+ _upb_sethas(msg, 1);
2504
+ *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
2505
+ }
2506
+ UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
2507
+ _upb_sethas(msg, 2);
2508
+ *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value;
2509
+ }
2510
+ UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) {
2511
+ _upb_sethas(msg, 3);
2512
+ *UPB_PTR_AT(msg, UPB_SIZE(12, 16), google_protobuf_ExtensionRangeOptions*) = value;
2513
+ }
2514
+ UPB_INLINE struct google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_mutable_options(google_protobuf_DescriptorProto_ExtensionRange *msg, upb_arena *arena) {
2515
+ struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg);
2516
+ if (sub == NULL) {
2517
+ sub = (struct google_protobuf_ExtensionRangeOptions*)_upb_msg_new(&google_protobuf_ExtensionRangeOptions_msginit, arena);
2518
+ if (!sub) return NULL;
2519
+ google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub);
2520
+ }
2521
+ return sub;
2522
+ }
2523
+
2524
+ /* google.protobuf.DescriptorProto.ReservedRange */
2525
+
2526
+ UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_new(upb_arena *arena) {
2527
+ return (google_protobuf_DescriptorProto_ReservedRange *)_upb_msg_new(&google_protobuf_DescriptorProto_ReservedRange_msginit, arena);
2528
+ }
2529
+ UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parse(const char *buf, size_t size,
2530
+ upb_arena *arena) {
2531
+ google_protobuf_DescriptorProto_ReservedRange *ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
2532
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena)) ? ret : NULL;
2533
+ }
2534
+ UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parse_ex(const char *buf, size_t size,
2535
+ upb_arena *arena, int options) {
2536
+ google_protobuf_DescriptorProto_ReservedRange *ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
2537
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena, options))
2538
+ ? ret : NULL;
2539
+ }
2540
+ UPB_INLINE char *google_protobuf_DescriptorProto_ReservedRange_serialize(const google_protobuf_DescriptorProto_ReservedRange *msg, upb_arena *arena, size_t *len) {
2541
+ return upb_encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena, len);
2542
+ }
2543
+
2544
+ UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange *msg) { return _upb_hasbit(msg, 1); }
2545
+ UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
2546
+ UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_end(const google_protobuf_DescriptorProto_ReservedRange *msg) { return _upb_hasbit(msg, 2); }
2547
+ UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t); }
2548
+
2549
+ UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
2550
+ _upb_sethas(msg, 1);
2551
+ *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
2552
+ }
2553
+ UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
2554
+ _upb_sethas(msg, 2);
2555
+ *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value;
2556
+ }
2557
+
2558
+ /* google.protobuf.ExtensionRangeOptions */
2559
+
2560
+ UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_new(upb_arena *arena) {
2561
+ return (google_protobuf_ExtensionRangeOptions *)_upb_msg_new(&google_protobuf_ExtensionRangeOptions_msginit, arena);
2562
+ }
2563
+ UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parse(const char *buf, size_t size,
2564
+ upb_arena *arena) {
2565
+ google_protobuf_ExtensionRangeOptions *ret = google_protobuf_ExtensionRangeOptions_new(arena);
2566
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msginit, arena)) ? ret : NULL;
2567
+ }
2568
+ UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parse_ex(const char *buf, size_t size,
2569
+ upb_arena *arena, int options) {
2570
+ google_protobuf_ExtensionRangeOptions *ret = google_protobuf_ExtensionRangeOptions_new(arena);
2571
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msginit, arena, options))
2572
+ ? ret : NULL;
2573
+ }
2574
+ UPB_INLINE char *google_protobuf_ExtensionRangeOptions_serialize(const google_protobuf_ExtensionRangeOptions *msg, upb_arena *arena, size_t *len) {
2575
+ return upb_encode(msg, &google_protobuf_ExtensionRangeOptions_msginit, arena, len);
2576
+ }
2577
+
2578
+ UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_uninterpreted_option(const google_protobuf_ExtensionRangeOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(0, 0)); }
2579
+ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
2580
+
2581
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_mutable_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, size_t *len) {
2582
+ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
2583
+ }
2584
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_resize_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, size_t len, upb_arena *arena) {
2585
+ return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena);
2586
+ }
2587
+ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ExtensionRangeOptions_add_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, upb_arena *arena) {
2588
+ struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
2589
+ bool ok = _upb_array_append_accessor2(
2590
+ msg, UPB_SIZE(0, 0), UPB_SIZE(2, 3), &sub, arena);
2591
+ if (!ok) return NULL;
2592
+ return sub;
2593
+ }
2594
+
2595
+ /* google.protobuf.FieldDescriptorProto */
2596
+
2597
+ UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_new(upb_arena *arena) {
2598
+ return (google_protobuf_FieldDescriptorProto *)_upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
2599
+ }
2600
+ UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parse(const char *buf, size_t size,
2601
+ upb_arena *arena) {
2602
+ google_protobuf_FieldDescriptorProto *ret = google_protobuf_FieldDescriptorProto_new(arena);
2603
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msginit, arena)) ? ret : NULL;
2604
+ }
2605
+ UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parse_ex(const char *buf, size_t size,
2606
+ upb_arena *arena, int options) {
2607
+ google_protobuf_FieldDescriptorProto *ret = google_protobuf_FieldDescriptorProto_new(arena);
2608
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msginit, arena, options))
2609
+ ? ret : NULL;
2610
+ }
2611
+ UPB_INLINE char *google_protobuf_FieldDescriptorProto_serialize(const google_protobuf_FieldDescriptorProto *msg, upb_arena *arena, size_t *len) {
2612
+ return upb_encode(msg, &google_protobuf_FieldDescriptorProto_msginit, arena, len);
2613
+ }
2614
+
2615
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
2616
+ UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(24, 24), upb_strview); }
2617
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
2618
+ UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(32, 40), upb_strview); }
2619
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 3); }
2620
+ UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 12), int32_t); }
2621
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 4); }
2622
+ UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
2623
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 5); }
2624
+ UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t); }
2625
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 6); }
2626
+ UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(40, 56), upb_strview); }
2627
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 7); }
2628
+ UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(48, 72), upb_strview); }
2629
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 8); }
2630
+ UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(64, 104), const google_protobuf_FieldOptions*); }
2631
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 9); }
2632
+ UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(16, 16), int32_t); }
2633
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 10); }
2634
+ UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(56, 88), upb_strview); }
2635
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 11); }
2636
+ UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(20, 20), bool); }
2637
+
2638
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
2639
+ _upb_sethas(msg, 1);
2640
+ *UPB_PTR_AT(msg, UPB_SIZE(24, 24), upb_strview) = value;
2641
+ }
2642
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
2643
+ _upb_sethas(msg, 2);
2644
+ *UPB_PTR_AT(msg, UPB_SIZE(32, 40), upb_strview) = value;
2645
+ }
2646
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
2647
+ _upb_sethas(msg, 3);
2648
+ *UPB_PTR_AT(msg, UPB_SIZE(12, 12), int32_t) = value;
2649
+ }
2650
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
2651
+ _upb_sethas(msg, 4);
2652
+ *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
2653
+ }
2654
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
2655
+ _upb_sethas(msg, 5);
2656
+ *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value;
2657
+ }
2658
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
2659
+ _upb_sethas(msg, 6);
2660
+ *UPB_PTR_AT(msg, UPB_SIZE(40, 56), upb_strview) = value;
2661
+ }
2662
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
2663
+ _upb_sethas(msg, 7);
2664
+ *UPB_PTR_AT(msg, UPB_SIZE(48, 72), upb_strview) = value;
2665
+ }
2666
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) {
2667
+ _upb_sethas(msg, 8);
2668
+ *UPB_PTR_AT(msg, UPB_SIZE(64, 104), google_protobuf_FieldOptions*) = value;
2669
+ }
2670
+ UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto *msg, upb_arena *arena) {
2671
+ struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg);
2672
+ if (sub == NULL) {
2673
+ sub = (struct google_protobuf_FieldOptions*)_upb_msg_new(&google_protobuf_FieldOptions_msginit, arena);
2674
+ if (!sub) return NULL;
2675
+ google_protobuf_FieldDescriptorProto_set_options(msg, sub);
2676
+ }
2677
+ return sub;
2678
+ }
2679
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
2680
+ _upb_sethas(msg, 9);
2681
+ *UPB_PTR_AT(msg, UPB_SIZE(16, 16), int32_t) = value;
2682
+ }
2683
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
2684
+ _upb_sethas(msg, 10);
2685
+ *UPB_PTR_AT(msg, UPB_SIZE(56, 88), upb_strview) = value;
2686
+ }
2687
+ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) {
2688
+ _upb_sethas(msg, 11);
2689
+ *UPB_PTR_AT(msg, UPB_SIZE(20, 20), bool) = value;
2690
+ }
2691
+
2692
+ /* google.protobuf.OneofDescriptorProto */
2693
+
2694
+ UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_new(upb_arena *arena) {
2695
+ return (google_protobuf_OneofDescriptorProto *)_upb_msg_new(&google_protobuf_OneofDescriptorProto_msginit, arena);
2696
+ }
2697
+ UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parse(const char *buf, size_t size,
2698
+ upb_arena *arena) {
2699
+ google_protobuf_OneofDescriptorProto *ret = google_protobuf_OneofDescriptorProto_new(arena);
2700
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msginit, arena)) ? ret : NULL;
2701
+ }
2702
+ UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parse_ex(const char *buf, size_t size,
2703
+ upb_arena *arena, int options) {
2704
+ google_protobuf_OneofDescriptorProto *ret = google_protobuf_OneofDescriptorProto_new(arena);
2705
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msginit, arena, options))
2706
+ ? ret : NULL;
2707
+ }
2708
+ UPB_INLINE char *google_protobuf_OneofDescriptorProto_serialize(const google_protobuf_OneofDescriptorProto *msg, upb_arena *arena, size_t *len) {
2709
+ return upb_encode(msg, &google_protobuf_OneofDescriptorProto_msginit, arena, len);
2710
+ }
2711
+
2712
+ UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_name(const google_protobuf_OneofDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
2713
+ UPB_INLINE upb_strview google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
2714
+ UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_options(const google_protobuf_OneofDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
2715
+ UPB_INLINE const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), const google_protobuf_OneofOptions*); }
2716
+
2717
+ UPB_INLINE void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_strview value) {
2718
+ _upb_sethas(msg, 1);
2719
+ *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
2720
+ }
2721
+ UPB_INLINE void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) {
2722
+ _upb_sethas(msg, 2);
2723
+ *UPB_PTR_AT(msg, UPB_SIZE(12, 24), google_protobuf_OneofOptions*) = value;
2724
+ }
2725
+ UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto *msg, upb_arena *arena) {
2726
+ struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg);
2727
+ if (sub == NULL) {
2728
+ sub = (struct google_protobuf_OneofOptions*)_upb_msg_new(&google_protobuf_OneofOptions_msginit, arena);
2729
+ if (!sub) return NULL;
2730
+ google_protobuf_OneofDescriptorProto_set_options(msg, sub);
2731
+ }
2732
+ return sub;
2733
+ }
2734
+
2735
+ /* google.protobuf.EnumDescriptorProto */
2736
+
2737
+ UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_new(upb_arena *arena) {
2738
+ return (google_protobuf_EnumDescriptorProto *)_upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena);
2739
+ }
2740
+ UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parse(const char *buf, size_t size,
2741
+ upb_arena *arena) {
2742
+ google_protobuf_EnumDescriptorProto *ret = google_protobuf_EnumDescriptorProto_new(arena);
2743
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msginit, arena)) ? ret : NULL;
2744
+ }
2745
+ UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parse_ex(const char *buf, size_t size,
2746
+ upb_arena *arena, int options) {
2747
+ google_protobuf_EnumDescriptorProto *ret = google_protobuf_EnumDescriptorProto_new(arena);
2748
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msginit, arena, options))
2749
+ ? ret : NULL;
2750
+ }
2751
+ UPB_INLINE char *google_protobuf_EnumDescriptorProto_serialize(const google_protobuf_EnumDescriptorProto *msg, upb_arena *arena, size_t *len) {
2752
+ return upb_encode(msg, &google_protobuf_EnumDescriptorProto_msginit, arena, len);
2753
+ }
2754
+
2755
+ UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_name(const google_protobuf_EnumDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
2756
+ UPB_INLINE upb_strview google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
2757
+ UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_value(const google_protobuf_EnumDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(16, 32)); }
2758
+ UPB_INLINE const google_protobuf_EnumValueDescriptorProto* const* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumValueDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); }
2759
+ UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_options(const google_protobuf_EnumDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
2760
+ UPB_INLINE const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), const google_protobuf_EnumOptions*); }
2761
+ UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_range(const google_protobuf_EnumDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(20, 40)); }
2762
+ UPB_INLINE const google_protobuf_EnumDescriptorProto_EnumReservedRange* const* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); }
2763
+ UPB_INLINE upb_strview const* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
2764
+
2765
+ UPB_INLINE void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_strview value) {
2766
+ _upb_sethas(msg, 1);
2767
+ *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
2768
+ }
2769
+ UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto *msg, size_t *len) {
2770
+ return (google_protobuf_EnumValueDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
2771
+ }
2772
+ UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_resize_value(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) {
2773
+ return (google_protobuf_EnumValueDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(16, 32), len, UPB_SIZE(2, 3), arena);
2774
+ }
2775
+ UPB_INLINE struct google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumDescriptorProto_add_value(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) {
2776
+ struct google_protobuf_EnumValueDescriptorProto* sub = (struct google_protobuf_EnumValueDescriptorProto*)_upb_msg_new(&google_protobuf_EnumValueDescriptorProto_msginit, arena);
2777
+ bool ok = _upb_array_append_accessor2(
2778
+ msg, UPB_SIZE(16, 32), UPB_SIZE(2, 3), &sub, arena);
2779
+ if (!ok) return NULL;
2780
+ return sub;
2781
+ }
2782
+ UPB_INLINE void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) {
2783
+ _upb_sethas(msg, 2);
2784
+ *UPB_PTR_AT(msg, UPB_SIZE(12, 24), google_protobuf_EnumOptions*) = value;
2785
+ }
2786
+ UPB_INLINE struct google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) {
2787
+ struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg);
2788
+ if (sub == NULL) {
2789
+ sub = (struct google_protobuf_EnumOptions*)_upb_msg_new(&google_protobuf_EnumOptions_msginit, arena);
2790
+ if (!sub) return NULL;
2791
+ google_protobuf_EnumDescriptorProto_set_options(msg, sub);
2792
+ }
2793
+ return sub;
2794
+ }
2795
+ UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_mutable_reserved_range(google_protobuf_EnumDescriptorProto *msg, size_t *len) {
2796
+ return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
2797
+ }
2798
+ UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_resize_reserved_range(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) {
2799
+ return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_resize_accessor2(msg, UPB_SIZE(20, 40), len, UPB_SIZE(2, 3), arena);
2800
+ }
2801
+ UPB_INLINE struct google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_add_reserved_range(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) {
2802
+ struct google_protobuf_EnumDescriptorProto_EnumReservedRange* sub = (struct google_protobuf_EnumDescriptorProto_EnumReservedRange*)_upb_msg_new(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena);
2803
+ bool ok = _upb_array_append_accessor2(
2804
+ msg, UPB_SIZE(20, 40), UPB_SIZE(2, 3), &sub, arena);
2805
+ if (!ok) return NULL;
2806
+ return sub;
2807
+ }
2808
+ UPB_INLINE upb_strview* google_protobuf_EnumDescriptorProto_mutable_reserved_name(google_protobuf_EnumDescriptorProto *msg, size_t *len) {
2809
+ return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
2810
+ }
2811
+ UPB_INLINE upb_strview* google_protobuf_EnumDescriptorProto_resize_reserved_name(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) {
2812
+ return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(24, 48), len, UPB_SIZE(3, 4), arena);
2813
+ }
2814
+ UPB_INLINE bool google_protobuf_EnumDescriptorProto_add_reserved_name(google_protobuf_EnumDescriptorProto *msg, upb_strview val, upb_arena *arena) {
2815
+ return _upb_array_append_accessor2(msg, UPB_SIZE(24, 48), UPB_SIZE(3, 4), &val,
2816
+ arena);
2817
+ }
2818
+
2819
+ /* google.protobuf.EnumDescriptorProto.EnumReservedRange */
2820
+
2821
+ UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_arena *arena) {
2822
+ return (google_protobuf_EnumDescriptorProto_EnumReservedRange *)_upb_msg_new(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena);
2823
+ }
2824
+ UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char *buf, size_t size,
2825
+ upb_arena *arena) {
2826
+ google_protobuf_EnumDescriptorProto_EnumReservedRange *ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
2827
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena)) ? ret : NULL;
2828
+ }
2829
+ UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parse_ex(const char *buf, size_t size,
2830
+ upb_arena *arena, int options) {
2831
+ google_protobuf_EnumDescriptorProto_EnumReservedRange *ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
2832
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena, options))
2833
+ ? ret : NULL;
2834
+ }
2835
+ UPB_INLINE char *google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, upb_arena *arena, size_t *len) {
2836
+ return upb_encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena, len);
2837
+ }
2838
+
2839
+ UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return _upb_hasbit(msg, 1); }
2840
+ UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
2841
+ UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return _upb_hasbit(msg, 2); }
2842
+ UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t); }
2843
+
2844
+ UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
2845
+ _upb_sethas(msg, 1);
2846
+ *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
2847
+ }
2848
+ UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
2849
+ _upb_sethas(msg, 2);
2850
+ *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value;
2851
+ }
2852
+
2853
+ /* google.protobuf.EnumValueDescriptorProto */
2854
+
2855
+ UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_new(upb_arena *arena) {
2856
+ return (google_protobuf_EnumValueDescriptorProto *)_upb_msg_new(&google_protobuf_EnumValueDescriptorProto_msginit, arena);
2857
+ }
2858
+ UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parse(const char *buf, size_t size,
2859
+ upb_arena *arena) {
2860
+ google_protobuf_EnumValueDescriptorProto *ret = google_protobuf_EnumValueDescriptorProto_new(arena);
2861
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msginit, arena)) ? ret : NULL;
2862
+ }
2863
+ UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parse_ex(const char *buf, size_t size,
2864
+ upb_arena *arena, int options) {
2865
+ google_protobuf_EnumValueDescriptorProto *ret = google_protobuf_EnumValueDescriptorProto_new(arena);
2866
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msginit, arena, options))
2867
+ ? ret : NULL;
2868
+ }
2869
+ UPB_INLINE char *google_protobuf_EnumValueDescriptorProto_serialize(const google_protobuf_EnumValueDescriptorProto *msg, upb_arena *arena, size_t *len) {
2870
+ return upb_encode(msg, &google_protobuf_EnumValueDescriptorProto_msginit, arena, len);
2871
+ }
2872
+
2873
+ UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
2874
+ UPB_INLINE upb_strview google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), upb_strview); }
2875
+ UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
2876
+ UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
2877
+ UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_hasbit(msg, 3); }
2878
+ UPB_INLINE const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(16, 24), const google_protobuf_EnumValueOptions*); }
2879
+
2880
+ UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_strview value) {
2881
+ _upb_sethas(msg, 1);
2882
+ *UPB_PTR_AT(msg, UPB_SIZE(8, 8), upb_strview) = value;
2883
+ }
2884
+ UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) {
2885
+ _upb_sethas(msg, 2);
2886
+ *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
2887
+ }
2888
+ UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) {
2889
+ _upb_sethas(msg, 3);
2890
+ *UPB_PTR_AT(msg, UPB_SIZE(16, 24), google_protobuf_EnumValueOptions*) = value;
2891
+ }
2892
+ UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto *msg, upb_arena *arena) {
2893
+ struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg);
2894
+ if (sub == NULL) {
2895
+ sub = (struct google_protobuf_EnumValueOptions*)_upb_msg_new(&google_protobuf_EnumValueOptions_msginit, arena);
2896
+ if (!sub) return NULL;
2897
+ google_protobuf_EnumValueDescriptorProto_set_options(msg, sub);
2898
+ }
2899
+ return sub;
2900
+ }
2901
+
2902
+ /* google.protobuf.ServiceDescriptorProto */
2903
+
2904
+ UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_new(upb_arena *arena) {
2905
+ return (google_protobuf_ServiceDescriptorProto *)_upb_msg_new(&google_protobuf_ServiceDescriptorProto_msginit, arena);
2906
+ }
2907
+ UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parse(const char *buf, size_t size,
2908
+ upb_arena *arena) {
2909
+ google_protobuf_ServiceDescriptorProto *ret = google_protobuf_ServiceDescriptorProto_new(arena);
2910
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msginit, arena)) ? ret : NULL;
2911
+ }
2912
+ UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parse_ex(const char *buf, size_t size,
2913
+ upb_arena *arena, int options) {
2914
+ google_protobuf_ServiceDescriptorProto *ret = google_protobuf_ServiceDescriptorProto_new(arena);
2915
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msginit, arena, options))
2916
+ ? ret : NULL;
2917
+ }
2918
+ UPB_INLINE char *google_protobuf_ServiceDescriptorProto_serialize(const google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena, size_t *len) {
2919
+ return upb_encode(msg, &google_protobuf_ServiceDescriptorProto_msginit, arena, len);
2920
+ }
2921
+
2922
+ UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
2923
+ UPB_INLINE upb_strview google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
2924
+ UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_method(const google_protobuf_ServiceDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(16, 32)); }
2925
+ UPB_INLINE const google_protobuf_MethodDescriptorProto* const* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto *msg, size_t *len) { return (const google_protobuf_MethodDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); }
2926
+ UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_options(const google_protobuf_ServiceDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
2927
+ UPB_INLINE const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), const google_protobuf_ServiceOptions*); }
2928
+
2929
+ UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_strview value) {
2930
+ _upb_sethas(msg, 1);
2931
+ *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
2932
+ }
2933
+ UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto *msg, size_t *len) {
2934
+ return (google_protobuf_MethodDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
2935
+ }
2936
+ UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_resize_method(google_protobuf_ServiceDescriptorProto *msg, size_t len, upb_arena *arena) {
2937
+ return (google_protobuf_MethodDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(16, 32), len, UPB_SIZE(2, 3), arena);
2938
+ }
2939
+ UPB_INLINE struct google_protobuf_MethodDescriptorProto* google_protobuf_ServiceDescriptorProto_add_method(google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena) {
2940
+ struct google_protobuf_MethodDescriptorProto* sub = (struct google_protobuf_MethodDescriptorProto*)_upb_msg_new(&google_protobuf_MethodDescriptorProto_msginit, arena);
2941
+ bool ok = _upb_array_append_accessor2(
2942
+ msg, UPB_SIZE(16, 32), UPB_SIZE(2, 3), &sub, arena);
2943
+ if (!ok) return NULL;
2944
+ return sub;
2945
+ }
2946
+ UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) {
2947
+ _upb_sethas(msg, 2);
2948
+ *UPB_PTR_AT(msg, UPB_SIZE(12, 24), google_protobuf_ServiceOptions*) = value;
2949
+ }
2950
+ UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena) {
2951
+ struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg);
2952
+ if (sub == NULL) {
2953
+ sub = (struct google_protobuf_ServiceOptions*)_upb_msg_new(&google_protobuf_ServiceOptions_msginit, arena);
2954
+ if (!sub) return NULL;
2955
+ google_protobuf_ServiceDescriptorProto_set_options(msg, sub);
2956
+ }
2957
+ return sub;
2958
+ }
2959
+
2960
+ /* google.protobuf.MethodDescriptorProto */
2961
+
2962
+ UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_new(upb_arena *arena) {
2963
+ return (google_protobuf_MethodDescriptorProto *)_upb_msg_new(&google_protobuf_MethodDescriptorProto_msginit, arena);
2964
+ }
2965
+ UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parse(const char *buf, size_t size,
2966
+ upb_arena *arena) {
2967
+ google_protobuf_MethodDescriptorProto *ret = google_protobuf_MethodDescriptorProto_new(arena);
2968
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msginit, arena)) ? ret : NULL;
2969
+ }
2970
+ UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parse_ex(const char *buf, size_t size,
2971
+ upb_arena *arena, int options) {
2972
+ google_protobuf_MethodDescriptorProto *ret = google_protobuf_MethodDescriptorProto_new(arena);
2973
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msginit, arena, options))
2974
+ ? ret : NULL;
2975
+ }
2976
+ UPB_INLINE char *google_protobuf_MethodDescriptorProto_serialize(const google_protobuf_MethodDescriptorProto *msg, upb_arena *arena, size_t *len) {
2977
+ return upb_encode(msg, &google_protobuf_MethodDescriptorProto_msginit, arena, len);
2978
+ }
2979
+
2980
+ UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
2981
+ UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
2982
+ UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
2983
+ UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview); }
2984
+ UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 3); }
2985
+ UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(20, 40), upb_strview); }
2986
+ UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 4); }
2987
+ UPB_INLINE const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(28, 56), const google_protobuf_MethodOptions*); }
2988
+ UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 5); }
2989
+ UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool); }
2990
+ UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 6); }
2991
+ UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(2, 2), bool); }
2992
+
2993
+ UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_strview value) {
2994
+ _upb_sethas(msg, 1);
2995
+ *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
2996
+ }
2997
+ UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_strview value) {
2998
+ _upb_sethas(msg, 2);
2999
+ *UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview) = value;
3000
+ }
3001
+ UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_strview value) {
3002
+ _upb_sethas(msg, 3);
3003
+ *UPB_PTR_AT(msg, UPB_SIZE(20, 40), upb_strview) = value;
3004
+ }
3005
+ UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) {
3006
+ _upb_sethas(msg, 4);
3007
+ *UPB_PTR_AT(msg, UPB_SIZE(28, 56), google_protobuf_MethodOptions*) = value;
3008
+ }
3009
+ UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto *msg, upb_arena *arena) {
3010
+ struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg);
3011
+ if (sub == NULL) {
3012
+ sub = (struct google_protobuf_MethodOptions*)_upb_msg_new(&google_protobuf_MethodOptions_msginit, arena);
3013
+ if (!sub) return NULL;
3014
+ google_protobuf_MethodDescriptorProto_set_options(msg, sub);
3015
+ }
3016
+ return sub;
3017
+ }
3018
+ UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
3019
+ _upb_sethas(msg, 5);
3020
+ *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool) = value;
3021
+ }
3022
+ UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
3023
+ _upb_sethas(msg, 6);
3024
+ *UPB_PTR_AT(msg, UPB_SIZE(2, 2), bool) = value;
3025
+ }
3026
+
3027
+ /* google.protobuf.FileOptions */
3028
+
3029
+ UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_new(upb_arena *arena) {
3030
+ return (google_protobuf_FileOptions *)_upb_msg_new(&google_protobuf_FileOptions_msginit, arena);
3031
+ }
3032
+ UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_parse(const char *buf, size_t size,
3033
+ upb_arena *arena) {
3034
+ google_protobuf_FileOptions *ret = google_protobuf_FileOptions_new(arena);
3035
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_FileOptions_msginit, arena)) ? ret : NULL;
3036
+ }
3037
+ UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_parse_ex(const char *buf, size_t size,
3038
+ upb_arena *arena, int options) {
3039
+ google_protobuf_FileOptions *ret = google_protobuf_FileOptions_new(arena);
3040
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_FileOptions_msginit, arena, options))
3041
+ ? ret : NULL;
3042
+ }
3043
+ UPB_INLINE char *google_protobuf_FileOptions_serialize(const google_protobuf_FileOptions *msg, upb_arena *arena, size_t *len) {
3044
+ return upb_encode(msg, &google_protobuf_FileOptions_msginit, arena, len);
3045
+ }
3046
+
3047
+ UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 1); }
3048
+ UPB_INLINE upb_strview google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(20, 24), upb_strview); }
3049
+ UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 2); }
3050
+ UPB_INLINE upb_strview google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(28, 40), upb_strview); }
3051
+ UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 3); }
3052
+ UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
3053
+ UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 4); }
3054
+ UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), bool); }
3055
+ UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 5); }
3056
+ UPB_INLINE upb_strview google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(36, 56), upb_strview); }
3057
+ UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 6); }
3058
+ UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(9, 9), bool); }
3059
+ UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 7); }
3060
+ UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(10, 10), bool); }
3061
+ UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 8); }
3062
+ UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(11, 11), bool); }
3063
+ UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 9); }
3064
+ UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 12), bool); }
3065
+ UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 10); }
3066
+ UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(13, 13), bool); }
3067
+ UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 11); }
3068
+ UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(14, 14), bool); }
3069
+ UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 12); }
3070
+ UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(15, 15), bool); }
3071
+ UPB_INLINE bool google_protobuf_FileOptions_has_objc_class_prefix(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 13); }
3072
+ UPB_INLINE upb_strview google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(44, 72), upb_strview); }
3073
+ UPB_INLINE bool google_protobuf_FileOptions_has_csharp_namespace(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 14); }
3074
+ UPB_INLINE upb_strview google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(52, 88), upb_strview); }
3075
+ UPB_INLINE bool google_protobuf_FileOptions_has_swift_prefix(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 15); }
3076
+ UPB_INLINE upb_strview google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(60, 104), upb_strview); }
3077
+ UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 16); }
3078
+ UPB_INLINE upb_strview google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(68, 120), upb_strview); }
3079
+ UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 17); }
3080
+ UPB_INLINE upb_strview google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(76, 136), upb_strview); }
3081
+ UPB_INLINE bool google_protobuf_FileOptions_has_php_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 18); }
3082
+ UPB_INLINE bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(16, 16), bool); }
3083
+ UPB_INLINE bool google_protobuf_FileOptions_has_php_metadata_namespace(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 19); }
3084
+ UPB_INLINE upb_strview google_protobuf_FileOptions_php_metadata_namespace(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(84, 152), upb_strview); }
3085
+ UPB_INLINE bool google_protobuf_FileOptions_has_ruby_package(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 20); }
3086
+ UPB_INLINE upb_strview google_protobuf_FileOptions_ruby_package(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(92, 168), upb_strview); }
3087
+ UPB_INLINE bool google_protobuf_FileOptions_has_uninterpreted_option(const google_protobuf_FileOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(100, 184)); }
3088
+ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(100, 184), len); }
3089
+
3090
+ UPB_INLINE void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_strview value) {
3091
+ _upb_sethas(msg, 1);
3092
+ *UPB_PTR_AT(msg, UPB_SIZE(20, 24), upb_strview) = value;
3093
+ }
3094
+ UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_strview value) {
3095
+ _upb_sethas(msg, 2);
3096
+ *UPB_PTR_AT(msg, UPB_SIZE(28, 40), upb_strview) = value;
3097
+ }
3098
+ UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) {
3099
+ _upb_sethas(msg, 3);
3100
+ *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
3101
+ }
3102
+ UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) {
3103
+ _upb_sethas(msg, 4);
3104
+ *UPB_PTR_AT(msg, UPB_SIZE(8, 8), bool) = value;
3105
+ }
3106
+ UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_strview value) {
3107
+ _upb_sethas(msg, 5);
3108
+ *UPB_PTR_AT(msg, UPB_SIZE(36, 56), upb_strview) = value;
3109
+ }
3110
+ UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) {
3111
+ _upb_sethas(msg, 6);
3112
+ *UPB_PTR_AT(msg, UPB_SIZE(9, 9), bool) = value;
3113
+ }
3114
+ UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) {
3115
+ _upb_sethas(msg, 7);
3116
+ *UPB_PTR_AT(msg, UPB_SIZE(10, 10), bool) = value;
3117
+ }
3118
+ UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) {
3119
+ _upb_sethas(msg, 8);
3120
+ *UPB_PTR_AT(msg, UPB_SIZE(11, 11), bool) = value;
3121
+ }
3122
+ UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) {
3123
+ _upb_sethas(msg, 9);
3124
+ *UPB_PTR_AT(msg, UPB_SIZE(12, 12), bool) = value;
3125
+ }
3126
+ UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) {
3127
+ _upb_sethas(msg, 10);
3128
+ *UPB_PTR_AT(msg, UPB_SIZE(13, 13), bool) = value;
3129
+ }
3130
+ UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) {
3131
+ _upb_sethas(msg, 11);
3132
+ *UPB_PTR_AT(msg, UPB_SIZE(14, 14), bool) = value;
3133
+ }
3134
+ UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) {
3135
+ _upb_sethas(msg, 12);
3136
+ *UPB_PTR_AT(msg, UPB_SIZE(15, 15), bool) = value;
3137
+ }
3138
+ UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_strview value) {
3139
+ _upb_sethas(msg, 13);
3140
+ *UPB_PTR_AT(msg, UPB_SIZE(44, 72), upb_strview) = value;
3141
+ }
3142
+ UPB_INLINE void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_strview value) {
3143
+ _upb_sethas(msg, 14);
3144
+ *UPB_PTR_AT(msg, UPB_SIZE(52, 88), upb_strview) = value;
3145
+ }
3146
+ UPB_INLINE void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_strview value) {
3147
+ _upb_sethas(msg, 15);
3148
+ *UPB_PTR_AT(msg, UPB_SIZE(60, 104), upb_strview) = value;
3149
+ }
3150
+ UPB_INLINE void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_strview value) {
3151
+ _upb_sethas(msg, 16);
3152
+ *UPB_PTR_AT(msg, UPB_SIZE(68, 120), upb_strview) = value;
3153
+ }
3154
+ UPB_INLINE void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_strview value) {
3155
+ _upb_sethas(msg, 17);
3156
+ *UPB_PTR_AT(msg, UPB_SIZE(76, 136), upb_strview) = value;
3157
+ }
3158
+ UPB_INLINE void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value) {
3159
+ _upb_sethas(msg, 18);
3160
+ *UPB_PTR_AT(msg, UPB_SIZE(16, 16), bool) = value;
3161
+ }
3162
+ UPB_INLINE void google_protobuf_FileOptions_set_php_metadata_namespace(google_protobuf_FileOptions *msg, upb_strview value) {
3163
+ _upb_sethas(msg, 19);
3164
+ *UPB_PTR_AT(msg, UPB_SIZE(84, 152), upb_strview) = value;
3165
+ }
3166
+ UPB_INLINE void google_protobuf_FileOptions_set_ruby_package(google_protobuf_FileOptions *msg, upb_strview value) {
3167
+ _upb_sethas(msg, 20);
3168
+ *UPB_PTR_AT(msg, UPB_SIZE(92, 168), upb_strview) = value;
3169
+ }
3170
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_mutable_uninterpreted_option(google_protobuf_FileOptions *msg, size_t *len) {
3171
+ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(100, 184), len);
3172
+ }
3173
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_resize_uninterpreted_option(google_protobuf_FileOptions *msg, size_t len, upb_arena *arena) {
3174
+ return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(100, 184), len, UPB_SIZE(2, 3), arena);
3175
+ }
3176
+ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FileOptions_add_uninterpreted_option(google_protobuf_FileOptions *msg, upb_arena *arena) {
3177
+ struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
3178
+ bool ok = _upb_array_append_accessor2(
3179
+ msg, UPB_SIZE(100, 184), UPB_SIZE(2, 3), &sub, arena);
3180
+ if (!ok) return NULL;
3181
+ return sub;
3182
+ }
3183
+
3184
+ /* google.protobuf.MessageOptions */
3185
+
3186
+ UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_new(upb_arena *arena) {
3187
+ return (google_protobuf_MessageOptions *)_upb_msg_new(&google_protobuf_MessageOptions_msginit, arena);
3188
+ }
3189
+ UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_parse(const char *buf, size_t size,
3190
+ upb_arena *arena) {
3191
+ google_protobuf_MessageOptions *ret = google_protobuf_MessageOptions_new(arena);
3192
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_MessageOptions_msginit, arena)) ? ret : NULL;
3193
+ }
3194
+ UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_parse_ex(const char *buf, size_t size,
3195
+ upb_arena *arena, int options) {
3196
+ google_protobuf_MessageOptions *ret = google_protobuf_MessageOptions_new(arena);
3197
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_MessageOptions_msginit, arena, options))
3198
+ ? ret : NULL;
3199
+ }
3200
+ UPB_INLINE char *google_protobuf_MessageOptions_serialize(const google_protobuf_MessageOptions *msg, upb_arena *arena, size_t *len) {
3201
+ return upb_encode(msg, &google_protobuf_MessageOptions_msginit, arena, len);
3202
+ }
3203
+
3204
+ UPB_INLINE bool google_protobuf_MessageOptions_has_message_set_wire_format(const google_protobuf_MessageOptions *msg) { return _upb_hasbit(msg, 1); }
3205
+ UPB_INLINE bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool); }
3206
+ UPB_INLINE bool google_protobuf_MessageOptions_has_no_standard_descriptor_accessor(const google_protobuf_MessageOptions *msg) { return _upb_hasbit(msg, 2); }
3207
+ UPB_INLINE bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(2, 2), bool); }
3208
+ UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated(const google_protobuf_MessageOptions *msg) { return _upb_hasbit(msg, 3); }
3209
+ UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(3, 3), bool); }
3210
+ UPB_INLINE bool google_protobuf_MessageOptions_has_map_entry(const google_protobuf_MessageOptions *msg) { return _upb_hasbit(msg, 4); }
3211
+ UPB_INLINE bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), bool); }
3212
+ UPB_INLINE bool google_protobuf_MessageOptions_has_uninterpreted_option(const google_protobuf_MessageOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(8, 8)); }
3213
+ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(8, 8), len); }
3214
+
3215
+ UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) {
3216
+ _upb_sethas(msg, 1);
3217
+ *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool) = value;
3218
+ }
3219
+ UPB_INLINE void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) {
3220
+ _upb_sethas(msg, 2);
3221
+ *UPB_PTR_AT(msg, UPB_SIZE(2, 2), bool) = value;
3222
+ }
3223
+ UPB_INLINE void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) {
3224
+ _upb_sethas(msg, 3);
3225
+ *UPB_PTR_AT(msg, UPB_SIZE(3, 3), bool) = value;
3226
+ }
3227
+ UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) {
3228
+ _upb_sethas(msg, 4);
3229
+ *UPB_PTR_AT(msg, UPB_SIZE(4, 4), bool) = value;
3230
+ }
3231
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_mutable_uninterpreted_option(google_protobuf_MessageOptions *msg, size_t *len) {
3232
+ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(8, 8), len);
3233
+ }
3234
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_resize_uninterpreted_option(google_protobuf_MessageOptions *msg, size_t len, upb_arena *arena) {
3235
+ return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(8, 8), len, UPB_SIZE(2, 3), arena);
3236
+ }
3237
+ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MessageOptions_add_uninterpreted_option(google_protobuf_MessageOptions *msg, upb_arena *arena) {
3238
+ struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
3239
+ bool ok = _upb_array_append_accessor2(
3240
+ msg, UPB_SIZE(8, 8), UPB_SIZE(2, 3), &sub, arena);
3241
+ if (!ok) return NULL;
3242
+ return sub;
3243
+ }
3244
+
3245
+ /* google.protobuf.FieldOptions */
3246
+
3247
+ UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_new(upb_arena *arena) {
3248
+ return (google_protobuf_FieldOptions *)_upb_msg_new(&google_protobuf_FieldOptions_msginit, arena);
3249
+ }
3250
+ UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_parse(const char *buf, size_t size,
3251
+ upb_arena *arena) {
3252
+ google_protobuf_FieldOptions *ret = google_protobuf_FieldOptions_new(arena);
3253
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_FieldOptions_msginit, arena)) ? ret : NULL;
3254
+ }
3255
+ UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_parse_ex(const char *buf, size_t size,
3256
+ upb_arena *arena, int options) {
3257
+ google_protobuf_FieldOptions *ret = google_protobuf_FieldOptions_new(arena);
3258
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_FieldOptions_msginit, arena, options))
3259
+ ? ret : NULL;
3260
+ }
3261
+ UPB_INLINE char *google_protobuf_FieldOptions_serialize(const google_protobuf_FieldOptions *msg, upb_arena *arena, size_t *len) {
3262
+ return upb_encode(msg, &google_protobuf_FieldOptions_msginit, arena, len);
3263
+ }
3264
+
3265
+ UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 1); }
3266
+ UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
3267
+ UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 2); }
3268
+ UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 12), bool); }
3269
+ UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 3); }
3270
+ UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(13, 13), bool); }
3271
+ UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 4); }
3272
+ UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(14, 14), bool); }
3273
+ UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 5); }
3274
+ UPB_INLINE int32_t google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t); }
3275
+ UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 6); }
3276
+ UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(15, 15), bool); }
3277
+ UPB_INLINE bool google_protobuf_FieldOptions_has_uninterpreted_option(const google_protobuf_FieldOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(16, 16)); }
3278
+ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(16, 16), len); }
3279
+
3280
+ UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) {
3281
+ _upb_sethas(msg, 1);
3282
+ *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
3283
+ }
3284
+ UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) {
3285
+ _upb_sethas(msg, 2);
3286
+ *UPB_PTR_AT(msg, UPB_SIZE(12, 12), bool) = value;
3287
+ }
3288
+ UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) {
3289
+ _upb_sethas(msg, 3);
3290
+ *UPB_PTR_AT(msg, UPB_SIZE(13, 13), bool) = value;
3291
+ }
3292
+ UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) {
3293
+ _upb_sethas(msg, 4);
3294
+ *UPB_PTR_AT(msg, UPB_SIZE(14, 14), bool) = value;
3295
+ }
3296
+ UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) {
3297
+ _upb_sethas(msg, 5);
3298
+ *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value;
3299
+ }
3300
+ UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) {
3301
+ _upb_sethas(msg, 6);
3302
+ *UPB_PTR_AT(msg, UPB_SIZE(15, 15), bool) = value;
3303
+ }
3304
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions *msg, size_t *len) {
3305
+ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 16), len);
3306
+ }
3307
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions *msg, size_t len, upb_arena *arena) {
3308
+ return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(16, 16), len, UPB_SIZE(2, 3), arena);
3309
+ }
3310
+ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions *msg, upb_arena *arena) {
3311
+ struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
3312
+ bool ok = _upb_array_append_accessor2(
3313
+ msg, UPB_SIZE(16, 16), UPB_SIZE(2, 3), &sub, arena);
3314
+ if (!ok) return NULL;
3315
+ return sub;
3316
+ }
3317
+
3318
+ /* google.protobuf.OneofOptions */
3319
+
3320
+ UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_new(upb_arena *arena) {
3321
+ return (google_protobuf_OneofOptions *)_upb_msg_new(&google_protobuf_OneofOptions_msginit, arena);
3322
+ }
3323
+ UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_parse(const char *buf, size_t size,
3324
+ upb_arena *arena) {
3325
+ google_protobuf_OneofOptions *ret = google_protobuf_OneofOptions_new(arena);
3326
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_OneofOptions_msginit, arena)) ? ret : NULL;
3327
+ }
3328
+ UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_parse_ex(const char *buf, size_t size,
3329
+ upb_arena *arena, int options) {
3330
+ google_protobuf_OneofOptions *ret = google_protobuf_OneofOptions_new(arena);
3331
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_OneofOptions_msginit, arena, options))
3332
+ ? ret : NULL;
3333
+ }
3334
+ UPB_INLINE char *google_protobuf_OneofOptions_serialize(const google_protobuf_OneofOptions *msg, upb_arena *arena, size_t *len) {
3335
+ return upb_encode(msg, &google_protobuf_OneofOptions_msginit, arena, len);
3336
+ }
3337
+
3338
+ UPB_INLINE bool google_protobuf_OneofOptions_has_uninterpreted_option(const google_protobuf_OneofOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(0, 0)); }
3339
+ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
3340
+
3341
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_mutable_uninterpreted_option(google_protobuf_OneofOptions *msg, size_t *len) {
3342
+ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
3343
+ }
3344
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_resize_uninterpreted_option(google_protobuf_OneofOptions *msg, size_t len, upb_arena *arena) {
3345
+ return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena);
3346
+ }
3347
+ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_OneofOptions_add_uninterpreted_option(google_protobuf_OneofOptions *msg, upb_arena *arena) {
3348
+ struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
3349
+ bool ok = _upb_array_append_accessor2(
3350
+ msg, UPB_SIZE(0, 0), UPB_SIZE(2, 3), &sub, arena);
3351
+ if (!ok) return NULL;
3352
+ return sub;
3353
+ }
3354
+
3355
+ /* google.protobuf.EnumOptions */
3356
+
3357
+ UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_new(upb_arena *arena) {
3358
+ return (google_protobuf_EnumOptions *)_upb_msg_new(&google_protobuf_EnumOptions_msginit, arena);
3359
+ }
3360
+ UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_parse(const char *buf, size_t size,
3361
+ upb_arena *arena) {
3362
+ google_protobuf_EnumOptions *ret = google_protobuf_EnumOptions_new(arena);
3363
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumOptions_msginit, arena)) ? ret : NULL;
3364
+ }
3365
+ UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_parse_ex(const char *buf, size_t size,
3366
+ upb_arena *arena, int options) {
3367
+ google_protobuf_EnumOptions *ret = google_protobuf_EnumOptions_new(arena);
3368
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_EnumOptions_msginit, arena, options))
3369
+ ? ret : NULL;
3370
+ }
3371
+ UPB_INLINE char *google_protobuf_EnumOptions_serialize(const google_protobuf_EnumOptions *msg, upb_arena *arena, size_t *len) {
3372
+ return upb_encode(msg, &google_protobuf_EnumOptions_msginit, arena, len);
3373
+ }
3374
+
3375
+ UPB_INLINE bool google_protobuf_EnumOptions_has_allow_alias(const google_protobuf_EnumOptions *msg) { return _upb_hasbit(msg, 1); }
3376
+ UPB_INLINE bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool); }
3377
+ UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated(const google_protobuf_EnumOptions *msg) { return _upb_hasbit(msg, 2); }
3378
+ UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(2, 2), bool); }
3379
+ UPB_INLINE bool google_protobuf_EnumOptions_has_uninterpreted_option(const google_protobuf_EnumOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(4, 8)); }
3380
+ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); }
3381
+
3382
+ UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) {
3383
+ _upb_sethas(msg, 1);
3384
+ *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool) = value;
3385
+ }
3386
+ UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) {
3387
+ _upb_sethas(msg, 2);
3388
+ *UPB_PTR_AT(msg, UPB_SIZE(2, 2), bool) = value;
3389
+ }
3390
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_mutable_uninterpreted_option(google_protobuf_EnumOptions *msg, size_t *len) {
3391
+ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len);
3392
+ }
3393
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_resize_uninterpreted_option(google_protobuf_EnumOptions *msg, size_t len, upb_arena *arena) {
3394
+ return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(4, 8), len, UPB_SIZE(2, 3), arena);
3395
+ }
3396
+ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumOptions_add_uninterpreted_option(google_protobuf_EnumOptions *msg, upb_arena *arena) {
3397
+ struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
3398
+ bool ok = _upb_array_append_accessor2(
3399
+ msg, UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena);
3400
+ if (!ok) return NULL;
3401
+ return sub;
3402
+ }
3403
+
3404
+ /* google.protobuf.EnumValueOptions */
3405
+
3406
+ UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_new(upb_arena *arena) {
3407
+ return (google_protobuf_EnumValueOptions *)_upb_msg_new(&google_protobuf_EnumValueOptions_msginit, arena);
3408
+ }
3409
+ UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_parse(const char *buf, size_t size,
3410
+ upb_arena *arena) {
3411
+ google_protobuf_EnumValueOptions *ret = google_protobuf_EnumValueOptions_new(arena);
3412
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumValueOptions_msginit, arena)) ? ret : NULL;
3413
+ }
3414
+ UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_parse_ex(const char *buf, size_t size,
3415
+ upb_arena *arena, int options) {
3416
+ google_protobuf_EnumValueOptions *ret = google_protobuf_EnumValueOptions_new(arena);
3417
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_EnumValueOptions_msginit, arena, options))
3418
+ ? ret : NULL;
3419
+ }
3420
+ UPB_INLINE char *google_protobuf_EnumValueOptions_serialize(const google_protobuf_EnumValueOptions *msg, upb_arena *arena, size_t *len) {
3421
+ return upb_encode(msg, &google_protobuf_EnumValueOptions_msginit, arena, len);
3422
+ }
3423
+
3424
+ UPB_INLINE bool google_protobuf_EnumValueOptions_has_deprecated(const google_protobuf_EnumValueOptions *msg) { return _upb_hasbit(msg, 1); }
3425
+ UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool); }
3426
+ UPB_INLINE bool google_protobuf_EnumValueOptions_has_uninterpreted_option(const google_protobuf_EnumValueOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(4, 8)); }
3427
+ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); }
3428
+
3429
+ UPB_INLINE void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) {
3430
+ _upb_sethas(msg, 1);
3431
+ *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool) = value;
3432
+ }
3433
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions *msg, size_t *len) {
3434
+ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len);
3435
+ }
3436
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_resize_uninterpreted_option(google_protobuf_EnumValueOptions *msg, size_t len, upb_arena *arena) {
3437
+ return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(4, 8), len, UPB_SIZE(2, 3), arena);
3438
+ }
3439
+ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValueOptions_add_uninterpreted_option(google_protobuf_EnumValueOptions *msg, upb_arena *arena) {
3440
+ struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
3441
+ bool ok = _upb_array_append_accessor2(
3442
+ msg, UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena);
3443
+ if (!ok) return NULL;
3444
+ return sub;
3445
+ }
3446
+
3447
+ /* google.protobuf.ServiceOptions */
3448
+
3449
+ UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_new(upb_arena *arena) {
3450
+ return (google_protobuf_ServiceOptions *)_upb_msg_new(&google_protobuf_ServiceOptions_msginit, arena);
3451
+ }
3452
+ UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_parse(const char *buf, size_t size,
3453
+ upb_arena *arena) {
3454
+ google_protobuf_ServiceOptions *ret = google_protobuf_ServiceOptions_new(arena);
3455
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_ServiceOptions_msginit, arena)) ? ret : NULL;
3456
+ }
3457
+ UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_parse_ex(const char *buf, size_t size,
3458
+ upb_arena *arena, int options) {
3459
+ google_protobuf_ServiceOptions *ret = google_protobuf_ServiceOptions_new(arena);
3460
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_ServiceOptions_msginit, arena, options))
3461
+ ? ret : NULL;
3462
+ }
3463
+ UPB_INLINE char *google_protobuf_ServiceOptions_serialize(const google_protobuf_ServiceOptions *msg, upb_arena *arena, size_t *len) {
3464
+ return upb_encode(msg, &google_protobuf_ServiceOptions_msginit, arena, len);
3465
+ }
3466
+
3467
+ UPB_INLINE bool google_protobuf_ServiceOptions_has_deprecated(const google_protobuf_ServiceOptions *msg) { return _upb_hasbit(msg, 1); }
3468
+ UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool); }
3469
+ UPB_INLINE bool google_protobuf_ServiceOptions_has_uninterpreted_option(const google_protobuf_ServiceOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(4, 8)); }
3470
+ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); }
3471
+
3472
+ UPB_INLINE void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) {
3473
+ _upb_sethas(msg, 1);
3474
+ *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool) = value;
3475
+ }
3476
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_mutable_uninterpreted_option(google_protobuf_ServiceOptions *msg, size_t *len) {
3477
+ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len);
3478
+ }
3479
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_resize_uninterpreted_option(google_protobuf_ServiceOptions *msg, size_t len, upb_arena *arena) {
3480
+ return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(4, 8), len, UPB_SIZE(2, 3), arena);
3481
+ }
3482
+ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ServiceOptions_add_uninterpreted_option(google_protobuf_ServiceOptions *msg, upb_arena *arena) {
3483
+ struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
3484
+ bool ok = _upb_array_append_accessor2(
3485
+ msg, UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena);
3486
+ if (!ok) return NULL;
3487
+ return sub;
3488
+ }
3489
+
3490
+ /* google.protobuf.MethodOptions */
3491
+
3492
+ UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_new(upb_arena *arena) {
3493
+ return (google_protobuf_MethodOptions *)_upb_msg_new(&google_protobuf_MethodOptions_msginit, arena);
3494
+ }
3495
+ UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_parse(const char *buf, size_t size,
3496
+ upb_arena *arena) {
3497
+ google_protobuf_MethodOptions *ret = google_protobuf_MethodOptions_new(arena);
3498
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_MethodOptions_msginit, arena)) ? ret : NULL;
3499
+ }
3500
+ UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_parse_ex(const char *buf, size_t size,
3501
+ upb_arena *arena, int options) {
3502
+ google_protobuf_MethodOptions *ret = google_protobuf_MethodOptions_new(arena);
3503
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_MethodOptions_msginit, arena, options))
3504
+ ? ret : NULL;
3505
+ }
3506
+ UPB_INLINE char *google_protobuf_MethodOptions_serialize(const google_protobuf_MethodOptions *msg, upb_arena *arena, size_t *len) {
3507
+ return upb_encode(msg, &google_protobuf_MethodOptions_msginit, arena, len);
3508
+ }
3509
+
3510
+ UPB_INLINE bool google_protobuf_MethodOptions_has_deprecated(const google_protobuf_MethodOptions *msg) { return _upb_hasbit(msg, 1); }
3511
+ UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), bool); }
3512
+ UPB_INLINE bool google_protobuf_MethodOptions_has_idempotency_level(const google_protobuf_MethodOptions *msg) { return _upb_hasbit(msg, 2); }
3513
+ UPB_INLINE int32_t google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
3514
+ UPB_INLINE bool google_protobuf_MethodOptions_has_uninterpreted_option(const google_protobuf_MethodOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(12, 16)); }
3515
+ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(12, 16), len); }
3516
+
3517
+ UPB_INLINE void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) {
3518
+ _upb_sethas(msg, 1);
3519
+ *UPB_PTR_AT(msg, UPB_SIZE(8, 8), bool) = value;
3520
+ }
3521
+ UPB_INLINE void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, int32_t value) {
3522
+ _upb_sethas(msg, 2);
3523
+ *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
3524
+ }
3525
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_mutable_uninterpreted_option(google_protobuf_MethodOptions *msg, size_t *len) {
3526
+ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(12, 16), len);
3527
+ }
3528
+ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_resize_uninterpreted_option(google_protobuf_MethodOptions *msg, size_t len, upb_arena *arena) {
3529
+ return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(12, 16), len, UPB_SIZE(2, 3), arena);
3530
+ }
3531
+ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MethodOptions_add_uninterpreted_option(google_protobuf_MethodOptions *msg, upb_arena *arena) {
3532
+ struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
3533
+ bool ok = _upb_array_append_accessor2(
3534
+ msg, UPB_SIZE(12, 16), UPB_SIZE(2, 3), &sub, arena);
3535
+ if (!ok) return NULL;
3536
+ return sub;
3537
+ }
3538
+
3539
+ /* google.protobuf.UninterpretedOption */
3540
+
3541
+ UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_new(upb_arena *arena) {
3542
+ return (google_protobuf_UninterpretedOption *)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
3543
+ }
3544
+ UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parse(const char *buf, size_t size,
3545
+ upb_arena *arena) {
3546
+ google_protobuf_UninterpretedOption *ret = google_protobuf_UninterpretedOption_new(arena);
3547
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_msginit, arena)) ? ret : NULL;
3548
+ }
3549
+ UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parse_ex(const char *buf, size_t size,
3550
+ upb_arena *arena, int options) {
3551
+ google_protobuf_UninterpretedOption *ret = google_protobuf_UninterpretedOption_new(arena);
3552
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_msginit, arena, options))
3553
+ ? ret : NULL;
3554
+ }
3555
+ UPB_INLINE char *google_protobuf_UninterpretedOption_serialize(const google_protobuf_UninterpretedOption *msg, upb_arena *arena, size_t *len) {
3556
+ return upb_encode(msg, &google_protobuf_UninterpretedOption_msginit, arena, len);
3557
+ }
3558
+
3559
+ UPB_INLINE bool google_protobuf_UninterpretedOption_has_name(const google_protobuf_UninterpretedOption *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(56, 80)); }
3560
+ UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption *msg, size_t *len) { return (const google_protobuf_UninterpretedOption_NamePart* const*)_upb_array_accessor(msg, UPB_SIZE(56, 80), len); }
3561
+ UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 1); }
3562
+ UPB_INLINE upb_strview google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(32, 32), upb_strview); }
3563
+ UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 2); }
3564
+ UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), uint64_t); }
3565
+ UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 3); }
3566
+ UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(16, 16), int64_t); }
3567
+ UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 4); }
3568
+ UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(24, 24), double); }
3569
+ UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 5); }
3570
+ UPB_INLINE upb_strview google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(40, 48), upb_strview); }
3571
+ UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 6); }
3572
+ UPB_INLINE upb_strview google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(48, 64), upb_strview); }
3573
+
3574
+ UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption *msg, size_t *len) {
3575
+ return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_mutable_accessor(msg, UPB_SIZE(56, 80), len);
3576
+ }
3577
+ UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_resize_name(google_protobuf_UninterpretedOption *msg, size_t len, upb_arena *arena) {
3578
+ return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_resize_accessor2(msg, UPB_SIZE(56, 80), len, UPB_SIZE(2, 3), arena);
3579
+ }
3580
+ UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_add_name(google_protobuf_UninterpretedOption *msg, upb_arena *arena) {
3581
+ struct google_protobuf_UninterpretedOption_NamePart* sub = (struct google_protobuf_UninterpretedOption_NamePart*)_upb_msg_new(&google_protobuf_UninterpretedOption_NamePart_msginit, arena);
3582
+ bool ok = _upb_array_append_accessor2(
3583
+ msg, UPB_SIZE(56, 80), UPB_SIZE(2, 3), &sub, arena);
3584
+ if (!ok) return NULL;
3585
+ return sub;
3586
+ }
3587
+ UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_strview value) {
3588
+ _upb_sethas(msg, 1);
3589
+ *UPB_PTR_AT(msg, UPB_SIZE(32, 32), upb_strview) = value;
3590
+ }
3591
+ UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) {
3592
+ _upb_sethas(msg, 2);
3593
+ *UPB_PTR_AT(msg, UPB_SIZE(8, 8), uint64_t) = value;
3594
+ }
3595
+ UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) {
3596
+ _upb_sethas(msg, 3);
3597
+ *UPB_PTR_AT(msg, UPB_SIZE(16, 16), int64_t) = value;
3598
+ }
3599
+ UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) {
3600
+ _upb_sethas(msg, 4);
3601
+ *UPB_PTR_AT(msg, UPB_SIZE(24, 24), double) = value;
3602
+ }
3603
+ UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_strview value) {
3604
+ _upb_sethas(msg, 5);
3605
+ *UPB_PTR_AT(msg, UPB_SIZE(40, 48), upb_strview) = value;
3606
+ }
3607
+ UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_strview value) {
3608
+ _upb_sethas(msg, 6);
3609
+ *UPB_PTR_AT(msg, UPB_SIZE(48, 64), upb_strview) = value;
3610
+ }
3611
+
3612
+ /* google.protobuf.UninterpretedOption.NamePart */
3613
+
3614
+ UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_new(upb_arena *arena) {
3615
+ return (google_protobuf_UninterpretedOption_NamePart *)_upb_msg_new(&google_protobuf_UninterpretedOption_NamePart_msginit, arena);
3616
+ }
3617
+ UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_parse(const char *buf, size_t size,
3618
+ upb_arena *arena) {
3619
+ google_protobuf_UninterpretedOption_NamePart *ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
3620
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msginit, arena)) ? ret : NULL;
3621
+ }
3622
+ UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_parse_ex(const char *buf, size_t size,
3623
+ upb_arena *arena, int options) {
3624
+ google_protobuf_UninterpretedOption_NamePart *ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
3625
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msginit, arena, options))
3626
+ ? ret : NULL;
3627
+ }
3628
+ UPB_INLINE char *google_protobuf_UninterpretedOption_NamePart_serialize(const google_protobuf_UninterpretedOption_NamePart *msg, upb_arena *arena, size_t *len) {
3629
+ return upb_encode(msg, &google_protobuf_UninterpretedOption_NamePart_msginit, arena, len);
3630
+ }
3631
+
3632
+ UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_name_part(const google_protobuf_UninterpretedOption_NamePart *msg) { return _upb_hasbit(msg, 1); }
3633
+ UPB_INLINE upb_strview google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
3634
+ UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg) { return _upb_hasbit(msg, 2); }
3635
+ UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool); }
3636
+
3637
+ UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_strview value) {
3638
+ _upb_sethas(msg, 1);
3639
+ *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
3640
+ }
3641
+ UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) {
3642
+ _upb_sethas(msg, 2);
3643
+ *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool) = value;
3644
+ }
3645
+
3646
+ /* google.protobuf.SourceCodeInfo */
3647
+
3648
+ UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_new(upb_arena *arena) {
3649
+ return (google_protobuf_SourceCodeInfo *)_upb_msg_new(&google_protobuf_SourceCodeInfo_msginit, arena);
3650
+ }
3651
+ UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parse(const char *buf, size_t size,
3652
+ upb_arena *arena) {
3653
+ google_protobuf_SourceCodeInfo *ret = google_protobuf_SourceCodeInfo_new(arena);
3654
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msginit, arena)) ? ret : NULL;
3655
+ }
3656
+ UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parse_ex(const char *buf, size_t size,
3657
+ upb_arena *arena, int options) {
3658
+ google_protobuf_SourceCodeInfo *ret = google_protobuf_SourceCodeInfo_new(arena);
3659
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msginit, arena, options))
3660
+ ? ret : NULL;
3661
+ }
3662
+ UPB_INLINE char *google_protobuf_SourceCodeInfo_serialize(const google_protobuf_SourceCodeInfo *msg, upb_arena *arena, size_t *len) {
3663
+ return upb_encode(msg, &google_protobuf_SourceCodeInfo_msginit, arena, len);
3664
+ }
3665
+
3666
+ UPB_INLINE bool google_protobuf_SourceCodeInfo_has_location(const google_protobuf_SourceCodeInfo *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(0, 0)); }
3667
+ UPB_INLINE const google_protobuf_SourceCodeInfo_Location* const* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo *msg, size_t *len) { return (const google_protobuf_SourceCodeInfo_Location* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
3668
+
3669
+ UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_mutable_location(google_protobuf_SourceCodeInfo *msg, size_t *len) {
3670
+ return (google_protobuf_SourceCodeInfo_Location**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
3671
+ }
3672
+ UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_resize_location(google_protobuf_SourceCodeInfo *msg, size_t len, upb_arena *arena) {
3673
+ return (google_protobuf_SourceCodeInfo_Location**)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena);
3674
+ }
3675
+ UPB_INLINE struct google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_add_location(google_protobuf_SourceCodeInfo *msg, upb_arena *arena) {
3676
+ struct google_protobuf_SourceCodeInfo_Location* sub = (struct google_protobuf_SourceCodeInfo_Location*)_upb_msg_new(&google_protobuf_SourceCodeInfo_Location_msginit, arena);
3677
+ bool ok = _upb_array_append_accessor2(
3678
+ msg, UPB_SIZE(0, 0), UPB_SIZE(2, 3), &sub, arena);
3679
+ if (!ok) return NULL;
3680
+ return sub;
3681
+ }
3682
+
3683
+ /* google.protobuf.SourceCodeInfo.Location */
3684
+
3685
+ UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_new(upb_arena *arena) {
3686
+ return (google_protobuf_SourceCodeInfo_Location *)_upb_msg_new(&google_protobuf_SourceCodeInfo_Location_msginit, arena);
3687
+ }
3688
+ UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_parse(const char *buf, size_t size,
3689
+ upb_arena *arena) {
3690
+ google_protobuf_SourceCodeInfo_Location *ret = google_protobuf_SourceCodeInfo_Location_new(arena);
3691
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msginit, arena)) ? ret : NULL;
3692
+ }
3693
+ UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_parse_ex(const char *buf, size_t size,
3694
+ upb_arena *arena, int options) {
3695
+ google_protobuf_SourceCodeInfo_Location *ret = google_protobuf_SourceCodeInfo_Location_new(arena);
3696
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msginit, arena, options))
3697
+ ? ret : NULL;
3698
+ }
3699
+ UPB_INLINE char *google_protobuf_SourceCodeInfo_Location_serialize(const google_protobuf_SourceCodeInfo_Location *msg, upb_arena *arena, size_t *len) {
3700
+ return upb_encode(msg, &google_protobuf_SourceCodeInfo_Location_msginit, arena, len);
3701
+ }
3702
+
3703
+ UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); }
3704
+ UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
3705
+ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return _upb_hasbit(msg, 1); }
3706
+ UPB_INLINE upb_strview google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
3707
+ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return _upb_hasbit(msg, 2); }
3708
+ UPB_INLINE upb_strview google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview); }
3709
+ UPB_INLINE upb_strview const* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); }
3710
+
3711
+ UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) {
3712
+ return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
3713
+ }
3714
+ UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_path(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) {
3715
+ return (int32_t*)_upb_array_resize_accessor2(msg, UPB_SIZE(20, 40), len, 2, arena);
3716
+ }
3717
+ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf_SourceCodeInfo_Location *msg, int32_t val, upb_arena *arena) {
3718
+ return _upb_array_append_accessor2(msg, UPB_SIZE(20, 40), 2, &val,
3719
+ arena);
3720
+ }
3721
+ UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) {
3722
+ return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
3723
+ }
3724
+ UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_span(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) {
3725
+ return (int32_t*)_upb_array_resize_accessor2(msg, UPB_SIZE(24, 48), len, 2, arena);
3726
+ }
3727
+ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf_SourceCodeInfo_Location *msg, int32_t val, upb_arena *arena) {
3728
+ return _upb_array_append_accessor2(msg, UPB_SIZE(24, 48), 2, &val,
3729
+ arena);
3730
+ }
3731
+ UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview value) {
3732
+ _upb_sethas(msg, 1);
3733
+ *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
3734
+ }
3735
+ UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview value) {
3736
+ _upb_sethas(msg, 2);
3737
+ *UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview) = value;
3738
+ }
3739
+ UPB_INLINE upb_strview* google_protobuf_SourceCodeInfo_Location_mutable_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) {
3740
+ return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len);
3741
+ }
3742
+ UPB_INLINE upb_strview* google_protobuf_SourceCodeInfo_Location_resize_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) {
3743
+ return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(28, 56), len, UPB_SIZE(3, 4), arena);
3744
+ }
3745
+ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview val, upb_arena *arena) {
3746
+ return _upb_array_append_accessor2(msg, UPB_SIZE(28, 56), UPB_SIZE(3, 4), &val,
3747
+ arena);
3748
+ }
3749
+
3750
+ /* google.protobuf.GeneratedCodeInfo */
3751
+
3752
+ UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_new(upb_arena *arena) {
3753
+ return (google_protobuf_GeneratedCodeInfo *)_upb_msg_new(&google_protobuf_GeneratedCodeInfo_msginit, arena);
3754
+ }
3755
+ UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_parse(const char *buf, size_t size,
3756
+ upb_arena *arena) {
3757
+ google_protobuf_GeneratedCodeInfo *ret = google_protobuf_GeneratedCodeInfo_new(arena);
3758
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msginit, arena)) ? ret : NULL;
3759
+ }
3760
+ UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_parse_ex(const char *buf, size_t size,
3761
+ upb_arena *arena, int options) {
3762
+ google_protobuf_GeneratedCodeInfo *ret = google_protobuf_GeneratedCodeInfo_new(arena);
3763
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msginit, arena, options))
3764
+ ? ret : NULL;
3765
+ }
3766
+ UPB_INLINE char *google_protobuf_GeneratedCodeInfo_serialize(const google_protobuf_GeneratedCodeInfo *msg, upb_arena *arena, size_t *len) {
3767
+ return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_msginit, arena, len);
3768
+ }
3769
+
3770
+ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_has_annotation(const google_protobuf_GeneratedCodeInfo *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(0, 0)); }
3771
+ UPB_INLINE const google_protobuf_GeneratedCodeInfo_Annotation* const* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo *msg, size_t *len) { return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
3772
+
3773
+ UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_mutable_annotation(google_protobuf_GeneratedCodeInfo *msg, size_t *len) {
3774
+ return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
3775
+ }
3776
+ UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_resize_annotation(google_protobuf_GeneratedCodeInfo *msg, size_t len, upb_arena *arena) {
3777
+ return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena);
3778
+ }
3779
+ UPB_INLINE struct google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_add_annotation(google_protobuf_GeneratedCodeInfo *msg, upb_arena *arena) {
3780
+ struct google_protobuf_GeneratedCodeInfo_Annotation* sub = (struct google_protobuf_GeneratedCodeInfo_Annotation*)_upb_msg_new(&google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena);
3781
+ bool ok = _upb_array_append_accessor2(
3782
+ msg, UPB_SIZE(0, 0), UPB_SIZE(2, 3), &sub, arena);
3783
+ if (!ok) return NULL;
3784
+ return sub;
3785
+ }
3786
+
3787
+ /* google.protobuf.GeneratedCodeInfo.Annotation */
3788
+
3789
+ UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_new(upb_arena *arena) {
3790
+ return (google_protobuf_GeneratedCodeInfo_Annotation *)_upb_msg_new(&google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena);
3791
+ }
3792
+ UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_parse(const char *buf, size_t size,
3793
+ upb_arena *arena) {
3794
+ google_protobuf_GeneratedCodeInfo_Annotation *ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
3795
+ return (ret && upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena)) ? ret : NULL;
3796
+ }
3797
+ UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_parse_ex(const char *buf, size_t size,
3798
+ upb_arena *arena, int options) {
3799
+ google_protobuf_GeneratedCodeInfo_Annotation *ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
3800
+ return (ret && _upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena, options))
3801
+ ? ret : NULL;
3802
+ }
3803
+ UPB_INLINE char *google_protobuf_GeneratedCodeInfo_Annotation_serialize(const google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_arena *arena, size_t *len) {
3804
+ return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena, len);
3805
+ }
3806
+
3807
+ UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(20, 32), len); }
3808
+ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_hasbit(msg, 1); }
3809
+ UPB_INLINE upb_strview google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 16), upb_strview); }
3810
+ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_hasbit(msg, 2); }
3811
+ UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
3812
+ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_hasbit(msg, 3); }
3813
+ UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t); }
3814
+
3815
+ UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t *len) {
3816
+ return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 32), len);
3817
+ }
3818
+ UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_resize_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t len, upb_arena *arena) {
3819
+ return (int32_t*)_upb_array_resize_accessor2(msg, UPB_SIZE(20, 32), len, 2, arena);
3820
+ }
3821
+ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t val, upb_arena *arena) {
3822
+ return _upb_array_append_accessor2(msg, UPB_SIZE(20, 32), 2, &val,
3823
+ arena);
3824
+ }
3825
+ UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_strview value) {
3826
+ _upb_sethas(msg, 1);
3827
+ *UPB_PTR_AT(msg, UPB_SIZE(12, 16), upb_strview) = value;
3828
+ }
3829
+ UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
3830
+ _upb_sethas(msg, 2);
3831
+ *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
3832
+ }
3833
+ UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
3834
+ _upb_sethas(msg, 3);
3835
+ *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value;
3836
+ }
3837
+
3838
+ #ifdef __cplusplus
3839
+ } /* extern "C" */
3840
+ #endif
3841
+
3842
+
3843
+ #endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */
3844
+
3845
+ /** upb/def.h ************************************************************/
3846
+ /*
3847
+ * Defs are upb's internal representation of the constructs that can appear
3848
+ * in a .proto file:
3849
+ *
3850
+ * - upb_msgdef: describes a "message" construct.
3851
+ * - upb_fielddef: describes a message field.
3852
+ * - upb_filedef: describes a .proto file and its defs.
3853
+ * - upb_enumdef: describes an enum.
3854
+ * - upb_oneofdef: describes a oneof.
3855
+ *
3856
+ * TODO: definitions of services.
3857
+ */
3858
+
3859
+ #ifndef UPB_DEF_H_
3860
+ #define UPB_DEF_H_
3861
+
3862
+
3863
+ /* Must be last. */
3864
+
3865
+ #ifdef __cplusplus
3866
+ extern "C" {
3867
+ #endif /* __cplusplus */
3868
+
3869
+ struct upb_enumdef;
3870
+ typedef struct upb_enumdef upb_enumdef;
3871
+ struct upb_fielddef;
3872
+ typedef struct upb_fielddef upb_fielddef;
3873
+ struct upb_filedef;
3874
+ typedef struct upb_filedef upb_filedef;
3875
+ struct upb_msgdef;
3876
+ typedef struct upb_msgdef upb_msgdef;
3877
+ struct upb_oneofdef;
3878
+ typedef struct upb_oneofdef upb_oneofdef;
3879
+ struct upb_symtab;
3880
+ typedef struct upb_symtab upb_symtab;
3881
+
3882
+ typedef enum {
3883
+ UPB_SYNTAX_PROTO2 = 2,
3884
+ UPB_SYNTAX_PROTO3 = 3
3885
+ } upb_syntax_t;
3886
+
3887
+ /* All the different kind of well known type messages. For simplicity of check,
3888
+ * number wrappers and string wrappers are grouped together. Make sure the
3889
+ * order and merber of these groups are not changed.
3890
+ */
3891
+ typedef enum {
3892
+ UPB_WELLKNOWN_UNSPECIFIED,
3893
+ UPB_WELLKNOWN_ANY,
3894
+ UPB_WELLKNOWN_FIELDMASK,
3895
+ UPB_WELLKNOWN_DURATION,
3896
+ UPB_WELLKNOWN_TIMESTAMP,
3897
+ /* number wrappers */
3898
+ UPB_WELLKNOWN_DOUBLEVALUE,
3899
+ UPB_WELLKNOWN_FLOATVALUE,
3900
+ UPB_WELLKNOWN_INT64VALUE,
3901
+ UPB_WELLKNOWN_UINT64VALUE,
3902
+ UPB_WELLKNOWN_INT32VALUE,
3903
+ UPB_WELLKNOWN_UINT32VALUE,
3904
+ /* string wrappers */
3905
+ UPB_WELLKNOWN_STRINGVALUE,
3906
+ UPB_WELLKNOWN_BYTESVALUE,
3907
+ UPB_WELLKNOWN_BOOLVALUE,
3908
+ UPB_WELLKNOWN_VALUE,
3909
+ UPB_WELLKNOWN_LISTVALUE,
3910
+ UPB_WELLKNOWN_STRUCT
3911
+ } upb_wellknowntype_t;
3912
+
3913
+ /* upb_fielddef ***************************************************************/
3914
+
3915
+ /* Maximum field number allowed for FieldDefs. This is an inherent limit of the
3916
+ * protobuf wire format. */
3917
+ #define UPB_MAX_FIELDNUMBER ((1 << 29) - 1)
3918
+
3919
+ const char *upb_fielddef_fullname(const upb_fielddef *f);
3920
+ upb_fieldtype_t upb_fielddef_type(const upb_fielddef *f);
3921
+ upb_descriptortype_t upb_fielddef_descriptortype(const upb_fielddef *f);
3922
+ upb_label_t upb_fielddef_label(const upb_fielddef *f);
3923
+ uint32_t upb_fielddef_number(const upb_fielddef *f);
3924
+ const char *upb_fielddef_name(const upb_fielddef *f);
3925
+ const char *upb_fielddef_jsonname(const upb_fielddef *f);
3926
+ bool upb_fielddef_isextension(const upb_fielddef *f);
3927
+ bool upb_fielddef_lazy(const upb_fielddef *f);
3928
+ bool upb_fielddef_packed(const upb_fielddef *f);
3929
+ const upb_filedef *upb_fielddef_file(const upb_fielddef *f);
3930
+ const upb_msgdef *upb_fielddef_containingtype(const upb_fielddef *f);
3931
+ const upb_oneofdef *upb_fielddef_containingoneof(const upb_fielddef *f);
3932
+ const upb_oneofdef *upb_fielddef_realcontainingoneof(const upb_fielddef *f);
3933
+ uint32_t upb_fielddef_index(const upb_fielddef *f);
3934
+ bool upb_fielddef_issubmsg(const upb_fielddef *f);
3935
+ bool upb_fielddef_isstring(const upb_fielddef *f);
3936
+ bool upb_fielddef_isseq(const upb_fielddef *f);
3937
+ bool upb_fielddef_isprimitive(const upb_fielddef *f);
3938
+ bool upb_fielddef_ismap(const upb_fielddef *f);
3939
+ int64_t upb_fielddef_defaultint64(const upb_fielddef *f);
3940
+ int32_t upb_fielddef_defaultint32(const upb_fielddef *f);
3941
+ uint64_t upb_fielddef_defaultuint64(const upb_fielddef *f);
3942
+ uint32_t upb_fielddef_defaultuint32(const upb_fielddef *f);
3943
+ bool upb_fielddef_defaultbool(const upb_fielddef *f);
3944
+ float upb_fielddef_defaultfloat(const upb_fielddef *f);
3945
+ double upb_fielddef_defaultdouble(const upb_fielddef *f);
3946
+ const char *upb_fielddef_defaultstr(const upb_fielddef *f, size_t *len);
3947
+ bool upb_fielddef_hassubdef(const upb_fielddef *f);
3948
+ bool upb_fielddef_haspresence(const upb_fielddef *f);
3949
+ const upb_msgdef *upb_fielddef_msgsubdef(const upb_fielddef *f);
3950
+ const upb_enumdef *upb_fielddef_enumsubdef(const upb_fielddef *f);
3951
+ const upb_msglayout_field *upb_fielddef_layout(const upb_fielddef *f);
3952
+
3953
+ /* upb_oneofdef ***************************************************************/
3954
+
3955
+ typedef upb_inttable_iter upb_oneof_iter;
3956
+
3957
+ const char *upb_oneofdef_name(const upb_oneofdef *o);
3958
+ const upb_msgdef *upb_oneofdef_containingtype(const upb_oneofdef *o);
3959
+ uint32_t upb_oneofdef_index(const upb_oneofdef *o);
3960
+ bool upb_oneofdef_issynthetic(const upb_oneofdef *o);
3961
+ int upb_oneofdef_fieldcount(const upb_oneofdef *o);
3962
+ const upb_fielddef *upb_oneofdef_field(const upb_oneofdef *o, int i);
3963
+
3964
+ /* Oneof lookups:
3965
+ * - ntof: look up a field by name.
3966
+ * - ntofz: look up a field by name (as a null-terminated string).
3967
+ * - itof: look up a field by number. */
3968
+ const upb_fielddef *upb_oneofdef_ntof(const upb_oneofdef *o,
3969
+ const char *name, size_t length);
3970
+ UPB_INLINE const upb_fielddef *upb_oneofdef_ntofz(const upb_oneofdef *o,
3971
+ const char *name) {
3972
+ return upb_oneofdef_ntof(o, name, strlen(name));
3973
+ }
3974
+ const upb_fielddef *upb_oneofdef_itof(const upb_oneofdef *o, uint32_t num);
3975
+
3976
+ /* DEPRECATED, slated for removal. */
3977
+ int upb_oneofdef_numfields(const upb_oneofdef *o);
3978
+ void upb_oneof_begin(upb_oneof_iter *iter, const upb_oneofdef *o);
3979
+ void upb_oneof_next(upb_oneof_iter *iter);
3980
+ bool upb_oneof_done(upb_oneof_iter *iter);
3981
+ upb_fielddef *upb_oneof_iter_field(const upb_oneof_iter *iter);
3982
+ void upb_oneof_iter_setdone(upb_oneof_iter *iter);
3983
+ bool upb_oneof_iter_isequal(const upb_oneof_iter *iter1,
3984
+ const upb_oneof_iter *iter2);
3985
+ /* END DEPRECATED */
3986
+
3987
+ /* upb_msgdef *****************************************************************/
3988
+
3989
+ typedef upb_inttable_iter upb_msg_field_iter;
3990
+ typedef upb_strtable_iter upb_msg_oneof_iter;
3991
+
3992
+ /* Well-known field tag numbers for map-entry messages. */
3993
+ #define UPB_MAPENTRY_KEY 1
3994
+ #define UPB_MAPENTRY_VALUE 2
3995
+
3996
+ /* Well-known field tag numbers for Any messages. */
3997
+ #define UPB_ANY_TYPE 1
3998
+ #define UPB_ANY_VALUE 2
3999
+
4000
+ /* Well-known field tag numbers for timestamp messages. */
4001
+ #define UPB_DURATION_SECONDS 1
4002
+ #define UPB_DURATION_NANOS 2
4003
+
4004
+ /* Well-known field tag numbers for duration messages. */
4005
+ #define UPB_TIMESTAMP_SECONDS 1
4006
+ #define UPB_TIMESTAMP_NANOS 2
4007
+
4008
+ const char *upb_msgdef_fullname(const upb_msgdef *m);
4009
+ const upb_filedef *upb_msgdef_file(const upb_msgdef *m);
4010
+ const char *upb_msgdef_name(const upb_msgdef *m);
4011
+ upb_syntax_t upb_msgdef_syntax(const upb_msgdef *m);
4012
+ bool upb_msgdef_mapentry(const upb_msgdef *m);
4013
+ upb_wellknowntype_t upb_msgdef_wellknowntype(const upb_msgdef *m);
4014
+ bool upb_msgdef_iswrapper(const upb_msgdef *m);
4015
+ bool upb_msgdef_isnumberwrapper(const upb_msgdef *m);
4016
+ int upb_msgdef_fieldcount(const upb_msgdef *m);
4017
+ int upb_msgdef_oneofcount(const upb_msgdef *m);
4018
+ const upb_fielddef *upb_msgdef_field(const upb_msgdef *m, int i);
4019
+ const upb_oneofdef *upb_msgdef_oneof(const upb_msgdef *m, int i);
4020
+ const upb_fielddef *upb_msgdef_itof(const upb_msgdef *m, uint32_t i);
4021
+ const upb_fielddef *upb_msgdef_ntof(const upb_msgdef *m, const char *name,
4022
+ size_t len);
4023
+ const upb_oneofdef *upb_msgdef_ntoo(const upb_msgdef *m, const char *name,
4024
+ size_t len);
4025
+ const upb_msglayout *upb_msgdef_layout(const upb_msgdef *m);
4026
+
4027
+ UPB_INLINE const upb_oneofdef *upb_msgdef_ntooz(const upb_msgdef *m,
4028
+ const char *name) {
4029
+ return upb_msgdef_ntoo(m, name, strlen(name));
4030
+ }
4031
+
4032
+ UPB_INLINE const upb_fielddef *upb_msgdef_ntofz(const upb_msgdef *m,
4033
+ const char *name) {
4034
+ return upb_msgdef_ntof(m, name, strlen(name));
4035
+ }
4036
+
4037
+ /* Lookup of either field or oneof by name. Returns whether either was found.
4038
+ * If the return is true, then the found def will be set, and the non-found
4039
+ * one set to NULL. */
4040
+ bool upb_msgdef_lookupname(const upb_msgdef *m, const char *name, size_t len,
4041
+ const upb_fielddef **f, const upb_oneofdef **o);
4042
+
4043
+ UPB_INLINE bool upb_msgdef_lookupnamez(const upb_msgdef *m, const char *name,
4044
+ const upb_fielddef **f,
4045
+ const upb_oneofdef **o) {
4046
+ return upb_msgdef_lookupname(m, name, strlen(name), f, o);
4047
+ }
4048
+
4049
+ /* Returns a field by either JSON name or regular proto name. */
4050
+ const upb_fielddef *upb_msgdef_lookupjsonname(const upb_msgdef *m,
4051
+ const char *name, size_t len);
4052
+
4053
+ /* DEPRECATED, slated for removal */
4054
+ int upb_msgdef_numfields(const upb_msgdef *m);
4055
+ int upb_msgdef_numoneofs(const upb_msgdef *m);
4056
+ int upb_msgdef_numrealoneofs(const upb_msgdef *m);
4057
+ void upb_msg_field_begin(upb_msg_field_iter *iter, const upb_msgdef *m);
4058
+ void upb_msg_field_next(upb_msg_field_iter *iter);
4059
+ bool upb_msg_field_done(const upb_msg_field_iter *iter);
4060
+ upb_fielddef *upb_msg_iter_field(const upb_msg_field_iter *iter);
4061
+ void upb_msg_field_iter_setdone(upb_msg_field_iter *iter);
4062
+ bool upb_msg_field_iter_isequal(const upb_msg_field_iter * iter1,
4063
+ const upb_msg_field_iter * iter2);
4064
+ void upb_msg_oneof_begin(upb_msg_oneof_iter * iter, const upb_msgdef *m);
4065
+ void upb_msg_oneof_next(upb_msg_oneof_iter * iter);
4066
+ bool upb_msg_oneof_done(const upb_msg_oneof_iter *iter);
4067
+ const upb_oneofdef *upb_msg_iter_oneof(const upb_msg_oneof_iter *iter);
4068
+ void upb_msg_oneof_iter_setdone(upb_msg_oneof_iter * iter);
4069
+ bool upb_msg_oneof_iter_isequal(const upb_msg_oneof_iter *iter1,
4070
+ const upb_msg_oneof_iter *iter2);
4071
+ /* END DEPRECATED */
4072
+
4073
+ /* upb_enumdef ****************************************************************/
4074
+
4075
+ typedef upb_strtable_iter upb_enum_iter;
4076
+
4077
+ const char *upb_enumdef_fullname(const upb_enumdef *e);
4078
+ const char *upb_enumdef_name(const upb_enumdef *e);
4079
+ const upb_filedef *upb_enumdef_file(const upb_enumdef *e);
4080
+ int32_t upb_enumdef_default(const upb_enumdef *e);
4081
+ int upb_enumdef_numvals(const upb_enumdef *e);
4082
+
4083
+ /* Enum lookups:
4084
+ * - ntoi: look up a name with specified length.
4085
+ * - ntoiz: look up a name provided as a null-terminated string.
4086
+ * - iton: look up an integer, returning the name as a null-terminated
4087
+ * string. */
4088
+ bool upb_enumdef_ntoi(const upb_enumdef *e, const char *name, size_t len,
4089
+ int32_t *num);
4090
+ UPB_INLINE bool upb_enumdef_ntoiz(const upb_enumdef *e,
4091
+ const char *name, int32_t *num) {
4092
+ return upb_enumdef_ntoi(e, name, strlen(name), num);
4093
+ }
4094
+ const char *upb_enumdef_iton(const upb_enumdef *e, int32_t num);
4095
+
4096
+ void upb_enum_begin(upb_enum_iter *iter, const upb_enumdef *e);
4097
+ void upb_enum_next(upb_enum_iter *iter);
4098
+ bool upb_enum_done(upb_enum_iter *iter);
4099
+ const char *upb_enum_iter_name(upb_enum_iter *iter);
4100
+ int32_t upb_enum_iter_number(upb_enum_iter *iter);
4101
+
4102
+ /* upb_filedef ****************************************************************/
4103
+
4104
+ const char *upb_filedef_name(const upb_filedef *f);
4105
+ const char *upb_filedef_package(const upb_filedef *f);
4106
+ const char *upb_filedef_phpprefix(const upb_filedef *f);
4107
+ const char *upb_filedef_phpnamespace(const upb_filedef *f);
4108
+ upb_syntax_t upb_filedef_syntax(const upb_filedef *f);
4109
+ int upb_filedef_depcount(const upb_filedef *f);
4110
+ int upb_filedef_msgcount(const upb_filedef *f);
4111
+ int upb_filedef_enumcount(const upb_filedef *f);
4112
+ const upb_filedef *upb_filedef_dep(const upb_filedef *f, int i);
4113
+ const upb_msgdef *upb_filedef_msg(const upb_filedef *f, int i);
4114
+ const upb_enumdef *upb_filedef_enum(const upb_filedef *f, int i);
4115
+ const upb_symtab *upb_filedef_symtab(const upb_filedef *f);
4116
+
4117
+ /* upb_symtab *****************************************************************/
4118
+
4119
+ upb_symtab *upb_symtab_new(void);
4120
+ void upb_symtab_free(upb_symtab* s);
4121
+ const upb_msgdef *upb_symtab_lookupmsg(const upb_symtab *s, const char *sym);
4122
+ const upb_msgdef *upb_symtab_lookupmsg2(
4123
+ const upb_symtab *s, const char *sym, size_t len);
4124
+ const upb_enumdef *upb_symtab_lookupenum(const upb_symtab *s, const char *sym);
4125
+ const upb_filedef *upb_symtab_lookupfile(const upb_symtab *s, const char *name);
4126
+ const upb_filedef *upb_symtab_lookupfile2(
4127
+ const upb_symtab *s, const char *name, size_t len);
4128
+ int upb_symtab_filecount(const upb_symtab *s);
4129
+ const upb_filedef *upb_symtab_addfile(
4130
+ upb_symtab *s, const google_protobuf_FileDescriptorProto *file,
4131
+ upb_status *status);
4132
+ size_t _upb_symtab_bytesloaded(const upb_symtab *s);
4133
+ upb_arena *_upb_symtab_arena(const upb_symtab *s);
4134
+
4135
+ /* For generated code only: loads a generated descriptor. */
4136
+ typedef struct upb_def_init {
4137
+ struct upb_def_init **deps; /* Dependencies of this file. */
4138
+ const upb_msglayout **layouts; /* Pre-order layouts of all messages. */
4139
+ const char *filename;
4140
+ upb_strview descriptor; /* Serialized descriptor. */
4141
+ } upb_def_init;
4142
+
4143
+ bool _upb_symtab_loaddefinit(upb_symtab *s, const upb_def_init *init);
4144
+
4145
+
4146
+ #ifdef __cplusplus
4147
+ } /* extern "C" */
4148
+ #endif /* __cplusplus */
4149
+
4150
+ #endif /* UPB_DEF_H_ */
4151
+
4152
+ /** upb/reflection.h ************************************************************/
4153
+ #ifndef UPB_REFLECTION_H_
4154
+ #define UPB_REFLECTION_H_
4155
+
4156
+
4157
+
4158
+ #ifdef __cplusplus
4159
+ extern "C" {
4160
+ #endif
4161
+
4162
+ typedef union {
4163
+ bool bool_val;
4164
+ float float_val;
4165
+ double double_val;
4166
+ int32_t int32_val;
4167
+ int64_t int64_val;
4168
+ uint32_t uint32_val;
4169
+ uint64_t uint64_val;
4170
+ const upb_map* map_val;
4171
+ const upb_msg* msg_val;
4172
+ const upb_array* array_val;
4173
+ upb_strview str_val;
4174
+ } upb_msgval;
4175
+
4176
+ typedef union {
4177
+ upb_map* map;
4178
+ upb_msg* msg;
4179
+ upb_array* array;
4180
+ } upb_mutmsgval;
4181
+
4182
+ upb_msgval upb_fielddef_default(const upb_fielddef *f);
4183
+
4184
+ /** upb_msg *******************************************************************/
4185
+
4186
+ /* Creates a new message of the given type in the given arena. */
4187
+ upb_msg *upb_msg_new(const upb_msgdef *m, upb_arena *a);
4188
+
4189
+ /* Returns the value associated with this field. */
4190
+ upb_msgval upb_msg_get(const upb_msg *msg, const upb_fielddef *f);
4191
+
4192
+ /* Returns a mutable pointer to a map, array, or submessage value. If the given
4193
+ * arena is non-NULL this will construct a new object if it was not previously
4194
+ * present. May not be called for primitive fields. */
4195
+ upb_mutmsgval upb_msg_mutable(upb_msg *msg, const upb_fielddef *f, upb_arena *a);
4196
+
4197
+ /* May only be called for fields where upb_fielddef_haspresence(f) == true. */
4198
+ bool upb_msg_has(const upb_msg *msg, const upb_fielddef *f);
4199
+
4200
+ /* Returns the field that is set in the oneof, or NULL if none are set. */
4201
+ const upb_fielddef *upb_msg_whichoneof(const upb_msg *msg,
4202
+ const upb_oneofdef *o);
4203
+
4204
+ /* Sets the given field to the given value. For a msg/array/map/string, the
4205
+ * value must be in the same arena. */
4206
+ void upb_msg_set(upb_msg *msg, const upb_fielddef *f, upb_msgval val,
4207
+ upb_arena *a);
4208
+
4209
+ /* Clears any field presence and sets the value back to its default. */
4210
+ void upb_msg_clearfield(upb_msg *msg, const upb_fielddef *f);
4211
+
4212
+ /* Clear all data and unknown fields. */
4213
+ void upb_msg_clear(upb_msg *msg, const upb_msgdef *m);
4214
+
4215
+ /* Iterate over present fields.
4216
+ *
4217
+ * size_t iter = UPB_MSG_BEGIN;
4218
+ * const upb_fielddef *f;
4219
+ * upb_msgval val;
4220
+ * while (upb_msg_next(msg, m, ext_pool, &f, &val, &iter)) {
4221
+ * process_field(f, val);
4222
+ * }
4223
+ *
4224
+ * If ext_pool is NULL, no extensions will be returned. If the given symtab
4225
+ * returns extensions that don't match what is in this message, those extensions
4226
+ * will be skipped.
4227
+ */
4228
+
4229
+ #define UPB_MSG_BEGIN -1
4230
+ bool upb_msg_next(const upb_msg *msg, const upb_msgdef *m,
4231
+ const upb_symtab *ext_pool, const upb_fielddef **f,
4232
+ upb_msgval *val, size_t *iter);
4233
+
4234
+ /* Clears all unknown field data from this message and all submessages. */
4235
+ bool upb_msg_discardunknown(upb_msg *msg, const upb_msgdef *m, int maxdepth);
4236
+
4237
+ /** upb_array *****************************************************************/
4238
+
4239
+ /* Creates a new array on the given arena that holds elements of this type. */
4240
+ upb_array *upb_array_new(upb_arena *a, upb_fieldtype_t type);
4241
+
4242
+ /* Returns the size of the array. */
4243
+ size_t upb_array_size(const upb_array *arr);
4244
+
4245
+ /* Returns the given element, which must be within the array's current size. */
4246
+ upb_msgval upb_array_get(const upb_array *arr, size_t i);
4247
+
4248
+ /* Sets the given element, which must be within the array's current size. */
4249
+ void upb_array_set(upb_array *arr, size_t i, upb_msgval val);
4250
+
4251
+ /* Appends an element to the array. Returns false on allocation failure. */
4252
+ bool upb_array_append(upb_array *array, upb_msgval val, upb_arena *arena);
4253
+
4254
+ /* Changes the size of a vector. New elements are initialized to empty/0.
4255
+ * Returns false on allocation failure. */
4256
+ bool upb_array_resize(upb_array *array, size_t size, upb_arena *arena);
4257
+
4258
+ /** upb_map *******************************************************************/
4259
+
4260
+ /* Creates a new map on the given arena with the given key/value size. */
4261
+ upb_map *upb_map_new(upb_arena *a, upb_fieldtype_t key_type,
4262
+ upb_fieldtype_t value_type);
4263
+
4264
+ /* Returns the number of entries in the map. */
4265
+ size_t upb_map_size(const upb_map *map);
4266
+
4267
+ /* Stores a value for the given key into |*val| (or the zero value if the key is
4268
+ * not present). Returns whether the key was present. The |val| pointer may be
4269
+ * NULL, in which case the function tests whether the given key is present. */
4270
+ bool upb_map_get(const upb_map *map, upb_msgval key, upb_msgval *val);
4271
+
4272
+ /* Removes all entries in the map. */
4273
+ void upb_map_clear(upb_map *map);
4274
+
4275
+ /* Sets the given key to the given value. Returns true if this was a new key in
4276
+ * the map, or false if an existing key was replaced. */
4277
+ bool upb_map_set(upb_map *map, upb_msgval key, upb_msgval val,
4278
+ upb_arena *arena);
4279
+
4280
+ /* Deletes this key from the table. Returns true if the key was present. */
4281
+ bool upb_map_delete(upb_map *map, upb_msgval key);
4282
+
4283
+ /* Map iteration:
4284
+ *
4285
+ * size_t iter = UPB_MAP_BEGIN;
4286
+ * while (upb_mapiter_next(map, &iter)) {
4287
+ * upb_msgval key = upb_mapiter_key(map, iter);
4288
+ * upb_msgval val = upb_mapiter_value(map, iter);
4289
+ *
4290
+ * // If mutating is desired.
4291
+ * upb_mapiter_setvalue(map, iter, value2);
4292
+ * }
4293
+ */
4294
+
4295
+ /* Advances to the next entry. Returns false if no more entries are present. */
4296
+ bool upb_mapiter_next(const upb_map *map, size_t *iter);
4297
+
4298
+ /* Returns true if the iterator still points to a valid entry, or false if the
4299
+ * iterator is past the last element. It is an error to call this function with
4300
+ * UPB_MAP_BEGIN (you must call next() at least once first). */
4301
+ bool upb_mapiter_done(const upb_map *map, size_t iter);
4302
+
4303
+ /* Returns the key and value for this entry of the map. */
4304
+ upb_msgval upb_mapiter_key(const upb_map *map, size_t iter);
4305
+ upb_msgval upb_mapiter_value(const upb_map *map, size_t iter);
4306
+
4307
+ /* Sets the value for this entry. The iterator must not be done, and the
4308
+ * iterator must not have been initialized const. */
4309
+ void upb_mapiter_setvalue(upb_map *map, size_t iter, upb_msgval value);
4310
+
4311
+ #ifdef __cplusplus
4312
+ } /* extern "C" */
4313
+ #endif
4314
+
4315
+
4316
+ #endif /* UPB_REFLECTION_H_ */
4317
+
4318
+ /** upb/json_decode.h ************************************************************/
4319
+ #ifndef UPB_JSONDECODE_H_
4320
+ #define UPB_JSONDECODE_H_
4321
+
4322
+
4323
+ #ifdef __cplusplus
4324
+ extern "C" {
4325
+ #endif
4326
+
4327
+ enum {
4328
+ UPB_JSONDEC_IGNOREUNKNOWN = 1
4329
+ };
4330
+
4331
+ bool upb_json_decode(const char *buf, size_t size, upb_msg *msg,
4332
+ const upb_msgdef *m, const upb_symtab *any_pool,
4333
+ int options, upb_arena *arena, upb_status *status);
4334
+
4335
+ #ifdef __cplusplus
4336
+ } /* extern "C" */
4337
+ #endif
4338
+
4339
+ #endif /* UPB_JSONDECODE_H_ */
4340
+
4341
+ /** upb/json_encode.h ************************************************************/
4342
+ #ifndef UPB_JSONENCODE_H_
4343
+ #define UPB_JSONENCODE_H_
4344
+
4345
+
4346
+ #ifdef __cplusplus
4347
+ extern "C" {
4348
+ #endif
4349
+
4350
+ enum {
4351
+ /* When set, emits 0/default values. TODO(haberman): proto3 only? */
4352
+ UPB_JSONENC_EMITDEFAULTS = 1,
4353
+
4354
+ /* When set, use normal (snake_caes) field names instead of JSON (camelCase)
4355
+ names. */
4356
+ UPB_JSONENC_PROTONAMES = 2
4357
+ };
4358
+
4359
+ /* Encodes the given |msg| to JSON format. The message's reflection is given in
4360
+ * |m|. The symtab in |symtab| is used to find extensions (if NULL, extensions
4361
+ * will not be printed).
4362
+ *
4363
+ * Output is placed in the given buffer, and always NULL-terminated. The output
4364
+ * size (excluding NULL) is returned. This means that a return value >= |size|
4365
+ * implies that the output was truncated. (These are the same semantics as
4366
+ * snprintf()). */
4367
+ size_t upb_json_encode(const upb_msg *msg, const upb_msgdef *m,
4368
+ const upb_symtab *ext_pool, int options, char *buf,
4369
+ size_t size, upb_status *status);
4370
+
4371
+ #ifdef __cplusplus
4372
+ } /* extern "C" */
4373
+ #endif
4374
+
4375
+ #endif /* UPB_JSONENCODE_H_ */
4376
+
4377
+ /** upb/port_undef.inc ************************************************************/
4378
+ /* See port_def.inc. This should #undef all macros #defined there. */
4379
+
4380
+ #undef UPB_SIZE
4381
+ #undef UPB_PTR_AT
4382
+ #undef UPB_READ_ONEOF
4383
+ #undef UPB_WRITE_ONEOF
4384
+ #undef UPB_MAPTYPE_STRING
4385
+ #undef UPB_INLINE
4386
+ #undef UPB_ALIGN_UP
4387
+ #undef UPB_ALIGN_DOWN
4388
+ #undef UPB_ALIGN_MALLOC
4389
+ #undef UPB_ALIGN_OF
4390
+ #undef UPB_LIKELY
4391
+ #undef UPB_UNLIKELY
4392
+ #undef UPB_FORCEINLINE
4393
+ #undef UPB_NOINLINE
4394
+ #undef UPB_NORETURN
4395
+ #undef UPB_PRINTF
4396
+ #undef UPB_MAX
4397
+ #undef UPB_MIN
4398
+ #undef UPB_UNUSED
4399
+ #undef UPB_ASSUME
4400
+ #undef UPB_ASSERT
4401
+ #undef UPB_UNREACHABLE
4402
+ #undef UPB_SETJMP
4403
+ #undef UPB_LONGJMP
4404
+ #undef UPB_PTRADD
4405
+ #undef UPB_MUSTTAIL
4406
+ #undef UPB_FASTTABLE_SUPPORTED
4407
+ #undef UPB_FASTTABLE
4408
+ #undef UPB_FASTTABLE_INIT
4409
+ #undef UPB_POISON_MEMORY_REGION
4410
+ #undef UPB_UNPOISON_MEMORY_REGION
4411
+ #undef UPB_ASAN