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