blob: 1fbbb1870eff5511909a10afb68a0f29fb451f55 [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 *
Protobuf Team Bot06310352023-09-26 21:54:58 +000012 * #include "upb/foobar.h"
13 * #include "upb/baz.h"
Joshua Habermandd69a482021-05-17 22:40:33 -070014 *
15 * // MUST be last included header.
Protobuf Team Bot06310352023-09-26 21:54:58 +000016 * #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.
Protobuf Team Bot06310352023-09-26 21:54:58 +000022 * #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
Protobuf Team Botce9dcc22023-11-03 22:38:26 +0000323#define UPB_DESC_MINITABLE(sym) &proto2__##sym##_msg_init
324#elif defined(UPB_BOOTSTRAP_STAGE0)
325#define UPB_DESC(sym) google_protobuf_##sym
326#define UPB_DESC_MINITABLE(sym) google__protobuf__##sym##_msg_init()
Mike Kruskal232ecf42023-01-14 00:09:40 -0800327#else
328#define UPB_DESC(sym) google_protobuf_##sym
Protobuf Team Botce9dcc22023-11-03 22:38:26 +0000329#define UPB_DESC_MINITABLE(sym) &google__protobuf__##sym##_msg_init
Mike Kruskal232ecf42023-01-14 00:09:40 -0800330#endif
331
Eric Salo8809a112022-11-21 13:01:06 -0800332#ifndef UPB_BASE_STATUS_H_
333#define UPB_BASE_STATUS_H_
334
335#include <stdarg.h>
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700336
337// Must be last.
338
Eric Salo8809a112022-11-21 13:01:06 -0800339#define _kUpb_Status_MaxMessage 127
340
341typedef struct {
342 bool ok;
343 char msg[_kUpb_Status_MaxMessage]; // Error message; NULL-terminated.
344} upb_Status;
345
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700346#ifdef __cplusplus
347extern "C" {
348#endif
349
Eric Salo3f36a912022-12-05 14:12:25 -0800350UPB_API const char* upb_Status_ErrorMessage(const upb_Status* status);
351UPB_API bool upb_Status_IsOk(const upb_Status* status);
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700352
Eric Salo8809a112022-11-21 13:01:06 -0800353// These are no-op if |status| is NULL.
Eric Salo3f36a912022-12-05 14:12:25 -0800354UPB_API void upb_Status_Clear(upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -0800355void upb_Status_SetErrorMessage(upb_Status* status, const char* msg);
356void upb_Status_SetErrorFormat(upb_Status* status, const char* fmt, ...)
357 UPB_PRINTF(2, 3);
358void upb_Status_VSetErrorFormat(upb_Status* status, const char* fmt,
359 va_list args) UPB_PRINTF(2, 0);
360void upb_Status_VAppendErrorFormat(upb_Status* status, const char* fmt,
361 va_list args) UPB_PRINTF(2, 0);
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700362
363#ifdef __cplusplus
364} /* extern "C" */
365#endif
366
367
Eric Salo8809a112022-11-21 13:01:06 -0800368#endif /* UPB_BASE_STATUS_H_ */
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700369
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000370#ifndef UPB_GENERATED_CODE_SUPPORT_H_
371#define UPB_GENERATED_CODE_SUPPORT_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -0700372
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000373// IWYU pragma: begin_exports
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800374
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000375#ifndef UPB_MESSAGE_ACCESSORS_H_
376#define UPB_MESSAGE_ACCESSORS_H_
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000377
Joshua Habermand3995ec2022-09-30 16:54:39 -0700378
Eric Salo8809a112022-11-21 13:01:06 -0800379#ifndef UPB_BASE_DESCRIPTOR_CONSTANTS_H_
380#define UPB_BASE_DESCRIPTOR_CONSTANTS_H_
381
Eric Salodfb71552023-03-22 12:35:09 -0700382// Must be last.
383
Eric Salo8809a112022-11-21 13:01:06 -0800384// The types a field can have. Note that this list is not identical to the
385// types defined in descriptor.proto, which gives INT32 and SINT32 separate
386// types (we distinguish the two with the "integer encoding" enum below).
387// This enum is an internal convenience only and has no meaning outside of upb.
388typedef enum {
389 kUpb_CType_Bool = 1,
390 kUpb_CType_Float = 2,
391 kUpb_CType_Int32 = 3,
392 kUpb_CType_UInt32 = 4,
Protobuf Team Bot986cbb62023-09-19 15:03:51 +0000393 kUpb_CType_Enum = 5, // Enum values are int32. TODO: rename
Eric Salo8809a112022-11-21 13:01:06 -0800394 kUpb_CType_Message = 6,
395 kUpb_CType_Double = 7,
396 kUpb_CType_Int64 = 8,
397 kUpb_CType_UInt64 = 9,
398 kUpb_CType_String = 10,
399 kUpb_CType_Bytes = 11
400} upb_CType;
401
402// The repeated-ness of each field; this matches descriptor.proto.
403typedef enum {
404 kUpb_Label_Optional = 1,
405 kUpb_Label_Required = 2,
406 kUpb_Label_Repeated = 3
407} upb_Label;
408
409// Descriptor types, as defined in descriptor.proto.
410typedef enum {
411 kUpb_FieldType_Double = 1,
412 kUpb_FieldType_Float = 2,
413 kUpb_FieldType_Int64 = 3,
414 kUpb_FieldType_UInt64 = 4,
415 kUpb_FieldType_Int32 = 5,
416 kUpb_FieldType_Fixed64 = 6,
417 kUpb_FieldType_Fixed32 = 7,
418 kUpb_FieldType_Bool = 8,
419 kUpb_FieldType_String = 9,
420 kUpb_FieldType_Group = 10,
421 kUpb_FieldType_Message = 11,
422 kUpb_FieldType_Bytes = 12,
423 kUpb_FieldType_UInt32 = 13,
424 kUpb_FieldType_Enum = 14,
425 kUpb_FieldType_SFixed32 = 15,
426 kUpb_FieldType_SFixed64 = 16,
427 kUpb_FieldType_SInt32 = 17,
428 kUpb_FieldType_SInt64 = 18,
429} upb_FieldType;
430
431#define kUpb_FieldType_SizeOf 19
432
Eric Salodfb71552023-03-22 12:35:09 -0700433#ifdef __cplusplus
434extern "C" {
435#endif
436
Protobuf Team Bot7c687212023-11-14 03:01:42 +0000437// Convert from upb_FieldType to upb_CType
438UPB_INLINE upb_CType upb_FieldType_CType(upb_FieldType field_type) {
439 static const upb_CType c_type[] = {
440 kUpb_CType_Double, // kUpb_FieldType_Double
441 kUpb_CType_Float, // kUpb_FieldType_Float
442 kUpb_CType_Int64, // kUpb_FieldType_Int64
443 kUpb_CType_UInt64, // kUpb_FieldType_UInt64
444 kUpb_CType_Int32, // kUpb_FieldType_Int32
445 kUpb_CType_UInt64, // kUpb_FieldType_Fixed64
446 kUpb_CType_UInt32, // kUpb_FieldType_Fixed32
447 kUpb_CType_Bool, // kUpb_FieldType_Bool
448 kUpb_CType_String, // kUpb_FieldType_String
449 kUpb_CType_Message, // kUpb_FieldType_Group
450 kUpb_CType_Message, // kUpb_FieldType_Message
451 kUpb_CType_Bytes, // kUpb_FieldType_Bytes
452 kUpb_CType_UInt32, // kUpb_FieldType_UInt32
453 kUpb_CType_Enum, // kUpb_FieldType_Enum
454 kUpb_CType_Int32, // kUpb_FieldType_SFixed32
455 kUpb_CType_Int64, // kUpb_FieldType_SFixed64
456 kUpb_CType_Int32, // kUpb_FieldType_SInt32
457 kUpb_CType_Int64, // kUpb_FieldType_SInt64
458 };
459
460 // -1 here because the enum is one-based but the table is zero-based.
461 return c_type[field_type - 1];
462}
463
464UPB_INLINE bool upb_FieldType_IsPackable(upb_FieldType field_type) {
Eric Salodfb71552023-03-22 12:35:09 -0700465 // clang-format off
466 const unsigned kUnpackableTypes =
467 (1 << kUpb_FieldType_String) |
468 (1 << kUpb_FieldType_Bytes) |
469 (1 << kUpb_FieldType_Message) |
470 (1 << kUpb_FieldType_Group);
471 // clang-format on
Protobuf Team Bot7c687212023-11-14 03:01:42 +0000472 return (1 << field_type) & ~kUnpackableTypes;
Eric Salodfb71552023-03-22 12:35:09 -0700473}
474
475#ifdef __cplusplus
476} /* extern "C" */
477#endif
478
479
Eric Salo8809a112022-11-21 13:01:06 -0800480#endif /* UPB_BASE_DESCRIPTOR_CONSTANTS_H_ */
481
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000482#ifndef UPB_MESSAGE_ARRAY_H_
483#define UPB_MESSAGE_ARRAY_H_
484
485#include <stddef.h>
486
487
Eric Salo8809a112022-11-21 13:01:06 -0800488/* upb_Arena is a specific allocator implementation that uses arena allocation.
489 * The user provides an allocator that will be used to allocate the underlying
490 * arena blocks. Arenas by nature do not require the individual allocations
491 * to be freed. However the Arena does allow users to register cleanup
492 * functions that will run when the arena is destroyed.
Joshua Habermandd69a482021-05-17 22:40:33 -0700493 *
Eric Salo8809a112022-11-21 13:01:06 -0800494 * A upb_Arena is *not* thread-safe.
495 *
496 * You could write a thread-safe arena allocator that satisfies the
497 * upb_alloc interface, but it would not be as efficient for the
498 * single-threaded case. */
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800499
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700500#ifndef UPB_MEM_ARENA_H_
501#define UPB_MEM_ARENA_H_
Joshua Habermandd69a482021-05-17 22:40:33 -0700502
Adam Cozzette7d5592e2023-08-23 12:15:26 -0700503#include <stddef.h>
504#include <stdint.h>
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800505#include <string.h>
506
507
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700508#ifndef UPB_MEM_ALLOC_H_
509#define UPB_MEM_ALLOC_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -0700510
511// Must be last.
512
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800513#ifdef __cplusplus
514extern "C" {
515#endif
516
Joshua Habermand3995ec2022-09-30 16:54:39 -0700517typedef struct upb_alloc upb_alloc;
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800518
Joshua Habermand3995ec2022-09-30 16:54:39 -0700519/* A combined `malloc()`/`free()` function.
520 * If `size` is 0 then the function acts like `free()`, otherwise it acts like
521 * `realloc()`. Only `oldsize` bytes from a previous allocation are
522 * preserved. */
523typedef void* upb_alloc_func(upb_alloc* alloc, void* ptr, size_t oldsize,
524 size_t size);
525
526/* A upb_alloc is a possibly-stateful allocator object.
527 *
528 * It could either be an arena allocator (which doesn't require individual
529 * `free()` calls) or a regular `malloc()` (which does). The client must
530 * therefore free memory unless it knows that the allocator is an arena
531 * allocator. */
532struct upb_alloc {
533 upb_alloc_func* func;
534};
535
536UPB_INLINE void* upb_malloc(upb_alloc* alloc, size_t size) {
537 UPB_ASSERT(alloc);
538 return alloc->func(alloc, NULL, 0, size);
539}
540
541UPB_INLINE void* upb_realloc(upb_alloc* alloc, void* ptr, size_t oldsize,
542 size_t size) {
543 UPB_ASSERT(alloc);
544 return alloc->func(alloc, ptr, oldsize, size);
545}
546
547UPB_INLINE void upb_free(upb_alloc* alloc, void* ptr) {
548 UPB_ASSERT(alloc);
549 alloc->func(alloc, ptr, 0, 0);
550}
551
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700552// The global allocator used by upb. Uses the standard malloc()/free().
Joshua Habermand3995ec2022-09-30 16:54:39 -0700553
554extern upb_alloc upb_alloc_global;
555
556/* Functions that hard-code the global malloc.
557 *
558 * We still get benefit because we can put custom logic into our global
559 * allocator, like injecting out-of-memory faults in debug/testing builds. */
560
561UPB_INLINE void* upb_gmalloc(size_t size) {
562 return upb_malloc(&upb_alloc_global, size);
563}
564
565UPB_INLINE void* upb_grealloc(void* ptr, size_t oldsize, size_t size) {
566 return upb_realloc(&upb_alloc_global, ptr, oldsize, size);
567}
568
569UPB_INLINE void upb_gfree(void* ptr) { upb_free(&upb_alloc_global, ptr); }
570
571#ifdef __cplusplus
572} /* extern "C" */
573#endif
574
575
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700576#endif /* UPB_MEM_ALLOC_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -0700577
578// Must be last.
579
Joshua Habermand3995ec2022-09-30 16:54:39 -0700580typedef struct upb_Arena upb_Arena;
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800581
582typedef struct {
Joshua Habermand3995ec2022-09-30 16:54:39 -0700583 char *ptr, *end;
584} _upb_ArenaHead;
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800585
Eric Salo8809a112022-11-21 13:01:06 -0800586#ifdef __cplusplus
587extern "C" {
588#endif
589
Mike Kruskal3bc50492022-12-01 13:34:12 -0800590// Creates an arena from the given initial block (if any -- n may be 0).
591// Additional blocks will be allocated from |alloc|. If |alloc| is NULL, this
592// is a fixed-size arena and cannot grow.
Eric Salo3f36a912022-12-05 14:12:25 -0800593UPB_API upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc);
Mike Kruskal3bc50492022-12-01 13:34:12 -0800594
Eric Salo3f36a912022-12-05 14:12:25 -0800595UPB_API void upb_Arena_Free(upb_Arena* a);
Eric Salo3f36a912022-12-05 14:12:25 -0800596UPB_API bool upb_Arena_Fuse(upb_Arena* a, upb_Arena* b);
597
Protobuf Team Bot1fb26f22023-10-19 01:48:15 +0000598bool upb_Arena_IncRefFor(upb_Arena* arena, const void* owner);
Protobuf Team Bot777d6a92023-10-06 23:52:49 +0000599void upb_Arena_DecRefFor(upb_Arena* arena, const void* owner);
600
Joshua Habermand3995ec2022-09-30 16:54:39 -0700601void* _upb_Arena_SlowMalloc(upb_Arena* a, size_t size);
602size_t upb_Arena_SpaceAllocated(upb_Arena* arena);
603uint32_t upb_Arena_DebugRefCount(upb_Arena* arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800604
Joshua Habermand3995ec2022-09-30 16:54:39 -0700605UPB_INLINE size_t _upb_ArenaHas(upb_Arena* a) {
606 _upb_ArenaHead* h = (_upb_ArenaHead*)a;
607 return (size_t)(h->end - h->ptr);
608}
609
Eric Salo3f36a912022-12-05 14:12:25 -0800610UPB_API_INLINE void* upb_Arena_Malloc(upb_Arena* a, size_t size) {
Eric Salo8809a112022-11-21 13:01:06 -0800611 size = UPB_ALIGN_MALLOC(size);
Sandy Zhange3b09432023-08-07 09:30:02 -0700612 size_t span = size + UPB_ASAN_GUARD_SIZE;
613 if (UPB_UNLIKELY(_upb_ArenaHas(a) < span)) {
Eric Salo8809a112022-11-21 13:01:06 -0800614 return _upb_Arena_SlowMalloc(a, size);
615 }
616
617 // We have enough space to do a fast malloc.
Joshua Habermand3995ec2022-09-30 16:54:39 -0700618 _upb_ArenaHead* h = (_upb_ArenaHead*)a;
619 void* ret = h->ptr;
620 UPB_ASSERT(UPB_ALIGN_MALLOC((uintptr_t)ret) == (uintptr_t)ret);
621 UPB_ASSERT(UPB_ALIGN_MALLOC(size) == size);
622 UPB_UNPOISON_MEMORY_REGION(ret, size);
623
Sandy Zhange3b09432023-08-07 09:30:02 -0700624 h->ptr += span;
Joshua Habermand3995ec2022-09-30 16:54:39 -0700625
626 return ret;
627}
628
Joshua Habermand3995ec2022-09-30 16:54:39 -0700629// Shrinks the last alloc from arena.
630// REQUIRES: (ptr, oldsize) was the last malloc/realloc from this arena.
631// We could also add a upb_Arena_TryShrinkLast() which is simply a no-op if
632// this was not the last alloc.
Eric Salo3f36a912022-12-05 14:12:25 -0800633UPB_API_INLINE void upb_Arena_ShrinkLast(upb_Arena* a, void* ptr,
634 size_t oldsize, size_t size) {
Joshua Habermand3995ec2022-09-30 16:54:39 -0700635 _upb_ArenaHead* h = (_upb_ArenaHead*)a;
636 oldsize = UPB_ALIGN_MALLOC(oldsize);
637 size = UPB_ALIGN_MALLOC(size);
Sandy Zhange3b09432023-08-07 09:30:02 -0700638 // Must be the last alloc.
639 UPB_ASSERT((char*)ptr + oldsize == h->ptr - UPB_ASAN_GUARD_SIZE);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700640 UPB_ASSERT(size <= oldsize);
641 h->ptr = (char*)ptr + size;
642}
643
Eric Salo3f36a912022-12-05 14:12:25 -0800644UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize,
645 size_t size) {
Joshua Habermand3995ec2022-09-30 16:54:39 -0700646 _upb_ArenaHead* h = (_upb_ArenaHead*)a;
647 oldsize = UPB_ALIGN_MALLOC(oldsize);
648 size = UPB_ALIGN_MALLOC(size);
649 bool is_most_recent_alloc = (uintptr_t)ptr + oldsize == (uintptr_t)h->ptr;
650
651 if (is_most_recent_alloc) {
652 ptrdiff_t diff = size - oldsize;
653 if ((ptrdiff_t)_upb_ArenaHas(a) >= diff) {
654 h->ptr += diff;
655 return ptr;
656 }
657 } else if (size <= oldsize) {
658 return ptr;
659 }
660
661 void* ret = upb_Arena_Malloc(a, size);
662
663 if (ret && oldsize > 0) {
664 memcpy(ret, ptr, UPB_MIN(oldsize, size));
665 }
666
667 return ret;
668}
669
Eric Salo3f36a912022-12-05 14:12:25 -0800670UPB_API_INLINE upb_Arena* upb_Arena_New(void) {
Joshua Habermand3995ec2022-09-30 16:54:39 -0700671 return upb_Arena_Init(NULL, 0, &upb_alloc_global);
672}
673
674#ifdef __cplusplus
675} /* extern "C" */
676#endif
677
678
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700679#endif /* UPB_MEM_ARENA_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -0700680
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000681// Users should include array.h or map.h instead.
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000682// IWYU pragma: private, include "upb/message/array.h"
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000683
684#ifndef UPB_MESSAGE_VALUE_H_
685#define UPB_MESSAGE_VALUE_H_
686
687#include <stdint.h>
688
689#ifndef UPB_BASE_STRING_VIEW_H_
690#define UPB_BASE_STRING_VIEW_H_
691
692#include <string.h>
693
Joshua Habermand3995ec2022-09-30 16:54:39 -0700694// Must be last.
695
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000696#define UPB_STRINGVIEW_INIT(ptr, len) \
697 { ptr, len }
698
699#define UPB_STRINGVIEW_FORMAT "%.*s"
700#define UPB_STRINGVIEW_ARGS(view) (int)(view).size, (view).data
701
702// LINT.IfChange(struct_definition)
703typedef struct {
704 const char* data;
705 size_t size;
706} upb_StringView;
707// LINT.ThenChange(
708// GoogleInternalName0,
709// //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string
710// )
711
712#ifdef __cplusplus
713extern "C" {
714#endif
715
716UPB_API_INLINE upb_StringView upb_StringView_FromDataAndSize(const char* data,
717 size_t size) {
718 upb_StringView ret;
719 ret.data = data;
720 ret.size = size;
721 return ret;
722}
723
724UPB_INLINE upb_StringView upb_StringView_FromString(const char* data) {
725 return upb_StringView_FromDataAndSize(data, strlen(data));
726}
727
728UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) {
729 return a.size == b.size && memcmp(a.data, b.data, a.size) == 0;
730}
731
732#ifdef __cplusplus
733} /* extern "C" */
734#endif
735
736
737#endif /* UPB_BASE_STRING_VIEW_H_ */
738
739#ifndef UPB_MINI_TABLE_TYPES_H_
740#define UPB_MINI_TABLE_TYPES_H_
741
742#include <stdint.h>
743
744
745#ifndef UPB_MESSAGE_TYPES_H_
746#define UPB_MESSAGE_TYPES_H_
747
748// This typedef is in a leaf header to resolve a circular dependency between
749// messages and mini tables.
750typedef void upb_Message;
751
752#endif /* UPB_MESSAGE_TYPES_H_ */
753
754// Must be last.
755
756#ifdef __cplusplus
757extern "C" {
758#endif
759
760// When a upb_Message* is stored in a message, array, or map, it is stored in a
761// tagged form. If the tag bit is set, the referenced upb_Message is of type
762// _kUpb_MiniTable_Empty (a sentinel message type with no fields) instead of
763// that field's true message type. This forms the basis of what we call
764// "dynamic tree shaking."
765//
766// See the documentation for kUpb_DecodeOption_ExperimentalAllowUnlinked for
767// more information.
768typedef uintptr_t upb_TaggedMessagePtr;
769
770// Internal-only because empty messages cannot be created by the user.
771UPB_INLINE upb_TaggedMessagePtr _upb_TaggedMessagePtr_Pack(upb_Message* ptr,
772 bool empty) {
773 UPB_ASSERT(((uintptr_t)ptr & 1) == 0);
774 return (uintptr_t)ptr | (empty ? 1 : 0);
775}
776
777// Users who enable unlinked sub-messages must use this to test whether a
778// message is empty before accessing it. If a message is empty, it must be
779// first promoted using the interfaces in message/promote.h.
780UPB_INLINE bool upb_TaggedMessagePtr_IsEmpty(upb_TaggedMessagePtr ptr) {
781 return ptr & 1;
782}
783
784UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetMessage(
785 upb_TaggedMessagePtr ptr) {
786 return (upb_Message*)(ptr & ~(uintptr_t)1);
787}
788
789UPB_INLINE upb_Message* upb_TaggedMessagePtr_GetNonEmptyMessage(
790 upb_TaggedMessagePtr ptr) {
791 UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(ptr));
792 return _upb_TaggedMessagePtr_GetMessage(ptr);
793}
794
795UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetEmptyMessage(
796 upb_TaggedMessagePtr ptr) {
797 UPB_ASSERT(upb_TaggedMessagePtr_IsEmpty(ptr));
798 return _upb_TaggedMessagePtr_GetMessage(ptr);
799}
800
801#ifdef __cplusplus
802} /* extern "C" */
803#endif
804
805
806#endif /* UPB_MINI_TABLE_TYPES_H_ */
807
808typedef union {
809 bool bool_val;
810 float float_val;
811 double double_val;
812 int32_t int32_val;
813 int64_t int64_val;
814 uint32_t uint32_val;
815 uint64_t uint64_val;
816 const struct upb_Array* array_val;
817 const struct upb_Map* map_val;
818 const upb_Message* msg_val;
819 upb_StringView str_val;
820
821 // EXPERIMENTAL: A tagged upb_Message*. Users must use this instead of
822 // msg_val if unlinked sub-messages may possibly be in use. See the
823 // documentation in kUpb_DecodeOption_ExperimentalAllowUnlinked for more
824 // information.
825 upb_TaggedMessagePtr tagged_msg_val;
826} upb_MessageValue;
827
828typedef union {
829 struct upb_Array* array;
830 struct upb_Map* map;
831 upb_Message* msg;
832} upb_MutableMessageValue;
833
834#endif /* UPB_MESSAGE_VALUE_H_ */
835
836// Must be last.
837
838typedef struct upb_Array upb_Array;
839
Joshua Habermand3995ec2022-09-30 16:54:39 -0700840#ifdef __cplusplus
841extern "C" {
842#endif
843
Eric Salob598b2d2022-12-22 23:14:27 -0800844// Creates a new array on the given arena that holds elements of this type.
845UPB_API upb_Array* upb_Array_New(upb_Arena* a, upb_CType type);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700846
Eric Salob598b2d2022-12-22 23:14:27 -0800847// Returns the number of elements in the array.
848UPB_API size_t upb_Array_Size(const upb_Array* arr);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700849
Eric Salob598b2d2022-12-22 23:14:27 -0800850// Returns the given element, which must be within the array's current size.
851UPB_API upb_MessageValue upb_Array_Get(const upb_Array* arr, size_t i);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700852
Eric Salob598b2d2022-12-22 23:14:27 -0800853// Sets the given element, which must be within the array's current size.
854UPB_API void upb_Array_Set(upb_Array* arr, size_t i, upb_MessageValue val);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700855
Eric Salob598b2d2022-12-22 23:14:27 -0800856// Appends an element to the array. Returns false on allocation failure.
857UPB_API bool upb_Array_Append(upb_Array* array, upb_MessageValue val,
858 upb_Arena* arena);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700859
Eric Salob598b2d2022-12-22 23:14:27 -0800860// Moves elements within the array using memmove().
861// Like memmove(), the source and destination elements may be overlapping.
862UPB_API void upb_Array_Move(upb_Array* array, size_t dst_idx, size_t src_idx,
863 size_t count);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700864
Eric Salob598b2d2022-12-22 23:14:27 -0800865// Inserts one or more empty elements into the array.
866// Existing elements are shifted right.
867// The new elements have undefined state and must be set with `upb_Array_Set()`.
868// REQUIRES: `i <= upb_Array_Size(arr)`
869UPB_API bool upb_Array_Insert(upb_Array* array, size_t i, size_t count,
870 upb_Arena* arena);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700871
Eric Salob598b2d2022-12-22 23:14:27 -0800872// Deletes one or more elements from the array.
873// Existing elements are shifted left.
874// REQUIRES: `i + count <= upb_Array_Size(arr)`
875UPB_API void upb_Array_Delete(upb_Array* array, size_t i, size_t count);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700876
Eric Salob598b2d2022-12-22 23:14:27 -0800877// Changes the size of a vector. New elements are initialized to NULL/0.
878// Returns false on allocation failure.
879UPB_API bool upb_Array_Resize(upb_Array* array, size_t size, upb_Arena* arena);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700880
Jie Luo3560e232023-06-12 00:33:50 -0700881// Returns pointer to array data.
882UPB_API const void* upb_Array_DataPtr(const upb_Array* arr);
883
884// Returns mutable pointer to array data.
885UPB_API void* upb_Array_MutableDataPtr(upb_Array* arr);
886
Joshua Habermand3995ec2022-09-30 16:54:39 -0700887#ifdef __cplusplus
888} /* extern "C" */
889#endif
890
891
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000892#endif /* UPB_MESSAGE_ARRAY_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -0700893
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000894#ifndef UPB_MESSAGE_INTERNAL_ACCESSORS_H_
895#define UPB_MESSAGE_INTERNAL_ACCESSORS_H_
Protobuf Team Botdcc1f612023-09-05 21:56:25 +0000896
Protobuf Team Bot7c687212023-11-14 03:01:42 +0000897#include <stddef.h>
898#include <stdint.h>
899#include <string.h>
900
Protobuf Team Botdcc1f612023-09-05 21:56:25 +0000901
Adam Cozzette8059da22023-08-16 07:57:14 -0700902#ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_
903#define UPB_MESSAGE_INTERNAL_EXTENSION_H_
Mike Kruskal3bc50492022-12-01 13:34:12 -0800904
905
Deanna Garciabd6a0cf2023-04-20 10:30:44 -0700906// Public APIs for message operations that do not depend on the schema.
Eric Salo8809a112022-11-21 13:01:06 -0800907//
Deanna Garciabd6a0cf2023-04-20 10:30:44 -0700908// MiniTable-based accessors live in accessors.h.
Eric Salo8809a112022-11-21 13:01:06 -0800909
910#ifndef UPB_MESSAGE_MESSAGE_H_
911#define UPB_MESSAGE_MESSAGE_H_
912
Protobuf Team Bot75af7f92023-09-06 18:07:53 +0000913#include <stddef.h>
914
Eric Salo8809a112022-11-21 13:01:06 -0800915
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000916#ifndef UPB_MINI_TABLE_MESSAGE_H_
917#define UPB_MINI_TABLE_MESSAGE_H_
918
919
920#ifndef UPB_MINI_TABLE_ENUM_H_
921#define UPB_MINI_TABLE_ENUM_H_
922
923
924#ifndef UPB_MINI_TABLE_INTERNAL_ENUM_H_
925#define UPB_MINI_TABLE_INTERNAL_ENUM_H_
926
927#include <stdint.h>
928
929// Must be last.
930
931struct upb_MiniTableEnum {
932 uint32_t mask_limit; // Limit enum value that can be tested with mask.
933 uint32_t value_count; // Number of values after the bitfield.
934 uint32_t data[]; // Bitmask + enumerated values follow.
935};
936
937typedef enum {
938 _kUpb_FastEnumCheck_ValueIsInEnum = 0,
939 _kUpb_FastEnumCheck_ValueIsNotInEnum = 1,
940 _kUpb_FastEnumCheck_CannotCheckFast = 2,
941} _kUpb_FastEnumCheck_Status;
942
943#ifdef __cplusplus
944extern "C" {
945#endif
946
947UPB_INLINE _kUpb_FastEnumCheck_Status _upb_MiniTable_CheckEnumValueFast(
948 const struct upb_MiniTableEnum* e, uint32_t val) {
949 if (UPB_UNLIKELY(val >= 64)) return _kUpb_FastEnumCheck_CannotCheckFast;
950 uint64_t mask = e->data[0] | ((uint64_t)e->data[1] << 32);
951 return (mask & (1ULL << val)) ? _kUpb_FastEnumCheck_ValueIsInEnum
952 : _kUpb_FastEnumCheck_ValueIsNotInEnum;
953}
954
955UPB_INLINE bool _upb_MiniTable_CheckEnumValueSlow(
956 const struct upb_MiniTableEnum* e, uint32_t val) {
957 if (val < e->mask_limit) return e->data[val / 32] & (1ULL << (val % 32));
958 // OPT: binary search long lists?
959 const uint32_t* start = &e->data[e->mask_limit / 32];
960 const uint32_t* limit = &e->data[(e->mask_limit / 32) + e->value_count];
961 for (const uint32_t* p = start; p < limit; p++) {
962 if (*p == val) return true;
963 }
964 return false;
965}
966
967#ifdef __cplusplus
968} /* extern "C" */
969#endif
970
971
972#endif /* UPB_MINI_TABLE_INTERNAL_ENUM_H_ */
973
974// Must be last
975
976typedef struct upb_MiniTableEnum upb_MiniTableEnum;
977
Protobuf Team Bot450e0652023-09-21 17:36:36 +0000978#ifdef __cplusplus
979extern "C" {
980#endif
981
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000982// Validates enum value against range defined by enum mini table.
983UPB_INLINE bool upb_MiniTableEnum_CheckValue(const struct upb_MiniTableEnum* e,
984 uint32_t val) {
985 _kUpb_FastEnumCheck_Status status = _upb_MiniTable_CheckEnumValueFast(e, val);
986 if (UPB_UNLIKELY(status == _kUpb_FastEnumCheck_CannotCheckFast)) {
987 return _upb_MiniTable_CheckEnumValueSlow(e, val);
988 }
989 return status == _kUpb_FastEnumCheck_ValueIsInEnum ? true : false;
990}
991
Protobuf Team Bot450e0652023-09-21 17:36:36 +0000992#ifdef __cplusplus
993} /* extern "C" */
994#endif
995
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000996
997#endif /* UPB_MINI_TABLE_ENUM_H_ */
998
999#ifndef UPB_MINI_TABLE_FIELD_H_
1000#define UPB_MINI_TABLE_FIELD_H_
1001
1002
1003#ifndef UPB_MINI_TABLE_INTERNAL_FIELD_H_
1004#define UPB_MINI_TABLE_INTERNAL_FIELD_H_
1005
1006#include <stdint.h>
1007
1008
1009// Must be last.
1010
1011struct upb_MiniTableField {
1012 uint32_t number;
1013 uint16_t offset;
1014 int16_t presence; // If >0, hasbit_index. If <0, ~oneof_index
1015
1016 // Indexes into `upb_MiniTable.subs`
1017 // Will be set to `kUpb_NoSub` if `descriptortype` != MESSAGE/GROUP/ENUM
1018 uint16_t UPB_PRIVATE(submsg_index);
1019
1020 uint8_t UPB_PRIVATE(descriptortype);
1021
1022 // upb_FieldMode | upb_LabelFlags | (upb_FieldRep << kUpb_FieldRep_Shift)
1023 uint8_t mode;
1024};
1025
1026#define kUpb_NoSub ((uint16_t)-1)
1027
1028typedef enum {
1029 kUpb_FieldMode_Map = 0,
1030 kUpb_FieldMode_Array = 1,
1031 kUpb_FieldMode_Scalar = 2,
1032} upb_FieldMode;
1033
1034// Mask to isolate the upb_FieldMode from field.mode.
1035#define kUpb_FieldMode_Mask 3
1036
1037// Extra flags on the mode field.
1038typedef enum {
1039 kUpb_LabelFlags_IsPacked = 4,
1040 kUpb_LabelFlags_IsExtension = 8,
1041 // Indicates that this descriptor type is an "alternate type":
1042 // - for Int32, this indicates that the actual type is Enum (but was
1043 // rewritten to Int32 because it is an open enum that requires no check).
1044 // - for Bytes, this indicates that the actual type is String (but does
1045 // not require any UTF-8 check).
1046 kUpb_LabelFlags_IsAlternate = 16,
1047} upb_LabelFlags;
1048
1049// Note: we sort by this number when calculating layout order.
1050typedef enum {
1051 kUpb_FieldRep_1Byte = 0,
1052 kUpb_FieldRep_4Byte = 1,
1053 kUpb_FieldRep_StringView = 2,
1054 kUpb_FieldRep_8Byte = 3,
1055
1056 kUpb_FieldRep_NativePointer =
1057 UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte),
1058 kUpb_FieldRep_Max = kUpb_FieldRep_8Byte,
1059} upb_FieldRep;
1060
1061#define kUpb_FieldRep_Shift 6
1062
1063UPB_INLINE upb_FieldRep
1064_upb_MiniTableField_GetRep(const struct upb_MiniTableField* field) {
1065 return (upb_FieldRep)(field->mode >> kUpb_FieldRep_Shift);
1066}
1067
1068#ifdef __cplusplus
1069extern "C" {
1070#endif
1071
1072UPB_INLINE upb_FieldMode
1073upb_FieldMode_Get(const struct upb_MiniTableField* field) {
1074 return (upb_FieldMode)(field->mode & 3);
1075}
1076
1077UPB_INLINE void _upb_MiniTableField_CheckIsArray(
1078 const struct upb_MiniTableField* field) {
1079 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_NativePointer);
1080 UPB_ASSUME(upb_FieldMode_Get(field) == kUpb_FieldMode_Array);
1081 UPB_ASSUME(field->presence == 0);
1082}
1083
1084UPB_INLINE void _upb_MiniTableField_CheckIsMap(
1085 const struct upb_MiniTableField* field) {
1086 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_NativePointer);
1087 UPB_ASSUME(upb_FieldMode_Get(field) == kUpb_FieldMode_Map);
1088 UPB_ASSUME(field->presence == 0);
1089}
1090
1091UPB_INLINE bool upb_IsRepeatedOrMap(const struct upb_MiniTableField* field) {
1092 // This works because upb_FieldMode has no value 3.
1093 return !(field->mode & kUpb_FieldMode_Scalar);
1094}
1095
1096UPB_INLINE bool upb_IsSubMessage(const struct upb_MiniTableField* field) {
1097 return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Message ||
1098 field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Group;
1099}
1100
1101#ifdef __cplusplus
1102} /* extern "C" */
1103#endif
1104
1105
1106#endif /* UPB_MINI_TABLE_INTERNAL_FIELD_H_ */
1107
1108#ifndef UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
1109#define UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
1110
1111
1112// Must be last.
1113
1114struct upb_Decoder;
1115typedef const char* _upb_FieldParser(struct upb_Decoder* d, const char* ptr,
1116 upb_Message* msg, intptr_t table,
1117 uint64_t hasbits, uint64_t data);
1118typedef struct {
1119 uint64_t field_data;
1120 _upb_FieldParser* field_parser;
1121} _upb_FastTable_Entry;
1122
1123typedef enum {
1124 kUpb_ExtMode_NonExtendable = 0, // Non-extendable message.
1125 kUpb_ExtMode_Extendable = 1, // Normal extendable message.
1126 kUpb_ExtMode_IsMessageSet = 2, // MessageSet message.
1127 kUpb_ExtMode_IsMessageSet_ITEM =
1128 3, // MessageSet item (temporary only, see decode.c)
1129
1130 // During table building we steal a bit to indicate that the message is a map
1131 // entry. *Only* used during table building!
1132 kUpb_ExtMode_IsMapEntry = 4,
1133} upb_ExtMode;
1134
1135union upb_MiniTableSub;
1136
1137// upb_MiniTable represents the memory layout of a given upb_MessageDef.
1138// The members are public so generated code can initialize them,
1139// but users MUST NOT directly read or write any of its members.
1140struct upb_MiniTable {
1141 const union upb_MiniTableSub* subs;
1142 const struct upb_MiniTableField* fields;
1143
1144 // Must be aligned to sizeof(void*). Doesn't include internal members like
1145 // unknown fields, extension dict, pointer to msglayout, etc.
1146 uint16_t size;
1147
1148 uint16_t field_count;
1149 uint8_t ext; // upb_ExtMode, declared as uint8_t so sizeof(ext) == 1
1150 uint8_t dense_below;
1151 uint8_t table_mask;
1152 uint8_t required_count; // Required fields have the lowest hasbits.
1153
1154 // To statically initialize the tables of variable length, we need a flexible
1155 // array member, and we need to compile in gnu99 mode (constant initialization
1156 // of flexible array members is a GNU extension, not in C99 unfortunately.
1157 _upb_FastTable_Entry fasttable[];
1158};
1159
1160#ifdef __cplusplus
1161extern "C" {
1162#endif
1163
1164// A MiniTable for an empty message, used for unlinked sub-messages.
1165extern const struct upb_MiniTable _kUpb_MiniTable_Empty;
1166
1167// Computes a bitmask in which the |l->required_count| lowest bits are set,
1168// except that we skip the lowest bit (because upb never uses hasbit 0).
1169//
1170// Sample output:
1171// requiredmask(1) => 0b10 (0x2)
1172// requiredmask(5) => 0b111110 (0x3e)
1173UPB_INLINE uint64_t upb_MiniTable_requiredmask(const struct upb_MiniTable* l) {
1174 int n = l->required_count;
1175 assert(0 < n && n <= 63);
1176 return ((1ULL << n) - 1) << 1;
1177}
1178
1179#ifdef __cplusplus
1180} /* extern "C" */
1181#endif
1182
1183
1184#endif /* UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ */
Protobuf Team Bot473d20d2023-09-15 22:27:16 +00001185#ifndef UPB_MINI_TABLE_INTERNAL_SUB_H_
1186#define UPB_MINI_TABLE_INTERNAL_SUB_H_
1187
1188
1189union upb_MiniTableSub {
1190 const struct upb_MiniTable* submsg;
1191 const struct upb_MiniTableEnum* subenum;
1192};
1193
1194#endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */
1195
1196// Must be last.
1197
1198#ifdef __cplusplus
1199extern "C" {
1200#endif
1201
1202typedef struct upb_MiniTableField upb_MiniTableField;
1203
1204UPB_API_INLINE upb_FieldType
1205upb_MiniTableField_Type(const upb_MiniTableField* field) {
1206 if (field->mode & kUpb_LabelFlags_IsAlternate) {
1207 if (field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Int32) {
1208 return kUpb_FieldType_Enum;
1209 } else if (field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bytes) {
1210 return kUpb_FieldType_String;
1211 } else {
1212 UPB_ASSERT(false);
1213 }
1214 }
1215 return (upb_FieldType)field->UPB_PRIVATE(descriptortype);
1216}
1217
1218UPB_API_INLINE upb_CType upb_MiniTableField_CType(const upb_MiniTableField* f) {
Protobuf Team Bot7c687212023-11-14 03:01:42 +00001219 return upb_FieldType_CType(upb_MiniTableField_Type(f));
Protobuf Team Bot473d20d2023-09-15 22:27:16 +00001220}
1221
1222UPB_API_INLINE bool upb_MiniTableField_IsExtension(
1223 const upb_MiniTableField* field) {
1224 return field->mode & kUpb_LabelFlags_IsExtension;
1225}
1226
1227UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum(
1228 const upb_MiniTableField* field) {
1229 return field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Enum;
1230}
1231
1232UPB_API_INLINE bool upb_MiniTableField_HasPresence(
1233 const upb_MiniTableField* field) {
1234 if (upb_MiniTableField_IsExtension(field)) {
1235 return !upb_IsRepeatedOrMap(field);
1236 } else {
1237 return field->presence != 0;
1238 }
1239}
1240
1241#ifdef __cplusplus
1242} /* extern "C" */
1243#endif
1244
1245
1246#endif /* UPB_MINI_TABLE_FIELD_H_ */
1247
1248// Must be last.
1249
1250#ifdef __cplusplus
1251extern "C" {
1252#endif
1253
1254typedef struct upb_MiniTable upb_MiniTable;
1255
1256UPB_API const upb_MiniTableField* upb_MiniTable_FindFieldByNumber(
1257 const upb_MiniTable* table, uint32_t number);
1258
1259UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_GetFieldByIndex(
1260 const upb_MiniTable* t, uint32_t index) {
1261 return &t->fields[index];
1262}
1263
1264// Returns the MiniTable for this message field. If the field is unlinked,
1265// returns NULL.
1266UPB_API_INLINE const upb_MiniTable* upb_MiniTable_GetSubMessageTable(
1267 const upb_MiniTable* mini_table, const upb_MiniTableField* field) {
1268 UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Message);
1269 const upb_MiniTable* ret =
1270 mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg;
1271 UPB_ASSUME(ret);
1272 return ret == &_kUpb_MiniTable_Empty ? NULL : ret;
1273}
1274
1275// Returns the MiniTableEnum for this enum field. If the field is unlinked,
1276// returns NULL.
1277UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
1278 const upb_MiniTable* mini_table, const upb_MiniTableField* field) {
1279 UPB_ASSERT(upb_MiniTableField_CType(field) == kUpb_CType_Enum);
1280 return mini_table->subs[field->UPB_PRIVATE(submsg_index)].subenum;
1281}
1282
1283// Returns true if this MiniTable field is linked to a MiniTable for the
1284// sub-message.
1285UPB_API_INLINE bool upb_MiniTable_MessageFieldIsLinked(
1286 const upb_MiniTable* mini_table, const upb_MiniTableField* field) {
1287 return upb_MiniTable_GetSubMessageTable(mini_table, field) != NULL;
1288}
1289
1290// If this field is in a oneof, returns the first field in the oneof.
1291//
1292// Otherwise returns NULL.
1293//
1294// Usage:
1295// const upb_MiniTableField* field = upb_MiniTable_GetOneof(m, f);
1296// do {
1297// ..
1298// } while (upb_MiniTable_NextOneofField(m, &field);
1299//
1300const upb_MiniTableField* upb_MiniTable_GetOneof(const upb_MiniTable* m,
1301 const upb_MiniTableField* f);
1302
1303// Iterates to the next field in the oneof. If this is the last field in the
1304// oneof, returns false. The ordering of fields in the oneof is not
1305// guaranteed.
1306// REQUIRES: |f| is the field initialized by upb_MiniTable_GetOneof and updated
1307// by prior upb_MiniTable_NextOneofField calls.
1308bool upb_MiniTable_NextOneofField(const upb_MiniTable* m,
1309 const upb_MiniTableField** f);
1310
1311#ifdef __cplusplus
1312} /* extern "C" */
1313#endif
1314
1315
1316#endif /* UPB_MINI_TABLE_MESSAGE_H_ */
1317
Eric Salo8809a112022-11-21 13:01:06 -08001318// Must be last.
1319
1320#ifdef __cplusplus
1321extern "C" {
1322#endif
1323
1324// Creates a new message with the given mini_table on the given arena.
Eric Salo10505992022-12-12 12:16:36 -08001325UPB_API upb_Message* upb_Message_New(const upb_MiniTable* mini_table,
1326 upb_Arena* arena);
Eric Salo8809a112022-11-21 13:01:06 -08001327
1328// Adds unknown data (serialized protobuf data) to the given message.
1329// The data is copied into the message instance.
1330void upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len,
1331 upb_Arena* arena);
1332
1333// Returns a reference to the message's unknown data.
1334const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len);
1335
1336// Removes partial unknown data from message.
1337void upb_Message_DeleteUnknown(upb_Message* msg, const char* data, size_t len);
1338
1339// Returns the number of extensions present in this message.
1340size_t upb_Message_ExtensionCount(const upb_Message* msg);
1341
1342#ifdef __cplusplus
1343} /* extern "C" */
1344#endif
1345
1346
1347#endif /* UPB_MESSAGE_MESSAGE_H_ */
1348
Mike Kruskal9d435022023-07-11 12:45:07 -07001349#ifndef UPB_MINI_TABLE_EXTENSION_H_
1350#define UPB_MINI_TABLE_EXTENSION_H_
Eric Salo8809a112022-11-21 13:01:06 -08001351
1352
Mike Kruskal9d435022023-07-11 12:45:07 -07001353#ifndef UPB_MINI_TABLE_INTERNAL_EXTENSION_H_
1354#define UPB_MINI_TABLE_INTERNAL_EXTENSION_H_
Eric Salo8809a112022-11-21 13:01:06 -08001355
1356
1357// Must be last.
1358
Eric Salo8809a112022-11-21 13:01:06 -08001359struct upb_MiniTableExtension {
Deanna Garcia59cfc2f2023-01-31 13:19:28 -08001360 // Do not move this field. We need to be able to alias pointers.
Mike Kruskal9d435022023-07-11 12:45:07 -07001361 struct upb_MiniTableField field;
Deanna Garcia59cfc2f2023-01-31 13:19:28 -08001362
Mike Kruskal9d435022023-07-11 12:45:07 -07001363 const struct upb_MiniTable* extendee;
1364 union upb_MiniTableSub sub; // NULL unless submessage or proto2 enum
Eric Salo8809a112022-11-21 13:01:06 -08001365};
1366
1367
Mike Kruskal9d435022023-07-11 12:45:07 -07001368#endif /* UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ */
1369
Mike Kruskal9d435022023-07-11 12:45:07 -07001370typedef struct upb_MiniTableExtension upb_MiniTableExtension;
1371
Mike Kruskal9d435022023-07-11 12:45:07 -07001372#endif /* UPB_MINI_TABLE_EXTENSION_H_ */
Eric Salo8809a112022-11-21 13:01:06 -08001373
1374// Must be last.
1375
1376// The internal representation of an extension is self-describing: it contains
1377// enough information that we can serialize it to binary format without needing
1378// to look it up in a upb_ExtensionRegistry.
1379//
1380// This representation allocates 16 bytes to data on 64-bit platforms.
1381// This is rather wasteful for scalars (in the extreme case of bool,
1382// it wastes 15 bytes). We accept this because we expect messages to be
1383// the most common extension type.
1384typedef struct {
1385 const upb_MiniTableExtension* ext;
1386 union {
1387 upb_StringView str;
1388 void* ptr;
1389 char scalar_data[8];
1390 } data;
1391} upb_Message_Extension;
1392
1393#ifdef __cplusplus
1394extern "C" {
1395#endif
1396
1397// Adds the given extension data to the given message.
1398// |ext| is copied into the message instance.
1399// This logically replaces any previously-added extension with this number.
1400upb_Message_Extension* _upb_Message_GetOrCreateExtension(
1401 upb_Message* msg, const upb_MiniTableExtension* ext, upb_Arena* arena);
1402
1403// Returns an array of extensions for this message.
1404// Note: the array is ordered in reverse relative to the order of creation.
1405const upb_Message_Extension* _upb_Message_Getexts(const upb_Message* msg,
1406 size_t* count);
1407
1408// Returns an extension for the given field number, or NULL if no extension
1409// exists for this field number.
1410const upb_Message_Extension* _upb_Message_Getext(
1411 const upb_Message* msg, const upb_MiniTableExtension* ext);
1412
Eric Salo8809a112022-11-21 13:01:06 -08001413#ifdef __cplusplus
1414} /* extern "C" */
1415#endif
1416
1417
Adam Cozzette8059da22023-08-16 07:57:14 -07001418#endif /* UPB_MESSAGE_INTERNAL_EXTENSION_H_ */
Eric Salo8809a112022-11-21 13:01:06 -08001419
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001420// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
1421
1422#ifndef UPB_COLLECTIONS_INTERNAL_MAP_H_
1423#define UPB_COLLECTIONS_INTERNAL_MAP_H_
1424
1425
1426#ifndef UPB_HASH_STR_TABLE_H_
1427#define UPB_HASH_STR_TABLE_H_
1428
1429
1430/*
1431 * upb_table
1432 *
1433 * This header is INTERNAL-ONLY! Its interfaces are not public or stable!
1434 * This file defines very fast int->upb_value (inttable) and string->upb_value
1435 * (strtable) hash tables.
1436 *
1437 * The table uses chained scatter with Brent's variation (inspired by the Lua
1438 * implementation of hash tables). The hash function for strings is Austin
1439 * Appleby's "MurmurHash."
1440 *
1441 * The inttable uses uintptr_t as its key, which guarantees it can be used to
1442 * store pointers or integers of at least 32 bits (upb isn't really useful on
1443 * systems where sizeof(void*) < 4).
1444 *
1445 * The table must be homogeneous (all values of the same type). In debug
1446 * mode, we check this on insert and lookup.
1447 */
1448
1449#ifndef UPB_HASH_COMMON_H_
1450#define UPB_HASH_COMMON_H_
1451
1452#include <string.h>
1453
1454
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001455// Must be last.
1456
1457#ifdef __cplusplus
1458extern "C" {
1459#endif
1460
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001461/* upb_value ******************************************************************/
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001462
1463typedef struct {
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001464 uint64_t val;
1465} upb_value;
1466
1467UPB_INLINE void _upb_value_setval(upb_value* v, uint64_t val) { v->val = val; }
1468
1469/* For each value ctype, define the following set of functions:
1470 *
1471 * // Get/set an int32 from a upb_value.
1472 * int32_t upb_value_getint32(upb_value val);
1473 * void upb_value_setint32(upb_value *val, int32_t cval);
1474 *
1475 * // Construct a new upb_value from an int32.
1476 * upb_value upb_value_int32(int32_t val); */
1477#define FUNCS(name, membername, type_t, converter) \
1478 UPB_INLINE void upb_value_set##name(upb_value* val, type_t cval) { \
1479 val->val = (converter)cval; \
1480 } \
1481 UPB_INLINE upb_value upb_value_##name(type_t val) { \
1482 upb_value ret; \
1483 upb_value_set##name(&ret, val); \
1484 return ret; \
1485 } \
1486 UPB_INLINE type_t upb_value_get##name(upb_value val) { \
1487 return (type_t)(converter)val.val; \
1488 }
1489
1490FUNCS(int32, int32, int32_t, int32_t)
1491FUNCS(int64, int64, int64_t, int64_t)
1492FUNCS(uint32, uint32, uint32_t, uint32_t)
1493FUNCS(uint64, uint64, uint64_t, uint64_t)
1494FUNCS(bool, _bool, bool, bool)
1495FUNCS(cstr, cstr, char*, uintptr_t)
1496FUNCS(uintptr, uptr, uintptr_t, uintptr_t)
1497FUNCS(ptr, ptr, void*, uintptr_t)
1498FUNCS(constptr, constptr, const void*, uintptr_t)
1499
1500#undef FUNCS
1501
1502UPB_INLINE void upb_value_setfloat(upb_value* val, float cval) {
1503 memcpy(&val->val, &cval, sizeof(cval));
1504}
1505
1506UPB_INLINE void upb_value_setdouble(upb_value* val, double cval) {
1507 memcpy(&val->val, &cval, sizeof(cval));
1508}
1509
1510UPB_INLINE upb_value upb_value_float(float cval) {
1511 upb_value ret;
1512 upb_value_setfloat(&ret, cval);
1513 return ret;
1514}
1515
1516UPB_INLINE upb_value upb_value_double(double cval) {
1517 upb_value ret;
1518 upb_value_setdouble(&ret, cval);
1519 return ret;
1520}
1521
1522/* upb_tabkey *****************************************************************/
1523
1524/* Either:
1525 * 1. an actual integer key, or
1526 * 2. a pointer to a string prefixed by its uint32_t length, owned by us.
1527 *
1528 * ...depending on whether this is a string table or an int table. We would
1529 * make this a union of those two types, but C89 doesn't support statically
1530 * initializing a non-first union member. */
1531typedef uintptr_t upb_tabkey;
1532
1533UPB_INLINE char* upb_tabstr(upb_tabkey key, uint32_t* len) {
1534 char* mem = (char*)key;
1535 if (len) memcpy(len, mem, sizeof(*len));
1536 return mem + sizeof(*len);
1537}
1538
1539UPB_INLINE upb_StringView upb_tabstrview(upb_tabkey key) {
1540 upb_StringView ret;
1541 uint32_t len;
1542 ret.data = upb_tabstr(key, &len);
1543 ret.size = len;
1544 return ret;
1545}
1546
1547/* upb_tabval *****************************************************************/
1548
1549typedef struct upb_tabval {
1550 uint64_t val;
1551} upb_tabval;
1552
1553#define UPB_TABVALUE_EMPTY_INIT \
1554 { -1 }
1555
1556/* upb_table ******************************************************************/
1557
1558typedef struct _upb_tabent {
1559 upb_tabkey key;
1560 upb_tabval val;
1561
1562 /* Internal chaining. This is const so we can create static initializers for
1563 * tables. We cast away const sometimes, but *only* when the containing
1564 * upb_table is known to be non-const. This requires a bit of care, but
1565 * the subtlety is confined to table.c. */
1566 const struct _upb_tabent* next;
1567} upb_tabent;
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001568
1569typedef struct {
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001570 size_t count; /* Number of entries in the hash part. */
1571 uint32_t mask; /* Mask to turn hash value -> bucket. */
1572 uint32_t max_count; /* Max count before we hit our load limit. */
1573 uint8_t size_lg2; /* Size of the hashtable part is 2^size_lg2 entries. */
1574 upb_tabent* entries;
1575} upb_table;
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001576
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001577UPB_INLINE size_t upb_table_size(const upb_table* t) {
1578 return t->size_lg2 ? 1 << t->size_lg2 : 0;
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001579}
1580
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001581// Internal-only functions, in .h file only out of necessity.
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001582
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001583UPB_INLINE bool upb_tabent_isempty(const upb_tabent* e) { return e->key == 0; }
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001584
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001585uint32_t _upb_Hash(const void* p, size_t n, uint64_t seed);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001586
1587#ifdef __cplusplus
1588} /* extern "C" */
1589#endif
1590
1591
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001592#endif /* UPB_HASH_COMMON_H_ */
Adam Cozzette8059da22023-08-16 07:57:14 -07001593
1594// Must be last.
1595
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001596typedef struct {
1597 upb_table t;
1598} upb_strtable;
1599
Adam Cozzette8059da22023-08-16 07:57:14 -07001600#ifdef __cplusplus
1601extern "C" {
1602#endif
1603
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001604// Initialize a table. If memory allocation failed, false is returned and
1605// the table is uninitialized.
1606bool upb_strtable_init(upb_strtable* table, size_t expected_size, upb_Arena* a);
1607
1608// Returns the number of values in the table.
1609UPB_INLINE size_t upb_strtable_count(const upb_strtable* t) {
1610 return t->t.count;
Adam Cozzette8059da22023-08-16 07:57:14 -07001611}
1612
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001613void upb_strtable_clear(upb_strtable* t);
1614
1615// Inserts the given key into the hashtable with the given value.
1616// The key must not already exist in the hash table. The key is not required
1617// to be NULL-terminated, and the table will make an internal copy of the key.
1618//
1619// If a table resize was required but memory allocation failed, false is
1620// returned and the table is unchanged. */
1621bool upb_strtable_insert(upb_strtable* t, const char* key, size_t len,
1622 upb_value val, upb_Arena* a);
1623
1624// Looks up key in this table, returning "true" if the key was found.
1625// If v is non-NULL, copies the value for this key into *v.
1626bool upb_strtable_lookup2(const upb_strtable* t, const char* key, size_t len,
1627 upb_value* v);
1628
1629// For NULL-terminated strings.
1630UPB_INLINE bool upb_strtable_lookup(const upb_strtable* t, const char* key,
1631 upb_value* v) {
1632 return upb_strtable_lookup2(t, key, strlen(key), v);
1633}
1634
1635// Removes an item from the table. Returns true if the remove was successful,
1636// and stores the removed item in *val if non-NULL.
1637bool upb_strtable_remove2(upb_strtable* t, const char* key, size_t len,
1638 upb_value* val);
1639
1640UPB_INLINE bool upb_strtable_remove(upb_strtable* t, const char* key,
1641 upb_value* v) {
1642 return upb_strtable_remove2(t, key, strlen(key), v);
1643}
1644
1645// Exposed for testing only.
1646bool upb_strtable_resize(upb_strtable* t, size_t size_lg2, upb_Arena* a);
1647
1648/* Iteration over strtable:
1649 *
1650 * intptr_t iter = UPB_STRTABLE_BEGIN;
1651 * upb_StringView key;
1652 * upb_value val;
1653 * while (upb_strtable_next2(t, &key, &val, &iter)) {
1654 * // ...
1655 * }
1656 */
1657
1658#define UPB_STRTABLE_BEGIN -1
1659
1660bool upb_strtable_next2(const upb_strtable* t, upb_StringView* key,
1661 upb_value* val, intptr_t* iter);
1662void upb_strtable_removeiter(upb_strtable* t, intptr_t* iter);
1663void upb_strtable_setentryvalue(upb_strtable* t, intptr_t iter, upb_value v);
1664
1665/* DEPRECATED iterators, slated for removal.
1666 *
1667 * Iterators for string tables. We are subject to some kind of unusual
1668 * design constraints:
1669 *
1670 * For high-level languages:
1671 * - we must be able to guarantee that we don't crash or corrupt memory even if
1672 * the program accesses an invalidated iterator.
1673 *
1674 * For C++11 range-based for:
1675 * - iterators must be copyable
1676 * - iterators must be comparable
1677 * - it must be possible to construct an "end" value.
1678 *
1679 * Iteration order is undefined.
1680 *
1681 * Modifying the table invalidates iterators. upb_{str,int}table_done() is
1682 * guaranteed to work even on an invalidated iterator, as long as the table it
1683 * is iterating over has not been freed. Calling next() or accessing data from
1684 * an invalidated iterator yields unspecified elements from the table, but it is
1685 * guaranteed not to crash and to return real table elements (except when done()
1686 * is true). */
1687/* upb_strtable_iter **********************************************************/
1688
1689/* upb_strtable_iter i;
1690 * upb_strtable_begin(&i, t);
1691 * for(; !upb_strtable_done(&i); upb_strtable_next(&i)) {
1692 * const char *key = upb_strtable_iter_key(&i);
1693 * const upb_value val = upb_strtable_iter_value(&i);
1694 * // ...
1695 * }
1696 */
1697
1698typedef struct {
1699 const upb_strtable* t;
1700 size_t index;
1701} upb_strtable_iter;
1702
1703UPB_INLINE const upb_tabent* str_tabent(const upb_strtable_iter* i) {
1704 return &i->t->t.entries[i->index];
1705}
1706
1707void upb_strtable_begin(upb_strtable_iter* i, const upb_strtable* t);
1708void upb_strtable_next(upb_strtable_iter* i);
1709bool upb_strtable_done(const upb_strtable_iter* i);
1710upb_StringView upb_strtable_iter_key(const upb_strtable_iter* i);
1711upb_value upb_strtable_iter_value(const upb_strtable_iter* i);
1712void upb_strtable_iter_setdone(upb_strtable_iter* i);
1713bool upb_strtable_iter_isequal(const upb_strtable_iter* i1,
1714 const upb_strtable_iter* i2);
Adam Cozzette8059da22023-08-16 07:57:14 -07001715
1716#ifdef __cplusplus
1717} /* extern "C" */
1718#endif
1719
1720
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001721#endif /* UPB_HASH_STR_TABLE_H_ */
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001722
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001723#ifndef UPB_MESSAGE_MAP_H_
1724#define UPB_MESSAGE_MAP_H_
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001725
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001726#include <stddef.h>
Mike Kruskal9d435022023-07-11 12:45:07 -07001727
1728
1729// Must be last.
1730
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001731typedef struct upb_Map upb_Map;
1732
Mike Kruskal9d435022023-07-11 12:45:07 -07001733#ifdef __cplusplus
1734extern "C" {
1735#endif
1736
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001737// Creates a new map on the given arena with the given key/value size.
1738UPB_API upb_Map* upb_Map_New(upb_Arena* a, upb_CType key_type,
1739 upb_CType value_type);
Mike Kruskal9d435022023-07-11 12:45:07 -07001740
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001741// Returns the number of entries in the map.
1742UPB_API size_t upb_Map_Size(const upb_Map* map);
1743
1744// Stores a value for the given key into |*val| (or the zero value if the key is
1745// not present). Returns whether the key was present. The |val| pointer may be
1746// NULL, in which case the function tests whether the given key is present.
1747UPB_API bool upb_Map_Get(const upb_Map* map, upb_MessageValue key,
1748 upb_MessageValue* val);
1749
1750// Removes all entries in the map.
1751UPB_API void upb_Map_Clear(upb_Map* map);
1752
1753typedef enum {
1754 kUpb_MapInsertStatus_Inserted = 0,
1755 kUpb_MapInsertStatus_Replaced = 1,
1756 kUpb_MapInsertStatus_OutOfMemory = 2,
1757} upb_MapInsertStatus;
1758
1759// Sets the given key to the given value, returning whether the key was inserted
1760// or replaced. If the key was inserted, then any existing iterators will be
1761// invalidated.
1762UPB_API upb_MapInsertStatus upb_Map_Insert(upb_Map* map, upb_MessageValue key,
1763 upb_MessageValue val,
1764 upb_Arena* arena);
1765
1766// Sets the given key to the given value. Returns false if memory allocation
1767// failed. If the key is newly inserted, then any existing iterators will be
1768// invalidated.
1769UPB_API_INLINE bool upb_Map_Set(upb_Map* map, upb_MessageValue key,
1770 upb_MessageValue val, upb_Arena* arena) {
1771 return upb_Map_Insert(map, key, val, arena) !=
1772 kUpb_MapInsertStatus_OutOfMemory;
Mike Kruskal9d435022023-07-11 12:45:07 -07001773}
1774
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001775// Deletes this key from the table. Returns true if the key was present.
1776// If present and |val| is non-NULL, stores the deleted value.
1777UPB_API bool upb_Map_Delete(upb_Map* map, upb_MessageValue key,
1778 upb_MessageValue* val);
1779
1780// (DEPRECATED and going away soon. Do not use.)
1781UPB_INLINE bool upb_Map_Delete2(upb_Map* map, upb_MessageValue key,
1782 upb_MessageValue* val) {
1783 return upb_Map_Delete(map, key, val);
Mike Kruskal9d435022023-07-11 12:45:07 -07001784}
1785
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001786// Map iteration:
1787//
1788// size_t iter = kUpb_Map_Begin;
1789// upb_MessageValue key, val;
1790// while (upb_Map_Next(map, &key, &val, &iter)) {
1791// ...
1792// }
1793
1794#define kUpb_Map_Begin ((size_t)-1)
1795
1796// Advances to the next entry. Returns false if no more entries are present.
1797// Otherwise returns true and populates both *key and *value.
1798UPB_API bool upb_Map_Next(const upb_Map* map, upb_MessageValue* key,
1799 upb_MessageValue* val, size_t* iter);
1800
1801// Sets the value for the entry pointed to by iter.
1802// WARNING: this does not currently work for string values!
1803UPB_API void upb_Map_SetEntryValue(upb_Map* map, size_t iter,
1804 upb_MessageValue val);
1805
1806// DEPRECATED iterator, slated for removal.
1807
1808/* Map iteration:
1809 *
1810 * size_t iter = kUpb_Map_Begin;
1811 * while (upb_MapIterator_Next(map, &iter)) {
1812 * upb_MessageValue key = upb_MapIterator_Key(map, iter);
1813 * upb_MessageValue val = upb_MapIterator_Value(map, iter);
1814 * }
1815 */
1816
1817// Advances to the next entry. Returns false if no more entries are present.
1818UPB_API bool upb_MapIterator_Next(const upb_Map* map, size_t* iter);
1819
1820// Returns true if the iterator still points to a valid entry, or false if the
1821// iterator is past the last element. It is an error to call this function with
1822// kUpb_Map_Begin (you must call next() at least once first).
1823UPB_API bool upb_MapIterator_Done(const upb_Map* map, size_t iter);
1824
1825// Returns the key and value for this entry of the map.
1826UPB_API upb_MessageValue upb_MapIterator_Key(const upb_Map* map, size_t iter);
1827UPB_API upb_MessageValue upb_MapIterator_Value(const upb_Map* map, size_t iter);
1828
1829#ifdef __cplusplus
1830} /* extern "C" */
1831#endif
1832
1833
1834#endif /* UPB_MESSAGE_MAP_H_ */
1835
1836// Must be last.
1837
1838struct upb_Map {
1839 // Size of key and val, based on the map type.
1840 // Strings are represented as '0' because they must be handled specially.
1841 char key_size;
1842 char val_size;
1843
1844 upb_strtable table;
1845};
1846
1847#ifdef __cplusplus
1848extern "C" {
1849#endif
1850
1851// Converting between internal table representation and user values.
1852//
1853// _upb_map_tokey() and _upb_map_fromkey() are inverses.
1854// _upb_map_tovalue() and _upb_map_fromvalue() are inverses.
1855//
1856// These functions account for the fact that strings are treated differently
1857// from other types when stored in a map.
1858
1859UPB_INLINE upb_StringView _upb_map_tokey(const void* key, size_t size) {
Mike Kruskal9d435022023-07-11 12:45:07 -07001860 if (size == UPB_MAPTYPE_STRING) {
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001861 return *(upb_StringView*)key;
Mike Kruskal9d435022023-07-11 12:45:07 -07001862 } else {
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001863 return upb_StringView_FromDataAndSize((const char*)key, size);
Mike Kruskal9d435022023-07-11 12:45:07 -07001864 }
1865}
1866
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001867UPB_INLINE void _upb_map_fromkey(upb_StringView key, void* out, size_t size) {
1868 if (size == UPB_MAPTYPE_STRING) {
1869 memcpy(out, &key, sizeof(key));
1870 } else {
1871 memcpy(out, key.data, size);
1872 }
1873}
1874
1875UPB_INLINE bool _upb_map_tovalue(const void* val, size_t size,
1876 upb_value* msgval, upb_Arena* a) {
1877 if (size == UPB_MAPTYPE_STRING) {
1878 upb_StringView* strp = (upb_StringView*)upb_Arena_Malloc(a, sizeof(*strp));
1879 if (!strp) return false;
1880 *strp = *(upb_StringView*)val;
1881 *msgval = upb_value_ptr(strp);
1882 } else {
1883 memcpy(msgval, val, size);
1884 }
1885 return true;
1886}
1887
1888UPB_INLINE void _upb_map_fromvalue(upb_value val, void* out, size_t size) {
1889 if (size == UPB_MAPTYPE_STRING) {
1890 const upb_StringView* strp = (const upb_StringView*)upb_value_getptr(val);
1891 memcpy(out, strp, sizeof(upb_StringView));
1892 } else {
1893 memcpy(out, &val, size);
1894 }
1895}
1896
1897UPB_INLINE void* _upb_map_next(const upb_Map* map, size_t* iter) {
1898 upb_strtable_iter it;
1899 it.t = &map->table;
1900 it.index = *iter;
1901 upb_strtable_next(&it);
1902 *iter = it.index;
1903 if (upb_strtable_done(&it)) return NULL;
1904 return (void*)str_tabent(&it);
1905}
1906
1907UPB_INLINE void _upb_Map_Clear(upb_Map* map) {
1908 upb_strtable_clear(&map->table);
1909}
1910
1911UPB_INLINE bool _upb_Map_Delete(upb_Map* map, const void* key, size_t key_size,
1912 upb_value* val) {
1913 upb_StringView k = _upb_map_tokey(key, key_size);
1914 return upb_strtable_remove2(&map->table, k.data, k.size, val);
1915}
1916
1917UPB_INLINE bool _upb_Map_Get(const upb_Map* map, const void* key,
1918 size_t key_size, void* val, size_t val_size) {
1919 upb_value tabval;
1920 upb_StringView k = _upb_map_tokey(key, key_size);
1921 bool ret = upb_strtable_lookup2(&map->table, k.data, k.size, &tabval);
1922 if (ret && val) {
1923 _upb_map_fromvalue(tabval, val, val_size);
1924 }
1925 return ret;
1926}
1927
1928UPB_INLINE upb_MapInsertStatus _upb_Map_Insert(upb_Map* map, const void* key,
1929 size_t key_size, void* val,
1930 size_t val_size, upb_Arena* a) {
1931 upb_StringView strkey = _upb_map_tokey(key, key_size);
1932 upb_value tabval = {0};
1933 if (!_upb_map_tovalue(val, val_size, &tabval, a)) {
1934 return kUpb_MapInsertStatus_OutOfMemory;
1935 }
1936
1937 // TODO: add overwrite operation to minimize number of lookups.
1938 bool removed =
1939 upb_strtable_remove2(&map->table, strkey.data, strkey.size, NULL);
1940 if (!upb_strtable_insert(&map->table, strkey.data, strkey.size, tabval, a)) {
1941 return kUpb_MapInsertStatus_OutOfMemory;
1942 }
1943 return removed ? kUpb_MapInsertStatus_Replaced
1944 : kUpb_MapInsertStatus_Inserted;
1945}
1946
1947UPB_INLINE size_t _upb_Map_Size(const upb_Map* map) {
1948 return map->table.t.count;
1949}
1950
1951// Strings/bytes are special-cased in maps.
1952extern char _upb_Map_CTypeSizeTable[12];
1953
1954UPB_INLINE size_t _upb_Map_CTypeSize(upb_CType ctype) {
1955 return _upb_Map_CTypeSizeTable[ctype];
1956}
1957
1958// Creates a new map on the given arena with this key/value type.
1959upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size);
1960
Mike Kruskal9d435022023-07-11 12:45:07 -07001961#ifdef __cplusplus
1962} /* extern "C" */
1963#endif
1964
1965
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001966#endif /* UPB_COLLECTIONS_INTERNAL_MAP_H_ */
Adam Cozzette8059da22023-08-16 07:57:14 -07001967
Sandy Zhange3b09432023-08-07 09:30:02 -07001968/*
1969** Our memory representation for parsing tables and messages themselves.
1970** Functions in this file are used by generated code and possibly reflection.
1971**
1972** The definitions in this file are internal to upb.
1973**/
1974
1975#ifndef UPB_MESSAGE_INTERNAL_H_
1976#define UPB_MESSAGE_INTERNAL_H_
1977
1978#include <stdlib.h>
1979#include <string.h>
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07001980
1981
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00001982#ifndef UPB_MINI_TABLE_INTERNAL_TYPES_H_
1983#define UPB_MINI_TABLE_INTERNAL_TYPES_H_
1984
1985typedef struct upb_Message_InternalData upb_Message_InternalData;
1986
1987typedef struct {
1988 union {
1989 upb_Message_InternalData* internal;
1990
1991 // Force 8-byte alignment, since the data members may contain members that
1992 // require 8-byte alignment.
1993 double d;
1994 };
1995} upb_Message_Internal;
1996
1997#endif // UPB_MINI_TABLE_INTERNAL_TYPES_H_
1998
Mike Kruskal3bc50492022-12-01 13:34:12 -08001999#ifndef UPB_MINI_TABLE_EXTENSION_REGISTRY_H_
2000#define UPB_MINI_TABLE_EXTENSION_REGISTRY_H_
2001
2002
2003// Must be last.
2004
2005#ifdef __cplusplus
2006extern "C" {
2007#endif
2008
2009/* Extension registry: a dynamic data structure that stores a map of:
2010 * (upb_MiniTable, number) -> extension info
2011 *
2012 * upb_decode() uses upb_ExtensionRegistry to look up extensions while parsing
2013 * binary format.
2014 *
2015 * upb_ExtensionRegistry is part of the mini-table (msglayout) family of
2016 * objects. Like all mini-table objects, it is suitable for reflection-less
2017 * builds that do not want to expose names into the binary.
2018 *
2019 * Unlike most mini-table types, upb_ExtensionRegistry requires dynamic memory
2020 * allocation and dynamic initialization:
2021 * * If reflection is being used, then upb_DefPool will construct an appropriate
2022 * upb_ExtensionRegistry automatically.
2023 * * For a mini-table only build, the user must manually construct the
2024 * upb_ExtensionRegistry and populate it with all of the extensions the user
2025 * cares about.
2026 * * A third alternative is to manually unpack relevant extensions after the
2027 * main parse is complete, similar to how Any works. This is perhaps the
2028 * nicest solution from the perspective of reducing dependencies, avoiding
2029 * dynamic memory allocation, and avoiding the need to parse uninteresting
2030 * extensions. The downsides are:
2031 * (1) parse errors are not caught during the main parse
2032 * (2) the CPU hit of parsing comes during access, which could cause an
2033 * undesirable stutter in application performance.
2034 *
2035 * Users cannot directly get or put into this map. Users can only add the
2036 * extensions from a generated module and pass the extension registry to the
2037 * binary decoder.
2038 *
2039 * A upb_DefPool provides a upb_ExtensionRegistry, so any users who use
2040 * reflection do not need to populate a upb_ExtensionRegistry directly.
2041 */
2042
2043typedef struct upb_ExtensionRegistry upb_ExtensionRegistry;
2044
2045// Creates a upb_ExtensionRegistry in the given arena.
2046// The arena must outlive any use of the extreg.
Eric Salo10505992022-12-12 12:16:36 -08002047UPB_API upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena);
Mike Kruskal3bc50492022-12-01 13:34:12 -08002048
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002049UPB_API bool upb_ExtensionRegistry_Add(upb_ExtensionRegistry* r,
2050 const upb_MiniTableExtension* e);
2051
Mike Kruskal3bc50492022-12-01 13:34:12 -08002052// Adds the given extension info for the array |e| of size |count| into the
2053// registry. If there are any errors, the entire array is backed out.
2054// The extensions must outlive the registry.
2055// Possible errors include OOM or an extension number that already exists.
Protobuf Team Bot986cbb62023-09-19 15:03:51 +00002056// TODO: There is currently no way to know the exact reason for failure.
Mike Kruskal3bc50492022-12-01 13:34:12 -08002057bool upb_ExtensionRegistry_AddArray(upb_ExtensionRegistry* r,
2058 const upb_MiniTableExtension** e,
2059 size_t count);
2060
2061// Looks up the extension (if any) defined for message type |t| and field
2062// number |num|. Returns the extension if found, otherwise NULL.
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07002063UPB_API const upb_MiniTableExtension* upb_ExtensionRegistry_Lookup(
Mike Kruskal3bc50492022-12-01 13:34:12 -08002064 const upb_ExtensionRegistry* r, const upb_MiniTable* t, uint32_t num);
2065
2066#ifdef __cplusplus
2067} /* extern "C" */
2068#endif
2069
2070
2071#endif /* UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ */
2072
Eric Salo8809a112022-11-21 13:01:06 -08002073// Must be last.
Mike Kruskal9cf9db82022-11-04 21:22:31 -07002074
Eric Salo8809a112022-11-21 13:01:06 -08002075#ifdef __cplusplus
2076extern "C" {
2077#endif
Mike Kruskal9cf9db82022-11-04 21:22:31 -07002078
Eric Salo8809a112022-11-21 13:01:06 -08002079extern const float kUpb_FltInfinity;
2080extern const double kUpb_Infinity;
2081extern const double kUpb_NaN;
2082
2083/* Internal members of a upb_Message that track unknown fields and/or
2084 * extensions. We can change this without breaking binary compatibility. We put
2085 * these before the user's data. The user's upb_Message* points after the
2086 * upb_Message_Internal. */
2087
Protobuf Team Botdcc1f612023-09-05 21:56:25 +00002088struct upb_Message_InternalData {
Eric Salo8809a112022-11-21 13:01:06 -08002089 /* Total size of this structure, including the data that follows.
2090 * Must be aligned to 8, which is alignof(upb_Message_Extension) */
2091 uint32_t size;
2092
2093 /* Offsets relative to the beginning of this structure.
2094 *
2095 * Unknown data grows forward from the beginning to unknown_end.
2096 * Extension data grows backward from size to ext_begin.
2097 * When the two meet, we're out of data and have to realloc.
2098 *
2099 * If we imagine that the final member of this struct is:
2100 * char data[size - overhead]; // overhead =
2101 * sizeof(upb_Message_InternalData)
2102 *
2103 * Then we have:
2104 * unknown data: data[0 .. (unknown_end - overhead)]
2105 * extensions data: data[(ext_begin - overhead) .. (size - overhead)] */
2106 uint32_t unknown_end;
2107 uint32_t ext_begin;
2108 /* Data follows, as if there were an array:
2109 * char data[size - sizeof(upb_Message_InternalData)]; */
Protobuf Team Botdcc1f612023-09-05 21:56:25 +00002110};
Eric Salo8809a112022-11-21 13:01:06 -08002111
2112/* Maps upb_CType -> memory size. */
2113extern char _upb_CTypeo_size[12];
2114
2115UPB_INLINE size_t upb_msg_sizeof(const upb_MiniTable* t) {
2116 return t->size + sizeof(upb_Message_Internal);
2117}
2118
2119// Inline version upb_Message_New(), for internal use.
2120UPB_INLINE upb_Message* _upb_Message_New(const upb_MiniTable* mini_table,
2121 upb_Arena* arena) {
2122 size_t size = upb_msg_sizeof(mini_table);
2123 void* mem = upb_Arena_Malloc(arena, size + sizeof(upb_Message_Internal));
2124 if (UPB_UNLIKELY(!mem)) return NULL;
2125 upb_Message* msg = UPB_PTR_AT(mem, sizeof(upb_Message_Internal), upb_Message);
2126 memset(mem, 0, size);
2127 return msg;
2128}
2129
2130UPB_INLINE upb_Message_Internal* upb_Message_Getinternal(
2131 const upb_Message* msg) {
2132 ptrdiff_t size = sizeof(upb_Message_Internal);
2133 return (upb_Message_Internal*)((char*)msg - size);
2134}
2135
Eric Salo8809a112022-11-21 13:01:06 -08002136// Discards the unknown fields for this message only.
2137void _upb_Message_DiscardUnknown_shallow(upb_Message* msg);
2138
2139// Adds unknown data (serialized protobuf data) to the given message.
2140// The data is copied into the message instance.
2141bool _upb_Message_AddUnknown(upb_Message* msg, const char* data, size_t len,
2142 upb_Arena* arena);
2143
Eric Salo8809a112022-11-21 13:01:06 -08002144#ifdef __cplusplus
2145} /* extern "C" */
2146#endif
2147
2148
2149#endif /* UPB_MESSAGE_INTERNAL_H_ */
Mike Kruskal9cf9db82022-11-04 21:22:31 -07002150
Protobuf Team Bot7c687212023-11-14 03:01:42 +00002151#ifndef UPB_MESSAGE_INTERNAL_SIZE_LOG2_H_
2152#define UPB_MESSAGE_INTERNAL_SIZE_LOG2_H_
2153
2154#include <stddef.h>
2155#include <stdint.h>
2156
2157
2158// Must be last.
2159
2160#ifdef __cplusplus
2161extern "C" {
2162#endif
2163
2164// Return the log2 of the storage size in bytes for a upb_CType
2165UPB_INLINE int upb_SizeLog2_CType(upb_CType c_type) {
2166 static const int8_t size[] = {
2167 0, // kUpb_CType_Bool
2168 2, // kUpb_CType_Float
2169 2, // kUpb_CType_Int32
2170 2, // kUpb_CType_UInt32
2171 2, // kUpb_CType_Enum
2172 UPB_SIZE(2, 3), // kUpb_CType_Message
2173 3, // kUpb_CType_Double
2174 3, // kUpb_CType_Int64
2175 3, // kUpb_CType_UInt64
2176 UPB_SIZE(3, 4), // kUpb_CType_String
2177 UPB_SIZE(3, 4), // kUpb_CType_Bytes
2178 };
2179
2180 // -1 here because the enum is one-based but the table is zero-based.
2181 return size[c_type - 1];
2182}
2183
2184// Return the log2 of the storage size in bytes for a upb_FieldType
2185UPB_INLINE int upb_SizeLog2_FieldType(upb_FieldType field_type) {
2186 static const int8_t size[] = {
2187 3, // kUpb_FieldType_Double
2188 2, // kUpb_FieldType_Float
2189 3, // kUpb_FieldType_Int64
2190 3, // kUpb_FieldType_UInt64
2191 2, // kUpb_FieldType_Int32
2192 3, // kUpb_FieldType_Fixed64
2193 2, // kUpb_FieldType_Fixed32
2194 0, // kUpb_FieldType_Bool
2195 UPB_SIZE(3, 4), // kUpb_FieldType_String
2196 UPB_SIZE(2, 3), // kUpb_FieldType_Group
2197 UPB_SIZE(2, 3), // kUpb_FieldType_Message
2198 UPB_SIZE(3, 4), // kUpb_FieldType_Bytes
2199 2, // kUpb_FieldType_UInt32
2200 2, // kUpb_FieldType_Enum
2201 2, // kUpb_FieldType_SFixed32
2202 3, // kUpb_FieldType_SFixed64
2203 2, // kUpb_FieldType_SInt32
2204 3, // kUpb_FieldType_SInt64
2205 };
2206
2207 // -1 here because the enum is one-based but the table is zero-based.
2208 return size[field_type - 1];
2209}
2210
2211#ifdef __cplusplus
2212} /* extern "C" */
2213#endif
2214
2215
2216#endif /* UPB_MESSAGE_INTERNAL_SIZE_LOG2_H_ */
2217
Eric Salo8809a112022-11-21 13:01:06 -08002218// Must be last.
2219
Eric Salob7d54ac2022-12-29 11:59:42 -08002220#if defined(__GNUC__) && !defined(__clang__)
2221// GCC raises incorrect warnings in these functions. It thinks that we are
2222// overrunning buffers, but we carefully write the functions in this file to
2223// guarantee that this is impossible. GCC gets this wrong due it its failure
2224// to perform constant propagation as we expect:
2225// - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108217
2226// - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108226
2227//
2228// Unfortunately this also indicates that GCC is not optimizing away the
2229// switch() in cases where it should be, compromising the performance.
2230#pragma GCC diagnostic push
2231#pragma GCC diagnostic ignored "-Warray-bounds"
2232#pragma GCC diagnostic ignored "-Wstringop-overflow"
Mike Kruskal232ecf42023-01-14 00:09:40 -08002233#if __GNUC__ >= 11
Eric Salob7d54ac2022-12-29 11:59:42 -08002234#pragma GCC diagnostic ignored "-Wstringop-overread"
2235#endif
Mike Kruskal232ecf42023-01-14 00:09:40 -08002236#endif
Eric Salob7d54ac2022-12-29 11:59:42 -08002237
Eric Salo8809a112022-11-21 13:01:06 -08002238#ifdef __cplusplus
2239extern "C" {
2240#endif
2241
Mike Kruskal9d435022023-07-11 12:45:07 -07002242// LINT.IfChange(presence_logic)
2243
2244// Hasbit access ///////////////////////////////////////////////////////////////
2245
2246UPB_INLINE size_t _upb_hasbit_ofs(size_t idx) { return idx / 8; }
2247
2248UPB_INLINE char _upb_hasbit_mask(size_t idx) { return 1 << (idx % 8); }
2249
2250UPB_INLINE bool _upb_hasbit(const upb_Message* msg, size_t idx) {
2251 return (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), const char) &
2252 _upb_hasbit_mask(idx)) != 0;
2253}
2254
2255UPB_INLINE void _upb_sethas(const upb_Message* msg, size_t idx) {
2256 (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), char)) |= _upb_hasbit_mask(idx);
2257}
2258
2259UPB_INLINE void _upb_clearhas(const upb_Message* msg, size_t idx) {
2260 (*UPB_PTR_AT(msg, _upb_hasbit_ofs(idx), char)) &= ~_upb_hasbit_mask(idx);
2261}
2262
2263UPB_INLINE size_t _upb_Message_Hasidx(const upb_MiniTableField* f) {
2264 UPB_ASSERT(f->presence > 0);
2265 return f->presence;
2266}
2267
2268UPB_INLINE bool _upb_hasbit_field(const upb_Message* msg,
2269 const upb_MiniTableField* f) {
2270 return _upb_hasbit(msg, _upb_Message_Hasidx(f));
2271}
2272
2273UPB_INLINE void _upb_sethas_field(const upb_Message* msg,
2274 const upb_MiniTableField* f) {
2275 _upb_sethas(msg, _upb_Message_Hasidx(f));
2276}
2277
2278// Oneof case access ///////////////////////////////////////////////////////////
2279
2280UPB_INLINE size_t _upb_oneofcase_ofs(const upb_MiniTableField* f) {
2281 UPB_ASSERT(f->presence < 0);
2282 return ~(ptrdiff_t)f->presence;
2283}
2284
2285UPB_INLINE uint32_t* _upb_oneofcase_field(upb_Message* msg,
2286 const upb_MiniTableField* f) {
2287 return UPB_PTR_AT(msg, _upb_oneofcase_ofs(f), uint32_t);
2288}
2289
2290UPB_INLINE uint32_t _upb_getoneofcase_field(const upb_Message* msg,
2291 const upb_MiniTableField* f) {
2292 return *_upb_oneofcase_field((upb_Message*)msg, f);
2293}
2294
2295// LINT.ThenChange(GoogleInternalName2)
Mike Kruskal9d435022023-07-11 12:45:07 -07002296
Eric Salo8809a112022-11-21 13:01:06 -08002297UPB_INLINE bool _upb_MiniTableField_InOneOf(const upb_MiniTableField* field) {
2298 return field->presence < 0;
2299}
2300
2301UPB_INLINE void* _upb_MiniTableField_GetPtr(upb_Message* msg,
2302 const upb_MiniTableField* field) {
2303 return (char*)msg + field->offset;
2304}
2305
2306UPB_INLINE const void* _upb_MiniTableField_GetConstPtr(
2307 const upb_Message* msg, const upb_MiniTableField* field) {
2308 return (char*)msg + field->offset;
2309}
2310
Eric Salo10505992022-12-12 12:16:36 -08002311UPB_INLINE void _upb_Message_SetPresence(upb_Message* msg,
2312 const upb_MiniTableField* field) {
Eric Salo8809a112022-11-21 13:01:06 -08002313 if (field->presence > 0) {
2314 _upb_sethas_field(msg, field);
2315 } else if (_upb_MiniTableField_InOneOf(field)) {
2316 *_upb_oneofcase_field(msg, field) = field->number;
2317 }
2318}
2319
Mike Kruskal3bc50492022-12-01 13:34:12 -08002320UPB_INLINE bool _upb_MiniTable_ValueIsNonZero(const void* default_val,
2321 const upb_MiniTableField* field) {
Eric Salo8809a112022-11-21 13:01:06 -08002322 char zero[16] = {0};
2323 switch (_upb_MiniTableField_GetRep(field)) {
2324 case kUpb_FieldRep_1Byte:
2325 return memcmp(&zero, default_val, 1) != 0;
2326 case kUpb_FieldRep_4Byte:
2327 return memcmp(&zero, default_val, 4) != 0;
2328 case kUpb_FieldRep_8Byte:
2329 return memcmp(&zero, default_val, 8) != 0;
2330 case kUpb_FieldRep_StringView: {
2331 const upb_StringView* sv = (const upb_StringView*)default_val;
2332 return sv->size != 0;
2333 }
2334 }
2335 UPB_UNREACHABLE();
2336}
2337
2338UPB_INLINE void _upb_MiniTable_CopyFieldData(void* to, const void* from,
2339 const upb_MiniTableField* field) {
2340 switch (_upb_MiniTableField_GetRep(field)) {
2341 case kUpb_FieldRep_1Byte:
2342 memcpy(to, from, 1);
2343 return;
2344 case kUpb_FieldRep_4Byte:
2345 memcpy(to, from, 4);
2346 return;
2347 case kUpb_FieldRep_8Byte:
2348 memcpy(to, from, 8);
2349 return;
2350 case kUpb_FieldRep_StringView: {
2351 memcpy(to, from, sizeof(upb_StringView));
2352 return;
2353 }
2354 }
2355 UPB_UNREACHABLE();
2356}
2357
Eric Salob7d54ac2022-12-29 11:59:42 -08002358UPB_INLINE size_t
2359_upb_MiniTable_ElementSizeLg2(const upb_MiniTableField* field) {
Protobuf Team Bot7c687212023-11-14 03:01:42 +00002360 return upb_SizeLog2_FieldType(
2361 (upb_FieldType)field->UPB_PRIVATE(descriptortype));
Eric Salob7d54ac2022-12-29 11:59:42 -08002362}
2363
Eric Salo8809a112022-11-21 13:01:06 -08002364// Here we define universal getter/setter functions for message fields.
2365// These look very branchy and inefficient, but as long as the MiniTableField
2366// values are known at compile time, all the branches are optimized away and
2367// we are left with ideal code. This can happen either through through
2368// literals or UPB_ASSUME():
2369//
Eric Salob598b2d2022-12-22 23:14:27 -08002370// // Via struct literals.
Eric Salo8809a112022-11-21 13:01:06 -08002371// bool FooMessage_set_bool_field(const upb_Message* msg, bool val) {
2372// const upb_MiniTableField field = {1, 0, 0, /* etc... */};
2373// // All value in "field" are compile-time known.
Eric Salo10505992022-12-12 12:16:36 -08002374// _upb_Message_SetNonExtensionField(msg, &field, &value);
Eric Salo8809a112022-11-21 13:01:06 -08002375// }
2376//
2377// // Via UPB_ASSUME().
Eric Salo10505992022-12-12 12:16:36 -08002378// UPB_INLINE bool upb_Message_SetBool(upb_Message* msg,
2379// const upb_MiniTableField* field,
2380// bool value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002381// UPB_ASSUME(field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bool);
Eric Salo8809a112022-11-21 13:01:06 -08002382// UPB_ASSUME(!upb_IsRepeatedOrMap(field));
2383// UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte);
Eric Salo10505992022-12-12 12:16:36 -08002384// _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002385// }
2386//
2387// As a result, we can use these universal getters/setters for *all* message
2388// accessors: generated code, MiniTable accessors, and reflection. The only
2389// exception is the binary encoder/decoder, which need to be a bit more clever
Eric Salob598b2d2022-12-22 23:14:27 -08002390// about how they read/write the message data, for efficiency.
Eric Salo10505992022-12-12 12:16:36 -08002391//
2392// These functions work on both extensions and non-extensions. If the field
2393// of a setter is known to be a non-extension, the arena may be NULL and the
2394// returned bool value may be ignored since it will always succeed.
Eric Salo8809a112022-11-21 13:01:06 -08002395
Eric Salo10505992022-12-12 12:16:36 -08002396UPB_INLINE bool _upb_Message_HasExtensionField(
2397 const upb_Message* msg, const upb_MiniTableExtension* ext) {
2398 UPB_ASSERT(upb_MiniTableField_HasPresence(&ext->field));
2399 return _upb_Message_Getext(msg, ext) != NULL;
2400}
2401
2402UPB_INLINE bool _upb_Message_HasNonExtensionField(
2403 const upb_Message* msg, const upb_MiniTableField* field) {
2404 UPB_ASSERT(upb_MiniTableField_HasPresence(field));
2405 UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
2406 if (_upb_MiniTableField_InOneOf(field)) {
2407 return _upb_getoneofcase_field(msg, field) == field->number;
2408 } else {
2409 return _upb_hasbit_field(msg, field);
2410 }
2411}
2412
2413static UPB_FORCEINLINE void _upb_Message_GetNonExtensionField(
Eric Salo8809a112022-11-21 13:01:06 -08002414 const upb_Message* msg, const upb_MiniTableField* field,
2415 const void* default_val, void* val) {
2416 UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
2417 if ((_upb_MiniTableField_InOneOf(field) ||
Mike Kruskal3bc50492022-12-01 13:34:12 -08002418 _upb_MiniTable_ValueIsNonZero(default_val, field)) &&
Eric Salo10505992022-12-12 12:16:36 -08002419 !_upb_Message_HasNonExtensionField(msg, field)) {
Eric Salo8809a112022-11-21 13:01:06 -08002420 _upb_MiniTable_CopyFieldData(val, default_val, field);
2421 return;
2422 }
2423 _upb_MiniTable_CopyFieldData(val, _upb_MiniTableField_GetConstPtr(msg, field),
2424 field);
2425}
2426
Eric Salo10505992022-12-12 12:16:36 -08002427UPB_INLINE void _upb_Message_GetExtensionField(
Eric Salo8809a112022-11-21 13:01:06 -08002428 const upb_Message* msg, const upb_MiniTableExtension* mt_ext,
2429 const void* default_val, void* val) {
2430 UPB_ASSUME(upb_MiniTableField_IsExtension(&mt_ext->field));
2431 const upb_Message_Extension* ext = _upb_Message_Getext(msg, mt_ext);
2432 if (ext) {
2433 _upb_MiniTable_CopyFieldData(val, &ext->data, &mt_ext->field);
2434 } else {
2435 _upb_MiniTable_CopyFieldData(val, default_val, &mt_ext->field);
2436 }
2437}
2438
Eric Salo10505992022-12-12 12:16:36 -08002439UPB_INLINE void _upb_Message_GetField(const upb_Message* msg,
2440 const upb_MiniTableField* field,
2441 const void* default_val, void* val) {
Eric Salo8809a112022-11-21 13:01:06 -08002442 if (upb_MiniTableField_IsExtension(field)) {
Eric Salo10505992022-12-12 12:16:36 -08002443 _upb_Message_GetExtensionField(msg, (upb_MiniTableExtension*)field,
2444 default_val, val);
Eric Salo8809a112022-11-21 13:01:06 -08002445 } else {
Eric Salo10505992022-12-12 12:16:36 -08002446 _upb_Message_GetNonExtensionField(msg, field, default_val, val);
Eric Salo8809a112022-11-21 13:01:06 -08002447 }
2448}
2449
Eric Salo10505992022-12-12 12:16:36 -08002450UPB_INLINE void _upb_Message_SetNonExtensionField(
Eric Salo8809a112022-11-21 13:01:06 -08002451 upb_Message* msg, const upb_MiniTableField* field, const void* val) {
2452 UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
Eric Salo10505992022-12-12 12:16:36 -08002453 _upb_Message_SetPresence(msg, field);
Eric Salo8809a112022-11-21 13:01:06 -08002454 _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), val,
2455 field);
2456}
2457
Eric Salo10505992022-12-12 12:16:36 -08002458UPB_INLINE bool _upb_Message_SetExtensionField(
Eric Salo8809a112022-11-21 13:01:06 -08002459 upb_Message* msg, const upb_MiniTableExtension* mt_ext, const void* val,
2460 upb_Arena* a) {
Eric Salo10505992022-12-12 12:16:36 -08002461 UPB_ASSERT(a);
Eric Salo8809a112022-11-21 13:01:06 -08002462 upb_Message_Extension* ext =
2463 _upb_Message_GetOrCreateExtension(msg, mt_ext, a);
2464 if (!ext) return false;
2465 _upb_MiniTable_CopyFieldData(&ext->data, val, &mt_ext->field);
2466 return true;
2467}
2468
Eric Salo10505992022-12-12 12:16:36 -08002469UPB_INLINE bool _upb_Message_SetField(upb_Message* msg,
2470 const upb_MiniTableField* field,
2471 const void* val, upb_Arena* a) {
Eric Salo8809a112022-11-21 13:01:06 -08002472 if (upb_MiniTableField_IsExtension(field)) {
Eric Salo10505992022-12-12 12:16:36 -08002473 const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field;
2474 return _upb_Message_SetExtensionField(msg, ext, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08002475 } else {
Eric Salo10505992022-12-12 12:16:36 -08002476 _upb_Message_SetNonExtensionField(msg, field, val);
Eric Salo8809a112022-11-21 13:01:06 -08002477 return true;
2478 }
2479}
2480
Eric Salo10505992022-12-12 12:16:36 -08002481UPB_INLINE void _upb_Message_ClearExtensionField(
2482 upb_Message* msg, const upb_MiniTableExtension* ext_l) {
2483 upb_Message_Internal* in = upb_Message_Getinternal(msg);
2484 if (!in->internal) return;
2485 const upb_Message_Extension* base =
2486 UPB_PTR_AT(in->internal, in->internal->ext_begin, upb_Message_Extension);
2487 upb_Message_Extension* ext =
2488 (upb_Message_Extension*)_upb_Message_Getext(msg, ext_l);
2489 if (ext) {
2490 *ext = *base;
2491 in->internal->ext_begin += sizeof(upb_Message_Extension);
Mike Kruskal3bc50492022-12-01 13:34:12 -08002492 }
2493}
2494
Eric Salo10505992022-12-12 12:16:36 -08002495UPB_INLINE void _upb_Message_ClearNonExtensionField(
Mike Kruskal3bc50492022-12-01 13:34:12 -08002496 upb_Message* msg, const upb_MiniTableField* field) {
2497 if (field->presence > 0) {
Eric Salob598b2d2022-12-22 23:14:27 -08002498 _upb_clearhas(msg, _upb_Message_Hasidx(field));
Mike Kruskal3bc50492022-12-01 13:34:12 -08002499 } else if (_upb_MiniTableField_InOneOf(field)) {
2500 uint32_t* oneof_case = _upb_oneofcase_field(msg, field);
2501 if (*oneof_case != field->number) return;
2502 *oneof_case = 0;
2503 }
2504 const char zeros[16] = {0};
2505 _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), zeros,
2506 field);
2507}
2508
Jie Luo3560e232023-06-12 00:33:50 -07002509UPB_INLINE void _upb_Message_AssertMapIsUntagged(
2510 const upb_Message* msg, const upb_MiniTableField* field) {
Adam Cozzette7d5592e2023-08-23 12:15:26 -07002511 UPB_UNUSED(msg);
Jie Luo3560e232023-06-12 00:33:50 -07002512 _upb_MiniTableField_CheckIsMap(field);
2513#ifndef NDEBUG
2514 upb_TaggedMessagePtr default_val = 0;
2515 upb_TaggedMessagePtr tagged;
2516 _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged);
2517 UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(tagged));
2518#endif
2519}
2520
Mike Kruskal232ecf42023-01-14 00:09:40 -08002521UPB_INLINE upb_Map* _upb_Message_GetOrCreateMutableMap(
Eric Salob7d54ac2022-12-29 11:59:42 -08002522 upb_Message* msg, const upb_MiniTableField* field, size_t key_size,
2523 size_t val_size, upb_Arena* arena) {
2524 _upb_MiniTableField_CheckIsMap(field);
Jie Luo3560e232023-06-12 00:33:50 -07002525 _upb_Message_AssertMapIsUntagged(msg, field);
Eric Salob7d54ac2022-12-29 11:59:42 -08002526 upb_Map* map = NULL;
2527 upb_Map* default_map_value = NULL;
2528 _upb_Message_GetNonExtensionField(msg, field, &default_map_value, &map);
2529 if (!map) {
2530 map = _upb_Map_New(arena, key_size, val_size);
2531 // Check again due to: https://godbolt.org/z/7WfaoKG1r
2532 _upb_MiniTableField_CheckIsMap(field);
2533 _upb_Message_SetNonExtensionField(msg, field, &map);
2534 }
2535 return map;
2536}
2537
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002538#ifdef __cplusplus
2539} /* extern "C" */
2540#endif
2541
2542#if defined(__GNUC__) && !defined(__clang__)
2543#pragma GCC diagnostic pop
2544#endif
2545
2546
Sandy Zhange3b09432023-08-07 09:30:02 -07002547#endif // UPB_MESSAGE_INTERNAL_ACCESSORS_H_
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002548
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002549#ifndef UPB_MESSAGE_INTERNAL_ARRAY_H_
2550#define UPB_MESSAGE_INTERNAL_ARRAY_H_
2551
2552#include <string.h>
2553
2554
2555// Must be last.
2556
2557#ifdef __cplusplus
2558extern "C" {
2559#endif
2560
2561// LINT.IfChange(struct_definition)
2562// Our internal representation for repeated fields.
2563struct upb_Array {
2564 uintptr_t data; /* Tagged ptr: low 3 bits of ptr are lg2(elem size). */
2565 size_t size; /* The number of elements in the array. */
2566 size_t capacity; /* Allocated storage. Measured in elements. */
2567};
2568// LINT.ThenChange(GoogleInternalName1)
2569
2570UPB_INLINE size_t _upb_Array_ElementSizeLg2(const upb_Array* arr) {
2571 size_t ret = arr->data & 7;
2572 UPB_ASSERT(ret <= 4);
2573 return ret;
2574}
2575
2576UPB_INLINE const void* _upb_array_constptr(const upb_Array* arr) {
2577 _upb_Array_ElementSizeLg2(arr); // Check assertion.
2578 return (void*)(arr->data & ~(uintptr_t)7);
2579}
2580
2581UPB_INLINE uintptr_t _upb_array_tagptr(void* ptr, int elem_size_lg2) {
2582 UPB_ASSERT(elem_size_lg2 <= 4);
2583 return (uintptr_t)ptr | elem_size_lg2;
2584}
2585
2586UPB_INLINE void* _upb_array_ptr(upb_Array* arr) {
2587 return (void*)_upb_array_constptr(arr);
2588}
2589
2590UPB_INLINE uintptr_t _upb_tag_arrptr(void* ptr, int elem_size_lg2) {
2591 UPB_ASSERT(elem_size_lg2 <= 4);
2592 UPB_ASSERT(((uintptr_t)ptr & 7) == 0);
2593 return (uintptr_t)ptr | (unsigned)elem_size_lg2;
2594}
2595
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002596UPB_INLINE upb_Array* _upb_Array_New(upb_Arena* a, size_t init_capacity,
2597 int elem_size_lg2) {
2598 UPB_ASSERT(elem_size_lg2 <= 4);
2599 const size_t arr_size = UPB_ALIGN_UP(sizeof(upb_Array), UPB_MALLOC_ALIGN);
2600 const size_t bytes = arr_size + (init_capacity << elem_size_lg2);
2601 upb_Array* arr = (upb_Array*)upb_Arena_Malloc(a, bytes);
2602 if (!arr) return NULL;
2603 arr->data = _upb_tag_arrptr(UPB_PTR_AT(arr, arr_size, void), elem_size_lg2);
2604 arr->size = 0;
2605 arr->capacity = init_capacity;
2606 return arr;
2607}
2608
2609// Resizes the capacity of the array to be at least min_size.
2610bool _upb_array_realloc(upb_Array* arr, size_t min_size, upb_Arena* arena);
2611
2612UPB_INLINE bool _upb_array_reserve(upb_Array* arr, size_t size,
2613 upb_Arena* arena) {
2614 if (arr->capacity < size) return _upb_array_realloc(arr, size, arena);
2615 return true;
2616}
2617
2618// Resize without initializing new elements.
2619UPB_INLINE bool _upb_Array_ResizeUninitialized(upb_Array* arr, size_t size,
2620 upb_Arena* arena) {
2621 UPB_ASSERT(size <= arr->size || arena); // Allow NULL arena when shrinking.
2622 if (!_upb_array_reserve(arr, size, arena)) return false;
2623 arr->size = size;
2624 return true;
2625}
2626
2627// This function is intended for situations where elem_size is compile-time
2628// constant or a known expression of the form (1 << lg2), so that the expression
2629// i*elem_size does not result in an actual multiplication.
2630UPB_INLINE void _upb_Array_Set(upb_Array* arr, size_t i, const void* data,
2631 size_t elem_size) {
2632 UPB_ASSERT(i < arr->size);
2633 UPB_ASSERT(elem_size == 1U << _upb_Array_ElementSizeLg2(arr));
2634 char* arr_data = (char*)_upb_array_ptr(arr);
2635 memcpy(arr_data + (i * elem_size), data, elem_size);
2636}
2637
2638UPB_INLINE void _upb_array_detach(const void* msg, size_t ofs) {
2639 *UPB_PTR_AT(msg, ofs, upb_Array*) = NULL;
2640}
2641
2642#ifdef __cplusplus
2643} /* extern "C" */
2644#endif
2645
2646
2647#endif /* UPB_MESSAGE_INTERNAL_ARRAY_H_ */
2648
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002649// Must be last.
2650
2651#ifdef __cplusplus
2652extern "C" {
2653#endif
Eric Salo10505992022-12-12 12:16:36 -08002654
2655UPB_API_INLINE void upb_Message_ClearField(upb_Message* msg,
2656 const upb_MiniTableField* field) {
Mike Kruskal3bc50492022-12-01 13:34:12 -08002657 if (upb_MiniTableField_IsExtension(field)) {
Eric Salo10505992022-12-12 12:16:36 -08002658 const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field;
2659 _upb_Message_ClearExtensionField(msg, ext);
Mike Kruskal3bc50492022-12-01 13:34:12 -08002660 } else {
Eric Salo10505992022-12-12 12:16:36 -08002661 _upb_Message_ClearNonExtensionField(msg, field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08002662 }
2663}
2664
Jie Luof36a5c62023-05-23 17:56:18 -07002665UPB_API_INLINE void upb_Message_Clear(upb_Message* msg,
2666 const upb_MiniTable* l) {
2667 // Note: Can't use UPB_PTR_AT() here because we are doing pointer subtraction.
2668 char* mem = (char*)msg - sizeof(upb_Message_Internal);
2669 memset(mem, 0, upb_msg_sizeof(l));
2670}
2671
Eric Salo10505992022-12-12 12:16:36 -08002672UPB_API_INLINE bool upb_Message_HasField(const upb_Message* msg,
2673 const upb_MiniTableField* field) {
2674 if (upb_MiniTableField_IsExtension(field)) {
2675 const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field;
2676 return _upb_Message_HasExtensionField(msg, ext);
2677 } else {
2678 return _upb_Message_HasNonExtensionField(msg, field);
2679 }
Mike Kruskal3bc50492022-12-01 13:34:12 -08002680}
Eric Salo8809a112022-11-21 13:01:06 -08002681
Eric Salob598b2d2022-12-22 23:14:27 -08002682UPB_API_INLINE uint32_t upb_Message_WhichOneofFieldNumber(
2683 const upb_Message* message, const upb_MiniTableField* oneof_field) {
2684 UPB_ASSUME(_upb_MiniTableField_InOneOf(oneof_field));
2685 return _upb_getoneofcase_field(message, oneof_field);
2686}
2687
Eric Salo10505992022-12-12 12:16:36 -08002688UPB_API_INLINE bool upb_Message_GetBool(const upb_Message* msg,
2689 const upb_MiniTableField* field,
2690 bool default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002691 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool);
Eric Salo8809a112022-11-21 13:01:06 -08002692 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002693 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002694 bool ret;
Eric Salo10505992022-12-12 12:16:36 -08002695 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002696 return ret;
2697}
2698
Eric Salo10505992022-12-12 12:16:36 -08002699UPB_API_INLINE bool upb_Message_SetBool(upb_Message* msg,
2700 const upb_MiniTableField* field,
2701 bool value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002702 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool);
Eric Salo8809a112022-11-21 13:01:06 -08002703 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002704 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002705 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002706}
2707
Eric Salo10505992022-12-12 12:16:36 -08002708UPB_API_INLINE int32_t upb_Message_GetInt32(const upb_Message* msg,
2709 const upb_MiniTableField* field,
2710 int32_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002711 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 ||
2712 upb_MiniTableField_CType(field) == kUpb_CType_Enum);
Eric Salo8809a112022-11-21 13:01:06 -08002713 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002714 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002715 int32_t ret;
Eric Salo10505992022-12-12 12:16:36 -08002716 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002717 return ret;
2718}
2719
Eric Salo10505992022-12-12 12:16:36 -08002720UPB_API_INLINE bool upb_Message_SetInt32(upb_Message* msg,
2721 const upb_MiniTableField* field,
2722 int32_t value, upb_Arena* a) {
Deanna Garciab26afb52023-04-25 13:37:18 -07002723 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 ||
2724 upb_MiniTableField_CType(field) == kUpb_CType_Enum);
Eric Salo8809a112022-11-21 13:01:06 -08002725 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002726 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002727 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002728}
2729
Eric Salo10505992022-12-12 12:16:36 -08002730UPB_API_INLINE uint32_t upb_Message_GetUInt32(const upb_Message* msg,
2731 const upb_MiniTableField* field,
2732 uint32_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002733 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32);
Eric Salo8809a112022-11-21 13:01:06 -08002734 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002735 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002736 uint32_t ret;
Eric Salo10505992022-12-12 12:16:36 -08002737 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002738 return ret;
2739}
2740
Eric Salo10505992022-12-12 12:16:36 -08002741UPB_API_INLINE bool upb_Message_SetUInt32(upb_Message* msg,
2742 const upb_MiniTableField* field,
2743 uint32_t value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002744 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32);
Eric Salo8809a112022-11-21 13:01:06 -08002745 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002746 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002747 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002748}
2749
Deanna Garciab26afb52023-04-25 13:37:18 -07002750UPB_API_INLINE void upb_Message_SetClosedEnum(
Eric Salo3f36a912022-12-05 14:12:25 -08002751 upb_Message* msg, const upb_MiniTable* msg_mini_table,
2752 const upb_MiniTableField* field, int32_t value) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002753 UPB_ASSERT(upb_MiniTableField_IsClosedEnum(field));
Eric Salo8809a112022-11-21 13:01:06 -08002754 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002755 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002756 UPB_ASSERT(upb_MiniTableEnum_CheckValue(
2757 upb_MiniTable_GetSubEnumTable(msg_mini_table, field), value));
Eric Salo10505992022-12-12 12:16:36 -08002758 _upb_Message_SetNonExtensionField(msg, field, &value);
Eric Salo8809a112022-11-21 13:01:06 -08002759}
2760
Eric Salo10505992022-12-12 12:16:36 -08002761UPB_API_INLINE int64_t upb_Message_GetInt64(const upb_Message* msg,
2762 const upb_MiniTableField* field,
2763 uint64_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002764 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64);
Eric Salo8809a112022-11-21 13:01:06 -08002765 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002766 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002767 int64_t ret;
Eric Salo10505992022-12-12 12:16:36 -08002768 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002769 return ret;
2770}
2771
Eric Salo10505992022-12-12 12:16:36 -08002772UPB_API_INLINE bool upb_Message_SetInt64(upb_Message* msg,
2773 const upb_MiniTableField* field,
2774 int64_t value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002775 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64);
Eric Salo8809a112022-11-21 13:01:06 -08002776 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002777 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002778 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002779}
2780
Eric Salo10505992022-12-12 12:16:36 -08002781UPB_API_INLINE uint64_t upb_Message_GetUInt64(const upb_Message* msg,
2782 const upb_MiniTableField* field,
2783 uint64_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002784 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64);
Eric Salo8809a112022-11-21 13:01:06 -08002785 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002786 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002787 uint64_t ret;
Eric Salo10505992022-12-12 12:16:36 -08002788 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002789 return ret;
2790}
2791
Eric Salo10505992022-12-12 12:16:36 -08002792UPB_API_INLINE bool upb_Message_SetUInt64(upb_Message* msg,
2793 const upb_MiniTableField* field,
2794 uint64_t value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002795 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64);
Eric Salo8809a112022-11-21 13:01:06 -08002796 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002797 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002798 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002799}
2800
Eric Salo10505992022-12-12 12:16:36 -08002801UPB_API_INLINE float upb_Message_GetFloat(const upb_Message* msg,
2802 const upb_MiniTableField* field,
2803 float default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002804 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float);
Eric Salo8809a112022-11-21 13:01:06 -08002805 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002806 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002807 float ret;
Eric Salo10505992022-12-12 12:16:36 -08002808 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002809 return ret;
2810}
2811
Eric Salo10505992022-12-12 12:16:36 -08002812UPB_API_INLINE bool upb_Message_SetFloat(upb_Message* msg,
2813 const upb_MiniTableField* field,
2814 float value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002815 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float);
Eric Salo8809a112022-11-21 13:01:06 -08002816 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002817 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002818 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002819}
2820
Eric Salo10505992022-12-12 12:16:36 -08002821UPB_API_INLINE double upb_Message_GetDouble(const upb_Message* msg,
2822 const upb_MiniTableField* field,
2823 double default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002824 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double);
Eric Salo8809a112022-11-21 13:01:06 -08002825 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002826 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002827 double ret;
Eric Salo10505992022-12-12 12:16:36 -08002828 _upb_Message_GetField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002829 return ret;
2830}
2831
Eric Salo10505992022-12-12 12:16:36 -08002832UPB_API_INLINE bool upb_Message_SetDouble(upb_Message* msg,
2833 const upb_MiniTableField* field,
2834 double value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002835 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double);
Eric Salo8809a112022-11-21 13:01:06 -08002836 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002837 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002838 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002839}
2840
Eric Salo3f36a912022-12-05 14:12:25 -08002841UPB_API_INLINE upb_StringView
Eric Salo10505992022-12-12 12:16:36 -08002842upb_Message_GetString(const upb_Message* msg, const upb_MiniTableField* field,
2843 upb_StringView def_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002844 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String ||
2845 upb_MiniTableField_CType(field) == kUpb_CType_Bytes);
Eric Salo8809a112022-11-21 13:01:06 -08002846 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002847 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo8809a112022-11-21 13:01:06 -08002848 upb_StringView ret;
Eric Salo10505992022-12-12 12:16:36 -08002849 _upb_Message_GetField(msg, field, &def_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002850 return ret;
2851}
2852
Eric Salo10505992022-12-12 12:16:36 -08002853UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg,
2854 const upb_MiniTableField* field,
2855 upb_StringView value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002856 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String ||
2857 upb_MiniTableField_CType(field) == kUpb_CType_Bytes);
Eric Salo8809a112022-11-21 13:01:06 -08002858 UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView);
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002859 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Eric Salo10505992022-12-12 12:16:36 -08002860 return _upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002861}
2862
Jie Luo3560e232023-06-12 00:33:50 -07002863UPB_API_INLINE upb_TaggedMessagePtr upb_Message_GetTaggedMessagePtr(
Eric Salo8809a112022-11-21 13:01:06 -08002864 const upb_Message* msg, const upb_MiniTableField* field,
2865 upb_Message* default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002866 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Eric Salo8809a112022-11-21 13:01:06 -08002867 UPB_ASSUME(_upb_MiniTableField_GetRep(field) ==
2868 UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002869 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Jie Luo3560e232023-06-12 00:33:50 -07002870 upb_TaggedMessagePtr tagged;
2871 _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged);
2872 return tagged;
Eric Salo8809a112022-11-21 13:01:06 -08002873}
2874
Jie Luo3560e232023-06-12 00:33:50 -07002875UPB_API_INLINE const upb_Message* upb_Message_GetMessage(
2876 const upb_Message* msg, const upb_MiniTableField* field,
2877 upb_Message* default_val) {
2878 upb_TaggedMessagePtr tagged =
2879 upb_Message_GetTaggedMessagePtr(msg, field, default_val);
2880 return upb_TaggedMessagePtr_GetNonEmptyMessage(tagged);
2881}
2882
2883// For internal use only; users cannot set tagged messages because only the
2884// parser and the message copier are allowed to directly create an empty
2885// message.
2886UPB_API_INLINE void _upb_Message_SetTaggedMessagePtr(
2887 upb_Message* msg, const upb_MiniTable* mini_table,
2888 const upb_MiniTableField* field, upb_TaggedMessagePtr sub_message) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002889 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Eric Salo8809a112022-11-21 13:01:06 -08002890 UPB_ASSUME(_upb_MiniTableField_GetRep(field) ==
2891 UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002892 UPB_ASSUME(!upb_IsRepeatedOrMap(field));
Deanna Garciac7d979d2023-04-14 17:22:13 -07002893 UPB_ASSERT(mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg);
Eric Salo10505992022-12-12 12:16:36 -08002894 _upb_Message_SetNonExtensionField(msg, field, &sub_message);
Eric Salo8809a112022-11-21 13:01:06 -08002895}
2896
Jie Luo3560e232023-06-12 00:33:50 -07002897UPB_API_INLINE void upb_Message_SetMessage(upb_Message* msg,
2898 const upb_MiniTable* mini_table,
2899 const upb_MiniTableField* field,
2900 upb_Message* sub_message) {
2901 _upb_Message_SetTaggedMessagePtr(
2902 msg, mini_table, field, _upb_TaggedMessagePtr_Pack(sub_message, false));
2903}
2904
Mike Kruskal232ecf42023-01-14 00:09:40 -08002905UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage(
Eric Salo8809a112022-11-21 13:01:06 -08002906 upb_Message* msg, const upb_MiniTable* mini_table,
2907 const upb_MiniTableField* field, upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002908 UPB_ASSERT(arena);
2909 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Eric Salo8809a112022-11-21 13:01:06 -08002910 upb_Message* sub_message = *UPB_PTR_AT(msg, field->offset, upb_Message*);
2911 if (!sub_message) {
2912 const upb_MiniTable* sub_mini_table =
Deanna Garciac7d979d2023-04-14 17:22:13 -07002913 mini_table->subs[field->UPB_PRIVATE(submsg_index)].submsg;
Eric Salo8809a112022-11-21 13:01:06 -08002914 UPB_ASSERT(sub_mini_table);
2915 sub_message = _upb_Message_New(sub_mini_table, arena);
2916 *UPB_PTR_AT(msg, field->offset, upb_Message*) = sub_message;
Eric Salo10505992022-12-12 12:16:36 -08002917 _upb_Message_SetPresence(msg, field);
Eric Salo8809a112022-11-21 13:01:06 -08002918 }
2919 return sub_message;
2920}
2921
Eric Salob598b2d2022-12-22 23:14:27 -08002922UPB_API_INLINE const upb_Array* upb_Message_GetArray(
Eric Salo8809a112022-11-21 13:01:06 -08002923 const upb_Message* msg, const upb_MiniTableField* field) {
Eric Salob7d54ac2022-12-29 11:59:42 -08002924 _upb_MiniTableField_CheckIsArray(field);
Deanna Garciac7d979d2023-04-14 17:22:13 -07002925 upb_Array* ret;
Eric Salo8809a112022-11-21 13:01:06 -08002926 const upb_Array* default_val = NULL;
Eric Salo10505992022-12-12 12:16:36 -08002927 _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08002928 return ret;
2929}
2930
Eric Salob598b2d2022-12-22 23:14:27 -08002931UPB_API_INLINE upb_Array* upb_Message_GetMutableArray(
Eric Salo8809a112022-11-21 13:01:06 -08002932 upb_Message* msg, const upb_MiniTableField* field) {
Eric Salob7d54ac2022-12-29 11:59:42 -08002933 _upb_MiniTableField_CheckIsArray(field);
Eric Salob598b2d2022-12-22 23:14:27 -08002934 return (upb_Array*)upb_Message_GetArray(msg, field);
Eric Salo8809a112022-11-21 13:01:06 -08002935}
2936
Eric Salob598b2d2022-12-22 23:14:27 -08002937UPB_API_INLINE upb_Array* upb_Message_GetOrCreateMutableArray(
Eric Salob7d54ac2022-12-29 11:59:42 -08002938 upb_Message* msg, const upb_MiniTableField* field, upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002939 UPB_ASSERT(arena);
Eric Salob7d54ac2022-12-29 11:59:42 -08002940 _upb_MiniTableField_CheckIsArray(field);
Eric Salob598b2d2022-12-22 23:14:27 -08002941 upb_Array* array = upb_Message_GetMutableArray(msg, field);
2942 if (!array) {
Eric Salob7d54ac2022-12-29 11:59:42 -08002943 array = _upb_Array_New(arena, 4, _upb_MiniTable_ElementSizeLg2(field));
2944 // Check again due to: https://godbolt.org/z/7WfaoKG1r
2945 _upb_MiniTableField_CheckIsArray(field);
Eric Salob598b2d2022-12-22 23:14:27 -08002946 _upb_Message_SetField(msg, field, &array, arena);
2947 }
2948 return array;
2949}
2950
Jie Luof36a5c62023-05-23 17:56:18 -07002951UPB_API_INLINE void* upb_Message_ResizeArrayUninitialized(
Eric Salob7d54ac2022-12-29 11:59:42 -08002952 upb_Message* msg, const upb_MiniTableField* field, size_t size,
2953 upb_Arena* arena) {
2954 _upb_MiniTableField_CheckIsArray(field);
2955 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, field, arena);
2956 if (!arr || !_upb_Array_ResizeUninitialized(arr, size, arena)) return NULL;
Eric Salob7d54ac2022-12-29 11:59:42 -08002957 return _upb_array_ptr(arr);
2958}
Eric Salo10505992022-12-12 12:16:36 -08002959
Eric Salob7d54ac2022-12-29 11:59:42 -08002960UPB_API_INLINE const upb_Map* upb_Message_GetMap(
2961 const upb_Message* msg, const upb_MiniTableField* field) {
2962 _upb_MiniTableField_CheckIsMap(field);
Jie Luo3560e232023-06-12 00:33:50 -07002963 _upb_Message_AssertMapIsUntagged(msg, field);
Deanna Garciac7d979d2023-04-14 17:22:13 -07002964 upb_Map* ret;
Eric Salob7d54ac2022-12-29 11:59:42 -08002965 const upb_Map* default_val = NULL;
2966 _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
2967 return ret;
2968}
2969
Jie Luo3560e232023-06-12 00:33:50 -07002970UPB_API_INLINE upb_Map* upb_Message_GetMutableMap(
2971 upb_Message* msg, const upb_MiniTableField* field) {
2972 return (upb_Map*)upb_Message_GetMap(msg, field);
2973}
2974
Mike Kruskal232ecf42023-01-14 00:09:40 -08002975UPB_API_INLINE upb_Map* upb_Message_GetOrCreateMutableMap(
Eric Salob598b2d2022-12-22 23:14:27 -08002976 upb_Message* msg, const upb_MiniTable* map_entry_mini_table,
2977 const upb_MiniTableField* field, upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002978 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Eric Salob7d54ac2022-12-29 11:59:42 -08002979 const upb_MiniTableField* map_entry_key_field =
2980 &map_entry_mini_table->fields[0];
2981 const upb_MiniTableField* map_entry_value_field =
2982 &map_entry_mini_table->fields[1];
Mike Kruskal232ecf42023-01-14 00:09:40 -08002983 return _upb_Message_GetOrCreateMutableMap(
Eric Salob7d54ac2022-12-29 11:59:42 -08002984 msg, field,
2985 _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_key_field)),
2986 _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_value_field)),
2987 arena);
Eric Salob598b2d2022-12-22 23:14:27 -08002988}
2989
2990// Updates a map entry given an entry message.
2991upb_MapInsertStatus upb_Message_InsertMapEntry(upb_Map* map,
2992 const upb_MiniTable* mini_table,
2993 const upb_MiniTableField* field,
2994 upb_Message* map_entry_message,
2995 upb_Arena* arena);
2996
Mike Kruskal9d435022023-07-11 12:45:07 -07002997// Compares two messages by serializing them and calling memcmp().
2998bool upb_Message_IsExactlyEqual(const upb_Message* m1, const upb_Message* m2,
2999 const upb_MiniTable* layout);
3000
Eric Salo8809a112022-11-21 13:01:06 -08003001#ifdef __cplusplus
3002} /* extern "C" */
3003#endif
3004
3005
3006#endif // UPB_MESSAGE_ACCESSORS_H_
3007
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00003008// These functions are only used by generated code.
3009
3010#ifndef UPB_MESSAGE_MAP_GENCODE_UTIL_H_
3011#define UPB_MESSAGE_MAP_GENCODE_UTIL_H_
3012
3013
3014// Must be last.
3015
3016#ifdef __cplusplus
3017extern "C" {
3018#endif
3019
3020// Message map operations, these get the map from the message first.
3021
3022UPB_INLINE void _upb_msg_map_key(const void* msg, void* key, size_t size) {
3023 const upb_tabent* ent = (const upb_tabent*)msg;
3024 uint32_t u32len;
3025 upb_StringView k;
3026 k.data = upb_tabstr(ent->key, &u32len);
3027 k.size = u32len;
3028 _upb_map_fromkey(k, key, size);
3029}
3030
3031UPB_INLINE void _upb_msg_map_value(const void* msg, void* val, size_t size) {
3032 const upb_tabent* ent = (const upb_tabent*)msg;
3033 upb_value v = {ent->val.val};
3034 _upb_map_fromvalue(v, val, size);
3035}
3036
3037UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val,
3038 size_t size) {
3039 upb_tabent* ent = (upb_tabent*)msg;
3040 // This is like _upb_map_tovalue() except the entry already exists
3041 // so we can reuse the allocated upb_StringView for string fields.
3042 if (size == UPB_MAPTYPE_STRING) {
3043 upb_StringView* strp = (upb_StringView*)(uintptr_t)ent->val.val;
3044 memcpy(strp, val, sizeof(*strp));
3045 } else {
3046 memcpy(&ent->val.val, val, size);
3047 }
3048}
3049
3050#ifdef __cplusplus
3051} /* extern "C" */
3052#endif
3053
3054
3055#endif /* UPB_MESSAGE_MAP_GENCODE_UTIL_H_ */
3056
Mike Kruskal9d435022023-07-11 12:45:07 -07003057#ifndef UPB_MINI_TABLE_DECODE_H_
3058#define UPB_MINI_TABLE_DECODE_H_
3059
3060
3061#ifndef UPB_MINI_TABLE_SUB_H_
3062#define UPB_MINI_TABLE_SUB_H_
3063
3064
3065typedef union upb_MiniTableSub upb_MiniTableSub;
3066
3067#endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */
3068
3069// Export the newer headers, for legacy users. New users should include the
3070// more specific headers directly.
3071// IWYU pragma: begin_exports
Mike Kruskal9d435022023-07-11 12:45:07 -07003072#ifndef UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3073#define UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3074
3075
3076// Must be last.
3077
3078#ifdef __cplusplus
3079extern "C" {
3080#endif
3081
3082// Builds a upb_MiniTableEnum from an enum MiniDescriptor. The MiniDescriptor
3083// must be for an enum, not a message.
3084UPB_API upb_MiniTableEnum* upb_MiniDescriptor_BuildEnum(const char* data,
3085 size_t len,
3086 upb_Arena* arena,
3087 upb_Status* status);
3088
Protobuf Team Bot986cbb62023-09-19 15:03:51 +00003089// TODO: Deprecated name; update callers.
Mike Kruskal9d435022023-07-11 12:45:07 -07003090UPB_API_INLINE upb_MiniTableEnum* upb_MiniTableEnum_Build(const char* data,
3091 size_t len,
3092 upb_Arena* arena,
3093 upb_Status* status) {
3094 return upb_MiniDescriptor_BuildEnum(data, len, arena, status);
3095}
3096
3097#ifdef __cplusplus
3098} /* extern "C" */
3099#endif
3100
3101
3102#endif // UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3103
3104// Functions for linking MiniTables together once they are built from a
3105// MiniDescriptor.
3106//
3107// These functions have names like upb_MiniTable_Link() because they operate on
3108// MiniTables. We put them here, rather than in the mini_table/ directory,
3109// because they are only needed when building MiniTables from MiniDescriptors.
3110// The interfaces in mini_table/ assume that MiniTables are immutable.
3111
3112#ifndef UPB_MINI_DESCRIPTOR_LINK_H_
3113#define UPB_MINI_DESCRIPTOR_LINK_H_
3114
3115
3116// Must be last.
3117
3118#ifdef __cplusplus
3119extern "C" {
3120#endif
3121
3122// Links a sub-message field to a MiniTable for that sub-message. If a
3123// sub-message field is not linked, it will be treated as an unknown field
3124// during parsing, and setting the field will not be allowed. It is possible
3125// to link the message field later, at which point it will no longer be treated
3126// as unknown. However there is no synchronization for this operation, which
3127// means parallel mutation requires external synchronization.
3128// Returns success/failure.
3129UPB_API bool upb_MiniTable_SetSubMessage(upb_MiniTable* table,
3130 upb_MiniTableField* field,
3131 const upb_MiniTable* sub);
3132
3133// Links an enum field to a MiniTable for that enum.
3134// All enum fields must be linked prior to parsing.
3135// Returns success/failure.
3136UPB_API bool upb_MiniTable_SetSubEnum(upb_MiniTable* table,
3137 upb_MiniTableField* field,
3138 const upb_MiniTableEnum* sub);
3139
3140// Returns a list of fields that require linking at runtime, to connect the
3141// MiniTable to its sub-messages and sub-enums. The list of fields will be
3142// written to the `subs` array, which must have been allocated by the caller
3143// and must be large enough to hold a list of all fields in the message.
3144//
3145// The order of the fields returned by this function is significant: it matches
3146// the order expected by upb_MiniTable_Link() below.
3147//
3148// The return value packs the sub-message count and sub-enum count into a single
3149// integer like so:
3150// return (msg_count << 16) | enum_count;
3151UPB_API uint32_t upb_MiniTable_GetSubList(const upb_MiniTable* mt,
3152 const upb_MiniTableField** subs);
3153
3154// Links a message to its sub-messages and sub-enums. The caller must pass
3155// arrays of sub-tables and sub-enums, in the same length and order as is
3156// returned by upb_MiniTable_GetSubList() above. However, individual elements
3157// of the sub_tables may be NULL if those sub-messages were tree shaken.
3158//
3159// Returns false if either array is too short, or if any of the tables fails
3160// to link.
3161UPB_API bool upb_MiniTable_Link(upb_MiniTable* mt,
3162 const upb_MiniTable** sub_tables,
3163 size_t sub_table_count,
3164 const upb_MiniTableEnum** sub_enums,
3165 size_t sub_enum_count);
3166
3167#ifdef __cplusplus
3168} /* extern "C" */
3169#endif
3170
3171
3172#endif // UPB_MINI_DESCRIPTOR_LINK_H_
3173// IWYU pragma: end_exports
3174
3175// Must be last.
3176
3177typedef enum {
3178 kUpb_MiniTablePlatform_32Bit,
3179 kUpb_MiniTablePlatform_64Bit,
3180 kUpb_MiniTablePlatform_Native =
3181 UPB_SIZE(kUpb_MiniTablePlatform_32Bit, kUpb_MiniTablePlatform_64Bit),
3182} upb_MiniTablePlatform;
3183
3184#ifdef __cplusplus
3185extern "C" {
3186#endif
3187
3188// Builds a mini table from the data encoded in the buffer [data, len]. If any
3189// errors occur, returns NULL and sets a status message. In the success case,
3190// the caller must call upb_MiniTable_SetSub*() for all message or proto2 enum
3191// fields to link the table to the appropriate sub-tables.
3192upb_MiniTable* _upb_MiniTable_Build(const char* data, size_t len,
3193 upb_MiniTablePlatform platform,
3194 upb_Arena* arena, upb_Status* status);
3195
3196UPB_API_INLINE upb_MiniTable* upb_MiniTable_Build(const char* data, size_t len,
3197 upb_Arena* arena,
3198 upb_Status* status) {
3199 return _upb_MiniTable_Build(data, len, kUpb_MiniTablePlatform_Native, arena,
3200 status);
3201}
3202
3203// Initializes a MiniTableExtension buffer that has already been allocated.
3204// This is needed by upb_FileDef and upb_MessageDef, which allocate all of the
3205// extensions together in a single contiguous array.
3206const char* _upb_MiniTableExtension_Init(const char* data, size_t len,
3207 upb_MiniTableExtension* ext,
3208 const upb_MiniTable* extendee,
3209 upb_MiniTableSub sub,
3210 upb_MiniTablePlatform platform,
3211 upb_Status* status);
3212
3213UPB_API_INLINE const char* upb_MiniTableExtension_Init(
3214 const char* data, size_t len, upb_MiniTableExtension* ext,
3215 const upb_MiniTable* extendee, upb_MiniTableSub sub, upb_Status* status) {
3216 return _upb_MiniTableExtension_Init(data, len, ext, extendee, sub,
3217 kUpb_MiniTablePlatform_Native, status);
3218}
3219
3220UPB_API upb_MiniTableExtension* _upb_MiniTableExtension_Build(
3221 const char* data, size_t len, const upb_MiniTable* extendee,
3222 upb_MiniTableSub sub, upb_MiniTablePlatform platform, upb_Arena* arena,
3223 upb_Status* status);
3224
3225UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_Build(
3226 const char* data, size_t len, const upb_MiniTable* extendee,
3227 upb_Arena* arena, upb_Status* status) {
3228 upb_MiniTableSub sub;
3229 sub.submsg = NULL;
3230 return _upb_MiniTableExtension_Build(
3231 data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
3232}
3233
3234UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildMessage(
3235 const char* data, size_t len, const upb_MiniTable* extendee,
3236 upb_MiniTable* submsg, upb_Arena* arena, upb_Status* status) {
3237 upb_MiniTableSub sub;
3238 sub.submsg = submsg;
3239 return _upb_MiniTableExtension_Build(
3240 data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
3241}
3242
3243UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildEnum(
3244 const char* data, size_t len, const upb_MiniTable* extendee,
3245 upb_MiniTableEnum* subenum, upb_Arena* arena, upb_Status* status) {
3246 upb_MiniTableSub sub;
3247 sub.subenum = subenum;
3248 return _upb_MiniTableExtension_Build(
3249 data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
3250}
3251
3252// Like upb_MiniTable_Build(), but the user provides a buffer of layout data so
3253// it can be reused from call to call, avoiding repeated realloc()/free().
3254//
3255// The caller owns `*buf` both before and after the call, and must free() it
3256// when it is no longer in use. The function will realloc() `*buf` as
3257// necessary, updating `*size` accordingly.
3258upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len,
3259 upb_MiniTablePlatform platform,
3260 upb_Arena* arena, void** buf,
3261 size_t* buf_size, upb_Status* status);
3262
3263#ifdef __cplusplus
3264} /* extern "C" */
3265#endif
3266
3267
3268#endif /* UPB_MINI_TABLE_DECODE_H_ */
3269
3270#ifndef UPB_MINI_TABLE_FILE_H_
3271#define UPB_MINI_TABLE_FILE_H_
3272
3273
3274#ifndef UPB_MINI_TABLE_INTERNAL_FILE_H_
3275#define UPB_MINI_TABLE_INTERNAL_FILE_H_
3276
3277
3278// Must be last.
3279
3280struct upb_MiniTableFile {
Sandy Zhange3b09432023-08-07 09:30:02 -07003281 const struct upb_MiniTable** msgs;
3282 const struct upb_MiniTableEnum** enums;
3283 const struct upb_MiniTableExtension** exts;
Mike Kruskal9d435022023-07-11 12:45:07 -07003284 int msg_count;
3285 int enum_count;
3286 int ext_count;
3287};
3288
3289
3290#endif /* UPB_MINI_TABLE_INTERNAL_FILE_H_ */
3291
3292typedef struct upb_MiniTableFile upb_MiniTableFile;
3293
3294#endif /* UPB_MINI_TABLE_FILE_H_ */
3295
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003296// upb_decode: parsing into a upb_Message using a upb_MiniTable.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003297
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003298#ifndef UPB_WIRE_DECODE_H_
3299#define UPB_WIRE_DECODE_H_
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003300
Protobuf Team Bot743bf922023-09-14 01:12:11 +00003301#include <stddef.h>
3302#include <stdint.h>
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003303
Adam Cozzette7d5592e2023-08-23 12:15:26 -07003304
Joshua Habermand3995ec2022-09-30 16:54:39 -07003305// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003306
3307#ifdef __cplusplus
3308extern "C" {
3309#endif
3310
3311enum {
Joshua Habermand3995ec2022-09-30 16:54:39 -07003312 /* If set, strings will alias the input buffer instead of copying into the
3313 * arena. */
3314 kUpb_DecodeOption_AliasString = 1,
3315
3316 /* If set, the parse will return failure if any message is missing any
3317 * required fields when the message data ends. The parse will still continue,
3318 * and the failure will only be reported at the end.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003319 *
Joshua Habermand3995ec2022-09-30 16:54:39 -07003320 * IMPORTANT CAVEATS:
3321 *
3322 * 1. This can throw a false positive failure if an incomplete message is seen
3323 * on the wire but is later completed when the sub-message occurs again.
3324 * For this reason, a second pass is required to verify a failure, to be
3325 * truly robust.
3326 *
3327 * 2. This can return a false success if you are decoding into a message that
3328 * already has some sub-message fields present. If the sub-message does
3329 * not occur in the binary payload, we will never visit it and discover the
3330 * incomplete sub-message. For this reason, this check is only useful for
3331 * implemting ParseFromString() semantics. For MergeFromString(), a
3332 * post-parse validation step will always be necessary. */
3333 kUpb_DecodeOption_CheckRequired = 2,
Jie Luo3560e232023-06-12 00:33:50 -07003334
3335 /* EXPERIMENTAL:
3336 *
3337 * If set, the parser will allow parsing of sub-message fields that were not
3338 * previously linked using upb_MiniTable_SetSubMessage(). The data will be
3339 * parsed into an internal "empty" message type that cannot be accessed
3340 * directly, but can be later promoted into the true message type if the
3341 * sub-message fields are linked at a later time.
3342 *
3343 * Users should set this option if they intend to perform dynamic tree shaking
3344 * and promoting using the interfaces in message/promote.h. If this option is
3345 * enabled, it is important that the resulting messages are only accessed by
3346 * code that is aware of promotion rules:
3347 *
3348 * 1. Message pointers in upb_Message, upb_Array, and upb_Map are represented
3349 * by a tagged pointer upb_TaggedMessagePointer. The tag indicates whether
3350 * the message uses the internal "empty" type.
3351 *
3352 * 2. Any code *reading* these message pointers must test whether the "empty"
3353 * tag bit is set, using the interfaces in mini_table/types.h. However
3354 * writing of message pointers should always use plain upb_Message*, since
3355 * users are not allowed to create "empty" messages.
3356 *
3357 * 3. It is always safe to test whether a field is present or test the array
3358 * length; these interfaces will reflect that empty messages are present,
3359 * even though their data cannot be accessed without promoting first.
3360 *
3361 * 4. If a message pointer is indeed tagged as empty, the message may not be
3362 * accessed directly, only promoted through the interfaces in
3363 * message/promote.h.
3364 *
3365 * 5. Tagged/empty messages may never be created by the user. They may only
3366 * be created by the parser or the message-copying logic in message/copy.h.
3367 */
3368 kUpb_DecodeOption_ExperimentalAllowUnlinked = 4,
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003369};
3370
Deanna Garciac7d979d2023-04-14 17:22:13 -07003371UPB_INLINE uint32_t upb_DecodeOptions_MaxDepth(uint16_t depth) {
3372 return (uint32_t)depth << 16;
3373}
3374
3375UPB_INLINE uint16_t upb_DecodeOptions_GetMaxDepth(uint32_t options) {
3376 return options >> 16;
3377}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003378
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07003379// Enforce an upper bound on recursion depth.
3380UPB_INLINE int upb_Decode_LimitDepth(uint32_t decode_options, uint32_t limit) {
Deanna Garciac7d979d2023-04-14 17:22:13 -07003381 uint32_t max_depth = upb_DecodeOptions_GetMaxDepth(decode_options);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07003382 if (max_depth > limit) max_depth = limit;
Deanna Garciac7d979d2023-04-14 17:22:13 -07003383 return upb_DecodeOptions_MaxDepth(max_depth) | (decode_options & 0xffff);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07003384}
3385
Joshua Habermand3995ec2022-09-30 16:54:39 -07003386typedef enum {
3387 kUpb_DecodeStatus_Ok = 0,
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003388 kUpb_DecodeStatus_Malformed = 1, // Wire format was corrupt
3389 kUpb_DecodeStatus_OutOfMemory = 2, // Arena alloc failed
3390 kUpb_DecodeStatus_BadUtf8 = 3, // String field had bad UTF-8
3391 kUpb_DecodeStatus_MaxDepthExceeded =
3392 4, // Exceeded upb_DecodeOptions_MaxDepth
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003393
Joshua Habermand3995ec2022-09-30 16:54:39 -07003394 // kUpb_DecodeOption_CheckRequired failed (see above), but the parse otherwise
3395 // succeeded.
3396 kUpb_DecodeStatus_MissingRequired = 5,
Jie Luo3560e232023-06-12 00:33:50 -07003397
3398 // Unlinked sub-message field was present, but
3399 // kUpb_DecodeOptions_ExperimentalAllowUnlinked was not specified in the list
3400 // of options.
3401 kUpb_DecodeStatus_UnlinkedSubMessage = 6,
Joshua Habermand3995ec2022-09-30 16:54:39 -07003402} upb_DecodeStatus;
3403
Eric Salo10505992022-12-12 12:16:36 -08003404UPB_API upb_DecodeStatus upb_Decode(const char* buf, size_t size,
3405 upb_Message* msg, const upb_MiniTable* l,
3406 const upb_ExtensionRegistry* extreg,
3407 int options, upb_Arena* arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003408
3409#ifdef __cplusplus
Joshua Habermanf41049a2022-01-21 14:41:25 -08003410} /* extern "C" */
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003411#endif
3412
Joshua Habermandd69a482021-05-17 22:40:33 -07003413
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003414#endif /* UPB_WIRE_DECODE_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -07003415
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003416// These are the specialized field parser functions for the fast parser.
3417// Generated tables will refer to these by name.
3418//
3419// The function names are encoded with names like:
3420//
3421// // 123 4
3422// upb_pss_1bt(); // Parse singular string, 1 byte tag.
3423//
3424// In position 1:
3425// - 'p' for parse, most function use this
3426// - 'c' for copy, for when we are copying strings instead of aliasing
3427//
3428// In position 2 (cardinality):
3429// - 's' for singular, with or without hasbit
3430// - 'o' for oneof
3431// - 'r' for non-packed repeated
3432// - 'p' for packed repeated
3433//
3434// In position 3 (type):
3435// - 'b1' for bool
3436// - 'v4' for 4-byte varint
3437// - 'v8' for 8-byte varint
3438// - 'z4' for zig-zag-encoded 4-byte varint
3439// - 'z8' for zig-zag-encoded 8-byte varint
3440// - 'f4' for 4-byte fixed
3441// - 'f8' for 8-byte fixed
3442// - 'm' for sub-message
3443// - 's' for string (validate UTF-8)
3444// - 'b' for bytes
3445//
3446// In position 4 (tag length):
3447// - '1' for one-byte tags (field numbers 1-15)
3448// - '2' for two-byte tags (field numbers 16-2048)
3449
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003450#ifndef UPB_WIRE_DECODE_FAST_H_
3451#define UPB_WIRE_DECODE_FAST_H_
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003452
3453
Joshua Habermand3995ec2022-09-30 16:54:39 -07003454// Must be last.
3455
3456#ifdef __cplusplus
3457extern "C" {
3458#endif
3459
Joshua Habermanf41049a2022-01-21 14:41:25 -08003460struct upb_Decoder;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003461
3462// The fallback, generic parsing function that can handle any field type.
3463// This just uses the regular (non-fast) parser to parse a single field.
Joshua Habermand3995ec2022-09-30 16:54:39 -07003464const char* _upb_FastDecoder_DecodeGeneric(struct upb_Decoder* d,
3465 const char* ptr, upb_Message* msg,
3466 intptr_t table, uint64_t hasbits,
3467 uint64_t data);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003468
Joshua Habermanf41049a2022-01-21 14:41:25 -08003469#define UPB_PARSE_PARAMS \
3470 struct upb_Decoder *d, const char *ptr, upb_Message *msg, intptr_t table, \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003471 uint64_t hasbits, uint64_t data
3472
3473/* primitive fields ***********************************************************/
3474
3475#define F(card, type, valbytes, tagbytes) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003476 const char* upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003477
3478#define TYPES(card, tagbytes) \
3479 F(card, b, 1, tagbytes) \
3480 F(card, v, 4, tagbytes) \
3481 F(card, v, 8, tagbytes) \
3482 F(card, z, 4, tagbytes) \
3483 F(card, z, 8, tagbytes) \
3484 F(card, f, 4, tagbytes) \
3485 F(card, f, 8, tagbytes)
3486
3487#define TAGBYTES(card) \
3488 TYPES(card, 1) \
3489 TYPES(card, 2)
3490
3491TAGBYTES(s)
3492TAGBYTES(o)
3493TAGBYTES(r)
3494TAGBYTES(p)
3495
3496#undef F
3497#undef TYPES
3498#undef TAGBYTES
3499
3500/* string fields **************************************************************/
3501
3502#define F(card, tagbytes, type) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003503 const char* upb_p##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); \
3504 const char* upb_c##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003505
3506#define UTF8(card, tagbytes) \
3507 F(card, tagbytes, s) \
3508 F(card, tagbytes, b)
3509
3510#define TAGBYTES(card) \
3511 UTF8(card, 1) \
3512 UTF8(card, 2)
3513
3514TAGBYTES(s)
3515TAGBYTES(o)
3516TAGBYTES(r)
3517
3518#undef F
3519#undef TAGBYTES
3520
3521/* sub-message fields *********************************************************/
3522
3523#define F(card, tagbytes, size_ceil, ceil_arg) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003524 const char* upb_p##card##m_##tagbytes##bt_max##size_ceil##b(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003525
3526#define SIZES(card, tagbytes) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003527 F(card, tagbytes, 64, 64) \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003528 F(card, tagbytes, 128, 128) \
3529 F(card, tagbytes, 192, 192) \
3530 F(card, tagbytes, 256, 256) \
3531 F(card, tagbytes, max, -1)
3532
3533#define TAGBYTES(card) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08003534 SIZES(card, 1) \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003535 SIZES(card, 2)
3536
3537TAGBYTES(s)
3538TAGBYTES(o)
3539TAGBYTES(r)
3540
3541#undef TAGBYTES
3542#undef SIZES
3543#undef F
3544
3545#undef UPB_PARSE_PARAMS
3546
Joshua Habermand3995ec2022-09-30 16:54:39 -07003547#ifdef __cplusplus
3548} /* extern "C" */
3549#endif
3550
3551
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003552#endif /* UPB_WIRE_DECODE_FAST_H_ */
Joshua Habermandd69a482021-05-17 22:40:33 -07003553
Eric Salo8809a112022-11-21 13:01:06 -08003554// upb_Encode: parsing from a upb_Message using a upb_MiniTable.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003555
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003556#ifndef UPB_WIRE_ENCODE_H_
3557#define UPB_WIRE_ENCODE_H_
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003558
Protobuf Team Bot743bf922023-09-14 01:12:11 +00003559#include <stddef.h>
3560#include <stdint.h>
3561
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003562
Joshua Habermand3995ec2022-09-30 16:54:39 -07003563// Must be last.
3564
3565#ifdef __cplusplus
3566extern "C" {
3567#endif
3568
3569enum {
3570 /* If set, the results of serializing will be deterministic across all
3571 * instances of this binary. There are no guarantees across different
3572 * binary builds.
3573 *
3574 * If your proto contains maps, the encoder will need to malloc()/free()
3575 * memory during encode. */
3576 kUpb_EncodeOption_Deterministic = 1,
3577
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003578 // When set, unknown fields are not printed.
Joshua Habermand3995ec2022-09-30 16:54:39 -07003579 kUpb_EncodeOption_SkipUnknown = 2,
3580
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003581 // When set, the encode will fail if any required fields are missing.
Joshua Habermand3995ec2022-09-30 16:54:39 -07003582 kUpb_EncodeOption_CheckRequired = 4,
3583};
3584
Joshua Habermand3995ec2022-09-30 16:54:39 -07003585typedef enum {
3586 kUpb_EncodeStatus_Ok = 0,
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003587 kUpb_EncodeStatus_OutOfMemory = 1, // Arena alloc failed
3588 kUpb_EncodeStatus_MaxDepthExceeded = 2,
Joshua Habermand3995ec2022-09-30 16:54:39 -07003589
3590 // kUpb_EncodeOption_CheckRequired failed but the parse otherwise succeeded.
3591 kUpb_EncodeStatus_MissingRequired = 3,
3592} upb_EncodeStatus;
3593
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003594UPB_INLINE uint32_t upb_EncodeOptions_MaxDepth(uint16_t depth) {
3595 return (uint32_t)depth << 16;
3596}
3597
3598UPB_INLINE uint16_t upb_EncodeOptions_GetMaxDepth(uint32_t options) {
3599 return options >> 16;
3600}
3601
3602// Enforce an upper bound on recursion depth.
3603UPB_INLINE int upb_Encode_LimitDepth(uint32_t encode_options, uint32_t limit) {
3604 uint32_t max_depth = upb_EncodeOptions_GetMaxDepth(encode_options);
3605 if (max_depth > limit) max_depth = limit;
3606 return upb_EncodeOptions_MaxDepth(max_depth) | (encode_options & 0xffff);
3607}
3608
Jason Lunn67dee292023-07-13 13:15:26 -07003609UPB_API upb_EncodeStatus upb_Encode(const void* msg, const upb_MiniTable* l,
3610 int options, upb_Arena* arena, char** buf,
3611 size_t* size);
Joshua Habermand3995ec2022-09-30 16:54:39 -07003612
3613#ifdef __cplusplus
3614} /* extern "C" */
3615#endif
3616
3617
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003618#endif /* UPB_WIRE_ENCODE_H_ */
Mike Kruskal9d435022023-07-11 12:45:07 -07003619// IWYU pragma: end_exports
3620
3621#endif // UPB_GENERATED_CODE_SUPPORT_H_
Protobuf Team Bot0cb912c2023-09-28 20:14:04 +00003622/* This file was generated by upb_generator from the input file:
Mike Kruskal9d435022023-07-11 12:45:07 -07003623 *
3624 * google/protobuf/descriptor.proto
3625 *
3626 * Do not edit -- your changes will be discarded when the file is
3627 * regenerated. */
3628
Protobuf Team Botd11eb712023-09-15 00:25:33 +00003629#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_
3630#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_
3631
3632
3633// Must be last.
3634
3635#ifdef __cplusplus
3636extern "C" {
3637#endif
3638
Protobuf Team Botd14a3362023-10-07 23:51:34 +00003639extern const upb_MiniTable google__protobuf__FileDescriptorSet_msg_init;
3640extern const upb_MiniTable google__protobuf__FileDescriptorProto_msg_init;
3641extern const upb_MiniTable google__protobuf__DescriptorProto_msg_init;
3642extern const upb_MiniTable google__protobuf__DescriptorProto__ExtensionRange_msg_init;
3643extern const upb_MiniTable google__protobuf__DescriptorProto__ReservedRange_msg_init;
3644extern const upb_MiniTable google__protobuf__ExtensionRangeOptions_msg_init;
3645extern const upb_MiniTable google__protobuf__ExtensionRangeOptions__Declaration_msg_init;
3646extern const upb_MiniTable google__protobuf__FieldDescriptorProto_msg_init;
3647extern const upb_MiniTable google__protobuf__OneofDescriptorProto_msg_init;
3648extern const upb_MiniTable google__protobuf__EnumDescriptorProto_msg_init;
3649extern const upb_MiniTable google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init;
3650extern const upb_MiniTable google__protobuf__EnumValueDescriptorProto_msg_init;
3651extern const upb_MiniTable google__protobuf__ServiceDescriptorProto_msg_init;
3652extern const upb_MiniTable google__protobuf__MethodDescriptorProto_msg_init;
3653extern const upb_MiniTable google__protobuf__FileOptions_msg_init;
3654extern const upb_MiniTable google__protobuf__MessageOptions_msg_init;
3655extern const upb_MiniTable google__protobuf__FieldOptions_msg_init;
3656extern const upb_MiniTable google__protobuf__FieldOptions__EditionDefault_msg_init;
3657extern const upb_MiniTable google__protobuf__OneofOptions_msg_init;
3658extern const upb_MiniTable google__protobuf__EnumOptions_msg_init;
3659extern const upb_MiniTable google__protobuf__EnumValueOptions_msg_init;
3660extern const upb_MiniTable google__protobuf__ServiceOptions_msg_init;
3661extern const upb_MiniTable google__protobuf__MethodOptions_msg_init;
3662extern const upb_MiniTable google__protobuf__UninterpretedOption_msg_init;
3663extern const upb_MiniTable google__protobuf__UninterpretedOption__NamePart_msg_init;
3664extern const upb_MiniTable google__protobuf__FeatureSet_msg_init;
3665extern const upb_MiniTable google__protobuf__FeatureSetDefaults_msg_init;
3666extern const upb_MiniTable google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init;
3667extern const upb_MiniTable google__protobuf__SourceCodeInfo_msg_init;
3668extern const upb_MiniTable google__protobuf__SourceCodeInfo__Location_msg_init;
3669extern const upb_MiniTable google__protobuf__GeneratedCodeInfo_msg_init;
3670extern const upb_MiniTable google__protobuf__GeneratedCodeInfo__Annotation_msg_init;
Protobuf Team Botd11eb712023-09-15 00:25:33 +00003671
3672extern const upb_MiniTableEnum google_protobuf_Edition_enum_init;
3673extern const upb_MiniTableEnum google_protobuf_ExtensionRangeOptions_VerificationState_enum_init;
3674extern const upb_MiniTableEnum google_protobuf_FeatureSet_EnumType_enum_init;
3675extern const upb_MiniTableEnum google_protobuf_FeatureSet_FieldPresence_enum_init;
3676extern const upb_MiniTableEnum google_protobuf_FeatureSet_JsonFormat_enum_init;
3677extern const upb_MiniTableEnum google_protobuf_FeatureSet_MessageEncoding_enum_init;
3678extern const upb_MiniTableEnum google_protobuf_FeatureSet_RepeatedFieldEncoding_enum_init;
Protobuf Team Bot61127952023-09-26 20:07:33 +00003679extern const upb_MiniTableEnum google_protobuf_FeatureSet_Utf8Validation_enum_init;
Protobuf Team Botd11eb712023-09-15 00:25:33 +00003680extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Label_enum_init;
3681extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Type_enum_init;
3682extern const upb_MiniTableEnum google_protobuf_FieldOptions_CType_enum_init;
3683extern const upb_MiniTableEnum google_protobuf_FieldOptions_JSType_enum_init;
3684extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionRetention_enum_init;
3685extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionTargetType_enum_init;
3686extern const upb_MiniTableEnum google_protobuf_FileOptions_OptimizeMode_enum_init;
3687extern const upb_MiniTableEnum google_protobuf_GeneratedCodeInfo_Annotation_Semantic_enum_init;
3688extern const upb_MiniTableEnum google_protobuf_MethodOptions_IdempotencyLevel_enum_init;
3689extern const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout;
3690
3691#ifdef __cplusplus
3692} /* extern "C" */
3693#endif
3694
3695
3696#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_ */
3697
3698#ifndef UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
3699#define UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
3700
3701#include <string.h>
3702
3703
3704// Must be last.
3705
3706#ifdef __cplusplus
3707extern "C" {
3708#endif
3709
3710// The maximum number of bytes a single protobuf field can take up in the
3711// wire format. We only want to do one bounds check per field, so the input
3712// stream guarantees that after upb_EpsCopyInputStream_IsDone() is called,
3713// the decoder can read this many bytes without performing another bounds
3714// check. The stream will copy into a patch buffer as necessary to guarantee
3715// this invariant.
3716#define kUpb_EpsCopyInputStream_SlopBytes 16
3717
3718enum {
3719 kUpb_EpsCopyInputStream_NoAliasing = 0,
3720 kUpb_EpsCopyInputStream_OnPatch = 1,
3721 kUpb_EpsCopyInputStream_NoDelta = 2
3722};
3723
3724typedef struct {
3725 const char* end; // Can read up to SlopBytes bytes beyond this.
3726 const char* limit_ptr; // For bounds checks, = end + UPB_MIN(limit, 0)
3727 uintptr_t aliasing;
3728 int limit; // Submessage limit relative to end
3729 bool error; // To distinguish between EOF and error.
3730 char patch[kUpb_EpsCopyInputStream_SlopBytes * 2];
3731} upb_EpsCopyInputStream;
3732
3733// Returns true if the stream is in the error state. A stream enters the error
3734// state when the user reads past a limit (caught in IsDone()) or the
3735// ZeroCopyInputStream returns an error.
3736UPB_INLINE bool upb_EpsCopyInputStream_IsError(upb_EpsCopyInputStream* e) {
3737 return e->error;
3738}
3739
3740typedef const char* upb_EpsCopyInputStream_BufferFlipCallback(
3741 upb_EpsCopyInputStream* e, const char* old_end, const char* new_start);
3742
3743typedef const char* upb_EpsCopyInputStream_IsDoneFallbackFunc(
3744 upb_EpsCopyInputStream* e, const char* ptr, int overrun);
3745
3746// Initializes a upb_EpsCopyInputStream using the contents of the buffer
3747// [*ptr, size]. Updates `*ptr` as necessary to guarantee that at least
3748// kUpb_EpsCopyInputStream_SlopBytes are available to read.
3749UPB_INLINE void upb_EpsCopyInputStream_Init(upb_EpsCopyInputStream* e,
3750 const char** ptr, size_t size,
3751 bool enable_aliasing) {
3752 if (size <= kUpb_EpsCopyInputStream_SlopBytes) {
3753 memset(&e->patch, 0, 32);
3754 if (size) memcpy(&e->patch, *ptr, size);
3755 e->aliasing = enable_aliasing ? (uintptr_t)*ptr - (uintptr_t)e->patch
3756 : kUpb_EpsCopyInputStream_NoAliasing;
3757 *ptr = e->patch;
3758 e->end = *ptr + size;
3759 e->limit = 0;
3760 } else {
3761 e->end = *ptr + size - kUpb_EpsCopyInputStream_SlopBytes;
3762 e->limit = kUpb_EpsCopyInputStream_SlopBytes;
3763 e->aliasing = enable_aliasing ? kUpb_EpsCopyInputStream_NoDelta
3764 : kUpb_EpsCopyInputStream_NoAliasing;
3765 }
3766 e->limit_ptr = e->end;
3767 e->error = false;
3768}
3769
3770typedef enum {
3771 // The current stream position is at a limit.
3772 kUpb_IsDoneStatus_Done,
3773
3774 // The current stream position is not at a limit.
3775 kUpb_IsDoneStatus_NotDone,
3776
3777 // The current stream position is not at a limit, and the stream needs to
3778 // be flipped to a new buffer before more data can be read.
3779 kUpb_IsDoneStatus_NeedFallback,
3780} upb_IsDoneStatus;
3781
3782// Returns the status of the current stream position. This is a low-level
3783// function, it is simpler to call upb_EpsCopyInputStream_IsDone() if possible.
3784UPB_INLINE upb_IsDoneStatus upb_EpsCopyInputStream_IsDoneStatus(
3785 upb_EpsCopyInputStream* e, const char* ptr, int* overrun) {
3786 *overrun = ptr - e->end;
3787 if (UPB_LIKELY(ptr < e->limit_ptr)) {
3788 return kUpb_IsDoneStatus_NotDone;
3789 } else if (UPB_LIKELY(*overrun == e->limit)) {
3790 return kUpb_IsDoneStatus_Done;
3791 } else {
3792 return kUpb_IsDoneStatus_NeedFallback;
3793 }
3794}
3795
3796// Returns true if the stream has hit a limit, either the current delimited
3797// limit or the overall end-of-stream. As a side effect, this function may flip
3798// the pointer to a new buffer if there are less than
3799// kUpb_EpsCopyInputStream_SlopBytes of data to be read in the current buffer.
3800//
3801// Postcondition: if the function returns false, there are at least
3802// kUpb_EpsCopyInputStream_SlopBytes of data available to read at *ptr.
3803UPB_INLINE bool upb_EpsCopyInputStream_IsDoneWithCallback(
3804 upb_EpsCopyInputStream* e, const char** ptr,
3805 upb_EpsCopyInputStream_IsDoneFallbackFunc* func) {
3806 int overrun;
3807 switch (upb_EpsCopyInputStream_IsDoneStatus(e, *ptr, &overrun)) {
3808 case kUpb_IsDoneStatus_Done:
3809 return true;
3810 case kUpb_IsDoneStatus_NotDone:
3811 return false;
3812 case kUpb_IsDoneStatus_NeedFallback:
3813 *ptr = func(e, *ptr, overrun);
3814 return *ptr == NULL;
3815 }
3816 UPB_UNREACHABLE();
3817}
3818
3819const char* _upb_EpsCopyInputStream_IsDoneFallbackNoCallback(
3820 upb_EpsCopyInputStream* e, const char* ptr, int overrun);
3821
3822// A simpler version of IsDoneWithCallback() that does not support a buffer flip
3823// callback. Useful in cases where we do not need to insert custom logic at
3824// every buffer flip.
3825//
3826// If this returns true, the user must call upb_EpsCopyInputStream_IsError()
3827// to distinguish between EOF and error.
3828UPB_INLINE bool upb_EpsCopyInputStream_IsDone(upb_EpsCopyInputStream* e,
3829 const char** ptr) {
3830 return upb_EpsCopyInputStream_IsDoneWithCallback(
3831 e, ptr, _upb_EpsCopyInputStream_IsDoneFallbackNoCallback);
3832}
3833
3834// Returns the total number of bytes that are safe to read from the current
3835// buffer without reading uninitialized or unallocated memory.
3836//
3837// Note that this check does not respect any semantic limits on the stream,
3838// either limits from PushLimit() or the overall stream end, so some of these
3839// bytes may have unpredictable, nonsense values in them. The guarantee is only
3840// that the bytes are valid to read from the perspective of the C language
3841// (ie. you can read without triggering UBSAN or ASAN).
3842UPB_INLINE size_t upb_EpsCopyInputStream_BytesAvailable(
3843 upb_EpsCopyInputStream* e, const char* ptr) {
3844 return (e->end - ptr) + kUpb_EpsCopyInputStream_SlopBytes;
3845}
3846
3847// Returns true if the given delimited field size is valid (it does not extend
3848// beyond any previously-pushed limits). `ptr` should point to the beginning
3849// of the field data, after the delimited size.
3850//
3851// Note that this does *not* guarantee that all of the data for this field is in
3852// the current buffer.
3853UPB_INLINE bool upb_EpsCopyInputStream_CheckSize(
3854 const upb_EpsCopyInputStream* e, const char* ptr, int size) {
3855 UPB_ASSERT(size >= 0);
3856 return ptr - e->end + size <= e->limit;
3857}
3858
3859UPB_INLINE bool _upb_EpsCopyInputStream_CheckSizeAvailable(
3860 upb_EpsCopyInputStream* e, const char* ptr, int size, bool submessage) {
3861 // This is one extra branch compared to the more normal:
3862 // return (size_t)(end - ptr) < size;
3863 // However it is one less computation if we are just about to use "ptr + len":
3864 // https://godbolt.org/z/35YGPz
3865 // In microbenchmarks this shows a small improvement.
3866 uintptr_t uptr = (uintptr_t)ptr;
3867 uintptr_t uend = (uintptr_t)e->limit_ptr;
3868 uintptr_t res = uptr + (size_t)size;
3869 if (!submessage) uend += kUpb_EpsCopyInputStream_SlopBytes;
3870 // NOTE: this check depends on having a linear address space. This is not
3871 // technically guaranteed by uintptr_t.
3872 bool ret = res >= uptr && res <= uend;
3873 if (size < 0) UPB_ASSERT(!ret);
3874 return ret;
3875}
3876
3877// Returns true if the given delimited field size is valid (it does not extend
3878// beyond any previously-pushed limited) *and* all of the data for this field is
3879// available to be read in the current buffer.
3880//
3881// If the size is negative, this function will always return false. This
3882// property can be useful in some cases.
3883UPB_INLINE bool upb_EpsCopyInputStream_CheckDataSizeAvailable(
3884 upb_EpsCopyInputStream* e, const char* ptr, int size) {
3885 return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, false);
3886}
3887
3888// Returns true if the given sub-message size is valid (it does not extend
3889// beyond any previously-pushed limited) *and* all of the data for this
3890// sub-message is available to be parsed in the current buffer.
3891//
3892// This implies that all fields from the sub-message can be parsed from the
3893// current buffer while maintaining the invariant that we always have at least
3894// kUpb_EpsCopyInputStream_SlopBytes of data available past the beginning of
3895// any individual field start.
3896//
3897// If the size is negative, this function will always return false. This
3898// property can be useful in some cases.
3899UPB_INLINE bool upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(
3900 upb_EpsCopyInputStream* e, const char* ptr, int size) {
3901 return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, true);
3902}
3903
3904// Returns true if aliasing_enabled=true was passed to
3905// upb_EpsCopyInputStream_Init() when this stream was initialized.
3906UPB_INLINE bool upb_EpsCopyInputStream_AliasingEnabled(
3907 upb_EpsCopyInputStream* e) {
3908 return e->aliasing != kUpb_EpsCopyInputStream_NoAliasing;
3909}
3910
3911// Returns true if aliasing_enabled=true was passed to
3912// upb_EpsCopyInputStream_Init() when this stream was initialized *and* we can
3913// alias into the region [ptr, size] in an input buffer.
3914UPB_INLINE bool upb_EpsCopyInputStream_AliasingAvailable(
3915 upb_EpsCopyInputStream* e, const char* ptr, size_t size) {
3916 // When EpsCopyInputStream supports streaming, this will need to become a
3917 // runtime check.
3918 return upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size) &&
3919 e->aliasing >= kUpb_EpsCopyInputStream_NoDelta;
3920}
3921
3922// Returns a pointer into an input buffer that corresponds to the parsing
3923// pointer `ptr`. The returned pointer may be the same as `ptr`, but also may
3924// be different if we are currently parsing out of the patch buffer.
3925//
3926// REQUIRES: Aliasing must be available for the given pointer. If the input is a
3927// flat buffer and aliasing is enabled, then aliasing will always be available.
3928UPB_INLINE const char* upb_EpsCopyInputStream_GetAliasedPtr(
3929 upb_EpsCopyInputStream* e, const char* ptr) {
3930 UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, ptr, 0));
3931 uintptr_t delta =
3932 e->aliasing == kUpb_EpsCopyInputStream_NoDelta ? 0 : e->aliasing;
3933 return (const char*)((uintptr_t)ptr + delta);
3934}
3935
3936// Reads string data from the input, aliasing into the input buffer instead of
3937// copying. The parsing pointer is passed in `*ptr`, and will be updated if
3938// necessary to point to the actual input buffer. Returns the new parsing
3939// pointer, which will be advanced past the string data.
3940//
3941// REQUIRES: Aliasing must be available for this data region (test with
3942// upb_EpsCopyInputStream_AliasingAvailable().
3943UPB_INLINE const char* upb_EpsCopyInputStream_ReadStringAliased(
3944 upb_EpsCopyInputStream* e, const char** ptr, size_t size) {
3945 UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size));
3946 const char* ret = *ptr + size;
3947 *ptr = upb_EpsCopyInputStream_GetAliasedPtr(e, *ptr);
3948 UPB_ASSUME(ret != NULL);
3949 return ret;
3950}
3951
3952// Skips `size` bytes of data from the input and returns a pointer past the end.
3953// Returns NULL on end of stream or error.
3954UPB_INLINE const char* upb_EpsCopyInputStream_Skip(upb_EpsCopyInputStream* e,
3955 const char* ptr, int size) {
3956 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL;
3957 return ptr + size;
3958}
3959
3960// Copies `size` bytes of data from the input `ptr` into the buffer `to`, and
3961// returns a pointer past the end. Returns NULL on end of stream or error.
3962UPB_INLINE const char* upb_EpsCopyInputStream_Copy(upb_EpsCopyInputStream* e,
3963 const char* ptr, void* to,
3964 int size) {
3965 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL;
3966 memcpy(to, ptr, size);
3967 return ptr + size;
3968}
3969
3970// Reads string data from the stream and advances the pointer accordingly.
3971// If aliasing was enabled when the stream was initialized, then the returned
3972// pointer will point into the input buffer if possible, otherwise new data
3973// will be allocated from arena and copied into. We may be forced to copy even
3974// if aliasing was enabled if the input data spans input buffers.
3975//
3976// Returns NULL if memory allocation failed, or we reached a premature EOF.
3977UPB_INLINE const char* upb_EpsCopyInputStream_ReadString(
3978 upb_EpsCopyInputStream* e, const char** ptr, size_t size,
3979 upb_Arena* arena) {
3980 if (upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size)) {
3981 return upb_EpsCopyInputStream_ReadStringAliased(e, ptr, size);
3982 } else {
3983 // We need to allocate and copy.
3984 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, *ptr, size)) {
3985 return NULL;
3986 }
3987 UPB_ASSERT(arena);
3988 char* data = (char*)upb_Arena_Malloc(arena, size);
3989 if (!data) return NULL;
3990 const char* ret = upb_EpsCopyInputStream_Copy(e, *ptr, data, size);
3991 *ptr = data;
3992 return ret;
3993 }
3994}
3995
3996UPB_INLINE void _upb_EpsCopyInputStream_CheckLimit(upb_EpsCopyInputStream* e) {
3997 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
3998}
3999
4000// Pushes a limit onto the stack of limits for the current stream. The limit
4001// will extend for `size` bytes beyond the position in `ptr`. Future calls to
4002// upb_EpsCopyInputStream_IsDone() will return `true` when the stream position
4003// reaches this limit.
4004//
4005// Returns a delta that the caller must store and supply to PopLimit() below.
4006UPB_INLINE int upb_EpsCopyInputStream_PushLimit(upb_EpsCopyInputStream* e,
4007 const char* ptr, int size) {
4008 int limit = size + (int)(ptr - e->end);
4009 int delta = e->limit - limit;
4010 _upb_EpsCopyInputStream_CheckLimit(e);
4011 UPB_ASSERT(limit <= e->limit);
4012 e->limit = limit;
4013 e->limit_ptr = e->end + UPB_MIN(0, limit);
4014 _upb_EpsCopyInputStream_CheckLimit(e);
4015 return delta;
4016}
4017
4018// Pops the last limit that was pushed on this stream. This may only be called
4019// once IsDone() returns true. The user must pass the delta that was returned
4020// from PushLimit().
4021UPB_INLINE void upb_EpsCopyInputStream_PopLimit(upb_EpsCopyInputStream* e,
4022 const char* ptr,
4023 int saved_delta) {
4024 UPB_ASSERT(ptr - e->end == e->limit);
4025 _upb_EpsCopyInputStream_CheckLimit(e);
4026 e->limit += saved_delta;
4027 e->limit_ptr = e->end + UPB_MIN(0, e->limit);
4028 _upb_EpsCopyInputStream_CheckLimit(e);
4029}
4030
4031UPB_INLINE const char* _upb_EpsCopyInputStream_IsDoneFallbackInline(
4032 upb_EpsCopyInputStream* e, const char* ptr, int overrun,
4033 upb_EpsCopyInputStream_BufferFlipCallback* callback) {
4034 if (overrun < e->limit) {
4035 // Need to copy remaining data into patch buffer.
4036 UPB_ASSERT(overrun < kUpb_EpsCopyInputStream_SlopBytes);
4037 const char* old_end = ptr;
4038 const char* new_start = &e->patch[0] + overrun;
4039 memset(e->patch + kUpb_EpsCopyInputStream_SlopBytes, 0,
4040 kUpb_EpsCopyInputStream_SlopBytes);
4041 memcpy(e->patch, e->end, kUpb_EpsCopyInputStream_SlopBytes);
4042 ptr = new_start;
4043 e->end = &e->patch[kUpb_EpsCopyInputStream_SlopBytes];
4044 e->limit -= kUpb_EpsCopyInputStream_SlopBytes;
4045 e->limit_ptr = e->end + e->limit;
4046 UPB_ASSERT(ptr < e->limit_ptr);
4047 if (e->aliasing != kUpb_EpsCopyInputStream_NoAliasing) {
4048 e->aliasing = (uintptr_t)old_end - (uintptr_t)new_start;
4049 }
4050 return callback(e, old_end, new_start);
4051 } else {
4052 UPB_ASSERT(overrun > e->limit);
4053 e->error = true;
4054 return callback(e, NULL, NULL);
4055 }
4056}
4057
4058typedef const char* upb_EpsCopyInputStream_ParseDelimitedFunc(
4059 upb_EpsCopyInputStream* e, const char* ptr, void* ctx);
4060
4061// Tries to perform a fast-path handling of the given delimited message data.
4062// If the sub-message beginning at `*ptr` and extending for `len` is short and
4063// fits within this buffer, calls `func` with `ctx` as a parameter, where the
4064// pushing and popping of limits is handled automatically and with lower cost
4065// than the normal PushLimit()/PopLimit() sequence.
4066static UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast(
4067 upb_EpsCopyInputStream* e, const char** ptr, int len,
4068 upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) {
4069 if (!upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(e, *ptr, len)) {
4070 return false;
4071 }
4072
4073 // Fast case: Sub-message is <128 bytes and fits in the current buffer.
4074 // This means we can preserve limit/limit_ptr verbatim.
4075 const char* saved_limit_ptr = e->limit_ptr;
4076 int saved_limit = e->limit;
4077 e->limit_ptr = *ptr + len;
4078 e->limit = e->limit_ptr - e->end;
4079 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
4080 *ptr = func(e, *ptr, ctx);
4081 e->limit_ptr = saved_limit_ptr;
4082 e->limit = saved_limit;
4083 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
4084 return true;
4085}
4086
4087#ifdef __cplusplus
4088} /* extern "C" */
4089#endif
4090
4091
4092#endif // UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
4093
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00004094#ifndef UPB_BASE_INTERNAL_LOG2_H_
4095#define UPB_BASE_INTERNAL_LOG2_H_
4096
4097// Must be last.
4098
4099#ifdef __cplusplus
4100extern "C" {
4101#endif
4102
4103UPB_INLINE int upb_Log2Ceiling(int x) {
4104 if (x <= 1) return 0;
4105#ifdef __GNUC__
4106 return 32 - __builtin_clz(x - 1);
4107#else
4108 int lg2 = 0;
4109 while ((1 << lg2) < x) lg2++;
4110 return lg2;
4111#endif
4112}
4113
4114UPB_INLINE int upb_Log2CeilingSize(int x) { return 1 << upb_Log2Ceiling(x); }
4115
4116#ifdef __cplusplus
4117} /* extern "C" */
4118#endif
4119
4120
4121#endif /* UPB_BASE_INTERNAL_LOG2_H_ */
4122
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004123#ifndef UPB_HASH_INT_TABLE_H_
4124#define UPB_HASH_INT_TABLE_H_
4125
4126
4127// Must be last.
4128
4129typedef struct {
4130 upb_table t; // For entries that don't fit in the array part.
4131 const upb_tabval* array; // Array part of the table. See const note above.
4132 size_t array_size; // Array part size.
4133 size_t array_count; // Array part number of elements.
4134} upb_inttable;
4135
4136#ifdef __cplusplus
4137extern "C" {
4138#endif
4139
4140// Initialize a table. If memory allocation failed, false is returned and
4141// the table is uninitialized.
4142bool upb_inttable_init(upb_inttable* table, upb_Arena* a);
4143
4144// Returns the number of values in the table.
4145size_t upb_inttable_count(const upb_inttable* t);
4146
4147// Inserts the given key into the hashtable with the given value.
4148// The key must not already exist in the hash table.
4149// The value must not be UINTPTR_MAX.
4150//
4151// If a table resize was required but memory allocation failed, false is
4152// returned and the table is unchanged.
4153bool upb_inttable_insert(upb_inttable* t, uintptr_t key, upb_value val,
4154 upb_Arena* a);
4155
4156// Looks up key in this table, returning "true" if the key was found.
4157// If v is non-NULL, copies the value for this key into *v.
4158bool upb_inttable_lookup(const upb_inttable* t, uintptr_t key, upb_value* v);
4159
4160// Removes an item from the table. Returns true if the remove was successful,
4161// and stores the removed item in *val if non-NULL.
4162bool upb_inttable_remove(upb_inttable* t, uintptr_t key, upb_value* val);
4163
4164// Updates an existing entry in an inttable.
4165// If the entry does not exist, returns false and does nothing.
4166// Unlike insert/remove, this does not invalidate iterators.
4167bool upb_inttable_replace(upb_inttable* t, uintptr_t key, upb_value val);
4168
4169// Optimizes the table for the current set of entries, for both memory use and
4170// lookup time. Client should call this after all entries have been inserted;
4171// inserting more entries is legal, but will likely require a table resize.
4172void upb_inttable_compact(upb_inttable* t, upb_Arena* a);
4173
4174// Iteration over inttable:
4175//
4176// intptr_t iter = UPB_INTTABLE_BEGIN;
4177// uintptr_t key;
4178// upb_value val;
4179// while (upb_inttable_next(t, &key, &val, &iter)) {
4180// // ...
4181// }
4182
4183#define UPB_INTTABLE_BEGIN -1
4184
4185bool upb_inttable_next(const upb_inttable* t, uintptr_t* key, upb_value* val,
4186 intptr_t* iter);
4187void upb_inttable_removeiter(upb_inttable* t, intptr_t* iter);
4188
4189#ifdef __cplusplus
4190} /* extern "C" */
4191#endif
4192
4193
4194#endif /* UPB_HASH_INT_TABLE_H_ */
4195
4196#ifndef UPB_JSON_DECODE_H_
4197#define UPB_JSON_DECODE_H_
4198
4199
4200#ifndef UPB_REFLECTION_DEF_H_
4201#define UPB_REFLECTION_DEF_H_
4202
4203// IWYU pragma: begin_exports
4204
Protobuf Team Bot06310352023-09-26 21:54:58 +00004205// IWYU pragma: private, include "upb/reflection/def.h"
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004206
4207#ifndef UPB_REFLECTION_DEF_POOL_H_
4208#define UPB_REFLECTION_DEF_POOL_H_
4209
4210
Protobuf Team Bot06310352023-09-26 21:54:58 +00004211// IWYU pragma: private, include "upb/reflection/def.h"
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004212
4213// Declarations common to all public def types.
4214
4215#ifndef UPB_REFLECTION_COMMON_H_
4216#define UPB_REFLECTION_COMMON_H_
4217
4218// begin:google_only
4219// #ifndef UPB_BOOTSTRAP_STAGE0
4220// #include "net/proto2/proto/descriptor.upb.h"
4221// #else
4222// #include "google/protobuf/descriptor.upb.h"
4223// #endif
4224// end:google_only
4225
4226// begin:github_only
Protobuf Team Bot0cb912c2023-09-28 20:14:04 +00004227/* This file was generated by upb_generator from the input file:
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004228 *
4229 * google/protobuf/descriptor.proto
4230 *
4231 * Do not edit -- your changes will be discarded when the file is
4232 * regenerated. */
4233
Mike Kruskal9d435022023-07-11 12:45:07 -07004234#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
4235#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -07004236
Protobuf Team Bot111d6552023-09-15 21:07:08 +00004237
4238
4239// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004240
4241#ifdef __cplusplus
4242extern "C" {
4243#endif
4244
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004245typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet;
4246typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto;
4247typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto;
4248typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange;
4249typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange;
4250typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions;
Mike Kruskal145900f2023-03-27 09:55:52 -07004251typedef struct google_protobuf_ExtensionRangeOptions_Declaration google_protobuf_ExtensionRangeOptions_Declaration;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004252typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto;
4253typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto;
4254typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto;
4255typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange;
4256typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto;
4257typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto;
4258typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto;
4259typedef struct google_protobuf_FileOptions google_protobuf_FileOptions;
4260typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions;
4261typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07004262typedef struct google_protobuf_FieldOptions_EditionDefault google_protobuf_FieldOptions_EditionDefault;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004263typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions;
4264typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions;
4265typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions;
4266typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions;
4267typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions;
4268typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption;
4269typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07004270typedef struct google_protobuf_FeatureSet google_protobuf_FeatureSet;
Mike Kruskalba964702023-08-22 17:37:48 -07004271typedef struct google_protobuf_FeatureSetDefaults google_protobuf_FeatureSetDefaults;
4272typedef struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004273typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo;
4274typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location;
4275typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo;
4276typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004277
4278typedef enum {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00004279 google_protobuf_EDITION_UNKNOWN = 0,
4280 google_protobuf_EDITION_1_TEST_ONLY = 1,
4281 google_protobuf_EDITION_2_TEST_ONLY = 2,
Protobuf Team Bot67038022023-10-04 04:14:37 +00004282 google_protobuf_EDITION_PROTO2 = 998,
4283 google_protobuf_EDITION_PROTO3 = 999,
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00004284 google_protobuf_EDITION_2023 = 1000,
4285 google_protobuf_EDITION_99997_TEST_ONLY = 99997,
4286 google_protobuf_EDITION_99998_TEST_ONLY = 99998,
4287 google_protobuf_EDITION_99999_TEST_ONLY = 99999
4288} google_protobuf_Edition;
4289
4290typedef enum {
Protobuf Team Bot469f0272023-04-21 18:12:45 -07004291 google_protobuf_ExtensionRangeOptions_DECLARATION = 0,
4292 google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1
4293} google_protobuf_ExtensionRangeOptions_VerificationState;
4294
4295typedef enum {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07004296 google_protobuf_FeatureSet_ENUM_TYPE_UNKNOWN = 0,
4297 google_protobuf_FeatureSet_OPEN = 1,
4298 google_protobuf_FeatureSet_CLOSED = 2
4299} google_protobuf_FeatureSet_EnumType;
4300
4301typedef enum {
4302 google_protobuf_FeatureSet_FIELD_PRESENCE_UNKNOWN = 0,
4303 google_protobuf_FeatureSet_EXPLICIT = 1,
4304 google_protobuf_FeatureSet_IMPLICIT = 2,
4305 google_protobuf_FeatureSet_LEGACY_REQUIRED = 3
4306} google_protobuf_FeatureSet_FieldPresence;
4307
4308typedef enum {
4309 google_protobuf_FeatureSet_JSON_FORMAT_UNKNOWN = 0,
4310 google_protobuf_FeatureSet_ALLOW = 1,
4311 google_protobuf_FeatureSet_LEGACY_BEST_EFFORT = 2
4312} google_protobuf_FeatureSet_JsonFormat;
4313
4314typedef enum {
4315 google_protobuf_FeatureSet_MESSAGE_ENCODING_UNKNOWN = 0,
4316 google_protobuf_FeatureSet_LENGTH_PREFIXED = 1,
4317 google_protobuf_FeatureSet_DELIMITED = 2
4318} google_protobuf_FeatureSet_MessageEncoding;
4319
4320typedef enum {
4321 google_protobuf_FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN = 0,
4322 google_protobuf_FeatureSet_PACKED = 1,
4323 google_protobuf_FeatureSet_EXPANDED = 2
4324} google_protobuf_FeatureSet_RepeatedFieldEncoding;
4325
4326typedef enum {
Protobuf Team Bot61127952023-09-26 20:07:33 +00004327 google_protobuf_FeatureSet_UTF8_VALIDATION_UNKNOWN = 0,
Protobuf Team Bot4b301ad2023-10-14 03:20:44 +00004328 google_protobuf_FeatureSet_NONE = 1,
Protobuf Team Bot61127952023-09-26 20:07:33 +00004329 google_protobuf_FeatureSet_VERIFY = 2
4330} google_protobuf_FeatureSet_Utf8Validation;
4331
4332typedef enum {
Mike Kruskalccbdaa72023-02-02 20:42:14 -08004333 google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1,
4334 google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2,
4335 google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3
4336} google_protobuf_FieldDescriptorProto_Label;
4337
4338typedef enum {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004339 google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1,
4340 google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2,
4341 google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3,
4342 google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4,
4343 google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5,
4344 google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6,
4345 google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7,
4346 google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8,
4347 google_protobuf_FieldDescriptorProto_TYPE_STRING = 9,
4348 google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10,
4349 google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11,
4350 google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12,
4351 google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13,
4352 google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14,
4353 google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15,
4354 google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16,
4355 google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17,
4356 google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18
4357} google_protobuf_FieldDescriptorProto_Type;
4358
4359typedef enum {
4360 google_protobuf_FieldOptions_STRING = 0,
4361 google_protobuf_FieldOptions_CORD = 1,
4362 google_protobuf_FieldOptions_STRING_PIECE = 2
4363} google_protobuf_FieldOptions_CType;
4364
4365typedef enum {
4366 google_protobuf_FieldOptions_JS_NORMAL = 0,
4367 google_protobuf_FieldOptions_JS_STRING = 1,
4368 google_protobuf_FieldOptions_JS_NUMBER = 2
4369} google_protobuf_FieldOptions_JSType;
4370
4371typedef enum {
Adam Cozzette90ff32c2023-01-21 15:04:56 -08004372 google_protobuf_FieldOptions_RETENTION_UNKNOWN = 0,
4373 google_protobuf_FieldOptions_RETENTION_RUNTIME = 1,
4374 google_protobuf_FieldOptions_RETENTION_SOURCE = 2
4375} google_protobuf_FieldOptions_OptionRetention;
4376
4377typedef enum {
4378 google_protobuf_FieldOptions_TARGET_TYPE_UNKNOWN = 0,
4379 google_protobuf_FieldOptions_TARGET_TYPE_FILE = 1,
4380 google_protobuf_FieldOptions_TARGET_TYPE_EXTENSION_RANGE = 2,
4381 google_protobuf_FieldOptions_TARGET_TYPE_MESSAGE = 3,
4382 google_protobuf_FieldOptions_TARGET_TYPE_FIELD = 4,
4383 google_protobuf_FieldOptions_TARGET_TYPE_ONEOF = 5,
4384 google_protobuf_FieldOptions_TARGET_TYPE_ENUM = 6,
4385 google_protobuf_FieldOptions_TARGET_TYPE_ENUM_ENTRY = 7,
4386 google_protobuf_FieldOptions_TARGET_TYPE_SERVICE = 8,
4387 google_protobuf_FieldOptions_TARGET_TYPE_METHOD = 9
4388} google_protobuf_FieldOptions_OptionTargetType;
4389
4390typedef enum {
Mike Kruskalccbdaa72023-02-02 20:42:14 -08004391 google_protobuf_FileOptions_SPEED = 1,
4392 google_protobuf_FileOptions_CODE_SIZE = 2,
4393 google_protobuf_FileOptions_LITE_RUNTIME = 3
4394} google_protobuf_FileOptions_OptimizeMode;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004395
4396typedef enum {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004397 google_protobuf_GeneratedCodeInfo_Annotation_NONE = 0,
4398 google_protobuf_GeneratedCodeInfo_Annotation_SET = 1,
4399 google_protobuf_GeneratedCodeInfo_Annotation_ALIAS = 2
4400} google_protobuf_GeneratedCodeInfo_Annotation_Semantic;
4401
Mike Kruskalccbdaa72023-02-02 20:42:14 -08004402typedef enum {
4403 google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0,
4404 google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1,
4405 google_protobuf_MethodOptions_IDEMPOTENT = 2
4406} google_protobuf_MethodOptions_IdempotencyLevel;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004407
Mike Kruskalccbdaa72023-02-02 20:42:14 -08004408
Joshua Habermanf41049a2022-01-21 14:41:25 -08004409
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004410/* google.protobuf.FileDescriptorSet */
4411
Joshua Habermanf41049a2022-01-21 14:41:25 -08004412UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004413 return (google_protobuf_FileDescriptorSet*)_upb_Message_New(&google__protobuf__FileDescriptorSet_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004414}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004415UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse(const char* buf, size_t size, upb_Arena* arena) {
4416 google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07004417 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004418 if (upb_Decode(buf, size, ret, &google__protobuf__FileDescriptorSet_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07004419 return NULL;
4420 }
4421 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004422}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004423UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse_ex(const char* buf, size_t size,
4424 const upb_ExtensionRegistry* extreg,
4425 int options, upb_Arena* arena) {
4426 google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena);
4427 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004428 if (upb_Decode(buf, size, ret, &google__protobuf__FileDescriptorSet_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08004429 kUpb_DecodeStatus_Ok) {
4430 return NULL;
4431 }
4432 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004433}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004434UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize(const google_protobuf_FileDescriptorSet* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004435 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004436 (void)upb_Encode(msg, &google__protobuf__FileDescriptorSet_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004437 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004438}
4439UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize_ex(const google_protobuf_FileDescriptorSet* msg, int options,
4440 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004441 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004442 (void)upb_Encode(msg, &google__protobuf__FileDescriptorSet_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004443 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004444}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004445UPB_INLINE void google_protobuf_FileDescriptorSet_clear_file(google_protobuf_FileDescriptorSet* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004446 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 -08004447 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004448}
Eric Salob7d54ac2022-12-29 11:59:42 -08004449UPB_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 -07004450 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 -08004451 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4452 if (arr) {
4453 if (size) *size = arr->size;
4454 return (const google_protobuf_FileDescriptorProto* const*)_upb_array_constptr(arr);
4455 } else {
4456 if (size) *size = 0;
4457 return NULL;
4458 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004459}
Deanna Garciab26afb52023-04-25 13:37:18 -07004460UPB_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 -07004461 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 -07004462 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4463 if (size) {
4464 *size = arr ? arr->size : 0;
4465 }
4466 return arr;
4467}
4468UPB_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 -07004469 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 -07004470 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4471 (upb_Message*)msg, &field, arena);
4472 if (size) {
4473 *size = arr ? arr->size : 0;
4474 }
4475 return arr;
4476}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004477UPB_INLINE bool google_protobuf_FileDescriptorSet_has_file(const google_protobuf_FileDescriptorSet* msg) {
4478 size_t size;
4479 google_protobuf_FileDescriptorSet_file(msg, &size);
4480 return size != 0;
4481}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004482
Eric Salob7d54ac2022-12-29 11:59:42 -08004483UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_mutable_file(google_protobuf_FileDescriptorSet* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004484 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 -08004485 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4486 if (arr) {
4487 if (size) *size = arr->size;
4488 return (google_protobuf_FileDescriptorProto**)_upb_array_ptr(arr);
4489 } else {
4490 if (size) *size = 0;
4491 return NULL;
4492 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004493}
Eric Salob7d54ac2022-12-29 11:59:42 -08004494UPB_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 -07004495 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 -07004496 return (google_protobuf_FileDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004497}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004498UPB_INLINE struct google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorSet_add_file(google_protobuf_FileDescriptorSet* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004499 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 -08004500 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4501 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4502 return NULL;
4503 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004504 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 -08004505 if (!arr || !sub) return NULL;
4506 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004507 return sub;
4508}
4509
4510/* google.protobuf.FileDescriptorProto */
4511
Joshua Habermanf41049a2022-01-21 14:41:25 -08004512UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004513 return (google_protobuf_FileDescriptorProto*)_upb_Message_New(&google__protobuf__FileDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004514}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004515UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
4516 google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07004517 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004518 if (upb_Decode(buf, size, ret, &google__protobuf__FileDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07004519 return NULL;
4520 }
4521 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004522}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004523UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse_ex(const char* buf, size_t size,
4524 const upb_ExtensionRegistry* extreg,
4525 int options, upb_Arena* arena) {
4526 google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena);
4527 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004528 if (upb_Decode(buf, size, ret, &google__protobuf__FileDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08004529 kUpb_DecodeStatus_Ok) {
4530 return NULL;
4531 }
4532 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004533}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004534UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004535 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004536 (void)upb_Encode(msg, &google__protobuf__FileDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004537 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004538}
4539UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize_ex(const google_protobuf_FileDescriptorProto* msg, int options,
4540 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004541 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004542 (void)upb_Encode(msg, &google__protobuf__FileDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004543 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004544}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004545UPB_INLINE void google_protobuf_FileDescriptorProto_clear_name(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004546 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 -08004547 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004548}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004549UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004550 upb_StringView default_val = upb_StringView_FromString("");
4551 upb_StringView ret;
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004552 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 -08004553 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004554 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004555}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004556UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004557 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 -08004558 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004559}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004560UPB_INLINE void google_protobuf_FileDescriptorProto_clear_package(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004561 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 -08004562 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004563}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004564UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004565 upb_StringView default_val = upb_StringView_FromString("");
4566 upb_StringView ret;
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004567 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 -08004568 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004569 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004570}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004571UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004572 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 -08004573 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08004574}
4575UPB_INLINE void google_protobuf_FileDescriptorProto_clear_dependency(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004576 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 -08004577 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004578}
Eric Salob7d54ac2022-12-29 11:59:42 -08004579UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004580 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 -08004581 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4582 if (arr) {
4583 if (size) *size = arr->size;
4584 return (upb_StringView const*)_upb_array_constptr(arr);
4585 } else {
4586 if (size) *size = 0;
4587 return NULL;
4588 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004589}
Deanna Garciab26afb52023-04-25 13:37:18 -07004590UPB_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 -07004591 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 -07004592 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4593 if (size) {
4594 *size = arr ? arr->size : 0;
4595 }
4596 return arr;
4597}
4598UPB_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 -07004599 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 -07004600 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4601 (upb_Message*)msg, &field, arena);
4602 if (size) {
4603 *size = arr ? arr->size : 0;
4604 }
4605 return arr;
4606}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004607UPB_INLINE bool google_protobuf_FileDescriptorProto_has_dependency(const google_protobuf_FileDescriptorProto* msg) {
4608 size_t size;
4609 google_protobuf_FileDescriptorProto_dependency(msg, &size);
4610 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004611}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004612UPB_INLINE void google_protobuf_FileDescriptorProto_clear_message_type(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004613 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 -08004614 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004615}
Eric Salob7d54ac2022-12-29 11:59:42 -08004616UPB_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 -07004617 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 -08004618 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4619 if (arr) {
4620 if (size) *size = arr->size;
4621 return (const google_protobuf_DescriptorProto* const*)_upb_array_constptr(arr);
4622 } else {
4623 if (size) *size = 0;
4624 return NULL;
4625 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004626}
Deanna Garciab26afb52023-04-25 13:37:18 -07004627UPB_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 -07004628 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 -07004629 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4630 if (size) {
4631 *size = arr ? arr->size : 0;
4632 }
4633 return arr;
4634}
4635UPB_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 -07004636 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 -07004637 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4638 (upb_Message*)msg, &field, arena);
4639 if (size) {
4640 *size = arr ? arr->size : 0;
4641 }
4642 return arr;
4643}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004644UPB_INLINE bool google_protobuf_FileDescriptorProto_has_message_type(const google_protobuf_FileDescriptorProto* msg) {
4645 size_t size;
4646 google_protobuf_FileDescriptorProto_message_type(msg, &size);
4647 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004648}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004649UPB_INLINE void google_protobuf_FileDescriptorProto_clear_enum_type(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004650 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 -08004651 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004652}
Eric Salob7d54ac2022-12-29 11:59:42 -08004653UPB_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 -07004654 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 -08004655 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4656 if (arr) {
4657 if (size) *size = arr->size;
4658 return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_constptr(arr);
4659 } else {
4660 if (size) *size = 0;
4661 return NULL;
4662 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004663}
Deanna Garciab26afb52023-04-25 13:37:18 -07004664UPB_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 -07004665 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 -07004666 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4667 if (size) {
4668 *size = arr ? arr->size : 0;
4669 }
4670 return arr;
4671}
4672UPB_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 -07004673 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 -07004674 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4675 (upb_Message*)msg, &field, arena);
4676 if (size) {
4677 *size = arr ? arr->size : 0;
4678 }
4679 return arr;
4680}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004681UPB_INLINE bool google_protobuf_FileDescriptorProto_has_enum_type(const google_protobuf_FileDescriptorProto* msg) {
4682 size_t size;
4683 google_protobuf_FileDescriptorProto_enum_type(msg, &size);
4684 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004685}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004686UPB_INLINE void google_protobuf_FileDescriptorProto_clear_service(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004687 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 -08004688 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004689}
Eric Salob7d54ac2022-12-29 11:59:42 -08004690UPB_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 -07004691 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 -08004692 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4693 if (arr) {
4694 if (size) *size = arr->size;
4695 return (const google_protobuf_ServiceDescriptorProto* const*)_upb_array_constptr(arr);
4696 } else {
4697 if (size) *size = 0;
4698 return NULL;
4699 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004700}
Deanna Garciab26afb52023-04-25 13:37:18 -07004701UPB_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 -07004702 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 -07004703 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4704 if (size) {
4705 *size = arr ? arr->size : 0;
4706 }
4707 return arr;
4708}
4709UPB_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 -07004710 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 -07004711 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4712 (upb_Message*)msg, &field, arena);
4713 if (size) {
4714 *size = arr ? arr->size : 0;
4715 }
4716 return arr;
4717}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004718UPB_INLINE bool google_protobuf_FileDescriptorProto_has_service(const google_protobuf_FileDescriptorProto* msg) {
4719 size_t size;
4720 google_protobuf_FileDescriptorProto_service(msg, &size);
4721 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004722}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004723UPB_INLINE void google_protobuf_FileDescriptorProto_clear_extension(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004724 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 -08004725 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004726}
Eric Salob7d54ac2022-12-29 11:59:42 -08004727UPB_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 -07004728 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 -08004729 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4730 if (arr) {
4731 if (size) *size = arr->size;
4732 return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr);
4733 } else {
4734 if (size) *size = 0;
4735 return NULL;
4736 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004737}
Deanna Garciab26afb52023-04-25 13:37:18 -07004738UPB_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 -07004739 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 -07004740 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4741 if (size) {
4742 *size = arr ? arr->size : 0;
4743 }
4744 return arr;
4745}
4746UPB_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 -07004747 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 -07004748 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4749 (upb_Message*)msg, &field, arena);
4750 if (size) {
4751 *size = arr ? arr->size : 0;
4752 }
4753 return arr;
4754}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004755UPB_INLINE bool google_protobuf_FileDescriptorProto_has_extension(const google_protobuf_FileDescriptorProto* msg) {
4756 size_t size;
4757 google_protobuf_FileDescriptorProto_extension(msg, &size);
4758 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004759}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004760UPB_INLINE void google_protobuf_FileDescriptorProto_clear_options(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004761 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 -08004762 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004763}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004764UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004765 const google_protobuf_FileOptions* default_val = NULL;
4766 const google_protobuf_FileOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07004767 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 -08004768 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004769 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004770}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004771UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004772 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 -08004773 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004774}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004775UPB_INLINE void google_protobuf_FileDescriptorProto_clear_source_code_info(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004776 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 -08004777 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004778}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004779UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004780 const google_protobuf_SourceCodeInfo* default_val = NULL;
4781 const google_protobuf_SourceCodeInfo* ret;
Jie Luo3560e232023-06-12 00:33:50 -07004782 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 -08004783 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004784 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004785}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004786UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004787 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 -08004788 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08004789}
4790UPB_INLINE void google_protobuf_FileDescriptorProto_clear_public_dependency(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004791 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 -08004792 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -08004793}
Eric Salob7d54ac2022-12-29 11:59:42 -08004794UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004795 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 -08004796 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4797 if (arr) {
4798 if (size) *size = arr->size;
4799 return (int32_t const*)_upb_array_constptr(arr);
4800 } else {
4801 if (size) *size = 0;
4802 return NULL;
4803 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07004804}
Deanna Garciab26afb52023-04-25 13:37:18 -07004805UPB_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 -07004806 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 -07004807 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4808 if (size) {
4809 *size = arr ? arr->size : 0;
4810 }
4811 return arr;
4812}
4813UPB_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 -07004814 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 -07004815 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4816 (upb_Message*)msg, &field, arena);
4817 if (size) {
4818 *size = arr ? arr->size : 0;
4819 }
4820 return arr;
4821}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004822UPB_INLINE bool google_protobuf_FileDescriptorProto_has_public_dependency(const google_protobuf_FileDescriptorProto* msg) {
4823 size_t size;
4824 google_protobuf_FileDescriptorProto_public_dependency(msg, &size);
4825 return size != 0;
4826}
4827UPB_INLINE void google_protobuf_FileDescriptorProto_clear_weak_dependency(google_protobuf_FileDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07004828 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 -08004829 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004830}
Eric Salob7d54ac2022-12-29 11:59:42 -08004831UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004832 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 -08004833 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4834 if (arr) {
4835 if (size) *size = arr->size;
4836 return (int32_t const*)_upb_array_constptr(arr);
4837 } else {
4838 if (size) *size = 0;
4839 return NULL;
4840 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004841}
Deanna Garciab26afb52023-04-25 13:37:18 -07004842UPB_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 -07004843 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 -07004844 const upb_Array* arr = upb_Message_GetArray(msg, &field);
4845 if (size) {
4846 *size = arr ? arr->size : 0;
4847 }
4848 return arr;
4849}
4850UPB_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 -07004851 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 -07004852 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
4853 (upb_Message*)msg, &field, arena);
4854 if (size) {
4855 *size = arr ? arr->size : 0;
4856 }
4857 return arr;
4858}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004859UPB_INLINE bool google_protobuf_FileDescriptorProto_has_weak_dependency(const google_protobuf_FileDescriptorProto* msg) {
4860 size_t size;
4861 google_protobuf_FileDescriptorProto_weak_dependency(msg, &size);
4862 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004863}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004864UPB_INLINE void google_protobuf_FileDescriptorProto_clear_syntax(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004865 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 -08004866 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004867}
Joshua Habermanf41049a2022-01-21 14:41:25 -08004868UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08004869 upb_StringView default_val = upb_StringView_FromString("");
4870 upb_StringView ret;
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004871 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 -08004872 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004873 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -07004874}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004875UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004876 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 -08004877 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004878}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004879UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00004880 const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004881 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07004882}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00004883UPB_INLINE int32_t google_protobuf_FileDescriptorProto_edition(const google_protobuf_FileDescriptorProto* msg) {
4884 int32_t default_val = 0;
4885 int32_t ret;
4886 const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004887 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08004888 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08004889}
Mike Kruskal3bc50492022-12-01 13:34:12 -08004890UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00004891 const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08004892 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08004893}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004894
Joshua Habermanf41049a2022-01-21 14:41:25 -08004895UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004896 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 -08004897 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08004898}
4899UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00004900 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 -08004901 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08004902}
4903UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004904 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 -08004905 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4906 if (arr) {
4907 if (size) *size = arr->size;
4908 return (upb_StringView*)_upb_array_ptr(arr);
4909 } else {
4910 if (size) *size = 0;
4911 return NULL;
4912 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004913}
Eric Salob7d54ac2022-12-29 11:59:42 -08004914UPB_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 -07004915 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 -07004916 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004917}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004918UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto* msg, upb_StringView val, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004919 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 -08004920 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4921 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4922 return false;
4923 }
4924 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
4925 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004926}
Eric Salob7d54ac2022-12-29 11:59:42 -08004927UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004928 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 -08004929 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4930 if (arr) {
4931 if (size) *size = arr->size;
4932 return (google_protobuf_DescriptorProto**)_upb_array_ptr(arr);
4933 } else {
4934 if (size) *size = 0;
4935 return NULL;
4936 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004937}
Eric Salob7d54ac2022-12-29 11:59:42 -08004938UPB_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 -07004939 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 -07004940 return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004941}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004942UPB_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 -07004943 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 -08004944 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4945 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4946 return NULL;
4947 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004948 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 -08004949 if (!arr || !sub) return NULL;
4950 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004951 return sub;
4952}
Eric Salob7d54ac2022-12-29 11:59:42 -08004953UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004954 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 -08004955 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4956 if (arr) {
4957 if (size) *size = arr->size;
4958 return (google_protobuf_EnumDescriptorProto**)_upb_array_ptr(arr);
4959 } else {
4960 if (size) *size = 0;
4961 return NULL;
4962 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004963}
Eric Salob7d54ac2022-12-29 11:59:42 -08004964UPB_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 -07004965 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 -07004966 return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004967}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004968UPB_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 -07004969 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 -08004970 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4971 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4972 return NULL;
4973 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004974 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 -08004975 if (!arr || !sub) return NULL;
4976 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004977 return sub;
4978}
Eric Salob7d54ac2022-12-29 11:59:42 -08004979UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07004980 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 -08004981 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
4982 if (arr) {
4983 if (size) *size = arr->size;
4984 return (google_protobuf_ServiceDescriptorProto**)_upb_array_ptr(arr);
4985 } else {
4986 if (size) *size = 0;
4987 return NULL;
4988 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004989}
Eric Salob7d54ac2022-12-29 11:59:42 -08004990UPB_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 -07004991 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 -07004992 return (google_protobuf_ServiceDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004993}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07004994UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07004995 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 -08004996 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
4997 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
4998 return NULL;
4999 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005000 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 -08005001 if (!arr || !sub) return NULL;
5002 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005003 return sub;
5004}
Eric Salob7d54ac2022-12-29 11:59:42 -08005005UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005006 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 -08005007 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5008 if (arr) {
5009 if (size) *size = arr->size;
5010 return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr);
5011 } else {
5012 if (size) *size = 0;
5013 return NULL;
5014 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005015}
Eric Salob7d54ac2022-12-29 11:59:42 -08005016UPB_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 -07005017 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 -07005018 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005019}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005020UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005021 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 -08005022 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5023 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5024 return NULL;
5025 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005026 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 -08005027 if (!arr || !sub) return NULL;
5028 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005029 return sub;
5030}
5031UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07005032 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 -08005033 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005034}
5035UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005036 struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg);
5037 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005038 sub = (struct google_protobuf_FileOptions*)_upb_Message_New(&google__protobuf__FileOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005039 if (sub) google_protobuf_FileDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005040 }
5041 return sub;
5042}
5043UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) {
Jie Luo3560e232023-06-12 00:33:50 -07005044 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 -08005045 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005046}
5047UPB_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 -08005048 struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg);
5049 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005050 sub = (struct google_protobuf_SourceCodeInfo*)_upb_Message_New(&google__protobuf__SourceCodeInfo_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005051 if (sub) google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005052 }
5053 return sub;
5054}
Eric Salob7d54ac2022-12-29 11:59:42 -08005055UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005056 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 -08005057 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5058 if (arr) {
5059 if (size) *size = arr->size;
5060 return (int32_t*)_upb_array_ptr(arr);
5061 } else {
5062 if (size) *size = 0;
5063 return NULL;
5064 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005065}
Eric Salob7d54ac2022-12-29 11:59:42 -08005066UPB_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 -07005067 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 -07005068 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005069}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005070UPB_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 -07005071 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 -08005072 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5073 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5074 return false;
5075 }
5076 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
5077 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005078}
Eric Salob7d54ac2022-12-29 11:59:42 -08005079UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005080 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 -08005081 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5082 if (arr) {
5083 if (size) *size = arr->size;
5084 return (int32_t*)_upb_array_ptr(arr);
5085 } else {
5086 if (size) *size = 0;
5087 return NULL;
5088 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005089}
Eric Salob7d54ac2022-12-29 11:59:42 -08005090UPB_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 -07005091 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 -07005092 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005093}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005094UPB_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 -07005095 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 -08005096 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5097 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5098 return false;
5099 }
5100 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
5101 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005102}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005103UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot0e484c72023-09-06 19:28:27 +00005104 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 -08005105 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005106}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00005107UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, int32_t value) {
5108 const upb_MiniTableField field = {14, UPB_SIZE(40, 4), 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Eric Salo10505992022-12-12 12:16:36 -08005109 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005110}
Mike Kruskal232ecf42023-01-14 00:09:40 -08005111
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005112/* google.protobuf.DescriptorProto */
5113
Joshua Habermanf41049a2022-01-21 14:41:25 -08005114UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005115 return (google_protobuf_DescriptorProto*)_upb_Message_New(&google__protobuf__DescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005116}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005117UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
5118 google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005119 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005120 if (upb_Decode(buf, size, ret, &google__protobuf__DescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005121 return NULL;
5122 }
5123 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005124}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005125UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse_ex(const char* buf, size_t size,
5126 const upb_ExtensionRegistry* extreg,
5127 int options, upb_Arena* arena) {
5128 google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena);
5129 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005130 if (upb_Decode(buf, size, ret, &google__protobuf__DescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08005131 kUpb_DecodeStatus_Ok) {
5132 return NULL;
5133 }
5134 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005135}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005136UPB_INLINE char* google_protobuf_DescriptorProto_serialize(const google_protobuf_DescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005137 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005138 (void)upb_Encode(msg, &google__protobuf__DescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005139 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005140}
5141UPB_INLINE char* google_protobuf_DescriptorProto_serialize_ex(const google_protobuf_DescriptorProto* msg, int options,
5142 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005143 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005144 (void)upb_Encode(msg, &google__protobuf__DescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005145 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005146}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005147UPB_INLINE void google_protobuf_DescriptorProto_clear_name(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005148 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 -08005149 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005150}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005151UPB_INLINE upb_StringView google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005152 upb_StringView default_val = upb_StringView_FromString("");
5153 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07005154 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 -08005155 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005156 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005157}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005158UPB_INLINE bool google_protobuf_DescriptorProto_has_name(const google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005159 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 -08005160 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005161}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005162UPB_INLINE void google_protobuf_DescriptorProto_clear_field(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005163 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 -08005164 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005165}
Eric Salob7d54ac2022-12-29 11:59:42 -08005166UPB_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 -07005167 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 -08005168 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5169 if (arr) {
5170 if (size) *size = arr->size;
5171 return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr);
5172 } else {
5173 if (size) *size = 0;
5174 return NULL;
5175 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005176}
Deanna Garciab26afb52023-04-25 13:37:18 -07005177UPB_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 -07005178 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 -07005179 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5180 if (size) {
5181 *size = arr ? arr->size : 0;
5182 }
5183 return arr;
5184}
5185UPB_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 -07005186 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 -07005187 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5188 (upb_Message*)msg, &field, arena);
5189 if (size) {
5190 *size = arr ? arr->size : 0;
5191 }
5192 return arr;
5193}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005194UPB_INLINE bool google_protobuf_DescriptorProto_has_field(const google_protobuf_DescriptorProto* msg) {
5195 size_t size;
5196 google_protobuf_DescriptorProto_field(msg, &size);
5197 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005198}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005199UPB_INLINE void google_protobuf_DescriptorProto_clear_nested_type(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005200 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 -08005201 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005202}
Eric Salob7d54ac2022-12-29 11:59:42 -08005203UPB_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 -07005204 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 -08005205 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5206 if (arr) {
5207 if (size) *size = arr->size;
5208 return (const google_protobuf_DescriptorProto* const*)_upb_array_constptr(arr);
5209 } else {
5210 if (size) *size = 0;
5211 return NULL;
5212 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005213}
Deanna Garciab26afb52023-04-25 13:37:18 -07005214UPB_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 -07005215 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 -07005216 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5217 if (size) {
5218 *size = arr ? arr->size : 0;
5219 }
5220 return arr;
5221}
5222UPB_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 -07005223 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 -07005224 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5225 (upb_Message*)msg, &field, arena);
5226 if (size) {
5227 *size = arr ? arr->size : 0;
5228 }
5229 return arr;
5230}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005231UPB_INLINE bool google_protobuf_DescriptorProto_has_nested_type(const google_protobuf_DescriptorProto* msg) {
5232 size_t size;
5233 google_protobuf_DescriptorProto_nested_type(msg, &size);
5234 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005235}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005236UPB_INLINE void google_protobuf_DescriptorProto_clear_enum_type(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005237 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 -08005238 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005239}
Eric Salob7d54ac2022-12-29 11:59:42 -08005240UPB_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 -07005241 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 -08005242 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5243 if (arr) {
5244 if (size) *size = arr->size;
5245 return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_constptr(arr);
5246 } else {
5247 if (size) *size = 0;
5248 return NULL;
5249 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005250}
Deanna Garciab26afb52023-04-25 13:37:18 -07005251UPB_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 -07005252 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 -07005253 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5254 if (size) {
5255 *size = arr ? arr->size : 0;
5256 }
5257 return arr;
5258}
5259UPB_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 -07005260 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 -07005261 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5262 (upb_Message*)msg, &field, arena);
5263 if (size) {
5264 *size = arr ? arr->size : 0;
5265 }
5266 return arr;
5267}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005268UPB_INLINE bool google_protobuf_DescriptorProto_has_enum_type(const google_protobuf_DescriptorProto* msg) {
5269 size_t size;
5270 google_protobuf_DescriptorProto_enum_type(msg, &size);
5271 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005272}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005273UPB_INLINE void google_protobuf_DescriptorProto_clear_extension_range(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005274 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 -08005275 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005276}
Eric Salob7d54ac2022-12-29 11:59:42 -08005277UPB_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 -07005278 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 -08005279 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5280 if (arr) {
5281 if (size) *size = arr->size;
5282 return (const google_protobuf_DescriptorProto_ExtensionRange* const*)_upb_array_constptr(arr);
5283 } else {
5284 if (size) *size = 0;
5285 return NULL;
5286 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005287}
Deanna Garciab26afb52023-04-25 13:37:18 -07005288UPB_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 -07005289 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 -07005290 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5291 if (size) {
5292 *size = arr ? arr->size : 0;
5293 }
5294 return arr;
5295}
5296UPB_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 -07005297 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 -07005298 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5299 (upb_Message*)msg, &field, arena);
5300 if (size) {
5301 *size = arr ? arr->size : 0;
5302 }
5303 return arr;
5304}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005305UPB_INLINE bool google_protobuf_DescriptorProto_has_extension_range(const google_protobuf_DescriptorProto* msg) {
5306 size_t size;
5307 google_protobuf_DescriptorProto_extension_range(msg, &size);
5308 return size != 0;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005309}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005310UPB_INLINE void google_protobuf_DescriptorProto_clear_extension(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005311 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 -08005312 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005313}
Eric Salob7d54ac2022-12-29 11:59:42 -08005314UPB_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 -07005315 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 -08005316 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5317 if (arr) {
5318 if (size) *size = arr->size;
5319 return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_constptr(arr);
5320 } else {
5321 if (size) *size = 0;
5322 return NULL;
5323 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005324}
Deanna Garciab26afb52023-04-25 13:37:18 -07005325UPB_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 -07005326 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 -07005327 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5328 if (size) {
5329 *size = arr ? arr->size : 0;
5330 }
5331 return arr;
5332}
5333UPB_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 -07005334 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 -07005335 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5336 (upb_Message*)msg, &field, arena);
5337 if (size) {
5338 *size = arr ? arr->size : 0;
5339 }
5340 return arr;
5341}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005342UPB_INLINE bool google_protobuf_DescriptorProto_has_extension(const google_protobuf_DescriptorProto* msg) {
5343 size_t size;
5344 google_protobuf_DescriptorProto_extension(msg, &size);
5345 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005346}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005347UPB_INLINE void google_protobuf_DescriptorProto_clear_options(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005348 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 -08005349 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005350}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005351UPB_INLINE const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005352 const google_protobuf_MessageOptions* default_val = NULL;
5353 const google_protobuf_MessageOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07005354 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 -08005355 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005356 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005357}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005358UPB_INLINE bool google_protobuf_DescriptorProto_has_options(const google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005359 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 -08005360 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005361}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005362UPB_INLINE void google_protobuf_DescriptorProto_clear_oneof_decl(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005363 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 -08005364 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005365}
Eric Salob7d54ac2022-12-29 11:59:42 -08005366UPB_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 -07005367 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 -08005368 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5369 if (arr) {
5370 if (size) *size = arr->size;
5371 return (const google_protobuf_OneofDescriptorProto* const*)_upb_array_constptr(arr);
5372 } else {
5373 if (size) *size = 0;
5374 return NULL;
5375 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005376}
Deanna Garciab26afb52023-04-25 13:37:18 -07005377UPB_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 -07005378 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 -07005379 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5380 if (size) {
5381 *size = arr ? arr->size : 0;
5382 }
5383 return arr;
5384}
5385UPB_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 -07005386 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 -07005387 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5388 (upb_Message*)msg, &field, arena);
5389 if (size) {
5390 *size = arr ? arr->size : 0;
5391 }
5392 return arr;
5393}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005394UPB_INLINE bool google_protobuf_DescriptorProto_has_oneof_decl(const google_protobuf_DescriptorProto* msg) {
5395 size_t size;
5396 google_protobuf_DescriptorProto_oneof_decl(msg, &size);
5397 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005398}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005399UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_range(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005400 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 -08005401 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005402}
Eric Salob7d54ac2022-12-29 11:59:42 -08005403UPB_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 -07005404 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 -08005405 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5406 if (arr) {
5407 if (size) *size = arr->size;
5408 return (const google_protobuf_DescriptorProto_ReservedRange* const*)_upb_array_constptr(arr);
5409 } else {
5410 if (size) *size = 0;
5411 return NULL;
5412 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005413}
Deanna Garciab26afb52023-04-25 13:37:18 -07005414UPB_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 -07005415 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 -07005416 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5417 if (size) {
5418 *size = arr ? arr->size : 0;
5419 }
5420 return arr;
5421}
5422UPB_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 -07005423 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 -07005424 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5425 (upb_Message*)msg, &field, arena);
5426 if (size) {
5427 *size = arr ? arr->size : 0;
5428 }
5429 return arr;
5430}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005431UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_range(const google_protobuf_DescriptorProto* msg) {
5432 size_t size;
5433 google_protobuf_DescriptorProto_reserved_range(msg, &size);
5434 return size != 0;
5435}
5436UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_name(google_protobuf_DescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005437 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 -08005438 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005439}
Eric Salob7d54ac2022-12-29 11:59:42 -08005440UPB_INLINE upb_StringView const* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005441 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 -08005442 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5443 if (arr) {
5444 if (size) *size = arr->size;
5445 return (upb_StringView const*)_upb_array_constptr(arr);
5446 } else {
5447 if (size) *size = 0;
5448 return NULL;
5449 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005450}
Deanna Garciab26afb52023-04-25 13:37:18 -07005451UPB_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 -07005452 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 -07005453 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5454 if (size) {
5455 *size = arr ? arr->size : 0;
5456 }
5457 return arr;
5458}
5459UPB_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 -07005460 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 -07005461 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5462 (upb_Message*)msg, &field, arena);
5463 if (size) {
5464 *size = arr ? arr->size : 0;
5465 }
5466 return arr;
5467}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005468UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_name(const google_protobuf_DescriptorProto* msg) {
5469 size_t size;
5470 google_protobuf_DescriptorProto_reserved_name(msg, &size);
5471 return size != 0;
5472}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005473
Joshua Habermanf41049a2022-01-21 14:41:25 -08005474UPB_INLINE void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07005475 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 -08005476 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005477}
5478UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005479 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 -08005480 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5481 if (arr) {
5482 if (size) *size = arr->size;
5483 return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr);
5484 } else {
5485 if (size) *size = 0;
5486 return NULL;
5487 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005488}
Eric Salob7d54ac2022-12-29 11:59:42 -08005489UPB_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 -07005490 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 -07005491 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005492}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005493UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_field(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005494 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 -08005495 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5496 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5497 return NULL;
5498 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005499 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 -08005500 if (!arr || !sub) return NULL;
5501 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005502 return sub;
5503}
Eric Salob7d54ac2022-12-29 11:59:42 -08005504UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_mutable_nested_type(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005505 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 -08005506 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5507 if (arr) {
5508 if (size) *size = arr->size;
5509 return (google_protobuf_DescriptorProto**)_upb_array_ptr(arr);
5510 } else {
5511 if (size) *size = 0;
5512 return NULL;
5513 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005514}
Eric Salob7d54ac2022-12-29 11:59:42 -08005515UPB_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 -07005516 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 -07005517 return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005518}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005519UPB_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 -07005520 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 -08005521 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5522 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5523 return NULL;
5524 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005525 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 -08005526 if (!arr || !sub) return NULL;
5527 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005528 return sub;
5529}
Eric Salob7d54ac2022-12-29 11:59:42 -08005530UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_mutable_enum_type(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005531 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 -08005532 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5533 if (arr) {
5534 if (size) *size = arr->size;
5535 return (google_protobuf_EnumDescriptorProto**)_upb_array_ptr(arr);
5536 } else {
5537 if (size) *size = 0;
5538 return NULL;
5539 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005540}
Eric Salob7d54ac2022-12-29 11:59:42 -08005541UPB_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 -07005542 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 -07005543 return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005544}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005545UPB_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 -07005546 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 -08005547 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5548 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5549 return NULL;
5550 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005551 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 -08005552 if (!arr || !sub) return NULL;
5553 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005554 return sub;
5555}
Eric Salob7d54ac2022-12-29 11:59:42 -08005556UPB_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 -07005557 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 -08005558 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5559 if (arr) {
5560 if (size) *size = arr->size;
5561 return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_ptr(arr);
5562 } else {
5563 if (size) *size = 0;
5564 return NULL;
5565 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005566}
Eric Salob7d54ac2022-12-29 11:59:42 -08005567UPB_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 -07005568 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 -07005569 return (google_protobuf_DescriptorProto_ExtensionRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005570}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005571UPB_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 -07005572 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 -08005573 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5574 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5575 return NULL;
5576 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005577 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 -08005578 if (!arr || !sub) return NULL;
5579 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005580 return sub;
5581}
Eric Salob7d54ac2022-12-29 11:59:42 -08005582UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_extension(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005583 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 -08005584 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5585 if (arr) {
5586 if (size) *size = arr->size;
5587 return (google_protobuf_FieldDescriptorProto**)_upb_array_ptr(arr);
5588 } else {
5589 if (size) *size = 0;
5590 return NULL;
5591 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005592}
Eric Salob7d54ac2022-12-29 11:59:42 -08005593UPB_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 -07005594 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 -07005595 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005596}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005597UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_extension(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07005598 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 -08005599 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5600 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5601 return NULL;
5602 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005603 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 -08005604 if (!arr || !sub) return NULL;
5605 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005606 return sub;
5607}
5608UPB_INLINE void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07005609 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 -08005610 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005611}
5612UPB_INLINE struct google_protobuf_MessageOptions* google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005613 struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg);
5614 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005615 sub = (struct google_protobuf_MessageOptions*)_upb_Message_New(&google__protobuf__MessageOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005616 if (sub) google_protobuf_DescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005617 }
5618 return sub;
5619}
Eric Salob7d54ac2022-12-29 11:59:42 -08005620UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_mutable_oneof_decl(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005621 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 -08005622 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5623 if (arr) {
5624 if (size) *size = arr->size;
5625 return (google_protobuf_OneofDescriptorProto**)_upb_array_ptr(arr);
5626 } else {
5627 if (size) *size = 0;
5628 return NULL;
5629 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005630}
Eric Salob7d54ac2022-12-29 11:59:42 -08005631UPB_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 -07005632 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 -07005633 return (google_protobuf_OneofDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005634}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005635UPB_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 -07005636 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 -08005637 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5638 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5639 return NULL;
5640 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005641 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 -08005642 if (!arr || !sub) return NULL;
5643 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005644 return sub;
5645}
Eric Salob7d54ac2022-12-29 11:59:42 -08005646UPB_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 -07005647 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 -08005648 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5649 if (arr) {
5650 if (size) *size = arr->size;
5651 return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_ptr(arr);
5652 } else {
5653 if (size) *size = 0;
5654 return NULL;
5655 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005656}
Eric Salob7d54ac2022-12-29 11:59:42 -08005657UPB_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 -07005658 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 -07005659 return (google_protobuf_DescriptorProto_ReservedRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005660}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005661UPB_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 -07005662 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 -08005663 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5664 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5665 return NULL;
5666 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005667 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 -08005668 if (!arr || !sub) return NULL;
5669 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005670 return sub;
5671}
Eric Salob7d54ac2022-12-29 11:59:42 -08005672UPB_INLINE upb_StringView* google_protobuf_DescriptorProto_mutable_reserved_name(google_protobuf_DescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07005673 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 -08005674 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
5675 if (arr) {
5676 if (size) *size = arr->size;
5677 return (upb_StringView*)_upb_array_ptr(arr);
5678 } else {
5679 if (size) *size = 0;
5680 return NULL;
5681 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005682}
Eric Salob7d54ac2022-12-29 11:59:42 -08005683UPB_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 -07005684 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 -07005685 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005686}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005687UPB_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 -07005688 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 -08005689 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
5690 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
5691 return false;
5692 }
5693 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
5694 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005695}
5696
5697/* google.protobuf.DescriptorProto.ExtensionRange */
5698
Joshua Habermanf41049a2022-01-21 14:41:25 -08005699UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005700 return (google_protobuf_DescriptorProto_ExtensionRange*)_upb_Message_New(&google__protobuf__DescriptorProto__ExtensionRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005701}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005702UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse(const char* buf, size_t size, upb_Arena* arena) {
5703 google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005704 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005705 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 -07005706 return NULL;
5707 }
5708 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005709}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005710UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse_ex(const char* buf, size_t size,
5711 const upb_ExtensionRegistry* extreg,
5712 int options, upb_Arena* arena) {
5713 google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
5714 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005715 if (upb_Decode(buf, size, ret, &google__protobuf__DescriptorProto__ExtensionRange_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08005716 kUpb_DecodeStatus_Ok) {
5717 return NULL;
5718 }
5719 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005720}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005721UPB_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 -07005722 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005723 (void)upb_Encode(msg, &google__protobuf__DescriptorProto__ExtensionRange_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005724 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005725}
5726UPB_INLINE char* google_protobuf_DescriptorProto_ExtensionRange_serialize_ex(const google_protobuf_DescriptorProto_ExtensionRange* msg, int options,
5727 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005728 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005729 (void)upb_Encode(msg, &google__protobuf__DescriptorProto__ExtensionRange_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005730 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005731}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005732UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_start(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005733 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 -08005734 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005735}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005736UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005737 int32_t default_val = (int32_t)0;
5738 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005739 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 -08005740 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005741 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005742}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005743UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005744 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 -08005745 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005746}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005747UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_end(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005748 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 -08005749 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005750}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005751UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005752 int32_t default_val = (int32_t)0;
5753 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005754 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 -08005755 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005756 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005757}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005758UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005759 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 -08005760 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005761}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005762UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_options(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005763 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 -08005764 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005765}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005766UPB_INLINE const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005767 const google_protobuf_ExtensionRangeOptions* default_val = NULL;
5768 const google_protobuf_ExtensionRangeOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07005769 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 -08005770 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005771 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005772}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005773UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005774 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 -08005775 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08005776}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005777
5778UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005779 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 -08005780 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005781}
5782UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005783 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 -08005784 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005785}
5786UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07005787 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 -08005788 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005789}
5790UPB_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 -08005791 struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg);
5792 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005793 sub = (struct google_protobuf_ExtensionRangeOptions*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005794 if (sub) google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005795 }
5796 return sub;
5797}
5798
5799/* google.protobuf.DescriptorProto.ReservedRange */
5800
Joshua Habermanf41049a2022-01-21 14:41:25 -08005801UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005802 return (google_protobuf_DescriptorProto_ReservedRange*)_upb_Message_New(&google__protobuf__DescriptorProto__ReservedRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005803}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005804UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) {
5805 google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005806 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005807 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 -07005808 return NULL;
5809 }
5810 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005811}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005812UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse_ex(const char* buf, size_t size,
5813 const upb_ExtensionRegistry* extreg,
5814 int options, upb_Arena* arena) {
5815 google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
5816 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005817 if (upb_Decode(buf, size, ret, &google__protobuf__DescriptorProto__ReservedRange_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08005818 kUpb_DecodeStatus_Ok) {
5819 return NULL;
5820 }
5821 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005822}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005823UPB_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 -07005824 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005825 (void)upb_Encode(msg, &google__protobuf__DescriptorProto__ReservedRange_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005826 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005827}
5828UPB_INLINE char* google_protobuf_DescriptorProto_ReservedRange_serialize_ex(const google_protobuf_DescriptorProto_ReservedRange* msg, int options,
5829 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005830 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005831 (void)upb_Encode(msg, &google__protobuf__DescriptorProto__ReservedRange_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005832 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005833}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005834UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_start(google_protobuf_DescriptorProto_ReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005835 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 -08005836 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005837}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005838UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005839 int32_t default_val = (int32_t)0;
5840 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005841 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 -08005842 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005843 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005844}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005845UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005846 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 -08005847 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005848}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005849UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_end(google_protobuf_DescriptorProto_ReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005850 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 -08005851 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005852}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005853UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005854 int32_t default_val = (int32_t)0;
5855 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07005856 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 -08005857 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005858 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005859}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005860UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_end(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005861 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 -08005862 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08005863}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005864
5865UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005866 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 -08005867 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005868}
5869UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07005870 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 -08005871 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005872}
Mike Kruskal232ecf42023-01-14 00:09:40 -08005873
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005874/* google.protobuf.ExtensionRangeOptions */
5875
Joshua Habermanf41049a2022-01-21 14:41:25 -08005876UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005877 return (google_protobuf_ExtensionRangeOptions*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005878}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005879UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
5880 google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005881 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005882 if (upb_Decode(buf, size, ret, &google__protobuf__ExtensionRangeOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005883 return NULL;
5884 }
5885 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005886}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005887UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse_ex(const char* buf, size_t size,
5888 const upb_ExtensionRegistry* extreg,
5889 int options, upb_Arena* arena) {
5890 google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena);
5891 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005892 if (upb_Decode(buf, size, ret, &google__protobuf__ExtensionRangeOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08005893 kUpb_DecodeStatus_Ok) {
5894 return NULL;
5895 }
5896 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005897}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005898UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize(const google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005899 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005900 (void)upb_Encode(msg, &google__protobuf__ExtensionRangeOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005901 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005902}
5903UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize_ex(const google_protobuf_ExtensionRangeOptions* msg, int options,
5904 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005905 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00005906 (void)upb_Encode(msg, &google__protobuf__ExtensionRangeOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005907 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005908}
Mike Kruskal145900f2023-03-27 09:55:52 -07005909UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_declaration(google_protobuf_ExtensionRangeOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07005910 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 -07005911 _upb_Message_ClearNonExtensionField(msg, &field);
5912}
5913UPB_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 -07005914 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 -07005915 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5916 if (arr) {
5917 if (size) *size = arr->size;
5918 return (const google_protobuf_ExtensionRangeOptions_Declaration* const*)_upb_array_constptr(arr);
5919 } else {
5920 if (size) *size = 0;
5921 return NULL;
5922 }
5923}
Deanna Garciab26afb52023-04-25 13:37:18 -07005924UPB_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 -07005925 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 -07005926 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5927 if (size) {
5928 *size = arr ? arr->size : 0;
5929 }
5930 return arr;
5931}
5932UPB_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 -07005933 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 -07005934 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5935 (upb_Message*)msg, &field, arena);
5936 if (size) {
5937 *size = arr ? arr->size : 0;
5938 }
5939 return arr;
5940}
Mike Kruskal145900f2023-03-27 09:55:52 -07005941UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_declaration(const google_protobuf_ExtensionRangeOptions* msg) {
5942 size_t size;
5943 google_protobuf_ExtensionRangeOptions_declaration(msg, &size);
5944 return size != 0;
5945}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07005946UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_verification(google_protobuf_ExtensionRangeOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005947 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 -07005948 _upb_Message_ClearNonExtensionField(msg, &field);
5949}
5950UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_verification(const google_protobuf_ExtensionRangeOptions* msg) {
5951 int32_t default_val = 1;
5952 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005953 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 -07005954 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
5955 return ret;
5956}
5957UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_verification(const google_protobuf_ExtensionRangeOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005958 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 1, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
5959 return _upb_Message_HasNonExtensionField(msg, &field);
5960}
5961UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_features(google_protobuf_ExtensionRangeOptions* msg) {
5962 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)};
5963 _upb_Message_ClearNonExtensionField(msg, &field);
5964}
5965UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_features(const google_protobuf_ExtensionRangeOptions* msg) {
5966 const google_protobuf_FeatureSet* default_val = NULL;
5967 const google_protobuf_FeatureSet* ret;
5968 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)};
5969 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
5970 return ret;
5971}
5972UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_features(const google_protobuf_ExtensionRangeOptions* msg) {
5973 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 -07005974 return _upb_Message_HasNonExtensionField(msg, &field);
5975}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005976UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07005977 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 -08005978 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005979}
Eric Salob7d54ac2022-12-29 11:59:42 -08005980UPB_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 -07005981 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 -08005982 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5983 if (arr) {
5984 if (size) *size = arr->size;
5985 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
5986 } else {
5987 if (size) *size = 0;
5988 return NULL;
5989 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005990}
Deanna Garciab26afb52023-04-25 13:37:18 -07005991UPB_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 -07005992 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 -07005993 const upb_Array* arr = upb_Message_GetArray(msg, &field);
5994 if (size) {
5995 *size = arr ? arr->size : 0;
5996 }
5997 return arr;
5998}
5999UPB_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 -07006000 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 -07006001 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6002 (upb_Message*)msg, &field, arena);
6003 if (size) {
6004 *size = arr ? arr->size : 0;
6005 }
6006 return arr;
6007}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006008UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_uninterpreted_option(const google_protobuf_ExtensionRangeOptions* msg) {
6009 size_t size;
6010 google_protobuf_ExtensionRangeOptions_uninterpreted_option(msg, &size);
6011 return size != 0;
6012}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006013
Mike Kruskal145900f2023-03-27 09:55:52 -07006014UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration** google_protobuf_ExtensionRangeOptions_mutable_declaration(google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006015 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 -07006016 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6017 if (arr) {
6018 if (size) *size = arr->size;
6019 return (google_protobuf_ExtensionRangeOptions_Declaration**)_upb_array_ptr(arr);
6020 } else {
6021 if (size) *size = 0;
6022 return NULL;
6023 }
6024}
6025UPB_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 -07006026 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 -07006027 return (google_protobuf_ExtensionRangeOptions_Declaration**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Mike Kruskal145900f2023-03-27 09:55:52 -07006028}
6029UPB_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 -07006030 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 -07006031 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6032 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6033 return NULL;
6034 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006035 struct google_protobuf_ExtensionRangeOptions_Declaration* sub = (struct google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions__Declaration_msg_init, arena);
Mike Kruskal145900f2023-03-27 09:55:52 -07006036 if (!arr || !sub) return NULL;
6037 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
6038 return sub;
6039}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006040UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_verification(google_protobuf_ExtensionRangeOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006041 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 -07006042 _upb_Message_SetNonExtensionField(msg, &field, &value);
6043}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006044UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_features(google_protobuf_ExtensionRangeOptions *msg, google_protobuf_FeatureSet* value) {
6045 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)};
6046 _upb_Message_SetNonExtensionField(msg, &field, &value);
6047}
6048UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_mutable_features(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) {
6049 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ExtensionRangeOptions_features(msg);
6050 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006051 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006052 if (sub) google_protobuf_ExtensionRangeOptions_set_features(msg, sub);
6053 }
6054 return sub;
6055}
Eric Salob7d54ac2022-12-29 11:59:42 -08006056UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_mutable_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006057 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 -08006058 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6059 if (arr) {
6060 if (size) *size = arr->size;
6061 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
6062 } else {
6063 if (size) *size = 0;
6064 return NULL;
6065 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006066}
Eric Salob7d54ac2022-12-29 11:59:42 -08006067UPB_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 -07006068 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 -07006069 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006070}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006071UPB_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 -07006072 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 -08006073 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6074 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6075 return NULL;
6076 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006077 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 -08006078 if (!arr || !sub) return NULL;
6079 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006080 return sub;
6081}
6082
Mike Kruskal145900f2023-03-27 09:55:52 -07006083/* google.protobuf.ExtensionRangeOptions.Declaration */
6084
6085UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006086 return (google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions__Declaration_msg_init, arena);
Mike Kruskal145900f2023-03-27 09:55:52 -07006087}
6088UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse(const char* buf, size_t size, upb_Arena* arena) {
6089 google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena);
6090 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006091 if (upb_Decode(buf, size, ret, &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskal145900f2023-03-27 09:55:52 -07006092 return NULL;
6093 }
6094 return ret;
6095}
6096UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse_ex(const char* buf, size_t size,
6097 const upb_ExtensionRegistry* extreg,
6098 int options, upb_Arena* arena) {
6099 google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena);
6100 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006101 if (upb_Decode(buf, size, ret, &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, extreg, options, arena) !=
Mike Kruskal145900f2023-03-27 09:55:52 -07006102 kUpb_DecodeStatus_Ok) {
6103 return NULL;
6104 }
6105 return ret;
6106}
6107UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize(const google_protobuf_ExtensionRangeOptions_Declaration* msg, upb_Arena* arena, size_t* len) {
6108 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006109 (void)upb_Encode(msg, &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, 0, arena, &ptr, len);
Mike Kruskal145900f2023-03-27 09:55:52 -07006110 return ptr;
6111}
6112UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize_ex(const google_protobuf_ExtensionRangeOptions_Declaration* msg, int options,
6113 upb_Arena* arena, size_t* len) {
6114 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006115 (void)upb_Encode(msg, &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, options, arena, &ptr, len);
Mike Kruskal145900f2023-03-27 09:55:52 -07006116 return ptr;
6117}
6118UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_number(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006119 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 -07006120 _upb_Message_ClearNonExtensionField(msg, &field);
6121}
6122UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_Declaration_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6123 int32_t default_val = (int32_t)0;
6124 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006125 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 -07006126 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
6127 return ret;
6128}
6129UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006130 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 -07006131 return _upb_Message_HasNonExtensionField(msg, &field);
6132}
6133UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_full_name(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006134 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 -07006135 _upb_Message_ClearNonExtensionField(msg, &field);
6136}
6137UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6138 upb_StringView default_val = upb_StringView_FromString("");
6139 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006140 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 -07006141 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
6142 return ret;
6143}
6144UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006145 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 -07006146 return _upb_Message_HasNonExtensionField(msg, &field);
6147}
6148UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_type(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006149 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 -07006150 _upb_Message_ClearNonExtensionField(msg, &field);
6151}
6152UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6153 upb_StringView default_val = upb_StringView_FromString("");
6154 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006155 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 -07006156 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
6157 return ret;
6158}
6159UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006160 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 -07006161 return _upb_Message_HasNonExtensionField(msg, &field);
6162}
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006163UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_reserved(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07006164 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 -07006165 _upb_Message_ClearNonExtensionField(msg, &field);
6166}
6167UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6168 bool default_val = false;
6169 bool ret;
Sandy Zhang96c601d2023-07-05 12:39:20 -07006170 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 -07006171 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
6172 return ret;
6173}
6174UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07006175 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 -07006176 return _upb_Message_HasNonExtensionField(msg, &field);
6177}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006178UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_repeated(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07006179 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 -07006180 _upb_Message_ClearNonExtensionField(msg, &field);
6181}
6182UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6183 bool default_val = false;
6184 bool ret;
Sandy Zhang96c601d2023-07-05 12:39:20 -07006185 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 -07006186 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
6187 return ret;
6188}
6189UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07006190 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 -07006191 return _upb_Message_HasNonExtensionField(msg, &field);
6192}
Mike Kruskal145900f2023-03-27 09:55:52 -07006193
6194UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_number(google_protobuf_ExtensionRangeOptions_Declaration *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006195 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 -07006196 _upb_Message_SetNonExtensionField(msg, &field, &value);
6197}
6198UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_full_name(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006199 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 -07006200 _upb_Message_SetNonExtensionField(msg, &field, &value);
6201}
6202UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_type(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006203 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 -07006204 _upb_Message_SetNonExtensionField(msg, &field, &value);
6205}
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006206UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_reserved(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07006207 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 -07006208 _upb_Message_SetNonExtensionField(msg, &field, &value);
6209}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006210UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_repeated(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07006211 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 -07006212 _upb_Message_SetNonExtensionField(msg, &field, &value);
6213}
Mike Kruskal145900f2023-03-27 09:55:52 -07006214
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006215/* google.protobuf.FieldDescriptorProto */
6216
Joshua Habermanf41049a2022-01-21 14:41:25 -08006217UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006218 return (google_protobuf_FieldDescriptorProto*)_upb_Message_New(&google__protobuf__FieldDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006219}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006220UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6221 google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006222 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006223 if (upb_Decode(buf, size, ret, &google__protobuf__FieldDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006224 return NULL;
6225 }
6226 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006227}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006228UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse_ex(const char* buf, size_t size,
6229 const upb_ExtensionRegistry* extreg,
6230 int options, upb_Arena* arena) {
6231 google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena);
6232 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006233 if (upb_Decode(buf, size, ret, &google__protobuf__FieldDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006234 kUpb_DecodeStatus_Ok) {
6235 return NULL;
6236 }
6237 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006238}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006239UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize(const google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006240 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006241 (void)upb_Encode(msg, &google__protobuf__FieldDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006242 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006243}
6244UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize_ex(const google_protobuf_FieldDescriptorProto* msg, int options,
6245 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006246 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006247 (void)upb_Encode(msg, &google__protobuf__FieldDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006248 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006249}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006250UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_name(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006251 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 -08006252 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006253}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006254UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006255 upb_StringView default_val = upb_StringView_FromString("");
6256 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006257 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 -08006258 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006259 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006260}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006261UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006262 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 -08006263 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006264}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006265UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_extendee(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006266 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 -08006267 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006268}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006269UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006270 upb_StringView default_val = upb_StringView_FromString("");
6271 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006272 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 -08006273 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006274 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006275}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006276UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006277 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 -08006278 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006279}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006280UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_number(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006281 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 -08006282 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006283}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006284UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006285 int32_t default_val = (int32_t)0;
6286 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006287 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 -08006288 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006289 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006290}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006291UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006292 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 -08006293 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006294}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006295UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_label(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006296 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 -08006297 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006298}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006299UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006300 int32_t default_val = 1;
6301 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006302 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 -08006303 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006304 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006305}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006306UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006307 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 -08006308 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006309}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006310UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006311 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 -08006312 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006313}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006314UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006315 int32_t default_val = 1;
6316 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006317 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 -08006318 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006319 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006320}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006321UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006322 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 -08006323 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006324}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006325UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type_name(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006326 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 -08006327 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006328}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006329UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006330 upb_StringView default_val = upb_StringView_FromString("");
6331 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006332 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 -08006333 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006334 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006335}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006336UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006337 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 -08006338 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006339}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006340UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_default_value(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006341 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 -08006342 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006343}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006344UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006345 upb_StringView default_val = upb_StringView_FromString("");
6346 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006347 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 -08006348 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006349 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006350}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006351UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006352 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 -08006353 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006354}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006355UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_options(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006356 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 -08006357 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006358}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006359UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006360 const google_protobuf_FieldOptions* default_val = NULL;
6361 const google_protobuf_FieldOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07006362 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 -08006363 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006364 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006365}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006366UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006367 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 -08006368 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006369}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006370UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_oneof_index(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006371 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 -08006372 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006373}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006374UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006375 int32_t default_val = (int32_t)0;
6376 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006377 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 -08006378 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006379 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006380}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006381UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006382 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 -08006383 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006384}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006385UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_json_name(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006386 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 -08006387 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006388}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006389UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006390 upb_StringView default_val = upb_StringView_FromString("");
6391 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006392 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 -08006393 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006394 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006395}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006396UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006397 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 -08006398 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006399}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006400UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_proto3_optional(google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006401 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 -08006402 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006403}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006404UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006405 bool default_val = false;
6406 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07006407 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 -08006408 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006409 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006410}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006411UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006412 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 -08006413 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006414}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006415
6416UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006417 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 -08006418 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006419}
6420UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006421 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 -08006422 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006423}
6424UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006425 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 -08006426 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006427}
6428UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006429 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 -08006430 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006431}
6432UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006433 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 -08006434 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006435}
6436UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006437 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 -08006438 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006439}
6440UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006441 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 -08006442 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006443}
6444UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07006445 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 -08006446 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006447}
6448UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006449 struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg);
6450 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006451 sub = (struct google_protobuf_FieldOptions*)_upb_Message_New(&google__protobuf__FieldOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006452 if (sub) google_protobuf_FieldDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006453 }
6454 return sub;
6455}
6456UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006457 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 -08006458 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006459}
6460UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006461 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 -08006462 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006463}
6464UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07006465 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 -08006466 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006467}
Mike Kruskal232ecf42023-01-14 00:09:40 -08006468
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006469/* google.protobuf.OneofDescriptorProto */
6470
Joshua Habermanf41049a2022-01-21 14:41:25 -08006471UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006472 return (google_protobuf_OneofDescriptorProto*)_upb_Message_New(&google__protobuf__OneofDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006473}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006474UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6475 google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006476 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006477 if (upb_Decode(buf, size, ret, &google__protobuf__OneofDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006478 return NULL;
6479 }
6480 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006481}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006482UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse_ex(const char* buf, size_t size,
6483 const upb_ExtensionRegistry* extreg,
6484 int options, upb_Arena* arena) {
6485 google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena);
6486 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006487 if (upb_Decode(buf, size, ret, &google__protobuf__OneofDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006488 kUpb_DecodeStatus_Ok) {
6489 return NULL;
6490 }
6491 return ret;
6492}
6493UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize(const google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006494 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006495 (void)upb_Encode(msg, &google__protobuf__OneofDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006496 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006497}
6498UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize_ex(const google_protobuf_OneofDescriptorProto* msg, int options,
6499 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006500 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006501 (void)upb_Encode(msg, &google__protobuf__OneofDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006502 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006503}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006504UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_name(google_protobuf_OneofDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006505 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 -08006506 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006507}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006508UPB_INLINE upb_StringView google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006509 upb_StringView default_val = upb_StringView_FromString("");
6510 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006511 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 -08006512 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006513 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006514}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006515UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_name(const google_protobuf_OneofDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006516 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 -08006517 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006518}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006519UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_options(google_protobuf_OneofDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006520 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 -08006521 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006522}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006523UPB_INLINE const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006524 const google_protobuf_OneofOptions* default_val = NULL;
6525 const google_protobuf_OneofOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07006526 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 -08006527 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006528 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006529}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006530UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_options(const google_protobuf_OneofDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006531 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 -08006532 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006533}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006534
Joshua Habermanf41049a2022-01-21 14:41:25 -08006535UPB_INLINE void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006536 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 -08006537 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006538}
6539UPB_INLINE void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07006540 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 -08006541 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006542}
6543UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006544 struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg);
6545 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006546 sub = (struct google_protobuf_OneofOptions*)_upb_Message_New(&google__protobuf__OneofOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006547 if (sub) google_protobuf_OneofDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006548 }
6549 return sub;
6550}
6551
6552/* google.protobuf.EnumDescriptorProto */
6553
Joshua Habermanf41049a2022-01-21 14:41:25 -08006554UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006555 return (google_protobuf_EnumDescriptorProto*)_upb_Message_New(&google__protobuf__EnumDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006556}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006557UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6558 google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006559 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006560 if (upb_Decode(buf, size, ret, &google__protobuf__EnumDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006561 return NULL;
6562 }
6563 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006564}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006565UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse_ex(const char* buf, size_t size,
6566 const upb_ExtensionRegistry* extreg,
6567 int options, upb_Arena* arena) {
6568 google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena);
6569 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006570 if (upb_Decode(buf, size, ret, &google__protobuf__EnumDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006571 kUpb_DecodeStatus_Ok) {
6572 return NULL;
6573 }
6574 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006575}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006576UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize(const google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006577 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006578 (void)upb_Encode(msg, &google__protobuf__EnumDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006579 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006580}
6581UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize_ex(const google_protobuf_EnumDescriptorProto* msg, int options,
6582 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006583 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006584 (void)upb_Encode(msg, &google__protobuf__EnumDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006585 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006586}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006587UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_name(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006588 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 -08006589 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006590}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006591UPB_INLINE upb_StringView google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006592 upb_StringView default_val = upb_StringView_FromString("");
6593 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006594 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 -08006595 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006596 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006597}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006598UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_name(const google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006599 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 -08006600 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006601}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006602UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_value(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006603 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 -08006604 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006605}
Eric Salob7d54ac2022-12-29 11:59:42 -08006606UPB_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 -07006607 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 -08006608 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6609 if (arr) {
6610 if (size) *size = arr->size;
6611 return (const google_protobuf_EnumValueDescriptorProto* const*)_upb_array_constptr(arr);
6612 } else {
6613 if (size) *size = 0;
6614 return NULL;
6615 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006616}
Deanna Garciab26afb52023-04-25 13:37:18 -07006617UPB_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 -07006618 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 -07006619 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6620 if (size) {
6621 *size = arr ? arr->size : 0;
6622 }
6623 return arr;
6624}
6625UPB_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 -07006626 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 -07006627 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6628 (upb_Message*)msg, &field, arena);
6629 if (size) {
6630 *size = arr ? arr->size : 0;
6631 }
6632 return arr;
6633}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006634UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_value(const google_protobuf_EnumDescriptorProto* msg) {
6635 size_t size;
6636 google_protobuf_EnumDescriptorProto_value(msg, &size);
6637 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006638}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006639UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_options(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006640 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 -08006641 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006642}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006643UPB_INLINE const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006644 const google_protobuf_EnumOptions* default_val = NULL;
6645 const google_protobuf_EnumOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07006646 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 -08006647 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006648 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006649}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006650UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_options(const google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006651 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 -08006652 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006653}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006654UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_range(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006655 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 -08006656 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006657}
Eric Salob7d54ac2022-12-29 11:59:42 -08006658UPB_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 -07006659 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 -08006660 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6661 if (arr) {
6662 if (size) *size = arr->size;
6663 return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)_upb_array_constptr(arr);
6664 } else {
6665 if (size) *size = 0;
6666 return NULL;
6667 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006668}
Deanna Garciab26afb52023-04-25 13:37:18 -07006669UPB_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 -07006670 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 -07006671 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6672 if (size) {
6673 *size = arr ? arr->size : 0;
6674 }
6675 return arr;
6676}
6677UPB_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 -07006678 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 -07006679 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6680 (upb_Message*)msg, &field, arena);
6681 if (size) {
6682 *size = arr ? arr->size : 0;
6683 }
6684 return arr;
6685}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006686UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_range(const google_protobuf_EnumDescriptorProto* msg) {
6687 size_t size;
6688 google_protobuf_EnumDescriptorProto_reserved_range(msg, &size);
6689 return size != 0;
6690}
6691UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_name(google_protobuf_EnumDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006692 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 -08006693 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006694}
Eric Salob7d54ac2022-12-29 11:59:42 -08006695UPB_INLINE upb_StringView const* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006696 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 -08006697 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6698 if (arr) {
6699 if (size) *size = arr->size;
6700 return (upb_StringView const*)_upb_array_constptr(arr);
6701 } else {
6702 if (size) *size = 0;
6703 return NULL;
6704 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006705}
Deanna Garciab26afb52023-04-25 13:37:18 -07006706UPB_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 -07006707 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 -07006708 const upb_Array* arr = upb_Message_GetArray(msg, &field);
6709 if (size) {
6710 *size = arr ? arr->size : 0;
6711 }
6712 return arr;
6713}
6714UPB_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 -07006715 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 -07006716 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6717 (upb_Message*)msg, &field, arena);
6718 if (size) {
6719 *size = arr ? arr->size : 0;
6720 }
6721 return arr;
6722}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006723UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_name(const google_protobuf_EnumDescriptorProto* msg) {
6724 size_t size;
6725 google_protobuf_EnumDescriptorProto_reserved_name(msg, &size);
6726 return size != 0;
6727}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006728
Joshua Habermanf41049a2022-01-21 14:41:25 -08006729UPB_INLINE void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006730 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 -08006731 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006732}
6733UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006734 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 -08006735 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6736 if (arr) {
6737 if (size) *size = arr->size;
6738 return (google_protobuf_EnumValueDescriptorProto**)_upb_array_ptr(arr);
6739 } else {
6740 if (size) *size = 0;
6741 return NULL;
6742 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006743}
Eric Salob7d54ac2022-12-29 11:59:42 -08006744UPB_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 -07006745 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 -07006746 return (google_protobuf_EnumValueDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006747}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006748UPB_INLINE struct google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumDescriptorProto_add_value(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07006749 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 -08006750 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6751 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6752 return NULL;
6753 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006754 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 -08006755 if (!arr || !sub) return NULL;
6756 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006757 return sub;
6758}
6759UPB_INLINE void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07006760 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 -08006761 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006762}
6763UPB_INLINE struct google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006764 struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg);
6765 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006766 sub = (struct google_protobuf_EnumOptions*)_upb_Message_New(&google__protobuf__EnumOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006767 if (sub) google_protobuf_EnumDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006768 }
6769 return sub;
6770}
Eric Salob7d54ac2022-12-29 11:59:42 -08006771UPB_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 -07006772 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 -08006773 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6774 if (arr) {
6775 if (size) *size = arr->size;
6776 return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_ptr(arr);
6777 } else {
6778 if (size) *size = 0;
6779 return NULL;
6780 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006781}
Eric Salob7d54ac2022-12-29 11:59:42 -08006782UPB_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 -07006783 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 -07006784 return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006785}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006786UPB_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 -07006787 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 -08006788 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6789 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6790 return NULL;
6791 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006792 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 -08006793 if (!arr || !sub) return NULL;
6794 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006795 return sub;
6796}
Eric Salob7d54ac2022-12-29 11:59:42 -08006797UPB_INLINE upb_StringView* google_protobuf_EnumDescriptorProto_mutable_reserved_name(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07006798 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 -08006799 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
6800 if (arr) {
6801 if (size) *size = arr->size;
6802 return (upb_StringView*)_upb_array_ptr(arr);
6803 } else {
6804 if (size) *size = 0;
6805 return NULL;
6806 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006807}
Eric Salob7d54ac2022-12-29 11:59:42 -08006808UPB_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 -07006809 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 -07006810 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006811}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006812UPB_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 -07006813 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 -08006814 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
6815 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
6816 return false;
6817 }
6818 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
6819 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006820}
6821
6822/* google.protobuf.EnumDescriptorProto.EnumReservedRange */
6823
Joshua Habermanf41049a2022-01-21 14:41:25 -08006824UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006825 return (google_protobuf_EnumDescriptorProto_EnumReservedRange*)_upb_Message_New(&google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006826}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006827UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) {
6828 google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006829 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006830 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 -07006831 return NULL;
6832 }
6833 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006834}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006835UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse_ex(const char* buf, size_t size,
6836 const upb_ExtensionRegistry* extreg,
6837 int options, upb_Arena* arena) {
6838 google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
6839 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006840 if (upb_Decode(buf, size, ret, &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006841 kUpb_DecodeStatus_Ok) {
6842 return NULL;
6843 }
6844 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006845}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006846UPB_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 -07006847 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006848 (void)upb_Encode(msg, &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006849 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006850}
6851UPB_INLINE char* google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize_ex(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg, int options,
6852 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006853 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006854 (void)upb_Encode(msg, &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006855 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006856}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006857UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_start(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006858 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 -08006859 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006860}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006861UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006862 int32_t default_val = (int32_t)0;
6863 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006864 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 -08006865 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006866 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006867}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006868UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006869 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 -08006870 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006871}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006872UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_end(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006873 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 -08006874 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006875}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006876UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006877 int32_t default_val = (int32_t)0;
6878 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006879 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 -08006880 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006881 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006882}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006883UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006884 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 -08006885 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006886}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006887
6888UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006889 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 -08006890 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006891}
6892UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006893 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 -08006894 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006895}
Mike Kruskal232ecf42023-01-14 00:09:40 -08006896
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006897/* google.protobuf.EnumValueDescriptorProto */
6898
Joshua Habermanf41049a2022-01-21 14:41:25 -08006899UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006900 return (google_protobuf_EnumValueDescriptorProto*)_upb_Message_New(&google__protobuf__EnumValueDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006901}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006902UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6903 google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006904 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006905 if (upb_Decode(buf, size, ret, &google__protobuf__EnumValueDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006906 return NULL;
6907 }
6908 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006909}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006910UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse_ex(const char* buf, size_t size,
6911 const upb_ExtensionRegistry* extreg,
6912 int options, upb_Arena* arena) {
6913 google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena);
6914 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006915 if (upb_Decode(buf, size, ret, &google__protobuf__EnumValueDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08006916 kUpb_DecodeStatus_Ok) {
6917 return NULL;
6918 }
6919 return ret;
6920}
6921UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize(const google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006922 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006923 (void)upb_Encode(msg, &google__protobuf__EnumValueDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006924 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006925}
6926UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize_ex(const google_protobuf_EnumValueDescriptorProto* msg, int options,
6927 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006928 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006929 (void)upb_Encode(msg, &google__protobuf__EnumValueDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006930 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006931}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006932UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_name(google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006933 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 -08006934 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006935}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006936UPB_INLINE upb_StringView google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006937 upb_StringView default_val = upb_StringView_FromString("");
6938 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07006939 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 -08006940 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006941 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006942}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006943UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006944 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 -08006945 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006946}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006947UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_number(google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006948 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 -08006949 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006950}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006951UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006952 int32_t default_val = (int32_t)0;
6953 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07006954 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 -08006955 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006956 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006957}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006958UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006959 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 -08006960 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006961}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006962UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_options(google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006963 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 -08006964 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006965}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006966UPB_INLINE const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006967 const google_protobuf_EnumValueOptions* default_val = NULL;
6968 const google_protobuf_EnumValueOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07006969 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 -08006970 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006971 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006972}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006973UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07006974 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 -08006975 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006976}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006977
Joshua Habermanf41049a2022-01-21 14:41:25 -08006978UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07006979 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 -08006980 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006981}
6982UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07006983 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 -08006984 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006985}
6986UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07006987 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 -08006988 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006989}
6990UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006991 struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg);
6992 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00006993 sub = (struct google_protobuf_EnumValueOptions*)_upb_Message_New(&google__protobuf__EnumValueOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006994 if (sub) google_protobuf_EnumValueDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006995 }
6996 return sub;
6997}
6998
6999/* google.protobuf.ServiceDescriptorProto */
7000
Joshua Habermanf41049a2022-01-21 14:41:25 -08007001UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007002 return (google_protobuf_ServiceDescriptorProto*)_upb_Message_New(&google__protobuf__ServiceDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007003}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007004UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7005 google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007006 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007007 if (upb_Decode(buf, size, ret, &google__protobuf__ServiceDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007008 return NULL;
7009 }
7010 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007011}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007012UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse_ex(const char* buf, size_t size,
7013 const upb_ExtensionRegistry* extreg,
7014 int options, upb_Arena* arena) {
7015 google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena);
7016 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007017 if (upb_Decode(buf, size, ret, &google__protobuf__ServiceDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08007018 kUpb_DecodeStatus_Ok) {
7019 return NULL;
7020 }
7021 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007022}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007023UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize(const google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007024 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007025 (void)upb_Encode(msg, &google__protobuf__ServiceDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007026 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007027}
7028UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize_ex(const google_protobuf_ServiceDescriptorProto* msg, int options,
7029 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007030 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007031 (void)upb_Encode(msg, &google__protobuf__ServiceDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007032 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007033}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007034UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_name(google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007035 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 -08007036 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007037}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007038UPB_INLINE upb_StringView google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007039 upb_StringView default_val = upb_StringView_FromString("");
7040 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07007041 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 -08007042 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007043 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007044}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007045UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007046 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 -08007047 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007048}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007049UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_method(google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007050 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 -08007051 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007052}
Eric Salob7d54ac2022-12-29 11:59:42 -08007053UPB_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 -07007054 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 -08007055 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7056 if (arr) {
7057 if (size) *size = arr->size;
7058 return (const google_protobuf_MethodDescriptorProto* const*)_upb_array_constptr(arr);
7059 } else {
7060 if (size) *size = 0;
7061 return NULL;
7062 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007063}
Deanna Garciab26afb52023-04-25 13:37:18 -07007064UPB_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 -07007065 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 -07007066 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7067 if (size) {
7068 *size = arr ? arr->size : 0;
7069 }
7070 return arr;
7071}
7072UPB_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 -07007073 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 -07007074 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7075 (upb_Message*)msg, &field, arena);
7076 if (size) {
7077 *size = arr ? arr->size : 0;
7078 }
7079 return arr;
7080}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007081UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_method(const google_protobuf_ServiceDescriptorProto* msg) {
7082 size_t size;
7083 google_protobuf_ServiceDescriptorProto_method(msg, &size);
7084 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007085}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007086UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_options(google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007087 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 -08007088 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007089}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007090UPB_INLINE const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007091 const google_protobuf_ServiceOptions* default_val = NULL;
7092 const google_protobuf_ServiceOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07007093 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 -08007094 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007095 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007096}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007097UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_options(const google_protobuf_ServiceDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007098 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 -08007099 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007100}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007101
Joshua Habermanf41049a2022-01-21 14:41:25 -08007102UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07007103 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 -08007104 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007105}
7106UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07007107 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 -08007108 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
7109 if (arr) {
7110 if (size) *size = arr->size;
7111 return (google_protobuf_MethodDescriptorProto**)_upb_array_ptr(arr);
7112 } else {
7113 if (size) *size = 0;
7114 return NULL;
7115 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007116}
Eric Salob7d54ac2022-12-29 11:59:42 -08007117UPB_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 -07007118 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 -07007119 return (google_protobuf_MethodDescriptorProto**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007120}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007121UPB_INLINE struct google_protobuf_MethodDescriptorProto* google_protobuf_ServiceDescriptorProto_add_method(google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena) {
Jie Luo3560e232023-06-12 00:33:50 -07007122 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 -08007123 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
7124 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
7125 return NULL;
7126 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007127 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 -08007128 if (!arr || !sub) return NULL;
7129 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007130 return sub;
7131}
7132UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07007133 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 -08007134 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007135}
7136UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007137 struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg);
7138 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007139 sub = (struct google_protobuf_ServiceOptions*)_upb_Message_New(&google__protobuf__ServiceOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007140 if (sub) google_protobuf_ServiceDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007141 }
7142 return sub;
7143}
7144
7145/* google.protobuf.MethodDescriptorProto */
7146
Joshua Habermanf41049a2022-01-21 14:41:25 -08007147UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007148 return (google_protobuf_MethodDescriptorProto*)_upb_Message_New(&google__protobuf__MethodDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007149}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007150UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7151 google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007152 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007153 if (upb_Decode(buf, size, ret, &google__protobuf__MethodDescriptorProto_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007154 return NULL;
7155 }
7156 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007157}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007158UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse_ex(const char* buf, size_t size,
7159 const upb_ExtensionRegistry* extreg,
7160 int options, upb_Arena* arena) {
7161 google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena);
7162 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007163 if (upb_Decode(buf, size, ret, &google__protobuf__MethodDescriptorProto_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08007164 kUpb_DecodeStatus_Ok) {
7165 return NULL;
7166 }
7167 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007168}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007169UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize(const google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007170 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007171 (void)upb_Encode(msg, &google__protobuf__MethodDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007172 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007173}
7174UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize_ex(const google_protobuf_MethodDescriptorProto* msg, int options,
7175 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007176 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007177 (void)upb_Encode(msg, &google__protobuf__MethodDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007178 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007179}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007180UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_name(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007181 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 -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_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007185 upb_StringView default_val = upb_StringView_FromString("");
7186 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07007187 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 -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_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007192 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 -08007193 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007194}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007195UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_input_type(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007196 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 -08007197 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007198}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007199UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007200 upb_StringView default_val = upb_StringView_FromString("");
7201 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07007202 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 -08007203 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007204 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007205}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007206UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007207 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 -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_MethodDescriptorProto_clear_output_type(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007211 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 -08007212 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007213}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007214UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007215 upb_StringView default_val = upb_StringView_FromString("");
7216 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07007217 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 -08007218 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007219 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007220}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007221UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007222 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 -08007223 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007224}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007225UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_options(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007226 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 -08007227 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007228}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007229UPB_INLINE const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007230 const google_protobuf_MethodOptions* default_val = NULL;
7231 const google_protobuf_MethodOptions* ret;
Jie Luo3560e232023-06-12 00:33:50 -07007232 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 -08007233 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007234 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007235}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007236UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007237 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 -08007238 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007239}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007240UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_client_streaming(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007241 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 -08007242 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007243}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007244UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007245 bool default_val = false;
7246 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007247 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 -08007248 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007249 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007250}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007251UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007252 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 -08007253 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007254}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007255UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_server_streaming(google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007256 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 -08007257 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007258}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007259UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007260 bool default_val = false;
7261 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007262 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 -08007263 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007264 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007265}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007266UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007267 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 -08007268 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007269}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007270
Joshua Habermanf41049a2022-01-21 14:41:25 -08007271UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07007272 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 -08007273 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007274}
7275UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07007276 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 -08007277 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007278}
7279UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07007280 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 -08007281 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007282}
7283UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) {
Jie Luo3560e232023-06-12 00:33:50 -07007284 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 -08007285 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007286}
7287UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007288 struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg);
7289 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007290 sub = (struct google_protobuf_MethodOptions*)_upb_Message_New(&google__protobuf__MethodOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007291 if (sub) google_protobuf_MethodDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007292 }
7293 return sub;
7294}
7295UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007296 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 -08007297 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007298}
7299UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007300 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 -08007301 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007302}
Mike Kruskal232ecf42023-01-14 00:09:40 -08007303
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007304/* google.protobuf.FileOptions */
7305
Joshua Habermanf41049a2022-01-21 14:41:25 -08007306UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007307 return (google_protobuf_FileOptions*)_upb_Message_New(&google__protobuf__FileOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007308}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007309UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
7310 google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007311 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007312 if (upb_Decode(buf, size, ret, &google__protobuf__FileOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007313 return NULL;
7314 }
7315 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007316}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007317UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse_ex(const char* buf, size_t size,
7318 const upb_ExtensionRegistry* extreg,
7319 int options, upb_Arena* arena) {
7320 google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena);
7321 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007322 if (upb_Decode(buf, size, ret, &google__protobuf__FileOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08007323 kUpb_DecodeStatus_Ok) {
7324 return NULL;
7325 }
7326 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007327}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007328UPB_INLINE char* google_protobuf_FileOptions_serialize(const google_protobuf_FileOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007329 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007330 (void)upb_Encode(msg, &google__protobuf__FileOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007331 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007332}
7333UPB_INLINE char* google_protobuf_FileOptions_serialize_ex(const google_protobuf_FileOptions* msg, int options,
7334 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007335 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007336 (void)upb_Encode(msg, &google__protobuf__FileOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007337 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007338}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007339UPB_INLINE void google_protobuf_FileOptions_clear_java_package(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007340 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 -08007341 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007342}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007343UPB_INLINE upb_StringView google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007344 upb_StringView default_val = upb_StringView_FromString("");
7345 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007346 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 -08007347 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007348 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007349}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007350UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007351 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 -08007352 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007353}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007354UPB_INLINE void google_protobuf_FileOptions_clear_java_outer_classname(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007355 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 -08007356 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007357}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007358UPB_INLINE upb_StringView google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007359 upb_StringView default_val = upb_StringView_FromString("");
7360 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007361 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 -08007362 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007363 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007364}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007365UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007366 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 -08007367 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007368}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007369UPB_INLINE void google_protobuf_FileOptions_clear_optimize_for(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007370 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 -08007371 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007372}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007373UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007374 int32_t default_val = 1;
7375 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007376 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 -08007377 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007378 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007379}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007380UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007381 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 -08007382 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007383}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007384UPB_INLINE void google_protobuf_FileOptions_clear_java_multiple_files(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007385 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 -08007386 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007387}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007388UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007389 bool default_val = false;
7390 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007391 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 -08007392 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007393 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007394}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007395UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007396 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 -08007397 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007398}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007399UPB_INLINE void google_protobuf_FileOptions_clear_go_package(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007400 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 -08007401 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007402}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007403UPB_INLINE upb_StringView google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007404 upb_StringView default_val = upb_StringView_FromString("");
7405 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007406 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 -08007407 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007408 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007409}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007410UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007411 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 -08007412 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007413}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007414UPB_INLINE void google_protobuf_FileOptions_clear_cc_generic_services(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007415 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 -08007416 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007417}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007418UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007419 bool default_val = false;
7420 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007421 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 -08007422 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007423 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007424}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007425UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007426 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 -08007427 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007428}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007429UPB_INLINE void google_protobuf_FileOptions_clear_java_generic_services(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007430 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 -08007431 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007432}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007433UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007434 bool default_val = false;
7435 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007436 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 -08007437 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007438 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007439}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007440UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007441 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 -08007442 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007443}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007444UPB_INLINE void google_protobuf_FileOptions_clear_py_generic_services(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007445 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 -08007446 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007447}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007448UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007449 bool default_val = false;
7450 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007451 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 -08007452 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007453 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007454}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007455UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007456 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 -08007457 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007458}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007459UPB_INLINE void google_protobuf_FileOptions_clear_java_generate_equals_and_hash(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007460 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 -08007461 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007462}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007463UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007464 bool default_val = false;
7465 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007466 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 -08007467 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007468 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007469}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007470UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007471 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 -08007472 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007473}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007474UPB_INLINE void google_protobuf_FileOptions_clear_deprecated(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007475 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 -08007476 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007477}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007478UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007479 bool default_val = false;
7480 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007481 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 -08007482 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007483 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007484}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007485UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007486 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 -08007487 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007488}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007489UPB_INLINE void google_protobuf_FileOptions_clear_java_string_check_utf8(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007490 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 -08007491 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007492}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007493UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007494 bool default_val = false;
7495 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007496 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 -08007497 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007498 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007499}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007500UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007501 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 -08007502 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007503}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007504UPB_INLINE void google_protobuf_FileOptions_clear_cc_enable_arenas(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007505 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 -08007506 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007507}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007508UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007509 bool default_val = true;
7510 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007511 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 -08007512 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007513 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007514}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007515UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007516 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 -08007517 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007518}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007519UPB_INLINE void google_protobuf_FileOptions_clear_objc_class_prefix(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007520 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 -08007521 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007522}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007523UPB_INLINE upb_StringView google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007524 upb_StringView default_val = upb_StringView_FromString("");
7525 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007526 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 -08007527 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007528 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007529}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007530UPB_INLINE bool google_protobuf_FileOptions_has_objc_class_prefix(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007531 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 -08007532 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007533}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007534UPB_INLINE void google_protobuf_FileOptions_clear_csharp_namespace(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007535 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 -08007536 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007537}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007538UPB_INLINE upb_StringView google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007539 upb_StringView default_val = upb_StringView_FromString("");
7540 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007541 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 -08007542 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007543 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007544}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007545UPB_INLINE bool google_protobuf_FileOptions_has_csharp_namespace(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007546 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 -08007547 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007548}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007549UPB_INLINE void google_protobuf_FileOptions_clear_swift_prefix(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007550 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 -08007551 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007552}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007553UPB_INLINE upb_StringView google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007554 upb_StringView default_val = upb_StringView_FromString("");
7555 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007556 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 -08007557 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007558 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007559}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007560UPB_INLINE bool google_protobuf_FileOptions_has_swift_prefix(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007561 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 -08007562 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007563}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007564UPB_INLINE void google_protobuf_FileOptions_clear_php_class_prefix(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007565 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 -08007566 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007567}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007568UPB_INLINE upb_StringView google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007569 upb_StringView default_val = upb_StringView_FromString("");
7570 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007571 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 -08007572 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007573 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007574}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007575UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007576 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 -08007577 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007578}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007579UPB_INLINE void google_protobuf_FileOptions_clear_php_namespace(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007580 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 -08007581 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007582}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007583UPB_INLINE upb_StringView google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007584 upb_StringView default_val = upb_StringView_FromString("");
7585 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007586 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 -08007587 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007588 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007589}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007590UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007591 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 -08007592 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007593}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007594UPB_INLINE void google_protobuf_FileOptions_clear_php_generic_services(google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007595 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 -08007596 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007597}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007598UPB_INLINE bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007599 bool default_val = false;
7600 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007601 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 -08007602 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007603 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007604}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007605UPB_INLINE bool google_protobuf_FileOptions_has_php_generic_services(const google_protobuf_FileOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007606 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 -08007607 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007608}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007609UPB_INLINE void google_protobuf_FileOptions_clear_php_metadata_namespace(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007610 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 -08007611 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007612}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007613UPB_INLINE upb_StringView google_protobuf_FileOptions_php_metadata_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007614 upb_StringView default_val = upb_StringView_FromString("");
7615 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007616 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 -08007617 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007618 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007619}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007620UPB_INLINE bool google_protobuf_FileOptions_has_php_metadata_namespace(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007621 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 -08007622 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007623}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007624UPB_INLINE void google_protobuf_FileOptions_clear_ruby_package(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007625 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 -08007626 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007627}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007628UPB_INLINE upb_StringView google_protobuf_FileOptions_ruby_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007629 upb_StringView default_val = upb_StringView_FromString("");
7630 upb_StringView ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007631 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 -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_FileOptions_has_ruby_package(const google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007636 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)};
7637 return _upb_Message_HasNonExtensionField(msg, &field);
7638}
7639UPB_INLINE void google_protobuf_FileOptions_clear_features(google_protobuf_FileOptions* msg) {
7640 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)};
7641 _upb_Message_ClearNonExtensionField(msg, &field);
7642}
7643UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FileOptions_features(const google_protobuf_FileOptions* msg) {
7644 const google_protobuf_FeatureSet* default_val = NULL;
7645 const google_protobuf_FeatureSet* ret;
7646 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)};
7647 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
7648 return ret;
7649}
7650UPB_INLINE bool google_protobuf_FileOptions_has_features(const google_protobuf_FileOptions* msg) {
7651 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 -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_FileOptions_clear_uninterpreted_option(google_protobuf_FileOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007655 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 -08007656 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007657}
Eric Salob7d54ac2022-12-29 11:59:42 -08007658UPB_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 -07007659 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 -08007660 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7661 if (arr) {
7662 if (size) *size = arr->size;
7663 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
7664 } else {
7665 if (size) *size = 0;
7666 return NULL;
7667 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007668}
Deanna Garciab26afb52023-04-25 13:37:18 -07007669UPB_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 -07007670 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 -07007671 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7672 if (size) {
7673 *size = arr ? arr->size : 0;
7674 }
7675 return arr;
7676}
7677UPB_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 -07007678 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 -07007679 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7680 (upb_Message*)msg, &field, arena);
7681 if (size) {
7682 *size = arr ? arr->size : 0;
7683 }
7684 return arr;
7685}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007686UPB_INLINE bool google_protobuf_FileOptions_has_uninterpreted_option(const google_protobuf_FileOptions* msg) {
7687 size_t size;
7688 google_protobuf_FileOptions_uninterpreted_option(msg, &size);
7689 return size != 0;
7690}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007691
Joshua Habermanf41049a2022-01-21 14:41:25 -08007692UPB_INLINE void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007693 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 -08007694 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007695}
7696UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007697 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 -08007698 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007699}
7700UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007701 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 -08007702 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007703}
7704UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007705 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 -08007706 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007707}
7708UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007709 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 -08007710 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007711}
7712UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007713 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 -08007714 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007715}
7716UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007717 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 -08007718 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007719}
7720UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007721 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 -08007722 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007723}
7724UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007725 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 -08007726 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007727}
7728UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007729 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 -08007730 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007731}
7732UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007733 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 -08007734 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007735}
7736UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007737 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 -08007738 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007739}
7740UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007741 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 -08007742 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007743}
7744UPB_INLINE void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007745 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 -08007746 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007747}
7748UPB_INLINE void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007749 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 -08007750 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007751}
7752UPB_INLINE void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007753 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 -08007754 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007755}
7756UPB_INLINE void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007757 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 -08007758 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007759}
7760UPB_INLINE void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007761 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 -08007762 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007763}
7764UPB_INLINE void google_protobuf_FileOptions_set_php_metadata_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007765 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 -08007766 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007767}
7768UPB_INLINE void google_protobuf_FileOptions_set_ruby_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007769 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 -08007770 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007771}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007772UPB_INLINE void google_protobuf_FileOptions_set_features(google_protobuf_FileOptions *msg, google_protobuf_FeatureSet* value) {
7773 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)};
7774 _upb_Message_SetNonExtensionField(msg, &field, &value);
7775}
7776UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FileOptions_mutable_features(google_protobuf_FileOptions* msg, upb_Arena* arena) {
7777 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FileOptions_features(msg);
7778 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007779 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007780 if (sub) google_protobuf_FileOptions_set_features(msg, sub);
7781 }
7782 return sub;
7783}
Mike Kruskal232ecf42023-01-14 00:09:40 -08007784UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_mutable_uninterpreted_option(google_protobuf_FileOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007785 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 -08007786 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
7787 if (arr) {
7788 if (size) *size = arr->size;
7789 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
7790 } else {
7791 if (size) *size = 0;
7792 return NULL;
7793 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007794}
Eric Salob7d54ac2022-12-29 11:59:42 -08007795UPB_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 -07007796 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 -07007797 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007798}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007799UPB_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 -07007800 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 -08007801 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
7802 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
7803 return NULL;
7804 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007805 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 -08007806 if (!arr || !sub) return NULL;
7807 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007808 return sub;
7809}
7810
7811/* google.protobuf.MessageOptions */
7812
Joshua Habermanf41049a2022-01-21 14:41:25 -08007813UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007814 return (google_protobuf_MessageOptions*)_upb_Message_New(&google__protobuf__MessageOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007815}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007816UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
7817 google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007818 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007819 if (upb_Decode(buf, size, ret, &google__protobuf__MessageOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007820 return NULL;
7821 }
7822 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007823}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007824UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse_ex(const char* buf, size_t size,
7825 const upb_ExtensionRegistry* extreg,
7826 int options, upb_Arena* arena) {
7827 google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena);
7828 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007829 if (upb_Decode(buf, size, ret, &google__protobuf__MessageOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08007830 kUpb_DecodeStatus_Ok) {
7831 return NULL;
7832 }
7833 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007834}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007835UPB_INLINE char* google_protobuf_MessageOptions_serialize(const google_protobuf_MessageOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007836 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007837 (void)upb_Encode(msg, &google__protobuf__MessageOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007838 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007839}
7840UPB_INLINE char* google_protobuf_MessageOptions_serialize_ex(const google_protobuf_MessageOptions* msg, int options,
7841 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007842 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00007843 (void)upb_Encode(msg, &google__protobuf__MessageOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007844 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007845}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007846UPB_INLINE void google_protobuf_MessageOptions_clear_message_set_wire_format(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007847 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 -08007848 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007849}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007850UPB_INLINE bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007851 bool default_val = false;
7852 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007853 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 -08007854 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007855 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007856}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007857UPB_INLINE bool google_protobuf_MessageOptions_has_message_set_wire_format(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007858 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 -08007859 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007860}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007861UPB_INLINE void google_protobuf_MessageOptions_clear_no_standard_descriptor_accessor(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007862 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 -08007863 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007864}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007865UPB_INLINE bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007866 bool default_val = false;
7867 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007868 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 -08007869 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007870 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007871}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007872UPB_INLINE bool google_protobuf_MessageOptions_has_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007873 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 -08007874 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007875}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007876UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007877 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 -08007878 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007879}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007880UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007881 bool default_val = false;
7882 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007883 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 -08007884 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007885 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007886}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007887UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007888 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 -08007889 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007890}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007891UPB_INLINE void google_protobuf_MessageOptions_clear_map_entry(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007892 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 -08007893 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007894}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007895UPB_INLINE bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007896 bool default_val = false;
7897 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007898 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 -08007899 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007900 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007901}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007902UPB_INLINE bool google_protobuf_MessageOptions_has_map_entry(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007903 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 -08007904 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007905}
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08007906UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007907 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 -08007908 _upb_Message_ClearNonExtensionField(msg, &field);
7909}
7910UPB_INLINE bool google_protobuf_MessageOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) {
7911 bool default_val = false;
7912 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07007913 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 -08007914 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
7915 return ret;
7916}
7917UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07007918 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 -08007919 return _upb_Message_HasNonExtensionField(msg, &field);
7920}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007921UPB_INLINE void google_protobuf_MessageOptions_clear_features(google_protobuf_MessageOptions* msg) {
7922 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)};
7923 _upb_Message_ClearNonExtensionField(msg, &field);
7924}
7925UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MessageOptions_features(const google_protobuf_MessageOptions* msg) {
7926 const google_protobuf_FeatureSet* default_val = NULL;
7927 const google_protobuf_FeatureSet* ret;
7928 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)};
7929 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
7930 return ret;
7931}
7932UPB_INLINE bool google_protobuf_MessageOptions_has_features(const google_protobuf_MessageOptions* msg) {
7933 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)};
7934 return _upb_Message_HasNonExtensionField(msg, &field);
7935}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007936UPB_INLINE void google_protobuf_MessageOptions_clear_uninterpreted_option(google_protobuf_MessageOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007937 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 -08007938 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007939}
Eric Salob7d54ac2022-12-29 11:59:42 -08007940UPB_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 -07007941 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 -08007942 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7943 if (arr) {
7944 if (size) *size = arr->size;
7945 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
7946 } else {
7947 if (size) *size = 0;
7948 return NULL;
7949 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007950}
Deanna Garciab26afb52023-04-25 13:37:18 -07007951UPB_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 -07007952 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 -07007953 const upb_Array* arr = upb_Message_GetArray(msg, &field);
7954 if (size) {
7955 *size = arr ? arr->size : 0;
7956 }
7957 return arr;
7958}
7959UPB_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 -07007960 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 -07007961 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7962 (upb_Message*)msg, &field, arena);
7963 if (size) {
7964 *size = arr ? arr->size : 0;
7965 }
7966 return arr;
7967}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007968UPB_INLINE bool google_protobuf_MessageOptions_has_uninterpreted_option(const google_protobuf_MessageOptions* msg) {
7969 size_t size;
7970 google_protobuf_MessageOptions_uninterpreted_option(msg, &size);
7971 return size != 0;
7972}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007973
7974UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007975 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 -08007976 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007977}
7978UPB_INLINE void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007979 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 -08007980 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007981}
7982UPB_INLINE void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007983 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 -08007984 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007985}
7986UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007987 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 -08007988 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007989}
7990UPB_INLINE void google_protobuf_MessageOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07007991 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 -08007992 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007993}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07007994UPB_INLINE void google_protobuf_MessageOptions_set_features(google_protobuf_MessageOptions *msg, google_protobuf_FeatureSet* value) {
7995 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)};
7996 _upb_Message_SetNonExtensionField(msg, &field, &value);
7997}
7998UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MessageOptions_mutable_features(google_protobuf_MessageOptions* msg, upb_Arena* arena) {
7999 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MessageOptions_features(msg);
8000 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008001 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008002 if (sub) google_protobuf_MessageOptions_set_features(msg, sub);
8003 }
8004 return sub;
8005}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008006UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_mutable_uninterpreted_option(google_protobuf_MessageOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008007 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 -08008008 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8009 if (arr) {
8010 if (size) *size = arr->size;
8011 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
8012 } else {
8013 if (size) *size = 0;
8014 return NULL;
8015 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008016}
Eric Salob7d54ac2022-12-29 11:59:42 -08008017UPB_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 -07008018 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 -07008019 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008020}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008021UPB_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 -07008022 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 -08008023 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8024 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8025 return NULL;
8026 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008027 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 -08008028 if (!arr || !sub) return NULL;
8029 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008030 return sub;
8031}
8032
8033/* google.protobuf.FieldOptions */
8034
Joshua Habermanf41049a2022-01-21 14:41:25 -08008035UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008036 return (google_protobuf_FieldOptions*)_upb_Message_New(&google__protobuf__FieldOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008037}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008038UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8039 google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008040 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008041 if (upb_Decode(buf, size, ret, &google__protobuf__FieldOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008042 return NULL;
8043 }
8044 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008045}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008046UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse_ex(const char* buf, size_t size,
8047 const upb_ExtensionRegistry* extreg,
8048 int options, upb_Arena* arena) {
8049 google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena);
8050 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008051 if (upb_Decode(buf, size, ret, &google__protobuf__FieldOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008052 kUpb_DecodeStatus_Ok) {
8053 return NULL;
8054 }
8055 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008056}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008057UPB_INLINE char* google_protobuf_FieldOptions_serialize(const google_protobuf_FieldOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008058 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008059 (void)upb_Encode(msg, &google__protobuf__FieldOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008060 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008061}
8062UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf_FieldOptions* msg, int options,
8063 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008064 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008065 (void)upb_Encode(msg, &google__protobuf__FieldOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008066 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008067}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008068UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008069 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 -08008070 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008071}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008072UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008073 int32_t default_val = 0;
8074 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008075 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 -08008076 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008077 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008078}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008079UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008080 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 -08008081 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008082}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008083UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008084 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 -08008085 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008086}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008087UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008088 bool default_val = false;
8089 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008090 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 -08008091 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008092 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008093}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008094UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008095 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 -08008096 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008097}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008098UPB_INLINE void google_protobuf_FieldOptions_clear_deprecated(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008099 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 -08008100 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008101}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008102UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008103 bool default_val = false;
8104 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008105 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 -08008106 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008107 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008108}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008109UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008110 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 -08008111 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008112}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008113UPB_INLINE void google_protobuf_FieldOptions_clear_lazy(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008114 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 -08008115 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008116}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008117UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008118 bool default_val = false;
8119 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008120 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 -08008121 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008122 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008123}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008124UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008125 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 -08008126 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008127}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008128UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008129 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 -08008130 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008131}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008132UPB_INLINE int32_t google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008133 int32_t default_val = 0;
8134 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008135 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 -08008136 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008137 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008138}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008139UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008140 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 -08008141 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008142}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008143UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008144 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 -08008145 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008146}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008147UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008148 bool default_val = false;
8149 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008150 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 -08008151 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008152 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008153}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008154UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008155 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 -08008156 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008157}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008158UPB_INLINE void google_protobuf_FieldOptions_clear_unverified_lazy(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008159 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 -08008160 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008161}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008162UPB_INLINE bool google_protobuf_FieldOptions_unverified_lazy(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008163 bool default_val = false;
8164 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008165 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 -08008166 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008167 return ret;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008168}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008169UPB_INLINE bool google_protobuf_FieldOptions_has_unverified_lazy(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008170 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 -08008171 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008172}
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008173UPB_INLINE void google_protobuf_FieldOptions_clear_debug_redact(google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008174 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 -08008175 _upb_Message_ClearNonExtensionField(msg, &field);
8176}
8177UPB_INLINE bool google_protobuf_FieldOptions_debug_redact(const google_protobuf_FieldOptions* msg) {
8178 bool default_val = false;
8179 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008180 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 -08008181 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8182 return ret;
8183}
8184UPB_INLINE bool google_protobuf_FieldOptions_has_debug_redact(const google_protobuf_FieldOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008185 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 -08008186 return _upb_Message_HasNonExtensionField(msg, &field);
8187}
Adam Cozzette5a568372023-01-24 20:35:59 -08008188UPB_INLINE void google_protobuf_FieldOptions_clear_retention(google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008189 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 -08008190 _upb_Message_ClearNonExtensionField(msg, &field);
8191}
8192UPB_INLINE int32_t google_protobuf_FieldOptions_retention(const google_protobuf_FieldOptions* msg) {
8193 int32_t default_val = 0;
8194 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008195 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 -08008196 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8197 return ret;
8198}
8199UPB_INLINE bool google_protobuf_FieldOptions_has_retention(const google_protobuf_FieldOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008200 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 -08008201 return _upb_Message_HasNonExtensionField(msg, &field);
8202}
Mike Kruskal0c121392023-03-18 00:05:41 -07008203UPB_INLINE void google_protobuf_FieldOptions_clear_targets(google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008204 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 -08008205 _upb_Message_ClearNonExtensionField(msg, &field);
8206}
Mike Kruskal0c121392023-03-18 00:05:41 -07008207UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008208 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 -07008209 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8210 if (arr) {
8211 if (size) *size = arr->size;
8212 return (int32_t const*)_upb_array_constptr(arr);
8213 } else {
8214 if (size) *size = 0;
8215 return NULL;
8216 }
Adam Cozzette5a568372023-01-24 20:35:59 -08008217}
Deanna Garciab26afb52023-04-25 13:37:18 -07008218UPB_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 -07008219 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 -07008220 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8221 if (size) {
8222 *size = arr ? arr->size : 0;
8223 }
8224 return arr;
8225}
8226UPB_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 -07008227 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 -07008228 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8229 (upb_Message*)msg, &field, arena);
8230 if (size) {
8231 *size = arr ? arr->size : 0;
8232 }
8233 return arr;
8234}
Mike Kruskal0c121392023-03-18 00:05:41 -07008235UPB_INLINE bool google_protobuf_FieldOptions_has_targets(const google_protobuf_FieldOptions* msg) {
8236 size_t size;
8237 google_protobuf_FieldOptions_targets(msg, &size);
8238 return size != 0;
Adam Cozzette5a568372023-01-24 20:35:59 -08008239}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008240UPB_INLINE void google_protobuf_FieldOptions_clear_edition_defaults(google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008241 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 -07008242 _upb_Message_ClearNonExtensionField(msg, &field);
8243}
8244UPB_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 -07008245 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 -07008246 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8247 if (arr) {
8248 if (size) *size = arr->size;
8249 return (const google_protobuf_FieldOptions_EditionDefault* const*)_upb_array_constptr(arr);
8250 } else {
8251 if (size) *size = 0;
8252 return NULL;
8253 }
8254}
8255UPB_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 -07008256 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 -07008257 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8258 if (size) {
8259 *size = arr ? arr->size : 0;
8260 }
8261 return arr;
8262}
8263UPB_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 -07008264 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 -07008265 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8266 (upb_Message*)msg, &field, arena);
8267 if (size) {
8268 *size = arr ? arr->size : 0;
8269 }
8270 return arr;
8271}
8272UPB_INLINE bool google_protobuf_FieldOptions_has_edition_defaults(const google_protobuf_FieldOptions* msg) {
8273 size_t size;
8274 google_protobuf_FieldOptions_edition_defaults(msg, &size);
8275 return size != 0;
8276}
8277UPB_INLINE void google_protobuf_FieldOptions_clear_features(google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008278 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 -07008279 _upb_Message_ClearNonExtensionField(msg, &field);
8280}
8281UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FieldOptions_features(const google_protobuf_FieldOptions* msg) {
8282 const google_protobuf_FeatureSet* default_val = NULL;
8283 const google_protobuf_FeatureSet* ret;
Sandy Zhang96c601d2023-07-05 12:39:20 -07008284 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 -07008285 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8286 return ret;
8287}
8288UPB_INLINE bool google_protobuf_FieldOptions_has_features(const google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008289 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 -07008290 return _upb_Message_HasNonExtensionField(msg, &field);
8291}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008292UPB_INLINE void google_protobuf_FieldOptions_clear_uninterpreted_option(google_protobuf_FieldOptions* msg) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008293 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 -08008294 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008295}
Eric Salob7d54ac2022-12-29 11:59:42 -08008296UPB_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 -07008297 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 -08008298 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8299 if (arr) {
8300 if (size) *size = arr->size;
8301 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
8302 } else {
8303 if (size) *size = 0;
8304 return NULL;
8305 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008306}
Deanna Garciab26afb52023-04-25 13:37:18 -07008307UPB_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 -07008308 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 -07008309 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8310 if (size) {
8311 *size = arr ? arr->size : 0;
8312 }
8313 return arr;
8314}
8315UPB_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 -07008316 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 -07008317 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8318 (upb_Message*)msg, &field, arena);
8319 if (size) {
8320 *size = arr ? arr->size : 0;
8321 }
8322 return arr;
8323}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008324UPB_INLINE bool google_protobuf_FieldOptions_has_uninterpreted_option(const google_protobuf_FieldOptions* msg) {
8325 size_t size;
8326 google_protobuf_FieldOptions_uninterpreted_option(msg, &size);
8327 return size != 0;
8328}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008329
8330UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008331 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 -08008332 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008333}
8334UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008335 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 -08008336 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008337}
8338UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008339 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 -08008340 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008341}
8342UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008343 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 -08008344 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008345}
8346UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008347 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 -08008348 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008349}
8350UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008351 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 -08008352 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008353}
8354UPB_INLINE void google_protobuf_FieldOptions_set_unverified_lazy(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008355 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 -08008356 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008357}
8358UPB_INLINE void google_protobuf_FieldOptions_set_debug_redact(google_protobuf_FieldOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008359 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 -08008360 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008361}
Adam Cozzette5a568372023-01-24 20:35:59 -08008362UPB_INLINE void google_protobuf_FieldOptions_set_retention(google_protobuf_FieldOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008363 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 -08008364 _upb_Message_SetNonExtensionField(msg, &field, &value);
8365}
Mike Kruskal0c121392023-03-18 00:05:41 -07008366UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008367 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 -07008368 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8369 if (arr) {
8370 if (size) *size = arr->size;
8371 return (int32_t*)_upb_array_ptr(arr);
8372 } else {
8373 if (size) *size = 0;
8374 return NULL;
8375 }
8376}
8377UPB_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 -07008378 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 -07008379 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Mike Kruskal0c121392023-03-18 00:05:41 -07008380}
8381UPB_INLINE bool google_protobuf_FieldOptions_add_targets(google_protobuf_FieldOptions* msg, int32_t val, upb_Arena* arena) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008382 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 -07008383 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8384 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8385 return false;
8386 }
8387 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
8388 return true;
Adam Cozzette5a568372023-01-24 20:35:59 -08008389}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008390UPB_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 -07008391 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 -07008392 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8393 if (arr) {
8394 if (size) *size = arr->size;
8395 return (google_protobuf_FieldOptions_EditionDefault**)_upb_array_ptr(arr);
8396 } else {
8397 if (size) *size = 0;
8398 return NULL;
8399 }
8400}
8401UPB_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 -07008402 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 -07008403 return (google_protobuf_FieldOptions_EditionDefault**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
8404}
8405UPB_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 -07008406 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 -07008407 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8408 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8409 return NULL;
8410 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008411 struct google_protobuf_FieldOptions_EditionDefault* sub = (struct google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google__protobuf__FieldOptions__EditionDefault_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008412 if (!arr || !sub) return NULL;
8413 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
8414 return sub;
8415}
8416UPB_INLINE void google_protobuf_FieldOptions_set_features(google_protobuf_FieldOptions *msg, google_protobuf_FeatureSet* value) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008417 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 -07008418 _upb_Message_SetNonExtensionField(msg, &field, &value);
8419}
8420UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FieldOptions_mutable_features(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
8421 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FieldOptions_features(msg);
8422 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008423 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008424 if (sub) google_protobuf_FieldOptions_set_features(msg, sub);
8425 }
8426 return sub;
8427}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008428UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t* size) {
Sandy Zhang96c601d2023-07-05 12:39:20 -07008429 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 -08008430 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8431 if (arr) {
8432 if (size) *size = arr->size;
8433 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
8434 } else {
8435 if (size) *size = 0;
8436 return NULL;
8437 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008438}
Eric Salob7d54ac2022-12-29 11:59:42 -08008439UPB_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 -07008440 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 -07008441 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008442}
8443UPB_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 -07008444 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 -08008445 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8446 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8447 return NULL;
8448 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008449 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 -08008450 if (!arr || !sub) return NULL;
8451 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008452 return sub;
8453}
8454
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008455/* google.protobuf.FieldOptions.EditionDefault */
8456
8457UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008458 return (google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google__protobuf__FieldOptions__EditionDefault_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008459}
8460UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) {
8461 google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena);
8462 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008463 if (upb_Decode(buf, size, ret, &google__protobuf__FieldOptions__EditionDefault_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008464 return NULL;
8465 }
8466 return ret;
8467}
8468UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse_ex(const char* buf, size_t size,
8469 const upb_ExtensionRegistry* extreg,
8470 int options, upb_Arena* arena) {
8471 google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena);
8472 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008473 if (upb_Decode(buf, size, ret, &google__protobuf__FieldOptions__EditionDefault_msg_init, extreg, options, arena) !=
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008474 kUpb_DecodeStatus_Ok) {
8475 return NULL;
8476 }
8477 return ret;
8478}
8479UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize(const google_protobuf_FieldOptions_EditionDefault* msg, upb_Arena* arena, size_t* len) {
8480 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008481 (void)upb_Encode(msg, &google__protobuf__FieldOptions__EditionDefault_msg_init, 0, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008482 return ptr;
8483}
8484UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize_ex(const google_protobuf_FieldOptions_EditionDefault* msg, int options,
8485 upb_Arena* arena, size_t* len) {
8486 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008487 (void)upb_Encode(msg, &google__protobuf__FieldOptions__EditionDefault_msg_init, options, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008488 return ptr;
8489}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008490UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_value(google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00008491 const upb_MiniTableField field = {2, 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 -07008492 _upb_Message_ClearNonExtensionField(msg, &field);
8493}
8494UPB_INLINE upb_StringView google_protobuf_FieldOptions_EditionDefault_value(const google_protobuf_FieldOptions_EditionDefault* msg) {
8495 upb_StringView default_val = upb_StringView_FromString("");
8496 upb_StringView ret;
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00008497 const upb_MiniTableField field = {2, 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 -07008498 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8499 return ret;
8500}
8501UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_value(const google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00008502 const upb_MiniTableField field = {2, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008503 return _upb_Message_HasNonExtensionField(msg, &field);
8504}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00008505UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_edition(google_protobuf_FieldOptions_EditionDefault* msg) {
8506 const upb_MiniTableField field = {3, 4, 2, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008507 _upb_Message_ClearNonExtensionField(msg, &field);
8508}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00008509UPB_INLINE int32_t google_protobuf_FieldOptions_EditionDefault_edition(const google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008510 int32_t default_val = 0;
8511 int32_t ret;
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00008512 const upb_MiniTableField field = {3, 4, 2, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008513 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8514 return ret;
8515}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00008516UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_edition(const google_protobuf_FieldOptions_EditionDefault* msg) {
8517 const upb_MiniTableField field = {3, 4, 2, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008518 return _upb_Message_HasNonExtensionField(msg, &field);
8519}
8520
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008521UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_value(google_protobuf_FieldOptions_EditionDefault *msg, upb_StringView value) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00008522 const upb_MiniTableField field = {2, 8, 1, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00008523 _upb_Message_SetNonExtensionField(msg, &field, &value);
8524}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00008525UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_edition(google_protobuf_FieldOptions_EditionDefault *msg, int32_t value) {
8526 const upb_MiniTableField field = {3, 4, 2, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008527 _upb_Message_SetNonExtensionField(msg, &field, &value);
8528}
8529
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008530/* google.protobuf.OneofOptions */
8531
Joshua Habermanf41049a2022-01-21 14:41:25 -08008532UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008533 return (google_protobuf_OneofOptions*)_upb_Message_New(&google__protobuf__OneofOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008534}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008535UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8536 google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008537 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008538 if (upb_Decode(buf, size, ret, &google__protobuf__OneofOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008539 return NULL;
8540 }
8541 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008542}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008543UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse_ex(const char* buf, size_t size,
8544 const upb_ExtensionRegistry* extreg,
8545 int options, upb_Arena* arena) {
8546 google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena);
8547 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008548 if (upb_Decode(buf, size, ret, &google__protobuf__OneofOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008549 kUpb_DecodeStatus_Ok) {
8550 return NULL;
8551 }
8552 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008553}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008554UPB_INLINE char* google_protobuf_OneofOptions_serialize(const google_protobuf_OneofOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008555 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008556 (void)upb_Encode(msg, &google__protobuf__OneofOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008557 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008558}
8559UPB_INLINE char* google_protobuf_OneofOptions_serialize_ex(const google_protobuf_OneofOptions* msg, int options,
8560 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008561 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008562 (void)upb_Encode(msg, &google__protobuf__OneofOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008563 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008564}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008565UPB_INLINE void google_protobuf_OneofOptions_clear_features(google_protobuf_OneofOptions* msg) {
8566 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)};
8567 _upb_Message_ClearNonExtensionField(msg, &field);
8568}
8569UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_OneofOptions_features(const google_protobuf_OneofOptions* msg) {
8570 const google_protobuf_FeatureSet* default_val = NULL;
8571 const google_protobuf_FeatureSet* ret;
8572 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)};
8573 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8574 return ret;
8575}
8576UPB_INLINE bool google_protobuf_OneofOptions_has_features(const google_protobuf_OneofOptions* msg) {
8577 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)};
8578 return _upb_Message_HasNonExtensionField(msg, &field);
8579}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008580UPB_INLINE void google_protobuf_OneofOptions_clear_uninterpreted_option(google_protobuf_OneofOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008581 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 -08008582 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008583}
Eric Salob7d54ac2022-12-29 11:59:42 -08008584UPB_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 -07008585 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 -08008586 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8587 if (arr) {
8588 if (size) *size = arr->size;
8589 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
8590 } else {
8591 if (size) *size = 0;
8592 return NULL;
8593 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008594}
Deanna Garciab26afb52023-04-25 13:37:18 -07008595UPB_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 -07008596 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 -07008597 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8598 if (size) {
8599 *size = arr ? arr->size : 0;
8600 }
8601 return arr;
8602}
8603UPB_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 -07008604 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 -07008605 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8606 (upb_Message*)msg, &field, arena);
8607 if (size) {
8608 *size = arr ? arr->size : 0;
8609 }
8610 return arr;
8611}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008612UPB_INLINE bool google_protobuf_OneofOptions_has_uninterpreted_option(const google_protobuf_OneofOptions* msg) {
8613 size_t size;
8614 google_protobuf_OneofOptions_uninterpreted_option(msg, &size);
8615 return size != 0;
8616}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008617
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008618UPB_INLINE void google_protobuf_OneofOptions_set_features(google_protobuf_OneofOptions *msg, google_protobuf_FeatureSet* value) {
8619 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)};
8620 _upb_Message_SetNonExtensionField(msg, &field, &value);
8621}
8622UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_OneofOptions_mutable_features(google_protobuf_OneofOptions* msg, upb_Arena* arena) {
8623 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_OneofOptions_features(msg);
8624 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008625 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008626 if (sub) google_protobuf_OneofOptions_set_features(msg, sub);
8627 }
8628 return sub;
8629}
Eric Salob7d54ac2022-12-29 11:59:42 -08008630UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_mutable_uninterpreted_option(google_protobuf_OneofOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008631 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 -08008632 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8633 if (arr) {
8634 if (size) *size = arr->size;
8635 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
8636 } else {
8637 if (size) *size = 0;
8638 return NULL;
8639 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008640}
Eric Salob7d54ac2022-12-29 11:59:42 -08008641UPB_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 -07008642 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 -07008643 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008644}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008645UPB_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 -07008646 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 -08008647 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8648 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8649 return NULL;
8650 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008651 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 -08008652 if (!arr || !sub) return NULL;
8653 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008654 return sub;
8655}
8656
8657/* google.protobuf.EnumOptions */
8658
Joshua Habermanf41049a2022-01-21 14:41:25 -08008659UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008660 return (google_protobuf_EnumOptions*)_upb_Message_New(&google__protobuf__EnumOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008661}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008662UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8663 google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008664 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008665 if (upb_Decode(buf, size, ret, &google__protobuf__EnumOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008666 return NULL;
8667 }
8668 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008669}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008670UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse_ex(const char* buf, size_t size,
8671 const upb_ExtensionRegistry* extreg,
8672 int options, upb_Arena* arena) {
8673 google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena);
8674 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008675 if (upb_Decode(buf, size, ret, &google__protobuf__EnumOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008676 kUpb_DecodeStatus_Ok) {
8677 return NULL;
8678 }
8679 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008680}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008681UPB_INLINE char* google_protobuf_EnumOptions_serialize(const google_protobuf_EnumOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008682 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008683 (void)upb_Encode(msg, &google__protobuf__EnumOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008684 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008685}
8686UPB_INLINE char* google_protobuf_EnumOptions_serialize_ex(const google_protobuf_EnumOptions* msg, int options,
8687 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008688 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008689 (void)upb_Encode(msg, &google__protobuf__EnumOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008690 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008691}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008692UPB_INLINE void google_protobuf_EnumOptions_clear_allow_alias(google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008693 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 -08008694 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008695}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008696UPB_INLINE bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008697 bool default_val = false;
8698 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008699 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 -08008700 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008701 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008702}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008703UPB_INLINE bool google_protobuf_EnumOptions_has_allow_alias(const google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008704 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 -08008705 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008706}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008707UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated(google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008708 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 -08008709 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008710}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008711UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008712 bool default_val = false;
8713 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008714 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 -08008715 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008716 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008717}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008718UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated(const google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008719 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 -08008720 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008721}
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008722UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008723 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 -08008724 _upb_Message_ClearNonExtensionField(msg, &field);
8725}
8726UPB_INLINE bool google_protobuf_EnumOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) {
8727 bool default_val = false;
8728 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008729 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 -08008730 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8731 return ret;
8732}
8733UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008734 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 -08008735 return _upb_Message_HasNonExtensionField(msg, &field);
8736}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008737UPB_INLINE void google_protobuf_EnumOptions_clear_features(google_protobuf_EnumOptions* msg) {
8738 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)};
8739 _upb_Message_ClearNonExtensionField(msg, &field);
8740}
8741UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumOptions_features(const google_protobuf_EnumOptions* msg) {
8742 const google_protobuf_FeatureSet* default_val = NULL;
8743 const google_protobuf_FeatureSet* ret;
8744 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)};
8745 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8746 return ret;
8747}
8748UPB_INLINE bool google_protobuf_EnumOptions_has_features(const google_protobuf_EnumOptions* msg) {
8749 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)};
8750 return _upb_Message_HasNonExtensionField(msg, &field);
8751}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008752UPB_INLINE void google_protobuf_EnumOptions_clear_uninterpreted_option(google_protobuf_EnumOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008753 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 -08008754 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008755}
Eric Salob7d54ac2022-12-29 11:59:42 -08008756UPB_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 -07008757 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 -08008758 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8759 if (arr) {
8760 if (size) *size = arr->size;
8761 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
8762 } else {
8763 if (size) *size = 0;
8764 return NULL;
8765 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008766}
Deanna Garciab26afb52023-04-25 13:37:18 -07008767UPB_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 -07008768 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 -07008769 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8770 if (size) {
8771 *size = arr ? arr->size : 0;
8772 }
8773 return arr;
8774}
8775UPB_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 -07008776 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 -07008777 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8778 (upb_Message*)msg, &field, arena);
8779 if (size) {
8780 *size = arr ? arr->size : 0;
8781 }
8782 return arr;
8783}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008784UPB_INLINE bool google_protobuf_EnumOptions_has_uninterpreted_option(const google_protobuf_EnumOptions* msg) {
8785 size_t size;
8786 google_protobuf_EnumOptions_uninterpreted_option(msg, &size);
8787 return size != 0;
8788}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008789
8790UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008791 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 -08008792 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008793}
8794UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008795 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 -08008796 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008797}
8798UPB_INLINE void google_protobuf_EnumOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008799 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 -08008800 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008801}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008802UPB_INLINE void google_protobuf_EnumOptions_set_features(google_protobuf_EnumOptions *msg, google_protobuf_FeatureSet* value) {
8803 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)};
8804 _upb_Message_SetNonExtensionField(msg, &field, &value);
8805}
8806UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumOptions_mutable_features(google_protobuf_EnumOptions* msg, upb_Arena* arena) {
8807 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumOptions_features(msg);
8808 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008809 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008810 if (sub) google_protobuf_EnumOptions_set_features(msg, sub);
8811 }
8812 return sub;
8813}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008814UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_mutable_uninterpreted_option(google_protobuf_EnumOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008815 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 -08008816 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8817 if (arr) {
8818 if (size) *size = arr->size;
8819 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
8820 } else {
8821 if (size) *size = 0;
8822 return NULL;
8823 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008824}
Eric Salob7d54ac2022-12-29 11:59:42 -08008825UPB_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 -07008826 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 -07008827 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008828}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008829UPB_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 -07008830 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 -08008831 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8832 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8833 return NULL;
8834 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008835 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 -08008836 if (!arr || !sub) return NULL;
8837 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008838 return sub;
8839}
8840
8841/* google.protobuf.EnumValueOptions */
8842
Joshua Habermanf41049a2022-01-21 14:41:25 -08008843UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008844 return (google_protobuf_EnumValueOptions*)_upb_Message_New(&google__protobuf__EnumValueOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008845}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008846UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8847 google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008848 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008849 if (upb_Decode(buf, size, ret, &google__protobuf__EnumValueOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008850 return NULL;
8851 }
8852 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008853}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008854UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse_ex(const char* buf, size_t size,
8855 const upb_ExtensionRegistry* extreg,
8856 int options, upb_Arena* arena) {
8857 google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena);
8858 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008859 if (upb_Decode(buf, size, ret, &google__protobuf__EnumValueOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08008860 kUpb_DecodeStatus_Ok) {
8861 return NULL;
8862 }
8863 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008864}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008865UPB_INLINE char* google_protobuf_EnumValueOptions_serialize(const google_protobuf_EnumValueOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008866 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008867 (void)upb_Encode(msg, &google__protobuf__EnumValueOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008868 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008869}
8870UPB_INLINE char* google_protobuf_EnumValueOptions_serialize_ex(const google_protobuf_EnumValueOptions* msg, int options,
8871 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008872 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008873 (void)upb_Encode(msg, &google__protobuf__EnumValueOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008874 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008875}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008876UPB_INLINE void google_protobuf_EnumValueOptions_clear_deprecated(google_protobuf_EnumValueOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008877 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 -08008878 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008879}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008880UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008881 bool default_val = false;
8882 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07008883 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 -08008884 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008885 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008886}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008887UPB_INLINE bool google_protobuf_EnumValueOptions_has_deprecated(const google_protobuf_EnumValueOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07008888 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 -08008889 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008890}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008891UPB_INLINE void google_protobuf_EnumValueOptions_clear_features(google_protobuf_EnumValueOptions* msg) {
8892 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)};
8893 _upb_Message_ClearNonExtensionField(msg, &field);
8894}
8895UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_features(const google_protobuf_EnumValueOptions* msg) {
8896 const google_protobuf_FeatureSet* default_val = NULL;
8897 const google_protobuf_FeatureSet* ret;
8898 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)};
8899 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8900 return ret;
8901}
8902UPB_INLINE bool google_protobuf_EnumValueOptions_has_features(const google_protobuf_EnumValueOptions* msg) {
8903 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)};
8904 return _upb_Message_HasNonExtensionField(msg, &field);
8905}
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07008906UPB_INLINE void google_protobuf_EnumValueOptions_clear_debug_redact(google_protobuf_EnumValueOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008907 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 -07008908 _upb_Message_ClearNonExtensionField(msg, &field);
8909}
8910UPB_INLINE bool google_protobuf_EnumValueOptions_debug_redact(const google_protobuf_EnumValueOptions* msg) {
8911 bool default_val = false;
8912 bool ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008913 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 -07008914 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
8915 return ret;
8916}
8917UPB_INLINE bool google_protobuf_EnumValueOptions_has_debug_redact(const google_protobuf_EnumValueOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008918 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 -07008919 return _upb_Message_HasNonExtensionField(msg, &field);
8920}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008921UPB_INLINE void google_protobuf_EnumValueOptions_clear_uninterpreted_option(google_protobuf_EnumValueOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008922 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 -08008923 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008924}
Eric Salob7d54ac2022-12-29 11:59:42 -08008925UPB_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 -07008926 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 -08008927 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8928 if (arr) {
8929 if (size) *size = arr->size;
8930 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
8931 } else {
8932 if (size) *size = 0;
8933 return NULL;
8934 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008935}
Deanna Garciab26afb52023-04-25 13:37:18 -07008936UPB_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 -07008937 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 -07008938 const upb_Array* arr = upb_Message_GetArray(msg, &field);
8939 if (size) {
8940 *size = arr ? arr->size : 0;
8941 }
8942 return arr;
8943}
8944UPB_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 -07008945 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 -07008946 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8947 (upb_Message*)msg, &field, arena);
8948 if (size) {
8949 *size = arr ? arr->size : 0;
8950 }
8951 return arr;
8952}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008953UPB_INLINE bool google_protobuf_EnumValueOptions_has_uninterpreted_option(const google_protobuf_EnumValueOptions* msg) {
8954 size_t size;
8955 google_protobuf_EnumValueOptions_uninterpreted_option(msg, &size);
8956 return size != 0;
8957}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008958
8959UPB_INLINE void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07008960 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 -08008961 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008962}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008963UPB_INLINE void google_protobuf_EnumValueOptions_set_features(google_protobuf_EnumValueOptions *msg, google_protobuf_FeatureSet* value) {
8964 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)};
8965 _upb_Message_SetNonExtensionField(msg, &field, &value);
8966}
8967UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_mutable_features(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) {
8968 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumValueOptions_features(msg);
8969 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00008970 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008971 if (sub) google_protobuf_EnumValueOptions_set_features(msg, sub);
8972 }
8973 return sub;
8974}
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07008975UPB_INLINE void google_protobuf_EnumValueOptions_set_debug_redact(google_protobuf_EnumValueOptions *msg, bool value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008976 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 -07008977 _upb_Message_SetNonExtensionField(msg, &field, &value);
8978}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008979UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008980 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 -08008981 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
8982 if (arr) {
8983 if (size) *size = arr->size;
8984 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
8985 } else {
8986 if (size) *size = 0;
8987 return NULL;
8988 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008989}
Eric Salob7d54ac2022-12-29 11:59:42 -08008990UPB_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 -07008991 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 -07008992 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008993}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008994UPB_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 -07008995 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 -08008996 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
8997 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
8998 return NULL;
8999 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009000 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 -08009001 if (!arr || !sub) return NULL;
9002 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009003 return sub;
9004}
9005
9006/* google.protobuf.ServiceOptions */
9007
Joshua Habermanf41049a2022-01-21 14:41:25 -08009008UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009009 return (google_protobuf_ServiceOptions*)_upb_Message_New(&google__protobuf__ServiceOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009010}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009011UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
9012 google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009013 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009014 if (upb_Decode(buf, size, ret, &google__protobuf__ServiceOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009015 return NULL;
9016 }
9017 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009018}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009019UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse_ex(const char* buf, size_t size,
9020 const upb_ExtensionRegistry* extreg,
9021 int options, upb_Arena* arena) {
9022 google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena);
9023 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009024 if (upb_Decode(buf, size, ret, &google__protobuf__ServiceOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08009025 kUpb_DecodeStatus_Ok) {
9026 return NULL;
9027 }
9028 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009029}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009030UPB_INLINE char* google_protobuf_ServiceOptions_serialize(const google_protobuf_ServiceOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009031 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009032 (void)upb_Encode(msg, &google__protobuf__ServiceOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009033 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009034}
9035UPB_INLINE char* google_protobuf_ServiceOptions_serialize_ex(const google_protobuf_ServiceOptions* msg, int options,
9036 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009037 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009038 (void)upb_Encode(msg, &google__protobuf__ServiceOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009039 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009040}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009041UPB_INLINE void google_protobuf_ServiceOptions_clear_deprecated(google_protobuf_ServiceOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009042 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 -08009043 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009044}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009045UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009046 bool default_val = false;
9047 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07009048 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 -08009049 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009050 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009051}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009052UPB_INLINE bool google_protobuf_ServiceOptions_has_deprecated(const google_protobuf_ServiceOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009053 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 -08009054 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009055}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009056UPB_INLINE void google_protobuf_ServiceOptions_clear_features(google_protobuf_ServiceOptions* msg) {
9057 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)};
9058 _upb_Message_ClearNonExtensionField(msg, &field);
9059}
9060UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ServiceOptions_features(const google_protobuf_ServiceOptions* msg) {
9061 const google_protobuf_FeatureSet* default_val = NULL;
9062 const google_protobuf_FeatureSet* ret;
9063 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)};
9064 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9065 return ret;
9066}
9067UPB_INLINE bool google_protobuf_ServiceOptions_has_features(const google_protobuf_ServiceOptions* msg) {
9068 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)};
9069 return _upb_Message_HasNonExtensionField(msg, &field);
9070}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009071UPB_INLINE void google_protobuf_ServiceOptions_clear_uninterpreted_option(google_protobuf_ServiceOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009072 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 -08009073 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009074}
Eric Salob7d54ac2022-12-29 11:59:42 -08009075UPB_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 -07009076 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 -08009077 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9078 if (arr) {
9079 if (size) *size = arr->size;
9080 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
9081 } else {
9082 if (size) *size = 0;
9083 return NULL;
9084 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009085}
Deanna Garciab26afb52023-04-25 13:37:18 -07009086UPB_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 -07009087 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 -07009088 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9089 if (size) {
9090 *size = arr ? arr->size : 0;
9091 }
9092 return arr;
9093}
9094UPB_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 -07009095 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 -07009096 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9097 (upb_Message*)msg, &field, arena);
9098 if (size) {
9099 *size = arr ? arr->size : 0;
9100 }
9101 return arr;
9102}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009103UPB_INLINE bool google_protobuf_ServiceOptions_has_uninterpreted_option(const google_protobuf_ServiceOptions* msg) {
9104 size_t size;
9105 google_protobuf_ServiceOptions_uninterpreted_option(msg, &size);
9106 return size != 0;
9107}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009108
9109UPB_INLINE void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07009110 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 -08009111 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009112}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009113UPB_INLINE void google_protobuf_ServiceOptions_set_features(google_protobuf_ServiceOptions *msg, google_protobuf_FeatureSet* value) {
9114 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)};
9115 _upb_Message_SetNonExtensionField(msg, &field, &value);
9116}
9117UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ServiceOptions_mutable_features(google_protobuf_ServiceOptions* msg, upb_Arena* arena) {
9118 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ServiceOptions_features(msg);
9119 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009120 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009121 if (sub) google_protobuf_ServiceOptions_set_features(msg, sub);
9122 }
9123 return sub;
9124}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009125UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_mutable_uninterpreted_option(google_protobuf_ServiceOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009126 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 -08009127 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9128 if (arr) {
9129 if (size) *size = arr->size;
9130 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
9131 } else {
9132 if (size) *size = 0;
9133 return NULL;
9134 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009135}
Eric Salob7d54ac2022-12-29 11:59:42 -08009136UPB_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 -07009137 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 -07009138 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009139}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009140UPB_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 -07009141 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 -08009142 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9143 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9144 return NULL;
9145 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009146 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 -08009147 if (!arr || !sub) return NULL;
9148 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009149 return sub;
9150}
9151
9152/* google.protobuf.MethodOptions */
9153
Joshua Habermanf41049a2022-01-21 14:41:25 -08009154UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009155 return (google_protobuf_MethodOptions*)_upb_Message_New(&google__protobuf__MethodOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009156}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009157UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
9158 google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009159 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009160 if (upb_Decode(buf, size, ret, &google__protobuf__MethodOptions_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009161 return NULL;
9162 }
9163 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009164}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009165UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse_ex(const char* buf, size_t size,
9166 const upb_ExtensionRegistry* extreg,
9167 int options, upb_Arena* arena) {
9168 google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena);
9169 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009170 if (upb_Decode(buf, size, ret, &google__protobuf__MethodOptions_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08009171 kUpb_DecodeStatus_Ok) {
9172 return NULL;
9173 }
9174 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009175}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009176UPB_INLINE char* google_protobuf_MethodOptions_serialize(const google_protobuf_MethodOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009177 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009178 (void)upb_Encode(msg, &google__protobuf__MethodOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009179 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009180}
9181UPB_INLINE char* google_protobuf_MethodOptions_serialize_ex(const google_protobuf_MethodOptions* msg, int options,
9182 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009183 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009184 (void)upb_Encode(msg, &google__protobuf__MethodOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009185 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009186}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009187UPB_INLINE void google_protobuf_MethodOptions_clear_deprecated(google_protobuf_MethodOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009188 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 -08009189 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009190}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009191UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009192 bool default_val = false;
9193 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07009194 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 -08009195 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009196 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009197}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009198UPB_INLINE bool google_protobuf_MethodOptions_has_deprecated(const google_protobuf_MethodOptions* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009199 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 -08009200 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009201}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009202UPB_INLINE void google_protobuf_MethodOptions_clear_idempotency_level(google_protobuf_MethodOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009203 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 -08009204 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009205}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009206UPB_INLINE int32_t google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009207 int32_t default_val = 0;
9208 int32_t ret;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009209 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 -08009210 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009211 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009212}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009213UPB_INLINE bool google_protobuf_MethodOptions_has_idempotency_level(const google_protobuf_MethodOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009214 const upb_MiniTableField field = {34, 4, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9215 return _upb_Message_HasNonExtensionField(msg, &field);
9216}
9217UPB_INLINE void google_protobuf_MethodOptions_clear_features(google_protobuf_MethodOptions* msg) {
9218 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)};
9219 _upb_Message_ClearNonExtensionField(msg, &field);
9220}
9221UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MethodOptions_features(const google_protobuf_MethodOptions* msg) {
9222 const google_protobuf_FeatureSet* default_val = NULL;
9223 const google_protobuf_FeatureSet* ret;
9224 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)};
9225 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9226 return ret;
9227}
9228UPB_INLINE bool google_protobuf_MethodOptions_has_features(const google_protobuf_MethodOptions* msg) {
9229 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 -08009230 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009231}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009232UPB_INLINE void google_protobuf_MethodOptions_clear_uninterpreted_option(google_protobuf_MethodOptions* msg) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009233 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 -08009234 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009235}
Eric Salob7d54ac2022-12-29 11:59:42 -08009236UPB_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 -07009237 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 -08009238 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9239 if (arr) {
9240 if (size) *size = arr->size;
9241 return (const google_protobuf_UninterpretedOption* const*)_upb_array_constptr(arr);
9242 } else {
9243 if (size) *size = 0;
9244 return NULL;
9245 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009246}
Deanna Garciab26afb52023-04-25 13:37:18 -07009247UPB_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 -07009248 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 -07009249 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9250 if (size) {
9251 *size = arr ? arr->size : 0;
9252 }
9253 return arr;
9254}
9255UPB_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 -07009256 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 -07009257 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9258 (upb_Message*)msg, &field, arena);
9259 if (size) {
9260 *size = arr ? arr->size : 0;
9261 }
9262 return arr;
9263}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009264UPB_INLINE bool google_protobuf_MethodOptions_has_uninterpreted_option(const google_protobuf_MethodOptions* msg) {
9265 size_t size;
9266 google_protobuf_MethodOptions_uninterpreted_option(msg, &size);
9267 return size != 0;
9268}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009269
9270UPB_INLINE void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07009271 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 -08009272 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009273}
9274UPB_INLINE void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, int32_t value) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009275 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 -08009276 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009277}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009278UPB_INLINE void google_protobuf_MethodOptions_set_features(google_protobuf_MethodOptions *msg, google_protobuf_FeatureSet* value) {
9279 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)};
9280 _upb_Message_SetNonExtensionField(msg, &field, &value);
9281}
9282UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MethodOptions_mutable_features(google_protobuf_MethodOptions* msg, upb_Arena* arena) {
9283 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MethodOptions_features(msg);
9284 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009285 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009286 if (sub) google_protobuf_MethodOptions_set_features(msg, sub);
9287 }
9288 return sub;
9289}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009290UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_mutable_uninterpreted_option(google_protobuf_MethodOptions* msg, size_t* size) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009291 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 -08009292 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9293 if (arr) {
9294 if (size) *size = arr->size;
9295 return (google_protobuf_UninterpretedOption**)_upb_array_ptr(arr);
9296 } else {
9297 if (size) *size = 0;
9298 return NULL;
9299 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009300}
Eric Salob7d54ac2022-12-29 11:59:42 -08009301UPB_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 -07009302 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 -07009303 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009304}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009305UPB_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 -07009306 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 -08009307 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9308 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9309 return NULL;
9310 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009311 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 -08009312 if (!arr || !sub) return NULL;
9313 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009314 return sub;
9315}
9316
9317/* google.protobuf.UninterpretedOption */
9318
Joshua Habermanf41049a2022-01-21 14:41:25 -08009319UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009320 return (google_protobuf_UninterpretedOption*)_upb_Message_New(&google__protobuf__UninterpretedOption_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009321}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009322UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse(const char* buf, size_t size, upb_Arena* arena) {
9323 google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009324 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009325 if (upb_Decode(buf, size, ret, &google__protobuf__UninterpretedOption_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009326 return NULL;
9327 }
9328 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009329}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009330UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse_ex(const char* buf, size_t size,
9331 const upb_ExtensionRegistry* extreg,
9332 int options, upb_Arena* arena) {
9333 google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena);
9334 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009335 if (upb_Decode(buf, size, ret, &google__protobuf__UninterpretedOption_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08009336 kUpb_DecodeStatus_Ok) {
9337 return NULL;
9338 }
9339 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009340}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009341UPB_INLINE char* google_protobuf_UninterpretedOption_serialize(const google_protobuf_UninterpretedOption* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009342 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009343 (void)upb_Encode(msg, &google__protobuf__UninterpretedOption_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009344 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009345}
9346UPB_INLINE char* google_protobuf_UninterpretedOption_serialize_ex(const google_protobuf_UninterpretedOption* msg, int options,
9347 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009348 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009349 (void)upb_Encode(msg, &google__protobuf__UninterpretedOption_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009350 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009351}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009352UPB_INLINE void google_protobuf_UninterpretedOption_clear_name(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009353 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 -08009354 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009355}
Eric Salob7d54ac2022-12-29 11:59:42 -08009356UPB_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 -07009357 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 -08009358 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9359 if (arr) {
9360 if (size) *size = arr->size;
9361 return (const google_protobuf_UninterpretedOption_NamePart* const*)_upb_array_constptr(arr);
9362 } else {
9363 if (size) *size = 0;
9364 return NULL;
9365 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009366}
Deanna Garciab26afb52023-04-25 13:37:18 -07009367UPB_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 -07009368 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 -07009369 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9370 if (size) {
9371 *size = arr ? arr->size : 0;
9372 }
9373 return arr;
9374}
9375UPB_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 -07009376 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 -07009377 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9378 (upb_Message*)msg, &field, arena);
9379 if (size) {
9380 *size = arr ? arr->size : 0;
9381 }
9382 return arr;
9383}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009384UPB_INLINE bool google_protobuf_UninterpretedOption_has_name(const google_protobuf_UninterpretedOption* msg) {
9385 size_t size;
9386 google_protobuf_UninterpretedOption_name(msg, &size);
9387 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009388}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009389UPB_INLINE void google_protobuf_UninterpretedOption_clear_identifier_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009390 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 -08009391 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009392}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009393UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009394 upb_StringView default_val = upb_StringView_FromString("");
9395 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07009396 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 -08009397 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009398 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009399}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009400UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009401 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 -08009402 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009403}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009404UPB_INLINE void google_protobuf_UninterpretedOption_clear_positive_int_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009405 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 -08009406 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009407}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009408UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009409 uint64_t default_val = (uint64_t)0ull;
9410 uint64_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07009411 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 -08009412 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009413 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009414}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009415UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009416 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 -08009417 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009418}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009419UPB_INLINE void google_protobuf_UninterpretedOption_clear_negative_int_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009420 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 -08009421 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009422}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009423UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009424 int64_t default_val = (int64_t)0ll;
9425 int64_t ret;
Jie Luo3560e232023-06-12 00:33:50 -07009426 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 -08009427 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009428 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009429}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009430UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009431 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 -08009432 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009433}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009434UPB_INLINE void google_protobuf_UninterpretedOption_clear_double_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009435 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 -08009436 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009437}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009438UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009439 double default_val = 0;
9440 double ret;
Jie Luo3560e232023-06-12 00:33:50 -07009441 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 -08009442 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009443 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009444}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009445UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009446 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 -08009447 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009448}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009449UPB_INLINE void google_protobuf_UninterpretedOption_clear_string_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009450 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 -08009451 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009452}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009453UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009454 upb_StringView default_val = upb_StringView_FromString("");
9455 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07009456 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 -08009457 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009458 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009459}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009460UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009461 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 -08009462 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009463}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009464UPB_INLINE void google_protobuf_UninterpretedOption_clear_aggregate_value(google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009465 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 -08009466 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009467}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009468UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009469 upb_StringView default_val = upb_StringView_FromString("");
9470 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07009471 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 -08009472 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009473 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009474}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009475UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009476 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 -08009477 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08009478}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009479
Eric Salob7d54ac2022-12-29 11:59:42 -08009480UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -07009481 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 -08009482 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9483 if (arr) {
9484 if (size) *size = arr->size;
9485 return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_ptr(arr);
9486 } else {
9487 if (size) *size = 0;
9488 return NULL;
9489 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009490}
Eric Salob7d54ac2022-12-29 11:59:42 -08009491UPB_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 -07009492 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 -07009493 return (google_protobuf_UninterpretedOption_NamePart**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009494}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009495UPB_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 -07009496 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 -08009497 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9498 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9499 return NULL;
9500 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009501 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 -08009502 if (!arr || !sub) return NULL;
9503 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009504 return sub;
9505}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009506UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07009507 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 -08009508 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009509}
9510UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07009511 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 -08009512 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009513}
9514UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) {
Jie Luo3560e232023-06-12 00:33:50 -07009515 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 -08009516 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009517}
9518UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) {
Jie Luo3560e232023-06-12 00:33:50 -07009519 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 -08009520 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009521}
9522UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07009523 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 -08009524 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009525}
9526UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07009527 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 -08009528 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009529}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009530
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009531/* google.protobuf.UninterpretedOption.NamePart */
9532
Joshua Habermanf41049a2022-01-21 14:41:25 -08009533UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009534 return (google_protobuf_UninterpretedOption_NamePart*)_upb_Message_New(&google__protobuf__UninterpretedOption__NamePart_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009535}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009536UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse(const char* buf, size_t size, upb_Arena* arena) {
9537 google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009538 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009539 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 -07009540 return NULL;
9541 }
9542 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009543}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009544UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse_ex(const char* buf, size_t size,
9545 const upb_ExtensionRegistry* extreg,
9546 int options, upb_Arena* arena) {
9547 google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
9548 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009549 if (upb_Decode(buf, size, ret, &google__protobuf__UninterpretedOption__NamePart_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08009550 kUpb_DecodeStatus_Ok) {
9551 return NULL;
9552 }
9553 return ret;
9554}
9555UPB_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 -07009556 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009557 (void)upb_Encode(msg, &google__protobuf__UninterpretedOption__NamePart_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009558 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009559}
9560UPB_INLINE char* google_protobuf_UninterpretedOption_NamePart_serialize_ex(const google_protobuf_UninterpretedOption_NamePart* msg, int options,
9561 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009562 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009563 (void)upb_Encode(msg, &google__protobuf__UninterpretedOption__NamePart_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009564 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009565}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009566UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_name_part(google_protobuf_UninterpretedOption_NamePart* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009567 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 -08009568 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009569}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009570UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009571 upb_StringView default_val = upb_StringView_FromString("");
9572 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -07009573 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 -08009574 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009575 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009576}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009577UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009578 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 -08009579 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009580}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009581UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_is_extension(google_protobuf_UninterpretedOption_NamePart* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009582 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 -08009583 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009584}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009585UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009586 bool default_val = false;
9587 bool ret;
Jie Luo3560e232023-06-12 00:33:50 -07009588 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 -08009589 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009590 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009591}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009592UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) {
Jie Luo3560e232023-06-12 00:33:50 -07009593 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 -08009594 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08009595}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009596
Joshua Habermanf41049a2022-01-21 14:41:25 -08009597UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -07009598 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 -08009599 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009600}
9601UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) {
Jie Luo3560e232023-06-12 00:33:50 -07009602 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 -08009603 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009604}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009605
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009606/* google.protobuf.FeatureSet */
9607
9608UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009609 return (google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009610}
9611UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse(const char* buf, size_t size, upb_Arena* arena) {
9612 google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena);
9613 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009614 if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSet_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009615 return NULL;
9616 }
9617 return ret;
9618}
9619UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse_ex(const char* buf, size_t size,
9620 const upb_ExtensionRegistry* extreg,
9621 int options, upb_Arena* arena) {
9622 google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena);
9623 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009624 if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSet_msg_init, extreg, options, arena) !=
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009625 kUpb_DecodeStatus_Ok) {
9626 return NULL;
9627 }
9628 return ret;
9629}
9630UPB_INLINE char* google_protobuf_FeatureSet_serialize(const google_protobuf_FeatureSet* msg, upb_Arena* arena, size_t* len) {
9631 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009632 (void)upb_Encode(msg, &google__protobuf__FeatureSet_msg_init, 0, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009633 return ptr;
9634}
9635UPB_INLINE char* google_protobuf_FeatureSet_serialize_ex(const google_protobuf_FeatureSet* msg, int options,
9636 upb_Arena* arena, size_t* len) {
9637 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009638 (void)upb_Encode(msg, &google__protobuf__FeatureSet_msg_init, options, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009639 return ptr;
9640}
9641UPB_INLINE void google_protobuf_FeatureSet_clear_field_presence(google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009642 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 -07009643 _upb_Message_ClearNonExtensionField(msg, &field);
9644}
9645UPB_INLINE int32_t google_protobuf_FeatureSet_field_presence(const google_protobuf_FeatureSet* msg) {
9646 int32_t default_val = 0;
9647 int32_t ret;
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009648 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 -07009649 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9650 return ret;
9651}
9652UPB_INLINE bool google_protobuf_FeatureSet_has_field_presence(const google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009653 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 -07009654 return _upb_Message_HasNonExtensionField(msg, &field);
9655}
9656UPB_INLINE void google_protobuf_FeatureSet_clear_enum_type(google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009657 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 -07009658 _upb_Message_ClearNonExtensionField(msg, &field);
9659}
9660UPB_INLINE int32_t google_protobuf_FeatureSet_enum_type(const google_protobuf_FeatureSet* msg) {
9661 int32_t default_val = 0;
9662 int32_t ret;
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009663 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 -07009664 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9665 return ret;
9666}
9667UPB_INLINE bool google_protobuf_FeatureSet_has_enum_type(const google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009668 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 -07009669 return _upb_Message_HasNonExtensionField(msg, &field);
9670}
9671UPB_INLINE void google_protobuf_FeatureSet_clear_repeated_field_encoding(google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009672 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 -07009673 _upb_Message_ClearNonExtensionField(msg, &field);
9674}
9675UPB_INLINE int32_t google_protobuf_FeatureSet_repeated_field_encoding(const google_protobuf_FeatureSet* msg) {
9676 int32_t default_val = 0;
9677 int32_t ret;
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009678 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 -07009679 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9680 return ret;
9681}
9682UPB_INLINE bool google_protobuf_FeatureSet_has_repeated_field_encoding(const google_protobuf_FeatureSet* msg) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009683 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 -07009684 return _upb_Message_HasNonExtensionField(msg, &field);
9685}
Protobuf Team Bot61127952023-09-26 20:07:33 +00009686UPB_INLINE void google_protobuf_FeatureSet_clear_utf8_validation(google_protobuf_FeatureSet* msg) {
9687 const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9688 _upb_Message_ClearNonExtensionField(msg, &field);
9689}
9690UPB_INLINE int32_t google_protobuf_FeatureSet_utf8_validation(const google_protobuf_FeatureSet* msg) {
9691 int32_t default_val = 0;
9692 int32_t ret;
9693 const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9694 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9695 return ret;
9696}
9697UPB_INLINE bool google_protobuf_FeatureSet_has_utf8_validation(const google_protobuf_FeatureSet* msg) {
9698 const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9699 return _upb_Message_HasNonExtensionField(msg, &field);
9700}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009701UPB_INLINE void google_protobuf_FeatureSet_clear_message_encoding(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot61127952023-09-26 20:07:33 +00009702 const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009703 _upb_Message_ClearNonExtensionField(msg, &field);
9704}
9705UPB_INLINE int32_t google_protobuf_FeatureSet_message_encoding(const google_protobuf_FeatureSet* msg) {
9706 int32_t default_val = 0;
9707 int32_t ret;
Protobuf Team Bot61127952023-09-26 20:07:33 +00009708 const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009709 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9710 return ret;
9711}
9712UPB_INLINE bool google_protobuf_FeatureSet_has_message_encoding(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot61127952023-09-26 20:07:33 +00009713 const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009714 return _upb_Message_HasNonExtensionField(msg, &field);
9715}
9716UPB_INLINE void google_protobuf_FeatureSet_clear_json_format(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot61127952023-09-26 20:07:33 +00009717 const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009718 _upb_Message_ClearNonExtensionField(msg, &field);
9719}
9720UPB_INLINE int32_t google_protobuf_FeatureSet_json_format(const google_protobuf_FeatureSet* msg) {
9721 int32_t default_val = 0;
9722 int32_t ret;
Protobuf Team Bot61127952023-09-26 20:07:33 +00009723 const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009724 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9725 return ret;
9726}
9727UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot61127952023-09-26 20:07:33 +00009728 const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009729 return _upb_Message_HasNonExtensionField(msg, &field);
9730}
9731
9732UPB_INLINE void google_protobuf_FeatureSet_set_field_presence(google_protobuf_FeatureSet *msg, int32_t value) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009733 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 -07009734 _upb_Message_SetNonExtensionField(msg, &field, &value);
9735}
9736UPB_INLINE void google_protobuf_FeatureSet_set_enum_type(google_protobuf_FeatureSet *msg, int32_t value) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009737 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 -07009738 _upb_Message_SetNonExtensionField(msg, &field, &value);
9739}
9740UPB_INLINE void google_protobuf_FeatureSet_set_repeated_field_encoding(google_protobuf_FeatureSet *msg, int32_t value) {
Mike Kruskal60ec7bf2023-08-17 16:44:12 -07009741 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 -07009742 _upb_Message_SetNonExtensionField(msg, &field, &value);
9743}
Protobuf Team Bot61127952023-09-26 20:07:33 +00009744UPB_INLINE void google_protobuf_FeatureSet_set_utf8_validation(google_protobuf_FeatureSet *msg, int32_t value) {
9745 const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
9746 _upb_Message_SetNonExtensionField(msg, &field, &value);
9747}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009748UPB_INLINE void google_protobuf_FeatureSet_set_message_encoding(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot61127952023-09-26 20:07:33 +00009749 const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009750 _upb_Message_SetNonExtensionField(msg, &field, &value);
9751}
9752UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot61127952023-09-26 20:07:33 +00009753 const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009754 _upb_Message_SetNonExtensionField(msg, &field, &value);
9755}
9756
Mike Kruskalba964702023-08-22 17:37:48 -07009757/* google.protobuf.FeatureSetDefaults */
9758
9759UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009760 return (google_protobuf_FeatureSetDefaults*)_upb_Message_New(&google__protobuf__FeatureSetDefaults_msg_init, arena);
Mike Kruskalba964702023-08-22 17:37:48 -07009761}
9762UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse(const char* buf, size_t size, upb_Arena* arena) {
9763 google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena);
9764 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009765 if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSetDefaults_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskalba964702023-08-22 17:37:48 -07009766 return NULL;
9767 }
9768 return ret;
9769}
9770UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse_ex(const char* buf, size_t size,
9771 const upb_ExtensionRegistry* extreg,
9772 int options, upb_Arena* arena) {
9773 google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena);
9774 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009775 if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSetDefaults_msg_init, extreg, options, arena) !=
Mike Kruskalba964702023-08-22 17:37:48 -07009776 kUpb_DecodeStatus_Ok) {
9777 return NULL;
9778 }
9779 return ret;
9780}
9781UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize(const google_protobuf_FeatureSetDefaults* msg, upb_Arena* arena, size_t* len) {
9782 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009783 (void)upb_Encode(msg, &google__protobuf__FeatureSetDefaults_msg_init, 0, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -07009784 return ptr;
9785}
9786UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize_ex(const google_protobuf_FeatureSetDefaults* msg, int options,
9787 upb_Arena* arena, size_t* len) {
9788 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009789 (void)upb_Encode(msg, &google__protobuf__FeatureSetDefaults_msg_init, options, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -07009790 return ptr;
9791}
9792UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_defaults(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009793 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 -07009794 _upb_Message_ClearNonExtensionField(msg, &field);
9795}
9796UPB_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 +00009797 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 -07009798 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9799 if (arr) {
9800 if (size) *size = arr->size;
9801 return (const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* const*)_upb_array_constptr(arr);
9802 } else {
9803 if (size) *size = 0;
9804 return NULL;
9805 }
9806}
9807UPB_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 +00009808 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 -07009809 const upb_Array* arr = upb_Message_GetArray(msg, &field);
9810 if (size) {
9811 *size = arr ? arr->size : 0;
9812 }
9813 return arr;
9814}
9815UPB_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 +00009816 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 -07009817 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9818 (upb_Message*)msg, &field, arena);
9819 if (size) {
9820 *size = arr ? arr->size : 0;
9821 }
9822 return arr;
9823}
9824UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_defaults(const google_protobuf_FeatureSetDefaults* msg) {
9825 size_t size;
9826 google_protobuf_FeatureSetDefaults_defaults(msg, &size);
9827 return size != 0;
9828}
9829UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_minimum_edition(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009830 const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009831 _upb_Message_ClearNonExtensionField(msg, &field);
9832}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009833UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) {
9834 int32_t default_val = 0;
9835 int32_t ret;
9836 const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009837 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9838 return ret;
9839}
9840UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009841 const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009842 return _upb_Message_HasNonExtensionField(msg, &field);
9843}
9844UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_maximum_edition(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009845 const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009846 _upb_Message_ClearNonExtensionField(msg, &field);
9847}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009848UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) {
9849 int32_t default_val = 0;
9850 int32_t ret;
9851 const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009852 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9853 return ret;
9854}
9855UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009856 const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009857 return _upb_Message_HasNonExtensionField(msg, &field);
9858}
9859
9860UPB_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 +00009861 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 -07009862 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
9863 if (arr) {
9864 if (size) *size = arr->size;
9865 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)_upb_array_ptr(arr);
9866 } else {
9867 if (size) *size = 0;
9868 return NULL;
9869 }
9870}
9871UPB_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 +00009872 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 -07009873 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
9874}
9875UPB_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 +00009876 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 -07009877 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
9878 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
9879 return NULL;
9880 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009881 struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* sub = (struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, arena);
Mike Kruskalba964702023-08-22 17:37:48 -07009882 if (!arr || !sub) return NULL;
9883 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
9884 return sub;
9885}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009886UPB_INLINE void google_protobuf_FeatureSetDefaults_set_minimum_edition(google_protobuf_FeatureSetDefaults *msg, int32_t value) {
9887 const upb_MiniTableField field = {4, UPB_SIZE(8, 4), 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009888 _upb_Message_SetNonExtensionField(msg, &field, &value);
9889}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009890UPB_INLINE void google_protobuf_FeatureSetDefaults_set_maximum_edition(google_protobuf_FeatureSetDefaults *msg, int32_t value) {
9891 const upb_MiniTableField field = {5, UPB_SIZE(12, 8), 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009892 _upb_Message_SetNonExtensionField(msg, &field, &value);
9893}
9894
9895/* google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault */
9896
9897UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009898 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, arena);
Mike Kruskalba964702023-08-22 17:37:48 -07009899}
9900UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) {
9901 google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena);
9902 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009903 if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskalba964702023-08-22 17:37:48 -07009904 return NULL;
9905 }
9906 return ret;
9907}
9908UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse_ex(const char* buf, size_t size,
9909 const upb_ExtensionRegistry* extreg,
9910 int options, upb_Arena* arena) {
9911 google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena);
9912 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009913 if (upb_Decode(buf, size, ret, &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, extreg, options, arena) !=
Mike Kruskalba964702023-08-22 17:37:48 -07009914 kUpb_DecodeStatus_Ok) {
9915 return NULL;
9916 }
9917 return ret;
9918}
9919UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena, size_t* len) {
9920 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009921 (void)upb_Encode(msg, &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, 0, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -07009922 return ptr;
9923}
9924UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize_ex(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, int options,
9925 upb_Arena* arena, size_t* len) {
9926 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009927 (void)upb_Encode(msg, &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, options, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -07009928 return ptr;
9929}
Mike Kruskalba964702023-08-22 17:37:48 -07009930UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009931 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009932 _upb_Message_ClearNonExtensionField(msg, &field);
9933}
9934UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
9935 const google_protobuf_FeatureSet* default_val = NULL;
9936 const google_protobuf_FeatureSet* ret;
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009937 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009938 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9939 return ret;
9940}
9941UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009942 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009943 return _upb_Message_HasNonExtensionField(msg, &field);
9944}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009945UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
9946 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009947 _upb_Message_ClearNonExtensionField(msg, &field);
9948}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009949UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009950 int32_t default_val = 0;
9951 int32_t ret;
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009952 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009953 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
9954 return ret;
9955}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009956UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
9957 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009958 return _upb_Message_HasNonExtensionField(msg, &field);
9959}
Mike Kruskalba964702023-08-22 17:37:48 -07009960
Mike Kruskalba964702023-08-22 17:37:48 -07009961UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009962 const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Mike Kruskalba964702023-08-22 17:37:48 -07009963 _upb_Message_SetNonExtensionField(msg, &field, &value);
9964}
9965UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) {
9966 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(msg);
9967 if (sub == NULL) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009968 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskalba964702023-08-22 17:37:48 -07009969 if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(msg, sub);
9970 }
9971 return sub;
9972}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009973UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, int32_t value) {
9974 const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009975 _upb_Message_SetNonExtensionField(msg, &field, &value);
9976}
Mike Kruskalba964702023-08-22 17:37:48 -07009977
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009978/* google.protobuf.SourceCodeInfo */
9979
Joshua Habermanf41049a2022-01-21 14:41:25 -08009980UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009981 return (google_protobuf_SourceCodeInfo*)_upb_Message_New(&google__protobuf__SourceCodeInfo_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009982}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009983UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) {
9984 google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009985 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009986 if (upb_Decode(buf, size, ret, &google__protobuf__SourceCodeInfo_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009987 return NULL;
9988 }
9989 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009990}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009991UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse_ex(const char* buf, size_t size,
9992 const upb_ExtensionRegistry* extreg,
9993 int options, upb_Arena* arena) {
9994 google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena);
9995 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +00009996 if (upb_Decode(buf, size, ret, &google__protobuf__SourceCodeInfo_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -08009997 kUpb_DecodeStatus_Ok) {
9998 return NULL;
9999 }
10000 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010001}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010002UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize(const google_protobuf_SourceCodeInfo* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010003 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010004 (void)upb_Encode(msg, &google__protobuf__SourceCodeInfo_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010005 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010006}
10007UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize_ex(const google_protobuf_SourceCodeInfo* msg, int options,
10008 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010009 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010010 (void)upb_Encode(msg, &google__protobuf__SourceCodeInfo_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010011 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010012}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010013UPB_INLINE void google_protobuf_SourceCodeInfo_clear_location(google_protobuf_SourceCodeInfo* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010014 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 -080010015 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010016}
Eric Salob7d54ac2022-12-29 11:59:42 -080010017UPB_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 -070010018 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 -080010019 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10020 if (arr) {
10021 if (size) *size = arr->size;
10022 return (const google_protobuf_SourceCodeInfo_Location* const*)_upb_array_constptr(arr);
10023 } else {
10024 if (size) *size = 0;
10025 return NULL;
10026 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010027}
Deanna Garciab26afb52023-04-25 13:37:18 -070010028UPB_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 -070010029 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 -070010030 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10031 if (size) {
10032 *size = arr ? arr->size : 0;
10033 }
10034 return arr;
10035}
10036UPB_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 -070010037 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 -070010038 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10039 (upb_Message*)msg, &field, arena);
10040 if (size) {
10041 *size = arr ? arr->size : 0;
10042 }
10043 return arr;
10044}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010045UPB_INLINE bool google_protobuf_SourceCodeInfo_has_location(const google_protobuf_SourceCodeInfo* msg) {
10046 size_t size;
10047 google_protobuf_SourceCodeInfo_location(msg, &size);
10048 return size != 0;
10049}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010050
Eric Salob7d54ac2022-12-29 11:59:42 -080010051UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_mutable_location(google_protobuf_SourceCodeInfo* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010052 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 -080010053 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10054 if (arr) {
10055 if (size) *size = arr->size;
10056 return (google_protobuf_SourceCodeInfo_Location**)_upb_array_ptr(arr);
10057 } else {
10058 if (size) *size = 0;
10059 return NULL;
10060 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010061}
Eric Salob7d54ac2022-12-29 11:59:42 -080010062UPB_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 -070010063 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 -070010064 return (google_protobuf_SourceCodeInfo_Location**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010065}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010066UPB_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 -070010067 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 -080010068 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10069 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10070 return NULL;
10071 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010072 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 -080010073 if (!arr || !sub) return NULL;
10074 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010075 return sub;
10076}
10077
10078/* google.protobuf.SourceCodeInfo.Location */
10079
Joshua Habermanf41049a2022-01-21 14:41:25 -080010080UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010081 return (google_protobuf_SourceCodeInfo_Location*)_upb_Message_New(&google__protobuf__SourceCodeInfo__Location_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010082}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010083UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse(const char* buf, size_t size, upb_Arena* arena) {
10084 google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010085 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010086 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 -070010087 return NULL;
10088 }
10089 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010090}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010091UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse_ex(const char* buf, size_t size,
10092 const upb_ExtensionRegistry* extreg,
10093 int options, upb_Arena* arena) {
10094 google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena);
10095 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010096 if (upb_Decode(buf, size, ret, &google__protobuf__SourceCodeInfo__Location_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -080010097 kUpb_DecodeStatus_Ok) {
10098 return NULL;
10099 }
10100 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010101}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010102UPB_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 -070010103 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010104 (void)upb_Encode(msg, &google__protobuf__SourceCodeInfo__Location_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010105 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010106}
10107UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize_ex(const google_protobuf_SourceCodeInfo_Location* msg, int options,
10108 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010109 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010110 (void)upb_Encode(msg, &google__protobuf__SourceCodeInfo__Location_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010111 return ptr;
10112}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010113UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_path(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010114 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 -080010115 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080010116}
Eric Salob7d54ac2022-12-29 11:59:42 -080010117UPB_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 -070010118 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 -080010119 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10120 if (arr) {
10121 if (size) *size = arr->size;
10122 return (int32_t const*)_upb_array_constptr(arr);
10123 } else {
10124 if (size) *size = 0;
10125 return NULL;
10126 }
Joshua Habermand3995ec2022-09-30 16:54:39 -070010127}
Deanna Garciab26afb52023-04-25 13:37:18 -070010128UPB_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 -070010129 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 -070010130 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10131 if (size) {
10132 *size = arr ? arr->size : 0;
10133 }
10134 return arr;
10135}
10136UPB_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 -070010137 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 -070010138 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10139 (upb_Message*)msg, &field, arena);
10140 if (size) {
10141 *size = arr ? arr->size : 0;
10142 }
10143 return arr;
10144}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010145UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_path(const google_protobuf_SourceCodeInfo_Location* msg) {
10146 size_t size;
10147 google_protobuf_SourceCodeInfo_Location_path(msg, &size);
10148 return size != 0;
10149}
10150UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_span(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010151 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 -080010152 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010153}
Eric Salob7d54ac2022-12-29 11:59:42 -080010154UPB_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 -070010155 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 -080010156 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10157 if (arr) {
10158 if (size) *size = arr->size;
10159 return (int32_t const*)_upb_array_constptr(arr);
10160 } else {
10161 if (size) *size = 0;
10162 return NULL;
10163 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010164}
Deanna Garciab26afb52023-04-25 13:37:18 -070010165UPB_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 -070010166 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 -070010167 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10168 if (size) {
10169 *size = arr ? arr->size : 0;
10170 }
10171 return arr;
10172}
10173UPB_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 -070010174 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 -070010175 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10176 (upb_Message*)msg, &field, arena);
10177 if (size) {
10178 *size = arr ? arr->size : 0;
10179 }
10180 return arr;
10181}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010182UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_span(const google_protobuf_SourceCodeInfo_Location* msg) {
10183 size_t size;
10184 google_protobuf_SourceCodeInfo_Location_span(msg, &size);
10185 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010186}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010187UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010188 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 -080010189 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010190}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010191UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010192 upb_StringView default_val = upb_StringView_FromString("");
10193 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -070010194 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 -080010195 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010196 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010197}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010198UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010199 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 -080010200 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010201}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010202UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_trailing_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010203 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 -080010204 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010205}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010206UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010207 upb_StringView default_val = upb_StringView_FromString("");
10208 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -070010209 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 -080010210 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010211 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -070010212}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010213UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010214 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 -080010215 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080010216}
10217UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010218 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 -080010219 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080010220}
Eric Salob7d54ac2022-12-29 11:59:42 -080010221UPB_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 -070010222 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 -080010223 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10224 if (arr) {
10225 if (size) *size = arr->size;
10226 return (upb_StringView const*)_upb_array_constptr(arr);
10227 } else {
10228 if (size) *size = 0;
10229 return NULL;
10230 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010231}
Deanna Garciab26afb52023-04-25 13:37:18 -070010232UPB_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 -070010233 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 -070010234 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10235 if (size) {
10236 *size = arr ? arr->size : 0;
10237 }
10238 return arr;
10239}
10240UPB_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 -070010241 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 -070010242 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10243 (upb_Message*)msg, &field, arena);
10244 if (size) {
10245 *size = arr ? arr->size : 0;
10246 }
10247 return arr;
10248}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010249UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
10250 size_t size;
10251 google_protobuf_SourceCodeInfo_Location_leading_detached_comments(msg, &size);
10252 return size != 0;
10253}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010254
Eric Salob7d54ac2022-12-29 11:59:42 -080010255UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010256 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 -080010257 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10258 if (arr) {
10259 if (size) *size = arr->size;
10260 return (int32_t*)_upb_array_ptr(arr);
10261 } else {
10262 if (size) *size = 0;
10263 return NULL;
10264 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010265}
Eric Salob7d54ac2022-12-29 11:59:42 -080010266UPB_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 -070010267 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 -070010268 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010269}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010270UPB_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 -070010271 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 -080010272 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10273 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10274 return false;
10275 }
10276 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
10277 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010278}
Eric Salob7d54ac2022-12-29 11:59:42 -080010279UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010280 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 -080010281 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10282 if (arr) {
10283 if (size) *size = arr->size;
10284 return (int32_t*)_upb_array_ptr(arr);
10285 } else {
10286 if (size) *size = 0;
10287 return NULL;
10288 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010289}
Eric Salob7d54ac2022-12-29 11:59:42 -080010290UPB_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 -070010291 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 -070010292 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010293}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010294UPB_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 -070010295 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 -080010296 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10297 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10298 return false;
10299 }
10300 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
10301 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010302}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010303UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -070010304 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 -080010305 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010306}
10307UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -070010308 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 -080010309 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010310}
10311UPB_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 -070010312 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 -080010313 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10314 if (arr) {
10315 if (size) *size = arr->size;
10316 return (upb_StringView*)_upb_array_ptr(arr);
10317 } else {
10318 if (size) *size = 0;
10319 return NULL;
10320 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010321}
Eric Salob7d54ac2022-12-29 11:59:42 -080010322UPB_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 -070010323 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 -070010324 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010325}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010326UPB_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 -070010327 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 -080010328 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10329 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10330 return false;
10331 }
10332 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
10333 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010334}
10335
10336/* google.protobuf.GeneratedCodeInfo */
10337
Joshua Habermanf41049a2022-01-21 14:41:25 -080010338UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010339 return (google_protobuf_GeneratedCodeInfo*)_upb_Message_New(&google__protobuf__GeneratedCodeInfo_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010340}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010341UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) {
10342 google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010343 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010344 if (upb_Decode(buf, size, ret, &google__protobuf__GeneratedCodeInfo_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010345 return NULL;
10346 }
10347 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010348}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010349UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse_ex(const char* buf, size_t size,
10350 const upb_ExtensionRegistry* extreg,
10351 int options, upb_Arena* arena) {
10352 google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena);
10353 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010354 if (upb_Decode(buf, size, ret, &google__protobuf__GeneratedCodeInfo_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -080010355 kUpb_DecodeStatus_Ok) {
10356 return NULL;
10357 }
10358 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010359}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010360UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize(const google_protobuf_GeneratedCodeInfo* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010361 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010362 (void)upb_Encode(msg, &google__protobuf__GeneratedCodeInfo_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010363 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010364}
10365UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize_ex(const google_protobuf_GeneratedCodeInfo* msg, int options,
10366 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010367 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010368 (void)upb_Encode(msg, &google__protobuf__GeneratedCodeInfo_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010369 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010370}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010371UPB_INLINE void google_protobuf_GeneratedCodeInfo_clear_annotation(google_protobuf_GeneratedCodeInfo* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010372 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 -080010373 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010374}
Eric Salob7d54ac2022-12-29 11:59:42 -080010375UPB_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 -070010376 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 -080010377 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10378 if (arr) {
10379 if (size) *size = arr->size;
10380 return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)_upb_array_constptr(arr);
10381 } else {
10382 if (size) *size = 0;
10383 return NULL;
10384 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010385}
Deanna Garciab26afb52023-04-25 13:37:18 -070010386UPB_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 -070010387 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 -070010388 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10389 if (size) {
10390 *size = arr ? arr->size : 0;
10391 }
10392 return arr;
10393}
10394UPB_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 -070010395 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 -070010396 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10397 (upb_Message*)msg, &field, arena);
10398 if (size) {
10399 *size = arr ? arr->size : 0;
10400 }
10401 return arr;
10402}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010403UPB_INLINE bool google_protobuf_GeneratedCodeInfo_has_annotation(const google_protobuf_GeneratedCodeInfo* msg) {
10404 size_t size;
10405 google_protobuf_GeneratedCodeInfo_annotation(msg, &size);
10406 return size != 0;
10407}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010408
Eric Salob7d54ac2022-12-29 11:59:42 -080010409UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_mutable_annotation(google_protobuf_GeneratedCodeInfo* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010410 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 -080010411 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10412 if (arr) {
10413 if (size) *size = arr->size;
10414 return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_ptr(arr);
10415 } else {
10416 if (size) *size = 0;
10417 return NULL;
10418 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010419}
Eric Salob7d54ac2022-12-29 11:59:42 -080010420UPB_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 -070010421 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 -070010422 return (google_protobuf_GeneratedCodeInfo_Annotation**)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010423}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010424UPB_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 -070010425 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 -080010426 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10427 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10428 return NULL;
10429 }
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010430 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 -080010431 if (!arr || !sub) return NULL;
10432 _upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010433 return sub;
10434}
10435
10436/* google.protobuf.GeneratedCodeInfo.Annotation */
10437
Joshua Habermanf41049a2022-01-21 14:41:25 -080010438UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_new(upb_Arena* arena) {
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010439 return (google_protobuf_GeneratedCodeInfo_Annotation*)_upb_Message_New(&google__protobuf__GeneratedCodeInfo__Annotation_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010440}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010441UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse(const char* buf, size_t size, upb_Arena* arena) {
10442 google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010443 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010444 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 -070010445 return NULL;
10446 }
10447 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010448}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010449UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse_ex(const char* buf, size_t size,
10450 const upb_ExtensionRegistry* extreg,
10451 int options, upb_Arena* arena) {
10452 google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
10453 if (!ret) return NULL;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010454 if (upb_Decode(buf, size, ret, &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, extreg, options, arena) !=
Joshua Habermanf41049a2022-01-21 14:41:25 -080010455 kUpb_DecodeStatus_Ok) {
10456 return NULL;
10457 }
10458 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010459}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010460UPB_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 -070010461 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010462 (void)upb_Encode(msg, &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010463 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010464}
10465UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize_ex(const google_protobuf_GeneratedCodeInfo_Annotation* msg, int options,
10466 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010467 char* ptr;
Protobuf Team Botd14a3362023-10-07 23:51:34 +000010468 (void)upb_Encode(msg, &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010469 return ptr;
10470}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010471UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_path(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010472 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 -080010473 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080010474}
Eric Salob7d54ac2022-12-29 11:59:42 -080010475UPB_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 -070010476 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 -080010477 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10478 if (arr) {
10479 if (size) *size = arr->size;
10480 return (int32_t const*)_upb_array_constptr(arr);
10481 } else {
10482 if (size) *size = 0;
10483 return NULL;
10484 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010485}
Deanna Garciab26afb52023-04-25 13:37:18 -070010486UPB_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 -070010487 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 -070010488 const upb_Array* arr = upb_Message_GetArray(msg, &field);
10489 if (size) {
10490 *size = arr ? arr->size : 0;
10491 }
10492 return arr;
10493}
10494UPB_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 -070010495 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 -070010496 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10497 (upb_Message*)msg, &field, arena);
10498 if (size) {
10499 *size = arr ? arr->size : 0;
10500 }
10501 return arr;
10502}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010503UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
10504 size_t size;
10505 google_protobuf_GeneratedCodeInfo_Annotation_path(msg, &size);
10506 return size != 0;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010507}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010508UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_source_file(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010509 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 -080010510 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010511}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010512UPB_INLINE upb_StringView google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010513 upb_StringView default_val = upb_StringView_FromString("");
10514 upb_StringView ret;
Jie Luo3560e232023-06-12 00:33:50 -070010515 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 -080010516 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010517 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010518}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010519UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010520 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 -080010521 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010522}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010523UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_begin(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010524 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 -080010525 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010526}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010527UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010528 int32_t default_val = (int32_t)0;
10529 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -070010530 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 -080010531 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010532 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010533}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010534UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010535 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 -080010536 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010537}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010538UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_end(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010539 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 -080010540 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010541}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010542UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010543 int32_t default_val = (int32_t)0;
10544 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -070010545 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 -080010546 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010547 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010548}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010549UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010550 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 -080010551 return _upb_Message_HasNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010552}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010553UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_semantic(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010554 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 -080010555 _upb_Message_ClearNonExtensionField(msg, &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010556}
10557UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010558 int32_t default_val = 0;
10559 int32_t ret;
Jie Luo3560e232023-06-12 00:33:50 -070010560 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 -080010561 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010562 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -070010563}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010564UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Jie Luo3560e232023-06-12 00:33:50 -070010565 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 -080010566 return _upb_Message_HasNonExtensionField(msg, &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080010567}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010568
Eric Salob7d54ac2022-12-29 11:59:42 -080010569UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) {
Jie Luo3560e232023-06-12 00:33:50 -070010570 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 -080010571 upb_Array* arr = upb_Message_GetMutableArray(msg, &field);
10572 if (arr) {
10573 if (size) *size = arr->size;
10574 return (int32_t*)_upb_array_ptr(arr);
10575 } else {
10576 if (size) *size = 0;
10577 return NULL;
10578 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010579}
Eric Salob7d54ac2022-12-29 11:59:42 -080010580UPB_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 -070010581 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 -070010582 return (int32_t*)upb_Message_ResizeArrayUninitialized(msg, &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010583}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010584UPB_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 -070010585 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 -080010586 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena);
10587 if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) {
10588 return false;
10589 }
10590 _upb_Array_Set(arr, arr->size - 1, &val, sizeof(val));
10591 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010592}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010593UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_StringView value) {
Jie Luo3560e232023-06-12 00:33:50 -070010594 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 -080010595 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010596}
10597UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -070010598 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 -080010599 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010600}
10601UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -070010602 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 -080010603 _upb_Message_SetNonExtensionField(msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010604}
10605UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_semantic(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Jie Luo3560e232023-06-12 00:33:50 -070010606 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 -080010607 _upb_Message_SetNonExtensionField(msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010608}
Mike Kruskal232ecf42023-01-14 00:09:40 -080010609
Joshua Habermanf41049a2022-01-21 14:41:25 -080010610/* Max size 32 is google.protobuf.FileOptions */
10611/* Max size 64 is google.protobuf.FileOptions */
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010612#define _UPB_MAXOPT_SIZE UPB_SIZE(112, 200)
Joshua Habermanf41049a2022-01-21 14:41:25 -080010613
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010614#ifdef __cplusplus
10615} /* extern "C" */
10616#endif
10617
10618
10619#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */
Mike Kruskal232ecf42023-01-14 00:09:40 -080010620// end:github_only
Eric Salo8809a112022-11-21 13:01:06 -080010621
Protobuf Team Bot7dabac92023-09-07 18:35:50 +000010622typedef enum {
10623 kUpb_Syntax_Proto2 = 2,
10624 kUpb_Syntax_Proto3 = 3,
10625 kUpb_Syntax_Editions = 99
10626} upb_Syntax;
Eric Salo8809a112022-11-21 13:01:06 -080010627
10628// Forward declarations for circular references.
10629typedef struct upb_DefPool upb_DefPool;
10630typedef struct upb_EnumDef upb_EnumDef;
10631typedef struct upb_EnumReservedRange upb_EnumReservedRange;
10632typedef struct upb_EnumValueDef upb_EnumValueDef;
10633typedef struct upb_ExtensionRange upb_ExtensionRange;
10634typedef struct upb_FieldDef upb_FieldDef;
10635typedef struct upb_FileDef upb_FileDef;
10636typedef struct upb_MessageDef upb_MessageDef;
10637typedef struct upb_MessageReservedRange upb_MessageReservedRange;
10638typedef struct upb_MethodDef upb_MethodDef;
10639typedef struct upb_OneofDef upb_OneofDef;
10640typedef struct upb_ServiceDef upb_ServiceDef;
10641
10642// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
10643
10644typedef struct upb_DefBuilder upb_DefBuilder;
10645
10646#endif /* UPB_REFLECTION_COMMON_H_ */
10647
10648#ifndef UPB_REFLECTION_DEF_TYPE_H_
10649#define UPB_REFLECTION_DEF_TYPE_H_
10650
10651
10652// Must be last.
10653
10654// Inside a symtab we store tagged pointers to specific def types.
10655typedef enum {
10656 UPB_DEFTYPE_MASK = 7,
10657
10658 // Only inside symtab table.
10659 UPB_DEFTYPE_EXT = 0,
10660 UPB_DEFTYPE_MSG = 1,
10661 UPB_DEFTYPE_ENUM = 2,
10662 UPB_DEFTYPE_ENUMVAL = 3,
10663 UPB_DEFTYPE_SERVICE = 4,
10664
10665 // Only inside message table.
10666 UPB_DEFTYPE_FIELD = 0,
10667 UPB_DEFTYPE_ONEOF = 1,
Eric Salo8809a112022-11-21 13:01:06 -080010668} upb_deftype_t;
10669
10670#ifdef __cplusplus
10671extern "C" {
10672#endif
10673
10674// Our 3-bit pointer tagging requires all pointers to be multiples of 8.
10675// The arena will always yield 8-byte-aligned addresses, however we put
10676// the defs into arrays. For each element in the array to be 8-byte-aligned,
10677// the sizes of each def type must also be a multiple of 8.
10678//
10679// If any of these asserts fail, we need to add or remove padding on 32-bit
10680// machines (64-bit machines will have 8-byte alignment already due to
10681// pointers, which all of these structs have).
10682UPB_INLINE void _upb_DefType_CheckPadding(size_t size) {
10683 UPB_ASSERT((size & UPB_DEFTYPE_MASK) == 0);
10684}
10685
10686upb_deftype_t _upb_DefType_Type(upb_value v);
10687
10688upb_value _upb_DefType_Pack(const void* ptr, upb_deftype_t type);
10689
10690const void* _upb_DefType_Unpack(upb_value v, upb_deftype_t type);
10691
10692#ifdef __cplusplus
10693} /* extern "C" */
10694#endif
10695
10696
10697#endif /* UPB_REFLECTION_DEF_TYPE_H_ */
10698
10699// Must be last.
10700
10701#ifdef __cplusplus
10702extern "C" {
10703#endif
10704
Jason Lunn67dee292023-07-13 13:15:26 -070010705UPB_API void upb_DefPool_Free(upb_DefPool* s);
Eric Salo8809a112022-11-21 13:01:06 -080010706
Jason Lunn67dee292023-07-13 13:15:26 -070010707UPB_API upb_DefPool* upb_DefPool_New(void);
Eric Salo8809a112022-11-21 13:01:06 -080010708
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000010709UPB_API const UPB_DESC(FeatureSetDefaults) *
10710 upb_DefPool_FeatureSetDefaults(const upb_DefPool* s);
10711
Protobuf Team Botc6b149c2023-11-10 23:37:46 +000010712UPB_API bool upb_DefPool_SetFeatureSetDefaults(upb_DefPool* s,
10713 const char* serialized_defaults,
10714 size_t serialized_len,
10715 upb_Status* status);
10716
Jason Lunn67dee292023-07-13 13:15:26 -070010717UPB_API const upb_MessageDef* upb_DefPool_FindMessageByName(
10718 const upb_DefPool* s, const char* sym);
Eric Salo8809a112022-11-21 13:01:06 -080010719
10720const upb_MessageDef* upb_DefPool_FindMessageByNameWithSize(
10721 const upb_DefPool* s, const char* sym, size_t len);
10722
Jason Lunn67dee292023-07-13 13:15:26 -070010723UPB_API const upb_EnumDef* upb_DefPool_FindEnumByName(const upb_DefPool* s,
10724 const char* sym);
Eric Salo8809a112022-11-21 13:01:06 -080010725
10726const upb_EnumValueDef* upb_DefPool_FindEnumByNameval(const upb_DefPool* s,
10727 const char* sym);
10728
10729const upb_FileDef* upb_DefPool_FindFileByName(const upb_DefPool* s,
10730 const char* name);
10731
10732const upb_FileDef* upb_DefPool_FindFileByNameWithSize(const upb_DefPool* s,
10733 const char* name,
10734 size_t len);
10735
10736const upb_FieldDef* upb_DefPool_FindExtensionByMiniTable(
10737 const upb_DefPool* s, const upb_MiniTableExtension* ext);
10738
10739const upb_FieldDef* upb_DefPool_FindExtensionByName(const upb_DefPool* s,
10740 const char* sym);
10741
10742const upb_FieldDef* upb_DefPool_FindExtensionByNameWithSize(
10743 const upb_DefPool* s, const char* name, size_t size);
10744
10745const upb_FieldDef* upb_DefPool_FindExtensionByNumber(const upb_DefPool* s,
10746 const upb_MessageDef* m,
10747 int32_t fieldnum);
10748
10749const upb_ServiceDef* upb_DefPool_FindServiceByName(const upb_DefPool* s,
10750 const char* name);
10751
10752const upb_ServiceDef* upb_DefPool_FindServiceByNameWithSize(
10753 const upb_DefPool* s, const char* name, size_t size);
10754
10755const upb_FileDef* upb_DefPool_FindFileContainingSymbol(const upb_DefPool* s,
10756 const char* name);
10757
Jason Lunn67dee292023-07-13 13:15:26 -070010758UPB_API const upb_FileDef* upb_DefPool_AddFile(
10759 upb_DefPool* s, const UPB_DESC(FileDescriptorProto) * file_proto,
10760 upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080010761
10762const upb_ExtensionRegistry* upb_DefPool_ExtensionRegistry(
10763 const upb_DefPool* s);
10764
10765const upb_FieldDef** upb_DefPool_GetAllExtensions(const upb_DefPool* s,
10766 const upb_MessageDef* m,
10767 size_t* count);
10768
10769#ifdef __cplusplus
10770} /* extern "C" */
10771#endif
10772
10773
10774#endif /* UPB_REFLECTION_DEF_POOL_H_ */
10775
Protobuf Team Bot06310352023-09-26 21:54:58 +000010776// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080010777
10778#ifndef UPB_REFLECTION_ENUM_DEF_H_
10779#define UPB_REFLECTION_ENUM_DEF_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -070010780
10781
10782// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010783
10784#ifdef __cplusplus
10785extern "C" {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010786#endif
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010787
Eric Salo8809a112022-11-21 13:01:06 -080010788bool upb_EnumDef_CheckNumber(const upb_EnumDef* e, int32_t num);
10789const upb_MessageDef* upb_EnumDef_ContainingType(const upb_EnumDef* e);
10790int32_t upb_EnumDef_Default(const upb_EnumDef* e);
Jason Lunn67dee292023-07-13 13:15:26 -070010791UPB_API const upb_FileDef* upb_EnumDef_File(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080010792const upb_EnumValueDef* upb_EnumDef_FindValueByName(const upb_EnumDef* e,
10793 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070010794UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080010795 const upb_EnumDef* e, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070010796UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNumber(
10797 const upb_EnumDef* e, int32_t num);
10798UPB_API const char* upb_EnumDef_FullName(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080010799bool upb_EnumDef_HasOptions(const upb_EnumDef* e);
10800bool upb_EnumDef_IsClosed(const upb_EnumDef* e);
10801
10802// Creates a mini descriptor string for an enum, returns true on success.
10803bool upb_EnumDef_MiniDescriptorEncode(const upb_EnumDef* e, upb_Arena* a,
10804 upb_StringView* out);
10805
10806const char* upb_EnumDef_Name(const upb_EnumDef* e);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010807const UPB_DESC(EnumOptions) * upb_EnumDef_Options(const upb_EnumDef* e);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000010808const UPB_DESC(FeatureSet) * upb_EnumDef_ResolvedFeatures(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080010809
10810upb_StringView upb_EnumDef_ReservedName(const upb_EnumDef* e, int i);
10811int upb_EnumDef_ReservedNameCount(const upb_EnumDef* e);
10812
10813const upb_EnumReservedRange* upb_EnumDef_ReservedRange(const upb_EnumDef* e,
10814 int i);
10815int upb_EnumDef_ReservedRangeCount(const upb_EnumDef* e);
10816
Jason Lunn67dee292023-07-13 13:15:26 -070010817UPB_API const upb_EnumValueDef* upb_EnumDef_Value(const upb_EnumDef* e, int i);
10818UPB_API int upb_EnumDef_ValueCount(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080010819
10820#ifdef __cplusplus
10821} /* extern "C" */
10822#endif
10823
10824
10825#endif /* UPB_REFLECTION_ENUM_DEF_H_ */
10826
Protobuf Team Bot06310352023-09-26 21:54:58 +000010827// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080010828
10829#ifndef UPB_REFLECTION_ENUM_VALUE_DEF_H_
10830#define UPB_REFLECTION_ENUM_VALUE_DEF_H_
10831
10832
10833// Must be last.
10834
10835#ifdef __cplusplus
10836extern "C" {
10837#endif
10838
10839const upb_EnumDef* upb_EnumValueDef_Enum(const upb_EnumValueDef* v);
10840const char* upb_EnumValueDef_FullName(const upb_EnumValueDef* v);
10841bool upb_EnumValueDef_HasOptions(const upb_EnumValueDef* v);
10842uint32_t upb_EnumValueDef_Index(const upb_EnumValueDef* v);
Jason Lunn67dee292023-07-13 13:15:26 -070010843UPB_API const char* upb_EnumValueDef_Name(const upb_EnumValueDef* v);
10844UPB_API int32_t upb_EnumValueDef_Number(const upb_EnumValueDef* v);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010845const UPB_DESC(EnumValueOptions) *
10846 upb_EnumValueDef_Options(const upb_EnumValueDef* v);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000010847const UPB_DESC(FeatureSet) *
10848 upb_EnumValueDef_ResolvedFeatures(const upb_EnumValueDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080010849
10850#ifdef __cplusplus
10851} /* extern "C" */
10852#endif
10853
10854
10855#endif /* UPB_REFLECTION_ENUM_VALUE_DEF_H_ */
10856
Protobuf Team Bot06310352023-09-26 21:54:58 +000010857// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080010858
10859#ifndef UPB_REFLECTION_EXTENSION_RANGE_H_
10860#define UPB_REFLECTION_EXTENSION_RANGE_H_
10861
10862
10863// Must be last.
10864
10865#ifdef __cplusplus
10866extern "C" {
10867#endif
10868
10869int32_t upb_ExtensionRange_Start(const upb_ExtensionRange* r);
10870int32_t upb_ExtensionRange_End(const upb_ExtensionRange* r);
10871
10872bool upb_ExtensionRange_HasOptions(const upb_ExtensionRange* r);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010873const UPB_DESC(ExtensionRangeOptions) *
10874 upb_ExtensionRange_Options(const upb_ExtensionRange* r);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000010875const UPB_DESC(FeatureSet) *
10876 upb_ExtensionRange_ResolvedFeatures(const upb_ExtensionRange* e);
Eric Salo8809a112022-11-21 13:01:06 -080010877
10878#ifdef __cplusplus
10879} /* extern "C" */
10880#endif
10881
10882
10883#endif /* UPB_REFLECTION_EXTENSION_RANGE_H_ */
10884
Protobuf Team Bot06310352023-09-26 21:54:58 +000010885// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080010886
10887#ifndef UPB_REFLECTION_FIELD_DEF_H_
10888#define UPB_REFLECTION_FIELD_DEF_H_
10889
10890
10891// Must be last.
10892
10893// Maximum field number allowed for FieldDefs.
10894// This is an inherent limit of the protobuf wire format.
10895#define kUpb_MaxFieldNumber ((1 << 29) - 1)
10896
10897#ifdef __cplusplus
10898extern "C" {
10899#endif
10900
10901const upb_OneofDef* upb_FieldDef_ContainingOneof(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010902UPB_API const upb_MessageDef* upb_FieldDef_ContainingType(
10903 const upb_FieldDef* f);
10904UPB_API upb_CType upb_FieldDef_CType(const upb_FieldDef* f);
10905UPB_API upb_MessageValue upb_FieldDef_Default(const upb_FieldDef* f);
10906UPB_API const upb_EnumDef* upb_FieldDef_EnumSubDef(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010907const upb_MessageDef* upb_FieldDef_ExtensionScope(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010908UPB_API const upb_FileDef* upb_FieldDef_File(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010909const char* upb_FieldDef_FullName(const upb_FieldDef* f);
10910bool upb_FieldDef_HasDefault(const upb_FieldDef* f);
10911bool upb_FieldDef_HasJsonName(const upb_FieldDef* f);
10912bool upb_FieldDef_HasOptions(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010913UPB_API bool upb_FieldDef_HasPresence(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010914bool upb_FieldDef_HasSubDef(const upb_FieldDef* f);
10915uint32_t upb_FieldDef_Index(const upb_FieldDef* f);
10916bool upb_FieldDef_IsExtension(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010917UPB_API bool upb_FieldDef_IsMap(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010918bool upb_FieldDef_IsOptional(const upb_FieldDef* f);
10919bool upb_FieldDef_IsPacked(const upb_FieldDef* f);
10920bool upb_FieldDef_IsPrimitive(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010921UPB_API bool upb_FieldDef_IsRepeated(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010922bool upb_FieldDef_IsRequired(const upb_FieldDef* f);
10923bool upb_FieldDef_IsString(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010924UPB_API bool upb_FieldDef_IsSubMessage(const upb_FieldDef* f);
10925UPB_API const char* upb_FieldDef_JsonName(const upb_FieldDef* f);
10926UPB_API upb_Label upb_FieldDef_Label(const upb_FieldDef* f);
10927UPB_API const upb_MessageDef* upb_FieldDef_MessageSubDef(const upb_FieldDef* f);
Protobuf Team Botb58bd402023-09-19 15:42:34 +000010928bool _upb_FieldDef_ValidateUtf8(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010929
10930// Creates a mini descriptor string for a field, returns true on success.
10931bool upb_FieldDef_MiniDescriptorEncode(const upb_FieldDef* f, upb_Arena* a,
10932 upb_StringView* out);
10933
10934const upb_MiniTableField* upb_FieldDef_MiniTable(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010935UPB_API const char* upb_FieldDef_Name(const upb_FieldDef* f);
10936UPB_API uint32_t upb_FieldDef_Number(const upb_FieldDef* f);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010937const UPB_DESC(FieldOptions) * upb_FieldDef_Options(const upb_FieldDef* f);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000010938const UPB_DESC(FeatureSet) *
10939 upb_FieldDef_ResolvedFeatures(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010940UPB_API const upb_OneofDef* upb_FieldDef_RealContainingOneof(
10941 const upb_FieldDef* f);
10942UPB_API upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010943
10944#ifdef __cplusplus
10945} /* extern "C" */
10946#endif
10947
10948
10949#endif /* UPB_REFLECTION_FIELD_DEF_H_ */
10950
Protobuf Team Bot06310352023-09-26 21:54:58 +000010951// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080010952
10953#ifndef UPB_REFLECTION_FILE_DEF_H_
10954#define UPB_REFLECTION_FILE_DEF_H_
10955
10956
10957// Must be last.
10958
10959#ifdef __cplusplus
10960extern "C" {
10961#endif
10962
Protobuf Team Botc6b149c2023-11-10 23:37:46 +000010963UPB_API const char* upb_FileDef_EditionName(int edition);
10964
Eric Salo8809a112022-11-21 13:01:06 -080010965const upb_FileDef* upb_FileDef_Dependency(const upb_FileDef* f, int i);
10966int upb_FileDef_DependencyCount(const upb_FileDef* f);
10967bool upb_FileDef_HasOptions(const upb_FileDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010968UPB_API const char* upb_FileDef_Name(const upb_FileDef* f);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010969const UPB_DESC(FileOptions) * upb_FileDef_Options(const upb_FileDef* f);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000010970const UPB_DESC(FeatureSet) * upb_FileDef_ResolvedFeatures(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010971const char* upb_FileDef_Package(const upb_FileDef* f);
Protobuf Team Bot7dabac92023-09-07 18:35:50 +000010972UPB_DESC(Edition) upb_FileDef_Edition(const upb_FileDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070010973UPB_API const upb_DefPool* upb_FileDef_Pool(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010974
10975const upb_FileDef* upb_FileDef_PublicDependency(const upb_FileDef* f, int i);
10976int upb_FileDef_PublicDependencyCount(const upb_FileDef* f);
10977
10978const upb_ServiceDef* upb_FileDef_Service(const upb_FileDef* f, int i);
10979int upb_FileDef_ServiceCount(const upb_FileDef* f);
10980
Jason Lunn67dee292023-07-13 13:15:26 -070010981UPB_API upb_Syntax upb_FileDef_Syntax(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080010982
10983const upb_EnumDef* upb_FileDef_TopLevelEnum(const upb_FileDef* f, int i);
10984int upb_FileDef_TopLevelEnumCount(const upb_FileDef* f);
10985
10986const upb_FieldDef* upb_FileDef_TopLevelExtension(const upb_FileDef* f, int i);
10987int upb_FileDef_TopLevelExtensionCount(const upb_FileDef* f);
10988
10989const upb_MessageDef* upb_FileDef_TopLevelMessage(const upb_FileDef* f, int i);
10990int upb_FileDef_TopLevelMessageCount(const upb_FileDef* f);
10991
10992const upb_FileDef* upb_FileDef_WeakDependency(const upb_FileDef* f, int i);
10993int upb_FileDef_WeakDependencyCount(const upb_FileDef* f);
10994
10995#ifdef __cplusplus
10996} /* extern "C" */
10997#endif
10998
10999
11000#endif /* UPB_REFLECTION_FILE_DEF_H_ */
11001
Protobuf Team Bot06310352023-09-26 21:54:58 +000011002// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011003
11004#ifndef UPB_REFLECTION_MESSAGE_DEF_H_
11005#define UPB_REFLECTION_MESSAGE_DEF_H_
11006
11007
11008// Must be last.
11009
11010// Well-known field tag numbers for map-entry messages.
11011#define kUpb_MapEntry_KeyFieldNumber 1
11012#define kUpb_MapEntry_ValueFieldNumber 2
11013
11014// Well-known field tag numbers for Any messages.
11015#define kUpb_Any_TypeFieldNumber 1
11016#define kUpb_Any_ValueFieldNumber 2
11017
11018// Well-known field tag numbers for duration messages.
11019#define kUpb_Duration_SecondsFieldNumber 1
11020#define kUpb_Duration_NanosFieldNumber 2
11021
11022// Well-known field tag numbers for timestamp messages.
11023#define kUpb_Timestamp_SecondsFieldNumber 1
11024#define kUpb_Timestamp_NanosFieldNumber 2
11025
11026// All the different kind of well known type messages. For simplicity of check,
11027// number wrappers and string wrappers are grouped together. Make sure the
11028// order and number of these groups are not changed.
11029typedef enum {
11030 kUpb_WellKnown_Unspecified,
11031 kUpb_WellKnown_Any,
11032 kUpb_WellKnown_FieldMask,
11033 kUpb_WellKnown_Duration,
11034 kUpb_WellKnown_Timestamp,
11035
11036 // number wrappers
11037 kUpb_WellKnown_DoubleValue,
11038 kUpb_WellKnown_FloatValue,
11039 kUpb_WellKnown_Int64Value,
11040 kUpb_WellKnown_UInt64Value,
11041 kUpb_WellKnown_Int32Value,
11042 kUpb_WellKnown_UInt32Value,
11043
11044 // string wrappers
11045 kUpb_WellKnown_StringValue,
11046 kUpb_WellKnown_BytesValue,
11047 kUpb_WellKnown_BoolValue,
11048 kUpb_WellKnown_Value,
11049 kUpb_WellKnown_ListValue,
11050 kUpb_WellKnown_Struct,
11051} upb_WellKnown;
11052
11053#ifdef __cplusplus
11054extern "C" {
11055#endif
11056
11057const upb_MessageDef* upb_MessageDef_ContainingType(const upb_MessageDef* m);
11058
11059const upb_ExtensionRange* upb_MessageDef_ExtensionRange(const upb_MessageDef* m,
11060 int i);
11061int upb_MessageDef_ExtensionRangeCount(const upb_MessageDef* m);
11062
Jason Lunn67dee292023-07-13 13:15:26 -070011063UPB_API const upb_FieldDef* upb_MessageDef_Field(const upb_MessageDef* m,
11064 int i);
11065UPB_API int upb_MessageDef_FieldCount(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011066
Jason Lunn67dee292023-07-13 13:15:26 -070011067UPB_API const upb_FileDef* upb_MessageDef_File(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011068
11069// Returns a field by either JSON name or regular proto name.
11070const upb_FieldDef* upb_MessageDef_FindByJsonNameWithSize(
11071 const upb_MessageDef* m, const char* name, size_t size);
11072UPB_INLINE const upb_FieldDef* upb_MessageDef_FindByJsonName(
11073 const upb_MessageDef* m, const char* name) {
11074 return upb_MessageDef_FindByJsonNameWithSize(m, name, strlen(name));
11075}
11076
11077// Lookup of either field or oneof by name. Returns whether either was found.
11078// If the return is true, then the found def will be set, and the non-found
11079// one set to NULL.
Jason Lunn67dee292023-07-13 13:15:26 -070011080UPB_API bool upb_MessageDef_FindByNameWithSize(const upb_MessageDef* m,
11081 const char* name, size_t size,
11082 const upb_FieldDef** f,
11083 const upb_OneofDef** o);
Eric Salo8809a112022-11-21 13:01:06 -080011084UPB_INLINE bool upb_MessageDef_FindByName(const upb_MessageDef* m,
11085 const char* name,
11086 const upb_FieldDef** f,
11087 const upb_OneofDef** o) {
11088 return upb_MessageDef_FindByNameWithSize(m, name, strlen(name), f, o);
11089}
11090
11091const upb_FieldDef* upb_MessageDef_FindFieldByName(const upb_MessageDef* m,
11092 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070011093UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080011094 const upb_MessageDef* m, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070011095UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNumber(
11096 const upb_MessageDef* m, uint32_t i);
Eric Salo8809a112022-11-21 13:01:06 -080011097const upb_OneofDef* upb_MessageDef_FindOneofByName(const upb_MessageDef* m,
11098 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070011099UPB_API const upb_OneofDef* upb_MessageDef_FindOneofByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080011100 const upb_MessageDef* m, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070011101UPB_API const char* upb_MessageDef_FullName(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011102bool upb_MessageDef_HasOptions(const upb_MessageDef* m);
11103bool upb_MessageDef_IsMapEntry(const upb_MessageDef* m);
11104bool upb_MessageDef_IsMessageSet(const upb_MessageDef* m);
11105
11106// Creates a mini descriptor string for a message, returns true on success.
11107bool upb_MessageDef_MiniDescriptorEncode(const upb_MessageDef* m, upb_Arena* a,
11108 upb_StringView* out);
11109
Jason Lunn67dee292023-07-13 13:15:26 -070011110UPB_API const upb_MiniTable* upb_MessageDef_MiniTable(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011111const char* upb_MessageDef_Name(const upb_MessageDef* m);
11112
11113const upb_EnumDef* upb_MessageDef_NestedEnum(const upb_MessageDef* m, int i);
11114const upb_FieldDef* upb_MessageDef_NestedExtension(const upb_MessageDef* m,
11115 int i);
11116const upb_MessageDef* upb_MessageDef_NestedMessage(const upb_MessageDef* m,
11117 int i);
11118
11119int upb_MessageDef_NestedEnumCount(const upb_MessageDef* m);
11120int upb_MessageDef_NestedExtensionCount(const upb_MessageDef* m);
11121int upb_MessageDef_NestedMessageCount(const upb_MessageDef* m);
11122
Jason Lunn67dee292023-07-13 13:15:26 -070011123UPB_API const upb_OneofDef* upb_MessageDef_Oneof(const upb_MessageDef* m,
11124 int i);
11125UPB_API int upb_MessageDef_OneofCount(const upb_MessageDef* m);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011126int upb_MessageDef_RealOneofCount(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011127
Mike Kruskal232ecf42023-01-14 00:09:40 -080011128const UPB_DESC(MessageOptions) *
11129 upb_MessageDef_Options(const upb_MessageDef* m);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011130const UPB_DESC(FeatureSet) *
11131 upb_MessageDef_ResolvedFeatures(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011132
11133upb_StringView upb_MessageDef_ReservedName(const upb_MessageDef* m, int i);
11134int upb_MessageDef_ReservedNameCount(const upb_MessageDef* m);
11135
11136const upb_MessageReservedRange* upb_MessageDef_ReservedRange(
11137 const upb_MessageDef* m, int i);
11138int upb_MessageDef_ReservedRangeCount(const upb_MessageDef* m);
11139
Jason Lunn67dee292023-07-13 13:15:26 -070011140UPB_API upb_Syntax upb_MessageDef_Syntax(const upb_MessageDef* m);
11141UPB_API upb_WellKnown upb_MessageDef_WellKnownType(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011142
11143#ifdef __cplusplus
11144} /* extern "C" */
11145#endif
11146
11147
11148#endif /* UPB_REFLECTION_MESSAGE_DEF_H_ */
11149
Protobuf Team Bot06310352023-09-26 21:54:58 +000011150// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011151
11152#ifndef UPB_REFLECTION_METHOD_DEF_H_
11153#define UPB_REFLECTION_METHOD_DEF_H_
11154
11155
11156// Must be last.
11157
11158#ifdef __cplusplus
11159extern "C" {
11160#endif
11161
11162bool upb_MethodDef_ClientStreaming(const upb_MethodDef* m);
11163const char* upb_MethodDef_FullName(const upb_MethodDef* m);
11164bool upb_MethodDef_HasOptions(const upb_MethodDef* m);
11165int upb_MethodDef_Index(const upb_MethodDef* m);
11166const upb_MessageDef* upb_MethodDef_InputType(const upb_MethodDef* m);
11167const char* upb_MethodDef_Name(const upb_MethodDef* m);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011168const UPB_DESC(MethodOptions) * upb_MethodDef_Options(const upb_MethodDef* m);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011169const UPB_DESC(FeatureSet) *
11170 upb_MethodDef_ResolvedFeatures(const upb_MethodDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011171const upb_MessageDef* upb_MethodDef_OutputType(const upb_MethodDef* m);
11172bool upb_MethodDef_ServerStreaming(const upb_MethodDef* m);
11173const upb_ServiceDef* upb_MethodDef_Service(const upb_MethodDef* m);
11174
11175#ifdef __cplusplus
11176} /* extern "C" */
11177#endif
11178
11179
11180#endif /* UPB_REFLECTION_METHOD_DEF_H_ */
11181
Protobuf Team Bot06310352023-09-26 21:54:58 +000011182// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011183
11184#ifndef UPB_REFLECTION_ONEOF_DEF_H_
11185#define UPB_REFLECTION_ONEOF_DEF_H_
11186
11187
11188// Must be last.
11189
11190#ifdef __cplusplus
11191extern "C" {
11192#endif
11193
Jason Lunn67dee292023-07-13 13:15:26 -070011194UPB_API const upb_MessageDef* upb_OneofDef_ContainingType(
11195 const upb_OneofDef* o);
11196UPB_API const upb_FieldDef* upb_OneofDef_Field(const upb_OneofDef* o, int i);
11197UPB_API int upb_OneofDef_FieldCount(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011198const char* upb_OneofDef_FullName(const upb_OneofDef* o);
11199bool upb_OneofDef_HasOptions(const upb_OneofDef* o);
11200uint32_t upb_OneofDef_Index(const upb_OneofDef* o);
11201bool upb_OneofDef_IsSynthetic(const upb_OneofDef* o);
11202const upb_FieldDef* upb_OneofDef_LookupName(const upb_OneofDef* o,
11203 const char* name);
11204const upb_FieldDef* upb_OneofDef_LookupNameWithSize(const upb_OneofDef* o,
11205 const char* name,
11206 size_t size);
11207const upb_FieldDef* upb_OneofDef_LookupNumber(const upb_OneofDef* o,
11208 uint32_t num);
Jason Lunn67dee292023-07-13 13:15:26 -070011209UPB_API const char* upb_OneofDef_Name(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011210int upb_OneofDef_numfields(const upb_OneofDef* o);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011211const UPB_DESC(OneofOptions*) upb_OneofDef_Options(const upb_OneofDef* o);
11212const UPB_DESC(FeatureSet*)
11213 upb_OneofDef_ResolvedFeatures(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011214
11215#ifdef __cplusplus
11216} /* extern "C" */
11217#endif
11218
11219
11220#endif /* UPB_REFLECTION_ONEOF_DEF_H_ */
11221
Protobuf Team Bot06310352023-09-26 21:54:58 +000011222// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011223
11224#ifndef UPB_REFLECTION_SERVICE_DEF_H_
11225#define UPB_REFLECTION_SERVICE_DEF_H_
11226
11227
11228// Must be last.
11229
11230#ifdef __cplusplus
11231extern "C" {
11232#endif
11233
11234const upb_FileDef* upb_ServiceDef_File(const upb_ServiceDef* s);
11235const upb_MethodDef* upb_ServiceDef_FindMethodByName(const upb_ServiceDef* s,
11236 const char* name);
11237const char* upb_ServiceDef_FullName(const upb_ServiceDef* s);
11238bool upb_ServiceDef_HasOptions(const upb_ServiceDef* s);
11239int upb_ServiceDef_Index(const upb_ServiceDef* s);
11240const upb_MethodDef* upb_ServiceDef_Method(const upb_ServiceDef* s, int i);
11241int upb_ServiceDef_MethodCount(const upb_ServiceDef* s);
11242const char* upb_ServiceDef_Name(const upb_ServiceDef* s);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011243const UPB_DESC(ServiceOptions) *
11244 upb_ServiceDef_Options(const upb_ServiceDef* s);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011245const UPB_DESC(FeatureSet) *
11246 upb_ServiceDef_ResolvedFeatures(const upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080011247
11248#ifdef __cplusplus
11249} /* extern "C" */
11250#endif
11251
11252
11253#endif /* UPB_REFLECTION_SERVICE_DEF_H_ */
Protobuf Team Botffc56ba2023-09-08 15:29:06 +000011254// IWYU pragma: end_exports
Eric Salo8809a112022-11-21 13:01:06 -080011255
11256#endif /* UPB_REFLECTION_DEF_H_ */
11257
11258// Must be last.
11259
11260#ifdef __cplusplus
11261extern "C" {
11262#endif
11263
11264enum { upb_JsonDecode_IgnoreUnknown = 1 };
11265
Jason Lunn67dee292023-07-13 13:15:26 -070011266UPB_API bool upb_JsonDecode(const char* buf, size_t size, upb_Message* msg,
11267 const upb_MessageDef* m, const upb_DefPool* symtab,
11268 int options, upb_Arena* arena, upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080011269
11270#ifdef __cplusplus
11271} /* extern "C" */
11272#endif
11273
11274
11275#endif /* UPB_JSONDECODE_H_ */
11276
11277#ifndef UPB_LEX_ATOI_H_
11278#define UPB_LEX_ATOI_H_
11279
Adam Cozzette7d5592e2023-08-23 12:15:26 -070011280#include <stdint.h>
11281
Eric Salo8809a112022-11-21 13:01:06 -080011282// Must be last.
11283
11284#ifdef __cplusplus
11285extern "C" {
11286#endif
11287
11288// We use these hand-written routines instead of strto[u]l() because the "long
11289// long" variants aren't in c89. Also our version allows setting a ptr limit.
11290// Return the new position of the pointer after parsing the int, or NULL on
11291// integer overflow.
11292
11293const char* upb_BufToUint64(const char* ptr, const char* end, uint64_t* val);
11294const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val,
11295 bool* is_neg);
11296
11297#ifdef __cplusplus
11298} /* extern "C" */
11299#endif
11300
11301
11302#endif /* UPB_LEX_ATOI_H_ */
11303
11304#ifndef UPB_LEX_UNICODE_H_
11305#define UPB_LEX_UNICODE_H_
11306
Adam Cozzette7d5592e2023-08-23 12:15:26 -070011307#include <stdint.h>
11308
Eric Salo8809a112022-11-21 13:01:06 -080011309// Must be last.
11310
11311#ifdef __cplusplus
11312extern "C" {
11313#endif
11314
11315// Returns true iff a codepoint is the value for a high surrogate.
11316UPB_INLINE bool upb_Unicode_IsHigh(uint32_t cp) {
11317 return (cp >= 0xd800 && cp <= 0xdbff);
11318}
11319
11320// Returns true iff a codepoint is the value for a low surrogate.
11321UPB_INLINE bool upb_Unicode_IsLow(uint32_t cp) {
11322 return (cp >= 0xdc00 && cp <= 0xdfff);
11323}
11324
11325// Returns the high 16-bit surrogate value for a supplementary codepoint.
11326// Does not sanity-check the input.
11327UPB_INLINE uint16_t upb_Unicode_ToHigh(uint32_t cp) {
11328 return (cp >> 10) + 0xd7c0;
11329}
11330
11331// Returns the low 16-bit surrogate value for a supplementary codepoint.
11332// Does not sanity-check the input.
11333UPB_INLINE uint16_t upb_Unicode_ToLow(uint32_t cp) {
11334 return (cp & 0x3ff) | 0xdc00;
11335}
11336
11337// Returns the 32-bit value corresponding to a pair of 16-bit surrogates.
11338// Does not sanity-check the input.
11339UPB_INLINE uint32_t upb_Unicode_FromPair(uint32_t high, uint32_t low) {
11340 return ((high & 0x3ff) << 10) + (low & 0x3ff) + 0x10000;
11341}
11342
11343// Outputs a codepoint as UTF8.
11344// Returns the number of bytes written (1-4 on success, 0 on error).
11345// Does not sanity-check the input. Specifically does not check for surrogates.
11346int upb_Unicode_ToUTF8(uint32_t cp, char* out);
11347
11348#ifdef __cplusplus
11349} /* extern "C" */
11350#endif
11351
11352
11353#endif /* UPB_LEX_UNICODE_H_ */
11354
11355#ifndef UPB_REFLECTION_MESSAGE_H_
11356#define UPB_REFLECTION_MESSAGE_H_
11357
Protobuf Team Bot473d20d2023-09-15 22:27:16 +000011358#include <stddef.h>
11359
Eric Salo8809a112022-11-21 13:01:06 -080011360
11361// Must be last.
11362
11363#ifdef __cplusplus
11364extern "C" {
11365#endif
11366
Eric Salo3f36a912022-12-05 14:12:25 -080011367// Returns a mutable pointer to a map, array, or submessage value. If the given
11368// arena is non-NULL this will construct a new object if it was not previously
11369// present. May not be called for primitive fields.
Jason Lunn67dee292023-07-13 13:15:26 -070011370UPB_API upb_MutableMessageValue upb_Message_Mutable(upb_Message* msg,
11371 const upb_FieldDef* f,
11372 upb_Arena* a);
Eric Salo8809a112022-11-21 13:01:06 -080011373
Eric Salo3f36a912022-12-05 14:12:25 -080011374// Returns the field that is set in the oneof, or NULL if none are set.
Jason Lunn67dee292023-07-13 13:15:26 -070011375UPB_API const upb_FieldDef* upb_Message_WhichOneof(const upb_Message* msg,
11376 const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011377
Eric Salo3f36a912022-12-05 14:12:25 -080011378// Clear all data and unknown fields.
11379void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011380
Eric Salo3f36a912022-12-05 14:12:25 -080011381// Clears any field presence and sets the value back to its default.
Jason Lunn67dee292023-07-13 13:15:26 -070011382UPB_API void upb_Message_ClearFieldByDef(upb_Message* msg,
11383 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011384
Eric Salo3f36a912022-12-05 14:12:25 -080011385// May only be called for fields where upb_FieldDef_HasPresence(f) == true.
Jason Lunn67dee292023-07-13 13:15:26 -070011386UPB_API bool upb_Message_HasFieldByDef(const upb_Message* msg,
11387 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011388
Eric Salo3f36a912022-12-05 14:12:25 -080011389// Returns the value in the message associated with this field def.
Jason Lunn67dee292023-07-13 13:15:26 -070011390UPB_API upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg,
11391 const upb_FieldDef* f);
Eric Salo3f36a912022-12-05 14:12:25 -080011392
11393// Sets the given field to the given value. For a msg/array/map/string, the
11394// caller must ensure that the target data outlives |msg| (by living either in
11395// the same arena or a different arena that outlives it).
11396//
11397// Returns false if allocation fails.
Jason Lunn67dee292023-07-13 13:15:26 -070011398UPB_API bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f,
11399 upb_MessageValue val, upb_Arena* a);
Eric Salo3f36a912022-12-05 14:12:25 -080011400
11401// Iterate over present fields.
11402//
11403// size_t iter = kUpb_Message_Begin;
11404// const upb_FieldDef *f;
11405// upb_MessageValue val;
11406// while (upb_Message_Next(msg, m, ext_pool, &f, &val, &iter)) {
11407// process_field(f, val);
11408// }
11409//
11410// If ext_pool is NULL, no extensions will be returned. If the given symtab
11411// returns extensions that don't match what is in this message, those extensions
11412// will be skipped.
Eric Salo8809a112022-11-21 13:01:06 -080011413
11414#define kUpb_Message_Begin -1
Eric Salo3f36a912022-12-05 14:12:25 -080011415
Eric Salo8809a112022-11-21 13:01:06 -080011416bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m,
11417 const upb_DefPool* ext_pool, const upb_FieldDef** f,
11418 upb_MessageValue* val, size_t* iter);
11419
Eric Salo3f36a912022-12-05 14:12:25 -080011420// Clears all unknown field data from this message and all submessages.
Jason Lunn67dee292023-07-13 13:15:26 -070011421UPB_API bool upb_Message_DiscardUnknown(upb_Message* msg,
11422 const upb_MessageDef* m, int maxdepth);
Eric Salo8809a112022-11-21 13:01:06 -080011423
11424#ifdef __cplusplus
11425} /* extern "C" */
11426#endif
11427
11428
11429#endif /* UPB_REFLECTION_MESSAGE_H_ */
11430
11431#ifndef UPB_JSON_ENCODE_H_
11432#define UPB_JSON_ENCODE_H_
11433
11434
11435// Must be last.
11436
11437#ifdef __cplusplus
11438extern "C" {
11439#endif
11440
11441enum {
Protobuf Team Bot986cbb62023-09-19 15:03:51 +000011442 /* When set, emits 0/default values. TODO: proto3 only? */
Eric Salo8809a112022-11-21 13:01:06 -080011443 upb_JsonEncode_EmitDefaults = 1 << 0,
11444
11445 /* When set, use normal (snake_case) field names instead of JSON (camelCase)
11446 names. */
11447 upb_JsonEncode_UseProtoNames = 1 << 1,
11448
11449 /* When set, emits enums as their integer values instead of as their names. */
11450 upb_JsonEncode_FormatEnumsAsIntegers = 1 << 2
11451};
11452
11453/* Encodes the given |msg| to JSON format. The message's reflection is given in
Protobuf Team Botad884532023-09-05 18:31:02 +000011454 * |m|. The DefPool in |ext_pool| is used to find extensions (if NULL,
11455 * extensions will not be printed).
Eric Salo8809a112022-11-21 13:01:06 -080011456 *
11457 * Output is placed in the given buffer, and always NULL-terminated. The output
11458 * size (excluding NULL) is returned. This means that a return value >= |size|
11459 * implies that the output was truncated. (These are the same semantics as
11460 * snprintf()). */
Jason Lunn67dee292023-07-13 13:15:26 -070011461UPB_API size_t upb_JsonEncode(const upb_Message* msg, const upb_MessageDef* m,
11462 const upb_DefPool* ext_pool, int options,
11463 char* buf, size_t size, upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080011464
11465#ifdef __cplusplus
11466} /* extern "C" */
11467#endif
11468
11469
11470#endif /* UPB_JSONENCODE_H_ */
11471
11472#ifndef UPB_LEX_ROUND_TRIP_H_
11473#define UPB_LEX_ROUND_TRIP_H_
11474
11475// Must be last.
11476
11477// Encodes a float or double that is round-trippable, but as short as possible.
11478// These routines are not fully optimal (not guaranteed to be shortest), but are
11479// short-ish and match the implementation that has been used in protobuf since
11480// the beginning.
11481
11482// The given buffer size must be at least kUpb_RoundTripBufferSize.
11483enum { kUpb_RoundTripBufferSize = 32 };
11484
11485#ifdef __cplusplus
11486extern "C" {
11487#endif
11488
11489void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size);
11490void _upb_EncodeRoundTripFloat(float val, char* buf, size_t size);
11491
11492#ifdef __cplusplus
11493} /* extern "C" */
11494#endif
11495
11496
11497#endif /* UPB_LEX_ROUND_TRIP_H_ */
11498
11499#ifndef UPB_PORT_VSNPRINTF_COMPAT_H_
11500#define UPB_PORT_VSNPRINTF_COMPAT_H_
11501
11502// Must be last.
11503
11504UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt,
11505 va_list ap) {
11506#if defined(__MINGW64__) || defined(__MINGW32__) || defined(_MSC_VER)
11507 // The msvc runtime has a non-conforming vsnprintf() that requires the
11508 // following compatibility code to become conformant.
11509 int n = -1;
11510 if (size != 0) n = _vsnprintf_s(buf, size, _TRUNCATE, fmt, ap);
11511 if (n == -1) n = _vscprintf(fmt, ap);
11512 return n;
11513#else
11514 return vsnprintf(buf, size, fmt, ap);
11515#endif
11516}
11517
11518
11519#endif // UPB_PORT_VSNPRINTF_COMPAT_H_
11520
11521#ifndef UPB_LEX_STRTOD_H_
11522#define UPB_LEX_STRTOD_H_
11523
11524// Must be last.
11525
11526#ifdef __cplusplus
11527extern "C" {
11528#endif
11529
11530double _upb_NoLocaleStrtod(const char *str, char **endptr);
11531
11532#ifdef __cplusplus
11533} /* extern "C" */
11534#endif
11535
11536
11537#endif /* UPB_LEX_STRTOD_H_ */
11538
Sandy Zhange3b09432023-08-07 09:30:02 -070011539#ifndef UPB_MEM_INTERNAL_ARENA_H_
11540#define UPB_MEM_INTERNAL_ARENA_H_
Eric Salo8809a112022-11-21 13:01:06 -080011541
11542
11543// Must be last.
11544
11545typedef struct _upb_MemBlock _upb_MemBlock;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011546
11547struct upb_Arena {
11548 _upb_ArenaHead head;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011549
Deanna Garciac7d979d2023-04-14 17:22:13 -070011550 // upb_alloc* together with a low bit which signals if there is an initial
11551 // block.
11552 uintptr_t block_alloc;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011553
Deanna Garciac7d979d2023-04-14 17:22:13 -070011554 // When multiple arenas are fused together, each arena points to a parent
11555 // arena (root points to itself). The root tracks how many live arenas
11556 // reference it.
Joshua Habermand3995ec2022-09-30 16:54:39 -070011557
Deanna Garciac7d979d2023-04-14 17:22:13 -070011558 // The low bit is tagged:
11559 // 0: pointer to parent
11560 // 1: count, left shifted by one
11561 UPB_ATOMIC(uintptr_t) parent_or_count;
11562
11563 // All nodes that are fused together are in a singly-linked list.
11564 UPB_ATOMIC(upb_Arena*) next; // NULL at end of list.
11565
11566 // The last element of the linked list. This is present only as an
11567 // optimization, so that we do not have to iterate over all members for every
11568 // fuse. Only significant for an arena root. In other cases it is ignored.
11569 UPB_ATOMIC(upb_Arena*) tail; // == self when no other list members.
11570
11571 // Linked list of blocks to free/cleanup. Atomic only for the benefit of
11572 // upb_Arena_SpaceAllocated().
11573 UPB_ATOMIC(_upb_MemBlock*) blocks;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011574};
11575
Eric Salodfb71552023-03-22 12:35:09 -070011576UPB_INLINE bool _upb_Arena_IsTaggedRefcount(uintptr_t parent_or_count) {
11577 return (parent_or_count & 1) == 1;
11578}
Eric Salo8809a112022-11-21 13:01:06 -080011579
Eric Salodfb71552023-03-22 12:35:09 -070011580UPB_INLINE bool _upb_Arena_IsTaggedPointer(uintptr_t parent_or_count) {
11581 return (parent_or_count & 1) == 0;
11582}
11583
Deanna Garciac7d979d2023-04-14 17:22:13 -070011584UPB_INLINE uintptr_t _upb_Arena_RefCountFromTagged(uintptr_t parent_or_count) {
Eric Salodfb71552023-03-22 12:35:09 -070011585 UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count));
11586 return parent_or_count >> 1;
11587}
11588
Deanna Garciac7d979d2023-04-14 17:22:13 -070011589UPB_INLINE uintptr_t _upb_Arena_TaggedFromRefcount(uintptr_t refcount) {
11590 uintptr_t parent_or_count = (refcount << 1) | 1;
Eric Salodfb71552023-03-22 12:35:09 -070011591 UPB_ASSERT(_upb_Arena_IsTaggedRefcount(parent_or_count));
11592 return parent_or_count;
11593}
11594
11595UPB_INLINE upb_Arena* _upb_Arena_PointerFromTagged(uintptr_t parent_or_count) {
11596 UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count));
11597 return (upb_Arena*)parent_or_count;
11598}
11599
11600UPB_INLINE uintptr_t _upb_Arena_TaggedFromPointer(upb_Arena* a) {
11601 uintptr_t parent_or_count = (uintptr_t)a;
11602 UPB_ASSERT(_upb_Arena_IsTaggedPointer(parent_or_count));
11603 return parent_or_count;
11604}
Joshua Habermand3995ec2022-09-30 16:54:39 -070011605
Deanna Garciac7d979d2023-04-14 17:22:13 -070011606UPB_INLINE upb_alloc* upb_Arena_BlockAlloc(upb_Arena* arena) {
11607 return (upb_alloc*)(arena->block_alloc & ~0x1);
11608}
11609
11610UPB_INLINE uintptr_t upb_Arena_MakeBlockAlloc(upb_alloc* alloc,
11611 bool has_initial) {
11612 uintptr_t alloc_uint = (uintptr_t)alloc;
11613 UPB_ASSERT((alloc_uint & 1) == 0);
11614 return alloc_uint | (has_initial ? 1 : 0);
11615}
11616
11617UPB_INLINE bool upb_Arena_HasInitialBlock(upb_Arena* arena) {
11618 return arena->block_alloc & 0x1;
11619}
11620
Joshua Habermand3995ec2022-09-30 16:54:39 -070011621
Sandy Zhange3b09432023-08-07 09:30:02 -070011622#endif /* UPB_MEM_INTERNAL_ARENA_H_ */
Eric Salo8809a112022-11-21 13:01:06 -080011623
Eric Salodfb71552023-03-22 12:35:09 -070011624#ifndef UPB_PORT_ATOMIC_H_
11625#define UPB_PORT_ATOMIC_H_
11626
11627
11628#ifdef UPB_USE_C11_ATOMICS
11629
Protobuf Team Bot743bf922023-09-14 01:12:11 +000011630// IWYU pragma: begin_exports
Eric Salodfb71552023-03-22 12:35:09 -070011631#include <stdatomic.h>
11632#include <stdbool.h>
Protobuf Team Bot743bf922023-09-14 01:12:11 +000011633// IWYU pragma: end_exports
Eric Salodfb71552023-03-22 12:35:09 -070011634
Deanna Garciac7d979d2023-04-14 17:22:13 -070011635#define upb_Atomic_Init(addr, val) atomic_init(addr, val)
11636#define upb_Atomic_Load(addr, order) atomic_load_explicit(addr, order)
11637#define upb_Atomic_Store(addr, val, order) \
11638 atomic_store_explicit(addr, val, order)
11639#define upb_Atomic_Add(addr, val, order) \
11640 atomic_fetch_add_explicit(addr, val, order)
11641#define upb_Atomic_Sub(addr, val, order) \
Deanna Garciabd6a0cf2023-04-20 10:30:44 -070011642 atomic_fetch_sub_explicit(addr, val, order)
11643#define upb_Atomic_Exchange(addr, val, order) \
11644 atomic_exchange_explicit(addr, val, order)
Deanna Garciac7d979d2023-04-14 17:22:13 -070011645#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \
11646 success_order, failure_order) \
11647 atomic_compare_exchange_strong_explicit(addr, expected, desired, \
11648 success_order, failure_order)
11649#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \
11650 failure_order) \
11651 atomic_compare_exchange_weak_explicit(addr, expected, desired, \
11652 success_order, failure_order)
Eric Salodfb71552023-03-22 12:35:09 -070011653
11654#else // !UPB_USE_C11_ATOMICS
11655
Deanna Garciac7d979d2023-04-14 17:22:13 -070011656#include <string.h>
Eric Salodfb71552023-03-22 12:35:09 -070011657
Deanna Garciac7d979d2023-04-14 17:22:13 -070011658#define upb_Atomic_Init(addr, val) (*addr = val)
11659#define upb_Atomic_Load(addr, order) (*addr)
11660#define upb_Atomic_Store(addr, val, order) (*(addr) = val)
11661#define upb_Atomic_Add(addr, val, order) (*(addr) += val)
11662#define upb_Atomic_Sub(addr, val, order) (*(addr) -= val)
Eric Salodfb71552023-03-22 12:35:09 -070011663
Deanna Garciabd6a0cf2023-04-20 10:30:44 -070011664UPB_INLINE void* _upb_NonAtomic_Exchange(void* addr, void* value) {
11665 void* old;
11666 memcpy(&old, addr, sizeof(value));
11667 memcpy(addr, &value, sizeof(value));
11668 return old;
11669}
11670
11671#define upb_Atomic_Exchange(addr, val, order) _upb_NonAtomic_Exchange(addr, val)
11672
Deanna Garciac7d979d2023-04-14 17:22:13 -070011673// `addr` and `expected` are logically double pointers.
11674UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr,
11675 void* expected,
11676 void* desired) {
11677 if (memcmp(addr, expected, sizeof(desired)) == 0) {
11678 memcpy(addr, &desired, sizeof(desired));
Eric Salodfb71552023-03-22 12:35:09 -070011679 return true;
11680 } else {
Deanna Garciac7d979d2023-04-14 17:22:13 -070011681 memcpy(expected, addr, sizeof(desired));
Eric Salodfb71552023-03-22 12:35:09 -070011682 return false;
11683 }
11684}
11685
Deanna Garciac7d979d2023-04-14 17:22:13 -070011686#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \
11687 success_order, failure_order) \
11688 _upb_NonAtomic_CompareExchangeStrongP((void*)addr, (void*)expected, \
11689 (void*)desired)
11690#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \
11691 failure_order) \
11692 upb_Atomic_CompareExchangeStrong(addr, expected, desired, 0, 0)
11693
Eric Salodfb71552023-03-22 12:35:09 -070011694#endif
11695
11696
11697#endif // UPB_PORT_ATOMIC_H_
11698
Eric Salob7d54ac2022-12-29 11:59:42 -080011699#ifndef UPB_WIRE_READER_H_
11700#define UPB_WIRE_READER_H_
11701
11702
Sandy Zhange3b09432023-08-07 09:30:02 -070011703#ifndef UPB_WIRE_INTERNAL_SWAP_H_
11704#define UPB_WIRE_INTERNAL_SWAP_H_
Eric Salob7d54ac2022-12-29 11:59:42 -080011705
Adam Cozzette7d5592e2023-08-23 12:15:26 -070011706#include <stdint.h>
11707
Eric Salob7d54ac2022-12-29 11:59:42 -080011708// Must be last.
11709
11710#ifdef __cplusplus
11711extern "C" {
11712#endif
11713
11714UPB_INLINE bool _upb_IsLittleEndian(void) {
11715 int x = 1;
11716 return *(char*)&x == 1;
11717}
11718
11719UPB_INLINE uint32_t _upb_BigEndian_Swap32(uint32_t val) {
11720 if (_upb_IsLittleEndian()) return val;
11721
11722 return ((val & 0xff) << 24) | ((val & 0xff00) << 8) |
11723 ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24);
11724}
11725
11726UPB_INLINE uint64_t _upb_BigEndian_Swap64(uint64_t val) {
11727 if (_upb_IsLittleEndian()) return val;
11728
11729 return ((uint64_t)_upb_BigEndian_Swap32((uint32_t)val) << 32) |
11730 _upb_BigEndian_Swap32((uint32_t)(val >> 32));
11731}
11732
11733#ifdef __cplusplus
11734} /* extern "C" */
11735#endif
11736
11737
Sandy Zhange3b09432023-08-07 09:30:02 -070011738#endif /* UPB_WIRE_INTERNAL_SWAP_H_ */
Eric Salob7d54ac2022-12-29 11:59:42 -080011739
Protobuf Team Bot743bf922023-09-14 01:12:11 +000011740#ifndef UPB_WIRE_TYPES_H_
11741#define UPB_WIRE_TYPES_H_
11742
11743// A list of types as they are encoded on the wire.
11744typedef enum {
11745 kUpb_WireType_Varint = 0,
11746 kUpb_WireType_64Bit = 1,
11747 kUpb_WireType_Delimited = 2,
11748 kUpb_WireType_StartGroup = 3,
11749 kUpb_WireType_EndGroup = 4,
11750 kUpb_WireType_32Bit = 5
11751} upb_WireType;
11752
11753#endif /* UPB_WIRE_TYPES_H_ */
11754
Eric Salob7d54ac2022-12-29 11:59:42 -080011755// Must be last.
11756
11757#ifdef __cplusplus
11758extern "C" {
11759#endif
11760
11761// The upb_WireReader interface is suitable for general-purpose parsing of
11762// protobuf binary wire format. It is designed to be used along with
11763// upb_EpsCopyInputStream for buffering, and all parsing routines in this file
11764// assume that at least kUpb_EpsCopyInputStream_SlopBytes worth of data is
11765// available to read without any bounds checks.
11766
11767#define kUpb_WireReader_WireTypeMask 7
11768#define kUpb_WireReader_WireTypeBits 3
11769
11770typedef struct {
11771 const char* ptr;
11772 uint64_t val;
11773} _upb_WireReader_ReadLongVarintRet;
11774
11775_upb_WireReader_ReadLongVarintRet _upb_WireReader_ReadLongVarint(
11776 const char* ptr, uint64_t val);
11777
11778static UPB_FORCEINLINE const char* _upb_WireReader_ReadVarint(const char* ptr,
11779 uint64_t* val,
11780 int maxlen,
11781 uint64_t maxval) {
11782 uint64_t byte = (uint8_t)*ptr;
11783 if (UPB_LIKELY((byte & 0x80) == 0)) {
11784 *val = (uint32_t)byte;
11785 return ptr + 1;
11786 }
11787 const char* start = ptr;
11788 _upb_WireReader_ReadLongVarintRet res =
11789 _upb_WireReader_ReadLongVarint(ptr, byte);
11790 if (!res.ptr || (maxlen < 10 && res.ptr - start > maxlen) ||
11791 res.val > maxval) {
11792 return NULL; // Malformed.
11793 }
11794 *val = res.val;
11795 return res.ptr;
11796}
11797
11798// Parses a tag into `tag`, and returns a pointer past the end of the tag, or
11799// NULL if there was an error in the tag data.
11800//
11801// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
11802// Bounds checks must be performed before calling this function, preferably
11803// by calling upb_EpsCopyInputStream_IsDone().
11804static UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr,
11805 uint32_t* tag) {
11806 uint64_t val;
11807 ptr = _upb_WireReader_ReadVarint(ptr, &val, 5, UINT32_MAX);
11808 if (!ptr) return NULL;
11809 *tag = val;
11810 return ptr;
11811}
11812
11813// Given a tag, returns the field number.
11814UPB_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag) {
11815 return tag >> kUpb_WireReader_WireTypeBits;
11816}
11817
11818// Given a tag, returns the wire type.
11819UPB_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag) {
11820 return tag & kUpb_WireReader_WireTypeMask;
11821}
11822
11823UPB_INLINE const char* upb_WireReader_ReadVarint(const char* ptr,
11824 uint64_t* val) {
11825 return _upb_WireReader_ReadVarint(ptr, val, 10, UINT64_MAX);
11826}
11827
11828// Skips data for a varint, returning a pointer past the end of the varint, or
11829// NULL if there was an error in the varint data.
11830//
11831// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
11832// Bounds checks must be performed before calling this function, preferably
11833// by calling upb_EpsCopyInputStream_IsDone().
11834UPB_INLINE const char* upb_WireReader_SkipVarint(const char* ptr) {
11835 uint64_t val;
11836 return upb_WireReader_ReadVarint(ptr, &val);
11837}
11838
11839// Reads a varint indicating the size of a delimited field into `size`, or
11840// NULL if there was an error in the varint data.
11841//
11842// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
11843// Bounds checks must be performed before calling this function, preferably
11844// by calling upb_EpsCopyInputStream_IsDone().
11845UPB_INLINE const char* upb_WireReader_ReadSize(const char* ptr, int* size) {
11846 uint64_t size64;
11847 ptr = upb_WireReader_ReadVarint(ptr, &size64);
11848 if (!ptr || size64 >= INT32_MAX) return NULL;
11849 *size = size64;
11850 return ptr;
11851}
11852
11853// Reads a fixed32 field, performing byte swapping if necessary.
11854//
11855// REQUIRES: there must be at least 4 bytes of data available at `ptr`.
11856// Bounds checks must be performed before calling this function, preferably
11857// by calling upb_EpsCopyInputStream_IsDone().
11858UPB_INLINE const char* upb_WireReader_ReadFixed32(const char* ptr, void* val) {
11859 uint32_t uval;
11860 memcpy(&uval, ptr, 4);
11861 uval = _upb_BigEndian_Swap32(uval);
11862 memcpy(val, &uval, 4);
11863 return ptr + 4;
11864}
11865
11866// Reads a fixed64 field, performing byte swapping if necessary.
11867//
11868// REQUIRES: there must be at least 4 bytes of data available at `ptr`.
11869// Bounds checks must be performed before calling this function, preferably
11870// by calling upb_EpsCopyInputStream_IsDone().
11871UPB_INLINE const char* upb_WireReader_ReadFixed64(const char* ptr, void* val) {
11872 uint64_t uval;
11873 memcpy(&uval, ptr, 8);
11874 uval = _upb_BigEndian_Swap64(uval);
11875 memcpy(val, &uval, 8);
11876 return ptr + 8;
11877}
11878
Mike Kruskal232ecf42023-01-14 00:09:40 -080011879const char* _upb_WireReader_SkipGroup(const char* ptr, uint32_t tag,
11880 int depth_limit,
11881 upb_EpsCopyInputStream* stream);
11882
Eric Salob7d54ac2022-12-29 11:59:42 -080011883// Skips data for a group, returning a pointer past the end of the group, or
11884// NULL if there was an error parsing the group. The `tag` argument should be
11885// the start group tag that begins the group. The `depth_limit` argument
11886// indicates how many levels of recursion the group is allowed to have before
11887// reporting a parse error (this limit exists to protect against stack
11888// overflow).
Eric Salob7d54ac2022-12-29 11:59:42 -080011889//
Mike Kruskal232ecf42023-01-14 00:09:40 -080011890// TODO: evaluate how the depth_limit should be specified. Do users need
11891// control over this?
11892UPB_INLINE const char* upb_WireReader_SkipGroup(
11893 const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) {
11894 return _upb_WireReader_SkipGroup(ptr, tag, 100, stream);
11895}
11896
11897UPB_INLINE const char* _upb_WireReader_SkipValue(
Eric Salob7d54ac2022-12-29 11:59:42 -080011898 const char* ptr, uint32_t tag, int depth_limit,
11899 upb_EpsCopyInputStream* stream) {
11900 switch (upb_WireReader_GetWireType(tag)) {
11901 case kUpb_WireType_Varint:
11902 return upb_WireReader_SkipVarint(ptr);
11903 case kUpb_WireType_32Bit:
11904 return ptr + 4;
11905 case kUpb_WireType_64Bit:
11906 return ptr + 8;
11907 case kUpb_WireType_Delimited: {
11908 int size;
11909 ptr = upb_WireReader_ReadSize(ptr, &size);
11910 if (!ptr) return NULL;
11911 ptr += size;
11912 return ptr;
11913 }
11914 case kUpb_WireType_StartGroup:
Mike Kruskal232ecf42023-01-14 00:09:40 -080011915 return _upb_WireReader_SkipGroup(ptr, tag, depth_limit, stream);
Eric Salob7d54ac2022-12-29 11:59:42 -080011916 case kUpb_WireType_EndGroup:
11917 return NULL; // Should be handled before now.
11918 default:
11919 return NULL; // Unknown wire type.
11920 }
11921}
11922
Mike Kruskal232ecf42023-01-14 00:09:40 -080011923// Skips data for a wire value of any type, returning a pointer past the end of
11924// the data, or NULL if there was an error parsing the group. The `tag` argument
11925// should be the tag that was just parsed. The `depth_limit` argument indicates
11926// how many levels of recursion a group is allowed to have before reporting a
11927// parse error (this limit exists to protect against stack overflow).
11928//
11929// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
11930// Bounds checks must be performed before calling this function, preferably
11931// by calling upb_EpsCopyInputStream_IsDone().
11932//
11933// TODO: evaluate how the depth_limit should be specified. Do users need
11934// control over this?
11935UPB_INLINE const char* upb_WireReader_SkipValue(
11936 const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) {
11937 return _upb_WireReader_SkipValue(ptr, tag, 100, stream);
11938}
11939
Eric Salob7d54ac2022-12-29 11:59:42 -080011940#ifdef __cplusplus
11941} /* extern "C" */
11942#endif
11943
11944
11945#endif // UPB_WIRE_READER_H_
11946
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011947#ifndef UPB_MESSAGE_COPY_H_
11948#define UPB_MESSAGE_COPY_H_
11949
11950
11951// Must be last.
11952
11953#ifdef __cplusplus
11954extern "C" {
11955#endif
11956
11957// Deep clones a message using the provided target arena.
11958upb_Message* upb_Message_DeepClone(const upb_Message* message,
11959 const upb_MiniTable* mini_table,
11960 upb_Arena* arena);
11961
11962// Deep clones array contents.
11963upb_Array* upb_Array_DeepClone(const upb_Array* array, upb_CType value_type,
11964 const upb_MiniTable* sub, upb_Arena* arena);
11965
11966// Deep clones map contents.
11967upb_Map* upb_Map_DeepClone(const upb_Map* map, upb_CType key_type,
11968 upb_CType value_type,
11969 const upb_MiniTable* map_entry_table,
11970 upb_Arena* arena);
11971
11972// Deep copies the message from src to dst.
11973bool upb_Message_DeepCopy(upb_Message* dst, const upb_Message* src,
11974 const upb_MiniTable* mini_table, upb_Arena* arena);
11975
11976#ifdef __cplusplus
11977} /* extern "C" */
11978#endif
11979
11980
11981#endif // UPB_MESSAGE_COPY_H_
11982
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000011983// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
11984
11985#ifndef UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_
11986#define UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_
11987
11988#include <stdlib.h>
11989
11990
11991#ifndef UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_
11992#define UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_
11993
11994
11995// Map entries aren't actually stored for map fields, they are only used during
11996// parsing. For parsing, it helps a lot if all map entry messages have the same
11997// layout. The layout code in mini_table/decode.c will ensure that all map
11998// entries have this layout.
11999//
12000// Note that users can and do create map entries directly, which will also use
12001// this layout.
12002//
12003// NOTE: sync with wire/decode.c.
12004typedef struct {
12005 // We only need 2 hasbits max, but due to alignment we'll use 8 bytes here,
12006 // and the uint64_t helps make this clear.
12007 uint64_t hasbits;
12008 union {
12009 upb_StringView str; // For str/bytes.
12010 upb_value val; // For all other types.
12011 } k;
12012 union {
12013 upb_StringView str; // For str/bytes.
12014 upb_value val; // For all other types.
12015 } v;
12016} upb_MapEntryData;
12017
12018typedef struct {
12019 upb_Message_Internal internal;
12020 upb_MapEntryData data;
12021} upb_MapEntry;
12022
12023#endif // UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_
12024
12025// Must be last.
12026
12027#ifdef __cplusplus
12028extern "C" {
12029#endif
12030
12031// _upb_mapsorter sorts maps and provides ordered iteration over the entries.
12032// Since maps can be recursive (map values can be messages which contain other
12033// maps), _upb_mapsorter can contain a stack of maps.
12034
12035typedef struct {
12036 void const** entries;
12037 int size;
12038 int cap;
12039} _upb_mapsorter;
12040
12041typedef struct {
12042 int start;
12043 int pos;
12044 int end;
12045} _upb_sortedmap;
12046
12047UPB_INLINE void _upb_mapsorter_init(_upb_mapsorter* s) {
12048 s->entries = NULL;
12049 s->size = 0;
12050 s->cap = 0;
12051}
12052
12053UPB_INLINE void _upb_mapsorter_destroy(_upb_mapsorter* s) {
12054 if (s->entries) free(s->entries);
12055}
12056
12057UPB_INLINE bool _upb_sortedmap_next(_upb_mapsorter* s, const upb_Map* map,
12058 _upb_sortedmap* sorted, upb_MapEntry* ent) {
12059 if (sorted->pos == sorted->end) return false;
12060 const upb_tabent* tabent = (const upb_tabent*)s->entries[sorted->pos++];
12061 upb_StringView key = upb_tabstrview(tabent->key);
12062 _upb_map_fromkey(key, &ent->data.k, map->key_size);
12063 upb_value val = {tabent->val.val};
12064 _upb_map_fromvalue(val, &ent->data.v, map->val_size);
12065 return true;
12066}
12067
12068UPB_INLINE bool _upb_sortedmap_nextext(_upb_mapsorter* s,
12069 _upb_sortedmap* sorted,
12070 const upb_Message_Extension** ext) {
12071 if (sorted->pos == sorted->end) return false;
12072 *ext = (const upb_Message_Extension*)s->entries[sorted->pos++];
12073 return true;
12074}
12075
12076UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter* s,
12077 _upb_sortedmap* sorted) {
12078 s->size = sorted->start;
12079}
12080
12081bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type,
12082 const upb_Map* map, _upb_sortedmap* sorted);
12083
12084bool _upb_mapsorter_pushexts(_upb_mapsorter* s,
12085 const upb_Message_Extension* exts, size_t count,
12086 _upb_sortedmap* sorted);
12087
12088#ifdef __cplusplus
12089} /* extern "C" */
12090#endif
12091
12092
12093#endif /* UPB_COLLECTIONS_INTERNAL_MAP_SORTER_H_ */
12094
Adam Cozzette8059da22023-08-16 07:57:14 -070012095#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12096#define UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12097
12098
12099#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12100#define UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12101
Adam Cozzette7d5592e2023-08-23 12:15:26 -070012102#include <stdint.h>
12103
Adam Cozzette8059da22023-08-16 07:57:14 -070012104
12105// Must be last.
12106
12107#ifdef __cplusplus
12108extern "C" {
12109#endif
12110
12111UPB_INLINE char _upb_ToBase92(int8_t ch) {
12112 extern const char _kUpb_ToBase92[];
12113 UPB_ASSERT(0 <= ch && ch < 92);
12114 return _kUpb_ToBase92[ch];
12115}
12116
12117UPB_INLINE char _upb_FromBase92(uint8_t ch) {
12118 extern const int8_t _kUpb_FromBase92[];
12119 if (' ' > ch || ch > '~') return -1;
12120 return _kUpb_FromBase92[ch - ' '];
12121}
12122
12123UPB_INLINE const char* _upb_Base92_DecodeVarint(const char* ptr,
12124 const char* end, char first_ch,
12125 uint8_t min, uint8_t max,
12126 uint32_t* out_val) {
12127 uint32_t val = 0;
12128 uint32_t shift = 0;
12129 const int bits_per_char =
12130 upb_Log2Ceiling(_upb_FromBase92(max) - _upb_FromBase92(min));
12131 char ch = first_ch;
12132 while (1) {
12133 uint32_t bits = _upb_FromBase92(ch) - _upb_FromBase92(min);
12134 val |= bits << shift;
12135 if (ptr == end || *ptr < min || max < *ptr) {
12136 *out_val = val;
12137 UPB_ASSUME(ptr != NULL);
12138 return ptr;
12139 }
12140 ch = *ptr++;
12141 shift += bits_per_char;
12142 if (shift >= 32) return NULL;
12143 }
12144}
12145
12146#ifdef __cplusplus
12147} /* extern "C" */
12148#endif
12149
12150
12151#endif // UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12152
12153// Must be last.
12154
12155// upb_MdDecoder: used internally for decoding MiniDescriptors for messages,
12156// extensions, and enums.
12157typedef struct {
12158 const char* end;
12159 upb_Status* status;
12160 jmp_buf err;
12161} upb_MdDecoder;
12162
12163UPB_PRINTF(2, 3)
12164UPB_NORETURN UPB_INLINE void upb_MdDecoder_ErrorJmp(upb_MdDecoder* d,
12165 const char* fmt, ...) {
12166 if (d->status) {
12167 va_list argp;
12168 upb_Status_SetErrorMessage(d->status, "Error building mini table: ");
12169 va_start(argp, fmt);
12170 upb_Status_VAppendErrorFormat(d->status, fmt, argp);
12171 va_end(argp);
12172 }
12173 UPB_LONGJMP(d->err, 1);
12174}
12175
12176UPB_INLINE void upb_MdDecoder_CheckOutOfMemory(upb_MdDecoder* d,
12177 const void* ptr) {
12178 if (!ptr) upb_MdDecoder_ErrorJmp(d, "Out of memory");
12179}
12180
12181UPB_INLINE const char* upb_MdDecoder_DecodeBase92Varint(
12182 upb_MdDecoder* d, const char* ptr, char first_ch, uint8_t min, uint8_t max,
12183 uint32_t* out_val) {
12184 ptr = _upb_Base92_DecodeVarint(ptr, d->end, first_ch, min, max, out_val);
12185 if (!ptr) upb_MdDecoder_ErrorJmp(d, "Overlong varint");
12186 return ptr;
12187}
12188
12189
12190#endif // UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12191
12192#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12193#define UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12194
12195
12196// Must be last.
12197
12198typedef enum {
12199 kUpb_EncodedType_Double = 0,
12200 kUpb_EncodedType_Float = 1,
12201 kUpb_EncodedType_Fixed32 = 2,
12202 kUpb_EncodedType_Fixed64 = 3,
12203 kUpb_EncodedType_SFixed32 = 4,
12204 kUpb_EncodedType_SFixed64 = 5,
12205 kUpb_EncodedType_Int32 = 6,
12206 kUpb_EncodedType_UInt32 = 7,
12207 kUpb_EncodedType_SInt32 = 8,
12208 kUpb_EncodedType_Int64 = 9,
12209 kUpb_EncodedType_UInt64 = 10,
12210 kUpb_EncodedType_SInt64 = 11,
12211 kUpb_EncodedType_OpenEnum = 12,
12212 kUpb_EncodedType_Bool = 13,
12213 kUpb_EncodedType_Bytes = 14,
12214 kUpb_EncodedType_String = 15,
12215 kUpb_EncodedType_Group = 16,
12216 kUpb_EncodedType_Message = 17,
12217 kUpb_EncodedType_ClosedEnum = 18,
12218
12219 kUpb_EncodedType_RepeatedBase = 20,
12220} upb_EncodedType;
12221
12222typedef enum {
12223 kUpb_EncodedFieldModifier_FlipPacked = 1 << 0,
12224 kUpb_EncodedFieldModifier_IsRequired = 1 << 1,
12225 kUpb_EncodedFieldModifier_IsProto3Singular = 1 << 2,
Protobuf Team Botb58bd402023-09-19 15:42:34 +000012226 kUpb_EncodedFieldModifier_FlipValidateUtf8 = 1 << 3,
Adam Cozzette8059da22023-08-16 07:57:14 -070012227} upb_EncodedFieldModifier;
12228
12229enum {
12230 kUpb_EncodedValue_MinField = ' ',
12231 kUpb_EncodedValue_MaxField = 'I',
12232 kUpb_EncodedValue_MinModifier = 'L',
12233 kUpb_EncodedValue_MaxModifier = '[',
12234 kUpb_EncodedValue_End = '^',
12235 kUpb_EncodedValue_MinSkip = '_',
12236 kUpb_EncodedValue_MaxSkip = '~',
12237 kUpb_EncodedValue_OneofSeparator = '~',
12238 kUpb_EncodedValue_FieldSeparator = '|',
12239 kUpb_EncodedValue_MinOneofField = ' ',
12240 kUpb_EncodedValue_MaxOneofField = 'b',
12241 kUpb_EncodedValue_MaxEnumMask = 'A',
12242};
12243
12244enum {
12245 kUpb_EncodedVersion_EnumV1 = '!',
12246 kUpb_EncodedVersion_ExtensionV1 = '#',
12247 kUpb_EncodedVersion_MapV1 = '%',
12248 kUpb_EncodedVersion_MessageV1 = '$',
12249 kUpb_EncodedVersion_MessageSetV1 = '&',
12250};
12251
12252
12253#endif // UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12254
12255#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
12256#define UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
12257
12258// Must be last.
12259
12260typedef enum {
12261 kUpb_FieldModifier_IsRepeated = 1 << 0,
12262 kUpb_FieldModifier_IsPacked = 1 << 1,
12263 kUpb_FieldModifier_IsClosedEnum = 1 << 2,
12264 kUpb_FieldModifier_IsProto3Singular = 1 << 3,
12265 kUpb_FieldModifier_IsRequired = 1 << 4,
Protobuf Team Botb58bd402023-09-19 15:42:34 +000012266 kUpb_FieldModifier_ValidateUtf8 = 1 << 5,
Adam Cozzette8059da22023-08-16 07:57:14 -070012267} kUpb_FieldModifier;
12268
Protobuf Team Botb58bd402023-09-19 15:42:34 +000012269// These modifiers are also used on the wire.
Adam Cozzette8059da22023-08-16 07:57:14 -070012270typedef enum {
12271 kUpb_MessageModifier_ValidateUtf8 = 1 << 0,
12272 kUpb_MessageModifier_DefaultIsPacked = 1 << 1,
12273 kUpb_MessageModifier_IsExtendable = 1 << 2,
12274} kUpb_MessageModifier;
12275
12276
12277#endif // UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
12278
12279#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
12280#define UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
12281
Adam Cozzette7d5592e2023-08-23 12:15:26 -070012282#include <stdint.h>
12283
Adam Cozzette8059da22023-08-16 07:57:14 -070012284
12285// Must be last.
12286
12287// If the input buffer has at least this many bytes available, the encoder call
12288// is guaranteed to succeed (as long as field number order is maintained).
12289#define kUpb_MtDataEncoder_MinSize 16
12290
12291typedef struct {
12292 char* end; // Limit of the buffer passed as a parameter.
12293 // Aliased to internal-only members in .cc.
12294 char internal[32];
12295} upb_MtDataEncoder;
12296
12297#ifdef __cplusplus
12298extern "C" {
12299#endif
12300
12301// Encodes field/oneof information for a given message. The sequence of calls
12302// should look like:
12303//
12304// upb_MtDataEncoder e;
12305// char buf[256];
12306// char* ptr = buf;
12307// e.end = ptr + sizeof(buf);
12308// unit64_t msg_mod = ...; // bitwise & of kUpb_MessageModifiers or zero
12309// ptr = upb_MtDataEncoder_StartMessage(&e, ptr, msg_mod);
12310// // Fields *must* be in field number order.
12311// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
12312// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
12313// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
12314//
12315// // If oneofs are present. Oneofs must be encoded after regular fields.
12316// ptr = upb_MiniTable_StartOneof(&e, ptr)
12317// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
12318// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
12319//
12320// ptr = upb_MiniTable_StartOneof(&e, ptr);
12321// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
12322// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
12323//
12324// Oneofs must be encoded after all regular fields.
12325char* upb_MtDataEncoder_StartMessage(upb_MtDataEncoder* e, char* ptr,
12326 uint64_t msg_mod);
12327char* upb_MtDataEncoder_PutField(upb_MtDataEncoder* e, char* ptr,
12328 upb_FieldType type, uint32_t field_num,
12329 uint64_t field_mod);
12330char* upb_MtDataEncoder_StartOneof(upb_MtDataEncoder* e, char* ptr);
12331char* upb_MtDataEncoder_PutOneofField(upb_MtDataEncoder* e, char* ptr,
12332 uint32_t field_num);
12333
12334// Encodes the set of values for a given enum. The values must be given in
12335// order (after casting to uint32_t), and repeats are not allowed.
12336char* upb_MtDataEncoder_StartEnum(upb_MtDataEncoder* e, char* ptr);
12337char* upb_MtDataEncoder_PutEnumValue(upb_MtDataEncoder* e, char* ptr,
12338 uint32_t val);
12339char* upb_MtDataEncoder_EndEnum(upb_MtDataEncoder* e, char* ptr);
12340
12341// Encodes an entire mini descriptor for an extension.
12342char* upb_MtDataEncoder_EncodeExtension(upb_MtDataEncoder* e, char* ptr,
12343 upb_FieldType type, uint32_t field_num,
12344 uint64_t field_mod);
12345
12346// Encodes an entire mini descriptor for a map.
12347char* upb_MtDataEncoder_EncodeMap(upb_MtDataEncoder* e, char* ptr,
12348 upb_FieldType key_type,
12349 upb_FieldType value_type, uint64_t key_mod,
12350 uint64_t value_mod);
12351
12352// Encodes an entire mini descriptor for a message set.
12353char* upb_MtDataEncoder_EncodeMessageSet(upb_MtDataEncoder* e, char* ptr);
12354
12355#ifdef __cplusplus
12356} /* extern "C" */
12357#endif
12358
12359
12360#endif /* UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ */
12361
Eric Salo8809a112022-11-21 13:01:06 -080012362#ifndef UPB_REFLECTION_DEF_POOL_INTERNAL_H_
12363#define UPB_REFLECTION_DEF_POOL_INTERNAL_H_
12364
12365
12366// Must be last.
12367
12368#ifdef __cplusplus
12369extern "C" {
12370#endif
12371
12372upb_Arena* _upb_DefPool_Arena(const upb_DefPool* s);
12373size_t _upb_DefPool_BytesLoaded(const upb_DefPool* s);
12374upb_ExtensionRegistry* _upb_DefPool_ExtReg(const upb_DefPool* s);
12375
12376bool _upb_DefPool_InsertExt(upb_DefPool* s, const upb_MiniTableExtension* ext,
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070012377 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080012378bool _upb_DefPool_InsertSym(upb_DefPool* s, upb_StringView sym, upb_value v,
12379 upb_Status* status);
12380bool _upb_DefPool_LookupSym(const upb_DefPool* s, const char* sym, size_t size,
12381 upb_value* v);
12382
12383void** _upb_DefPool_ScratchData(const upb_DefPool* s);
12384size_t* _upb_DefPool_ScratchSize(const upb_DefPool* s);
Mike Kruskal232ecf42023-01-14 00:09:40 -080012385void _upb_DefPool_SetPlatform(upb_DefPool* s, upb_MiniTablePlatform platform);
Eric Salo8809a112022-11-21 13:01:06 -080012386
12387// For generated code only: loads a generated descriptor.
12388typedef struct _upb_DefPool_Init {
12389 struct _upb_DefPool_Init** deps; // Dependencies of this file.
12390 const upb_MiniTableFile* layout;
12391 const char* filename;
12392 upb_StringView descriptor; // Serialized descriptor.
12393} _upb_DefPool_Init;
12394
12395bool _upb_DefPool_LoadDefInit(upb_DefPool* s, const _upb_DefPool_Init* init);
12396
12397// Should only be directly called by tests. This variant lets us suppress
12398// the use of compiled-in tables, forcing a rebuild of the tables at runtime.
12399bool _upb_DefPool_LoadDefInitEx(upb_DefPool* s, const _upb_DefPool_Init* init,
12400 bool rebuild_minitable);
12401
12402#ifdef __cplusplus
12403} /* extern "C" */
12404#endif
12405
12406
12407#endif /* UPB_REFLECTION_DEF_POOL_INTERNAL_H_ */
12408
Protobuf Team Bot7be2a452023-09-13 16:50:05 +000012409#ifndef UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_
12410#define UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_
12411
12412
Eric Salo8809a112022-11-21 13:01:06 -080012413// Must be last.
12414
12415// We want to copy the options verbatim into the destination options proto.
12416// We use serialize+parse as our deep copy.
Mike Kruskal232ecf42023-01-14 00:09:40 -080012417#define UPB_DEF_SET_OPTIONS(target, desc_type, options_type, proto) \
12418 if (UPB_DESC(desc_type##_has_options)(proto)) { \
12419 size_t size; \
12420 char* pb = UPB_DESC(options_type##_serialize)( \
12421 UPB_DESC(desc_type##_options)(proto), ctx->tmp_arena, &size); \
12422 if (!pb) _upb_DefBuilder_OomErr(ctx); \
12423 target = \
12424 UPB_DESC(options_type##_parse)(pb, size, _upb_DefBuilder_Arena(ctx)); \
12425 if (!target) _upb_DefBuilder_OomErr(ctx); \
12426 } else { \
12427 target = (const UPB_DESC(options_type)*)kUpbDefOptDefault; \
Eric Salo8809a112022-11-21 13:01:06 -080012428 }
12429
12430#ifdef __cplusplus
12431extern "C" {
12432#endif
12433
12434struct upb_DefBuilder {
12435 upb_DefPool* symtab;
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012436 upb_strtable feature_cache; // Caches features by identity.
12437 UPB_DESC(FeatureSet*) legacy_features; // For computing legacy features.
12438 char* tmp_buf; // Temporary buffer in tmp_arena.
12439 size_t tmp_buf_size; // Size of temporary buffer.
Eric Salo8809a112022-11-21 13:01:06 -080012440 upb_FileDef* file; // File we are building.
12441 upb_Arena* arena; // Allocate defs here.
12442 upb_Arena* tmp_arena; // For temporary allocations.
12443 upb_Status* status; // Record errors here.
12444 const upb_MiniTableFile* layout; // NULL if we should build layouts.
Mike Kruskal232ecf42023-01-14 00:09:40 -080012445 upb_MiniTablePlatform platform; // Platform we are targeting.
Eric Salo8809a112022-11-21 13:01:06 -080012446 int enum_count; // Count of enums built so far.
12447 int msg_count; // Count of messages built so far.
12448 int ext_count; // Count of extensions built so far.
12449 jmp_buf err; // longjmp() on error.
12450};
12451
12452extern const char* kUpbDefOptDefault;
12453
12454// ctx->status has already been set elsewhere so just fail/longjmp()
12455UPB_NORETURN void _upb_DefBuilder_FailJmp(upb_DefBuilder* ctx);
12456
12457UPB_NORETURN void _upb_DefBuilder_Errf(upb_DefBuilder* ctx, const char* fmt,
12458 ...) UPB_PRINTF(2, 3);
12459UPB_NORETURN void _upb_DefBuilder_OomErr(upb_DefBuilder* ctx);
12460
12461const char* _upb_DefBuilder_MakeFullName(upb_DefBuilder* ctx,
12462 const char* prefix,
12463 upb_StringView name);
12464
12465// Given a symbol and the base symbol inside which it is defined,
12466// find the symbol's definition.
12467const void* _upb_DefBuilder_ResolveAny(upb_DefBuilder* ctx,
12468 const char* from_name_dbg,
12469 const char* base, upb_StringView sym,
12470 upb_deftype_t* type);
12471
12472const void* _upb_DefBuilder_Resolve(upb_DefBuilder* ctx,
12473 const char* from_name_dbg, const char* base,
12474 upb_StringView sym, upb_deftype_t type);
12475
12476char _upb_DefBuilder_ParseEscape(upb_DefBuilder* ctx, const upb_FieldDef* f,
12477 const char** src, const char* end);
12478
12479const char* _upb_DefBuilder_FullToShort(const char* fullname);
12480
12481UPB_INLINE void* _upb_DefBuilder_Alloc(upb_DefBuilder* ctx, size_t bytes) {
12482 if (bytes == 0) return NULL;
12483 void* ret = upb_Arena_Malloc(ctx->arena, bytes);
12484 if (!ret) _upb_DefBuilder_OomErr(ctx);
12485 return ret;
12486}
12487
12488// Adds a symbol |v| to the symtab, which must be a def pointer previously
12489// packed with pack_def(). The def's pointer to upb_FileDef* must be set before
12490// adding, so we know which entries to remove if building this file fails.
12491UPB_INLINE void _upb_DefBuilder_Add(upb_DefBuilder* ctx, const char* name,
12492 upb_value v) {
12493 upb_StringView sym = {.data = name, .size = strlen(name)};
12494 bool ok = _upb_DefPool_InsertSym(ctx->symtab, sym, v, ctx->status);
12495 if (!ok) _upb_DefBuilder_FailJmp(ctx);
12496}
12497
12498UPB_INLINE upb_Arena* _upb_DefBuilder_Arena(const upb_DefBuilder* ctx) {
12499 return ctx->arena;
12500}
12501
12502UPB_INLINE upb_FileDef* _upb_DefBuilder_File(const upb_DefBuilder* ctx) {
12503 return ctx->file;
12504}
12505
12506// This version of CheckIdent() is only called by other, faster versions after
12507// they detect a parsing error.
12508void _upb_DefBuilder_CheckIdentSlow(upb_DefBuilder* ctx, upb_StringView name,
12509 bool full);
12510
Eric Salo8809a112022-11-21 13:01:06 -080012511// Verify a full identifier string. This is slightly more complicated than
12512// verifying a relative identifier string because we must track '.' chars.
12513UPB_INLINE void _upb_DefBuilder_CheckIdentFull(upb_DefBuilder* ctx,
12514 upb_StringView name) {
12515 bool good = name.size > 0;
12516 bool start = true;
12517
12518 for (size_t i = 0; i < name.size; i++) {
12519 const char c = name.data[i];
12520 const char d = c | 0x20; // force lowercase
12521 const bool is_alpha = (('a' <= d) & (d <= 'z')) | (c == '_');
12522 const bool is_numer = ('0' <= c) & (c <= '9') & !start;
12523 const bool is_dot = (c == '.') & !start;
12524
12525 good &= is_alpha | is_numer | is_dot;
12526 start = is_dot;
12527 }
12528
12529 if (!good) _upb_DefBuilder_CheckIdentSlow(ctx, name, true);
12530}
12531
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012532// Returns true if the returned feature set is new and must be populated.
12533bool _upb_DefBuilder_GetOrCreateFeatureSet(upb_DefBuilder* ctx,
12534 const UPB_DESC(FeatureSet*) parent,
12535 upb_StringView key,
12536 UPB_DESC(FeatureSet**) set);
12537
12538const UPB_DESC(FeatureSet*)
12539 _upb_DefBuilder_DoResolveFeatures(upb_DefBuilder* ctx,
12540 const UPB_DESC(FeatureSet*) parent,
12541 const UPB_DESC(FeatureSet*) child,
12542 bool is_implicit);
12543
12544UPB_INLINE const UPB_DESC(FeatureSet*)
12545 _upb_DefBuilder_ResolveFeatures(upb_DefBuilder* ctx,
12546 const UPB_DESC(FeatureSet*) parent,
12547 const UPB_DESC(FeatureSet*) child) {
12548 return _upb_DefBuilder_DoResolveFeatures(ctx, parent, child, false);
12549}
12550
Eric Salo8809a112022-11-21 13:01:06 -080012551#ifdef __cplusplus
12552} /* extern "C" */
12553#endif
12554
12555
12556#endif /* UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ */
12557
12558#ifndef UPB_REFLECTION_ENUM_DEF_INTERNAL_H_
12559#define UPB_REFLECTION_ENUM_DEF_INTERNAL_H_
12560
12561
12562// Must be last.
12563
12564#ifdef __cplusplus
12565extern "C" {
12566#endif
12567
12568upb_EnumDef* _upb_EnumDef_At(const upb_EnumDef* e, int i);
12569bool _upb_EnumDef_Insert(upb_EnumDef* e, upb_EnumValueDef* v, upb_Arena* a);
12570const upb_MiniTableEnum* _upb_EnumDef_MiniTable(const upb_EnumDef* e);
12571
12572// Allocate and initialize an array of |n| enum defs.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012573upb_EnumDef* _upb_EnumDefs_New(upb_DefBuilder* ctx, int n,
12574 const UPB_DESC(EnumDescriptorProto*)
12575 const* protos,
12576 const UPB_DESC(FeatureSet*) parent_features,
12577 const upb_MessageDef* containing_type);
Eric Salo8809a112022-11-21 13:01:06 -080012578
12579#ifdef __cplusplus
12580} /* extern "C" */
12581#endif
12582
12583
12584#endif /* UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ */
12585
12586#ifndef UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_
12587#define UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_
12588
12589
12590// Must be last.
12591
12592#ifdef __cplusplus
12593extern "C" {
12594#endif
12595
12596upb_EnumValueDef* _upb_EnumValueDef_At(const upb_EnumValueDef* v, int i);
12597
12598// Allocate and initialize an array of |n| enum value defs owned by |e|.
12599upb_EnumValueDef* _upb_EnumValueDefs_New(
12600 upb_DefBuilder* ctx, const char* prefix, int n,
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012601 const UPB_DESC(EnumValueDescriptorProto*) const* protos,
12602 const UPB_DESC(FeatureSet*) parent_features, upb_EnumDef* e,
Eric Salo8809a112022-11-21 13:01:06 -080012603 bool* is_sorted);
12604
12605const upb_EnumValueDef** _upb_EnumValueDefs_Sorted(const upb_EnumValueDef* v,
12606 int n, upb_Arena* a);
12607
12608#ifdef __cplusplus
12609} /* extern "C" */
12610#endif
12611
12612
12613#endif /* UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ */
12614
12615#ifndef UPB_REFLECTION_FIELD_DEF_INTERNAL_H_
12616#define UPB_REFLECTION_FIELD_DEF_INTERNAL_H_
12617
12618
12619// Must be last.
12620
12621#ifdef __cplusplus
12622extern "C" {
12623#endif
12624
12625upb_FieldDef* _upb_FieldDef_At(const upb_FieldDef* f, int i);
12626
12627const upb_MiniTableExtension* _upb_FieldDef_ExtensionMiniTable(
12628 const upb_FieldDef* f);
12629bool _upb_FieldDef_IsClosedEnum(const upb_FieldDef* f);
12630bool _upb_FieldDef_IsProto3Optional(const upb_FieldDef* f);
12631int _upb_FieldDef_LayoutIndex(const upb_FieldDef* f);
12632uint64_t _upb_FieldDef_Modifiers(const upb_FieldDef* f);
12633void _upb_FieldDef_Resolve(upb_DefBuilder* ctx, const char* prefix,
12634 upb_FieldDef* f);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070012635void _upb_FieldDef_BuildMiniTableExtension(upb_DefBuilder* ctx,
12636 const upb_FieldDef* f);
12637
12638// Allocate and initialize an array of |n| extensions (field defs).
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012639upb_FieldDef* _upb_Extensions_New(upb_DefBuilder* ctx, int n,
12640 const UPB_DESC(FieldDescriptorProto*)
12641 const* protos,
12642 const UPB_DESC(FeatureSet*) parent_features,
12643 const char* prefix, upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012644
12645// Allocate and initialize an array of |n| field defs.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012646upb_FieldDef* _upb_FieldDefs_New(upb_DefBuilder* ctx, int n,
12647 const UPB_DESC(FieldDescriptorProto*)
12648 const* protos,
12649 const UPB_DESC(FeatureSet*) parent_features,
12650 const char* prefix, upb_MessageDef* m,
12651 bool* is_sorted);
Eric Salo8809a112022-11-21 13:01:06 -080012652
12653// Allocate and return a list of pointers to the |n| field defs in |ff|,
12654// sorted by field number.
12655const upb_FieldDef** _upb_FieldDefs_Sorted(const upb_FieldDef* f, int n,
12656 upb_Arena* a);
12657
12658#ifdef __cplusplus
12659} /* extern "C" */
12660#endif
12661
12662
12663#endif /* UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ */
12664
12665#ifndef UPB_REFLECTION_FILE_DEF_INTERNAL_H_
12666#define UPB_REFLECTION_FILE_DEF_INTERNAL_H_
12667
12668
12669// Must be last.
12670
12671#ifdef __cplusplus
12672extern "C" {
12673#endif
12674
12675const upb_MiniTableExtension* _upb_FileDef_ExtensionMiniTable(
12676 const upb_FileDef* f, int i);
12677const int32_t* _upb_FileDef_PublicDependencyIndexes(const upb_FileDef* f);
12678const int32_t* _upb_FileDef_WeakDependencyIndexes(const upb_FileDef* f);
12679
12680// upb_FileDef_Package() returns "" if f->package is NULL, this does not.
12681const char* _upb_FileDef_RawPackage(const upb_FileDef* f);
12682
12683void _upb_FileDef_Create(upb_DefBuilder* ctx,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012684 const UPB_DESC(FileDescriptorProto) * file_proto);
Eric Salo8809a112022-11-21 13:01:06 -080012685
12686#ifdef __cplusplus
12687} /* extern "C" */
12688#endif
12689
12690
12691#endif /* UPB_REFLECTION_FILE_DEF_INTERNAL_H_ */
12692
12693#ifndef UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_
12694#define UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_
12695
12696
12697// Must be last.
12698
12699#ifdef __cplusplus
12700extern "C" {
12701#endif
12702
12703upb_MessageDef* _upb_MessageDef_At(const upb_MessageDef* m, int i);
12704bool _upb_MessageDef_InMessageSet(const upb_MessageDef* m);
12705bool _upb_MessageDef_Insert(upb_MessageDef* m, const char* name, size_t size,
12706 upb_value v, upb_Arena* a);
12707void _upb_MessageDef_InsertField(upb_DefBuilder* ctx, upb_MessageDef* m,
12708 const upb_FieldDef* f);
12709bool _upb_MessageDef_IsValidExtensionNumber(const upb_MessageDef* m, int n);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070012710void _upb_MessageDef_CreateMiniTable(upb_DefBuilder* ctx, upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012711void _upb_MessageDef_LinkMiniTable(upb_DefBuilder* ctx,
12712 const upb_MessageDef* m);
12713void _upb_MessageDef_Resolve(upb_DefBuilder* ctx, upb_MessageDef* m);
12714
12715// Allocate and initialize an array of |n| message defs.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012716upb_MessageDef* _upb_MessageDefs_New(upb_DefBuilder* ctx, int n,
12717 const UPB_DESC(DescriptorProto*)
12718 const* protos,
12719 const UPB_DESC(FeatureSet*)
12720 parent_features,
12721 const upb_MessageDef* containing_type);
Eric Salo8809a112022-11-21 13:01:06 -080012722
12723#ifdef __cplusplus
12724} /* extern "C" */
12725#endif
12726
12727
12728#endif /* UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ */
12729
12730#ifndef UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_
12731#define UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_
12732
12733
12734// Must be last.
12735
12736#ifdef __cplusplus
12737extern "C" {
12738#endif
12739
12740upb_ServiceDef* _upb_ServiceDef_At(const upb_ServiceDef* s, int i);
12741
12742// Allocate and initialize an array of |n| service defs.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012743upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n,
12744 const UPB_DESC(ServiceDescriptorProto*)
12745 const* protos,
12746 const UPB_DESC(FeatureSet*)
12747 parent_features);
Eric Salo8809a112022-11-21 13:01:06 -080012748
12749#ifdef __cplusplus
12750} /* extern "C" */
12751#endif
12752
12753
12754#endif /* UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ */
12755
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012756#ifndef UPB_REFLECTION_UPB_EDITION_DEFAULTS_H_
12757#define UPB_REFLECTION_UPB_EDITION_DEFAULTS_H_
12758
12759// This file contains the serialized FeatureSetDefaults object for
12760// language-independent features and (possibly at some point) for upb-specific
12761// features. This is used for feature resolution under Editions.
12762// NOLINTBEGIN
12763// clang-format off
12764#define UPB_INTERNAL_UPB_EDITION_DEFAULTS "\n\021\022\014\010\001\020\002\030\002 \001(\0010\002\030\346\007\n\021\022\014\010\002\020\001\030\001 \002(\0010\001\030\347\007\n\021\022\014\010\001\020\001\030\001 \002(\0010\001\030\350\007 \346\007(\350\007"
12765// clang-format on
12766// NOLINTEND
12767
12768#endif // UPB_REFLECTION_UPB_EDITION_DEFAULTS_H_
12769
Eric Salo8809a112022-11-21 13:01:06 -080012770#ifndef UPB_REFLECTION_DESC_STATE_INTERNAL_H_
12771#define UPB_REFLECTION_DESC_STATE_INTERNAL_H_
12772
12773
12774// Must be last.
12775
12776// Manages the storage for mini descriptor strings as they are being encoded.
Protobuf Team Bot986cbb62023-09-19 15:03:51 +000012777// TODO: Move some of this state directly into the encoder, maybe.
Eric Salo8809a112022-11-21 13:01:06 -080012778typedef struct {
12779 upb_MtDataEncoder e;
12780 size_t bufsize;
12781 char* buf;
12782 char* ptr;
12783} upb_DescState;
12784
12785#ifdef __cplusplus
12786extern "C" {
12787#endif
12788
12789UPB_INLINE void _upb_DescState_Init(upb_DescState* d) {
12790 d->bufsize = kUpb_MtDataEncoder_MinSize * 2;
12791 d->buf = NULL;
12792 d->ptr = NULL;
12793}
12794
12795bool _upb_DescState_Grow(upb_DescState* d, upb_Arena* a);
12796
12797#ifdef __cplusplus
12798} /* extern "C" */
12799#endif
12800
12801
12802#endif /* UPB_REFLECTION_DESC_STATE_INTERNAL_H_ */
12803
12804#ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_
12805#define UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_
12806
12807
Protobuf Team Bot06310352023-09-26 21:54:58 +000012808// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080012809
12810#ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_H_
12811#define UPB_REFLECTION_ENUM_RESERVED_RANGE_H_
12812
12813
12814// Must be last.
12815
12816#ifdef __cplusplus
12817extern "C" {
12818#endif
12819
12820int32_t upb_EnumReservedRange_Start(const upb_EnumReservedRange* r);
12821int32_t upb_EnumReservedRange_End(const upb_EnumReservedRange* r);
12822
12823#ifdef __cplusplus
12824} /* extern "C" */
12825#endif
12826
12827
12828#endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ */
12829
12830// Must be last.
12831
12832#ifdef __cplusplus
12833extern "C" {
12834#endif
12835
12836upb_EnumReservedRange* _upb_EnumReservedRange_At(const upb_EnumReservedRange* r,
12837 int i);
12838
12839// Allocate and initialize an array of |n| reserved ranges owned by |e|.
12840upb_EnumReservedRange* _upb_EnumReservedRanges_New(
12841 upb_DefBuilder* ctx, int n,
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012842 const UPB_DESC(EnumDescriptorProto_EnumReservedRange*) const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080012843 const upb_EnumDef* e);
12844
12845#ifdef __cplusplus
12846} /* extern "C" */
12847#endif
12848
12849
12850#endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ */
12851
Protobuf Team Bot7be2a452023-09-13 16:50:05 +000012852#ifndef UPB_REFLECTION_INTERNAL_STRDUP2_H_
12853#define UPB_REFLECTION_INTERNAL_STRDUP2_H_
12854
12855#include <stddef.h>
12856
12857
12858// Must be last.
12859
12860#ifdef __cplusplus
12861extern "C" {
12862#endif
12863
12864// Variant that works with a length-delimited rather than NULL-delimited string,
12865// as supported by strtable.
12866char* upb_strdup2(const char* s, size_t len, upb_Arena* a);
12867
12868#ifdef __cplusplus
12869} /* extern "C" */
12870#endif
12871
12872
12873#endif /* UPB_REFLECTION_INTERNAL_STRDUP2_H_ */
12874
Eric Salo8809a112022-11-21 13:01:06 -080012875#ifndef UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_
12876#define UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_
12877
12878
12879// Must be last.
12880
12881#ifdef __cplusplus
12882extern "C" {
12883#endif
12884
12885upb_ExtensionRange* _upb_ExtensionRange_At(const upb_ExtensionRange* r, int i);
12886
12887// Allocate and initialize an array of |n| extension ranges owned by |m|.
12888upb_ExtensionRange* _upb_ExtensionRanges_New(
12889 upb_DefBuilder* ctx, int n,
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012890 const UPB_DESC(DescriptorProto_ExtensionRange*) const* protos,
12891 const UPB_DESC(FeatureSet*) parent_features, const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012892
12893#ifdef __cplusplus
12894} /* extern "C" */
12895#endif
12896
12897
12898#endif /* UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ */
12899
12900#ifndef UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_
12901#define UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_
12902
12903
12904// Must be last.
12905
12906#ifdef __cplusplus
12907extern "C" {
12908#endif
12909
12910upb_OneofDef* _upb_OneofDef_At(const upb_OneofDef* o, int i);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070012911void _upb_OneofDef_Insert(upb_DefBuilder* ctx, upb_OneofDef* o,
12912 const upb_FieldDef* f, const char* name, size_t size);
Eric Salo8809a112022-11-21 13:01:06 -080012913
12914// Allocate and initialize an array of |n| oneof defs owned by |m|.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012915upb_OneofDef* _upb_OneofDefs_New(upb_DefBuilder* ctx, int n,
12916 const UPB_DESC(OneofDescriptorProto*)
12917 const* protos,
12918 const UPB_DESC(FeatureSet*) parent_features,
12919 upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012920
12921size_t _upb_OneofDefs_Finalize(upb_DefBuilder* ctx, upb_MessageDef* m);
12922
12923#ifdef __cplusplus
12924} /* extern "C" */
12925#endif
12926
12927
12928#endif /* UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ */
12929
12930#ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_
12931#define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_
12932
12933
Protobuf Team Bot06310352023-09-26 21:54:58 +000012934// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080012935
12936#ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_
12937#define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_
12938
12939
12940// Must be last.
12941
12942#ifdef __cplusplus
12943extern "C" {
12944#endif
12945
12946int32_t upb_MessageReservedRange_Start(const upb_MessageReservedRange* r);
12947int32_t upb_MessageReservedRange_End(const upb_MessageReservedRange* r);
12948
12949#ifdef __cplusplus
12950} /* extern "C" */
12951#endif
12952
12953
12954#endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ */
12955
12956// Must be last.
12957
12958#ifdef __cplusplus
12959extern "C" {
12960#endif
12961
12962upb_MessageReservedRange* _upb_MessageReservedRange_At(
12963 const upb_MessageReservedRange* r, int i);
12964
12965// Allocate and initialize an array of |n| reserved ranges owned by |m|.
12966upb_MessageReservedRange* _upb_MessageReservedRanges_New(
12967 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080012968 const UPB_DESC(DescriptorProto_ReservedRange) * const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080012969 const upb_MessageDef* m);
12970
12971#ifdef __cplusplus
12972} /* extern "C" */
12973#endif
12974
12975
12976#endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ */
12977
12978#ifndef UPB_REFLECTION_METHOD_DEF_INTERNAL_H_
12979#define UPB_REFLECTION_METHOD_DEF_INTERNAL_H_
12980
12981
12982// Must be last.
12983
12984#ifdef __cplusplus
12985extern "C" {
12986#endif
12987
12988upb_MethodDef* _upb_MethodDef_At(const upb_MethodDef* m, int i);
12989
12990// Allocate and initialize an array of |n| method defs owned by |s|.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000012991upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n,
12992 const UPB_DESC(MethodDescriptorProto*)
12993 const* protos,
12994 const UPB_DESC(FeatureSet*) parent_features,
12995 upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080012996
12997#ifdef __cplusplus
12998} /* extern "C" */
12999#endif
13000
13001
13002#endif /* UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ */
13003
Protobuf Team Bot743bf922023-09-14 01:12:11 +000013004#ifndef UPB_WIRE_INTERNAL_CONSTANTS_H_
13005#define UPB_WIRE_INTERNAL_CONSTANTS_H_
Eric Salo8809a112022-11-21 13:01:06 -080013006
Protobuf Team Bot743bf922023-09-14 01:12:11 +000013007#define kUpb_WireFormat_DefaultDepthLimit 100
Eric Salo8809a112022-11-21 13:01:06 -080013008
13009// MessageSet wire format is:
13010// message MessageSet {
13011// repeated group Item = 1 {
13012// required int32 type_id = 2;
13013// required bytes message = 3;
13014// }
13015// }
13016
13017enum {
13018 kUpb_MsgSet_Item = 1,
13019 kUpb_MsgSet_TypeId = 2,
13020 kUpb_MsgSet_Message = 3,
13021};
13022
Protobuf Team Bot743bf922023-09-14 01:12:11 +000013023#endif /* UPB_WIRE_INTERNAL_CONSTANTS_H_ */
Eric Salo8809a112022-11-21 13:01:06 -080013024
13025/*
13026 * Internal implementation details of the decoder that are shared between
13027 * decode.c and decode_fast.c.
13028 */
13029
Sandy Zhange3b09432023-08-07 09:30:02 -070013030#ifndef UPB_WIRE_INTERNAL_DECODE_H_
13031#define UPB_WIRE_INTERNAL_DECODE_H_
Eric Salo8809a112022-11-21 13:01:06 -080013032
Eric Salo3f36a912022-12-05 14:12:25 -080013033#include "utf8_range.h"
Joshua Habermand3995ec2022-09-30 16:54:39 -070013034
13035// Must be last.
13036
13037#define DECODE_NOGROUP (uint32_t) - 1
13038
13039typedef struct upb_Decoder {
Eric Salo10505992022-12-12 12:16:36 -080013040 upb_EpsCopyInputStream input;
13041 const upb_ExtensionRegistry* extreg;
13042 const char* unknown; // Start of unknown data, preserve at buffer flip
13043 upb_Message* unknown_msg; // Pointer to preserve data to
13044 int depth; // Tracks recursion depth to bound stack usage.
13045 uint32_t end_group; // field number of END_GROUP tag, else DECODE_NOGROUP.
Joshua Habermand3995ec2022-09-30 16:54:39 -070013046 uint16_t options;
13047 bool missing_required;
Joshua Habermand3995ec2022-09-30 16:54:39 -070013048 upb_Arena arena;
Mike Kruskal232ecf42023-01-14 00:09:40 -080013049 upb_DecodeStatus status;
Joshua Habermand3995ec2022-09-30 16:54:39 -070013050 jmp_buf err;
13051
13052#ifndef NDEBUG
13053 const char* debug_tagstart;
13054 const char* debug_valstart;
13055#endif
13056} upb_Decoder;
13057
13058/* Error function that will abort decoding with longjmp(). We can't declare this
13059 * UPB_NORETURN, even though it is appropriate, because if we do then compilers
13060 * will "helpfully" refuse to tailcall to it
13061 * (see: https://stackoverflow.com/a/55657013), which will defeat a major goal
13062 * of our optimizations. That is also why we must declare it in a separate file,
13063 * otherwise the compiler will see that it calls longjmp() and deduce that it is
13064 * noreturn. */
13065const char* _upb_FastDecoder_ErrorJmp(upb_Decoder* d, int status);
13066
13067extern const uint8_t upb_utf8_offsets[];
13068
13069UPB_INLINE
13070bool _upb_Decoder_VerifyUtf8Inline(const char* ptr, int len) {
13071 const char* end = ptr + len;
13072
13073 // Check 8 bytes at a time for any non-ASCII char.
13074 while (end - ptr >= 8) {
13075 uint64_t data;
13076 memcpy(&data, ptr, 8);
13077 if (data & 0x8080808080808080) goto non_ascii;
13078 ptr += 8;
13079 }
13080
13081 // Check one byte at a time for non-ASCII.
13082 while (ptr < end) {
13083 if (*ptr & 0x80) goto non_ascii;
13084 ptr++;
13085 }
13086
13087 return true;
13088
13089non_ascii:
13090 return utf8_range2((const unsigned char*)ptr, end - ptr) == 0;
13091}
13092
13093const char* _upb_Decoder_CheckRequired(upb_Decoder* d, const char* ptr,
13094 const upb_Message* msg,
13095 const upb_MiniTable* l);
13096
13097/* x86-64 pointers always have the high 16 bits matching. So we can shift
13098 * left 8 and right 8 without loss of information. */
13099UPB_INLINE intptr_t decode_totable(const upb_MiniTable* tablep) {
13100 return ((intptr_t)tablep << 8) | tablep->table_mask;
13101}
13102
13103UPB_INLINE const upb_MiniTable* decode_totablep(intptr_t table) {
13104 return (const upb_MiniTable*)(table >> 8);
13105}
13106
Eric Salo10505992022-12-12 12:16:36 -080013107const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e,
13108 const char* ptr, int overrun);
13109
13110UPB_INLINE bool _upb_Decoder_IsDone(upb_Decoder* d, const char** ptr) {
Eric Salob7d54ac2022-12-29 11:59:42 -080013111 return upb_EpsCopyInputStream_IsDoneWithCallback(
13112 &d->input, ptr, &_upb_Decoder_IsDoneFallback);
Joshua Habermand3995ec2022-09-30 16:54:39 -070013113}
13114
Eric Salo10505992022-12-12 12:16:36 -080013115UPB_INLINE const char* _upb_Decoder_BufferFlipCallback(
13116 upb_EpsCopyInputStream* e, const char* old_end, const char* new_start) {
13117 upb_Decoder* d = (upb_Decoder*)e;
13118 if (!old_end) _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed);
Joshua Habermand3995ec2022-09-30 16:54:39 -070013119
Eric Salo10505992022-12-12 12:16:36 -080013120 if (d->unknown) {
13121 if (!_upb_Message_AddUnknown(d->unknown_msg, d->unknown,
13122 old_end - d->unknown, &d->arena)) {
13123 _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory);
13124 }
13125 d->unknown = new_start;
Joshua Habermand3995ec2022-09-30 16:54:39 -070013126 }
Eric Salo10505992022-12-12 12:16:36 -080013127 return new_start;
Joshua Habermand3995ec2022-09-30 16:54:39 -070013128}
13129
13130#if UPB_FASTTABLE
13131UPB_INLINE
13132const char* _upb_FastDecoder_TagDispatch(upb_Decoder* d, const char* ptr,
13133 upb_Message* msg, intptr_t table,
13134 uint64_t hasbits, uint64_t tag) {
13135 const upb_MiniTable* table_p = decode_totablep(table);
13136 uint8_t mask = table;
13137 uint64_t data;
13138 size_t idx = tag & mask;
13139 UPB_ASSUME((idx & 7) == 0);
13140 idx >>= 3;
13141 data = table_p->fasttable[idx].field_data ^ tag;
13142 UPB_MUSTTAIL return table_p->fasttable[idx].field_parser(d, ptr, msg, table,
13143 hasbits, data);
13144}
13145#endif
13146
13147UPB_INLINE uint32_t _upb_FastDecoder_LoadTag(const char* ptr) {
13148 uint16_t tag;
13149 memcpy(&tag, ptr, 2);
13150 return tag;
13151}
13152
Joshua Habermand3995ec2022-09-30 16:54:39 -070013153
Sandy Zhange3b09432023-08-07 09:30:02 -070013154#endif /* UPB_WIRE_INTERNAL_DECODE_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -070013155
Eric Salo8809a112022-11-21 13:01:06 -080013156// This should #undef all macros #defined in def.inc
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013157
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013158#undef UPB_SIZE
13159#undef UPB_PTR_AT
Joshua Habermandd69a482021-05-17 22:40:33 -070013160#undef UPB_MAPTYPE_STRING
Eric Salo3f36a912022-12-05 14:12:25 -080013161#undef UPB_EXPORT
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013162#undef UPB_INLINE
Eric Salo3f36a912022-12-05 14:12:25 -080013163#undef UPB_API
13164#undef UPB_API_INLINE
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013165#undef UPB_ALIGN_UP
13166#undef UPB_ALIGN_DOWN
13167#undef UPB_ALIGN_MALLOC
13168#undef UPB_ALIGN_OF
Joshua Habermand3995ec2022-09-30 16:54:39 -070013169#undef UPB_MALLOC_ALIGN
Joshua Habermandd69a482021-05-17 22:40:33 -070013170#undef UPB_LIKELY
13171#undef UPB_UNLIKELY
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013172#undef UPB_FORCEINLINE
13173#undef UPB_NOINLINE
13174#undef UPB_NORETURN
Joshua Habermandd69a482021-05-17 22:40:33 -070013175#undef UPB_PRINTF
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013176#undef UPB_MAX
13177#undef UPB_MIN
13178#undef UPB_UNUSED
13179#undef UPB_ASSUME
13180#undef UPB_ASSERT
13181#undef UPB_UNREACHABLE
Joshua Habermandd69a482021-05-17 22:40:33 -070013182#undef UPB_SETJMP
13183#undef UPB_LONGJMP
13184#undef UPB_PTRADD
13185#undef UPB_MUSTTAIL
13186#undef UPB_FASTTABLE_SUPPORTED
Mike Kruskal232ecf42023-01-14 00:09:40 -080013187#undef UPB_FASTTABLE_MASK
Joshua Habermandd69a482021-05-17 22:40:33 -070013188#undef UPB_FASTTABLE
13189#undef UPB_FASTTABLE_INIT
Joshua Haberman9abf6e22021-01-13 12:16:25 -080013190#undef UPB_POISON_MEMORY_REGION
13191#undef UPB_UNPOISON_MEMORY_REGION
13192#undef UPB_ASAN
Sandy Zhange3b09432023-08-07 09:30:02 -070013193#undef UPB_ASAN_GUARD_SIZE
13194#undef UPB_CLANG_ASAN
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070013195#undef UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3
Joshua Habermand3995ec2022-09-30 16:54:39 -070013196#undef UPB_DEPRECATED
13197#undef UPB_GNUC_MIN
Mike Kruskal232ecf42023-01-14 00:09:40 -080013198#undef UPB_DESCRIPTOR_UPB_H_FILENAME
13199#undef UPB_DESC
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013200#undef UPB_DESC_MINITABLE
Mike Kruskal232ecf42023-01-14 00:09:40 -080013201#undef UPB_IS_GOOGLE3
Eric Salodfb71552023-03-22 12:35:09 -070013202#undef UPB_ATOMIC
13203#undef UPB_USE_C11_ATOMICS
Deanna Garciac7d979d2023-04-14 17:22:13 -070013204#undef UPB_PRIVATE