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