google-protobuf 3.7.0 → 3.17.0

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

Potentially problematic release.


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

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