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