blob: 8d99dc6dadbc293442c0008325a239c100e1a5af [file] [log] [blame]
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07001// Ruby is still using proto3 enum semantics for proto2
2#define UPB_DISABLE_PROTO2_ENUM_CHECKING
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003/* Amalgamated source file */
Joshua Habermandd69a482021-05-17 22:40:33 -07004
5/*
Eric Salo8809a112022-11-21 13:01:06 -08006 * This is where we define internal portability macros used across upb.
Joshua Habermandd69a482021-05-17 22:40:33 -07007 *
Eric Salo8809a112022-11-21 13:01:06 -08008 * All of these macros are undef'd in undef.inc to avoid leaking them to users.
Joshua Habermandd69a482021-05-17 22:40:33 -07009 *
10 * The correct usage is:
11 *
12 * #include "upb/foobar.h"
13 * #include "upb/baz.h"
14 *
15 * // MUST be last included header.
Eric Salo8809a112022-11-21 13:01:06 -080016 * #include "upb/port/def.inc"
Joshua Habermandd69a482021-05-17 22:40:33 -070017 *
18 * // Code for this file.
19 * // <...>
20 *
21 * // Can be omitted for .c files, required for .h.
Eric Salo8809a112022-11-21 13:01:06 -080022 * #include "upb/port/undef.inc"
Joshua Habermandd69a482021-05-17 22:40:33 -070023 *
24 * This file is private and must not be included by users!
25 */
Joshua Haberman9abf6e22021-01-13 12:16:25 -080026
27#if !((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
Mike Kruskalfd0b1a52022-10-14 16:27:22 -070028 (defined(__cplusplus) && __cplusplus >= 201402L) || \
Joshua Haberman9abf6e22021-01-13 12:16:25 -080029 (defined(_MSC_VER) && _MSC_VER >= 1900))
Mike Kruskalfd0b1a52022-10-14 16:27:22 -070030#error upb requires C99 or C++14 or MSVC >= 2015.
Joshua Haberman9abf6e22021-01-13 12:16:25 -080031#endif
32
Joshua Habermand3995ec2022-09-30 16:54:39 -070033// Portable check for GCC minimum version:
34// https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
35#if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
36#define UPB_GNUC_MIN(x, y) \
37 (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y))
38#else
39#define UPB_GNUC_MIN(x, y) 0
40#endif
41
42#include <assert.h>
43#include <setjmp.h>
44#include <stdbool.h>
Joshua Habermand3995ec2022-09-30 16:54:39 -070045#include <stdint.h>
Eric Salo8809a112022-11-21 13:01:06 -080046#include <stdio.h>
Joshua Haberman9abf6e22021-01-13 12:16:25 -080047
Adam Cozzette7d5592e2023-08-23 12:15:26 -070048#ifndef UINTPTR_MAX
49Error, UINTPTR_MAX is undefined
50#endif
51
Joshua Haberman9abf6e22021-01-13 12:16:25 -080052#if UINTPTR_MAX == 0xffffffff
53#define UPB_SIZE(size32, size64) size32
54#else
55#define UPB_SIZE(size32, size64) size64
56#endif
57
58/* If we always read/write as a consistent type to each address, this shouldn't
59 * violate aliasing.
60 */
61#define UPB_PTR_AT(msg, ofs, type) ((type*)((char*)(msg) + (ofs)))
62
Joshua Haberman9abf6e22021-01-13 12:16:25 -080063#define UPB_MAPTYPE_STRING 0
64
Eric Salo3f36a912022-12-05 14:12:25 -080065// UPB_EXPORT: always generate a public symbol.
66#if defined(__GNUC__) || defined(__clang__)
67#define UPB_EXPORT __attribute__((visibility("default"))) __attribute__((used))
68#else
69#define UPB_EXPORT
70#endif
71
72// UPB_INLINE: inline if possible, emit standalone code if required.
Joshua Haberman9abf6e22021-01-13 12:16:25 -080073#ifdef __cplusplus
74#define UPB_INLINE inline
75#elif defined (__GNUC__) || defined(__clang__)
76#define UPB_INLINE static __inline__
77#else
78#define UPB_INLINE static
79#endif
80
Eric Salo3f36a912022-12-05 14:12:25 -080081#ifdef UPB_BUILD_API
82#define UPB_API UPB_EXPORT
83#define UPB_API_INLINE UPB_EXPORT
84#else
85#define UPB_API
86#define UPB_API_INLINE UPB_INLINE
87#endif
88
Joshua Habermand3995ec2022-09-30 16:54:39 -070089#define UPB_MALLOC_ALIGN 8
Joshua Haberman9abf6e22021-01-13 12:16:25 -080090#define UPB_ALIGN_UP(size, align) (((size) + (align) - 1) / (align) * (align))
91#define UPB_ALIGN_DOWN(size, align) ((size) / (align) * (align))
Joshua Habermand3995ec2022-09-30 16:54:39 -070092#define UPB_ALIGN_MALLOC(size) UPB_ALIGN_UP(size, UPB_MALLOC_ALIGN)
Mike Kruskal232ecf42023-01-14 00:09:40 -080093#ifdef __clang__
94#define UPB_ALIGN_OF(type) _Alignof(type)
95#else
Joshua Haberman9abf6e22021-01-13 12:16:25 -080096#define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member)
Mike Kruskal232ecf42023-01-14 00:09:40 -080097#endif
Joshua Haberman9abf6e22021-01-13 12:16:25 -080098
Eric Salo8809a112022-11-21 13:01:06 -080099// Hints to the compiler about likely/unlikely branches.
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800100#if defined (__GNUC__) || defined(__clang__)
Eric Salo8809a112022-11-21 13:01:06 -0800101#define UPB_LIKELY(x) __builtin_expect((bool)(x), 1)
102#define UPB_UNLIKELY(x) __builtin_expect((bool)(x), 0)
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800103#else
104#define UPB_LIKELY(x) (x)
105#define UPB_UNLIKELY(x) (x)
106#endif
107
Eric Salo8809a112022-11-21 13:01:06 -0800108// Macros for function attributes on compilers that support them.
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800109#ifdef __GNUC__
110#define UPB_FORCEINLINE __inline__ __attribute__((always_inline))
111#define UPB_NOINLINE __attribute__((noinline))
112#define UPB_NORETURN __attribute__((__noreturn__))
113#define UPB_PRINTF(str, first_vararg) __attribute__((format (printf, str, first_vararg)))
114#elif defined(_MSC_VER)
115#define UPB_NOINLINE
116#define UPB_FORCEINLINE
117#define UPB_NORETURN __declspec(noreturn)
118#define UPB_PRINTF(str, first_vararg)
119#else /* !defined(__GNUC__) */
120#define UPB_FORCEINLINE
121#define UPB_NOINLINE
122#define UPB_NORETURN
123#define UPB_PRINTF(str, first_vararg)
124#endif
125
126#define UPB_MAX(x, y) ((x) > (y) ? (x) : (y))
127#define UPB_MIN(x, y) ((x) < (y) ? (x) : (y))
128
129#define UPB_UNUSED(var) (void)var
130
Eric Salo8809a112022-11-21 13:01:06 -0800131// UPB_ASSUME(): in release mode, we tell the compiler to assume this is true.
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800132#ifdef NDEBUG
133#ifdef __GNUC__
134#define UPB_ASSUME(expr) if (!(expr)) __builtin_unreachable()
135#elif defined _MSC_VER
136#define UPB_ASSUME(expr) if (!(expr)) __assume(0)
137#else
138#define UPB_ASSUME(expr) do {} while (false && (expr))
139#endif
140#else
141#define UPB_ASSUME(expr) assert(expr)
142#endif
143
144/* UPB_ASSERT(): in release mode, we use the expression without letting it be
145 * evaluated. This prevents "unused variable" warnings. */
146#ifdef NDEBUG
147#define UPB_ASSERT(expr) do {} while (false && (expr))
148#else
149#define UPB_ASSERT(expr) assert(expr)
150#endif
151
152#if defined(__GNUC__) || defined(__clang__)
153#define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0)
Eric Salo10505992022-12-12 12:16:36 -0800154#elif defined(_MSC_VER)
155#define UPB_UNREACHABLE() \
156 do { \
157 assert(0); \
158 __assume(0); \
159 } while (0)
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800160#else
161#define UPB_UNREACHABLE() do { assert(0); } while(0)
162#endif
163
164/* UPB_SETJMP() / UPB_LONGJMP(): avoid setting/restoring signal mask. */
165#ifdef __APPLE__
166#define UPB_SETJMP(buf) _setjmp(buf)
167#define UPB_LONGJMP(buf, val) _longjmp(buf, val)
168#else
169#define UPB_SETJMP(buf) setjmp(buf)
170#define UPB_LONGJMP(buf, val) longjmp(buf, val)
171#endif
172
Eric Salodfb71552023-03-22 12:35:09 -0700173#ifdef __GNUC__
174#define UPB_USE_C11_ATOMICS
Deanna Garciac7d979d2023-04-14 17:22:13 -0700175#define UPB_ATOMIC(T) _Atomic(T)
Eric Salodfb71552023-03-22 12:35:09 -0700176#else
Deanna Garciac7d979d2023-04-14 17:22:13 -0700177#define UPB_ATOMIC(T) T
Eric Salodfb71552023-03-22 12:35:09 -0700178#endif
179
Joshua Habermandd69a482021-05-17 22:40:33 -0700180/* UPB_PTRADD(ptr, ofs): add pointer while avoiding "NULL + 0" UB */
181#define UPB_PTRADD(ptr, ofs) ((ofs) ? (ptr) + (ofs) : (ptr))
182
Deanna Garciac7d979d2023-04-14 17:22:13 -0700183#define UPB_PRIVATE(x) x##_dont_copy_me__upb_internal_use_only
184
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800185/* Configure whether fasttable is switched on or not. *************************/
186
Joshua Habermandd69a482021-05-17 22:40:33 -0700187#ifdef __has_attribute
188#define UPB_HAS_ATTRIBUTE(x) __has_attribute(x)
189#else
190#define UPB_HAS_ATTRIBUTE(x) 0
191#endif
192
193#if UPB_HAS_ATTRIBUTE(musttail)
194#define UPB_MUSTTAIL __attribute__((musttail))
195#else
196#define UPB_MUSTTAIL
197#endif
198
199#undef UPB_HAS_ATTRIBUTE
200
201/* This check is not fully robust: it does not require that we have "musttail"
202 * support available. We need tail calls to avoid consuming arbitrary amounts
203 * of stack space.
204 *
205 * GCC/Clang can mostly be trusted to generate tail calls as long as
206 * optimization is enabled, but, debug builds will not generate tail calls
207 * unless "musttail" is available.
208 *
209 * We should probably either:
210 * 1. require that the compiler supports musttail.
211 * 2. add some fallback code for when musttail isn't available (ie. return
212 * instead of tail calling). This is safe and portable, but this comes at
213 * a CPU cost.
214 */
215#if (defined(__x86_64__) || defined(__aarch64__)) && defined(__GNUC__)
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800216#define UPB_FASTTABLE_SUPPORTED 1
217#else
218#define UPB_FASTTABLE_SUPPORTED 0
219#endif
220
221/* define UPB_ENABLE_FASTTABLE to force fast table support.
222 * This is useful when we want to ensure we are really getting fasttable,
223 * for example for testing or benchmarking. */
224#if defined(UPB_ENABLE_FASTTABLE)
225#if !UPB_FASTTABLE_SUPPORTED
Joshua Habermandd69a482021-05-17 22:40:33 -0700226#error fasttable is x86-64/ARM64 only and requires GCC or Clang.
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800227#endif
228#define UPB_FASTTABLE 1
229/* Define UPB_TRY_ENABLE_FASTTABLE to use fasttable if possible.
230 * This is useful for releasing code that might be used on multiple platforms,
231 * for example the PHP or Ruby C extensions. */
232#elif defined(UPB_TRY_ENABLE_FASTTABLE)
233#define UPB_FASTTABLE UPB_FASTTABLE_SUPPORTED
234#else
235#define UPB_FASTTABLE 0
236#endif
237
238/* UPB_FASTTABLE_INIT() allows protos compiled for fasttable to gracefully
Mike Kruskal232ecf42023-01-14 00:09:40 -0800239 * degrade to non-fasttable if the runtime or platform do not support it. */
240#if !UPB_FASTTABLE
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800241#define UPB_FASTTABLE_INIT(...)
Mike Kruskal232ecf42023-01-14 00:09:40 -0800242#define UPB_FASTTABLE_MASK(mask) -1
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800243#else
244#define UPB_FASTTABLE_INIT(...) __VA_ARGS__
Mike Kruskal232ecf42023-01-14 00:09:40 -0800245#define UPB_FASTTABLE_MASK(mask) mask
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800246#endif
247
248#undef UPB_FASTTABLE_SUPPORTED
249
Joshua Habermand3995ec2022-09-30 16:54:39 -0700250/* ASAN poisoning (for arena).
251 * If using UPB from an interpreted language like Ruby, a build of the
Joshua Haberman488b8b92022-09-30 18:07:16 -0700252 * interpreter compiled with ASAN enabled must be used in order to get sane and
Joshua Habermand3995ec2022-09-30 16:54:39 -0700253 * expected behavior.
254 */
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800255
Sandy Zhange3b09432023-08-07 09:30:02 -0700256/* Due to preprocessor limitations, the conditional logic for setting
257 * UPN_CLANG_ASAN below cannot be consolidated into a portable one-liner.
258 * See https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html.
259 */
260#if defined(__has_feature)
261#if __has_feature(address_sanitizer)
262#define UPB_CLANG_ASAN 1
263#else
264#define UPB_CLANG_ASAN 0
265#endif
266#else
267#define UPB_CLANG_ASAN 0
268#endif
269
270#if defined(__SANITIZE_ADDRESS__) || UPB_CLANG_ASAN
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800271#define UPB_ASAN 1
Sandy Zhange3b09432023-08-07 09:30:02 -0700272#define UPB_ASAN_GUARD_SIZE 32
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800273#ifdef __cplusplus
Adam Cozzette7d5592e2023-08-23 12:15:26 -0700274 extern "C" {
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800275#endif
276void __asan_poison_memory_region(void const volatile *addr, size_t size);
277void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
278#ifdef __cplusplus
279} /* extern "C" */
280#endif
281#define UPB_POISON_MEMORY_REGION(addr, size) \
282 __asan_poison_memory_region((addr), (size))
283#define UPB_UNPOISON_MEMORY_REGION(addr, size) \
284 __asan_unpoison_memory_region((addr), (size))
285#else
286#define UPB_ASAN 0
Sandy Zhange3b09432023-08-07 09:30:02 -0700287#define UPB_ASAN_GUARD_SIZE 0
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800288#define UPB_POISON_MEMORY_REGION(addr, size) \
289 ((void)(addr), (void)(size))
290#define UPB_UNPOISON_MEMORY_REGION(addr, size) \
291 ((void)(addr), (void)(size))
Joshua Habermandd69a482021-05-17 22:40:33 -0700292#endif
293
Joshua Haberman7ecf43f2022-03-14 13:11:29 -0700294/* Disable proto2 arena behavior (TEMPORARY) **********************************/
295
296#ifdef UPB_DISABLE_PROTO2_ENUM_CHECKING
297#define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 1
298#else
299#define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 0
300#endif
301
Joshua Habermand3995ec2022-09-30 16:54:39 -0700302#if defined(__cplusplus)
303#if defined(__clang__) || UPB_GNUC_MIN(6, 0)
304// https://gcc.gnu.org/gcc-6/changes.html
305#if __cplusplus >= 201402L
306#define UPB_DEPRECATED [[deprecated]]
307#else
308#define UPB_DEPRECATED __attribute__((deprecated))
309#endif
310#else
311#define UPB_DEPRECATED
312#endif
313#else
314#define UPB_DEPRECATED
315#endif
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800316
Mike Kruskal232ecf42023-01-14 00:09:40 -0800317// begin:google_only
318// #define UPB_IS_GOOGLE3
319// end:google_only
320
321#if defined(UPB_IS_GOOGLE3) && !defined(UPB_BOOTSTRAP_STAGE0)
322#define UPB_DESC(sym) proto2_##sym
323#else
324#define UPB_DESC(sym) google_protobuf_##sym
325#endif
326
Eric Salo8809a112022-11-21 13:01:06 -0800327#ifndef UPB_BASE_STATUS_H_
328#define UPB_BASE_STATUS_H_
329
330#include <stdarg.h>
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700331
332// Must be last.
333
Eric Salo8809a112022-11-21 13:01:06 -0800334#define _kUpb_Status_MaxMessage 127
335
336typedef struct {
337 bool ok;
338 char msg[_kUpb_Status_MaxMessage]; // Error message; NULL-terminated.
339} upb_Status;
340
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700341#ifdef __cplusplus
342extern "C" {
343#endif
344
Eric Salo3f36a912022-12-05 14:12:25 -0800345UPB_API const char* upb_Status_ErrorMessage(const upb_Status* status);
346UPB_API bool upb_Status_IsOk(const upb_Status* status);
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700347
Eric Salo8809a112022-11-21 13:01:06 -0800348// These are no-op if |status| is NULL.
Eric Salo3f36a912022-12-05 14:12:25 -0800349UPB_API void upb_Status_Clear(upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -0800350void upb_Status_SetErrorMessage(upb_Status* status, const char* msg);
351void upb_Status_SetErrorFormat(upb_Status* status, const char* fmt, ...)
352 UPB_PRINTF(2, 3);
353void upb_Status_VSetErrorFormat(upb_Status* status, const char* fmt,
354 va_list args) UPB_PRINTF(2, 0);
355void upb_Status_VAppendErrorFormat(upb_Status* status, const char* fmt,
356 va_list args) UPB_PRINTF(2, 0);
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700357
358#ifdef __cplusplus
359} /* extern "C" */
360#endif
361
362
Eric Salo8809a112022-11-21 13:01:06 -0800363#endif /* UPB_BASE_STATUS_H_ */
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700364
Adam Cozzette8059da22023-08-16 07:57:14 -0700365#ifndef UPB_COLLECTIONS_INTERNAL_ARRAY_H_
366#define UPB_COLLECTIONS_INTERNAL_ARRAY_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -0700367
368#include <string.h>
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800369
Joshua Habermandd69a482021-05-17 22:40:33 -0700370
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700371#ifndef UPB_COLLECTIONS_ARRAY_H_
372#define UPB_COLLECTIONS_ARRAY_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -0700373
374
Eric Salo8809a112022-11-21 13:01:06 -0800375#ifndef UPB_BASE_DESCRIPTOR_CONSTANTS_H_
376#define UPB_BASE_DESCRIPTOR_CONSTANTS_H_
377
Eric Salodfb71552023-03-22 12:35:09 -0700378// Must be last.
379
Eric Salo8809a112022-11-21 13:01:06 -0800380// The types a field can have. Note that this list is not identical to the
381// types defined in descriptor.proto, which gives INT32 and SINT32 separate
382// types (we distinguish the two with the "integer encoding" enum below).
383// This enum is an internal convenience only and has no meaning outside of upb.
384typedef enum {
385 kUpb_CType_Bool = 1,
386 kUpb_CType_Float = 2,
387 kUpb_CType_Int32 = 3,
388 kUpb_CType_UInt32 = 4,
Deanna Garciab26afb52023-04-25 13:37:18 -0700389 kUpb_CType_Enum = 5, // Enum values are int32. TODO(b/279178239): rename
Eric Salo8809a112022-11-21 13:01:06 -0800390 kUpb_CType_Message = 6,
391 kUpb_CType_Double = 7,
392 kUpb_CType_Int64 = 8,
393 kUpb_CType_UInt64 = 9,
394 kUpb_CType_String = 10,
395 kUpb_CType_Bytes = 11
396} upb_CType;
397
398// The repeated-ness of each field; this matches descriptor.proto.
399typedef enum {
400 kUpb_Label_Optional = 1,
401 kUpb_Label_Required = 2,
402 kUpb_Label_Repeated = 3
403} upb_Label;
404
405// Descriptor types, as defined in descriptor.proto.
406typedef enum {
407 kUpb_FieldType_Double = 1,
408 kUpb_FieldType_Float = 2,
409 kUpb_FieldType_Int64 = 3,
410 kUpb_FieldType_UInt64 = 4,
411 kUpb_FieldType_Int32 = 5,
412 kUpb_FieldType_Fixed64 = 6,
413 kUpb_FieldType_Fixed32 = 7,
414 kUpb_FieldType_Bool = 8,
415 kUpb_FieldType_String = 9,
416 kUpb_FieldType_Group = 10,
417 kUpb_FieldType_Message = 11,
418 kUpb_FieldType_Bytes = 12,
419 kUpb_FieldType_UInt32 = 13,
420 kUpb_FieldType_Enum = 14,
421 kUpb_FieldType_SFixed32 = 15,
422 kUpb_FieldType_SFixed64 = 16,
423 kUpb_FieldType_SInt32 = 17,
424 kUpb_FieldType_SInt64 = 18,
425} upb_FieldType;
426
427#define kUpb_FieldType_SizeOf 19
428
Eric Salodfb71552023-03-22 12:35:09 -0700429#ifdef __cplusplus
430extern "C" {
431#endif
432
433UPB_INLINE bool upb_FieldType_IsPackable(upb_FieldType type) {
434 // clang-format off
435 const unsigned kUnpackableTypes =
436 (1 << kUpb_FieldType_String) |
437 (1 << kUpb_FieldType_Bytes) |
438 (1 << kUpb_FieldType_Message) |
439 (1 << kUpb_FieldType_Group);
440 // clang-format on
441 return (1 << type) & ~kUnpackableTypes;
442}
443
444#ifdef __cplusplus
445} /* extern "C" */
446#endif
447
448
Eric Salo8809a112022-11-21 13:01:06 -0800449#endif /* UPB_BASE_DESCRIPTOR_CONSTANTS_H_ */
450
451// Users should include array.h or map.h instead.
452// IWYU pragma: private, include "upb/collections/array.h"
453
Joshua Habermand3995ec2022-09-30 16:54:39 -0700454#ifndef UPB_MESSAGE_VALUE_H_
455#define UPB_MESSAGE_VALUE_H_
456
457
Eric Salo8809a112022-11-21 13:01:06 -0800458#ifndef UPB_BASE_STRING_VIEW_H_
459#define UPB_BASE_STRING_VIEW_H_
460
461#include <string.h>
462
463// Must be last.
464
465#define UPB_STRINGVIEW_INIT(ptr, len) \
466 { ptr, len }
467
468#define UPB_STRINGVIEW_FORMAT "%.*s"
469#define UPB_STRINGVIEW_ARGS(view) (int)(view).size, (view).data
470
471// LINT.IfChange(struct_definition)
472typedef struct {
473 const char* data;
474 size_t size;
475} upb_StringView;
Adam Cozzette7d5592e2023-08-23 12:15:26 -0700476// LINT.ThenChange(
477// GoogleInternalName0,
478// //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string
479// )
Eric Salo8809a112022-11-21 13:01:06 -0800480
481#ifdef __cplusplus
482extern "C" {
483#endif
484
Eric Salo3f36a912022-12-05 14:12:25 -0800485UPB_API_INLINE upb_StringView upb_StringView_FromDataAndSize(const char* data,
486 size_t size) {
Eric Salo8809a112022-11-21 13:01:06 -0800487 upb_StringView ret;
488 ret.data = data;
489 ret.size = size;
490 return ret;
491}
492
493UPB_INLINE upb_StringView upb_StringView_FromString(const char* data) {
494 return upb_StringView_FromDataAndSize(data, strlen(data));
495}
496
497UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) {
498 return a.size == b.size && memcmp(a.data, b.data, a.size) == 0;
499}
500
501#ifdef __cplusplus
502} /* extern "C" */
503#endif
504
505
506#endif /* UPB_BASE_STRING_VIEW_H_ */
507
508#ifndef UPB_MINI_TABLE_TYPES_H_
509#define UPB_MINI_TABLE_TYPES_H_
510
Jie Luo3560e232023-06-12 00:33:50 -0700511#include <stdint.h>
512
Sandy Zhange3b09432023-08-07 09:30:02 -0700513
Adam Cozzette7d5592e2023-08-23 12:15:26 -0700514#ifndef UPB_MESSAGE_TYPES_H_
515#define UPB_MESSAGE_TYPES_H_
Sandy Zhange3b09432023-08-07 09:30:02 -0700516
Adam Cozzette7d5592e2023-08-23 12:15:26 -0700517// This typedef is in a leaf header to resolve a circular dependency between
Sandy Zhange3b09432023-08-07 09:30:02 -0700518// messages and mini tables.
519typedef void upb_Message;
520
Adam Cozzette7d5592e2023-08-23 12:15:26 -0700521#endif /* UPB_MESSAGE_TYPES_H_ */
Sandy Zhange3b09432023-08-07 09:30:02 -0700522
Jie Luo3560e232023-06-12 00:33:50 -0700523// Must be last.
524
525#ifdef __cplusplus
526extern "C" {
527#endif
528
Jie Luo3560e232023-06-12 00:33:50 -0700529// When a upb_Message* is stored in a message, array, or map, it is stored in a
530// tagged form. If the tag bit is set, the referenced upb_Message is of type
531// _kUpb_MiniTable_Empty (a sentinel message type with no fields) instead of
532// that field's true message type. This forms the basis of what we call
533// "dynamic tree shaking."
534//
535// See the documentation for kUpb_DecodeOption_ExperimentalAllowUnlinked for
536// more information.
537typedef uintptr_t upb_TaggedMessagePtr;
538
539// Internal-only because empty messages cannot be created by the user.
540UPB_INLINE upb_TaggedMessagePtr _upb_TaggedMessagePtr_Pack(upb_Message* ptr,
541 bool empty) {
542 UPB_ASSERT(((uintptr_t)ptr & 1) == 0);
543 return (uintptr_t)ptr | (empty ? 1 : 0);
544}
545
546// Users who enable unlinked sub-messages must use this to test whether a
547// message is empty before accessing it. If a message is empty, it must be
548// first promoted using the interfaces in message/promote.h.
549UPB_INLINE bool upb_TaggedMessagePtr_IsEmpty(upb_TaggedMessagePtr ptr) {
550 return ptr & 1;
551}
552
553UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetMessage(
554 upb_TaggedMessagePtr ptr) {
555 return (upb_Message*)(ptr & ~(uintptr_t)1);
556}
557
558UPB_INLINE upb_Message* upb_TaggedMessagePtr_GetNonEmptyMessage(
559 upb_TaggedMessagePtr ptr) {
560 UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(ptr));
561 return _upb_TaggedMessagePtr_GetMessage(ptr);
562}
563
564UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetEmptyMessage(
565 upb_TaggedMessagePtr ptr) {
566 UPB_ASSERT(upb_TaggedMessagePtr_IsEmpty(ptr));
567 return _upb_TaggedMessagePtr_GetMessage(ptr);
568}
569
570#ifdef __cplusplus
571} /* extern "C" */
572#endif
573
574
Eric Salo8809a112022-11-21 13:01:06 -0800575#endif /* UPB_MINI_TABLE_TYPES_H_ */
576
Mike Kruskal9d435022023-07-11 12:45:07 -0700577#ifndef UPB_MINI_TABLE_MESSAGE_H_
578#define UPB_MINI_TABLE_MESSAGE_H_
579
580
581#ifndef UPB_MINI_TABLE_ENUM_H_
582#define UPB_MINI_TABLE_ENUM_H_
583
584
585#ifndef UPB_MINI_TABLE_INTERNAL_ENUM_H_
586#define UPB_MINI_TABLE_INTERNAL_ENUM_H_
587
Adam Cozzette7d5592e2023-08-23 12:15:26 -0700588#include <stdint.h>
589
Mike Kruskal9d435022023-07-11 12:45:07 -0700590// Must be last.
591
592struct upb_MiniTableEnum {
593 uint32_t mask_limit; // Limit enum value that can be tested with mask.
594 uint32_t value_count; // Number of values after the bitfield.
595 uint32_t data[]; // Bitmask + enumerated values follow.
596};
597
598typedef enum {
599 _kUpb_FastEnumCheck_ValueIsInEnum = 0,
600 _kUpb_FastEnumCheck_ValueIsNotInEnum = 1,
601 _kUpb_FastEnumCheck_CannotCheckFast = 2,
602} _kUpb_FastEnumCheck_Status;
603
604#ifdef __cplusplus
605extern "C" {
606#endif
607
608UPB_INLINE _kUpb_FastEnumCheck_Status _upb_MiniTable_CheckEnumValueFast(
609 const struct upb_MiniTableEnum* e, uint32_t val) {
610 if (UPB_UNLIKELY(val >= 64)) return _kUpb_FastEnumCheck_CannotCheckFast;
611 uint64_t mask = e->data[0] | ((uint64_t)e->data[1] << 32);
612 return (mask & (1ULL << val)) ? _kUpb_FastEnumCheck_ValueIsInEnum
613 : _kUpb_FastEnumCheck_ValueIsNotInEnum;
614}
615
616UPB_INLINE bool _upb_MiniTable_CheckEnumValueSlow(
617 const struct upb_MiniTableEnum* e, uint32_t val) {
618 if (val < e->mask_limit) return e->data[val / 32] & (1ULL << (val % 32));
619 // OPT: binary search long lists?
620 const uint32_t* start = &e->data[e->mask_limit / 32];
621 const uint32_t* limit = &e->data[(e->mask_limit / 32) + e->value_count];
622 for (const uint32_t* p = start; p < limit; p++) {
623 if (*p == val) return true;
624 }
625 return false;
626}
627
628#ifdef __cplusplus
629} /* extern "C" */
630#endif
631
632
633#endif /* UPB_MINI_TABLE_INTERNAL_ENUM_H_ */
634
635// Must be last
636
637typedef struct upb_MiniTableEnum upb_MiniTableEnum;
638
639// Validates enum value against range defined by enum mini table.
640UPB_INLINE bool upb_MiniTableEnum_CheckValue(const struct upb_MiniTableEnum* e,
641 uint32_t val) {
642 _kUpb_FastEnumCheck_Status status = _upb_MiniTable_CheckEnumValueFast(e, val);
643 if (UPB_UNLIKELY(status == _kUpb_FastEnumCheck_CannotCheckFast)) {
644 return _upb_MiniTable_CheckEnumValueSlow(e, val);
645 }
646 return status == _kUpb_FastEnumCheck_ValueIsInEnum ? true : false;
647}
648
649
650#endif /* UPB_MINI_TABLE_ENUM_H_ */
651
652#ifndef UPB_MINI_TABLE_FIELD_H_
653#define UPB_MINI_TABLE_FIELD_H_
654
655
656#ifndef UPB_MINI_TABLE_INTERNAL_FIELD_H_
657#define UPB_MINI_TABLE_INTERNAL_FIELD_H_
658
Adam Cozzette7d5592e2023-08-23 12:15:26 -0700659#include <stdint.h>
660
Mike Kruskal9d435022023-07-11 12:45:07 -0700661
662// Must be last.
663
Mike Kruskal9d435022023-07-11 12:45:07 -0700664struct upb_MiniTableField {
665 uint32_t number;
666 uint16_t offset;
667 int16_t presence; // If >0, hasbit_index. If <0, ~oneof_index
668
669 // Indexes into `upb_MiniTable.subs`
670 // Will be set to `kUpb_NoSub` if `descriptortype` != MESSAGE/GROUP/ENUM
671 uint16_t UPB_PRIVATE(submsg_index);
672
673 uint8_t UPB_PRIVATE(descriptortype);
674
675 // upb_FieldMode | upb_LabelFlags | (upb_FieldRep << kUpb_FieldRep_Shift)
676 uint8_t mode;
677};
678
679#define kUpb_NoSub ((uint16_t)-1)
680
681typedef enum {
682 kUpb_FieldMode_Map = 0,
683 kUpb_FieldMode_Array = 1,
684 kUpb_FieldMode_Scalar = 2,
685} upb_FieldMode;
686
687// Mask to isolate the upb_FieldMode from field.mode.
688#define kUpb_FieldMode_Mask 3
689
690// Extra flags on the mode field.
691typedef enum {
692 kUpb_LabelFlags_IsPacked = 4,
693 kUpb_LabelFlags_IsExtension = 8,
694 // Indicates that this descriptor type is an "alternate type":
695 // - for Int32, this indicates that the actual type is Enum (but was
696 // rewritten to Int32 because it is an open enum that requires no check).
697 // - for Bytes, this indicates that the actual type is String (but does
698 // not require any UTF-8 check).
699 kUpb_LabelFlags_IsAlternate = 16,
700} upb_LabelFlags;
701
702// Note: we sort by this number when calculating layout order.
703typedef enum {
704 kUpb_FieldRep_1Byte = 0,
705 kUpb_FieldRep_4Byte = 1,
706 kUpb_FieldRep_StringView = 2,
707 kUpb_FieldRep_8Byte = 3,
708
709 kUpb_FieldRep_NativePointer =
710 UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte),
711 kUpb_FieldRep_Max = kUpb_FieldRep_8Byte,
712} upb_FieldRep;
713
714#define kUpb_FieldRep_Shift 6
715
Mike Kruskal9d435022023-07-11 12:45:07 -0700716UPB_INLINE upb_FieldRep
717_upb_MiniTableField_GetRep(const struct upb_MiniTableField* field) {
718 return (upb_FieldRep)(field->mode >> kUpb_FieldRep_Shift);
719}
720
721#ifdef __cplusplus
722extern "C" {
723#endif
724
725UPB_INLINE upb_FieldMode
726upb_FieldMode_Get(const struct upb_MiniTableField* field) {
727 return (upb_FieldMode)(field->mode & 3);
728}
729
730UPB_INLINE void _upb_MiniTableField_CheckIsArray(
731 const struct upb_MiniTableField* field) {
732 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_NativePointer);
733 UPB_ASSUME(upb_FieldMode_Get(field) == kUpb_FieldMode_Array);
734 UPB_ASSUME(field->presence == 0);
735}
736
737UPB_INLINE void _upb_MiniTableField_CheckIsMap(
738 const struct upb_MiniTableField* field) {
739 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_NativePointer);
740 UPB_ASSUME(upb_FieldMode_Get(field) == kUpb_FieldMode_Map);
741 UPB_ASSUME(field->presence == 0);
742}
743
744UPB_INLINE bool upb_IsRepeatedOrMap(const struct upb_MiniTableField* field) {
745 // This works because upb_FieldMode has no value 3.
746 return !(field->mode & kUpb_FieldMode_Scalar);
747}
748
749UPB_INLINE bool upb_IsSubMessage(const struct upb_MiniTableField* field) {
750 return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Message ||
751 field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Group;
752}
753
754#ifdef __cplusplus
755} /* extern "C" */
756#endif
757
758
759#endif /* UPB_MINI_TABLE_INTERNAL_FIELD_H_ */
760
761#ifndef UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
762#define UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
763
764
765// Must be last.
766
Mike Kruskal9d435022023-07-11 12:45:07 -0700767struct upb_Decoder;
768typedef const char* _upb_FieldParser(struct upb_Decoder* d, const char* ptr,
769 upb_Message* msg, intptr_t table,
770 uint64_t hasbits, uint64_t data);
771typedef struct {
772 uint64_t field_data;
773 _upb_FieldParser* field_parser;
774} _upb_FastTable_Entry;
775
776typedef enum {
777 kUpb_ExtMode_NonExtendable = 0, // Non-extendable message.
778 kUpb_ExtMode_Extendable = 1, // Normal extendable message.
779 kUpb_ExtMode_IsMessageSet = 2, // MessageSet message.
780 kUpb_ExtMode_IsMessageSet_ITEM =
781 3, // MessageSet item (temporary only, see decode.c)
782
783 // During table building we steal a bit to indicate that the message is a map
784 // entry. *Only* used during table building!
785 kUpb_ExtMode_IsMapEntry = 4,
786} upb_ExtMode;
787
Mike Kruskal9d435022023-07-11 12:45:07 -0700788union upb_MiniTableSub;
789
790// upb_MiniTable represents the memory layout of a given upb_MessageDef.
791// The members are public so generated code can initialize them,
792// but users MUST NOT directly read or write any of its members.
793struct upb_MiniTable {
794 const union upb_MiniTableSub* subs;
795 const struct upb_MiniTableField* fields;
796
797 // Must be aligned to sizeof(void*). Doesn't include internal members like
798 // unknown fields, extension dict, pointer to msglayout, etc.
799 uint16_t size;
800
801 uint16_t field_count;
802 uint8_t ext; // upb_ExtMode, declared as uint8_t so sizeof(ext) == 1
803 uint8_t dense_below;
804 uint8_t table_mask;
805 uint8_t required_count; // Required fields have the lowest hasbits.
806
807 // To statically initialize the tables of variable length, we need a flexible
808 // array member, and we need to compile in gnu99 mode (constant initialization
809 // of flexible array members is a GNU extension, not in C99 unfortunately.
810 _upb_FastTable_Entry fasttable[];
811};
812
Mike Kruskal9d435022023-07-11 12:45:07 -0700813#ifdef __cplusplus
814extern "C" {
815#endif
816
817// A MiniTable for an empty message, used for unlinked sub-messages.
818extern const struct upb_MiniTable _kUpb_MiniTable_Empty;
819
820// Computes a bitmask in which the |l->required_count| lowest bits are set,
821// except that we skip the lowest bit (because upb never uses hasbit 0).
822//
823// Sample output:
824// requiredmask(1) => 0b10 (0x2)
825// requiredmask(5) => 0b111110 (0x3e)
826UPB_INLINE uint64_t upb_MiniTable_requiredmask(const struct upb_MiniTable* l) {
827 int n = l->required_count;
828 assert(0 < n && n <= 63);
829 return ((1ULL << n) - 1) << 1;
830}
831
832#ifdef __cplusplus
833} /* extern "C" */
834#endif
835
836
837#endif /* UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ */
838
839#ifndef UPB_MINI_TABLE_INTERNAL_SUB_H_
840#define UPB_MINI_TABLE_INTERNAL_SUB_H_
841
842
843union upb_MiniTableSub {
844 const struct upb_MiniTable* submsg;
845 const struct upb_MiniTableEnum* subenum;
846};
847
848#endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */
849
850// Must be last.
851
852#ifdef __cplusplus
853extern "C" {
854#endif
855
856typedef struct upb_MiniTableField upb_MiniTableField;
857
858UPB_API_INLINE upb_FieldType
859upb_MiniTableField_Type(const upb_MiniTableField* field) {
860 if (field->mode & kUpb_LabelFlags_IsAlternate) {
861 if (field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Int32) {
862 return kUpb_FieldType_Enum;
863 } else if (field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bytes) {
864 return kUpb_FieldType_String;
865 } else {
866 UPB_ASSERT(false);
867 }
868 }
869 return (upb_FieldType)field->UPB_PRIVATE(descriptortype);
870}
871
872UPB_API_INLINE upb_CType upb_MiniTableField_CType(const upb_MiniTableField* f) {
873 switch (upb_MiniTableField_Type(f)) {
874 case kUpb_FieldType_Double:
875 return kUpb_CType_Double;
876 case kUpb_FieldType_Float:
877 return kUpb_CType_Float;
878 case kUpb_FieldType_Int64:
879 case kUpb_FieldType_SInt64:
880 case kUpb_FieldType_SFixed64:
881 return kUpb_CType_Int64;
882 case kUpb_FieldType_Int32:
883 case kUpb_FieldType_SFixed32:
884 case kUpb_FieldType_SInt32:
885 return kUpb_CType_Int32;
886 case kUpb_FieldType_UInt64:
887 case kUpb_FieldType_Fixed64:
888 return kUpb_CType_UInt64;
889 case kUpb_FieldType_UInt32:
890 case kUpb_FieldType_Fixed32:
891 return kUpb_CType_UInt32;
892 case kUpb_FieldType_Enum:
893 return kUpb_CType_Enum;
894 case kUpb_FieldType_Bool:
895 return kUpb_CType_Bool;
896 case kUpb_FieldType_String:
897 return kUpb_CType_String;
898 case kUpb_FieldType_Bytes:
899 return kUpb_CType_Bytes;
900 case kUpb_FieldType_Group:
901 case kUpb_FieldType_Message:
902 return kUpb_CType_Message;
903 }
904 UPB_UNREACHABLE();
905}
906
907UPB_API_INLINE bool upb_MiniTableField_IsExtension(
908 const upb_MiniTableField* field) {
909 return field->mode & kUpb_LabelFlags_IsExtension;
910}
911
912UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum(
913 const upb_MiniTableField* field) {
914 return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Enum;
915}
916
917UPB_API_INLINE bool upb_MiniTableField_HasPresence(
918 const upb_MiniTableField* field) {
919 if (upb_MiniTableField_IsExtension(field)) {
920 return !upb_IsRepeatedOrMap(field);
921 } else {
922 return field->presence != 0;
923 }
924}
925
926#ifdef __cplusplus
927} /* extern "C" */
928#endif
929
930
931#endif /* UPB_MINI_TABLE_FIELD_H_ */
932
933// Must be last.
934
935#ifdef __cplusplus
936extern "C" {
937#endif
938
939typedef struct upb_MiniTable upb_MiniTable;
940
941UPB_API const upb_MiniTableField* upb_MiniTable_FindFieldByNumber(
942 const upb_MiniTable* table, uint32_t number);
943
944UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_GetFieldByIndex(
945 const upb_MiniTable* t, uint32_t index) {
946 return &t->fields[index];
947}
948
949// Returns the MiniTable for this message field. If the field is unlinked,
950// returns NULL.
951UPB_API_INLINE const upb_MiniTable* upb_MiniTable_GetSubMessageTable(
952 const upb_MiniTable* mini_table, const upb_MiniTableField* field) {
953 UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Message);
954 const upb_MiniTable* ret =
955 mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg;
956 UPB_ASSUME(ret);
957 return ret == &_kUpb_MiniTable_Empty ? NULL : ret;
958}
959
960// Returns the MiniTableEnum for this enum field. If the field is unlinked,
961// returns NULL.
962UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
963 const upb_MiniTable* mini_table, const upb_MiniTableField* field) {
964 UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Enum);
965 return mini_table->subs[field->UPB_PRIVATE(submsg_index)].subenum;
966}
967
968// Returns true if this MiniTable field is linked to a MiniTable for the
969// sub-message.
970UPB_API_INLINE bool upb_MiniTable_MessageFieldIsLinked(
971 const upb_MiniTable* mini_table, const upb_MiniTableField* field) {
972 return upb_MiniTable_GetSubMessageTable(mini_table, field) != NULL;
973}
974
975// If this field is in a oneof, returns the first field in the oneof.
976//
977// Otherwise returns NULL.
978//
979// Usage:
980// const upb_MiniTableField* field = upb_MiniTable_GetOneof(m, f);
981// do {
982// ..
983// } while (upb_MiniTable_NextOneofField(m, &field);
984//
985const upb_MiniTableField* upb_MiniTable_GetOneof(const upb_MiniTable* m,
986 const upb_MiniTableField* f);
987
988// Iterates to the next field in the oneof. If this is the last field in the
989// oneof, returns false. The ordering of fields in the oneof is not
990// guaranteed.
991// REQUIRES: |f| is the field initialized by upb_MiniTable_GetOneof and updated
992// by prior upb_MiniTable_NextOneofField calls.
993bool upb_MiniTable_NextOneofField(const upb_MiniTable* m,
994 const upb_MiniTableField** f);
995
996#ifdef __cplusplus
997} /* extern "C" */
998#endif
999
1000
1001#endif /* UPB_MINI_TABLE_MESSAGE_H_ */
1002
Eric Salo8809a112022-11-21 13:01:06 -08001003// Must be last.
1004
1005typedef struct upb_Array upb_Array;
1006typedef struct upb_Map upb_Map;
1007
1008typedef union {
1009 bool bool_val;
1010 float float_val;
1011 double double_val;
1012 int32_t int32_val;
1013 int64_t int64_val;
1014 uint32_t uint32_val;
1015 uint64_t uint64_val;
1016 const upb_Array* array_val;
1017 const upb_Map* map_val;
1018 const upb_Message* msg_val;
1019 upb_StringView str_val;
Jie Luo3560e232023-06-12 00:33:50 -07001020
1021 // EXPERIMENTAL: A tagged upb_Message*. Users must use this instead of
1022 // msg_val if unlinked sub-messages may possibly be in use. See the
1023 // documentation in kUpb_DecodeOption_ExperimentalAllowUnlinked for more
1024 // information.
1025 upb_TaggedMessagePtr tagged_msg_val;
Eric Salo8809a112022-11-21 13:01:06 -08001026} upb_MessageValue;
1027
1028typedef union {
1029 upb_Array* array;
1030 upb_Map* map;
1031 upb_Message* msg;
1032} upb_MutableMessageValue;
1033
1034
1035#endif /* UPB_MESSAGE_VALUE_H_ */
1036
1037/* upb_Arena is a specific allocator implementation that uses arena allocation.
1038 * The user provides an allocator that will be used to allocate the underlying
1039 * arena blocks. Arenas by nature do not require the individual allocations
1040 * to be freed. However the Arena does allow users to register cleanup
1041 * functions that will run when the arena is destroyed.
Joshua Habermandd69a482021-05-17 22:40:33 -07001042 *
Eric Salo8809a112022-11-21 13:01:06 -08001043 * A upb_Arena is *not* thread-safe.
1044 *
1045 * You could write a thread-safe arena allocator that satisfies the
1046 * upb_alloc interface, but it would not be as efficient for the
1047 * single-threaded case. */
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001048
Mike Kruskal9cf9db82022-11-04 21:22:31 -07001049#ifndef UPB_MEM_ARENA_H_
1050#define UPB_MEM_ARENA_H_
Joshua Habermandd69a482021-05-17 22:40:33 -07001051
Adam Cozzette7d5592e2023-08-23 12:15:26 -07001052#include <stddef.h>
1053#include <stdint.h>
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001054#include <string.h>
1055
1056
Mike Kruskal9cf9db82022-11-04 21:22:31 -07001057#ifndef UPB_MEM_ALLOC_H_
1058#define UPB_MEM_ALLOC_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -07001059
1060// Must be last.
1061
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001062#ifdef __cplusplus
1063extern "C" {
1064#endif
1065
Joshua Habermand3995ec2022-09-30 16:54:39 -07001066typedef struct upb_alloc upb_alloc;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001067
Joshua Habermand3995ec2022-09-30 16:54:39 -07001068/* A combined `malloc()`/`free()` function.
1069 * If `size` is 0 then the function acts like `free()`, otherwise it acts like
1070 * `realloc()`. Only `oldsize` bytes from a previous allocation are
1071 * preserved. */
1072typedef void* upb_alloc_func(upb_alloc* alloc, void* ptr, size_t oldsize,
1073 size_t size);
1074
1075/* A upb_alloc is a possibly-stateful allocator object.
1076 *
1077 * It could either be an arena allocator (which doesn't require individual
1078 * `free()` calls) or a regular `malloc()` (which does). The client must
1079 * therefore free memory unless it knows that the allocator is an arena
1080 * allocator. */
1081struct upb_alloc {
1082 upb_alloc_func* func;
1083};
1084
1085UPB_INLINE void* upb_malloc(upb_alloc* alloc, size_t size) {
1086 UPB_ASSERT(alloc);
1087 return alloc->func(alloc, NULL, 0, size);
1088}
1089
1090UPB_INLINE void* upb_realloc(upb_alloc* alloc, void* ptr, size_t oldsize,
1091 size_t size) {
1092 UPB_ASSERT(alloc);
1093 return alloc->func(alloc, ptr, oldsize, size);
1094}
1095
1096UPB_INLINE void upb_free(upb_alloc* alloc, void* ptr) {
1097 UPB_ASSERT(alloc);
1098 alloc->func(alloc, ptr, 0, 0);
1099}
1100
Mike Kruskal9cf9db82022-11-04 21:22:31 -07001101// The global allocator used by upb. Uses the standard malloc()/free().
Joshua Habermand3995ec2022-09-30 16:54:39 -07001102
1103extern upb_alloc upb_alloc_global;
1104
1105/* Functions that hard-code the global malloc.
1106 *
1107 * We still get benefit because we can put custom logic into our global
1108 * allocator, like injecting out-of-memory faults in debug/testing builds. */
1109
1110UPB_INLINE void* upb_gmalloc(size_t size) {
1111 return upb_malloc(&upb_alloc_global, size);
1112}
1113
1114UPB_INLINE void* upb_grealloc(void* ptr, size_t oldsize, size_t size) {
1115 return upb_realloc(&upb_alloc_global, ptr, oldsize, size);
1116}
1117
1118UPB_INLINE void upb_gfree(void* ptr) { upb_free(&upb_alloc_global, ptr); }
1119
1120#ifdef __cplusplus
1121} /* extern "C" */
1122#endif
1123
1124
Mike Kruskal9cf9db82022-11-04 21:22:31 -07001125#endif /* UPB_MEM_ALLOC_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -07001126
1127// Must be last.
1128
Joshua Habermand3995ec2022-09-30 16:54:39 -07001129typedef struct upb_Arena upb_Arena;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001130
1131typedef struct {
Joshua Habermand3995ec2022-09-30 16:54:39 -07001132 char *ptr, *end;
1133} _upb_ArenaHead;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001134
Eric Salo8809a112022-11-21 13:01:06 -08001135#ifdef __cplusplus
1136extern "C" {
1137#endif
1138
Mike Kruskal3bc50492022-12-01 13:34:12 -08001139// Creates an arena from the given initial block (if any -- n may be 0).
1140// Additional blocks will be allocated from |alloc|. If |alloc| is NULL, this
1141// is a fixed-size arena and cannot grow.
Eric Salo3f36a912022-12-05 14:12:25 -08001142UPB_API upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc);
Mike Kruskal3bc50492022-12-01 13:34:12 -08001143
Eric Salo3f36a912022-12-05 14:12:25 -08001144UPB_API void upb_Arena_Free(upb_Arena* a);
Eric Salo3f36a912022-12-05 14:12:25 -08001145UPB_API bool upb_Arena_Fuse(upb_Arena* a, upb_Arena* b);
1146
Joshua Habermand3995ec2022-09-30 16:54:39 -07001147void* _upb_Arena_SlowMalloc(upb_Arena* a, size_t size);
1148size_t upb_Arena_SpaceAllocated(upb_Arena* arena);
1149uint32_t upb_Arena_DebugRefCount(upb_Arena* arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001150
Joshua Habermand3995ec2022-09-30 16:54:39 -07001151UPB_INLINE size_t _upb_ArenaHas(upb_Arena* a) {
1152 _upb_ArenaHead* h = (_upb_ArenaHead*)a;
1153 return (size_t)(h->end - h->ptr);
1154}
1155
Eric Salo3f36a912022-12-05 14:12:25 -08001156UPB_API_INLINE void* upb_Arena_Malloc(upb_Arena* a, size_t size) {
Eric Salo8809a112022-11-21 13:01:06 -08001157 size = UPB_ALIGN_MALLOC(size);
Sandy Zhange3b09432023-08-07 09:30:02 -07001158 size_t span = size + UPB_ASAN_GUARD_SIZE;
1159 if (UPB_UNLIKELY(_upb_ArenaHas(a) < span)) {
Eric Salo8809a112022-11-21 13:01:06 -08001160 return _upb_Arena_SlowMalloc(a, size);
1161 }
1162
1163 // We have enough space to do a fast malloc.
Joshua Habermand3995ec2022-09-30 16:54:39 -07001164 _upb_ArenaHead* h = (_upb_ArenaHead*)a;
1165 void* ret = h->ptr;
1166 UPB_ASSERT(UPB_ALIGN_MALLOC((uintptr_t)ret) == (uintptr_t)ret);
1167 UPB_ASSERT(UPB_ALIGN_MALLOC(size) == size);
1168 UPB_UNPOISON_MEMORY_REGION(ret, size);
1169
Sandy Zhange3b09432023-08-07 09:30:02 -07001170 h->ptr += span;
Joshua Habermand3995ec2022-09-30 16:54:39 -07001171
1172 return ret;
1173}
1174
Joshua Habermand3995ec2022-09-30 16:54:39 -07001175// Shrinks the last alloc from arena.
1176// REQUIRES: (ptr, oldsize) was the last malloc/realloc from this arena.
1177// We could also add a upb_Arena_TryShrinkLast() which is simply a no-op if
1178// this was not the last alloc.
Eric Salo3f36a912022-12-05 14:12:25 -08001179UPB_API_INLINE void upb_Arena_ShrinkLast(upb_Arena* a, void* ptr,
1180 size_t oldsize, size_t size) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07001181 _upb_ArenaHead* h = (_upb_ArenaHead*)a;
1182 oldsize = UPB_ALIGN_MALLOC(oldsize);
1183 size = UPB_ALIGN_MALLOC(size);
Sandy Zhange3b09432023-08-07 09:30:02 -07001184 // Must be the last alloc.
1185 UPB_ASSERT((char*)ptr + oldsize == h->ptr - UPB_ASAN_GUARD_SIZE);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001186 UPB_ASSERT(size <= oldsize);
1187 h->ptr = (char*)ptr + size;
1188}
1189
Eric Salo3f36a912022-12-05 14:12:25 -08001190UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize,
1191 size_t size) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07001192 _upb_ArenaHead* h = (_upb_ArenaHead*)a;
1193 oldsize = UPB_ALIGN_MALLOC(oldsize);
1194 size = UPB_ALIGN_MALLOC(size);
1195 bool is_most_recent_alloc = (uintptr_t)ptr + oldsize == (uintptr_t)h->ptr;
1196
1197 if (is_most_recent_alloc) {
1198 ptrdiff_t diff = size - oldsize;
1199 if ((ptrdiff_t)_upb_ArenaHas(a) >= diff) {
1200 h->ptr += diff;
1201 return ptr;
1202 }
1203 } else if (size <= oldsize) {
1204 return ptr;
1205 }
1206
1207 void* ret = upb_Arena_Malloc(a, size);
1208
1209 if (ret && oldsize > 0) {
1210 memcpy(ret, ptr, UPB_MIN(oldsize, size));
1211 }
1212
1213 return ret;
1214}
1215
Eric Salo3f36a912022-12-05 14:12:25 -08001216UPB_API_INLINE upb_Arena* upb_Arena_New(void) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07001217 return upb_Arena_Init(NULL, 0, &upb_alloc_global);
1218}
1219
1220#ifdef __cplusplus
1221} /* extern "C" */
1222#endif
1223
1224
Mike Kruskal9cf9db82022-11-04 21:22:31 -07001225#endif /* UPB_MEM_ARENA_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -07001226
1227// Must be last.
1228
1229#ifdef __cplusplus
1230extern "C" {
1231#endif
1232
Eric Salob598b2d2022-12-22 23:14:27 -08001233// Creates a new array on the given arena that holds elements of this type.
1234UPB_API upb_Array* upb_Array_New(upb_Arena* a, upb_CType type);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001235
Eric Salob598b2d2022-12-22 23:14:27 -08001236// Returns the number of elements in the array.
1237UPB_API size_t upb_Array_Size(const upb_Array* arr);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001238
Eric Salob598b2d2022-12-22 23:14:27 -08001239// Returns the given element, which must be within the array's current size.
1240UPB_API upb_MessageValue upb_Array_Get(const upb_Array* arr, size_t i);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001241
Eric Salob598b2d2022-12-22 23:14:27 -08001242// Sets the given element, which must be within the array's current size.
1243UPB_API void upb_Array_Set(upb_Array* arr, size_t i, upb_MessageValue val);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001244
Eric Salob598b2d2022-12-22 23:14:27 -08001245// Appends an element to the array. Returns false on allocation failure.
1246UPB_API bool upb_Array_Append(upb_Array* array, upb_MessageValue val,
1247 upb_Arena* arena);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001248
Eric Salob598b2d2022-12-22 23:14:27 -08001249// Moves elements within the array using memmove().
1250// Like memmove(), the source and destination elements may be overlapping.
1251UPB_API void upb_Array_Move(upb_Array* array, size_t dst_idx, size_t src_idx,
1252 size_t count);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001253
Eric Salob598b2d2022-12-22 23:14:27 -08001254// Inserts one or more empty elements into the array.
1255// Existing elements are shifted right.
1256// The new elements have undefined state and must be set with `upb_Array_Set()`.
1257// REQUIRES: `i <= upb_Array_Size(arr)`
1258UPB_API bool upb_Array_Insert(upb_Array* array, size_t i, size_t count,
1259 upb_Arena* arena);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001260
Eric Salob598b2d2022-12-22 23:14:27 -08001261// Deletes one or more elements from the array.
1262// Existing elements are shifted left.
1263// REQUIRES: `i + count <= upb_Array_Size(arr)`
1264UPB_API void upb_Array_Delete(upb_Array* array, size_t i, size_t count);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001265
Eric Salob598b2d2022-12-22 23:14:27 -08001266// Changes the size of a vector. New elements are initialized to NULL/0.
1267// Returns false on allocation failure.
1268UPB_API bool upb_Array_Resize(upb_Array* array, size_t size, upb_Arena* arena);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001269
Jie Luo3560e232023-06-12 00:33:50 -07001270// Returns pointer to array data.
1271UPB_API const void* upb_Array_DataPtr(const upb_Array* arr);
1272
1273// Returns mutable pointer to array data.
1274UPB_API void* upb_Array_MutableDataPtr(upb_Array* arr);
1275
Joshua Habermand3995ec2022-09-30 16:54:39 -07001276#ifdef __cplusplus
1277} /* extern "C" */
1278#endif
1279
1280
Mike Kruskal9cf9db82022-11-04 21:22:31 -07001281#endif /* UPB_COLLECTIONS_ARRAY_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -07001282
1283// Must be last.
1284
1285#ifdef __cplusplus
1286extern "C" {
1287#endif
1288
Eric Salo8809a112022-11-21 13:01:06 -08001289// LINT.IfChange(struct_definition)
Mike Kruskal9cf9db82022-11-04 21:22:31 -07001290// Our internal representation for repeated fields.
Joshua Habermand3995ec2022-09-30 16:54:39 -07001291struct upb_Array {
1292 uintptr_t data; /* Tagged ptr: low 3 bits of ptr are lg2(elem size). */
1293 size_t size; /* The number of elements in the array. */
1294 size_t capacity; /* Allocated storage. Measured in elements. */
Joshua Habermand3995ec2022-09-30 16:54:39 -07001295};
Eric Salo8809a112022-11-21 13:01:06 -08001296// LINT.ThenChange(GoogleInternalName1)
Joshua Habermand3995ec2022-09-30 16:54:39 -07001297
Eric Salob7d54ac2022-12-29 11:59:42 -08001298UPB_INLINE size_t _upb_Array_ElementSizeLg2(const upb_Array* arr) {
1299 size_t ret = arr->data & 7;
1300 UPB_ASSERT(ret <= 4);
1301 return ret;
1302}
1303
Joshua Habermand3995ec2022-09-30 16:54:39 -07001304UPB_INLINE const void* _upb_array_constptr(const upb_Array* arr) {
Eric Salob7d54ac2022-12-29 11:59:42 -08001305 _upb_Array_ElementSizeLg2(arr); // Check assertion.
Joshua Habermand3995ec2022-09-30 16:54:39 -07001306 return (void*)(arr->data & ~(uintptr_t)7);
1307}
1308
1309UPB_INLINE uintptr_t _upb_array_tagptr(void* ptr, int elem_size_lg2) {
1310 UPB_ASSERT(elem_size_lg2 <= 4);
1311 return (uintptr_t)ptr | elem_size_lg2;
1312}
1313
1314UPB_INLINE void* _upb_array_ptr(upb_Array* arr) {
1315 return (void*)_upb_array_constptr(arr);
1316}
1317
1318UPB_INLINE uintptr_t _upb_tag_arrptr(void* ptr, int elem_size_lg2) {
1319 UPB_ASSERT(elem_size_lg2 <= 4);
1320 UPB_ASSERT(((uintptr_t)ptr & 7) == 0);
1321 return (uintptr_t)ptr | (unsigned)elem_size_lg2;
1322}
1323
Eric Salob7d54ac2022-12-29 11:59:42 -08001324extern const char _upb_Array_CTypeSizeLg2Table[];
1325
1326UPB_INLINE size_t _upb_Array_CTypeSizeLg2(upb_CType ctype) {
1327 return _upb_Array_CTypeSizeLg2Table[ctype];
1328}
1329
Joshua Habermand3995ec2022-09-30 16:54:39 -07001330UPB_INLINE upb_Array* _upb_Array_New(upb_Arena* a, size_t init_capacity,
1331 int elem_size_lg2) {
Eric Salob7d54ac2022-12-29 11:59:42 -08001332 UPB_ASSERT(elem_size_lg2 <= 4);
Joshua Haberman77559732022-10-03 11:13:05 -07001333 const size_t arr_size = UPB_ALIGN_UP(sizeof(upb_Array), UPB_MALLOC_ALIGN);
1334 const size_t bytes = arr_size + (init_capacity << elem_size_lg2);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001335 upb_Array* arr = (upb_Array*)upb_Arena_Malloc(a, bytes);
1336 if (!arr) return NULL;
1337 arr->data = _upb_tag_arrptr(UPB_PTR_AT(arr, arr_size, void), elem_size_lg2);
1338 arr->size = 0;
1339 arr->capacity = init_capacity;
1340 return arr;
1341}
1342
Mike Kruskal9cf9db82022-11-04 21:22:31 -07001343// Resizes the capacity of the array to be at least min_size.
Joshua Habermand3995ec2022-09-30 16:54:39 -07001344bool _upb_array_realloc(upb_Array* arr, size_t min_size, upb_Arena* arena);
1345
Joshua Habermand3995ec2022-09-30 16:54:39 -07001346UPB_INLINE bool _upb_array_reserve(upb_Array* arr, size_t size,
1347 upb_Arena* arena) {
1348 if (arr->capacity < size) return _upb_array_realloc(arr, size, arena);
1349 return true;
1350}
1351
Eric Salob598b2d2022-12-22 23:14:27 -08001352// Resize without initializing new elements.
1353UPB_INLINE bool _upb_Array_ResizeUninitialized(upb_Array* arr, size_t size,
1354 upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07001355 UPB_ASSERT(size <= arr->size || arena); // Allow NULL arena when shrinking.
Joshua Habermand3995ec2022-09-30 16:54:39 -07001356 if (!_upb_array_reserve(arr, size, arena)) return false;
1357 arr->size = size;
1358 return true;
1359}
1360
Eric Salob7d54ac2022-12-29 11:59:42 -08001361// This function is intended for situations where elem_size is compile-time
1362// constant or a known expression of the form (1 << lg2), so that the expression
1363// i*elem_size does not result in an actual multiplication.
1364UPB_INLINE void _upb_Array_Set(upb_Array* arr, size_t i, const void* data,
1365 size_t elem_size) {
1366 UPB_ASSERT(i < arr->size);
1367 UPB_ASSERT(elem_size == 1U << _upb_Array_ElementSizeLg2(arr));
1368 char* arr_data = (char*)_upb_array_ptr(arr);
1369 memcpy(arr_data + (i * elem_size), data, elem_size);
1370}
1371
Joshua Habermand3995ec2022-09-30 16:54:39 -07001372UPB_INLINE void _upb_array_detach(const void* msg, size_t ofs) {
1373 *UPB_PTR_AT(msg, ofs, upb_Array*) = NULL;
1374}
1375
Joshua Habermand3995ec2022-09-30 16:54:39 -07001376#ifdef __cplusplus
1377} /* extern "C" */
1378#endif
1379
1380
Adam Cozzette8059da22023-08-16 07:57:14 -07001381#endif /* UPB_COLLECTIONS_INTERNAL_ARRAY_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -07001382
Mike Kruskal9cf9db82022-11-04 21:22:31 -07001383#ifndef UPB_COLLECTIONS_MAP_H_
1384#define UPB_COLLECTIONS_MAP_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -07001385
1386
1387// Must be last.
1388
1389#ifdef __cplusplus
1390extern "C" {
1391#endif
1392
Eric Salob7d54ac2022-12-29 11:59:42 -08001393// Creates a new map on the given arena with the given key/value size.
1394UPB_API upb_Map* upb_Map_New(upb_Arena* a, upb_CType key_type,
1395 upb_CType value_type);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001396
Eric Salob7d54ac2022-12-29 11:59:42 -08001397// Returns the number of entries in the map.
1398UPB_API size_t upb_Map_Size(const upb_Map* map);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001399
Eric Salob7d54ac2022-12-29 11:59:42 -08001400// Stores a value for the given key into |*val| (or the zero value if the key is
1401// not present). Returns whether the key was present. The |val| pointer may be
1402// NULL, in which case the function tests whether the given key is present.
1403UPB_API bool upb_Map_Get(const upb_Map* map, upb_MessageValue key,
1404 upb_MessageValue* val);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001405
Eric Salob7d54ac2022-12-29 11:59:42 -08001406// Removes all entries in the map.
1407UPB_API void upb_Map_Clear(upb_Map* map);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001408
1409typedef enum {
Joshua Habermand3995ec2022-09-30 16:54:39 -07001410 kUpb_MapInsertStatus_Inserted = 0,
1411 kUpb_MapInsertStatus_Replaced = 1,
1412 kUpb_MapInsertStatus_OutOfMemory = 2,
Joshua Habermand3995ec2022-09-30 16:54:39 -07001413} upb_MapInsertStatus;
1414
Eric Salob7d54ac2022-12-29 11:59:42 -08001415// Sets the given key to the given value, returning whether the key was inserted
1416// or replaced. If the key was inserted, then any existing iterators will be
1417// invalidated.
1418UPB_API upb_MapInsertStatus upb_Map_Insert(upb_Map* map, upb_MessageValue key,
1419 upb_MessageValue val,
1420 upb_Arena* arena);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001421
Eric Salob7d54ac2022-12-29 11:59:42 -08001422// Sets the given key to the given value. Returns false if memory allocation
1423// failed. If the key is newly inserted, then any existing iterators will be
1424// invalidated.
1425UPB_API_INLINE bool upb_Map_Set(upb_Map* map, upb_MessageValue key,
1426 upb_MessageValue val, upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07001427 return upb_Map_Insert(map, key, val, arena) !=
1428 kUpb_MapInsertStatus_OutOfMemory;
1429}
1430
Eric Salo8809a112022-11-21 13:01:06 -08001431// Deletes this key from the table. Returns true if the key was present.
Eric Salob598b2d2022-12-22 23:14:27 -08001432// If present and |val| is non-NULL, stores the deleted value.
Eric Salob7d54ac2022-12-29 11:59:42 -08001433UPB_API bool upb_Map_Delete(upb_Map* map, upb_MessageValue key,
1434 upb_MessageValue* val);
Eric Salob598b2d2022-12-22 23:14:27 -08001435
Eric Salob598b2d2022-12-22 23:14:27 -08001436// (DEPRECATED and going away soon. Do not use.)
Eric Salob7d54ac2022-12-29 11:59:42 -08001437UPB_INLINE bool upb_Map_Delete2(upb_Map* map, upb_MessageValue key,
1438 upb_MessageValue* val) {
1439 return upb_Map_Delete(map, key, val);
Eric Salob598b2d2022-12-22 23:14:27 -08001440}
Joshua Habermand3995ec2022-09-30 16:54:39 -07001441
Eric Salo8809a112022-11-21 13:01:06 -08001442// Map iteration:
1443//
1444// size_t iter = kUpb_Map_Begin;
1445// upb_MessageValue key, val;
1446// while (upb_Map_Next(map, &key, &val, &iter)) {
1447// ...
1448// }
1449
1450#define kUpb_Map_Begin ((size_t)-1)
1451
1452// Advances to the next entry. Returns false if no more entries are present.
1453// Otherwise returns true and populates both *key and *value.
Eric Salob7d54ac2022-12-29 11:59:42 -08001454UPB_API bool upb_Map_Next(const upb_Map* map, upb_MessageValue* key,
1455 upb_MessageValue* val, size_t* iter);
Eric Salo8809a112022-11-21 13:01:06 -08001456
Jie Luo3560e232023-06-12 00:33:50 -07001457// Sets the value for the entry pointed to by iter.
1458// WARNING: this does not currently work for string values!
1459UPB_API void upb_Map_SetEntryValue(upb_Map* map, size_t iter,
1460 upb_MessageValue val);
1461
Eric Salo8809a112022-11-21 13:01:06 -08001462// DEPRECATED iterator, slated for removal.
1463
Joshua Habermand3995ec2022-09-30 16:54:39 -07001464/* Map iteration:
1465 *
1466 * size_t iter = kUpb_Map_Begin;
1467 * while (upb_MapIterator_Next(map, &iter)) {
1468 * upb_MessageValue key = upb_MapIterator_Key(map, iter);
1469 * upb_MessageValue val = upb_MapIterator_Value(map, iter);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001470 * }
1471 */
1472
Eric Salo8809a112022-11-21 13:01:06 -08001473// Advances to the next entry. Returns false if no more entries are present.
Jason Lunn67dee292023-07-13 13:15:26 -07001474UPB_API bool upb_MapIterator_Next(const upb_Map* map, size_t* iter);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001475
Eric Salob7d54ac2022-12-29 11:59:42 -08001476// Returns true if the iterator still points to a valid entry, or false if the
1477// iterator is past the last element. It is an error to call this function with
1478// kUpb_Map_Begin (you must call next() at least once first).
Jason Lunn67dee292023-07-13 13:15:26 -07001479UPB_API bool upb_MapIterator_Done(const upb_Map* map, size_t iter);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001480
Eric Salob7d54ac2022-12-29 11:59:42 -08001481// Returns the key and value for this entry of the map.
Jason Lunn67dee292023-07-13 13:15:26 -07001482UPB_API upb_MessageValue upb_MapIterator_Key(const upb_Map* map, size_t iter);
1483UPB_API upb_MessageValue upb_MapIterator_Value(const upb_Map* map, size_t iter);
Joshua Habermand3995ec2022-09-30 16:54:39 -07001484
Joshua Habermand3995ec2022-09-30 16:54:39 -07001485#ifdef __cplusplus
1486} /* extern "C" */
1487#endif
1488
1489
Mike Kruskal9cf9db82022-11-04 21:22:31 -07001490#endif /* UPB_COLLECTIONS_MAP_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -07001491
Eric Salo8809a112022-11-21 13:01:06 -08001492// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
Joshua Habermand3995ec2022-09-30 16:54:39 -07001493
Adam Cozzette8059da22023-08-16 07:57:14 -07001494#ifndef UPB_COLLECTIONS_INTERNAL_MAP_H_
1495#define UPB_COLLECTIONS_INTERNAL_MAP_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -07001496
1497
Eric Salo8809a112022-11-21 13:01:06 -08001498#ifndef UPB_HASH_STR_TABLE_H_
1499#define UPB_HASH_STR_TABLE_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -07001500
1501
Joshua Habermandd69a482021-05-17 22:40:33 -07001502/*
1503 * upb_table
1504 *
1505 * This header is INTERNAL-ONLY! Its interfaces are not public or stable!
1506 * This file defines very fast int->upb_value (inttable) and string->upb_value
1507 * (strtable) hash tables.
1508 *
1509 * The table uses chained scatter with Brent's variation (inspired by the Lua
1510 * implementation of hash tables). The hash function for strings is Austin
1511 * Appleby's "MurmurHash."
1512 *
1513 * The inttable uses uintptr_t as its key, which guarantees it can be used to
1514 * store pointers or integers of at least 32 bits (upb isn't really useful on
1515 * systems where sizeof(void*) < 4).
1516 *
1517 * The table must be homogeneous (all values of the same type). In debug
1518 * mode, we check this on insert and lookup.
1519 */
1520
Eric Salo8809a112022-11-21 13:01:06 -08001521#ifndef UPB_HASH_COMMON_H_
1522#define UPB_HASH_COMMON_H_
Joshua Habermandd69a482021-05-17 22:40:33 -07001523
Joshua Habermandd69a482021-05-17 22:40:33 -07001524#include <string.h>
1525
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001526
Joshua Habermanf41049a2022-01-21 14:41:25 -08001527// Must be last.
1528
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001529#ifdef __cplusplus
1530extern "C" {
1531#endif
1532
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001533/* upb_value ******************************************************************/
1534
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001535typedef struct {
1536 uint64_t val;
1537} upb_value;
1538
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001539/* Variant that works with a length-delimited rather than NULL-delimited string,
1540 * as supported by strtable. */
Joshua Habermanf41049a2022-01-21 14:41:25 -08001541char* upb_strdup2(const char* s, size_t len, upb_Arena* a);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001542
Joshua Habermanf41049a2022-01-21 14:41:25 -08001543UPB_INLINE void _upb_value_setval(upb_value* v, uint64_t val) { v->val = val; }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001544
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001545/* For each value ctype, define the following set of functions:
1546 *
1547 * // Get/set an int32 from a upb_value.
1548 * int32_t upb_value_getint32(upb_value val);
1549 * void upb_value_setint32(upb_value *val, int32_t cval);
1550 *
1551 * // Construct a new upb_value from an int32.
1552 * upb_value upb_value_int32(int32_t val); */
Joshua Habermanf41049a2022-01-21 14:41:25 -08001553#define FUNCS(name, membername, type_t, converter, proto_type) \
1554 UPB_INLINE void upb_value_set##name(upb_value* val, type_t cval) { \
1555 val->val = (converter)cval; \
1556 } \
1557 UPB_INLINE upb_value upb_value_##name(type_t val) { \
1558 upb_value ret; \
1559 upb_value_set##name(&ret, val); \
1560 return ret; \
1561 } \
1562 UPB_INLINE type_t upb_value_get##name(upb_value val) { \
1563 return (type_t)(converter)val.val; \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001564 }
1565
Joshua Habermanf41049a2022-01-21 14:41:25 -08001566FUNCS(int32, int32, int32_t, int32_t, UPB_CTYPE_INT32)
1567FUNCS(int64, int64, int64_t, int64_t, UPB_CTYPE_INT64)
1568FUNCS(uint32, uint32, uint32_t, uint32_t, UPB_CTYPE_UINT32)
1569FUNCS(uint64, uint64, uint64_t, uint64_t, UPB_CTYPE_UINT64)
1570FUNCS(bool, _bool, bool, bool, UPB_CTYPE_BOOL)
1571FUNCS(cstr, cstr, char*, uintptr_t, UPB_CTYPE_CSTR)
Jie Luo3560e232023-06-12 00:33:50 -07001572FUNCS(uintptr, uptr, uintptr_t, uintptr_t, UPB_CTYPE_UPTR)
Joshua Habermanf41049a2022-01-21 14:41:25 -08001573FUNCS(ptr, ptr, void*, uintptr_t, UPB_CTYPE_PTR)
1574FUNCS(constptr, constptr, const void*, uintptr_t, UPB_CTYPE_CONSTPTR)
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001575
1576#undef FUNCS
1577
Joshua Habermanf41049a2022-01-21 14:41:25 -08001578UPB_INLINE void upb_value_setfloat(upb_value* val, float cval) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001579 memcpy(&val->val, &cval, sizeof(cval));
1580}
1581
Joshua Habermanf41049a2022-01-21 14:41:25 -08001582UPB_INLINE void upb_value_setdouble(upb_value* val, double cval) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001583 memcpy(&val->val, &cval, sizeof(cval));
1584}
1585
1586UPB_INLINE upb_value upb_value_float(float cval) {
1587 upb_value ret;
1588 upb_value_setfloat(&ret, cval);
1589 return ret;
1590}
1591
1592UPB_INLINE upb_value upb_value_double(double cval) {
1593 upb_value ret;
1594 upb_value_setdouble(&ret, cval);
1595 return ret;
1596}
1597
1598#undef SET_TYPE
1599
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001600/* upb_tabkey *****************************************************************/
1601
1602/* Either:
1603 * 1. an actual integer key, or
1604 * 2. a pointer to a string prefixed by its uint32_t length, owned by us.
1605 *
1606 * ...depending on whether this is a string table or an int table. We would
1607 * make this a union of those two types, but C89 doesn't support statically
1608 * initializing a non-first union member. */
1609typedef uintptr_t upb_tabkey;
1610
Joshua Habermanf41049a2022-01-21 14:41:25 -08001611UPB_INLINE char* upb_tabstr(upb_tabkey key, uint32_t* len) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001612 char* mem = (char*)key;
1613 if (len) memcpy(len, mem, sizeof(*len));
1614 return mem + sizeof(*len);
1615}
1616
Joshua Habermanf41049a2022-01-21 14:41:25 -08001617UPB_INLINE upb_StringView upb_tabstrview(upb_tabkey key) {
1618 upb_StringView ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001619 uint32_t len;
1620 ret.data = upb_tabstr(key, &len);
1621 ret.size = len;
1622 return ret;
1623}
1624
1625/* upb_tabval *****************************************************************/
1626
1627typedef struct upb_tabval {
1628 uint64_t val;
1629} upb_tabval;
1630
Joshua Habermanf41049a2022-01-21 14:41:25 -08001631#define UPB_TABVALUE_EMPTY_INIT \
1632 { -1 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001633
1634/* upb_table ******************************************************************/
1635
1636typedef struct _upb_tabent {
1637 upb_tabkey key;
1638 upb_tabval val;
1639
1640 /* Internal chaining. This is const so we can create static initializers for
1641 * tables. We cast away const sometimes, but *only* when the containing
1642 * upb_table is known to be non-const. This requires a bit of care, but
1643 * the subtlety is confined to table.c. */
Joshua Habermanf41049a2022-01-21 14:41:25 -08001644 const struct _upb_tabent* next;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001645} upb_tabent;
1646
1647typedef struct {
Joshua Habermanf41049a2022-01-21 14:41:25 -08001648 size_t count; /* Number of entries in the hash part. */
1649 uint32_t mask; /* Mask to turn hash value -> bucket. */
1650 uint32_t max_count; /* Max count before we hit our load limit. */
1651 uint8_t size_lg2; /* Size of the hashtable part is 2^size_lg2 entries. */
1652 upb_tabent* entries;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001653} upb_table;
1654
Eric Salo8809a112022-11-21 13:01:06 -08001655UPB_INLINE size_t upb_table_size(const upb_table* t) {
1656 return t->size_lg2 ? 1 << t->size_lg2 : 0;
1657}
1658
1659// Internal-only functions, in .h file only out of necessity.
Mike Kruskal04e81352022-11-23 11:07:53 -08001660
Eric Salo8809a112022-11-21 13:01:06 -08001661UPB_INLINE bool upb_tabent_isempty(const upb_tabent* e) { return e->key == 0; }
1662
Mike Kruskal04e81352022-11-23 11:07:53 -08001663uint32_t _upb_Hash(const void* p, size_t n, uint64_t seed);
1664
Eric Salo8809a112022-11-21 13:01:06 -08001665#ifdef __cplusplus
1666} /* extern "C" */
1667#endif
1668
1669
1670#endif /* UPB_HASH_COMMON_H_ */
1671
1672// Must be last.
1673
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001674typedef struct {
1675 upb_table t;
1676} upb_strtable;
1677
Eric Salo8809a112022-11-21 13:01:06 -08001678#ifdef __cplusplus
1679extern "C" {
1680#endif
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001681
Eric Salo8809a112022-11-21 13:01:06 -08001682// Initialize a table. If memory allocation failed, false is returned and
1683// the table is uninitialized.
Joshua Habermanf41049a2022-01-21 14:41:25 -08001684bool upb_strtable_init(upb_strtable* table, size_t expected_size, upb_Arena* a);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001685
Eric Salo8809a112022-11-21 13:01:06 -08001686// Returns the number of values in the table.
Joshua Habermanf41049a2022-01-21 14:41:25 -08001687UPB_INLINE size_t upb_strtable_count(const upb_strtable* t) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001688 return t->t.count;
1689}
1690
Joshua Habermanf41049a2022-01-21 14:41:25 -08001691void upb_strtable_clear(upb_strtable* t);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001692
Eric Salo8809a112022-11-21 13:01:06 -08001693// Inserts the given key into the hashtable with the given value.
1694// The key must not already exist in the hash table. The key is not required
1695// to be NULL-terminated, and the table will make an internal copy of the key.
1696//
1697// If a table resize was required but memory allocation failed, false is
1698// returned and the table is unchanged. */
Joshua Habermanf41049a2022-01-21 14:41:25 -08001699bool upb_strtable_insert(upb_strtable* t, const char* key, size_t len,
1700 upb_value val, upb_Arena* a);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001701
Eric Salo8809a112022-11-21 13:01:06 -08001702// Looks up key in this table, returning "true" if the key was found.
1703// If v is non-NULL, copies the value for this key into *v.
Joshua Habermanf41049a2022-01-21 14:41:25 -08001704bool upb_strtable_lookup2(const upb_strtable* t, const char* key, size_t len,
1705 upb_value* v);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001706
Eric Salo8809a112022-11-21 13:01:06 -08001707// For NULL-terminated strings.
Joshua Habermanf41049a2022-01-21 14:41:25 -08001708UPB_INLINE bool upb_strtable_lookup(const upb_strtable* t, const char* key,
1709 upb_value* v) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001710 return upb_strtable_lookup2(t, key, strlen(key), v);
1711}
1712
Eric Salo8809a112022-11-21 13:01:06 -08001713// Removes an item from the table. Returns true if the remove was successful,
1714// and stores the removed item in *val if non-NULL.
Joshua Habermanf41049a2022-01-21 14:41:25 -08001715bool upb_strtable_remove2(upb_strtable* t, const char* key, size_t len,
1716 upb_value* val);
1717
1718UPB_INLINE bool upb_strtable_remove(upb_strtable* t, const char* key,
1719 upb_value* v) {
1720 return upb_strtable_remove2(t, key, strlen(key), v);
1721}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001722
Eric Salo8809a112022-11-21 13:01:06 -08001723// Exposed for testing only.
Joshua Habermanf41049a2022-01-21 14:41:25 -08001724bool upb_strtable_resize(upb_strtable* t, size_t size_lg2, upb_Arena* a);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001725
Eric Salo8809a112022-11-21 13:01:06 -08001726/* Iteration over strtable:
Joshua Habermanf41049a2022-01-21 14:41:25 -08001727 *
Eric Salo8809a112022-11-21 13:01:06 -08001728 * intptr_t iter = UPB_STRTABLE_BEGIN;
Joshua Habermanf41049a2022-01-21 14:41:25 -08001729 * upb_StringView key;
1730 * upb_value val;
1731 * while (upb_strtable_next2(t, &key, &val, &iter)) {
1732 * // ...
1733 * }
1734 */
1735
1736#define UPB_STRTABLE_BEGIN -1
1737
1738bool upb_strtable_next2(const upb_strtable* t, upb_StringView* key,
1739 upb_value* val, intptr_t* iter);
1740void upb_strtable_removeiter(upb_strtable* t, intptr_t* iter);
Jie Luo3560e232023-06-12 00:33:50 -07001741void upb_strtable_setentryvalue(upb_strtable* t, intptr_t iter, upb_value v);
Joshua Habermanf41049a2022-01-21 14:41:25 -08001742
1743/* DEPRECATED iterators, slated for removal.
1744 *
Eric Salo8809a112022-11-21 13:01:06 -08001745 * Iterators for string tables. We are subject to some kind of unusual
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001746 * design constraints:
1747 *
1748 * For high-level languages:
1749 * - we must be able to guarantee that we don't crash or corrupt memory even if
1750 * the program accesses an invalidated iterator.
1751 *
1752 * For C++11 range-based for:
1753 * - iterators must be copyable
1754 * - iterators must be comparable
1755 * - it must be possible to construct an "end" value.
1756 *
1757 * Iteration order is undefined.
1758 *
1759 * Modifying the table invalidates iterators. upb_{str,int}table_done() is
1760 * guaranteed to work even on an invalidated iterator, as long as the table it
1761 * is iterating over has not been freed. Calling next() or accessing data from
1762 * an invalidated iterator yields unspecified elements from the table, but it is
1763 * guaranteed not to crash and to return real table elements (except when done()
1764 * is true). */
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001765/* upb_strtable_iter **********************************************************/
1766
1767/* upb_strtable_iter i;
1768 * upb_strtable_begin(&i, t);
1769 * for(; !upb_strtable_done(&i); upb_strtable_next(&i)) {
1770 * const char *key = upb_strtable_iter_key(&i);
1771 * const upb_value val = upb_strtable_iter_value(&i);
1772 * // ...
1773 * }
1774 */
1775
1776typedef struct {
Joshua Habermanf41049a2022-01-21 14:41:25 -08001777 const upb_strtable* t;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001778 size_t index;
1779} upb_strtable_iter;
1780
Eric Salo8809a112022-11-21 13:01:06 -08001781UPB_INLINE const upb_tabent* str_tabent(const upb_strtable_iter* i) {
1782 return &i->t->t.entries[i->index];
1783}
1784
Joshua Habermanf41049a2022-01-21 14:41:25 -08001785void upb_strtable_begin(upb_strtable_iter* i, const upb_strtable* t);
1786void upb_strtable_next(upb_strtable_iter* i);
1787bool upb_strtable_done(const upb_strtable_iter* i);
1788upb_StringView upb_strtable_iter_key(const upb_strtable_iter* i);
1789upb_value upb_strtable_iter_value(const upb_strtable_iter* i);
1790void upb_strtable_iter_setdone(upb_strtable_iter* i);
1791bool upb_strtable_iter_isequal(const upb_strtable_iter* i1,
1792 const upb_strtable_iter* i2);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001793
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001794#ifdef __cplusplus
Joshua Habermanf41049a2022-01-21 14:41:25 -08001795} /* extern "C" */
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001796#endif
1797
1798
Eric Salo8809a112022-11-21 13:01:06 -08001799#endif /* UPB_HASH_STR_TABLE_H_ */
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001800
Joshua Habermand3995ec2022-09-30 16:54:39 -07001801// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001802
Joshua Habermand3995ec2022-09-30 16:54:39 -07001803struct upb_Map {
Eric Salo8809a112022-11-21 13:01:06 -08001804 // Size of key and val, based on the map type.
1805 // Strings are represented as '0' because they must be handled specially.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001806 char key_size;
1807 char val_size;
1808
1809 upb_strtable table;
Joshua Habermand3995ec2022-09-30 16:54:39 -07001810};
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001811
Eric Salo8809a112022-11-21 13:01:06 -08001812#ifdef __cplusplus
1813extern "C" {
1814#endif
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001815
Eric Salo8809a112022-11-21 13:01:06 -08001816// Converting between internal table representation and user values.
1817//
1818// _upb_map_tokey() and _upb_map_fromkey() are inverses.
1819// _upb_map_tovalue() and _upb_map_fromvalue() are inverses.
1820//
1821// These functions account for the fact that strings are treated differently
1822// from other types when stored in a map.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001823
Joshua Habermanf41049a2022-01-21 14:41:25 -08001824UPB_INLINE upb_StringView _upb_map_tokey(const void* key, size_t size) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001825 if (size == UPB_MAPTYPE_STRING) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08001826 return *(upb_StringView*)key;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001827 } else {
Joshua Habermanf41049a2022-01-21 14:41:25 -08001828 return upb_StringView_FromDataAndSize((const char*)key, size);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001829 }
1830}
1831
Joshua Habermanf41049a2022-01-21 14:41:25 -08001832UPB_INLINE void _upb_map_fromkey(upb_StringView key, void* out, size_t size) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001833 if (size == UPB_MAPTYPE_STRING) {
1834 memcpy(out, &key, sizeof(key));
1835 } else {
1836 memcpy(out, key.data, size);
1837 }
1838}
1839
Joshua Habermanf41049a2022-01-21 14:41:25 -08001840UPB_INLINE bool _upb_map_tovalue(const void* val, size_t size,
1841 upb_value* msgval, upb_Arena* a) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001842 if (size == UPB_MAPTYPE_STRING) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08001843 upb_StringView* strp = (upb_StringView*)upb_Arena_Malloc(a, sizeof(*strp));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001844 if (!strp) return false;
Joshua Habermanf41049a2022-01-21 14:41:25 -08001845 *strp = *(upb_StringView*)val;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001846 *msgval = upb_value_ptr(strp);
1847 } else {
1848 memcpy(msgval, val, size);
1849 }
1850 return true;
1851}
1852
1853UPB_INLINE void _upb_map_fromvalue(upb_value val, void* out, size_t size) {
1854 if (size == UPB_MAPTYPE_STRING) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08001855 const upb_StringView* strp = (const upb_StringView*)upb_value_getptr(val);
1856 memcpy(out, strp, sizeof(upb_StringView));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001857 } else {
1858 memcpy(out, &val, size);
1859 }
1860}
1861
Eric Salo8809a112022-11-21 13:01:06 -08001862UPB_INLINE void* _upb_map_next(const upb_Map* map, size_t* iter) {
1863 upb_strtable_iter it;
1864 it.t = &map->table;
1865 it.index = *iter;
1866 upb_strtable_next(&it);
1867 *iter = it.index;
1868 if (upb_strtable_done(&it)) return NULL;
1869 return (void*)str_tabent(&it);
1870}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001871
Eric Salo8809a112022-11-21 13:01:06 -08001872UPB_INLINE void _upb_Map_Clear(upb_Map* map) {
1873 upb_strtable_clear(&map->table);
1874}
1875
Eric Salob598b2d2022-12-22 23:14:27 -08001876UPB_INLINE bool _upb_Map_Delete(upb_Map* map, const void* key, size_t key_size,
1877 upb_value* val) {
Eric Salo8809a112022-11-21 13:01:06 -08001878 upb_StringView k = _upb_map_tokey(key, key_size);
Eric Salob598b2d2022-12-22 23:14:27 -08001879 return upb_strtable_remove2(&map->table, k.data, k.size, val);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001880}
1881
Joshua Habermanf41049a2022-01-21 14:41:25 -08001882UPB_INLINE bool _upb_Map_Get(const upb_Map* map, const void* key,
1883 size_t key_size, void* val, size_t val_size) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001884 upb_value tabval;
Joshua Habermanf41049a2022-01-21 14:41:25 -08001885 upb_StringView k = _upb_map_tokey(key, key_size);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001886 bool ret = upb_strtable_lookup2(&map->table, k.data, k.size, &tabval);
1887 if (ret && val) {
1888 _upb_map_fromvalue(tabval, val, val_size);
1889 }
1890 return ret;
1891}
1892
Eric Salo8809a112022-11-21 13:01:06 -08001893UPB_INLINE upb_MapInsertStatus _upb_Map_Insert(upb_Map* map, const void* key,
1894 size_t key_size, void* val,
1895 size_t val_size, upb_Arena* a) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08001896 upb_StringView strkey = _upb_map_tokey(key, key_size);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001897 upb_value tabval = {0};
Joshua Habermand3995ec2022-09-30 16:54:39 -07001898 if (!_upb_map_tovalue(val, val_size, &tabval, a)) {
Eric Salo8809a112022-11-21 13:01:06 -08001899 return kUpb_MapInsertStatus_OutOfMemory;
Joshua Habermand3995ec2022-09-30 16:54:39 -07001900 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001901
Eric Salo8809a112022-11-21 13:01:06 -08001902 // TODO(haberman): add overwrite operation to minimize number of lookups.
Joshua Habermand3995ec2022-09-30 16:54:39 -07001903 bool removed =
1904 upb_strtable_remove2(&map->table, strkey.data, strkey.size, NULL);
1905 if (!upb_strtable_insert(&map->table, strkey.data, strkey.size, tabval, a)) {
Eric Salo8809a112022-11-21 13:01:06 -08001906 return kUpb_MapInsertStatus_OutOfMemory;
Joshua Habermand3995ec2022-09-30 16:54:39 -07001907 }
Eric Salo8809a112022-11-21 13:01:06 -08001908 return removed ? kUpb_MapInsertStatus_Replaced
1909 : kUpb_MapInsertStatus_Inserted;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001910}
1911
Eric Salo8809a112022-11-21 13:01:06 -08001912UPB_INLINE size_t _upb_Map_Size(const upb_Map* map) {
1913 return map->table.t.count;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08001914}
1915
Eric Salob7d54ac2022-12-29 11:59:42 -08001916// Strings/bytes are special-cased in maps.
1917extern char _upb_Map_CTypeSizeTable[12];
1918
1919UPB_INLINE size_t _upb_Map_CTypeSize(upb_CType ctype) {
1920 return _upb_Map_CTypeSizeTable[ctype];
1921}
1922
Eric Salo8809a112022-11-21 13:01:06 -08001923// Creates a new map on the given arena with this key/value type.
1924upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size);
1925
1926#ifdef __cplusplus
1927} /* extern "C" */
1928#endif
1929
1930
Adam Cozzette8059da22023-08-16 07:57:14 -07001931#endif /* UPB_COLLECTIONS_INTERNAL_MAP_H_ */
Mike Kruskal3bc50492022-12-01 13:34:12 -08001932
1933// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
1934
Adam Cozzette8059da22023-08-16 07:57:14 -07001935#ifndef UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_
1936#define UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_
Mike Kruskal3bc50492022-12-01 13:34:12 -08001937
1938#include <stdlib.h>
1939
1940
Protobuf Team Botdcc1f612023-09-05 21:56:25 +00001941#ifndef UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_
1942#define UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_
1943
1944
1945#ifndef UPB_MINI_TABLE_INTERNAL_TYPES_H_
1946#define UPB_MINI_TABLE_INTERNAL_TYPES_H_
1947
1948typedef struct upb_Message_InternalData upb_Message_InternalData;
1949
1950typedef struct {
1951 union {
1952 upb_Message_InternalData* internal;
1953
1954 // Force 8-byte alignment, since the data members may contain members that
1955 // require 8-byte alignment.
1956 double d;
1957 };
1958} upb_Message_Internal;
1959
1960#endif // UPB_MINI_TABLE_INTERNAL_TYPES_H_
1961
1962// Map entries aren't actually stored for map fields, they are only used during
1963// parsing. For parsing, it helps a lot if all map entry messages have the same
1964// layout. The layout code in mini_table/decode.c will ensure that all map
1965// entries have this layout.
1966//
1967// Note that users can and do create map entries directly, which will also use
1968// this layout.
1969//
1970// NOTE: sync with wire/decode.c.
1971typedef struct {
1972 // We only need 2 hasbits max, but due to alignment we'll use 8 bytes here,
1973 // and the uint64_t helps make this clear.
1974 uint64_t hasbits;
1975 union {
1976 upb_StringView str; // For str/bytes.
1977 upb_value val; // For all other types.
1978 } k;
1979 union {
1980 upb_StringView str; // For str/bytes.
1981 upb_value val; // For all other types.
1982 } v;
1983} upb_MapEntryData;
1984
1985typedef struct {
1986 upb_Message_Internal internal;
1987 upb_MapEntryData data;
1988} upb_MapEntry;
1989
1990#endif // UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_
1991
Adam Cozzette8059da22023-08-16 07:57:14 -07001992#ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_
1993#define UPB_MESSAGE_INTERNAL_EXTENSION_H_
Mike Kruskal3bc50492022-12-01 13:34:12 -08001994
1995
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07001996// Public APIs for message operations that do not depend on the schema.
Eric Salo8809a112022-11-21 13:01:06 -08001997//
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07001998// MiniTable-based accessors live in accessors.h.
Eric Salo8809a112022-11-21 13:01:06 -08001999
2000#ifndef UPB_MESSAGE_MESSAGE_H_
2001#define UPB_MESSAGE_MESSAGE_H_
2002
Protobuf Team Bot75af7f92023-09-06 18:07:53 +00002003#include <stddef.h>
2004
Eric Salo8809a112022-11-21 13:01:06 -08002005
2006// Must be last.
2007
2008#ifdef __cplusplus
2009extern "C" {
2010#endif
2011
2012// Creates a new message with the given mini_table on the given arena.
Eric Salo10505992022-12-12 12:16:36 -08002013UPB_API upb_Message* upb_Message_New(const upb_MiniTable* mini_table,
2014 upb_Arena* arena);
Eric Salo8809a112022-11-21 13:01:06 -08002015
2016// Adds unknown data (serialized protobuf data) to the given message.
2017// The data is copied into the message instance.
2018void upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len,
2019 upb_Arena* arena);
2020
2021// Returns a reference to the message's unknown data.
2022const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len);
2023
2024// Removes partial unknown data from message.
2025void upb_Message_DeleteUnknown(upb_Message* msg, const char* data, size_t len);
2026
2027// Returns the number of extensions present in this message.
2028size_t upb_Message_ExtensionCount(const upb_Message* msg);
2029
2030#ifdef __cplusplus
2031} /* extern "C" */
2032#endif
2033
2034
2035#endif /* UPB_MESSAGE_MESSAGE_H_ */
2036
Mike Kruskal9d435022023-07-11 12:45:07 -07002037#ifndef UPB_MINI_TABLE_EXTENSION_H_
2038#define UPB_MINI_TABLE_EXTENSION_H_
Eric Salo8809a112022-11-21 13:01:06 -08002039
2040
Mike Kruskal9d435022023-07-11 12:45:07 -07002041#ifndef UPB_MINI_TABLE_INTERNAL_EXTENSION_H_
2042#define UPB_MINI_TABLE_INTERNAL_EXTENSION_H_
Eric Salo8809a112022-11-21 13:01:06 -08002043
2044
2045// Must be last.
2046
Eric Salo8809a112022-11-21 13:01:06 -08002047struct upb_MiniTableExtension {
Deanna Garcia59cfc2f2023-01-31 13:19:28 -08002048 // Do not move this field. We need to be able to alias pointers.
Mike Kruskal9d435022023-07-11 12:45:07 -07002049 struct upb_MiniTableField field;
Deanna Garcia59cfc2f2023-01-31 13:19:28 -08002050
Mike Kruskal9d435022023-07-11 12:45:07 -07002051 const struct upb_MiniTable* extendee;
2052 union upb_MiniTableSub sub; // NULL unless submessage or proto2 enum
Eric Salo8809a112022-11-21 13:01:06 -08002053};
2054
2055
Mike Kruskal9d435022023-07-11 12:45:07 -07002056#endif /* UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ */
2057
2058// Must be last.
2059
2060typedef struct upb_MiniTableExtension upb_MiniTableExtension;
2061
2062
2063#endif /* UPB_MINI_TABLE_EXTENSION_H_ */
Eric Salo8809a112022-11-21 13:01:06 -08002064
2065// Must be last.
2066
2067// The internal representation of an extension is self-describing: it contains
2068// enough information that we can serialize it to binary format without needing
2069// to look it up in a upb_ExtensionRegistry.
2070//
2071// This representation allocates 16 bytes to data on 64-bit platforms.
2072// This is rather wasteful for scalars (in the extreme case of bool,
2073// it wastes 15 bytes). We accept this because we expect messages to be
2074// the most common extension type.
2075typedef struct {
2076 const upb_MiniTableExtension* ext;
2077 union {
2078 upb_StringView str;
2079 void* ptr;
2080 char scalar_data[8];
2081 } data;
2082} upb_Message_Extension;
2083
2084#ifdef __cplusplus
2085extern "C" {
2086#endif
2087
2088// Adds the given extension data to the given message.
2089// |ext| is copied into the message instance.
2090// This logically replaces any previously-added extension with this number.
2091upb_Message_Extension* _upb_Message_GetOrCreateExtension(
2092 upb_Message* msg, const upb_MiniTableExtension* ext, upb_Arena* arena);
2093
2094// Returns an array of extensions for this message.
2095// Note: the array is ordered in reverse relative to the order of creation.
2096const upb_Message_Extension* _upb_Message_Getexts(const upb_Message* msg,
2097 size_t* count);
2098
2099// Returns an extension for the given field number, or NULL if no extension
2100// exists for this field number.
2101const upb_Message_Extension* _upb_Message_Getext(
2102 const upb_Message* msg, const upb_MiniTableExtension* ext);
2103
Eric Salo8809a112022-11-21 13:01:06 -08002104#ifdef __cplusplus
2105} /* extern "C" */
2106#endif
2107
2108
Adam Cozzette8059da22023-08-16 07:57:14 -07002109#endif /* UPB_MESSAGE_INTERNAL_EXTENSION_H_ */
Eric Salo8809a112022-11-21 13:01:06 -08002110
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002111// Must be last.
2112
2113#ifdef __cplusplus
2114extern "C" {
2115#endif
2116
2117// _upb_mapsorter sorts maps and provides ordered iteration over the entries.
2118// Since maps can be recursive (map values can be messages which contain other
2119// maps), _upb_mapsorter can contain a stack of maps.
2120
2121typedef struct {
2122 void const** entries;
2123 int size;
2124 int cap;
2125} _upb_mapsorter;
2126
2127typedef struct {
2128 int start;
2129 int pos;
2130 int end;
2131} _upb_sortedmap;
2132
2133UPB_INLINE void _upb_mapsorter_init(_upb_mapsorter* s) {
2134 s->entries = NULL;
2135 s->size = 0;
2136 s->cap = 0;
2137}
2138
2139UPB_INLINE void _upb_mapsorter_destroy(_upb_mapsorter* s) {
2140 if (s->entries) free(s->entries);
2141}
2142
2143UPB_INLINE bool _upb_sortedmap_next(_upb_mapsorter* s, const upb_Map* map,
2144 _upb_sortedmap* sorted, upb_MapEntry* ent) {
2145 if (sorted->pos == sorted->end) return false;
2146 const upb_tabent* tabent = (const upb_tabent*)s->entries[sorted->pos++];
2147 upb_StringView key = upb_tabstrview(tabent->key);
2148 _upb_map_fromkey(key, &ent->data.k, map->key_size);
2149 upb_value val = {tabent->val.val};
2150 _upb_map_fromvalue(val, &ent->data.v, map->val_size);
2151 return true;
2152}
2153
2154UPB_INLINE bool _upb_sortedmap_nextext(_upb_mapsorter* s,
2155 _upb_sortedmap* sorted,
2156 const upb_Message_Extension** ext) {
2157 if (sorted->pos == sorted->end) return false;
2158 *ext = (const upb_Message_Extension*)s->entries[sorted->pos++];
2159 return true;
2160}
2161
2162UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter* s,
2163 _upb_sortedmap* sorted) {
2164 s->size = sorted->start;
2165}
2166
2167bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type,
2168 const upb_Map* map, _upb_sortedmap* sorted);
2169
2170bool _upb_mapsorter_pushexts(_upb_mapsorter* s,
2171 const upb_Message_Extension* exts, size_t count,
2172 _upb_sortedmap* sorted);
2173
2174#ifdef __cplusplus
2175} /* extern "C" */
2176#endif
2177
2178
Adam Cozzette8059da22023-08-16 07:57:14 -07002179#endif /* UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_ */
2180
2181#ifndef UPB_BASE_LOG2_H_
2182#define UPB_BASE_LOG2_H_
2183
2184// Must be last.
2185
2186#ifdef __cplusplus
2187extern "C" {
2188#endif
2189
2190UPB_INLINE int upb_Log2Ceiling(int x) {
2191 if (x <= 1) return 0;
2192#ifdef __GNUC__
2193 return 32 - __builtin_clz(x - 1);
2194#else
2195 int lg2 = 0;
2196 while ((1 << lg2) < x) lg2++;
2197 return lg2;
2198#endif
2199}
2200
2201UPB_INLINE int upb_Log2CeilingSize(int x) { return 1 << upb_Log2Ceiling(x); }
2202
2203#ifdef __cplusplus
2204} /* extern "C" */
2205#endif
2206
2207
2208#endif /* UPB_BASE_LOG2_H_ */
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002209
Mike Kruskal9d435022023-07-11 12:45:07 -07002210#ifndef UPB_GENERATED_CODE_SUPPORT_H_
2211#define UPB_GENERATED_CODE_SUPPORT_H_
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002212
Mike Kruskal9d435022023-07-11 12:45:07 -07002213// IWYU pragma: begin_exports
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002214
Mike Kruskal9d435022023-07-11 12:45:07 -07002215// These functions are only used by generated code.
2216
2217#ifndef UPB_COLLECTIONS_MAP_GENCODE_UTIL_H_
2218#define UPB_COLLECTIONS_MAP_GENCODE_UTIL_H_
2219
2220
2221// Must be last.
2222
2223#ifdef __cplusplus
2224extern "C" {
2225#endif
2226
2227// Message map operations, these get the map from the message first.
2228
2229UPB_INLINE void _upb_msg_map_key(const void* msg, void* key, size_t size) {
2230 const upb_tabent* ent = (const upb_tabent*)msg;
2231 uint32_t u32len;
2232 upb_StringView k;
2233 k.data = upb_tabstr(ent->key, &u32len);
2234 k.size = u32len;
2235 _upb_map_fromkey(k, key, size);
2236}
2237
2238UPB_INLINE void _upb_msg_map_value(const void* msg, void* val, size_t size) {
2239 const upb_tabent* ent = (const upb_tabent*)msg;
2240 upb_value v = {ent->val.val};
2241 _upb_map_fromvalue(v, val, size);
2242}
2243
2244UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val,
2245 size_t size) {
2246 upb_tabent* ent = (upb_tabent*)msg;
2247 // This is like _upb_map_tovalue() except the entry already exists
2248 // so we can reuse the allocated upb_StringView for string fields.
2249 if (size == UPB_MAPTYPE_STRING) {
2250 upb_StringView* strp = (upb_StringView*)(uintptr_t)ent->val.val;
2251 memcpy(strp, val, sizeof(*strp));
2252 } else {
2253 memcpy(&ent->val.val, val, size);
2254 }
2255}
2256
2257#ifdef __cplusplus
2258} /* extern "C" */
2259#endif
2260
2261
2262#endif /* UPB_COLLECTIONS_MAP_GENCODE_UTIL_H_ */
2263
Sandy Zhange3b09432023-08-07 09:30:02 -07002264#ifndef UPB_MESSAGE_ACCESSORS_H_
2265#define UPB_MESSAGE_ACCESSORS_H_
Mike Kruskal9d435022023-07-11 12:45:07 -07002266
Sandy Zhange3b09432023-08-07 09:30:02 -07002267
Adam Cozzette8059da22023-08-16 07:57:14 -07002268#ifndef UPB_MESSAGE_INTERNAL_ACCESSORS_H_
2269#define UPB_MESSAGE_INTERNAL_ACCESSORS_H_
2270
2271
Sandy Zhange3b09432023-08-07 09:30:02 -07002272/*
2273** Our memory representation for parsing tables and messages themselves.
2274** Functions in this file are used by generated code and possibly reflection.
2275**
2276** The definitions in this file are internal to upb.
2277**/
2278
2279#ifndef UPB_MESSAGE_INTERNAL_H_
2280#define UPB_MESSAGE_INTERNAL_H_
2281
2282#include <stdlib.h>
2283#include <string.h>
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002284
2285
Mike Kruskal3bc50492022-12-01 13:34:12 -08002286#ifndef UPB_MINI_TABLE_EXTENSION_REGISTRY_H_
2287#define UPB_MINI_TABLE_EXTENSION_REGISTRY_H_
2288
2289
2290// Must be last.
2291
2292#ifdef __cplusplus
2293extern "C" {
2294#endif
2295
2296/* Extension registry: a dynamic data structure that stores a map of:
2297 * (upb_MiniTable, number) -> extension info
2298 *
2299 * upb_decode() uses upb_ExtensionRegistry to look up extensions while parsing
2300 * binary format.
2301 *
2302 * upb_ExtensionRegistry is part of the mini-table (msglayout) family of
2303 * objects. Like all mini-table objects, it is suitable for reflection-less
2304 * builds that do not want to expose names into the binary.
2305 *
2306 * Unlike most mini-table types, upb_ExtensionRegistry requires dynamic memory
2307 * allocation and dynamic initialization:
2308 * * If reflection is being used, then upb_DefPool will construct an appropriate
2309 * upb_ExtensionRegistry automatically.
2310 * * For a mini-table only build, the user must manually construct the
2311 * upb_ExtensionRegistry and populate it with all of the extensions the user
2312 * cares about.
2313 * * A third alternative is to manually unpack relevant extensions after the
2314 * main parse is complete, similar to how Any works. This is perhaps the
2315 * nicest solution from the perspective of reducing dependencies, avoiding
2316 * dynamic memory allocation, and avoiding the need to parse uninteresting
2317 * extensions. The downsides are:
2318 * (1) parse errors are not caught during the main parse
2319 * (2) the CPU hit of parsing comes during access, which could cause an
2320 * undesirable stutter in application performance.
2321 *
2322 * Users cannot directly get or put into this map. Users can only add the
2323 * extensions from a generated module and pass the extension registry to the
2324 * binary decoder.
2325 *
2326 * A upb_DefPool provides a upb_ExtensionRegistry, so any users who use
2327 * reflection do not need to populate a upb_ExtensionRegistry directly.
2328 */
2329
2330typedef struct upb_ExtensionRegistry upb_ExtensionRegistry;
2331
2332// Creates a upb_ExtensionRegistry in the given arena.
2333// The arena must outlive any use of the extreg.
Eric Salo10505992022-12-12 12:16:36 -08002334UPB_API upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena);
Mike Kruskal3bc50492022-12-01 13:34:12 -08002335
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002336UPB_API bool upb_ExtensionRegistry_Add(upb_ExtensionRegistry* r,
2337 const upb_MiniTableExtension* e);
2338
Mike Kruskal3bc50492022-12-01 13:34:12 -08002339// Adds the given extension info for the array |e| of size |count| into the
2340// registry. If there are any errors, the entire array is backed out.
2341// The extensions must outlive the registry.
2342// Possible errors include OOM or an extension number that already exists.
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002343// TODO(salo): There is currently no way to know the exact reason for failure.
Mike Kruskal3bc50492022-12-01 13:34:12 -08002344bool upb_ExtensionRegistry_AddArray(upb_ExtensionRegistry* r,
2345 const upb_MiniTableExtension** e,
2346 size_t count);
2347
2348// Looks up the extension (if any) defined for message type |t| and field
2349// number |num|. Returns the extension if found, otherwise NULL.
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002350UPB_API const upb_MiniTableExtension* upb_ExtensionRegistry_Lookup(
Mike Kruskal3bc50492022-12-01 13:34:12 -08002351 const upb_ExtensionRegistry* r, const upb_MiniTable* t, uint32_t num);
2352
2353#ifdef __cplusplus
2354} /* extern "C" */
2355#endif
2356
2357
2358#endif /* UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ */
2359
Eric Salo8809a112022-11-21 13:01:06 -08002360// Must be last.
Mike Kruskal9cf9db82022-11-04 21:22:31 -07002361
Eric Salo8809a112022-11-21 13:01:06 -08002362#ifdef __cplusplus
2363extern "C" {
2364#endif
Mike Kruskal9cf9db82022-11-04 21:22:31 -07002365
Eric Salo8809a112022-11-21 13:01:06 -08002366extern const float kUpb_FltInfinity;
2367extern const double kUpb_Infinity;
2368extern const double kUpb_NaN;
2369
2370/* Internal members of a upb_Message that track unknown fields and/or
2371 * extensions. We can change this without breaking binary compatibility. We put
2372 * these before the user's data. The user's upb_Message* points after the
2373 * upb_Message_Internal. */
2374
Protobuf Team Botdcc1f612023-09-05 21:56:25 +00002375struct upb_Message_InternalData {
Eric Salo8809a112022-11-21 13:01:06 -08002376 /* Total size of this structure, including the data that follows.
2377 * Must be aligned to 8, which is alignof(upb_Message_Extension) */
2378 uint32_t size;
2379
2380 /* Offsets relative to the beginning of this structure.
2381 *
2382 * Unknown data grows forward from the beginning to unknown_end.
2383 * Extension data grows backward from size to ext_begin.
2384 * When the two meet, we're out of data and have to realloc.
2385 *
2386 * If we imagine that the final member of this struct is:
2387 * char data[size - overhead]; // overhead =
2388 * sizeof(upb_Message_InternalData)
2389 *
2390 * Then we have:
2391 * unknown data: data[0 .. (unknown_end - overhead)]
2392 * extensions data: data[(ext_begin - overhead) .. (size - overhead)] */
2393 uint32_t unknown_end;
2394 uint32_t ext_begin;
2395 /* Data follows, as if there were an array:
2396 * char data[size - sizeof(upb_Message_InternalData)]; */
Protobuf Team Botdcc1f612023-09-05 21:56:25 +00002397};
Eric Salo8809a112022-11-21 13:01:06 -08002398
2399/* Maps upb_CType -> memory size. */
2400extern char _upb_CTypeo_size[12];
2401
2402UPB_INLINE size_t upb_msg_sizeof(const upb_MiniTable* t) {
2403 return t->size + sizeof(upb_Message_Internal);
2404}
2405
2406// Inline version upb_Message_New(), for internal use.
2407UPB_INLINE upb_Message* _upb_Message_New(const upb_MiniTable* mini_table,
2408 upb_Arena* arena) {
2409 size_t size = upb_msg_sizeof(mini_table);
2410 void* mem = upb_Arena_Malloc(arena, size + sizeof(upb_Message_Internal));
2411 if (UPB_UNLIKELY(!mem)) return NULL;
2412 upb_Message* msg = UPB_PTR_AT(mem, sizeof(upb_Message_Internal), upb_Message);
2413 memset(mem, 0, size);
2414 return msg;
2415}
2416
2417UPB_INLINE upb_Message_Internal* upb_Message_Getinternal(
2418 const upb_Message* msg) {
2419 ptrdiff_t size = sizeof(upb_Message_Internal);
2420 return (upb_Message_Internal*)((char*)msg - size);
2421}
2422
Eric Salo8809a112022-11-21 13:01:06 -08002423// Discards the unknown fields for this message only.
2424void _upb_Message_DiscardUnknown_shallow(upb_Message* msg);
2425
2426// Adds unknown data (serialized protobuf data) to the given message.
2427// The data is copied into the message instance.
2428bool _upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len,
2429 upb_Arena* arena);
2430
Eric Salo8809a112022-11-21 13:01:06 -08002431#ifdef __cplusplus
2432} /* extern "C" */
2433#endif
2434
2435
2436#endif /* UPB_MESSAGE_INTERNAL_H_ */
Mike Kruskal9cf9db82022-11-04 21:22:31 -07002437
Eric Salo8809a112022-11-21 13:01:06 -08002438// Must be last.
2439
Eric Salob7d54ac2022-12-29 11:59:42 -08002440#if defined(__GNUC__) && !defined(__clang__)
2441// GCC raises incorrect warnings in these functions. It thinks that we are
2442// overrunning buffers, but we carefully write the functions in this file to
2443// guarantee that this is impossible. GCC gets this wrong due it its failure
2444// to perform constant propagation as we expect:
2445// - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108217
2446// - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108226
2447//
2448// Unfortunately this also indicates that GCC is not optimizing away the
2449// switch() in cases where it should be, compromising the performance.
2450#pragma GCC diagnostic push
2451#pragma GCC diagnostic ignored "-Warray-bounds"
2452#pragma GCC diagnostic ignored "-Wstringop-overflow"
Mike Kruskal232ecf42023-01-14 00:09:40 -08002453#if __GNUC__ >= 11
Eric Salob7d54ac2022-12-29 11:59:42 -08002454#pragma GCC diagnostic ignored "-Wstringop-overread"
2455#endif
Mike Kruskal232ecf42023-01-14 00:09:40 -08002456#endif
Eric Salob7d54ac2022-12-29 11:59:42 -08002457
Eric Salo8809a112022-11-21 13:01:06 -08002458#ifdef __cplusplus
2459extern "C" {
2460#endif
2461
Mike Kruskal9d435022023-07-11 12:45:07 -07002462// LINT.IfChange(presence_logic)
2463
2464// Hasbit access ///////////////////////////////////////////////////////////////
2465
2466UPB_INLINE size_t _upb_hasbit_ofs(size_t idx) { return idx / 8; }
2467
2468UPB_INLINE char _upb_hasbit_mask(size_t idx) { return 1 << (idx % 8); }
2469
2470UPB_INLINE bool _upb_hasbit(const upb_Message* msg, size_t idx) {
2471 return (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), const char) &
2472 _upb_hasbit_mask(idx)) != 0;
2473}
2474
2475UPB_INLINE void _upb_sethas(const upb_Message* msg, size_t idx) {
2476 (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), char)) |= _upb_hasbit_mask(idx);
2477}
2478
2479UPB_INLINE void _upb_clearhas(const upb_Message* msg, size_t idx) {
2480 (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), char)) &= ~_upb_hasbit_mask(idx);
2481}
2482
2483UPB_INLINE size_t _upb_Message_Hasidx(const upb_MiniTableField* f) {
2484 UPB_ASSERT(f->presence > 0);
2485 return f->presence;
2486}
2487
2488UPB_INLINE bool _upb_hasbit_field(const upb_Message* msg,
2489 const upb_MiniTableField* f) {
2490 return _upb_hasbit(msg, _upb_Message_Hasidx(f));
2491}
2492
2493UPB_INLINE void _upb_sethas_field(const upb_Message* msg,
2494 const upb_MiniTableField* f) {
2495 _upb_sethas(msg, _upb_Message_Hasidx(f));
2496}
2497
2498// Oneof case access ///////////////////////////////////////////////////////////
2499
2500UPB_INLINE size_t _upb_oneofcase_ofs(const upb_MiniTableField* f) {
2501 UPB_ASSERT(f->presence < 0);
2502 return ~(ptrdiff_t)f->presence;
2503}
2504
2505UPB_INLINE uint32_t* _upb_oneofcase_field(upb_Message* msg,
2506 const upb_MiniTableField* f) {
2507 return UPB_PTR_AT(msg, _upb_oneofcase_ofs(f), uint32_t);
2508}
2509
2510UPB_INLINE uint32_t _upb_getoneofcase_field(const upb_Message* msg,
2511 const upb_MiniTableField* f) {
2512 return *_upb_oneofcase_field((upb_Message*)msg, f);
2513}
2514
2515// LINT.ThenChange(GoogleInternalName2)
Mike Kruskal9d435022023-07-11 12:45:07 -07002516
Eric Salo8809a112022-11-21 13:01:06 -08002517UPB_INLINE bool _upb_MiniTableField_InOneOf(const upb_MiniTableField* field) {
2518 return field->presence < 0;
2519}
2520
2521UPB_INLINE void* _upb_MiniTableField_GetPtr(upb_Message* msg,
2522 const upb_MiniTableField* field) {
2523 return (char*)msg + field->offset;
2524}
2525
2526UPB_INLINE const void* _upb_MiniTableField_GetConstPtr(
2527 const upb_Message* msg, const upb_MiniTableField* field) {
2528 return (char*)msg + field->offset;
2529}
2530
Eric Salo10505992022-12-12 12:16:36 -08002531UPB_INLINE void _upb_Message_SetPresence(upb_Message* msg,
2532 const upb_MiniTableField* field) {
Eric Salo8809a112022-11-21 13:01:06 -08002533 if (field->presence > 0) {
2534 _upb_sethas_field(msg, field);
2535 } else if (_upb_MiniTableField_InOneOf(field)) {
2536 *_upb_oneofcase_field(msg, field) = field->number;
2537 }
2538}
2539
Mike Kruskal3bc50492022-12-01 13:34:12 -08002540UPB_INLINE bool _upb_MiniTable_ValueIsNonZero(const void* default_val,
2541 const upb_MiniTableField* field) {
Eric Salo8809a112022-11-21 13:01:06 -08002542 char zero[16] = {0};
2543 switch (_upb_MiniTableField_GetRep(field)) {
2544 case kUpb_FieldRep_1Byte:
2545 return memcmp(&zero, default_val, 1) != 0;
2546 case kUpb_FieldRep_4Byte:
2547 return memcmp(&zero, default_val, 4) != 0;
2548 case kUpb_FieldRep_8Byte:
2549 return memcmp(&zero, default_val, 8) != 0;
2550 case kUpb_FieldRep_StringView: {
2551 const upb_StringView* sv = (const upb_StringView*)default_val;
2552 return sv->size != 0;
2553 }
2554 }
2555 UPB_UNREACHABLE();
2556}
2557
2558UPB_INLINE void _upb_MiniTable_CopyFieldData(void* to, const void* from,
2559 const upb_MiniTableField* field) {
2560 switch (_upb_MiniTableField_GetRep(field)) {
2561 case kUpb_FieldRep_1Byte:
2562 memcpy(to, from, 1);
2563 return;
2564 case kUpb_FieldRep_4Byte:
2565 memcpy(to, from, 4);
2566 return;
2567 case kUpb_FieldRep_8Byte:
2568 memcpy(to, from, 8);
2569 return;
2570 case kUpb_FieldRep_StringView: {
2571 memcpy(to, from, sizeof(upb_StringView));
2572 return;
2573 }
2574 }
2575 UPB_UNREACHABLE();
2576}
2577
Eric Salob7d54ac2022-12-29 11:59:42 -08002578UPB_INLINE size_t
2579_upb_MiniTable_ElementSizeLg2(const upb_MiniTableField* field) {
2580 const unsigned char table[] = {
2581 0,
2582 3, // kUpb_FieldType_Double = 1,
2583 2, // kUpb_FieldType_Float = 2,
2584 3, // kUpb_FieldType_Int64 = 3,
2585 3, // kUpb_FieldType_UInt64 = 4,
2586 2, // kUpb_FieldType_Int32 = 5,
2587 3, // kUpb_FieldType_Fixed64 = 6,
2588 2, // kUpb_FieldType_Fixed32 = 7,
2589 0, // kUpb_FieldType_Bool = 8,
2590 UPB_SIZE(3, 4), // kUpb_FieldType_String = 9,
2591 UPB_SIZE(2, 3), // kUpb_FieldType_Group = 10,
2592 UPB_SIZE(2, 3), // kUpb_FieldType_Message = 11,
2593 UPB_SIZE(3, 4), // kUpb_FieldType_Bytes = 12,
2594 2, // kUpb_FieldType_UInt32 = 13,
2595 2, // kUpb_FieldType_Enum = 14,
2596 2, // kUpb_FieldType_SFixed32 = 15,
2597 3, // kUpb_FieldType_SFixed64 = 16,
2598 2, // kUpb_FieldType_SInt32 = 17,
2599 3, // kUpb_FieldType_SInt64 = 18,
2600 };
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002601 return table[field->UPB_PRIVATE(descriptortype)];
Eric Salob7d54ac2022-12-29 11:59:42 -08002602}
2603
Eric Salo8809a112022-11-21 13:01:06 -08002604// Here we define universal getter/setter functions for message fields.
2605// These look very branchy and inefficient, but as long as the MiniTableField
2606// values are known at compile time, all the branches are optimized away and
2607// we are left with ideal code. This can happen either through through
2608// literals or UPB_ASSUME():
2609//
Eric Salob598b2d2022-12-22 23:14:27 -08002610// // Via struct literals.
Eric Salo8809a112022-11-21 13:01:06 -08002611// bool FooMessage_set_bool_field(const upb_Message* msg, bool val) {
2612// const upb_MiniTableField field = {1, 0, 0, /* etc... */};
2613// // All value in "field" are compile-time known.
Eric Salo10505992022-12-12 12:16:36 -08002614// _upb_Message_SetNonExtensionField(msg, &field, &value);
Eric Salo8809a112022-11-21 13:01:06 -08002615// }
2616//
2617// // Via UPB_ASSUME().
Eric Salo10505992022-12-12 12:16:36 -08002618// UPB_INLINE bool upb_Message_SetBool(upb_Message* msg,
2619// const upb_MiniTableField* field,
2620// bool value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002621// UPB_ASSUME(field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bool);
Eric Salo8809a112022-11-21 13:01:06 -08002622// UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2623// UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte);
Eric Salo10505992022-12-12 12:16:36 -08002624// _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002625// }
2626//
2627// As a result, we can use these universal getters/setters for *all* message
2628// accessors: generated code, MiniTable accessors, and reflection. The only
2629// exception is the binary encoder/decoder, which need to be a bit more clever
Eric Salob598b2d2022-12-22 23:14:27 -08002630// about how they read/write the message data, for efficiency.
Eric Salo10505992022-12-12 12:16:36 -08002631//
2632// These functions work on both extensions and non-extensions. If the field
2633// of a setter is known to be a non-extension, the arena may be NULL and the
2634// returned bool value may be ignored since it will always succeed.
Eric Salo8809a112022-11-21 13:01:06 -08002635
Eric Salo10505992022-12-12 12:16:36 -08002636UPB_INLINE bool _upb_Message_HasExtensionField(
2637 const upb_Message* msg, const upb_MiniTableExtension* ext) {
2638 UPB_ASSERT(upb_MiniTableField_HasPresence(&ext->field));
2639 return _upb_Message_Getext(msg, ext) != NULL;
2640}
2641
2642UPB_INLINE bool _upb_Message_HasNonExtensionField(
2643 const upb_Message* msg, const upb_MiniTableField* field) {
2644 UPB_ASSERT(upb_MiniTableField_HasPresence(field));
2645 UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
2646 if (_upb_MiniTableField_InOneOf(field)) {
2647 return _upb_getoneofcase_field(msg, field) == field->number;
2648 } else {
2649 return _upb_hasbit_field(msg, field);
2650 }
2651}
2652
2653static UPB_FORCEINLINE void _upb_Message_GetNonExtensionField(
Eric Salo8809a112022-11-21 13:01:06 -08002654 const upb_Message* msg, const upb_MiniTableField* field,
2655 const void* default_val, void* val) {
2656 UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
2657 if ((_upb_MiniTableField_InOneOf(field) ||
Mike Kruskal3bc50492022-12-01 13:34:12 -08002658 _upb_MiniTable_ValueIsNonZero(default_val, field)) &&
Eric Salo10505992022-12-12 12:16:36 -08002659 !_upb_Message_HasNonExtensionField(msg, field)) {
Eric Salo8809a112022-11-21 13:01:06 -08002660 _upb_MiniTable_CopyFieldData(val, default_val, field);
2661 return;
2662 }
2663 _upb_MiniTable_CopyFieldData(val, _upb_MiniTableField_GetConstPtr(msg, field),
2664 field);
2665}
2666
Eric Salo10505992022-12-12 12:16:36 -08002667UPB_INLINE void _upb_Message_GetExtensionField(
Eric Salo8809a112022-11-21 13:01:06 -08002668 const upb_Message* msg, const upb_MiniTableExtension* mt_ext,
2669 const void* default_val, void* val) {
2670 UPB_ASSUME(upb_MiniTableField_IsExtension(&mt_ext->field));
2671 const upb_Message_Extension* ext = _upb_Message_Getext(msg, mt_ext);
2672 if (ext) {
2673 _upb_MiniTable_CopyFieldData(val, &ext->data, &mt_ext->field);
2674 } else {
2675 _upb_MiniTable_CopyFieldData(val, default_val, &mt_ext->field);
2676 }
2677}
2678
Eric Salo10505992022-12-12 12:16:36 -08002679UPB_INLINE void _upb_Message_GetField(const upb_Message* msg,
2680 const upb_MiniTableField* field,
2681 const void* default_val, void* val) {
Eric Salo8809a112022-11-21 13:01:06 -08002682 if (upb_MiniTableField_IsExtension(field)) {
Eric Salo10505992022-12-12 12:16:36 -08002683 _upb_Message_GetExtensionField(msg, (upb_MiniTableExtension*)field,
2684 default_val, val);
Eric Salo8809a112022-11-21 13:01:06 -08002685 } else {
Eric Salo10505992022-12-12 12:16:36 -08002686 _upb_Message_GetNonExtensionField(msg, field, default_val, val);
Eric Salo8809a112022-11-21 13:01:06 -08002687 }
2688}
2689
Eric Salo10505992022-12-12 12:16:36 -08002690UPB_INLINE void _upb_Message_SetNonExtensionField(
Eric Salo8809a112022-11-21 13:01:06 -08002691 upb_Message* msg, const upb_MiniTableField* field, const void* val) {
2692 UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
Eric Salo10505992022-12-12 12:16:36 -08002693 _upb_Message_SetPresence(msg, field);
Eric Salo8809a112022-11-21 13:01:06 -08002694 _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), val,
2695 field);
2696}
2697
Eric Salo10505992022-12-12 12:16:36 -08002698UPB_INLINE bool _upb_Message_SetExtensionField(
Eric Salo8809a112022-11-21 13:01:06 -08002699 upb_Message* msg, const upb_MiniTableExtension* mt_ext, const void* val,
2700 upb_Arena* a) {
Eric Salo10505992022-12-12 12:16:36 -08002701 UPB_ASSERT(a);
Eric Salo8809a112022-11-21 13:01:06 -08002702 upb_Message_Extension* ext =
2703 _upb_Message_GetOrCreateExtension(msg, mt_ext, a);
2704 if (!ext) return false;
2705 _upb_MiniTable_CopyFieldData(&ext->data, val, &mt_ext->field);
2706 return true;
2707}
2708
Eric Salo10505992022-12-12 12:16:36 -08002709UPB_INLINE bool _upb_Message_SetField(upb_Message* msg,
2710 const upb_MiniTableField* field,
2711 const void* val, upb_Arena* a) {
Eric Salo8809a112022-11-21 13:01:06 -08002712 if (upb_MiniTableField_IsExtension(field)) {
Eric Salo10505992022-12-12 12:16:36 -08002713 const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field;
2714 return _upb_Message_SetExtensionField(msg, ext, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08002715 } else {
Eric Salo10505992022-12-12 12:16:36 -08002716 _upb_Message_SetNonExtensionField(msg, field, val);
Eric Salo8809a112022-11-21 13:01:06 -08002717 return true;
2718 }
2719}
2720
Eric Salo10505992022-12-12 12:16:36 -08002721UPB_INLINE void _upb_Message_ClearExtensionField(
2722 upb_Message* msg, const upb_MiniTableExtension* ext_l) {
2723 upb_Message_Internal* in = upb_Message_Getinternal(msg);
2724 if (!in->internal) return;
2725 const upb_Message_Extension* base =
2726 UPB_PTR_AT(in->internal, in->internal->ext_begin, upb_Message_Extension);
2727 upb_Message_Extension* ext =
2728 (upb_Message_Extension*)_upb_Message_Getext(msg, ext_l);
2729 if (ext) {
2730 *ext = *base;
2731 in->internal->ext_begin += sizeof(upb_Message_Extension);
Mike Kruskal3bc50492022-12-01 13:34:12 -08002732 }
2733}
2734
Eric Salo10505992022-12-12 12:16:36 -08002735UPB_INLINE void _upb_Message_ClearNonExtensionField(
Mike Kruskal3bc50492022-12-01 13:34:12 -08002736 upb_Message* msg, const upb_MiniTableField* field) {
2737 if (field->presence > 0) {
Eric Salob598b2d2022-12-22 23:14:27 -08002738 _upb_clearhas(msg, _upb_Message_Hasidx(field));
Mike Kruskal3bc50492022-12-01 13:34:12 -08002739 } else if (_upb_MiniTableField_InOneOf(field)) {
2740 uint32_t* oneof_case = _upb_oneofcase_field(msg, field);
2741 if (*oneof_case != field->number) return;
2742 *oneof_case = 0;
2743 }
2744 const char zeros[16] = {0};
2745 _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), zeros,
2746 field);
2747}
2748
Jie Luo3560e232023-06-12 00:33:50 -07002749UPB_INLINE void _upb_Message_AssertMapIsUntagged(
2750 const upb_Message* msg, const upb_MiniTableField* field) {
Adam Cozzette7d5592e2023-08-23 12:15:26 -07002751 UPB_UNUSED(msg);
Jie Luo3560e232023-06-12 00:33:50 -07002752 _upb_MiniTableField_CheckIsMap(field);
2753#ifndef NDEBUG
2754 upb_TaggedMessagePtr default_val = 0;
2755 upb_TaggedMessagePtr tagged;
2756 _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged);
2757 UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(tagged));
2758#endif
2759}
2760
Mike Kruskal232ecf42023-01-14 00:09:40 -08002761UPB_INLINE upb_Map* _upb_Message_GetOrCreateMutableMap(
Eric Salob7d54ac2022-12-29 11:59:42 -08002762 upb_Message* msg, const upb_MiniTableField* field, size_t key_size,
2763 size_t val_size, upb_Arena* arena) {
2764 _upb_MiniTableField_CheckIsMap(field);
Jie Luo3560e232023-06-12 00:33:50 -07002765 _upb_Message_AssertMapIsUntagged(msg, field);
Eric Salob7d54ac2022-12-29 11:59:42 -08002766 upb_Map* map = NULL;
2767 upb_Map* default_map_value = NULL;
2768 _upb_Message_GetNonExtensionField(msg, field, &default_map_value, &map);
2769 if (!map) {
2770 map = _upb_Map_New(arena, key_size, val_size);
2771 // Check again due to: https://godbolt.org/z/7WfaoKG1r
2772 _upb_MiniTableField_CheckIsMap(field);
2773 _upb_Message_SetNonExtensionField(msg, field, &map);
2774 }
2775 return map;
2776}
2777
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002778#ifdef __cplusplus
2779} /* extern "C" */
2780#endif
2781
2782#if defined(__GNUC__) && !defined(__clang__)
2783#pragma GCC diagnostic pop
2784#endif
2785
2786
Sandy Zhange3b09432023-08-07 09:30:02 -07002787#endif // UPB_MESSAGE_INTERNAL_ACCESSORS_H_
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002788
2789// Must be last.
2790
2791#ifdef __cplusplus
2792extern "C" {
2793#endif
Eric Salo10505992022-12-12 12:16:36 -08002794
2795UPB_API_INLINE void upb_Message_ClearField(upb_Message* msg,
2796 const upb_MiniTableField* field) {
Mike Kruskal3bc50492022-12-01 13:34:12 -08002797 if (upb_MiniTableField_IsExtension(field)) {
Eric Salo10505992022-12-12 12:16:36 -08002798 const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field;
2799 _upb_Message_ClearExtensionField(msg, ext);
Mike Kruskal3bc50492022-12-01 13:34:12 -08002800 } else {
Eric Salo10505992022-12-12 12:16:36 -08002801 _upb_Message_ClearNonExtensionField(msg, field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08002802 }
2803}
2804
Jie Luof36a5c62023-05-23 17:56:18 -07002805UPB_API_INLINE void upb_Message_Clear(upb_Message* msg,
2806 const upb_MiniTable* l) {
2807 // Note: Can't use UPB_PTR_AT() here because we are doing pointer subtraction.
2808 char* mem = (char*)msg - sizeof(upb_Message_Internal);
2809 memset(mem, 0, upb_msg_sizeof(l));
2810}
2811
Eric Salo10505992022-12-12 12:16:36 -08002812UPB_API_INLINE bool upb_Message_HasField(const upb_Message* msg,
2813 const upb_MiniTableField* field) {
2814 if (upb_MiniTableField_IsExtension(field)) {
2815 const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field;
2816 return _upb_Message_HasExtensionField(msg, ext);
2817 } else {
2818 return _upb_Message_HasNonExtensionField(msg, field);
2819 }
Mike Kruskal3bc50492022-12-01 13:34:12 -08002820}
Eric Salo8809a112022-11-21 13:01:06 -08002821
Eric Salob598b2d2022-12-22 23:14:27 -08002822UPB_API_INLINE uint32_t upb_Message_WhichOneofFieldNumber(
2823 const upb_Message* message, const upb_MiniTableField* oneof_field) {
2824 UPB_ASSUME(_upb_MiniTableField_InOneOf(oneof_field));
2825 return _upb_getoneofcase_field(message, oneof_field);
2826}
2827
Eric Salo10505992022-12-12 12:16:36 -08002828UPB_API_INLINE bool upb_Message_GetBool(const upb_Message* msg,
2829 const upb_MiniTableField* field,
2830 bool default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002831 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool);
Eric Salo8809a112022-11-21 13:01:06 -08002832 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002833 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002834 bool ret;
Eric Salo10505992022-12-12 12:16:36 -08002835 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002836 return ret;
2837}
2838
Eric Salo10505992022-12-12 12:16:36 -08002839UPB_API_INLINE bool upb_Message_SetBool(upb_Message* msg,
2840 const upb_MiniTableField* field,
2841 bool value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002842 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool);
Eric Salo8809a112022-11-21 13:01:06 -08002843 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002844 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002845 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002846}
2847
Eric Salo10505992022-12-12 12:16:36 -08002848UPB_API_INLINE int32_t upb_Message_GetInt32(const upb_Message* msg,
2849 const upb_MiniTableField* field,
2850 int32_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002851 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 ||
2852 upb_MiniTableField_CType(field) == kUpb_CType_Enum);
Eric Salo8809a112022-11-21 13:01:06 -08002853 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002854 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002855 int32_t ret;
Eric Salo10505992022-12-12 12:16:36 -08002856 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002857 return ret;
2858}
2859
Eric Salo10505992022-12-12 12:16:36 -08002860UPB_API_INLINE bool upb_Message_SetInt32(upb_Message* msg,
2861 const upb_MiniTableField* field,
2862 int32_t value, upb_Arena* a) {
Deanna Garciab26afb52023-04-25 13:37:18 -07002863 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 ||
2864 upb_MiniTableField_CType(field) == kUpb_CType_Enum);
Eric Salo8809a112022-11-21 13:01:06 -08002865 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002866 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002867 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002868}
2869
Eric Salo10505992022-12-12 12:16:36 -08002870UPB_API_INLINE uint32_t upb_Message_GetUInt32(const upb_Message* msg,
2871 const upb_MiniTableField* field,
2872 uint32_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002873 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32);
Eric Salo8809a112022-11-21 13:01:06 -08002874 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002875 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002876 uint32_t ret;
Eric Salo10505992022-12-12 12:16:36 -08002877 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002878 return ret;
2879}
2880
Eric Salo10505992022-12-12 12:16:36 -08002881UPB_API_INLINE bool upb_Message_SetUInt32(upb_Message* msg,
2882 const upb_MiniTableField* field,
2883 uint32_t value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002884 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32);
Eric Salo8809a112022-11-21 13:01:06 -08002885 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002886 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002887 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002888}
2889
Deanna Garciab26afb52023-04-25 13:37:18 -07002890UPB_API_INLINE void upb_Message_SetClosedEnum(
Eric Salo3f36a912022-12-05 14:12:25 -08002891 upb_Message* msg, const upb_MiniTable* msg_mini_table,
2892 const upb_MiniTableField* field, int32_t value) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002893 UPB_ASSERT(upb_MiniTableField_IsClosedEnum(field));
Eric Salo8809a112022-11-21 13:01:06 -08002894 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002895 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002896 UPB_ASSERT(upb_MiniTableEnum_CheckValue(
2897 upb_MiniTable_GetSubEnumTable(msg_mini_table, field), value));
Eric Salo10505992022-12-12 12:16:36 -08002898 _upb_Message_SetNonExtensionField(msg, field, &value);
Eric Salo8809a112022-11-21 13:01:06 -08002899}
2900
Eric Salo10505992022-12-12 12:16:36 -08002901UPB_API_INLINE int64_t upb_Message_GetInt64(const upb_Message* msg,
2902 const upb_MiniTableField* field,
2903 uint64_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002904 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64);
Eric Salo8809a112022-11-21 13:01:06 -08002905 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002906 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002907 int64_t ret;
Eric Salo10505992022-12-12 12:16:36 -08002908 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002909 return ret;
2910}
2911
Eric Salo10505992022-12-12 12:16:36 -08002912UPB_API_INLINE bool upb_Message_SetInt64(upb_Message* msg,
2913 const upb_MiniTableField* field,
2914 int64_t value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002915 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64);
Eric Salo8809a112022-11-21 13:01:06 -08002916 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002917 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002918 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002919}
2920
Eric Salo10505992022-12-12 12:16:36 -08002921UPB_API_INLINE uint64_t upb_Message_GetUInt64(const upb_Message* msg,
2922 const upb_MiniTableField* field,
2923 uint64_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002924 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64);
Eric Salo8809a112022-11-21 13:01:06 -08002925 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002926 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002927 uint64_t ret;
Eric Salo10505992022-12-12 12:16:36 -08002928 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002929 return ret;
2930}
2931
Eric Salo10505992022-12-12 12:16:36 -08002932UPB_API_INLINE bool upb_Message_SetUInt64(upb_Message* msg,
2933 const upb_MiniTableField* field,
2934 uint64_t value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002935 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64);
Eric Salo8809a112022-11-21 13:01:06 -08002936 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002937 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002938 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002939}
2940
Eric Salo10505992022-12-12 12:16:36 -08002941UPB_API_INLINE float upb_Message_GetFloat(const upb_Message* msg,
2942 const upb_MiniTableField* field,
2943 float default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002944 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float);
Eric Salo8809a112022-11-21 13:01:06 -08002945 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002946 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002947 float ret;
Eric Salo10505992022-12-12 12:16:36 -08002948 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002949 return ret;
2950}
2951
Eric Salo10505992022-12-12 12:16:36 -08002952UPB_API_INLINE bool upb_Message_SetFloat(upb_Message* msg,
2953 const upb_MiniTableField* field,
2954 float value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002955 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float);
Eric Salo8809a112022-11-21 13:01:06 -08002956 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002957 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002958 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002959}
2960
Eric Salo10505992022-12-12 12:16:36 -08002961UPB_API_INLINE double upb_Message_GetDouble(const upb_Message* msg,
2962 const upb_MiniTableField* field,
2963 double default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002964 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double);
Eric Salo8809a112022-11-21 13:01:06 -08002965 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002966 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002967 double ret;
Eric Salo10505992022-12-12 12:16:36 -08002968 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002969 return ret;
2970}
2971
Eric Salo10505992022-12-12 12:16:36 -08002972UPB_API_INLINE bool upb_Message_SetDouble(upb_Message* msg,
2973 const upb_MiniTableField* field,
2974 double value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002975 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double);
Eric Salo8809a112022-11-21 13:01:06 -08002976 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002977 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002978 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002979}
2980
Eric Salo3f36a912022-12-05 14:12:25 -08002981UPB_API_INLINE upb_StringView
Eric Salo10505992022-12-12 12:16:36 -08002982upb_Message_GetString(const upb_Message* msg, const upb_MiniTableField* field,
2983 upb_StringView def_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002984 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String ||
2985 upb_MiniTableField_CType(field) == kUpb_CType_Bytes);
Eric Salo8809a112022-11-21 13:01:06 -08002986 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002987 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002988 upb_StringView ret;
Eric Salo10505992022-12-12 12:16:36 -08002989 _upb_Message_GetField(msg, field, &def_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002990 return ret;
2991}
2992
Eric Salo10505992022-12-12 12:16:36 -08002993UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg,
2994 const upb_MiniTableField* field,
2995 upb_StringView value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002996 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String ||
2997 upb_MiniTableField_CType(field) == kUpb_CType_Bytes);
Eric Salo8809a112022-11-21 13:01:06 -08002998 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002999 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08003000 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08003001}
3002
Jie Luo3560e232023-06-12 00:33:50 -07003003UPB_API_INLINE upb_TaggedMessagePtr upb_Message_GetTaggedMessagePtr(
Eric Salo8809a112022-11-21 13:01:06 -08003004 const upb_Message* msg, const upb_MiniTableField* field,
3005 upb_Message* default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003006 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Eric Salo8809a112022-11-21 13:01:06 -08003007 UPB_ASSUME(_upb_MiniTableField_GetRep(field) ==
3008 UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003009 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Jie Luo3560e232023-06-12 00:33:50 -07003010 upb_TaggedMessagePtr tagged;
3011 _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged);
3012 return tagged;
Eric Salo8809a112022-11-21 13:01:06 -08003013}
3014
Jie Luo3560e232023-06-12 00:33:50 -07003015UPB_API_INLINE const upb_Message* upb_Message_GetMessage(
3016 const upb_Message* msg, const upb_MiniTableField* field,
3017 upb_Message* default_val) {
3018 upb_TaggedMessagePtr tagged =
3019 upb_Message_GetTaggedMessagePtr(msg, field, default_val);
3020 return upb_TaggedMessagePtr_GetNonEmptyMessage(tagged);
3021}
3022
3023// For internal use only; users cannot set tagged messages because only the
3024// parser and the message copier are allowed to directly create an empty
3025// message.
3026UPB_API_INLINE void _upb_Message_SetTaggedMessagePtr(
3027 upb_Message* msg, const upb_MiniTable* mini_table,
3028 const upb_MiniTableField* field, upb_TaggedMessagePtr sub_message) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003029 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Eric Salo8809a112022-11-21 13:01:06 -08003030 UPB_ASSUME(_upb_MiniTableField_GetRep(field) ==
3031 UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003032 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Deanna Garciac7d979d2023-04-14 17:22:13 -07003033 UPB_ASSERT(mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg);
Eric Salo10505992022-12-12 12:16:36 -08003034 _upb_Message_SetNonExtensionField(msg, field, &sub_message);
Eric Salo8809a112022-11-21 13:01:06 -08003035}
3036
Jie Luo3560e232023-06-12 00:33:50 -07003037UPB_API_INLINE void upb_Message_SetMessage(upb_Message* msg,
3038 const upb_MiniTable* mini_table,
3039 const upb_MiniTableField* field,
3040 upb_Message* sub_message) {
3041 _upb_Message_SetTaggedMessagePtr(
3042 msg, mini_table, field, _upb_TaggedMessagePtr_Pack(sub_message, false));
3043}
3044
Mike Kruskal232ecf42023-01-14 00:09:40 -08003045UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage(
Eric Salo8809a112022-11-21 13:01:06 -08003046 upb_Message* msg, const upb_MiniTable* mini_table,
3047 const upb_MiniTableField* field, upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003048 UPB_ASSERT(arena);
3049 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Eric Salo8809a112022-11-21 13:01:06 -08003050 upb_Message* sub_message = *UPB_PTR_AT(msg, field->offset, upb_Message*);
3051 if (!sub_message) {
3052 const upb_MiniTable* sub_mini_table =
Deanna Garciac7d979d2023-04-14 17:22:13 -07003053 mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg;
Eric Salo8809a112022-11-21 13:01:06 -08003054 UPB_ASSERT(sub_mini_table);
3055 sub_message = _upb_Message_New(sub_mini_table, arena);
3056 *UPB_PTR_AT(msg, field->offset, upb_Message*) = sub_message;
Eric Salo10505992022-12-12 12:16:36 -08003057 _upb_Message_SetPresence(msg, field);
Eric Salo8809a112022-11-21 13:01:06 -08003058 }
3059 return sub_message;
3060}
3061
Eric Salob598b2d2022-12-22 23:14:27 -08003062UPB_API_INLINE const upb_Array* upb_Message_GetArray(
Eric Salo8809a112022-11-21 13:01:06 -08003063 const upb_Message* msg, const upb_MiniTableField* field) {
Eric Salob7d54ac2022-12-29 11:59:42 -08003064 _upb_MiniTableField_CheckIsArray(field);
Deanna Garciac7d979d2023-04-14 17:22:13 -07003065 upb_Array* ret;
Eric Salo8809a112022-11-21 13:01:06 -08003066 const upb_Array* default_val = NULL;
Eric Salo10505992022-12-12 12:16:36 -08003067 _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08003068 return ret;
3069}
3070
Eric Salob598b2d2022-12-22 23:14:27 -08003071UPB_API_INLINE upb_Array* upb_Message_GetMutableArray(
Eric Salo8809a112022-11-21 13:01:06 -08003072 upb_Message* msg, const upb_MiniTableField* field) {
Eric Salob7d54ac2022-12-29 11:59:42 -08003073 _upb_MiniTableField_CheckIsArray(field);
Eric Salob598b2d2022-12-22 23:14:27 -08003074 return (upb_Array*)upb_Message_GetArray(msg, field);
Eric Salo8809a112022-11-21 13:01:06 -08003075}
3076
Eric Salob598b2d2022-12-22 23:14:27 -08003077UPB_API_INLINE upb_Array* upb_Message_GetOrCreateMutableArray(
Eric Salob7d54ac2022-12-29 11:59:42 -08003078 upb_Message* msg, const upb_MiniTableField* field, upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003079 UPB_ASSERT(arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08003080 _upb_MiniTableField_CheckIsArray(field);
Eric Salob598b2d2022-12-22 23:14:27 -08003081 upb_Array* array = upb_Message_GetMutableArray(msg, field);
3082 if (!array) {
Eric Salob7d54ac2022-12-29 11:59:42 -08003083 array = _upb_Array_New(arena, 4, _upb_MiniTable_ElementSizeLg2(field));
3084 // Check again due to: https://godbolt.org/z/7WfaoKG1r
3085 _upb_MiniTableField_CheckIsArray(field);
Eric Salob598b2d2022-12-22 23:14:27 -08003086 _upb_Message_SetField(msg, field, &array, arena);
3087 }
3088 return array;
3089}
3090
Jie Luof36a5c62023-05-23 17:56:18 -07003091UPB_API_INLINE void* upb_Message_ResizeArrayUninitialized(
Eric Salob7d54ac2022-12-29 11:59:42 -08003092 upb_Message* msg, const upb_MiniTableField* field, size_t size,
3093 upb_Arena* arena) {
3094 _upb_MiniTableField_CheckIsArray(field);
3095 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, field, arena);
3096 if (!arr || !_upb_Array_ResizeUninitialized(arr, size, arena)) return NULL;
Eric Salob7d54ac2022-12-29 11:59:42 -08003097 return _upb_array_ptr(arr);
3098}
Eric Salo10505992022-12-12 12:16:36 -08003099
Eric Salob7d54ac2022-12-29 11:59:42 -08003100UPB_API_INLINE const upb_Map* upb_Message_GetMap(
3101 const upb_Message* msg, const upb_MiniTableField* field) {
3102 _upb_MiniTableField_CheckIsMap(field);
Jie Luo3560e232023-06-12 00:33:50 -07003103 _upb_Message_AssertMapIsUntagged(msg, field);
Deanna Garciac7d979d2023-04-14 17:22:13 -07003104 upb_Map* ret;
Eric Salob7d54ac2022-12-29 11:59:42 -08003105 const upb_Map* default_val = NULL;
3106 _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
3107 return ret;
3108}
3109
Jie Luo3560e232023-06-12 00:33:50 -07003110UPB_API_INLINE upb_Map* upb_Message_GetMutableMap(
3111 upb_Message* msg, const upb_MiniTableField* field) {
3112 return (upb_Map*)upb_Message_GetMap(msg, field);
3113}
3114
Mike Kruskal232ecf42023-01-14 00:09:40 -08003115UPB_API_INLINE upb_Map* upb_Message_GetOrCreateMutableMap(
Eric Salob598b2d2022-12-22 23:14:27 -08003116 upb_Message* msg, const upb_MiniTable* map_entry_mini_table,
3117 const upb_MiniTableField* field, upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003118 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Eric Salob7d54ac2022-12-29 11:59:42 -08003119 const upb_MiniTableField* map_entry_key_field =
3120 &map_entry_mini_table->fields[0];
3121 const upb_MiniTableField* map_entry_value_field =
3122 &map_entry_mini_table->fields[1];
Mike Kruskal232ecf42023-01-14 00:09:40 -08003123 return _upb_Message_GetOrCreateMutableMap(
Eric Salob7d54ac2022-12-29 11:59:42 -08003124 msg, field,
3125 _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_key_field)),
3126 _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_value_field)),
3127 arena);
Eric Salob598b2d2022-12-22 23:14:27 -08003128}
3129
3130// Updates a map entry given an entry message.
3131upb_MapInsertStatus upb_Message_InsertMapEntry(upb_Map* map,
3132 const upb_MiniTable* mini_table,
3133 const upb_MiniTableField* field,
3134 upb_Message* map_entry_message,
3135 upb_Arena* arena);
3136
Mike Kruskal9d435022023-07-11 12:45:07 -07003137// Compares two messages by serializing them and calling memcmp().
3138bool upb_Message_IsExactlyEqual(const upb_Message* m1, const upb_Message* m2,
3139 const upb_MiniTable* layout);
3140
Eric Salo8809a112022-11-21 13:01:06 -08003141#ifdef __cplusplus
3142} /* extern "C" */
3143#endif
3144
3145
3146#endif // UPB_MESSAGE_ACCESSORS_H_
3147
Mike Kruskal9d435022023-07-11 12:45:07 -07003148#ifndef UPB_MINI_TABLE_DECODE_H_
3149#define UPB_MINI_TABLE_DECODE_H_
3150
3151
3152#ifndef UPB_MINI_TABLE_SUB_H_
3153#define UPB_MINI_TABLE_SUB_H_
3154
3155
3156typedef union upb_MiniTableSub upb_MiniTableSub;
3157
3158#endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */
3159
3160// Export the newer headers, for legacy users. New users should include the
3161// more specific headers directly.
3162// IWYU pragma: begin_exports
3163
3164#ifndef UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3165#define UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3166
3167
3168// Must be last.
3169
3170#ifdef __cplusplus
3171extern "C" {
3172#endif
3173
3174// Builds a upb_MiniTableEnum from an enum MiniDescriptor. The MiniDescriptor
3175// must be for an enum, not a message.
3176UPB_API upb_MiniTableEnum* upb_MiniDescriptor_BuildEnum(const char* data,
3177 size_t len,
3178 upb_Arena* arena,
3179 upb_Status* status);
3180
3181// TODO(b/289057707): Deprecated name; update callers.
3182UPB_API_INLINE upb_MiniTableEnum* upb_MiniTableEnum_Build(const char* data,
3183 size_t len,
3184 upb_Arena* arena,
3185 upb_Status* status) {
3186 return upb_MiniDescriptor_BuildEnum(data, len, arena, status);
3187}
3188
3189#ifdef __cplusplus
3190} /* extern "C" */
3191#endif
3192
3193
3194#endif // UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3195
3196// Functions for linking MiniTables together once they are built from a
3197// MiniDescriptor.
3198//
3199// These functions have names like upb_MiniTable_Link() because they operate on
3200// MiniTables. We put them here, rather than in the mini_table/ directory,
3201// because they are only needed when building MiniTables from MiniDescriptors.
3202// The interfaces in mini_table/ assume that MiniTables are immutable.
3203
3204#ifndef UPB_MINI_DESCRIPTOR_LINK_H_
3205#define UPB_MINI_DESCRIPTOR_LINK_H_
3206
3207
3208// Must be last.
3209
3210#ifdef __cplusplus
3211extern "C" {
3212#endif
3213
3214// Links a sub-message field to a MiniTable for that sub-message. If a
3215// sub-message field is not linked, it will be treated as an unknown field
3216// during parsing, and setting the field will not be allowed. It is possible
3217// to link the message field later, at which point it will no longer be treated
3218// as unknown. However there is no synchronization for this operation, which
3219// means parallel mutation requires external synchronization.
3220// Returns success/failure.
3221UPB_API bool upb_MiniTable_SetSubMessage(upb_MiniTable* table,
3222 upb_MiniTableField* field,
3223 const upb_MiniTable* sub);
3224
3225// Links an enum field to a MiniTable for that enum.
3226// All enum fields must be linked prior to parsing.
3227// Returns success/failure.
3228UPB_API bool upb_MiniTable_SetSubEnum(upb_MiniTable* table,
3229 upb_MiniTableField* field,
3230 const upb_MiniTableEnum* sub);
3231
3232// Returns a list of fields that require linking at runtime, to connect the
3233// MiniTable to its sub-messages and sub-enums. The list of fields will be
3234// written to the `subs` array, which must have been allocated by the caller
3235// and must be large enough to hold a list of all fields in the message.
3236//
3237// The order of the fields returned by this function is significant: it matches
3238// the order expected by upb_MiniTable_Link() below.
3239//
3240// The return value packs the sub-message count and sub-enum count into a single
3241// integer like so:
3242// return (msg_count << 16) | enum_count;
3243UPB_API uint32_t upb_MiniTable_GetSubList(const upb_MiniTable* mt,
3244 const upb_MiniTableField** subs);
3245
3246// Links a message to its sub-messages and sub-enums. The caller must pass
3247// arrays of sub-tables and sub-enums, in the same length and order as is
3248// returned by upb_MiniTable_GetSubList() above. However, individual elements
3249// of the sub_tables may be NULL if those sub-messages were tree shaken.
3250//
3251// Returns false if either array is too short, or if any of the tables fails
3252// to link.
3253UPB_API bool upb_MiniTable_Link(upb_MiniTable* mt,
3254 const upb_MiniTable** sub_tables,
3255 size_t sub_table_count,
3256 const upb_MiniTableEnum** sub_enums,
3257 size_t sub_enum_count);
3258
3259#ifdef __cplusplus
3260} /* extern "C" */
3261#endif
3262
3263
3264#endif // UPB_MINI_DESCRIPTOR_LINK_H_
3265// IWYU pragma: end_exports
3266
3267// Must be last.
3268
3269typedef enum {
3270 kUpb_MiniTablePlatform_32Bit,
3271 kUpb_MiniTablePlatform_64Bit,
3272 kUpb_MiniTablePlatform_Native =
3273 UPB_SIZE(kUpb_MiniTablePlatform_32Bit, kUpb_MiniTablePlatform_64Bit),
3274} upb_MiniTablePlatform;
3275
3276#ifdef __cplusplus
3277extern "C" {
3278#endif
3279
3280// Builds a mini table from the data encoded in the buffer [data, len]. If any
3281// errors occur, returns NULL and sets a status message. In the success case,
3282// the caller must call upb_MiniTable_SetSub*() for all message or proto2 enum
3283// fields to link the table to the appropriate sub-tables.
3284upb_MiniTable* _upb_MiniTable_Build(const char* data, size_t len,
3285 upb_MiniTablePlatform platform,
3286 upb_Arena* arena, upb_Status* status);
3287
3288UPB_API_INLINE upb_MiniTable* upb_MiniTable_Build(const char* data, size_t len,
3289 upb_Arena* arena,
3290 upb_Status* status) {
3291 return _upb_MiniTable_Build(data, len, kUpb_MiniTablePlatform_Native, arena,
3292 status);
3293}
3294
3295// Initializes a MiniTableExtension buffer that has already been allocated.
3296// This is needed by upb_FileDef and upb_MessageDef, which allocate all of the
3297// extensions together in a single contiguous array.
3298const char* _upb_MiniTableExtension_Init(const char* data, size_t len,
3299 upb_MiniTableExtension* ext,
3300 const upb_MiniTable* extendee,
3301 upb_MiniTableSub sub,
3302 upb_MiniTablePlatform platform,
3303 upb_Status* status);
3304
3305UPB_API_INLINE const char* upb_MiniTableExtension_Init(
3306 const char* data, size_t len, upb_MiniTableExtension* ext,
3307 const upb_MiniTable* extendee, upb_MiniTableSub sub, upb_Status* status) {
3308 return _upb_MiniTableExtension_Init(data, len, ext, extendee, sub,
3309 kUpb_MiniTablePlatform_Native, status);
3310}
3311
3312UPB_API upb_MiniTableExtension* _upb_MiniTableExtension_Build(
3313 const char* data, size_t len, const upb_MiniTable* extendee,
3314 upb_MiniTableSub sub, upb_MiniTablePlatform platform, upb_Arena* arena,
3315 upb_Status* status);
3316
3317UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_Build(
3318 const char* data, size_t len, const upb_MiniTable* extendee,
3319 upb_Arena* arena, upb_Status* status) {
3320 upb_MiniTableSub sub;
3321 sub.submsg = NULL;
3322 return _upb_MiniTableExtension_Build(
3323 data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
3324}
3325
3326UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildMessage(
3327 const char* data, size_t len, const upb_MiniTable* extendee,
3328 upb_MiniTable* submsg, upb_Arena* arena, upb_Status* status) {
3329 upb_MiniTableSub sub;
3330 sub.submsg = submsg;
3331 return _upb_MiniTableExtension_Build(
3332 data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
3333}
3334
3335UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildEnum(
3336 const char* data, size_t len, const upb_MiniTable* extendee,
3337 upb_MiniTableEnum* subenum, upb_Arena* arena, upb_Status* status) {
3338 upb_MiniTableSub sub;
3339 sub.subenum = subenum;
3340 return _upb_MiniTableExtension_Build(
3341 data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
3342}
3343
3344// Like upb_MiniTable_Build(), but the user provides a buffer of layout data so
3345// it can be reused from call to call, avoiding repeated realloc()/free().
3346//
3347// The caller owns `*buf` both before and after the call, and must free() it
3348// when it is no longer in use. The function will realloc() `*buf` as
3349// necessary, updating `*size` accordingly.
3350upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len,
3351 upb_MiniTablePlatform platform,
3352 upb_Arena* arena, void** buf,
3353 size_t* buf_size, upb_Status* status);
3354
3355#ifdef __cplusplus
3356} /* extern "C" */
3357#endif
3358
3359
3360#endif /* UPB_MINI_TABLE_DECODE_H_ */
3361
3362#ifndef UPB_MINI_TABLE_FILE_H_
3363#define UPB_MINI_TABLE_FILE_H_
3364
3365
3366#ifndef UPB_MINI_TABLE_INTERNAL_FILE_H_
3367#define UPB_MINI_TABLE_INTERNAL_FILE_H_
3368
3369
3370// Must be last.
3371
3372struct upb_MiniTableFile {
Sandy Zhange3b09432023-08-07 09:30:02 -07003373 const struct upb_MiniTable** msgs;
3374 const struct upb_MiniTableEnum** enums;
3375 const struct upb_MiniTableExtension** exts;
Mike Kruskal9d435022023-07-11 12:45:07 -07003376 int msg_count;
3377 int enum_count;
3378 int ext_count;
3379};
3380
3381
3382#endif /* UPB_MINI_TABLE_INTERNAL_FILE_H_ */
3383
3384typedef struct upb_MiniTableFile upb_MiniTableFile;
3385
3386#endif /* UPB_MINI_TABLE_FILE_H_ */
3387
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003388// upb_decode: parsing into a upb_Message using a upb_MiniTable.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003389
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003390#ifndef UPB_WIRE_DECODE_H_
3391#define UPB_WIRE_DECODE_H_
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003392
3393
Adam Cozzette7d5592e2023-08-23 12:15:26 -07003394#ifndef UPB_WIRE_TYPES_H_
3395#define UPB_WIRE_TYPES_H_
3396
3397#define kUpb_WireFormat_DefaultDepthLimit 100
3398
3399// A list of types as they are encoded on the wire.
3400typedef enum {
3401 kUpb_WireType_Varint = 0,
3402 kUpb_WireType_64Bit = 1,
3403 kUpb_WireType_Delimited = 2,
3404 kUpb_WireType_StartGroup = 3,
3405 kUpb_WireType_EndGroup = 4,
3406 kUpb_WireType_32Bit = 5
3407} upb_WireType;
3408
3409#endif /* UPB_WIRE_TYPES_H_ */
3410
Joshua Habermand3995ec2022-09-30 16:54:39 -07003411// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003412
3413#ifdef __cplusplus
3414extern "C" {
3415#endif
3416
3417enum {
Joshua Habermand3995ec2022-09-30 16:54:39 -07003418 /* If set, strings will alias the input buffer instead of copying into the
3419 * arena. */
3420 kUpb_DecodeOption_AliasString = 1,
3421
3422 /* If set, the parse will return failure if any message is missing any
3423 * required fields when the message data ends. The parse will still continue,
3424 * and the failure will only be reported at the end.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003425 *
Joshua Habermand3995ec2022-09-30 16:54:39 -07003426 * IMPORTANT CAVEATS:
3427 *
3428 * 1. This can throw a false positive failure if an incomplete message is seen
3429 * on the wire but is later completed when the sub-message occurs again.
3430 * For this reason, a second pass is required to verify a failure, to be
3431 * truly robust.
3432 *
3433 * 2. This can return a false success if you are decoding into a message that
3434 * already has some sub-message fields present. If the sub-message does
3435 * not occur in the binary payload, we will never visit it and discover the
3436 * incomplete sub-message. For this reason, this check is only useful for
3437 * implemting ParseFromString() semantics. For MergeFromString(), a
3438 * post-parse validation step will always be necessary. */
3439 kUpb_DecodeOption_CheckRequired = 2,
Jie Luo3560e232023-06-12 00:33:50 -07003440
3441 /* EXPERIMENTAL:
3442 *
3443 * If set, the parser will allow parsing of sub-message fields that were not
3444 * previously linked using upb_MiniTable_SetSubMessage(). The data will be
3445 * parsed into an internal "empty" message type that cannot be accessed
3446 * directly, but can be later promoted into the true message type if the
3447 * sub-message fields are linked at a later time.
3448 *
3449 * Users should set this option if they intend to perform dynamic tree shaking
3450 * and promoting using the interfaces in message/promote.h. If this option is
3451 * enabled, it is important that the resulting messages are only accessed by
3452 * code that is aware of promotion rules:
3453 *
3454 * 1. Message pointers in upb_Message, upb_Array, and upb_Map are represented
3455 * by a tagged pointer upb_TaggedMessagePointer. The tag indicates whether
3456 * the message uses the internal "empty" type.
3457 *
3458 * 2. Any code *reading* these message pointers must test whether the "empty"
3459 * tag bit is set, using the interfaces in mini_table/types.h. However
3460 * writing of message pointers should always use plain upb_Message*, since
3461 * users are not allowed to create "empty" messages.
3462 *
3463 * 3. It is always safe to test whether a field is present or test the array
3464 * length; these interfaces will reflect that empty messages are present,
3465 * even though their data cannot be accessed without promoting first.
3466 *
3467 * 4. If a message pointer is indeed tagged as empty, the message may not be
3468 * accessed directly, only promoted through the interfaces in
3469 * message/promote.h.
3470 *
3471 * 5. Tagged/empty messages may never be created by the user. They may only
3472 * be created by the parser or the message-copying logic in message/copy.h.
3473 */
3474 kUpb_DecodeOption_ExperimentalAllowUnlinked = 4,
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003475};
3476
Deanna Garciac7d979d2023-04-14 17:22:13 -07003477UPB_INLINE uint32_t upb_DecodeOptions_MaxDepth(uint16_t depth) {
3478 return (uint32_t)depth << 16;
3479}
3480
3481UPB_INLINE uint16_t upb_DecodeOptions_GetMaxDepth(uint32_t options) {
3482 return options >> 16;
3483}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003484
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07003485// Enforce an upper bound on recursion depth.
3486UPB_INLINE int upb_Decode_LimitDepth(uint32_t decode_options, uint32_t limit) {
Deanna Garciac7d979d2023-04-14 17:22:13 -07003487 uint32_t max_depth = upb_DecodeOptions_GetMaxDepth(decode_options);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07003488 if (max_depth > limit) max_depth = limit;
Deanna Garciac7d979d2023-04-14 17:22:13 -07003489 return upb_DecodeOptions_MaxDepth(max_depth) | (decode_options & 0xffff);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07003490}
3491
Joshua Habermand3995ec2022-09-30 16:54:39 -07003492typedef enum {
3493 kUpb_DecodeStatus_Ok = 0,
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003494 kUpb_DecodeStatus_Malformed = 1, // Wire format was corrupt
3495 kUpb_DecodeStatus_OutOfMemory = 2, // Arena alloc failed
3496 kUpb_DecodeStatus_BadUtf8 = 3, // String field had bad UTF-8
3497 kUpb_DecodeStatus_MaxDepthExceeded =
3498 4, // Exceeded upb_DecodeOptions_MaxDepth
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003499
Joshua Habermand3995ec2022-09-30 16:54:39 -07003500 // kUpb_DecodeOption_CheckRequired failed (see above), but the parse otherwise
3501 // succeeded.
3502 kUpb_DecodeStatus_MissingRequired = 5,
Jie Luo3560e232023-06-12 00:33:50 -07003503
3504 // Unlinked sub-message field was present, but
3505 // kUpb_DecodeOptions_ExperimentalAllowUnlinked was not specified in the list
3506 // of options.
3507 kUpb_DecodeStatus_UnlinkedSubMessage = 6,
Joshua Habermand3995ec2022-09-30 16:54:39 -07003508} upb_DecodeStatus;
3509
Eric Salo10505992022-12-12 12:16:36 -08003510UPB_API upb_DecodeStatus upb_Decode(const char* buf, size_t size,
3511 upb_Message* msg, const upb_MiniTable* l,
3512 const upb_ExtensionRegistry* extreg,
3513 int options, upb_Arena* arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003514
3515#ifdef __cplusplus
Joshua Habermanf41049a2022-01-21 14:41:25 -08003516} /* extern "C" */
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003517#endif
3518
Joshua Habermandd69a482021-05-17 22:40:33 -07003519
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003520#endif /* UPB_WIRE_DECODE_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -07003521
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003522// These are the specialized field parser functions for the fast parser.
3523// Generated tables will refer to these by name.
3524//
3525// The function names are encoded with names like:
3526//
3527// // 123 4
3528// upb_pss_1bt(); // Parse singular string, 1 byte tag.
3529//
3530// In position 1:
3531// - 'p' for parse, most function use this
3532// - 'c' for copy, for when we are copying strings instead of aliasing
3533//
3534// In position 2 (cardinality):
3535// - 's' for singular, with or without hasbit
3536// - 'o' for oneof
3537// - 'r' for non-packed repeated
3538// - 'p' for packed repeated
3539//
3540// In position 3 (type):
3541// - 'b1' for bool
3542// - 'v4' for 4-byte varint
3543// - 'v8' for 8-byte varint
3544// - 'z4' for zig-zag-encoded 4-byte varint
3545// - 'z8' for zig-zag-encoded 8-byte varint
3546// - 'f4' for 4-byte fixed
3547// - 'f8' for 8-byte fixed
3548// - 'm' for sub-message
3549// - 's' for string (validate UTF-8)
3550// - 'b' for bytes
3551//
3552// In position 4 (tag length):
3553// - '1' for one-byte tags (field numbers 1-15)
3554// - '2' for two-byte tags (field numbers 16-2048)
3555
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003556#ifndef UPB_WIRE_DECODE_FAST_H_
3557#define UPB_WIRE_DECODE_FAST_H_
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003558
3559
Joshua Habermand3995ec2022-09-30 16:54:39 -07003560// Must be last.
3561
3562#ifdef __cplusplus
3563extern "C" {
3564#endif
3565
Joshua Habermanf41049a2022-01-21 14:41:25 -08003566struct upb_Decoder;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003567
3568// The fallback, generic parsing function that can handle any field type.
3569// This just uses the regular (non-fast) parser to parse a single field.
Joshua Habermand3995ec2022-09-30 16:54:39 -07003570const char* _upb_FastDecoder_DecodeGeneric(struct upb_Decoder* d,
3571 const char* ptr, upb_Message* msg,
3572 intptr_t table, uint64_t hasbits,
3573 uint64_t data);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003574
Joshua Habermanf41049a2022-01-21 14:41:25 -08003575#define UPB_PARSE_PARAMS \
3576 struct upb_Decoder *d, const char *ptr, upb_Message *msg, intptr_t table, \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003577 uint64_t hasbits, uint64_t data
3578
3579/* primitive fields ***********************************************************/
3580
3581#define F(card, type, valbytes, tagbytes) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003582 const char* upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003583
3584#define TYPES(card, tagbytes) \
3585 F(card, b, 1, tagbytes) \
3586 F(card, v, 4, tagbytes) \
3587 F(card, v, 8, tagbytes) \
3588 F(card, z, 4, tagbytes) \
3589 F(card, z, 8, tagbytes) \
3590 F(card, f, 4, tagbytes) \
3591 F(card, f, 8, tagbytes)
3592
3593#define TAGBYTES(card) \
3594 TYPES(card, 1) \
3595 TYPES(card, 2)
3596
3597TAGBYTES(s)
3598TAGBYTES(o)
3599TAGBYTES(r)
3600TAGBYTES(p)
3601
3602#undef F
3603#undef TYPES
3604#undef TAGBYTES
3605
3606/* string fields **************************************************************/
3607
3608#define F(card, tagbytes, type) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003609 const char* upb_p##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); \
3610 const char* upb_c##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003611
3612#define UTF8(card, tagbytes) \
3613 F(card, tagbytes, s) \
3614 F(card, tagbytes, b)
3615
3616#define TAGBYTES(card) \
3617 UTF8(card, 1) \
3618 UTF8(card, 2)
3619
3620TAGBYTES(s)
3621TAGBYTES(o)
3622TAGBYTES(r)
3623
3624#undef F
3625#undef TAGBYTES
3626
3627/* sub-message fields *********************************************************/
3628
3629#define F(card, tagbytes, size_ceil, ceil_arg) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003630 const char* upb_p##card##m_##tagbytes##bt_max##size_ceil##b(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003631
3632#define SIZES(card, tagbytes) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003633 F(card, tagbytes, 64, 64) \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003634 F(card, tagbytes, 128, 128) \
3635 F(card, tagbytes, 192, 192) \
3636 F(card, tagbytes, 256, 256) \
3637 F(card, tagbytes, max, -1)
3638
3639#define TAGBYTES(card) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003640 SIZES(card, 1) \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003641 SIZES(card, 2)
3642
3643TAGBYTES(s)
3644TAGBYTES(o)
3645TAGBYTES(r)
3646
3647#undef TAGBYTES
3648#undef SIZES
3649#undef F
3650
3651#undef UPB_PARSE_PARAMS
3652
Joshua Habermand3995ec2022-09-30 16:54:39 -07003653#ifdef __cplusplus
3654} /* extern "C" */
3655#endif
3656
3657
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003658#endif /* UPB_WIRE_DECODE_FAST_H_ */
Joshua Habermandd69a482021-05-17 22:40:33 -07003659
Eric Salo8809a112022-11-21 13:01:06 -08003660// upb_Encode: parsing from a upb_Message using a upb_MiniTable.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003661
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003662#ifndef UPB_WIRE_ENCODE_H_
3663#define UPB_WIRE_ENCODE_H_
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003664
3665
Joshua Habermand3995ec2022-09-30 16:54:39 -07003666// Must be last.
3667
3668#ifdef __cplusplus
3669extern "C" {
3670#endif
3671
3672enum {
3673 /* If set, the results of serializing will be deterministic across all
3674 * instances of this binary. There are no guarantees across different
3675 * binary builds.
3676 *
3677 * If your proto contains maps, the encoder will need to malloc()/free()
3678 * memory during encode. */
3679 kUpb_EncodeOption_Deterministic = 1,
3680
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003681 // When set, unknown fields are not printed.
Joshua Habermand3995ec2022-09-30 16:54:39 -07003682 kUpb_EncodeOption_SkipUnknown = 2,
3683
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003684 // When set, the encode will fail if any required fields are missing.
Joshua Habermand3995ec2022-09-30 16:54:39 -07003685 kUpb_EncodeOption_CheckRequired = 4,
3686};
3687
Joshua Habermand3995ec2022-09-30 16:54:39 -07003688typedef enum {
3689 kUpb_EncodeStatus_Ok = 0,
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003690 kUpb_EncodeStatus_OutOfMemory = 1, // Arena alloc failed
3691 kUpb_EncodeStatus_MaxDepthExceeded = 2,
Joshua Habermand3995ec2022-09-30 16:54:39 -07003692
3693 // kUpb_EncodeOption_CheckRequired failed but the parse otherwise succeeded.
3694 kUpb_EncodeStatus_MissingRequired = 3,
3695} upb_EncodeStatus;
3696
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003697UPB_INLINE uint32_t upb_EncodeOptions_MaxDepth(uint16_t depth) {
3698 return (uint32_t)depth << 16;
3699}
3700
3701UPB_INLINE uint16_t upb_EncodeOptions_GetMaxDepth(uint32_t options) {
3702 return options >> 16;
3703}
3704
3705// Enforce an upper bound on recursion depth.
3706UPB_INLINE int upb_Encode_LimitDepth(uint32_t encode_options, uint32_t limit) {
3707 uint32_t max_depth = upb_EncodeOptions_GetMaxDepth(encode_options);
3708 if (max_depth > limit) max_depth = limit;
3709 return upb_EncodeOptions_MaxDepth(max_depth) | (encode_options & 0xffff);
3710}
3711
Jason Lunn67dee292023-07-13 13:15:26 -07003712UPB_API upb_EncodeStatus upb_Encode(const void* msg, const upb_MiniTable* l,
3713 int options, upb_Arena* arena, char** buf,
3714 size_t* size);
Joshua Habermand3995ec2022-09-30 16:54:39 -07003715
3716#ifdef __cplusplus
3717} /* extern "C" */
3718#endif
3719
3720
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003721#endif /* UPB_WIRE_ENCODE_H_ */
Mike Kruskal9d435022023-07-11 12:45:07 -07003722// IWYU pragma: end_exports
3723
3724#endif // UPB_GENERATED_CODE_SUPPORT_H_
3725/* This file was generated by upbc (the upb compiler) from the input
3726 * file:
3727 *
3728 * google/protobuf/descriptor.proto
3729 *
3730 * Do not edit -- your changes will be discarded when the file is
3731 * regenerated. */
3732
3733#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
3734#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -07003735
Mike Kruskal232ecf42023-01-14 00:09:40 -08003736// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003737
3738#ifdef __cplusplus
3739extern "C" {
3740#endif
3741
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003742typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet;
3743typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto;
3744typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto;
3745typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange;
3746typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange;
3747typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions;
Mike Kruskal145900f2023-03-27 09:55:52 -07003748typedef struct google_protobuf_ExtensionRangeOptions_Declaration google_protobuf_ExtensionRangeOptions_Declaration;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003749typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto;
3750typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto;
3751typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto;
3752typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange;
3753typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto;
3754typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto;
3755typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto;
3756typedef struct google_protobuf_FileOptions google_protobuf_FileOptions;
3757typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions;
3758typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07003759typedef struct google_protobuf_FieldOptions_EditionDefault google_protobuf_FieldOptions_EditionDefault;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003760typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions;
3761typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions;
3762typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions;
3763typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions;
3764typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions;
3765typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption;
3766typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07003767typedef struct google_protobuf_FeatureSet google_protobuf_FeatureSet;
Mike Kruskalba964702023-08-22 17:37:48 -07003768typedef struct google_protobuf_FeatureSetDefaults google_protobuf_FeatureSetDefaults;
3769typedef struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003770typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo;
3771typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location;
3772typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo;
3773typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation;
Joshua Habermand3995ec2022-09-30 16:54:39 -07003774extern const upb_MiniTable google_protobuf_FileDescriptorSet_msg_init;
3775extern const upb_MiniTable google_protobuf_FileDescriptorProto_msg_init;
3776extern const upb_MiniTable google_protobuf_DescriptorProto_msg_init;
3777extern const upb_MiniTable google_protobuf_DescriptorProto_ExtensionRange_msg_init;
3778extern const upb_MiniTable google_protobuf_DescriptorProto_ReservedRange_msg_init;
3779extern const upb_MiniTable google_protobuf_ExtensionRangeOptions_msg_init;
Mike Kruskal145900f2023-03-27 09:55:52 -07003780extern const upb_MiniTable google_protobuf_ExtensionRangeOptions_Declaration_msg_init;
Joshua Habermand3995ec2022-09-30 16:54:39 -07003781extern const upb_MiniTable google_protobuf_FieldDescriptorProto_msg_init;
3782extern const upb_MiniTable google_protobuf_OneofDescriptorProto_msg_init;
3783extern const upb_MiniTable google_protobuf_EnumDescriptorProto_msg_init;
3784extern const upb_MiniTable google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init;
3785extern const upb_MiniTable google_protobuf_EnumValueDescriptorProto_msg_init;
3786extern const upb_MiniTable google_protobuf_ServiceDescriptorProto_msg_init;
3787extern const upb_MiniTable google_protobuf_MethodDescriptorProto_msg_init;
3788extern const upb_MiniTable google_protobuf_FileOptions_msg_init;
3789extern const upb_MiniTable google_protobuf_MessageOptions_msg_init;
3790extern const upb_MiniTable google_protobuf_FieldOptions_msg_init;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07003791extern const upb_MiniTable google_protobuf_FieldOptions_EditionDefault_msg_init;
Joshua Habermand3995ec2022-09-30 16:54:39 -07003792extern const upb_MiniTable google_protobuf_OneofOptions_msg_init;
3793extern const upb_MiniTable google_protobuf_EnumOptions_msg_init;
3794extern const upb_MiniTable google_protobuf_EnumValueOptions_msg_init;
3795extern const upb_MiniTable google_protobuf_ServiceOptions_msg_init;
3796extern const upb_MiniTable google_protobuf_MethodOptions_msg_init;
3797extern const upb_MiniTable google_protobuf_UninterpretedOption_msg_init;
3798extern const upb_MiniTable google_protobuf_UninterpretedOption_NamePart_msg_init;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07003799extern const upb_MiniTable google_protobuf_FeatureSet_msg_init;
Mike Kruskalba964702023-08-22 17:37:48 -07003800extern const upb_MiniTable google_protobuf_FeatureSetDefaults_msg_init;
3801extern const upb_MiniTable google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init;
Joshua Habermand3995ec2022-09-30 16:54:39 -07003802extern const upb_MiniTable google_protobuf_SourceCodeInfo_msg_init;
3803extern const upb_MiniTable google_protobuf_SourceCodeInfo_Location_msg_init;
3804extern const upb_MiniTable google_protobuf_GeneratedCodeInfo_msg_init;
3805extern const upb_MiniTable google_protobuf_GeneratedCodeInfo_Annotation_msg_init;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003806
3807typedef enum {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00003808 google_protobuf_EDITION_UNKNOWN = 0,
3809 google_protobuf_EDITION_1_TEST_ONLY = 1,
3810 google_protobuf_EDITION_2_TEST_ONLY = 2,
3811 google_protobuf_EDITION_2023 = 1000,
3812 google_protobuf_EDITION_99997_TEST_ONLY = 99997,
3813 google_protobuf_EDITION_99998_TEST_ONLY = 99998,
3814 google_protobuf_EDITION_99999_TEST_ONLY = 99999
3815} google_protobuf_Edition;
3816
3817typedef enum {
Protobuf Team Bot469f0272023-04-21 18:12:45 -07003818 google_protobuf_ExtensionRangeOptions_DECLARATION = 0,
3819 google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1
3820} google_protobuf_ExtensionRangeOptions_VerificationState;
3821
3822typedef enum {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07003823 google_protobuf_FeatureSet_ENUM_TYPE_UNKNOWN = 0,
3824 google_protobuf_FeatureSet_OPEN = 1,
3825 google_protobuf_FeatureSet_CLOSED = 2
3826} google_protobuf_FeatureSet_EnumType;
3827
3828typedef enum {
3829 google_protobuf_FeatureSet_FIELD_PRESENCE_UNKNOWN = 0,
3830 google_protobuf_FeatureSet_EXPLICIT = 1,
3831 google_protobuf_FeatureSet_IMPLICIT = 2,
3832 google_protobuf_FeatureSet_LEGACY_REQUIRED = 3
3833} google_protobuf_FeatureSet_FieldPresence;
3834
3835typedef enum {
3836 google_protobuf_FeatureSet_JSON_FORMAT_UNKNOWN = 0,
3837 google_protobuf_FeatureSet_ALLOW = 1,
3838 google_protobuf_FeatureSet_LEGACY_BEST_EFFORT = 2
3839} google_protobuf_FeatureSet_JsonFormat;
3840
3841typedef enum {
3842 google_protobuf_FeatureSet_MESSAGE_ENCODING_UNKNOWN = 0,
3843 google_protobuf_FeatureSet_LENGTH_PREFIXED = 1,
3844 google_protobuf_FeatureSet_DELIMITED = 2
3845} google_protobuf_FeatureSet_MessageEncoding;
3846
3847typedef enum {
3848 google_protobuf_FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN = 0,
3849 google_protobuf_FeatureSet_PACKED = 1,
3850 google_protobuf_FeatureSet_EXPANDED = 2
3851} google_protobuf_FeatureSet_RepeatedFieldEncoding;
3852
3853typedef enum {
Mike Kruskalccbdaa72023-02-02 20:42:14 -08003854 google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1,
3855 google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2,
3856 google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3
3857} google_protobuf_FieldDescriptorProto_Label;
3858
3859typedef enum {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003860 google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1,
3861 google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2,
3862 google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3,
3863 google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4,
3864 google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5,
3865 google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6,
3866 google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7,
3867 google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8,
3868 google_protobuf_FieldDescriptorProto_TYPE_STRING = 9,
3869 google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10,
3870 google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11,
3871 google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12,
3872 google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13,
3873 google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14,
3874 google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15,
3875 google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16,
3876 google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17,
3877 google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18
3878} google_protobuf_FieldDescriptorProto_Type;
3879
3880typedef enum {
3881 google_protobuf_FieldOptions_STRING = 0,
3882 google_protobuf_FieldOptions_CORD = 1,
3883 google_protobuf_FieldOptions_STRING_PIECE = 2
3884} google_protobuf_FieldOptions_CType;
3885
3886typedef enum {
3887 google_protobuf_FieldOptions_JS_NORMAL = 0,
3888 google_protobuf_FieldOptions_JS_STRING = 1,
3889 google_protobuf_FieldOptions_JS_NUMBER = 2
3890} google_protobuf_FieldOptions_JSType;
3891
3892typedef enum {
Adam Cozzette90ff32c2023-01-21 15:04:56 -08003893 google_protobuf_FieldOptions_RETENTION_UNKNOWN = 0,
3894 google_protobuf_FieldOptions_RETENTION_RUNTIME = 1,
3895 google_protobuf_FieldOptions_RETENTION_SOURCE = 2
3896} google_protobuf_FieldOptions_OptionRetention;
3897
3898typedef enum {
3899 google_protobuf_FieldOptions_TARGET_TYPE_UNKNOWN = 0,
3900 google_protobuf_FieldOptions_TARGET_TYPE_FILE = 1,
3901 google_protobuf_FieldOptions_TARGET_TYPE_EXTENSION_RANGE = 2,
3902 google_protobuf_FieldOptions_TARGET_TYPE_MESSAGE = 3,
3903 google_protobuf_FieldOptions_TARGET_TYPE_FIELD = 4,
3904 google_protobuf_FieldOptions_TARGET_TYPE_ONEOF = 5,
3905 google_protobuf_FieldOptions_TARGET_TYPE_ENUM = 6,
3906 google_protobuf_FieldOptions_TARGET_TYPE_ENUM_ENTRY = 7,
3907 google_protobuf_FieldOptions_TARGET_TYPE_SERVICE = 8,
3908 google_protobuf_FieldOptions_TARGET_TYPE_METHOD = 9
3909} google_protobuf_FieldOptions_OptionTargetType;
3910
3911typedef enum {
Mike Kruskalccbdaa72023-02-02 20:42:14 -08003912 google_protobuf_FileOptions_SPEED = 1,
3913 google_protobuf_FileOptions_CODE_SIZE = 2,
3914 google_protobuf_FileOptions_LITE_RUNTIME = 3
3915} google_protobuf_FileOptions_OptimizeMode;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003916
3917typedef enum {
Joshua Habermand3995ec2022-09-30 16:54:39 -07003918 google_protobuf_GeneratedCodeInfo_Annotation_NONE = 0,
3919 google_protobuf_GeneratedCodeInfo_Annotation_SET = 1,
3920 google_protobuf_GeneratedCodeInfo_Annotation_ALIAS = 2
3921} google_protobuf_GeneratedCodeInfo_Annotation_Semantic;
3922
Mike Kruskalccbdaa72023-02-02 20:42:14 -08003923typedef enum {
3924 google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0,
3925 google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1,
3926 google_protobuf_MethodOptions_IDEMPOTENT = 2
3927} google_protobuf_MethodOptions_IdempotencyLevel;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003928
Mike Kruskalccbdaa72023-02-02 20:42:14 -08003929
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00003930extern const upb_MiniTableEnum google_protobuf_Edition_enum_init;
Protobuf Team Bot469f0272023-04-21 18:12:45 -07003931extern const upb_MiniTableEnum google_protobuf_ExtensionRangeOptions_VerificationState_enum_init;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07003932extern const upb_MiniTableEnum google_protobuf_FeatureSet_EnumType_enum_init;
3933extern const upb_MiniTableEnum google_protobuf_FeatureSet_FieldPresence_enum_init;
3934extern const upb_MiniTableEnum google_protobuf_FeatureSet_JsonFormat_enum_init;
3935extern const upb_MiniTableEnum google_protobuf_FeatureSet_MessageEncoding_enum_init;
3936extern const upb_MiniTableEnum google_protobuf_FeatureSet_RepeatedFieldEncoding_enum_init;
Mike Kruskal232ecf42023-01-14 00:09:40 -08003937extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Label_enum_init;
Mike Kruskalccbdaa72023-02-02 20:42:14 -08003938extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Type_enum_init;
Eric Salo8809a112022-11-21 13:01:06 -08003939extern const upb_MiniTableEnum google_protobuf_FieldOptions_CType_enum_init;
3940extern const upb_MiniTableEnum google_protobuf_FieldOptions_JSType_enum_init;
Adam Cozzette90ff32c2023-01-21 15:04:56 -08003941extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionRetention_enum_init;
3942extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionTargetType_enum_init;
Mike Kruskalccbdaa72023-02-02 20:42:14 -08003943extern const upb_MiniTableEnum google_protobuf_FileOptions_OptimizeMode_enum_init;
Mike Kruskal232ecf42023-01-14 00:09:40 -08003944extern const upb_MiniTableEnum google_protobuf_GeneratedCodeInfo_Annotation_Semantic_enum_init;
Mike Kruskalccbdaa72023-02-02 20:42:14 -08003945extern const upb_MiniTableEnum google_protobuf_MethodOptions_IdempotencyLevel_enum_init;
Joshua Habermanf41049a2022-01-21 14:41:25 -08003946
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003947/* google.protobuf.FileDescriptorSet */
3948
Joshua Habermanf41049a2022-01-21 14:41:25 -08003949UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07003950 return (google_protobuf_FileDescriptorSet*)_upb_Message_New(&google_protobuf_FileDescriptorSet_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003951}
Joshua Habermanf41049a2022-01-21 14:41:25 -08003952UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse(const char* buf, size_t size, upb_Arena* arena) {
3953 google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07003954 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07003955 if (upb_Decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07003956 return NULL;
3957 }
3958 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003959}
Joshua Habermanf41049a2022-01-21 14:41:25 -08003960UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse_ex(const char* buf, size_t size,
3961 const upb_ExtensionRegistry* extreg,
3962 int options, upb_Arena* arena) {
3963 google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena);
3964 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07003965 if (upb_Decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08003966 kUpb_DecodeStatus_Ok) {
3967 return NULL;
3968 }
3969 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003970}
Joshua Habermanf41049a2022-01-21 14:41:25 -08003971UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize(const google_protobuf_FileDescriptorSet* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07003972 char* ptr;
3973 (void)upb_Encode(msg, &google_protobuf_FileDescriptorSet_msg_init, 0, arena, &ptr, len);
3974 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08003975}
3976UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize_ex(const google_protobuf_FileDescriptorSet* msg, int options,
3977 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07003978 char* ptr;
3979 (void)upb_Encode(msg, &google_protobuf_FileDescriptorSet_msg_init, options, arena, &ptr, len);
3980 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08003981}
Mike Kruskal3bc50492022-12-01 13:34:12 -08003982UPB_INLINE void google_protobuf_FileDescriptorSet_clear_file(google_protobuf_FileDescriptorSet* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07003983 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08003984 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07003985}
Eric Salob7d54ac2022-12-29 11:59:42 -08003986UPB_INLINE const google_protobuf_FileDescriptorProto* const* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07003987 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08003988 const upb_Array* arr = upb_Message_GetArray(msg, &field);
3989 if (arr) {
3990 if (size) *size = arr->size;
3991 return (const google_protobuf_FileDescriptorProto* const*)_upb_array_constptr(arr);
3992 } else {
3993 if (size) *size = 0;
3994 return NULL;
3995 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07003996}
Deanna Garciab26afb52023-04-25 13:37:18 -07003997UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorSet_file_upb_array(const google_protobuf_FileDescriptorSet* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07003998 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07003999 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4000 if (size) {
4001 *size = arr ? arr->size : 0;
4002 }
4003 return arr;
4004}
4005UPB_INLINE upb_Array* _google_protobuf_FileDescriptorSet_file_mutable_upb_array(const google_protobuf_FileDescriptorSet* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004006 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004007 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4008 (upb_Message*)msg, &field, arena);
4009 if (size) {
4010 *size = arr ? arr->size : 0;
4011 }
4012 return arr;
4013}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004014UPB_INLINE bool google_protobuf_FileDescriptorSet_has_file(const google_protobuf_FileDescriptorSet* msg) {
4015 size_t size;
4016 google_protobuf_FileDescriptorSet_file(msg, &size);
4017 return size != 0;
4018}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004019
Eric Salob7d54ac2022-12-29 11:59:42 -08004020UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_mutable_file(google_protobuf_FileDescriptorSet* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004021 upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004022 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4023 if (arr) {
4024 if (size) *size = arr->size;
4025 return (google_protobuf_FileDescriptorProto**)_upb_array_ptr(arr);
4026 } else {
4027 if (size) *size = 0;
4028 return NULL;
4029 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004030}
Eric Salob7d54ac2022-12-29 11:59:42 -08004031UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_resize_file(google_protobuf_FileDescriptorSet* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004032 upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07004033 return (google_protobuf_FileDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004034}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004035UPB_INLINE struct google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorSet_add_file(google_protobuf_FileDescriptorSet* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004036 upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004037 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4038 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4039 return NULL;
4040 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07004041 struct google_protobuf_FileDescriptorProto* sub = (struct google_protobuf_FileDescriptorProto*)_upb_Message_New(&google_protobuf_FileDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08004042 if (!arr || !sub) return NULL;
4043 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004044 return sub;
4045}
4046
4047/* google.protobuf.FileDescriptorProto */
4048
Joshua Habermanf41049a2022-01-21 14:41:25 -08004049UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004050 return (google_protobuf_FileDescriptorProto*)_upb_Message_New(&google_protobuf_FileDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004051}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004052UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
4053 google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07004054 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004055 if (upb_Decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07004056 return NULL;
4057 }
4058 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004059}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004060UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse_ex(const char* buf, size_t size,
4061 const upb_ExtensionRegistry* extreg,
4062 int options, upb_Arena* arena) {
4063 google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena);
4064 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004065 if (upb_Decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08004066 kUpb_DecodeStatus_Ok) {
4067 return NULL;
4068 }
4069 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004070}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004071UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004072 char* ptr;
4073 (void)upb_Encode(msg, &google_protobuf_FileDescriptorProto_msg_init, 0, arena, &ptr, len);
4074 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004075}
4076UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize_ex(const google_protobuf_FileDescriptorProto* msg, int options,
4077 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004078 char* ptr;
4079 (void)upb_Encode(msg, &google_protobuf_FileDescriptorProto_msg_init, options, arena, &ptr, len);
4080 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004081}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004082UPB_INLINE void google_protobuf_FileDescriptorProto_clear_name(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004083 const upb_MiniTableField field = {1, UPB_SIZE(44, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004084 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004085}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004086UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004087 upb_StringView default_val = upb_StringView_FromString("");
4088 upb_StringView ret;
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004089 const upb_MiniTableField field = {1, UPB_SIZE(44, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004090 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004091 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004092}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004093UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004094 const upb_MiniTableField field = {1, UPB_SIZE(44, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004095 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004096}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004097UPB_INLINE void google_protobuf_FileDescriptorProto_clear_package(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004098 const upb_MiniTableField field = {2, UPB_SIZE(52, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004099 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004100}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004101UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004102 upb_StringView default_val = upb_StringView_FromString("");
4103 upb_StringView ret;
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004104 const upb_MiniTableField field = {2, UPB_SIZE(52, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004105 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004106 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004107}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004108UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004109 const upb_MiniTableField field = {2, UPB_SIZE(52, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004110 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08004111}
4112UPB_INLINE void google_protobuf_FileDescriptorProto_clear_dependency(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004113 const upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004114 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004115}
Eric Salob7d54ac2022-12-29 11:59:42 -08004116UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004117 const upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004118 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4119 if (arr) {
4120 if (size) *size = arr->size;
4121 return (upb_StringView const*)_upb_array_constptr(arr);
4122 } else {
4123 if (size) *size = 0;
4124 return NULL;
4125 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004126}
Deanna Garciab26afb52023-04-25 13:37:18 -07004127UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004128 const upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004129 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4130 if (size) {
4131 *size = arr ? arr->size : 0;
4132 }
4133 return arr;
4134}
4135UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_dependency_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004136 const upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004137 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4138 (upb_Message*)msg, &field, arena);
4139 if (size) {
4140 *size = arr ? arr->size : 0;
4141 }
4142 return arr;
4143}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004144UPB_INLINE bool google_protobuf_FileDescriptorProto_has_dependency(const google_protobuf_FileDescriptorProto* msg) {
4145 size_t size;
4146 google_protobuf_FileDescriptorProto_dependency(msg, &size);
4147 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004148}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004149UPB_INLINE void google_protobuf_FileDescriptorProto_clear_message_type(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004150 const upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004151 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004152}
Eric Salob7d54ac2022-12-29 11:59:42 -08004153UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004154 const upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004155 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4156 if (arr) {
4157 if (size) *size = arr->size;
4158 return (const google_protobuf_DescriptorProto* const*)_upb_array_constptr(arr);
4159 } else {
4160 if (size) *size = 0;
4161 return NULL;
4162 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004163}
Deanna Garciab26afb52023-04-25 13:37:18 -07004164UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_message_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004165 const upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004166 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4167 if (size) {
4168 *size = arr ? arr->size : 0;
4169 }
4170 return arr;
4171}
4172UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_message_type_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004173 const upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004174 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4175 (upb_Message*)msg, &field, arena);
4176 if (size) {
4177 *size = arr ? arr->size : 0;
4178 }
4179 return arr;
4180}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004181UPB_INLINE bool google_protobuf_FileDescriptorProto_has_message_type(const google_protobuf_FileDescriptorProto* msg) {
4182 size_t size;
4183 google_protobuf_FileDescriptorProto_message_type(msg, &size);
4184 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004185}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004186UPB_INLINE void google_protobuf_FileDescriptorProto_clear_enum_type(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004187 const upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004188 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004189}
Eric Salob7d54ac2022-12-29 11:59:42 -08004190UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004191 const upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004192 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4193 if (arr) {
4194 if (size) *size = arr->size;
4195 return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_constptr(arr);
4196 } else {
4197 if (size) *size = 0;
4198 return NULL;
4199 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004200}
Deanna Garciab26afb52023-04-25 13:37:18 -07004201UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_enum_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004202 const upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004203 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4204 if (size) {
4205 *size = arr ? arr->size : 0;
4206 }
4207 return arr;
4208}
4209UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_enum_type_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004210 const upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004211 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4212 (upb_Message*)msg, &field, arena);
4213 if (size) {
4214 *size = arr ? arr->size : 0;
4215 }
4216 return arr;
4217}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004218UPB_INLINE bool google_protobuf_FileDescriptorProto_has_enum_type(const google_protobuf_FileDescriptorProto* msg) {
4219 size_t size;
4220 google_protobuf_FileDescriptorProto_enum_type(msg, &size);
4221 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004222}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004223UPB_INLINE void google_protobuf_FileDescriptorProto_clear_service(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004224 const upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004225 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004226}
Eric Salob7d54ac2022-12-29 11:59:42 -08004227UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004228 const upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004229 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4230 if (arr) {
4231 if (size) *size = arr->size;
4232 return (const google_protobuf_ServiceDescriptorProto* const*)_upb_array_constptr(arr);
4233 } else {
4234 if (size) *size = 0;
4235 return NULL;
4236 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004237}
Deanna Garciab26afb52023-04-25 13:37:18 -07004238UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_service_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004239 const upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004240 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4241 if (size) {
4242 *size = arr ? arr->size : 0;
4243 }
4244 return arr;
4245}
4246UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_service_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004247 const upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004248 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4249 (upb_Message*)msg, &field, arena);
4250 if (size) {
4251 *size = arr ? arr->size : 0;
4252 }
4253 return arr;
4254}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004255UPB_INLINE bool google_protobuf_FileDescriptorProto_has_service(const google_protobuf_FileDescriptorProto* msg) {
4256 size_t size;
4257 google_protobuf_FileDescriptorProto_service(msg, &size);
4258 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004259}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004260UPB_INLINE void google_protobuf_FileDescriptorProto_clear_extension(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004261 const upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004262 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004263}
Eric Salob7d54ac2022-12-29 11:59:42 -08004264UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004265 const upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004266 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4267 if (arr) {
4268 if (size) *size = arr->size;
4269 return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr);
4270 } else {
4271 if (size) *size = 0;
4272 return NULL;
4273 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004274}
Deanna Garciab26afb52023-04-25 13:37:18 -07004275UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_extension_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004276 const upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004277 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4278 if (size) {
4279 *size = arr ? arr->size : 0;
4280 }
4281 return arr;
4282}
4283UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_extension_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004284 const upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004285 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4286 (upb_Message*)msg, &field, arena);
4287 if (size) {
4288 *size = arr ? arr->size : 0;
4289 }
4290 return arr;
4291}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004292UPB_INLINE bool google_protobuf_FileDescriptorProto_has_extension(const google_protobuf_FileDescriptorProto* msg) {
4293 size_t size;
4294 google_protobuf_FileDescriptorProto_extension(msg, &size);
4295 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004296}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004297UPB_INLINE void google_protobuf_FileDescriptorProto_clear_options(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004298 const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004299 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004300}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004301UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004302 const google_protobuf_FileOptions* default_val = NULL;
4303 const google_protobuf_FileOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07004304 const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004305 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004306 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004307}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004308UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004309 const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004310 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004311}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004312UPB_INLINE void google_protobuf_FileDescriptorProto_clear_source_code_info(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004313 const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004314 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004315}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004316UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004317 const google_protobuf_SourceCodeInfo* default_val = NULL;
4318 const google_protobuf_SourceCodeInfo* ret;
Jie Luo3560e232023-06-12 00:33:50 -07004319 const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004320 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004321 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004322}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004323UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004324 const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004325 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08004326}
4327UPB_INLINE void google_protobuf_FileDescriptorProto_clear_public_dependency(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004328 const upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004329 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -08004330}
Eric Salob7d54ac2022-12-29 11:59:42 -08004331UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004332 const upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004333 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4334 if (arr) {
4335 if (size) *size = arr->size;
4336 return (int32_t const*)_upb_array_constptr(arr);
4337 } else {
4338 if (size) *size = 0;
4339 return NULL;
4340 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07004341}
Deanna Garciab26afb52023-04-25 13:37:18 -07004342UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004343 const upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004344 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4345 if (size) {
4346 *size = arr ? arr->size : 0;
4347 }
4348 return arr;
4349}
4350UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004351 const upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004352 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4353 (upb_Message*)msg, &field, arena);
4354 if (size) {
4355 *size = arr ? arr->size : 0;
4356 }
4357 return arr;
4358}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004359UPB_INLINE bool google_protobuf_FileDescriptorProto_has_public_dependency(const google_protobuf_FileDescriptorProto* msg) {
4360 size_t size;
4361 google_protobuf_FileDescriptorProto_public_dependency(msg, &size);
4362 return size != 0;
4363}
4364UPB_INLINE void google_protobuf_FileDescriptorProto_clear_weak_dependency(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004365 const upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004366 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004367}
Eric Salob7d54ac2022-12-29 11:59:42 -08004368UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004369 const upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004370 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4371 if (arr) {
4372 if (size) *size = arr->size;
4373 return (int32_t const*)_upb_array_constptr(arr);
4374 } else {
4375 if (size) *size = 0;
4376 return NULL;
4377 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004378}
Deanna Garciab26afb52023-04-25 13:37:18 -07004379UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004380 const upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004381 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4382 if (size) {
4383 *size = arr ? arr->size : 0;
4384 }
4385 return arr;
4386}
4387UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_mutable_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004388 const upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004389 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4390 (upb_Message*)msg, &field, arena);
4391 if (size) {
4392 *size = arr ? arr->size : 0;
4393 }
4394 return arr;
4395}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004396UPB_INLINE bool google_protobuf_FileDescriptorProto_has_weak_dependency(const google_protobuf_FileDescriptorProto* msg) {
4397 size_t size;
4398 google_protobuf_FileDescriptorProto_weak_dependency(msg, &size);
4399 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004400}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004401UPB_INLINE void google_protobuf_FileDescriptorProto_clear_syntax(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004402 const upb_MiniTableField field = {12, UPB_SIZE(60, 112), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004403 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004404}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004405UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004406 upb_StringView default_val = upb_StringView_FromString("");
4407 upb_StringView ret;
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004408 const upb_MiniTableField field = {12, UPB_SIZE(60, 112), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004409 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004410 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004411}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004412UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004413 const upb_MiniTableField field = {12, UPB_SIZE(60, 112), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004414 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004415}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004416UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004417 const upb_MiniTableField field = {13, UPB_SIZE(68, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004418 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004419}
4420UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_edition(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004421 upb_StringView default_val = upb_StringView_FromString("");
4422 upb_StringView ret;
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004423 const upb_MiniTableField field = {13, UPB_SIZE(68, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004424 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004425 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004426}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004427UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004428 const upb_MiniTableField field = {13, UPB_SIZE(68, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
4429 return _upb_Message_HasNonExtensionField(msg, &field);
4430}
4431UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition_enum(google_protobuf_FileDescriptorProto* msg) {
4432 const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 7, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
4433 _upb_Message_ClearNonExtensionField(msg, &field);
4434}
4435UPB_INLINE int32_t google_protobuf_FileDescriptorProto_edition_enum(const google_protobuf_FileDescriptorProto* msg) {
4436 int32_t default_val = 0;
4437 int32_t ret;
4438 const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 7, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
4439 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
4440 return ret;
4441}
4442UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition_enum(const google_protobuf_FileDescriptorProto* msg) {
4443 const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 7, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004444 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08004445}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004446
Joshua Habermanf41049a2022-01-21 14:41:25 -08004447UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004448 const upb_MiniTableField field = {1, UPB_SIZE(44, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004449 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08004450}
4451UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004452 const upb_MiniTableField field = {2, UPB_SIZE(52, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004453 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08004454}
4455UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004456 upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004457 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4458 if (arr) {
4459 if (size) *size = arr->size;
4460 return (upb_StringView*)_upb_array_ptr(arr);
4461 } else {
4462 if (size) *size = 0;
4463 return NULL;
4464 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004465}
Eric Salob7d54ac2022-12-29 11:59:42 -08004466UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_resize_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004467 upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07004468 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004469}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004470UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto* msg, upb_StringView val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004471 upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004472 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4473 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4474 return false;
4475 }
4476 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
4477 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004478}
Eric Salob7d54ac2022-12-29 11:59:42 -08004479UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004480 upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004481 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4482 if (arr) {
4483 if (size) *size = arr->size;
4484 return (google_protobuf_DescriptorProto**)_upb_array_ptr(arr);
4485 } else {
4486 if (size) *size = 0;
4487 return NULL;
4488 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004489}
Eric Salob7d54ac2022-12-29 11:59:42 -08004490UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_resize_message_type(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004491 upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07004492 return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004493}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004494UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescriptorProto_add_message_type(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004495 upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004496 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4497 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4498 return NULL;
4499 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07004500 struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)_upb_Message_New(&google_protobuf_DescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08004501 if (!arr || !sub) return NULL;
4502 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004503 return sub;
4504}
Eric Salob7d54ac2022-12-29 11:59:42 -08004505UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004506 upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004507 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4508 if (arr) {
4509 if (size) *size = arr->size;
4510 return (google_protobuf_EnumDescriptorProto**)_upb_array_ptr(arr);
4511 } else {
4512 if (size) *size = 0;
4513 return NULL;
4514 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004515}
Eric Salob7d54ac2022-12-29 11:59:42 -08004516UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_resize_enum_type(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004517 upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07004518 return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004519}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004520UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescriptorProto_add_enum_type(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004521 upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004522 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4523 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4524 return NULL;
4525 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07004526 struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)_upb_Message_New(&google_protobuf_EnumDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08004527 if (!arr || !sub) return NULL;
4528 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004529 return sub;
4530}
Eric Salob7d54ac2022-12-29 11:59:42 -08004531UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004532 upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004533 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4534 if (arr) {
4535 if (size) *size = arr->size;
4536 return (google_protobuf_ServiceDescriptorProto**)_upb_array_ptr(arr);
4537 } else {
4538 if (size) *size = 0;
4539 return NULL;
4540 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004541}
Eric Salob7d54ac2022-12-29 11:59:42 -08004542UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_resize_service(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004543 upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07004544 return (google_protobuf_ServiceDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004545}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004546UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004547 upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004548 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4549 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4550 return NULL;
4551 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07004552 struct google_protobuf_ServiceDescriptorProto* sub = (struct google_protobuf_ServiceDescriptorProto*)_upb_Message_New(&google_protobuf_ServiceDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08004553 if (!arr || !sub) return NULL;
4554 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004555 return sub;
4556}
Eric Salob7d54ac2022-12-29 11:59:42 -08004557UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004558 upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004559 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4560 if (arr) {
4561 if (size) *size = arr->size;
4562 return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr);
4563 } else {
4564 if (size) *size = 0;
4565 return NULL;
4566 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004567}
Eric Salob7d54ac2022-12-29 11:59:42 -08004568UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_resize_extension(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004569 upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07004570 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004571}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004572UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004573 upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004574 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4575 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4576 return NULL;
4577 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07004578 struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_Message_New(&google_protobuf_FieldDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08004579 if (!arr || !sub) return NULL;
4580 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004581 return sub;
4582}
4583UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07004584 const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004585 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08004586}
4587UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004588 struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg);
4589 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004590 sub = (struct google_protobuf_FileOptions*)_upb_Message_New(&google_protobuf_FileOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08004591 if (sub) google_protobuf_FileDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004592 }
4593 return sub;
4594}
4595UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) {
Jie Luo3560e232023-06-12 00:33:50 -07004596 const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004597 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08004598}
4599UPB_INLINE struct google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_mutable_source_code_info(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004600 struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg);
4601 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004602 sub = (struct google_protobuf_SourceCodeInfo*)_upb_Message_New(&google_protobuf_SourceCodeInfo_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08004603 if (sub) google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004604 }
4605 return sub;
4606}
Eric Salob7d54ac2022-12-29 11:59:42 -08004607UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004608 upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004609 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4610 if (arr) {
4611 if (size) *size = arr->size;
4612 return (int32_t*)_upb_array_ptr(arr);
4613 } else {
4614 if (size) *size = 0;
4615 return NULL;
4616 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004617}
Eric Salob7d54ac2022-12-29 11:59:42 -08004618UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004619 upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07004620 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004621}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004622UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google_protobuf_FileDescriptorProto* msg, int32_t val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004623 upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004624 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4625 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4626 return false;
4627 }
4628 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
4629 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004630}
Eric Salob7d54ac2022-12-29 11:59:42 -08004631UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004632 upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004633 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4634 if (arr) {
4635 if (size) *size = arr->size;
4636 return (int32_t*)_upb_array_ptr(arr);
4637 } else {
4638 if (size) *size = 0;
4639 return NULL;
4640 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004641}
Eric Salob7d54ac2022-12-29 11:59:42 -08004642UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004643 upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07004644 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004645}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004646UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_protobuf_FileDescriptorProto* msg, int32_t val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004647 upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004648 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4649 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4650 return false;
4651 }
4652 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
4653 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004654}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004655UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004656 const upb_MiniTableField field = {12, UPB_SIZE(60, 112), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004657 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08004658}
4659UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004660 const upb_MiniTableField field = {13, UPB_SIZE(68, 128), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
4661 _upb_Message_SetNonExtensionField(msg, &field, &value);
4662}
4663UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition_enum(google_protobuf_FileDescriptorProto *msg, int32_t value) {
4664 const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 7, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004665 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004666}
Mike Kruskal232ecf42023-01-14 00:09:40 -08004667
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004668/* google.protobuf.DescriptorProto */
4669
Joshua Habermanf41049a2022-01-21 14:41:25 -08004670UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004671 return (google_protobuf_DescriptorProto*)_upb_Message_New(&google_protobuf_DescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004672}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004673UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
4674 google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07004675 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004676 if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07004677 return NULL;
4678 }
4679 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004680}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004681UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse_ex(const char* buf, size_t size,
4682 const upb_ExtensionRegistry* extreg,
4683 int options, upb_Arena* arena) {
4684 google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena);
4685 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004686 if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08004687 kUpb_DecodeStatus_Ok) {
4688 return NULL;
4689 }
4690 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004691}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004692UPB_INLINE char* google_protobuf_DescriptorProto_serialize(const google_protobuf_DescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004693 char* ptr;
4694 (void)upb_Encode(msg, &google_protobuf_DescriptorProto_msg_init, 0, arena, &ptr, len);
4695 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004696}
4697UPB_INLINE char* google_protobuf_DescriptorProto_serialize_ex(const google_protobuf_DescriptorProto* msg, int options,
4698 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004699 char* ptr;
4700 (void)upb_Encode(msg, &google_protobuf_DescriptorProto_msg_init, options, arena, &ptr, len);
4701 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004702}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004703UPB_INLINE void google_protobuf_DescriptorProto_clear_name(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004704 const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004705 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004706}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004707UPB_INLINE upb_StringView google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004708 upb_StringView default_val = upb_StringView_FromString("");
4709 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07004710 const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004711 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004712 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004713}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004714UPB_INLINE bool google_protobuf_DescriptorProto_has_name(const google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004715 const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004716 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004717}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004718UPB_INLINE void google_protobuf_DescriptorProto_clear_field(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004719 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004720 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004721}
Eric Salob7d54ac2022-12-29 11:59:42 -08004722UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004723 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004724 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4725 if (arr) {
4726 if (size) *size = arr->size;
4727 return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr);
4728 } else {
4729 if (size) *size = 0;
4730 return NULL;
4731 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004732}
Deanna Garciab26afb52023-04-25 13:37:18 -07004733UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_field_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004734 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004735 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4736 if (size) {
4737 *size = arr ? arr->size : 0;
4738 }
4739 return arr;
4740}
4741UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_field_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004742 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004743 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4744 (upb_Message*)msg, &field, arena);
4745 if (size) {
4746 *size = arr ? arr->size : 0;
4747 }
4748 return arr;
4749}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004750UPB_INLINE bool google_protobuf_DescriptorProto_has_field(const google_protobuf_DescriptorProto* msg) {
4751 size_t size;
4752 google_protobuf_DescriptorProto_field(msg, &size);
4753 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004754}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004755UPB_INLINE void google_protobuf_DescriptorProto_clear_nested_type(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004756 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004757 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004758}
Eric Salob7d54ac2022-12-29 11:59:42 -08004759UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004760 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004761 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4762 if (arr) {
4763 if (size) *size = arr->size;
4764 return (const google_protobuf_DescriptorProto* const*)_upb_array_constptr(arr);
4765 } else {
4766 if (size) *size = 0;
4767 return NULL;
4768 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004769}
Deanna Garciab26afb52023-04-25 13:37:18 -07004770UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_nested_type_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004771 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004772 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4773 if (size) {
4774 *size = arr ? arr->size : 0;
4775 }
4776 return arr;
4777}
4778UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_nested_type_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004779 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004780 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4781 (upb_Message*)msg, &field, arena);
4782 if (size) {
4783 *size = arr ? arr->size : 0;
4784 }
4785 return arr;
4786}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004787UPB_INLINE bool google_protobuf_DescriptorProto_has_nested_type(const google_protobuf_DescriptorProto* msg) {
4788 size_t size;
4789 google_protobuf_DescriptorProto_nested_type(msg, &size);
4790 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004791}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004792UPB_INLINE void google_protobuf_DescriptorProto_clear_enum_type(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004793 const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004794 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004795}
Eric Salob7d54ac2022-12-29 11:59:42 -08004796UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004797 const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004798 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4799 if (arr) {
4800 if (size) *size = arr->size;
4801 return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_constptr(arr);
4802 } else {
4803 if (size) *size = 0;
4804 return NULL;
4805 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004806}
Deanna Garciab26afb52023-04-25 13:37:18 -07004807UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_enum_type_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004808 const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004809 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4810 if (size) {
4811 *size = arr ? arr->size : 0;
4812 }
4813 return arr;
4814}
4815UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_enum_type_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004816 const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004817 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4818 (upb_Message*)msg, &field, arena);
4819 if (size) {
4820 *size = arr ? arr->size : 0;
4821 }
4822 return arr;
4823}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004824UPB_INLINE bool google_protobuf_DescriptorProto_has_enum_type(const google_protobuf_DescriptorProto* msg) {
4825 size_t size;
4826 google_protobuf_DescriptorProto_enum_type(msg, &size);
4827 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004828}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004829UPB_INLINE void google_protobuf_DescriptorProto_clear_extension_range(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004830 const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004831 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004832}
Eric Salob7d54ac2022-12-29 11:59:42 -08004833UPB_INLINE const google_protobuf_DescriptorProto_ExtensionRange* const* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004834 const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004835 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4836 if (arr) {
4837 if (size) *size = arr->size;
4838 return (const google_protobuf_DescriptorProto_ExtensionRange* const*)_upb_array_constptr(arr);
4839 } else {
4840 if (size) *size = 0;
4841 return NULL;
4842 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004843}
Deanna Garciab26afb52023-04-25 13:37:18 -07004844UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_extension_range_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004845 const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004846 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4847 if (size) {
4848 *size = arr ? arr->size : 0;
4849 }
4850 return arr;
4851}
4852UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_extension_range_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004853 const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004854 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4855 (upb_Message*)msg, &field, arena);
4856 if (size) {
4857 *size = arr ? arr->size : 0;
4858 }
4859 return arr;
4860}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004861UPB_INLINE bool google_protobuf_DescriptorProto_has_extension_range(const google_protobuf_DescriptorProto* msg) {
4862 size_t size;
4863 google_protobuf_DescriptorProto_extension_range(msg, &size);
4864 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004865}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004866UPB_INLINE void google_protobuf_DescriptorProto_clear_extension(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004867 const upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004868 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004869}
Eric Salob7d54ac2022-12-29 11:59:42 -08004870UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004871 const upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004872 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4873 if (arr) {
4874 if (size) *size = arr->size;
4875 return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr);
4876 } else {
4877 if (size) *size = 0;
4878 return NULL;
4879 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004880}
Deanna Garciab26afb52023-04-25 13:37:18 -07004881UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_extension_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004882 const upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004883 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4884 if (size) {
4885 *size = arr ? arr->size : 0;
4886 }
4887 return arr;
4888}
4889UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_extension_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004890 const upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004891 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4892 (upb_Message*)msg, &field, arena);
4893 if (size) {
4894 *size = arr ? arr->size : 0;
4895 }
4896 return arr;
4897}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004898UPB_INLINE bool google_protobuf_DescriptorProto_has_extension(const google_protobuf_DescriptorProto* msg) {
4899 size_t size;
4900 google_protobuf_DescriptorProto_extension(msg, &size);
4901 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004902}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004903UPB_INLINE void google_protobuf_DescriptorProto_clear_options(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004904 const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004905 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004906}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004907UPB_INLINE const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004908 const google_protobuf_MessageOptions* default_val = NULL;
4909 const google_protobuf_MessageOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07004910 const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004911 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004912 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004913}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004914UPB_INLINE bool google_protobuf_DescriptorProto_has_options(const google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004915 const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004916 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004917}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004918UPB_INLINE void google_protobuf_DescriptorProto_clear_oneof_decl(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004919 const upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004920 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004921}
Eric Salob7d54ac2022-12-29 11:59:42 -08004922UPB_INLINE const google_protobuf_OneofDescriptorProto* const* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004923 const upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004924 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4925 if (arr) {
4926 if (size) *size = arr->size;
4927 return (const google_protobuf_OneofDescriptorProto* const*)_upb_array_constptr(arr);
4928 } else {
4929 if (size) *size = 0;
4930 return NULL;
4931 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004932}
Deanna Garciab26afb52023-04-25 13:37:18 -07004933UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_oneof_decl_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004934 const upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004935 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4936 if (size) {
4937 *size = arr ? arr->size : 0;
4938 }
4939 return arr;
4940}
4941UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_oneof_decl_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004942 const upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004943 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4944 (upb_Message*)msg, &field, arena);
4945 if (size) {
4946 *size = arr ? arr->size : 0;
4947 }
4948 return arr;
4949}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004950UPB_INLINE bool google_protobuf_DescriptorProto_has_oneof_decl(const google_protobuf_DescriptorProto* msg) {
4951 size_t size;
4952 google_protobuf_DescriptorProto_oneof_decl(msg, &size);
4953 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004954}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004955UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_range(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004956 const upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004957 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004958}
Eric Salob7d54ac2022-12-29 11:59:42 -08004959UPB_INLINE const google_protobuf_DescriptorProto_ReservedRange* const* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004960 const upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004961 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4962 if (arr) {
4963 if (size) *size = arr->size;
4964 return (const google_protobuf_DescriptorProto_ReservedRange* const*)_upb_array_constptr(arr);
4965 } else {
4966 if (size) *size = 0;
4967 return NULL;
4968 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004969}
Deanna Garciab26afb52023-04-25 13:37:18 -07004970UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_reserved_range_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004971 const upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004972 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4973 if (size) {
4974 *size = arr ? arr->size : 0;
4975 }
4976 return arr;
4977}
4978UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_reserved_range_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004979 const upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07004980 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4981 (upb_Message*)msg, &field, arena);
4982 if (size) {
4983 *size = arr ? arr->size : 0;
4984 }
4985 return arr;
4986}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004987UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_range(const google_protobuf_DescriptorProto* msg) {
4988 size_t size;
4989 google_protobuf_DescriptorProto_reserved_range(msg, &size);
4990 return size != 0;
4991}
4992UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_name(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004993 const upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004994 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004995}
Eric Salob7d54ac2022-12-29 11:59:42 -08004996UPB_INLINE upb_StringView const* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004997 const upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08004998 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4999 if (arr) {
5000 if (size) *size = arr->size;
5001 return (upb_StringView const*)_upb_array_constptr(arr);
5002 } else {
5003 if (size) *size = 0;
5004 return NULL;
5005 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005006}
Deanna Garciab26afb52023-04-25 13:37:18 -07005007UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_reserved_name_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005008 const upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005009 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5010 if (size) {
5011 *size = arr ? arr->size : 0;
5012 }
5013 return arr;
5014}
5015UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_reserved_name_mutable_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005016 const upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005017 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5018 (upb_Message*)msg, &field, arena);
5019 if (size) {
5020 *size = arr ? arr->size : 0;
5021 }
5022 return arr;
5023}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005024UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_name(const google_protobuf_DescriptorProto* msg) {
5025 size_t size;
5026 google_protobuf_DescriptorProto_reserved_name(msg, &size);
5027 return size != 0;
5028}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005029
Joshua Habermanf41049a2022-01-21 14:41:25 -08005030UPB_INLINE void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07005031 const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005032 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005033}
5034UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005035 upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005036 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5037 if (arr) {
5038 if (size) *size = arr->size;
5039 return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr);
5040 } else {
5041 if (size) *size = 0;
5042 return NULL;
5043 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005044}
Eric Salob7d54ac2022-12-29 11:59:42 -08005045UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_field(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005046 upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005047 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005048}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005049UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_field(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005050 upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005051 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5052 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5053 return NULL;
5054 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005055 struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_Message_New(&google_protobuf_FieldDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005056 if (!arr || !sub) return NULL;
5057 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005058 return sub;
5059}
Eric Salob7d54ac2022-12-29 11:59:42 -08005060UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_mutable_nested_type(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005061 upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005062 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5063 if (arr) {
5064 if (size) *size = arr->size;
5065 return (google_protobuf_DescriptorProto**)_upb_array_ptr(arr);
5066 } else {
5067 if (size) *size = 0;
5068 return NULL;
5069 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005070}
Eric Salob7d54ac2022-12-29 11:59:42 -08005071UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_resize_nested_type(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005072 upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005073 return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005074}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005075UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_add_nested_type(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005076 upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005077 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5078 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5079 return NULL;
5080 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005081 struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)_upb_Message_New(&google_protobuf_DescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005082 if (!arr || !sub) return NULL;
5083 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005084 return sub;
5085}
Eric Salob7d54ac2022-12-29 11:59:42 -08005086UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_mutable_enum_type(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005087 upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005088 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5089 if (arr) {
5090 if (size) *size = arr->size;
5091 return (google_protobuf_EnumDescriptorProto**)_upb_array_ptr(arr);
5092 } else {
5093 if (size) *size = 0;
5094 return NULL;
5095 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005096}
Eric Salob7d54ac2022-12-29 11:59:42 -08005097UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_resize_enum_type(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005098 upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005099 return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005100}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005101UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_DescriptorProto_add_enum_type(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005102 upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005103 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5104 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5105 return NULL;
5106 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005107 struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)_upb_Message_New(&google_protobuf_EnumDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005108 if (!arr || !sub) return NULL;
5109 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005110 return sub;
5111}
Eric Salob7d54ac2022-12-29 11:59:42 -08005112UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_mutable_extension_range(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005113 upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005114 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5115 if (arr) {
5116 if (size) *size = arr->size;
5117 return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_ptr(arr);
5118 } else {
5119 if (size) *size = 0;
5120 return NULL;
5121 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005122}
Eric Salob7d54ac2022-12-29 11:59:42 -08005123UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_resize_extension_range(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005124 upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005125 return (google_protobuf_DescriptorProto_ExtensionRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005126}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005127UPB_INLINE struct google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_add_extension_range(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005128 upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005129 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5130 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5131 return NULL;
5132 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005133 struct google_protobuf_DescriptorProto_ExtensionRange* sub = (struct google_protobuf_DescriptorProto_ExtensionRange*)_upb_Message_New(&google_protobuf_DescriptorProto_ExtensionRange_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005134 if (!arr || !sub) return NULL;
5135 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005136 return sub;
5137}
Eric Salob7d54ac2022-12-29 11:59:42 -08005138UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_extension(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005139 upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005140 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5141 if (arr) {
5142 if (size) *size = arr->size;
5143 return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr);
5144 } else {
5145 if (size) *size = 0;
5146 return NULL;
5147 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005148}
Eric Salob7d54ac2022-12-29 11:59:42 -08005149UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_extension(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005150 upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005151 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005152}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005153UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_extension(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005154 upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005155 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5156 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5157 return NULL;
5158 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005159 struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_Message_New(&google_protobuf_FieldDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005160 if (!arr || !sub) return NULL;
5161 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005162 return sub;
5163}
5164UPB_INLINE void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07005165 const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005166 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005167}
5168UPB_INLINE struct google_protobuf_MessageOptions* google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005169 struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg);
5170 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005171 sub = (struct google_protobuf_MessageOptions*)_upb_Message_New(&google_protobuf_MessageOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005172 if (sub) google_protobuf_DescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005173 }
5174 return sub;
5175}
Eric Salob7d54ac2022-12-29 11:59:42 -08005176UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_mutable_oneof_decl(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005177 upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005178 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5179 if (arr) {
5180 if (size) *size = arr->size;
5181 return (google_protobuf_OneofDescriptorProto**)_upb_array_ptr(arr);
5182 } else {
5183 if (size) *size = 0;
5184 return NULL;
5185 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005186}
Eric Salob7d54ac2022-12-29 11:59:42 -08005187UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_resize_oneof_decl(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005188 upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005189 return (google_protobuf_OneofDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005190}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005191UPB_INLINE struct google_protobuf_OneofDescriptorProto* google_protobuf_DescriptorProto_add_oneof_decl(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005192 upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005193 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5194 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5195 return NULL;
5196 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005197 struct google_protobuf_OneofDescriptorProto* sub = (struct google_protobuf_OneofDescriptorProto*)_upb_Message_New(&google_protobuf_OneofDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005198 if (!arr || !sub) return NULL;
5199 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005200 return sub;
5201}
Eric Salob7d54ac2022-12-29 11:59:42 -08005202UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_mutable_reserved_range(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005203 upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005204 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5205 if (arr) {
5206 if (size) *size = arr->size;
5207 return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_ptr(arr);
5208 } else {
5209 if (size) *size = 0;
5210 return NULL;
5211 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005212}
Eric Salob7d54ac2022-12-29 11:59:42 -08005213UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_resize_reserved_range(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005214 upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005215 return (google_protobuf_DescriptorProto_ReservedRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005216}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005217UPB_INLINE struct google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_add_reserved_range(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005218 upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005219 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5220 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5221 return NULL;
5222 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005223 struct google_protobuf_DescriptorProto_ReservedRange* sub = (struct google_protobuf_DescriptorProto_ReservedRange*)_upb_Message_New(&google_protobuf_DescriptorProto_ReservedRange_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005224 if (!arr || !sub) return NULL;
5225 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005226 return sub;
5227}
Eric Salob7d54ac2022-12-29 11:59:42 -08005228UPB_INLINE upb_StringView* google_protobuf_DescriptorProto_mutable_reserved_name(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005229 upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005230 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5231 if (arr) {
5232 if (size) *size = arr->size;
5233 return (upb_StringView*)_upb_array_ptr(arr);
5234 } else {
5235 if (size) *size = 0;
5236 return NULL;
5237 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005238}
Eric Salob7d54ac2022-12-29 11:59:42 -08005239UPB_INLINE upb_StringView* google_protobuf_DescriptorProto_resize_reserved_name(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005240 upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005241 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005242}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005243UPB_INLINE bool google_protobuf_DescriptorProto_add_reserved_name(google_protobuf_DescriptorProto* msg, upb_StringView val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005244 upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005245 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5246 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5247 return false;
5248 }
5249 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
5250 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005251}
5252
5253/* google.protobuf.DescriptorProto.ExtensionRange */
5254
Joshua Habermanf41049a2022-01-21 14:41:25 -08005255UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005256 return (google_protobuf_DescriptorProto_ExtensionRange*)_upb_Message_New(&google_protobuf_DescriptorProto_ExtensionRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005257}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005258UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse(const char* buf, size_t size, upb_Arena* arena) {
5259 google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005260 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005261 if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005262 return NULL;
5263 }
5264 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005265}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005266UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse_ex(const char* buf, size_t size,
5267 const upb_ExtensionRegistry* extreg,
5268 int options, upb_Arena* arena) {
5269 google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
5270 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005271 if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08005272 kUpb_DecodeStatus_Ok) {
5273 return NULL;
5274 }
5275 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005276}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005277UPB_INLINE char* google_protobuf_DescriptorProto_ExtensionRange_serialize(const google_protobuf_DescriptorProto_ExtensionRange* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005278 char* ptr;
5279 (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msg_init, 0, arena, &ptr, len);
5280 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005281}
5282UPB_INLINE char* google_protobuf_DescriptorProto_ExtensionRange_serialize_ex(const google_protobuf_DescriptorProto_ExtensionRange* msg, int options,
5283 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005284 char* ptr;
5285 (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msg_init, options, arena, &ptr, len);
5286 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005287}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005288UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_start(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005289 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005290 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005291}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005292UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005293 int32_t default_val = (int32_t)0;
5294 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005295 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005296 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005297 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005298}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005299UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005300 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005301 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005302}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005303UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_end(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005304 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005305 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005306}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005307UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005308 int32_t default_val = (int32_t)0;
5309 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005310 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005311 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005312 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005313}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005314UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005315 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005316 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005317}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005318UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_options(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005319 const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005320 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005321}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005322UPB_INLINE const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005323 const google_protobuf_ExtensionRangeOptions* default_val = NULL;
5324 const google_protobuf_ExtensionRangeOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07005325 const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005326 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005327 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005328}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005329UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005330 const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005331 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08005332}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005333
5334UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005335 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005336 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005337}
5338UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005339 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005340 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005341}
5342UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07005343 const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005344 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005345}
5346UPB_INLINE struct google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_mutable_options(google_protobuf_DescriptorProto_ExtensionRange* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005347 struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg);
5348 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005349 sub = (struct google_protobuf_ExtensionRangeOptions*)_upb_Message_New(&google_protobuf_ExtensionRangeOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005350 if (sub) google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005351 }
5352 return sub;
5353}
5354
5355/* google.protobuf.DescriptorProto.ReservedRange */
5356
Joshua Habermanf41049a2022-01-21 14:41:25 -08005357UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005358 return (google_protobuf_DescriptorProto_ReservedRange*)_upb_Message_New(&google_protobuf_DescriptorProto_ReservedRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005359}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005360UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) {
5361 google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005362 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005363 if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005364 return NULL;
5365 }
5366 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005367}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005368UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse_ex(const char* buf, size_t size,
5369 const upb_ExtensionRegistry* extreg,
5370 int options, upb_Arena* arena) {
5371 google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
5372 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005373 if (upb_Decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08005374 kUpb_DecodeStatus_Ok) {
5375 return NULL;
5376 }
5377 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005378}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005379UPB_INLINE char* google_protobuf_DescriptorProto_ReservedRange_serialize(const google_protobuf_DescriptorProto_ReservedRange* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005380 char* ptr;
5381 (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msg_init, 0, arena, &ptr, len);
5382 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005383}
5384UPB_INLINE char* google_protobuf_DescriptorProto_ReservedRange_serialize_ex(const google_protobuf_DescriptorProto_ReservedRange* msg, int options,
5385 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005386 char* ptr;
5387 (void)upb_Encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msg_init, options, arena, &ptr, len);
5388 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005389}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005390UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_start(google_protobuf_DescriptorProto_ReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005391 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005392 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005393}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005394UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005395 int32_t default_val = (int32_t)0;
5396 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005397 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005398 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005399 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005400}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005401UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005402 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005403 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005404}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005405UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_end(google_protobuf_DescriptorProto_ReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005406 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005407 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005408}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005409UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005410 int32_t default_val = (int32_t)0;
5411 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005412 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005413 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005414 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005415}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005416UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_end(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005417 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005418 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08005419}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005420
5421UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005422 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005423 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005424}
5425UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005426 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005427 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005428}
Mike Kruskal232ecf42023-01-14 00:09:40 -08005429
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005430/* google.protobuf.ExtensionRangeOptions */
5431
Joshua Habermanf41049a2022-01-21 14:41:25 -08005432UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005433 return (google_protobuf_ExtensionRangeOptions*)_upb_Message_New(&google_protobuf_ExtensionRangeOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005434}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005435UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
5436 google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005437 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005438 if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005439 return NULL;
5440 }
5441 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005442}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005443UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse_ex(const char* buf, size_t size,
5444 const upb_ExtensionRegistry* extreg,
5445 int options, upb_Arena* arena) {
5446 google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena);
5447 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005448 if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08005449 kUpb_DecodeStatus_Ok) {
5450 return NULL;
5451 }
5452 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005453}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005454UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize(const google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005455 char* ptr;
5456 (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_msg_init, 0, arena, &ptr, len);
5457 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005458}
5459UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize_ex(const google_protobuf_ExtensionRangeOptions* msg, int options,
5460 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005461 char* ptr;
5462 (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_msg_init, options, arena, &ptr, len);
5463 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005464}
Mike Kruskal145900f2023-03-27 09:55:52 -07005465UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_declaration(google_protobuf_ExtensionRangeOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005466 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07005467 _upb_Message_ClearNonExtensionField(msg, &field);
5468}
5469UPB_INLINE const google_protobuf_ExtensionRangeOptions_Declaration* const* google_protobuf_ExtensionRangeOptions_declaration(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005470 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07005471 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5472 if (arr) {
5473 if (size) *size = arr->size;
5474 return (const google_protobuf_ExtensionRangeOptions_Declaration* const*)_upb_array_constptr(arr);
5475 } else {
5476 if (size) *size = 0;
5477 return NULL;
5478 }
5479}
Deanna Garciab26afb52023-04-25 13:37:18 -07005480UPB_INLINE const upb_Array* _google_protobuf_ExtensionRangeOptions_declaration_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005481 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005482 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5483 if (size) {
5484 *size = arr ? arr->size : 0;
5485 }
5486 return arr;
5487}
5488UPB_INLINE upb_Array* _google_protobuf_ExtensionRangeOptions_declaration_mutable_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005489 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005490 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5491 (upb_Message*)msg, &field, arena);
5492 if (size) {
5493 *size = arr ? arr->size : 0;
5494 }
5495 return arr;
5496}
Mike Kruskal145900f2023-03-27 09:55:52 -07005497UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_declaration(const google_protobuf_ExtensionRangeOptions* msg) {
5498 size_t size;
5499 google_protobuf_ExtensionRangeOptions_declaration(msg, &size);
5500 return size != 0;
5501}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07005502UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_verification(google_protobuf_ExtensionRangeOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005503 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot469f0272023-04-21 18:12:45 -07005504 _upb_Message_ClearNonExtensionField(msg, &field);
5505}
5506UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_verification(const google_protobuf_ExtensionRangeOptions* msg) {
5507 int32_t default_val = 1;
5508 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005509 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot469f0272023-04-21 18:12:45 -07005510 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
5511 return ret;
5512}
5513UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_verification(const google_protobuf_ExtensionRangeOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005514 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
5515 return _upb_Message_HasNonExtensionField(msg, &field);
5516}
5517UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_features(google_protobuf_ExtensionRangeOptions* msg) {
5518 const upb_MiniTableField field = {50, UPB_SIZE(12, 16), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
5519 _upb_Message_ClearNonExtensionField(msg, &field);
5520}
5521UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_features(const google_protobuf_ExtensionRangeOptions* msg) {
5522 const google_protobuf_FeatureSet* default_val = NULL;
5523 const google_protobuf_FeatureSet* ret;
5524 const upb_MiniTableField field = {50, UPB_SIZE(12, 16), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
5525 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
5526 return ret;
5527}
5528UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_features(const google_protobuf_ExtensionRangeOptions* msg) {
5529 const upb_MiniTableField field = {50, UPB_SIZE(12, 16), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot469f0272023-04-21 18:12:45 -07005530 return _upb_Message_HasNonExtensionField(msg, &field);
5531}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005532UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005533 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005534 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005535}
Eric Salob7d54ac2022-12-29 11:59:42 -08005536UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005537 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005538 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5539 if (arr) {
5540 if (size) *size = arr->size;
5541 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
5542 } else {
5543 if (size) *size = 0;
5544 return NULL;
5545 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005546}
Deanna Garciab26afb52023-04-25 13:37:18 -07005547UPB_INLINE const upb_Array* _google_protobuf_ExtensionRangeOptions_uninterpreted_option_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005548 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005549 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5550 if (size) {
5551 *size = arr ? arr->size : 0;
5552 }
5553 return arr;
5554}
5555UPB_INLINE upb_Array* _google_protobuf_ExtensionRangeOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005556 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07005557 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5558 (upb_Message*)msg, &field, arena);
5559 if (size) {
5560 *size = arr ? arr->size : 0;
5561 }
5562 return arr;
5563}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005564UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_uninterpreted_option(const google_protobuf_ExtensionRangeOptions* msg) {
5565 size_t size;
5566 google_protobuf_ExtensionRangeOptions_uninterpreted_option(msg, &size);
5567 return size != 0;
5568}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005569
Mike Kruskal145900f2023-03-27 09:55:52 -07005570UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration** google_protobuf_ExtensionRangeOptions_mutable_declaration(google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005571 upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07005572 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5573 if (arr) {
5574 if (size) *size = arr->size;
5575 return (google_protobuf_ExtensionRangeOptions_Declaration**)_upb_array_ptr(arr);
5576 } else {
5577 if (size) *size = 0;
5578 return NULL;
5579 }
5580}
5581UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration** google_protobuf_ExtensionRangeOptions_resize_declaration(google_protobuf_ExtensionRangeOptions* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005582 upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005583 return (google_protobuf_ExtensionRangeOptions_Declaration**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Mike Kruskal145900f2023-03-27 09:55:52 -07005584}
5585UPB_INLINE struct google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_add_declaration(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005586 upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07005587 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5588 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5589 return NULL;
5590 }
5591 struct google_protobuf_ExtensionRangeOptions_Declaration* sub = (struct google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google_protobuf_ExtensionRangeOptions_Declaration_msg_init, arena);
5592 if (!arr || !sub) return NULL;
5593 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
5594 return sub;
5595}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07005596UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_verification(google_protobuf_ExtensionRangeOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005597 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot469f0272023-04-21 18:12:45 -07005598 _upb_Message_SetNonExtensionField(msg, &field, &value);
5599}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005600UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_features(google_protobuf_ExtensionRangeOptions *msg, google_protobuf_FeatureSet* value) {
5601 const upb_MiniTableField field = {50, UPB_SIZE(12, 16), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
5602 _upb_Message_SetNonExtensionField(msg, &field, &value);
5603}
5604UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_mutable_features(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) {
5605 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ExtensionRangeOptions_features(msg);
5606 if (sub == NULL) {
5607 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
5608 if (sub) google_protobuf_ExtensionRangeOptions_set_features(msg, sub);
5609 }
5610 return sub;
5611}
Eric Salob7d54ac2022-12-29 11:59:42 -08005612UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_mutable_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005613 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005614 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5615 if (arr) {
5616 if (size) *size = arr->size;
5617 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
5618 } else {
5619 if (size) *size = 0;
5620 return NULL;
5621 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005622}
Eric Salob7d54ac2022-12-29 11:59:42 -08005623UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_resize_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, size_t size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005624 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07005625 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005626}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005627UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ExtensionRangeOptions_add_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005628 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08005629 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5630 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5631 return NULL;
5632 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005633 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08005634 if (!arr || !sub) return NULL;
5635 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005636 return sub;
5637}
5638
Mike Kruskal145900f2023-03-27 09:55:52 -07005639/* google.protobuf.ExtensionRangeOptions.Declaration */
5640
5641UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_new(upb_Arena* arena) {
5642 return (google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google_protobuf_ExtensionRangeOptions_Declaration_msg_init, arena);
5643}
5644UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse(const char* buf, size_t size, upb_Arena* arena) {
5645 google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena);
5646 if (!ret) return NULL;
5647 if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
5648 return NULL;
5649 }
5650 return ret;
5651}
5652UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse_ex(const char* buf, size_t size,
5653 const upb_ExtensionRegistry* extreg,
5654 int options, upb_Arena* arena) {
5655 google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena);
5656 if (!ret) return NULL;
5657 if (upb_Decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, extreg, options, arena) !=
5658 kUpb_DecodeStatus_Ok) {
5659 return NULL;
5660 }
5661 return ret;
5662}
5663UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize(const google_protobuf_ExtensionRangeOptions_Declaration* msg, upb_Arena* arena, size_t* len) {
5664 char* ptr;
5665 (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, 0, arena, &ptr, len);
5666 return ptr;
5667}
5668UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize_ex(const google_protobuf_ExtensionRangeOptions_Declaration* msg, int options,
5669 upb_Arena* arena, size_t* len) {
5670 char* ptr;
5671 (void)upb_Encode(msg, &google_protobuf_ExtensionRangeOptions_Declaration_msg_init, options, arena, &ptr, len);
5672 return ptr;
5673}
5674UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_number(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005675 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07005676 _upb_Message_ClearNonExtensionField(msg, &field);
5677}
5678UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_Declaration_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5679 int32_t default_val = (int32_t)0;
5680 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005681 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07005682 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
5683 return ret;
5684}
5685UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005686 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07005687 return _upb_Message_HasNonExtensionField(msg, &field);
5688}
5689UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_full_name(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005690 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07005691 _upb_Message_ClearNonExtensionField(msg, &field);
5692}
5693UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5694 upb_StringView default_val = upb_StringView_FromString("");
5695 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07005696 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07005697 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
5698 return ret;
5699}
5700UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005701 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07005702 return _upb_Message_HasNonExtensionField(msg, &field);
5703}
5704UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_type(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005705 const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07005706 _upb_Message_ClearNonExtensionField(msg, &field);
5707}
5708UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5709 upb_StringView default_val = upb_StringView_FromString("");
5710 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07005711 const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07005712 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
5713 return ret;
5714}
5715UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005716 const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07005717 return _upb_Message_HasNonExtensionField(msg, &field);
5718}
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07005719UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_reserved(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07005720 const upb_MiniTableField field = {5, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07005721 _upb_Message_ClearNonExtensionField(msg, &field);
5722}
5723UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5724 bool default_val = false;
5725 bool ret;
Sandy Zhang96c601d2023-07-05 12:39:20 -07005726 const upb_MiniTableField field = {5, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07005727 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
5728 return ret;
5729}
5730UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07005731 const upb_MiniTableField field = {5, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07005732 return _upb_Message_HasNonExtensionField(msg, &field);
5733}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07005734UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_repeated(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07005735 const upb_MiniTableField field = {6, 9, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot469f0272023-04-21 18:12:45 -07005736 _upb_Message_ClearNonExtensionField(msg, &field);
5737}
5738UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
5739 bool default_val = false;
5740 bool ret;
Sandy Zhang96c601d2023-07-05 12:39:20 -07005741 const upb_MiniTableField field = {6, 9, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot469f0272023-04-21 18:12:45 -07005742 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
5743 return ret;
5744}
5745UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07005746 const upb_MiniTableField field = {6, 9, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot469f0272023-04-21 18:12:45 -07005747 return _upb_Message_HasNonExtensionField(msg, &field);
5748}
Mike Kruskal145900f2023-03-27 09:55:52 -07005749
5750UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_number(google_protobuf_ExtensionRangeOptions_Declaration *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005751 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07005752 _upb_Message_SetNonExtensionField(msg, &field, &value);
5753}
5754UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_full_name(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07005755 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07005756 _upb_Message_SetNonExtensionField(msg, &field, &value);
5757}
5758UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_type(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07005759 const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal145900f2023-03-27 09:55:52 -07005760 _upb_Message_SetNonExtensionField(msg, &field, &value);
5761}
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07005762UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_reserved(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07005763 const upb_MiniTableField field = {5, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07005764 _upb_Message_SetNonExtensionField(msg, &field, &value);
5765}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07005766UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_repeated(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07005767 const upb_MiniTableField field = {6, 9, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot469f0272023-04-21 18:12:45 -07005768 _upb_Message_SetNonExtensionField(msg, &field, &value);
5769}
Mike Kruskal145900f2023-03-27 09:55:52 -07005770
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005771/* google.protobuf.FieldDescriptorProto */
5772
Joshua Habermanf41049a2022-01-21 14:41:25 -08005773UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005774 return (google_protobuf_FieldDescriptorProto*)_upb_Message_New(&google_protobuf_FieldDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005775}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005776UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
5777 google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005778 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005779 if (upb_Decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005780 return NULL;
5781 }
5782 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005783}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005784UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse_ex(const char* buf, size_t size,
5785 const upb_ExtensionRegistry* extreg,
5786 int options, upb_Arena* arena) {
5787 google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena);
5788 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005789 if (upb_Decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08005790 kUpb_DecodeStatus_Ok) {
5791 return NULL;
5792 }
5793 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005794}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005795UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize(const google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005796 char* ptr;
5797 (void)upb_Encode(msg, &google_protobuf_FieldDescriptorProto_msg_init, 0, arena, &ptr, len);
5798 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005799}
5800UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize_ex(const google_protobuf_FieldDescriptorProto* msg, int options,
5801 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005802 char* ptr;
5803 (void)upb_Encode(msg, &google_protobuf_FieldDescriptorProto_msg_init, options, arena, &ptr, len);
5804 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005805}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005806UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_name(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005807 const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005808 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005809}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005810UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005811 upb_StringView default_val = upb_StringView_FromString("");
5812 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07005813 const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005814 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005815 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005816}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005817UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005818 const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005819 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005820}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005821UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_extendee(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005822 const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005823 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005824}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005825UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005826 upb_StringView default_val = upb_StringView_FromString("");
5827 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07005828 const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005829 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005830 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005831}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005832UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005833 const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005834 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005835}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005836UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_number(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005837 const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005838 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005839}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005840UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005841 int32_t default_val = (int32_t)0;
5842 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005843 const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005844 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005845 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005846}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005847UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005848 const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005849 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005850}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005851UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_label(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005852 const upb_MiniTableField field = {4, 8, 4, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005853 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005854}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005855UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005856 int32_t default_val = 1;
5857 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005858 const upb_MiniTableField field = {4, 8, 4, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005859 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005860 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005861}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005862UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005863 const upb_MiniTableField field = {4, 8, 4, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005864 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005865}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005866UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005867 const upb_MiniTableField field = {5, 12, 5, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005868 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005869}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005870UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005871 int32_t default_val = 1;
5872 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005873 const upb_MiniTableField field = {5, 12, 5, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005874 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005875 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005876}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005877UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005878 const upb_MiniTableField field = {5, 12, 5, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005879 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005880}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005881UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type_name(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005882 const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005883 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005884}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005885UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005886 upb_StringView default_val = upb_StringView_FromString("");
5887 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07005888 const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005889 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005890 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005891}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005892UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005893 const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005894 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005895}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005896UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_default_value(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005897 const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005898 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005899}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005900UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005901 upb_StringView default_val = upb_StringView_FromString("");
5902 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07005903 const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005904 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005905 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005906}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005907UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005908 const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005909 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005910}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005911UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_options(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005912 const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005913 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005914}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005915UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005916 const google_protobuf_FieldOptions* default_val = NULL;
5917 const google_protobuf_FieldOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07005918 const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005919 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005920 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005921}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005922UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005923 const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005924 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005925}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005926UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_oneof_index(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005927 const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005928 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005929}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005930UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005931 int32_t default_val = (int32_t)0;
5932 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005933 const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005934 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005935 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005936}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005937UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005938 const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005939 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005940}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005941UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_json_name(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005942 const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005943 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005944}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005945UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005946 upb_StringView default_val = upb_StringView_FromString("");
5947 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07005948 const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005949 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005950 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005951}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005952UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005953 const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005954 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005955}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005956UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_proto3_optional(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005957 const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005958 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005959}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005960UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005961 bool default_val = false;
5962 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07005963 const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005964 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005965 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005966}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005967UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005968 const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005969 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08005970}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005971
5972UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07005973 const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005974 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005975}
5976UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07005977 const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005978 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005979}
5980UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005981 const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005982 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005983}
5984UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005985 const upb_MiniTableField field = {4, 8, 4, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005986 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005987}
5988UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005989 const upb_MiniTableField field = {5, 12, 5, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005990 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005991}
5992UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07005993 const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005994 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005995}
5996UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07005997 const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005998 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005999}
6000UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07006001 const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006002 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006003}
6004UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006005 struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg);
6006 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006007 sub = (struct google_protobuf_FieldOptions*)_upb_Message_New(&google_protobuf_FieldOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006008 if (sub) google_protobuf_FieldDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006009 }
6010 return sub;
6011}
6012UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006013 const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006014 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006015}
6016UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006017 const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006018 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006019}
6020UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07006021 const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006022 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006023}
Mike Kruskal232ecf42023-01-14 00:09:40 -08006024
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006025/* google.protobuf.OneofDescriptorProto */
6026
Joshua Habermanf41049a2022-01-21 14:41:25 -08006027UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006028 return (google_protobuf_OneofDescriptorProto*)_upb_Message_New(&google_protobuf_OneofDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006029}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006030UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6031 google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006032 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006033 if (upb_Decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006034 return NULL;
6035 }
6036 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006037}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006038UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse_ex(const char* buf, size_t size,
6039 const upb_ExtensionRegistry* extreg,
6040 int options, upb_Arena* arena) {
6041 google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena);
6042 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006043 if (upb_Decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006044 kUpb_DecodeStatus_Ok) {
6045 return NULL;
6046 }
6047 return ret;
6048}
6049UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize(const google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006050 char* ptr;
6051 (void)upb_Encode(msg, &google_protobuf_OneofDescriptorProto_msg_init, 0, arena, &ptr, len);
6052 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006053}
6054UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize_ex(const google_protobuf_OneofDescriptorProto* msg, int options,
6055 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006056 char* ptr;
6057 (void)upb_Encode(msg, &google_protobuf_OneofDescriptorProto_msg_init, options, arena, &ptr, len);
6058 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006059}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006060UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_name(google_protobuf_OneofDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006061 const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006062 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006063}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006064UPB_INLINE upb_StringView google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006065 upb_StringView default_val = upb_StringView_FromString("");
6066 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006067 const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006068 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006069 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006070}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006071UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_name(const google_protobuf_OneofDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006072 const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006073 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006074}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006075UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_options(google_protobuf_OneofDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006076 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006077 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006078}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006079UPB_INLINE const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006080 const google_protobuf_OneofOptions* default_val = NULL;
6081 const google_protobuf_OneofOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07006082 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006083 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006084 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006085}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006086UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_options(const google_protobuf_OneofDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006087 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006088 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006089}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006090
Joshua Habermanf41049a2022-01-21 14:41:25 -08006091UPB_INLINE void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006092 const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006093 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006094}
6095UPB_INLINE void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07006096 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006097 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006098}
6099UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006100 struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg);
6101 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006102 sub = (struct google_protobuf_OneofOptions*)_upb_Message_New(&google_protobuf_OneofOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006103 if (sub) google_protobuf_OneofDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006104 }
6105 return sub;
6106}
6107
6108/* google.protobuf.EnumDescriptorProto */
6109
Joshua Habermanf41049a2022-01-21 14:41:25 -08006110UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006111 return (google_protobuf_EnumDescriptorProto*)_upb_Message_New(&google_protobuf_EnumDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006112}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006113UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6114 google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006115 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006116 if (upb_Decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006117 return NULL;
6118 }
6119 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006120}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006121UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse_ex(const char* buf, size_t size,
6122 const upb_ExtensionRegistry* extreg,
6123 int options, upb_Arena* arena) {
6124 google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena);
6125 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006126 if (upb_Decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006127 kUpb_DecodeStatus_Ok) {
6128 return NULL;
6129 }
6130 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006131}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006132UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize(const google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006133 char* ptr;
6134 (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_msg_init, 0, arena, &ptr, len);
6135 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006136}
6137UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize_ex(const google_protobuf_EnumDescriptorProto* msg, int options,
6138 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006139 char* ptr;
6140 (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_msg_init, options, arena, &ptr, len);
6141 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006142}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006143UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_name(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006144 const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006145 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006146}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006147UPB_INLINE upb_StringView google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006148 upb_StringView default_val = upb_StringView_FromString("");
6149 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006150 const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006151 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006152 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006153}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006154UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_name(const google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006155 const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006156 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006157}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006158UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_value(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006159 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006160 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006161}
Eric Salob7d54ac2022-12-29 11:59:42 -08006162UPB_INLINE const google_protobuf_EnumValueDescriptorProto* const* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006163 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006164 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6165 if (arr) {
6166 if (size) *size = arr->size;
6167 return (const google_protobuf_EnumValueDescriptorProto* const*)_upb_array_constptr(arr);
6168 } else {
6169 if (size) *size = 0;
6170 return NULL;
6171 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006172}
Deanna Garciab26afb52023-04-25 13:37:18 -07006173UPB_INLINE const upb_Array* _google_protobuf_EnumDescriptorProto_value_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006174 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07006175 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6176 if (size) {
6177 *size = arr ? arr->size : 0;
6178 }
6179 return arr;
6180}
6181UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_value_mutable_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006182 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07006183 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6184 (upb_Message*)msg, &field, arena);
6185 if (size) {
6186 *size = arr ? arr->size : 0;
6187 }
6188 return arr;
6189}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006190UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_value(const google_protobuf_EnumDescriptorProto* msg) {
6191 size_t size;
6192 google_protobuf_EnumDescriptorProto_value(msg, &size);
6193 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006194}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006195UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_options(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006196 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006197 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006198}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006199UPB_INLINE const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006200 const google_protobuf_EnumOptions* default_val = NULL;
6201 const google_protobuf_EnumOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07006202 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006203 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006204 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006205}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006206UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_options(const google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006207 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006208 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006209}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006210UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_range(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006211 const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006212 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006213}
Eric Salob7d54ac2022-12-29 11:59:42 -08006214UPB_INLINE const google_protobuf_EnumDescriptorProto_EnumReservedRange* const* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006215 const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006216 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6217 if (arr) {
6218 if (size) *size = arr->size;
6219 return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)_upb_array_constptr(arr);
6220 } else {
6221 if (size) *size = 0;
6222 return NULL;
6223 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006224}
Deanna Garciab26afb52023-04-25 13:37:18 -07006225UPB_INLINE const upb_Array* _google_protobuf_EnumDescriptorProto_reserved_range_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006226 const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07006227 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6228 if (size) {
6229 *size = arr ? arr->size : 0;
6230 }
6231 return arr;
6232}
6233UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_reserved_range_mutable_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006234 const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07006235 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6236 (upb_Message*)msg, &field, arena);
6237 if (size) {
6238 *size = arr ? arr->size : 0;
6239 }
6240 return arr;
6241}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006242UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_range(const google_protobuf_EnumDescriptorProto* msg) {
6243 size_t size;
6244 google_protobuf_EnumDescriptorProto_reserved_range(msg, &size);
6245 return size != 0;
6246}
6247UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_name(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006248 const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006249 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006250}
Eric Salob7d54ac2022-12-29 11:59:42 -08006251UPB_INLINE upb_StringView const* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006252 const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006253 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6254 if (arr) {
6255 if (size) *size = arr->size;
6256 return (upb_StringView const*)_upb_array_constptr(arr);
6257 } else {
6258 if (size) *size = 0;
6259 return NULL;
6260 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006261}
Deanna Garciab26afb52023-04-25 13:37:18 -07006262UPB_INLINE const upb_Array* _google_protobuf_EnumDescriptorProto_reserved_name_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006263 const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07006264 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6265 if (size) {
6266 *size = arr ? arr->size : 0;
6267 }
6268 return arr;
6269}
6270UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_reserved_name_mutable_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006271 const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07006272 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6273 (upb_Message*)msg, &field, arena);
6274 if (size) {
6275 *size = arr ? arr->size : 0;
6276 }
6277 return arr;
6278}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006279UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_name(const google_protobuf_EnumDescriptorProto* msg) {
6280 size_t size;
6281 google_protobuf_EnumDescriptorProto_reserved_name(msg, &size);
6282 return size != 0;
6283}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006284
Joshua Habermanf41049a2022-01-21 14:41:25 -08006285UPB_INLINE void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006286 const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006287 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006288}
6289UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006290 upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006291 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6292 if (arr) {
6293 if (size) *size = arr->size;
6294 return (google_protobuf_EnumValueDescriptorProto**)_upb_array_ptr(arr);
6295 } else {
6296 if (size) *size = 0;
6297 return NULL;
6298 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006299}
Eric Salob7d54ac2022-12-29 11:59:42 -08006300UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_resize_value(google_protobuf_EnumDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006301 upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07006302 return (google_protobuf_EnumValueDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006303}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006304UPB_INLINE struct google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumDescriptorProto_add_value(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006305 upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006306 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6307 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6308 return NULL;
6309 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07006310 struct google_protobuf_EnumValueDescriptorProto* sub = (struct google_protobuf_EnumValueDescriptorProto*)_upb_Message_New(&google_protobuf_EnumValueDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08006311 if (!arr || !sub) return NULL;
6312 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006313 return sub;
6314}
6315UPB_INLINE void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07006316 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006317 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006318}
6319UPB_INLINE struct google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006320 struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg);
6321 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006322 sub = (struct google_protobuf_EnumOptions*)_upb_Message_New(&google_protobuf_EnumOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006323 if (sub) google_protobuf_EnumDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006324 }
6325 return sub;
6326}
Eric Salob7d54ac2022-12-29 11:59:42 -08006327UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_mutable_reserved_range(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006328 upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006329 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6330 if (arr) {
6331 if (size) *size = arr->size;
6332 return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_ptr(arr);
6333 } else {
6334 if (size) *size = 0;
6335 return NULL;
6336 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006337}
Eric Salob7d54ac2022-12-29 11:59:42 -08006338UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_resize_reserved_range(google_protobuf_EnumDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006339 upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07006340 return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006341}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006342UPB_INLINE struct google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_add_reserved_range(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006343 upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006344 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6345 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6346 return NULL;
6347 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07006348 struct google_protobuf_EnumDescriptorProto_EnumReservedRange* sub = (struct google_protobuf_EnumDescriptorProto_EnumReservedRange*)_upb_Message_New(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08006349 if (!arr || !sub) return NULL;
6350 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006351 return sub;
6352}
Eric Salob7d54ac2022-12-29 11:59:42 -08006353UPB_INLINE upb_StringView* google_protobuf_EnumDescriptorProto_mutable_reserved_name(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006354 upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006355 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6356 if (arr) {
6357 if (size) *size = arr->size;
6358 return (upb_StringView*)_upb_array_ptr(arr);
6359 } else {
6360 if (size) *size = 0;
6361 return NULL;
6362 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006363}
Eric Salob7d54ac2022-12-29 11:59:42 -08006364UPB_INLINE upb_StringView* google_protobuf_EnumDescriptorProto_resize_reserved_name(google_protobuf_EnumDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006365 upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07006366 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006367}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006368UPB_INLINE bool google_protobuf_EnumDescriptorProto_add_reserved_name(google_protobuf_EnumDescriptorProto* msg, upb_StringView val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006369 upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006370 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6371 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6372 return false;
6373 }
6374 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
6375 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006376}
6377
6378/* google.protobuf.EnumDescriptorProto.EnumReservedRange */
6379
Joshua Habermanf41049a2022-01-21 14:41:25 -08006380UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006381 return (google_protobuf_EnumDescriptorProto_EnumReservedRange*)_upb_Message_New(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006382}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006383UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) {
6384 google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006385 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006386 if (upb_Decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006387 return NULL;
6388 }
6389 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006390}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006391UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse_ex(const char* buf, size_t size,
6392 const upb_ExtensionRegistry* extreg,
6393 int options, upb_Arena* arena) {
6394 google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
6395 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006396 if (upb_Decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006397 kUpb_DecodeStatus_Ok) {
6398 return NULL;
6399 }
6400 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006401}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006402UPB_INLINE char* google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006403 char* ptr;
6404 (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, 0, arena, &ptr, len);
6405 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006406}
6407UPB_INLINE char* google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize_ex(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg, int options,
6408 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006409 char* ptr;
6410 (void)upb_Encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init, options, arena, &ptr, len);
6411 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006412}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006413UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_start(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006414 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006415 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006416}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006417UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006418 int32_t default_val = (int32_t)0;
6419 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006420 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006421 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006422 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006423}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006424UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006425 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006426 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006427}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006428UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_end(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006429 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006430 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006431}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006432UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006433 int32_t default_val = (int32_t)0;
6434 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006435 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006436 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006437 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006438}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006439UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006440 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006441 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006442}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006443
6444UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006445 const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006446 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006447}
6448UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006449 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006450 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006451}
Mike Kruskal232ecf42023-01-14 00:09:40 -08006452
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006453/* google.protobuf.EnumValueDescriptorProto */
6454
Joshua Habermanf41049a2022-01-21 14:41:25 -08006455UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006456 return (google_protobuf_EnumValueDescriptorProto*)_upb_Message_New(&google_protobuf_EnumValueDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006457}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006458UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6459 google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006460 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006461 if (upb_Decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006462 return NULL;
6463 }
6464 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006465}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006466UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse_ex(const char* buf, size_t size,
6467 const upb_ExtensionRegistry* extreg,
6468 int options, upb_Arena* arena) {
6469 google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena);
6470 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006471 if (upb_Decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006472 kUpb_DecodeStatus_Ok) {
6473 return NULL;
6474 }
6475 return ret;
6476}
6477UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize(const google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006478 char* ptr;
6479 (void)upb_Encode(msg, &google_protobuf_EnumValueDescriptorProto_msg_init, 0, arena, &ptr, len);
6480 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006481}
6482UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize_ex(const google_protobuf_EnumValueDescriptorProto* msg, int options,
6483 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006484 char* ptr;
6485 (void)upb_Encode(msg, &google_protobuf_EnumValueDescriptorProto_msg_init, options, arena, &ptr, len);
6486 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006487}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006488UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_name(google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006489 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006490 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006491}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006492UPB_INLINE upb_StringView google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006493 upb_StringView default_val = upb_StringView_FromString("");
6494 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006495 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006496 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006497 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006498}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006499UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006500 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006501 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006502}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006503UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_number(google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006504 const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006505 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006506}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006507UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006508 int32_t default_val = (int32_t)0;
6509 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006510 const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006511 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006512 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006513}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006514UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006515 const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006516 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006517}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006518UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_options(google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006519 const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006520 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006521}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006522UPB_INLINE const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006523 const google_protobuf_EnumValueOptions* default_val = NULL;
6524 const google_protobuf_EnumValueOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07006525 const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006526 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006527 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006528}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006529UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006530 const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006531 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006532}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006533
Joshua Habermanf41049a2022-01-21 14:41:25 -08006534UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006535 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006536 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006537}
6538UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006539 const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006540 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006541}
6542UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07006543 const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006544 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006545}
6546UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006547 struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg);
6548 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006549 sub = (struct google_protobuf_EnumValueOptions*)_upb_Message_New(&google_protobuf_EnumValueOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006550 if (sub) google_protobuf_EnumValueDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006551 }
6552 return sub;
6553}
6554
6555/* google.protobuf.ServiceDescriptorProto */
6556
Joshua Habermanf41049a2022-01-21 14:41:25 -08006557UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006558 return (google_protobuf_ServiceDescriptorProto*)_upb_Message_New(&google_protobuf_ServiceDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006559}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006560UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6561 google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006562 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006563 if (upb_Decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006564 return NULL;
6565 }
6566 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006567}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006568UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse_ex(const char* buf, size_t size,
6569 const upb_ExtensionRegistry* extreg,
6570 int options, upb_Arena* arena) {
6571 google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena);
6572 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006573 if (upb_Decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006574 kUpb_DecodeStatus_Ok) {
6575 return NULL;
6576 }
6577 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006578}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006579UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize(const google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006580 char* ptr;
6581 (void)upb_Encode(msg, &google_protobuf_ServiceDescriptorProto_msg_init, 0, arena, &ptr, len);
6582 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006583}
6584UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize_ex(const google_protobuf_ServiceDescriptorProto* msg, int options,
6585 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006586 char* ptr;
6587 (void)upb_Encode(msg, &google_protobuf_ServiceDescriptorProto_msg_init, options, arena, &ptr, len);
6588 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006589}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006590UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_name(google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006591 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006592 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006593}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006594UPB_INLINE upb_StringView google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006595 upb_StringView default_val = upb_StringView_FromString("");
6596 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006597 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006598 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006599 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006600}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006601UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006602 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006603 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006604}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006605UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_method(google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006606 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006607 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006608}
Eric Salob7d54ac2022-12-29 11:59:42 -08006609UPB_INLINE const google_protobuf_MethodDescriptorProto* const* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006610 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006611 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6612 if (arr) {
6613 if (size) *size = arr->size;
6614 return (const google_protobuf_MethodDescriptorProto* const*)_upb_array_constptr(arr);
6615 } else {
6616 if (size) *size = 0;
6617 return NULL;
6618 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006619}
Deanna Garciab26afb52023-04-25 13:37:18 -07006620UPB_INLINE const upb_Array* _google_protobuf_ServiceDescriptorProto_method_upb_array(const google_protobuf_ServiceDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006621 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07006622 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6623 if (size) {
6624 *size = arr ? arr->size : 0;
6625 }
6626 return arr;
6627}
6628UPB_INLINE upb_Array* _google_protobuf_ServiceDescriptorProto_method_mutable_upb_array(const google_protobuf_ServiceDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006629 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07006630 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6631 (upb_Message*)msg, &field, arena);
6632 if (size) {
6633 *size = arr ? arr->size : 0;
6634 }
6635 return arr;
6636}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006637UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_method(const google_protobuf_ServiceDescriptorProto* msg) {
6638 size_t size;
6639 google_protobuf_ServiceDescriptorProto_method(msg, &size);
6640 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006641}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006642UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_options(google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006643 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006644 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006645}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006646UPB_INLINE const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006647 const google_protobuf_ServiceOptions* default_val = NULL;
6648 const google_protobuf_ServiceOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07006649 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006650 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006651 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006652}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006653UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_options(const google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006654 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006655 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006656}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006657
Joshua Habermanf41049a2022-01-21 14:41:25 -08006658UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006659 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006660 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006661}
6662UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006663 upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006664 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6665 if (arr) {
6666 if (size) *size = arr->size;
6667 return (google_protobuf_MethodDescriptorProto**)_upb_array_ptr(arr);
6668 } else {
6669 if (size) *size = 0;
6670 return NULL;
6671 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006672}
Eric Salob7d54ac2022-12-29 11:59:42 -08006673UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_resize_method(google_protobuf_ServiceDescriptorProto* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006674 upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07006675 return (google_protobuf_MethodDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006676}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006677UPB_INLINE struct google_protobuf_MethodDescriptorProto* google_protobuf_ServiceDescriptorProto_add_method(google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006678 upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08006679 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6680 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6681 return NULL;
6682 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07006683 struct google_protobuf_MethodDescriptorProto* sub = (struct google_protobuf_MethodDescriptorProto*)_upb_Message_New(&google_protobuf_MethodDescriptorProto_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08006684 if (!arr || !sub) return NULL;
6685 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006686 return sub;
6687}
6688UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07006689 const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006690 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006691}
6692UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006693 struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg);
6694 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006695 sub = (struct google_protobuf_ServiceOptions*)_upb_Message_New(&google_protobuf_ServiceOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006696 if (sub) google_protobuf_ServiceDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006697 }
6698 return sub;
6699}
6700
6701/* google.protobuf.MethodDescriptorProto */
6702
Joshua Habermanf41049a2022-01-21 14:41:25 -08006703UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006704 return (google_protobuf_MethodDescriptorProto*)_upb_Message_New(&google_protobuf_MethodDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006705}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006706UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6707 google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006708 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006709 if (upb_Decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006710 return NULL;
6711 }
6712 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006713}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006714UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse_ex(const char* buf, size_t size,
6715 const upb_ExtensionRegistry* extreg,
6716 int options, upb_Arena* arena) {
6717 google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena);
6718 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006719 if (upb_Decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006720 kUpb_DecodeStatus_Ok) {
6721 return NULL;
6722 }
6723 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006724}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006725UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize(const google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006726 char* ptr;
6727 (void)upb_Encode(msg, &google_protobuf_MethodDescriptorProto_msg_init, 0, arena, &ptr, len);
6728 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006729}
6730UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize_ex(const google_protobuf_MethodDescriptorProto* msg, int options,
6731 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006732 char* ptr;
6733 (void)upb_Encode(msg, &google_protobuf_MethodDescriptorProto_msg_init, options, arena, &ptr, len);
6734 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006735}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006736UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_name(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006737 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006738 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006739}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006740UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006741 upb_StringView default_val = upb_StringView_FromString("");
6742 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006743 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006744 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006745 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006746}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006747UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006748 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006749 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006750}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006751UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_input_type(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006752 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006753 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006754}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006755UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006756 upb_StringView default_val = upb_StringView_FromString("");
6757 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006758 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006759 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006760 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006761}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006762UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006763 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006764 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006765}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006766UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_output_type(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006767 const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006768 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006769}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006770UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006771 upb_StringView default_val = upb_StringView_FromString("");
6772 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006773 const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006774 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006775 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006776}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006777UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006778 const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006779 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006780}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006781UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_options(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006782 const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006783 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006784}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006785UPB_INLINE const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006786 const google_protobuf_MethodOptions* default_val = NULL;
6787 const google_protobuf_MethodOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07006788 const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006789 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006790 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006791}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006792UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006793 const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006794 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006795}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006796UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_client_streaming(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006797 const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006798 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006799}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006800UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006801 bool default_val = false;
6802 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07006803 const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006804 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006805 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006806}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006807UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006808 const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006809 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006810}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006811UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_server_streaming(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006812 const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006813 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006814}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006815UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006816 bool default_val = false;
6817 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07006818 const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006819 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006820 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006821}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006822UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006823 const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006824 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006825}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006826
Joshua Habermanf41049a2022-01-21 14:41:25 -08006827UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006828 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006829 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006830}
6831UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006832 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006833 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006834}
6835UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006836 const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006837 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006838}
6839UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07006840 const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006841 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006842}
6843UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006844 struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg);
6845 if (sub == NULL) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006846 sub = (struct google_protobuf_MethodOptions*)_upb_Message_New(&google_protobuf_MethodOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006847 if (sub) google_protobuf_MethodDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006848 }
6849 return sub;
6850}
6851UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07006852 const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006853 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006854}
6855UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07006856 const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006857 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006858}
Mike Kruskal232ecf42023-01-14 00:09:40 -08006859
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006860/* google.protobuf.FileOptions */
6861
Joshua Habermanf41049a2022-01-21 14:41:25 -08006862UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006863 return (google_protobuf_FileOptions*)_upb_Message_New(&google_protobuf_FileOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006864}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006865UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
6866 google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006867 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006868 if (upb_Decode(buf, size, ret, &google_protobuf_FileOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006869 return NULL;
6870 }
6871 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006872}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006873UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse_ex(const char* buf, size_t size,
6874 const upb_ExtensionRegistry* extreg,
6875 int options, upb_Arena* arena) {
6876 google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena);
6877 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07006878 if (upb_Decode(buf, size, ret, &google_protobuf_FileOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006879 kUpb_DecodeStatus_Ok) {
6880 return NULL;
6881 }
6882 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006883}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006884UPB_INLINE char* google_protobuf_FileOptions_serialize(const google_protobuf_FileOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006885 char* ptr;
6886 (void)upb_Encode(msg, &google_protobuf_FileOptions_msg_init, 0, arena, &ptr, len);
6887 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006888}
6889UPB_INLINE char* google_protobuf_FileOptions_serialize_ex(const google_protobuf_FileOptions* msg, int options,
6890 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006891 char* ptr;
6892 (void)upb_Encode(msg, &google_protobuf_FileOptions_msg_init, options, arena, &ptr, len);
6893 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006894}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006895UPB_INLINE void google_protobuf_FileOptions_clear_java_package(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006896 const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006897 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006898}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006899UPB_INLINE upb_StringView google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006900 upb_StringView default_val = upb_StringView_FromString("");
6901 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006902 const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006903 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006904 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006905}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006906UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006907 const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006908 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006909}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006910UPB_INLINE void google_protobuf_FileOptions_clear_java_outer_classname(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006911 const upb_MiniTableField field = {8, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006912 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006913}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006914UPB_INLINE upb_StringView google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006915 upb_StringView default_val = upb_StringView_FromString("");
6916 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006917 const upb_MiniTableField field = {8, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006918 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006919 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006920}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006921UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006922 const upb_MiniTableField field = {8, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006923 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006924}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006925UPB_INLINE void google_protobuf_FileOptions_clear_optimize_for(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006926 const upb_MiniTableField field = {9, 4, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006927 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006928}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006929UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006930 int32_t default_val = 1;
6931 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006932 const upb_MiniTableField field = {9, 4, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006933 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006934 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006935}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006936UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006937 const upb_MiniTableField field = {9, 4, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006938 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006939}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006940UPB_INLINE void google_protobuf_FileOptions_clear_java_multiple_files(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006941 const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006942 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006943}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006944UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006945 bool default_val = false;
6946 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07006947 const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006948 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006949 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006950}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006951UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006952 const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006953 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006954}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006955UPB_INLINE void google_protobuf_FileOptions_clear_go_package(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006956 const upb_MiniTableField field = {11, UPB_SIZE(44, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006957 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006958}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006959UPB_INLINE upb_StringView google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006960 upb_StringView default_val = upb_StringView_FromString("");
6961 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006962 const upb_MiniTableField field = {11, UPB_SIZE(44, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006963 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006964 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006965}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006966UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006967 const upb_MiniTableField field = {11, UPB_SIZE(44, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006968 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006969}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006970UPB_INLINE void google_protobuf_FileOptions_clear_cc_generic_services(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006971 const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006972 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006973}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006974UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006975 bool default_val = false;
6976 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07006977 const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006978 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006979 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006980}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006981UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006982 const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006983 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006984}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006985UPB_INLINE void google_protobuf_FileOptions_clear_java_generic_services(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006986 const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006987 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006988}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006989UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006990 bool default_val = false;
6991 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07006992 const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006993 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006994 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006995}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006996UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006997 const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08006998 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006999}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007000UPB_INLINE void google_protobuf_FileOptions_clear_py_generic_services(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007001 const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007002 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007003}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007004UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007005 bool default_val = false;
7006 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007007 const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007008 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007009 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007010}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007011UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007012 const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007013 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007014}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007015UPB_INLINE void google_protobuf_FileOptions_clear_java_generate_equals_and_hash(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007016 const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007017 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007018}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007019UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007020 bool default_val = false;
7021 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007022 const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007023 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007024 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007025}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007026UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007027 const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007028 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007029}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007030UPB_INLINE void google_protobuf_FileOptions_clear_deprecated(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007031 const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007032 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007033}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007034UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007035 bool default_val = false;
7036 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007037 const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007038 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007039 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007040}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007041UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007042 const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007043 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007044}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007045UPB_INLINE void google_protobuf_FileOptions_clear_java_string_check_utf8(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007046 const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007047 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007048}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007049UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007050 bool default_val = false;
7051 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007052 const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007053 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007054 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007055}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007056UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007057 const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007058 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007059}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007060UPB_INLINE void google_protobuf_FileOptions_clear_cc_enable_arenas(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007061 const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007062 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007063}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007064UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007065 bool default_val = true;
7066 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007067 const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007068 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007069 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007070}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007071UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007072 const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007073 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007074}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007075UPB_INLINE void google_protobuf_FileOptions_clear_objc_class_prefix(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007076 const upb_MiniTableField field = {36, UPB_SIZE(52, 72), 13, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007077 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007078}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007079UPB_INLINE upb_StringView google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007080 upb_StringView default_val = upb_StringView_FromString("");
7081 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007082 const upb_MiniTableField field = {36, UPB_SIZE(52, 72), 13, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007083 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007084 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007085}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007086UPB_INLINE bool google_protobuf_FileOptions_has_objc_class_prefix(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007087 const upb_MiniTableField field = {36, UPB_SIZE(52, 72), 13, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007088 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007089}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007090UPB_INLINE void google_protobuf_FileOptions_clear_csharp_namespace(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007091 const upb_MiniTableField field = {37, UPB_SIZE(60, 88), 14, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007092 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007093}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007094UPB_INLINE upb_StringView google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007095 upb_StringView default_val = upb_StringView_FromString("");
7096 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007097 const upb_MiniTableField field = {37, UPB_SIZE(60, 88), 14, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007098 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007099 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007100}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007101UPB_INLINE bool google_protobuf_FileOptions_has_csharp_namespace(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007102 const upb_MiniTableField field = {37, UPB_SIZE(60, 88), 14, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007103 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007104}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007105UPB_INLINE void google_protobuf_FileOptions_clear_swift_prefix(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007106 const upb_MiniTableField field = {39, UPB_SIZE(68, 104), 15, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007107 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007108}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007109UPB_INLINE upb_StringView google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007110 upb_StringView default_val = upb_StringView_FromString("");
7111 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007112 const upb_MiniTableField field = {39, UPB_SIZE(68, 104), 15, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007113 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007114 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007115}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007116UPB_INLINE bool google_protobuf_FileOptions_has_swift_prefix(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007117 const upb_MiniTableField field = {39, UPB_SIZE(68, 104), 15, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007118 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007119}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007120UPB_INLINE void google_protobuf_FileOptions_clear_php_class_prefix(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007121 const upb_MiniTableField field = {40, UPB_SIZE(76, 120), 16, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007122 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007123}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007124UPB_INLINE upb_StringView google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007125 upb_StringView default_val = upb_StringView_FromString("");
7126 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007127 const upb_MiniTableField field = {40, UPB_SIZE(76, 120), 16, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007128 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007129 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007130}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007131UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007132 const upb_MiniTableField field = {40, UPB_SIZE(76, 120), 16, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007133 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007134}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007135UPB_INLINE void google_protobuf_FileOptions_clear_php_namespace(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007136 const upb_MiniTableField field = {41, UPB_SIZE(84, 136), 17, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007137 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007138}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007139UPB_INLINE upb_StringView google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007140 upb_StringView default_val = upb_StringView_FromString("");
7141 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007142 const upb_MiniTableField field = {41, UPB_SIZE(84, 136), 17, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007143 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007144 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007145}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007146UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007147 const upb_MiniTableField field = {41, UPB_SIZE(84, 136), 17, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007148 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007149}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007150UPB_INLINE void google_protobuf_FileOptions_clear_php_generic_services(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007151 const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007152 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007153}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007154UPB_INLINE bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007155 bool default_val = false;
7156 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007157 const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007158 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007159 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007160}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007161UPB_INLINE bool google_protobuf_FileOptions_has_php_generic_services(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007162 const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007163 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007164}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007165UPB_INLINE void google_protobuf_FileOptions_clear_php_metadata_namespace(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007166 const upb_MiniTableField field = {44, UPB_SIZE(92, 152), 19, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007167 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007168}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007169UPB_INLINE upb_StringView google_protobuf_FileOptions_php_metadata_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007170 upb_StringView default_val = upb_StringView_FromString("");
7171 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007172 const upb_MiniTableField field = {44, UPB_SIZE(92, 152), 19, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007173 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007174 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007175}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007176UPB_INLINE bool google_protobuf_FileOptions_has_php_metadata_namespace(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007177 const upb_MiniTableField field = {44, UPB_SIZE(92, 152), 19, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007178 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007179}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007180UPB_INLINE void google_protobuf_FileOptions_clear_ruby_package(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007181 const upb_MiniTableField field = {45, UPB_SIZE(100, 168), 20, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007182 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007183}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007184UPB_INLINE upb_StringView google_protobuf_FileOptions_ruby_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007185 upb_StringView default_val = upb_StringView_FromString("");
7186 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007187 const upb_MiniTableField field = {45, UPB_SIZE(100, 168), 20, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007188 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007189 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007190}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007191UPB_INLINE bool google_protobuf_FileOptions_has_ruby_package(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007192 const upb_MiniTableField field = {45, UPB_SIZE(100, 168), 20, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
7193 return _upb_Message_HasNonExtensionField(msg, &field);
7194}
7195UPB_INLINE void google_protobuf_FileOptions_clear_features(google_protobuf_FileOptions* msg) {
7196 const upb_MiniTableField field = {50, UPB_SIZE(20, 184), 21, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7197 _upb_Message_ClearNonExtensionField(msg, &field);
7198}
7199UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FileOptions_features(const google_protobuf_FileOptions* msg) {
7200 const google_protobuf_FeatureSet* default_val = NULL;
7201 const google_protobuf_FeatureSet* ret;
7202 const upb_MiniTableField field = {50, UPB_SIZE(20, 184), 21, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7203 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
7204 return ret;
7205}
7206UPB_INLINE bool google_protobuf_FileOptions_has_features(const google_protobuf_FileOptions* msg) {
7207 const upb_MiniTableField field = {50, UPB_SIZE(20, 184), 21, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007208 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007209}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007210UPB_INLINE void google_protobuf_FileOptions_clear_uninterpreted_option(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007211 const upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007212 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007213}
Eric Salob7d54ac2022-12-29 11:59:42 -08007214UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007215 const upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08007216 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7217 if (arr) {
7218 if (size) *size = arr->size;
7219 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
7220 } else {
7221 if (size) *size = 0;
7222 return NULL;
7223 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007224}
Deanna Garciab26afb52023-04-25 13:37:18 -07007225UPB_INLINE const upb_Array* _google_protobuf_FileOptions_uninterpreted_option_upb_array(const google_protobuf_FileOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007226 const upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07007227 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7228 if (size) {
7229 *size = arr ? arr->size : 0;
7230 }
7231 return arr;
7232}
7233UPB_INLINE upb_Array* _google_protobuf_FileOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_FileOptions* msg, size_t* size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007234 const upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07007235 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7236 (upb_Message*)msg, &field, arena);
7237 if (size) {
7238 *size = arr ? arr->size : 0;
7239 }
7240 return arr;
7241}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007242UPB_INLINE bool google_protobuf_FileOptions_has_uninterpreted_option(const google_protobuf_FileOptions* msg) {
7243 size_t size;
7244 google_protobuf_FileOptions_uninterpreted_option(msg, &size);
7245 return size != 0;
7246}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007247
Joshua Habermanf41049a2022-01-21 14:41:25 -08007248UPB_INLINE void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007249 const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007250 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007251}
7252UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007253 const upb_MiniTableField field = {8, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007254 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007255}
7256UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007257 const upb_MiniTableField field = {9, 4, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007258 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007259}
7260UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007261 const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007262 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007263}
7264UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007265 const upb_MiniTableField field = {11, UPB_SIZE(44, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007266 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007267}
7268UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007269 const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007270 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007271}
7272UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007273 const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007274 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007275}
7276UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007277 const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007278 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007279}
7280UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007281 const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007282 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007283}
7284UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007285 const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007286 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007287}
7288UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007289 const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007290 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007291}
7292UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007293 const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007294 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007295}
7296UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007297 const upb_MiniTableField field = {36, UPB_SIZE(52, 72), 13, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007298 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007299}
7300UPB_INLINE void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007301 const upb_MiniTableField field = {37, UPB_SIZE(60, 88), 14, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007302 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007303}
7304UPB_INLINE void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007305 const upb_MiniTableField field = {39, UPB_SIZE(68, 104), 15, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007306 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007307}
7308UPB_INLINE void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007309 const upb_MiniTableField field = {40, UPB_SIZE(76, 120), 16, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007310 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007311}
7312UPB_INLINE void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007313 const upb_MiniTableField field = {41, UPB_SIZE(84, 136), 17, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007314 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007315}
7316UPB_INLINE void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007317 const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007318 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007319}
7320UPB_INLINE void google_protobuf_FileOptions_set_php_metadata_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007321 const upb_MiniTableField field = {44, UPB_SIZE(92, 152), 19, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007322 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007323}
7324UPB_INLINE void google_protobuf_FileOptions_set_ruby_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007325 const upb_MiniTableField field = {45, UPB_SIZE(100, 168), 20, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007326 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007327}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007328UPB_INLINE void google_protobuf_FileOptions_set_features(google_protobuf_FileOptions *msg, google_protobuf_FeatureSet* value) {
7329 const upb_MiniTableField field = {50, UPB_SIZE(20, 184), 21, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7330 _upb_Message_SetNonExtensionField(msg, &field, &value);
7331}
7332UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FileOptions_mutable_features(google_protobuf_FileOptions* msg, upb_Arena* arena) {
7333 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FileOptions_features(msg);
7334 if (sub == NULL) {
7335 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
7336 if (sub) google_protobuf_FileOptions_set_features(msg, sub);
7337 }
7338 return sub;
7339}
Mike Kruskal232ecf42023-01-14 00:09:40 -08007340UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_mutable_uninterpreted_option(google_protobuf_FileOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007341 upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08007342 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
7343 if (arr) {
7344 if (size) *size = arr->size;
7345 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
7346 } else {
7347 if (size) *size = 0;
7348 return NULL;
7349 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007350}
Eric Salob7d54ac2022-12-29 11:59:42 -08007351UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_resize_uninterpreted_option(google_protobuf_FileOptions* msg, size_t size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007352 upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07007353 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007354}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007355UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FileOptions_add_uninterpreted_option(google_protobuf_FileOptions* msg, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007356 upb_MiniTableField field = {999, UPB_SIZE(24, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08007357 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
7358 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
7359 return NULL;
7360 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07007361 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08007362 if (!arr || !sub) return NULL;
7363 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007364 return sub;
7365}
7366
7367/* google.protobuf.MessageOptions */
7368
Joshua Habermanf41049a2022-01-21 14:41:25 -08007369UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007370 return (google_protobuf_MessageOptions*)_upb_Message_New(&google_protobuf_MessageOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007371}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007372UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
7373 google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007374 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07007375 if (upb_Decode(buf, size, ret, &google_protobuf_MessageOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007376 return NULL;
7377 }
7378 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007379}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007380UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse_ex(const char* buf, size_t size,
7381 const upb_ExtensionRegistry* extreg,
7382 int options, upb_Arena* arena) {
7383 google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena);
7384 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07007385 if (upb_Decode(buf, size, ret, &google_protobuf_MessageOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08007386 kUpb_DecodeStatus_Ok) {
7387 return NULL;
7388 }
7389 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007390}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007391UPB_INLINE char* google_protobuf_MessageOptions_serialize(const google_protobuf_MessageOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007392 char* ptr;
7393 (void)upb_Encode(msg, &google_protobuf_MessageOptions_msg_init, 0, arena, &ptr, len);
7394 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007395}
7396UPB_INLINE char* google_protobuf_MessageOptions_serialize_ex(const google_protobuf_MessageOptions* msg, int options,
7397 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007398 char* ptr;
7399 (void)upb_Encode(msg, &google_protobuf_MessageOptions_msg_init, options, arena, &ptr, len);
7400 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007401}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007402UPB_INLINE void google_protobuf_MessageOptions_clear_message_set_wire_format(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007403 const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007404 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007405}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007406UPB_INLINE bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007407 bool default_val = false;
7408 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007409 const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007410 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007411 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007412}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007413UPB_INLINE bool google_protobuf_MessageOptions_has_message_set_wire_format(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007414 const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007415 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007416}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007417UPB_INLINE void google_protobuf_MessageOptions_clear_no_standard_descriptor_accessor(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007418 const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007419 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007420}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007421UPB_INLINE bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007422 bool default_val = false;
7423 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007424 const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007425 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007426 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007427}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007428UPB_INLINE bool google_protobuf_MessageOptions_has_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007429 const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007430 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007431}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007432UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007433 const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007434 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007435}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007436UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007437 bool default_val = false;
7438 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007439 const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007440 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007441 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007442}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007443UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007444 const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007445 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007446}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007447UPB_INLINE void google_protobuf_MessageOptions_clear_map_entry(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007448 const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007449 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007450}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007451UPB_INLINE bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007452 bool default_val = false;
7453 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007454 const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007455 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007456 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007457}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007458UPB_INLINE bool google_protobuf_MessageOptions_has_map_entry(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007459 const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007460 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007461}
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08007462UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007463 const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08007464 _upb_Message_ClearNonExtensionField(msg, &field);
7465}
7466UPB_INLINE bool google_protobuf_MessageOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) {
7467 bool default_val = false;
7468 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007469 const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08007470 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
7471 return ret;
7472}
7473UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007474 const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08007475 return _upb_Message_HasNonExtensionField(msg, &field);
7476}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007477UPB_INLINE void google_protobuf_MessageOptions_clear_features(google_protobuf_MessageOptions* msg) {
7478 const upb_MiniTableField field = {12, 8, 6, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7479 _upb_Message_ClearNonExtensionField(msg, &field);
7480}
7481UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MessageOptions_features(const google_protobuf_MessageOptions* msg) {
7482 const google_protobuf_FeatureSet* default_val = NULL;
7483 const google_protobuf_FeatureSet* ret;
7484 const upb_MiniTableField field = {12, 8, 6, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7485 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
7486 return ret;
7487}
7488UPB_INLINE bool google_protobuf_MessageOptions_has_features(const google_protobuf_MessageOptions* msg) {
7489 const upb_MiniTableField field = {12, 8, 6, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7490 return _upb_Message_HasNonExtensionField(msg, &field);
7491}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007492UPB_INLINE void google_protobuf_MessageOptions_clear_uninterpreted_option(google_protobuf_MessageOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007493 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007494 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007495}
Eric Salob7d54ac2022-12-29 11:59:42 -08007496UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007497 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08007498 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7499 if (arr) {
7500 if (size) *size = arr->size;
7501 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
7502 } else {
7503 if (size) *size = 0;
7504 return NULL;
7505 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007506}
Deanna Garciab26afb52023-04-25 13:37:18 -07007507UPB_INLINE const upb_Array* _google_protobuf_MessageOptions_uninterpreted_option_upb_array(const google_protobuf_MessageOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007508 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07007509 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7510 if (size) {
7511 *size = arr ? arr->size : 0;
7512 }
7513 return arr;
7514}
7515UPB_INLINE upb_Array* _google_protobuf_MessageOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_MessageOptions* msg, size_t* size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007516 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07007517 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7518 (upb_Message*)msg, &field, arena);
7519 if (size) {
7520 *size = arr ? arr->size : 0;
7521 }
7522 return arr;
7523}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007524UPB_INLINE bool google_protobuf_MessageOptions_has_uninterpreted_option(const google_protobuf_MessageOptions* msg) {
7525 size_t size;
7526 google_protobuf_MessageOptions_uninterpreted_option(msg, &size);
7527 return size != 0;
7528}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007529
7530UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007531 const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007532 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007533}
7534UPB_INLINE void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007535 const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007536 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007537}
7538UPB_INLINE void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007539 const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007540 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007541}
7542UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007543 const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007544 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007545}
7546UPB_INLINE void google_protobuf_MessageOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007547 const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08007548 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007549}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007550UPB_INLINE void google_protobuf_MessageOptions_set_features(google_protobuf_MessageOptions *msg, google_protobuf_FeatureSet* value) {
7551 const upb_MiniTableField field = {12, 8, 6, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
7552 _upb_Message_SetNonExtensionField(msg, &field, &value);
7553}
7554UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MessageOptions_mutable_features(google_protobuf_MessageOptions* msg, upb_Arena* arena) {
7555 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MessageOptions_features(msg);
7556 if (sub == NULL) {
7557 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
7558 if (sub) google_protobuf_MessageOptions_set_features(msg, sub);
7559 }
7560 return sub;
7561}
Mike Kruskal232ecf42023-01-14 00:09:40 -08007562UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_mutable_uninterpreted_option(google_protobuf_MessageOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007563 upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08007564 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
7565 if (arr) {
7566 if (size) *size = arr->size;
7567 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
7568 } else {
7569 if (size) *size = 0;
7570 return NULL;
7571 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007572}
Eric Salob7d54ac2022-12-29 11:59:42 -08007573UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_resize_uninterpreted_option(google_protobuf_MessageOptions* msg, size_t size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007574 upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07007575 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007576}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007577UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MessageOptions_add_uninterpreted_option(google_protobuf_MessageOptions* msg, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007578 upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08007579 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
7580 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
7581 return NULL;
7582 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07007583 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08007584 if (!arr || !sub) return NULL;
7585 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007586 return sub;
7587}
7588
7589/* google.protobuf.FieldOptions */
7590
Joshua Habermanf41049a2022-01-21 14:41:25 -08007591UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007592 return (google_protobuf_FieldOptions*)_upb_Message_New(&google_protobuf_FieldOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007593}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007594UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
7595 google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007596 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07007597 if (upb_Decode(buf, size, ret, &google_protobuf_FieldOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007598 return NULL;
7599 }
7600 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007601}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007602UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse_ex(const char* buf, size_t size,
7603 const upb_ExtensionRegistry* extreg,
7604 int options, upb_Arena* arena) {
7605 google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena);
7606 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07007607 if (upb_Decode(buf, size, ret, &google_protobuf_FieldOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08007608 kUpb_DecodeStatus_Ok) {
7609 return NULL;
7610 }
7611 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007612}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007613UPB_INLINE char* google_protobuf_FieldOptions_serialize(const google_protobuf_FieldOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007614 char* ptr;
7615 (void)upb_Encode(msg, &google_protobuf_FieldOptions_msg_init, 0, arena, &ptr, len);
7616 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007617}
7618UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf_FieldOptions* msg, int options,
7619 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007620 char* ptr;
7621 (void)upb_Encode(msg, &google_protobuf_FieldOptions_msg_init, options, arena, &ptr, len);
7622 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007623}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007624UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007625 const upb_MiniTableField field = {1, 4, 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007626 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007627}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007628UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007629 int32_t default_val = 0;
7630 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007631 const upb_MiniTableField field = {1, 4, 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007632 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007633 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007634}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007635UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007636 const upb_MiniTableField field = {1, 4, 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007637 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007638}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007639UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007640 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007641 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007642}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007643UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007644 bool default_val = false;
7645 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007646 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007647 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007648 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007649}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007650UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007651 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007652 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007653}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007654UPB_INLINE void google_protobuf_FieldOptions_clear_deprecated(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007655 const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007656 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007657}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007658UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007659 bool default_val = false;
7660 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007661 const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007662 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007663 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007664}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007665UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007666 const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007667 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007668}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007669UPB_INLINE void google_protobuf_FieldOptions_clear_lazy(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007670 const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007671 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007672}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007673UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007674 bool default_val = false;
7675 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007676 const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007677 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007678 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007679}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007680UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007681 const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007682 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007683}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007684UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007685 const upb_MiniTableField field = {6, 12, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007686 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007687}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007688UPB_INLINE int32_t google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007689 int32_t default_val = 0;
7690 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007691 const upb_MiniTableField field = {6, 12, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007692 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007693 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007694}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007695UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007696 const upb_MiniTableField field = {6, 12, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007697 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007698}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007699UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007700 const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007701 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007702}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007703UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007704 bool default_val = false;
7705 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007706 const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007707 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007708 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007709}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007710UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007711 const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007712 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007713}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007714UPB_INLINE void google_protobuf_FieldOptions_clear_unverified_lazy(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007715 const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007716 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007717}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007718UPB_INLINE bool google_protobuf_FieldOptions_unverified_lazy(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007719 bool default_val = false;
7720 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007721 const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007722 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007723 return ret;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007724}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007725UPB_INLINE bool google_protobuf_FieldOptions_has_unverified_lazy(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007726 const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007727 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007728}
Protobuf Team Bot9238c482022-12-16 20:01:55 -08007729UPB_INLINE void google_protobuf_FieldOptions_clear_debug_redact(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007730 const upb_MiniTableField field = {16, 18, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot9238c482022-12-16 20:01:55 -08007731 _upb_Message_ClearNonExtensionField(msg, &field);
7732}
7733UPB_INLINE bool google_protobuf_FieldOptions_debug_redact(const google_protobuf_FieldOptions* msg) {
7734 bool default_val = false;
7735 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007736 const upb_MiniTableField field = {16, 18, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot9238c482022-12-16 20:01:55 -08007737 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
7738 return ret;
7739}
7740UPB_INLINE bool google_protobuf_FieldOptions_has_debug_redact(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007741 const upb_MiniTableField field = {16, 18, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot9238c482022-12-16 20:01:55 -08007742 return _upb_Message_HasNonExtensionField(msg, &field);
7743}
Adam Cozzette5a568372023-01-24 20:35:59 -08007744UPB_INLINE void google_protobuf_FieldOptions_clear_retention(google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007745 const upb_MiniTableField field = {17, 20, 9, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Adam Cozzette5a568372023-01-24 20:35:59 -08007746 _upb_Message_ClearNonExtensionField(msg, &field);
7747}
7748UPB_INLINE int32_t google_protobuf_FieldOptions_retention(const google_protobuf_FieldOptions* msg) {
7749 int32_t default_val = 0;
7750 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007751 const upb_MiniTableField field = {17, 20, 9, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Adam Cozzette5a568372023-01-24 20:35:59 -08007752 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
7753 return ret;
7754}
7755UPB_INLINE bool google_protobuf_FieldOptions_has_retention(const google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007756 const upb_MiniTableField field = {17, 20, 9, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Adam Cozzette5a568372023-01-24 20:35:59 -08007757 return _upb_Message_HasNonExtensionField(msg, &field);
7758}
Mike Kruskal0c121392023-03-18 00:05:41 -07007759UPB_INLINE void google_protobuf_FieldOptions_clear_targets(google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007760 const upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Adam Cozzette5a568372023-01-24 20:35:59 -08007761 _upb_Message_ClearNonExtensionField(msg, &field);
7762}
Mike Kruskal0c121392023-03-18 00:05:41 -07007763UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007764 const upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal0c121392023-03-18 00:05:41 -07007765 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7766 if (arr) {
7767 if (size) *size = arr->size;
7768 return (int32_t const*)_upb_array_constptr(arr);
7769 } else {
7770 if (size) *size = 0;
7771 return NULL;
7772 }
Adam Cozzette5a568372023-01-24 20:35:59 -08007773}
Deanna Garciab26afb52023-04-25 13:37:18 -07007774UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_targets_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007775 const upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07007776 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7777 if (size) {
7778 *size = arr ? arr->size : 0;
7779 }
7780 return arr;
7781}
7782UPB_INLINE upb_Array* _google_protobuf_FieldOptions_targets_mutable_upb_array(const google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007783 const upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07007784 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7785 (upb_Message*)msg, &field, arena);
7786 if (size) {
7787 *size = arr ? arr->size : 0;
7788 }
7789 return arr;
7790}
Mike Kruskal0c121392023-03-18 00:05:41 -07007791UPB_INLINE bool google_protobuf_FieldOptions_has_targets(const google_protobuf_FieldOptions* msg) {
7792 size_t size;
7793 google_protobuf_FieldOptions_targets(msg, &size);
7794 return size != 0;
Adam Cozzette5a568372023-01-24 20:35:59 -08007795}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007796UPB_INLINE void google_protobuf_FieldOptions_clear_edition_defaults(google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007797 const upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007798 _upb_Message_ClearNonExtensionField(msg, &field);
7799}
7800UPB_INLINE const google_protobuf_FieldOptions_EditionDefault* const* google_protobuf_FieldOptions_edition_defaults(const google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007801 const upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007802 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7803 if (arr) {
7804 if (size) *size = arr->size;
7805 return (const google_protobuf_FieldOptions_EditionDefault* const*)_upb_array_constptr(arr);
7806 } else {
7807 if (size) *size = 0;
7808 return NULL;
7809 }
7810}
7811UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_edition_defaults_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007812 const upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007813 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7814 if (size) {
7815 *size = arr ? arr->size : 0;
7816 }
7817 return arr;
7818}
7819UPB_INLINE upb_Array* _google_protobuf_FieldOptions_edition_defaults_mutable_upb_array(const google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007820 const upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007821 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7822 (upb_Message*)msg, &field, arena);
7823 if (size) {
7824 *size = arr ? arr->size : 0;
7825 }
7826 return arr;
7827}
7828UPB_INLINE bool google_protobuf_FieldOptions_has_edition_defaults(const google_protobuf_FieldOptions* msg) {
7829 size_t size;
7830 google_protobuf_FieldOptions_edition_defaults(msg, &size);
7831 return size != 0;
7832}
7833UPB_INLINE void google_protobuf_FieldOptions_clear_features(google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007834 const upb_MiniTableField field = {21, UPB_SIZE(32, 40), 10, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007835 _upb_Message_ClearNonExtensionField(msg, &field);
7836}
7837UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FieldOptions_features(const google_protobuf_FieldOptions* msg) {
7838 const google_protobuf_FeatureSet* default_val = NULL;
7839 const google_protobuf_FeatureSet* ret;
Sandy Zhang96c601d2023-07-05 12:39:20 -07007840 const upb_MiniTableField field = {21, UPB_SIZE(32, 40), 10, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007841 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
7842 return ret;
7843}
7844UPB_INLINE bool google_protobuf_FieldOptions_has_features(const google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007845 const upb_MiniTableField field = {21, UPB_SIZE(32, 40), 10, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007846 return _upb_Message_HasNonExtensionField(msg, &field);
7847}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007848UPB_INLINE void google_protobuf_FieldOptions_clear_uninterpreted_option(google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007849 const upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007850 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007851}
Eric Salob7d54ac2022-12-29 11:59:42 -08007852UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007853 const upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08007854 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7855 if (arr) {
7856 if (size) *size = arr->size;
7857 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
7858 } else {
7859 if (size) *size = 0;
7860 return NULL;
7861 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007862}
Deanna Garciab26afb52023-04-25 13:37:18 -07007863UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007864 const upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07007865 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7866 if (size) {
7867 *size = arr ? arr->size : 0;
7868 }
7869 return arr;
7870}
7871UPB_INLINE upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007872 const upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07007873 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7874 (upb_Message*)msg, &field, arena);
7875 if (size) {
7876 *size = arr ? arr->size : 0;
7877 }
7878 return arr;
7879}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007880UPB_INLINE bool google_protobuf_FieldOptions_has_uninterpreted_option(const google_protobuf_FieldOptions* msg) {
7881 size_t size;
7882 google_protobuf_FieldOptions_uninterpreted_option(msg, &size);
7883 return size != 0;
7884}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007885
7886UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007887 const upb_MiniTableField field = {1, 4, 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007888 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007889}
7890UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007891 const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007892 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007893}
7894UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007895 const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007896 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007897}
7898UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007899 const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007900 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007901}
7902UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007903 const upb_MiniTableField field = {6, 12, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007904 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007905}
7906UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007907 const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007908 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007909}
7910UPB_INLINE void google_protobuf_FieldOptions_set_unverified_lazy(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007911 const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08007912 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007913}
7914UPB_INLINE void google_protobuf_FieldOptions_set_debug_redact(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007915 const upb_MiniTableField field = {16, 18, 8, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot9238c482022-12-16 20:01:55 -08007916 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007917}
Adam Cozzette5a568372023-01-24 20:35:59 -08007918UPB_INLINE void google_protobuf_FieldOptions_set_retention(google_protobuf_FieldOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007919 const upb_MiniTableField field = {17, 20, 9, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Adam Cozzette5a568372023-01-24 20:35:59 -08007920 _upb_Message_SetNonExtensionField(msg, &field, &value);
7921}
Mike Kruskal0c121392023-03-18 00:05:41 -07007922UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007923 upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal0c121392023-03-18 00:05:41 -07007924 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
7925 if (arr) {
7926 if (size) *size = arr->size;
7927 return (int32_t*)_upb_array_ptr(arr);
7928 } else {
7929 if (size) *size = 0;
7930 return NULL;
7931 }
7932}
7933UPB_INLINE int32_t* google_protobuf_FieldOptions_resize_targets(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007934 upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07007935 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Mike Kruskal0c121392023-03-18 00:05:41 -07007936}
7937UPB_INLINE bool google_protobuf_FieldOptions_add_targets(google_protobuf_FieldOptions* msg, int32_t val, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007938 upb_MiniTableField field = {19, 24, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal0c121392023-03-18 00:05:41 -07007939 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
7940 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
7941 return false;
7942 }
7943 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
7944 return true;
Adam Cozzette5a568372023-01-24 20:35:59 -08007945}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007946UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_mutable_edition_defaults(google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007947 upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007948 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
7949 if (arr) {
7950 if (size) *size = arr->size;
7951 return (google_protobuf_FieldOptions_EditionDefault**)_upb_array_ptr(arr);
7952 } else {
7953 if (size) *size = 0;
7954 return NULL;
7955 }
7956}
7957UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_resize_edition_defaults(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007958 upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007959 return (google_protobuf_FieldOptions_EditionDefault**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
7960}
7961UPB_INLINE struct google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_add_edition_defaults(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007962 upb_MiniTableField field = {20, UPB_SIZE(28, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007963 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
7964 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
7965 return NULL;
7966 }
7967 struct google_protobuf_FieldOptions_EditionDefault* sub = (struct google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google_protobuf_FieldOptions_EditionDefault_msg_init, arena);
7968 if (!arr || !sub) return NULL;
7969 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
7970 return sub;
7971}
7972UPB_INLINE void google_protobuf_FieldOptions_set_features(google_protobuf_FieldOptions *msg, google_protobuf_FeatureSet* value) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007973 const upb_MiniTableField field = {21, UPB_SIZE(32, 40), 10, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007974 _upb_Message_SetNonExtensionField(msg, &field, &value);
7975}
7976UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FieldOptions_mutable_features(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
7977 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FieldOptions_features(msg);
7978 if (sub == NULL) {
7979 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
7980 if (sub) google_protobuf_FieldOptions_set_features(msg, sub);
7981 }
7982 return sub;
7983}
Mike Kruskal232ecf42023-01-14 00:09:40 -08007984UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007985 upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08007986 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
7987 if (arr) {
7988 if (size) *size = arr->size;
7989 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
7990 } else {
7991 if (size) *size = 0;
7992 return NULL;
7993 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007994}
Eric Salob7d54ac2022-12-29 11:59:42 -08007995UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07007996 upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07007997 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007998}
7999UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008000 upb_MiniTableField field = {999, UPB_SIZE(36, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008001 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8002 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8003 return NULL;
8004 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07008005 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08008006 if (!arr || !sub) return NULL;
8007 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008008 return sub;
8009}
8010
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008011/* google.protobuf.FieldOptions.EditionDefault */
8012
8013UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_new(upb_Arena* arena) {
8014 return (google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google_protobuf_FieldOptions_EditionDefault_msg_init, arena);
8015}
8016UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) {
8017 google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena);
8018 if (!ret) return NULL;
8019 if (upb_Decode(buf, size, ret, &google_protobuf_FieldOptions_EditionDefault_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
8020 return NULL;
8021 }
8022 return ret;
8023}
8024UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse_ex(const char* buf, size_t size,
8025 const upb_ExtensionRegistry* extreg,
8026 int options, upb_Arena* arena) {
8027 google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena);
8028 if (!ret) return NULL;
8029 if (upb_Decode(buf, size, ret, &google_protobuf_FieldOptions_EditionDefault_msg_init, extreg, options, arena) !=
8030 kUpb_DecodeStatus_Ok) {
8031 return NULL;
8032 }
8033 return ret;
8034}
8035UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize(const google_protobuf_FieldOptions_EditionDefault* msg, upb_Arena* arena, size_t* len) {
8036 char* ptr;
8037 (void)upb_Encode(msg, &google_protobuf_FieldOptions_EditionDefault_msg_init, 0, arena, &ptr, len);
8038 return ptr;
8039}
8040UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize_ex(const google_protobuf_FieldOptions_EditionDefault* msg, int options,
8041 upb_Arena* arena, size_t* len) {
8042 char* ptr;
8043 (void)upb_Encode(msg, &google_protobuf_FieldOptions_EditionDefault_msg_init, options, arena, &ptr, len);
8044 return ptr;
8045}
8046UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_edition(google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008047 const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008048 _upb_Message_ClearNonExtensionField(msg, &field);
8049}
8050UPB_INLINE upb_StringView google_protobuf_FieldOptions_EditionDefault_edition(const google_protobuf_FieldOptions_EditionDefault* msg) {
8051 upb_StringView default_val = upb_StringView_FromString("");
8052 upb_StringView ret;
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008053 const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008054 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8055 return ret;
8056}
8057UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_edition(const google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008058 const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008059 return _upb_Message_HasNonExtensionField(msg, &field);
8060}
8061UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_value(google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008062 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008063 _upb_Message_ClearNonExtensionField(msg, &field);
8064}
8065UPB_INLINE upb_StringView google_protobuf_FieldOptions_EditionDefault_value(const google_protobuf_FieldOptions_EditionDefault* msg) {
8066 upb_StringView default_val = upb_StringView_FromString("");
8067 upb_StringView ret;
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008068 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008069 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8070 return ret;
8071}
8072UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_value(const google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008073 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
8074 return _upb_Message_HasNonExtensionField(msg, &field);
8075}
8076UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_edition_enum(google_protobuf_FieldOptions_EditionDefault* msg) {
8077 const upb_MiniTableField field = {3, 4, 3, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8078 _upb_Message_ClearNonExtensionField(msg, &field);
8079}
8080UPB_INLINE int32_t google_protobuf_FieldOptions_EditionDefault_edition_enum(const google_protobuf_FieldOptions_EditionDefault* msg) {
8081 int32_t default_val = 0;
8082 int32_t ret;
8083 const upb_MiniTableField field = {3, 4, 3, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8084 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8085 return ret;
8086}
8087UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_edition_enum(const google_protobuf_FieldOptions_EditionDefault* msg) {
8088 const upb_MiniTableField field = {3, 4, 3, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008089 return _upb_Message_HasNonExtensionField(msg, &field);
8090}
8091
8092UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_edition(google_protobuf_FieldOptions_EditionDefault *msg, upb_StringView value) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008093 const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008094 _upb_Message_SetNonExtensionField(msg, &field, &value);
8095}
8096UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_value(google_protobuf_FieldOptions_EditionDefault *msg, upb_StringView value) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008097 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
8098 _upb_Message_SetNonExtensionField(msg, &field, &value);
8099}
8100UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_edition_enum(google_protobuf_FieldOptions_EditionDefault *msg, int32_t value) {
8101 const upb_MiniTableField field = {3, 4, 3, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008102 _upb_Message_SetNonExtensionField(msg, &field, &value);
8103}
8104
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008105/* google.protobuf.OneofOptions */
8106
Joshua Habermanf41049a2022-01-21 14:41:25 -08008107UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008108 return (google_protobuf_OneofOptions*)_upb_Message_New(&google_protobuf_OneofOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008109}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008110UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8111 google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008112 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008113 if (upb_Decode(buf, size, ret, &google_protobuf_OneofOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008114 return NULL;
8115 }
8116 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008117}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008118UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse_ex(const char* buf, size_t size,
8119 const upb_ExtensionRegistry* extreg,
8120 int options, upb_Arena* arena) {
8121 google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena);
8122 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008123 if (upb_Decode(buf, size, ret, &google_protobuf_OneofOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008124 kUpb_DecodeStatus_Ok) {
8125 return NULL;
8126 }
8127 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008128}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008129UPB_INLINE char* google_protobuf_OneofOptions_serialize(const google_protobuf_OneofOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008130 char* ptr;
8131 (void)upb_Encode(msg, &google_protobuf_OneofOptions_msg_init, 0, arena, &ptr, len);
8132 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008133}
8134UPB_INLINE char* google_protobuf_OneofOptions_serialize_ex(const google_protobuf_OneofOptions* msg, int options,
8135 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008136 char* ptr;
8137 (void)upb_Encode(msg, &google_protobuf_OneofOptions_msg_init, options, arena, &ptr, len);
8138 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008139}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008140UPB_INLINE void google_protobuf_OneofOptions_clear_features(google_protobuf_OneofOptions* msg) {
8141 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8142 _upb_Message_ClearNonExtensionField(msg, &field);
8143}
8144UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_OneofOptions_features(const google_protobuf_OneofOptions* msg) {
8145 const google_protobuf_FeatureSet* default_val = NULL;
8146 const google_protobuf_FeatureSet* ret;
8147 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8148 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8149 return ret;
8150}
8151UPB_INLINE bool google_protobuf_OneofOptions_has_features(const google_protobuf_OneofOptions* msg) {
8152 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8153 return _upb_Message_HasNonExtensionField(msg, &field);
8154}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008155UPB_INLINE void google_protobuf_OneofOptions_clear_uninterpreted_option(google_protobuf_OneofOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008156 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008157 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008158}
Eric Salob7d54ac2022-12-29 11:59:42 -08008159UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008160 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008161 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8162 if (arr) {
8163 if (size) *size = arr->size;
8164 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
8165 } else {
8166 if (size) *size = 0;
8167 return NULL;
8168 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008169}
Deanna Garciab26afb52023-04-25 13:37:18 -07008170UPB_INLINE const upb_Array* _google_protobuf_OneofOptions_uninterpreted_option_upb_array(const google_protobuf_OneofOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008171 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008172 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8173 if (size) {
8174 *size = arr ? arr->size : 0;
8175 }
8176 return arr;
8177}
8178UPB_INLINE upb_Array* _google_protobuf_OneofOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_OneofOptions* msg, size_t* size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008179 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008180 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8181 (upb_Message*)msg, &field, arena);
8182 if (size) {
8183 *size = arr ? arr->size : 0;
8184 }
8185 return arr;
8186}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008187UPB_INLINE bool google_protobuf_OneofOptions_has_uninterpreted_option(const google_protobuf_OneofOptions* msg) {
8188 size_t size;
8189 google_protobuf_OneofOptions_uninterpreted_option(msg, &size);
8190 return size != 0;
8191}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008192
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008193UPB_INLINE void google_protobuf_OneofOptions_set_features(google_protobuf_OneofOptions *msg, google_protobuf_FeatureSet* value) {
8194 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8195 _upb_Message_SetNonExtensionField(msg, &field, &value);
8196}
8197UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_OneofOptions_mutable_features(google_protobuf_OneofOptions* msg, upb_Arena* arena) {
8198 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_OneofOptions_features(msg);
8199 if (sub == NULL) {
8200 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
8201 if (sub) google_protobuf_OneofOptions_set_features(msg, sub);
8202 }
8203 return sub;
8204}
Eric Salob7d54ac2022-12-29 11:59:42 -08008205UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_mutable_uninterpreted_option(google_protobuf_OneofOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008206 upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008207 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8208 if (arr) {
8209 if (size) *size = arr->size;
8210 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
8211 } else {
8212 if (size) *size = 0;
8213 return NULL;
8214 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008215}
Eric Salob7d54ac2022-12-29 11:59:42 -08008216UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_resize_uninterpreted_option(google_protobuf_OneofOptions* msg, size_t size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008217 upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07008218 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008219}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008220UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_OneofOptions_add_uninterpreted_option(google_protobuf_OneofOptions* msg, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008221 upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008222 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8223 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8224 return NULL;
8225 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07008226 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08008227 if (!arr || !sub) return NULL;
8228 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008229 return sub;
8230}
8231
8232/* google.protobuf.EnumOptions */
8233
Joshua Habermanf41049a2022-01-21 14:41:25 -08008234UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008235 return (google_protobuf_EnumOptions*)_upb_Message_New(&google_protobuf_EnumOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008236}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008237UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8238 google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008239 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008240 if (upb_Decode(buf, size, ret, &google_protobuf_EnumOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008241 return NULL;
8242 }
8243 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008244}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008245UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse_ex(const char* buf, size_t size,
8246 const upb_ExtensionRegistry* extreg,
8247 int options, upb_Arena* arena) {
8248 google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena);
8249 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008250 if (upb_Decode(buf, size, ret, &google_protobuf_EnumOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008251 kUpb_DecodeStatus_Ok) {
8252 return NULL;
8253 }
8254 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008255}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008256UPB_INLINE char* google_protobuf_EnumOptions_serialize(const google_protobuf_EnumOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008257 char* ptr;
8258 (void)upb_Encode(msg, &google_protobuf_EnumOptions_msg_init, 0, arena, &ptr, len);
8259 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008260}
8261UPB_INLINE char* google_protobuf_EnumOptions_serialize_ex(const google_protobuf_EnumOptions* msg, int options,
8262 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008263 char* ptr;
8264 (void)upb_Encode(msg, &google_protobuf_EnumOptions_msg_init, options, arena, &ptr, len);
8265 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008266}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008267UPB_INLINE void google_protobuf_EnumOptions_clear_allow_alias(google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008268 const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008269 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008270}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008271UPB_INLINE bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008272 bool default_val = false;
8273 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008274 const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008275 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008276 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008277}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008278UPB_INLINE bool google_protobuf_EnumOptions_has_allow_alias(const google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008279 const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008280 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008281}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008282UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated(google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008283 const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008284 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008285}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008286UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008287 bool default_val = false;
8288 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008289 const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008290 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008291 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008292}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008293UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated(const google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008294 const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008295 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008296}
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008297UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008298 const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008299 _upb_Message_ClearNonExtensionField(msg, &field);
8300}
8301UPB_INLINE bool google_protobuf_EnumOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) {
8302 bool default_val = false;
8303 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008304 const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008305 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8306 return ret;
8307}
8308UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008309 const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008310 return _upb_Message_HasNonExtensionField(msg, &field);
8311}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008312UPB_INLINE void google_protobuf_EnumOptions_clear_features(google_protobuf_EnumOptions* msg) {
8313 const upb_MiniTableField field = {7, UPB_SIZE(4, 8), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8314 _upb_Message_ClearNonExtensionField(msg, &field);
8315}
8316UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumOptions_features(const google_protobuf_EnumOptions* msg) {
8317 const google_protobuf_FeatureSet* default_val = NULL;
8318 const google_protobuf_FeatureSet* ret;
8319 const upb_MiniTableField field = {7, UPB_SIZE(4, 8), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8320 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8321 return ret;
8322}
8323UPB_INLINE bool google_protobuf_EnumOptions_has_features(const google_protobuf_EnumOptions* msg) {
8324 const upb_MiniTableField field = {7, UPB_SIZE(4, 8), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8325 return _upb_Message_HasNonExtensionField(msg, &field);
8326}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008327UPB_INLINE void google_protobuf_EnumOptions_clear_uninterpreted_option(google_protobuf_EnumOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008328 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008329 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008330}
Eric Salob7d54ac2022-12-29 11:59:42 -08008331UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008332 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008333 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8334 if (arr) {
8335 if (size) *size = arr->size;
8336 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
8337 } else {
8338 if (size) *size = 0;
8339 return NULL;
8340 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008341}
Deanna Garciab26afb52023-04-25 13:37:18 -07008342UPB_INLINE const upb_Array* _google_protobuf_EnumOptions_uninterpreted_option_upb_array(const google_protobuf_EnumOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008343 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008344 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8345 if (size) {
8346 *size = arr ? arr->size : 0;
8347 }
8348 return arr;
8349}
8350UPB_INLINE upb_Array* _google_protobuf_EnumOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_EnumOptions* msg, size_t* size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008351 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008352 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8353 (upb_Message*)msg, &field, arena);
8354 if (size) {
8355 *size = arr ? arr->size : 0;
8356 }
8357 return arr;
8358}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008359UPB_INLINE bool google_protobuf_EnumOptions_has_uninterpreted_option(const google_protobuf_EnumOptions* msg) {
8360 size_t size;
8361 google_protobuf_EnumOptions_uninterpreted_option(msg, &size);
8362 return size != 0;
8363}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008364
8365UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008366 const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008367 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008368}
8369UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008370 const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008371 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008372}
8373UPB_INLINE void google_protobuf_EnumOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008374 const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008375 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008376}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008377UPB_INLINE void google_protobuf_EnumOptions_set_features(google_protobuf_EnumOptions *msg, google_protobuf_FeatureSet* value) {
8378 const upb_MiniTableField field = {7, UPB_SIZE(4, 8), 4, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8379 _upb_Message_SetNonExtensionField(msg, &field, &value);
8380}
8381UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumOptions_mutable_features(google_protobuf_EnumOptions* msg, upb_Arena* arena) {
8382 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumOptions_features(msg);
8383 if (sub == NULL) {
8384 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
8385 if (sub) google_protobuf_EnumOptions_set_features(msg, sub);
8386 }
8387 return sub;
8388}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008389UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_mutable_uninterpreted_option(google_protobuf_EnumOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008390 upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008391 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8392 if (arr) {
8393 if (size) *size = arr->size;
8394 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
8395 } else {
8396 if (size) *size = 0;
8397 return NULL;
8398 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008399}
Eric Salob7d54ac2022-12-29 11:59:42 -08008400UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_resize_uninterpreted_option(google_protobuf_EnumOptions* msg, size_t size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008401 upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07008402 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008403}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008404UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumOptions_add_uninterpreted_option(google_protobuf_EnumOptions* msg, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008405 upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008406 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8407 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8408 return NULL;
8409 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07008410 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08008411 if (!arr || !sub) return NULL;
8412 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008413 return sub;
8414}
8415
8416/* google.protobuf.EnumValueOptions */
8417
Joshua Habermanf41049a2022-01-21 14:41:25 -08008418UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008419 return (google_protobuf_EnumValueOptions*)_upb_Message_New(&google_protobuf_EnumValueOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008420}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008421UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8422 google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008423 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008424 if (upb_Decode(buf, size, ret, &google_protobuf_EnumValueOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008425 return NULL;
8426 }
8427 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008428}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008429UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse_ex(const char* buf, size_t size,
8430 const upb_ExtensionRegistry* extreg,
8431 int options, upb_Arena* arena) {
8432 google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena);
8433 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008434 if (upb_Decode(buf, size, ret, &google_protobuf_EnumValueOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008435 kUpb_DecodeStatus_Ok) {
8436 return NULL;
8437 }
8438 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008439}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008440UPB_INLINE char* google_protobuf_EnumValueOptions_serialize(const google_protobuf_EnumValueOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008441 char* ptr;
8442 (void)upb_Encode(msg, &google_protobuf_EnumValueOptions_msg_init, 0, arena, &ptr, len);
8443 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008444}
8445UPB_INLINE char* google_protobuf_EnumValueOptions_serialize_ex(const google_protobuf_EnumValueOptions* msg, int options,
8446 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008447 char* ptr;
8448 (void)upb_Encode(msg, &google_protobuf_EnumValueOptions_msg_init, options, arena, &ptr, len);
8449 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008450}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008451UPB_INLINE void google_protobuf_EnumValueOptions_clear_deprecated(google_protobuf_EnumValueOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008452 const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008453 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008454}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008455UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008456 bool default_val = false;
8457 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008458 const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008459 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008460 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008461}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008462UPB_INLINE bool google_protobuf_EnumValueOptions_has_deprecated(const google_protobuf_EnumValueOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008463 const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008464 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008465}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008466UPB_INLINE void google_protobuf_EnumValueOptions_clear_features(google_protobuf_EnumValueOptions* msg) {
8467 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8468 _upb_Message_ClearNonExtensionField(msg, &field);
8469}
8470UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_features(const google_protobuf_EnumValueOptions* msg) {
8471 const google_protobuf_FeatureSet* default_val = NULL;
8472 const google_protobuf_FeatureSet* ret;
8473 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8474 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8475 return ret;
8476}
8477UPB_INLINE bool google_protobuf_EnumValueOptions_has_features(const google_protobuf_EnumValueOptions* msg) {
8478 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8479 return _upb_Message_HasNonExtensionField(msg, &field);
8480}
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07008481UPB_INLINE void google_protobuf_EnumValueOptions_clear_debug_redact(google_protobuf_EnumValueOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008482 const upb_MiniTableField field = {3, UPB_SIZE(8, 2), 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07008483 _upb_Message_ClearNonExtensionField(msg, &field);
8484}
8485UPB_INLINE bool google_protobuf_EnumValueOptions_debug_redact(const google_protobuf_EnumValueOptions* msg) {
8486 bool default_val = false;
8487 bool ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008488 const upb_MiniTableField field = {3, UPB_SIZE(8, 2), 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07008489 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8490 return ret;
8491}
8492UPB_INLINE bool google_protobuf_EnumValueOptions_has_debug_redact(const google_protobuf_EnumValueOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008493 const upb_MiniTableField field = {3, UPB_SIZE(8, 2), 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07008494 return _upb_Message_HasNonExtensionField(msg, &field);
8495}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008496UPB_INLINE void google_protobuf_EnumValueOptions_clear_uninterpreted_option(google_protobuf_EnumValueOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008497 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008498 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008499}
Eric Salob7d54ac2022-12-29 11:59:42 -08008500UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008501 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008502 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8503 if (arr) {
8504 if (size) *size = arr->size;
8505 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
8506 } else {
8507 if (size) *size = 0;
8508 return NULL;
8509 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008510}
Deanna Garciab26afb52023-04-25 13:37:18 -07008511UPB_INLINE const upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_upb_array(const google_protobuf_EnumValueOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008512 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008513 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8514 if (size) {
8515 *size = arr ? arr->size : 0;
8516 }
8517 return arr;
8518}
8519UPB_INLINE upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_EnumValueOptions* msg, size_t* size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008520 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008521 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8522 (upb_Message*)msg, &field, arena);
8523 if (size) {
8524 *size = arr ? arr->size : 0;
8525 }
8526 return arr;
8527}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008528UPB_INLINE bool google_protobuf_EnumValueOptions_has_uninterpreted_option(const google_protobuf_EnumValueOptions* msg) {
8529 size_t size;
8530 google_protobuf_EnumValueOptions_uninterpreted_option(msg, &size);
8531 return size != 0;
8532}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008533
8534UPB_INLINE void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008535 const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008536 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008537}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008538UPB_INLINE void google_protobuf_EnumValueOptions_set_features(google_protobuf_EnumValueOptions *msg, google_protobuf_FeatureSet* value) {
8539 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8540 _upb_Message_SetNonExtensionField(msg, &field, &value);
8541}
8542UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_mutable_features(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) {
8543 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumValueOptions_features(msg);
8544 if (sub == NULL) {
8545 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
8546 if (sub) google_protobuf_EnumValueOptions_set_features(msg, sub);
8547 }
8548 return sub;
8549}
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07008550UPB_INLINE void google_protobuf_EnumValueOptions_set_debug_redact(google_protobuf_EnumValueOptions *msg, bool value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008551 const upb_MiniTableField field = {3, UPB_SIZE(8, 2), 3, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07008552 _upb_Message_SetNonExtensionField(msg, &field, &value);
8553}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008554UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008555 upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008556 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8557 if (arr) {
8558 if (size) *size = arr->size;
8559 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
8560 } else {
8561 if (size) *size = 0;
8562 return NULL;
8563 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008564}
Eric Salob7d54ac2022-12-29 11:59:42 -08008565UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_resize_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008566 upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07008567 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008568}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008569UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValueOptions_add_uninterpreted_option(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008570 upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008571 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8572 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8573 return NULL;
8574 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07008575 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08008576 if (!arr || !sub) return NULL;
8577 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008578 return sub;
8579}
8580
8581/* google.protobuf.ServiceOptions */
8582
Joshua Habermanf41049a2022-01-21 14:41:25 -08008583UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008584 return (google_protobuf_ServiceOptions*)_upb_Message_New(&google_protobuf_ServiceOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008585}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008586UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8587 google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008588 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008589 if (upb_Decode(buf, size, ret, &google_protobuf_ServiceOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008590 return NULL;
8591 }
8592 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008593}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008594UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse_ex(const char* buf, size_t size,
8595 const upb_ExtensionRegistry* extreg,
8596 int options, upb_Arena* arena) {
8597 google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena);
8598 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008599 if (upb_Decode(buf, size, ret, &google_protobuf_ServiceOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008600 kUpb_DecodeStatus_Ok) {
8601 return NULL;
8602 }
8603 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008604}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008605UPB_INLINE char* google_protobuf_ServiceOptions_serialize(const google_protobuf_ServiceOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008606 char* ptr;
8607 (void)upb_Encode(msg, &google_protobuf_ServiceOptions_msg_init, 0, arena, &ptr, len);
8608 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008609}
8610UPB_INLINE char* google_protobuf_ServiceOptions_serialize_ex(const google_protobuf_ServiceOptions* msg, int options,
8611 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008612 char* ptr;
8613 (void)upb_Encode(msg, &google_protobuf_ServiceOptions_msg_init, options, arena, &ptr, len);
8614 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008615}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008616UPB_INLINE void google_protobuf_ServiceOptions_clear_deprecated(google_protobuf_ServiceOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008617 const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008618 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008619}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008620UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008621 bool default_val = false;
8622 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008623 const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008624 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008625 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008626}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008627UPB_INLINE bool google_protobuf_ServiceOptions_has_deprecated(const google_protobuf_ServiceOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008628 const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008629 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008630}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008631UPB_INLINE void google_protobuf_ServiceOptions_clear_features(google_protobuf_ServiceOptions* msg) {
8632 const upb_MiniTableField field = {34, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8633 _upb_Message_ClearNonExtensionField(msg, &field);
8634}
8635UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ServiceOptions_features(const google_protobuf_ServiceOptions* msg) {
8636 const google_protobuf_FeatureSet* default_val = NULL;
8637 const google_protobuf_FeatureSet* ret;
8638 const upb_MiniTableField field = {34, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8639 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8640 return ret;
8641}
8642UPB_INLINE bool google_protobuf_ServiceOptions_has_features(const google_protobuf_ServiceOptions* msg) {
8643 const upb_MiniTableField field = {34, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8644 return _upb_Message_HasNonExtensionField(msg, &field);
8645}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008646UPB_INLINE void google_protobuf_ServiceOptions_clear_uninterpreted_option(google_protobuf_ServiceOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008647 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008648 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008649}
Eric Salob7d54ac2022-12-29 11:59:42 -08008650UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008651 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008652 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8653 if (arr) {
8654 if (size) *size = arr->size;
8655 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
8656 } else {
8657 if (size) *size = 0;
8658 return NULL;
8659 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008660}
Deanna Garciab26afb52023-04-25 13:37:18 -07008661UPB_INLINE const upb_Array* _google_protobuf_ServiceOptions_uninterpreted_option_upb_array(const google_protobuf_ServiceOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008662 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008663 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8664 if (size) {
8665 *size = arr ? arr->size : 0;
8666 }
8667 return arr;
8668}
8669UPB_INLINE upb_Array* _google_protobuf_ServiceOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_ServiceOptions* msg, size_t* size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008670 const upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008671 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8672 (upb_Message*)msg, &field, arena);
8673 if (size) {
8674 *size = arr ? arr->size : 0;
8675 }
8676 return arr;
8677}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008678UPB_INLINE bool google_protobuf_ServiceOptions_has_uninterpreted_option(const google_protobuf_ServiceOptions* msg) {
8679 size_t size;
8680 google_protobuf_ServiceOptions_uninterpreted_option(msg, &size);
8681 return size != 0;
8682}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008683
8684UPB_INLINE void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008685 const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008686 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008687}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008688UPB_INLINE void google_protobuf_ServiceOptions_set_features(google_protobuf_ServiceOptions *msg, google_protobuf_FeatureSet* value) {
8689 const upb_MiniTableField field = {34, UPB_SIZE(4, 8), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8690 _upb_Message_SetNonExtensionField(msg, &field, &value);
8691}
8692UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ServiceOptions_mutable_features(google_protobuf_ServiceOptions* msg, upb_Arena* arena) {
8693 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ServiceOptions_features(msg);
8694 if (sub == NULL) {
8695 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
8696 if (sub) google_protobuf_ServiceOptions_set_features(msg, sub);
8697 }
8698 return sub;
8699}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008700UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_mutable_uninterpreted_option(google_protobuf_ServiceOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008701 upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008702 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8703 if (arr) {
8704 if (size) *size = arr->size;
8705 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
8706 } else {
8707 if (size) *size = 0;
8708 return NULL;
8709 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008710}
Eric Salob7d54ac2022-12-29 11:59:42 -08008711UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_resize_uninterpreted_option(google_protobuf_ServiceOptions* msg, size_t size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008712 upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07008713 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008714}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008715UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ServiceOptions_add_uninterpreted_option(google_protobuf_ServiceOptions* msg, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008716 upb_MiniTableField field = {999, UPB_SIZE(8, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008717 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8718 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8719 return NULL;
8720 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07008721 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08008722 if (!arr || !sub) return NULL;
8723 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008724 return sub;
8725}
8726
8727/* google.protobuf.MethodOptions */
8728
Joshua Habermanf41049a2022-01-21 14:41:25 -08008729UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008730 return (google_protobuf_MethodOptions*)_upb_Message_New(&google_protobuf_MethodOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008731}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008732UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8733 google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008734 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008735 if (upb_Decode(buf, size, ret, &google_protobuf_MethodOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008736 return NULL;
8737 }
8738 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008739}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008740UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse_ex(const char* buf, size_t size,
8741 const upb_ExtensionRegistry* extreg,
8742 int options, upb_Arena* arena) {
8743 google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena);
8744 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008745 if (upb_Decode(buf, size, ret, &google_protobuf_MethodOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008746 kUpb_DecodeStatus_Ok) {
8747 return NULL;
8748 }
8749 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008750}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008751UPB_INLINE char* google_protobuf_MethodOptions_serialize(const google_protobuf_MethodOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008752 char* ptr;
8753 (void)upb_Encode(msg, &google_protobuf_MethodOptions_msg_init, 0, arena, &ptr, len);
8754 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008755}
8756UPB_INLINE char* google_protobuf_MethodOptions_serialize_ex(const google_protobuf_MethodOptions* msg, int options,
8757 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008758 char* ptr;
8759 (void)upb_Encode(msg, &google_protobuf_MethodOptions_msg_init, options, arena, &ptr, len);
8760 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008761}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008762UPB_INLINE void google_protobuf_MethodOptions_clear_deprecated(google_protobuf_MethodOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008763 const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008764 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008765}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008766UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008767 bool default_val = false;
8768 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008769 const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008770 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008771 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008772}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008773UPB_INLINE bool google_protobuf_MethodOptions_has_deprecated(const google_protobuf_MethodOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008774 const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008775 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008776}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008777UPB_INLINE void google_protobuf_MethodOptions_clear_idempotency_level(google_protobuf_MethodOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008778 const upb_MiniTableField field = {34, 4, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008779 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008780}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008781UPB_INLINE int32_t google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008782 int32_t default_val = 0;
8783 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008784 const upb_MiniTableField field = {34, 4, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008785 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008786 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008787}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008788UPB_INLINE bool google_protobuf_MethodOptions_has_idempotency_level(const google_protobuf_MethodOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008789 const upb_MiniTableField field = {34, 4, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
8790 return _upb_Message_HasNonExtensionField(msg, &field);
8791}
8792UPB_INLINE void google_protobuf_MethodOptions_clear_features(google_protobuf_MethodOptions* msg) {
8793 const upb_MiniTableField field = {35, 8, 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8794 _upb_Message_ClearNonExtensionField(msg, &field);
8795}
8796UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MethodOptions_features(const google_protobuf_MethodOptions* msg) {
8797 const google_protobuf_FeatureSet* default_val = NULL;
8798 const google_protobuf_FeatureSet* ret;
8799 const upb_MiniTableField field = {35, 8, 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8800 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8801 return ret;
8802}
8803UPB_INLINE bool google_protobuf_MethodOptions_has_features(const google_protobuf_MethodOptions* msg) {
8804 const upb_MiniTableField field = {35, 8, 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008805 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008806}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008807UPB_INLINE void google_protobuf_MethodOptions_clear_uninterpreted_option(google_protobuf_MethodOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008808 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008809 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008810}
Eric Salob7d54ac2022-12-29 11:59:42 -08008811UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008812 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008813 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8814 if (arr) {
8815 if (size) *size = arr->size;
8816 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
8817 } else {
8818 if (size) *size = 0;
8819 return NULL;
8820 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008821}
Deanna Garciab26afb52023-04-25 13:37:18 -07008822UPB_INLINE const upb_Array* _google_protobuf_MethodOptions_uninterpreted_option_upb_array(const google_protobuf_MethodOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008823 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008824 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8825 if (size) {
8826 *size = arr ? arr->size : 0;
8827 }
8828 return arr;
8829}
8830UPB_INLINE upb_Array* _google_protobuf_MethodOptions_uninterpreted_option_mutable_upb_array(const google_protobuf_MethodOptions* msg, size_t* size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008831 const upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008832 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8833 (upb_Message*)msg, &field, arena);
8834 if (size) {
8835 *size = arr ? arr->size : 0;
8836 }
8837 return arr;
8838}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008839UPB_INLINE bool google_protobuf_MethodOptions_has_uninterpreted_option(const google_protobuf_MethodOptions* msg) {
8840 size_t size;
8841 google_protobuf_MethodOptions_uninterpreted_option(msg, &size);
8842 return size != 0;
8843}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008844
8845UPB_INLINE void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008846 const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008847 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008848}
8849UPB_INLINE void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008850 const upb_MiniTableField field = {34, 4, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008851 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008852}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008853UPB_INLINE void google_protobuf_MethodOptions_set_features(google_protobuf_MethodOptions *msg, google_protobuf_FeatureSet* value) {
8854 const upb_MiniTableField field = {35, 8, 3, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
8855 _upb_Message_SetNonExtensionField(msg, &field, &value);
8856}
8857UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MethodOptions_mutable_features(google_protobuf_MethodOptions* msg, upb_Arena* arena) {
8858 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MethodOptions_features(msg);
8859 if (sub == NULL) {
8860 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
8861 if (sub) google_protobuf_MethodOptions_set_features(msg, sub);
8862 }
8863 return sub;
8864}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008865UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_mutable_uninterpreted_option(google_protobuf_MethodOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008866 upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008867 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8868 if (arr) {
8869 if (size) *size = arr->size;
8870 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
8871 } else {
8872 if (size) *size = 0;
8873 return NULL;
8874 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008875}
Eric Salob7d54ac2022-12-29 11:59:42 -08008876UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_resize_uninterpreted_option(google_protobuf_MethodOptions* msg, size_t size, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008877 upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07008878 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008879}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008880UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MethodOptions_add_uninterpreted_option(google_protobuf_MethodOptions* msg, upb_Arena* arena) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008881 upb_MiniTableField field = {999, UPB_SIZE(12, 16), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008882 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8883 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8884 return NULL;
8885 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07008886 struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08008887 if (!arr || !sub) return NULL;
8888 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008889 return sub;
8890}
8891
8892/* google.protobuf.UninterpretedOption */
8893
Joshua Habermanf41049a2022-01-21 14:41:25 -08008894UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008895 return (google_protobuf_UninterpretedOption*)_upb_Message_New(&google_protobuf_UninterpretedOption_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008896}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008897UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse(const char* buf, size_t size, upb_Arena* arena) {
8898 google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008899 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008900 if (upb_Decode(buf, size, ret, &google_protobuf_UninterpretedOption_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008901 return NULL;
8902 }
8903 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008904}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008905UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse_ex(const char* buf, size_t size,
8906 const upb_ExtensionRegistry* extreg,
8907 int options, upb_Arena* arena) {
8908 google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena);
8909 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07008910 if (upb_Decode(buf, size, ret, &google_protobuf_UninterpretedOption_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008911 kUpb_DecodeStatus_Ok) {
8912 return NULL;
8913 }
8914 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008915}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008916UPB_INLINE char* google_protobuf_UninterpretedOption_serialize(const google_protobuf_UninterpretedOption* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008917 char* ptr;
8918 (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_msg_init, 0, arena, &ptr, len);
8919 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008920}
8921UPB_INLINE char* google_protobuf_UninterpretedOption_serialize_ex(const google_protobuf_UninterpretedOption* msg, int options,
8922 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008923 char* ptr;
8924 (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_msg_init, options, arena, &ptr, len);
8925 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008926}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008927UPB_INLINE void google_protobuf_UninterpretedOption_clear_name(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008928 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008929 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008930}
Eric Salob7d54ac2022-12-29 11:59:42 -08008931UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07008932 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08008933 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8934 if (arr) {
8935 if (size) *size = arr->size;
8936 return (const google_protobuf_UninterpretedOption_NamePart* const*)_upb_array_constptr(arr);
8937 } else {
8938 if (size) *size = 0;
8939 return NULL;
8940 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008941}
Deanna Garciab26afb52023-04-25 13:37:18 -07008942UPB_INLINE const upb_Array* _google_protobuf_UninterpretedOption_name_upb_array(const google_protobuf_UninterpretedOption* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07008943 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008944 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8945 if (size) {
8946 *size = arr ? arr->size : 0;
8947 }
8948 return arr;
8949}
8950UPB_INLINE upb_Array* _google_protobuf_UninterpretedOption_name_mutable_upb_array(const google_protobuf_UninterpretedOption* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07008951 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07008952 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8953 (upb_Message*)msg, &field, arena);
8954 if (size) {
8955 *size = arr ? arr->size : 0;
8956 }
8957 return arr;
8958}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008959UPB_INLINE bool google_protobuf_UninterpretedOption_has_name(const google_protobuf_UninterpretedOption* msg) {
8960 size_t size;
8961 google_protobuf_UninterpretedOption_name(msg, &size);
8962 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008963}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008964UPB_INLINE void google_protobuf_UninterpretedOption_clear_identifier_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008965 const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008966 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008967}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008968UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008969 upb_StringView default_val = upb_StringView_FromString("");
8970 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07008971 const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008972 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008973 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008974}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008975UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008976 const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008977 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008978}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008979UPB_INLINE void google_protobuf_UninterpretedOption_clear_positive_int_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008980 const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008981 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008982}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008983UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008984 uint64_t default_val = (uint64_t)0ull;
8985 uint64_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07008986 const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008987 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008988 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008989}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008990UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008991 const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008992 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008993}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008994UPB_INLINE void google_protobuf_UninterpretedOption_clear_negative_int_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008995 const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08008996 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008997}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008998UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008999 int64_t default_val = (int64_t)0ll;
9000 int64_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07009001 const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009002 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009003 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009004}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009005UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009006 const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009007 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009008}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009009UPB_INLINE void google_protobuf_UninterpretedOption_clear_double_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009010 const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009011 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009012}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009013UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009014 double default_val = 0;
9015 double ret;
Jie Luo3560e232023-06-12 00:33:50 -07009016 const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009017 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009018 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009019}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009020UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009021 const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009022 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009023}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009024UPB_INLINE void google_protobuf_UninterpretedOption_clear_string_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009025 const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009026 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009027}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009028UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009029 upb_StringView default_val = upb_StringView_FromString("");
9030 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07009031 const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009032 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009033 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009034}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009035UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009036 const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009037 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009038}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009039UPB_INLINE void google_protobuf_UninterpretedOption_clear_aggregate_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009040 const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009041 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009042}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009043UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009044 upb_StringView default_val = upb_StringView_FromString("");
9045 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07009046 const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009047 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009048 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009049}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009050UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009051 const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009052 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08009053}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009054
Eric Salob7d54ac2022-12-29 11:59:42 -08009055UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009056 upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009057 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9058 if (arr) {
9059 if (size) *size = arr->size;
9060 return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_ptr(arr);
9061 } else {
9062 if (size) *size = 0;
9063 return NULL;
9064 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009065}
Eric Salob7d54ac2022-12-29 11:59:42 -08009066UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_resize_name(google_protobuf_UninterpretedOption* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07009067 upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07009068 return (google_protobuf_UninterpretedOption_NamePart**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009069}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009070UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_add_name(google_protobuf_UninterpretedOption* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07009071 upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009072 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9073 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9074 return NULL;
9075 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07009076 struct google_protobuf_UninterpretedOption_NamePart* sub = (struct google_protobuf_UninterpretedOption_NamePart*)_upb_Message_New(&google_protobuf_UninterpretedOption_NamePart_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08009077 if (!arr || !sub) return NULL;
9078 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009079 return sub;
9080}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009081UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07009082 const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009083 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009084}
9085UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07009086 const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009087 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009088}
9089UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07009090 const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009091 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009092}
9093UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) {
Jie Luo3560e232023-06-12 00:33:50 -07009094 const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009095 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009096}
9097UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07009098 const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009099 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009100}
9101UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07009102 const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009103 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009104}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009105
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009106/* google.protobuf.UninterpretedOption.NamePart */
9107
Joshua Habermanf41049a2022-01-21 14:41:25 -08009108UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009109 return (google_protobuf_UninterpretedOption_NamePart*)_upb_Message_New(&google_protobuf_UninterpretedOption_NamePart_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009110}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009111UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse(const char* buf, size_t size, upb_Arena* arena) {
9112 google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009113 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07009114 if (upb_Decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009115 return NULL;
9116 }
9117 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009118}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009119UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse_ex(const char* buf, size_t size,
9120 const upb_ExtensionRegistry* extreg,
9121 int options, upb_Arena* arena) {
9122 google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
9123 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07009124 if (upb_Decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08009125 kUpb_DecodeStatus_Ok) {
9126 return NULL;
9127 }
9128 return ret;
9129}
9130UPB_INLINE char* google_protobuf_UninterpretedOption_NamePart_serialize(const google_protobuf_UninterpretedOption_NamePart* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009131 char* ptr;
9132 (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_NamePart_msg_init, 0, arena, &ptr, len);
9133 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009134}
9135UPB_INLINE char* google_protobuf_UninterpretedOption_NamePart_serialize_ex(const google_protobuf_UninterpretedOption_NamePart* msg, int options,
9136 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009137 char* ptr;
9138 (void)upb_Encode(msg, &google_protobuf_UninterpretedOption_NamePart_msg_init, options, arena, &ptr, len);
9139 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009140}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009141UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_name_part(google_protobuf_UninterpretedOption_NamePart* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009142 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009143 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009144}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009145UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009146 upb_StringView default_val = upb_StringView_FromString("");
9147 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07009148 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009149 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009150 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009151}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009152UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009153 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009154 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009155}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009156UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_is_extension(google_protobuf_UninterpretedOption_NamePart* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009157 const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009158 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009159}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009160UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009161 bool default_val = false;
9162 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07009163 const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009164 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009165 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009166}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009167UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009168 const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009169 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08009170}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009171
Joshua Habermanf41049a2022-01-21 14:41:25 -08009172UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07009173 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009174 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009175}
9176UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07009177 const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009178 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009179}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009180
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009181/* google.protobuf.FeatureSet */
9182
9183UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_new(upb_Arena* arena) {
9184 return (google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
9185}
9186UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse(const char* buf, size_t size, upb_Arena* arena) {
9187 google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena);
9188 if (!ret) return NULL;
9189 if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSet_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
9190 return NULL;
9191 }
9192 return ret;
9193}
9194UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse_ex(const char* buf, size_t size,
9195 const upb_ExtensionRegistry* extreg,
9196 int options, upb_Arena* arena) {
9197 google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena);
9198 if (!ret) return NULL;
9199 if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSet_msg_init, extreg, options, arena) !=
9200 kUpb_DecodeStatus_Ok) {
9201 return NULL;
9202 }
9203 return ret;
9204}
9205UPB_INLINE char* google_protobuf_FeatureSet_serialize(const google_protobuf_FeatureSet* msg, upb_Arena* arena, size_t* len) {
9206 char* ptr;
9207 (void)upb_Encode(msg, &google_protobuf_FeatureSet_msg_init, 0, arena, &ptr, len);
9208 return ptr;
9209}
9210UPB_INLINE char* google_protobuf_FeatureSet_serialize_ex(const google_protobuf_FeatureSet* msg, int options,
9211 upb_Arena* arena, size_t* len) {
9212 char* ptr;
9213 (void)upb_Encode(msg, &google_protobuf_FeatureSet_msg_init, options, arena, &ptr, len);
9214 return ptr;
9215}
9216UPB_INLINE void google_protobuf_FeatureSet_clear_field_presence(google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009217 const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009218 _upb_Message_ClearNonExtensionField(msg, &field);
9219}
9220UPB_INLINE int32_t google_protobuf_FeatureSet_field_presence(const google_protobuf_FeatureSet* msg) {
9221 int32_t default_val = 0;
9222 int32_t ret;
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009223 const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009224 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9225 return ret;
9226}
9227UPB_INLINE bool google_protobuf_FeatureSet_has_field_presence(const google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009228 const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009229 return _upb_Message_HasNonExtensionField(msg, &field);
9230}
9231UPB_INLINE void google_protobuf_FeatureSet_clear_enum_type(google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009232 const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009233 _upb_Message_ClearNonExtensionField(msg, &field);
9234}
9235UPB_INLINE int32_t google_protobuf_FeatureSet_enum_type(const google_protobuf_FeatureSet* msg) {
9236 int32_t default_val = 0;
9237 int32_t ret;
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009238 const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009239 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9240 return ret;
9241}
9242UPB_INLINE bool google_protobuf_FeatureSet_has_enum_type(const google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009243 const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009244 return _upb_Message_HasNonExtensionField(msg, &field);
9245}
9246UPB_INLINE void google_protobuf_FeatureSet_clear_repeated_field_encoding(google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009247 const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009248 _upb_Message_ClearNonExtensionField(msg, &field);
9249}
9250UPB_INLINE int32_t google_protobuf_FeatureSet_repeated_field_encoding(const google_protobuf_FeatureSet* msg) {
9251 int32_t default_val = 0;
9252 int32_t ret;
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009253 const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009254 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9255 return ret;
9256}
9257UPB_INLINE bool google_protobuf_FeatureSet_has_repeated_field_encoding(const google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009258 const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009259 return _upb_Message_HasNonExtensionField(msg, &field);
9260}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009261UPB_INLINE void google_protobuf_FeatureSet_clear_message_encoding(google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009262 const upb_MiniTableField field = {5, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009263 _upb_Message_ClearNonExtensionField(msg, &field);
9264}
9265UPB_INLINE int32_t google_protobuf_FeatureSet_message_encoding(const google_protobuf_FeatureSet* msg) {
9266 int32_t default_val = 0;
9267 int32_t ret;
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009268 const upb_MiniTableField field = {5, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009269 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9270 return ret;
9271}
9272UPB_INLINE bool google_protobuf_FeatureSet_has_message_encoding(const google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009273 const upb_MiniTableField field = {5, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009274 return _upb_Message_HasNonExtensionField(msg, &field);
9275}
9276UPB_INLINE void google_protobuf_FeatureSet_clear_json_format(google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009277 const upb_MiniTableField field = {6, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009278 _upb_Message_ClearNonExtensionField(msg, &field);
9279}
9280UPB_INLINE int32_t google_protobuf_FeatureSet_json_format(const google_protobuf_FeatureSet* msg) {
9281 int32_t default_val = 0;
9282 int32_t ret;
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009283 const upb_MiniTableField field = {6, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009284 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9285 return ret;
9286}
9287UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009288 const upb_MiniTableField field = {6, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009289 return _upb_Message_HasNonExtensionField(msg, &field);
9290}
9291
9292UPB_INLINE void google_protobuf_FeatureSet_set_field_presence(google_protobuf_FeatureSet *msg, int32_t value) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009293 const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009294 _upb_Message_SetNonExtensionField(msg, &field, &value);
9295}
9296UPB_INLINE void google_protobuf_FeatureSet_set_enum_type(google_protobuf_FeatureSet *msg, int32_t value) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009297 const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009298 _upb_Message_SetNonExtensionField(msg, &field, &value);
9299}
9300UPB_INLINE void google_protobuf_FeatureSet_set_repeated_field_encoding(google_protobuf_FeatureSet *msg, int32_t value) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009301 const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009302 _upb_Message_SetNonExtensionField(msg, &field, &value);
9303}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009304UPB_INLINE void google_protobuf_FeatureSet_set_message_encoding(google_protobuf_FeatureSet *msg, int32_t value) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009305 const upb_MiniTableField field = {5, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009306 _upb_Message_SetNonExtensionField(msg, &field, &value);
9307}
9308UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_FeatureSet *msg, int32_t value) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009309 const upb_MiniTableField field = {6, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009310 _upb_Message_SetNonExtensionField(msg, &field, &value);
9311}
9312
Mike Kruskalba964702023-08-22 17:37:48 -07009313/* google.protobuf.FeatureSetDefaults */
9314
9315UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_new(upb_Arena* arena) {
9316 return (google_protobuf_FeatureSetDefaults*)_upb_Message_New(&google_protobuf_FeatureSetDefaults_msg_init, arena);
9317}
9318UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse(const char* buf, size_t size, upb_Arena* arena) {
9319 google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena);
9320 if (!ret) return NULL;
9321 if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSetDefaults_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
9322 return NULL;
9323 }
9324 return ret;
9325}
9326UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse_ex(const char* buf, size_t size,
9327 const upb_ExtensionRegistry* extreg,
9328 int options, upb_Arena* arena) {
9329 google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena);
9330 if (!ret) return NULL;
9331 if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSetDefaults_msg_init, extreg, options, arena) !=
9332 kUpb_DecodeStatus_Ok) {
9333 return NULL;
9334 }
9335 return ret;
9336}
9337UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize(const google_protobuf_FeatureSetDefaults* msg, upb_Arena* arena, size_t* len) {
9338 char* ptr;
9339 (void)upb_Encode(msg, &google_protobuf_FeatureSetDefaults_msg_init, 0, arena, &ptr, len);
9340 return ptr;
9341}
9342UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize_ex(const google_protobuf_FeatureSetDefaults* msg, int options,
9343 upb_Arena* arena, size_t* len) {
9344 char* ptr;
9345 (void)upb_Encode(msg, &google_protobuf_FeatureSetDefaults_msg_init, options, arena, &ptr, len);
9346 return ptr;
9347}
9348UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_defaults(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009349 const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009350 _upb_Message_ClearNonExtensionField(msg, &field);
9351}
9352UPB_INLINE const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* const* google_protobuf_FeatureSetDefaults_defaults(const google_protobuf_FeatureSetDefaults* msg, size_t* size) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009353 const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009354 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9355 if (arr) {
9356 if (size) *size = arr->size;
9357 return (const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* const*)_upb_array_constptr(arr);
9358 } else {
9359 if (size) *size = 0;
9360 return NULL;
9361 }
9362}
9363UPB_INLINE const upb_Array* _google_protobuf_FeatureSetDefaults_defaults_upb_array(const google_protobuf_FeatureSetDefaults* msg, size_t* size) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009364 const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009365 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9366 if (size) {
9367 *size = arr ? arr->size : 0;
9368 }
9369 return arr;
9370}
9371UPB_INLINE upb_Array* _google_protobuf_FeatureSetDefaults_defaults_mutable_upb_array(const google_protobuf_FeatureSetDefaults* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009372 const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009373 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9374 (upb_Message*)msg, &field, arena);
9375 if (size) {
9376 *size = arr ? arr->size : 0;
9377 }
9378 return arr;
9379}
9380UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_defaults(const google_protobuf_FeatureSetDefaults* msg) {
9381 size_t size;
9382 google_protobuf_FeatureSetDefaults_defaults(msg, &size);
9383 return size != 0;
9384}
9385UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_minimum_edition(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009386 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009387 _upb_Message_ClearNonExtensionField(msg, &field);
9388}
9389UPB_INLINE upb_StringView google_protobuf_FeatureSetDefaults_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) {
9390 upb_StringView default_val = upb_StringView_FromString("");
9391 upb_StringView ret;
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009392 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009393 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9394 return ret;
9395}
9396UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009397 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009398 return _upb_Message_HasNonExtensionField(msg, &field);
9399}
9400UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_maximum_edition(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009401 const upb_MiniTableField field = {3, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009402 _upb_Message_ClearNonExtensionField(msg, &field);
9403}
9404UPB_INLINE upb_StringView google_protobuf_FeatureSetDefaults_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) {
9405 upb_StringView default_val = upb_StringView_FromString("");
9406 upb_StringView ret;
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009407 const upb_MiniTableField field = {3, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009408 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9409 return ret;
9410}
9411UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009412 const upb_MiniTableField field = {3, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
9413 return _upb_Message_HasNonExtensionField(msg, &field);
9414}
9415UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_minimum_edition_enum(google_protobuf_FeatureSetDefaults* msg) {
9416 const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9417 _upb_Message_ClearNonExtensionField(msg, &field);
9418}
9419UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_minimum_edition_enum(const google_protobuf_FeatureSetDefaults* msg) {
9420 int32_t default_val = 0;
9421 int32_t ret;
9422 const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9423 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9424 return ret;
9425}
9426UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_minimum_edition_enum(const google_protobuf_FeatureSetDefaults* msg) {
9427 const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9428 return _upb_Message_HasNonExtensionField(msg, &field);
9429}
9430UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_maximum_edition_enum(google_protobuf_FeatureSetDefaults* msg) {
9431 const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 4, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9432 _upb_Message_ClearNonExtensionField(msg, &field);
9433}
9434UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_maximum_edition_enum(const google_protobuf_FeatureSetDefaults* msg) {
9435 int32_t default_val = 0;
9436 int32_t ret;
9437 const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 4, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9438 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9439 return ret;
9440}
9441UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_maximum_edition_enum(const google_protobuf_FeatureSetDefaults* msg) {
9442 const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 4, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009443 return _upb_Message_HasNonExtensionField(msg, &field);
9444}
9445
9446UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault** google_protobuf_FeatureSetDefaults_mutable_defaults(google_protobuf_FeatureSetDefaults* msg, size_t* size) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009447 upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009448 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9449 if (arr) {
9450 if (size) *size = arr->size;
9451 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)_upb_array_ptr(arr);
9452 } else {
9453 if (size) *size = 0;
9454 return NULL;
9455 }
9456}
9457UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault** google_protobuf_FeatureSetDefaults_resize_defaults(google_protobuf_FeatureSetDefaults* msg, size_t size, upb_Arena* arena) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009458 upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009459 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
9460}
9461UPB_INLINE struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_add_defaults(google_protobuf_FeatureSetDefaults* msg, upb_Arena* arena) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009462 upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009463 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9464 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9465 return NULL;
9466 }
9467 struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* sub = (struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, arena);
9468 if (!arr || !sub) return NULL;
9469 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
9470 return sub;
9471}
9472UPB_INLINE void google_protobuf_FeatureSetDefaults_set_minimum_edition(google_protobuf_FeatureSetDefaults *msg, upb_StringView value) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009473 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009474 _upb_Message_SetNonExtensionField(msg, &field, &value);
9475}
9476UPB_INLINE void google_protobuf_FeatureSetDefaults_set_maximum_edition(google_protobuf_FeatureSetDefaults *msg, upb_StringView value) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009477 const upb_MiniTableField field = {3, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
9478 _upb_Message_SetNonExtensionField(msg, &field, &value);
9479}
9480UPB_INLINE void google_protobuf_FeatureSetDefaults_set_minimum_edition_enum(google_protobuf_FeatureSetDefaults *msg, int32_t value) {
9481 const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9482 _upb_Message_SetNonExtensionField(msg, &field, &value);
9483}
9484UPB_INLINE void google_protobuf_FeatureSetDefaults_set_maximum_edition_enum(google_protobuf_FeatureSetDefaults *msg, int32_t value) {
9485 const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 4, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009486 _upb_Message_SetNonExtensionField(msg, &field, &value);
9487}
9488
9489/* google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault */
9490
9491UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(upb_Arena* arena) {
9492 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, arena);
9493}
9494UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) {
9495 google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena);
9496 if (!ret) return NULL;
9497 if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
9498 return NULL;
9499 }
9500 return ret;
9501}
9502UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse_ex(const char* buf, size_t size,
9503 const upb_ExtensionRegistry* extreg,
9504 int options, upb_Arena* arena) {
9505 google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena);
9506 if (!ret) return NULL;
9507 if (upb_Decode(buf, size, ret, &google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, extreg, options, arena) !=
9508 kUpb_DecodeStatus_Ok) {
9509 return NULL;
9510 }
9511 return ret;
9512}
9513UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena, size_t* len) {
9514 char* ptr;
9515 (void)upb_Encode(msg, &google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, 0, arena, &ptr, len);
9516 return ptr;
9517}
9518UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize_ex(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, int options,
9519 upb_Arena* arena, size_t* len) {
9520 char* ptr;
9521 (void)upb_Encode(msg, &google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_msg_init, options, arena, &ptr, len);
9522 return ptr;
9523}
9524UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009525 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009526 _upb_Message_ClearNonExtensionField(msg, &field);
9527}
9528UPB_INLINE upb_StringView google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
9529 upb_StringView default_val = upb_StringView_FromString("");
9530 upb_StringView ret;
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009531 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009532 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9533 return ret;
9534}
9535UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009536 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009537 return _upb_Message_HasNonExtensionField(msg, &field);
9538}
9539UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
9540 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9541 _upb_Message_ClearNonExtensionField(msg, &field);
9542}
9543UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
9544 const google_protobuf_FeatureSet* default_val = NULL;
9545 const google_protobuf_FeatureSet* ret;
9546 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9547 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9548 return ret;
9549}
9550UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
9551 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9552 return _upb_Message_HasNonExtensionField(msg, &field);
9553}
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009554UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_edition_enum(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
9555 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9556 _upb_Message_ClearNonExtensionField(msg, &field);
9557}
9558UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_edition_enum(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
9559 int32_t default_val = 0;
9560 int32_t ret;
9561 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9562 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9563 return ret;
9564}
9565UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_edition_enum(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
9566 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9567 return _upb_Message_HasNonExtensionField(msg, &field);
9568}
Mike Kruskalba964702023-08-22 17:37:48 -07009569
9570UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, upb_StringView value) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009571 const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009572 _upb_Message_SetNonExtensionField(msg, &field, &value);
9573}
9574UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, google_protobuf_FeatureSet* value) {
9575 const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
9576 _upb_Message_SetNonExtensionField(msg, &field, &value);
9577}
9578UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) {
9579 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(msg);
9580 if (sub == NULL) {
9581 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena);
9582 if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(msg, sub);
9583 }
9584 return sub;
9585}
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009586UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_edition_enum(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, int32_t value) {
9587 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 3, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9588 _upb_Message_SetNonExtensionField(msg, &field, &value);
9589}
Mike Kruskalba964702023-08-22 17:37:48 -07009590
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009591/* google.protobuf.SourceCodeInfo */
9592
Joshua Habermanf41049a2022-01-21 14:41:25 -08009593UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009594 return (google_protobuf_SourceCodeInfo*)_upb_Message_New(&google_protobuf_SourceCodeInfo_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009595}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009596UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) {
9597 google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009598 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07009599 if (upb_Decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009600 return NULL;
9601 }
9602 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009603}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009604UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse_ex(const char* buf, size_t size,
9605 const upb_ExtensionRegistry* extreg,
9606 int options, upb_Arena* arena) {
9607 google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena);
9608 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07009609 if (upb_Decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08009610 kUpb_DecodeStatus_Ok) {
9611 return NULL;
9612 }
9613 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009614}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009615UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize(const google_protobuf_SourceCodeInfo* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009616 char* ptr;
9617 (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_msg_init, 0, arena, &ptr, len);
9618 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009619}
9620UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize_ex(const google_protobuf_SourceCodeInfo* msg, int options,
9621 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009622 char* ptr;
9623 (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_msg_init, options, arena, &ptr, len);
9624 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009625}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009626UPB_INLINE void google_protobuf_SourceCodeInfo_clear_location(google_protobuf_SourceCodeInfo* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009627 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009628 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009629}
Eric Salob7d54ac2022-12-29 11:59:42 -08009630UPB_INLINE const google_protobuf_SourceCodeInfo_Location* const* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009631 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009632 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9633 if (arr) {
9634 if (size) *size = arr->size;
9635 return (const google_protobuf_SourceCodeInfo_Location* const*)_upb_array_constptr(arr);
9636 } else {
9637 if (size) *size = 0;
9638 return NULL;
9639 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009640}
Deanna Garciab26afb52023-04-25 13:37:18 -07009641UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_location_upb_array(const google_protobuf_SourceCodeInfo* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009642 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07009643 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9644 if (size) {
9645 *size = arr ? arr->size : 0;
9646 }
9647 return arr;
9648}
9649UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_location_mutable_upb_array(const google_protobuf_SourceCodeInfo* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07009650 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07009651 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9652 (upb_Message*)msg, &field, arena);
9653 if (size) {
9654 *size = arr ? arr->size : 0;
9655 }
9656 return arr;
9657}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009658UPB_INLINE bool google_protobuf_SourceCodeInfo_has_location(const google_protobuf_SourceCodeInfo* msg) {
9659 size_t size;
9660 google_protobuf_SourceCodeInfo_location(msg, &size);
9661 return size != 0;
9662}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009663
Eric Salob7d54ac2022-12-29 11:59:42 -08009664UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_mutable_location(google_protobuf_SourceCodeInfo* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009665 upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009666 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9667 if (arr) {
9668 if (size) *size = arr->size;
9669 return (google_protobuf_SourceCodeInfo_Location**)_upb_array_ptr(arr);
9670 } else {
9671 if (size) *size = 0;
9672 return NULL;
9673 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009674}
Eric Salob7d54ac2022-12-29 11:59:42 -08009675UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_resize_location(google_protobuf_SourceCodeInfo* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07009676 upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07009677 return (google_protobuf_SourceCodeInfo_Location**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009678}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009679UPB_INLINE struct google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_add_location(google_protobuf_SourceCodeInfo* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07009680 upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009681 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9682 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9683 return NULL;
9684 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07009685 struct google_protobuf_SourceCodeInfo_Location* sub = (struct google_protobuf_SourceCodeInfo_Location*)_upb_Message_New(&google_protobuf_SourceCodeInfo_Location_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08009686 if (!arr || !sub) return NULL;
9687 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009688 return sub;
9689}
9690
9691/* google.protobuf.SourceCodeInfo.Location */
9692
Joshua Habermanf41049a2022-01-21 14:41:25 -08009693UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009694 return (google_protobuf_SourceCodeInfo_Location*)_upb_Message_New(&google_protobuf_SourceCodeInfo_Location_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009695}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009696UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse(const char* buf, size_t size, upb_Arena* arena) {
9697 google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009698 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07009699 if (upb_Decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009700 return NULL;
9701 }
9702 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009703}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009704UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse_ex(const char* buf, size_t size,
9705 const upb_ExtensionRegistry* extreg,
9706 int options, upb_Arena* arena) {
9707 google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena);
9708 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07009709 if (upb_Decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08009710 kUpb_DecodeStatus_Ok) {
9711 return NULL;
9712 }
9713 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009714}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009715UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize(const google_protobuf_SourceCodeInfo_Location* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009716 char* ptr;
9717 (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_Location_msg_init, 0, arena, &ptr, len);
9718 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009719}
9720UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize_ex(const google_protobuf_SourceCodeInfo_Location* msg, int options,
9721 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009722 char* ptr;
9723 (void)upb_Encode(msg, &google_protobuf_SourceCodeInfo_Location_msg_init, options, arena, &ptr, len);
9724 return ptr;
9725}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009726UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_path(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009727 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009728 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -08009729}
Eric Salob7d54ac2022-12-29 11:59:42 -08009730UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009731 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009732 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9733 if (arr) {
9734 if (size) *size = arr->size;
9735 return (int32_t const*)_upb_array_constptr(arr);
9736 } else {
9737 if (size) *size = 0;
9738 return NULL;
9739 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07009740}
Deanna Garciab26afb52023-04-25 13:37:18 -07009741UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_path_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009742 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07009743 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9744 if (size) {
9745 *size = arr ? arr->size : 0;
9746 }
9747 return arr;
9748}
9749UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_path_mutable_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07009750 const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07009751 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9752 (upb_Message*)msg, &field, arena);
9753 if (size) {
9754 *size = arr ? arr->size : 0;
9755 }
9756 return arr;
9757}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009758UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_path(const google_protobuf_SourceCodeInfo_Location* msg) {
9759 size_t size;
9760 google_protobuf_SourceCodeInfo_Location_path(msg, &size);
9761 return size != 0;
9762}
9763UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_span(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009764 const upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009765 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009766}
Eric Salob7d54ac2022-12-29 11:59:42 -08009767UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009768 const upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009769 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9770 if (arr) {
9771 if (size) *size = arr->size;
9772 return (int32_t const*)_upb_array_constptr(arr);
9773 } else {
9774 if (size) *size = 0;
9775 return NULL;
9776 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009777}
Deanna Garciab26afb52023-04-25 13:37:18 -07009778UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_span_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009779 const upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07009780 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9781 if (size) {
9782 *size = arr ? arr->size : 0;
9783 }
9784 return arr;
9785}
9786UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_span_mutable_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07009787 const upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07009788 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9789 (upb_Message*)msg, &field, arena);
9790 if (size) {
9791 *size = arr ? arr->size : 0;
9792 }
9793 return arr;
9794}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009795UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_span(const google_protobuf_SourceCodeInfo_Location* msg) {
9796 size_t size;
9797 google_protobuf_SourceCodeInfo_Location_span(msg, &size);
9798 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009799}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009800UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009801 const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009802 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009803}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009804UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009805 upb_StringView default_val = upb_StringView_FromString("");
9806 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07009807 const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009808 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009809 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009810}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009811UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009812 const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009813 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009814}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009815UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_trailing_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009816 const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009817 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009818}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009819UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009820 upb_StringView default_val = upb_StringView_FromString("");
9821 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07009822 const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009823 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009824 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -07009825}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009826UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009827 const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009828 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08009829}
9830UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009831 const upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009832 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -08009833}
Eric Salob7d54ac2022-12-29 11:59:42 -08009834UPB_INLINE upb_StringView const* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009835 const upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009836 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9837 if (arr) {
9838 if (size) *size = arr->size;
9839 return (upb_StringView const*)_upb_array_constptr(arr);
9840 } else {
9841 if (size) *size = 0;
9842 return NULL;
9843 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009844}
Deanna Garciab26afb52023-04-25 13:37:18 -07009845UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_leading_detached_comments_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009846 const upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07009847 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9848 if (size) {
9849 *size = arr ? arr->size : 0;
9850 }
9851 return arr;
9852}
9853UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_leading_detached_comments_mutable_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07009854 const upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -07009855 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9856 (upb_Message*)msg, &field, arena);
9857 if (size) {
9858 *size = arr ? arr->size : 0;
9859 }
9860 return arr;
9861}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009862UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
9863 size_t size;
9864 google_protobuf_SourceCodeInfo_Location_leading_detached_comments(msg, &size);
9865 return size != 0;
9866}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009867
Eric Salob7d54ac2022-12-29 11:59:42 -08009868UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009869 upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009870 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9871 if (arr) {
9872 if (size) *size = arr->size;
9873 return (int32_t*)_upb_array_ptr(arr);
9874 } else {
9875 if (size) *size = 0;
9876 return NULL;
9877 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009878}
Eric Salob7d54ac2022-12-29 11:59:42 -08009879UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_path(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07009880 upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07009881 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009882}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009883UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf_SourceCodeInfo_Location* msg, int32_t val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07009884 upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009885 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9886 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9887 return false;
9888 }
9889 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
9890 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009891}
Eric Salob7d54ac2022-12-29 11:59:42 -08009892UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009893 upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009894 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9895 if (arr) {
9896 if (size) *size = arr->size;
9897 return (int32_t*)_upb_array_ptr(arr);
9898 } else {
9899 if (size) *size = 0;
9900 return NULL;
9901 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009902}
Eric Salob7d54ac2022-12-29 11:59:42 -08009903UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_span(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07009904 upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07009905 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009906}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009907UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf_SourceCodeInfo_Location* msg, int32_t val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07009908 upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009909 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9910 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9911 return false;
9912 }
9913 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
9914 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009915}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009916UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07009917 const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009918 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009919}
9920UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07009921 const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009922 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009923}
9924UPB_INLINE upb_StringView* google_protobuf_SourceCodeInfo_Location_mutable_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009925 upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009926 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9927 if (arr) {
9928 if (size) *size = arr->size;
9929 return (upb_StringView*)_upb_array_ptr(arr);
9930 } else {
9931 if (size) *size = 0;
9932 return NULL;
9933 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009934}
Eric Salob7d54ac2022-12-29 11:59:42 -08009935UPB_INLINE upb_StringView* google_protobuf_SourceCodeInfo_Location_resize_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07009936 upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -07009937 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009938}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009939UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, upb_StringView val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07009940 upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009941 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9942 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9943 return false;
9944 }
9945 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
9946 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009947}
9948
9949/* google.protobuf.GeneratedCodeInfo */
9950
Joshua Habermanf41049a2022-01-21 14:41:25 -08009951UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009952 return (google_protobuf_GeneratedCodeInfo*)_upb_Message_New(&google_protobuf_GeneratedCodeInfo_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009953}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009954UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) {
9955 google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009956 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07009957 if (upb_Decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009958 return NULL;
9959 }
9960 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009961}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009962UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse_ex(const char* buf, size_t size,
9963 const upb_ExtensionRegistry* extreg,
9964 int options, upb_Arena* arena) {
9965 google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena);
9966 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -07009967 if (upb_Decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08009968 kUpb_DecodeStatus_Ok) {
9969 return NULL;
9970 }
9971 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009972}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009973UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize(const google_protobuf_GeneratedCodeInfo* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009974 char* ptr;
9975 (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_msg_init, 0, arena, &ptr, len);
9976 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009977}
9978UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize_ex(const google_protobuf_GeneratedCodeInfo* msg, int options,
9979 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009980 char* ptr;
9981 (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_msg_init, options, arena, &ptr, len);
9982 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009983}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009984UPB_INLINE void google_protobuf_GeneratedCodeInfo_clear_annotation(google_protobuf_GeneratedCodeInfo* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009985 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08009986 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009987}
Eric Salob7d54ac2022-12-29 11:59:42 -08009988UPB_INLINE const google_protobuf_GeneratedCodeInfo_Annotation* const* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009989 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -08009990 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9991 if (arr) {
9992 if (size) *size = arr->size;
9993 return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)_upb_array_constptr(arr);
9994 } else {
9995 if (size) *size = 0;
9996 return NULL;
9997 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009998}
Deanna Garciab26afb52023-04-25 13:37:18 -07009999UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_annotation_upb_array(const google_protobuf_GeneratedCodeInfo* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010000 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -070010001 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10002 if (size) {
10003 *size = arr ? arr->size : 0;
10004 }
10005 return arr;
10006}
10007UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_annotation_mutable_upb_array(const google_protobuf_GeneratedCodeInfo* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010008 const upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -070010009 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10010 (upb_Message*)msg, &field, arena);
10011 if (size) {
10012 *size = arr ? arr->size : 0;
10013 }
10014 return arr;
10015}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010016UPB_INLINE bool google_protobuf_GeneratedCodeInfo_has_annotation(const google_protobuf_GeneratedCodeInfo* msg) {
10017 size_t size;
10018 google_protobuf_GeneratedCodeInfo_annotation(msg, &size);
10019 return size != 0;
10020}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010021
Eric Salob7d54ac2022-12-29 11:59:42 -080010022UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_mutable_annotation(google_protobuf_GeneratedCodeInfo* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010023 upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010024 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10025 if (arr) {
10026 if (size) *size = arr->size;
10027 return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_ptr(arr);
10028 } else {
10029 if (size) *size = 0;
10030 return NULL;
10031 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010032}
Eric Salob7d54ac2022-12-29 11:59:42 -080010033UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_resize_annotation(google_protobuf_GeneratedCodeInfo* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010034 upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -070010035 return (google_protobuf_GeneratedCodeInfo_Annotation**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010036}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010037UPB_INLINE struct google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_add_annotation(google_protobuf_GeneratedCodeInfo* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010038 upb_MiniTableField field = {1, 0, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010039 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10040 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10041 return NULL;
10042 }
Joshua Habermand3995ec2022-09-30 16:54:39 -070010043 struct google_protobuf_GeneratedCodeInfo_Annotation* sub = (struct google_protobuf_GeneratedCodeInfo_Annotation*)_upb_Message_New(&google_protobuf_GeneratedCodeInfo_Annotation_msg_init, arena);
Eric Salob7d54ac2022-12-29 11:59:42 -080010044 if (!arr || !sub) return NULL;
10045 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010046 return sub;
10047}
10048
10049/* google.protobuf.GeneratedCodeInfo.Annotation */
10050
Joshua Habermanf41049a2022-01-21 14:41:25 -080010051UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_new(upb_Arena* arena) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010052 return (google_protobuf_GeneratedCodeInfo_Annotation*)_upb_Message_New(&google_protobuf_GeneratedCodeInfo_Annotation_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010053}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010054UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse(const char* buf, size_t size, upb_Arena* arena) {
10055 google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010056 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -070010057 if (upb_Decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010058 return NULL;
10059 }
10060 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010061}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010062UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse_ex(const char* buf, size_t size,
10063 const upb_ExtensionRegistry* extreg,
10064 int options, upb_Arena* arena) {
10065 google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
10066 if (!ret) return NULL;
Joshua Habermand3995ec2022-09-30 16:54:39 -070010067 if (upb_Decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -080010068 kUpb_DecodeStatus_Ok) {
10069 return NULL;
10070 }
10071 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010072}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010073UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize(const google_protobuf_GeneratedCodeInfo_Annotation* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010074 char* ptr;
10075 (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msg_init, 0, arena, &ptr, len);
10076 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010077}
10078UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize_ex(const google_protobuf_GeneratedCodeInfo_Annotation* msg, int options,
10079 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010080 char* ptr;
10081 (void)upb_Encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msg_init, options, arena, &ptr, len);
10082 return ptr;
10083}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010084UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_path(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010085 const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010086 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080010087}
Eric Salob7d54ac2022-12-29 11:59:42 -080010088UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010089 const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010090 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10091 if (arr) {
10092 if (size) *size = arr->size;
10093 return (int32_t const*)_upb_array_constptr(arr);
10094 } else {
10095 if (size) *size = 0;
10096 return NULL;
10097 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010098}
Deanna Garciab26afb52023-04-25 13:37:18 -070010099UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_upb_array(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010100 const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -070010101 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10102 if (size) {
10103 *size = arr ? arr->size : 0;
10104 }
10105 return arr;
10106}
10107UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_mutable_upb_array(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010108 const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Deanna Garciab26afb52023-04-25 13:37:18 -070010109 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10110 (upb_Message*)msg, &field, arena);
10111 if (size) {
10112 *size = arr ? arr->size : 0;
10113 }
10114 return arr;
10115}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010116UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
10117 size_t size;
10118 google_protobuf_GeneratedCodeInfo_Annotation_path(msg, &size);
10119 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010120}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010121UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_source_file(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010122 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010123 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010124}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010125UPB_INLINE upb_StringView google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010126 upb_StringView default_val = upb_StringView_FromString("");
10127 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -070010128 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010129 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010130 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010131}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010132UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010133 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010134 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010135}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010136UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_begin(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010137 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010138 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010139}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010140UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010141 int32_t default_val = (int32_t)0;
10142 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -070010143 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010144 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010145 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010146}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010147UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010148 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010149 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010150}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010151UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_end(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010152 const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010153 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010154}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010155UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010156 int32_t default_val = (int32_t)0;
10157 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -070010158 const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010159 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010160 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010161}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010162UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010163 const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010164 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010165}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010166UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_semantic(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010167 const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010168 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010169}
10170UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010171 int32_t default_val = 0;
10172 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -070010173 const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010174 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010175 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -070010176}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010177UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010178 const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010179 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080010180}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010181
Eric Salob7d54ac2022-12-29 11:59:42 -080010182UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010183 upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010184 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10185 if (arr) {
10186 if (size) *size = arr->size;
10187 return (int32_t*)_upb_array_ptr(arr);
10188 } else {
10189 if (size) *size = 0;
10190 return NULL;
10191 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010192}
Eric Salob7d54ac2022-12-29 11:59:42 -080010193UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_resize_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t size, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010194 upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Jie Luof36a5c62023-05-23 17:56:18 -070010195 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010196}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010197UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, int32_t val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -070010198 upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Eric Salob7d54ac2022-12-29 11:59:42 -080010199 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10200 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10201 return false;
10202 }
10203 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
10204 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010205}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010206UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -070010207 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010208 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010209}
10210UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -070010211 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010212 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010213}
10214UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -070010215 const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010216 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010217}
10218UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_semantic(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -070010219 const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -080010220 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010221}
Mike Kruskal232ecf42023-01-14 00:09:40 -080010222
Eric Salo8809a112022-11-21 13:01:06 -080010223extern const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010224
10225/* Max size 32 is google.protobuf.FileOptions */
10226/* Max size 64 is google.protobuf.FileOptions */
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010227#define _UPB_MAXOPT_SIZE UPB_SIZE(112, 200)
Joshua Habermanf41049a2022-01-21 14:41:25 -080010228
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010229#ifdef __cplusplus
10230} /* extern "C" */
10231#endif
10232
10233
10234#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */
Joshua Habermandd69a482021-05-17 22:40:33 -070010235
Eric Salob7d54ac2022-12-29 11:59:42 -080010236#ifndef UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
10237#define UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
10238
10239#include <string.h>
10240
10241
10242// Must be last.
10243
10244#ifdef __cplusplus
10245extern "C" {
10246#endif
10247
10248// The maximum number of bytes a single protobuf field can take up in the
10249// wire format. We only want to do one bounds check per field, so the input
10250// stream guarantees that after upb_EpsCopyInputStream_IsDone() is called,
10251// the decoder can read this many bytes without performing another bounds
10252// check. The stream will copy into a patch buffer as necessary to guarantee
10253// this invariant.
10254#define kUpb_EpsCopyInputStream_SlopBytes 16
10255
10256enum {
10257 kUpb_EpsCopyInputStream_NoAliasing = 0,
10258 kUpb_EpsCopyInputStream_OnPatch = 1,
10259 kUpb_EpsCopyInputStream_NoDelta = 2
10260};
10261
10262typedef struct {
10263 const char* end; // Can read up to SlopBytes bytes beyond this.
10264 const char* limit_ptr; // For bounds checks, = end + UPB_MIN(limit, 0)
10265 uintptr_t aliasing;
10266 int limit; // Submessage limit relative to end
10267 bool error; // To distinguish between EOF and error.
10268 char patch[kUpb_EpsCopyInputStream_SlopBytes * 2];
10269} upb_EpsCopyInputStream;
10270
10271// Returns true if the stream is in the error state. A stream enters the error
10272// state when the user reads past a limit (caught in IsDone()) or the
10273// ZeroCopyInputStream returns an error.
10274UPB_INLINE bool upb_EpsCopyInputStream_IsError(upb_EpsCopyInputStream* e) {
10275 return e->error;
10276}
10277
10278typedef const char* upb_EpsCopyInputStream_BufferFlipCallback(
10279 upb_EpsCopyInputStream* e, const char* old_end, const char* new_start);
10280
10281typedef const char* upb_EpsCopyInputStream_IsDoneFallbackFunc(
10282 upb_EpsCopyInputStream* e, const char* ptr, int overrun);
10283
10284// Initializes a upb_EpsCopyInputStream using the contents of the buffer
10285// [*ptr, size]. Updates `*ptr` as necessary to guarantee that at least
10286// kUpb_EpsCopyInputStream_SlopBytes are available to read.
10287UPB_INLINE void upb_EpsCopyInputStream_Init(upb_EpsCopyInputStream* e,
10288 const char** ptr, size_t size,
10289 bool enable_aliasing) {
Eric Salob7d54ac2022-12-29 11:59:42 -080010290 if (size <= kUpb_EpsCopyInputStream_SlopBytes) {
10291 memset(&e->patch, 0, 32);
10292 if (size) memcpy(&e->patch, *ptr, size);
10293 e->aliasing = enable_aliasing ? (uintptr_t)*ptr - (uintptr_t)e->patch
10294 : kUpb_EpsCopyInputStream_NoAliasing;
10295 *ptr = e->patch;
10296 e->end = *ptr + size;
10297 e->limit = 0;
Eric Salob7d54ac2022-12-29 11:59:42 -080010298 } else {
10299 e->end = *ptr + size - kUpb_EpsCopyInputStream_SlopBytes;
10300 e->limit = kUpb_EpsCopyInputStream_SlopBytes;
10301 e->aliasing = enable_aliasing ? kUpb_EpsCopyInputStream_NoDelta
10302 : kUpb_EpsCopyInputStream_NoAliasing;
Eric Salob7d54ac2022-12-29 11:59:42 -080010303 }
10304 e->limit_ptr = e->end;
10305 e->error = false;
10306}
10307
10308typedef enum {
10309 // The current stream position is at a limit.
10310 kUpb_IsDoneStatus_Done,
10311
10312 // The current stream position is not at a limit.
10313 kUpb_IsDoneStatus_NotDone,
10314
10315 // The current stream position is not at a limit, and the stream needs to
10316 // be flipped to a new buffer before more data can be read.
10317 kUpb_IsDoneStatus_NeedFallback,
10318} upb_IsDoneStatus;
10319
10320// Returns the status of the current stream position. This is a low-level
10321// function, it is simpler to call upb_EpsCopyInputStream_IsDone() if possible.
10322UPB_INLINE upb_IsDoneStatus upb_EpsCopyInputStream_IsDoneStatus(
10323 upb_EpsCopyInputStream* e, const char* ptr, int* overrun) {
10324 *overrun = ptr - e->end;
10325 if (UPB_LIKELY(ptr < e->limit_ptr)) {
10326 return kUpb_IsDoneStatus_NotDone;
10327 } else if (UPB_LIKELY(*overrun == e->limit)) {
10328 return kUpb_IsDoneStatus_Done;
10329 } else {
10330 return kUpb_IsDoneStatus_NeedFallback;
10331 }
10332}
10333
10334// Returns true if the stream has hit a limit, either the current delimited
10335// limit or the overall end-of-stream. As a side effect, this function may flip
10336// the pointer to a new buffer if there are less than
10337// kUpb_EpsCopyInputStream_SlopBytes of data to be read in the current buffer.
10338//
10339// Postcondition: if the function returns false, there are at least
10340// kUpb_EpsCopyInputStream_SlopBytes of data available to read at *ptr.
10341UPB_INLINE bool upb_EpsCopyInputStream_IsDoneWithCallback(
10342 upb_EpsCopyInputStream* e, const char** ptr,
10343 upb_EpsCopyInputStream_IsDoneFallbackFunc* func) {
10344 int overrun;
10345 switch (upb_EpsCopyInputStream_IsDoneStatus(e, *ptr, &overrun)) {
10346 case kUpb_IsDoneStatus_Done:
10347 return true;
10348 case kUpb_IsDoneStatus_NotDone:
10349 return false;
10350 case kUpb_IsDoneStatus_NeedFallback:
10351 *ptr = func(e, *ptr, overrun);
10352 return *ptr == NULL;
10353 }
Mike Kruskal232ecf42023-01-14 00:09:40 -080010354 UPB_UNREACHABLE();
Eric Salob7d54ac2022-12-29 11:59:42 -080010355}
10356
10357const char* _upb_EpsCopyInputStream_IsDoneFallbackNoCallback(
10358 upb_EpsCopyInputStream* e, const char* ptr, int overrun);
10359
10360// A simpler version of IsDoneWithCallback() that does not support a buffer flip
10361// callback. Useful in cases where we do not need to insert custom logic at
10362// every buffer flip.
10363//
10364// If this returns true, the user must call upb_EpsCopyInputStream_IsError()
10365// to distinguish between EOF and error.
10366UPB_INLINE bool upb_EpsCopyInputStream_IsDone(upb_EpsCopyInputStream* e,
10367 const char** ptr) {
10368 return upb_EpsCopyInputStream_IsDoneWithCallback(
10369 e, ptr, _upb_EpsCopyInputStream_IsDoneFallbackNoCallback);
10370}
10371
10372// Returns the total number of bytes that are safe to read from the current
10373// buffer without reading uninitialized or unallocated memory.
10374//
10375// Note that this check does not respect any semantic limits on the stream,
10376// either limits from PushLimit() or the overall stream end, so some of these
10377// bytes may have unpredictable, nonsense values in them. The guarantee is only
10378// that the bytes are valid to read from the perspective of the C language
10379// (ie. you can read without triggering UBSAN or ASAN).
10380UPB_INLINE size_t upb_EpsCopyInputStream_BytesAvailable(
10381 upb_EpsCopyInputStream* e, const char* ptr) {
10382 return (e->end - ptr) + kUpb_EpsCopyInputStream_SlopBytes;
10383}
10384
10385// Returns true if the given delimited field size is valid (it does not extend
10386// beyond any previously-pushed limits). `ptr` should point to the beginning
10387// of the field data, after the delimited size.
10388//
10389// Note that this does *not* guarantee that all of the data for this field is in
10390// the current buffer.
10391UPB_INLINE bool upb_EpsCopyInputStream_CheckSize(
10392 const upb_EpsCopyInputStream* e, const char* ptr, int size) {
10393 UPB_ASSERT(size >= 0);
10394 return ptr - e->end + size <= e->limit;
10395}
10396
10397UPB_INLINE bool _upb_EpsCopyInputStream_CheckSizeAvailable(
10398 upb_EpsCopyInputStream* e, const char* ptr, int size, bool submessage) {
10399 // This is one extra branch compared to the more normal:
10400 // return (size_t)(end - ptr) < size;
10401 // However it is one less computation if we are just about to use "ptr + len":
10402 // https://godbolt.org/z/35YGPz
10403 // In microbenchmarks this shows a small improvement.
10404 uintptr_t uptr = (uintptr_t)ptr;
10405 uintptr_t uend = (uintptr_t)e->limit_ptr;
10406 uintptr_t res = uptr + (size_t)size;
10407 if (!submessage) uend += kUpb_EpsCopyInputStream_SlopBytes;
10408 // NOTE: this check depends on having a linear address space. This is not
10409 // technically guaranteed by uintptr_t.
10410 bool ret = res >= uptr && res <= uend;
10411 if (size < 0) UPB_ASSERT(!ret);
10412 return ret;
10413}
10414
10415// Returns true if the given delimited field size is valid (it does not extend
10416// beyond any previously-pushed limited) *and* all of the data for this field is
10417// available to be read in the current buffer.
10418//
10419// If the size is negative, this function will always return false. This
10420// property can be useful in some cases.
10421UPB_INLINE bool upb_EpsCopyInputStream_CheckDataSizeAvailable(
10422 upb_EpsCopyInputStream* e, const char* ptr, int size) {
10423 return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, false);
10424}
10425
10426// Returns true if the given sub-message size is valid (it does not extend
10427// beyond any previously-pushed limited) *and* all of the data for this
10428// sub-message is available to be parsed in the current buffer.
10429//
10430// This implies that all fields from the sub-message can be parsed from the
10431// current buffer while maintaining the invariant that we always have at least
10432// kUpb_EpsCopyInputStream_SlopBytes of data available past the beginning of
10433// any individual field start.
10434//
10435// If the size is negative, this function will always return false. This
10436// property can be useful in some cases.
10437UPB_INLINE bool upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(
10438 upb_EpsCopyInputStream* e, const char* ptr, int size) {
10439 return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, true);
10440}
10441
10442// Returns true if aliasing_enabled=true was passed to
10443// upb_EpsCopyInputStream_Init() when this stream was initialized.
10444UPB_INLINE bool upb_EpsCopyInputStream_AliasingEnabled(
10445 upb_EpsCopyInputStream* e) {
10446 return e->aliasing != kUpb_EpsCopyInputStream_NoAliasing;
10447}
10448
10449// Returns true if aliasing_enabled=true was passed to
10450// upb_EpsCopyInputStream_Init() when this stream was initialized *and* we can
10451// alias into the region [ptr, size] in an input buffer.
10452UPB_INLINE bool upb_EpsCopyInputStream_AliasingAvailable(
10453 upb_EpsCopyInputStream* e, const char* ptr, size_t size) {
10454 // When EpsCopyInputStream supports streaming, this will need to become a
10455 // runtime check.
10456 return upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size) &&
10457 e->aliasing >= kUpb_EpsCopyInputStream_NoDelta;
10458}
10459
10460// Returns a pointer into an input buffer that corresponds to the parsing
10461// pointer `ptr`. The returned pointer may be the same as `ptr`, but also may
10462// be different if we are currently parsing out of the patch buffer.
10463//
10464// REQUIRES: Aliasing must be available for the given pointer. If the input is a
10465// flat buffer and aliasing is enabled, then aliasing will always be available.
10466UPB_INLINE const char* upb_EpsCopyInputStream_GetAliasedPtr(
10467 upb_EpsCopyInputStream* e, const char* ptr) {
10468 UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, ptr, 0));
10469 uintptr_t delta =
10470 e->aliasing == kUpb_EpsCopyInputStream_NoDelta ? 0 : e->aliasing;
10471 return (const char*)((uintptr_t)ptr + delta);
10472}
10473
10474// Reads string data from the input, aliasing into the input buffer instead of
10475// copying. The parsing pointer is passed in `*ptr`, and will be updated if
10476// necessary to point to the actual input buffer. Returns the new parsing
10477// pointer, which will be advanced past the string data.
10478//
10479// REQUIRES: Aliasing must be available for this data region (test with
10480// upb_EpsCopyInputStream_AliasingAvailable().
10481UPB_INLINE const char* upb_EpsCopyInputStream_ReadStringAliased(
10482 upb_EpsCopyInputStream* e, const char** ptr, size_t size) {
10483 UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size));
10484 const char* ret = *ptr + size;
10485 *ptr = upb_EpsCopyInputStream_GetAliasedPtr(e, *ptr);
10486 UPB_ASSUME(ret != NULL);
10487 return ret;
10488}
10489
Mike Kruskal232ecf42023-01-14 00:09:40 -080010490// Skips `size` bytes of data from the input and returns a pointer past the end.
10491// Returns NULL on end of stream or error.
Eric Salob7d54ac2022-12-29 11:59:42 -080010492UPB_INLINE const char* upb_EpsCopyInputStream_Skip(upb_EpsCopyInputStream* e,
10493 const char* ptr, int size) {
10494 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL;
10495 return ptr + size;
10496}
10497
Mike Kruskal232ecf42023-01-14 00:09:40 -080010498// Copies `size` bytes of data from the input `ptr` into the buffer `to`, and
10499// returns a pointer past the end. Returns NULL on end of stream or error.
10500UPB_INLINE const char* upb_EpsCopyInputStream_Copy(upb_EpsCopyInputStream* e,
10501 const char* ptr, void* to,
10502 int size) {
10503 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL;
10504 memcpy(to, ptr, size);
10505 return ptr + size;
10506}
10507
Eric Salob7d54ac2022-12-29 11:59:42 -080010508// Reads string data from the stream and advances the pointer accordingly.
10509// If aliasing was enabled when the stream was initialized, then the returned
10510// pointer will point into the input buffer if possible, otherwise new data
10511// will be allocated from arena and copied into. We may be forced to copy even
10512// if aliasing was enabled if the input data spans input buffers.
10513//
10514// Returns NULL if memory allocation failed, or we reached a premature EOF.
10515UPB_INLINE const char* upb_EpsCopyInputStream_ReadString(
10516 upb_EpsCopyInputStream* e, const char** ptr, size_t size,
10517 upb_Arena* arena) {
10518 if (upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size)) {
10519 return upb_EpsCopyInputStream_ReadStringAliased(e, ptr, size);
10520 } else {
10521 // We need to allocate and copy.
10522 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, *ptr, size)) {
10523 return NULL;
10524 }
10525 UPB_ASSERT(arena);
10526 char* data = (char*)upb_Arena_Malloc(arena, size);
10527 if (!data) return NULL;
Mike Kruskal232ecf42023-01-14 00:09:40 -080010528 const char* ret = upb_EpsCopyInputStream_Copy(e, *ptr, data, size);
Eric Salob7d54ac2022-12-29 11:59:42 -080010529 *ptr = data;
Eric Salob7d54ac2022-12-29 11:59:42 -080010530 return ret;
10531 }
10532}
10533
10534UPB_INLINE void _upb_EpsCopyInputStream_CheckLimit(upb_EpsCopyInputStream* e) {
10535 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
10536}
10537
10538// Pushes a limit onto the stack of limits for the current stream. The limit
10539// will extend for `size` bytes beyond the position in `ptr`. Future calls to
10540// upb_EpsCopyInputStream_IsDone() will return `true` when the stream position
10541// reaches this limit.
10542//
10543// Returns a delta that the caller must store and supply to PopLimit() below.
10544UPB_INLINE int upb_EpsCopyInputStream_PushLimit(upb_EpsCopyInputStream* e,
10545 const char* ptr, int size) {
10546 int limit = size + (int)(ptr - e->end);
10547 int delta = e->limit - limit;
10548 _upb_EpsCopyInputStream_CheckLimit(e);
Deanna Garcia59cfc2f2023-01-31 13:19:28 -080010549 UPB_ASSERT(limit <= e->limit);
Eric Salob7d54ac2022-12-29 11:59:42 -080010550 e->limit = limit;
10551 e->limit_ptr = e->end + UPB_MIN(0, limit);
10552 _upb_EpsCopyInputStream_CheckLimit(e);
10553 return delta;
10554}
10555
10556// Pops the last limit that was pushed on this stream. This may only be called
10557// once IsDone() returns true. The user must pass the delta that was returned
10558// from PushLimit().
10559UPB_INLINE void upb_EpsCopyInputStream_PopLimit(upb_EpsCopyInputStream* e,
10560 const char* ptr,
10561 int saved_delta) {
10562 UPB_ASSERT(ptr - e->end == e->limit);
10563 _upb_EpsCopyInputStream_CheckLimit(e);
10564 e->limit += saved_delta;
10565 e->limit_ptr = e->end + UPB_MIN(0, e->limit);
10566 _upb_EpsCopyInputStream_CheckLimit(e);
10567}
10568
10569UPB_INLINE const char* _upb_EpsCopyInputStream_IsDoneFallbackInline(
10570 upb_EpsCopyInputStream* e, const char* ptr, int overrun,
10571 upb_EpsCopyInputStream_BufferFlipCallback* callback) {
10572 if (overrun < e->limit) {
10573 // Need to copy remaining data into patch buffer.
10574 UPB_ASSERT(overrun < kUpb_EpsCopyInputStream_SlopBytes);
10575 const char* old_end = ptr;
10576 const char* new_start = &e->patch[0] + overrun;
10577 memset(e->patch + kUpb_EpsCopyInputStream_SlopBytes, 0,
10578 kUpb_EpsCopyInputStream_SlopBytes);
10579 memcpy(e->patch, e->end, kUpb_EpsCopyInputStream_SlopBytes);
10580 ptr = new_start;
10581 e->end = &e->patch[kUpb_EpsCopyInputStream_SlopBytes];
10582 e->limit -= kUpb_EpsCopyInputStream_SlopBytes;
10583 e->limit_ptr = e->end + e->limit;
10584 UPB_ASSERT(ptr < e->limit_ptr);
10585 if (e->aliasing != kUpb_EpsCopyInputStream_NoAliasing) {
10586 e->aliasing = (uintptr_t)old_end - (uintptr_t)new_start;
10587 }
10588 return callback(e, old_end, new_start);
10589 } else {
10590 UPB_ASSERT(overrun > e->limit);
10591 e->error = true;
10592 return callback(e, NULL, NULL);
10593 }
10594}
10595
10596typedef const char* upb_EpsCopyInputStream_ParseDelimitedFunc(
10597 upb_EpsCopyInputStream* e, const char* ptr, void* ctx);
10598
10599// Tries to perform a fast-path handling of the given delimited message data.
10600// If the sub-message beginning at `*ptr` and extending for `len` is short and
10601// fits within this buffer, calls `func` with `ctx` as a parameter, where the
10602// pushing and popping of limits is handled automatically and with lower cost
10603// than the normal PushLimit()/PopLimit() sequence.
10604static UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast(
10605 upb_EpsCopyInputStream* e, const char** ptr, int len,
10606 upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) {
10607 if (!upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(e, *ptr, len)) {
10608 return false;
10609 }
10610
10611 // Fast case: Sub-message is <128 bytes and fits in the current buffer.
10612 // This means we can preserve limit/limit_ptr verbatim.
10613 const char* saved_limit_ptr = e->limit_ptr;
10614 int saved_limit = e->limit;
10615 e->limit_ptr = *ptr + len;
10616 e->limit = e->limit_ptr - e->end;
10617 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
10618 *ptr = func(e, *ptr, ctx);
10619 e->limit_ptr = saved_limit_ptr;
10620 e->limit = saved_limit;
10621 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
10622 return true;
10623}
10624
10625#ifdef __cplusplus
10626} /* extern "C" */
10627#endif
10628
10629
10630#endif // UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
10631
Eric Salo8809a112022-11-21 13:01:06 -080010632#ifndef UPB_HASH_INT_TABLE_H_
10633#define UPB_HASH_INT_TABLE_H_
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010634
10635
Eric Salo8809a112022-11-21 13:01:06 -080010636// Must be last.
10637
10638typedef struct {
10639 upb_table t; // For entries that don't fit in the array part.
10640 const upb_tabval* array; // Array part of the table. See const note above.
10641 size_t array_size; // Array part size.
10642 size_t array_count; // Array part number of elements.
10643} upb_inttable;
10644
10645#ifdef __cplusplus
10646extern "C" {
10647#endif
10648
10649// Initialize a table. If memory allocation failed, false is returned and
10650// the table is uninitialized.
10651bool upb_inttable_init(upb_inttable* table, upb_Arena* a);
10652
10653// Returns the number of values in the table.
10654size_t upb_inttable_count(const upb_inttable* t);
10655
10656// Inserts the given key into the hashtable with the given value.
10657// The key must not already exist in the hash table.
10658// The value must not be UINTPTR_MAX.
10659//
10660// If a table resize was required but memory allocation failed, false is
10661// returned and the table is unchanged.
10662bool upb_inttable_insert(upb_inttable* t, uintptr_t key, upb_value val,
10663 upb_Arena* a);
10664
10665// Looks up key in this table, returning "true" if the key was found.
10666// If v is non-NULL, copies the value for this key into *v.
10667bool upb_inttable_lookup(const upb_inttable* t, uintptr_t key, upb_value* v);
10668
10669// Removes an item from the table. Returns true if the remove was successful,
10670// and stores the removed item in *val if non-NULL.
10671bool upb_inttable_remove(upb_inttable* t, uintptr_t key, upb_value* val);
10672
10673// Updates an existing entry in an inttable.
10674// If the entry does not exist, returns false and does nothing.
10675// Unlike insert/remove, this does not invalidate iterators.
10676bool upb_inttable_replace(upb_inttable* t, uintptr_t key, upb_value val);
10677
10678// Optimizes the table for the current set of entries, for both memory use and
10679// lookup time. Client should call this after all entries have been inserted;
10680// inserting more entries is legal, but will likely require a table resize.
10681void upb_inttable_compact(upb_inttable* t, upb_Arena* a);
10682
10683// Iteration over inttable:
10684//
10685// intptr_t iter = UPB_INTTABLE_BEGIN;
10686// uintptr_t key;
10687// upb_value val;
10688// while (upb_inttable_next(t, &key, &val, &iter)) {
10689// // ...
10690// }
10691
10692#define UPB_INTTABLE_BEGIN -1
10693
10694bool upb_inttable_next(const upb_inttable* t, uintptr_t* key, upb_value* val,
10695 intptr_t* iter);
10696void upb_inttable_removeiter(upb_inttable* t, intptr_t* iter);
10697
10698#ifdef __cplusplus
10699} /* extern "C" */
10700#endif
10701
10702
10703#endif /* UPB_HASH_INT_TABLE_H_ */
10704
10705#ifndef UPB_JSON_DECODE_H_
10706#define UPB_JSON_DECODE_H_
10707
10708
10709#ifndef UPB_REFLECTION_DEF_H_
10710#define UPB_REFLECTION_DEF_H_
10711
10712
10713// IWYU pragma: private, include "upb/reflection/def.h"
10714
10715#ifndef UPB_REFLECTION_DEF_POOL_H_
10716#define UPB_REFLECTION_DEF_POOL_H_
10717
10718
10719// IWYU pragma: private, include "upb/reflection/def.h"
10720
10721// Declarations common to all public def types.
10722
10723#ifndef UPB_REFLECTION_COMMON_H_
10724#define UPB_REFLECTION_COMMON_H_
10725
Mike Kruskal232ecf42023-01-14 00:09:40 -080010726// begin:google_only
10727// #ifndef UPB_BOOTSTRAP_STAGE0
10728// #include "net/proto2/proto/descriptor.upb.h"
10729// #else
10730// #include "google/protobuf/descriptor.upb.h"
10731// #endif
10732// end:google_only
10733
10734// begin:github_only
10735// end:github_only
Eric Salo8809a112022-11-21 13:01:06 -080010736
Protobuf Team Bot7dabac92023-09-07 18:35:50 +000010737typedef enum {
10738 kUpb_Syntax_Proto2 = 2,
10739 kUpb_Syntax_Proto3 = 3,
10740 kUpb_Syntax_Editions = 99
10741} upb_Syntax;
Eric Salo8809a112022-11-21 13:01:06 -080010742
10743// Forward declarations for circular references.
10744typedef struct upb_DefPool upb_DefPool;
10745typedef struct upb_EnumDef upb_EnumDef;
10746typedef struct upb_EnumReservedRange upb_EnumReservedRange;
10747typedef struct upb_EnumValueDef upb_EnumValueDef;
10748typedef struct upb_ExtensionRange upb_ExtensionRange;
10749typedef struct upb_FieldDef upb_FieldDef;
10750typedef struct upb_FileDef upb_FileDef;
10751typedef struct upb_MessageDef upb_MessageDef;
10752typedef struct upb_MessageReservedRange upb_MessageReservedRange;
10753typedef struct upb_MethodDef upb_MethodDef;
10754typedef struct upb_OneofDef upb_OneofDef;
10755typedef struct upb_ServiceDef upb_ServiceDef;
10756
10757// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
10758
10759typedef struct upb_DefBuilder upb_DefBuilder;
10760
10761#endif /* UPB_REFLECTION_COMMON_H_ */
10762
10763#ifndef UPB_REFLECTION_DEF_TYPE_H_
10764#define UPB_REFLECTION_DEF_TYPE_H_
10765
10766
10767// Must be last.
10768
10769// Inside a symtab we store tagged pointers to specific def types.
10770typedef enum {
10771 UPB_DEFTYPE_MASK = 7,
10772
10773 // Only inside symtab table.
10774 UPB_DEFTYPE_EXT = 0,
10775 UPB_DEFTYPE_MSG = 1,
10776 UPB_DEFTYPE_ENUM = 2,
10777 UPB_DEFTYPE_ENUMVAL = 3,
10778 UPB_DEFTYPE_SERVICE = 4,
10779
10780 // Only inside message table.
10781 UPB_DEFTYPE_FIELD = 0,
10782 UPB_DEFTYPE_ONEOF = 1,
10783 UPB_DEFTYPE_FIELD_JSONNAME = 2,
10784} upb_deftype_t;
10785
10786#ifdef __cplusplus
10787extern "C" {
10788#endif
10789
10790// Our 3-bit pointer tagging requires all pointers to be multiples of 8.
10791// The arena will always yield 8-byte-aligned addresses, however we put
10792// the defs into arrays. For each element in the array to be 8-byte-aligned,
10793// the sizes of each def type must also be a multiple of 8.
10794//
10795// If any of these asserts fail, we need to add or remove padding on 32-bit
10796// machines (64-bit machines will have 8-byte alignment already due to
10797// pointers, which all of these structs have).
10798UPB_INLINE void _upb_DefType_CheckPadding(size_t size) {
10799 UPB_ASSERT((size & UPB_DEFTYPE_MASK) == 0);
10800}
10801
10802upb_deftype_t _upb_DefType_Type(upb_value v);
10803
10804upb_value _upb_DefType_Pack(const void* ptr, upb_deftype_t type);
10805
10806const void* _upb_DefType_Unpack(upb_value v, upb_deftype_t type);
10807
10808#ifdef __cplusplus
10809} /* extern "C" */
10810#endif
10811
10812
10813#endif /* UPB_REFLECTION_DEF_TYPE_H_ */
10814
10815// Must be last.
10816
10817#ifdef __cplusplus
10818extern "C" {
10819#endif
10820
Jason Lunn67dee292023-07-13 13:15:26 -070010821UPB_API void upb_DefPool_Free(upb_DefPool* s);
Eric Salo8809a112022-11-21 13:01:06 -080010822
Jason Lunn67dee292023-07-13 13:15:26 -070010823UPB_API upb_DefPool* upb_DefPool_New(void);
Eric Salo8809a112022-11-21 13:01:06 -080010824
Jason Lunn67dee292023-07-13 13:15:26 -070010825UPB_API const upb_MessageDef* upb_DefPool_FindMessageByName(
10826 const upb_DefPool* s, const char* sym);
Eric Salo8809a112022-11-21 13:01:06 -080010827
10828const upb_MessageDef* upb_DefPool_FindMessageByNameWithSize(
10829 const upb_DefPool* s, const char* sym, size_t len);
10830
Jason Lunn67dee292023-07-13 13:15:26 -070010831UPB_API const upb_EnumDef* upb_DefPool_FindEnumByName(const upb_DefPool* s,
10832 const char* sym);
Eric Salo8809a112022-11-21 13:01:06 -080010833
10834const upb_EnumValueDef* upb_DefPool_FindEnumByNameval(const upb_DefPool* s,
10835 const char* sym);
10836
10837const upb_FileDef* upb_DefPool_FindFileByName(const upb_DefPool* s,
10838 const char* name);
10839
10840const upb_FileDef* upb_DefPool_FindFileByNameWithSize(const upb_DefPool* s,
10841 const char* name,
10842 size_t len);
10843
10844const upb_FieldDef* upb_DefPool_FindExtensionByMiniTable(
10845 const upb_DefPool* s, const upb_MiniTableExtension* ext);
10846
10847const upb_FieldDef* upb_DefPool_FindExtensionByName(const upb_DefPool* s,
10848 const char* sym);
10849
10850const upb_FieldDef* upb_DefPool_FindExtensionByNameWithSize(
10851 const upb_DefPool* s, const char* name, size_t size);
10852
10853const upb_FieldDef* upb_DefPool_FindExtensionByNumber(const upb_DefPool* s,
10854 const upb_MessageDef* m,
10855 int32_t fieldnum);
10856
10857const upb_ServiceDef* upb_DefPool_FindServiceByName(const upb_DefPool* s,
10858 const char* name);
10859
10860const upb_ServiceDef* upb_DefPool_FindServiceByNameWithSize(
10861 const upb_DefPool* s, const char* name, size_t size);
10862
10863const upb_FileDef* upb_DefPool_FindFileContainingSymbol(const upb_DefPool* s,
10864 const char* name);
10865
Jason Lunn67dee292023-07-13 13:15:26 -070010866UPB_API const upb_FileDef* upb_DefPool_AddFile(
10867 upb_DefPool* s, const UPB_DESC(FileDescriptorProto) * file_proto,
10868 upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080010869
10870const upb_ExtensionRegistry* upb_DefPool_ExtensionRegistry(
10871 const upb_DefPool* s);
10872
10873const upb_FieldDef** upb_DefPool_GetAllExtensions(const upb_DefPool* s,
10874 const upb_MessageDef* m,
10875 size_t* count);
10876
10877#ifdef __cplusplus
10878} /* extern "C" */
10879#endif
10880
10881
10882#endif /* UPB_REFLECTION_DEF_POOL_H_ */
10883
10884// IWYU pragma: private, include "upb/reflection/def.h"
10885
10886#ifndef UPB_REFLECTION_ENUM_DEF_H_
10887#define UPB_REFLECTION_ENUM_DEF_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -070010888
10889
10890// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010891
10892#ifdef __cplusplus
10893extern "C" {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010894#endif
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010895
Eric Salo8809a112022-11-21 13:01:06 -080010896bool upb_EnumDef_CheckNumber(const upb_EnumDef* e, int32_t num);
10897const upb_MessageDef* upb_EnumDef_ContainingType(const upb_EnumDef* e);
10898int32_t upb_EnumDef_Default(const upb_EnumDef* e);
Jason Lunn67dee292023-07-13 13:15:26 -070010899UPB_API const upb_FileDef* upb_EnumDef_File(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080010900const upb_EnumValueDef* upb_EnumDef_FindValueByName(const upb_EnumDef* e,
10901 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070010902UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080010903 const upb_EnumDef* e, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070010904UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNumber(
10905 const upb_EnumDef* e, int32_t num);
10906UPB_API const char* upb_EnumDef_FullName(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080010907bool upb_EnumDef_HasOptions(const upb_EnumDef* e);
10908bool upb_EnumDef_IsClosed(const upb_EnumDef* e);
10909
10910// Creates a mini descriptor string for an enum, returns true on success.
10911bool upb_EnumDef_MiniDescriptorEncode(const upb_EnumDef* e, upb_Arena* a,
10912 upb_StringView* out);
10913
10914const char* upb_EnumDef_Name(const upb_EnumDef* e);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010915const UPB_DESC(EnumOptions) * upb_EnumDef_Options(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080010916
10917upb_StringView upb_EnumDef_ReservedName(const upb_EnumDef* e, int i);
10918int upb_EnumDef_ReservedNameCount(const upb_EnumDef* e);
10919
10920const upb_EnumReservedRange* upb_EnumDef_ReservedRange(const upb_EnumDef* e,
10921 int i);
10922int upb_EnumDef_ReservedRangeCount(const upb_EnumDef* e);
10923
Jason Lunn67dee292023-07-13 13:15:26 -070010924UPB_API const upb_EnumValueDef* upb_EnumDef_Value(const upb_EnumDef* e, int i);
10925UPB_API int upb_EnumDef_ValueCount(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080010926
10927#ifdef __cplusplus
10928} /* extern "C" */
10929#endif
10930
10931
10932#endif /* UPB_REFLECTION_ENUM_DEF_H_ */
10933
10934// IWYU pragma: private, include "upb/reflection/def.h"
10935
10936#ifndef UPB_REFLECTION_ENUM_VALUE_DEF_H_
10937#define UPB_REFLECTION_ENUM_VALUE_DEF_H_
10938
10939
10940// Must be last.
10941
10942#ifdef __cplusplus
10943extern "C" {
10944#endif
10945
10946const upb_EnumDef* upb_EnumValueDef_Enum(const upb_EnumValueDef* v);
10947const char* upb_EnumValueDef_FullName(const upb_EnumValueDef* v);
10948bool upb_EnumValueDef_HasOptions(const upb_EnumValueDef* v);
10949uint32_t upb_EnumValueDef_Index(const upb_EnumValueDef* v);
Jason Lunn67dee292023-07-13 13:15:26 -070010950UPB_API const char* upb_EnumValueDef_Name(const upb_EnumValueDef* v);
10951UPB_API int32_t upb_EnumValueDef_Number(const upb_EnumValueDef* v);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010952const UPB_DESC(EnumValueOptions) *
10953 upb_EnumValueDef_Options(const upb_EnumValueDef* v);
Eric Salo8809a112022-11-21 13:01:06 -080010954
10955#ifdef __cplusplus
10956} /* extern "C" */
10957#endif
10958
10959
10960#endif /* UPB_REFLECTION_ENUM_VALUE_DEF_H_ */
10961
10962// IWYU pragma: private, include "upb/reflection/def.h"
10963
10964#ifndef UPB_REFLECTION_EXTENSION_RANGE_H_
10965#define UPB_REFLECTION_EXTENSION_RANGE_H_
10966
10967
10968// Must be last.
10969
10970#ifdef __cplusplus
10971extern "C" {
10972#endif
10973
10974int32_t upb_ExtensionRange_Start(const upb_ExtensionRange* r);
10975int32_t upb_ExtensionRange_End(const upb_ExtensionRange* r);
10976
10977bool upb_ExtensionRange_HasOptions(const upb_ExtensionRange* r);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010978const UPB_DESC(ExtensionRangeOptions) *
10979 upb_ExtensionRange_Options(const upb_ExtensionRange* r);
Eric Salo8809a112022-11-21 13:01:06 -080010980
10981#ifdef __cplusplus
10982} /* extern "C" */
10983#endif
10984
10985
10986#endif /* UPB_REFLECTION_EXTENSION_RANGE_H_ */
10987
10988// IWYU pragma: private, include "upb/reflection/def.h"
10989
10990#ifndef UPB_REFLECTION_FIELD_DEF_H_
10991#define UPB_REFLECTION_FIELD_DEF_H_
10992
10993
10994// Must be last.
10995
10996// Maximum field number allowed for FieldDefs.
10997// This is an inherent limit of the protobuf wire format.
10998#define kUpb_MaxFieldNumber ((1 << 29) - 1)
10999
11000#ifdef __cplusplus
11001extern "C" {
11002#endif
11003
11004const upb_OneofDef* upb_FieldDef_ContainingOneof(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011005UPB_API const upb_MessageDef* upb_FieldDef_ContainingType(
11006 const upb_FieldDef* f);
11007UPB_API upb_CType upb_FieldDef_CType(const upb_FieldDef* f);
11008UPB_API upb_MessageValue upb_FieldDef_Default(const upb_FieldDef* f);
11009UPB_API const upb_EnumDef* upb_FieldDef_EnumSubDef(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011010const upb_MessageDef* upb_FieldDef_ExtensionScope(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011011UPB_API const upb_FileDef* upb_FieldDef_File(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011012const char* upb_FieldDef_FullName(const upb_FieldDef* f);
11013bool upb_FieldDef_HasDefault(const upb_FieldDef* f);
11014bool upb_FieldDef_HasJsonName(const upb_FieldDef* f);
11015bool upb_FieldDef_HasOptions(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011016UPB_API bool upb_FieldDef_HasPresence(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011017bool upb_FieldDef_HasSubDef(const upb_FieldDef* f);
11018uint32_t upb_FieldDef_Index(const upb_FieldDef* f);
11019bool upb_FieldDef_IsExtension(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011020UPB_API bool upb_FieldDef_IsMap(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011021bool upb_FieldDef_IsOptional(const upb_FieldDef* f);
11022bool upb_FieldDef_IsPacked(const upb_FieldDef* f);
11023bool upb_FieldDef_IsPrimitive(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011024UPB_API bool upb_FieldDef_IsRepeated(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011025bool upb_FieldDef_IsRequired(const upb_FieldDef* f);
11026bool upb_FieldDef_IsString(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011027UPB_API bool upb_FieldDef_IsSubMessage(const upb_FieldDef* f);
11028UPB_API const char* upb_FieldDef_JsonName(const upb_FieldDef* f);
11029UPB_API upb_Label upb_FieldDef_Label(const upb_FieldDef* f);
11030UPB_API const upb_MessageDef* upb_FieldDef_MessageSubDef(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011031
11032// Creates a mini descriptor string for a field, returns true on success.
11033bool upb_FieldDef_MiniDescriptorEncode(const upb_FieldDef* f, upb_Arena* a,
11034 upb_StringView* out);
11035
11036const upb_MiniTableField* upb_FieldDef_MiniTable(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011037UPB_API const char* upb_FieldDef_Name(const upb_FieldDef* f);
11038UPB_API uint32_t upb_FieldDef_Number(const upb_FieldDef* f);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011039const UPB_DESC(FieldOptions) * upb_FieldDef_Options(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011040UPB_API const upb_OneofDef* upb_FieldDef_RealContainingOneof(
11041 const upb_FieldDef* f);
11042UPB_API upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011043
11044#ifdef __cplusplus
11045} /* extern "C" */
11046#endif
11047
11048
11049#endif /* UPB_REFLECTION_FIELD_DEF_H_ */
11050
11051// IWYU pragma: private, include "upb/reflection/def.h"
11052
11053#ifndef UPB_REFLECTION_FILE_DEF_H_
11054#define UPB_REFLECTION_FILE_DEF_H_
11055
11056
11057// Must be last.
11058
11059#ifdef __cplusplus
11060extern "C" {
11061#endif
11062
11063const upb_FileDef* upb_FileDef_Dependency(const upb_FileDef* f, int i);
11064int upb_FileDef_DependencyCount(const upb_FileDef* f);
11065bool upb_FileDef_HasOptions(const upb_FileDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011066UPB_API const char* upb_FileDef_Name(const upb_FileDef* f);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011067const UPB_DESC(FileOptions) * upb_FileDef_Options(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011068const char* upb_FileDef_Package(const upb_FileDef* f);
Protobuf Team Bot7dabac92023-09-07 18:35:50 +000011069UPB_DESC(Edition) upb_FileDef_Edition(const upb_FileDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011070UPB_API const upb_DefPool* upb_FileDef_Pool(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011071
11072const upb_FileDef* upb_FileDef_PublicDependency(const upb_FileDef* f, int i);
11073int upb_FileDef_PublicDependencyCount(const upb_FileDef* f);
11074
11075const upb_ServiceDef* upb_FileDef_Service(const upb_FileDef* f, int i);
11076int upb_FileDef_ServiceCount(const upb_FileDef* f);
11077
Jason Lunn67dee292023-07-13 13:15:26 -070011078UPB_API upb_Syntax upb_FileDef_Syntax(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011079
11080const upb_EnumDef* upb_FileDef_TopLevelEnum(const upb_FileDef* f, int i);
11081int upb_FileDef_TopLevelEnumCount(const upb_FileDef* f);
11082
11083const upb_FieldDef* upb_FileDef_TopLevelExtension(const upb_FileDef* f, int i);
11084int upb_FileDef_TopLevelExtensionCount(const upb_FileDef* f);
11085
11086const upb_MessageDef* upb_FileDef_TopLevelMessage(const upb_FileDef* f, int i);
11087int upb_FileDef_TopLevelMessageCount(const upb_FileDef* f);
11088
11089const upb_FileDef* upb_FileDef_WeakDependency(const upb_FileDef* f, int i);
11090int upb_FileDef_WeakDependencyCount(const upb_FileDef* f);
11091
11092#ifdef __cplusplus
11093} /* extern "C" */
11094#endif
11095
11096
11097#endif /* UPB_REFLECTION_FILE_DEF_H_ */
11098
11099// IWYU pragma: private, include "upb/reflection/def.h"
11100
11101#ifndef UPB_REFLECTION_MESSAGE_DEF_H_
11102#define UPB_REFLECTION_MESSAGE_DEF_H_
11103
11104
11105// Must be last.
11106
11107// Well-known field tag numbers for map-entry messages.
11108#define kUpb_MapEntry_KeyFieldNumber 1
11109#define kUpb_MapEntry_ValueFieldNumber 2
11110
11111// Well-known field tag numbers for Any messages.
11112#define kUpb_Any_TypeFieldNumber 1
11113#define kUpb_Any_ValueFieldNumber 2
11114
11115// Well-known field tag numbers for duration messages.
11116#define kUpb_Duration_SecondsFieldNumber 1
11117#define kUpb_Duration_NanosFieldNumber 2
11118
11119// Well-known field tag numbers for timestamp messages.
11120#define kUpb_Timestamp_SecondsFieldNumber 1
11121#define kUpb_Timestamp_NanosFieldNumber 2
11122
11123// All the different kind of well known type messages. For simplicity of check,
11124// number wrappers and string wrappers are grouped together. Make sure the
11125// order and number of these groups are not changed.
11126typedef enum {
11127 kUpb_WellKnown_Unspecified,
11128 kUpb_WellKnown_Any,
11129 kUpb_WellKnown_FieldMask,
11130 kUpb_WellKnown_Duration,
11131 kUpb_WellKnown_Timestamp,
11132
11133 // number wrappers
11134 kUpb_WellKnown_DoubleValue,
11135 kUpb_WellKnown_FloatValue,
11136 kUpb_WellKnown_Int64Value,
11137 kUpb_WellKnown_UInt64Value,
11138 kUpb_WellKnown_Int32Value,
11139 kUpb_WellKnown_UInt32Value,
11140
11141 // string wrappers
11142 kUpb_WellKnown_StringValue,
11143 kUpb_WellKnown_BytesValue,
11144 kUpb_WellKnown_BoolValue,
11145 kUpb_WellKnown_Value,
11146 kUpb_WellKnown_ListValue,
11147 kUpb_WellKnown_Struct,
11148} upb_WellKnown;
11149
11150#ifdef __cplusplus
11151extern "C" {
11152#endif
11153
11154const upb_MessageDef* upb_MessageDef_ContainingType(const upb_MessageDef* m);
11155
11156const upb_ExtensionRange* upb_MessageDef_ExtensionRange(const upb_MessageDef* m,
11157 int i);
11158int upb_MessageDef_ExtensionRangeCount(const upb_MessageDef* m);
11159
Jason Lunn67dee292023-07-13 13:15:26 -070011160UPB_API const upb_FieldDef* upb_MessageDef_Field(const upb_MessageDef* m,
11161 int i);
11162UPB_API int upb_MessageDef_FieldCount(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011163
Jason Lunn67dee292023-07-13 13:15:26 -070011164UPB_API const upb_FileDef* upb_MessageDef_File(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011165
11166// Returns a field by either JSON name or regular proto name.
11167const upb_FieldDef* upb_MessageDef_FindByJsonNameWithSize(
11168 const upb_MessageDef* m, const char* name, size_t size);
11169UPB_INLINE const upb_FieldDef* upb_MessageDef_FindByJsonName(
11170 const upb_MessageDef* m, const char* name) {
11171 return upb_MessageDef_FindByJsonNameWithSize(m, name, strlen(name));
11172}
11173
11174// Lookup of either field or oneof by name. Returns whether either was found.
11175// If the return is true, then the found def will be set, and the non-found
11176// one set to NULL.
Jason Lunn67dee292023-07-13 13:15:26 -070011177UPB_API bool upb_MessageDef_FindByNameWithSize(const upb_MessageDef* m,
11178 const char* name, size_t size,
11179 const upb_FieldDef** f,
11180 const upb_OneofDef** o);
Eric Salo8809a112022-11-21 13:01:06 -080011181UPB_INLINE bool upb_MessageDef_FindByName(const upb_MessageDef* m,
11182 const char* name,
11183 const upb_FieldDef** f,
11184 const upb_OneofDef** o) {
11185 return upb_MessageDef_FindByNameWithSize(m, name, strlen(name), f, o);
11186}
11187
11188const upb_FieldDef* upb_MessageDef_FindFieldByName(const upb_MessageDef* m,
11189 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070011190UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080011191 const upb_MessageDef* m, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070011192UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNumber(
11193 const upb_MessageDef* m, uint32_t i);
Eric Salo8809a112022-11-21 13:01:06 -080011194const upb_OneofDef* upb_MessageDef_FindOneofByName(const upb_MessageDef* m,
11195 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070011196UPB_API const upb_OneofDef* upb_MessageDef_FindOneofByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080011197 const upb_MessageDef* m, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070011198UPB_API const char* upb_MessageDef_FullName(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011199bool upb_MessageDef_HasOptions(const upb_MessageDef* m);
11200bool upb_MessageDef_IsMapEntry(const upb_MessageDef* m);
11201bool upb_MessageDef_IsMessageSet(const upb_MessageDef* m);
11202
11203// Creates a mini descriptor string for a message, returns true on success.
11204bool upb_MessageDef_MiniDescriptorEncode(const upb_MessageDef* m, upb_Arena* a,
11205 upb_StringView* out);
11206
Jason Lunn67dee292023-07-13 13:15:26 -070011207UPB_API const upb_MiniTable* upb_MessageDef_MiniTable(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011208const char* upb_MessageDef_Name(const upb_MessageDef* m);
11209
11210const upb_EnumDef* upb_MessageDef_NestedEnum(const upb_MessageDef* m, int i);
11211const upb_FieldDef* upb_MessageDef_NestedExtension(const upb_MessageDef* m,
11212 int i);
11213const upb_MessageDef* upb_MessageDef_NestedMessage(const upb_MessageDef* m,
11214 int i);
11215
11216int upb_MessageDef_NestedEnumCount(const upb_MessageDef* m);
11217int upb_MessageDef_NestedExtensionCount(const upb_MessageDef* m);
11218int upb_MessageDef_NestedMessageCount(const upb_MessageDef* m);
11219
Jason Lunn67dee292023-07-13 13:15:26 -070011220UPB_API const upb_OneofDef* upb_MessageDef_Oneof(const upb_MessageDef* m,
11221 int i);
11222UPB_API int upb_MessageDef_OneofCount(const upb_MessageDef* m);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011223int upb_MessageDef_RealOneofCount(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011224
Mike Kruskal232ecf42023-01-14 00:09:40 -080011225const UPB_DESC(MessageOptions) *
11226 upb_MessageDef_Options(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011227
11228upb_StringView upb_MessageDef_ReservedName(const upb_MessageDef* m, int i);
11229int upb_MessageDef_ReservedNameCount(const upb_MessageDef* m);
11230
11231const upb_MessageReservedRange* upb_MessageDef_ReservedRange(
11232 const upb_MessageDef* m, int i);
11233int upb_MessageDef_ReservedRangeCount(const upb_MessageDef* m);
11234
Jason Lunn67dee292023-07-13 13:15:26 -070011235UPB_API upb_Syntax upb_MessageDef_Syntax(const upb_MessageDef* m);
11236UPB_API upb_WellKnown upb_MessageDef_WellKnownType(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011237
11238#ifdef __cplusplus
11239} /* extern "C" */
11240#endif
11241
11242
11243#endif /* UPB_REFLECTION_MESSAGE_DEF_H_ */
11244
11245// IWYU pragma: private, include "upb/reflection/def.h"
11246
11247#ifndef UPB_REFLECTION_METHOD_DEF_H_
11248#define UPB_REFLECTION_METHOD_DEF_H_
11249
11250
11251// Must be last.
11252
11253#ifdef __cplusplus
11254extern "C" {
11255#endif
11256
11257bool upb_MethodDef_ClientStreaming(const upb_MethodDef* m);
11258const char* upb_MethodDef_FullName(const upb_MethodDef* m);
11259bool upb_MethodDef_HasOptions(const upb_MethodDef* m);
11260int upb_MethodDef_Index(const upb_MethodDef* m);
11261const upb_MessageDef* upb_MethodDef_InputType(const upb_MethodDef* m);
11262const char* upb_MethodDef_Name(const upb_MethodDef* m);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011263const UPB_DESC(MethodOptions) * upb_MethodDef_Options(const upb_MethodDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011264const upb_MessageDef* upb_MethodDef_OutputType(const upb_MethodDef* m);
11265bool upb_MethodDef_ServerStreaming(const upb_MethodDef* m);
11266const upb_ServiceDef* upb_MethodDef_Service(const upb_MethodDef* m);
11267
11268#ifdef __cplusplus
11269} /* extern "C" */
11270#endif
11271
11272
11273#endif /* UPB_REFLECTION_METHOD_DEF_H_ */
11274
11275// IWYU pragma: private, include "upb/reflection/def.h"
11276
11277#ifndef UPB_REFLECTION_ONEOF_DEF_H_
11278#define UPB_REFLECTION_ONEOF_DEF_H_
11279
11280
11281// Must be last.
11282
11283#ifdef __cplusplus
11284extern "C" {
11285#endif
11286
Jason Lunn67dee292023-07-13 13:15:26 -070011287UPB_API const upb_MessageDef* upb_OneofDef_ContainingType(
11288 const upb_OneofDef* o);
11289UPB_API const upb_FieldDef* upb_OneofDef_Field(const upb_OneofDef* o, int i);
11290UPB_API int upb_OneofDef_FieldCount(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011291const char* upb_OneofDef_FullName(const upb_OneofDef* o);
11292bool upb_OneofDef_HasOptions(const upb_OneofDef* o);
11293uint32_t upb_OneofDef_Index(const upb_OneofDef* o);
11294bool upb_OneofDef_IsSynthetic(const upb_OneofDef* o);
11295const upb_FieldDef* upb_OneofDef_LookupName(const upb_OneofDef* o,
11296 const char* name);
11297const upb_FieldDef* upb_OneofDef_LookupNameWithSize(const upb_OneofDef* o,
11298 const char* name,
11299 size_t size);
11300const upb_FieldDef* upb_OneofDef_LookupNumber(const upb_OneofDef* o,
11301 uint32_t num);
Jason Lunn67dee292023-07-13 13:15:26 -070011302UPB_API const char* upb_OneofDef_Name(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011303int upb_OneofDef_numfields(const upb_OneofDef* o);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011304const UPB_DESC(OneofOptions) * upb_OneofDef_Options(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011305
11306#ifdef __cplusplus
11307} /* extern "C" */
11308#endif
11309
11310
11311#endif /* UPB_REFLECTION_ONEOF_DEF_H_ */
11312
11313// IWYU pragma: private, include "upb/reflection/def.h"
11314
11315#ifndef UPB_REFLECTION_SERVICE_DEF_H_
11316#define UPB_REFLECTION_SERVICE_DEF_H_
11317
11318
11319// Must be last.
11320
11321#ifdef __cplusplus
11322extern "C" {
11323#endif
11324
11325const upb_FileDef* upb_ServiceDef_File(const upb_ServiceDef* s);
11326const upb_MethodDef* upb_ServiceDef_FindMethodByName(const upb_ServiceDef* s,
11327 const char* name);
11328const char* upb_ServiceDef_FullName(const upb_ServiceDef* s);
11329bool upb_ServiceDef_HasOptions(const upb_ServiceDef* s);
11330int upb_ServiceDef_Index(const upb_ServiceDef* s);
11331const upb_MethodDef* upb_ServiceDef_Method(const upb_ServiceDef* s, int i);
11332int upb_ServiceDef_MethodCount(const upb_ServiceDef* s);
11333const char* upb_ServiceDef_Name(const upb_ServiceDef* s);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011334const UPB_DESC(ServiceOptions) *
11335 upb_ServiceDef_Options(const upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080011336
11337#ifdef __cplusplus
11338} /* extern "C" */
11339#endif
11340
11341
11342#endif /* UPB_REFLECTION_SERVICE_DEF_H_ */
11343
11344#endif /* UPB_REFLECTION_DEF_H_ */
11345
11346// Must be last.
11347
11348#ifdef __cplusplus
11349extern "C" {
11350#endif
11351
11352enum { upb_JsonDecode_IgnoreUnknown = 1 };
11353
Jason Lunn67dee292023-07-13 13:15:26 -070011354UPB_API bool upb_JsonDecode(const char* buf, size_t size, upb_Message* msg,
11355 const upb_MessageDef* m, const upb_DefPool* symtab,
11356 int options, upb_Arena* arena, upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080011357
11358#ifdef __cplusplus
11359} /* extern "C" */
11360#endif
11361
11362
11363#endif /* UPB_JSONDECODE_H_ */
11364
11365#ifndef UPB_LEX_ATOI_H_
11366#define UPB_LEX_ATOI_H_
11367
Adam Cozzette7d5592e2023-08-23 12:15:26 -070011368#include <stdint.h>
11369
Eric Salo8809a112022-11-21 13:01:06 -080011370// Must be last.
11371
11372#ifdef __cplusplus
11373extern "C" {
11374#endif
11375
11376// We use these hand-written routines instead of strto[u]l() because the "long
11377// long" variants aren't in c89. Also our version allows setting a ptr limit.
11378// Return the new position of the pointer after parsing the int, or NULL on
11379// integer overflow.
11380
11381const char* upb_BufToUint64(const char* ptr, const char* end, uint64_t* val);
11382const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val,
11383 bool* is_neg);
11384
11385#ifdef __cplusplus
11386} /* extern "C" */
11387#endif
11388
11389
11390#endif /* UPB_LEX_ATOI_H_ */
11391
11392#ifndef UPB_LEX_UNICODE_H_
11393#define UPB_LEX_UNICODE_H_
11394
Adam Cozzette7d5592e2023-08-23 12:15:26 -070011395#include <stdint.h>
11396
Eric Salo8809a112022-11-21 13:01:06 -080011397// Must be last.
11398
11399#ifdef __cplusplus
11400extern "C" {
11401#endif
11402
11403// Returns true iff a codepoint is the value for a high surrogate.
11404UPB_INLINE bool upb_Unicode_IsHigh(uint32_t cp) {
11405 return (cp >= 0xd800 && cp <= 0xdbff);
11406}
11407
11408// Returns true iff a codepoint is the value for a low surrogate.
11409UPB_INLINE bool upb_Unicode_IsLow(uint32_t cp) {
11410 return (cp >= 0xdc00 && cp <= 0xdfff);
11411}
11412
11413// Returns the high 16-bit surrogate value for a supplementary codepoint.
11414// Does not sanity-check the input.
11415UPB_INLINE uint16_t upb_Unicode_ToHigh(uint32_t cp) {
11416 return (cp >> 10) + 0xd7c0;
11417}
11418
11419// Returns the low 16-bit surrogate value for a supplementary codepoint.
11420// Does not sanity-check the input.
11421UPB_INLINE uint16_t upb_Unicode_ToLow(uint32_t cp) {
11422 return (cp & 0x3ff) | 0xdc00;
11423}
11424
11425// Returns the 32-bit value corresponding to a pair of 16-bit surrogates.
11426// Does not sanity-check the input.
11427UPB_INLINE uint32_t upb_Unicode_FromPair(uint32_t high, uint32_t low) {
11428 return ((high & 0x3ff) << 10) + (low & 0x3ff) + 0x10000;
11429}
11430
11431// Outputs a codepoint as UTF8.
11432// Returns the number of bytes written (1-4 on success, 0 on error).
11433// Does not sanity-check the input. Specifically does not check for surrogates.
11434int upb_Unicode_ToUTF8(uint32_t cp, char* out);
11435
11436#ifdef __cplusplus
11437} /* extern "C" */
11438#endif
11439
11440
11441#endif /* UPB_LEX_UNICODE_H_ */
11442
11443#ifndef UPB_REFLECTION_MESSAGE_H_
11444#define UPB_REFLECTION_MESSAGE_H_
11445
11446
11447// Must be last.
11448
11449#ifdef __cplusplus
11450extern "C" {
11451#endif
11452
Eric Salo3f36a912022-12-05 14:12:25 -080011453// Returns a mutable pointer to a map, array, or submessage value. If the given
11454// arena is non-NULL this will construct a new object if it was not previously
11455// present. May not be called for primitive fields.
Jason Lunn67dee292023-07-13 13:15:26 -070011456UPB_API upb_MutableMessageValue upb_Message_Mutable(upb_Message* msg,
11457 const upb_FieldDef* f,
11458 upb_Arena* a);
Eric Salo8809a112022-11-21 13:01:06 -080011459
Eric Salo3f36a912022-12-05 14:12:25 -080011460// Returns the field that is set in the oneof, or NULL if none are set.
Jason Lunn67dee292023-07-13 13:15:26 -070011461UPB_API const upb_FieldDef* upb_Message_WhichOneof(const upb_Message* msg,
11462 const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011463
Eric Salo3f36a912022-12-05 14:12:25 -080011464// Clear all data and unknown fields.
11465void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011466
Eric Salo3f36a912022-12-05 14:12:25 -080011467// Clears any field presence and sets the value back to its default.
Jason Lunn67dee292023-07-13 13:15:26 -070011468UPB_API void upb_Message_ClearFieldByDef(upb_Message* msg,
11469 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011470
Eric Salo3f36a912022-12-05 14:12:25 -080011471// May only be called for fields where upb_FieldDef_HasPresence(f) == true.
Jason Lunn67dee292023-07-13 13:15:26 -070011472UPB_API bool upb_Message_HasFieldByDef(const upb_Message* msg,
11473 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011474
Eric Salo3f36a912022-12-05 14:12:25 -080011475// Returns the value in the message associated with this field def.
Jason Lunn67dee292023-07-13 13:15:26 -070011476UPB_API upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg,
11477 const upb_FieldDef* f);
Eric Salo3f36a912022-12-05 14:12:25 -080011478
11479// Sets the given field to the given value. For a msg/array/map/string, the
11480// caller must ensure that the target data outlives |msg| (by living either in
11481// the same arena or a different arena that outlives it).
11482//
11483// Returns false if allocation fails.
Jason Lunn67dee292023-07-13 13:15:26 -070011484UPB_API bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f,
11485 upb_MessageValue val, upb_Arena* a);
Eric Salo3f36a912022-12-05 14:12:25 -080011486
11487// Iterate over present fields.
11488//
11489// size_t iter = kUpb_Message_Begin;
11490// const upb_FieldDef *f;
11491// upb_MessageValue val;
11492// while (upb_Message_Next(msg, m, ext_pool, &f, &val, &iter)) {
11493// process_field(f, val);
11494// }
11495//
11496// If ext_pool is NULL, no extensions will be returned. If the given symtab
11497// returns extensions that don't match what is in this message, those extensions
11498// will be skipped.
Eric Salo8809a112022-11-21 13:01:06 -080011499
11500#define kUpb_Message_Begin -1
Eric Salo3f36a912022-12-05 14:12:25 -080011501
Eric Salo8809a112022-11-21 13:01:06 -080011502bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m,
11503 const upb_DefPool* ext_pool, const upb_FieldDef** f,
11504 upb_MessageValue* val, size_t* iter);
11505
Eric Salo3f36a912022-12-05 14:12:25 -080011506// Clears all unknown field data from this message and all submessages.
Jason Lunn67dee292023-07-13 13:15:26 -070011507UPB_API bool upb_Message_DiscardUnknown(upb_Message* msg,
11508 const upb_MessageDef* m, int maxdepth);
Eric Salo8809a112022-11-21 13:01:06 -080011509
11510#ifdef __cplusplus
11511} /* extern "C" */
11512#endif
11513
11514
11515#endif /* UPB_REFLECTION_MESSAGE_H_ */
11516
11517#ifndef UPB_JSON_ENCODE_H_
11518#define UPB_JSON_ENCODE_H_
11519
11520
11521// Must be last.
11522
11523#ifdef __cplusplus
11524extern "C" {
11525#endif
11526
11527enum {
11528 /* When set, emits 0/default values. TODO(haberman): proto3 only? */
11529 upb_JsonEncode_EmitDefaults = 1 << 0,
11530
11531 /* When set, use normal (snake_case) field names instead of JSON (camelCase)
11532 names. */
11533 upb_JsonEncode_UseProtoNames = 1 << 1,
11534
11535 /* When set, emits enums as their integer values instead of as their names. */
11536 upb_JsonEncode_FormatEnumsAsIntegers = 1 << 2
11537};
11538
11539/* Encodes the given |msg| to JSON format. The message's reflection is given in
Protobuf Team Botad884532023-09-05 18:31:02 +000011540 * |m|. The DefPool in |ext_pool| is used to find extensions (if NULL,
11541 * extensions will not be printed).
Eric Salo8809a112022-11-21 13:01:06 -080011542 *
11543 * Output is placed in the given buffer, and always NULL-terminated. The output
11544 * size (excluding NULL) is returned. This means that a return value >= |size|
11545 * implies that the output was truncated. (These are the same semantics as
11546 * snprintf()). */
Jason Lunn67dee292023-07-13 13:15:26 -070011547UPB_API size_t upb_JsonEncode(const upb_Message* msg, const upb_MessageDef* m,
11548 const upb_DefPool* ext_pool, int options,
11549 char* buf, size_t size, upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080011550
11551#ifdef __cplusplus
11552} /* extern "C" */
11553#endif
11554
11555
11556#endif /* UPB_JSONENCODE_H_ */
11557
11558#ifndef UPB_LEX_ROUND_TRIP_H_
11559#define UPB_LEX_ROUND_TRIP_H_
11560
11561// Must be last.
11562
11563// Encodes a float or double that is round-trippable, but as short as possible.
11564// These routines are not fully optimal (not guaranteed to be shortest), but are
11565// short-ish and match the implementation that has been used in protobuf since
11566// the beginning.
11567
11568// The given buffer size must be at least kUpb_RoundTripBufferSize.
11569enum { kUpb_RoundTripBufferSize = 32 };
11570
11571#ifdef __cplusplus
11572extern "C" {
11573#endif
11574
11575void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size);
11576void _upb_EncodeRoundTripFloat(float val, char* buf, size_t size);
11577
11578#ifdef __cplusplus
11579} /* extern "C" */
11580#endif
11581
11582
11583#endif /* UPB_LEX_ROUND_TRIP_H_ */
11584
11585#ifndef UPB_PORT_VSNPRINTF_COMPAT_H_
11586#define UPB_PORT_VSNPRINTF_COMPAT_H_
11587
11588// Must be last.
11589
11590UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt,
11591 va_list ap) {
11592#if defined(__MINGW64__) || defined(__MINGW32__) || defined(_MSC_VER)
11593 // The msvc runtime has a non-conforming vsnprintf() that requires the
11594 // following compatibility code to become conformant.
11595 int n = -1;
11596 if (size != 0) n = _vsnprintf_s(buf, size, _TRUNCATE, fmt, ap);
11597 if (n == -1) n = _vscprintf(fmt, ap);
11598 return n;
11599#else
11600 return vsnprintf(buf, size, fmt, ap);
11601#endif
11602}
11603
11604
11605#endif // UPB_PORT_VSNPRINTF_COMPAT_H_
11606
11607#ifndef UPB_LEX_STRTOD_H_
11608#define UPB_LEX_STRTOD_H_
11609
11610// Must be last.
11611
11612#ifdef __cplusplus
11613extern "C" {
11614#endif
11615
11616double _upb_NoLocaleStrtod(const char *str, char **endptr);
11617
11618#ifdef __cplusplus
11619} /* extern "C" */
11620#endif
11621
11622
11623#endif /* UPB_LEX_STRTOD_H_ */
11624
Sandy Zhange3b09432023-08-07 09:30:02 -070011625#ifndef UPB_MEM_INTERNAL_ARENA_H_
11626#define UPB_MEM_INTERNAL_ARENA_H_
Eric Salo8809a112022-11-21 13:01:06 -080011627
11628
11629// Must be last.
11630
11631typedef struct _upb_MemBlock _upb_MemBlock;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011632
11633struct upb_Arena {
11634 _upb_ArenaHead head;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011635
Deanna Garciac7d979d2023-04-14 17:22:13 -070011636 // upb_alloc* together with a low bit which signals if there is an initial
11637 // block.
11638 uintptr_t block_alloc;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011639
Deanna Garciac7d979d2023-04-14 17:22:13 -070011640 // When multiple arenas are fused together, each arena points to a parent
11641 // arena (root points to itself). The root tracks how many live arenas
11642 // reference it.
Joshua Habermand3995ec2022-09-30 16:54:39 -070011643
Deanna Garciac7d979d2023-04-14 17:22:13 -070011644 // The low bit is tagged:
11645 // 0: pointer to parent
11646 // 1: count, left shifted by one
11647 UPB_ATOMIC(uintptr_t) parent_or_count;
11648
11649 // All nodes that are fused together are in a singly-linked list.
11650 UPB_ATOMIC(upb_Arena*) next; // NULL at end of list.
11651
11652 // The last element of the linked list. This is present only as an
11653 // optimization, so that we do not have to iterate over all members for every
11654 // fuse. Only significant for an arena root. In other cases it is ignored.
11655 UPB_ATOMIC(upb_Arena*) tail; // == self when no other list members.
11656
11657 // Linked list of blocks to free/cleanup. Atomic only for the benefit of
11658 // upb_Arena_SpaceAllocated().
11659 UPB_ATOMIC(_upb_MemBlock*) blocks;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011660};
11661
Eric Salodfb71552023-03-22 12:35:09 -070011662UPB_INLINE bool _upb_Arena_IsTaggedRefcount(uintptr_t parent_or_count) {
11663 return (parent_or_count & 1) == 1;
11664}
Eric Salo8809a112022-11-21 13:01:06 -080011665
Eric Salodfb71552023-03-22 12:35:09 -070011666UPB_INLINE bool _upb_Arena_IsTaggedPointer(uintptr_t parent_or_count) {
11667 return (parent_or_count & 1) == 0;
11668}
11669
Deanna Garciac7d979d2023-04-14 17:22:13 -070011670UPB_INLINE uintptr_t _upb_Arena_RefCountFromTagged(uintptr_t parent_or_count) {
Eric Salodfb71552023-03-22 12:35:09 -070011671 UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count));
11672 return parent_or_count >> 1;
11673}
11674
Deanna Garciac7d979d2023-04-14 17:22:13 -070011675UPB_INLINE uintptr_t _upb_Arena_TaggedFromRefcount(uintptr_t refcount) {
11676 uintptr_t parent_or_count = (refcount << 1) | 1;
Eric Salodfb71552023-03-22 12:35:09 -070011677 UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count));
11678 return parent_or_count;
11679}
11680
11681UPB_INLINE upb_Arena* _upb_Arena_PointerFromTagged(uintptr_t parent_or_count) {
11682 UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count));
11683 return (upb_Arena*)parent_or_count;
11684}
11685
11686UPB_INLINE uintptr_t _upb_Arena_TaggedFromPointer(upb_Arena* a) {
11687 uintptr_t parent_or_count = (uintptr_t)a;
11688 UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count));
11689 return parent_or_count;
11690}
Joshua Habermand3995ec2022-09-30 16:54:39 -070011691
Deanna Garciac7d979d2023-04-14 17:22:13 -070011692UPB_INLINE upb_alloc* upb_Arena_BlockAlloc(upb_Arena* arena) {
11693 return (upb_alloc*)(arena->block_alloc & ~0x1);
11694}
11695
11696UPB_INLINE uintptr_t upb_Arena_MakeBlockAlloc(upb_alloc* alloc,
11697 bool has_initial) {
11698 uintptr_t alloc_uint = (uintptr_t)alloc;
11699 UPB_ASSERT((alloc_uint & 1) == 0);
11700 return alloc_uint | (has_initial ? 1 : 0);
11701}
11702
11703UPB_INLINE bool upb_Arena_HasInitialBlock(upb_Arena* arena) {
11704 return arena->block_alloc & 0x1;
11705}
11706
Joshua Habermand3995ec2022-09-30 16:54:39 -070011707
Sandy Zhange3b09432023-08-07 09:30:02 -070011708#endif /* UPB_MEM_INTERNAL_ARENA_H_ */
Eric Salo8809a112022-11-21 13:01:06 -080011709
Eric Salodfb71552023-03-22 12:35:09 -070011710#ifndef UPB_PORT_ATOMIC_H_
11711#define UPB_PORT_ATOMIC_H_
11712
11713
11714#ifdef UPB_USE_C11_ATOMICS
11715
11716#include <stdatomic.h>
11717#include <stdbool.h>
11718
Deanna Garciac7d979d2023-04-14 17:22:13 -070011719#define upb_Atomic_Init(addr, val) atomic_init(addr, val)
11720#define upb_Atomic_Load(addr, order) atomic_load_explicit(addr, order)
11721#define upb_Atomic_Store(addr, val, order) \
11722 atomic_store_explicit(addr, val, order)
11723#define upb_Atomic_Add(addr, val, order) \
11724 atomic_fetch_add_explicit(addr, val, order)
11725#define upb_Atomic_Sub(addr, val, order) \
Deanna Garciabd6a0cf2023-04-20 10:30:44 -070011726 atomic_fetch_sub_explicit(addr, val, order)
11727#define upb_Atomic_Exchange(addr, val, order) \
11728 atomic_exchange_explicit(addr, val, order)
Deanna Garciac7d979d2023-04-14 17:22:13 -070011729#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \
11730 success_order, failure_order) \
11731 atomic_compare_exchange_strong_explicit(addr, expected, desired, \
11732 success_order, failure_order)
11733#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \
11734 failure_order) \
11735 atomic_compare_exchange_weak_explicit(addr, expected, desired, \
11736 success_order, failure_order)
Eric Salodfb71552023-03-22 12:35:09 -070011737
11738#else // !UPB_USE_C11_ATOMICS
11739
Deanna Garciac7d979d2023-04-14 17:22:13 -070011740#include <string.h>
Eric Salodfb71552023-03-22 12:35:09 -070011741
Deanna Garciac7d979d2023-04-14 17:22:13 -070011742#define upb_Atomic_Init(addr, val) (*addr = val)
11743#define upb_Atomic_Load(addr, order) (*addr)
11744#define upb_Atomic_Store(addr, val, order) (*(addr) = val)
11745#define upb_Atomic_Add(addr, val, order) (*(addr) += val)
11746#define upb_Atomic_Sub(addr, val, order) (*(addr) -= val)
Eric Salodfb71552023-03-22 12:35:09 -070011747
Deanna Garciabd6a0cf2023-04-20 10:30:44 -070011748UPB_INLINE void* _upb_NonAtomic_Exchange(void* addr, void* value) {
11749 void* old;
11750 memcpy(&old, addr, sizeof(value));
11751 memcpy(addr, &value, sizeof(value));
11752 return old;
11753}
11754
11755#define upb_Atomic_Exchange(addr, val, order) _upb_NonAtomic_Exchange(addr, val)
11756
Deanna Garciac7d979d2023-04-14 17:22:13 -070011757// `addr` and `expected` are logically double pointers.
11758UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr,
11759 void* expected,
11760 void* desired) {
11761 if (memcmp(addr, expected, sizeof(desired)) == 0) {
11762 memcpy(addr, &desired, sizeof(desired));
Eric Salodfb71552023-03-22 12:35:09 -070011763 return true;
11764 } else {
Deanna Garciac7d979d2023-04-14 17:22:13 -070011765 memcpy(expected, addr, sizeof(desired));
Eric Salodfb71552023-03-22 12:35:09 -070011766 return false;
11767 }
11768}
11769
Deanna Garciac7d979d2023-04-14 17:22:13 -070011770#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \
11771 success_order, failure_order) \
11772 _upb_NonAtomic_CompareExchangeStrongP((void*)addr, (void*)expected, \
11773 (void*)desired)
11774#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \
11775 failure_order) \
11776 upb_Atomic_CompareExchangeStrong(addr, expected, desired, 0, 0)
11777
Eric Salodfb71552023-03-22 12:35:09 -070011778#endif
11779
11780
11781#endif // UPB_PORT_ATOMIC_H_
11782
Eric Salob7d54ac2022-12-29 11:59:42 -080011783#ifndef UPB_WIRE_READER_H_
11784#define UPB_WIRE_READER_H_
11785
11786
Sandy Zhange3b09432023-08-07 09:30:02 -070011787#ifndef UPB_WIRE_INTERNAL_SWAP_H_
11788#define UPB_WIRE_INTERNAL_SWAP_H_
Eric Salob7d54ac2022-12-29 11:59:42 -080011789
Adam Cozzette7d5592e2023-08-23 12:15:26 -070011790#include <stdint.h>
11791
Eric Salob7d54ac2022-12-29 11:59:42 -080011792// Must be last.
11793
11794#ifdef __cplusplus
11795extern "C" {
11796#endif
11797
11798UPB_INLINE bool _upb_IsLittleEndian(void) {
11799 int x = 1;
11800 return *(char*)&x == 1;
11801}
11802
11803UPB_INLINE uint32_t _upb_BigEndian_Swap32(uint32_t val) {
11804 if (_upb_IsLittleEndian()) return val;
11805
11806 return ((val & 0xff) << 24) | ((val & 0xff00) << 8) |
11807 ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24);
11808}
11809
11810UPB_INLINE uint64_t _upb_BigEndian_Swap64(uint64_t val) {
11811 if (_upb_IsLittleEndian()) return val;
11812
11813 return ((uint64_t)_upb_BigEndian_Swap32((uint32_t)val) << 32) |
11814 _upb_BigEndian_Swap32((uint32_t)(val >> 32));
11815}
11816
11817#ifdef __cplusplus
11818} /* extern "C" */
11819#endif
11820
11821
Sandy Zhange3b09432023-08-07 09:30:02 -070011822#endif /* UPB_WIRE_INTERNAL_SWAP_H_ */
Eric Salob7d54ac2022-12-29 11:59:42 -080011823
Eric Salob7d54ac2022-12-29 11:59:42 -080011824// Must be last.
11825
11826#ifdef __cplusplus
11827extern "C" {
11828#endif
11829
11830// The upb_WireReader interface is suitable for general-purpose parsing of
11831// protobuf binary wire format. It is designed to be used along with
11832// upb_EpsCopyInputStream for buffering, and all parsing routines in this file
11833// assume that at least kUpb_EpsCopyInputStream_SlopBytes worth of data is
11834// available to read without any bounds checks.
11835
11836#define kUpb_WireReader_WireTypeMask 7
11837#define kUpb_WireReader_WireTypeBits 3
11838
11839typedef struct {
11840 const char* ptr;
11841 uint64_t val;
11842} _upb_WireReader_ReadLongVarintRet;
11843
11844_upb_WireReader_ReadLongVarintRet _upb_WireReader_ReadLongVarint(
11845 const char* ptr, uint64_t val);
11846
11847static UPB_FORCEINLINE const char* _upb_WireReader_ReadVarint(const char* ptr,
11848 uint64_t* val,
11849 int maxlen,
11850 uint64_t maxval) {
11851 uint64_t byte = (uint8_t)*ptr;
11852 if (UPB_LIKELY((byte & 0x80) == 0)) {
11853 *val = (uint32_t)byte;
11854 return ptr + 1;
11855 }
11856 const char* start = ptr;
11857 _upb_WireReader_ReadLongVarintRet res =
11858 _upb_WireReader_ReadLongVarint(ptr, byte);
11859 if (!res.ptr || (maxlen < 10 && res.ptr - start > maxlen) ||
11860 res.val > maxval) {
11861 return NULL; // Malformed.
11862 }
11863 *val = res.val;
11864 return res.ptr;
11865}
11866
11867// Parses a tag into `tag`, and returns a pointer past the end of the tag, or
11868// NULL if there was an error in the tag data.
11869//
11870// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
11871// Bounds checks must be performed before calling this function, preferably
11872// by calling upb_EpsCopyInputStream_IsDone().
11873static UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr,
11874 uint32_t* tag) {
11875 uint64_t val;
11876 ptr = _upb_WireReader_ReadVarint(ptr, &val, 5, UINT32_MAX);
11877 if (!ptr) return NULL;
11878 *tag = val;
11879 return ptr;
11880}
11881
11882// Given a tag, returns the field number.
11883UPB_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag) {
11884 return tag >> kUpb_WireReader_WireTypeBits;
11885}
11886
11887// Given a tag, returns the wire type.
11888UPB_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag) {
11889 return tag & kUpb_WireReader_WireTypeMask;
11890}
11891
11892UPB_INLINE const char* upb_WireReader_ReadVarint(const char* ptr,
11893 uint64_t* val) {
11894 return _upb_WireReader_ReadVarint(ptr, val, 10, UINT64_MAX);
11895}
11896
11897// Skips data for a varint, returning a pointer past the end of the varint, or
11898// NULL if there was an error in the varint data.
11899//
11900// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
11901// Bounds checks must be performed before calling this function, preferably
11902// by calling upb_EpsCopyInputStream_IsDone().
11903UPB_INLINE const char* upb_WireReader_SkipVarint(const char* ptr) {
11904 uint64_t val;
11905 return upb_WireReader_ReadVarint(ptr, &val);
11906}
11907
11908// Reads a varint indicating the size of a delimited field into `size`, or
11909// NULL if there was an error in the varint data.
11910//
11911// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
11912// Bounds checks must be performed before calling this function, preferably
11913// by calling upb_EpsCopyInputStream_IsDone().
11914UPB_INLINE const char* upb_WireReader_ReadSize(const char* ptr, int* size) {
11915 uint64_t size64;
11916 ptr = upb_WireReader_ReadVarint(ptr, &size64);
11917 if (!ptr || size64 >= INT32_MAX) return NULL;
11918 *size = size64;
11919 return ptr;
11920}
11921
11922// Reads a fixed32 field, performing byte swapping if necessary.
11923//
11924// REQUIRES: there must be at least 4 bytes of data available at `ptr`.
11925// Bounds checks must be performed before calling this function, preferably
11926// by calling upb_EpsCopyInputStream_IsDone().
11927UPB_INLINE const char* upb_WireReader_ReadFixed32(const char* ptr, void* val) {
11928 uint32_t uval;
11929 memcpy(&uval, ptr, 4);
11930 uval = _upb_BigEndian_Swap32(uval);
11931 memcpy(val, &uval, 4);
11932 return ptr + 4;
11933}
11934
11935// Reads a fixed64 field, performing byte swapping if necessary.
11936//
11937// REQUIRES: there must be at least 4 bytes of data available at `ptr`.
11938// Bounds checks must be performed before calling this function, preferably
11939// by calling upb_EpsCopyInputStream_IsDone().
11940UPB_INLINE const char* upb_WireReader_ReadFixed64(const char* ptr, void* val) {
11941 uint64_t uval;
11942 memcpy(&uval, ptr, 8);
11943 uval = _upb_BigEndian_Swap64(uval);
11944 memcpy(val, &uval, 8);
11945 return ptr + 8;
11946}
11947
Mike Kruskal232ecf42023-01-14 00:09:40 -080011948const char* _upb_WireReader_SkipGroup(const char* ptr, uint32_t tag,
11949 int depth_limit,
11950 upb_EpsCopyInputStream* stream);
11951
Eric Salob7d54ac2022-12-29 11:59:42 -080011952// Skips data for a group, returning a pointer past the end of the group, or
11953// NULL if there was an error parsing the group. The `tag` argument should be
11954// the start group tag that begins the group. The `depth_limit` argument
11955// indicates how many levels of recursion the group is allowed to have before
11956// reporting a parse error (this limit exists to protect against stack
11957// overflow).
Eric Salob7d54ac2022-12-29 11:59:42 -080011958//
Mike Kruskal232ecf42023-01-14 00:09:40 -080011959// TODO: evaluate how the depth_limit should be specified. Do users need
11960// control over this?
11961UPB_INLINE const char* upb_WireReader_SkipGroup(
11962 const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) {
11963 return _upb_WireReader_SkipGroup(ptr, tag, 100, stream);
11964}
11965
11966UPB_INLINE const char* _upb_WireReader_SkipValue(
Eric Salob7d54ac2022-12-29 11:59:42 -080011967 const char* ptr, uint32_t tag, int depth_limit,
11968 upb_EpsCopyInputStream* stream) {
11969 switch (upb_WireReader_GetWireType(tag)) {
11970 case kUpb_WireType_Varint:
11971 return upb_WireReader_SkipVarint(ptr);
11972 case kUpb_WireType_32Bit:
11973 return ptr + 4;
11974 case kUpb_WireType_64Bit:
11975 return ptr + 8;
11976 case kUpb_WireType_Delimited: {
11977 int size;
11978 ptr = upb_WireReader_ReadSize(ptr, &size);
11979 if (!ptr) return NULL;
11980 ptr += size;
11981 return ptr;
11982 }
11983 case kUpb_WireType_StartGroup:
Mike Kruskal232ecf42023-01-14 00:09:40 -080011984 return _upb_WireReader_SkipGroup(ptr, tag, depth_limit, stream);
Eric Salob7d54ac2022-12-29 11:59:42 -080011985 case kUpb_WireType_EndGroup:
11986 return NULL; // Should be handled before now.
11987 default:
11988 return NULL; // Unknown wire type.
11989 }
11990}
11991
Mike Kruskal232ecf42023-01-14 00:09:40 -080011992// Skips data for a wire value of any type, returning a pointer past the end of
11993// the data, or NULL if there was an error parsing the group. The `tag` argument
11994// should be the tag that was just parsed. The `depth_limit` argument indicates
11995// how many levels of recursion a group is allowed to have before reporting a
11996// parse error (this limit exists to protect against stack overflow).
11997//
11998// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
11999// Bounds checks must be performed before calling this function, preferably
12000// by calling upb_EpsCopyInputStream_IsDone().
12001//
12002// TODO: evaluate how the depth_limit should be specified. Do users need
12003// control over this?
12004UPB_INLINE const char* upb_WireReader_SkipValue(
12005 const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) {
12006 return _upb_WireReader_SkipValue(ptr, tag, 100, stream);
12007}
12008
Eric Salob7d54ac2022-12-29 11:59:42 -080012009#ifdef __cplusplus
12010} /* extern "C" */
12011#endif
12012
12013
12014#endif // UPB_WIRE_READER_H_
12015
Adam Cozzette8059da22023-08-16 07:57:14 -070012016#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12017#define UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12018
12019
12020#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12021#define UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12022
Adam Cozzette7d5592e2023-08-23 12:15:26 -070012023#include <stdint.h>
12024
Adam Cozzette8059da22023-08-16 07:57:14 -070012025
12026// Must be last.
12027
12028#ifdef __cplusplus
12029extern "C" {
12030#endif
12031
12032UPB_INLINE char _upb_ToBase92(int8_t ch) {
12033 extern const char _kUpb_ToBase92[];
12034 UPB_ASSERT(0 <= ch && ch < 92);
12035 return _kUpb_ToBase92[ch];
12036}
12037
12038UPB_INLINE char _upb_FromBase92(uint8_t ch) {
12039 extern const int8_t _kUpb_FromBase92[];
12040 if (' ' > ch || ch > '~') return -1;
12041 return _kUpb_FromBase92[ch - ' '];
12042}
12043
12044UPB_INLINE const char* _upb_Base92_DecodeVarint(const char* ptr,
12045 const char* end, char first_ch,
12046 uint8_t min, uint8_t max,
12047 uint32_t* out_val) {
12048 uint32_t val = 0;
12049 uint32_t shift = 0;
12050 const int bits_per_char =
12051 upb_Log2Ceiling(_upb_FromBase92(max) - _upb_FromBase92(min));
12052 char ch = first_ch;
12053 while (1) {
12054 uint32_t bits = _upb_FromBase92(ch) - _upb_FromBase92(min);
12055 val |= bits << shift;
12056 if (ptr == end || *ptr < min || max < *ptr) {
12057 *out_val = val;
12058 UPB_ASSUME(ptr != NULL);
12059 return ptr;
12060 }
12061 ch = *ptr++;
12062 shift += bits_per_char;
12063 if (shift >= 32) return NULL;
12064 }
12065}
12066
12067#ifdef __cplusplus
12068} /* extern "C" */
12069#endif
12070
12071
12072#endif // UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12073
12074// Must be last.
12075
12076// upb_MdDecoder: used internally for decoding MiniDescriptors for messages,
12077// extensions, and enums.
12078typedef struct {
12079 const char* end;
12080 upb_Status* status;
12081 jmp_buf err;
12082} upb_MdDecoder;
12083
12084UPB_PRINTF(2, 3)
12085UPB_NORETURN UPB_INLINE void upb_MdDecoder_ErrorJmp(upb_MdDecoder* d,
12086 const char* fmt, ...) {
12087 if (d->status) {
12088 va_list argp;
12089 upb_Status_SetErrorMessage(d->status, "Error building mini table: ");
12090 va_start(argp, fmt);
12091 upb_Status_VAppendErrorFormat(d->status, fmt, argp);
12092 va_end(argp);
12093 }
12094 UPB_LONGJMP(d->err, 1);
12095}
12096
12097UPB_INLINE void upb_MdDecoder_CheckOutOfMemory(upb_MdDecoder* d,
12098 const void* ptr) {
12099 if (!ptr) upb_MdDecoder_ErrorJmp(d, "Out of memory");
12100}
12101
12102UPB_INLINE const char* upb_MdDecoder_DecodeBase92Varint(
12103 upb_MdDecoder* d, const char* ptr, char first_ch, uint8_t min, uint8_t max,
12104 uint32_t* out_val) {
12105 ptr = _upb_Base92_DecodeVarint(ptr, d->end, first_ch, min, max, out_val);
12106 if (!ptr) upb_MdDecoder_ErrorJmp(d, "Overlong varint");
12107 return ptr;
12108}
12109
12110
12111#endif // UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12112
12113#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12114#define UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12115
12116
12117// Must be last.
12118
12119typedef enum {
12120 kUpb_EncodedType_Double = 0,
12121 kUpb_EncodedType_Float = 1,
12122 kUpb_EncodedType_Fixed32 = 2,
12123 kUpb_EncodedType_Fixed64 = 3,
12124 kUpb_EncodedType_SFixed32 = 4,
12125 kUpb_EncodedType_SFixed64 = 5,
12126 kUpb_EncodedType_Int32 = 6,
12127 kUpb_EncodedType_UInt32 = 7,
12128 kUpb_EncodedType_SInt32 = 8,
12129 kUpb_EncodedType_Int64 = 9,
12130 kUpb_EncodedType_UInt64 = 10,
12131 kUpb_EncodedType_SInt64 = 11,
12132 kUpb_EncodedType_OpenEnum = 12,
12133 kUpb_EncodedType_Bool = 13,
12134 kUpb_EncodedType_Bytes = 14,
12135 kUpb_EncodedType_String = 15,
12136 kUpb_EncodedType_Group = 16,
12137 kUpb_EncodedType_Message = 17,
12138 kUpb_EncodedType_ClosedEnum = 18,
12139
12140 kUpb_EncodedType_RepeatedBase = 20,
12141} upb_EncodedType;
12142
12143typedef enum {
12144 kUpb_EncodedFieldModifier_FlipPacked = 1 << 0,
12145 kUpb_EncodedFieldModifier_IsRequired = 1 << 1,
12146 kUpb_EncodedFieldModifier_IsProto3Singular = 1 << 2,
12147} upb_EncodedFieldModifier;
12148
12149enum {
12150 kUpb_EncodedValue_MinField = ' ',
12151 kUpb_EncodedValue_MaxField = 'I',
12152 kUpb_EncodedValue_MinModifier = 'L',
12153 kUpb_EncodedValue_MaxModifier = '[',
12154 kUpb_EncodedValue_End = '^',
12155 kUpb_EncodedValue_MinSkip = '_',
12156 kUpb_EncodedValue_MaxSkip = '~',
12157 kUpb_EncodedValue_OneofSeparator = '~',
12158 kUpb_EncodedValue_FieldSeparator = '|',
12159 kUpb_EncodedValue_MinOneofField = ' ',
12160 kUpb_EncodedValue_MaxOneofField = 'b',
12161 kUpb_EncodedValue_MaxEnumMask = 'A',
12162};
12163
12164enum {
12165 kUpb_EncodedVersion_EnumV1 = '!',
12166 kUpb_EncodedVersion_ExtensionV1 = '#',
12167 kUpb_EncodedVersion_MapV1 = '%',
12168 kUpb_EncodedVersion_MessageV1 = '$',
12169 kUpb_EncodedVersion_MessageSetV1 = '&',
12170};
12171
12172
12173#endif // UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12174
12175#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
12176#define UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
12177
12178// Must be last.
12179
12180typedef enum {
12181 kUpb_FieldModifier_IsRepeated = 1 << 0,
12182 kUpb_FieldModifier_IsPacked = 1 << 1,
12183 kUpb_FieldModifier_IsClosedEnum = 1 << 2,
12184 kUpb_FieldModifier_IsProto3Singular = 1 << 3,
12185 kUpb_FieldModifier_IsRequired = 1 << 4,
12186} kUpb_FieldModifier;
12187
12188typedef enum {
12189 kUpb_MessageModifier_ValidateUtf8 = 1 << 0,
12190 kUpb_MessageModifier_DefaultIsPacked = 1 << 1,
12191 kUpb_MessageModifier_IsExtendable = 1 << 2,
12192} kUpb_MessageModifier;
12193
12194
12195#endif // UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
12196
12197#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
12198#define UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
12199
Adam Cozzette7d5592e2023-08-23 12:15:26 -070012200#include <stdint.h>
12201
Adam Cozzette8059da22023-08-16 07:57:14 -070012202
12203// Must be last.
12204
12205// If the input buffer has at least this many bytes available, the encoder call
12206// is guaranteed to succeed (as long as field number order is maintained).
12207#define kUpb_MtDataEncoder_MinSize 16
12208
12209typedef struct {
12210 char* end; // Limit of the buffer passed as a parameter.
12211 // Aliased to internal-only members in .cc.
12212 char internal[32];
12213} upb_MtDataEncoder;
12214
12215#ifdef __cplusplus
12216extern "C" {
12217#endif
12218
12219// Encodes field/oneof information for a given message. The sequence of calls
12220// should look like:
12221//
12222// upb_MtDataEncoder e;
12223// char buf[256];
12224// char* ptr = buf;
12225// e.end = ptr + sizeof(buf);
12226// unit64_t msg_mod = ...; // bitwise & of kUpb_MessageModifiers or zero
12227// ptr = upb_MtDataEncoder_StartMessage(&e, ptr, msg_mod);
12228// // Fields *must* be in field number order.
12229// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
12230// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
12231// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
12232//
12233// // If oneofs are present. Oneofs must be encoded after regular fields.
12234// ptr = upb_MiniTable_StartOneof(&e, ptr)
12235// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
12236// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
12237//
12238// ptr = upb_MiniTable_StartOneof(&e, ptr);
12239// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
12240// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
12241//
12242// Oneofs must be encoded after all regular fields.
12243char* upb_MtDataEncoder_StartMessage(upb_MtDataEncoder* e, char* ptr,
12244 uint64_t msg_mod);
12245char* upb_MtDataEncoder_PutField(upb_MtDataEncoder* e, char* ptr,
12246 upb_FieldType type, uint32_t field_num,
12247 uint64_t field_mod);
12248char* upb_MtDataEncoder_StartOneof(upb_MtDataEncoder* e, char* ptr);
12249char* upb_MtDataEncoder_PutOneofField(upb_MtDataEncoder* e, char* ptr,
12250 uint32_t field_num);
12251
12252// Encodes the set of values for a given enum. The values must be given in
12253// order (after casting to uint32_t), and repeats are not allowed.
12254char* upb_MtDataEncoder_StartEnum(upb_MtDataEncoder* e, char* ptr);
12255char* upb_MtDataEncoder_PutEnumValue(upb_MtDataEncoder* e, char* ptr,
12256 uint32_t val);
12257char* upb_MtDataEncoder_EndEnum(upb_MtDataEncoder* e, char* ptr);
12258
12259// Encodes an entire mini descriptor for an extension.
12260char* upb_MtDataEncoder_EncodeExtension(upb_MtDataEncoder* e, char* ptr,
12261 upb_FieldType type, uint32_t field_num,
12262 uint64_t field_mod);
12263
12264// Encodes an entire mini descriptor for a map.
12265char* upb_MtDataEncoder_EncodeMap(upb_MtDataEncoder* e, char* ptr,
12266 upb_FieldType key_type,
12267 upb_FieldType value_type, uint64_t key_mod,
12268 uint64_t value_mod);
12269
12270// Encodes an entire mini descriptor for a message set.
12271char* upb_MtDataEncoder_EncodeMessageSet(upb_MtDataEncoder* e, char* ptr);
12272
12273#ifdef __cplusplus
12274} /* extern "C" */
12275#endif
12276
12277
12278#endif /* UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ */
12279
Eric Salo8809a112022-11-21 13:01:06 -080012280#ifndef UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_
12281#define UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_
12282
12283
12284#ifndef UPB_REFLECTION_DEF_POOL_INTERNAL_H_
12285#define UPB_REFLECTION_DEF_POOL_INTERNAL_H_
12286
12287
12288// Must be last.
12289
12290#ifdef __cplusplus
12291extern "C" {
12292#endif
12293
12294upb_Arena* _upb_DefPool_Arena(const upb_DefPool* s);
12295size_t _upb_DefPool_BytesLoaded(const upb_DefPool* s);
12296upb_ExtensionRegistry* _upb_DefPool_ExtReg(const upb_DefPool* s);
12297
12298bool _upb_DefPool_InsertExt(upb_DefPool* s, const upb_MiniTableExtension* ext,
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070012299 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080012300bool _upb_DefPool_InsertSym(upb_DefPool* s, upb_StringView sym, upb_value v,
12301 upb_Status* status);
12302bool _upb_DefPool_LookupSym(const upb_DefPool* s, const char* sym, size_t size,
12303 upb_value* v);
12304
12305void** _upb_DefPool_ScratchData(const upb_DefPool* s);
12306size_t* _upb_DefPool_ScratchSize(const upb_DefPool* s);
Mike Kruskal232ecf42023-01-14 00:09:40 -080012307void _upb_DefPool_SetPlatform(upb_DefPool* s, upb_MiniTablePlatform platform);
Eric Salo8809a112022-11-21 13:01:06 -080012308
12309// For generated code only: loads a generated descriptor.
12310typedef struct _upb_DefPool_Init {
12311 struct _upb_DefPool_Init** deps; // Dependencies of this file.
12312 const upb_MiniTableFile* layout;
12313 const char* filename;
12314 upb_StringView descriptor; // Serialized descriptor.
12315} _upb_DefPool_Init;
12316
12317bool _upb_DefPool_LoadDefInit(upb_DefPool* s, const _upb_DefPool_Init* init);
12318
12319// Should only be directly called by tests. This variant lets us suppress
12320// the use of compiled-in tables, forcing a rebuild of the tables at runtime.
12321bool _upb_DefPool_LoadDefInitEx(upb_DefPool* s, const _upb_DefPool_Init* init,
12322 bool rebuild_minitable);
12323
12324#ifdef __cplusplus
12325} /* extern "C" */
12326#endif
12327
12328
12329#endif /* UPB_REFLECTION_DEF_POOL_INTERNAL_H_ */
12330
12331// Must be last.
12332
12333// We want to copy the options verbatim into the destination options proto.
12334// We use serialize+parse as our deep copy.
Mike Kruskal232ecf42023-01-14 00:09:40 -080012335#define UPB_DEF_SET_OPTIONS(target, desc_type, options_type, proto) \
12336 if (UPB_DESC(desc_type##_has_options)(proto)) { \
12337 size_t size; \
12338 char* pb = UPB_DESC(options_type##_serialize)( \
12339 UPB_DESC(desc_type##_options)(proto), ctx->tmp_arena, &size); \
12340 if (!pb) _upb_DefBuilder_OomErr(ctx); \
12341 target = \
12342 UPB_DESC(options_type##_parse)(pb, size, _upb_DefBuilder_Arena(ctx)); \
12343 if (!target) _upb_DefBuilder_OomErr(ctx); \
12344 } else { \
12345 target = (const UPB_DESC(options_type)*)kUpbDefOptDefault; \
Eric Salo8809a112022-11-21 13:01:06 -080012346 }
12347
12348#ifdef __cplusplus
12349extern "C" {
12350#endif
12351
12352struct upb_DefBuilder {
12353 upb_DefPool* symtab;
12354 upb_FileDef* file; // File we are building.
12355 upb_Arena* arena; // Allocate defs here.
12356 upb_Arena* tmp_arena; // For temporary allocations.
12357 upb_Status* status; // Record errors here.
12358 const upb_MiniTableFile* layout; // NULL if we should build layouts.
Mike Kruskal232ecf42023-01-14 00:09:40 -080012359 upb_MiniTablePlatform platform; // Platform we are targeting.
Eric Salo8809a112022-11-21 13:01:06 -080012360 int enum_count; // Count of enums built so far.
12361 int msg_count; // Count of messages built so far.
12362 int ext_count; // Count of extensions built so far.
12363 jmp_buf err; // longjmp() on error.
12364};
12365
12366extern const char* kUpbDefOptDefault;
12367
12368// ctx->status has already been set elsewhere so just fail/longjmp()
12369UPB_NORETURN void _upb_DefBuilder_FailJmp(upb_DefBuilder* ctx);
12370
12371UPB_NORETURN void _upb_DefBuilder_Errf(upb_DefBuilder* ctx, const char* fmt,
12372 ...) UPB_PRINTF(2, 3);
12373UPB_NORETURN void _upb_DefBuilder_OomErr(upb_DefBuilder* ctx);
12374
12375const char* _upb_DefBuilder_MakeFullName(upb_DefBuilder* ctx,
12376 const char* prefix,
12377 upb_StringView name);
12378
12379// Given a symbol and the base symbol inside which it is defined,
12380// find the symbol's definition.
12381const void* _upb_DefBuilder_ResolveAny(upb_DefBuilder* ctx,
12382 const char* from_name_dbg,
12383 const char* base, upb_StringView sym,
12384 upb_deftype_t* type);
12385
12386const void* _upb_DefBuilder_Resolve(upb_DefBuilder* ctx,
12387 const char* from_name_dbg, const char* base,
12388 upb_StringView sym, upb_deftype_t type);
12389
12390char _upb_DefBuilder_ParseEscape(upb_DefBuilder* ctx, const upb_FieldDef* f,
12391 const char** src, const char* end);
12392
12393const char* _upb_DefBuilder_FullToShort(const char* fullname);
12394
12395UPB_INLINE void* _upb_DefBuilder_Alloc(upb_DefBuilder* ctx, size_t bytes) {
12396 if (bytes == 0) return NULL;
12397 void* ret = upb_Arena_Malloc(ctx->arena, bytes);
12398 if (!ret) _upb_DefBuilder_OomErr(ctx);
12399 return ret;
12400}
12401
12402// Adds a symbol |v| to the symtab, which must be a def pointer previously
12403// packed with pack_def(). The def's pointer to upb_FileDef* must be set before
12404// adding, so we know which entries to remove if building this file fails.
12405UPB_INLINE void _upb_DefBuilder_Add(upb_DefBuilder* ctx, const char* name,
12406 upb_value v) {
12407 upb_StringView sym = {.data = name, .size = strlen(name)};
12408 bool ok = _upb_DefPool_InsertSym(ctx->symtab, sym, v, ctx->status);
12409 if (!ok) _upb_DefBuilder_FailJmp(ctx);
12410}
12411
12412UPB_INLINE upb_Arena* _upb_DefBuilder_Arena(const upb_DefBuilder* ctx) {
12413 return ctx->arena;
12414}
12415
12416UPB_INLINE upb_FileDef* _upb_DefBuilder_File(const upb_DefBuilder* ctx) {
12417 return ctx->file;
12418}
12419
12420// This version of CheckIdent() is only called by other, faster versions after
12421// they detect a parsing error.
12422void _upb_DefBuilder_CheckIdentSlow(upb_DefBuilder* ctx, upb_StringView name,
12423 bool full);
12424
Eric Salo8809a112022-11-21 13:01:06 -080012425// Verify a full identifier string. This is slightly more complicated than
12426// verifying a relative identifier string because we must track '.' chars.
12427UPB_INLINE void _upb_DefBuilder_CheckIdentFull(upb_DefBuilder* ctx,
12428 upb_StringView name) {
12429 bool good = name.size > 0;
12430 bool start = true;
12431
12432 for (size_t i = 0; i < name.size; i++) {
12433 const char c = name.data[i];
12434 const char d = c | 0x20; // force lowercase
12435 const bool is_alpha = (('a' <= d) & (d <= 'z')) | (c == '_');
12436 const bool is_numer = ('0' <= c) & (c <= '9') & !start;
12437 const bool is_dot = (c == '.') & !start;
12438
12439 good &= is_alpha | is_numer | is_dot;
12440 start = is_dot;
12441 }
12442
12443 if (!good) _upb_DefBuilder_CheckIdentSlow(ctx, name, true);
12444}
12445
12446#ifdef __cplusplus
12447} /* extern "C" */
12448#endif
12449
12450
12451#endif /* UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ */
12452
12453#ifndef UPB_REFLECTION_ENUM_DEF_INTERNAL_H_
12454#define UPB_REFLECTION_ENUM_DEF_INTERNAL_H_
12455
12456
12457// Must be last.
12458
12459#ifdef __cplusplus
12460extern "C" {
12461#endif
12462
12463upb_EnumDef* _upb_EnumDef_At(const upb_EnumDef* e, int i);
12464bool _upb_EnumDef_Insert(upb_EnumDef* e, upb_EnumValueDef* v, upb_Arena* a);
12465const upb_MiniTableEnum* _upb_EnumDef_MiniTable(const upb_EnumDef* e);
12466
12467// Allocate and initialize an array of |n| enum defs.
Mike Kruskal232ecf42023-01-14 00:09:40 -080012468upb_EnumDef* _upb_EnumDefs_New(
12469 upb_DefBuilder* ctx, int n,
12470 const UPB_DESC(EnumDescriptorProto) * const* protos,
12471 const upb_MessageDef* containing_type);
Eric Salo8809a112022-11-21 13:01:06 -080012472
12473#ifdef __cplusplus
12474} /* extern "C" */
12475#endif
12476
12477
12478#endif /* UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ */
12479
12480#ifndef UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_
12481#define UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_
12482
12483
12484// Must be last.
12485
12486#ifdef __cplusplus
12487extern "C" {
12488#endif
12489
12490upb_EnumValueDef* _upb_EnumValueDef_At(const upb_EnumValueDef* v, int i);
12491
12492// Allocate and initialize an array of |n| enum value defs owned by |e|.
12493upb_EnumValueDef* _upb_EnumValueDefs_New(
12494 upb_DefBuilder* ctx, const char* prefix, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012495 const UPB_DESC(EnumValueDescriptorProto) * const* protos, upb_EnumDef* e,
Eric Salo8809a112022-11-21 13:01:06 -080012496 bool* is_sorted);
12497
12498const upb_EnumValueDef** _upb_EnumValueDefs_Sorted(const upb_EnumValueDef* v,
12499 int n, upb_Arena* a);
12500
12501#ifdef __cplusplus
12502} /* extern "C" */
12503#endif
12504
12505
12506#endif /* UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ */
12507
12508#ifndef UPB_REFLECTION_FIELD_DEF_INTERNAL_H_
12509#define UPB_REFLECTION_FIELD_DEF_INTERNAL_H_
12510
12511
12512// Must be last.
12513
12514#ifdef __cplusplus
12515extern "C" {
12516#endif
12517
12518upb_FieldDef* _upb_FieldDef_At(const upb_FieldDef* f, int i);
12519
12520const upb_MiniTableExtension* _upb_FieldDef_ExtensionMiniTable(
12521 const upb_FieldDef* f);
12522bool _upb_FieldDef_IsClosedEnum(const upb_FieldDef* f);
12523bool _upb_FieldDef_IsProto3Optional(const upb_FieldDef* f);
12524int _upb_FieldDef_LayoutIndex(const upb_FieldDef* f);
12525uint64_t _upb_FieldDef_Modifiers(const upb_FieldDef* f);
12526void _upb_FieldDef_Resolve(upb_DefBuilder* ctx, const char* prefix,
12527 upb_FieldDef* f);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070012528void _upb_FieldDef_BuildMiniTableExtension(upb_DefBuilder* ctx,
12529 const upb_FieldDef* f);
12530
12531// Allocate and initialize an array of |n| extensions (field defs).
12532upb_FieldDef* _upb_Extensions_New(
12533 upb_DefBuilder* ctx, int n,
12534 const UPB_DESC(FieldDescriptorProto) * const* protos, const char* prefix,
12535 upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012536
12537// Allocate and initialize an array of |n| field defs.
12538upb_FieldDef* _upb_FieldDefs_New(
12539 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012540 const UPB_DESC(FieldDescriptorProto) * const* protos, const char* prefix,
Eric Salo8809a112022-11-21 13:01:06 -080012541 upb_MessageDef* m, bool* is_sorted);
12542
12543// Allocate and return a list of pointers to the |n| field defs in |ff|,
12544// sorted by field number.
12545const upb_FieldDef** _upb_FieldDefs_Sorted(const upb_FieldDef* f, int n,
12546 upb_Arena* a);
12547
12548#ifdef __cplusplus
12549} /* extern "C" */
12550#endif
12551
12552
12553#endif /* UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ */
12554
12555#ifndef UPB_REFLECTION_FILE_DEF_INTERNAL_H_
12556#define UPB_REFLECTION_FILE_DEF_INTERNAL_H_
12557
12558
12559// Must be last.
12560
12561#ifdef __cplusplus
12562extern "C" {
12563#endif
12564
12565const upb_MiniTableExtension* _upb_FileDef_ExtensionMiniTable(
12566 const upb_FileDef* f, int i);
12567const int32_t* _upb_FileDef_PublicDependencyIndexes(const upb_FileDef* f);
12568const int32_t* _upb_FileDef_WeakDependencyIndexes(const upb_FileDef* f);
12569
12570// upb_FileDef_Package() returns "" if f->package is NULL, this does not.
12571const char* _upb_FileDef_RawPackage(const upb_FileDef* f);
12572
12573void _upb_FileDef_Create(upb_DefBuilder* ctx,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012574 const UPB_DESC(FileDescriptorProto) * file_proto);
Eric Salo8809a112022-11-21 13:01:06 -080012575
12576#ifdef __cplusplus
12577} /* extern "C" */
12578#endif
12579
12580
12581#endif /* UPB_REFLECTION_FILE_DEF_INTERNAL_H_ */
12582
12583#ifndef UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_
12584#define UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_
12585
12586
12587// Must be last.
12588
12589#ifdef __cplusplus
12590extern "C" {
12591#endif
12592
12593upb_MessageDef* _upb_MessageDef_At(const upb_MessageDef* m, int i);
12594bool _upb_MessageDef_InMessageSet(const upb_MessageDef* m);
12595bool _upb_MessageDef_Insert(upb_MessageDef* m, const char* name, size_t size,
12596 upb_value v, upb_Arena* a);
12597void _upb_MessageDef_InsertField(upb_DefBuilder* ctx, upb_MessageDef* m,
12598 const upb_FieldDef* f);
12599bool _upb_MessageDef_IsValidExtensionNumber(const upb_MessageDef* m, int n);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070012600void _upb_MessageDef_CreateMiniTable(upb_DefBuilder* ctx, upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012601void _upb_MessageDef_LinkMiniTable(upb_DefBuilder* ctx,
12602 const upb_MessageDef* m);
12603void _upb_MessageDef_Resolve(upb_DefBuilder* ctx, upb_MessageDef* m);
12604
12605// Allocate and initialize an array of |n| message defs.
12606upb_MessageDef* _upb_MessageDefs_New(
Mike Kruskal232ecf42023-01-14 00:09:40 -080012607 upb_DefBuilder* ctx, int n, const UPB_DESC(DescriptorProto) * const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080012608 const upb_MessageDef* containing_type);
12609
12610#ifdef __cplusplus
12611} /* extern "C" */
12612#endif
12613
12614
12615#endif /* UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ */
12616
12617#ifndef UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_
12618#define UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_
12619
12620
12621// Must be last.
12622
12623#ifdef __cplusplus
12624extern "C" {
12625#endif
12626
12627upb_ServiceDef* _upb_ServiceDef_At(const upb_ServiceDef* s, int i);
12628
12629// Allocate and initialize an array of |n| service defs.
12630upb_ServiceDef* _upb_ServiceDefs_New(
12631 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012632 const UPB_DESC(ServiceDescriptorProto) * const* protos);
Eric Salo8809a112022-11-21 13:01:06 -080012633
12634#ifdef __cplusplus
12635} /* extern "C" */
12636#endif
12637
12638
12639#endif /* UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ */
12640
12641#ifndef UPB_REFLECTION_DESC_STATE_INTERNAL_H_
12642#define UPB_REFLECTION_DESC_STATE_INTERNAL_H_
12643
12644
12645// Must be last.
12646
12647// Manages the storage for mini descriptor strings as they are being encoded.
12648// TODO(b/234740652): Move some of this state directly into the encoder, maybe.
12649typedef struct {
12650 upb_MtDataEncoder e;
12651 size_t bufsize;
12652 char* buf;
12653 char* ptr;
12654} upb_DescState;
12655
12656#ifdef __cplusplus
12657extern "C" {
12658#endif
12659
12660UPB_INLINE void _upb_DescState_Init(upb_DescState* d) {
12661 d->bufsize = kUpb_MtDataEncoder_MinSize * 2;
12662 d->buf = NULL;
12663 d->ptr = NULL;
12664}
12665
12666bool _upb_DescState_Grow(upb_DescState* d, upb_Arena* a);
12667
12668#ifdef __cplusplus
12669} /* extern "C" */
12670#endif
12671
12672
12673#endif /* UPB_REFLECTION_DESC_STATE_INTERNAL_H_ */
12674
12675#ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_
12676#define UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_
12677
12678
12679// IWYU pragma: private, include "upb/reflection/def.h"
12680
12681#ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_H_
12682#define UPB_REFLECTION_ENUM_RESERVED_RANGE_H_
12683
12684
12685// Must be last.
12686
12687#ifdef __cplusplus
12688extern "C" {
12689#endif
12690
12691int32_t upb_EnumReservedRange_Start(const upb_EnumReservedRange* r);
12692int32_t upb_EnumReservedRange_End(const upb_EnumReservedRange* r);
12693
12694#ifdef __cplusplus
12695} /* extern "C" */
12696#endif
12697
12698
12699#endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ */
12700
12701// Must be last.
12702
12703#ifdef __cplusplus
12704extern "C" {
12705#endif
12706
12707upb_EnumReservedRange* _upb_EnumReservedRange_At(const upb_EnumReservedRange* r,
12708 int i);
12709
12710// Allocate and initialize an array of |n| reserved ranges owned by |e|.
12711upb_EnumReservedRange* _upb_EnumReservedRanges_New(
12712 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012713 const UPB_DESC(EnumDescriptorProto_EnumReservedRange) * const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080012714 const upb_EnumDef* e);
12715
12716#ifdef __cplusplus
12717} /* extern "C" */
12718#endif
12719
12720
12721#endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ */
12722
12723#ifndef UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_
12724#define UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_
12725
12726
12727// Must be last.
12728
12729#ifdef __cplusplus
12730extern "C" {
12731#endif
12732
12733upb_ExtensionRange* _upb_ExtensionRange_At(const upb_ExtensionRange* r, int i);
12734
12735// Allocate and initialize an array of |n| extension ranges owned by |m|.
12736upb_ExtensionRange* _upb_ExtensionRanges_New(
12737 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012738 const UPB_DESC(DescriptorProto_ExtensionRange) * const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080012739 const upb_MessageDef* m);
12740
12741#ifdef __cplusplus
12742} /* extern "C" */
12743#endif
12744
12745
12746#endif /* UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ */
12747
12748#ifndef UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_
12749#define UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_
12750
12751
12752// Must be last.
12753
12754#ifdef __cplusplus
12755extern "C" {
12756#endif
12757
12758upb_OneofDef* _upb_OneofDef_At(const upb_OneofDef* o, int i);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070012759void _upb_OneofDef_Insert(upb_DefBuilder* ctx, upb_OneofDef* o,
12760 const upb_FieldDef* f, const char* name, size_t size);
Eric Salo8809a112022-11-21 13:01:06 -080012761
12762// Allocate and initialize an array of |n| oneof defs owned by |m|.
12763upb_OneofDef* _upb_OneofDefs_New(
12764 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012765 const UPB_DESC(OneofDescriptorProto) * const* protos, upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012766
12767size_t _upb_OneofDefs_Finalize(upb_DefBuilder* ctx, upb_MessageDef* m);
12768
12769#ifdef __cplusplus
12770} /* extern "C" */
12771#endif
12772
12773
12774#endif /* UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ */
12775
12776#ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_
12777#define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_
12778
12779
12780// IWYU pragma: private, include "upb/reflection/def.h"
12781
12782#ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_
12783#define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_
12784
12785
12786// Must be last.
12787
12788#ifdef __cplusplus
12789extern "C" {
12790#endif
12791
12792int32_t upb_MessageReservedRange_Start(const upb_MessageReservedRange* r);
12793int32_t upb_MessageReservedRange_End(const upb_MessageReservedRange* r);
12794
12795#ifdef __cplusplus
12796} /* extern "C" */
12797#endif
12798
12799
12800#endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ */
12801
12802// Must be last.
12803
12804#ifdef __cplusplus
12805extern "C" {
12806#endif
12807
12808upb_MessageReservedRange* _upb_MessageReservedRange_At(
12809 const upb_MessageReservedRange* r, int i);
12810
12811// Allocate and initialize an array of |n| reserved ranges owned by |m|.
12812upb_MessageReservedRange* _upb_MessageReservedRanges_New(
12813 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012814 const UPB_DESC(DescriptorProto_ReservedRange) * const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080012815 const upb_MessageDef* m);
12816
12817#ifdef __cplusplus
12818} /* extern "C" */
12819#endif
12820
12821
12822#endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ */
12823
12824#ifndef UPB_REFLECTION_METHOD_DEF_INTERNAL_H_
12825#define UPB_REFLECTION_METHOD_DEF_INTERNAL_H_
12826
12827
12828// Must be last.
12829
12830#ifdef __cplusplus
12831extern "C" {
12832#endif
12833
12834upb_MethodDef* _upb_MethodDef_At(const upb_MethodDef* m, int i);
12835
12836// Allocate and initialize an array of |n| method defs owned by |s|.
12837upb_MethodDef* _upb_MethodDefs_New(
12838 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012839 const UPB_DESC(MethodDescriptorProto) * const* protos, upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080012840
12841#ifdef __cplusplus
12842} /* extern "C" */
12843#endif
12844
12845
12846#endif /* UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ */
12847
Sandy Zhange3b09432023-08-07 09:30:02 -070012848#ifndef UPB_WIRE_INTERNAL_COMMON_H_
12849#define UPB_WIRE_INTERNAL_COMMON_H_
Eric Salo8809a112022-11-21 13:01:06 -080012850
12851// Must be last.
12852
12853// MessageSet wire format is:
12854// message MessageSet {
12855// repeated group Item = 1 {
12856// required int32 type_id = 2;
12857// required bytes message = 3;
12858// }
12859// }
12860
12861enum {
12862 kUpb_MsgSet_Item = 1,
12863 kUpb_MsgSet_TypeId = 2,
12864 kUpb_MsgSet_Message = 3,
12865};
12866
12867
Sandy Zhange3b09432023-08-07 09:30:02 -070012868#endif /* UPB_WIRE_INTERNAL_COMMON_H_ */
Eric Salo8809a112022-11-21 13:01:06 -080012869
12870/*
12871 * Internal implementation details of the decoder that are shared between
12872 * decode.c and decode_fast.c.
12873 */
12874
Sandy Zhange3b09432023-08-07 09:30:02 -070012875#ifndef UPB_WIRE_INTERNAL_DECODE_H_
12876#define UPB_WIRE_INTERNAL_DECODE_H_
Eric Salo8809a112022-11-21 13:01:06 -080012877
Eric Salo3f36a912022-12-05 14:12:25 -080012878#include "utf8_range.h"
Joshua Habermand3995ec2022-09-30 16:54:39 -070012879
12880// Must be last.
12881
12882#define DECODE_NOGROUP (uint32_t) - 1
12883
12884typedef struct upb_Decoder {
Eric Salo10505992022-12-12 12:16:36 -080012885 upb_EpsCopyInputStream input;
12886 const upb_ExtensionRegistry* extreg;
12887 const char* unknown; // Start of unknown data, preserve at buffer flip
12888 upb_Message* unknown_msg; // Pointer to preserve data to
12889 int depth; // Tracks recursion depth to bound stack usage.
12890 uint32_t end_group; // field number of END_GROUP tag, else DECODE_NOGROUP.
Joshua Habermand3995ec2022-09-30 16:54:39 -070012891 uint16_t options;
12892 bool missing_required;
Joshua Habermand3995ec2022-09-30 16:54:39 -070012893 upb_Arena arena;
Mike Kruskal232ecf42023-01-14 00:09:40 -080012894 upb_DecodeStatus status;
Joshua Habermand3995ec2022-09-30 16:54:39 -070012895 jmp_buf err;
12896
12897#ifndef NDEBUG
12898 const char* debug_tagstart;
12899 const char* debug_valstart;
12900#endif
12901} upb_Decoder;
12902
12903/* Error function that will abort decoding with longjmp(). We can't declare this
12904 * UPB_NORETURN, even though it is appropriate, because if we do then compilers
12905 * will "helpfully" refuse to tailcall to it
12906 * (see: https://stackoverflow.com/a/55657013), which will defeat a major goal
12907 * of our optimizations. That is also why we must declare it in a separate file,
12908 * otherwise the compiler will see that it calls longjmp() and deduce that it is
12909 * noreturn. */
12910const char* _upb_FastDecoder_ErrorJmp(upb_Decoder* d, int status);
12911
12912extern const uint8_t upb_utf8_offsets[];
12913
12914UPB_INLINE
12915bool _upb_Decoder_VerifyUtf8Inline(const char* ptr, int len) {
12916 const char* end = ptr + len;
12917
12918 // Check 8 bytes at a time for any non-ASCII char.
12919 while (end - ptr >= 8) {
12920 uint64_t data;
12921 memcpy(&data, ptr, 8);
12922 if (data & 0x8080808080808080) goto non_ascii;
12923 ptr += 8;
12924 }
12925
12926 // Check one byte at a time for non-ASCII.
12927 while (ptr < end) {
12928 if (*ptr & 0x80) goto non_ascii;
12929 ptr++;
12930 }
12931
12932 return true;
12933
12934non_ascii:
12935 return utf8_range2((const unsigned char*)ptr, end - ptr) == 0;
12936}
12937
12938const char* _upb_Decoder_CheckRequired(upb_Decoder* d, const char* ptr,
12939 const upb_Message* msg,
12940 const upb_MiniTable* l);
12941
12942/* x86-64 pointers always have the high 16 bits matching. So we can shift
12943 * left 8 and right 8 without loss of information. */
12944UPB_INLINE intptr_t decode_totable(const upb_MiniTable* tablep) {
12945 return ((intptr_t)tablep << 8) | tablep->table_mask;
12946}
12947
12948UPB_INLINE const upb_MiniTable* decode_totablep(intptr_t table) {
12949 return (const upb_MiniTable*)(table >> 8);
12950}
12951
Eric Salo10505992022-12-12 12:16:36 -080012952const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e,
12953 const char* ptr, int overrun);
12954
12955UPB_INLINE bool _upb_Decoder_IsDone(upb_Decoder* d, const char** ptr) {
Eric Salob7d54ac2022-12-29 11:59:42 -080012956 return upb_EpsCopyInputStream_IsDoneWithCallback(
12957 &d->input, ptr, &_upb_Decoder_IsDoneFallback);
Joshua Habermand3995ec2022-09-30 16:54:39 -070012958}
12959
Eric Salo10505992022-12-12 12:16:36 -080012960UPB_INLINE const char* _upb_Decoder_BufferFlipCallback(
12961 upb_EpsCopyInputStream* e, const char* old_end, const char* new_start) {
12962 upb_Decoder* d = (upb_Decoder*)e;
12963 if (!old_end) _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed);
Joshua Habermand3995ec2022-09-30 16:54:39 -070012964
Eric Salo10505992022-12-12 12:16:36 -080012965 if (d->unknown) {
12966 if (!_upb_Message_AddUnknown(d->unknown_msg, d->unknown,
12967 old_end - d->unknown, &d->arena)) {
12968 _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory);
12969 }
12970 d->unknown = new_start;
Joshua Habermand3995ec2022-09-30 16:54:39 -070012971 }
Eric Salo10505992022-12-12 12:16:36 -080012972 return new_start;
Joshua Habermand3995ec2022-09-30 16:54:39 -070012973}
12974
12975#if UPB_FASTTABLE
12976UPB_INLINE
12977const char* _upb_FastDecoder_TagDispatch(upb_Decoder* d, const char* ptr,
12978 upb_Message* msg, intptr_t table,
12979 uint64_t hasbits, uint64_t tag) {
12980 const upb_MiniTable* table_p = decode_totablep(table);
12981 uint8_t mask = table;
12982 uint64_t data;
12983 size_t idx = tag & mask;
12984 UPB_ASSUME((idx & 7) == 0);
12985 idx >>= 3;
12986 data = table_p->fasttable[idx].field_data ^ tag;
12987 UPB_MUSTTAIL return table_p->fasttable[idx].field_parser(d, ptr, msg, table,
12988 hasbits, data);
12989}
12990#endif
12991
12992UPB_INLINE uint32_t _upb_FastDecoder_LoadTag(const char* ptr) {
12993 uint16_t tag;
12994 memcpy(&tag, ptr, 2);
12995 return tag;
12996}
12997
Joshua Habermand3995ec2022-09-30 16:54:39 -070012998
Sandy Zhange3b09432023-08-07 09:30:02 -070012999#endif /* UPB_WIRE_INTERNAL_DECODE_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -070013000
Eric Salo8809a112022-11-21 13:01:06 -080013001// This should #undef all macros #defined in def.inc
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013002
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013003#undef UPB_SIZE
13004#undef UPB_PTR_AT
Joshua Habermandd69a482021-05-17 22:40:33 -070013005#undef UPB_MAPTYPE_STRING
Eric Salo3f36a912022-12-05 14:12:25 -080013006#undef UPB_EXPORT
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013007#undef UPB_INLINE
Eric Salo3f36a912022-12-05 14:12:25 -080013008#undef UPB_API
13009#undef UPB_API_INLINE
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013010#undef UPB_ALIGN_UP
13011#undef UPB_ALIGN_DOWN
13012#undef UPB_ALIGN_MALLOC
13013#undef UPB_ALIGN_OF
Joshua Habermand3995ec2022-09-30 16:54:39 -070013014#undef UPB_MALLOC_ALIGN
Joshua Habermandd69a482021-05-17 22:40:33 -070013015#undef UPB_LIKELY
13016#undef UPB_UNLIKELY
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013017#undef UPB_FORCEINLINE
13018#undef UPB_NOINLINE
13019#undef UPB_NORETURN
Joshua Habermandd69a482021-05-17 22:40:33 -070013020#undef UPB_PRINTF
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013021#undef UPB_MAX
13022#undef UPB_MIN
13023#undef UPB_UNUSED
13024#undef UPB_ASSUME
13025#undef UPB_ASSERT
13026#undef UPB_UNREACHABLE
Joshua Habermandd69a482021-05-17 22:40:33 -070013027#undef UPB_SETJMP
13028#undef UPB_LONGJMP
13029#undef UPB_PTRADD
13030#undef UPB_MUSTTAIL
13031#undef UPB_FASTTABLE_SUPPORTED
Mike Kruskal232ecf42023-01-14 00:09:40 -080013032#undef UPB_FASTTABLE_MASK
Joshua Habermandd69a482021-05-17 22:40:33 -070013033#undef UPB_FASTTABLE
13034#undef UPB_FASTTABLE_INIT
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013035#undef UPB_POISON_MEMORY_REGION
13036#undef UPB_UNPOISON_MEMORY_REGION
13037#undef UPB_ASAN
Sandy Zhange3b09432023-08-07 09:30:02 -070013038#undef UPB_ASAN_GUARD_SIZE
13039#undef UPB_CLANG_ASAN
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070013040#undef UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3
Joshua Habermand3995ec2022-09-30 16:54:39 -070013041#undef UPB_DEPRECATED
13042#undef UPB_GNUC_MIN
Mike Kruskal232ecf42023-01-14 00:09:40 -080013043#undef UPB_DESCRIPTOR_UPB_H_FILENAME
13044#undef UPB_DESC
13045#undef UPB_IS_GOOGLE3
Eric Salodfb71552023-03-22 12:35:09 -070013046#undef UPB_ATOMIC
13047#undef UPB_USE_C11_ATOMICS
Deanna Garciac7d979d2023-04-14 17:22:13 -070013048#undef UPB_PRIVATE