1 /* Amalgamated source file */
2 #include <stdint.h>/*
3 * This is where we define macros used across upb.
4 *
5 * All of these macros are undef'd in port_undef.inc to avoid leaking them to
6 * users.
7 *
8 * The correct usage is:
9 *
10 * #include "upb/foobar.h"
11 * #include "upb/baz.h"
12 *
13 * // MUST be last included header.
14 * #include "upb/port_def.inc"
15 *
16 * // Code for this file.
17 * // <...>
18 *
19 * // Can be omitted for .c files, required for .h.
20 * #include "upb/port_undef.inc"
21 *
22 * This file is private and must not be included by users!
23 */
24
25 #if !(__STDC_VERSION__ >= 199901L || __cplusplus >= 201103L)
26 #error upb requires C99 or C++11
27 #endif
28
29 #if (defined(_MSC_VER) && _MSC_VER < 1900)
30 #error upb requires MSVC >= 2015.
31 #endif
32
33 #include <stdint.h>
34 #include <stddef.h>
35
36 #if UINTPTR_MAX == 0xffffffff
37 #define UPB_SIZE(size32, size64) size32
38 #else
39 #define UPB_SIZE(size32, size64) size64
40 #endif
41
42 /* If we always read/write as a consistent type to each address, this shouldn't
43 * violate aliasing.
44 */
45 #define UPB_PTR_AT(msg, ofs, type) ((type*)((char*)(msg) + (ofs)))
46
47 #define UPB_READ_ONEOF(msg, fieldtype, offset, case_offset, case_val, default) \
48 *UPB_PTR_AT(msg, case_offset, int) == case_val \
49 ? *UPB_PTR_AT(msg, offset, fieldtype) \
50 : default
51
52 #define UPB_WRITE_ONEOF(msg, fieldtype, offset, value, case_offset, case_val) \
53 *UPB_PTR_AT(msg, case_offset, int) = case_val; \
54 *UPB_PTR_AT(msg, offset, fieldtype) = value;
55
56 #define UPB_MAPTYPE_STRING 0
57
58 /* UPB_INLINE: inline if possible, emit standalone code if required. */
59 #ifdef __cplusplus
60 #define UPB_INLINE inline
61 #elif defined (__GNUC__) || defined(__clang__)
62 #define UPB_INLINE static __inline__
63 #else
64 #define UPB_INLINE static
65 #endif
66
67 #define UPB_ALIGN_UP(size, align) (((size) + (align) - 1) / (align) * (align))
68 #define UPB_ALIGN_DOWN(size, align) ((size) / (align) * (align))
69 #define UPB_ALIGN_MALLOC(size) UPB_ALIGN_UP(size, 16)
70 #define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member)
71
72 /* Hints to the compiler about likely/unlikely branches. */
73 #if defined (__GNUC__) || defined(__clang__)
74 #define UPB_LIKELY(x) __builtin_expect((x),1)
75 #define UPB_UNLIKELY(x) __builtin_expect((x),0)
76 #else
77 #define UPB_LIKELY(x) (x)
78 #define UPB_UNLIKELY(x) (x)
79 #endif
80
81 /* Macros for function attributes on compilers that support them. */
82 #ifdef __GNUC__
83 #define UPB_FORCEINLINE __inline__ __attribute__((always_inline))
84 #define UPB_NOINLINE __attribute__((noinline))
85 #define UPB_NORETURN __attribute__((__noreturn__))
86 #elif defined(_MSC_VER)
87 #define UPB_NOINLINE
88 #define UPB_FORCEINLINE
89 #define UPB_NORETURN __declspec(noreturn)
90 #else /* !defined(__GNUC__) */
91 #define UPB_FORCEINLINE
92 #define UPB_NOINLINE
93 #define UPB_NORETURN
94 #endif
95
96 #define UPB_MAX(x, y) ((x) > (y) ? (x) : (y))
97 #define UPB_MIN(x, y) ((x) < (y) ? (x) : (y))
98
99 #define UPB_UNUSED(var) (void)var
100
101 /* UPB_ASSUME(): in release mode, we tell the compiler to assume this is true.
102 */
103 #ifdef NDEBUG
104 #ifdef __GNUC__
105 #define UPB_ASSUME(expr) if (!(expr)) __builtin_unreachable()
106 #elif defined _MSC_VER
107 #define UPB_ASSUME(expr) if (!(expr)) __assume(0)
108 #else
109 #define UPB_ASSUME(expr) do {} while (false && (expr))
110 #endif
111 #else
112 #define UPB_ASSUME(expr) assert(expr)
113 #endif
114
115 /* UPB_ASSERT(): in release mode, we use the expression without letting it be
116 * evaluated. This prevents "unused variable" warnings. */
117 #ifdef NDEBUG
118 #define UPB_ASSERT(expr) do {} while (false && (expr))
119 #else
120 #define UPB_ASSERT(expr) assert(expr)
121 #endif
122
123 #if defined(__GNUC__) || defined(__clang__)
124 #define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0)
125 #else
126 #define UPB_UNREACHABLE() do { assert(0); } while(0)
127 #endif
128
129 #if defined(__SANITIZE_ADDRESS__)
130 #define UPB_ASAN 1
131 #ifdef __cplusplus
132 extern "C" {
133 #endif
134 void __asan_poison_memory_region(void const volatile *addr, size_t size);
135 void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
136 #ifdef __cplusplus
137 } /* extern "C" */
138 #endif
139 #define UPB_POISON_MEMORY_REGION(addr, size) \
140 __asan_poison_memory_region((addr), (size))
141 #define UPB_UNPOISON_MEMORY_REGION(addr, size) \
142 __asan_unpoison_memory_region((addr), (size))
143 #else
144 #define UPB_ASAN 0
145 #define UPB_POISON_MEMORY_REGION(addr, size) \
146 ((void)(addr), (void)(size))
147 #define UPB_UNPOISON_MEMORY_REGION(addr, size) \
148 ((void)(addr), (void)(size))
149 #endif
150 /*
151 ** upb_decode: parsing into a upb_msg using a upb_msglayout.
152 */
153
154 #ifndef UPB_DECODE_H_
155 #define UPB_DECODE_H_
156
157 /*
158 ** Our memory representation for parsing tables and messages themselves.
159 ** Functions in this file are used by generated code and possibly reflection.
160 **
161 ** The definitions in this file are internal to upb.
162 **/
163
164 #ifndef UPB_MSG_H_
165 #define UPB_MSG_H_
166
167 #include <stdint.h>
168 #include <string.h>
169
170 /*
171 ** upb_table
172 **
173 ** This header is INTERNAL-ONLY! Its interfaces are not public or stable!
174 ** This file defines very fast int->upb_value (inttable) and string->upb_value
175 ** (strtable) hash tables.
176 **
177 ** The table uses chained scatter with Brent's variation (inspired by the Lua
178 ** implementation of hash tables). The hash function for strings is Austin
179 ** Appleby's "MurmurHash."
180 **
181 ** The inttable uses uintptr_t as its key, which guarantees it can be used to
182 ** store pointers or integers of at least 32 bits (upb isn't really useful on
183 ** systems where sizeof(void*) < 4).
184 **
185 ** The table must be homogeneous (all values of the same type). In debug
186 ** mode, we check this on insert and lookup.
187 */
188
189 #ifndef UPB_TABLE_H_
190 #define UPB_TABLE_H_
191
192 #include <stdint.h>
193 #include <string.h>
194 /*
195 ** This file contains shared definitions that are widely used across upb.
196 */
197
198 #ifndef UPB_H_
199 #define UPB_H_
200
201 #include <assert.h>
202 #include <stdarg.h>
203 #include <stdbool.h>
204 #include <stddef.h>
205 #include <stdint.h>
206 #include <string.h>
207
208
209 #ifdef __cplusplus
210 extern "C" {
211 #endif
212
213 /* upb_status *****************************************************************/
214
215 #define UPB_STATUS_MAX_MESSAGE 127
216
217 typedef struct {
218 bool ok;
219 char msg[UPB_STATUS_MAX_MESSAGE]; /* Error message; NULL-terminated. */
220 } upb_status;
221
222 const char *upb_status_errmsg(const upb_status *status);
223 bool upb_ok(const upb_status *status);
224
225 /* These are no-op if |status| is NULL. */
226 void upb_status_clear(upb_status *status);
227 void upb_status_seterrmsg(upb_status *status, const char *msg);
228 void upb_status_seterrf(upb_status *status, const char *fmt, ...);
229 void upb_status_vseterrf(upb_status *status, const char *fmt, va_list args);
230 void upb_status_vappenderrf(upb_status *status, const char *fmt, va_list args);
231
232 /** upb_strview ************************************************************/
233
234 typedef struct {
235 const char *data;
236 size_t size;
237 } upb_strview;
238
upb_strview_make(const char * data,size_t size)239 UPB_INLINE upb_strview upb_strview_make(const char *data, size_t size) {
240 upb_strview ret;
241 ret.data = data;
242 ret.size = size;
243 return ret;
244 }
245
upb_strview_makez(const char * data)246 UPB_INLINE upb_strview upb_strview_makez(const char *data) {
247 return upb_strview_make(data, strlen(data));
248 }
249
upb_strview_eql(upb_strview a,upb_strview b)250 UPB_INLINE bool upb_strview_eql(upb_strview a, upb_strview b) {
251 return a.size == b.size && memcmp(a.data, b.data, a.size) == 0;
252 }
253
254 #define UPB_STRVIEW_INIT(ptr, len) {ptr, len}
255
256 #define UPB_STRVIEW_FORMAT "%.*s"
257 #define UPB_STRVIEW_ARGS(view) (int)(view).size, (view).data
258
259 /** upb_alloc *****************************************************************/
260
261 /* A upb_alloc is a possibly-stateful allocator object.
262 *
263 * It could either be an arena allocator (which doesn't require individual
264 * free() calls) or a regular malloc() (which does). The client must therefore
265 * free memory unless it knows that the allocator is an arena allocator. */
266
267 struct upb_alloc;
268 typedef struct upb_alloc upb_alloc;
269
270 /* A malloc()/free() function.
271 * If "size" is 0 then the function acts like free(), otherwise it acts like
272 * realloc(). Only "oldsize" bytes from a previous allocation are preserved. */
273 typedef void *upb_alloc_func(upb_alloc *alloc, void *ptr, size_t oldsize,
274 size_t size);
275
276 struct upb_alloc {
277 upb_alloc_func *func;
278 };
279
upb_malloc(upb_alloc * alloc,size_t size)280 UPB_INLINE void *upb_malloc(upb_alloc *alloc, size_t size) {
281 UPB_ASSERT(alloc);
282 return alloc->func(alloc, NULL, 0, size);
283 }
284
upb_realloc(upb_alloc * alloc,void * ptr,size_t oldsize,size_t size)285 UPB_INLINE void *upb_realloc(upb_alloc *alloc, void *ptr, size_t oldsize,
286 size_t size) {
287 UPB_ASSERT(alloc);
288 return alloc->func(alloc, ptr, oldsize, size);
289 }
290
upb_free(upb_alloc * alloc,void * ptr)291 UPB_INLINE void upb_free(upb_alloc *alloc, void *ptr) {
292 assert(alloc);
293 alloc->func(alloc, ptr, 0, 0);
294 }
295
296 /* The global allocator used by upb. Uses the standard malloc()/free(). */
297
298 extern upb_alloc upb_alloc_global;
299
300 /* Functions that hard-code the global malloc.
301 *
302 * We still get benefit because we can put custom logic into our global
303 * allocator, like injecting out-of-memory faults in debug/testing builds. */
304
upb_gmalloc(size_t size)305 UPB_INLINE void *upb_gmalloc(size_t size) {
306 return upb_malloc(&upb_alloc_global, size);
307 }
308
upb_grealloc(void * ptr,size_t oldsize,size_t size)309 UPB_INLINE void *upb_grealloc(void *ptr, size_t oldsize, size_t size) {
310 return upb_realloc(&upb_alloc_global, ptr, oldsize, size);
311 }
312
upb_gfree(void * ptr)313 UPB_INLINE void upb_gfree(void *ptr) {
314 upb_free(&upb_alloc_global, ptr);
315 }
316
317 /* upb_arena ******************************************************************/
318
319 /* upb_arena is a specific allocator implementation that uses arena allocation.
320 * The user provides an allocator that will be used to allocate the underlying
321 * arena blocks. Arenas by nature do not require the individual allocations
322 * to be freed. However the Arena does allow users to register cleanup
323 * functions that will run when the arena is destroyed.
324 *
325 * A upb_arena is *not* thread-safe.
326 *
327 * You could write a thread-safe arena allocator that satisfies the
328 * upb_alloc interface, but it would not be as efficient for the
329 * single-threaded case. */
330
331 typedef void upb_cleanup_func(void *ud);
332
333 struct upb_arena;
334 typedef struct upb_arena upb_arena;
335
336 typedef struct {
337 /* We implement the allocator interface.
338 * This must be the first member of upb_arena!
339 * TODO(haberman): remove once handlers are gone. */
340 upb_alloc alloc;
341
342 char *ptr, *end;
343 } _upb_arena_head;
344
345 /* Creates an arena from the given initial block (if any -- n may be 0).
346 * Additional blocks will be allocated from |alloc|. If |alloc| is NULL, this
347 * is a fixed-size arena and cannot grow. */
348 upb_arena *upb_arena_init(void *mem, size_t n, upb_alloc *alloc);
349 void upb_arena_free(upb_arena *a);
350 bool upb_arena_addcleanup(upb_arena *a, void *ud, upb_cleanup_func *func);
351 void upb_arena_fuse(upb_arena *a, upb_arena *b);
352 void *_upb_arena_slowmalloc(upb_arena *a, size_t size);
353
upb_arena_alloc(upb_arena * a)354 UPB_INLINE upb_alloc *upb_arena_alloc(upb_arena *a) { return (upb_alloc*)a; }
355
_upb_arenahas(upb_arena * a,size_t size)356 UPB_INLINE bool _upb_arenahas(upb_arena *a, size_t size) {
357 _upb_arena_head *h = (_upb_arena_head*)a;
358 return (size_t)(h->end - h->ptr) >= size;
359 }
360
upb_arena_malloc(upb_arena * a,size_t size)361 UPB_INLINE void *upb_arena_malloc(upb_arena *a, size_t size) {
362 _upb_arena_head *h = (_upb_arena_head*)a;
363 void* ret;
364 size = UPB_ALIGN_MALLOC(size);
365
366 if (UPB_UNLIKELY(!_upb_arenahas(a, size))) {
367 return _upb_arena_slowmalloc(a, size);
368 }
369
370 ret = h->ptr;
371 h->ptr += size;
372 UPB_UNPOISON_MEMORY_REGION(ret, size);
373
374 #if UPB_ASAN
375 {
376 size_t guard_size = 32;
377 if (_upb_arenahas(a, guard_size)) {
378 h->ptr += guard_size;
379 } else {
380 h->ptr = h->end;
381 }
382 }
383 #endif
384
385 return ret;
386 }
387
upb_arena_realloc(upb_arena * a,void * ptr,size_t oldsize,size_t size)388 UPB_INLINE void *upb_arena_realloc(upb_arena *a, void *ptr, size_t oldsize,
389 size_t size) {
390 void *ret = upb_arena_malloc(a, size);
391
392 if (ret && oldsize > 0) {
393 memcpy(ret, ptr, oldsize);
394 }
395
396 return ret;
397 }
398
upb_arena_new(void)399 UPB_INLINE upb_arena *upb_arena_new(void) {
400 return upb_arena_init(NULL, 0, &upb_alloc_global);
401 }
402
403 /* Constants ******************************************************************/
404
405 /* Generic function type. */
406 typedef void upb_func(void);
407
408 /* A list of types as they are encoded on-the-wire. */
409 typedef enum {
410 UPB_WIRE_TYPE_VARINT = 0,
411 UPB_WIRE_TYPE_64BIT = 1,
412 UPB_WIRE_TYPE_DELIMITED = 2,
413 UPB_WIRE_TYPE_START_GROUP = 3,
414 UPB_WIRE_TYPE_END_GROUP = 4,
415 UPB_WIRE_TYPE_32BIT = 5
416 } upb_wiretype_t;
417
418 /* The types a field can have. Note that this list is not identical to the
419 * types defined in descriptor.proto, which gives INT32 and SINT32 separate
420 * types (we distinguish the two with the "integer encoding" enum below). */
421 typedef enum {
422 UPB_TYPE_BOOL = 1,
423 UPB_TYPE_FLOAT = 2,
424 UPB_TYPE_INT32 = 3,
425 UPB_TYPE_UINT32 = 4,
426 UPB_TYPE_ENUM = 5, /* Enum values are int32. */
427 UPB_TYPE_MESSAGE = 6,
428 UPB_TYPE_DOUBLE = 7,
429 UPB_TYPE_INT64 = 8,
430 UPB_TYPE_UINT64 = 9,
431 UPB_TYPE_STRING = 10,
432 UPB_TYPE_BYTES = 11
433 } upb_fieldtype_t;
434
435 /* The repeated-ness of each field; this matches descriptor.proto. */
436 typedef enum {
437 UPB_LABEL_OPTIONAL = 1,
438 UPB_LABEL_REQUIRED = 2,
439 UPB_LABEL_REPEATED = 3
440 } upb_label_t;
441
442 /* Descriptor types, as defined in descriptor.proto. */
443 typedef enum {
444 /* Old (long) names. TODO(haberman): remove */
445 UPB_DESCRIPTOR_TYPE_DOUBLE = 1,
446 UPB_DESCRIPTOR_TYPE_FLOAT = 2,
447 UPB_DESCRIPTOR_TYPE_INT64 = 3,
448 UPB_DESCRIPTOR_TYPE_UINT64 = 4,
449 UPB_DESCRIPTOR_TYPE_INT32 = 5,
450 UPB_DESCRIPTOR_TYPE_FIXED64 = 6,
451 UPB_DESCRIPTOR_TYPE_FIXED32 = 7,
452 UPB_DESCRIPTOR_TYPE_BOOL = 8,
453 UPB_DESCRIPTOR_TYPE_STRING = 9,
454 UPB_DESCRIPTOR_TYPE_GROUP = 10,
455 UPB_DESCRIPTOR_TYPE_MESSAGE = 11,
456 UPB_DESCRIPTOR_TYPE_BYTES = 12,
457 UPB_DESCRIPTOR_TYPE_UINT32 = 13,
458 UPB_DESCRIPTOR_TYPE_ENUM = 14,
459 UPB_DESCRIPTOR_TYPE_SFIXED32 = 15,
460 UPB_DESCRIPTOR_TYPE_SFIXED64 = 16,
461 UPB_DESCRIPTOR_TYPE_SINT32 = 17,
462 UPB_DESCRIPTOR_TYPE_SINT64 = 18,
463
464 UPB_DTYPE_DOUBLE = 1,
465 UPB_DTYPE_FLOAT = 2,
466 UPB_DTYPE_INT64 = 3,
467 UPB_DTYPE_UINT64 = 4,
468 UPB_DTYPE_INT32 = 5,
469 UPB_DTYPE_FIXED64 = 6,
470 UPB_DTYPE_FIXED32 = 7,
471 UPB_DTYPE_BOOL = 8,
472 UPB_DTYPE_STRING = 9,
473 UPB_DTYPE_GROUP = 10,
474 UPB_DTYPE_MESSAGE = 11,
475 UPB_DTYPE_BYTES = 12,
476 UPB_DTYPE_UINT32 = 13,
477 UPB_DTYPE_ENUM = 14,
478 UPB_DTYPE_SFIXED32 = 15,
479 UPB_DTYPE_SFIXED64 = 16,
480 UPB_DTYPE_SINT32 = 17,
481 UPB_DTYPE_SINT64 = 18
482 } upb_descriptortype_t;
483
484 #define UPB_MAP_BEGIN ((size_t)-1)
485
_upb_isle(void)486 UPB_INLINE bool _upb_isle(void) {
487 int x = 1;
488 return *(char*)&x == 1;
489 }
490
_upb_be_swap32(uint32_t val)491 UPB_INLINE uint32_t _upb_be_swap32(uint32_t val) {
492 if (_upb_isle()) {
493 return val;
494 } else {
495 return ((val & 0xff) << 24) | ((val & 0xff00) << 8) |
496 ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24);
497 }
498 }
499
_upb_be_swap64(uint64_t val)500 UPB_INLINE uint64_t _upb_be_swap64(uint64_t val) {
501 if (_upb_isle()) {
502 return val;
503 } else {
504 return ((uint64_t)_upb_be_swap32(val) << 32) | _upb_be_swap32(val >> 32);
505 }
506 }
507
_upb_lg2ceil(int x)508 UPB_INLINE int _upb_lg2ceil(int x) {
509 if (x <= 1) return 0;
510 #ifdef __GNUC__
511 return 32 - __builtin_clz(x - 1);
512 #else
513 int lg2 = 0;
514 while (1 << lg2 < x) lg2++;
515 return lg2;
516 #endif
517 }
518
519
520 #ifdef __cplusplus
521 } /* extern "C" */
522 #endif
523
524 #endif /* UPB_H_ */
525
526
527 #ifdef __cplusplus
528 extern "C" {
529 #endif
530
531
532 /* upb_value ******************************************************************/
533
534 /* A tagged union (stored untagged inside the table) so that we can check that
535 * clients calling table accessors are correctly typed without having to have
536 * an explosion of accessors. */
537 typedef enum {
538 UPB_CTYPE_INT32 = 1,
539 UPB_CTYPE_INT64 = 2,
540 UPB_CTYPE_UINT32 = 3,
541 UPB_CTYPE_UINT64 = 4,
542 UPB_CTYPE_BOOL = 5,
543 UPB_CTYPE_CSTR = 6,
544 UPB_CTYPE_PTR = 7,
545 UPB_CTYPE_CONSTPTR = 8,
546 UPB_CTYPE_FPTR = 9,
547 UPB_CTYPE_FLOAT = 10,
548 UPB_CTYPE_DOUBLE = 11
549 } upb_ctype_t;
550
551 typedef struct {
552 uint64_t val;
553 } upb_value;
554
555 /* Like strdup(), which isn't always available since it's not ANSI C. */
556 char *upb_strdup(const char *s, upb_alloc *a);
557 /* Variant that works with a length-delimited rather than NULL-delimited string,
558 * as supported by strtable. */
559 char *upb_strdup2(const char *s, size_t len, upb_alloc *a);
560
upb_gstrdup(const char * s)561 UPB_INLINE char *upb_gstrdup(const char *s) {
562 return upb_strdup(s, &upb_alloc_global);
563 }
564
_upb_value_setval(upb_value * v,uint64_t val)565 UPB_INLINE void _upb_value_setval(upb_value *v, uint64_t val) {
566 v->val = val;
567 }
568
_upb_value_val(uint64_t val)569 UPB_INLINE upb_value _upb_value_val(uint64_t val) {
570 upb_value ret;
571 _upb_value_setval(&ret, val);
572 return ret;
573 }
574
575 /* For each value ctype, define the following set of functions:
576 *
577 * // Get/set an int32 from a upb_value.
578 * int32_t upb_value_getint32(upb_value val);
579 * void upb_value_setint32(upb_value *val, int32_t cval);
580 *
581 * // Construct a new upb_value from an int32.
582 * upb_value upb_value_int32(int32_t val); */
583 #define FUNCS(name, membername, type_t, converter, proto_type) \
584 UPB_INLINE void upb_value_set ## name(upb_value *val, type_t cval) { \
585 val->val = (converter)cval; \
586 } \
587 UPB_INLINE upb_value upb_value_ ## name(type_t val) { \
588 upb_value ret; \
589 upb_value_set ## name(&ret, val); \
590 return ret; \
591 } \
592 UPB_INLINE type_t upb_value_get ## name(upb_value val) { \
593 return (type_t)(converter)val.val; \
594 }
595
FUNCS(int32,int32,int32_t,int32_t,UPB_CTYPE_INT32)596 FUNCS(int32, int32, int32_t, int32_t, UPB_CTYPE_INT32)
597 FUNCS(int64, int64, int64_t, int64_t, UPB_CTYPE_INT64)
598 FUNCS(uint32, uint32, uint32_t, uint32_t, UPB_CTYPE_UINT32)
599 FUNCS(uint64, uint64, uint64_t, uint64_t, UPB_CTYPE_UINT64)
600 FUNCS(bool, _bool, bool, bool, UPB_CTYPE_BOOL)
601 FUNCS(cstr, cstr, char*, uintptr_t, UPB_CTYPE_CSTR)
602 FUNCS(ptr, ptr, void*, uintptr_t, UPB_CTYPE_PTR)
603 FUNCS(constptr, constptr, const void*, uintptr_t, UPB_CTYPE_CONSTPTR)
604 FUNCS(fptr, fptr, upb_func*, uintptr_t, UPB_CTYPE_FPTR)
605
606 #undef FUNCS
607
608 UPB_INLINE void upb_value_setfloat(upb_value *val, float cval) {
609 memcpy(&val->val, &cval, sizeof(cval));
610 }
611
upb_value_setdouble(upb_value * val,double cval)612 UPB_INLINE void upb_value_setdouble(upb_value *val, double cval) {
613 memcpy(&val->val, &cval, sizeof(cval));
614 }
615
upb_value_float(float cval)616 UPB_INLINE upb_value upb_value_float(float cval) {
617 upb_value ret;
618 upb_value_setfloat(&ret, cval);
619 return ret;
620 }
621
upb_value_double(double cval)622 UPB_INLINE upb_value upb_value_double(double cval) {
623 upb_value ret;
624 upb_value_setdouble(&ret, cval);
625 return ret;
626 }
627
628 #undef SET_TYPE
629
630
631 /* upb_tabkey *****************************************************************/
632
633 /* Either:
634 * 1. an actual integer key, or
635 * 2. a pointer to a string prefixed by its uint32_t length, owned by us.
636 *
637 * ...depending on whether this is a string table or an int table. We would
638 * make this a union of those two types, but C89 doesn't support statically
639 * initializing a non-first union member. */
640 typedef uintptr_t upb_tabkey;
641
upb_tabstr(upb_tabkey key,uint32_t * len)642 UPB_INLINE char *upb_tabstr(upb_tabkey key, uint32_t *len) {
643 char* mem = (char*)key;
644 if (len) memcpy(len, mem, sizeof(*len));
645 return mem + sizeof(*len);
646 }
647
648
649 /* upb_tabval *****************************************************************/
650
651 typedef struct {
652 uint64_t val;
653 } upb_tabval;
654
655 #define UPB_TABVALUE_EMPTY_INIT {-1}
656
657 /* upb_table ******************************************************************/
658
659 typedef struct _upb_tabent {
660 upb_tabkey key;
661 upb_tabval val;
662
663 /* Internal chaining. This is const so we can create static initializers for
664 * tables. We cast away const sometimes, but *only* when the containing
665 * upb_table is known to be non-const. This requires a bit of care, but
666 * the subtlety is confined to table.c. */
667 const struct _upb_tabent *next;
668 } upb_tabent;
669
670 typedef struct {
671 size_t count; /* Number of entries in the hash part. */
672 uint32_t mask; /* Mask to turn hash value -> bucket. */
673 uint32_t max_count; /* Max count before we hit our load limit. */
674 uint8_t size_lg2; /* Size of the hashtable part is 2^size_lg2 entries. */
675
676 /* Hash table entries.
677 * Making this const isn't entirely accurate; what we really want is for it to
678 * have the same const-ness as the table it's inside. But there's no way to
679 * declare that in C. So we have to make it const so that we can statically
680 * initialize const hash tables. Then we cast away const when we have to.
681 */
682 const upb_tabent *entries;
683 } upb_table;
684
685 typedef struct {
686 upb_table t;
687 } upb_strtable;
688
689 typedef struct {
690 upb_table t; /* For entries that don't fit in the array part. */
691 const upb_tabval *array; /* Array part of the table. See const note above. */
692 size_t array_size; /* Array part size. */
693 size_t array_count; /* Array part number of elements. */
694 } upb_inttable;
695
696 #define UPB_ARRAY_EMPTYENT -1
697
upb_table_size(const upb_table * t)698 UPB_INLINE size_t upb_table_size(const upb_table *t) {
699 if (t->size_lg2 == 0)
700 return 0;
701 else
702 return 1 << t->size_lg2;
703 }
704
705 /* Internal-only functions, in .h file only out of necessity. */
upb_tabent_isempty(const upb_tabent * e)706 UPB_INLINE bool upb_tabent_isempty(const upb_tabent *e) {
707 return e->key == 0;
708 }
709
710 /* Used by some of the unit tests for generic hashing functionality. */
711 uint32_t upb_murmur_hash2(const void * key, size_t len, uint32_t seed);
712
upb_intkey(uintptr_t key)713 UPB_INLINE uintptr_t upb_intkey(uintptr_t key) {
714 return key;
715 }
716
upb_inthash(uintptr_t key)717 UPB_INLINE uint32_t upb_inthash(uintptr_t key) {
718 return (uint32_t)key;
719 }
720
upb_getentry(const upb_table * t,uint32_t hash)721 static const upb_tabent *upb_getentry(const upb_table *t, uint32_t hash) {
722 return t->entries + (hash & t->mask);
723 }
724
upb_arrhas(upb_tabval key)725 UPB_INLINE bool upb_arrhas(upb_tabval key) {
726 return key.val != (uint64_t)-1;
727 }
728
729 /* Initialize and uninitialize a table, respectively. If memory allocation
730 * failed, false is returned that the table is uninitialized. */
731 bool upb_inttable_init2(upb_inttable *table, upb_ctype_t ctype, upb_alloc *a);
732 bool upb_strtable_init2(upb_strtable *table, upb_ctype_t ctype,
733 size_t expected_size, upb_alloc *a);
734 void upb_inttable_uninit2(upb_inttable *table, upb_alloc *a);
735 void upb_strtable_uninit2(upb_strtable *table, upb_alloc *a);
736
upb_inttable_init(upb_inttable * table,upb_ctype_t ctype)737 UPB_INLINE bool upb_inttable_init(upb_inttable *table, upb_ctype_t ctype) {
738 return upb_inttable_init2(table, ctype, &upb_alloc_global);
739 }
740
upb_strtable_init(upb_strtable * table,upb_ctype_t ctype)741 UPB_INLINE bool upb_strtable_init(upb_strtable *table, upb_ctype_t ctype) {
742 return upb_strtable_init2(table, ctype, 4, &upb_alloc_global);
743 }
744
upb_inttable_uninit(upb_inttable * table)745 UPB_INLINE void upb_inttable_uninit(upb_inttable *table) {
746 upb_inttable_uninit2(table, &upb_alloc_global);
747 }
748
upb_strtable_uninit(upb_strtable * table)749 UPB_INLINE void upb_strtable_uninit(upb_strtable *table) {
750 upb_strtable_uninit2(table, &upb_alloc_global);
751 }
752
753 /* Returns the number of values in the table. */
754 size_t upb_inttable_count(const upb_inttable *t);
upb_strtable_count(const upb_strtable * t)755 UPB_INLINE size_t upb_strtable_count(const upb_strtable *t) {
756 return t->t.count;
757 }
758
759 void upb_inttable_packedsize(const upb_inttable *t, size_t *size);
760 void upb_strtable_packedsize(const upb_strtable *t, size_t *size);
761 upb_inttable *upb_inttable_pack(const upb_inttable *t, void *p, size_t *ofs,
762 size_t size);
763 upb_strtable *upb_strtable_pack(const upb_strtable *t, void *p, size_t *ofs,
764 size_t size);
765 void upb_strtable_clear(upb_strtable *t);
766
767 /* Inserts the given key into the hashtable with the given value. The key must
768 * not already exist in the hash table. For string tables, the key must be
769 * NULL-terminated, and the table will make an internal copy of the key.
770 * Inttables must not insert a value of UINTPTR_MAX.
771 *
772 * If a table resize was required but memory allocation failed, false is
773 * returned and the table is unchanged. */
774 bool upb_inttable_insert2(upb_inttable *t, uintptr_t key, upb_value val,
775 upb_alloc *a);
776 bool upb_strtable_insert3(upb_strtable *t, const char *key, size_t len,
777 upb_value val, upb_alloc *a);
778
upb_inttable_insert(upb_inttable * t,uintptr_t key,upb_value val)779 UPB_INLINE bool upb_inttable_insert(upb_inttable *t, uintptr_t key,
780 upb_value val) {
781 return upb_inttable_insert2(t, key, val, &upb_alloc_global);
782 }
783
upb_strtable_insert2(upb_strtable * t,const char * key,size_t len,upb_value val)784 UPB_INLINE bool upb_strtable_insert2(upb_strtable *t, const char *key,
785 size_t len, upb_value val) {
786 return upb_strtable_insert3(t, key, len, val, &upb_alloc_global);
787 }
788
789 /* For NULL-terminated strings. */
upb_strtable_insert(upb_strtable * t,const char * key,upb_value val)790 UPB_INLINE bool upb_strtable_insert(upb_strtable *t, const char *key,
791 upb_value val) {
792 return upb_strtable_insert2(t, key, strlen(key), val);
793 }
794
795 /* Looks up key in this table, returning "true" if the key was found.
796 * If v is non-NULL, copies the value for this key into *v. */
797 bool upb_inttable_lookup(const upb_inttable *t, uintptr_t key, upb_value *v);
798 bool upb_strtable_lookup2(const upb_strtable *t, const char *key, size_t len,
799 upb_value *v);
800
801 /* For NULL-terminated strings. */
upb_strtable_lookup(const upb_strtable * t,const char * key,upb_value * v)802 UPB_INLINE bool upb_strtable_lookup(const upb_strtable *t, const char *key,
803 upb_value *v) {
804 return upb_strtable_lookup2(t, key, strlen(key), v);
805 }
806
807 /* Removes an item from the table. Returns true if the remove was successful,
808 * and stores the removed item in *val if non-NULL. */
809 bool upb_inttable_remove(upb_inttable *t, uintptr_t key, upb_value *val);
810 bool upb_strtable_remove3(upb_strtable *t, const char *key, size_t len,
811 upb_value *val, upb_alloc *alloc);
812
upb_strtable_remove2(upb_strtable * t,const char * key,size_t len,upb_value * val)813 UPB_INLINE bool upb_strtable_remove2(upb_strtable *t, const char *key,
814 size_t len, upb_value *val) {
815 return upb_strtable_remove3(t, key, len, val, &upb_alloc_global);
816 }
817
818 /* For NULL-terminated strings. */
upb_strtable_remove(upb_strtable * t,const char * key,upb_value * v)819 UPB_INLINE bool upb_strtable_remove(upb_strtable *t, const char *key,
820 upb_value *v) {
821 return upb_strtable_remove2(t, key, strlen(key), v);
822 }
823
824 /* Updates an existing entry in an inttable. If the entry does not exist,
825 * returns false and does nothing. Unlike insert/remove, this does not
826 * invalidate iterators. */
827 bool upb_inttable_replace(upb_inttable *t, uintptr_t key, upb_value val);
828
829 /* Convenience routines for inttables with pointer keys. */
830 bool upb_inttable_insertptr2(upb_inttable *t, const void *key, upb_value val,
831 upb_alloc *a);
832 bool upb_inttable_removeptr(upb_inttable *t, const void *key, upb_value *val);
833 bool upb_inttable_lookupptr(
834 const upb_inttable *t, const void *key, upb_value *val);
835
upb_inttable_insertptr(upb_inttable * t,const void * key,upb_value val)836 UPB_INLINE bool upb_inttable_insertptr(upb_inttable *t, const void *key,
837 upb_value val) {
838 return upb_inttable_insertptr2(t, key, val, &upb_alloc_global);
839 }
840
841 /* Optimizes the table for the current set of entries, for both memory use and
842 * lookup time. Client should call this after all entries have been inserted;
843 * inserting more entries is legal, but will likely require a table resize. */
844 void upb_inttable_compact2(upb_inttable *t, upb_alloc *a);
845
upb_inttable_compact(upb_inttable * t)846 UPB_INLINE void upb_inttable_compact(upb_inttable *t) {
847 upb_inttable_compact2(t, &upb_alloc_global);
848 }
849
850 /* A special-case inlinable version of the lookup routine for 32-bit
851 * integers. */
upb_inttable_lookup32(const upb_inttable * t,uint32_t key,upb_value * v)852 UPB_INLINE bool upb_inttable_lookup32(const upb_inttable *t, uint32_t key,
853 upb_value *v) {
854 *v = upb_value_int32(0); /* Silence compiler warnings. */
855 if (key < t->array_size) {
856 upb_tabval arrval = t->array[key];
857 if (upb_arrhas(arrval)) {
858 _upb_value_setval(v, arrval.val);
859 return true;
860 } else {
861 return false;
862 }
863 } else {
864 const upb_tabent *e;
865 if (t->t.entries == NULL) return false;
866 for (e = upb_getentry(&t->t, upb_inthash(key)); true; e = e->next) {
867 if ((uint32_t)e->key == key) {
868 _upb_value_setval(v, e->val.val);
869 return true;
870 }
871 if (e->next == NULL) return false;
872 }
873 }
874 }
875
876 /* Exposed for testing only. */
877 bool upb_strtable_resize(upb_strtable *t, size_t size_lg2, upb_alloc *a);
878
879 /* Iterators ******************************************************************/
880
881 /* Iterators for int and string tables. We are subject to some kind of unusual
882 * design constraints:
883 *
884 * For high-level languages:
885 * - we must be able to guarantee that we don't crash or corrupt memory even if
886 * the program accesses an invalidated iterator.
887 *
888 * For C++11 range-based for:
889 * - iterators must be copyable
890 * - iterators must be comparable
891 * - it must be possible to construct an "end" value.
892 *
893 * Iteration order is undefined.
894 *
895 * Modifying the table invalidates iterators. upb_{str,int}table_done() is
896 * guaranteed to work even on an invalidated iterator, as long as the table it
897 * is iterating over has not been freed. Calling next() or accessing data from
898 * an invalidated iterator yields unspecified elements from the table, but it is
899 * guaranteed not to crash and to return real table elements (except when done()
900 * is true). */
901
902
903 /* upb_strtable_iter **********************************************************/
904
905 /* upb_strtable_iter i;
906 * upb_strtable_begin(&i, t);
907 * for(; !upb_strtable_done(&i); upb_strtable_next(&i)) {
908 * const char *key = upb_strtable_iter_key(&i);
909 * const upb_value val = upb_strtable_iter_value(&i);
910 * // ...
911 * }
912 */
913
914 typedef struct {
915 const upb_strtable *t;
916 size_t index;
917 } upb_strtable_iter;
918
919 void upb_strtable_begin(upb_strtable_iter *i, const upb_strtable *t);
920 void upb_strtable_next(upb_strtable_iter *i);
921 bool upb_strtable_done(const upb_strtable_iter *i);
922 upb_strview upb_strtable_iter_key(const upb_strtable_iter *i);
923 upb_value upb_strtable_iter_value(const upb_strtable_iter *i);
924 void upb_strtable_iter_setdone(upb_strtable_iter *i);
925 bool upb_strtable_iter_isequal(const upb_strtable_iter *i1,
926 const upb_strtable_iter *i2);
927
928
929 /* upb_inttable_iter **********************************************************/
930
931 /* upb_inttable_iter i;
932 * upb_inttable_begin(&i, t);
933 * for(; !upb_inttable_done(&i); upb_inttable_next(&i)) {
934 * uintptr_t key = upb_inttable_iter_key(&i);
935 * upb_value val = upb_inttable_iter_value(&i);
936 * // ...
937 * }
938 */
939
940 typedef struct {
941 const upb_inttable *t;
942 size_t index;
943 bool array_part;
944 } upb_inttable_iter;
945
str_tabent(const upb_strtable_iter * i)946 UPB_INLINE const upb_tabent *str_tabent(const upb_strtable_iter *i) {
947 return &i->t->t.entries[i->index];
948 }
949
950 void upb_inttable_begin(upb_inttable_iter *i, const upb_inttable *t);
951 void upb_inttable_next(upb_inttable_iter *i);
952 bool upb_inttable_done(const upb_inttable_iter *i);
953 uintptr_t upb_inttable_iter_key(const upb_inttable_iter *i);
954 upb_value upb_inttable_iter_value(const upb_inttable_iter *i);
955 void upb_inttable_iter_setdone(upb_inttable_iter *i);
956 bool upb_inttable_iter_isequal(const upb_inttable_iter *i1,
957 const upb_inttable_iter *i2);
958
959
960 #ifdef __cplusplus
961 } /* extern "C" */
962 #endif
963
964
965 #endif /* UPB_TABLE_H_ */
966
967
968 #ifdef __cplusplus
969 extern "C" {
970 #endif
971
972 #define PTR_AT(msg, ofs, type) (type*)((const char*)msg + ofs)
973
974 typedef void upb_msg;
975
976 /** upb_msglayout *************************************************************/
977
978 /* upb_msglayout represents the memory layout of a given upb_msgdef. The
979 * members are public so generated code can initialize them, but users MUST NOT
980 * read or write any of its members. */
981
982 /* These aren't real labels according to descriptor.proto, but in the table we
983 * use these for map/packed fields instead of UPB_LABEL_REPEATED. */
984 enum {
985 _UPB_LABEL_MAP = 4,
986 _UPB_LABEL_PACKED = 7 /* Low 3 bits are common with UPB_LABEL_REPEATED. */
987 };
988
989 typedef struct {
990 uint32_t number;
991 uint16_t offset;
992 int16_t presence; /* If >0, hasbit_index. If <0, ~oneof_index. */
993 uint16_t submsg_index; /* undefined if descriptortype != MESSAGE or GROUP. */
994 uint8_t descriptortype;
995 uint8_t label; /* google.protobuf.Label or _UPB_LABEL_* above. */
996 } upb_msglayout_field;
997
998 typedef struct upb_msglayout {
999 const struct upb_msglayout *const* submsgs;
1000 const upb_msglayout_field *fields;
1001 /* Must be aligned to sizeof(void*). Doesn't include internal members like
1002 * unknown fields, extension dict, pointer to msglayout, etc. */
1003 uint16_t size;
1004 uint16_t field_count;
1005 bool extendable;
1006 } upb_msglayout;
1007
1008 /** upb_msg *******************************************************************/
1009
1010 /* Internal members of a upb_msg. We can change this without breaking binary
1011 * compatibility. We put these before the user's data. The user's upb_msg*
1012 * points after the upb_msg_internal. */
1013
1014 typedef struct {
1015 uint32_t len;
1016 uint32_t size;
1017 /* Data follows. */
1018 } upb_msg_unknowndata;
1019
1020 /* Used when a message is not extendable. */
1021 typedef struct {
1022 upb_msg_unknowndata *unknown;
1023 } upb_msg_internal;
1024
1025 /* Maps upb_fieldtype_t -> memory size. */
1026 extern char _upb_fieldtype_to_size[12];
1027
upb_msg_sizeof(const upb_msglayout * l)1028 UPB_INLINE size_t upb_msg_sizeof(const upb_msglayout *l) {
1029 return l->size + sizeof(upb_msg_internal);
1030 }
1031
_upb_msg_new_inl(const upb_msglayout * l,upb_arena * a)1032 UPB_INLINE upb_msg *_upb_msg_new_inl(const upb_msglayout *l, upb_arena *a) {
1033 size_t size = upb_msg_sizeof(l);
1034 void *mem = upb_arena_malloc(a, size);
1035 upb_msg *msg;
1036 if (UPB_UNLIKELY(!mem)) return NULL;
1037 msg = UPB_PTR_AT(mem, sizeof(upb_msg_internal), upb_msg);
1038 memset(mem, 0, size);
1039 return msg;
1040 }
1041
1042 /* Creates a new messages with the given layout on the given arena. */
1043 upb_msg *_upb_msg_new(const upb_msglayout *l, upb_arena *a);
1044
upb_msg_getinternal(upb_msg * msg)1045 UPB_INLINE upb_msg_internal *upb_msg_getinternal(upb_msg *msg) {
1046 ptrdiff_t size = sizeof(upb_msg_internal);
1047 return (upb_msg_internal*)((char*)msg - size);
1048 }
1049
1050 /* Clears the given message. */
1051 void _upb_msg_clear(upb_msg *msg, const upb_msglayout *l);
1052
1053 /* Discards the unknown fields for this message only. */
1054 void _upb_msg_discardunknown_shallow(upb_msg *msg);
1055
1056 /* Adds unknown data (serialized protobuf data) to the given message. The data
1057 * is copied into the message instance. */
1058 bool _upb_msg_addunknown(upb_msg *msg, const char *data, size_t len,
1059 upb_arena *arena);
1060
1061 /* Returns a reference to the message's unknown data. */
1062 const char *upb_msg_getunknown(const upb_msg *msg, size_t *len);
1063
1064 /** Hasbit access *************************************************************/
1065
_upb_hasbit(const upb_msg * msg,size_t idx)1066 UPB_INLINE bool _upb_hasbit(const upb_msg *msg, size_t idx) {
1067 return (*PTR_AT(msg, idx / 8, const char) & (1 << (idx % 8))) != 0;
1068 }
1069
_upb_sethas(const upb_msg * msg,size_t idx)1070 UPB_INLINE void _upb_sethas(const upb_msg *msg, size_t idx) {
1071 (*PTR_AT(msg, idx / 8, char)) |= (char)(1 << (idx % 8));
1072 }
1073
_upb_clearhas(const upb_msg * msg,size_t idx)1074 UPB_INLINE void _upb_clearhas(const upb_msg *msg, size_t idx) {
1075 (*PTR_AT(msg, idx / 8, char)) &= (char)(~(1 << (idx % 8)));
1076 }
1077
_upb_msg_hasidx(const upb_msglayout_field * f)1078 UPB_INLINE size_t _upb_msg_hasidx(const upb_msglayout_field *f) {
1079 UPB_ASSERT(f->presence > 0);
1080 return f->presence;
1081 }
1082
_upb_hasbit_field(const upb_msg * msg,const upb_msglayout_field * f)1083 UPB_INLINE bool _upb_hasbit_field(const upb_msg *msg,
1084 const upb_msglayout_field *f) {
1085 return _upb_hasbit(msg, _upb_msg_hasidx(f));
1086 }
1087
_upb_sethas_field(const upb_msg * msg,const upb_msglayout_field * f)1088 UPB_INLINE void _upb_sethas_field(const upb_msg *msg,
1089 const upb_msglayout_field *f) {
1090 _upb_sethas(msg, _upb_msg_hasidx(f));
1091 }
1092
_upb_clearhas_field(const upb_msg * msg,const upb_msglayout_field * f)1093 UPB_INLINE void _upb_clearhas_field(const upb_msg *msg,
1094 const upb_msglayout_field *f) {
1095 _upb_clearhas(msg, _upb_msg_hasidx(f));
1096 }
1097
1098 /** Oneof case access *********************************************************/
1099
_upb_oneofcase(upb_msg * msg,size_t case_ofs)1100 UPB_INLINE uint32_t *_upb_oneofcase(upb_msg *msg, size_t case_ofs) {
1101 return PTR_AT(msg, case_ofs, uint32_t);
1102 }
1103
_upb_getoneofcase(const void * msg,size_t case_ofs)1104 UPB_INLINE uint32_t _upb_getoneofcase(const void *msg, size_t case_ofs) {
1105 return *PTR_AT(msg, case_ofs, uint32_t);
1106 }
1107
_upb_oneofcase_ofs(const upb_msglayout_field * f)1108 UPB_INLINE size_t _upb_oneofcase_ofs(const upb_msglayout_field *f) {
1109 UPB_ASSERT(f->presence < 0);
1110 return ~(ptrdiff_t)f->presence;
1111 }
1112
_upb_oneofcase_field(upb_msg * msg,const upb_msglayout_field * f)1113 UPB_INLINE uint32_t *_upb_oneofcase_field(upb_msg *msg,
1114 const upb_msglayout_field *f) {
1115 return _upb_oneofcase(msg, _upb_oneofcase_ofs(f));
1116 }
1117
_upb_getoneofcase_field(const upb_msg * msg,const upb_msglayout_field * f)1118 UPB_INLINE uint32_t _upb_getoneofcase_field(const upb_msg *msg,
1119 const upb_msglayout_field *f) {
1120 return _upb_getoneofcase(msg, _upb_oneofcase_ofs(f));
1121 }
1122
_upb_has_submsg_nohasbit(const upb_msg * msg,size_t ofs)1123 UPB_INLINE bool _upb_has_submsg_nohasbit(const upb_msg *msg, size_t ofs) {
1124 return *PTR_AT(msg, ofs, const upb_msg*) != NULL;
1125 }
1126
_upb_isrepeated(const upb_msglayout_field * field)1127 UPB_INLINE bool _upb_isrepeated(const upb_msglayout_field *field) {
1128 return (field->label & 3) == UPB_LABEL_REPEATED;
1129 }
1130
_upb_repeated_or_map(const upb_msglayout_field * field)1131 UPB_INLINE bool _upb_repeated_or_map(const upb_msglayout_field *field) {
1132 return field->label >= UPB_LABEL_REPEATED;
1133 }
1134
1135 /** upb_array *****************************************************************/
1136
1137 /* Our internal representation for repeated fields. */
1138 typedef struct {
1139 uintptr_t data; /* Tagged ptr: low 3 bits of ptr are lg2(elem size). */
1140 size_t len; /* Measured in elements. */
1141 size_t size; /* Measured in elements. */
1142 uint64_t junk;
1143 } upb_array;
1144
_upb_array_constptr(const upb_array * arr)1145 UPB_INLINE const void *_upb_array_constptr(const upb_array *arr) {
1146 UPB_ASSERT((arr->data & 7) <= 4);
1147 return (void*)(arr->data & ~(uintptr_t)7);
1148 }
1149
_upb_array_ptr(upb_array * arr)1150 UPB_INLINE void *_upb_array_ptr(upb_array *arr) {
1151 return (void*)_upb_array_constptr(arr);
1152 }
1153
_upb_tag_arrptr(void * ptr,int elem_size_lg2)1154 UPB_INLINE uintptr_t _upb_tag_arrptr(void* ptr, int elem_size_lg2) {
1155 UPB_ASSERT(elem_size_lg2 <= 4);
1156 UPB_ASSERT(((uintptr_t)ptr & 7) == 0);
1157 return (uintptr_t)ptr | (unsigned)elem_size_lg2;
1158 }
1159
_upb_array_new(upb_arena * a,size_t init_size,int elem_size_lg2)1160 UPB_INLINE upb_array *_upb_array_new(upb_arena *a, size_t init_size,
1161 int elem_size_lg2) {
1162 const size_t arr_size = UPB_ALIGN_UP(sizeof(upb_array), 8);
1163 const size_t bytes = sizeof(upb_array) + (init_size << elem_size_lg2);
1164 upb_array *arr = (upb_array*)upb_arena_malloc(a, bytes);
1165 if (!arr) return NULL;
1166 arr->data = _upb_tag_arrptr(UPB_PTR_AT(arr, arr_size, void), elem_size_lg2);
1167 arr->len = 0;
1168 arr->size = init_size;
1169 return arr;
1170 }
1171
1172 /* Resizes the capacity of the array to be at least min_size. */
1173 bool _upb_array_realloc(upb_array *arr, size_t min_size, upb_arena *arena);
1174
1175 /* Fallback functions for when the accessors require a resize. */
1176 void *_upb_array_resize_fallback(upb_array **arr_ptr, size_t size,
1177 int elem_size_lg2, upb_arena *arena);
1178 bool _upb_array_append_fallback(upb_array **arr_ptr, const void *value,
1179 int elem_size_lg2, upb_arena *arena);
1180
_upb_array_reserve(upb_array * arr,size_t size,upb_arena * arena)1181 UPB_INLINE bool _upb_array_reserve(upb_array *arr, size_t size,
1182 upb_arena *arena) {
1183 if (arr->size < size) return _upb_array_realloc(arr, size, arena);
1184 return true;
1185 }
1186
_upb_array_resize(upb_array * arr,size_t size,upb_arena * arena)1187 UPB_INLINE bool _upb_array_resize(upb_array *arr, size_t size,
1188 upb_arena *arena) {
1189 if (!_upb_array_reserve(arr, size, arena)) return false;
1190 arr->len = size;
1191 return true;
1192 }
1193
_upb_array_accessor(const void * msg,size_t ofs,size_t * size)1194 UPB_INLINE const void *_upb_array_accessor(const void *msg, size_t ofs,
1195 size_t *size) {
1196 const upb_array *arr = *PTR_AT(msg, ofs, const upb_array*);
1197 if (arr) {
1198 if (size) *size = arr->len;
1199 return _upb_array_constptr(arr);
1200 } else {
1201 if (size) *size = 0;
1202 return NULL;
1203 }
1204 }
1205
_upb_array_mutable_accessor(void * msg,size_t ofs,size_t * size)1206 UPB_INLINE void *_upb_array_mutable_accessor(void *msg, size_t ofs,
1207 size_t *size) {
1208 upb_array *arr = *PTR_AT(msg, ofs, upb_array*);
1209 if (arr) {
1210 if (size) *size = arr->len;
1211 return _upb_array_ptr(arr);
1212 } else {
1213 if (size) *size = 0;
1214 return NULL;
1215 }
1216 }
1217
_upb_array_resize_accessor2(void * msg,size_t ofs,size_t size,int elem_size_lg2,upb_arena * arena)1218 UPB_INLINE void *_upb_array_resize_accessor2(void *msg, size_t ofs, size_t size,
1219 int elem_size_lg2,
1220 upb_arena *arena) {
1221 upb_array **arr_ptr = PTR_AT(msg, ofs, upb_array *);
1222 upb_array *arr = *arr_ptr;
1223 if (!arr || arr->size < size) {
1224 return _upb_array_resize_fallback(arr_ptr, size, elem_size_lg2, arena);
1225 }
1226 arr->len = size;
1227 return _upb_array_ptr(arr);
1228 }
1229
_upb_array_append_accessor2(void * msg,size_t ofs,int elem_size_lg2,const void * value,upb_arena * arena)1230 UPB_INLINE bool _upb_array_append_accessor2(void *msg, size_t ofs,
1231 int elem_size_lg2,
1232 const void *value,
1233 upb_arena *arena) {
1234 upb_array **arr_ptr = PTR_AT(msg, ofs, upb_array *);
1235 size_t elem_size = 1 << elem_size_lg2;
1236 upb_array *arr = *arr_ptr;
1237 void *ptr;
1238 if (!arr || arr->len == arr->size) {
1239 return _upb_array_append_fallback(arr_ptr, value, elem_size_lg2, arena);
1240 }
1241 ptr = _upb_array_ptr(arr);
1242 memcpy(PTR_AT(ptr, arr->len * elem_size, char), value, elem_size);
1243 arr->len++;
1244 return true;
1245 }
1246
1247 /* Used by old generated code, remove once all code has been regenerated. */
_upb_sizelg2(upb_fieldtype_t type)1248 UPB_INLINE int _upb_sizelg2(upb_fieldtype_t type) {
1249 switch (type) {
1250 case UPB_TYPE_BOOL:
1251 return 0;
1252 case UPB_TYPE_FLOAT:
1253 case UPB_TYPE_INT32:
1254 case UPB_TYPE_UINT32:
1255 case UPB_TYPE_ENUM:
1256 return 2;
1257 case UPB_TYPE_MESSAGE:
1258 return UPB_SIZE(2, 3);
1259 case UPB_TYPE_DOUBLE:
1260 case UPB_TYPE_INT64:
1261 case UPB_TYPE_UINT64:
1262 return 3;
1263 case UPB_TYPE_STRING:
1264 case UPB_TYPE_BYTES:
1265 return UPB_SIZE(3, 4);
1266 }
1267 UPB_UNREACHABLE();
1268 }
_upb_array_resize_accessor(void * msg,size_t ofs,size_t size,upb_fieldtype_t type,upb_arena * arena)1269 UPB_INLINE void *_upb_array_resize_accessor(void *msg, size_t ofs, size_t size,
1270 upb_fieldtype_t type,
1271 upb_arena *arena) {
1272 return _upb_array_resize_accessor2(msg, ofs, size, _upb_sizelg2(type), arena);
1273 }
_upb_array_append_accessor(void * msg,size_t ofs,size_t elem_size,upb_fieldtype_t type,const void * value,upb_arena * arena)1274 UPB_INLINE bool _upb_array_append_accessor(void *msg, size_t ofs,
1275 size_t elem_size, upb_fieldtype_t type,
1276 const void *value,
1277 upb_arena *arena) {
1278 (void)elem_size;
1279 return _upb_array_append_accessor2(msg, ofs, _upb_sizelg2(type), value,
1280 arena);
1281 }
1282
1283 /** upb_map *******************************************************************/
1284
1285 /* Right now we use strmaps for everything. We'll likely want to use
1286 * integer-specific maps for integer-keyed maps.*/
1287 typedef struct {
1288 /* Size of key and val, based on the map type. Strings are represented as '0'
1289 * because they must be handled specially. */
1290 char key_size;
1291 char val_size;
1292
1293 upb_strtable table;
1294 } upb_map;
1295
1296 /* Map entries aren't actually stored, they are only used during parsing. For
1297 * parsing, it helps a lot if all map entry messages have the same layout.
1298 * The compiler and def.c must ensure that all map entries have this layout. */
1299 typedef struct {
1300 upb_msg_internal internal;
1301 union {
1302 upb_strview str; /* For str/bytes. */
1303 upb_value val; /* For all other types. */
1304 } k;
1305 union {
1306 upb_strview str; /* For str/bytes. */
1307 upb_value val; /* For all other types. */
1308 } v;
1309 } upb_map_entry;
1310
1311 /* Creates a new map on the given arena with this key/value type. */
1312 upb_map *_upb_map_new(upb_arena *a, size_t key_size, size_t value_size);
1313
1314 /* Converting between internal table representation and user values.
1315 *
1316 * _upb_map_tokey() and _upb_map_fromkey() are inverses.
1317 * _upb_map_tovalue() and _upb_map_fromvalue() are inverses.
1318 *
1319 * These functions account for the fact that strings are treated differently
1320 * from other types when stored in a map.
1321 */
1322
_upb_map_tokey(const void * key,size_t size)1323 UPB_INLINE upb_strview _upb_map_tokey(const void *key, size_t size) {
1324 if (size == UPB_MAPTYPE_STRING) {
1325 return *(upb_strview*)key;
1326 } else {
1327 return upb_strview_make((const char*)key, size);
1328 }
1329 }
1330
_upb_map_fromkey(upb_strview key,void * out,size_t size)1331 UPB_INLINE void _upb_map_fromkey(upb_strview key, void* out, size_t size) {
1332 if (size == UPB_MAPTYPE_STRING) {
1333 memcpy(out, &key, sizeof(key));
1334 } else {
1335 memcpy(out, key.data, size);
1336 }
1337 }
1338
_upb_map_tovalue(const void * val,size_t size,upb_value * msgval,upb_arena * a)1339 UPB_INLINE bool _upb_map_tovalue(const void *val, size_t size, upb_value *msgval,
1340 upb_arena *a) {
1341 if (size == UPB_MAPTYPE_STRING) {
1342 upb_strview *strp = (upb_strview*)upb_arena_malloc(a, sizeof(*strp));
1343 if (!strp) return false;
1344 *strp = *(upb_strview*)val;
1345 *msgval = upb_value_ptr(strp);
1346 } else {
1347 memcpy(msgval, val, size);
1348 }
1349 return true;
1350 }
1351
_upb_map_fromvalue(upb_value val,void * out,size_t size)1352 UPB_INLINE void _upb_map_fromvalue(upb_value val, void* out, size_t size) {
1353 if (size == UPB_MAPTYPE_STRING) {
1354 const upb_strview *strp = (const upb_strview*)upb_value_getptr(val);
1355 memcpy(out, strp, sizeof(upb_strview));
1356 } else {
1357 memcpy(out, &val, size);
1358 }
1359 }
1360
1361 /* Map operations, shared by reflection and generated code. */
1362
_upb_map_size(const upb_map * map)1363 UPB_INLINE size_t _upb_map_size(const upb_map *map) {
1364 return map->table.t.count;
1365 }
1366
_upb_map_get(const upb_map * map,const void * key,size_t key_size,void * val,size_t val_size)1367 UPB_INLINE bool _upb_map_get(const upb_map *map, const void *key,
1368 size_t key_size, void *val, size_t val_size) {
1369 upb_value tabval;
1370 upb_strview k = _upb_map_tokey(key, key_size);
1371 bool ret = upb_strtable_lookup2(&map->table, k.data, k.size, &tabval);
1372 if (ret && val) {
1373 _upb_map_fromvalue(tabval, val, val_size);
1374 }
1375 return ret;
1376 }
1377
_upb_map_next(const upb_map * map,size_t * iter)1378 UPB_INLINE void* _upb_map_next(const upb_map *map, size_t *iter) {
1379 upb_strtable_iter it;
1380 it.t = &map->table;
1381 it.index = *iter;
1382 upb_strtable_next(&it);
1383 *iter = it.index;
1384 if (upb_strtable_done(&it)) return NULL;
1385 return (void*)str_tabent(&it);
1386 }
1387
_upb_map_set(upb_map * map,const void * key,size_t key_size,void * val,size_t val_size,upb_arena * arena)1388 UPB_INLINE bool _upb_map_set(upb_map *map, const void *key, size_t key_size,
1389 void *val, size_t val_size, upb_arena *arena) {
1390 upb_strview strkey = _upb_map_tokey(key, key_size);
1391 upb_value tabval = {0};
1392 if (!_upb_map_tovalue(val, val_size, &tabval, arena)) return false;
1393 upb_alloc *a = upb_arena_alloc(arena);
1394
1395 /* TODO(haberman): add overwrite operation to minimize number of lookups. */
1396 upb_strtable_remove3(&map->table, strkey.data, strkey.size, NULL, a);
1397 return upb_strtable_insert3(&map->table, strkey.data, strkey.size, tabval, a);
1398 }
1399
_upb_map_delete(upb_map * map,const void * key,size_t key_size)1400 UPB_INLINE bool _upb_map_delete(upb_map *map, const void *key, size_t key_size) {
1401 upb_strview k = _upb_map_tokey(key, key_size);
1402 return upb_strtable_remove3(&map->table, k.data, k.size, NULL, NULL);
1403 }
1404
_upb_map_clear(upb_map * map)1405 UPB_INLINE void _upb_map_clear(upb_map *map) {
1406 upb_strtable_clear(&map->table);
1407 }
1408
1409 /* Message map operations, these get the map from the message first. */
1410
_upb_msg_map_size(const upb_msg * msg,size_t ofs)1411 UPB_INLINE size_t _upb_msg_map_size(const upb_msg *msg, size_t ofs) {
1412 upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
1413 return map ? _upb_map_size(map) : 0;
1414 }
1415
_upb_msg_map_get(const upb_msg * msg,size_t ofs,const void * key,size_t key_size,void * val,size_t val_size)1416 UPB_INLINE bool _upb_msg_map_get(const upb_msg *msg, size_t ofs,
1417 const void *key, size_t key_size, void *val,
1418 size_t val_size) {
1419 upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
1420 if (!map) return false;
1421 return _upb_map_get(map, key, key_size, val, val_size);
1422 }
1423
_upb_msg_map_next(const upb_msg * msg,size_t ofs,size_t * iter)1424 UPB_INLINE void *_upb_msg_map_next(const upb_msg *msg, size_t ofs,
1425 size_t *iter) {
1426 upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
1427 if (!map) return NULL;
1428 return _upb_map_next(map, iter);
1429 }
1430
_upb_msg_map_set(upb_msg * msg,size_t ofs,const void * key,size_t key_size,void * val,size_t val_size,upb_arena * arena)1431 UPB_INLINE bool _upb_msg_map_set(upb_msg *msg, size_t ofs, const void *key,
1432 size_t key_size, void *val, size_t val_size,
1433 upb_arena *arena) {
1434 upb_map **map = PTR_AT(msg, ofs, upb_map *);
1435 if (!*map) {
1436 *map = _upb_map_new(arena, key_size, val_size);
1437 }
1438 return _upb_map_set(*map, key, key_size, val, val_size, arena);
1439 }
1440
_upb_msg_map_delete(upb_msg * msg,size_t ofs,const void * key,size_t key_size)1441 UPB_INLINE bool _upb_msg_map_delete(upb_msg *msg, size_t ofs, const void *key,
1442 size_t key_size) {
1443 upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
1444 if (!map) return false;
1445 return _upb_map_delete(map, key, key_size);
1446 }
1447
_upb_msg_map_clear(upb_msg * msg,size_t ofs)1448 UPB_INLINE void _upb_msg_map_clear(upb_msg *msg, size_t ofs) {
1449 upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
1450 if (!map) return;
1451 _upb_map_clear(map);
1452 }
1453
1454 /* Accessing map key/value from a pointer, used by generated code only. */
1455
_upb_msg_map_key(const void * msg,void * key,size_t size)1456 UPB_INLINE void _upb_msg_map_key(const void* msg, void* key, size_t size) {
1457 const upb_tabent *ent = (const upb_tabent*)msg;
1458 uint32_t u32len;
1459 upb_strview k;
1460 k.data = upb_tabstr(ent->key, &u32len);
1461 k.size = u32len;
1462 _upb_map_fromkey(k, key, size);
1463 }
1464
_upb_msg_map_value(const void * msg,void * val,size_t size)1465 UPB_INLINE void _upb_msg_map_value(const void* msg, void* val, size_t size) {
1466 const upb_tabent *ent = (const upb_tabent*)msg;
1467 upb_value v;
1468 _upb_value_setval(&v, ent->val.val);
1469 _upb_map_fromvalue(v, val, size);
1470 }
1471
_upb_msg_map_set_value(void * msg,const void * val,size_t size)1472 UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val, size_t size) {
1473 upb_tabent *ent = (upb_tabent*)msg;
1474 /* This is like _upb_map_tovalue() except the entry already exists so we can
1475 * reuse the allocated upb_strview for string fields. */
1476 if (size == UPB_MAPTYPE_STRING) {
1477 upb_strview *strp = (upb_strview*)(uintptr_t)ent->val.val;
1478 memcpy(strp, val, sizeof(*strp));
1479 } else {
1480 memcpy(&ent->val.val, val, size);
1481 }
1482 }
1483
1484 #undef PTR_AT
1485
1486 #ifdef __cplusplus
1487 } /* extern "C" */
1488 #endif
1489
1490
1491 #endif /* UPB_MSG_H_ */
1492
1493 #ifdef __cplusplus
1494 extern "C" {
1495 #endif
1496
1497 bool upb_decode(const char *buf, size_t size, upb_msg *msg,
1498 const upb_msglayout *l, upb_arena *arena);
1499
1500 #ifdef __cplusplus
1501 } /* extern "C" */
1502 #endif
1503
1504 #endif /* UPB_DECODE_H_ */
1505
1506 #ifndef UPB_INT_H_
1507 #define UPB_INT_H_
1508
1509
1510 struct mem_block;
1511 typedef struct mem_block mem_block;
1512
1513 struct upb_arena {
1514 _upb_arena_head head;
1515 uint32_t *cleanups;
1516
1517 /* Allocator to allocate arena blocks. We are responsible for freeing these
1518 * when we are destroyed. */
1519 upb_alloc *block_alloc;
1520 uint32_t last_size;
1521
1522 /* When multiple arenas are fused together, each arena points to a parent
1523 * arena (root points to itself). The root tracks how many live arenas
1524 * reference it. */
1525 uint32_t refcount; /* Only used when a->parent == a */
1526 struct upb_arena *parent;
1527
1528 /* Linked list of blocks to free/cleanup. */
1529 mem_block *freelist, *freelist_tail;
1530 };
1531
1532 #endif /* UPB_INT_H_ */
1533 /*
1534 ** upb_encode: parsing into a upb_msg using a upb_msglayout.
1535 */
1536
1537 #ifndef UPB_ENCODE_H_
1538 #define UPB_ENCODE_H_
1539
1540
1541 #ifdef __cplusplus
1542 extern "C" {
1543 #endif
1544
1545 char *upb_encode(const void *msg, const upb_msglayout *l, upb_arena *arena,
1546 size_t *size);
1547
1548 #ifdef __cplusplus
1549 } /* extern "C" */
1550 #endif
1551
1552 #endif /* UPB_ENCODE_H_ */
1553 /* This file was generated by upbc (the upb compiler) from the input
1554 * file:
1555 *
1556 * google/protobuf/descriptor.proto
1557 *
1558 * Do not edit -- your changes will be discarded when the file is
1559 * regenerated. */
1560
1561 #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
1562 #define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
1563
1564
1565
1566 #ifdef __cplusplus
1567 extern "C" {
1568 #endif
1569
1570 struct google_protobuf_FileDescriptorSet;
1571 struct google_protobuf_FileDescriptorProto;
1572 struct google_protobuf_DescriptorProto;
1573 struct google_protobuf_DescriptorProto_ExtensionRange;
1574 struct google_protobuf_DescriptorProto_ReservedRange;
1575 struct google_protobuf_ExtensionRangeOptions;
1576 struct google_protobuf_FieldDescriptorProto;
1577 struct google_protobuf_OneofDescriptorProto;
1578 struct google_protobuf_EnumDescriptorProto;
1579 struct google_protobuf_EnumDescriptorProto_EnumReservedRange;
1580 struct google_protobuf_EnumValueDescriptorProto;
1581 struct google_protobuf_ServiceDescriptorProto;
1582 struct google_protobuf_MethodDescriptorProto;
1583 struct google_protobuf_FileOptions;
1584 struct google_protobuf_MessageOptions;
1585 struct google_protobuf_FieldOptions;
1586 struct google_protobuf_OneofOptions;
1587 struct google_protobuf_EnumOptions;
1588 struct google_protobuf_EnumValueOptions;
1589 struct google_protobuf_ServiceOptions;
1590 struct google_protobuf_MethodOptions;
1591 struct google_protobuf_UninterpretedOption;
1592 struct google_protobuf_UninterpretedOption_NamePart;
1593 struct google_protobuf_SourceCodeInfo;
1594 struct google_protobuf_SourceCodeInfo_Location;
1595 struct google_protobuf_GeneratedCodeInfo;
1596 struct google_protobuf_GeneratedCodeInfo_Annotation;
1597 typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet;
1598 typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto;
1599 typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto;
1600 typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange;
1601 typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange;
1602 typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions;
1603 typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto;
1604 typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto;
1605 typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto;
1606 typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange;
1607 typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto;
1608 typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto;
1609 typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto;
1610 typedef struct google_protobuf_FileOptions google_protobuf_FileOptions;
1611 typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions;
1612 typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions;
1613 typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions;
1614 typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions;
1615 typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions;
1616 typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions;
1617 typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions;
1618 typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption;
1619 typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart;
1620 typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo;
1621 typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location;
1622 typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo;
1623 typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation;
1624 extern const upb_msglayout google_protobuf_FileDescriptorSet_msginit;
1625 extern const upb_msglayout google_protobuf_FileDescriptorProto_msginit;
1626 extern const upb_msglayout google_protobuf_DescriptorProto_msginit;
1627 extern const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit;
1628 extern const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit;
1629 extern const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit;
1630 extern const upb_msglayout google_protobuf_FieldDescriptorProto_msginit;
1631 extern const upb_msglayout google_protobuf_OneofDescriptorProto_msginit;
1632 extern const upb_msglayout google_protobuf_EnumDescriptorProto_msginit;
1633 extern const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit;
1634 extern const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit;
1635 extern const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit;
1636 extern const upb_msglayout google_protobuf_MethodDescriptorProto_msginit;
1637 extern const upb_msglayout google_protobuf_FileOptions_msginit;
1638 extern const upb_msglayout google_protobuf_MessageOptions_msginit;
1639 extern const upb_msglayout google_protobuf_FieldOptions_msginit;
1640 extern const upb_msglayout google_protobuf_OneofOptions_msginit;
1641 extern const upb_msglayout google_protobuf_EnumOptions_msginit;
1642 extern const upb_msglayout google_protobuf_EnumValueOptions_msginit;
1643 extern const upb_msglayout google_protobuf_ServiceOptions_msginit;
1644 extern const upb_msglayout google_protobuf_MethodOptions_msginit;
1645 extern const upb_msglayout google_protobuf_UninterpretedOption_msginit;
1646 extern const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit;
1647 extern const upb_msglayout google_protobuf_SourceCodeInfo_msginit;
1648 extern const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit;
1649 extern const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit;
1650 extern const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit;
1651
1652 typedef enum {
1653 google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1,
1654 google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2,
1655 google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3
1656 } google_protobuf_FieldDescriptorProto_Label;
1657
1658 typedef enum {
1659 google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1,
1660 google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2,
1661 google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3,
1662 google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4,
1663 google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5,
1664 google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6,
1665 google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7,
1666 google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8,
1667 google_protobuf_FieldDescriptorProto_TYPE_STRING = 9,
1668 google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10,
1669 google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11,
1670 google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12,
1671 google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13,
1672 google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14,
1673 google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15,
1674 google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16,
1675 google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17,
1676 google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18
1677 } google_protobuf_FieldDescriptorProto_Type;
1678
1679 typedef enum {
1680 google_protobuf_FieldOptions_STRING = 0,
1681 google_protobuf_FieldOptions_CORD = 1,
1682 google_protobuf_FieldOptions_STRING_PIECE = 2
1683 } google_protobuf_FieldOptions_CType;
1684
1685 typedef enum {
1686 google_protobuf_FieldOptions_JS_NORMAL = 0,
1687 google_protobuf_FieldOptions_JS_STRING = 1,
1688 google_protobuf_FieldOptions_JS_NUMBER = 2
1689 } google_protobuf_FieldOptions_JSType;
1690
1691 typedef enum {
1692 google_protobuf_FileOptions_SPEED = 1,
1693 google_protobuf_FileOptions_CODE_SIZE = 2,
1694 google_protobuf_FileOptions_LITE_RUNTIME = 3
1695 } google_protobuf_FileOptions_OptimizeMode;
1696
1697 typedef enum {
1698 google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0,
1699 google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1,
1700 google_protobuf_MethodOptions_IDEMPOTENT = 2
1701 } google_protobuf_MethodOptions_IdempotencyLevel;
1702
1703
1704 /* google.protobuf.FileDescriptorSet */
1705
google_protobuf_FileDescriptorSet_new(upb_arena * arena)1706 UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_new(upb_arena *arena) {
1707 return (google_protobuf_FileDescriptorSet *)_upb_msg_new(&google_protobuf_FileDescriptorSet_msginit, arena);
1708 }
google_protobuf_FileDescriptorSet_parse(const char * buf,size_t size,upb_arena * arena)1709 UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parse(const char *buf, size_t size,
1710 upb_arena *arena) {
1711 google_protobuf_FileDescriptorSet *ret = google_protobuf_FileDescriptorSet_new(arena);
1712 return (ret && upb_decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msginit, arena)) ? ret : NULL;
1713 }
google_protobuf_FileDescriptorSet_serialize(const google_protobuf_FileDescriptorSet * msg,upb_arena * arena,size_t * len)1714 UPB_INLINE char *google_protobuf_FileDescriptorSet_serialize(const google_protobuf_FileDescriptorSet *msg, upb_arena *arena, size_t *len) {
1715 return upb_encode(msg, &google_protobuf_FileDescriptorSet_msginit, arena, len);
1716 }
1717
google_protobuf_FileDescriptorSet_has_file(const google_protobuf_FileDescriptorSet * msg)1718 UPB_INLINE bool google_protobuf_FileDescriptorSet_has_file(const google_protobuf_FileDescriptorSet *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(0, 0)); }
google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet * msg,size_t * len)1719 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); }
1720
google_protobuf_FileDescriptorSet_mutable_file(google_protobuf_FileDescriptorSet * msg,size_t * len)1721 UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_mutable_file(google_protobuf_FileDescriptorSet *msg, size_t *len) {
1722 return (google_protobuf_FileDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
1723 }
google_protobuf_FileDescriptorSet_resize_file(google_protobuf_FileDescriptorSet * msg,size_t len,upb_arena * arena)1724 UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_resize_file(google_protobuf_FileDescriptorSet *msg, size_t len, upb_arena *arena) {
1725 return (google_protobuf_FileDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena);
1726 }
google_protobuf_FileDescriptorSet_add_file(google_protobuf_FileDescriptorSet * msg,upb_arena * arena)1727 UPB_INLINE struct google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorSet_add_file(google_protobuf_FileDescriptorSet *msg, upb_arena *arena) {
1728 struct google_protobuf_FileDescriptorProto* sub = (struct google_protobuf_FileDescriptorProto*)_upb_msg_new(&google_protobuf_FileDescriptorProto_msginit, arena);
1729 bool ok = _upb_array_append_accessor2(
1730 msg, UPB_SIZE(0, 0), UPB_SIZE(2, 3), &sub, arena);
1731 if (!ok) return NULL;
1732 return sub;
1733 }
1734
1735 /* google.protobuf.FileDescriptorProto */
1736
google_protobuf_FileDescriptorProto_new(upb_arena * arena)1737 UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_new(upb_arena *arena) {
1738 return (google_protobuf_FileDescriptorProto *)_upb_msg_new(&google_protobuf_FileDescriptorProto_msginit, arena);
1739 }
google_protobuf_FileDescriptorProto_parse(const char * buf,size_t size,upb_arena * arena)1740 UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parse(const char *buf, size_t size,
1741 upb_arena *arena) {
1742 google_protobuf_FileDescriptorProto *ret = google_protobuf_FileDescriptorProto_new(arena);
1743 return (ret && upb_decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msginit, arena)) ? ret : NULL;
1744 }
google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto * msg,upb_arena * arena,size_t * len)1745 UPB_INLINE char *google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto *msg, upb_arena *arena, size_t *len) {
1746 return upb_encode(msg, &google_protobuf_FileDescriptorProto_msginit, arena, len);
1747 }
1748
google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto * msg)1749 UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto * msg)1750 UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto * msg)1751 UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto * msg)1752 UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview); }
google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto * msg,size_t * len)1753 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); }
google_protobuf_FileDescriptorProto_has_message_type(const google_protobuf_FileDescriptorProto * msg)1754 UPB_INLINE bool google_protobuf_FileDescriptorProto_has_message_type(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(40, 80)); }
google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto * msg,size_t * len)1755 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); }
google_protobuf_FileDescriptorProto_has_enum_type(const google_protobuf_FileDescriptorProto * msg)1756 UPB_INLINE bool google_protobuf_FileDescriptorProto_has_enum_type(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(44, 88)); }
google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto * msg,size_t * len)1757 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); }
google_protobuf_FileDescriptorProto_has_service(const google_protobuf_FileDescriptorProto * msg)1758 UPB_INLINE bool google_protobuf_FileDescriptorProto_has_service(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(48, 96)); }
google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto * msg,size_t * len)1759 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); }
google_protobuf_FileDescriptorProto_has_extension(const google_protobuf_FileDescriptorProto * msg)1760 UPB_INLINE bool google_protobuf_FileDescriptorProto_has_extension(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(52, 104)); }
google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto * msg,size_t * len)1761 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); }
google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto * msg)1762 UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 4); }
google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto * msg)1763 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*); }
google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto * msg)1764 UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 5); }
google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto * msg)1765 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*); }
google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto * msg,size_t * len)1766 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); }
google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto * msg,size_t * len)1767 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); }
google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto * msg)1768 UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 3); }
google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto * msg)1769 UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(20, 40), upb_strview); }
1770
google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto * msg,upb_strview value)1771 UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_strview value) {
1772 _upb_sethas(msg, 1);
1773 *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
1774 }
google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto * msg,upb_strview value)1775 UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_strview value) {
1776 _upb_sethas(msg, 2);
1777 *UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview) = value;
1778 }
google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto * msg,size_t * len)1779 UPB_INLINE upb_strview* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) {
1780 return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 72), len);
1781 }
google_protobuf_FileDescriptorProto_resize_dependency(google_protobuf_FileDescriptorProto * msg,size_t len,upb_arena * arena)1782 UPB_INLINE upb_strview* google_protobuf_FileDescriptorProto_resize_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
1783 return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(36, 72), len, UPB_SIZE(3, 4), arena);
1784 }
google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto * msg,upb_strview val,upb_arena * arena)1785 UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto *msg, upb_strview val, upb_arena *arena) {
1786 return _upb_array_append_accessor2(msg, UPB_SIZE(36, 72), UPB_SIZE(3, 4), &val,
1787 arena);
1788 }
google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto * msg,size_t * len)1789 UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto *msg, size_t *len) {
1790 return (google_protobuf_DescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 80), len);
1791 }
google_protobuf_FileDescriptorProto_resize_message_type(google_protobuf_FileDescriptorProto * msg,size_t len,upb_arena * arena)1792 UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_resize_message_type(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
1793 return (google_protobuf_DescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(40, 80), len, UPB_SIZE(2, 3), arena);
1794 }
google_protobuf_FileDescriptorProto_add_message_type(google_protobuf_FileDescriptorProto * msg,upb_arena * arena)1795 UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescriptorProto_add_message_type(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
1796 struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)_upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena);
1797 bool ok = _upb_array_append_accessor2(
1798 msg, UPB_SIZE(40, 80), UPB_SIZE(2, 3), &sub, arena);
1799 if (!ok) return NULL;
1800 return sub;
1801 }
google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto * msg,size_t * len)1802 UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto *msg, size_t *len) {
1803 return (google_protobuf_EnumDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 88), len);
1804 }
google_protobuf_FileDescriptorProto_resize_enum_type(google_protobuf_FileDescriptorProto * msg,size_t len,upb_arena * arena)1805 UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_resize_enum_type(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
1806 return (google_protobuf_EnumDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(44, 88), len, UPB_SIZE(2, 3), arena);
1807 }
google_protobuf_FileDescriptorProto_add_enum_type(google_protobuf_FileDescriptorProto * msg,upb_arena * arena)1808 UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescriptorProto_add_enum_type(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
1809 struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)_upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena);
1810 bool ok = _upb_array_append_accessor2(
1811 msg, UPB_SIZE(44, 88), UPB_SIZE(2, 3), &sub, arena);
1812 if (!ok) return NULL;
1813 return sub;
1814 }
google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto * msg,size_t * len)1815 UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto *msg, size_t *len) {
1816 return (google_protobuf_ServiceDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(48, 96), len);
1817 }
google_protobuf_FileDescriptorProto_resize_service(google_protobuf_FileDescriptorProto * msg,size_t len,upb_arena * arena)1818 UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_resize_service(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
1819 return (google_protobuf_ServiceDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(48, 96), len, UPB_SIZE(2, 3), arena);
1820 }
google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto * msg,upb_arena * arena)1821 UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
1822 struct google_protobuf_ServiceDescriptorProto* sub = (struct google_protobuf_ServiceDescriptorProto*)_upb_msg_new(&google_protobuf_ServiceDescriptorProto_msginit, arena);
1823 bool ok = _upb_array_append_accessor2(
1824 msg, UPB_SIZE(48, 96), UPB_SIZE(2, 3), &sub, arena);
1825 if (!ok) return NULL;
1826 return sub;
1827 }
google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto * msg,size_t * len)1828 UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto *msg, size_t *len) {
1829 return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(52, 104), len);
1830 }
google_protobuf_FileDescriptorProto_resize_extension(google_protobuf_FileDescriptorProto * msg,size_t len,upb_arena * arena)1831 UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_resize_extension(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
1832 return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(52, 104), len, UPB_SIZE(2, 3), arena);
1833 }
google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto * msg,upb_arena * arena)1834 UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
1835 struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
1836 bool ok = _upb_array_append_accessor2(
1837 msg, UPB_SIZE(52, 104), UPB_SIZE(2, 3), &sub, arena);
1838 if (!ok) return NULL;
1839 return sub;
1840 }
google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto * msg,google_protobuf_FileOptions * value)1841 UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) {
1842 _upb_sethas(msg, 4);
1843 *UPB_PTR_AT(msg, UPB_SIZE(28, 56), google_protobuf_FileOptions*) = value;
1844 }
google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto * msg,upb_arena * arena)1845 UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
1846 struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg);
1847 if (sub == NULL) {
1848 sub = (struct google_protobuf_FileOptions*)_upb_msg_new(&google_protobuf_FileOptions_msginit, arena);
1849 if (!sub) return NULL;
1850 google_protobuf_FileDescriptorProto_set_options(msg, sub);
1851 }
1852 return sub;
1853 }
google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto * msg,google_protobuf_SourceCodeInfo * value)1854 UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) {
1855 _upb_sethas(msg, 5);
1856 *UPB_PTR_AT(msg, UPB_SIZE(32, 64), google_protobuf_SourceCodeInfo*) = value;
1857 }
google_protobuf_FileDescriptorProto_mutable_source_code_info(google_protobuf_FileDescriptorProto * msg,upb_arena * arena)1858 UPB_INLINE struct google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_mutable_source_code_info(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
1859 struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg);
1860 if (sub == NULL) {
1861 sub = (struct google_protobuf_SourceCodeInfo*)_upb_msg_new(&google_protobuf_SourceCodeInfo_msginit, arena);
1862 if (!sub) return NULL;
1863 google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub);
1864 }
1865 return sub;
1866 }
google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto * msg,size_t * len)1867 UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) {
1868 return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(56, 112), len);
1869 }
google_protobuf_FileDescriptorProto_resize_public_dependency(google_protobuf_FileDescriptorProto * msg,size_t len,upb_arena * arena)1870 UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_public_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
1871 return (int32_t*)_upb_array_resize_accessor2(msg, UPB_SIZE(56, 112), len, 2, arena);
1872 }
google_protobuf_FileDescriptorProto_add_public_dependency(google_protobuf_FileDescriptorProto * msg,int32_t val,upb_arena * arena)1873 UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google_protobuf_FileDescriptorProto *msg, int32_t val, upb_arena *arena) {
1874 return _upb_array_append_accessor2(msg, UPB_SIZE(56, 112), 2, &val,
1875 arena);
1876 }
google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto * msg,size_t * len)1877 UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) {
1878 return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(60, 120), len);
1879 }
google_protobuf_FileDescriptorProto_resize_weak_dependency(google_protobuf_FileDescriptorProto * msg,size_t len,upb_arena * arena)1880 UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_weak_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
1881 return (int32_t*)_upb_array_resize_accessor2(msg, UPB_SIZE(60, 120), len, 2, arena);
1882 }
google_protobuf_FileDescriptorProto_add_weak_dependency(google_protobuf_FileDescriptorProto * msg,int32_t val,upb_arena * arena)1883 UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_protobuf_FileDescriptorProto *msg, int32_t val, upb_arena *arena) {
1884 return _upb_array_append_accessor2(msg, UPB_SIZE(60, 120), 2, &val,
1885 arena);
1886 }
google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto * msg,upb_strview value)1887 UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_strview value) {
1888 _upb_sethas(msg, 3);
1889 *UPB_PTR_AT(msg, UPB_SIZE(20, 40), upb_strview) = value;
1890 }
1891
1892 /* google.protobuf.DescriptorProto */
1893
google_protobuf_DescriptorProto_new(upb_arena * arena)1894 UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_new(upb_arena *arena) {
1895 return (google_protobuf_DescriptorProto *)_upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena);
1896 }
google_protobuf_DescriptorProto_parse(const char * buf,size_t size,upb_arena * arena)1897 UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parse(const char *buf, size_t size,
1898 upb_arena *arena) {
1899 google_protobuf_DescriptorProto *ret = google_protobuf_DescriptorProto_new(arena);
1900 return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_msginit, arena)) ? ret : NULL;
1901 }
google_protobuf_DescriptorProto_serialize(const google_protobuf_DescriptorProto * msg,upb_arena * arena,size_t * len)1902 UPB_INLINE char *google_protobuf_DescriptorProto_serialize(const google_protobuf_DescriptorProto *msg, upb_arena *arena, size_t *len) {
1903 return upb_encode(msg, &google_protobuf_DescriptorProto_msginit, arena, len);
1904 }
1905
google_protobuf_DescriptorProto_has_name(const google_protobuf_DescriptorProto * msg)1906 UPB_INLINE bool google_protobuf_DescriptorProto_has_name(const google_protobuf_DescriptorProto *msg) { return _upb_hasbit(msg, 1); }
google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto * msg)1907 UPB_INLINE upb_strview google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
google_protobuf_DescriptorProto_has_field(const google_protobuf_DescriptorProto * msg)1908 UPB_INLINE bool google_protobuf_DescriptorProto_has_field(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(16, 32)); }
google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto * msg,size_t * len)1909 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); }
google_protobuf_DescriptorProto_has_nested_type(const google_protobuf_DescriptorProto * msg)1910 UPB_INLINE bool google_protobuf_DescriptorProto_has_nested_type(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(20, 40)); }
google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto * msg,size_t * len)1911 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); }
google_protobuf_DescriptorProto_has_enum_type(const google_protobuf_DescriptorProto * msg)1912 UPB_INLINE bool google_protobuf_DescriptorProto_has_enum_type(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(24, 48)); }
google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto * msg,size_t * len)1913 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); }
google_protobuf_DescriptorProto_has_extension_range(const google_protobuf_DescriptorProto * msg)1914 UPB_INLINE bool google_protobuf_DescriptorProto_has_extension_range(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(28, 56)); }
google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto * msg,size_t * len)1915 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); }
google_protobuf_DescriptorProto_has_extension(const google_protobuf_DescriptorProto * msg)1916 UPB_INLINE bool google_protobuf_DescriptorProto_has_extension(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(32, 64)); }
google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto * msg,size_t * len)1917 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); }
google_protobuf_DescriptorProto_has_options(const google_protobuf_DescriptorProto * msg)1918 UPB_INLINE bool google_protobuf_DescriptorProto_has_options(const google_protobuf_DescriptorProto *msg) { return _upb_hasbit(msg, 2); }
google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto * msg)1919 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*); }
google_protobuf_DescriptorProto_has_oneof_decl(const google_protobuf_DescriptorProto * msg)1920 UPB_INLINE bool google_protobuf_DescriptorProto_has_oneof_decl(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(36, 72)); }
google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto * msg,size_t * len)1921 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); }
google_protobuf_DescriptorProto_has_reserved_range(const google_protobuf_DescriptorProto * msg)1922 UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_range(const google_protobuf_DescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(40, 80)); }
google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto * msg,size_t * len)1923 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); }
google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto * msg,size_t * len)1924 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); }
1925
google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto * msg,upb_strview value)1926 UPB_INLINE void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_strview value) {
1927 _upb_sethas(msg, 1);
1928 *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
1929 }
google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto * msg,size_t * len)1930 UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto *msg, size_t *len) {
1931 return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
1932 }
google_protobuf_DescriptorProto_resize_field(google_protobuf_DescriptorProto * msg,size_t len,upb_arena * arena)1933 UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_field(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
1934 return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(16, 32), len, UPB_SIZE(2, 3), arena);
1935 }
google_protobuf_DescriptorProto_add_field(google_protobuf_DescriptorProto * msg,upb_arena * arena)1936 UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_field(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
1937 struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
1938 bool ok = _upb_array_append_accessor2(
1939 msg, UPB_SIZE(16, 32), UPB_SIZE(2, 3), &sub, arena);
1940 if (!ok) return NULL;
1941 return sub;
1942 }
google_protobuf_DescriptorProto_mutable_nested_type(google_protobuf_DescriptorProto * msg,size_t * len)1943 UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_mutable_nested_type(google_protobuf_DescriptorProto *msg, size_t *len) {
1944 return (google_protobuf_DescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
1945 }
google_protobuf_DescriptorProto_resize_nested_type(google_protobuf_DescriptorProto * msg,size_t len,upb_arena * arena)1946 UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_resize_nested_type(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
1947 return (google_protobuf_DescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(20, 40), len, UPB_SIZE(2, 3), arena);
1948 }
google_protobuf_DescriptorProto_add_nested_type(google_protobuf_DescriptorProto * msg,upb_arena * arena)1949 UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_add_nested_type(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
1950 struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)_upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena);
1951 bool ok = _upb_array_append_accessor2(
1952 msg, UPB_SIZE(20, 40), UPB_SIZE(2, 3), &sub, arena);
1953 if (!ok) return NULL;
1954 return sub;
1955 }
google_protobuf_DescriptorProto_mutable_enum_type(google_protobuf_DescriptorProto * msg,size_t * len)1956 UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_mutable_enum_type(google_protobuf_DescriptorProto *msg, size_t *len) {
1957 return (google_protobuf_EnumDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
1958 }
google_protobuf_DescriptorProto_resize_enum_type(google_protobuf_DescriptorProto * msg,size_t len,upb_arena * arena)1959 UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_resize_enum_type(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
1960 return (google_protobuf_EnumDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(24, 48), len, UPB_SIZE(2, 3), arena);
1961 }
google_protobuf_DescriptorProto_add_enum_type(google_protobuf_DescriptorProto * msg,upb_arena * arena)1962 UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_DescriptorProto_add_enum_type(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
1963 struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)_upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena);
1964 bool ok = _upb_array_append_accessor2(
1965 msg, UPB_SIZE(24, 48), UPB_SIZE(2, 3), &sub, arena);
1966 if (!ok) return NULL;
1967 return sub;
1968 }
google_protobuf_DescriptorProto_mutable_extension_range(google_protobuf_DescriptorProto * msg,size_t * len)1969 UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_mutable_extension_range(google_protobuf_DescriptorProto *msg, size_t *len) {
1970 return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len);
1971 }
google_protobuf_DescriptorProto_resize_extension_range(google_protobuf_DescriptorProto * msg,size_t len,upb_arena * arena)1972 UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_resize_extension_range(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
1973 return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_resize_accessor2(msg, UPB_SIZE(28, 56), len, UPB_SIZE(2, 3), arena);
1974 }
google_protobuf_DescriptorProto_add_extension_range(google_protobuf_DescriptorProto * msg,upb_arena * arena)1975 UPB_INLINE struct google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_add_extension_range(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
1976 struct google_protobuf_DescriptorProto_ExtensionRange* sub = (struct google_protobuf_DescriptorProto_ExtensionRange*)_upb_msg_new(&google_protobuf_DescriptorProto_ExtensionRange_msginit, arena);
1977 bool ok = _upb_array_append_accessor2(
1978 msg, UPB_SIZE(28, 56), UPB_SIZE(2, 3), &sub, arena);
1979 if (!ok) return NULL;
1980 return sub;
1981 }
google_protobuf_DescriptorProto_mutable_extension(google_protobuf_DescriptorProto * msg,size_t * len)1982 UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_extension(google_protobuf_DescriptorProto *msg, size_t *len) {
1983 return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 64), len);
1984 }
google_protobuf_DescriptorProto_resize_extension(google_protobuf_DescriptorProto * msg,size_t len,upb_arena * arena)1985 UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_extension(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
1986 return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(32, 64), len, UPB_SIZE(2, 3), arena);
1987 }
google_protobuf_DescriptorProto_add_extension(google_protobuf_DescriptorProto * msg,upb_arena * arena)1988 UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_extension(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
1989 struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
1990 bool ok = _upb_array_append_accessor2(
1991 msg, UPB_SIZE(32, 64), UPB_SIZE(2, 3), &sub, arena);
1992 if (!ok) return NULL;
1993 return sub;
1994 }
google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto * msg,google_protobuf_MessageOptions * value)1995 UPB_INLINE void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) {
1996 _upb_sethas(msg, 2);
1997 *UPB_PTR_AT(msg, UPB_SIZE(12, 24), google_protobuf_MessageOptions*) = value;
1998 }
google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto * msg,upb_arena * arena)1999 UPB_INLINE struct google_protobuf_MessageOptions* google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
2000 struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg);
2001 if (sub == NULL) {
2002 sub = (struct google_protobuf_MessageOptions*)_upb_msg_new(&google_protobuf_MessageOptions_msginit, arena);
2003 if (!sub) return NULL;
2004 google_protobuf_DescriptorProto_set_options(msg, sub);
2005 }
2006 return sub;
2007 }
google_protobuf_DescriptorProto_mutable_oneof_decl(google_protobuf_DescriptorProto * msg,size_t * len)2008 UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_mutable_oneof_decl(google_protobuf_DescriptorProto *msg, size_t *len) {
2009 return (google_protobuf_OneofDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 72), len);
2010 }
google_protobuf_DescriptorProto_resize_oneof_decl(google_protobuf_DescriptorProto * msg,size_t len,upb_arena * arena)2011 UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_resize_oneof_decl(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
2012 return (google_protobuf_OneofDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(36, 72), len, UPB_SIZE(2, 3), arena);
2013 }
google_protobuf_DescriptorProto_add_oneof_decl(google_protobuf_DescriptorProto * msg,upb_arena * arena)2014 UPB_INLINE struct google_protobuf_OneofDescriptorProto* google_protobuf_DescriptorProto_add_oneof_decl(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
2015 struct google_protobuf_OneofDescriptorProto* sub = (struct google_protobuf_OneofDescriptorProto*)_upb_msg_new(&google_protobuf_OneofDescriptorProto_msginit, arena);
2016 bool ok = _upb_array_append_accessor2(
2017 msg, UPB_SIZE(36, 72), UPB_SIZE(2, 3), &sub, arena);
2018 if (!ok) return NULL;
2019 return sub;
2020 }
google_protobuf_DescriptorProto_mutable_reserved_range(google_protobuf_DescriptorProto * msg,size_t * len)2021 UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_mutable_reserved_range(google_protobuf_DescriptorProto *msg, size_t *len) {
2022 return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 80), len);
2023 }
google_protobuf_DescriptorProto_resize_reserved_range(google_protobuf_DescriptorProto * msg,size_t len,upb_arena * arena)2024 UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_resize_reserved_range(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
2025 return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_resize_accessor2(msg, UPB_SIZE(40, 80), len, UPB_SIZE(2, 3), arena);
2026 }
google_protobuf_DescriptorProto_add_reserved_range(google_protobuf_DescriptorProto * msg,upb_arena * arena)2027 UPB_INLINE struct google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_add_reserved_range(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
2028 struct google_protobuf_DescriptorProto_ReservedRange* sub = (struct google_protobuf_DescriptorProto_ReservedRange*)_upb_msg_new(&google_protobuf_DescriptorProto_ReservedRange_msginit, arena);
2029 bool ok = _upb_array_append_accessor2(
2030 msg, UPB_SIZE(40, 80), UPB_SIZE(2, 3), &sub, arena);
2031 if (!ok) return NULL;
2032 return sub;
2033 }
google_protobuf_DescriptorProto_mutable_reserved_name(google_protobuf_DescriptorProto * msg,size_t * len)2034 UPB_INLINE upb_strview* google_protobuf_DescriptorProto_mutable_reserved_name(google_protobuf_DescriptorProto *msg, size_t *len) {
2035 return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 88), len);
2036 }
google_protobuf_DescriptorProto_resize_reserved_name(google_protobuf_DescriptorProto * msg,size_t len,upb_arena * arena)2037 UPB_INLINE upb_strview* google_protobuf_DescriptorProto_resize_reserved_name(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
2038 return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(44, 88), len, UPB_SIZE(3, 4), arena);
2039 }
google_protobuf_DescriptorProto_add_reserved_name(google_protobuf_DescriptorProto * msg,upb_strview val,upb_arena * arena)2040 UPB_INLINE bool google_protobuf_DescriptorProto_add_reserved_name(google_protobuf_DescriptorProto *msg, upb_strview val, upb_arena *arena) {
2041 return _upb_array_append_accessor2(msg, UPB_SIZE(44, 88), UPB_SIZE(3, 4), &val,
2042 arena);
2043 }
2044
2045 /* google.protobuf.DescriptorProto.ExtensionRange */
2046
google_protobuf_DescriptorProto_ExtensionRange_new(upb_arena * arena)2047 UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_new(upb_arena *arena) {
2048 return (google_protobuf_DescriptorProto_ExtensionRange *)_upb_msg_new(&google_protobuf_DescriptorProto_ExtensionRange_msginit, arena);
2049 }
google_protobuf_DescriptorProto_ExtensionRange_parse(const char * buf,size_t size,upb_arena * arena)2050 UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parse(const char *buf, size_t size,
2051 upb_arena *arena) {
2052 google_protobuf_DescriptorProto_ExtensionRange *ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
2053 return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena)) ? ret : NULL;
2054 }
google_protobuf_DescriptorProto_ExtensionRange_serialize(const google_protobuf_DescriptorProto_ExtensionRange * msg,upb_arena * arena,size_t * len)2055 UPB_INLINE char *google_protobuf_DescriptorProto_ExtensionRange_serialize(const google_protobuf_DescriptorProto_ExtensionRange *msg, upb_arena *arena, size_t *len) {
2056 return upb_encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena, len);
2057 }
2058
google_protobuf_DescriptorProto_ExtensionRange_has_start(const google_protobuf_DescriptorProto_ExtensionRange * msg)2059 UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_start(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_hasbit(msg, 1); }
google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange * msg)2060 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); }
google_protobuf_DescriptorProto_ExtensionRange_has_end(const google_protobuf_DescriptorProto_ExtensionRange * msg)2061 UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_end(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_hasbit(msg, 2); }
google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange * msg)2062 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); }
google_protobuf_DescriptorProto_ExtensionRange_has_options(const google_protobuf_DescriptorProto_ExtensionRange * msg)2063 UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_options(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_hasbit(msg, 3); }
google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange * msg)2064 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*); }
2065
google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange * msg,int32_t value)2066 UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
2067 _upb_sethas(msg, 1);
2068 *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
2069 }
google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange * msg,int32_t value)2070 UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
2071 _upb_sethas(msg, 2);
2072 *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value;
2073 }
google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange * msg,google_protobuf_ExtensionRangeOptions * value)2074 UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) {
2075 _upb_sethas(msg, 3);
2076 *UPB_PTR_AT(msg, UPB_SIZE(12, 16), google_protobuf_ExtensionRangeOptions*) = value;
2077 }
google_protobuf_DescriptorProto_ExtensionRange_mutable_options(google_protobuf_DescriptorProto_ExtensionRange * msg,upb_arena * arena)2078 UPB_INLINE struct google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_mutable_options(google_protobuf_DescriptorProto_ExtensionRange *msg, upb_arena *arena) {
2079 struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg);
2080 if (sub == NULL) {
2081 sub = (struct google_protobuf_ExtensionRangeOptions*)_upb_msg_new(&google_protobuf_ExtensionRangeOptions_msginit, arena);
2082 if (!sub) return NULL;
2083 google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub);
2084 }
2085 return sub;
2086 }
2087
2088 /* google.protobuf.DescriptorProto.ReservedRange */
2089
google_protobuf_DescriptorProto_ReservedRange_new(upb_arena * arena)2090 UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_new(upb_arena *arena) {
2091 return (google_protobuf_DescriptorProto_ReservedRange *)_upb_msg_new(&google_protobuf_DescriptorProto_ReservedRange_msginit, arena);
2092 }
google_protobuf_DescriptorProto_ReservedRange_parse(const char * buf,size_t size,upb_arena * arena)2093 UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parse(const char *buf, size_t size,
2094 upb_arena *arena) {
2095 google_protobuf_DescriptorProto_ReservedRange *ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
2096 return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena)) ? ret : NULL;
2097 }
google_protobuf_DescriptorProto_ReservedRange_serialize(const google_protobuf_DescriptorProto_ReservedRange * msg,upb_arena * arena,size_t * len)2098 UPB_INLINE char *google_protobuf_DescriptorProto_ReservedRange_serialize(const google_protobuf_DescriptorProto_ReservedRange *msg, upb_arena *arena, size_t *len) {
2099 return upb_encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena, len);
2100 }
2101
google_protobuf_DescriptorProto_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange * msg)2102 UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange *msg) { return _upb_hasbit(msg, 1); }
google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange * msg)2103 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); }
google_protobuf_DescriptorProto_ReservedRange_has_end(const google_protobuf_DescriptorProto_ReservedRange * msg)2104 UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_end(const google_protobuf_DescriptorProto_ReservedRange *msg) { return _upb_hasbit(msg, 2); }
google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange * msg)2105 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); }
2106
google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange * msg,int32_t value)2107 UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
2108 _upb_sethas(msg, 1);
2109 *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
2110 }
google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange * msg,int32_t value)2111 UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
2112 _upb_sethas(msg, 2);
2113 *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value;
2114 }
2115
2116 /* google.protobuf.ExtensionRangeOptions */
2117
google_protobuf_ExtensionRangeOptions_new(upb_arena * arena)2118 UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_new(upb_arena *arena) {
2119 return (google_protobuf_ExtensionRangeOptions *)_upb_msg_new(&google_protobuf_ExtensionRangeOptions_msginit, arena);
2120 }
google_protobuf_ExtensionRangeOptions_parse(const char * buf,size_t size,upb_arena * arena)2121 UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parse(const char *buf, size_t size,
2122 upb_arena *arena) {
2123 google_protobuf_ExtensionRangeOptions *ret = google_protobuf_ExtensionRangeOptions_new(arena);
2124 return (ret && upb_decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msginit, arena)) ? ret : NULL;
2125 }
google_protobuf_ExtensionRangeOptions_serialize(const google_protobuf_ExtensionRangeOptions * msg,upb_arena * arena,size_t * len)2126 UPB_INLINE char *google_protobuf_ExtensionRangeOptions_serialize(const google_protobuf_ExtensionRangeOptions *msg, upb_arena *arena, size_t *len) {
2127 return upb_encode(msg, &google_protobuf_ExtensionRangeOptions_msginit, arena, len);
2128 }
2129
google_protobuf_ExtensionRangeOptions_has_uninterpreted_option(const google_protobuf_ExtensionRangeOptions * msg)2130 UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_uninterpreted_option(const google_protobuf_ExtensionRangeOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(0, 0)); }
google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions * msg,size_t * len)2131 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); }
2132
google_protobuf_ExtensionRangeOptions_mutable_uninterpreted_option(google_protobuf_ExtensionRangeOptions * msg,size_t * len)2133 UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_mutable_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, size_t *len) {
2134 return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
2135 }
google_protobuf_ExtensionRangeOptions_resize_uninterpreted_option(google_protobuf_ExtensionRangeOptions * msg,size_t len,upb_arena * arena)2136 UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_resize_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, size_t len, upb_arena *arena) {
2137 return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor2(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena);
2138 }
google_protobuf_ExtensionRangeOptions_add_uninterpreted_option(google_protobuf_ExtensionRangeOptions * msg,upb_arena * arena)2139 UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ExtensionRangeOptions_add_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, upb_arena *arena) {
2140 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
2141 bool ok = _upb_array_append_accessor2(
2142 msg, UPB_SIZE(0, 0), UPB_SIZE(2, 3), &sub, arena);
2143 if (!ok) return NULL;
2144 return sub;
2145 }
2146
2147 /* google.protobuf.FieldDescriptorProto */
2148
google_protobuf_FieldDescriptorProto_new(upb_arena * arena)2149 UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_new(upb_arena *arena) {
2150 return (google_protobuf_FieldDescriptorProto *)_upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
2151 }
google_protobuf_FieldDescriptorProto_parse(const char * buf,size_t size,upb_arena * arena)2152 UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parse(const char *buf, size_t size,
2153 upb_arena *arena) {
2154 google_protobuf_FieldDescriptorProto *ret = google_protobuf_FieldDescriptorProto_new(arena);
2155 return (ret && upb_decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msginit, arena)) ? ret : NULL;
2156 }
google_protobuf_FieldDescriptorProto_serialize(const google_protobuf_FieldDescriptorProto * msg,upb_arena * arena,size_t * len)2157 UPB_INLINE char *google_protobuf_FieldDescriptorProto_serialize(const google_protobuf_FieldDescriptorProto *msg, upb_arena *arena, size_t *len) {
2158 return upb_encode(msg, &google_protobuf_FieldDescriptorProto_msginit, arena, len);
2159 }
2160
google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto * msg)2161 UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 6); }
google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto * msg)2162 UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(24, 24), upb_strview); }
google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto * msg)2163 UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 7); }
google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto * msg)2164 UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(32, 40), upb_strview); }
google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto * msg)2165 UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 3); }
google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto * msg)2166 UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 12), int32_t); }
google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto * msg)2167 UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto * msg)2168 UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto * msg)2169 UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto * msg)2170 UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t); }
google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto * msg)2171 UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 8); }
google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto * msg)2172 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); }
google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto * msg)2173 UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 9); }
google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto * msg)2174 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); }
google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto * msg)2175 UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 11); }
google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto * msg)2176 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*); }
google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto * msg)2177 UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 4); }
google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto * msg)2178 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); }
google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto * msg)2179 UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 10); }
google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto * msg)2180 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); }
google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto * msg)2181 UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 5); }
google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto * msg)2182 UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(20, 20), bool); }
2183
google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto * msg,upb_strview value)2184 UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
2185 _upb_sethas(msg, 6);
2186 *UPB_PTR_AT(msg, UPB_SIZE(24, 24), upb_strview) = value;
2187 }
google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto * msg,upb_strview value)2188 UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
2189 _upb_sethas(msg, 7);
2190 *UPB_PTR_AT(msg, UPB_SIZE(32, 40), upb_strview) = value;
2191 }
google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto * msg,int32_t value)2192 UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
2193 _upb_sethas(msg, 3);
2194 *UPB_PTR_AT(msg, UPB_SIZE(12, 12), int32_t) = value;
2195 }
google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto * msg,int32_t value)2196 UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
2197 _upb_sethas(msg, 1);
2198 *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
2199 }
google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto * msg,int32_t value)2200 UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
2201 _upb_sethas(msg, 2);
2202 *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value;
2203 }
google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto * msg,upb_strview value)2204 UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
2205 _upb_sethas(msg, 8);
2206 *UPB_PTR_AT(msg, UPB_SIZE(40, 56), upb_strview) = value;
2207 }
google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto * msg,upb_strview value)2208 UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
2209 _upb_sethas(msg, 9);
2210 *UPB_PTR_AT(msg, UPB_SIZE(48, 72), upb_strview) = value;
2211 }
google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto * msg,google_protobuf_FieldOptions * value)2212 UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) {
2213 _upb_sethas(msg, 11);
2214 *UPB_PTR_AT(msg, UPB_SIZE(64, 104), google_protobuf_FieldOptions*) = value;
2215 }
google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto * msg,upb_arena * arena)2216 UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto *msg, upb_arena *arena) {
2217 struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg);
2218 if (sub == NULL) {
2219 sub = (struct google_protobuf_FieldOptions*)_upb_msg_new(&google_protobuf_FieldOptions_msginit, arena);
2220 if (!sub) return NULL;
2221 google_protobuf_FieldDescriptorProto_set_options(msg, sub);
2222 }
2223 return sub;
2224 }
google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto * msg,int32_t value)2225 UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
2226 _upb_sethas(msg, 4);
2227 *UPB_PTR_AT(msg, UPB_SIZE(16, 16), int32_t) = value;
2228 }
google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto * msg,upb_strview value)2229 UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
2230 _upb_sethas(msg, 10);
2231 *UPB_PTR_AT(msg, UPB_SIZE(56, 88), upb_strview) = value;
2232 }
google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto * msg,bool value)2233 UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) {
2234 _upb_sethas(msg, 5);
2235 *UPB_PTR_AT(msg, UPB_SIZE(20, 20), bool) = value;
2236 }
2237
2238 /* google.protobuf.OneofDescriptorProto */
2239
google_protobuf_OneofDescriptorProto_new(upb_arena * arena)2240 UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_new(upb_arena *arena) {
2241 return (google_protobuf_OneofDescriptorProto *)_upb_msg_new(&google_protobuf_OneofDescriptorProto_msginit, arena);
2242 }
google_protobuf_OneofDescriptorProto_parse(const char * buf,size_t size,upb_arena * arena)2243 UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parse(const char *buf, size_t size,
2244 upb_arena *arena) {
2245 google_protobuf_OneofDescriptorProto *ret = google_protobuf_OneofDescriptorProto_new(arena);
2246 return (ret && upb_decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msginit, arena)) ? ret : NULL;
2247 }
google_protobuf_OneofDescriptorProto_serialize(const google_protobuf_OneofDescriptorProto * msg,upb_arena * arena,size_t * len)2248 UPB_INLINE char *google_protobuf_OneofDescriptorProto_serialize(const google_protobuf_OneofDescriptorProto *msg, upb_arena *arena, size_t *len) {
2249 return upb_encode(msg, &google_protobuf_OneofDescriptorProto_msginit, arena, len);
2250 }
2251
google_protobuf_OneofDescriptorProto_has_name(const google_protobuf_OneofDescriptorProto * msg)2252 UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_name(const google_protobuf_OneofDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto * msg)2253 UPB_INLINE upb_strview google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
google_protobuf_OneofDescriptorProto_has_options(const google_protobuf_OneofDescriptorProto * msg)2254 UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_options(const google_protobuf_OneofDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto * msg)2255 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*); }
2256
google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto * msg,upb_strview value)2257 UPB_INLINE void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_strview value) {
2258 _upb_sethas(msg, 1);
2259 *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
2260 }
google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto * msg,google_protobuf_OneofOptions * value)2261 UPB_INLINE void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) {
2262 _upb_sethas(msg, 2);
2263 *UPB_PTR_AT(msg, UPB_SIZE(12, 24), google_protobuf_OneofOptions*) = value;
2264 }
google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto * msg,upb_arena * arena)2265 UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto *msg, upb_arena *arena) {
2266 struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg);
2267 if (sub == NULL) {
2268 sub = (struct google_protobuf_OneofOptions*)_upb_msg_new(&google_protobuf_OneofOptions_msginit, arena);
2269 if (!sub) return NULL;
2270 google_protobuf_OneofDescriptorProto_set_options(msg, sub);
2271 }
2272 return sub;
2273 }
2274
2275 /* google.protobuf.EnumDescriptorProto */
2276
google_protobuf_EnumDescriptorProto_new(upb_arena * arena)2277 UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_new(upb_arena *arena) {
2278 return (google_protobuf_EnumDescriptorProto *)_upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena);
2279 }
google_protobuf_EnumDescriptorProto_parse(const char * buf,size_t size,upb_arena * arena)2280 UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parse(const char *buf, size_t size,
2281 upb_arena *arena) {
2282 google_protobuf_EnumDescriptorProto *ret = google_protobuf_EnumDescriptorProto_new(arena);
2283 return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msginit, arena)) ? ret : NULL;
2284 }
google_protobuf_EnumDescriptorProto_serialize(const google_protobuf_EnumDescriptorProto * msg,upb_arena * arena,size_t * len)2285 UPB_INLINE char *google_protobuf_EnumDescriptorProto_serialize(const google_protobuf_EnumDescriptorProto *msg, upb_arena *arena, size_t *len) {
2286 return upb_encode(msg, &google_protobuf_EnumDescriptorProto_msginit, arena, len);
2287 }
2288
google_protobuf_EnumDescriptorProto_has_name(const google_protobuf_EnumDescriptorProto * msg)2289 UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_name(const google_protobuf_EnumDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto * msg)2290 UPB_INLINE upb_strview google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
google_protobuf_EnumDescriptorProto_has_value(const google_protobuf_EnumDescriptorProto * msg)2291 UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_value(const google_protobuf_EnumDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(16, 32)); }
google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto * msg,size_t * len)2292 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); }
google_protobuf_EnumDescriptorProto_has_options(const google_protobuf_EnumDescriptorProto * msg)2293 UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_options(const google_protobuf_EnumDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto * msg)2294 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*); }
google_protobuf_EnumDescriptorProto_has_reserved_range(const google_protobuf_EnumDescriptorProto * msg)2295 UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_range(const google_protobuf_EnumDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(20, 40)); }
google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto * msg,size_t * len)2296 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); }
google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto * msg,size_t * len)2297 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); }
2298
google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto * msg,upb_strview value)2299 UPB_INLINE void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_strview value) {
2300 _upb_sethas(msg, 1);
2301 *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
2302 }
google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto * msg,size_t * len)2303 UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto *msg, size_t *len) {
2304 return (google_protobuf_EnumValueDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
2305 }
google_protobuf_EnumDescriptorProto_resize_value(google_protobuf_EnumDescriptorProto * msg,size_t len,upb_arena * arena)2306 UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_resize_value(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) {
2307 return (google_protobuf_EnumValueDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(16, 32), len, UPB_SIZE(2, 3), arena);
2308 }
google_protobuf_EnumDescriptorProto_add_value(google_protobuf_EnumDescriptorProto * msg,upb_arena * arena)2309 UPB_INLINE struct google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumDescriptorProto_add_value(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) {
2310 struct google_protobuf_EnumValueDescriptorProto* sub = (struct google_protobuf_EnumValueDescriptorProto*)_upb_msg_new(&google_protobuf_EnumValueDescriptorProto_msginit, arena);
2311 bool ok = _upb_array_append_accessor2(
2312 msg, UPB_SIZE(16, 32), UPB_SIZE(2, 3), &sub, arena);
2313 if (!ok) return NULL;
2314 return sub;
2315 }
google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto * msg,google_protobuf_EnumOptions * value)2316 UPB_INLINE void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) {
2317 _upb_sethas(msg, 2);
2318 *UPB_PTR_AT(msg, UPB_SIZE(12, 24), google_protobuf_EnumOptions*) = value;
2319 }
google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto * msg,upb_arena * arena)2320 UPB_INLINE struct google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) {
2321 struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg);
2322 if (sub == NULL) {
2323 sub = (struct google_protobuf_EnumOptions*)_upb_msg_new(&google_protobuf_EnumOptions_msginit, arena);
2324 if (!sub) return NULL;
2325 google_protobuf_EnumDescriptorProto_set_options(msg, sub);
2326 }
2327 return sub;
2328 }
google_protobuf_EnumDescriptorProto_mutable_reserved_range(google_protobuf_EnumDescriptorProto * msg,size_t * len)2329 UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_mutable_reserved_range(google_protobuf_EnumDescriptorProto *msg, size_t *len) {
2330 return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
2331 }
google_protobuf_EnumDescriptorProto_resize_reserved_range(google_protobuf_EnumDescriptorProto * msg,size_t len,upb_arena * arena)2332 UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_resize_reserved_range(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) {
2333 return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_resize_accessor2(msg, UPB_SIZE(20, 40), len, UPB_SIZE(2, 3), arena);
2334 }
google_protobuf_EnumDescriptorProto_add_reserved_range(google_protobuf_EnumDescriptorProto * msg,upb_arena * arena)2335 UPB_INLINE struct google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_add_reserved_range(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) {
2336 struct google_protobuf_EnumDescriptorProto_EnumReservedRange* sub = (struct google_protobuf_EnumDescriptorProto_EnumReservedRange*)_upb_msg_new(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena);
2337 bool ok = _upb_array_append_accessor2(
2338 msg, UPB_SIZE(20, 40), UPB_SIZE(2, 3), &sub, arena);
2339 if (!ok) return NULL;
2340 return sub;
2341 }
google_protobuf_EnumDescriptorProto_mutable_reserved_name(google_protobuf_EnumDescriptorProto * msg,size_t * len)2342 UPB_INLINE upb_strview* google_protobuf_EnumDescriptorProto_mutable_reserved_name(google_protobuf_EnumDescriptorProto *msg, size_t *len) {
2343 return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
2344 }
google_protobuf_EnumDescriptorProto_resize_reserved_name(google_protobuf_EnumDescriptorProto * msg,size_t len,upb_arena * arena)2345 UPB_INLINE upb_strview* google_protobuf_EnumDescriptorProto_resize_reserved_name(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) {
2346 return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(24, 48), len, UPB_SIZE(3, 4), arena);
2347 }
google_protobuf_EnumDescriptorProto_add_reserved_name(google_protobuf_EnumDescriptorProto * msg,upb_strview val,upb_arena * arena)2348 UPB_INLINE bool google_protobuf_EnumDescriptorProto_add_reserved_name(google_protobuf_EnumDescriptorProto *msg, upb_strview val, upb_arena *arena) {
2349 return _upb_array_append_accessor2(msg, UPB_SIZE(24, 48), UPB_SIZE(3, 4), &val,
2350 arena);
2351 }
2352
2353 /* google.protobuf.EnumDescriptorProto.EnumReservedRange */
2354
google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_arena * arena)2355 UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_arena *arena) {
2356 return (google_protobuf_EnumDescriptorProto_EnumReservedRange *)_upb_msg_new(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena);
2357 }
google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char * buf,size_t size,upb_arena * arena)2358 UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char *buf, size_t size,
2359 upb_arena *arena) {
2360 google_protobuf_EnumDescriptorProto_EnumReservedRange *ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
2361 return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena)) ? ret : NULL;
2362 }
google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(const google_protobuf_EnumDescriptorProto_EnumReservedRange * msg,upb_arena * arena,size_t * len)2363 UPB_INLINE char *google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, upb_arena *arena, size_t *len) {
2364 return upb_encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena, len);
2365 }
2366
google_protobuf_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange * msg)2367 UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return _upb_hasbit(msg, 1); }
google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange * msg)2368 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); }
google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange * msg)2369 UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return _upb_hasbit(msg, 2); }
google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange * msg)2370 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); }
2371
google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange * msg,int32_t value)2372 UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
2373 _upb_sethas(msg, 1);
2374 *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
2375 }
google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange * msg,int32_t value)2376 UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
2377 _upb_sethas(msg, 2);
2378 *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value;
2379 }
2380
2381 /* google.protobuf.EnumValueDescriptorProto */
2382
google_protobuf_EnumValueDescriptorProto_new(upb_arena * arena)2383 UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_new(upb_arena *arena) {
2384 return (google_protobuf_EnumValueDescriptorProto *)_upb_msg_new(&google_protobuf_EnumValueDescriptorProto_msginit, arena);
2385 }
google_protobuf_EnumValueDescriptorProto_parse(const char * buf,size_t size,upb_arena * arena)2386 UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parse(const char *buf, size_t size,
2387 upb_arena *arena) {
2388 google_protobuf_EnumValueDescriptorProto *ret = google_protobuf_EnumValueDescriptorProto_new(arena);
2389 return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msginit, arena)) ? ret : NULL;
2390 }
google_protobuf_EnumValueDescriptorProto_serialize(const google_protobuf_EnumValueDescriptorProto * msg,upb_arena * arena,size_t * len)2391 UPB_INLINE char *google_protobuf_EnumValueDescriptorProto_serialize(const google_protobuf_EnumValueDescriptorProto *msg, upb_arena *arena, size_t *len) {
2392 return upb_encode(msg, &google_protobuf_EnumValueDescriptorProto_msginit, arena, len);
2393 }
2394
google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto * msg)2395 UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto * msg)2396 UPB_INLINE upb_strview google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), upb_strview); }
google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto * msg)2397 UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto * msg)2398 UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); }
google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto * msg)2399 UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_hasbit(msg, 3); }
google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto * msg)2400 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*); }
2401
google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto * msg,upb_strview value)2402 UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_strview value) {
2403 _upb_sethas(msg, 2);
2404 *UPB_PTR_AT(msg, UPB_SIZE(8, 8), upb_strview) = value;
2405 }
google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto * msg,int32_t value)2406 UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) {
2407 _upb_sethas(msg, 1);
2408 *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value;
2409 }
google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto * msg,google_protobuf_EnumValueOptions * value)2410 UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) {
2411 _upb_sethas(msg, 3);
2412 *UPB_PTR_AT(msg, UPB_SIZE(16, 24), google_protobuf_EnumValueOptions*) = value;
2413 }
google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto * msg,upb_arena * arena)2414 UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto *msg, upb_arena *arena) {
2415 struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg);
2416 if (sub == NULL) {
2417 sub = (struct google_protobuf_EnumValueOptions*)_upb_msg_new(&google_protobuf_EnumValueOptions_msginit, arena);
2418 if (!sub) return NULL;
2419 google_protobuf_EnumValueDescriptorProto_set_options(msg, sub);
2420 }
2421 return sub;
2422 }
2423
2424 /* google.protobuf.ServiceDescriptorProto */
2425
google_protobuf_ServiceDescriptorProto_new(upb_arena * arena)2426 UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_new(upb_arena *arena) {
2427 return (google_protobuf_ServiceDescriptorProto *)_upb_msg_new(&google_protobuf_ServiceDescriptorProto_msginit, arena);
2428 }
google_protobuf_ServiceDescriptorProto_parse(const char * buf,size_t size,upb_arena * arena)2429 UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parse(const char *buf, size_t size,
2430 upb_arena *arena) {
2431 google_protobuf_ServiceDescriptorProto *ret = google_protobuf_ServiceDescriptorProto_new(arena);
2432 return (ret && upb_decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msginit, arena)) ? ret : NULL;
2433 }
google_protobuf_ServiceDescriptorProto_serialize(const google_protobuf_ServiceDescriptorProto * msg,upb_arena * arena,size_t * len)2434 UPB_INLINE char *google_protobuf_ServiceDescriptorProto_serialize(const google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena, size_t *len) {
2435 return upb_encode(msg, &google_protobuf_ServiceDescriptorProto_msginit, arena, len);
2436 }
2437
google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto * msg)2438 UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto * msg)2439 UPB_INLINE upb_strview google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
google_protobuf_ServiceDescriptorProto_has_method(const google_protobuf_ServiceDescriptorProto * msg)2440 UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_method(const google_protobuf_ServiceDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(16, 32)); }
google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto * msg,size_t * len)2441 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); }
google_protobuf_ServiceDescriptorProto_has_options(const google_protobuf_ServiceDescriptorProto * msg)2442 UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_options(const google_protobuf_ServiceDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto * msg)2443 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*); }
2444
google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto * msg,upb_strview value)2445 UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_strview value) {
2446 _upb_sethas(msg, 1);
2447 *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
2448 }
google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto * msg,size_t * len)2449 UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto *msg, size_t *len) {
2450 return (google_protobuf_MethodDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
2451 }
google_protobuf_ServiceDescriptorProto_resize_method(google_protobuf_ServiceDescriptorProto * msg,size_t len,upb_arena * arena)2452 UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_resize_method(google_protobuf_ServiceDescriptorProto *msg, size_t len, upb_arena *arena) {
2453 return (google_protobuf_MethodDescriptorProto**)_upb_array_resize_accessor2(msg, UPB_SIZE(16, 32), len, UPB_SIZE(2, 3), arena);
2454 }
google_protobuf_ServiceDescriptorProto_add_method(google_protobuf_ServiceDescriptorProto * msg,upb_arena * arena)2455 UPB_INLINE struct google_protobuf_MethodDescriptorProto* google_protobuf_ServiceDescriptorProto_add_method(google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena) {
2456 struct google_protobuf_MethodDescriptorProto* sub = (struct google_protobuf_MethodDescriptorProto*)_upb_msg_new(&google_protobuf_MethodDescriptorProto_msginit, arena);
2457 bool ok = _upb_array_append_accessor2(
2458 msg, UPB_SIZE(16, 32), UPB_SIZE(2, 3), &sub, arena);
2459 if (!ok) return NULL;
2460 return sub;
2461 }
google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto * msg,google_protobuf_ServiceOptions * value)2462 UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) {
2463 _upb_sethas(msg, 2);
2464 *UPB_PTR_AT(msg, UPB_SIZE(12, 24), google_protobuf_ServiceOptions*) = value;
2465 }
google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto * msg,upb_arena * arena)2466 UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena) {
2467 struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg);
2468 if (sub == NULL) {
2469 sub = (struct google_protobuf_ServiceOptions*)_upb_msg_new(&google_protobuf_ServiceOptions_msginit, arena);
2470 if (!sub) return NULL;
2471 google_protobuf_ServiceDescriptorProto_set_options(msg, sub);
2472 }
2473 return sub;
2474 }
2475
2476 /* google.protobuf.MethodDescriptorProto */
2477
google_protobuf_MethodDescriptorProto_new(upb_arena * arena)2478 UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_new(upb_arena *arena) {
2479 return (google_protobuf_MethodDescriptorProto *)_upb_msg_new(&google_protobuf_MethodDescriptorProto_msginit, arena);
2480 }
google_protobuf_MethodDescriptorProto_parse(const char * buf,size_t size,upb_arena * arena)2481 UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parse(const char *buf, size_t size,
2482 upb_arena *arena) {
2483 google_protobuf_MethodDescriptorProto *ret = google_protobuf_MethodDescriptorProto_new(arena);
2484 return (ret && upb_decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msginit, arena)) ? ret : NULL;
2485 }
google_protobuf_MethodDescriptorProto_serialize(const google_protobuf_MethodDescriptorProto * msg,upb_arena * arena,size_t * len)2486 UPB_INLINE char *google_protobuf_MethodDescriptorProto_serialize(const google_protobuf_MethodDescriptorProto *msg, upb_arena *arena, size_t *len) {
2487 return upb_encode(msg, &google_protobuf_MethodDescriptorProto_msginit, arena, len);
2488 }
2489
google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto * msg)2490 UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 3); }
google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto * msg)2491 UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto * msg)2492 UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 4); }
google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto * msg)2493 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); }
google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto * msg)2494 UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 5); }
google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto * msg)2495 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); }
google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto * msg)2496 UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 6); }
google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto * msg)2497 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*); }
google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto * msg)2498 UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 1); }
google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto * msg)2499 UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool); }
google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto * msg)2500 UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 2); }
google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto * msg)2501 UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(2, 2), bool); }
2502
google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto * msg,upb_strview value)2503 UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_strview value) {
2504 _upb_sethas(msg, 3);
2505 *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
2506 }
google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto * msg,upb_strview value)2507 UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_strview value) {
2508 _upb_sethas(msg, 4);
2509 *UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview) = value;
2510 }
google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto * msg,upb_strview value)2511 UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_strview value) {
2512 _upb_sethas(msg, 5);
2513 *UPB_PTR_AT(msg, UPB_SIZE(20, 40), upb_strview) = value;
2514 }
google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto * msg,google_protobuf_MethodOptions * value)2515 UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) {
2516 _upb_sethas(msg, 6);
2517 *UPB_PTR_AT(msg, UPB_SIZE(28, 56), google_protobuf_MethodOptions*) = value;
2518 }
google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto * msg,upb_arena * arena)2519 UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto *msg, upb_arena *arena) {
2520 struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg);
2521 if (sub == NULL) {
2522 sub = (struct google_protobuf_MethodOptions*)_upb_msg_new(&google_protobuf_MethodOptions_msginit, arena);
2523 if (!sub) return NULL;
2524 google_protobuf_MethodDescriptorProto_set_options(msg, sub);
2525 }
2526 return sub;
2527 }
google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto * msg,bool value)2528 UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
2529 _upb_sethas(msg, 1);
2530 *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool) = value;
2531 }
google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto * msg,bool value)2532 UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
2533 _upb_sethas(msg, 2);
2534 *UPB_PTR_AT(msg, UPB_SIZE(2, 2), bool) = value;
2535 }
2536
2537 /* google.protobuf.FileOptions */
2538
google_protobuf_FileOptions_new(upb_arena * arena)2539 UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_new(upb_arena *arena) {
2540 return (google_protobuf_FileOptions *)_upb_msg_new(&google_protobuf_FileOptions_msginit, arena);
2541 }
google_protobuf_FileOptions_parse(const char * buf,size_t size,upb_arena * arena)2542 UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_parse(const char *buf, size_t size,
2543 upb_arena *arena) {
2544 google_protobuf_FileOptions *ret = google_protobuf_FileOptions_new(arena);
2545 return (ret && upb_decode(buf, size, ret, &google_protobuf_FileOptions_msginit, arena)) ? ret : NULL;
2546 }
google_protobuf_FileOptions_serialize(const google_protobuf_FileOptions * msg,upb_arena * arena,size_t * len)2547 UPB_INLINE char *google_protobuf_FileOptions_serialize(const google_protobuf_FileOptions *msg, upb_arena *arena, size_t *len) {
2548 return upb_encode(msg, &google_protobuf_FileOptions_msginit, arena, len);
2549 }
2550
google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions * msg)2551 UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 11); }
google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions * msg)2552 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); }
google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions * msg)2553 UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 12); }
google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions * msg)2554 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); }
google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions * msg)2555 UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 1); }
google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions * msg)2556 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); }
google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions * msg)2557 UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 2); }
google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions * msg)2558 UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), bool); }
google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions * msg)2559 UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 13); }
google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions * msg)2560 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); }
google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions * msg)2561 UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 3); }
google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions * msg)2562 UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(9, 9), bool); }
google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions * msg)2563 UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 4); }
google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions * msg)2564 UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(10, 10), bool); }
google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions * msg)2565 UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 5); }
google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions * msg)2566