blob: a603770efeb6a5d7fd55da7da4618b79c2f0fde4 [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
Protobuf Team Bote2785502023-12-21 21:28:36 +000099#ifdef _MSC_VER
100// Some versions of our Windows compiler don't support the C11 syntax.
101#define UPB_ALIGN_AS(x) __declspec(align(x))
102#else
103#define UPB_ALIGN_AS(x) _Alignas(x)
104#endif
105
Eric Salo8809a112022-11-21 13:01:06 -0800106// Hints to the compiler about likely/unlikely branches.
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800107#if defined (__GNUC__) || defined(__clang__)
Eric Salo8809a112022-11-21 13:01:06 -0800108#define UPB_LIKELY(x) __builtin_expect((bool)(x), 1)
109#define UPB_UNLIKELY(x) __builtin_expect((bool)(x), 0)
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800110#else
111#define UPB_LIKELY(x) (x)
112#define UPB_UNLIKELY(x) (x)
113#endif
114
Eric Salo8809a112022-11-21 13:01:06 -0800115// Macros for function attributes on compilers that support them.
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800116#ifdef __GNUC__
Protobuf Team Bot1d143b52024-01-25 20:29:43 +0000117#define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) static
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800118#define UPB_NOINLINE __attribute__((noinline))
119#define UPB_NORETURN __attribute__((__noreturn__))
120#define UPB_PRINTF(str, first_vararg) __attribute__((format (printf, str, first_vararg)))
121#elif defined(_MSC_VER)
122#define UPB_NOINLINE
Protobuf Team Bot1d143b52024-01-25 20:29:43 +0000123#define UPB_FORCEINLINE static
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800124#define UPB_NORETURN __declspec(noreturn)
125#define UPB_PRINTF(str, first_vararg)
126#else /* !defined(__GNUC__) */
Protobuf Team Bot1d143b52024-01-25 20:29:43 +0000127#define UPB_FORCEINLINE static
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800128#define UPB_NOINLINE
129#define UPB_NORETURN
130#define UPB_PRINTF(str, first_vararg)
131#endif
132
133#define UPB_MAX(x, y) ((x) > (y) ? (x) : (y))
134#define UPB_MIN(x, y) ((x) < (y) ? (x) : (y))
135
136#define UPB_UNUSED(var) (void)var
137
Eric Salo8809a112022-11-21 13:01:06 -0800138// UPB_ASSUME(): in release mode, we tell the compiler to assume this is true.
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800139#ifdef NDEBUG
140#ifdef __GNUC__
141#define UPB_ASSUME(expr) if (!(expr)) __builtin_unreachable()
142#elif defined _MSC_VER
143#define UPB_ASSUME(expr) if (!(expr)) __assume(0)
144#else
145#define UPB_ASSUME(expr) do {} while (false && (expr))
146#endif
147#else
148#define UPB_ASSUME(expr) assert(expr)
149#endif
150
151/* UPB_ASSERT(): in release mode, we use the expression without letting it be
152 * evaluated. This prevents "unused variable" warnings. */
153#ifdef NDEBUG
154#define UPB_ASSERT(expr) do {} while (false && (expr))
155#else
156#define UPB_ASSERT(expr) assert(expr)
157#endif
158
159#if defined(__GNUC__) || defined(__clang__)
160#define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0)
Eric Salo10505992022-12-12 12:16:36 -0800161#elif defined(_MSC_VER)
162#define UPB_UNREACHABLE() \
163 do { \
164 assert(0); \
165 __assume(0); \
166 } while (0)
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800167#else
168#define UPB_UNREACHABLE() do { assert(0); } while(0)
169#endif
170
171/* UPB_SETJMP() / UPB_LONGJMP(): avoid setting/restoring signal mask. */
172#ifdef __APPLE__
173#define UPB_SETJMP(buf) _setjmp(buf)
174#define UPB_LONGJMP(buf, val) _longjmp(buf, val)
175#else
176#define UPB_SETJMP(buf) setjmp(buf)
177#define UPB_LONGJMP(buf, val) longjmp(buf, val)
178#endif
179
Eric Salodfb71552023-03-22 12:35:09 -0700180#ifdef __GNUC__
181#define UPB_USE_C11_ATOMICS
Deanna Garciac7d979d2023-04-14 17:22:13 -0700182#define UPB_ATOMIC(T) _Atomic(T)
Eric Salodfb71552023-03-22 12:35:09 -0700183#else
Deanna Garciac7d979d2023-04-14 17:22:13 -0700184#define UPB_ATOMIC(T) T
Eric Salodfb71552023-03-22 12:35:09 -0700185#endif
186
Joshua Habermandd69a482021-05-17 22:40:33 -0700187/* UPB_PTRADD(ptr, ofs): add pointer while avoiding "NULL + 0" UB */
188#define UPB_PTRADD(ptr, ofs) ((ofs) ? (ptr) + (ofs) : (ptr))
189
Deanna Garciac7d979d2023-04-14 17:22:13 -0700190#define UPB_PRIVATE(x) x##_dont_copy_me__upb_internal_use_only
191
Protobuf Team Bot07194fc2023-11-30 05:43:03 +0000192#ifdef UPB_ALLOW_PRIVATE_ACCESS__FOR_BITS_ONLY
193#define UPB_ONLYBITS(x) x
194#else
195#define UPB_ONLYBITS(x) UPB_PRIVATE(x)
196#endif
197
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800198/* Configure whether fasttable is switched on or not. *************************/
199
Joshua Habermandd69a482021-05-17 22:40:33 -0700200#ifdef __has_attribute
201#define UPB_HAS_ATTRIBUTE(x) __has_attribute(x)
202#else
203#define UPB_HAS_ATTRIBUTE(x) 0
204#endif
205
206#if UPB_HAS_ATTRIBUTE(musttail)
207#define UPB_MUSTTAIL __attribute__((musttail))
208#else
209#define UPB_MUSTTAIL
210#endif
211
212#undef UPB_HAS_ATTRIBUTE
213
214/* This check is not fully robust: it does not require that we have "musttail"
215 * support available. We need tail calls to avoid consuming arbitrary amounts
216 * of stack space.
217 *
218 * GCC/Clang can mostly be trusted to generate tail calls as long as
219 * optimization is enabled, but, debug builds will not generate tail calls
220 * unless "musttail" is available.
221 *
222 * We should probably either:
223 * 1. require that the compiler supports musttail.
224 * 2. add some fallback code for when musttail isn't available (ie. return
225 * instead of tail calling). This is safe and portable, but this comes at
226 * a CPU cost.
227 */
228#if (defined(__x86_64__) || defined(__aarch64__)) && defined(__GNUC__)
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800229#define UPB_FASTTABLE_SUPPORTED 1
230#else
231#define UPB_FASTTABLE_SUPPORTED 0
232#endif
233
234/* define UPB_ENABLE_FASTTABLE to force fast table support.
235 * This is useful when we want to ensure we are really getting fasttable,
236 * for example for testing or benchmarking. */
237#if defined(UPB_ENABLE_FASTTABLE)
238#if !UPB_FASTTABLE_SUPPORTED
Joshua Habermandd69a482021-05-17 22:40:33 -0700239#error fasttable is x86-64/ARM64 only and requires GCC or Clang.
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800240#endif
241#define UPB_FASTTABLE 1
242/* Define UPB_TRY_ENABLE_FASTTABLE to use fasttable if possible.
243 * This is useful for releasing code that might be used on multiple platforms,
244 * for example the PHP or Ruby C extensions. */
245#elif defined(UPB_TRY_ENABLE_FASTTABLE)
246#define UPB_FASTTABLE UPB_FASTTABLE_SUPPORTED
247#else
248#define UPB_FASTTABLE 0
249#endif
250
251/* UPB_FASTTABLE_INIT() allows protos compiled for fasttable to gracefully
Mike Kruskal232ecf42023-01-14 00:09:40 -0800252 * degrade to non-fasttable if the runtime or platform do not support it. */
253#if !UPB_FASTTABLE
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800254#define UPB_FASTTABLE_INIT(...)
Mike Kruskal232ecf42023-01-14 00:09:40 -0800255#define UPB_FASTTABLE_MASK(mask) -1
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800256#else
257#define UPB_FASTTABLE_INIT(...) __VA_ARGS__
Mike Kruskal232ecf42023-01-14 00:09:40 -0800258#define UPB_FASTTABLE_MASK(mask) mask
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800259#endif
260
261#undef UPB_FASTTABLE_SUPPORTED
262
Joshua Habermand3995ec2022-09-30 16:54:39 -0700263/* ASAN poisoning (for arena).
264 * If using UPB from an interpreted language like Ruby, a build of the
Joshua Haberman488b8b92022-09-30 18:07:16 -0700265 * interpreter compiled with ASAN enabled must be used in order to get sane and
Joshua Habermand3995ec2022-09-30 16:54:39 -0700266 * expected behavior.
267 */
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800268
Sandy Zhange3b09432023-08-07 09:30:02 -0700269/* Due to preprocessor limitations, the conditional logic for setting
270 * UPN_CLANG_ASAN below cannot be consolidated into a portable one-liner.
271 * See https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html.
272 */
273#if defined(__has_feature)
274#if __has_feature(address_sanitizer)
275#define UPB_CLANG_ASAN 1
276#else
277#define UPB_CLANG_ASAN 0
278#endif
279#else
280#define UPB_CLANG_ASAN 0
281#endif
282
283#if defined(__SANITIZE_ADDRESS__) || UPB_CLANG_ASAN
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800284#define UPB_ASAN 1
Sandy Zhange3b09432023-08-07 09:30:02 -0700285#define UPB_ASAN_GUARD_SIZE 32
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800286#ifdef __cplusplus
Adam Cozzette7d5592e2023-08-23 12:15:26 -0700287 extern "C" {
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800288#endif
289void __asan_poison_memory_region(void const volatile *addr, size_t size);
290void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
291#ifdef __cplusplus
292} /* extern "C" */
293#endif
294#define UPB_POISON_MEMORY_REGION(addr, size) \
295 __asan_poison_memory_region((addr), (size))
296#define UPB_UNPOISON_MEMORY_REGION(addr, size) \
297 __asan_unpoison_memory_region((addr), (size))
298#else
299#define UPB_ASAN 0
Sandy Zhange3b09432023-08-07 09:30:02 -0700300#define UPB_ASAN_GUARD_SIZE 0
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800301#define UPB_POISON_MEMORY_REGION(addr, size) \
302 ((void)(addr), (void)(size))
303#define UPB_UNPOISON_MEMORY_REGION(addr, size) \
304 ((void)(addr), (void)(size))
Joshua Habermandd69a482021-05-17 22:40:33 -0700305#endif
306
Joshua Haberman7ecf43f2022-03-14 13:11:29 -0700307/* Disable proto2 arena behavior (TEMPORARY) **********************************/
308
309#ifdef UPB_DISABLE_PROTO2_ENUM_CHECKING
310#define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 1
311#else
312#define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 0
313#endif
314
Joshua Habermand3995ec2022-09-30 16:54:39 -0700315#if defined(__cplusplus)
316#if defined(__clang__) || UPB_GNUC_MIN(6, 0)
317// https://gcc.gnu.org/gcc-6/changes.html
318#if __cplusplus >= 201402L
319#define UPB_DEPRECATED [[deprecated]]
320#else
321#define UPB_DEPRECATED __attribute__((deprecated))
322#endif
323#else
324#define UPB_DEPRECATED
325#endif
326#else
327#define UPB_DEPRECATED
328#endif
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800329
Mike Kruskal232ecf42023-01-14 00:09:40 -0800330// begin:google_only
331// #define UPB_IS_GOOGLE3
332// end:google_only
333
334#if defined(UPB_IS_GOOGLE3) && !defined(UPB_BOOTSTRAP_STAGE0)
335#define UPB_DESC(sym) proto2_##sym
Protobuf Team Botce9dcc22023-11-03 22:38:26 +0000336#define UPB_DESC_MINITABLE(sym) &proto2__##sym##_msg_init
337#elif defined(UPB_BOOTSTRAP_STAGE0)
338#define UPB_DESC(sym) google_protobuf_##sym
339#define UPB_DESC_MINITABLE(sym) google__protobuf__##sym##_msg_init()
Mike Kruskal232ecf42023-01-14 00:09:40 -0800340#else
341#define UPB_DESC(sym) google_protobuf_##sym
Protobuf Team Botce9dcc22023-11-03 22:38:26 +0000342#define UPB_DESC_MINITABLE(sym) &google__protobuf__##sym##_msg_init
Mike Kruskal232ecf42023-01-14 00:09:40 -0800343#endif
344
Protobuf Team Bot5d58cb82024-03-06 19:59:18 +0000345#ifdef UPB_TRACING_ENABLED
346#ifdef NDEBUG
347error UPB_TRACING_ENABLED Tracing should be disabled in production builds
348#endif
349#endif
350
Eric Salo8809a112022-11-21 13:01:06 -0800351#ifndef UPB_BASE_STATUS_H_
352#define UPB_BASE_STATUS_H_
353
354#include <stdarg.h>
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700355
356// Must be last.
357
Protobuf Team Botb931e792024-01-31 21:16:11 +0000358#define _kUpb_Status_MaxMessage 511
Eric Salo8809a112022-11-21 13:01:06 -0800359
360typedef struct {
361 bool ok;
362 char msg[_kUpb_Status_MaxMessage]; // Error message; NULL-terminated.
363} upb_Status;
364
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700365#ifdef __cplusplus
366extern "C" {
367#endif
368
Eric Salo3f36a912022-12-05 14:12:25 -0800369UPB_API const char* upb_Status_ErrorMessage(const upb_Status* status);
370UPB_API bool upb_Status_IsOk(const upb_Status* status);
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700371
Eric Salo8809a112022-11-21 13:01:06 -0800372// These are no-op if |status| is NULL.
Eric Salo3f36a912022-12-05 14:12:25 -0800373UPB_API void upb_Status_Clear(upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -0800374void upb_Status_SetErrorMessage(upb_Status* status, const char* msg);
375void upb_Status_SetErrorFormat(upb_Status* status, const char* fmt, ...)
376 UPB_PRINTF(2, 3);
377void upb_Status_VSetErrorFormat(upb_Status* status, const char* fmt,
378 va_list args) UPB_PRINTF(2, 0);
379void upb_Status_VAppendErrorFormat(upb_Status* status, const char* fmt,
380 va_list args) UPB_PRINTF(2, 0);
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700381
382#ifdef __cplusplus
383} /* extern "C" */
384#endif
385
386
Eric Salo8809a112022-11-21 13:01:06 -0800387#endif /* UPB_BASE_STATUS_H_ */
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700388
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000389#ifndef UPB_GENERATED_CODE_SUPPORT_H_
390#define UPB_GENERATED_CODE_SUPPORT_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -0700391
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000392// IWYU pragma: begin_exports
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800393
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +0000394#ifndef UPB_BASE_UPCAST_H_
395#define UPB_BASE_UPCAST_H_
396
397// Must be last.
398
399// This macro provides a way to upcast message pointers in a way that is
400// somewhat more bulletproof than blindly casting a pointer. Example:
401//
402// typedef struct {
403// upb_Message UPB_PRIVATE(base);
404// } pkg_FooMessage;
405//
406// void f(pkg_FooMessage* msg) {
407// upb_Decode(UPB_UPCAST(msg), ...);
408// }
409
410#define UPB_UPCAST(x) (&(x)->base##_dont_copy_me__upb_internal_use_only)
411
412
413#endif /* UPB_BASE_UPCAST_H_ */
414
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000415#ifndef UPB_MESSAGE_ACCESSORS_H_
416#define UPB_MESSAGE_ACCESSORS_H_
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000417
Protobuf Team Bot54573a42023-11-21 14:47:34 +0000418#include <stddef.h>
419#include <stdint.h>
420#include <string.h>
421
Joshua Habermand3995ec2022-09-30 16:54:39 -0700422
Eric Salo8809a112022-11-21 13:01:06 -0800423#ifndef UPB_BASE_DESCRIPTOR_CONSTANTS_H_
424#define UPB_BASE_DESCRIPTOR_CONSTANTS_H_
425
Eric Salodfb71552023-03-22 12:35:09 -0700426// Must be last.
427
Eric Salo8809a112022-11-21 13:01:06 -0800428// The types a field can have. Note that this list is not identical to the
429// types defined in descriptor.proto, which gives INT32 and SINT32 separate
430// types (we distinguish the two with the "integer encoding" enum below).
431// This enum is an internal convenience only and has no meaning outside of upb.
432typedef enum {
433 kUpb_CType_Bool = 1,
434 kUpb_CType_Float = 2,
435 kUpb_CType_Int32 = 3,
436 kUpb_CType_UInt32 = 4,
Protobuf Team Bot986cbb62023-09-19 15:03:51 +0000437 kUpb_CType_Enum = 5, // Enum values are int32. TODO: rename
Eric Salo8809a112022-11-21 13:01:06 -0800438 kUpb_CType_Message = 6,
439 kUpb_CType_Double = 7,
440 kUpb_CType_Int64 = 8,
441 kUpb_CType_UInt64 = 9,
442 kUpb_CType_String = 10,
443 kUpb_CType_Bytes = 11
444} upb_CType;
445
446// The repeated-ness of each field; this matches descriptor.proto.
447typedef enum {
448 kUpb_Label_Optional = 1,
449 kUpb_Label_Required = 2,
450 kUpb_Label_Repeated = 3
451} upb_Label;
452
453// Descriptor types, as defined in descriptor.proto.
454typedef enum {
455 kUpb_FieldType_Double = 1,
456 kUpb_FieldType_Float = 2,
457 kUpb_FieldType_Int64 = 3,
458 kUpb_FieldType_UInt64 = 4,
459 kUpb_FieldType_Int32 = 5,
460 kUpb_FieldType_Fixed64 = 6,
461 kUpb_FieldType_Fixed32 = 7,
462 kUpb_FieldType_Bool = 8,
463 kUpb_FieldType_String = 9,
464 kUpb_FieldType_Group = 10,
465 kUpb_FieldType_Message = 11,
466 kUpb_FieldType_Bytes = 12,
467 kUpb_FieldType_UInt32 = 13,
468 kUpb_FieldType_Enum = 14,
469 kUpb_FieldType_SFixed32 = 15,
470 kUpb_FieldType_SFixed64 = 16,
471 kUpb_FieldType_SInt32 = 17,
472 kUpb_FieldType_SInt64 = 18,
473} upb_FieldType;
474
475#define kUpb_FieldType_SizeOf 19
476
Eric Salodfb71552023-03-22 12:35:09 -0700477#ifdef __cplusplus
478extern "C" {
479#endif
480
Protobuf Team Bot7c687212023-11-14 03:01:42 +0000481// Convert from upb_FieldType to upb_CType
482UPB_INLINE upb_CType upb_FieldType_CType(upb_FieldType field_type) {
483 static const upb_CType c_type[] = {
484 kUpb_CType_Double, // kUpb_FieldType_Double
485 kUpb_CType_Float, // kUpb_FieldType_Float
486 kUpb_CType_Int64, // kUpb_FieldType_Int64
487 kUpb_CType_UInt64, // kUpb_FieldType_UInt64
488 kUpb_CType_Int32, // kUpb_FieldType_Int32
489 kUpb_CType_UInt64, // kUpb_FieldType_Fixed64
490 kUpb_CType_UInt32, // kUpb_FieldType_Fixed32
491 kUpb_CType_Bool, // kUpb_FieldType_Bool
492 kUpb_CType_String, // kUpb_FieldType_String
493 kUpb_CType_Message, // kUpb_FieldType_Group
494 kUpb_CType_Message, // kUpb_FieldType_Message
495 kUpb_CType_Bytes, // kUpb_FieldType_Bytes
496 kUpb_CType_UInt32, // kUpb_FieldType_UInt32
497 kUpb_CType_Enum, // kUpb_FieldType_Enum
498 kUpb_CType_Int32, // kUpb_FieldType_SFixed32
499 kUpb_CType_Int64, // kUpb_FieldType_SFixed64
500 kUpb_CType_Int32, // kUpb_FieldType_SInt32
501 kUpb_CType_Int64, // kUpb_FieldType_SInt64
502 };
503
504 // -1 here because the enum is one-based but the table is zero-based.
505 return c_type[field_type - 1];
506}
507
508UPB_INLINE bool upb_FieldType_IsPackable(upb_FieldType field_type) {
Eric Salodfb71552023-03-22 12:35:09 -0700509 // clang-format off
510 const unsigned kUnpackableTypes =
511 (1 << kUpb_FieldType_String) |
512 (1 << kUpb_FieldType_Bytes) |
513 (1 << kUpb_FieldType_Message) |
514 (1 << kUpb_FieldType_Group);
515 // clang-format on
Protobuf Team Bot7c687212023-11-14 03:01:42 +0000516 return (1 << field_type) & ~kUnpackableTypes;
Eric Salodfb71552023-03-22 12:35:09 -0700517}
518
519#ifdef __cplusplus
520} /* extern "C" */
521#endif
522
523
Eric Salo8809a112022-11-21 13:01:06 -0800524#endif /* UPB_BASE_DESCRIPTOR_CONSTANTS_H_ */
Protobuf Team Bot54573a42023-11-21 14:47:34 +0000525#ifndef UPB_BASE_STRING_VIEW_H_
526#define UPB_BASE_STRING_VIEW_H_
Eric Salo8809a112022-11-21 13:01:06 -0800527
Protobuf Team Bot54573a42023-11-21 14:47:34 +0000528#include <string.h>
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000529
Protobuf Team Bot54573a42023-11-21 14:47:34 +0000530// Must be last.
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000531
Protobuf Team Bot54573a42023-11-21 14:47:34 +0000532#define UPB_STRINGVIEW_INIT(ptr, len) \
533 { ptr, len }
534
535#define UPB_STRINGVIEW_FORMAT "%.*s"
536#define UPB_STRINGVIEW_ARGS(view) (int)(view).size, (view).data
537
538// LINT.IfChange(struct_definition)
539typedef struct {
540 const char* data;
541 size_t size;
542} upb_StringView;
Protobuf Team Bot54573a42023-11-21 14:47:34 +0000543
544#ifdef __cplusplus
545extern "C" {
546#endif
547
548UPB_API_INLINE upb_StringView upb_StringView_FromDataAndSize(const char* data,
549 size_t size) {
550 upb_StringView ret;
551 ret.data = data;
552 ret.size = size;
553 return ret;
554}
555
556UPB_INLINE upb_StringView upb_StringView_FromString(const char* data) {
557 return upb_StringView_FromDataAndSize(data, strlen(data));
558}
559
560UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) {
Protobuf Team Botddc54062023-12-12 20:03:38 +0000561 return (a.size == b.size) && (!a.size || !memcmp(a.data, b.data, a.size));
Protobuf Team Bot54573a42023-11-21 14:47:34 +0000562}
563
Protobuf Team Bot030ab8d2023-12-01 19:20:11 +0000564// LINT.ThenChange(
Protobuf Team Botfd82df72024-01-29 20:24:42 +0000565// GoogleInternalName1,
Protobuf Team Bot030ab8d2023-12-01 19:20:11 +0000566// //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string,
567// //depot/google3/third_party/upb/bits/typescript/string_view.ts
568// )
569
Protobuf Team Bot54573a42023-11-21 14:47:34 +0000570#ifdef __cplusplus
571} /* extern "C" */
572#endif
573
574
575#endif /* UPB_BASE_STRING_VIEW_H_ */
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000576
Eric Salo8809a112022-11-21 13:01:06 -0800577/* upb_Arena is a specific allocator implementation that uses arena allocation.
578 * The user provides an allocator that will be used to allocate the underlying
579 * arena blocks. Arenas by nature do not require the individual allocations
580 * to be freed. However the Arena does allow users to register cleanup
581 * functions that will run when the arena is destroyed.
Joshua Habermandd69a482021-05-17 22:40:33 -0700582 *
Eric Salo8809a112022-11-21 13:01:06 -0800583 * A upb_Arena is *not* thread-safe.
584 *
585 * You could write a thread-safe arena allocator that satisfies the
586 * upb_alloc interface, but it would not be as efficient for the
587 * single-threaded case. */
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800588
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700589#ifndef UPB_MEM_ARENA_H_
590#define UPB_MEM_ARENA_H_
Joshua Habermandd69a482021-05-17 22:40:33 -0700591
Adam Cozzette7d5592e2023-08-23 12:15:26 -0700592#include <stddef.h>
593#include <stdint.h>
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800594
595
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700596#ifndef UPB_MEM_ALLOC_H_
597#define UPB_MEM_ALLOC_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -0700598
599// Must be last.
600
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800601#ifdef __cplusplus
602extern "C" {
603#endif
604
Joshua Habermand3995ec2022-09-30 16:54:39 -0700605typedef struct upb_alloc upb_alloc;
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800606
Joshua Habermand3995ec2022-09-30 16:54:39 -0700607/* A combined `malloc()`/`free()` function.
608 * If `size` is 0 then the function acts like `free()`, otherwise it acts like
609 * `realloc()`. Only `oldsize` bytes from a previous allocation are
610 * preserved. */
611typedef void* upb_alloc_func(upb_alloc* alloc, void* ptr, size_t oldsize,
612 size_t size);
613
614/* A upb_alloc is a possibly-stateful allocator object.
615 *
616 * It could either be an arena allocator (which doesn't require individual
617 * `free()` calls) or a regular `malloc()` (which does). The client must
618 * therefore free memory unless it knows that the allocator is an arena
619 * allocator. */
620struct upb_alloc {
621 upb_alloc_func* func;
622};
623
624UPB_INLINE void* upb_malloc(upb_alloc* alloc, size_t size) {
625 UPB_ASSERT(alloc);
626 return alloc->func(alloc, NULL, 0, size);
627}
628
629UPB_INLINE void* upb_realloc(upb_alloc* alloc, void* ptr, size_t oldsize,
630 size_t size) {
631 UPB_ASSERT(alloc);
632 return alloc->func(alloc, ptr, oldsize, size);
633}
634
635UPB_INLINE void upb_free(upb_alloc* alloc, void* ptr) {
636 UPB_ASSERT(alloc);
637 alloc->func(alloc, ptr, 0, 0);
638}
639
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700640// The global allocator used by upb. Uses the standard malloc()/free().
Joshua Habermand3995ec2022-09-30 16:54:39 -0700641
642extern upb_alloc upb_alloc_global;
643
644/* Functions that hard-code the global malloc.
645 *
646 * We still get benefit because we can put custom logic into our global
647 * allocator, like injecting out-of-memory faults in debug/testing builds. */
648
649UPB_INLINE void* upb_gmalloc(size_t size) {
650 return upb_malloc(&upb_alloc_global, size);
651}
652
653UPB_INLINE void* upb_grealloc(void* ptr, size_t oldsize, size_t size) {
654 return upb_realloc(&upb_alloc_global, ptr, oldsize, size);
655}
656
657UPB_INLINE void upb_gfree(void* ptr) { upb_free(&upb_alloc_global, ptr); }
658
659#ifdef __cplusplus
660} /* extern "C" */
661#endif
662
663
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700664#endif /* UPB_MEM_ALLOC_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -0700665
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000666#ifndef UPB_MEM_INTERNAL_ARENA_H_
667#define UPB_MEM_INTERNAL_ARENA_H_
668
669#include <stddef.h>
670#include <stdint.h>
671#include <string.h>
672
673// Must be last.
674
675// This is QUITE an ugly hack, which specifies the number of pointers needed
676// to equal (or exceed) the storage required for one upb_Arena.
677//
678// We need this because the decoder inlines a upb_Arena for performance but
679// the full struct is not visible outside of arena.c. Yes, I know, it's awful.
680#define UPB_ARENA_SIZE_HACK 7
681
Protobuf Team Bot6964e2c2023-12-21 15:42:16 +0000682// LINT.IfChange(upb_Arena)
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000683
684struct upb_Arena {
685 char* UPB_ONLYBITS(ptr);
686 char* UPB_ONLYBITS(end);
687};
688
Protobuf Team Bot6964e2c2023-12-21 15:42:16 +0000689// LINT.ThenChange(//depot/google3/third_party/upb/bits/typescript/arena.ts:upb_Arena)
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000690
691#ifdef __cplusplus
692extern "C" {
693#endif
694
695void UPB_PRIVATE(_upb_Arena_SwapIn)(struct upb_Arena* des,
696 const struct upb_Arena* src);
697void UPB_PRIVATE(_upb_Arena_SwapOut)(struct upb_Arena* des,
698 const struct upb_Arena* src);
699
Protobuf Team Bot56409302024-02-12 16:52:47 +0000700// Returns whether |ptr| was allocated directly by |a| (so care must be used
701// with fused arenas).
702UPB_API bool UPB_ONLYBITS(_upb_Arena_Contains)(const struct upb_Arena* a,
703 void* ptr);
704
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000705UPB_INLINE size_t UPB_PRIVATE(_upb_ArenaHas)(const struct upb_Arena* a) {
706 return (size_t)(a->UPB_ONLYBITS(end) - a->UPB_ONLYBITS(ptr));
707}
708
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000709UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size) {
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000710 void* UPB_PRIVATE(_upb_Arena_SlowMalloc)(struct upb_Arena * a, size_t size);
711
712 size = UPB_ALIGN_MALLOC(size);
713 const size_t span = size + UPB_ASAN_GUARD_SIZE;
714 if (UPB_UNLIKELY(UPB_PRIVATE(_upb_ArenaHas)(a) < span)) {
715 return UPB_PRIVATE(_upb_Arena_SlowMalloc)(a, span);
716 }
717
718 // We have enough space to do a fast malloc.
719 void* ret = a->UPB_ONLYBITS(ptr);
720 UPB_ASSERT(UPB_ALIGN_MALLOC((uintptr_t)ret) == (uintptr_t)ret);
721 UPB_ASSERT(UPB_ALIGN_MALLOC(size) == size);
722 UPB_UNPOISON_MEMORY_REGION(ret, size);
723
724 a->UPB_ONLYBITS(ptr) += span;
725
726 return ret;
727}
728
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000729UPB_API_INLINE void* upb_Arena_Realloc(struct upb_Arena* a, void* ptr,
730 size_t oldsize, size_t size) {
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000731 oldsize = UPB_ALIGN_MALLOC(oldsize);
732 size = UPB_ALIGN_MALLOC(size);
733 bool is_most_recent_alloc =
734 (uintptr_t)ptr + oldsize == (uintptr_t)a->UPB_ONLYBITS(ptr);
735
736 if (is_most_recent_alloc) {
737 ptrdiff_t diff = size - oldsize;
738 if ((ptrdiff_t)UPB_PRIVATE(_upb_ArenaHas)(a) >= diff) {
739 a->UPB_ONLYBITS(ptr) += diff;
740 return ptr;
741 }
742 } else if (size <= oldsize) {
743 return ptr;
744 }
745
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000746 void* ret = upb_Arena_Malloc(a, size);
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000747
748 if (ret && oldsize > 0) {
749 memcpy(ret, ptr, UPB_MIN(oldsize, size));
750 }
751
752 return ret;
753}
754
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000755UPB_API_INLINE void upb_Arena_ShrinkLast(struct upb_Arena* a, void* ptr,
756 size_t oldsize, size_t size) {
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000757 oldsize = UPB_ALIGN_MALLOC(oldsize);
758 size = UPB_ALIGN_MALLOC(size);
759 // Must be the last alloc.
760 UPB_ASSERT((char*)ptr + oldsize ==
761 a->UPB_ONLYBITS(ptr) - UPB_ASAN_GUARD_SIZE);
762 UPB_ASSERT(size <= oldsize);
763 a->UPB_ONLYBITS(ptr) = (char*)ptr + size;
764}
765
766#ifdef __cplusplus
767} /* extern "C" */
768#endif
769
770
771#endif /* UPB_MEM_INTERNAL_ARENA_H_ */
772
Joshua Habermand3995ec2022-09-30 16:54:39 -0700773// Must be last.
774
Joshua Habermand3995ec2022-09-30 16:54:39 -0700775typedef struct upb_Arena upb_Arena;
Joshua Haberman9abf6e22021-01-13 12:16:25 -0800776
Eric Salo8809a112022-11-21 13:01:06 -0800777#ifdef __cplusplus
778extern "C" {
779#endif
780
Mike Kruskal3bc50492022-12-01 13:34:12 -0800781// Creates an arena from the given initial block (if any -- n may be 0).
782// Additional blocks will be allocated from |alloc|. If |alloc| is NULL, this
783// is a fixed-size arena and cannot grow.
Eric Salo3f36a912022-12-05 14:12:25 -0800784UPB_API upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc);
Mike Kruskal3bc50492022-12-01 13:34:12 -0800785
Eric Salo3f36a912022-12-05 14:12:25 -0800786UPB_API void upb_Arena_Free(upb_Arena* a);
Eric Salo3f36a912022-12-05 14:12:25 -0800787UPB_API bool upb_Arena_Fuse(upb_Arena* a, upb_Arena* b);
788
Protobuf Team Bot3d597c22023-12-13 04:04:17 +0000789bool upb_Arena_IncRefFor(upb_Arena* a, const void* owner);
790void upb_Arena_DecRefFor(upb_Arena* a, const void* owner);
Protobuf Team Bot777d6a92023-10-06 23:52:49 +0000791
Protobuf Team Bota3c33a82024-02-13 21:14:13 +0000792size_t upb_Arena_SpaceAllocated(upb_Arena* a, size_t* fused_count);
Protobuf Team Bot3d597c22023-12-13 04:04:17 +0000793uint32_t upb_Arena_DebugRefCount(upb_Arena* a);
794
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000795UPB_API_INLINE upb_Arena* upb_Arena_New(void) {
796 return upb_Arena_Init(NULL, 0, &upb_alloc_global);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700797}
798
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000799UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size);
Eric Salo8809a112022-11-21 13:01:06 -0800800
Protobuf Team Botf75fe9e2023-12-19 22:41:49 +0000801UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize,
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000802 size_t size);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700803
Joshua Habermand3995ec2022-09-30 16:54:39 -0700804// Shrinks the last alloc from arena.
805// REQUIRES: (ptr, oldsize) was the last malloc/realloc from this arena.
806// We could also add a upb_Arena_TryShrinkLast() which is simply a no-op if
807// this was not the last alloc.
Eric Salo3f36a912022-12-05 14:12:25 -0800808UPB_API_INLINE void upb_Arena_ShrinkLast(upb_Arena* a, void* ptr,
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000809 size_t oldsize, size_t size);
Joshua Habermand3995ec2022-09-30 16:54:39 -0700810
811#ifdef __cplusplus
812} /* extern "C" */
813#endif
814
815
Mike Kruskal9cf9db82022-11-04 21:22:31 -0700816#endif /* UPB_MEM_ARENA_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -0700817
Protobuf Team Bot54573a42023-11-21 14:47:34 +0000818#ifndef UPB_MESSAGE_ARRAY_H_
819#define UPB_MESSAGE_ARRAY_H_
820
821#include <stddef.h>
822
823
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000824#ifndef UPB_MESSAGE_INTERNAL_ARRAY_H_
825#define UPB_MESSAGE_INTERNAL_ARRAY_H_
826
827#include <stdint.h>
828#include <string.h>
829
830
831// Must be last.
832
833#define _UPB_ARRAY_MASK_IMM 0x4 // Frozen/immutable bit.
834#define _UPB_ARRAY_MASK_LG2 0x3 // Encoded elem size.
835#define _UPB_ARRAY_MASK_ALL (_UPB_ARRAY_MASK_IMM | _UPB_ARRAY_MASK_LG2)
836
837#ifdef __cplusplus
838extern "C" {
839#endif
840
Protobuf Team Botfd82df72024-01-29 20:24:42 +0000841// LINT.IfChange(upb_Array)
842
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000843// Our internal representation for repeated fields.
844struct upb_Array {
845 // This is a tagged pointer. Bits #0 and #1 encode the elem size as follows:
846 // 0 maps to elem size 1
847 // 1 maps to elem size 4
848 // 2 maps to elem size 8
849 // 3 maps to elem size 16
850 //
Protobuf Team Bot886a0b12024-01-26 21:23:01 +0000851 // Bit #2 contains the frozen/immutable flag.
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000852 uintptr_t UPB_ONLYBITS(data);
853
854 size_t UPB_ONLYBITS(size); // The number of elements in the array.
855 size_t UPB_PRIVATE(capacity); // Allocated storage. Measured in elements.
856};
857
Protobuf Team Bot886a0b12024-01-26 21:23:01 +0000858UPB_INLINE void UPB_PRIVATE(_upb_Array_ShallowFreeze)(struct upb_Array* arr) {
859 arr->UPB_ONLYBITS(data) |= _UPB_ARRAY_MASK_IMM;
860}
861
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000862UPB_API_INLINE bool upb_Array_IsFrozen(const struct upb_Array* arr) {
Protobuf Team Bot886a0b12024-01-26 21:23:01 +0000863 return (arr->UPB_ONLYBITS(data) & _UPB_ARRAY_MASK_IMM) != 0;
864}
865
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000866UPB_INLINE void UPB_PRIVATE(_upb_Array_SetTaggedPtr)(struct upb_Array* array,
867 void* data, size_t lg2) {
868 UPB_ASSERT(lg2 != 1);
869 UPB_ASSERT(lg2 <= 4);
870 const size_t bits = lg2 - (lg2 != 0);
871 array->UPB_ONLYBITS(data) = (uintptr_t)data | bits;
872}
873
874UPB_INLINE size_t
875UPB_PRIVATE(_upb_Array_ElemSizeLg2)(const struct upb_Array* array) {
876 const size_t bits = array->UPB_ONLYBITS(data) & _UPB_ARRAY_MASK_LG2;
877 const size_t lg2 = bits + (bits != 0);
878 return lg2;
879}
880
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000881UPB_API_INLINE const void* upb_Array_DataPtr(const struct upb_Array* array) {
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000882 UPB_PRIVATE(_upb_Array_ElemSizeLg2)(array); // Check assertions.
883 return (void*)(array->UPB_ONLYBITS(data) & ~(uintptr_t)_UPB_ARRAY_MASK_ALL);
884}
885
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000886UPB_API_INLINE void* upb_Array_MutableDataPtr(struct upb_Array* array) {
887 return (void*)upb_Array_DataPtr(array);
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000888}
889
890UPB_INLINE struct upb_Array* UPB_PRIVATE(_upb_Array_New)(upb_Arena* arena,
891 size_t init_capacity,
892 int elem_size_lg2) {
893 UPB_ASSERT(elem_size_lg2 != 1);
894 UPB_ASSERT(elem_size_lg2 <= 4);
895 const size_t array_size =
896 UPB_ALIGN_UP(sizeof(struct upb_Array), UPB_MALLOC_ALIGN);
897 const size_t bytes = array_size + (init_capacity << elem_size_lg2);
898 struct upb_Array* array = (struct upb_Array*)upb_Arena_Malloc(arena, bytes);
899 if (!array) return NULL;
900 UPB_PRIVATE(_upb_Array_SetTaggedPtr)
901 (array, UPB_PTR_AT(array, array_size, void), elem_size_lg2);
902 array->UPB_ONLYBITS(size) = 0;
903 array->UPB_PRIVATE(capacity) = init_capacity;
904 return array;
905}
906
907// Resizes the capacity of the array to be at least min_size.
908bool UPB_PRIVATE(_upb_Array_Realloc)(struct upb_Array* array, size_t min_size,
909 upb_Arena* arena);
910
911UPB_INLINE bool UPB_PRIVATE(_upb_Array_Reserve)(struct upb_Array* array,
912 size_t size, upb_Arena* arena) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000913 UPB_ASSERT(!upb_Array_IsFrozen(array));
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000914 if (array->UPB_PRIVATE(capacity) < size)
915 return UPB_PRIVATE(_upb_Array_Realloc)(array, size, arena);
916 return true;
917}
918
919// Resize without initializing new elements.
920UPB_INLINE bool UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
921 struct upb_Array* array, size_t size, upb_Arena* arena) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000922 UPB_ASSERT(!upb_Array_IsFrozen(array));
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000923 UPB_ASSERT(size <= array->UPB_ONLYBITS(size) ||
924 arena); // Allow NULL arena when shrinking.
925 if (!UPB_PRIVATE(_upb_Array_Reserve)(array, size, arena)) return false;
926 array->UPB_ONLYBITS(size) = size;
927 return true;
928}
929
930// This function is intended for situations where elem_size is compile-time
931// constant or a known expression of the form (1 << lg2), so that the expression
932// i*elem_size does not result in an actual multiplication.
933UPB_INLINE void UPB_PRIVATE(_upb_Array_Set)(struct upb_Array* array, size_t i,
934 const void* data,
935 size_t elem_size) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000936 UPB_ASSERT(!upb_Array_IsFrozen(array));
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000937 UPB_ASSERT(i < array->UPB_ONLYBITS(size));
938 UPB_ASSERT(elem_size == 1U << UPB_PRIVATE(_upb_Array_ElemSizeLg2)(array));
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000939 char* arr_data = (char*)upb_Array_MutableDataPtr(array);
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000940 memcpy(arr_data + (i * elem_size), data, elem_size);
941}
942
Protobuf Team Botb3878b52024-02-08 21:50:53 +0000943UPB_API_INLINE size_t upb_Array_Size(const struct upb_Array* arr) {
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000944 return arr->UPB_ONLYBITS(size);
945}
946
Protobuf Team Botfd82df72024-01-29 20:24:42 +0000947// LINT.ThenChange(GoogleInternalName0)
Protobuf Team Bot81e54332024-01-11 21:04:07 +0000948
949#ifdef __cplusplus
950} /* extern "C" */
951#endif
952
953#undef _UPB_ARRAY_MASK_IMM
954#undef _UPB_ARRAY_MASK_LG2
955#undef _UPB_ARRAY_MASK_ALL
956
957
958#endif /* UPB_MESSAGE_INTERNAL_ARRAY_H_ */
959
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000960// Users should include array.h or map.h instead.
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +0000961// IWYU pragma: private, include "upb/message/array.h"
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000962
963#ifndef UPB_MESSAGE_VALUE_H_
964#define UPB_MESSAGE_VALUE_H_
965
966#include <stdint.h>
967
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000968
Protobuf Team Bote1253cd2024-01-08 23:09:09 +0000969typedef union {
970 bool bool_val;
971 float float_val;
972 double double_val;
973 int32_t int32_val;
974 int64_t int64_val;
975 uint32_t uint32_val;
976 uint64_t uint64_val;
977 const struct upb_Array* array_val;
978 const struct upb_Map* map_val;
979 const struct upb_Message* msg_val;
980 upb_StringView str_val;
Protobuf Team Bot473d20d2023-09-15 22:27:16 +0000981
Protobuf Team Bote1253cd2024-01-08 23:09:09 +0000982 // EXPERIMENTAL: A tagged upb_Message*. Users must use this instead of
983 // msg_val if unlinked sub-messages may possibly be in use. See the
984 // documentation in kUpb_DecodeOption_ExperimentalAllowUnlinked for more
985 // information.
986 uintptr_t tagged_msg_val; // upb_TaggedMessagePtr
987} upb_MessageValue;
Protobuf Team Bot7c687212023-11-14 03:01:42 +0000988
Protobuf Team Bote1253cd2024-01-08 23:09:09 +0000989typedef union {
990 struct upb_Array* array;
991 struct upb_Map* map;
992 struct upb_Message* msg;
993} upb_MutableMessageValue;
994
995#endif /* UPB_MESSAGE_VALUE_H_ */
Protobuf Team Botdcc1f612023-09-05 21:56:25 +0000996
Protobuf Team Bote1253cd2024-01-08 23:09:09 +0000997#ifndef UPB_MINI_TABLE_FIELD_H_
998#define UPB_MINI_TABLE_FIELD_H_
999
1000#include <stdint.h>
1001
1002
1003#ifndef UPB_MINI_TABLE_INTERNAL_FIELD_H_
1004#define UPB_MINI_TABLE_INTERNAL_FIELD_H_
1005
1006#include <stddef.h>
1007#include <stdint.h>
1008
1009
1010#ifndef UPB_MINI_TABLE_INTERNAL_SIZE_LOG2_H_
1011#define UPB_MINI_TABLE_INTERNAL_SIZE_LOG2_H_
1012
1013#include <stddef.h>
1014#include <stdint.h>
1015
1016
1017// Must be last.
1018
1019#ifdef __cplusplus
1020extern "C" {
1021#endif
1022
1023// Return the log2 of the storage size in bytes for a upb_CType
1024UPB_INLINE int UPB_PRIVATE(_upb_CType_SizeLg2)(upb_CType c_type) {
1025 static const int8_t size[] = {
1026 0, // kUpb_CType_Bool
1027 2, // kUpb_CType_Float
1028 2, // kUpb_CType_Int32
1029 2, // kUpb_CType_UInt32
1030 2, // kUpb_CType_Enum
1031 UPB_SIZE(2, 3), // kUpb_CType_Message
1032 3, // kUpb_CType_Double
1033 3, // kUpb_CType_Int64
1034 3, // kUpb_CType_UInt64
1035 UPB_SIZE(3, 4), // kUpb_CType_String
1036 UPB_SIZE(3, 4), // kUpb_CType_Bytes
1037 };
1038
1039 // -1 here because the enum is one-based but the table is zero-based.
1040 return size[c_type - 1];
1041}
1042
1043// Return the log2 of the storage size in bytes for a upb_FieldType
1044UPB_INLINE int UPB_PRIVATE(_upb_FieldType_SizeLg2)(upb_FieldType field_type) {
1045 static const int8_t size[] = {
1046 3, // kUpb_FieldType_Double
1047 2, // kUpb_FieldType_Float
1048 3, // kUpb_FieldType_Int64
1049 3, // kUpb_FieldType_UInt64
1050 2, // kUpb_FieldType_Int32
1051 3, // kUpb_FieldType_Fixed64
1052 2, // kUpb_FieldType_Fixed32
1053 0, // kUpb_FieldType_Bool
1054 UPB_SIZE(3, 4), // kUpb_FieldType_String
1055 UPB_SIZE(2, 3), // kUpb_FieldType_Group
1056 UPB_SIZE(2, 3), // kUpb_FieldType_Message
1057 UPB_SIZE(3, 4), // kUpb_FieldType_Bytes
1058 2, // kUpb_FieldType_UInt32
1059 2, // kUpb_FieldType_Enum
1060 2, // kUpb_FieldType_SFixed32
1061 3, // kUpb_FieldType_SFixed64
1062 2, // kUpb_FieldType_SInt32
1063 3, // kUpb_FieldType_SInt64
1064 };
1065
1066 // -1 here because the enum is one-based but the table is zero-based.
1067 return size[field_type - 1];
1068}
1069
1070#ifdef __cplusplus
1071} /* extern "C" */
1072#endif
1073
1074
1075#endif /* UPB_MINI_TABLE_INTERNAL_SIZE_LOG2_H_ */
1076
1077// Must be last.
1078
1079// LINT.IfChange(struct_definition)
1080struct upb_MiniTableField {
1081 uint32_t UPB_ONLYBITS(number);
1082 uint16_t UPB_ONLYBITS(offset);
1083 int16_t presence; // If >0, hasbit_index. If <0, ~oneof_index
1084
1085 // Indexes into `upb_MiniTable.subs`
1086 // Will be set to `kUpb_NoSub` if `descriptortype` != MESSAGE/GROUP/ENUM
1087 uint16_t UPB_PRIVATE(submsg_index);
1088
1089 uint8_t UPB_PRIVATE(descriptortype);
1090
1091 // upb_FieldMode | upb_LabelFlags | (upb_FieldRep << kUpb_FieldRep_Shift)
1092 uint8_t UPB_ONLYBITS(mode);
1093};
1094
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001095#define kUpb_NoSub ((uint16_t) - 1)
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001096
1097typedef enum {
1098 kUpb_FieldMode_Map = 0,
1099 kUpb_FieldMode_Array = 1,
1100 kUpb_FieldMode_Scalar = 2,
1101} upb_FieldMode;
1102
1103// Mask to isolate the upb_FieldMode from field.mode.
1104#define kUpb_FieldMode_Mask 3
1105
1106// Extra flags on the mode field.
1107typedef enum {
1108 kUpb_LabelFlags_IsPacked = 4,
1109 kUpb_LabelFlags_IsExtension = 8,
1110 // Indicates that this descriptor type is an "alternate type":
1111 // - for Int32, this indicates that the actual type is Enum (but was
1112 // rewritten to Int32 because it is an open enum that requires no check).
1113 // - for Bytes, this indicates that the actual type is String (but does
1114 // not require any UTF-8 check).
1115 kUpb_LabelFlags_IsAlternate = 16,
1116} upb_LabelFlags;
1117
1118// Note: we sort by this number when calculating layout order.
1119typedef enum {
1120 kUpb_FieldRep_1Byte = 0,
1121 kUpb_FieldRep_4Byte = 1,
1122 kUpb_FieldRep_StringView = 2,
1123 kUpb_FieldRep_8Byte = 3,
1124
1125 kUpb_FieldRep_NativePointer =
1126 UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte),
1127 kUpb_FieldRep_Max = kUpb_FieldRep_8Byte,
1128} upb_FieldRep;
1129
1130#define kUpb_FieldRep_Shift 6
1131
1132#ifdef __cplusplus
1133extern "C" {
1134#endif
1135
1136UPB_INLINE upb_FieldMode
1137UPB_PRIVATE(_upb_MiniTableField_Mode)(const struct upb_MiniTableField* f) {
1138 return (upb_FieldMode)(f->UPB_ONLYBITS(mode) & kUpb_FieldMode_Mask);
1139}
1140
1141UPB_INLINE upb_FieldRep
1142UPB_PRIVATE(_upb_MiniTableField_GetRep)(const struct upb_MiniTableField* f) {
1143 return (upb_FieldRep)(f->UPB_ONLYBITS(mode) >> kUpb_FieldRep_Shift);
1144}
1145
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001146UPB_API_INLINE bool upb_MiniTableField_IsArray(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001147 const struct upb_MiniTableField* f) {
1148 return UPB_PRIVATE(_upb_MiniTableField_Mode)(f) == kUpb_FieldMode_Array;
1149}
1150
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001151UPB_API_INLINE bool upb_MiniTableField_IsMap(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001152 const struct upb_MiniTableField* f) {
1153 return UPB_PRIVATE(_upb_MiniTableField_Mode)(f) == kUpb_FieldMode_Map;
1154}
1155
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001156UPB_API_INLINE bool upb_MiniTableField_IsScalar(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001157 const struct upb_MiniTableField* f) {
1158 return UPB_PRIVATE(_upb_MiniTableField_Mode)(f) == kUpb_FieldMode_Scalar;
1159}
1160
1161UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_IsAlternate)(
1162 const struct upb_MiniTableField* f) {
1163 return (f->UPB_ONLYBITS(mode) & kUpb_LabelFlags_IsAlternate) != 0;
1164}
1165
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001166UPB_API_INLINE bool upb_MiniTableField_IsExtension(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001167 const struct upb_MiniTableField* f) {
1168 return (f->UPB_ONLYBITS(mode) & kUpb_LabelFlags_IsExtension) != 0;
1169}
1170
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001171UPB_API_INLINE bool upb_MiniTableField_IsPacked(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001172 const struct upb_MiniTableField* f) {
1173 return (f->UPB_ONLYBITS(mode) & kUpb_LabelFlags_IsPacked) != 0;
1174}
1175
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001176UPB_API_INLINE upb_FieldType
1177upb_MiniTableField_Type(const struct upb_MiniTableField* f) {
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001178 const upb_FieldType type = (upb_FieldType)f->UPB_PRIVATE(descriptortype);
1179 if (UPB_PRIVATE(_upb_MiniTableField_IsAlternate)(f)) {
1180 if (type == kUpb_FieldType_Int32) return kUpb_FieldType_Enum;
1181 if (type == kUpb_FieldType_Bytes) return kUpb_FieldType_String;
1182 UPB_ASSERT(false);
1183 }
1184 return type;
1185}
1186
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001187UPB_API_INLINE
1188upb_CType upb_MiniTableField_CType(const struct upb_MiniTableField* f) {
1189 return upb_FieldType_CType(upb_MiniTableField_Type(f));
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001190}
1191
1192UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_HasHasbit)(
1193 const struct upb_MiniTableField* f) {
1194 return f->presence > 0;
1195}
1196
1197UPB_INLINE char UPB_PRIVATE(_upb_MiniTableField_HasbitMask)(
1198 const struct upb_MiniTableField* f) {
1199 UPB_ASSERT(UPB_PRIVATE(_upb_MiniTableField_HasHasbit)(f));
1200 const size_t index = f->presence;
1201 return 1 << (index % 8);
1202}
1203
1204UPB_INLINE size_t UPB_PRIVATE(_upb_MiniTableField_HasbitOffset)(
1205 const struct upb_MiniTableField* f) {
1206 UPB_ASSERT(UPB_PRIVATE(_upb_MiniTableField_HasHasbit)(f));
1207 const size_t index = f->presence;
1208 return index / 8;
1209}
1210
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001211UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001212 const struct upb_MiniTableField* f) {
1213 return f->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Enum;
1214}
1215
Protobuf Team Bot89587682024-02-29 17:19:51 +00001216UPB_API_INLINE bool upb_MiniTableField_IsInOneof(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001217 const struct upb_MiniTableField* f) {
1218 return f->presence < 0;
1219}
1220
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001221UPB_API_INLINE bool upb_MiniTableField_IsSubMessage(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001222 const struct upb_MiniTableField* f) {
1223 return f->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Message ||
1224 f->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Group;
1225}
1226
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001227UPB_API_INLINE bool upb_MiniTableField_HasPresence(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001228 const struct upb_MiniTableField* f) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001229 if (upb_MiniTableField_IsExtension(f)) {
1230 return upb_MiniTableField_IsScalar(f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001231 } else {
1232 return f->presence != 0;
1233 }
1234}
1235
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001236UPB_API_INLINE uint32_t
1237upb_MiniTableField_Number(const struct upb_MiniTableField* f) {
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001238 return f->UPB_ONLYBITS(number);
1239}
1240
1241UPB_INLINE uint16_t
1242UPB_PRIVATE(_upb_MiniTableField_Offset)(const struct upb_MiniTableField* f) {
1243 return f->UPB_ONLYBITS(offset);
1244}
1245
1246UPB_INLINE size_t UPB_PRIVATE(_upb_MiniTableField_OneofOffset)(
1247 const struct upb_MiniTableField* f) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001248 UPB_ASSERT(upb_MiniTableField_IsInOneof(f));
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001249 return ~(ptrdiff_t)f->presence;
1250}
1251
1252UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_CheckIsArray)(
1253 const struct upb_MiniTableField* f) {
1254 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(f) ==
1255 kUpb_FieldRep_NativePointer);
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001256 UPB_ASSUME(upb_MiniTableField_IsArray(f));
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001257 UPB_ASSUME(f->presence == 0);
1258}
1259
1260UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_CheckIsMap)(
1261 const struct upb_MiniTableField* f) {
1262 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(f) ==
1263 kUpb_FieldRep_NativePointer);
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001264 UPB_ASSUME(upb_MiniTableField_IsMap(f));
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001265 UPB_ASSUME(f->presence == 0);
1266}
1267
1268UPB_INLINE size_t UPB_PRIVATE(_upb_MiniTableField_ElemSizeLg2)(
1269 const struct upb_MiniTableField* f) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001270 const upb_FieldType field_type = upb_MiniTableField_Type(f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001271 return UPB_PRIVATE(_upb_FieldType_SizeLg2)(field_type);
1272}
1273
1274// LINT.ThenChange(//depot/google3/third_party/upb/bits/typescript/mini_table_field.ts)
1275
1276#ifdef __cplusplus
1277} /* extern "C" */
1278#endif
1279
1280
1281#endif /* UPB_MINI_TABLE_INTERNAL_FIELD_H_ */
1282
1283// Must be last.
1284
1285typedef struct upb_MiniTableField upb_MiniTableField;
1286
1287#ifdef __cplusplus
1288extern "C" {
1289#endif
1290
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001291UPB_API_INLINE upb_CType upb_MiniTableField_CType(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001292
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001293UPB_API_INLINE bool upb_MiniTableField_HasPresence(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001294
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001295UPB_API_INLINE bool upb_MiniTableField_IsArray(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001296
1297UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001298 const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001299
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001300UPB_API_INLINE bool upb_MiniTableField_IsExtension(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001301
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001302UPB_API_INLINE bool upb_MiniTableField_IsInOneof(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001303
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001304UPB_API_INLINE bool upb_MiniTableField_IsMap(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001305
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001306UPB_API_INLINE bool upb_MiniTableField_IsPacked(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001307
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001308UPB_API_INLINE bool upb_MiniTableField_IsScalar(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001309
1310UPB_API_INLINE bool upb_MiniTableField_IsSubMessage(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001311 const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001312
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001313UPB_API_INLINE uint32_t upb_MiniTableField_Number(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001314
1315UPB_API_INLINE upb_FieldType
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001316upb_MiniTableField_Type(const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001317
1318#ifdef __cplusplus
1319} /* extern "C" */
1320#endif
1321
1322
1323#endif /* UPB_MINI_TABLE_FIELD_H_ */
1324
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001325#ifndef UPB_MINI_TABLE_MESSAGE_H_
1326#define UPB_MINI_TABLE_MESSAGE_H_
1327
1328
1329#ifndef UPB_MINI_TABLE_ENUM_H_
1330#define UPB_MINI_TABLE_ENUM_H_
1331
1332#include <stdint.h>
1333
1334
1335#ifndef UPB_MINI_TABLE_INTERNAL_ENUM_H_
1336#define UPB_MINI_TABLE_INTERNAL_ENUM_H_
1337
1338#include <stdint.h>
1339
1340// Must be last.
1341
1342struct upb_MiniTableEnum {
1343 uint32_t UPB_PRIVATE(mask_limit); // Highest that can be tested with mask.
1344 uint32_t UPB_PRIVATE(value_count); // Number of values after the bitfield.
1345 uint32_t UPB_PRIVATE(data)[]; // Bitmask + enumerated values follow.
1346};
1347
1348#ifdef __cplusplus
1349extern "C" {
1350#endif
1351
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001352UPB_API_INLINE bool upb_MiniTableEnum_CheckValue(
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001353 const struct upb_MiniTableEnum* e, uint32_t val) {
1354 if (UPB_LIKELY(val < 64)) {
1355 const uint64_t mask =
1356 e->UPB_PRIVATE(data)[0] | ((uint64_t)e->UPB_PRIVATE(data)[1] << 32);
1357 const uint64_t bit = 1ULL << val;
1358 return (mask & bit) != 0;
1359 }
1360 if (UPB_LIKELY(val < e->UPB_PRIVATE(mask_limit))) {
1361 const uint32_t mask = e->UPB_PRIVATE(data)[val / 32];
1362 const uint32_t bit = 1ULL << (val % 32);
1363 return (mask & bit) != 0;
1364 }
1365
1366 // OPT: binary search long lists?
1367 const uint32_t* start =
1368 &e->UPB_PRIVATE(data)[e->UPB_PRIVATE(mask_limit) / 32];
1369 const uint32_t* limit = &e->UPB_PRIVATE(
1370 data)[e->UPB_PRIVATE(mask_limit) / 32 + e->UPB_PRIVATE(value_count)];
1371 for (const uint32_t* p = start; p < limit; p++) {
1372 if (*p == val) return true;
1373 }
1374 return false;
1375}
1376
1377#ifdef __cplusplus
1378} /* extern "C" */
1379#endif
1380
1381
1382#endif /* UPB_MINI_TABLE_INTERNAL_ENUM_H_ */
1383
1384// Must be last
1385
1386typedef struct upb_MiniTableEnum upb_MiniTableEnum;
1387
1388#ifdef __cplusplus
1389extern "C" {
1390#endif
1391
1392// Validates enum value against range defined by enum mini table.
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001393UPB_API_INLINE bool upb_MiniTableEnum_CheckValue(const upb_MiniTableEnum* e,
1394 uint32_t val);
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001395
1396#ifdef __cplusplus
1397} /* extern "C" */
1398#endif
1399
1400
1401#endif /* UPB_MINI_TABLE_ENUM_H_ */
1402
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001403#ifndef UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
1404#define UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
1405
1406#include <stdint.h>
1407
1408
1409#ifndef UPB_MINI_TABLE_INTERNAL_SUB_H_
1410#define UPB_MINI_TABLE_INTERNAL_SUB_H_
1411
1412// Must be last.
1413
1414union upb_MiniTableSub {
1415 const struct upb_MiniTable* UPB_PRIVATE(submsg);
1416 const struct upb_MiniTableEnum* UPB_PRIVATE(subenum);
1417};
1418
1419#ifdef __cplusplus
1420extern "C" {
1421#endif
1422
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001423UPB_API_INLINE union upb_MiniTableSub upb_MiniTableSub_FromEnum(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001424 const struct upb_MiniTableEnum* subenum) {
1425 union upb_MiniTableSub out;
1426 out.UPB_PRIVATE(subenum) = subenum;
1427 return out;
1428}
1429
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001430UPB_API_INLINE union upb_MiniTableSub upb_MiniTableSub_FromMessage(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001431 const struct upb_MiniTable* submsg) {
1432 union upb_MiniTableSub out;
1433 out.UPB_PRIVATE(submsg) = submsg;
1434 return out;
1435}
1436
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001437UPB_API_INLINE const struct upb_MiniTableEnum* upb_MiniTableSub_Enum(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001438 const union upb_MiniTableSub sub) {
1439 return sub.UPB_PRIVATE(subenum);
1440}
1441
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001442UPB_API_INLINE const struct upb_MiniTable* upb_MiniTableSub_Message(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001443 const union upb_MiniTableSub sub) {
1444 return sub.UPB_PRIVATE(submsg);
1445}
1446
1447#ifdef __cplusplus
1448} /* extern "C" */
1449#endif
1450
1451
1452#endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */
1453
1454// Must be last.
1455
1456struct upb_Decoder;
Protobuf Team Botc12c96e2024-01-16 07:41:08 +00001457struct upb_Message;
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001458typedef const char* _upb_FieldParser(struct upb_Decoder* d, const char* ptr,
1459 struct upb_Message* msg, intptr_t table,
1460 uint64_t hasbits, uint64_t data);
1461typedef struct {
1462 uint64_t field_data;
1463 _upb_FieldParser* field_parser;
1464} _upb_FastTable_Entry;
1465
1466typedef enum {
1467 kUpb_ExtMode_NonExtendable = 0, // Non-extendable message.
1468 kUpb_ExtMode_Extendable = 1, // Normal extendable message.
1469 kUpb_ExtMode_IsMessageSet = 2, // MessageSet message.
1470 kUpb_ExtMode_IsMessageSet_ITEM =
1471 3, // MessageSet item (temporary only, see decode.c)
1472
1473 // During table building we steal a bit to indicate that the message is a map
1474 // entry. *Only* used during table building!
1475 kUpb_ExtMode_IsMapEntry = 4,
1476} upb_ExtMode;
1477
1478// upb_MiniTable represents the memory layout of a given upb_MessageDef.
1479// The members are public so generated code can initialize them,
1480// but users MUST NOT directly read or write any of its members.
1481
1482// LINT.IfChange(minitable_struct_definition)
1483struct upb_MiniTable {
1484 const union upb_MiniTableSub* UPB_PRIVATE(subs);
1485 const struct upb_MiniTableField* UPB_ONLYBITS(fields);
1486
1487 // Must be aligned to sizeof(void*). Doesn't include internal members like
1488 // unknown fields, extension dict, pointer to msglayout, etc.
1489 uint16_t UPB_PRIVATE(size);
1490
1491 uint16_t UPB_ONLYBITS(field_count);
1492
1493 uint8_t UPB_PRIVATE(ext); // upb_ExtMode, uint8_t here so sizeof(ext) == 1
1494 uint8_t UPB_PRIVATE(dense_below);
1495 uint8_t UPB_PRIVATE(table_mask);
1496 uint8_t UPB_PRIVATE(required_count); // Required fields have the low hasbits.
Protobuf Team Bot5d58cb82024-03-06 19:59:18 +00001497#ifdef UPB_TRACING_ENABLED
1498 const char* UPB_PRIVATE(full_name);
1499#endif
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001500
Protobuf Team Bot5d58cb82024-03-06 19:59:18 +00001501#ifdef UPB_FASTTABLE_ENABLED
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001502 // To statically initialize the tables of variable length, we need a flexible
1503 // array member, and we need to compile in gnu99 mode (constant initialization
1504 // of flexible array members is a GNU extension, not in C99 unfortunately.
1505 _upb_FastTable_Entry UPB_PRIVATE(fasttable)[];
Protobuf Team Bot5d58cb82024-03-06 19:59:18 +00001506#endif
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001507};
1508// LINT.ThenChange(//depot/google3/third_party/upb/bits/typescript/mini_table.ts)
1509
1510#ifdef __cplusplus
1511extern "C" {
1512#endif
1513
1514UPB_INLINE const struct upb_MiniTable* UPB_PRIVATE(_upb_MiniTable_Empty)(void) {
1515 extern const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_Empty);
1516
1517 return &UPB_PRIVATE(_kUpb_MiniTable_Empty);
1518}
1519
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001520UPB_API_INLINE int upb_MiniTable_FieldCount(const struct upb_MiniTable* m) {
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001521 return m->UPB_ONLYBITS(field_count);
1522}
1523
1524UPB_INLINE bool UPB_PRIVATE(_upb_MiniTable_IsEmpty)(
1525 const struct upb_MiniTable* m) {
1526 extern const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_Empty);
1527
1528 return m == &UPB_PRIVATE(_kUpb_MiniTable_Empty);
1529}
1530
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001531UPB_API_INLINE const struct upb_MiniTableField* upb_MiniTable_GetFieldByIndex(
1532 const struct upb_MiniTable* m, uint32_t i) {
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001533 return &m->UPB_ONLYBITS(fields)[i];
1534}
1535
1536UPB_INLINE const union upb_MiniTableSub* UPB_PRIVATE(
1537 _upb_MiniTable_GetSubByIndex)(const struct upb_MiniTable* m, uint32_t i) {
1538 return &m->UPB_PRIVATE(subs)[i];
1539}
1540
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001541UPB_API_INLINE const struct upb_MiniTable* upb_MiniTable_GetSubMessageTable(
1542 const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
1543 UPB_ASSERT(upb_MiniTableField_CType(f) == kUpb_CType_Message);
1544 const struct upb_MiniTable* ret = upb_MiniTableSub_Message(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001545 m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
1546 UPB_ASSUME(ret);
1547 return UPB_PRIVATE(_upb_MiniTable_IsEmpty)(ret) ? NULL : ret;
1548}
1549
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001550UPB_API_INLINE const struct upb_MiniTable* upb_MiniTable_SubMessage(
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001551 const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001552 if (upb_MiniTableField_CType(f) != kUpb_CType_Message) {
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001553 return NULL;
1554 }
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001555 return upb_MiniTableSub_Message(
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001556 m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
1557}
1558
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001559UPB_API_INLINE const struct upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001560 const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001561 UPB_ASSERT(upb_MiniTableField_CType(f) == kUpb_CType_Enum);
1562 return upb_MiniTableSub_Enum(
1563 m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
1564}
1565
1566UPB_API_INLINE const struct upb_MiniTableField* upb_MiniTable_MapKey(
1567 const struct upb_MiniTable* m) {
1568 UPB_ASSERT(upb_MiniTable_FieldCount(m) == 2);
1569 const struct upb_MiniTableField* f = upb_MiniTable_GetFieldByIndex(m, 0);
1570 UPB_ASSERT(upb_MiniTableField_Number(f) == 1);
1571 return f;
1572}
1573
1574UPB_API_INLINE const struct upb_MiniTableField* upb_MiniTable_MapValue(
1575 const struct upb_MiniTable* m) {
1576 UPB_ASSERT(upb_MiniTable_FieldCount(m) == 2);
1577 const struct upb_MiniTableField* f = upb_MiniTable_GetFieldByIndex(m, 1);
1578 UPB_ASSERT(upb_MiniTableField_Number(f) == 2);
1579 return f;
1580}
1581
1582UPB_API_INLINE bool upb_MiniTable_MessageFieldIsLinked(
1583 const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
1584 return upb_MiniTable_GetSubMessageTable(m, f) != NULL;
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001585}
1586
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00001587// Computes a bitmask in which the |m->required_count| lowest bits are set.
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001588//
1589// Sample output:
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00001590// RequiredMask(1) => 0b1 (0x1)
1591// RequiredMask(5) => 0b11111 (0x1f)
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001592UPB_INLINE uint64_t
1593UPB_PRIVATE(_upb_MiniTable_RequiredMask)(const struct upb_MiniTable* m) {
1594 int n = m->UPB_PRIVATE(required_count);
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00001595 UPB_ASSERT(0 < n && n <= 64);
1596 return (1ULL << n) - 1;
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001597}
1598
Protobuf Team Bot5d58cb82024-03-06 19:59:18 +00001599#ifdef UPB_TRACING_ENABLED
1600UPB_INLINE const char* upb_MiniTable_FullName(
1601 const struct upb_MiniTable* mini_table) {
1602 return mini_table->UPB_PRIVATE(full_name);
1603}
1604#endif
1605
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001606#ifdef __cplusplus
1607} /* extern "C" */
1608#endif
1609
1610
1611#endif /* UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ */
1612
1613// Must be last.
1614
1615typedef struct upb_MiniTable upb_MiniTable;
1616
1617#ifdef __cplusplus
1618extern "C" {
1619#endif
1620
1621UPB_API const upb_MiniTableField* upb_MiniTable_FindFieldByNumber(
1622 const upb_MiniTable* m, uint32_t number);
1623
1624UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_GetFieldByIndex(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001625 const upb_MiniTable* m, uint32_t index);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001626
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001627UPB_API_INLINE int upb_MiniTable_FieldCount(const upb_MiniTable* m);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001628
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001629// DEPRECATED: use upb_MiniTable_SubMessage() instead
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001630// Returns the MiniTable for a message field, NULL if the field is unlinked.
1631UPB_API_INLINE const upb_MiniTable* upb_MiniTable_GetSubMessageTable(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001632 const upb_MiniTable* m, const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001633
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001634// Returns the MiniTable for a message field if it is a submessage.
1635UPB_API_INLINE const upb_MiniTable* upb_MiniTable_SubMessage(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001636 const upb_MiniTable* m, const upb_MiniTableField* f);
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001637
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001638// Returns the MiniTableEnum for a message field, NULL if the field is unlinked.
1639UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001640 const upb_MiniTable* m, const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001641
1642// Returns the MiniTableField for the key of a map.
1643UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_MapKey(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001644 const upb_MiniTable* m);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001645
1646// Returns the MiniTableField for the value of a map.
1647UPB_API_INLINE const upb_MiniTableField* upb_MiniTable_MapValue(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001648 const upb_MiniTable* m);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001649
1650// Returns true if this MiniTable field is linked to a MiniTable for the
1651// sub-message.
1652UPB_API_INLINE bool upb_MiniTable_MessageFieldIsLinked(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001653 const upb_MiniTable* m, const upb_MiniTableField* f);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001654
1655// If this field is in a oneof, returns the first field in the oneof.
1656//
1657// Otherwise returns NULL.
1658//
1659// Usage:
1660// const upb_MiniTableField* field = upb_MiniTable_GetOneof(m, f);
1661// do {
1662// ..
1663// } while (upb_MiniTable_NextOneofField(m, &field);
1664//
1665const upb_MiniTableField* upb_MiniTable_GetOneof(const upb_MiniTable* m,
1666 const upb_MiniTableField* f);
1667
1668// Iterates to the next field in the oneof. If this is the last field in the
1669// oneof, returns false. The ordering of fields in the oneof is not
1670// guaranteed.
1671// REQUIRES: |f| is the field initialized by upb_MiniTable_GetOneof and updated
1672// by prior upb_MiniTable_NextOneofField calls.
1673bool upb_MiniTable_NextOneofField(const upb_MiniTable* m,
1674 const upb_MiniTableField** f);
1675
1676#ifdef __cplusplus
1677} /* extern "C" */
1678#endif
1679
1680
1681#endif /* UPB_MINI_TABLE_MESSAGE_H_ */
1682
1683// Must be last.
1684
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001685typedef struct upb_Array upb_Array;
1686
1687#ifdef __cplusplus
1688extern "C" {
1689#endif
1690
1691// Creates a new array on the given arena that holds elements of this type.
1692UPB_API upb_Array* upb_Array_New(upb_Arena* a, upb_CType type);
1693
1694// Returns the number of elements in the array.
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001695UPB_API_INLINE size_t upb_Array_Size(const upb_Array* arr);
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001696
1697// Returns the given element, which must be within the array's current size.
1698UPB_API upb_MessageValue upb_Array_Get(const upb_Array* arr, size_t i);
1699
1700// Returns a mutating pointer to the given element, which must be within the
1701// array's current size.
1702UPB_API upb_MutableMessageValue upb_Array_GetMutable(upb_Array* arr, size_t i);
1703
1704// Sets the given element, which must be within the array's current size.
1705UPB_API void upb_Array_Set(upb_Array* arr, size_t i, upb_MessageValue val);
1706
1707// Appends an element to the array. Returns false on allocation failure.
1708UPB_API bool upb_Array_Append(upb_Array* array, upb_MessageValue val,
1709 upb_Arena* arena);
1710
1711// Moves elements within the array using memmove().
1712// Like memmove(), the source and destination elements may be overlapping.
1713UPB_API void upb_Array_Move(upb_Array* array, size_t dst_idx, size_t src_idx,
1714 size_t count);
1715
1716// Inserts one or more empty elements into the array.
1717// Existing elements are shifted right.
1718// The new elements have undefined state and must be set with `upb_Array_Set()`.
1719// REQUIRES: `i <= upb_Array_Size(arr)`
1720UPB_API bool upb_Array_Insert(upb_Array* array, size_t i, size_t count,
1721 upb_Arena* arena);
1722
1723// Deletes one or more elements from the array.
1724// Existing elements are shifted left.
1725// REQUIRES: `i + count <= upb_Array_Size(arr)`
1726UPB_API void upb_Array_Delete(upb_Array* array, size_t i, size_t count);
1727
1728// Changes the size of a vector. New elements are initialized to NULL/0.
1729// Returns false on allocation failure.
1730UPB_API bool upb_Array_Resize(upb_Array* array, size_t size, upb_Arena* arena);
1731
1732// Returns pointer to array data.
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001733UPB_API_INLINE const void* upb_Array_DataPtr(const upb_Array* arr);
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001734
1735// Returns mutable pointer to array data.
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001736UPB_API_INLINE void* upb_Array_MutableDataPtr(upb_Array* arr);
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001737
1738// Mark an array and all of its descendents as frozen/immutable.
1739// If the array elements are messages then |m| must point to the minitable for
1740// those messages. Otherwise |m| must be NULL.
1741UPB_API void upb_Array_Freeze(upb_Array* arr, const upb_MiniTable* m);
1742
1743// Returns whether an array has been frozen.
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001744UPB_API_INLINE bool upb_Array_IsFrozen(const upb_Array* arr);
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001745
1746#ifdef __cplusplus
1747} /* extern "C" */
1748#endif
1749
1750
1751#endif /* UPB_MESSAGE_ARRAY_H_ */
1752
1753#ifndef UPB_MESSAGE_INTERNAL_ACCESSORS_H_
1754#define UPB_MESSAGE_INTERNAL_ACCESSORS_H_
1755
1756#include <stddef.h>
1757#include <stdint.h>
1758#include <string.h>
1759
1760
1761#ifndef UPB_BASE_INTERNAL_ENDIAN_H_
1762#define UPB_BASE_INTERNAL_ENDIAN_H_
1763
1764#include <stdint.h>
1765
1766// Must be last.
1767
1768#ifdef __cplusplus
1769extern "C" {
1770#endif
1771
1772UPB_INLINE bool upb_IsLittleEndian(void) {
1773 const int x = 1;
1774 return *(char*)&x == 1;
1775}
1776
1777UPB_INLINE uint32_t upb_BigEndian32(uint32_t val) {
1778 if (upb_IsLittleEndian()) return val;
1779
1780 return ((val & 0xff) << 24) | ((val & 0xff00) << 8) |
1781 ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24);
1782}
1783
1784UPB_INLINE uint64_t upb_BigEndian64(uint64_t val) {
1785 if (upb_IsLittleEndian()) return val;
1786
1787 const uint64_t hi = ((uint64_t)upb_BigEndian32((uint32_t)val)) << 32;
1788 const uint64_t lo = upb_BigEndian32((uint32_t)(val >> 32));
1789 return hi | lo;
1790}
1791
1792#ifdef __cplusplus
1793} /* extern "C" */
1794#endif
1795
1796
1797#endif /* UPB_BASE_INTERNAL_ENDIAN_H_ */
1798
1799#ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_
1800#define UPB_MESSAGE_INTERNAL_EXTENSION_H_
1801
Protobuf Team Bot4df6e042024-01-30 19:27:52 +00001802#include <stddef.h>
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00001803
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001804
1805#ifndef UPB_MINI_TABLE_EXTENSION_H_
1806#define UPB_MINI_TABLE_EXTENSION_H_
1807
1808#include <stdint.h>
1809
1810
1811#ifndef UPB_MINI_TABLE_INTERNAL_EXTENSION_H_
1812#define UPB_MINI_TABLE_INTERNAL_EXTENSION_H_
1813
1814#include <stdint.h>
1815
1816
1817// Must be last.
1818
1819struct upb_MiniTableExtension {
1820 // Do not move this field. We need to be able to alias pointers.
1821 struct upb_MiniTableField UPB_PRIVATE(field);
1822
1823 const struct upb_MiniTable* UPB_PRIVATE(extendee);
1824 union upb_MiniTableSub UPB_PRIVATE(sub); // NULL unless submsg or proto2 enum
1825};
1826
1827#ifdef __cplusplus
1828extern "C" {
1829#endif
1830
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001831UPB_API_INLINE upb_CType
1832upb_MiniTableExtension_CType(const struct upb_MiniTableExtension* e) {
1833 return upb_MiniTableField_CType(&e->UPB_PRIVATE(field));
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001834}
1835
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001836UPB_API_INLINE uint32_t
1837upb_MiniTableExtension_Number(const struct upb_MiniTableExtension* e) {
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001838 return e->UPB_PRIVATE(field).UPB_ONLYBITS(number);
1839}
1840
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001841UPB_API_INLINE const struct upb_MiniTable* upb_MiniTableExtension_GetSubMessage(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001842 const struct upb_MiniTableExtension* e) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001843 return upb_MiniTableSub_Message(e->UPB_PRIVATE(sub));
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001844}
1845
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001846UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001847 struct upb_MiniTableExtension* e, const struct upb_MiniTable* m) {
1848 e->UPB_PRIVATE(sub).UPB_PRIVATE(submsg) = m;
1849}
1850
1851#ifdef __cplusplus
1852} /* extern "C" */
1853#endif
1854
1855
1856#endif /* UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ */
1857
1858// Must be last.
1859
1860typedef struct upb_MiniTableExtension upb_MiniTableExtension;
1861
1862#ifdef __cplusplus
1863extern "C" {
1864#endif
1865
Protobuf Team Botfe6a6012024-01-18 00:05:28 +00001866UPB_API_INLINE upb_CType
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001867upb_MiniTableExtension_CType(const upb_MiniTableExtension* e);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001868
1869UPB_API_INLINE uint32_t
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001870upb_MiniTableExtension_Number(const upb_MiniTableExtension* e);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001871
1872UPB_API_INLINE const upb_MiniTable* upb_MiniTableExtension_GetSubMessage(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001873 const upb_MiniTableExtension* e);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001874
1875UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00001876 upb_MiniTableExtension* e, const upb_MiniTable* m);
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001877
1878#ifdef __cplusplus
1879} /* extern "C" */
1880#endif
1881
1882
1883#endif /* UPB_MINI_TABLE_EXTENSION_H_ */
1884
1885// Must be last.
1886
1887// The internal representation of an extension is self-describing: it contains
1888// enough information that we can serialize it to binary format without needing
1889// to look it up in a upb_ExtensionRegistry.
1890//
1891// This representation allocates 16 bytes to data on 64-bit platforms.
1892// This is rather wasteful for scalars (in the extreme case of bool,
1893// it wastes 15 bytes). We accept this because we expect messages to be
1894// the most common extension type.
Protobuf Team Botc13512a2024-01-25 18:53:49 +00001895typedef struct {
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001896 const upb_MiniTableExtension* ext;
Protobuf Team Bot4df6e042024-01-30 19:27:52 +00001897 upb_MessageValue data;
Protobuf Team Botc13512a2024-01-25 18:53:49 +00001898} upb_Extension;
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001899
1900#ifdef __cplusplus
1901extern "C" {
1902#endif
1903
1904// Adds the given extension data to the given message.
1905// |ext| is copied into the message instance.
1906// This logically replaces any previously-added extension with this number.
Protobuf Team Botc13512a2024-01-25 18:53:49 +00001907upb_Extension* UPB_PRIVATE(_upb_Message_GetOrCreateExtension)(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001908 struct upb_Message* msg, const upb_MiniTableExtension* ext,
1909 upb_Arena* arena);
1910
1911// Returns an array of extensions for this message.
1912// Note: the array is ordered in reverse relative to the order of creation.
Protobuf Team Botc13512a2024-01-25 18:53:49 +00001913const upb_Extension* UPB_PRIVATE(_upb_Message_Getexts)(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001914 const struct upb_Message* msg, size_t* count);
1915
1916// Returns an extension for a message with a given mini table,
1917// or NULL if no extension exists with this mini table.
Protobuf Team Botc13512a2024-01-25 18:53:49 +00001918const upb_Extension* UPB_PRIVATE(_upb_Message_Getext)(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00001919 const struct upb_Message* msg, const upb_MiniTableExtension* ext);
1920
1921#ifdef __cplusplus
1922} /* extern "C" */
1923#endif
1924
1925
1926#endif /* UPB_MESSAGE_INTERNAL_EXTENSION_H_ */
Protobuf Team Bot499c7482023-12-30 01:42:17 +00001927
1928#ifndef UPB_MESSAGE_INTERNAL_MAP_H_
1929#define UPB_MESSAGE_INTERNAL_MAP_H_
1930
1931#include <stddef.h>
1932#include <string.h>
1933
1934
1935#ifndef UPB_HASH_STR_TABLE_H_
1936#define UPB_HASH_STR_TABLE_H_
1937
1938
1939/*
1940 * upb_table
1941 *
1942 * This header is INTERNAL-ONLY! Its interfaces are not public or stable!
1943 * This file defines very fast int->upb_value (inttable) and string->upb_value
1944 * (strtable) hash tables.
1945 *
1946 * The table uses chained scatter with Brent's variation (inspired by the Lua
1947 * implementation of hash tables). The hash function for strings is Austin
1948 * Appleby's "MurmurHash."
1949 *
1950 * The inttable uses uintptr_t as its key, which guarantees it can be used to
1951 * store pointers or integers of at least 32 bits (upb isn't really useful on
1952 * systems where sizeof(void*) < 4).
1953 *
1954 * The table must be homogeneous (all values of the same type). In debug
1955 * mode, we check this on insert and lookup.
1956 */
1957
1958#ifndef UPB_HASH_COMMON_H_
1959#define UPB_HASH_COMMON_H_
1960
1961#include <string.h>
1962
1963
1964// Must be last.
1965
1966#ifdef __cplusplus
1967extern "C" {
1968#endif
1969
1970/* upb_value ******************************************************************/
1971
1972typedef struct {
1973 uint64_t val;
1974} upb_value;
1975
1976UPB_INLINE void _upb_value_setval(upb_value* v, uint64_t val) { v->val = val; }
1977
1978/* For each value ctype, define the following set of functions:
1979 *
1980 * // Get/set an int32 from a upb_value.
1981 * int32_t upb_value_getint32(upb_value val);
1982 * void upb_value_setint32(upb_value *val, int32_t cval);
1983 *
1984 * // Construct a new upb_value from an int32.
1985 * upb_value upb_value_int32(int32_t val); */
1986#define FUNCS(name, membername, type_t, converter) \
1987 UPB_INLINE void upb_value_set##name(upb_value* val, type_t cval) { \
1988 val->val = (converter)cval; \
1989 } \
1990 UPB_INLINE upb_value upb_value_##name(type_t val) { \
1991 upb_value ret; \
1992 upb_value_set##name(&ret, val); \
1993 return ret; \
1994 } \
1995 UPB_INLINE type_t upb_value_get##name(upb_value val) { \
1996 return (type_t)(converter)val.val; \
1997 }
1998
1999FUNCS(int32, int32, int32_t, int32_t)
2000FUNCS(int64, int64, int64_t, int64_t)
2001FUNCS(uint32, uint32, uint32_t, uint32_t)
2002FUNCS(uint64, uint64, uint64_t, uint64_t)
2003FUNCS(bool, _bool, bool, bool)
2004FUNCS(cstr, cstr, char*, uintptr_t)
2005FUNCS(uintptr, uptr, uintptr_t, uintptr_t)
2006FUNCS(ptr, ptr, void*, uintptr_t)
2007FUNCS(constptr, constptr, const void*, uintptr_t)
2008
2009#undef FUNCS
2010
2011UPB_INLINE void upb_value_setfloat(upb_value* val, float cval) {
2012 memcpy(&val->val, &cval, sizeof(cval));
2013}
2014
2015UPB_INLINE void upb_value_setdouble(upb_value* val, double cval) {
2016 memcpy(&val->val, &cval, sizeof(cval));
2017}
2018
2019UPB_INLINE upb_value upb_value_float(float cval) {
2020 upb_value ret;
2021 upb_value_setfloat(&ret, cval);
2022 return ret;
2023}
2024
2025UPB_INLINE upb_value upb_value_double(double cval) {
2026 upb_value ret;
2027 upb_value_setdouble(&ret, cval);
2028 return ret;
2029}
2030
2031/* upb_tabkey *****************************************************************/
2032
2033/* Either:
2034 * 1. an actual integer key, or
2035 * 2. a pointer to a string prefixed by its uint32_t length, owned by us.
2036 *
2037 * ...depending on whether this is a string table or an int table. We would
2038 * make this a union of those two types, but C89 doesn't support statically
2039 * initializing a non-first union member. */
2040typedef uintptr_t upb_tabkey;
2041
2042UPB_INLINE char* upb_tabstr(upb_tabkey key, uint32_t* len) {
2043 char* mem = (char*)key;
2044 if (len) memcpy(len, mem, sizeof(*len));
2045 return mem + sizeof(*len);
2046}
2047
2048UPB_INLINE upb_StringView upb_tabstrview(upb_tabkey key) {
2049 upb_StringView ret;
2050 uint32_t len;
2051 ret.data = upb_tabstr(key, &len);
2052 ret.size = len;
2053 return ret;
2054}
2055
2056/* upb_tabval *****************************************************************/
2057
2058typedef struct upb_tabval {
2059 uint64_t val;
2060} upb_tabval;
2061
2062#define UPB_TABVALUE_EMPTY_INIT \
2063 { -1 }
2064
2065/* upb_table ******************************************************************/
2066
2067typedef struct _upb_tabent {
2068 upb_tabkey key;
2069 upb_tabval val;
2070
2071 /* Internal chaining. This is const so we can create static initializers for
2072 * tables. We cast away const sometimes, but *only* when the containing
2073 * upb_table is known to be non-const. This requires a bit of care, but
2074 * the subtlety is confined to table.c. */
2075 const struct _upb_tabent* next;
2076} upb_tabent;
2077
2078typedef struct {
2079 size_t count; /* Number of entries in the hash part. */
2080 uint32_t mask; /* Mask to turn hash value -> bucket. */
2081 uint32_t max_count; /* Max count before we hit our load limit. */
2082 uint8_t size_lg2; /* Size of the hashtable part is 2^size_lg2 entries. */
2083 upb_tabent* entries;
2084} upb_table;
2085
2086UPB_INLINE size_t upb_table_size(const upb_table* t) {
2087 return t->size_lg2 ? 1 << t->size_lg2 : 0;
2088}
2089
2090// Internal-only functions, in .h file only out of necessity.
2091
2092UPB_INLINE bool upb_tabent_isempty(const upb_tabent* e) { return e->key == 0; }
2093
2094uint32_t _upb_Hash(const void* p, size_t n, uint64_t seed);
2095
2096#ifdef __cplusplus
2097} /* extern "C" */
2098#endif
2099
2100
2101#endif /* UPB_HASH_COMMON_H_ */
2102
2103// Must be last.
2104
2105typedef struct {
2106 upb_table t;
2107} upb_strtable;
2108
2109#ifdef __cplusplus
2110extern "C" {
2111#endif
2112
2113// Initialize a table. If memory allocation failed, false is returned and
2114// the table is uninitialized.
2115bool upb_strtable_init(upb_strtable* table, size_t expected_size, upb_Arena* a);
2116
2117// Returns the number of values in the table.
2118UPB_INLINE size_t upb_strtable_count(const upb_strtable* t) {
2119 return t->t.count;
2120}
2121
2122void upb_strtable_clear(upb_strtable* t);
2123
2124// Inserts the given key into the hashtable with the given value.
2125// The key must not already exist in the hash table. The key is not required
2126// to be NULL-terminated, and the table will make an internal copy of the key.
2127//
2128// If a table resize was required but memory allocation failed, false is
2129// returned and the table is unchanged. */
2130bool upb_strtable_insert(upb_strtable* t, const char* key, size_t len,
2131 upb_value val, upb_Arena* a);
2132
2133// Looks up key in this table, returning "true" if the key was found.
2134// If v is non-NULL, copies the value for this key into *v.
2135bool upb_strtable_lookup2(const upb_strtable* t, const char* key, size_t len,
2136 upb_value* v);
2137
2138// For NULL-terminated strings.
2139UPB_INLINE bool upb_strtable_lookup(const upb_strtable* t, const char* key,
2140 upb_value* v) {
2141 return upb_strtable_lookup2(t, key, strlen(key), v);
2142}
2143
2144// Removes an item from the table. Returns true if the remove was successful,
2145// and stores the removed item in *val if non-NULL.
2146bool upb_strtable_remove2(upb_strtable* t, const char* key, size_t len,
2147 upb_value* val);
2148
2149UPB_INLINE bool upb_strtable_remove(upb_strtable* t, const char* key,
2150 upb_value* v) {
2151 return upb_strtable_remove2(t, key, strlen(key), v);
2152}
2153
2154// Exposed for testing only.
2155bool upb_strtable_resize(upb_strtable* t, size_t size_lg2, upb_Arena* a);
2156
2157/* Iteration over strtable:
2158 *
2159 * intptr_t iter = UPB_STRTABLE_BEGIN;
2160 * upb_StringView key;
2161 * upb_value val;
2162 * while (upb_strtable_next2(t, &key, &val, &iter)) {
2163 * // ...
2164 * }
2165 */
2166
2167#define UPB_STRTABLE_BEGIN -1
2168
2169bool upb_strtable_next2(const upb_strtable* t, upb_StringView* key,
2170 upb_value* val, intptr_t* iter);
2171void upb_strtable_removeiter(upb_strtable* t, intptr_t* iter);
2172void upb_strtable_setentryvalue(upb_strtable* t, intptr_t iter, upb_value v);
2173
2174/* DEPRECATED iterators, slated for removal.
2175 *
2176 * Iterators for string tables. We are subject to some kind of unusual
2177 * design constraints:
2178 *
2179 * For high-level languages:
2180 * - we must be able to guarantee that we don't crash or corrupt memory even if
2181 * the program accesses an invalidated iterator.
2182 *
2183 * For C++11 range-based for:
2184 * - iterators must be copyable
2185 * - iterators must be comparable
2186 * - it must be possible to construct an "end" value.
2187 *
2188 * Iteration order is undefined.
2189 *
2190 * Modifying the table invalidates iterators. upb_{str,int}table_done() is
2191 * guaranteed to work even on an invalidated iterator, as long as the table it
2192 * is iterating over has not been freed. Calling next() or accessing data from
2193 * an invalidated iterator yields unspecified elements from the table, but it is
2194 * guaranteed not to crash and to return real table elements (except when done()
2195 * is true). */
2196/* upb_strtable_iter **********************************************************/
2197
2198/* upb_strtable_iter i;
2199 * upb_strtable_begin(&i, t);
2200 * for(; !upb_strtable_done(&i); upb_strtable_next(&i)) {
2201 * const char *key = upb_strtable_iter_key(&i);
2202 * const upb_value val = upb_strtable_iter_value(&i);
2203 * // ...
2204 * }
2205 */
2206
2207typedef struct {
2208 const upb_strtable* t;
2209 size_t index;
2210} upb_strtable_iter;
2211
2212UPB_INLINE const upb_tabent* str_tabent(const upb_strtable_iter* i) {
2213 return &i->t->t.entries[i->index];
2214}
2215
2216void upb_strtable_begin(upb_strtable_iter* i, const upb_strtable* t);
2217void upb_strtable_next(upb_strtable_iter* i);
2218bool upb_strtable_done(const upb_strtable_iter* i);
2219upb_StringView upb_strtable_iter_key(const upb_strtable_iter* i);
2220upb_value upb_strtable_iter_value(const upb_strtable_iter* i);
2221void upb_strtable_iter_setdone(upb_strtable_iter* i);
2222bool upb_strtable_iter_isequal(const upb_strtable_iter* i1,
2223 const upb_strtable_iter* i2);
2224
2225#ifdef __cplusplus
2226} /* extern "C" */
2227#endif
2228
2229
2230#endif /* UPB_HASH_STR_TABLE_H_ */
2231
2232// Must be last.
2233
2234typedef enum {
2235 kUpb_MapInsertStatus_Inserted = 0,
2236 kUpb_MapInsertStatus_Replaced = 1,
2237 kUpb_MapInsertStatus_OutOfMemory = 2,
2238} upb_MapInsertStatus;
2239
2240// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
2241
2242struct upb_Map {
2243 // Size of key and val, based on the map type.
2244 // Strings are represented as '0' because they must be handled specially.
2245 char key_size;
2246 char val_size;
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002247 bool UPB_PRIVATE(is_frozen);
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002248
2249 upb_strtable table;
2250};
2251
2252#ifdef __cplusplus
2253extern "C" {
2254#endif
2255
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002256UPB_INLINE void UPB_PRIVATE(_upb_Map_ShallowFreeze)(struct upb_Map* map) {
2257 map->UPB_PRIVATE(is_frozen) = true;
2258}
2259
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002260UPB_API_INLINE bool upb_Map_IsFrozen(const struct upb_Map* map) {
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002261 return map->UPB_PRIVATE(is_frozen);
2262}
2263
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002264// Converting between internal table representation and user values.
2265//
2266// _upb_map_tokey() and _upb_map_fromkey() are inverses.
2267// _upb_map_tovalue() and _upb_map_fromvalue() are inverses.
2268//
2269// These functions account for the fact that strings are treated differently
2270// from other types when stored in a map.
2271
2272UPB_INLINE upb_StringView _upb_map_tokey(const void* key, size_t size) {
2273 if (size == UPB_MAPTYPE_STRING) {
2274 return *(upb_StringView*)key;
2275 } else {
2276 return upb_StringView_FromDataAndSize((const char*)key, size);
2277 }
2278}
2279
2280UPB_INLINE void _upb_map_fromkey(upb_StringView key, void* out, size_t size) {
2281 if (size == UPB_MAPTYPE_STRING) {
2282 memcpy(out, &key, sizeof(key));
2283 } else {
2284 memcpy(out, key.data, size);
2285 }
2286}
2287
2288UPB_INLINE bool _upb_map_tovalue(const void* val, size_t size,
2289 upb_value* msgval, upb_Arena* a) {
2290 if (size == UPB_MAPTYPE_STRING) {
2291 upb_StringView* strp = (upb_StringView*)upb_Arena_Malloc(a, sizeof(*strp));
2292 if (!strp) return false;
2293 *strp = *(upb_StringView*)val;
2294 *msgval = upb_value_ptr(strp);
2295 } else {
2296 memcpy(msgval, val, size);
2297 }
2298 return true;
2299}
2300
2301UPB_INLINE void _upb_map_fromvalue(upb_value val, void* out, size_t size) {
2302 if (size == UPB_MAPTYPE_STRING) {
2303 const upb_StringView* strp = (const upb_StringView*)upb_value_getptr(val);
2304 memcpy(out, strp, sizeof(upb_StringView));
2305 } else {
2306 memcpy(out, &val, size);
2307 }
2308}
2309
2310UPB_INLINE void* _upb_map_next(const struct upb_Map* map, size_t* iter) {
2311 upb_strtable_iter it;
2312 it.t = &map->table;
2313 it.index = *iter;
2314 upb_strtable_next(&it);
2315 *iter = it.index;
2316 if (upb_strtable_done(&it)) return NULL;
2317 return (void*)str_tabent(&it);
2318}
2319
2320UPB_INLINE void _upb_Map_Clear(struct upb_Map* map) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002321 UPB_ASSERT(!upb_Map_IsFrozen(map));
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002322
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002323 upb_strtable_clear(&map->table);
2324}
2325
2326UPB_INLINE bool _upb_Map_Delete(struct upb_Map* map, const void* key,
2327 size_t key_size, upb_value* val) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002328 UPB_ASSERT(!upb_Map_IsFrozen(map));
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002329
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002330 upb_StringView k = _upb_map_tokey(key, key_size);
2331 return upb_strtable_remove2(&map->table, k.data, k.size, val);
2332}
2333
2334UPB_INLINE bool _upb_Map_Get(const struct upb_Map* map, const void* key,
2335 size_t key_size, void* val, size_t val_size) {
2336 upb_value tabval;
2337 upb_StringView k = _upb_map_tokey(key, key_size);
2338 bool ret = upb_strtable_lookup2(&map->table, k.data, k.size, &tabval);
2339 if (ret && val) {
2340 _upb_map_fromvalue(tabval, val, val_size);
2341 }
2342 return ret;
2343}
2344
2345UPB_INLINE upb_MapInsertStatus _upb_Map_Insert(struct upb_Map* map,
2346 const void* key, size_t key_size,
2347 void* val, size_t val_size,
2348 upb_Arena* a) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002349 UPB_ASSERT(!upb_Map_IsFrozen(map));
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002350
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002351 upb_StringView strkey = _upb_map_tokey(key, key_size);
2352 upb_value tabval = {0};
2353 if (!_upb_map_tovalue(val, val_size, &tabval, a)) {
2354 return kUpb_MapInsertStatus_OutOfMemory;
2355 }
2356
2357 // TODO: add overwrite operation to minimize number of lookups.
2358 bool removed =
2359 upb_strtable_remove2(&map->table, strkey.data, strkey.size, NULL);
2360 if (!upb_strtable_insert(&map->table, strkey.data, strkey.size, tabval, a)) {
2361 return kUpb_MapInsertStatus_OutOfMemory;
2362 }
2363 return removed ? kUpb_MapInsertStatus_Replaced
2364 : kUpb_MapInsertStatus_Inserted;
2365}
2366
2367UPB_INLINE size_t _upb_Map_Size(const struct upb_Map* map) {
2368 return map->table.t.count;
2369}
2370
2371// Strings/bytes are special-cased in maps.
2372extern char _upb_Map_CTypeSizeTable[12];
2373
2374UPB_INLINE size_t _upb_Map_CTypeSize(upb_CType ctype) {
2375 return _upb_Map_CTypeSizeTable[ctype];
2376}
2377
2378// Creates a new map on the given arena with this key/value type.
2379struct upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size);
2380
2381#ifdef __cplusplus
2382} /* extern "C" */
2383#endif
2384
2385
2386#endif /* UPB_MESSAGE_INTERNAL_MAP_H_ */
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00002387
Protobuf Team Bot4df6e042024-01-30 19:27:52 +00002388/*
2389** Our memory representation for parsing tables and messages themselves.
2390** Functions in this file are used by generated code and possibly reflection.
2391**
2392** The definitions in this file are internal to upb.
2393**/
2394
2395#ifndef UPB_MESSAGE_INTERNAL_MESSAGE_H_
2396#define UPB_MESSAGE_INTERNAL_MESSAGE_H_
2397
2398#include <stdlib.h>
2399#include <string.h>
2400
2401
2402// Must be last.
2403
2404#ifdef __cplusplus
2405extern "C" {
2406#endif
2407
2408extern const float kUpb_FltInfinity;
2409extern const double kUpb_Infinity;
2410extern const double kUpb_NaN;
2411
2412// Internal members of a upb_Message that track unknown fields and/or
2413// extensions. We can change this without breaking binary compatibility.
2414
2415typedef struct upb_Message_Internal {
2416 // Total size of this structure, including the data that follows.
2417 // Must be aligned to 8, which is alignof(upb_Extension)
2418 uint32_t size;
2419
2420 /* Offsets relative to the beginning of this structure.
2421 *
2422 * Unknown data grows forward from the beginning to unknown_end.
2423 * Extension data grows backward from size to ext_begin.
2424 * When the two meet, we're out of data and have to realloc.
2425 *
2426 * If we imagine that the final member of this struct is:
2427 * char data[size - overhead]; // overhead = sizeof(upb_Message_Internal)
2428 *
2429 * Then we have:
2430 * unknown data: data[0 .. (unknown_end - overhead)]
2431 * extensions data: data[(ext_begin - overhead) .. (size - overhead)] */
2432 uint32_t unknown_end;
2433 uint32_t ext_begin;
2434 // Data follows, as if there were an array:
2435 // char data[size - sizeof(upb_Message_Internal)];
2436} upb_Message_Internal;
2437
2438// Inline version upb_Message_New(), for internal use.
2439UPB_INLINE struct upb_Message* _upb_Message_New(const upb_MiniTable* m,
2440 upb_Arena* a) {
2441 const int size = m->UPB_PRIVATE(size);
2442 struct upb_Message* msg = (struct upb_Message*)upb_Arena_Malloc(a, size);
2443 if (UPB_UNLIKELY(!msg)) return NULL;
2444 memset(msg, 0, size);
2445 return msg;
2446}
2447
2448// Discards the unknown fields for this message only.
2449void _upb_Message_DiscardUnknown_shallow(struct upb_Message* msg);
2450
2451// Adds unknown data (serialized protobuf data) to the given message.
2452// The data is copied into the message instance.
2453bool UPB_PRIVATE(_upb_Message_AddUnknown)(struct upb_Message* msg,
2454 const char* data, size_t len,
2455 upb_Arena* arena);
2456
2457bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need,
2458 upb_Arena* arena);
2459
2460#ifdef __cplusplus
2461} /* extern "C" */
2462#endif
2463
2464
2465#endif /* UPB_MESSAGE_INTERNAL_MESSAGE_H_ */
2466
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002467#ifndef UPB_MINI_TABLE_INTERNAL_TAGGED_PTR_H_
2468#define UPB_MINI_TABLE_INTERNAL_TAGGED_PTR_H_
2469
2470#include <stdint.h>
2471
2472
2473// Must be last.
2474
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002475#ifdef __cplusplus
2476extern "C" {
2477#endif
2478
2479// Internal-only because empty messages cannot be created by the user.
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00002480UPB_INLINE uintptr_t
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002481UPB_PRIVATE(_upb_TaggedMessagePtr_Pack)(struct upb_Message* ptr, bool empty) {
2482 UPB_ASSERT(((uintptr_t)ptr & 1) == 0);
2483 return (uintptr_t)ptr | (empty ? 1 : 0);
2484}
2485
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002486UPB_API_INLINE bool upb_TaggedMessagePtr_IsEmpty(uintptr_t ptr) {
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002487 return ptr & 1;
2488}
2489
2490UPB_INLINE struct upb_Message* UPB_PRIVATE(_upb_TaggedMessagePtr_GetMessage)(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00002491 uintptr_t ptr) {
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002492 return (struct upb_Message*)(ptr & ~(uintptr_t)1);
2493}
2494
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002495UPB_API_INLINE struct upb_Message* upb_TaggedMessagePtr_GetNonEmptyMessage(
2496 uintptr_t ptr) {
2497 UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(ptr));
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002498 return UPB_PRIVATE(_upb_TaggedMessagePtr_GetMessage)(ptr);
2499}
2500
2501UPB_INLINE struct upb_Message* UPB_PRIVATE(
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00002502 _upb_TaggedMessagePtr_GetEmptyMessage)(uintptr_t ptr) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002503 UPB_ASSERT(upb_TaggedMessagePtr_IsEmpty(ptr));
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002504 return UPB_PRIVATE(_upb_TaggedMessagePtr_GetMessage)(ptr);
2505}
2506
2507#ifdef __cplusplus
2508} /* extern "C" */
2509#endif
2510
2511
2512#endif /* UPB_MINI_TABLE_INTERNAL_TAGGED_PTR_H_ */
2513
Protobuf Team Botc12c96e2024-01-16 07:41:08 +00002514#ifndef UPB_MESSAGE_INTERNAL_TYPES_H_
2515#define UPB_MESSAGE_INTERNAL_TYPES_H_
2516
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002517#include <stdint.h>
2518
2519// Must be last.
2520
2521#define UPB_OPAQUE(x) x##_opaque
2522
Protobuf Team Botc12c96e2024-01-16 07:41:08 +00002523struct upb_Message {
2524 union {
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002525 uintptr_t UPB_OPAQUE(internal); // tagged pointer, low bit == frozen
Protobuf Team Botc12c96e2024-01-16 07:41:08 +00002526 double d; // Forces same size for 32-bit/64-bit builds
2527 };
2528};
2529
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002530#ifdef __cplusplus
2531extern "C" {
2532#endif
2533
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002534UPB_INLINE void UPB_PRIVATE(_upb_Message_ShallowFreeze)(
2535 struct upb_Message* msg) {
2536 msg->UPB_OPAQUE(internal) |= 1ULL;
2537}
2538
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002539UPB_API_INLINE bool upb_Message_IsFrozen(const struct upb_Message* msg) {
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002540 return (msg->UPB_OPAQUE(internal) & 1ULL) != 0;
2541}
2542
2543UPB_INLINE struct upb_Message_Internal* UPB_PRIVATE(_upb_Message_GetInternal)(
2544 const struct upb_Message* msg) {
2545 const uintptr_t tmp = msg->UPB_OPAQUE(internal) & ~1ULL;
2546 return (struct upb_Message_Internal*)tmp;
2547}
2548
2549UPB_INLINE void UPB_PRIVATE(_upb_Message_SetInternal)(
2550 struct upb_Message* msg, struct upb_Message_Internal* internal) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002551 UPB_ASSERT(!upb_Message_IsFrozen(msg));
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002552 msg->UPB_OPAQUE(internal) = (uintptr_t)internal;
2553}
2554
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002555#ifdef __cplusplus
2556} /* extern "C" */
2557#endif
2558
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002559#undef UPB_OPAQUE
2560
2561
Protobuf Team Botc12c96e2024-01-16 07:41:08 +00002562#endif /* UPB_MESSAGE_INTERNAL_TYPES_H_ */
2563
Eric Salo8809a112022-11-21 13:01:06 -08002564// Must be last.
2565
Eric Salob7d54ac2022-12-29 11:59:42 -08002566#if defined(__GNUC__) && !defined(__clang__)
2567// GCC raises incorrect warnings in these functions. It thinks that we are
2568// overrunning buffers, but we carefully write the functions in this file to
2569// guarantee that this is impossible. GCC gets this wrong due it its failure
2570// to perform constant propagation as we expect:
2571// - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108217
2572// - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108226
2573//
2574// Unfortunately this also indicates that GCC is not optimizing away the
2575// switch() in cases where it should be, compromising the performance.
2576#pragma GCC diagnostic push
2577#pragma GCC diagnostic ignored "-Warray-bounds"
2578#pragma GCC diagnostic ignored "-Wstringop-overflow"
Mike Kruskal232ecf42023-01-14 00:09:40 -08002579#if __GNUC__ >= 11
Eric Salob7d54ac2022-12-29 11:59:42 -08002580#pragma GCC diagnostic ignored "-Wstringop-overread"
2581#endif
Mike Kruskal232ecf42023-01-14 00:09:40 -08002582#endif
Eric Salob7d54ac2022-12-29 11:59:42 -08002583
Eric Salo8809a112022-11-21 13:01:06 -08002584#ifdef __cplusplus
2585extern "C" {
2586#endif
2587
Mike Kruskal9d435022023-07-11 12:45:07 -07002588// LINT.IfChange(presence_logic)
2589
2590// Hasbit access ///////////////////////////////////////////////////////////////
2591
Protobuf Team Bot7713df52023-12-05 20:16:11 +00002592UPB_INLINE bool UPB_PRIVATE(_upb_Message_GetHasbit)(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002593 const struct upb_Message* msg, const upb_MiniTableField* f) {
Protobuf Team Bota0e81952023-12-21 14:54:29 +00002594 const size_t offset = UPB_PRIVATE(_upb_MiniTableField_HasbitOffset)(f);
2595 const char mask = UPB_PRIVATE(_upb_MiniTableField_HasbitMask)(f);
2596
Protobuf Team Botb8c1a272023-11-15 17:49:10 +00002597 return (*UPB_PTR_AT(msg, offset, const char) & mask) != 0;
Mike Kruskal9d435022023-07-11 12:45:07 -07002598}
2599
Protobuf Team Bot7713df52023-12-05 20:16:11 +00002600UPB_INLINE void UPB_PRIVATE(_upb_Message_SetHasbit)(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002601 const struct upb_Message* msg, const upb_MiniTableField* f) {
Protobuf Team Bota0e81952023-12-21 14:54:29 +00002602 const size_t offset = UPB_PRIVATE(_upb_MiniTableField_HasbitOffset)(f);
2603 const char mask = UPB_PRIVATE(_upb_MiniTableField_HasbitMask)(f);
2604
Protobuf Team Botb8c1a272023-11-15 17:49:10 +00002605 (*UPB_PTR_AT(msg, offset, char)) |= mask;
2606}
2607
Protobuf Team Bot7713df52023-12-05 20:16:11 +00002608UPB_INLINE void UPB_PRIVATE(_upb_Message_ClearHasbit)(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002609 const struct upb_Message* msg, const upb_MiniTableField* f) {
Protobuf Team Bota0e81952023-12-21 14:54:29 +00002610 const size_t offset = UPB_PRIVATE(_upb_MiniTableField_HasbitOffset)(f);
2611 const char mask = UPB_PRIVATE(_upb_MiniTableField_HasbitMask)(f);
2612
Protobuf Team Botb8c1a272023-11-15 17:49:10 +00002613 (*UPB_PTR_AT(msg, offset, char)) &= ~mask;
2614}
2615
Mike Kruskal9d435022023-07-11 12:45:07 -07002616// Oneof case access ///////////////////////////////////////////////////////////
2617
Protobuf Team Bot7d4ead22023-12-05 21:25:30 +00002618UPB_INLINE uint32_t* UPB_PRIVATE(_upb_Message_OneofCasePtr)(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002619 struct upb_Message* msg, const upb_MiniTableField* f) {
Protobuf Team Bota0e81952023-12-21 14:54:29 +00002620 return UPB_PTR_AT(msg, UPB_PRIVATE(_upb_MiniTableField_OneofOffset)(f),
2621 uint32_t);
Mike Kruskal9d435022023-07-11 12:45:07 -07002622}
2623
Protobuf Team Bot7d4ead22023-12-05 21:25:30 +00002624UPB_INLINE uint32_t UPB_PRIVATE(_upb_Message_GetOneofCase)(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002625 const struct upb_Message* msg, const upb_MiniTableField* f) {
Protobuf Team Bot18d4a762024-01-02 05:41:47 +00002626 const uint32_t* ptr =
2627 UPB_PRIVATE(_upb_Message_OneofCasePtr)((struct upb_Message*)msg, f);
2628
2629 return *ptr;
Mike Kruskal9d435022023-07-11 12:45:07 -07002630}
2631
Protobuf Team Bot7d4ead22023-12-05 21:25:30 +00002632UPB_INLINE void UPB_PRIVATE(_upb_Message_SetOneofCase)(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002633 struct upb_Message* msg, const upb_MiniTableField* f) {
Protobuf Team Bot18d4a762024-01-02 05:41:47 +00002634 uint32_t* ptr = UPB_PRIVATE(_upb_Message_OneofCasePtr)(msg, f);
2635
2636 *ptr = upb_MiniTableField_Number(f);
Protobuf Team Botb8c1a272023-11-15 17:49:10 +00002637}
2638
Protobuf Team Bot18d4a762024-01-02 05:41:47 +00002639// Returns true if the given field is the current oneof case.
2640// Does nothing if it is not the current oneof case.
2641UPB_INLINE bool UPB_PRIVATE(_upb_Message_ClearOneofCase)(
2642 struct upb_Message* msg, const upb_MiniTableField* f) {
2643 uint32_t* ptr = UPB_PRIVATE(_upb_Message_OneofCasePtr)(msg, f);
2644
2645 if (*ptr != upb_MiniTableField_Number(f)) return false;
2646 *ptr = 0;
2647 return true;
2648}
Protobuf Team Botb8c1a272023-11-15 17:49:10 +00002649
Mike Kruskal9d435022023-07-11 12:45:07 -07002650// LINT.ThenChange(GoogleInternalName2)
Mike Kruskal9d435022023-07-11 12:45:07 -07002651
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00002652// Returns false if the message is missing any of its required fields.
2653UPB_INLINE bool UPB_PRIVATE(_upb_Message_IsInitializedShallow)(
2654 const struct upb_Message* msg, const upb_MiniTable* m) {
2655 uint64_t bits;
2656 memcpy(&bits, msg + 1, sizeof(bits));
2657 bits = upb_BigEndian64(bits);
2658 return (UPB_PRIVATE(_upb_MiniTable_RequiredMask)(m) & ~bits) == 0;
2659}
2660
Protobuf Team Bot9bee7472024-01-10 18:09:23 +00002661UPB_INLINE void* UPB_PRIVATE(_upb_Message_MutableDataPtr)(
Protobuf Team Bot18d4a762024-01-02 05:41:47 +00002662 struct upb_Message* msg, const upb_MiniTableField* f) {
2663 return (char*)msg + f->UPB_ONLYBITS(offset);
Eric Salo8809a112022-11-21 13:01:06 -08002664}
2665
Protobuf Team Bot9bee7472024-01-10 18:09:23 +00002666UPB_INLINE const void* UPB_PRIVATE(_upb_Message_DataPtr)(
Protobuf Team Bot18d4a762024-01-02 05:41:47 +00002667 const struct upb_Message* msg, const upb_MiniTableField* f) {
2668 return (const char*)msg + f->UPB_ONLYBITS(offset);
Eric Salo8809a112022-11-21 13:01:06 -08002669}
2670
Protobuf Team Bot7d4ead22023-12-05 21:25:30 +00002671UPB_INLINE void UPB_PRIVATE(_upb_Message_SetPresence)(
Protobuf Team Bot18d4a762024-01-02 05:41:47 +00002672 struct upb_Message* msg, const upb_MiniTableField* f) {
2673 if (UPB_PRIVATE(_upb_MiniTableField_HasHasbit)(f)) {
2674 UPB_PRIVATE(_upb_Message_SetHasbit)(msg, f);
2675 } else if (upb_MiniTableField_IsInOneof(f)) {
2676 UPB_PRIVATE(_upb_Message_SetOneofCase)(msg, f);
Eric Salo8809a112022-11-21 13:01:06 -08002677 }
2678}
2679
Protobuf Team Botddc54062023-12-12 20:03:38 +00002680UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_DataCopy)(
Protobuf Team Bot18d4a762024-01-02 05:41:47 +00002681 const upb_MiniTableField* f, void* to, const void* from) {
2682 switch (UPB_PRIVATE(_upb_MiniTableField_GetRep)(f)) {
Eric Salo8809a112022-11-21 13:01:06 -08002683 case kUpb_FieldRep_1Byte:
2684 memcpy(to, from, 1);
2685 return;
2686 case kUpb_FieldRep_4Byte:
2687 memcpy(to, from, 4);
2688 return;
2689 case kUpb_FieldRep_8Byte:
2690 memcpy(to, from, 8);
2691 return;
2692 case kUpb_FieldRep_StringView: {
2693 memcpy(to, from, sizeof(upb_StringView));
2694 return;
2695 }
2696 }
2697 UPB_UNREACHABLE();
2698}
2699
Protobuf Team Bot18d4a762024-01-02 05:41:47 +00002700UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_DataEquals)(
2701 const upb_MiniTableField* f, const void* a, const void* b) {
2702 switch (UPB_PRIVATE(_upb_MiniTableField_GetRep)(f)) {
2703 case kUpb_FieldRep_1Byte:
2704 return memcmp(a, b, 1) == 0;
2705 case kUpb_FieldRep_4Byte:
2706 return memcmp(a, b, 4) == 0;
2707 case kUpb_FieldRep_8Byte:
2708 return memcmp(a, b, 8) == 0;
2709 case kUpb_FieldRep_StringView: {
2710 const upb_StringView sa = *(const upb_StringView*)a;
2711 const upb_StringView sb = *(const upb_StringView*)b;
2712 return upb_StringView_IsEqual(sa, sb);
2713 }
2714 }
2715 UPB_UNREACHABLE();
2716}
2717
2718UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_DataClear)(
2719 const upb_MiniTableField* f, void* val) {
2720 const char zero[16] = {0};
2721 return UPB_PRIVATE(_upb_MiniTableField_DataCopy)(f, val, zero);
2722}
2723
2724UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_DataIsZero)(
2725 const upb_MiniTableField* f, const void* val) {
2726 const char zero[16] = {0};
2727 return UPB_PRIVATE(_upb_MiniTableField_DataEquals)(f, val, zero);
2728}
2729
Eric Salo8809a112022-11-21 13:01:06 -08002730// Here we define universal getter/setter functions for message fields.
2731// These look very branchy and inefficient, but as long as the MiniTableField
2732// values are known at compile time, all the branches are optimized away and
2733// we are left with ideal code. This can happen either through through
2734// literals or UPB_ASSUME():
2735//
Eric Salob598b2d2022-12-22 23:14:27 -08002736// // Via struct literals.
Eric Salo8809a112022-11-21 13:01:06 -08002737// bool FooMessage_set_bool_field(const upb_Message* msg, bool val) {
2738// const upb_MiniTableField field = {1, 0, 0, /* etc... */};
2739// // All value in "field" are compile-time known.
Eric Salo10505992022-12-12 12:16:36 -08002740// _upb_Message_SetNonExtensionField(msg, &field, &value);
Eric Salo8809a112022-11-21 13:01:06 -08002741// }
2742//
2743// // Via UPB_ASSUME().
Eric Salo10505992022-12-12 12:16:36 -08002744// UPB_INLINE bool upb_Message_SetBool(upb_Message* msg,
2745// const upb_MiniTableField* field,
2746// bool value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002747// UPB_ASSUME(field->UPB_PRIVATE(descriptortype) == kUpb_FieldType_Bool);
Protobuf Team Bot42169722023-11-29 03:54:33 +00002748// UPB_ASSUME(upb_MiniTableField_IsScalar(field));
2749// UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
2750// kUpb_FieldRep_1Byte);
Protobuf Team Bot54573a42023-11-21 14:47:34 +00002751// upb_Message_SetField(msg, field, &value, a);
Eric Salo8809a112022-11-21 13:01:06 -08002752// }
2753//
2754// As a result, we can use these universal getters/setters for *all* message
2755// accessors: generated code, MiniTable accessors, and reflection. The only
2756// exception is the binary encoder/decoder, which need to be a bit more clever
Eric Salob598b2d2022-12-22 23:14:27 -08002757// about how they read/write the message data, for efficiency.
Eric Salo10505992022-12-12 12:16:36 -08002758//
2759// These functions work on both extensions and non-extensions. If the field
2760// of a setter is known to be a non-extension, the arena may be NULL and the
2761// returned bool value may be ignored since it will always succeed.
Eric Salo8809a112022-11-21 13:01:06 -08002762
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002763UPB_API_INLINE bool upb_Message_HasBaseField(const struct upb_Message* msg,
2764 const upb_MiniTableField* field) {
Eric Salo10505992022-12-12 12:16:36 -08002765 UPB_ASSERT(upb_MiniTableField_HasPresence(field));
2766 UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
Protobuf Team Bote81cda12023-11-21 18:23:13 +00002767 if (upb_MiniTableField_IsInOneof(field)) {
Protobuf Team Bot7d4ead22023-12-05 21:25:30 +00002768 return UPB_PRIVATE(_upb_Message_GetOneofCase)(msg, field) ==
Protobuf Team Bot7bdd38e2023-12-01 23:06:45 +00002769 upb_MiniTableField_Number(field);
Eric Salo10505992022-12-12 12:16:36 -08002770 } else {
Protobuf Team Bot7713df52023-12-05 20:16:11 +00002771 return UPB_PRIVATE(_upb_Message_GetHasbit)(msg, field);
Eric Salo10505992022-12-12 12:16:36 -08002772 }
2773}
2774
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002775UPB_API_INLINE bool upb_Message_HasExtension(const struct upb_Message* msg,
2776 const upb_MiniTableExtension* e) {
2777 UPB_ASSERT(upb_MiniTableField_HasPresence(&e->UPB_PRIVATE(field)));
2778 return UPB_PRIVATE(_upb_Message_Getext)(msg, e) != NULL;
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00002779}
2780
Protobuf Team Bot1d143b52024-01-25 20:29:43 +00002781UPB_FORCEINLINE void _upb_Message_GetNonExtensionField(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002782 const struct upb_Message* msg, const upb_MiniTableField* field,
Eric Salo8809a112022-11-21 13:01:06 -08002783 const void* default_val, void* val) {
2784 UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
Protobuf Team Bote81cda12023-11-21 18:23:13 +00002785 if ((upb_MiniTableField_IsInOneof(field) ||
Protobuf Team Botddc54062023-12-12 20:03:38 +00002786 !UPB_PRIVATE(_upb_MiniTableField_DataIsZero)(field, default_val)) &&
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002787 !upb_Message_HasBaseField(msg, field)) {
Protobuf Team Botddc54062023-12-12 20:03:38 +00002788 UPB_PRIVATE(_upb_MiniTableField_DataCopy)(field, val, default_val);
Eric Salo8809a112022-11-21 13:01:06 -08002789 return;
2790 }
Protobuf Team Botddc54062023-12-12 20:03:38 +00002791 UPB_PRIVATE(_upb_MiniTableField_DataCopy)
Protobuf Team Bot9bee7472024-01-10 18:09:23 +00002792 (field, val, UPB_PRIVATE(_upb_Message_DataPtr)(msg, field));
Eric Salo8809a112022-11-21 13:01:06 -08002793}
2794
Eric Salo10505992022-12-12 12:16:36 -08002795UPB_INLINE void _upb_Message_GetExtensionField(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002796 const struct upb_Message* msg, const upb_MiniTableExtension* mt_ext,
Eric Salo8809a112022-11-21 13:01:06 -08002797 const void* default_val, void* val) {
Protobuf Team Botc13512a2024-01-25 18:53:49 +00002798 const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getext)(msg, mt_ext);
Protobuf Team Botddc54062023-12-12 20:03:38 +00002799 const upb_MiniTableField* f = &mt_ext->UPB_PRIVATE(field);
2800 UPB_ASSUME(upb_MiniTableField_IsExtension(f));
2801
Eric Salo8809a112022-11-21 13:01:06 -08002802 if (ext) {
Protobuf Team Botddc54062023-12-12 20:03:38 +00002803 UPB_PRIVATE(_upb_MiniTableField_DataCopy)(f, val, &ext->data);
Eric Salo8809a112022-11-21 13:01:06 -08002804 } else {
Protobuf Team Botddc54062023-12-12 20:03:38 +00002805 UPB_PRIVATE(_upb_MiniTableField_DataCopy)(f, val, default_val);
Eric Salo8809a112022-11-21 13:01:06 -08002806 }
2807}
2808
Eric Salo10505992022-12-12 12:16:36 -08002809UPB_INLINE void _upb_Message_SetNonExtensionField(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002810 struct upb_Message* msg, const upb_MiniTableField* field, const void* val) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002811 UPB_ASSERT(!upb_Message_IsFrozen(msg));
Eric Salo8809a112022-11-21 13:01:06 -08002812 UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
Protobuf Team Bot7d4ead22023-12-05 21:25:30 +00002813 UPB_PRIVATE(_upb_Message_SetPresence)(msg, field);
Protobuf Team Botddc54062023-12-12 20:03:38 +00002814 UPB_PRIVATE(_upb_MiniTableField_DataCopy)
Protobuf Team Bot9bee7472024-01-10 18:09:23 +00002815 (field, UPB_PRIVATE(_upb_Message_MutableDataPtr)(msg, field), val);
Eric Salo8809a112022-11-21 13:01:06 -08002816}
2817
Eric Salo10505992022-12-12 12:16:36 -08002818UPB_INLINE bool _upb_Message_SetExtensionField(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002819 struct upb_Message* msg, const upb_MiniTableExtension* mt_ext,
2820 const void* val, upb_Arena* a) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002821 UPB_ASSERT(!upb_Message_IsFrozen(msg));
Eric Salo10505992022-12-12 12:16:36 -08002822 UPB_ASSERT(a);
Protobuf Team Botc13512a2024-01-25 18:53:49 +00002823 upb_Extension* ext =
Protobuf Team Bot9ffbe842024-01-23 04:41:30 +00002824 UPB_PRIVATE(_upb_Message_GetOrCreateExtension)(msg, mt_ext, a);
Eric Salo8809a112022-11-21 13:01:06 -08002825 if (!ext) return false;
Protobuf Team Botddc54062023-12-12 20:03:38 +00002826 UPB_PRIVATE(_upb_MiniTableField_DataCopy)
2827 (&mt_ext->UPB_PRIVATE(field), &ext->data, val);
Eric Salo8809a112022-11-21 13:01:06 -08002828 return true;
2829}
2830
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002831UPB_API_INLINE void upb_Message_Clear(struct upb_Message* msg,
2832 const upb_MiniTable* m) {
2833 UPB_ASSERT(!upb_Message_IsFrozen(msg));
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00002834 memset(msg, 0, m->UPB_PRIVATE(size));
2835}
2836
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002837UPB_API_INLINE void upb_Message_ClearBaseField(struct upb_Message* msg,
2838 const upb_MiniTableField* f) {
2839 UPB_ASSERT(!upb_Message_IsFrozen(msg));
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00002840 if (UPB_PRIVATE(_upb_MiniTableField_HasHasbit)(f)) {
2841 UPB_PRIVATE(_upb_Message_ClearHasbit)(msg, f);
2842 } else if (upb_MiniTableField_IsInOneof(f)) {
2843 uint32_t* ptr = UPB_PRIVATE(_upb_Message_OneofCasePtr)(msg, f);
2844 if (*ptr != upb_MiniTableField_Number(f)) return;
2845 *ptr = 0;
2846 }
2847 const char zeros[16] = {0};
2848 UPB_PRIVATE(_upb_MiniTableField_DataCopy)
Protobuf Team Bot9bee7472024-01-10 18:09:23 +00002849 (f, UPB_PRIVATE(_upb_Message_MutableDataPtr)(msg, f), zeros);
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00002850}
2851
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002852UPB_API_INLINE void upb_Message_ClearExtension(
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00002853 struct upb_Message* msg, const upb_MiniTableExtension* e) {
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002854 UPB_ASSERT(!upb_Message_IsFrozen(msg));
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00002855 upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg);
Protobuf Team Bot2b797382023-12-30 23:16:16 +00002856 if (!in) return;
Protobuf Team Botc13512a2024-01-25 18:53:49 +00002857 const upb_Extension* base = UPB_PTR_AT(in, in->ext_begin, upb_Extension);
2858 upb_Extension* ext = (upb_Extension*)UPB_PRIVATE(_upb_Message_Getext)(msg, e);
Eric Salo10505992022-12-12 12:16:36 -08002859 if (ext) {
2860 *ext = *base;
Protobuf Team Botc13512a2024-01-25 18:53:49 +00002861 in->ext_begin += sizeof(upb_Extension);
Mike Kruskal3bc50492022-12-01 13:34:12 -08002862 }
2863}
2864
Jie Luo3560e232023-06-12 00:33:50 -07002865UPB_INLINE void _upb_Message_AssertMapIsUntagged(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002866 const struct upb_Message* msg, const upb_MiniTableField* field) {
Adam Cozzette7d5592e2023-08-23 12:15:26 -07002867 UPB_UNUSED(msg);
Protobuf Team Bot42169722023-11-29 03:54:33 +00002868 UPB_PRIVATE(_upb_MiniTableField_CheckIsMap)(field);
Jie Luo3560e232023-06-12 00:33:50 -07002869#ifndef NDEBUG
Protobuf Team Bote1253cd2024-01-08 23:09:09 +00002870 uintptr_t default_val = 0;
2871 uintptr_t tagged;
Jie Luo3560e232023-06-12 00:33:50 -07002872 _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged);
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002873 UPB_ASSERT(!upb_TaggedMessagePtr_IsEmpty(tagged));
Jie Luo3560e232023-06-12 00:33:50 -07002874#endif
2875}
2876
Protobuf Team Bote9ea4a52023-12-28 02:56:22 +00002877UPB_INLINE struct upb_Map* _upb_Message_GetOrCreateMutableMap(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002878 struct upb_Message* msg, const upb_MiniTableField* field, size_t key_size,
Eric Salob7d54ac2022-12-29 11:59:42 -08002879 size_t val_size, upb_Arena* arena) {
Protobuf Team Bot42169722023-11-29 03:54:33 +00002880 UPB_PRIVATE(_upb_MiniTableField_CheckIsMap)(field);
Jie Luo3560e232023-06-12 00:33:50 -07002881 _upb_Message_AssertMapIsUntagged(msg, field);
Protobuf Team Bote9ea4a52023-12-28 02:56:22 +00002882 struct upb_Map* map = NULL;
2883 struct upb_Map* default_map_value = NULL;
Eric Salob7d54ac2022-12-29 11:59:42 -08002884 _upb_Message_GetNonExtensionField(msg, field, &default_map_value, &map);
2885 if (!map) {
2886 map = _upb_Map_New(arena, key_size, val_size);
2887 // Check again due to: https://godbolt.org/z/7WfaoKG1r
Protobuf Team Bot42169722023-11-29 03:54:33 +00002888 UPB_PRIVATE(_upb_MiniTableField_CheckIsMap)(field);
Eric Salob7d54ac2022-12-29 11:59:42 -08002889 _upb_Message_SetNonExtensionField(msg, field, &map);
2890 }
2891 return map;
2892}
2893
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002894#ifdef __cplusplus
2895} /* extern "C" */
2896#endif
2897
2898#if defined(__GNUC__) && !defined(__clang__)
2899#pragma GCC diagnostic pop
2900#endif
2901
2902
Sandy Zhange3b09432023-08-07 09:30:02 -07002903#endif // UPB_MESSAGE_INTERNAL_ACCESSORS_H_
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07002904
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002905#ifndef UPB_MESSAGE_MAP_H_
2906#define UPB_MESSAGE_MAP_H_
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002907
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002908#include <stddef.h>
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002909
2910
2911// Must be last.
2912
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002913typedef struct upb_Map upb_Map;
Protobuf Team Botc9a8b462023-11-18 01:30:26 +00002914
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002915#ifdef __cplusplus
2916extern "C" {
2917#endif
2918
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002919// Creates a new map on the given arena with the given key/value size.
2920UPB_API upb_Map* upb_Map_New(upb_Arena* a, upb_CType key_type,
2921 upb_CType value_type);
Protobuf Team Botc9a8b462023-11-18 01:30:26 +00002922
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002923// Returns the number of entries in the map.
2924UPB_API size_t upb_Map_Size(const upb_Map* map);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002925
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002926// Stores a value for the given key into |*val| (or the zero value if the key is
2927// not present). Returns whether the key was present. The |val| pointer may be
2928// NULL, in which case the function tests whether the given key is present.
2929UPB_API bool upb_Map_Get(const upb_Map* map, upb_MessageValue key,
2930 upb_MessageValue* val);
2931
2932// Removes all entries in the map.
2933UPB_API void upb_Map_Clear(upb_Map* map);
2934
2935// Sets the given key to the given value, returning whether the key was inserted
2936// or replaced. If the key was inserted, then any existing iterators will be
2937// invalidated.
2938UPB_API upb_MapInsertStatus upb_Map_Insert(upb_Map* map, upb_MessageValue key,
2939 upb_MessageValue val,
2940 upb_Arena* arena);
2941
2942// Sets the given key to the given value. Returns false if memory allocation
2943// failed. If the key is newly inserted, then any existing iterators will be
2944// invalidated.
2945UPB_API_INLINE bool upb_Map_Set(upb_Map* map, upb_MessageValue key,
2946 upb_MessageValue val, upb_Arena* arena) {
2947 return upb_Map_Insert(map, key, val, arena) !=
2948 kUpb_MapInsertStatus_OutOfMemory;
Protobuf Team Botc9a8b462023-11-18 01:30:26 +00002949}
2950
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002951// Deletes this key from the table. Returns true if the key was present.
2952// If present and |val| is non-NULL, stores the deleted value.
2953UPB_API bool upb_Map_Delete(upb_Map* map, upb_MessageValue key,
2954 upb_MessageValue* val);
2955
2956// (DEPRECATED and going away soon. Do not use.)
2957UPB_INLINE bool upb_Map_Delete2(upb_Map* map, upb_MessageValue key,
2958 upb_MessageValue* val) {
2959 return upb_Map_Delete(map, key, val);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002960}
2961
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002962// Map iteration:
2963//
2964// size_t iter = kUpb_Map_Begin;
2965// upb_MessageValue key, val;
2966// while (upb_Map_Next(map, &key, &val, &iter)) {
2967// ...
2968// }
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002969
Protobuf Team Botb3878b52024-02-08 21:50:53 +00002970#define kUpb_Map_Begin ((size_t) - 1)
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002971
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002972// Advances to the next entry. Returns false if no more entries are present.
2973// Otherwise returns true and populates both *key and *value.
2974UPB_API bool upb_Map_Next(const upb_Map* map, upb_MessageValue* key,
2975 upb_MessageValue* val, size_t* iter);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002976
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002977// Sets the value for the entry pointed to by iter.
2978// WARNING: this does not currently work for string values!
2979UPB_API void upb_Map_SetEntryValue(upb_Map* map, size_t iter,
2980 upb_MessageValue val);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002981
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002982// DEPRECATED iterator, slated for removal.
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002983
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002984/* Map iteration:
2985 *
2986 * size_t iter = kUpb_Map_Begin;
2987 * while (upb_MapIterator_Next(map, &iter)) {
2988 * upb_MessageValue key = upb_MapIterator_Key(map, iter);
2989 * upb_MessageValue val = upb_MapIterator_Value(map, iter);
2990 * }
2991 */
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002992
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002993// Advances to the next entry. Returns false if no more entries are present.
2994UPB_API bool upb_MapIterator_Next(const upb_Map* map, size_t* iter);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00002995
Protobuf Team Bot499c7482023-12-30 01:42:17 +00002996// Returns true if the iterator still points to a valid entry, or false if the
2997// iterator is past the last element. It is an error to call this function with
2998// kUpb_Map_Begin (you must call next() at least once first).
2999UPB_API bool upb_MapIterator_Done(const upb_Map* map, size_t iter);
3000
3001// Returns the key and value for this entry of the map.
3002UPB_API upb_MessageValue upb_MapIterator_Key(const upb_Map* map, size_t iter);
3003UPB_API upb_MessageValue upb_MapIterator_Value(const upb_Map* map, size_t iter);
Protobuf Team Bot030ab8d2023-12-01 19:20:11 +00003004
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00003005// Mark a map and all of its descendents as frozen/immutable.
3006// If the map values are messages then |m| must point to the minitable for
3007// those messages. Otherwise |m| must be NULL.
3008UPB_API void upb_Map_Freeze(upb_Map* map, const upb_MiniTable* m);
3009
3010// Returns whether a map has been frozen.
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003011UPB_API_INLINE bool upb_Map_IsFrozen(const upb_Map* map);
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00003012
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00003013#ifdef __cplusplus
3014} /* extern "C" */
3015#endif
3016
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003017
3018#endif /* UPB_MESSAGE_MAP_H_ */
3019
3020#ifndef UPB_MINI_TABLE_TAGGED_PTR_H_
3021#define UPB_MINI_TABLE_TAGGED_PTR_H_
3022
3023#include <stdint.h>
Protobuf Team Botc9a8b462023-11-18 01:30:26 +00003024
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00003025
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003026// Public APIs for message operations that do not depend on the schema.
3027//
3028// MiniTable-based accessors live in accessors.h.
3029
3030#ifndef UPB_MESSAGE_MESSAGE_H_
3031#define UPB_MESSAGE_MESSAGE_H_
3032
3033#include <stddef.h>
3034
3035
3036// Must be last.
3037
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003038typedef struct upb_Message upb_Message;
3039
3040#ifdef __cplusplus
3041extern "C" {
3042#endif
3043
3044// Creates a new message with the given mini_table on the given arena.
3045UPB_API upb_Message* upb_Message_New(const upb_MiniTable* m, upb_Arena* arena);
3046
3047// Returns a reference to the message's unknown data.
3048const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len);
3049
3050// Removes partial unknown data from message.
3051void upb_Message_DeleteUnknown(upb_Message* msg, const char* data, size_t len);
3052
3053// Returns the number of extensions present in this message.
3054size_t upb_Message_ExtensionCount(const upb_Message* msg);
3055
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00003056// Mark a message and all of its descendents as frozen/immutable.
3057UPB_API void upb_Message_Freeze(upb_Message* msg, const upb_MiniTable* m);
3058
3059// Returns whether a message has been frozen.
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003060UPB_API_INLINE bool upb_Message_IsFrozen(const upb_Message* msg);
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00003061
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003062#ifdef __cplusplus
3063} /* extern "C" */
3064#endif
3065
3066
3067#endif /* UPB_MESSAGE_MESSAGE_H_ */
3068
3069// Must be last.
3070
3071// When a upb_Message* is stored in a message, array, or map, it is stored in a
3072// tagged form. If the tag bit is set, the referenced upb_Message is of type
3073// _kUpb_MiniTable_Empty (a sentinel message type with no fields) instead of
3074// that field's true message type. This forms the basis of what we call
3075// "dynamic tree shaking."
3076//
3077// See the documentation for kUpb_DecodeOption_ExperimentalAllowUnlinked for
3078// more information.
3079
3080typedef uintptr_t upb_TaggedMessagePtr;
3081
3082#ifdef __cplusplus
3083extern "C" {
3084#endif
3085
3086// Users who enable unlinked sub-messages must use this to test whether a
3087// message is empty before accessing it. If a message is empty, it must be
3088// first promoted using the interfaces in message/promote.h.
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003089UPB_API_INLINE bool upb_TaggedMessagePtr_IsEmpty(upb_TaggedMessagePtr ptr);
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003090
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003091UPB_API_INLINE upb_Message* upb_TaggedMessagePtr_GetNonEmptyMessage(
3092 upb_TaggedMessagePtr ptr);
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003093
3094#ifdef __cplusplus
3095} /* extern "C" */
3096#endif
3097
3098
3099#endif /* UPB_MINI_TABLE_TAGGED_PTR_H_ */
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00003100
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003101#ifndef UPB_MINI_TABLE_SUB_H_
3102#define UPB_MINI_TABLE_SUB_H_
3103
3104
3105// Must be last.
3106
Protobuf Team Bot9b4aff22023-12-27 21:35:01 +00003107typedef union upb_MiniTableSub upb_MiniTableSub;
3108
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003109#ifdef __cplusplus
3110extern "C" {
3111#endif
3112
3113// Constructors
3114
3115UPB_API_INLINE upb_MiniTableSub
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003116upb_MiniTableSub_FromEnum(const upb_MiniTableEnum* subenum);
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003117
3118UPB_API_INLINE upb_MiniTableSub
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003119upb_MiniTableSub_FromMessage(const upb_MiniTable* submsg);
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003120
3121// Getters
3122
3123UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTableSub_Enum(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003124 upb_MiniTableSub sub);
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003125
3126UPB_API_INLINE const upb_MiniTable* upb_MiniTableSub_Message(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003127 upb_MiniTableSub sub);
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003128
3129#ifdef __cplusplus
3130} /* extern "C" */
3131#endif
3132
3133
3134#endif /* UPB_MINI_TABLE_SUB_H_ */
3135
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003136// Must be last.
3137
3138#ifdef __cplusplus
3139extern "C" {
3140#endif
Eric Salo10505992022-12-12 12:16:36 -08003141
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00003142// Functions ending in BaseField() take a (upb_MiniTableField*) argument
3143// and work only on non-extension fields.
3144//
3145// Functions ending in Extension() take a (upb_MiniTableExtension*) argument
3146// and work only on extensions.
Mike Kruskal3bc50492022-12-01 13:34:12 -08003147
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003148UPB_API_INLINE void upb_Message_Clear(upb_Message* msg, const upb_MiniTable* m);
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00003149
3150UPB_API_INLINE void upb_Message_ClearBaseField(upb_Message* msg,
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003151 const upb_MiniTableField* f);
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00003152
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003153UPB_API_INLINE void upb_Message_ClearExtension(upb_Message* msg,
3154 const upb_MiniTableExtension* e);
Jie Luof36a5c62023-05-23 17:56:18 -07003155
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00003156UPB_API_INLINE bool upb_Message_HasBaseField(const upb_Message* msg,
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003157 const upb_MiniTableField* f);
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00003158
3159UPB_API_INLINE bool upb_Message_HasExtension(const upb_Message* msg,
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003160 const upb_MiniTableExtension* e);
Eric Salo8809a112022-11-21 13:01:06 -08003161
Eric Salob598b2d2022-12-22 23:14:27 -08003162UPB_API_INLINE uint32_t upb_Message_WhichOneofFieldNumber(
3163 const upb_Message* message, const upb_MiniTableField* oneof_field) {
Protobuf Team Bote81cda12023-11-21 18:23:13 +00003164 UPB_ASSUME(upb_MiniTableField_IsInOneof(oneof_field));
Protobuf Team Bot7d4ead22023-12-05 21:25:30 +00003165 return UPB_PRIVATE(_upb_Message_GetOneofCase)(message, oneof_field);
Eric Salob598b2d2022-12-22 23:14:27 -08003166}
3167
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003168// NOTE: The default_val is only used for fields that support presence.
3169// For repeated/map fields, the resulting upb_Array*/upb_Map* can be NULL if a
3170// upb_Array/upb_Map has not been allocated yet. Array/map fields do not have
3171// presence, so this is semantically identical to a pointer to an empty
3172// array/map, and must be treated the same for all semantic purposes.
3173UPB_INLINE upb_MessageValue
3174upb_Message_GetField(const upb_Message* msg, const upb_MiniTableField* field,
3175 upb_MessageValue default_val) {
3176 upb_MessageValue ret;
3177 if (upb_MiniTableField_IsExtension(field)) {
3178 _upb_Message_GetExtensionField(msg, (upb_MiniTableExtension*)field,
3179 &default_val, &ret);
3180 } else {
3181 _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
3182 }
3183 return ret;
3184}
3185
Protobuf Team Bot5ec1e252024-03-05 22:36:44 +00003186// Sets the value of the given field in the given msg. The return value is true
3187// if the operation completed successfully, or false if memory allocation
3188// failed.
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003189UPB_INLINE bool upb_Message_SetField(upb_Message* msg,
3190 const upb_MiniTableField* field,
3191 upb_MessageValue val, upb_Arena* a) {
3192 if (upb_MiniTableField_IsExtension(field)) {
3193 const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field;
3194 return _upb_Message_SetExtensionField(msg, ext, &val, a);
3195 } else {
3196 _upb_Message_SetNonExtensionField(msg, field, &val);
3197 return true;
3198 }
3199}
3200
Eric Salo10505992022-12-12 12:16:36 -08003201UPB_API_INLINE bool upb_Message_GetBool(const upb_Message* msg,
3202 const upb_MiniTableField* field,
3203 bool default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003204 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003205 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3206 kUpb_FieldRep_1Byte);
3207 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003208 upb_MessageValue def;
3209 def.bool_val = default_val;
3210 return upb_Message_GetField(msg, field, def).bool_val;
Eric Salo8809a112022-11-21 13:01:06 -08003211}
3212
Eric Salo10505992022-12-12 12:16:36 -08003213UPB_API_INLINE bool upb_Message_SetBool(upb_Message* msg,
3214 const upb_MiniTableField* field,
3215 bool value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003216 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Bool);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003217 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3218 kUpb_FieldRep_1Byte);
3219 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003220 upb_MessageValue val;
3221 val.bool_val = value;
3222 return upb_Message_SetField(msg, field, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08003223}
3224
Eric Salo10505992022-12-12 12:16:36 -08003225UPB_API_INLINE int32_t upb_Message_GetInt32(const upb_Message* msg,
3226 const upb_MiniTableField* field,
3227 int32_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003228 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 ||
3229 upb_MiniTableField_CType(field) == kUpb_CType_Enum);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003230 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3231 kUpb_FieldRep_4Byte);
3232 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003233
3234 upb_MessageValue def;
3235 def.int32_val = default_val;
3236 return upb_Message_GetField(msg, field, def).int32_val;
Eric Salo8809a112022-11-21 13:01:06 -08003237}
3238
Eric Salo10505992022-12-12 12:16:36 -08003239UPB_API_INLINE bool upb_Message_SetInt32(upb_Message* msg,
3240 const upb_MiniTableField* field,
3241 int32_t value, upb_Arena* a) {
Deanna Garciab26afb52023-04-25 13:37:18 -07003242 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 ||
3243 upb_MiniTableField_CType(field) == kUpb_CType_Enum);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003244 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3245 kUpb_FieldRep_4Byte);
3246 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003247 upb_MessageValue val;
3248 val.int32_val = value;
3249 return upb_Message_SetField(msg, field, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08003250}
3251
Eric Salo10505992022-12-12 12:16:36 -08003252UPB_API_INLINE uint32_t upb_Message_GetUInt32(const upb_Message* msg,
3253 const upb_MiniTableField* field,
3254 uint32_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003255 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003256 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3257 kUpb_FieldRep_4Byte);
3258 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003259
3260 upb_MessageValue def;
3261 def.uint32_val = default_val;
3262 return upb_Message_GetField(msg, field, def).uint32_val;
Eric Salo8809a112022-11-21 13:01:06 -08003263}
3264
Eric Salo10505992022-12-12 12:16:36 -08003265UPB_API_INLINE bool upb_Message_SetUInt32(upb_Message* msg,
3266 const upb_MiniTableField* field,
3267 uint32_t value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003268 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt32);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003269 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3270 kUpb_FieldRep_4Byte);
3271 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003272 upb_MessageValue val;
3273 val.uint32_val = value;
3274 return upb_Message_SetField(msg, field, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08003275}
3276
Deanna Garciab26afb52023-04-25 13:37:18 -07003277UPB_API_INLINE void upb_Message_SetClosedEnum(
Eric Salo3f36a912022-12-05 14:12:25 -08003278 upb_Message* msg, const upb_MiniTable* msg_mini_table,
3279 const upb_MiniTableField* field, int32_t value) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003280 UPB_ASSERT(upb_MiniTableField_IsClosedEnum(field));
Protobuf Team Bot42169722023-11-29 03:54:33 +00003281 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3282 kUpb_FieldRep_4Byte);
3283 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Eric Salo8809a112022-11-21 13:01:06 -08003284 UPB_ASSERT(upb_MiniTableEnum_CheckValue(
3285 upb_MiniTable_GetSubEnumTable(msg_mini_table, field), value));
Eric Salo10505992022-12-12 12:16:36 -08003286 _upb_Message_SetNonExtensionField(msg, field, &value);
Eric Salo8809a112022-11-21 13:01:06 -08003287}
3288
Eric Salo10505992022-12-12 12:16:36 -08003289UPB_API_INLINE int64_t upb_Message_GetInt64(const upb_Message* msg,
3290 const upb_MiniTableField* field,
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003291 int64_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003292 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003293 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3294 kUpb_FieldRep_8Byte);
3295 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003296
3297 upb_MessageValue def;
3298 def.int64_val = default_val;
3299 return upb_Message_GetField(msg, field, def).int64_val;
Eric Salo8809a112022-11-21 13:01:06 -08003300}
3301
Eric Salo10505992022-12-12 12:16:36 -08003302UPB_API_INLINE bool upb_Message_SetInt64(upb_Message* msg,
3303 const upb_MiniTableField* field,
3304 int64_t value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003305 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int64);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003306 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3307 kUpb_FieldRep_8Byte);
3308 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003309 upb_MessageValue val;
3310 val.int64_val = value;
3311 return upb_Message_SetField(msg, field, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08003312}
3313
Eric Salo10505992022-12-12 12:16:36 -08003314UPB_API_INLINE uint64_t upb_Message_GetUInt64(const upb_Message* msg,
3315 const upb_MiniTableField* field,
3316 uint64_t default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003317 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003318 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3319 kUpb_FieldRep_8Byte);
3320 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003321
3322 upb_MessageValue def;
3323 def.uint64_val = default_val;
3324 return upb_Message_GetField(msg, field, def).uint64_val;
Eric Salo8809a112022-11-21 13:01:06 -08003325}
3326
Eric Salo10505992022-12-12 12:16:36 -08003327UPB_API_INLINE bool upb_Message_SetUInt64(upb_Message* msg,
3328 const upb_MiniTableField* field,
3329 uint64_t value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003330 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_UInt64);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003331 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3332 kUpb_FieldRep_8Byte);
3333 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003334 upb_MessageValue val;
3335 val.uint64_val = value;
3336 return upb_Message_SetField(msg, field, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08003337}
3338
Eric Salo10505992022-12-12 12:16:36 -08003339UPB_API_INLINE float upb_Message_GetFloat(const upb_Message* msg,
3340 const upb_MiniTableField* field,
3341 float default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003342 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003343 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3344 kUpb_FieldRep_4Byte);
3345 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003346
3347 upb_MessageValue def;
3348 def.float_val = default_val;
3349 return upb_Message_GetField(msg, field, def).float_val;
Eric Salo8809a112022-11-21 13:01:06 -08003350}
3351
Eric Salo10505992022-12-12 12:16:36 -08003352UPB_API_INLINE bool upb_Message_SetFloat(upb_Message* msg,
3353 const upb_MiniTableField* field,
3354 float value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003355 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Float);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003356 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3357 kUpb_FieldRep_4Byte);
3358 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003359 upb_MessageValue val;
3360 val.float_val = value;
3361 return upb_Message_SetField(msg, field, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08003362}
3363
Eric Salo10505992022-12-12 12:16:36 -08003364UPB_API_INLINE double upb_Message_GetDouble(const upb_Message* msg,
3365 const upb_MiniTableField* field,
3366 double default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003367 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003368 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3369 kUpb_FieldRep_8Byte);
3370 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003371
3372 upb_MessageValue def;
3373 def.double_val = default_val;
3374 return upb_Message_GetField(msg, field, def).double_val;
Eric Salo8809a112022-11-21 13:01:06 -08003375}
3376
Eric Salo10505992022-12-12 12:16:36 -08003377UPB_API_INLINE bool upb_Message_SetDouble(upb_Message* msg,
3378 const upb_MiniTableField* field,
3379 double value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003380 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Double);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003381 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3382 kUpb_FieldRep_8Byte);
3383 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003384 upb_MessageValue val;
3385 val.double_val = value;
3386 return upb_Message_SetField(msg, field, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08003387}
3388
Eric Salo3f36a912022-12-05 14:12:25 -08003389UPB_API_INLINE upb_StringView
Eric Salo10505992022-12-12 12:16:36 -08003390upb_Message_GetString(const upb_Message* msg, const upb_MiniTableField* field,
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003391 upb_StringView default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003392 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String ||
3393 upb_MiniTableField_CType(field) == kUpb_CType_Bytes);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003394 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3395 kUpb_FieldRep_StringView);
3396 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003397
3398 upb_MessageValue def;
3399 def.str_val = default_val;
3400 return upb_Message_GetField(msg, field, def).str_val;
Eric Salo8809a112022-11-21 13:01:06 -08003401}
3402
Protobuf Team Bot33f367d2024-03-06 18:26:18 +00003403// Sets the value of a `string` or `bytes` field. The bytes of the value are not
3404// copied, so it is the caller's responsibility to ensure that they remain valid
3405// for the lifetime of `msg`. That might be done by copying them into the given
3406// arena, or by fusing that arena with the arena the bytes live in, for example.
Eric Salo10505992022-12-12 12:16:36 -08003407UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg,
3408 const upb_MiniTableField* field,
3409 upb_StringView value, upb_Arena* a) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003410 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_String ||
3411 upb_MiniTableField_CType(field) == kUpb_CType_Bytes);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003412 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
3413 kUpb_FieldRep_StringView);
3414 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003415 upb_MessageValue val;
3416 val.str_val = value;
3417 return upb_Message_SetField(msg, field, val, a);
Eric Salo8809a112022-11-21 13:01:06 -08003418}
3419
Jie Luo3560e232023-06-12 00:33:50 -07003420UPB_API_INLINE upb_TaggedMessagePtr upb_Message_GetTaggedMessagePtr(
Eric Salo8809a112022-11-21 13:01:06 -08003421 const upb_Message* msg, const upb_MiniTableField* field,
3422 upb_Message* default_val) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003423 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003424 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
Eric Salo8809a112022-11-21 13:01:06 -08003425 UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
Protobuf Team Bot42169722023-11-29 03:54:33 +00003426 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Jie Luo3560e232023-06-12 00:33:50 -07003427 upb_TaggedMessagePtr tagged;
3428 _upb_Message_GetNonExtensionField(msg, field, &default_val, &tagged);
3429 return tagged;
Eric Salo8809a112022-11-21 13:01:06 -08003430}
3431
Jie Luo3560e232023-06-12 00:33:50 -07003432UPB_API_INLINE const upb_Message* upb_Message_GetMessage(
Protobuf Team Bot4687ef32024-02-01 03:10:38 +00003433 const upb_Message* msg, const upb_MiniTableField* field) {
Jie Luo3560e232023-06-12 00:33:50 -07003434 upb_TaggedMessagePtr tagged =
Protobuf Team Bot4687ef32024-02-01 03:10:38 +00003435 upb_Message_GetTaggedMessagePtr(msg, field, NULL);
Jie Luo3560e232023-06-12 00:33:50 -07003436 return upb_TaggedMessagePtr_GetNonEmptyMessage(tagged);
3437}
3438
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00003439UPB_API_INLINE upb_Message* upb_Message_GetMutableMessage(
3440 upb_Message* msg, const upb_MiniTableField* field) {
Protobuf Team Bot4687ef32024-02-01 03:10:38 +00003441 return (upb_Message*)upb_Message_GetMessage(msg, field);
Protobuf Team Bot886a0b12024-01-26 21:23:01 +00003442}
3443
Jie Luo3560e232023-06-12 00:33:50 -07003444// For internal use only; users cannot set tagged messages because only the
3445// parser and the message copier are allowed to directly create an empty
3446// message.
3447UPB_API_INLINE void _upb_Message_SetTaggedMessagePtr(
3448 upb_Message* msg, const upb_MiniTable* mini_table,
3449 const upb_MiniTableField* field, upb_TaggedMessagePtr sub_message) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003450 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003451 UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
Eric Salo8809a112022-11-21 13:01:06 -08003452 UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
Protobuf Team Bot42169722023-11-29 03:54:33 +00003453 UPB_ASSUME(upb_MiniTableField_IsScalar(field));
Protobuf Team Bot842f56b2023-11-29 05:02:57 +00003454 UPB_ASSERT(upb_MiniTableSub_Message(
Protobuf Team Bot07194fc2023-11-30 05:43:03 +00003455 mini_table->UPB_PRIVATE(subs)[field->UPB_PRIVATE(submsg_index)]));
Eric Salo10505992022-12-12 12:16:36 -08003456 _upb_Message_SetNonExtensionField(msg, field, &sub_message);
Eric Salo8809a112022-11-21 13:01:06 -08003457}
3458
Jie Luo3560e232023-06-12 00:33:50 -07003459UPB_API_INLINE void upb_Message_SetMessage(upb_Message* msg,
3460 const upb_MiniTable* mini_table,
3461 const upb_MiniTableField* field,
3462 upb_Message* sub_message) {
3463 _upb_Message_SetTaggedMessagePtr(
Protobuf Team Bot499c7482023-12-30 01:42:17 +00003464 msg, mini_table, field,
3465 UPB_PRIVATE(_upb_TaggedMessagePtr_Pack)(sub_message, false));
Jie Luo3560e232023-06-12 00:33:50 -07003466}
3467
Mike Kruskal232ecf42023-01-14 00:09:40 -08003468UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage(
Eric Salo8809a112022-11-21 13:01:06 -08003469 upb_Message* msg, const upb_MiniTable* mini_table,
3470 const upb_MiniTableField* field, upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003471 UPB_ASSERT(arena);
3472 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Protobuf Team Bota9a40062023-12-19 04:10:41 +00003473 upb_Message* sub_message =
3474 *UPB_PTR_AT(msg, field->UPB_ONLYBITS(offset), upb_Message*);
Eric Salo8809a112022-11-21 13:01:06 -08003475 if (!sub_message) {
Protobuf Team Bot842f56b2023-11-29 05:02:57 +00003476 const upb_MiniTable* sub_mini_table = upb_MiniTableSub_Message(
Protobuf Team Bot07194fc2023-11-30 05:43:03 +00003477 mini_table->UPB_PRIVATE(subs)[field->UPB_PRIVATE(submsg_index)]);
Eric Salo8809a112022-11-21 13:01:06 -08003478 UPB_ASSERT(sub_mini_table);
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00003479 sub_message = _upb_Message_New(sub_mini_table, arena);
Protobuf Team Bota9a40062023-12-19 04:10:41 +00003480 *UPB_PTR_AT(msg, field->UPB_ONLYBITS(offset), upb_Message*) = sub_message;
Protobuf Team Bot7d4ead22023-12-05 21:25:30 +00003481 UPB_PRIVATE(_upb_Message_SetPresence)(msg, field);
Eric Salo8809a112022-11-21 13:01:06 -08003482 }
3483 return sub_message;
3484}
3485
Eric Salob598b2d2022-12-22 23:14:27 -08003486UPB_API_INLINE const upb_Array* upb_Message_GetArray(
Eric Salo8809a112022-11-21 13:01:06 -08003487 const upb_Message* msg, const upb_MiniTableField* field) {
Protobuf Team Bot42169722023-11-29 03:54:33 +00003488 UPB_PRIVATE(_upb_MiniTableField_CheckIsArray)(field);
Deanna Garciac7d979d2023-04-14 17:22:13 -07003489 upb_Array* ret;
Eric Salo8809a112022-11-21 13:01:06 -08003490 const upb_Array* default_val = NULL;
Eric Salo10505992022-12-12 12:16:36 -08003491 _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08003492 return ret;
3493}
3494
Eric Salob598b2d2022-12-22 23:14:27 -08003495UPB_API_INLINE upb_Array* upb_Message_GetMutableArray(
Eric Salo8809a112022-11-21 13:01:06 -08003496 upb_Message* msg, const upb_MiniTableField* field) {
Protobuf Team Bot42169722023-11-29 03:54:33 +00003497 UPB_PRIVATE(_upb_MiniTableField_CheckIsArray)(field);
Eric Salob598b2d2022-12-22 23:14:27 -08003498 return (upb_Array*)upb_Message_GetArray(msg, field);
Eric Salo8809a112022-11-21 13:01:06 -08003499}
3500
Eric Salob598b2d2022-12-22 23:14:27 -08003501UPB_API_INLINE upb_Array* upb_Message_GetOrCreateMutableArray(
Eric Salob7d54ac2022-12-29 11:59:42 -08003502 upb_Message* msg, const upb_MiniTableField* field, upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003503 UPB_ASSERT(arena);
Protobuf Team Bot42169722023-11-29 03:54:33 +00003504 UPB_PRIVATE(_upb_MiniTableField_CheckIsArray)(field);
Eric Salob598b2d2022-12-22 23:14:27 -08003505 upb_Array* array = upb_Message_GetMutableArray(msg, field);
3506 if (!array) {
Protobuf Team Bot42169722023-11-29 03:54:33 +00003507 array = UPB_PRIVATE(_upb_Array_New)(
3508 arena, 4, UPB_PRIVATE(_upb_MiniTableField_ElemSizeLg2)(field));
Eric Salob7d54ac2022-12-29 11:59:42 -08003509 // Check again due to: https://godbolt.org/z/7WfaoKG1r
Protobuf Team Bot42169722023-11-29 03:54:33 +00003510 UPB_PRIVATE(_upb_MiniTableField_CheckIsArray)(field);
Protobuf Team Bot54573a42023-11-21 14:47:34 +00003511 upb_MessageValue val;
3512 val.array_val = array;
3513 upb_Message_SetField(msg, field, val, arena);
Eric Salob598b2d2022-12-22 23:14:27 -08003514 }
3515 return array;
3516}
3517
Jie Luof36a5c62023-05-23 17:56:18 -07003518UPB_API_INLINE void* upb_Message_ResizeArrayUninitialized(
Eric Salob7d54ac2022-12-29 11:59:42 -08003519 upb_Message* msg, const upb_MiniTableField* field, size_t size,
3520 upb_Arena* arena) {
Protobuf Team Bot42169722023-11-29 03:54:33 +00003521 UPB_PRIVATE(_upb_MiniTableField_CheckIsArray)(field);
Eric Salob7d54ac2022-12-29 11:59:42 -08003522 upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00003523 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(arr, size, arena)) {
3524 return NULL;
3525 }
3526 return upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08003527}
Eric Salo10505992022-12-12 12:16:36 -08003528
Eric Salob7d54ac2022-12-29 11:59:42 -08003529UPB_API_INLINE const upb_Map* upb_Message_GetMap(
3530 const upb_Message* msg, const upb_MiniTableField* field) {
Protobuf Team Bot42169722023-11-29 03:54:33 +00003531 UPB_PRIVATE(_upb_MiniTableField_CheckIsMap)(field);
Jie Luo3560e232023-06-12 00:33:50 -07003532 _upb_Message_AssertMapIsUntagged(msg, field);
Deanna Garciac7d979d2023-04-14 17:22:13 -07003533 upb_Map* ret;
Eric Salob7d54ac2022-12-29 11:59:42 -08003534 const upb_Map* default_val = NULL;
3535 _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
3536 return ret;
3537}
3538
Jie Luo3560e232023-06-12 00:33:50 -07003539UPB_API_INLINE upb_Map* upb_Message_GetMutableMap(
3540 upb_Message* msg, const upb_MiniTableField* field) {
3541 return (upb_Map*)upb_Message_GetMap(msg, field);
3542}
3543
Mike Kruskal232ecf42023-01-14 00:09:40 -08003544UPB_API_INLINE upb_Map* upb_Message_GetOrCreateMutableMap(
Eric Salob598b2d2022-12-22 23:14:27 -08003545 upb_Message* msg, const upb_MiniTable* map_entry_mini_table,
3546 const upb_MiniTableField* field, upb_Arena* arena) {
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07003547 UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
Eric Salob7d54ac2022-12-29 11:59:42 -08003548 const upb_MiniTableField* map_entry_key_field =
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +00003549 &map_entry_mini_table->UPB_ONLYBITS(fields)[0];
Eric Salob7d54ac2022-12-29 11:59:42 -08003550 const upb_MiniTableField* map_entry_value_field =
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +00003551 &map_entry_mini_table->UPB_ONLYBITS(fields)[1];
Mike Kruskal232ecf42023-01-14 00:09:40 -08003552 return _upb_Message_GetOrCreateMutableMap(
Eric Salob7d54ac2022-12-29 11:59:42 -08003553 msg, field,
3554 _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_key_field)),
3555 _upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_value_field)),
3556 arena);
Eric Salob598b2d2022-12-22 23:14:27 -08003557}
3558
3559// Updates a map entry given an entry message.
Protobuf Team Bot5b343372023-12-19 06:18:53 +00003560bool upb_Message_SetMapEntry(upb_Map* map, const upb_MiniTable* mini_table,
3561 const upb_MiniTableField* field,
3562 upb_Message* map_entry_message, upb_Arena* arena);
Eric Salob598b2d2022-12-22 23:14:27 -08003563
Eric Salo8809a112022-11-21 13:01:06 -08003564#ifdef __cplusplus
3565} /* extern "C" */
3566#endif
3567
3568
3569#endif // UPB_MESSAGE_ACCESSORS_H_
3570
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +00003571// These functions are only used by generated code.
3572
3573#ifndef UPB_MESSAGE_MAP_GENCODE_UTIL_H_
3574#define UPB_MESSAGE_MAP_GENCODE_UTIL_H_
3575
3576
3577// Must be last.
3578
3579#ifdef __cplusplus
3580extern "C" {
3581#endif
3582
3583// Message map operations, these get the map from the message first.
3584
3585UPB_INLINE void _upb_msg_map_key(const void* msg, void* key, size_t size) {
3586 const upb_tabent* ent = (const upb_tabent*)msg;
3587 uint32_t u32len;
3588 upb_StringView k;
3589 k.data = upb_tabstr(ent->key, &u32len);
3590 k.size = u32len;
3591 _upb_map_fromkey(k, key, size);
3592}
3593
3594UPB_INLINE void _upb_msg_map_value(const void* msg, void* val, size_t size) {
3595 const upb_tabent* ent = (const upb_tabent*)msg;
3596 upb_value v = {ent->val.val};
3597 _upb_map_fromvalue(v, val, size);
3598}
3599
3600UPB_INLINE void _upb_msg_map_set_value(void* msg, const void* val,
3601 size_t size) {
3602 upb_tabent* ent = (upb_tabent*)msg;
3603 // This is like _upb_map_tovalue() except the entry already exists
3604 // so we can reuse the allocated upb_StringView for string fields.
3605 if (size == UPB_MAPTYPE_STRING) {
3606 upb_StringView* strp = (upb_StringView*)(uintptr_t)ent->val.val;
3607 memcpy(strp, val, sizeof(*strp));
3608 } else {
3609 memcpy(&ent->val.val, val, size);
3610 }
3611}
3612
3613#ifdef __cplusplus
3614} /* extern "C" */
3615#endif
3616
3617
3618#endif /* UPB_MESSAGE_MAP_GENCODE_UTIL_H_ */
3619
Mike Kruskal9d435022023-07-11 12:45:07 -07003620#ifndef UPB_MINI_TABLE_DECODE_H_
3621#define UPB_MINI_TABLE_DECODE_H_
3622
3623
Mike Kruskal9d435022023-07-11 12:45:07 -07003624// Export the newer headers, for legacy users. New users should include the
3625// more specific headers directly.
3626// IWYU pragma: begin_exports
Mike Kruskal9d435022023-07-11 12:45:07 -07003627#ifndef UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3628#define UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3629
3630
3631// Must be last.
3632
3633#ifdef __cplusplus
3634extern "C" {
3635#endif
3636
3637// Builds a upb_MiniTableEnum from an enum MiniDescriptor. The MiniDescriptor
3638// must be for an enum, not a message.
3639UPB_API upb_MiniTableEnum* upb_MiniDescriptor_BuildEnum(const char* data,
3640 size_t len,
3641 upb_Arena* arena,
3642 upb_Status* status);
3643
Protobuf Team Bot986cbb62023-09-19 15:03:51 +00003644// TODO: Deprecated name; update callers.
Mike Kruskal9d435022023-07-11 12:45:07 -07003645UPB_API_INLINE upb_MiniTableEnum* upb_MiniTableEnum_Build(const char* data,
3646 size_t len,
3647 upb_Arena* arena,
3648 upb_Status* status) {
3649 return upb_MiniDescriptor_BuildEnum(data, len, arena, status);
3650}
3651
3652#ifdef __cplusplus
3653} /* extern "C" */
3654#endif
3655
3656
3657#endif // UPB_MINI_DESCRIPTOR_BUILD_ENUM_H_
3658
3659// Functions for linking MiniTables together once they are built from a
3660// MiniDescriptor.
3661//
3662// These functions have names like upb_MiniTable_Link() because they operate on
3663// MiniTables. We put them here, rather than in the mini_table/ directory,
3664// because they are only needed when building MiniTables from MiniDescriptors.
3665// The interfaces in mini_table/ assume that MiniTables are immutable.
3666
3667#ifndef UPB_MINI_DESCRIPTOR_LINK_H_
3668#define UPB_MINI_DESCRIPTOR_LINK_H_
3669
3670
3671// Must be last.
3672
3673#ifdef __cplusplus
3674extern "C" {
3675#endif
3676
3677// Links a sub-message field to a MiniTable for that sub-message. If a
3678// sub-message field is not linked, it will be treated as an unknown field
3679// during parsing, and setting the field will not be allowed. It is possible
3680// to link the message field later, at which point it will no longer be treated
3681// as unknown. However there is no synchronization for this operation, which
3682// means parallel mutation requires external synchronization.
3683// Returns success/failure.
3684UPB_API bool upb_MiniTable_SetSubMessage(upb_MiniTable* table,
3685 upb_MiniTableField* field,
3686 const upb_MiniTable* sub);
3687
3688// Links an enum field to a MiniTable for that enum.
3689// All enum fields must be linked prior to parsing.
3690// Returns success/failure.
3691UPB_API bool upb_MiniTable_SetSubEnum(upb_MiniTable* table,
3692 upb_MiniTableField* field,
3693 const upb_MiniTableEnum* sub);
3694
3695// Returns a list of fields that require linking at runtime, to connect the
3696// MiniTable to its sub-messages and sub-enums. The list of fields will be
3697// written to the `subs` array, which must have been allocated by the caller
3698// and must be large enough to hold a list of all fields in the message.
3699//
3700// The order of the fields returned by this function is significant: it matches
3701// the order expected by upb_MiniTable_Link() below.
3702//
3703// The return value packs the sub-message count and sub-enum count into a single
3704// integer like so:
3705// return (msg_count << 16) | enum_count;
3706UPB_API uint32_t upb_MiniTable_GetSubList(const upb_MiniTable* mt,
3707 const upb_MiniTableField** subs);
3708
3709// Links a message to its sub-messages and sub-enums. The caller must pass
3710// arrays of sub-tables and sub-enums, in the same length and order as is
3711// returned by upb_MiniTable_GetSubList() above. However, individual elements
3712// of the sub_tables may be NULL if those sub-messages were tree shaken.
3713//
3714// Returns false if either array is too short, or if any of the tables fails
3715// to link.
3716UPB_API bool upb_MiniTable_Link(upb_MiniTable* mt,
3717 const upb_MiniTable** sub_tables,
3718 size_t sub_table_count,
3719 const upb_MiniTableEnum** sub_enums,
3720 size_t sub_enum_count);
3721
3722#ifdef __cplusplus
3723} /* extern "C" */
3724#endif
3725
3726
3727#endif // UPB_MINI_DESCRIPTOR_LINK_H_
3728// IWYU pragma: end_exports
3729
3730// Must be last.
3731
3732typedef enum {
3733 kUpb_MiniTablePlatform_32Bit,
3734 kUpb_MiniTablePlatform_64Bit,
3735 kUpb_MiniTablePlatform_Native =
3736 UPB_SIZE(kUpb_MiniTablePlatform_32Bit, kUpb_MiniTablePlatform_64Bit),
3737} upb_MiniTablePlatform;
3738
3739#ifdef __cplusplus
3740extern "C" {
3741#endif
3742
3743// Builds a mini table from the data encoded in the buffer [data, len]. If any
3744// errors occur, returns NULL and sets a status message. In the success case,
3745// the caller must call upb_MiniTable_SetSub*() for all message or proto2 enum
3746// fields to link the table to the appropriate sub-tables.
3747upb_MiniTable* _upb_MiniTable_Build(const char* data, size_t len,
3748 upb_MiniTablePlatform platform,
3749 upb_Arena* arena, upb_Status* status);
3750
3751UPB_API_INLINE upb_MiniTable* upb_MiniTable_Build(const char* data, size_t len,
3752 upb_Arena* arena,
3753 upb_Status* status) {
3754 return _upb_MiniTable_Build(data, len, kUpb_MiniTablePlatform_Native, arena,
3755 status);
3756}
3757
3758// Initializes a MiniTableExtension buffer that has already been allocated.
3759// This is needed by upb_FileDef and upb_MessageDef, which allocate all of the
3760// extensions together in a single contiguous array.
3761const char* _upb_MiniTableExtension_Init(const char* data, size_t len,
3762 upb_MiniTableExtension* ext,
3763 const upb_MiniTable* extendee,
3764 upb_MiniTableSub sub,
3765 upb_MiniTablePlatform platform,
3766 upb_Status* status);
3767
3768UPB_API_INLINE const char* upb_MiniTableExtension_Init(
3769 const char* data, size_t len, upb_MiniTableExtension* ext,
3770 const upb_MiniTable* extendee, upb_MiniTableSub sub, upb_Status* status) {
3771 return _upb_MiniTableExtension_Init(data, len, ext, extendee, sub,
3772 kUpb_MiniTablePlatform_Native, status);
3773}
3774
3775UPB_API upb_MiniTableExtension* _upb_MiniTableExtension_Build(
3776 const char* data, size_t len, const upb_MiniTable* extendee,
3777 upb_MiniTableSub sub, upb_MiniTablePlatform platform, upb_Arena* arena,
3778 upb_Status* status);
3779
3780UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_Build(
3781 const char* data, size_t len, const upb_MiniTable* extendee,
3782 upb_Arena* arena, upb_Status* status) {
Protobuf Team Bot842f56b2023-11-29 05:02:57 +00003783 upb_MiniTableSub sub = upb_MiniTableSub_FromMessage(NULL);
Mike Kruskal9d435022023-07-11 12:45:07 -07003784 return _upb_MiniTableExtension_Build(
3785 data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
3786}
3787
3788UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildMessage(
3789 const char* data, size_t len, const upb_MiniTable* extendee,
3790 upb_MiniTable* submsg, upb_Arena* arena, upb_Status* status) {
Protobuf Team Bot842f56b2023-11-29 05:02:57 +00003791 upb_MiniTableSub sub = upb_MiniTableSub_FromMessage(submsg);
Mike Kruskal9d435022023-07-11 12:45:07 -07003792 return _upb_MiniTableExtension_Build(
3793 data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
3794}
3795
3796UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildEnum(
3797 const char* data, size_t len, const upb_MiniTable* extendee,
3798 upb_MiniTableEnum* subenum, upb_Arena* arena, upb_Status* status) {
Protobuf Team Bot842f56b2023-11-29 05:02:57 +00003799 upb_MiniTableSub sub = upb_MiniTableSub_FromEnum(subenum);
Mike Kruskal9d435022023-07-11 12:45:07 -07003800 return _upb_MiniTableExtension_Build(
3801 data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
3802}
3803
3804// Like upb_MiniTable_Build(), but the user provides a buffer of layout data so
3805// it can be reused from call to call, avoiding repeated realloc()/free().
3806//
3807// The caller owns `*buf` both before and after the call, and must free() it
3808// when it is no longer in use. The function will realloc() `*buf` as
3809// necessary, updating `*size` accordingly.
3810upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len,
3811 upb_MiniTablePlatform platform,
3812 upb_Arena* arena, void** buf,
3813 size_t* buf_size, upb_Status* status);
3814
3815#ifdef __cplusplus
3816} /* extern "C" */
3817#endif
3818
3819
3820#endif /* UPB_MINI_TABLE_DECODE_H_ */
3821
Protobuf Team Bot4eeaa222023-12-04 05:00:05 +00003822#ifndef UPB_MINI_TABLE_EXTENSION_REGISTRY_H_
3823#define UPB_MINI_TABLE_EXTENSION_REGISTRY_H_
3824
3825
3826// Must be last.
3827
3828#ifdef __cplusplus
3829extern "C" {
3830#endif
3831
3832/* Extension registry: a dynamic data structure that stores a map of:
3833 * (upb_MiniTable, number) -> extension info
3834 *
3835 * upb_decode() uses upb_ExtensionRegistry to look up extensions while parsing
3836 * binary format.
3837 *
3838 * upb_ExtensionRegistry is part of the mini-table (msglayout) family of
3839 * objects. Like all mini-table objects, it is suitable for reflection-less
3840 * builds that do not want to expose names into the binary.
3841 *
3842 * Unlike most mini-table types, upb_ExtensionRegistry requires dynamic memory
3843 * allocation and dynamic initialization:
3844 * * If reflection is being used, then upb_DefPool will construct an appropriate
3845 * upb_ExtensionRegistry automatically.
3846 * * For a mini-table only build, the user must manually construct the
3847 * upb_ExtensionRegistry and populate it with all of the extensions the user
3848 * cares about.
3849 * * A third alternative is to manually unpack relevant extensions after the
3850 * main parse is complete, similar to how Any works. This is perhaps the
3851 * nicest solution from the perspective of reducing dependencies, avoiding
3852 * dynamic memory allocation, and avoiding the need to parse uninteresting
3853 * extensions. The downsides are:
3854 * (1) parse errors are not caught during the main parse
3855 * (2) the CPU hit of parsing comes during access, which could cause an
3856 * undesirable stutter in application performance.
3857 *
3858 * Users cannot directly get or put into this map. Users can only add the
3859 * extensions from a generated module and pass the extension registry to the
3860 * binary decoder.
3861 *
3862 * A upb_DefPool provides a upb_ExtensionRegistry, so any users who use
3863 * reflection do not need to populate a upb_ExtensionRegistry directly.
3864 */
3865
3866typedef struct upb_ExtensionRegistry upb_ExtensionRegistry;
3867
3868// Creates a upb_ExtensionRegistry in the given arena.
3869// The arena must outlive any use of the extreg.
3870UPB_API upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena);
3871
3872UPB_API bool upb_ExtensionRegistry_Add(upb_ExtensionRegistry* r,
3873 const upb_MiniTableExtension* e);
3874
3875// Adds the given extension info for the array |e| of size |count| into the
3876// registry. If there are any errors, the entire array is backed out.
3877// The extensions must outlive the registry.
3878// Possible errors include OOM or an extension number that already exists.
3879// TODO: There is currently no way to know the exact reason for failure.
3880bool upb_ExtensionRegistry_AddArray(upb_ExtensionRegistry* r,
3881 const upb_MiniTableExtension** e,
3882 size_t count);
3883
3884// Looks up the extension (if any) defined for message type |t| and field
3885// number |num|. Returns the extension if found, otherwise NULL.
3886UPB_API const upb_MiniTableExtension* upb_ExtensionRegistry_Lookup(
3887 const upb_ExtensionRegistry* r, const upb_MiniTable* t, uint32_t num);
3888
3889#ifdef __cplusplus
3890} /* extern "C" */
3891#endif
3892
3893
3894#endif /* UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ */
3895
Mike Kruskal9d435022023-07-11 12:45:07 -07003896#ifndef UPB_MINI_TABLE_FILE_H_
3897#define UPB_MINI_TABLE_FILE_H_
3898
3899
3900#ifndef UPB_MINI_TABLE_INTERNAL_FILE_H_
3901#define UPB_MINI_TABLE_INTERNAL_FILE_H_
3902
Mike Kruskal9d435022023-07-11 12:45:07 -07003903// Must be last.
3904
3905struct upb_MiniTableFile {
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003906 const struct upb_MiniTable** UPB_PRIVATE(msgs);
3907 const struct upb_MiniTableEnum** UPB_PRIVATE(enums);
3908 const struct upb_MiniTableExtension** UPB_PRIVATE(exts);
Protobuf Team Botff422002023-11-28 17:31:45 +00003909 int UPB_PRIVATE(msg_count);
3910 int UPB_PRIVATE(enum_count);
3911 int UPB_PRIVATE(ext_count);
Mike Kruskal9d435022023-07-11 12:45:07 -07003912};
3913
Protobuf Team Botff422002023-11-28 17:31:45 +00003914#ifdef __cplusplus
3915extern "C" {
3916#endif
3917
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003918UPB_API_INLINE int upb_MiniTableFile_EnumCount(
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003919 const struct upb_MiniTableFile* f) {
Protobuf Team Botff422002023-11-28 17:31:45 +00003920 return f->UPB_PRIVATE(enum_count);
3921}
3922
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003923UPB_API_INLINE int upb_MiniTableFile_ExtensionCount(
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003924 const struct upb_MiniTableFile* f) {
Protobuf Team Botff422002023-11-28 17:31:45 +00003925 return f->UPB_PRIVATE(ext_count);
3926}
3927
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003928UPB_API_INLINE int upb_MiniTableFile_MessageCount(
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003929 const struct upb_MiniTableFile* f) {
Protobuf Team Botff422002023-11-28 17:31:45 +00003930 return f->UPB_PRIVATE(msg_count);
3931}
3932
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003933UPB_API_INLINE const struct upb_MiniTableEnum* upb_MiniTableFile_Enum(
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003934 const struct upb_MiniTableFile* f, int i) {
Protobuf Team Botff422002023-11-28 17:31:45 +00003935 UPB_ASSERT(i < f->UPB_PRIVATE(enum_count));
3936 return f->UPB_PRIVATE(enums)[i];
3937}
3938
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003939UPB_API_INLINE const struct upb_MiniTableExtension* upb_MiniTableFile_Extension(
3940 const struct upb_MiniTableFile* f, int i) {
Protobuf Team Botff422002023-11-28 17:31:45 +00003941 UPB_ASSERT(i < f->UPB_PRIVATE(ext_count));
3942 return f->UPB_PRIVATE(exts)[i];
3943}
3944
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003945UPB_API_INLINE const struct upb_MiniTable* upb_MiniTableFile_Message(
Protobuf Team Bot4c743452023-12-26 22:55:49 +00003946 const struct upb_MiniTableFile* f, int i) {
Protobuf Team Botff422002023-11-28 17:31:45 +00003947 UPB_ASSERT(i < f->UPB_PRIVATE(msg_count));
3948 return f->UPB_PRIVATE(msgs)[i];
3949}
3950
3951#ifdef __cplusplus
3952} /* extern "C" */
3953#endif
3954
Mike Kruskal9d435022023-07-11 12:45:07 -07003955
3956#endif /* UPB_MINI_TABLE_INTERNAL_FILE_H_ */
3957
Protobuf Team Botff422002023-11-28 17:31:45 +00003958// Must be last.
3959
Protobuf Team Bot9b4aff22023-12-27 21:35:01 +00003960typedef struct upb_MiniTableFile upb_MiniTableFile;
3961
Protobuf Team Botff422002023-11-28 17:31:45 +00003962#ifdef __cplusplus
3963extern "C" {
3964#endif
3965
Protobuf Team Bot1db94652023-12-20 02:08:18 +00003966UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTableFile_Enum(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003967 const upb_MiniTableFile* f, int i);
Protobuf Team Botff422002023-11-28 17:31:45 +00003968
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003969UPB_API_INLINE int upb_MiniTableFile_EnumCount(const upb_MiniTableFile* f);
Protobuf Team Botff422002023-11-28 17:31:45 +00003970
Protobuf Team Bot1db94652023-12-20 02:08:18 +00003971UPB_API_INLINE const upb_MiniTableExtension* upb_MiniTableFile_Extension(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003972 const upb_MiniTableFile* f, int i);
Protobuf Team Botff422002023-11-28 17:31:45 +00003973
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003974UPB_API_INLINE int upb_MiniTableFile_ExtensionCount(const upb_MiniTableFile* f);
Protobuf Team Botff422002023-11-28 17:31:45 +00003975
Protobuf Team Bot1db94652023-12-20 02:08:18 +00003976UPB_API_INLINE const upb_MiniTable* upb_MiniTableFile_Message(
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003977 const upb_MiniTableFile* f, int i);
Protobuf Team Botff422002023-11-28 17:31:45 +00003978
Protobuf Team Botb3878b52024-02-08 21:50:53 +00003979UPB_API_INLINE int upb_MiniTableFile_MessageCount(const upb_MiniTableFile* f);
Protobuf Team Botff422002023-11-28 17:31:45 +00003980
3981#ifdef __cplusplus
3982} /* extern "C" */
3983#endif
3984
3985
Mike Kruskal9d435022023-07-11 12:45:07 -07003986#endif /* UPB_MINI_TABLE_FILE_H_ */
3987
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003988// upb_decode: parsing into a upb_Message using a upb_MiniTable.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003989
Mike Kruskal9cf9db82022-11-04 21:22:31 -07003990#ifndef UPB_WIRE_DECODE_H_
3991#define UPB_WIRE_DECODE_H_
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003992
Protobuf Team Bot743bf922023-09-14 01:12:11 +00003993#include <stddef.h>
3994#include <stdint.h>
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003995
Adam Cozzette7d5592e2023-08-23 12:15:26 -07003996
Joshua Habermand3995ec2022-09-30 16:54:39 -07003997// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08003998
3999#ifdef __cplusplus
4000extern "C" {
4001#endif
4002
4003enum {
Joshua Habermand3995ec2022-09-30 16:54:39 -07004004 /* If set, strings will alias the input buffer instead of copying into the
4005 * arena. */
4006 kUpb_DecodeOption_AliasString = 1,
4007
4008 /* If set, the parse will return failure if any message is missing any
4009 * required fields when the message data ends. The parse will still continue,
4010 * and the failure will only be reported at the end.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004011 *
Joshua Habermand3995ec2022-09-30 16:54:39 -07004012 * IMPORTANT CAVEATS:
4013 *
4014 * 1. This can throw a false positive failure if an incomplete message is seen
4015 * on the wire but is later completed when the sub-message occurs again.
4016 * For this reason, a second pass is required to verify a failure, to be
4017 * truly robust.
4018 *
4019 * 2. This can return a false success if you are decoding into a message that
4020 * already has some sub-message fields present. If the sub-message does
4021 * not occur in the binary payload, we will never visit it and discover the
4022 * incomplete sub-message. For this reason, this check is only useful for
4023 * implemting ParseFromString() semantics. For MergeFromString(), a
4024 * post-parse validation step will always be necessary. */
4025 kUpb_DecodeOption_CheckRequired = 2,
Jie Luo3560e232023-06-12 00:33:50 -07004026
4027 /* EXPERIMENTAL:
4028 *
4029 * If set, the parser will allow parsing of sub-message fields that were not
4030 * previously linked using upb_MiniTable_SetSubMessage(). The data will be
4031 * parsed into an internal "empty" message type that cannot be accessed
4032 * directly, but can be later promoted into the true message type if the
4033 * sub-message fields are linked at a later time.
4034 *
4035 * Users should set this option if they intend to perform dynamic tree shaking
4036 * and promoting using the interfaces in message/promote.h. If this option is
4037 * enabled, it is important that the resulting messages are only accessed by
4038 * code that is aware of promotion rules:
4039 *
4040 * 1. Message pointers in upb_Message, upb_Array, and upb_Map are represented
4041 * by a tagged pointer upb_TaggedMessagePointer. The tag indicates whether
4042 * the message uses the internal "empty" type.
4043 *
4044 * 2. Any code *reading* these message pointers must test whether the "empty"
4045 * tag bit is set, using the interfaces in mini_table/types.h. However
4046 * writing of message pointers should always use plain upb_Message*, since
4047 * users are not allowed to create "empty" messages.
4048 *
4049 * 3. It is always safe to test whether a field is present or test the array
4050 * length; these interfaces will reflect that empty messages are present,
4051 * even though their data cannot be accessed without promoting first.
4052 *
4053 * 4. If a message pointer is indeed tagged as empty, the message may not be
4054 * accessed directly, only promoted through the interfaces in
4055 * message/promote.h.
4056 *
4057 * 5. Tagged/empty messages may never be created by the user. They may only
4058 * be created by the parser or the message-copying logic in message/copy.h.
4059 */
4060 kUpb_DecodeOption_ExperimentalAllowUnlinked = 4,
Protobuf Team Bot1610bf12024-01-10 21:45:42 +00004061
4062 /* EXPERIMENTAL:
4063 *
4064 * If set, decoding will enforce UTF-8 validation for string fields, even for
4065 * proto2 or fields with `features.utf8_validation = NONE`. Normally, only
4066 * proto3 string fields will be validated for UTF-8. Decoding will return
4067 * kUpb_DecodeStatus_BadUtf8 for non-UTF-8 strings, which is the same behavior
4068 * as non-UTF-8 proto3 string fields.
4069 */
4070 kUpb_DecodeOption_AlwaysValidateUtf8 = 8,
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004071};
4072
Deanna Garciac7d979d2023-04-14 17:22:13 -07004073UPB_INLINE uint32_t upb_DecodeOptions_MaxDepth(uint16_t depth) {
4074 return (uint32_t)depth << 16;
4075}
4076
4077UPB_INLINE uint16_t upb_DecodeOptions_GetMaxDepth(uint32_t options) {
4078 return options >> 16;
4079}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004080
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07004081// Enforce an upper bound on recursion depth.
4082UPB_INLINE int upb_Decode_LimitDepth(uint32_t decode_options, uint32_t limit) {
Deanna Garciac7d979d2023-04-14 17:22:13 -07004083 uint32_t max_depth = upb_DecodeOptions_GetMaxDepth(decode_options);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07004084 if (max_depth > limit) max_depth = limit;
Deanna Garciac7d979d2023-04-14 17:22:13 -07004085 return upb_DecodeOptions_MaxDepth(max_depth) | (decode_options & 0xffff);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -07004086}
4087
Joshua Habermand3995ec2022-09-30 16:54:39 -07004088typedef enum {
4089 kUpb_DecodeStatus_Ok = 0,
Deanna Garciabd6a0cf2023-04-20 10:30:44 -07004090 kUpb_DecodeStatus_Malformed = 1, // Wire format was corrupt
4091 kUpb_DecodeStatus_OutOfMemory = 2, // Arena alloc failed
4092 kUpb_DecodeStatus_BadUtf8 = 3, // String field had bad UTF-8
4093 kUpb_DecodeStatus_MaxDepthExceeded =
4094 4, // Exceeded upb_DecodeOptions_MaxDepth
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004095
Joshua Habermand3995ec2022-09-30 16:54:39 -07004096 // kUpb_DecodeOption_CheckRequired failed (see above), but the parse otherwise
4097 // succeeded.
4098 kUpb_DecodeStatus_MissingRequired = 5,
Jie Luo3560e232023-06-12 00:33:50 -07004099
4100 // Unlinked sub-message field was present, but
4101 // kUpb_DecodeOptions_ExperimentalAllowUnlinked was not specified in the list
4102 // of options.
4103 kUpb_DecodeStatus_UnlinkedSubMessage = 6,
Joshua Habermand3995ec2022-09-30 16:54:39 -07004104} upb_DecodeStatus;
4105
Eric Salo10505992022-12-12 12:16:36 -08004106UPB_API upb_DecodeStatus upb_Decode(const char* buf, size_t size,
4107 upb_Message* msg, const upb_MiniTable* l,
4108 const upb_ExtensionRegistry* extreg,
4109 int options, upb_Arena* arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004110
4111#ifdef __cplusplus
Joshua Habermanf41049a2022-01-21 14:41:25 -08004112} /* extern "C" */
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004113#endif
4114
Joshua Habermandd69a482021-05-17 22:40:33 -07004115
Mike Kruskal9cf9db82022-11-04 21:22:31 -07004116#endif /* UPB_WIRE_DECODE_H_ */
Joshua Habermand3995ec2022-09-30 16:54:39 -07004117
Protobuf Team Botda56def2023-12-26 19:08:52 +00004118// upb_Encode: parsing from a upb_Message using a upb_MiniTable.
4119
4120#ifndef UPB_WIRE_ENCODE_H_
4121#define UPB_WIRE_ENCODE_H_
4122
4123#include <stddef.h>
4124#include <stdint.h>
4125
4126
4127// Must be last.
4128
4129#ifdef __cplusplus
4130extern "C" {
4131#endif
4132
4133enum {
4134 /* If set, the results of serializing will be deterministic across all
4135 * instances of this binary. There are no guarantees across different
4136 * binary builds.
4137 *
4138 * If your proto contains maps, the encoder will need to malloc()/free()
4139 * memory during encode. */
4140 kUpb_EncodeOption_Deterministic = 1,
4141
4142 // When set, unknown fields are not printed.
4143 kUpb_EncodeOption_SkipUnknown = 2,
4144
4145 // When set, the encode will fail if any required fields are missing.
4146 kUpb_EncodeOption_CheckRequired = 4,
4147};
4148
4149typedef enum {
4150 kUpb_EncodeStatus_Ok = 0,
4151 kUpb_EncodeStatus_OutOfMemory = 1, // Arena alloc failed
4152 kUpb_EncodeStatus_MaxDepthExceeded = 2,
4153
4154 // kUpb_EncodeOption_CheckRequired failed but the parse otherwise succeeded.
4155 kUpb_EncodeStatus_MissingRequired = 3,
4156} upb_EncodeStatus;
4157
4158UPB_INLINE uint32_t upb_EncodeOptions_MaxDepth(uint16_t depth) {
4159 return (uint32_t)depth << 16;
4160}
4161
4162UPB_INLINE uint16_t upb_EncodeOptions_GetMaxDepth(uint32_t options) {
4163 return options >> 16;
4164}
4165
4166// Enforce an upper bound on recursion depth.
4167UPB_INLINE int upb_Encode_LimitDepth(uint32_t encode_options, uint32_t limit) {
4168 uint32_t max_depth = upb_EncodeOptions_GetMaxDepth(encode_options);
4169 if (max_depth > limit) max_depth = limit;
4170 return upb_EncodeOptions_MaxDepth(max_depth) | (encode_options & 0xffff);
4171}
4172
4173UPB_API upb_EncodeStatus upb_Encode(const upb_Message* msg,
4174 const upb_MiniTable* l, int options,
4175 upb_Arena* arena, char** buf, size_t* size);
4176
4177#ifdef __cplusplus
4178} /* extern "C" */
4179#endif
4180
4181
4182#endif /* UPB_WIRE_ENCODE_H_ */
4183
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004184// These are the specialized field parser functions for the fast parser.
4185// Generated tables will refer to these by name.
4186//
4187// The function names are encoded with names like:
4188//
4189// // 123 4
4190// upb_pss_1bt(); // Parse singular string, 1 byte tag.
4191//
4192// In position 1:
4193// - 'p' for parse, most function use this
4194// - 'c' for copy, for when we are copying strings instead of aliasing
4195//
4196// In position 2 (cardinality):
4197// - 's' for singular, with or without hasbit
4198// - 'o' for oneof
4199// - 'r' for non-packed repeated
4200// - 'p' for packed repeated
4201//
4202// In position 3 (type):
4203// - 'b1' for bool
4204// - 'v4' for 4-byte varint
4205// - 'v8' for 8-byte varint
4206// - 'z4' for zig-zag-encoded 4-byte varint
4207// - 'z8' for zig-zag-encoded 8-byte varint
4208// - 'f4' for 4-byte fixed
4209// - 'f8' for 8-byte fixed
4210// - 'm' for sub-message
4211// - 's' for string (validate UTF-8)
4212// - 'b' for bytes
4213//
4214// In position 4 (tag length):
4215// - '1' for one-byte tags (field numbers 1-15)
4216// - '2' for two-byte tags (field numbers 16-2048)
4217
Protobuf Team Botde5ea1e2024-01-02 04:02:53 +00004218#ifndef UPB_WIRE_INTERNAL_DECODE_FAST_H_
4219#define UPB_WIRE_INTERNAL_DECODE_FAST_H_
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004220
4221
Joshua Habermand3995ec2022-09-30 16:54:39 -07004222// Must be last.
4223
4224#ifdef __cplusplus
4225extern "C" {
4226#endif
4227
Joshua Habermanf41049a2022-01-21 14:41:25 -08004228struct upb_Decoder;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004229
4230// The fallback, generic parsing function that can handle any field type.
4231// This just uses the regular (non-fast) parser to parse a single field.
Joshua Habermand3995ec2022-09-30 16:54:39 -07004232const char* _upb_FastDecoder_DecodeGeneric(struct upb_Decoder* d,
4233 const char* ptr, upb_Message* msg,
4234 intptr_t table, uint64_t hasbits,
4235 uint64_t data);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004236
Joshua Habermanf41049a2022-01-21 14:41:25 -08004237#define UPB_PARSE_PARAMS \
4238 struct upb_Decoder *d, const char *ptr, upb_Message *msg, intptr_t table, \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004239 uint64_t hasbits, uint64_t data
4240
4241/* primitive fields ***********************************************************/
4242
4243#define F(card, type, valbytes, tagbytes) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08004244 const char* upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004245
4246#define TYPES(card, tagbytes) \
4247 F(card, b, 1, tagbytes) \
4248 F(card, v, 4, tagbytes) \
4249 F(card, v, 8, tagbytes) \
4250 F(card, z, 4, tagbytes) \
4251 F(card, z, 8, tagbytes) \
4252 F(card, f, 4, tagbytes) \
4253 F(card, f, 8, tagbytes)
4254
4255#define TAGBYTES(card) \
4256 TYPES(card, 1) \
4257 TYPES(card, 2)
4258
4259TAGBYTES(s)
4260TAGBYTES(o)
4261TAGBYTES(r)
4262TAGBYTES(p)
4263
4264#undef F
4265#undef TYPES
4266#undef TAGBYTES
4267
4268/* string fields **************************************************************/
4269
4270#define F(card, tagbytes, type) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08004271 const char* upb_p##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); \
4272 const char* upb_c##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004273
4274#define UTF8(card, tagbytes) \
4275 F(card, tagbytes, s) \
4276 F(card, tagbytes, b)
4277
4278#define TAGBYTES(card) \
4279 UTF8(card, 1) \
4280 UTF8(card, 2)
4281
4282TAGBYTES(s)
4283TAGBYTES(o)
4284TAGBYTES(r)
4285
4286#undef F
Protobuf Team Botde5ea1e2024-01-02 04:02:53 +00004287#undef UTF8
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004288#undef TAGBYTES
4289
4290/* sub-message fields *********************************************************/
4291
4292#define F(card, tagbytes, size_ceil, ceil_arg) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08004293 const char* upb_p##card##m_##tagbytes##bt_max##size_ceil##b(UPB_PARSE_PARAMS);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004294
4295#define SIZES(card, tagbytes) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08004296 F(card, tagbytes, 64, 64) \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004297 F(card, tagbytes, 128, 128) \
4298 F(card, tagbytes, 192, 192) \
4299 F(card, tagbytes, 256, 256) \
4300 F(card, tagbytes, max, -1)
4301
4302#define TAGBYTES(card) \
Joshua Habermanf41049a2022-01-21 14:41:25 -08004303 SIZES(card, 1) \
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004304 SIZES(card, 2)
4305
4306TAGBYTES(s)
4307TAGBYTES(o)
4308TAGBYTES(r)
4309
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004310#undef F
Protobuf Team Botde5ea1e2024-01-02 04:02:53 +00004311#undef SIZES
4312#undef TAGBYTES
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004313
4314#undef UPB_PARSE_PARAMS
4315
Joshua Habermand3995ec2022-09-30 16:54:39 -07004316#ifdef __cplusplus
4317} /* extern "C" */
4318#endif
4319
4320
Protobuf Team Botde5ea1e2024-01-02 04:02:53 +00004321#endif /* UPB_WIRE_INTERNAL_DECODE_FAST_H_ */
Mike Kruskal9d435022023-07-11 12:45:07 -07004322// IWYU pragma: end_exports
4323
4324#endif // UPB_GENERATED_CODE_SUPPORT_H_
Protobuf Team Bot0cb912c2023-09-28 20:14:04 +00004325/* This file was generated by upb_generator from the input file:
Mike Kruskal9d435022023-07-11 12:45:07 -07004326 *
4327 * google/protobuf/descriptor.proto
4328 *
4329 * Do not edit -- your changes will be discarded when the file is
4330 * regenerated. */
4331
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004332#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_
4333#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_
4334
4335
4336// Must be last.
4337
4338#ifdef __cplusplus
4339extern "C" {
4340#endif
4341
Protobuf Team Botd14a3362023-10-07 23:51:34 +00004342extern const upb_MiniTable google__protobuf__FileDescriptorSet_msg_init;
4343extern const upb_MiniTable google__protobuf__FileDescriptorProto_msg_init;
4344extern const upb_MiniTable google__protobuf__DescriptorProto_msg_init;
4345extern const upb_MiniTable google__protobuf__DescriptorProto__ExtensionRange_msg_init;
4346extern const upb_MiniTable google__protobuf__DescriptorProto__ReservedRange_msg_init;
4347extern const upb_MiniTable google__protobuf__ExtensionRangeOptions_msg_init;
4348extern const upb_MiniTable google__protobuf__ExtensionRangeOptions__Declaration_msg_init;
4349extern const upb_MiniTable google__protobuf__FieldDescriptorProto_msg_init;
4350extern const upb_MiniTable google__protobuf__OneofDescriptorProto_msg_init;
4351extern const upb_MiniTable google__protobuf__EnumDescriptorProto_msg_init;
4352extern const upb_MiniTable google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init;
4353extern const upb_MiniTable google__protobuf__EnumValueDescriptorProto_msg_init;
4354extern const upb_MiniTable google__protobuf__ServiceDescriptorProto_msg_init;
4355extern const upb_MiniTable google__protobuf__MethodDescriptorProto_msg_init;
4356extern const upb_MiniTable google__protobuf__FileOptions_msg_init;
4357extern const upb_MiniTable google__protobuf__MessageOptions_msg_init;
4358extern const upb_MiniTable google__protobuf__FieldOptions_msg_init;
4359extern const upb_MiniTable google__protobuf__FieldOptions__EditionDefault_msg_init;
4360extern const upb_MiniTable google__protobuf__OneofOptions_msg_init;
4361extern const upb_MiniTable google__protobuf__EnumOptions_msg_init;
4362extern const upb_MiniTable google__protobuf__EnumValueOptions_msg_init;
4363extern const upb_MiniTable google__protobuf__ServiceOptions_msg_init;
4364extern const upb_MiniTable google__protobuf__MethodOptions_msg_init;
4365extern const upb_MiniTable google__protobuf__UninterpretedOption_msg_init;
4366extern const upb_MiniTable google__protobuf__UninterpretedOption__NamePart_msg_init;
4367extern const upb_MiniTable google__protobuf__FeatureSet_msg_init;
4368extern const upb_MiniTable google__protobuf__FeatureSetDefaults_msg_init;
4369extern const upb_MiniTable google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init;
4370extern const upb_MiniTable google__protobuf__SourceCodeInfo_msg_init;
4371extern const upb_MiniTable google__protobuf__SourceCodeInfo__Location_msg_init;
4372extern const upb_MiniTable google__protobuf__GeneratedCodeInfo_msg_init;
4373extern const upb_MiniTable google__protobuf__GeneratedCodeInfo__Annotation_msg_init;
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004374
4375extern const upb_MiniTableEnum google_protobuf_Edition_enum_init;
4376extern const upb_MiniTableEnum google_protobuf_ExtensionRangeOptions_VerificationState_enum_init;
4377extern const upb_MiniTableEnum google_protobuf_FeatureSet_EnumType_enum_init;
4378extern const upb_MiniTableEnum google_protobuf_FeatureSet_FieldPresence_enum_init;
4379extern const upb_MiniTableEnum google_protobuf_FeatureSet_JsonFormat_enum_init;
4380extern const upb_MiniTableEnum google_protobuf_FeatureSet_MessageEncoding_enum_init;
4381extern const upb_MiniTableEnum google_protobuf_FeatureSet_RepeatedFieldEncoding_enum_init;
Protobuf Team Bot61127952023-09-26 20:07:33 +00004382extern const upb_MiniTableEnum google_protobuf_FeatureSet_Utf8Validation_enum_init;
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004383extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Label_enum_init;
4384extern const upb_MiniTableEnum google_protobuf_FieldDescriptorProto_Type_enum_init;
4385extern const upb_MiniTableEnum google_protobuf_FieldOptions_CType_enum_init;
4386extern const upb_MiniTableEnum google_protobuf_FieldOptions_JSType_enum_init;
4387extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionRetention_enum_init;
4388extern const upb_MiniTableEnum google_protobuf_FieldOptions_OptionTargetType_enum_init;
4389extern const upb_MiniTableEnum google_protobuf_FileOptions_OptimizeMode_enum_init;
4390extern const upb_MiniTableEnum google_protobuf_GeneratedCodeInfo_Annotation_Semantic_enum_init;
4391extern const upb_MiniTableEnum google_protobuf_MethodOptions_IdempotencyLevel_enum_init;
4392extern const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout;
4393
4394#ifdef __cplusplus
4395} /* extern "C" */
4396#endif
4397
4398
4399#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_MINITABLE_H_ */
4400
4401#ifndef UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
4402#define UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
4403
4404#include <string.h>
4405
4406
4407// Must be last.
4408
4409#ifdef __cplusplus
4410extern "C" {
4411#endif
4412
4413// The maximum number of bytes a single protobuf field can take up in the
4414// wire format. We only want to do one bounds check per field, so the input
4415// stream guarantees that after upb_EpsCopyInputStream_IsDone() is called,
4416// the decoder can read this many bytes without performing another bounds
4417// check. The stream will copy into a patch buffer as necessary to guarantee
4418// this invariant.
4419#define kUpb_EpsCopyInputStream_SlopBytes 16
4420
4421enum {
4422 kUpb_EpsCopyInputStream_NoAliasing = 0,
4423 kUpb_EpsCopyInputStream_OnPatch = 1,
4424 kUpb_EpsCopyInputStream_NoDelta = 2
4425};
4426
4427typedef struct {
4428 const char* end; // Can read up to SlopBytes bytes beyond this.
4429 const char* limit_ptr; // For bounds checks, = end + UPB_MIN(limit, 0)
4430 uintptr_t aliasing;
Protobuf Team Bot1d143b52024-01-25 20:29:43 +00004431 int limit; // Submessage limit relative to end
4432 bool error; // To distinguish between EOF and error.
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004433 char patch[kUpb_EpsCopyInputStream_SlopBytes * 2];
4434} upb_EpsCopyInputStream;
4435
4436// Returns true if the stream is in the error state. A stream enters the error
4437// state when the user reads past a limit (caught in IsDone()) or the
4438// ZeroCopyInputStream returns an error.
4439UPB_INLINE bool upb_EpsCopyInputStream_IsError(upb_EpsCopyInputStream* e) {
4440 return e->error;
4441}
4442
4443typedef const char* upb_EpsCopyInputStream_BufferFlipCallback(
4444 upb_EpsCopyInputStream* e, const char* old_end, const char* new_start);
4445
4446typedef const char* upb_EpsCopyInputStream_IsDoneFallbackFunc(
4447 upb_EpsCopyInputStream* e, const char* ptr, int overrun);
4448
4449// Initializes a upb_EpsCopyInputStream using the contents of the buffer
4450// [*ptr, size]. Updates `*ptr` as necessary to guarantee that at least
4451// kUpb_EpsCopyInputStream_SlopBytes are available to read.
4452UPB_INLINE void upb_EpsCopyInputStream_Init(upb_EpsCopyInputStream* e,
4453 const char** ptr, size_t size,
4454 bool enable_aliasing) {
4455 if (size <= kUpb_EpsCopyInputStream_SlopBytes) {
4456 memset(&e->patch, 0, 32);
4457 if (size) memcpy(&e->patch, *ptr, size);
4458 e->aliasing = enable_aliasing ? (uintptr_t)*ptr - (uintptr_t)e->patch
4459 : kUpb_EpsCopyInputStream_NoAliasing;
4460 *ptr = e->patch;
4461 e->end = *ptr + size;
4462 e->limit = 0;
4463 } else {
4464 e->end = *ptr + size - kUpb_EpsCopyInputStream_SlopBytes;
4465 e->limit = kUpb_EpsCopyInputStream_SlopBytes;
4466 e->aliasing = enable_aliasing ? kUpb_EpsCopyInputStream_NoDelta
4467 : kUpb_EpsCopyInputStream_NoAliasing;
4468 }
4469 e->limit_ptr = e->end;
4470 e->error = false;
4471}
4472
4473typedef enum {
4474 // The current stream position is at a limit.
4475 kUpb_IsDoneStatus_Done,
4476
4477 // The current stream position is not at a limit.
4478 kUpb_IsDoneStatus_NotDone,
4479
4480 // The current stream position is not at a limit, and the stream needs to
4481 // be flipped to a new buffer before more data can be read.
4482 kUpb_IsDoneStatus_NeedFallback,
4483} upb_IsDoneStatus;
4484
4485// Returns the status of the current stream position. This is a low-level
4486// function, it is simpler to call upb_EpsCopyInputStream_IsDone() if possible.
4487UPB_INLINE upb_IsDoneStatus upb_EpsCopyInputStream_IsDoneStatus(
4488 upb_EpsCopyInputStream* e, const char* ptr, int* overrun) {
4489 *overrun = ptr - e->end;
4490 if (UPB_LIKELY(ptr < e->limit_ptr)) {
4491 return kUpb_IsDoneStatus_NotDone;
4492 } else if (UPB_LIKELY(*overrun == e->limit)) {
4493 return kUpb_IsDoneStatus_Done;
4494 } else {
4495 return kUpb_IsDoneStatus_NeedFallback;
4496 }
4497}
4498
4499// Returns true if the stream has hit a limit, either the current delimited
4500// limit or the overall end-of-stream. As a side effect, this function may flip
4501// the pointer to a new buffer if there are less than
4502// kUpb_EpsCopyInputStream_SlopBytes of data to be read in the current buffer.
4503//
4504// Postcondition: if the function returns false, there are at least
4505// kUpb_EpsCopyInputStream_SlopBytes of data available to read at *ptr.
4506UPB_INLINE bool upb_EpsCopyInputStream_IsDoneWithCallback(
4507 upb_EpsCopyInputStream* e, const char** ptr,
4508 upb_EpsCopyInputStream_IsDoneFallbackFunc* func) {
4509 int overrun;
4510 switch (upb_EpsCopyInputStream_IsDoneStatus(e, *ptr, &overrun)) {
4511 case kUpb_IsDoneStatus_Done:
4512 return true;
4513 case kUpb_IsDoneStatus_NotDone:
4514 return false;
4515 case kUpb_IsDoneStatus_NeedFallback:
4516 *ptr = func(e, *ptr, overrun);
4517 return *ptr == NULL;
4518 }
4519 UPB_UNREACHABLE();
4520}
4521
4522const char* _upb_EpsCopyInputStream_IsDoneFallbackNoCallback(
4523 upb_EpsCopyInputStream* e, const char* ptr, int overrun);
4524
4525// A simpler version of IsDoneWithCallback() that does not support a buffer flip
4526// callback. Useful in cases where we do not need to insert custom logic at
4527// every buffer flip.
4528//
4529// If this returns true, the user must call upb_EpsCopyInputStream_IsError()
4530// to distinguish between EOF and error.
4531UPB_INLINE bool upb_EpsCopyInputStream_IsDone(upb_EpsCopyInputStream* e,
4532 const char** ptr) {
4533 return upb_EpsCopyInputStream_IsDoneWithCallback(
4534 e, ptr, _upb_EpsCopyInputStream_IsDoneFallbackNoCallback);
4535}
4536
4537// Returns the total number of bytes that are safe to read from the current
4538// buffer without reading uninitialized or unallocated memory.
4539//
4540// Note that this check does not respect any semantic limits on the stream,
4541// either limits from PushLimit() or the overall stream end, so some of these
4542// bytes may have unpredictable, nonsense values in them. The guarantee is only
4543// that the bytes are valid to read from the perspective of the C language
4544// (ie. you can read without triggering UBSAN or ASAN).
4545UPB_INLINE size_t upb_EpsCopyInputStream_BytesAvailable(
4546 upb_EpsCopyInputStream* e, const char* ptr) {
4547 return (e->end - ptr) + kUpb_EpsCopyInputStream_SlopBytes;
4548}
4549
4550// Returns true if the given delimited field size is valid (it does not extend
4551// beyond any previously-pushed limits). `ptr` should point to the beginning
4552// of the field data, after the delimited size.
4553//
4554// Note that this does *not* guarantee that all of the data for this field is in
4555// the current buffer.
4556UPB_INLINE bool upb_EpsCopyInputStream_CheckSize(
4557 const upb_EpsCopyInputStream* e, const char* ptr, int size) {
4558 UPB_ASSERT(size >= 0);
4559 return ptr - e->end + size <= e->limit;
4560}
4561
4562UPB_INLINE bool _upb_EpsCopyInputStream_CheckSizeAvailable(
4563 upb_EpsCopyInputStream* e, const char* ptr, int size, bool submessage) {
4564 // This is one extra branch compared to the more normal:
4565 // return (size_t)(end - ptr) < size;
4566 // However it is one less computation if we are just about to use "ptr + len":
4567 // https://godbolt.org/z/35YGPz
4568 // In microbenchmarks this shows a small improvement.
4569 uintptr_t uptr = (uintptr_t)ptr;
4570 uintptr_t uend = (uintptr_t)e->limit_ptr;
4571 uintptr_t res = uptr + (size_t)size;
4572 if (!submessage) uend += kUpb_EpsCopyInputStream_SlopBytes;
4573 // NOTE: this check depends on having a linear address space. This is not
4574 // technically guaranteed by uintptr_t.
4575 bool ret = res >= uptr && res <= uend;
4576 if (size < 0) UPB_ASSERT(!ret);
4577 return ret;
4578}
4579
4580// Returns true if the given delimited field size is valid (it does not extend
4581// beyond any previously-pushed limited) *and* all of the data for this field is
4582// available to be read in the current buffer.
4583//
4584// If the size is negative, this function will always return false. This
4585// property can be useful in some cases.
4586UPB_INLINE bool upb_EpsCopyInputStream_CheckDataSizeAvailable(
4587 upb_EpsCopyInputStream* e, const char* ptr, int size) {
4588 return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, false);
4589}
4590
4591// Returns true if the given sub-message size is valid (it does not extend
4592// beyond any previously-pushed limited) *and* all of the data for this
4593// sub-message is available to be parsed in the current buffer.
4594//
4595// This implies that all fields from the sub-message can be parsed from the
4596// current buffer while maintaining the invariant that we always have at least
4597// kUpb_EpsCopyInputStream_SlopBytes of data available past the beginning of
4598// any individual field start.
4599//
4600// If the size is negative, this function will always return false. This
4601// property can be useful in some cases.
4602UPB_INLINE bool upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(
4603 upb_EpsCopyInputStream* e, const char* ptr, int size) {
4604 return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, true);
4605}
4606
4607// Returns true if aliasing_enabled=true was passed to
4608// upb_EpsCopyInputStream_Init() when this stream was initialized.
4609UPB_INLINE bool upb_EpsCopyInputStream_AliasingEnabled(
4610 upb_EpsCopyInputStream* e) {
4611 return e->aliasing != kUpb_EpsCopyInputStream_NoAliasing;
4612}
4613
4614// Returns true if aliasing_enabled=true was passed to
4615// upb_EpsCopyInputStream_Init() when this stream was initialized *and* we can
4616// alias into the region [ptr, size] in an input buffer.
4617UPB_INLINE bool upb_EpsCopyInputStream_AliasingAvailable(
4618 upb_EpsCopyInputStream* e, const char* ptr, size_t size) {
4619 // When EpsCopyInputStream supports streaming, this will need to become a
4620 // runtime check.
4621 return upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size) &&
4622 e->aliasing >= kUpb_EpsCopyInputStream_NoDelta;
4623}
4624
4625// Returns a pointer into an input buffer that corresponds to the parsing
4626// pointer `ptr`. The returned pointer may be the same as `ptr`, but also may
4627// be different if we are currently parsing out of the patch buffer.
4628//
4629// REQUIRES: Aliasing must be available for the given pointer. If the input is a
4630// flat buffer and aliasing is enabled, then aliasing will always be available.
4631UPB_INLINE const char* upb_EpsCopyInputStream_GetAliasedPtr(
4632 upb_EpsCopyInputStream* e, const char* ptr) {
4633 UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, ptr, 0));
4634 uintptr_t delta =
4635 e->aliasing == kUpb_EpsCopyInputStream_NoDelta ? 0 : e->aliasing;
4636 return (const char*)((uintptr_t)ptr + delta);
4637}
4638
4639// Reads string data from the input, aliasing into the input buffer instead of
4640// copying. The parsing pointer is passed in `*ptr`, and will be updated if
4641// necessary to point to the actual input buffer. Returns the new parsing
4642// pointer, which will be advanced past the string data.
4643//
4644// REQUIRES: Aliasing must be available for this data region (test with
4645// upb_EpsCopyInputStream_AliasingAvailable().
4646UPB_INLINE const char* upb_EpsCopyInputStream_ReadStringAliased(
4647 upb_EpsCopyInputStream* e, const char** ptr, size_t size) {
4648 UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size));
4649 const char* ret = *ptr + size;
4650 *ptr = upb_EpsCopyInputStream_GetAliasedPtr(e, *ptr);
4651 UPB_ASSUME(ret != NULL);
4652 return ret;
4653}
4654
4655// Skips `size` bytes of data from the input and returns a pointer past the end.
4656// Returns NULL on end of stream or error.
4657UPB_INLINE const char* upb_EpsCopyInputStream_Skip(upb_EpsCopyInputStream* e,
4658 const char* ptr, int size) {
4659 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL;
4660 return ptr + size;
4661}
4662
4663// Copies `size` bytes of data from the input `ptr` into the buffer `to`, and
4664// returns a pointer past the end. Returns NULL on end of stream or error.
4665UPB_INLINE const char* upb_EpsCopyInputStream_Copy(upb_EpsCopyInputStream* e,
4666 const char* ptr, void* to,
4667 int size) {
4668 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size)) return NULL;
4669 memcpy(to, ptr, size);
4670 return ptr + size;
4671}
4672
4673// Reads string data from the stream and advances the pointer accordingly.
4674// If aliasing was enabled when the stream was initialized, then the returned
4675// pointer will point into the input buffer if possible, otherwise new data
4676// will be allocated from arena and copied into. We may be forced to copy even
4677// if aliasing was enabled if the input data spans input buffers.
4678//
4679// Returns NULL if memory allocation failed, or we reached a premature EOF.
4680UPB_INLINE const char* upb_EpsCopyInputStream_ReadString(
4681 upb_EpsCopyInputStream* e, const char** ptr, size_t size,
4682 upb_Arena* arena) {
4683 if (upb_EpsCopyInputStream_AliasingAvailable(e, *ptr, size)) {
4684 return upb_EpsCopyInputStream_ReadStringAliased(e, ptr, size);
4685 } else {
4686 // We need to allocate and copy.
4687 if (!upb_EpsCopyInputStream_CheckDataSizeAvailable(e, *ptr, size)) {
4688 return NULL;
4689 }
4690 UPB_ASSERT(arena);
4691 char* data = (char*)upb_Arena_Malloc(arena, size);
4692 if (!data) return NULL;
4693 const char* ret = upb_EpsCopyInputStream_Copy(e, *ptr, data, size);
4694 *ptr = data;
4695 return ret;
4696 }
4697}
4698
4699UPB_INLINE void _upb_EpsCopyInputStream_CheckLimit(upb_EpsCopyInputStream* e) {
4700 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
4701}
4702
4703// Pushes a limit onto the stack of limits for the current stream. The limit
4704// will extend for `size` bytes beyond the position in `ptr`. Future calls to
4705// upb_EpsCopyInputStream_IsDone() will return `true` when the stream position
4706// reaches this limit.
4707//
4708// Returns a delta that the caller must store and supply to PopLimit() below.
4709UPB_INLINE int upb_EpsCopyInputStream_PushLimit(upb_EpsCopyInputStream* e,
4710 const char* ptr, int size) {
4711 int limit = size + (int)(ptr - e->end);
4712 int delta = e->limit - limit;
4713 _upb_EpsCopyInputStream_CheckLimit(e);
4714 UPB_ASSERT(limit <= e->limit);
4715 e->limit = limit;
4716 e->limit_ptr = e->end + UPB_MIN(0, limit);
4717 _upb_EpsCopyInputStream_CheckLimit(e);
4718 return delta;
4719}
4720
4721// Pops the last limit that was pushed on this stream. This may only be called
4722// once IsDone() returns true. The user must pass the delta that was returned
4723// from PushLimit().
4724UPB_INLINE void upb_EpsCopyInputStream_PopLimit(upb_EpsCopyInputStream* e,
4725 const char* ptr,
4726 int saved_delta) {
4727 UPB_ASSERT(ptr - e->end == e->limit);
4728 _upb_EpsCopyInputStream_CheckLimit(e);
4729 e->limit += saved_delta;
4730 e->limit_ptr = e->end + UPB_MIN(0, e->limit);
4731 _upb_EpsCopyInputStream_CheckLimit(e);
4732}
4733
4734UPB_INLINE const char* _upb_EpsCopyInputStream_IsDoneFallbackInline(
4735 upb_EpsCopyInputStream* e, const char* ptr, int overrun,
4736 upb_EpsCopyInputStream_BufferFlipCallback* callback) {
4737 if (overrun < e->limit) {
4738 // Need to copy remaining data into patch buffer.
4739 UPB_ASSERT(overrun < kUpb_EpsCopyInputStream_SlopBytes);
4740 const char* old_end = ptr;
4741 const char* new_start = &e->patch[0] + overrun;
4742 memset(e->patch + kUpb_EpsCopyInputStream_SlopBytes, 0,
4743 kUpb_EpsCopyInputStream_SlopBytes);
4744 memcpy(e->patch, e->end, kUpb_EpsCopyInputStream_SlopBytes);
4745 ptr = new_start;
4746 e->end = &e->patch[kUpb_EpsCopyInputStream_SlopBytes];
4747 e->limit -= kUpb_EpsCopyInputStream_SlopBytes;
4748 e->limit_ptr = e->end + e->limit;
4749 UPB_ASSERT(ptr < e->limit_ptr);
4750 if (e->aliasing != kUpb_EpsCopyInputStream_NoAliasing) {
4751 e->aliasing = (uintptr_t)old_end - (uintptr_t)new_start;
4752 }
4753 return callback(e, old_end, new_start);
4754 } else {
4755 UPB_ASSERT(overrun > e->limit);
4756 e->error = true;
4757 return callback(e, NULL, NULL);
4758 }
4759}
4760
4761typedef const char* upb_EpsCopyInputStream_ParseDelimitedFunc(
4762 upb_EpsCopyInputStream* e, const char* ptr, void* ctx);
4763
4764// Tries to perform a fast-path handling of the given delimited message data.
4765// If the sub-message beginning at `*ptr` and extending for `len` is short and
4766// fits within this buffer, calls `func` with `ctx` as a parameter, where the
4767// pushing and popping of limits is handled automatically and with lower cost
4768// than the normal PushLimit()/PopLimit() sequence.
Protobuf Team Bot1d143b52024-01-25 20:29:43 +00004769UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast(
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004770 upb_EpsCopyInputStream* e, const char** ptr, int len,
4771 upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) {
4772 if (!upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(e, *ptr, len)) {
4773 return false;
4774 }
4775
4776 // Fast case: Sub-message is <128 bytes and fits in the current buffer.
4777 // This means we can preserve limit/limit_ptr verbatim.
4778 const char* saved_limit_ptr = e->limit_ptr;
4779 int saved_limit = e->limit;
4780 e->limit_ptr = *ptr + len;
4781 e->limit = e->limit_ptr - e->end;
4782 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
4783 *ptr = func(e, *ptr, ctx);
4784 e->limit_ptr = saved_limit_ptr;
4785 e->limit = saved_limit;
4786 UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit));
4787 return true;
4788}
4789
4790#ifdef __cplusplus
4791} /* extern "C" */
4792#endif
4793
4794
4795#endif // UPB_WIRE_EPS_COPY_INPUT_STREAM_H_
4796
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004797#ifndef UPB_JSON_DECODE_H_
4798#define UPB_JSON_DECODE_H_
4799
4800
4801#ifndef UPB_REFLECTION_DEF_H_
4802#define UPB_REFLECTION_DEF_H_
4803
4804// IWYU pragma: begin_exports
4805
Protobuf Team Bot06310352023-09-26 21:54:58 +00004806// IWYU pragma: private, include "upb/reflection/def.h"
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004807
4808#ifndef UPB_REFLECTION_DEF_POOL_H_
4809#define UPB_REFLECTION_DEF_POOL_H_
4810
4811
Protobuf Team Bot06310352023-09-26 21:54:58 +00004812// IWYU pragma: private, include "upb/reflection/def.h"
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004813
4814// Declarations common to all public def types.
4815
4816#ifndef UPB_REFLECTION_COMMON_H_
4817#define UPB_REFLECTION_COMMON_H_
4818
4819// begin:google_only
4820// #ifndef UPB_BOOTSTRAP_STAGE0
4821// #include "net/proto2/proto/descriptor.upb.h"
4822// #else
4823// #include "google/protobuf/descriptor.upb.h"
4824// #endif
4825// end:google_only
4826
4827// begin:github_only
Protobuf Team Bot0cb912c2023-09-28 20:14:04 +00004828/* This file was generated by upb_generator from the input file:
Protobuf Team Botd11eb712023-09-15 00:25:33 +00004829 *
4830 * google/protobuf/descriptor.proto
4831 *
4832 * Do not edit -- your changes will be discarded when the file is
4833 * regenerated. */
4834
Mike Kruskal9d435022023-07-11 12:45:07 -07004835#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
4836#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -07004837
Protobuf Team Bot111d6552023-09-15 21:07:08 +00004838
4839
4840// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004841
4842#ifdef __cplusplus
4843extern "C" {
4844#endif
4845
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00004846typedef struct google_protobuf_FileDescriptorSet { upb_Message UPB_PRIVATE(base); } google_protobuf_FileDescriptorSet;
4847typedef struct google_protobuf_FileDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_FileDescriptorProto;
4848typedef struct google_protobuf_DescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_DescriptorProto;
4849typedef struct google_protobuf_DescriptorProto_ExtensionRange { upb_Message UPB_PRIVATE(base); } google_protobuf_DescriptorProto_ExtensionRange;
4850typedef struct google_protobuf_DescriptorProto_ReservedRange { upb_Message UPB_PRIVATE(base); } google_protobuf_DescriptorProto_ReservedRange;
4851typedef struct google_protobuf_ExtensionRangeOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_ExtensionRangeOptions;
4852typedef struct google_protobuf_ExtensionRangeOptions_Declaration { upb_Message UPB_PRIVATE(base); } google_protobuf_ExtensionRangeOptions_Declaration;
4853typedef struct google_protobuf_FieldDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_FieldDescriptorProto;
4854typedef struct google_protobuf_OneofDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_OneofDescriptorProto;
4855typedef struct google_protobuf_EnumDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_EnumDescriptorProto;
4856typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange { upb_Message UPB_PRIVATE(base); } google_protobuf_EnumDescriptorProto_EnumReservedRange;
4857typedef struct google_protobuf_EnumValueDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_EnumValueDescriptorProto;
4858typedef struct google_protobuf_ServiceDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_ServiceDescriptorProto;
4859typedef struct google_protobuf_MethodDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_MethodDescriptorProto;
4860typedef struct google_protobuf_FileOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_FileOptions;
4861typedef struct google_protobuf_MessageOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_MessageOptions;
4862typedef struct google_protobuf_FieldOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_FieldOptions;
4863typedef struct google_protobuf_FieldOptions_EditionDefault { upb_Message UPB_PRIVATE(base); } google_protobuf_FieldOptions_EditionDefault;
4864typedef struct google_protobuf_OneofOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_OneofOptions;
4865typedef struct google_protobuf_EnumOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_EnumOptions;
4866typedef struct google_protobuf_EnumValueOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_EnumValueOptions;
4867typedef struct google_protobuf_ServiceOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_ServiceOptions;
4868typedef struct google_protobuf_MethodOptions { upb_Message UPB_PRIVATE(base); } google_protobuf_MethodOptions;
4869typedef struct google_protobuf_UninterpretedOption { upb_Message UPB_PRIVATE(base); } google_protobuf_UninterpretedOption;
4870typedef struct google_protobuf_UninterpretedOption_NamePart { upb_Message UPB_PRIVATE(base); } google_protobuf_UninterpretedOption_NamePart;
4871typedef struct google_protobuf_FeatureSet { upb_Message UPB_PRIVATE(base); } google_protobuf_FeatureSet;
4872typedef struct google_protobuf_FeatureSetDefaults { upb_Message UPB_PRIVATE(base); } google_protobuf_FeatureSetDefaults;
4873typedef struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault { upb_Message UPB_PRIVATE(base); } google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault;
4874typedef struct google_protobuf_SourceCodeInfo { upb_Message UPB_PRIVATE(base); } google_protobuf_SourceCodeInfo;
4875typedef struct google_protobuf_SourceCodeInfo_Location { upb_Message UPB_PRIVATE(base); } google_protobuf_SourceCodeInfo_Location;
4876typedef struct google_protobuf_GeneratedCodeInfo { upb_Message UPB_PRIVATE(base); } google_protobuf_GeneratedCodeInfo;
4877typedef struct google_protobuf_GeneratedCodeInfo_Annotation { upb_Message UPB_PRIVATE(base); } google_protobuf_GeneratedCodeInfo_Annotation;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004878
4879typedef enum {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00004880 google_protobuf_EDITION_UNKNOWN = 0,
4881 google_protobuf_EDITION_1_TEST_ONLY = 1,
4882 google_protobuf_EDITION_2_TEST_ONLY = 2,
Protobuf Team Bot67038022023-10-04 04:14:37 +00004883 google_protobuf_EDITION_PROTO2 = 998,
4884 google_protobuf_EDITION_PROTO3 = 999,
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00004885 google_protobuf_EDITION_2023 = 1000,
Protobuf Team Bot41c8f2a2024-01-11 00:10:17 +00004886 google_protobuf_EDITION_2024 = 1001,
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00004887 google_protobuf_EDITION_99997_TEST_ONLY = 99997,
4888 google_protobuf_EDITION_99998_TEST_ONLY = 99998,
Protobuf Team Botde57b672023-11-30 22:16:47 +00004889 google_protobuf_EDITION_99999_TEST_ONLY = 99999,
4890 google_protobuf_EDITION_MAX = 2147483647
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00004891} google_protobuf_Edition;
4892
4893typedef enum {
Protobuf Team Bot469f0272023-04-21 18:12:45 -07004894 google_protobuf_ExtensionRangeOptions_DECLARATION = 0,
4895 google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1
4896} google_protobuf_ExtensionRangeOptions_VerificationState;
4897
4898typedef enum {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07004899 google_protobuf_FeatureSet_ENUM_TYPE_UNKNOWN = 0,
4900 google_protobuf_FeatureSet_OPEN = 1,
4901 google_protobuf_FeatureSet_CLOSED = 2
4902} google_protobuf_FeatureSet_EnumType;
4903
4904typedef enum {
4905 google_protobuf_FeatureSet_FIELD_PRESENCE_UNKNOWN = 0,
4906 google_protobuf_FeatureSet_EXPLICIT = 1,
4907 google_protobuf_FeatureSet_IMPLICIT = 2,
4908 google_protobuf_FeatureSet_LEGACY_REQUIRED = 3
4909} google_protobuf_FeatureSet_FieldPresence;
4910
4911typedef enum {
4912 google_protobuf_FeatureSet_JSON_FORMAT_UNKNOWN = 0,
4913 google_protobuf_FeatureSet_ALLOW = 1,
4914 google_protobuf_FeatureSet_LEGACY_BEST_EFFORT = 2
4915} google_protobuf_FeatureSet_JsonFormat;
4916
4917typedef enum {
4918 google_protobuf_FeatureSet_MESSAGE_ENCODING_UNKNOWN = 0,
4919 google_protobuf_FeatureSet_LENGTH_PREFIXED = 1,
4920 google_protobuf_FeatureSet_DELIMITED = 2
4921} google_protobuf_FeatureSet_MessageEncoding;
4922
4923typedef enum {
4924 google_protobuf_FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN = 0,
4925 google_protobuf_FeatureSet_PACKED = 1,
4926 google_protobuf_FeatureSet_EXPANDED = 2
4927} google_protobuf_FeatureSet_RepeatedFieldEncoding;
4928
4929typedef enum {
Protobuf Team Bot61127952023-09-26 20:07:33 +00004930 google_protobuf_FeatureSet_UTF8_VALIDATION_UNKNOWN = 0,
Protobuf Team Bot5b8b87f2023-11-30 05:12:08 +00004931 google_protobuf_FeatureSet_VERIFY = 2,
4932 google_protobuf_FeatureSet_NONE = 3
Protobuf Team Bot61127952023-09-26 20:07:33 +00004933} google_protobuf_FeatureSet_Utf8Validation;
4934
4935typedef enum {
Mike Kruskalccbdaa72023-02-02 20:42:14 -08004936 google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1,
4937 google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2,
4938 google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3
4939} google_protobuf_FieldDescriptorProto_Label;
4940
4941typedef enum {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004942 google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1,
4943 google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2,
4944 google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3,
4945 google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4,
4946 google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5,
4947 google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6,
4948 google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7,
4949 google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8,
4950 google_protobuf_FieldDescriptorProto_TYPE_STRING = 9,
4951 google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10,
4952 google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11,
4953 google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12,
4954 google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13,
4955 google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14,
4956 google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15,
4957 google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16,
4958 google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17,
4959 google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18
4960} google_protobuf_FieldDescriptorProto_Type;
4961
4962typedef enum {
4963 google_protobuf_FieldOptions_STRING = 0,
4964 google_protobuf_FieldOptions_CORD = 1,
4965 google_protobuf_FieldOptions_STRING_PIECE = 2
4966} google_protobuf_FieldOptions_CType;
4967
4968typedef enum {
4969 google_protobuf_FieldOptions_JS_NORMAL = 0,
4970 google_protobuf_FieldOptions_JS_STRING = 1,
4971 google_protobuf_FieldOptions_JS_NUMBER = 2
4972} google_protobuf_FieldOptions_JSType;
4973
4974typedef enum {
Adam Cozzette90ff32c2023-01-21 15:04:56 -08004975 google_protobuf_FieldOptions_RETENTION_UNKNOWN = 0,
4976 google_protobuf_FieldOptions_RETENTION_RUNTIME = 1,
4977 google_protobuf_FieldOptions_RETENTION_SOURCE = 2
4978} google_protobuf_FieldOptions_OptionRetention;
4979
4980typedef enum {
4981 google_protobuf_FieldOptions_TARGET_TYPE_UNKNOWN = 0,
4982 google_protobuf_FieldOptions_TARGET_TYPE_FILE = 1,
4983 google_protobuf_FieldOptions_TARGET_TYPE_EXTENSION_RANGE = 2,
4984 google_protobuf_FieldOptions_TARGET_TYPE_MESSAGE = 3,
4985 google_protobuf_FieldOptions_TARGET_TYPE_FIELD = 4,
4986 google_protobuf_FieldOptions_TARGET_TYPE_ONEOF = 5,
4987 google_protobuf_FieldOptions_TARGET_TYPE_ENUM = 6,
4988 google_protobuf_FieldOptions_TARGET_TYPE_ENUM_ENTRY = 7,
4989 google_protobuf_FieldOptions_TARGET_TYPE_SERVICE = 8,
4990 google_protobuf_FieldOptions_TARGET_TYPE_METHOD = 9
4991} google_protobuf_FieldOptions_OptionTargetType;
4992
4993typedef enum {
Mike Kruskalccbdaa72023-02-02 20:42:14 -08004994 google_protobuf_FileOptions_SPEED = 1,
4995 google_protobuf_FileOptions_CODE_SIZE = 2,
4996 google_protobuf_FileOptions_LITE_RUNTIME = 3
4997} google_protobuf_FileOptions_OptimizeMode;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08004998
4999typedef enum {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005000 google_protobuf_GeneratedCodeInfo_Annotation_NONE = 0,
5001 google_protobuf_GeneratedCodeInfo_Annotation_SET = 1,
5002 google_protobuf_GeneratedCodeInfo_Annotation_ALIAS = 2
5003} google_protobuf_GeneratedCodeInfo_Annotation_Semantic;
5004
Mike Kruskalccbdaa72023-02-02 20:42:14 -08005005typedef enum {
5006 google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0,
5007 google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1,
5008 google_protobuf_MethodOptions_IDEMPOTENT = 2
5009} google_protobuf_MethodOptions_IdempotencyLevel;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005010
Mike Kruskalccbdaa72023-02-02 20:42:14 -08005011
Joshua Habermanf41049a2022-01-21 14:41:25 -08005012
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005013/* google.protobuf.FileDescriptorSet */
5014
Joshua Habermanf41049a2022-01-21 14:41:25 -08005015UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005016 return (google_protobuf_FileDescriptorSet*)_upb_Message_New(&google__protobuf__FileDescriptorSet_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005017}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005018UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse(const char* buf, size_t size, upb_Arena* arena) {
5019 google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005020 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005021 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FileDescriptorSet_msg_init, NULL, 0, arena) !=
5022 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005023 return NULL;
5024 }
5025 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005026}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005027UPB_INLINE google_protobuf_FileDescriptorSet* google_protobuf_FileDescriptorSet_parse_ex(const char* buf, size_t size,
5028 const upb_ExtensionRegistry* extreg,
5029 int options, upb_Arena* arena) {
5030 google_protobuf_FileDescriptorSet* ret = google_protobuf_FileDescriptorSet_new(arena);
5031 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005032 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FileDescriptorSet_msg_init, extreg, options,
5033 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08005034 return NULL;
5035 }
5036 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005037}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005038UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize(const google_protobuf_FileDescriptorSet* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005039 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005040 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FileDescriptorSet_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005041 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005042}
5043UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize_ex(const google_protobuf_FileDescriptorSet* msg, int options,
5044 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005045 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005046 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FileDescriptorSet_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005047 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005048}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005049UPB_INLINE void google_protobuf_FileDescriptorSet_clear_file(google_protobuf_FileDescriptorSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005050 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005051 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005052}
Eric Salob7d54ac2022-12-29 11:59:42 -08005053UPB_INLINE const google_protobuf_FileDescriptorProto* const* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005054 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005055 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005056 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005057 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005058 return (const google_protobuf_FileDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005059 } else {
5060 if (size) *size = 0;
5061 return NULL;
5062 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005063}
Deanna Garciab26afb52023-04-25 13:37:18 -07005064UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorSet_file_upb_array(const google_protobuf_FileDescriptorSet* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005065 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005066 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005067 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005068 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005069 }
5070 return arr;
5071}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005072UPB_INLINE upb_Array* _google_protobuf_FileDescriptorSet_file_mutable_upb_array(google_protobuf_FileDescriptorSet* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005073 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005074 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5075 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005076 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005077 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005078 }
5079 return arr;
5080}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005081
Eric Salob7d54ac2022-12-29 11:59:42 -08005082UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_mutable_file(google_protobuf_FileDescriptorSet* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005083 upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005084 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005085 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005086 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005087 return (google_protobuf_FileDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005088 } else {
5089 if (size) *size = 0;
5090 return NULL;
5091 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005092}
Eric Salob7d54ac2022-12-29 11:59:42 -08005093UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_resize_file(google_protobuf_FileDescriptorSet* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005094 upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005095 return (google_protobuf_FileDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5096 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005097}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005098UPB_INLINE struct google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorSet_add_file(google_protobuf_FileDescriptorSet* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005099 upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005100 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5101 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005102 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005103 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005104 return NULL;
5105 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005106 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 -08005107 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005108 UPB_PRIVATE(_upb_Array_Set)
5109 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005110 return sub;
5111}
5112
5113/* google.protobuf.FileDescriptorProto */
5114
Joshua Habermanf41049a2022-01-21 14:41:25 -08005115UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005116 return (google_protobuf_FileDescriptorProto*)_upb_Message_New(&google__protobuf__FileDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005117}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005118UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
5119 google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005120 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005121 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FileDescriptorProto_msg_init, NULL, 0, arena) !=
5122 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005123 return NULL;
5124 }
5125 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005126}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005127UPB_INLINE google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorProto_parse_ex(const char* buf, size_t size,
5128 const upb_ExtensionRegistry* extreg,
5129 int options, upb_Arena* arena) {
5130 google_protobuf_FileDescriptorProto* ret = google_protobuf_FileDescriptorProto_new(arena);
5131 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005132 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FileDescriptorProto_msg_init, extreg, options,
5133 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08005134 return NULL;
5135 }
5136 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005137}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005138UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005139 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005140 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FileDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005141 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005142}
5143UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize_ex(const google_protobuf_FileDescriptorProto* msg, int options,
5144 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005145 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005146 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FileDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005147 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005148}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005149UPB_INLINE void google_protobuf_FileDescriptorProto_clear_name(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005150 const upb_MiniTableField field = {1, UPB_SIZE(52, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005151 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005152}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005153UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005154 upb_StringView default_val = upb_StringView_FromString("");
5155 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005156 const upb_MiniTableField field = {1, UPB_SIZE(52, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005157 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5158 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005159 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005160}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005161UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005162 const upb_MiniTableField field = {1, UPB_SIZE(52, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00005163 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005164}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005165UPB_INLINE void google_protobuf_FileDescriptorProto_clear_package(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005166 const upb_MiniTableField field = {2, UPB_SIZE(60, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005167 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005168}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005169UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005170 upb_StringView default_val = upb_StringView_FromString("");
5171 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005172 const upb_MiniTableField field = {2, UPB_SIZE(60, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005173 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5174 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005175 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005176}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005177UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005178 const upb_MiniTableField field = {2, UPB_SIZE(60, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00005179 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08005180}
5181UPB_INLINE void google_protobuf_FileDescriptorProto_clear_dependency(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005182 const upb_MiniTableField field = {3, UPB_SIZE(12, 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)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005183 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005184}
Eric Salob7d54ac2022-12-29 11:59:42 -08005185UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005186 const upb_MiniTableField field = {3, UPB_SIZE(12, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005187 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005188 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005189 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005190 return (upb_StringView const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005191 } else {
5192 if (size) *size = 0;
5193 return NULL;
5194 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005195}
Deanna Garciab26afb52023-04-25 13:37:18 -07005196UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005197 const upb_MiniTableField field = {3, UPB_SIZE(12, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005198 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005199 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005200 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005201 }
5202 return arr;
5203}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005204UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_dependency_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005205 const upb_MiniTableField field = {3, UPB_SIZE(12, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005206 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5207 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005208 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005209 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005210 }
5211 return arr;
5212}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005213UPB_INLINE void google_protobuf_FileDescriptorProto_clear_message_type(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005214 const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005215 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005216}
Eric Salob7d54ac2022-12-29 11:59:42 -08005217UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005218 const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005219 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005220 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005221 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005222 return (const google_protobuf_DescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005223 } else {
5224 if (size) *size = 0;
5225 return NULL;
5226 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005227}
Deanna Garciab26afb52023-04-25 13:37:18 -07005228UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_message_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005229 const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005230 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005231 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005232 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005233 }
5234 return arr;
5235}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005236UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_message_type_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005237 const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005238 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5239 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005240 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005241 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005242 }
5243 return arr;
5244}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005245UPB_INLINE void google_protobuf_FileDescriptorProto_clear_enum_type(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005246 const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005247 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005248}
Eric Salob7d54ac2022-12-29 11:59:42 -08005249UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005250 const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005251 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005252 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005253 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005254 return (const google_protobuf_EnumDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005255 } else {
5256 if (size) *size = 0;
5257 return NULL;
5258 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005259}
Deanna Garciab26afb52023-04-25 13:37:18 -07005260UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_enum_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005261 const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005262 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005263 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005264 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005265 }
5266 return arr;
5267}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005268UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_enum_type_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005269 const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005270 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5271 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005272 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005273 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005274 }
5275 return arr;
5276}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005277UPB_INLINE void google_protobuf_FileDescriptorProto_clear_service(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005278 const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005279 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005280}
Eric Salob7d54ac2022-12-29 11:59:42 -08005281UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005282 const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005283 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005284 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005285 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005286 return (const google_protobuf_ServiceDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005287 } else {
5288 if (size) *size = 0;
5289 return NULL;
5290 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005291}
Deanna Garciab26afb52023-04-25 13:37:18 -07005292UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_service_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005293 const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005294 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005295 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005296 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005297 }
5298 return arr;
5299}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005300UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_service_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005301 const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005302 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5303 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005304 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005305 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005306 }
5307 return arr;
5308}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005309UPB_INLINE void google_protobuf_FileDescriptorProto_clear_extension(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005310 const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005311 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005312}
Eric Salob7d54ac2022-12-29 11:59:42 -08005313UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005314 const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005315 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005316 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005317 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005318 return (const google_protobuf_FieldDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005319 } else {
5320 if (size) *size = 0;
5321 return NULL;
5322 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005323}
Deanna Garciab26afb52023-04-25 13:37:18 -07005324UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_extension_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005325 const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005326 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005327 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005328 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005329 }
5330 return arr;
5331}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005332UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_extension_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005333 const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005334 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5335 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005336 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005337 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005338 }
5339 return arr;
5340}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005341UPB_INLINE void google_protobuf_FileDescriptorProto_clear_options(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005342 const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005343 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005344}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005345UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005346 const google_protobuf_FileOptions* default_val = NULL;
5347 const google_protobuf_FileOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005348 const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005349 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5350 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005351 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005352}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005353UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005354 const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00005355 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005356}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005357UPB_INLINE void google_protobuf_FileDescriptorProto_clear_source_code_info(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005358 const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005359 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005360}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005361UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005362 const google_protobuf_SourceCodeInfo* default_val = NULL;
5363 const google_protobuf_SourceCodeInfo* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005364 const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005365 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5366 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005367 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005368}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005369UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005370 const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00005371 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08005372}
5373UPB_INLINE void google_protobuf_FileDescriptorProto_clear_public_dependency(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005374 const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005375 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -08005376}
Eric Salob7d54ac2022-12-29 11:59:42 -08005377UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005378 const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005379 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005380 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005381 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005382 return (int32_t const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005383 } else {
5384 if (size) *size = 0;
5385 return NULL;
5386 }
Joshua Habermand3995ec2022-09-30 16:54:39 -07005387}
Deanna Garciab26afb52023-04-25 13:37:18 -07005388UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005389 const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005390 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005391 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005392 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005393 }
5394 return arr;
5395}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005396UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005397 const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005398 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5399 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005400 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005401 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005402 }
5403 return arr;
5404}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005405UPB_INLINE void google_protobuf_FileDescriptorProto_clear_weak_dependency(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005406 const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005407 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005408}
Eric Salob7d54ac2022-12-29 11:59:42 -08005409UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005410 const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005411 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005412 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005413 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005414 return (int32_t const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005415 } else {
5416 if (size) *size = 0;
5417 return NULL;
5418 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005419}
Deanna Garciab26afb52023-04-25 13:37:18 -07005420UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005421 const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005422 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005423 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005424 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005425 }
5426 return arr;
5427}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005428UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005429 const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005430 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5431 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005432 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005433 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005434 }
5435 return arr;
5436}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005437UPB_INLINE void google_protobuf_FileDescriptorProto_clear_syntax(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005438 const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005439 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005440}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005441UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005442 upb_StringView default_val = upb_StringView_FromString("");
5443 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005444 const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005445 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5446 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005447 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -07005448}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005449UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005450 const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00005451 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005452}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005453UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition(google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005454 const upb_MiniTableField field = {14, UPB_SIZE(48, 12), 69, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005455 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005456}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00005457UPB_INLINE int32_t google_protobuf_FileDescriptorProto_edition(const google_protobuf_FileDescriptorProto* msg) {
5458 int32_t default_val = 0;
5459 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005460 const upb_MiniTableField field = {14, UPB_SIZE(48, 12), 69, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005461 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5462 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005463 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005464}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005465UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition(const google_protobuf_FileDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005466 const upb_MiniTableField field = {14, UPB_SIZE(48, 12), 69, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00005467 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08005468}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005469
Joshua Habermanf41049a2022-01-21 14:41:25 -08005470UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005471 const upb_MiniTableField field = {1, UPB_SIZE(52, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005472 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005473}
5474UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005475 const upb_MiniTableField field = {2, UPB_SIZE(60, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005476 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005477}
5478UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005479 upb_MiniTableField field = {3, UPB_SIZE(12, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005480 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005481 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005482 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005483 return (upb_StringView*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005484 } 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 upb_StringView* google_protobuf_FileDescriptorProto_resize_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005490 upb_MiniTableField field = {3, UPB_SIZE(12, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005491 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5492 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005493}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005494UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto* msg, upb_StringView val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005495 upb_MiniTableField field = {3, UPB_SIZE(12, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005496 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5497 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005498 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005499 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005500 return false;
5501 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005502 UPB_PRIVATE(_upb_Array_Set)
5503 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -08005504 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005505}
Eric Salob7d54ac2022-12-29 11:59:42 -08005506UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005507 upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005508 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005509 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005510 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005511 return (google_protobuf_DescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005512 } else {
5513 if (size) *size = 0;
5514 return NULL;
5515 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005516}
Eric Salob7d54ac2022-12-29 11:59:42 -08005517UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_resize_message_type(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005518 upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005519 return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5520 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005521}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005522UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescriptorProto_add_message_type(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005523 upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005524 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5525 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005526 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005527 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005528 return NULL;
5529 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005530 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 -08005531 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005532 UPB_PRIVATE(_upb_Array_Set)
5533 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005534 return sub;
5535}
Eric Salob7d54ac2022-12-29 11:59:42 -08005536UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005537 upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005538 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005539 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005540 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005541 return (google_protobuf_EnumDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005542 } else {
5543 if (size) *size = 0;
5544 return NULL;
5545 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005546}
Eric Salob7d54ac2022-12-29 11:59:42 -08005547UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_resize_enum_type(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005548 upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005549 return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5550 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005551}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005552UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescriptorProto_add_enum_type(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005553 upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005554 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5555 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005556 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005557 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005558 return NULL;
5559 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005560 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 -08005561 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005562 UPB_PRIVATE(_upb_Array_Set)
5563 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005564 return sub;
5565}
Eric Salob7d54ac2022-12-29 11:59:42 -08005566UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005567 upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005568 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005569 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005570 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005571 return (google_protobuf_ServiceDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005572 } else {
5573 if (size) *size = 0;
5574 return NULL;
5575 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005576}
Eric Salob7d54ac2022-12-29 11:59:42 -08005577UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_resize_service(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005578 upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005579 return (google_protobuf_ServiceDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5580 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005581}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005582UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005583 upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005584 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5585 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005586 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005587 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005588 return NULL;
5589 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005590 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 -08005591 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005592 UPB_PRIVATE(_upb_Array_Set)
5593 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005594 return sub;
5595}
Eric Salob7d54ac2022-12-29 11:59:42 -08005596UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005597 upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005598 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005599 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005600 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005601 return (google_protobuf_FieldDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005602 } else {
5603 if (size) *size = 0;
5604 return NULL;
5605 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005606}
Eric Salob7d54ac2022-12-29 11:59:42 -08005607UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_resize_extension(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005608 upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005609 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5610 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005611}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005612UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005613 upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005614 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5615 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005616 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005617 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005618 return NULL;
5619 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005620 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 -08005621 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005622 UPB_PRIVATE(_upb_Array_Set)
5623 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005624 return sub;
5625}
5626UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005627 const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005628 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005629}
5630UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005631 struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg);
5632 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005633 sub = (struct google_protobuf_FileOptions*)_upb_Message_New(&google__protobuf__FileOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005634 if (sub) google_protobuf_FileDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005635 }
5636 return sub;
5637}
5638UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005639 const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005640 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005641}
5642UPB_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 -08005643 struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg);
5644 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005645 sub = (struct google_protobuf_SourceCodeInfo*)_upb_Message_New(&google__protobuf__SourceCodeInfo_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08005646 if (sub) google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005647 }
5648 return sub;
5649}
Eric Salob7d54ac2022-12-29 11:59:42 -08005650UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005651 upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005652 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005653 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005654 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005655 return (int32_t*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005656 } else {
5657 if (size) *size = 0;
5658 return NULL;
5659 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005660}
Eric Salob7d54ac2022-12-29 11:59:42 -08005661UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005662 upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005663 return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5664 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005665}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005666UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google_protobuf_FileDescriptorProto* msg, int32_t val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005667 upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005668 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5669 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005670 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005671 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005672 return false;
5673 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005674 UPB_PRIVATE(_upb_Array_Set)
5675 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -08005676 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005677}
Eric Salob7d54ac2022-12-29 11:59:42 -08005678UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005679 upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005680 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005681 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005682 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005683 return (int32_t*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005684 } else {
5685 if (size) *size = 0;
5686 return NULL;
5687 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005688}
Eric Salob7d54ac2022-12-29 11:59:42 -08005689UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005690 upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005691 return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
5692 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005693}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005694UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_protobuf_FileDescriptorProto* msg, int32_t val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005695 upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005696 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
5697 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005698 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005699 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08005700 return false;
5701 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005702 UPB_PRIVATE(_upb_Array_Set)
5703 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -08005704 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005705}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005706UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005707 const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005708 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08005709}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00005710UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005711 const upb_MiniTableField field = {14, UPB_SIZE(48, 12), 69, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005712 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005713}
Mike Kruskal232ecf42023-01-14 00:09:40 -08005714
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005715/* google.protobuf.DescriptorProto */
5716
Joshua Habermanf41049a2022-01-21 14:41:25 -08005717UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00005718 return (google_protobuf_DescriptorProto*)_upb_Message_New(&google__protobuf__DescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005719}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005720UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
5721 google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07005722 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005723 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__DescriptorProto_msg_init, NULL, 0, arena) !=
5724 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07005725 return NULL;
5726 }
5727 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005728}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005729UPB_INLINE google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_parse_ex(const char* buf, size_t size,
5730 const upb_ExtensionRegistry* extreg,
5731 int options, upb_Arena* arena) {
5732 google_protobuf_DescriptorProto* ret = google_protobuf_DescriptorProto_new(arena);
5733 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005734 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__DescriptorProto_msg_init, extreg, options,
5735 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08005736 return NULL;
5737 }
5738 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08005739}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005740UPB_INLINE char* google_protobuf_DescriptorProto_serialize(const google_protobuf_DescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005741 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005742 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__DescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005743 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005744}
5745UPB_INLINE char* google_protobuf_DescriptorProto_serialize_ex(const google_protobuf_DescriptorProto* msg, int options,
5746 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07005747 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005748 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__DescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005749 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005750}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005751UPB_INLINE void google_protobuf_DescriptorProto_clear_name(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005752 const upb_MiniTableField field = {1, UPB_SIZE(48, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005753 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005754}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005755UPB_INLINE upb_StringView google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005756 upb_StringView default_val = upb_StringView_FromString("");
5757 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005758 const upb_MiniTableField field = {1, UPB_SIZE(48, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005759 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5760 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005761 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005762}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005763UPB_INLINE bool google_protobuf_DescriptorProto_has_name(const google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005764 const upb_MiniTableField field = {1, UPB_SIZE(48, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00005765 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005766}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005767UPB_INLINE void google_protobuf_DescriptorProto_clear_field(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005768 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005769 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005770}
Eric Salob7d54ac2022-12-29 11:59:42 -08005771UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005772 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005773 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005774 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005775 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005776 return (const google_protobuf_FieldDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005777 } else {
5778 if (size) *size = 0;
5779 return NULL;
5780 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005781}
Deanna Garciab26afb52023-04-25 13:37:18 -07005782UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_field_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005783 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005784 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005785 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005786 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005787 }
5788 return arr;
5789}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005790UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_field_mutable_upb_array(google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005791 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005792 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5793 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005794 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005795 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005796 }
5797 return arr;
5798}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005799UPB_INLINE void google_protobuf_DescriptorProto_clear_nested_type(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005800 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005801 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005802}
Eric Salob7d54ac2022-12-29 11:59:42 -08005803UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005804 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005805 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005806 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005807 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005808 return (const google_protobuf_DescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005809 } else {
5810 if (size) *size = 0;
5811 return NULL;
5812 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005813}
Deanna Garciab26afb52023-04-25 13:37:18 -07005814UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_nested_type_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005815 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005816 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005817 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005818 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005819 }
5820 return arr;
5821}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005822UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_nested_type_mutable_upb_array(google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005823 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005824 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5825 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005826 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005827 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005828 }
5829 return arr;
5830}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005831UPB_INLINE void google_protobuf_DescriptorProto_clear_enum_type(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005832 const upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005833 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005834}
Eric Salob7d54ac2022-12-29 11:59:42 -08005835UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005836 const upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005837 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005838 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005839 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005840 return (const google_protobuf_EnumDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005841 } else {
5842 if (size) *size = 0;
5843 return NULL;
5844 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005845}
Deanna Garciab26afb52023-04-25 13:37:18 -07005846UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_enum_type_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005847 const upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005848 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005849 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005850 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005851 }
5852 return arr;
5853}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005854UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_enum_type_mutable_upb_array(google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005855 const upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005856 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5857 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005858 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005859 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005860 }
5861 return arr;
5862}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005863UPB_INLINE void google_protobuf_DescriptorProto_clear_extension_range(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005864 const upb_MiniTableField field = {5, UPB_SIZE(24, 56), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005865 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005866}
Eric Salob7d54ac2022-12-29 11:59:42 -08005867UPB_INLINE const google_protobuf_DescriptorProto_ExtensionRange* const* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005868 const upb_MiniTableField field = {5, UPB_SIZE(24, 56), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005869 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005870 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005871 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005872 return (const google_protobuf_DescriptorProto_ExtensionRange* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005873 } else {
5874 if (size) *size = 0;
5875 return NULL;
5876 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005877}
Deanna Garciab26afb52023-04-25 13:37:18 -07005878UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_extension_range_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005879 const upb_MiniTableField field = {5, UPB_SIZE(24, 56), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005880 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005881 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005882 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005883 }
5884 return arr;
5885}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005886UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_extension_range_mutable_upb_array(google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005887 const upb_MiniTableField field = {5, UPB_SIZE(24, 56), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005888 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5889 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005890 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005891 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005892 }
5893 return arr;
5894}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005895UPB_INLINE void google_protobuf_DescriptorProto_clear_extension(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005896 const upb_MiniTableField field = {6, UPB_SIZE(28, 64), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005897 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005898}
Eric Salob7d54ac2022-12-29 11:59:42 -08005899UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005900 const upb_MiniTableField field = {6, UPB_SIZE(28, 64), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005901 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005902 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005903 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005904 return (const google_protobuf_FieldDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005905 } else {
5906 if (size) *size = 0;
5907 return NULL;
5908 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005909}
Deanna Garciab26afb52023-04-25 13:37:18 -07005910UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_extension_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005911 const upb_MiniTableField field = {6, UPB_SIZE(28, 64), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005912 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005913 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005914 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005915 }
5916 return arr;
5917}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005918UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_extension_mutable_upb_array(google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005919 const upb_MiniTableField field = {6, UPB_SIZE(28, 64), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005920 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5921 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005922 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005923 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005924 }
5925 return arr;
5926}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005927UPB_INLINE void google_protobuf_DescriptorProto_clear_options(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005928 const upb_MiniTableField field = {7, UPB_SIZE(32, 72), 65, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005929 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005930}
Joshua Habermanf41049a2022-01-21 14:41:25 -08005931UPB_INLINE const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08005932 const google_protobuf_MessageOptions* default_val = NULL;
5933 const google_protobuf_MessageOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005934 const upb_MiniTableField field = {7, UPB_SIZE(32, 72), 65, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005935 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
5936 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08005937 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08005938}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005939UPB_INLINE bool google_protobuf_DescriptorProto_has_options(const google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005940 const upb_MiniTableField field = {7, UPB_SIZE(32, 72), 65, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00005941 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005942}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005943UPB_INLINE void google_protobuf_DescriptorProto_clear_oneof_decl(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005944 const upb_MiniTableField field = {8, UPB_SIZE(36, 80), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005945 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005946}
Eric Salob7d54ac2022-12-29 11:59:42 -08005947UPB_INLINE const google_protobuf_OneofDescriptorProto* const* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005948 const upb_MiniTableField field = {8, UPB_SIZE(36, 80), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005949 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005950 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005951 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005952 return (const google_protobuf_OneofDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005953 } else {
5954 if (size) *size = 0;
5955 return NULL;
5956 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005957}
Deanna Garciab26afb52023-04-25 13:37:18 -07005958UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_oneof_decl_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005959 const upb_MiniTableField field = {8, UPB_SIZE(36, 80), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005960 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005961 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005962 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005963 }
5964 return arr;
5965}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005966UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_oneof_decl_mutable_upb_array(google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005967 const upb_MiniTableField field = {8, UPB_SIZE(36, 80), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005968 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
5969 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07005970 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005971 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005972 }
5973 return arr;
5974}
Mike Kruskal3bc50492022-12-01 13:34:12 -08005975UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_range(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005976 const upb_MiniTableField field = {9, UPB_SIZE(40, 88), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00005977 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07005978}
Eric Salob7d54ac2022-12-29 11:59:42 -08005979UPB_INLINE const google_protobuf_DescriptorProto_ReservedRange* const* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005980 const upb_MiniTableField field = {9, UPB_SIZE(40, 88), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005981 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08005982 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005983 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00005984 return (const google_protobuf_DescriptorProto_ReservedRange* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08005985 } else {
5986 if (size) *size = 0;
5987 return NULL;
5988 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07005989}
Deanna Garciab26afb52023-04-25 13:37:18 -07005990UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_reserved_range_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005991 const upb_MiniTableField field = {9, UPB_SIZE(40, 88), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005992 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07005993 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00005994 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07005995 }
5996 return arr;
5997}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00005998UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_reserved_range_mutable_upb_array(google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00005999 const upb_MiniTableField field = {9, UPB_SIZE(40, 88), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006000 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
6001 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07006002 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006003 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006004 }
6005 return arr;
6006}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006007UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_name(google_protobuf_DescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006008 const upb_MiniTableField field = {10, UPB_SIZE(44, 96), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006009 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006010}
Eric Salob7d54ac2022-12-29 11:59:42 -08006011UPB_INLINE upb_StringView const* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006012 const upb_MiniTableField field = {10, UPB_SIZE(44, 96), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006013 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006014 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006015 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006016 return (upb_StringView const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006017 } else {
6018 if (size) *size = 0;
6019 return NULL;
6020 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006021}
Deanna Garciab26afb52023-04-25 13:37:18 -07006022UPB_INLINE const upb_Array* _google_protobuf_DescriptorProto_reserved_name_upb_array(const google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006023 const upb_MiniTableField field = {10, UPB_SIZE(44, 96), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006024 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07006025 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006026 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006027 }
6028 return arr;
6029}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006030UPB_INLINE upb_Array* _google_protobuf_DescriptorProto_reserved_name_mutable_upb_array(google_protobuf_DescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006031 const upb_MiniTableField field = {10, UPB_SIZE(44, 96), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006032 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
6033 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07006034 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006035 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006036 }
6037 return arr;
6038}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006039
Joshua Habermanf41049a2022-01-21 14:41:25 -08006040UPB_INLINE void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006041 const upb_MiniTableField field = {1, UPB_SIZE(48, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006042 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006043}
6044UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006045 upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006046 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006047 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006048 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006049 return (google_protobuf_FieldDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006050 } else {
6051 if (size) *size = 0;
6052 return NULL;
6053 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006054}
Eric Salob7d54ac2022-12-29 11:59:42 -08006055UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_field(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006056 upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006057 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6058 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006059}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006060UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_field(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006061 upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006062 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6063 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006064 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006065 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006066 return NULL;
6067 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006068 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 -08006069 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006070 UPB_PRIVATE(_upb_Array_Set)
6071 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006072 return sub;
6073}
Eric Salob7d54ac2022-12-29 11:59:42 -08006074UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_mutable_nested_type(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006075 upb_MiniTableField field = {3, UPB_SIZE(16, 40), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006076 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006077 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006078 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006079 return (google_protobuf_DescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006080 } else {
6081 if (size) *size = 0;
6082 return NULL;
6083 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006084}
Eric Salob7d54ac2022-12-29 11:59:42 -08006085UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_resize_nested_type(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006086 upb_MiniTableField field = {3, UPB_SIZE(16, 40), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006087 return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6088 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006089}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006090UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_add_nested_type(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006091 upb_MiniTableField field = {3, UPB_SIZE(16, 40), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006092 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6093 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006094 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006095 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006096 return NULL;
6097 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006098 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 -08006099 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006100 UPB_PRIVATE(_upb_Array_Set)
6101 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006102 return sub;
6103}
Eric Salob7d54ac2022-12-29 11:59:42 -08006104UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_mutable_enum_type(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006105 upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006106 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006107 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006108 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006109 return (google_protobuf_EnumDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006110 } else {
6111 if (size) *size = 0;
6112 return NULL;
6113 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006114}
Eric Salob7d54ac2022-12-29 11:59:42 -08006115UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_resize_enum_type(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006116 upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006117 return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6118 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006119}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006120UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_DescriptorProto_add_enum_type(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006121 upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006122 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6123 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006124 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006125 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006126 return NULL;
6127 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006128 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 -08006129 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006130 UPB_PRIVATE(_upb_Array_Set)
6131 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006132 return sub;
6133}
Eric Salob7d54ac2022-12-29 11:59:42 -08006134UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_mutable_extension_range(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006135 upb_MiniTableField field = {5, UPB_SIZE(24, 56), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006136 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006137 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006138 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006139 return (google_protobuf_DescriptorProto_ExtensionRange**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006140 } else {
6141 if (size) *size = 0;
6142 return NULL;
6143 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006144}
Eric Salob7d54ac2022-12-29 11:59:42 -08006145UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_resize_extension_range(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006146 upb_MiniTableField field = {5, UPB_SIZE(24, 56), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006147 return (google_protobuf_DescriptorProto_ExtensionRange**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6148 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006149}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006150UPB_INLINE struct google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_add_extension_range(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006151 upb_MiniTableField field = {5, UPB_SIZE(24, 56), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006152 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6153 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006154 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006155 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006156 return NULL;
6157 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006158 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 -08006159 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006160 UPB_PRIVATE(_upb_Array_Set)
6161 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006162 return sub;
6163}
Eric Salob7d54ac2022-12-29 11:59:42 -08006164UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_extension(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006165 upb_MiniTableField field = {6, UPB_SIZE(28, 64), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006166 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006167 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006168 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006169 return (google_protobuf_FieldDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006170 } else {
6171 if (size) *size = 0;
6172 return NULL;
6173 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006174}
Eric Salob7d54ac2022-12-29 11:59:42 -08006175UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_extension(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006176 upb_MiniTableField field = {6, UPB_SIZE(28, 64), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006177 return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6178 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006179}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006180UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_extension(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006181 upb_MiniTableField field = {6, UPB_SIZE(28, 64), 0, 4, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006182 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6183 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006184 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006185 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006186 return NULL;
6187 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006188 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 -08006189 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006190 UPB_PRIVATE(_upb_Array_Set)
6191 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006192 return sub;
6193}
6194UPB_INLINE void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006195 const upb_MiniTableField field = {7, UPB_SIZE(32, 72), 65, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006196 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006197}
6198UPB_INLINE struct google_protobuf_MessageOptions* google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006199 struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg);
6200 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006201 sub = (struct google_protobuf_MessageOptions*)_upb_Message_New(&google__protobuf__MessageOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006202 if (sub) google_protobuf_DescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006203 }
6204 return sub;
6205}
Eric Salob7d54ac2022-12-29 11:59:42 -08006206UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_mutable_oneof_decl(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006207 upb_MiniTableField field = {8, UPB_SIZE(36, 80), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006208 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006209 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006210 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006211 return (google_protobuf_OneofDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006212 } else {
6213 if (size) *size = 0;
6214 return NULL;
6215 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006216}
Eric Salob7d54ac2022-12-29 11:59:42 -08006217UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_resize_oneof_decl(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006218 upb_MiniTableField field = {8, UPB_SIZE(36, 80), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006219 return (google_protobuf_OneofDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6220 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006221}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006222UPB_INLINE struct google_protobuf_OneofDescriptorProto* google_protobuf_DescriptorProto_add_oneof_decl(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006223 upb_MiniTableField field = {8, UPB_SIZE(36, 80), 0, 6, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006224 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6225 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006226 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006227 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006228 return NULL;
6229 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006230 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 -08006231 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006232 UPB_PRIVATE(_upb_Array_Set)
6233 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006234 return sub;
6235}
Eric Salob7d54ac2022-12-29 11:59:42 -08006236UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_mutable_reserved_range(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006237 upb_MiniTableField field = {9, UPB_SIZE(40, 88), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006238 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006239 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006240 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006241 return (google_protobuf_DescriptorProto_ReservedRange**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006242 } else {
6243 if (size) *size = 0;
6244 return NULL;
6245 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006246}
Eric Salob7d54ac2022-12-29 11:59:42 -08006247UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_resize_reserved_range(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006248 upb_MiniTableField field = {9, UPB_SIZE(40, 88), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006249 return (google_protobuf_DescriptorProto_ReservedRange**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6250 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006251}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006252UPB_INLINE struct google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_add_reserved_range(google_protobuf_DescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006253 upb_MiniTableField field = {9, UPB_SIZE(40, 88), 0, 7, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006254 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6255 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006256 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006257 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006258 return NULL;
6259 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006260 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 -08006261 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006262 UPB_PRIVATE(_upb_Array_Set)
6263 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006264 return sub;
6265}
Eric Salob7d54ac2022-12-29 11:59:42 -08006266UPB_INLINE upb_StringView* google_protobuf_DescriptorProto_mutable_reserved_name(google_protobuf_DescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006267 upb_MiniTableField field = {10, UPB_SIZE(44, 96), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006268 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006269 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006270 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006271 return (upb_StringView*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006272 } else {
6273 if (size) *size = 0;
6274 return NULL;
6275 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006276}
Eric Salob7d54ac2022-12-29 11:59:42 -08006277UPB_INLINE upb_StringView* google_protobuf_DescriptorProto_resize_reserved_name(google_protobuf_DescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006278 upb_MiniTableField field = {10, UPB_SIZE(44, 96), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006279 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6280 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006281}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006282UPB_INLINE bool google_protobuf_DescriptorProto_add_reserved_name(google_protobuf_DescriptorProto* msg, upb_StringView val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006283 upb_MiniTableField field = {10, UPB_SIZE(44, 96), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006284 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6285 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006286 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006287 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006288 return false;
6289 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006290 UPB_PRIVATE(_upb_Array_Set)
6291 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -08006292 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006293}
6294
6295/* google.protobuf.DescriptorProto.ExtensionRange */
6296
Joshua Habermanf41049a2022-01-21 14:41:25 -08006297UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006298 return (google_protobuf_DescriptorProto_ExtensionRange*)_upb_Message_New(&google__protobuf__DescriptorProto__ExtensionRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006299}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006300UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse(const char* buf, size_t size, upb_Arena* arena) {
6301 google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006302 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006303 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__DescriptorProto__ExtensionRange_msg_init, NULL, 0, arena) !=
6304 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006305 return NULL;
6306 }
6307 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006308}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006309UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_ExtensionRange_parse_ex(const char* buf, size_t size,
6310 const upb_ExtensionRegistry* extreg,
6311 int options, upb_Arena* arena) {
6312 google_protobuf_DescriptorProto_ExtensionRange* ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
6313 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006314 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__DescriptorProto__ExtensionRange_msg_init, extreg, options,
6315 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08006316 return NULL;
6317 }
6318 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006319}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006320UPB_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 -07006321 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006322 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__DescriptorProto__ExtensionRange_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006323 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006324}
6325UPB_INLINE char* google_protobuf_DescriptorProto_ExtensionRange_serialize_ex(const google_protobuf_DescriptorProto_ExtensionRange* msg, int options,
6326 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006327 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006328 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__DescriptorProto__ExtensionRange_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006329 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006330}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006331UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_start(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006332 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006333 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006334}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006335UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006336 int32_t default_val = (int32_t)0;
6337 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006338 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006339 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6340 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006341 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006342}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006343UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006344 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006345 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006346}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006347UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_end(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006348 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006349 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006350}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006351UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006352 int32_t default_val = (int32_t)0;
6353 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006354 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006355 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6356 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006357 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006358}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006359UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006360 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006361 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006362}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006363UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_options(google_protobuf_DescriptorProto_ExtensionRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006364 const upb_MiniTableField field = {3, UPB_SIZE(20, 24), 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006365 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006366}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006367UPB_INLINE const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006368 const google_protobuf_ExtensionRangeOptions* default_val = NULL;
6369 const google_protobuf_ExtensionRangeOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006370 const upb_MiniTableField field = {3, UPB_SIZE(20, 24), 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006371 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6372 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006373 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006374}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006375UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006376 const upb_MiniTableField field = {3, UPB_SIZE(20, 24), 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006377 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006378}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006379
6380UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006381 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006382 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006383}
6384UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006385 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006386 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006387}
6388UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006389 const upb_MiniTableField field = {3, UPB_SIZE(20, 24), 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006390 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006391}
6392UPB_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 -08006393 struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg);
6394 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006395 sub = (struct google_protobuf_ExtensionRangeOptions*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08006396 if (sub) google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006397 }
6398 return sub;
6399}
6400
6401/* google.protobuf.DescriptorProto.ReservedRange */
6402
Joshua Habermanf41049a2022-01-21 14:41:25 -08006403UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006404 return (google_protobuf_DescriptorProto_ReservedRange*)_upb_Message_New(&google__protobuf__DescriptorProto__ReservedRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006405}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006406UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) {
6407 google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006408 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006409 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__DescriptorProto__ReservedRange_msg_init, NULL, 0, arena) !=
6410 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006411 return NULL;
6412 }
6413 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006414}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006415UPB_INLINE google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_ReservedRange_parse_ex(const char* buf, size_t size,
6416 const upb_ExtensionRegistry* extreg,
6417 int options, upb_Arena* arena) {
6418 google_protobuf_DescriptorProto_ReservedRange* ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
6419 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006420 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__DescriptorProto__ReservedRange_msg_init, extreg, options,
6421 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08006422 return NULL;
6423 }
6424 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006425}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006426UPB_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 -07006427 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006428 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__DescriptorProto__ReservedRange_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006429 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006430}
6431UPB_INLINE char* google_protobuf_DescriptorProto_ReservedRange_serialize_ex(const google_protobuf_DescriptorProto_ReservedRange* msg, int options,
6432 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006433 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006434 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__DescriptorProto__ReservedRange_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006435 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006436}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006437UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_start(google_protobuf_DescriptorProto_ReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006438 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006439 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006440}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006441UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006442 int32_t default_val = (int32_t)0;
6443 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006444 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006445 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6446 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006447 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006448}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006449UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006450 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006451 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006452}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006453UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_end(google_protobuf_DescriptorProto_ReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006454 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006455 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006456}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006457UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006458 int32_t default_val = (int32_t)0;
6459 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006460 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006461 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6462 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006463 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006464}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006465UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_end(const google_protobuf_DescriptorProto_ReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006466 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006467 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08006468}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006469
6470UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006471 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006472 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08006473}
6474UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006475 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006476 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006477}
Mike Kruskal232ecf42023-01-14 00:09:40 -08006478
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006479/* google.protobuf.ExtensionRangeOptions */
6480
Joshua Habermanf41049a2022-01-21 14:41:25 -08006481UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006482 return (google_protobuf_ExtensionRangeOptions*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006483}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006484UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
6485 google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006486 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006487 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ExtensionRangeOptions_msg_init, NULL, 0, arena) !=
6488 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006489 return NULL;
6490 }
6491 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006492}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006493UPB_INLINE google_protobuf_ExtensionRangeOptions* google_protobuf_ExtensionRangeOptions_parse_ex(const char* buf, size_t size,
6494 const upb_ExtensionRegistry* extreg,
6495 int options, upb_Arena* arena) {
6496 google_protobuf_ExtensionRangeOptions* ret = google_protobuf_ExtensionRangeOptions_new(arena);
6497 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006498 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ExtensionRangeOptions_msg_init, extreg, options,
6499 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08006500 return NULL;
6501 }
6502 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006503}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006504UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize(const google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006505 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006506 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ExtensionRangeOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006507 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006508}
6509UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize_ex(const google_protobuf_ExtensionRangeOptions* msg, int options,
6510 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006511 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006512 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ExtensionRangeOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006513 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006514}
Mike Kruskal145900f2023-03-27 09:55:52 -07006515UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_declaration(google_protobuf_ExtensionRangeOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006516 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006517 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006518}
6519UPB_INLINE const google_protobuf_ExtensionRangeOptions_Declaration* const* google_protobuf_ExtensionRangeOptions_declaration(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006520 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006521 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006522 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006523 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006524 return (const google_protobuf_ExtensionRangeOptions_Declaration* const*)upb_Array_DataPtr(arr);
Mike Kruskal145900f2023-03-27 09:55:52 -07006525 } else {
6526 if (size) *size = 0;
6527 return NULL;
6528 }
6529}
Deanna Garciab26afb52023-04-25 13:37:18 -07006530UPB_INLINE const upb_Array* _google_protobuf_ExtensionRangeOptions_declaration_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006531 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006532 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07006533 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006534 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006535 }
6536 return arr;
6537}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006538UPB_INLINE upb_Array* _google_protobuf_ExtensionRangeOptions_declaration_mutable_upb_array(google_protobuf_ExtensionRangeOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006539 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006540 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
6541 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07006542 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006543 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006544 }
6545 return arr;
6546}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006547UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_verification(google_protobuf_ExtensionRangeOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006548 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 64, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006549 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006550}
6551UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_verification(const google_protobuf_ExtensionRangeOptions* msg) {
6552 int32_t default_val = 1;
6553 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006554 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 64, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006555 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6556 &default_val, &ret);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006557 return ret;
6558}
6559UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_verification(const google_protobuf_ExtensionRangeOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006560 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 64, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006561 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006562}
6563UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_features(google_protobuf_ExtensionRangeOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006564 const upb_MiniTableField field = {50, UPB_SIZE(20, 24), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006565 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006566}
6567UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_features(const google_protobuf_ExtensionRangeOptions* msg) {
6568 const google_protobuf_FeatureSet* default_val = NULL;
6569 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006570 const upb_MiniTableField field = {50, UPB_SIZE(20, 24), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006571 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6572 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006573 return ret;
6574}
6575UPB_INLINE bool google_protobuf_ExtensionRangeOptions_has_features(const google_protobuf_ExtensionRangeOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006576 const upb_MiniTableField field = {50, UPB_SIZE(20, 24), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006577 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006578}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006579UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006580 const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006581 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006582}
Eric Salob7d54ac2022-12-29 11:59:42 -08006583UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006584 const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006585 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006586 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006587 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006588 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006589 } else {
6590 if (size) *size = 0;
6591 return NULL;
6592 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006593}
Deanna Garciab26afb52023-04-25 13:37:18 -07006594UPB_INLINE const upb_Array* _google_protobuf_ExtensionRangeOptions_uninterpreted_option_upb_array(const google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006595 const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006596 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07006597 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006598 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006599 }
6600 return arr;
6601}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006602UPB_INLINE upb_Array* _google_protobuf_ExtensionRangeOptions_uninterpreted_option_mutable_upb_array(google_protobuf_ExtensionRangeOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006603 const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006604 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
6605 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07006606 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006607 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07006608 }
6609 return arr;
6610}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006611
Mike Kruskal145900f2023-03-27 09:55:52 -07006612UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration** google_protobuf_ExtensionRangeOptions_mutable_declaration(google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006613 upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006614 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006615 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006616 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006617 return (google_protobuf_ExtensionRangeOptions_Declaration**)upb_Array_MutableDataPtr(arr);
Mike Kruskal145900f2023-03-27 09:55:52 -07006618 } else {
6619 if (size) *size = 0;
6620 return NULL;
6621 }
6622}
6623UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration** google_protobuf_ExtensionRangeOptions_resize_declaration(google_protobuf_ExtensionRangeOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006624 upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006625 return (google_protobuf_ExtensionRangeOptions_Declaration**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6626 &field, size, arena);
Mike Kruskal145900f2023-03-27 09:55:52 -07006627}
6628UPB_INLINE struct google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_add_declaration(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006629 upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006630 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6631 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006632 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006633 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Mike Kruskal145900f2023-03-27 09:55:52 -07006634 return NULL;
6635 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006636 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 -07006637 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006638 UPB_PRIVATE(_upb_Array_Set)
6639 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Mike Kruskal145900f2023-03-27 09:55:52 -07006640 return sub;
6641}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006642UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_verification(google_protobuf_ExtensionRangeOptions *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006643 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 64, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006644 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006645}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006646UPB_INLINE void google_protobuf_ExtensionRangeOptions_set_features(google_protobuf_ExtensionRangeOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006647 const upb_MiniTableField field = {50, UPB_SIZE(20, 24), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006648 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006649}
6650UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ExtensionRangeOptions_mutable_features(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) {
6651 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ExtensionRangeOptions_features(msg);
6652 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006653 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07006654 if (sub) google_protobuf_ExtensionRangeOptions_set_features(msg, sub);
6655 }
6656 return sub;
6657}
Eric Salob7d54ac2022-12-29 11:59:42 -08006658UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_mutable_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006659 upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006660 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08006661 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006662 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006663 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08006664 } else {
6665 if (size) *size = 0;
6666 return NULL;
6667 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006668}
Eric Salob7d54ac2022-12-29 11:59:42 -08006669UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_resize_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006670 upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006671 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
6672 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006673}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006674UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ExtensionRangeOptions_add_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006675 upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006676 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
6677 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00006678 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006679 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08006680 return NULL;
6681 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006682 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 -08006683 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00006684 UPB_PRIVATE(_upb_Array_Set)
6685 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006686 return sub;
6687}
6688
Mike Kruskal145900f2023-03-27 09:55:52 -07006689/* google.protobuf.ExtensionRangeOptions.Declaration */
6690
6691UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006692 return (google_protobuf_ExtensionRangeOptions_Declaration*)_upb_Message_New(&google__protobuf__ExtensionRangeOptions__Declaration_msg_init, arena);
Mike Kruskal145900f2023-03-27 09:55:52 -07006693}
6694UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse(const char* buf, size_t size, upb_Arena* arena) {
6695 google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena);
6696 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006697 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, NULL, 0, arena) !=
6698 kUpb_DecodeStatus_Ok) {
Mike Kruskal145900f2023-03-27 09:55:52 -07006699 return NULL;
6700 }
6701 return ret;
6702}
6703UPB_INLINE google_protobuf_ExtensionRangeOptions_Declaration* google_protobuf_ExtensionRangeOptions_Declaration_parse_ex(const char* buf, size_t size,
6704 const upb_ExtensionRegistry* extreg,
6705 int options, upb_Arena* arena) {
6706 google_protobuf_ExtensionRangeOptions_Declaration* ret = google_protobuf_ExtensionRangeOptions_Declaration_new(arena);
6707 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006708 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, extreg, options,
6709 arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskal145900f2023-03-27 09:55:52 -07006710 return NULL;
6711 }
6712 return ret;
6713}
6714UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize(const google_protobuf_ExtensionRangeOptions_Declaration* msg, upb_Arena* arena, size_t* len) {
6715 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006716 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, 0, arena, &ptr, len);
Mike Kruskal145900f2023-03-27 09:55:52 -07006717 return ptr;
6718}
6719UPB_INLINE char* google_protobuf_ExtensionRangeOptions_Declaration_serialize_ex(const google_protobuf_ExtensionRangeOptions_Declaration* msg, int options,
6720 upb_Arena* arena, size_t* len) {
6721 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006722 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ExtensionRangeOptions__Declaration_msg_init, options, arena, &ptr, len);
Mike Kruskal145900f2023-03-27 09:55:52 -07006723 return ptr;
6724}
6725UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_number(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006726 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006727 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006728}
6729UPB_INLINE int32_t google_protobuf_ExtensionRangeOptions_Declaration_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6730 int32_t default_val = (int32_t)0;
6731 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006732 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006733 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6734 &default_val, &ret);
Mike Kruskal145900f2023-03-27 09:55:52 -07006735 return ret;
6736}
6737UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_number(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006738 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006739 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006740}
6741UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_full_name(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006742 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006743 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006744}
6745UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6746 upb_StringView default_val = upb_StringView_FromString("");
6747 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006748 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006749 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6750 &default_val, &ret);
Mike Kruskal145900f2023-03-27 09:55:52 -07006751 return ret;
6752}
6753UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006754 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006755 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006756}
6757UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_type(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006758 const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006759 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006760}
6761UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6762 upb_StringView default_val = upb_StringView_FromString("");
6763 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006764 const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006765 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6766 &default_val, &ret);
Mike Kruskal145900f2023-03-27 09:55:52 -07006767 return ret;
6768}
6769UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006770 const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006771 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal145900f2023-03-27 09:55:52 -07006772}
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006773UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_reserved(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006774 const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006775 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006776}
6777UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6778 bool default_val = false;
6779 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006780 const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006781 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6782 &default_val, &ret);
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006783 return ret;
6784}
6785UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006786 const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006787 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006788}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006789UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_repeated(google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006790 const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006791 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006792}
6793UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
6794 bool default_val = false;
6795 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006796 const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006797 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6798 &default_val, &ret);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006799 return ret;
6800}
6801UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006802 const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006803 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006804}
Mike Kruskal145900f2023-03-27 09:55:52 -07006805
6806UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_number(google_protobuf_ExtensionRangeOptions_Declaration *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006807 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006808 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal145900f2023-03-27 09:55:52 -07006809}
6810UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_full_name(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006811 const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006812 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal145900f2023-03-27 09:55:52 -07006813}
6814UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_type(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006815 const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006816 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal145900f2023-03-27 09:55:52 -07006817}
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006818UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_reserved(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006819 const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006820 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Protobuf Team Bot41287bd2023-04-10 18:57:14 -07006821}
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006822UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_repeated(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006823 const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006824 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Protobuf Team Bot469f0272023-04-21 18:12:45 -07006825}
Mike Kruskal145900f2023-03-27 09:55:52 -07006826
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006827/* google.protobuf.FieldDescriptorProto */
6828
Joshua Habermanf41049a2022-01-21 14:41:25 -08006829UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00006830 return (google_protobuf_FieldDescriptorProto*)_upb_Message_New(&google__protobuf__FieldDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006831}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006832UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
6833 google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07006834 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006835 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldDescriptorProto_msg_init, NULL, 0, arena) !=
6836 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07006837 return NULL;
6838 }
6839 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006840}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006841UPB_INLINE google_protobuf_FieldDescriptorProto* google_protobuf_FieldDescriptorProto_parse_ex(const char* buf, size_t size,
6842 const upb_ExtensionRegistry* extreg,
6843 int options, upb_Arena* arena) {
6844 google_protobuf_FieldDescriptorProto* ret = google_protobuf_FieldDescriptorProto_new(arena);
6845 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006846 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldDescriptorProto_msg_init, extreg, options,
6847 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08006848 return NULL;
6849 }
6850 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006851}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006852UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize(const google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006853 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006854 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006855 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006856}
6857UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize_ex(const google_protobuf_FieldDescriptorProto* msg, int options,
6858 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07006859 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006860 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006861 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006862}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006863UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_name(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006864 const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006865 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006866}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006867UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006868 upb_StringView default_val = upb_StringView_FromString("");
6869 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006870 const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006871 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6872 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006873 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08006874}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006875UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006876 const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006877 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006878}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006879UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_extendee(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006880 const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006881 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006882}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006883UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006884 upb_StringView default_val = upb_StringView_FromString("");
6885 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006886 const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006887 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6888 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006889 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006890}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006891UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006892 const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006893 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006894}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006895UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_number(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006896 const upb_MiniTableField field = {3, 12, 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006897 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006898}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006899UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006900 int32_t default_val = (int32_t)0;
6901 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006902 const upb_MiniTableField field = {3, 12, 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006903 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6904 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006905 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006906}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006907UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006908 const upb_MiniTableField field = {3, 12, 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006909 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006910}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006911UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_label(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006912 const upb_MiniTableField field = {4, 16, 67, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006913 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006914}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006915UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006916 int32_t default_val = 1;
6917 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006918 const upb_MiniTableField field = {4, 16, 67, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006919 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6920 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006921 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006922}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006923UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006924 const upb_MiniTableField field = {4, 16, 67, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006925 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006926}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006927UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006928 const upb_MiniTableField field = {5, 20, 68, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006929 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006930}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006931UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006932 int32_t default_val = 1;
6933 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006934 const upb_MiniTableField field = {5, 20, 68, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006935 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6936 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006937 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006938}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006939UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006940 const upb_MiniTableField field = {5, 20, 68, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006941 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006942}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006943UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type_name(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006944 const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006945 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006946}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006947UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006948 upb_StringView default_val = upb_StringView_FromString("");
6949 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006950 const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006951 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6952 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006953 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006954}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006955UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006956 const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006957 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006958}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006959UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_default_value(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006960 const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006961 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006962}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006963UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006964 upb_StringView default_val = upb_StringView_FromString("");
6965 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006966 const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006967 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6968 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006969 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006970}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006971UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006972 const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006973 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006974}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006975UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_options(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006976 const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006977 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006978}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006979UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006980 const google_protobuf_FieldOptions* default_val = NULL;
6981 const google_protobuf_FieldOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006982 const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006983 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
6984 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08006985 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08006986}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006987UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006988 const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00006989 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07006990}
Mike Kruskal3bc50492022-12-01 13:34:12 -08006991UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_oneof_index(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006992 const upb_MiniTableField field = {9, UPB_SIZE(28, 24), 72, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00006993 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07006994}
Joshua Habermanf41049a2022-01-21 14:41:25 -08006995UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08006996 int32_t default_val = (int32_t)0;
6997 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00006998 const upb_MiniTableField field = {9, UPB_SIZE(28, 24), 72, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00006999 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7000 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007001 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007002}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007003UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007004 const upb_MiniTableField field = {9, UPB_SIZE(28, 24), 72, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007005 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007006}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007007UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_json_name(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007008 const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007009 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007010}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007011UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007012 upb_StringView default_val = upb_StringView_FromString("");
7013 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007014 const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007015 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7016 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007017 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007018}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007019UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007020 const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007021 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007022}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007023UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_proto3_optional(google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007024 const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007025 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007026}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007027UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007028 bool default_val = false;
7029 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007030 const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007031 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7032 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007033 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007034}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007035UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007036 const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007037 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007038}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007039
7040UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007041 const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007042 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007043}
7044UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007045 const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007046 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007047}
7048UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007049 const upb_MiniTableField field = {3, 12, 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007050 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007051}
7052UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007053 const upb_MiniTableField field = {4, 16, 67, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007054 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007055}
7056UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007057 const upb_MiniTableField field = {5, 20, 68, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007058 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007059}
7060UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007061 const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007062 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007063}
7064UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007065 const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007066 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007067}
7068UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007069 const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007070 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007071}
7072UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007073 struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg);
7074 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007075 sub = (struct google_protobuf_FieldOptions*)_upb_Message_New(&google__protobuf__FieldOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007076 if (sub) google_protobuf_FieldDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007077 }
7078 return sub;
7079}
7080UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007081 const upb_MiniTableField field = {9, UPB_SIZE(28, 24), 72, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007082 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007083}
7084UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007085 const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007086 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007087}
7088UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007089 const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007090 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007091}
Mike Kruskal232ecf42023-01-14 00:09:40 -08007092
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007093/* google.protobuf.OneofDescriptorProto */
7094
Joshua Habermanf41049a2022-01-21 14:41:25 -08007095UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007096 return (google_protobuf_OneofDescriptorProto*)_upb_Message_New(&google__protobuf__OneofDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007097}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007098UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7099 google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007100 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007101 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__OneofDescriptorProto_msg_init, NULL, 0, arena) !=
7102 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007103 return NULL;
7104 }
7105 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007106}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007107UPB_INLINE google_protobuf_OneofDescriptorProto* google_protobuf_OneofDescriptorProto_parse_ex(const char* buf, size_t size,
7108 const upb_ExtensionRegistry* extreg,
7109 int options, upb_Arena* arena) {
7110 google_protobuf_OneofDescriptorProto* ret = google_protobuf_OneofDescriptorProto_new(arena);
7111 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007112 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__OneofDescriptorProto_msg_init, extreg, options,
7113 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007114 return NULL;
7115 }
7116 return ret;
7117}
7118UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize(const google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007119 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007120 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__OneofDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007121 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007122}
7123UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize_ex(const google_protobuf_OneofDescriptorProto* msg, int options,
7124 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007125 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007126 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__OneofDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007127 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007128}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007129UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_name(google_protobuf_OneofDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007130 const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007131 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007132}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007133UPB_INLINE upb_StringView google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007134 upb_StringView default_val = upb_StringView_FromString("");
7135 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007136 const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007137 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7138 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007139 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007140}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007141UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_name(const google_protobuf_OneofDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007142 const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007143 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007144}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007145UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_options(google_protobuf_OneofDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007146 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007147 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007148}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007149UPB_INLINE const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007150 const google_protobuf_OneofOptions* default_val = NULL;
7151 const google_protobuf_OneofOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007152 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007153 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7154 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007155 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007156}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007157UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_options(const google_protobuf_OneofDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007158 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007159 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007160}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007161
Joshua Habermanf41049a2022-01-21 14:41:25 -08007162UPB_INLINE void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007163 const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007164 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007165}
7166UPB_INLINE void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007167 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007168 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007169}
7170UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007171 struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg);
7172 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007173 sub = (struct google_protobuf_OneofOptions*)_upb_Message_New(&google__protobuf__OneofOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007174 if (sub) google_protobuf_OneofDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007175 }
7176 return sub;
7177}
7178
7179/* google.protobuf.EnumDescriptorProto */
7180
Joshua Habermanf41049a2022-01-21 14:41:25 -08007181UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007182 return (google_protobuf_EnumDescriptorProto*)_upb_Message_New(&google__protobuf__EnumDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007183}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007184UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7185 google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007186 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007187 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumDescriptorProto_msg_init, NULL, 0, arena) !=
7188 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007189 return NULL;
7190 }
7191 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007192}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007193UPB_INLINE google_protobuf_EnumDescriptorProto* google_protobuf_EnumDescriptorProto_parse_ex(const char* buf, size_t size,
7194 const upb_ExtensionRegistry* extreg,
7195 int options, upb_Arena* arena) {
7196 google_protobuf_EnumDescriptorProto* ret = google_protobuf_EnumDescriptorProto_new(arena);
7197 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007198 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumDescriptorProto_msg_init, extreg, options,
7199 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007200 return NULL;
7201 }
7202 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007203}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007204UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize(const google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007205 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007206 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007207 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007208}
7209UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize_ex(const google_protobuf_EnumDescriptorProto* msg, int options,
7210 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007211 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007212 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007213 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007214}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007215UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_name(google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007216 const upb_MiniTableField field = {1, UPB_SIZE(28, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007217 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007218}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007219UPB_INLINE upb_StringView google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007220 upb_StringView default_val = upb_StringView_FromString("");
7221 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007222 const upb_MiniTableField field = {1, UPB_SIZE(28, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007223 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7224 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007225 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007226}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007227UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_name(const google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007228 const upb_MiniTableField field = {1, UPB_SIZE(28, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007229 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007230}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007231UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_value(google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007232 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007233 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007234}
Eric Salob7d54ac2022-12-29 11:59:42 -08007235UPB_INLINE const google_protobuf_EnumValueDescriptorProto* const* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007236 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007237 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007238 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007239 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007240 return (const google_protobuf_EnumValueDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007241 } else {
7242 if (size) *size = 0;
7243 return NULL;
7244 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007245}
Deanna Garciab26afb52023-04-25 13:37:18 -07007246UPB_INLINE const upb_Array* _google_protobuf_EnumDescriptorProto_value_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007247 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007248 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07007249 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007250 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007251 }
7252 return arr;
7253}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007254UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_value_mutable_upb_array(google_protobuf_EnumDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007255 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007256 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
7257 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07007258 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007259 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007260 }
7261 return arr;
7262}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007263UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_options(google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007264 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007265 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007266}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007267UPB_INLINE const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007268 const google_protobuf_EnumOptions* default_val = NULL;
7269 const google_protobuf_EnumOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007270 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007271 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7272 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007273 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007274}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007275UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_options(const google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007276 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007277 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007278}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007279UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_range(google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007280 const upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007281 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007282}
Eric Salob7d54ac2022-12-29 11:59:42 -08007283UPB_INLINE const google_protobuf_EnumDescriptorProto_EnumReservedRange* const* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007284 const upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007285 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007286 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007287 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007288 return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007289 } else {
7290 if (size) *size = 0;
7291 return NULL;
7292 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007293}
Deanna Garciab26afb52023-04-25 13:37:18 -07007294UPB_INLINE const upb_Array* _google_protobuf_EnumDescriptorProto_reserved_range_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007295 const upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007296 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07007297 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007298 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007299 }
7300 return arr;
7301}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007302UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_reserved_range_mutable_upb_array(google_protobuf_EnumDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007303 const upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007304 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
7305 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07007306 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007307 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007308 }
7309 return arr;
7310}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007311UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_name(google_protobuf_EnumDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007312 const upb_MiniTableField field = {5, UPB_SIZE(24, 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)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007313 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007314}
Eric Salob7d54ac2022-12-29 11:59:42 -08007315UPB_INLINE upb_StringView const* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007316 const upb_MiniTableField field = {5, UPB_SIZE(24, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007317 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007318 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007319 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007320 return (upb_StringView const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007321 } else {
7322 if (size) *size = 0;
7323 return NULL;
7324 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007325}
Deanna Garciab26afb52023-04-25 13:37:18 -07007326UPB_INLINE const upb_Array* _google_protobuf_EnumDescriptorProto_reserved_name_upb_array(const google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007327 const upb_MiniTableField field = {5, UPB_SIZE(24, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007328 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07007329 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007330 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007331 }
7332 return arr;
7333}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007334UPB_INLINE upb_Array* _google_protobuf_EnumDescriptorProto_reserved_name_mutable_upb_array(google_protobuf_EnumDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007335 const upb_MiniTableField field = {5, UPB_SIZE(24, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007336 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
7337 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07007338 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007339 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007340 }
7341 return arr;
7342}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007343
Joshua Habermanf41049a2022-01-21 14:41:25 -08007344UPB_INLINE void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007345 const upb_MiniTableField field = {1, UPB_SIZE(28, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007346 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007347}
7348UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007349 upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007350 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007351 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007352 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007353 return (google_protobuf_EnumValueDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007354 } else {
7355 if (size) *size = 0;
7356 return NULL;
7357 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007358}
Eric Salob7d54ac2022-12-29 11:59:42 -08007359UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_resize_value(google_protobuf_EnumDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007360 upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007361 return (google_protobuf_EnumValueDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
7362 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007363}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007364UPB_INLINE struct google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumDescriptorProto_add_value(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007365 upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007366 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7367 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007368 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007369 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08007370 return NULL;
7371 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007372 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 -08007373 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007374 UPB_PRIVATE(_upb_Array_Set)
7375 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007376 return sub;
7377}
7378UPB_INLINE void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007379 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007380 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007381}
7382UPB_INLINE struct google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007383 struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg);
7384 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007385 sub = (struct google_protobuf_EnumOptions*)_upb_Message_New(&google__protobuf__EnumOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007386 if (sub) google_protobuf_EnumDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007387 }
7388 return sub;
7389}
Eric Salob7d54ac2022-12-29 11:59:42 -08007390UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_mutable_reserved_range(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007391 upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007392 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007393 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007394 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007395 return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007396 } else {
7397 if (size) *size = 0;
7398 return NULL;
7399 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007400}
Eric Salob7d54ac2022-12-29 11:59:42 -08007401UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_resize_reserved_range(google_protobuf_EnumDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007402 upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007403 return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
7404 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007405}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007406UPB_INLINE struct google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_add_reserved_range(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007407 upb_MiniTableField field = {4, UPB_SIZE(20, 48), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007408 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7409 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007410 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007411 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08007412 return NULL;
7413 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007414 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 -08007415 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007416 UPB_PRIVATE(_upb_Array_Set)
7417 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007418 return sub;
7419}
Eric Salob7d54ac2022-12-29 11:59:42 -08007420UPB_INLINE upb_StringView* google_protobuf_EnumDescriptorProto_mutable_reserved_name(google_protobuf_EnumDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007421 upb_MiniTableField field = {5, UPB_SIZE(24, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007422 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007423 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007424 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007425 return (upb_StringView*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007426 } else {
7427 if (size) *size = 0;
7428 return NULL;
7429 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007430}
Eric Salob7d54ac2022-12-29 11:59:42 -08007431UPB_INLINE upb_StringView* google_protobuf_EnumDescriptorProto_resize_reserved_name(google_protobuf_EnumDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007432 upb_MiniTableField field = {5, UPB_SIZE(24, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007433 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
7434 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007435}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007436UPB_INLINE bool google_protobuf_EnumDescriptorProto_add_reserved_name(google_protobuf_EnumDescriptorProto* msg, upb_StringView val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007437 upb_MiniTableField field = {5, UPB_SIZE(24, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007438 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7439 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007440 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007441 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08007442 return false;
7443 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007444 UPB_PRIVATE(_upb_Array_Set)
7445 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -08007446 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007447}
7448
7449/* google.protobuf.EnumDescriptorProto.EnumReservedRange */
7450
Joshua Habermanf41049a2022-01-21 14:41:25 -08007451UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007452 return (google_protobuf_EnumDescriptorProto_EnumReservedRange*)_upb_Message_New(&google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007453}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007454UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char* buf, size_t size, upb_Arena* arena) {
7455 google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007456 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007457 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, NULL, 0, arena) !=
7458 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007459 return NULL;
7460 }
7461 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007462}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007463UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_EnumReservedRange_parse_ex(const char* buf, size_t size,
7464 const upb_ExtensionRegistry* extreg,
7465 int options, upb_Arena* arena) {
7466 google_protobuf_EnumDescriptorProto_EnumReservedRange* ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
7467 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007468 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, extreg, options,
7469 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007470 return NULL;
7471 }
7472 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007473}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007474UPB_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 -07007475 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007476 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007477 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007478}
7479UPB_INLINE char* google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize_ex(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg, int options,
7480 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007481 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007482 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007483 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007484}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007485UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_start(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007486 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007487 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007488}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007489UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007490 int32_t default_val = (int32_t)0;
7491 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007492 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007493 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7494 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007495 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007496}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007497UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007498 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007499 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007500}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007501UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_end(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007502 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007503 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007504}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007505UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007506 int32_t default_val = (int32_t)0;
7507 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007508 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007509 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7510 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007511 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007512}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007513UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007514 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007515 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007516}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007517
7518UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007519 const upb_MiniTableField field = {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007520 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007521}
7522UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007523 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007524 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007525}
Mike Kruskal232ecf42023-01-14 00:09:40 -08007526
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007527/* google.protobuf.EnumValueDescriptorProto */
7528
Joshua Habermanf41049a2022-01-21 14:41:25 -08007529UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007530 return (google_protobuf_EnumValueDescriptorProto*)_upb_Message_New(&google__protobuf__EnumValueDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007531}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007532UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7533 google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007534 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007535 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumValueDescriptorProto_msg_init, NULL, 0, arena) !=
7536 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007537 return NULL;
7538 }
7539 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007540}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007541UPB_INLINE google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumValueDescriptorProto_parse_ex(const char* buf, size_t size,
7542 const upb_ExtensionRegistry* extreg,
7543 int options, upb_Arena* arena) {
7544 google_protobuf_EnumValueDescriptorProto* ret = google_protobuf_EnumValueDescriptorProto_new(arena);
7545 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007546 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumValueDescriptorProto_msg_init, extreg, options,
7547 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007548 return NULL;
7549 }
7550 return ret;
7551}
7552UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize(const google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007553 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007554 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumValueDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007555 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007556}
7557UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize_ex(const google_protobuf_EnumValueDescriptorProto* msg, int options,
7558 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007559 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007560 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumValueDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007561 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007562}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007563UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_name(google_protobuf_EnumValueDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007564 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007565 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007566}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007567UPB_INLINE upb_StringView google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007568 upb_StringView default_val = upb_StringView_FromString("");
7569 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007570 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007571 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7572 &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_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007576 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007577 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007578}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007579UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_number(google_protobuf_EnumValueDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007580 const upb_MiniTableField field = {2, 12, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007581 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007582}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007583UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007584 int32_t default_val = (int32_t)0;
7585 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007586 const upb_MiniTableField field = {2, 12, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007587 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7588 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007589 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007590}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007591UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007592 const upb_MiniTableField field = {2, 12, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007593 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007594}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007595UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_options(google_protobuf_EnumValueDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007596 const upb_MiniTableField field = {3, UPB_SIZE(16, 32), 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007597 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007598}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007599UPB_INLINE const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007600 const google_protobuf_EnumValueOptions* default_val = NULL;
7601 const google_protobuf_EnumValueOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007602 const upb_MiniTableField field = {3, UPB_SIZE(16, 32), 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007603 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7604 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007605 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007606}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007607UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007608 const upb_MiniTableField field = {3, UPB_SIZE(16, 32), 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007609 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007610}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007611
Joshua Habermanf41049a2022-01-21 14:41:25 -08007612UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007613 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007614 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007615}
7616UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007617 const upb_MiniTableField field = {2, 12, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007618 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007619}
7620UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007621 const upb_MiniTableField field = {3, UPB_SIZE(16, 32), 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007622 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007623}
7624UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007625 struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg);
7626 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007627 sub = (struct google_protobuf_EnumValueOptions*)_upb_Message_New(&google__protobuf__EnumValueOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007628 if (sub) google_protobuf_EnumValueDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007629 }
7630 return sub;
7631}
7632
7633/* google.protobuf.ServiceDescriptorProto */
7634
Joshua Habermanf41049a2022-01-21 14:41:25 -08007635UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007636 return (google_protobuf_ServiceDescriptorProto*)_upb_Message_New(&google__protobuf__ServiceDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007637}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007638UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7639 google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007640 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007641 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ServiceDescriptorProto_msg_init, NULL, 0, arena) !=
7642 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007643 return NULL;
7644 }
7645 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007646}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007647UPB_INLINE google_protobuf_ServiceDescriptorProto* google_protobuf_ServiceDescriptorProto_parse_ex(const char* buf, size_t size,
7648 const upb_ExtensionRegistry* extreg,
7649 int options, upb_Arena* arena) {
7650 google_protobuf_ServiceDescriptorProto* ret = google_protobuf_ServiceDescriptorProto_new(arena);
7651 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007652 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ServiceDescriptorProto_msg_init, extreg, options,
7653 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007654 return NULL;
7655 }
7656 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007657}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007658UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize(const google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007659 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007660 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ServiceDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007661 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007662}
7663UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize_ex(const google_protobuf_ServiceDescriptorProto* msg, int options,
7664 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007665 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007666 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ServiceDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007667 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007668}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007669UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_name(google_protobuf_ServiceDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007670 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007671 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007672}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007673UPB_INLINE upb_StringView google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007674 upb_StringView default_val = upb_StringView_FromString("");
7675 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007676 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007677 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7678 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007679 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007680}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007681UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007682 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007683 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007684}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007685UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_method(google_protobuf_ServiceDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007686 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007687 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007688}
Eric Salob7d54ac2022-12-29 11:59:42 -08007689UPB_INLINE const google_protobuf_MethodDescriptorProto* const* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007690 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007691 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007692 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007693 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007694 return (const google_protobuf_MethodDescriptorProto* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007695 } else {
7696 if (size) *size = 0;
7697 return NULL;
7698 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007699}
Deanna Garciab26afb52023-04-25 13:37:18 -07007700UPB_INLINE const upb_Array* _google_protobuf_ServiceDescriptorProto_method_upb_array(const google_protobuf_ServiceDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007701 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007702 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07007703 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007704 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007705 }
7706 return arr;
7707}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007708UPB_INLINE upb_Array* _google_protobuf_ServiceDescriptorProto_method_mutable_upb_array(google_protobuf_ServiceDescriptorProto* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007709 const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007710 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
7711 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07007712 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007713 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07007714 }
7715 return arr;
7716}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007717UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_options(google_protobuf_ServiceDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007718 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007719 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007720}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007721UPB_INLINE const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007722 const google_protobuf_ServiceOptions* default_val = NULL;
7723 const google_protobuf_ServiceOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007724 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007725 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7726 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007727 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007728}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007729UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_options(const google_protobuf_ServiceDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007730 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007731 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007732}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007733
Joshua Habermanf41049a2022-01-21 14:41:25 -08007734UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007735 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007736 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007737}
7738UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007739 upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007740 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08007741 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007742 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007743 return (google_protobuf_MethodDescriptorProto**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08007744 } else {
7745 if (size) *size = 0;
7746 return NULL;
7747 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007748}
Eric Salob7d54ac2022-12-29 11:59:42 -08007749UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_resize_method(google_protobuf_ServiceDescriptorProto* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007750 upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007751 return (google_protobuf_MethodDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
7752 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007753}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007754UPB_INLINE struct google_protobuf_MethodDescriptorProto* google_protobuf_ServiceDescriptorProto_add_method(google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007755 upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007756 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
7757 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00007758 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007759 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08007760 return NULL;
7761 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007762 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 -08007763 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00007764 UPB_PRIVATE(_upb_Array_Set)
7765 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007766 return sub;
7767}
7768UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007769 const upb_MiniTableField field = {3, UPB_SIZE(16, 40), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007770 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007771}
7772UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007773 struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg);
7774 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007775 sub = (struct google_protobuf_ServiceOptions*)_upb_Message_New(&google__protobuf__ServiceOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007776 if (sub) google_protobuf_ServiceDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007777 }
7778 return sub;
7779}
7780
7781/* google.protobuf.MethodDescriptorProto */
7782
Joshua Habermanf41049a2022-01-21 14:41:25 -08007783UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007784 return (google_protobuf_MethodDescriptorProto*)_upb_Message_New(&google__protobuf__MethodDescriptorProto_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007785}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007786UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse(const char* buf, size_t size, upb_Arena* arena) {
7787 google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007788 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007789 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__MethodDescriptorProto_msg_init, NULL, 0, arena) !=
7790 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007791 return NULL;
7792 }
7793 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007794}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007795UPB_INLINE google_protobuf_MethodDescriptorProto* google_protobuf_MethodDescriptorProto_parse_ex(const char* buf, size_t size,
7796 const upb_ExtensionRegistry* extreg,
7797 int options, upb_Arena* arena) {
7798 google_protobuf_MethodDescriptorProto* ret = google_protobuf_MethodDescriptorProto_new(arena);
7799 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007800 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__MethodDescriptorProto_msg_init, extreg, options,
7801 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007802 return NULL;
7803 }
7804 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007805}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007806UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize(const google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007807 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007808 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__MethodDescriptorProto_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007809 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007810}
7811UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize_ex(const google_protobuf_MethodDescriptorProto* msg, int options,
7812 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007813 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007814 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__MethodDescriptorProto_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007815 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007816}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007817UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_name(google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007818 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007819 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007820}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007821UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007822 upb_StringView default_val = upb_StringView_FromString("");
7823 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007824 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007825 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7826 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007827 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007828}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007829UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007830 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007831 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007832}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007833UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_input_type(google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007834 const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007835 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007836}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007837UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007838 upb_StringView default_val = upb_StringView_FromString("");
7839 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007840 const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007841 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7842 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007843 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007844}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007845UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007846 const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007847 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007848}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007849UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_output_type(google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007850 const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007851 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007852}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007853UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007854 upb_StringView default_val = upb_StringView_FromString("");
7855 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007856 const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007857 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7858 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007859 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007860}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007861UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007862 const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007863 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007864}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007865UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_options(google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007866 const upb_MiniTableField field = {4, UPB_SIZE(12, 64), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007867 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007868}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007869UPB_INLINE const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007870 const google_protobuf_MethodOptions* default_val = NULL;
7871 const google_protobuf_MethodOptions* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007872 const upb_MiniTableField field = {4, UPB_SIZE(12, 64), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007873 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7874 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007875 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007876}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007877UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007878 const upb_MiniTableField field = {4, UPB_SIZE(12, 64), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007879 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007880}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007881UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_client_streaming(google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007882 const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007883 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007884}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007885UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007886 bool default_val = false;
7887 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007888 const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007889 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7890 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007891 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007892}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007893UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007894 const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007895 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007896}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007897UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_server_streaming(google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007898 const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007899 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007900}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007901UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007902 bool default_val = false;
7903 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007904 const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007905 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7906 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007907 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007908}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007909UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007910 const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007911 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -08007912}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007913
Joshua Habermanf41049a2022-01-21 14:41:25 -08007914UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007915 const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007916 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007917}
7918UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007919 const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007920 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007921}
7922UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007923 const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007924 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007925}
7926UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007927 const upb_MiniTableField field = {4, UPB_SIZE(12, 64), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007928 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007929}
7930UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena) {
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007931 struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg);
7932 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007933 sub = (struct google_protobuf_MethodOptions*)_upb_Message_New(&google__protobuf__MethodOptions_msg_init, arena);
Eric Salo8809a112022-11-21 13:01:06 -08007934 if (sub) google_protobuf_MethodDescriptorProto_set_options(msg, sub);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007935 }
7936 return sub;
7937}
7938UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007939 const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007940 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08007941}
7942UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007943 const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007944 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007945}
Mike Kruskal232ecf42023-01-14 00:09:40 -08007946
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007947/* google.protobuf.FileOptions */
7948
Joshua Habermanf41049a2022-01-21 14:41:25 -08007949UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00007950 return (google_protobuf_FileOptions*)_upb_Message_New(&google__protobuf__FileOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007951}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007952UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
7953 google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07007954 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007955 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FileOptions_msg_init, NULL, 0, arena) !=
7956 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07007957 return NULL;
7958 }
7959 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007960}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007961UPB_INLINE google_protobuf_FileOptions* google_protobuf_FileOptions_parse_ex(const char* buf, size_t size,
7962 const upb_ExtensionRegistry* extreg,
7963 int options, upb_Arena* arena) {
7964 google_protobuf_FileOptions* ret = google_protobuf_FileOptions_new(arena);
7965 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007966 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FileOptions_msg_init, extreg, options,
7967 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08007968 return NULL;
7969 }
7970 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08007971}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007972UPB_INLINE char* google_protobuf_FileOptions_serialize(const google_protobuf_FileOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007973 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007974 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FileOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007975 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007976}
7977UPB_INLINE char* google_protobuf_FileOptions_serialize_ex(const google_protobuf_FileOptions* msg, int options,
7978 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07007979 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007980 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FileOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007981 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007982}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007983UPB_INLINE void google_protobuf_FileOptions_clear_java_package(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007984 const upb_MiniTableField field = {1, UPB_SIZE(32, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00007985 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07007986}
Joshua Habermanf41049a2022-01-21 14:41:25 -08007987UPB_INLINE upb_StringView google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08007988 upb_StringView default_val = upb_StringView_FromString("");
7989 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007990 const upb_MiniTableField field = {1, UPB_SIZE(32, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00007991 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
7992 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08007993 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08007994}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007995UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00007996 const upb_MiniTableField field = {1, UPB_SIZE(32, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00007997 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07007998}
Mike Kruskal3bc50492022-12-01 13:34:12 -08007999UPB_INLINE void google_protobuf_FileOptions_clear_java_outer_classname(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008000 const upb_MiniTableField field = {8, 40, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008001 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008002}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008003UPB_INLINE upb_StringView google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008004 upb_StringView default_val = upb_StringView_FromString("");
8005 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008006 const upb_MiniTableField field = {8, 40, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008007 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8008 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008009 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008010}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008011UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008012 const upb_MiniTableField field = {8, 40, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008013 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008014}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008015UPB_INLINE void google_protobuf_FileOptions_clear_optimize_for(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008016 const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008017 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008018}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008019UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008020 int32_t default_val = 1;
8021 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008022 const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008023 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8024 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008025 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008026}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008027UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008028 const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008029 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008030}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008031UPB_INLINE void google_protobuf_FileOptions_clear_java_multiple_files(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008032 const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008033 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008034}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008035UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008036 bool default_val = false;
8037 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008038 const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008039 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8040 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008041 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008042}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008043UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008044 const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008045 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008046}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008047UPB_INLINE void google_protobuf_FileOptions_clear_go_package(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008048 const upb_MiniTableField field = {11, UPB_SIZE(48, 56), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008049 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008050}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008051UPB_INLINE upb_StringView google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008052 upb_StringView default_val = upb_StringView_FromString("");
8053 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008054 const upb_MiniTableField field = {11, UPB_SIZE(48, 56), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008055 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8056 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008057 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008058}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008059UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008060 const upb_MiniTableField field = {11, UPB_SIZE(48, 56), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008061 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008062}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008063UPB_INLINE void google_protobuf_FileOptions_clear_cc_generic_services(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008064 const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008065 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008066}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008067UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008068 bool default_val = false;
8069 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008070 const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008071 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8072 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008073 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008074}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008075UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008076 const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008077 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008078}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008079UPB_INLINE void google_protobuf_FileOptions_clear_java_generic_services(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008080 const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008081 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008082}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008083UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008084 bool default_val = false;
8085 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008086 const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008087 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8088 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008089 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008090}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008091UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008092 const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008093 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008094}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008095UPB_INLINE void google_protobuf_FileOptions_clear_py_generic_services(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008096 const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008097 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008098}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008099UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008100 bool default_val = false;
8101 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008102 const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008103 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8104 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008105 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008106}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008107UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008108 const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008109 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008110}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008111UPB_INLINE void google_protobuf_FileOptions_clear_java_generate_equals_and_hash(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008112 const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008113 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008114}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008115UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008116 bool default_val = false;
8117 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008118 const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008119 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8120 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008121 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008122}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008123UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008124 const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008125 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008126}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008127UPB_INLINE void google_protobuf_FileOptions_clear_deprecated(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008128 const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008129 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008130}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008131UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008132 bool default_val = false;
8133 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008134 const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008135 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8136 &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_FileOptions_has_deprecated(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008140 const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008141 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008142}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008143UPB_INLINE void google_protobuf_FileOptions_clear_java_string_check_utf8(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008144 const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008145 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008146}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008147UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008148 bool default_val = false;
8149 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008150 const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008151 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8152 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008153 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008154}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008155UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008156 const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008157 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008158}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008159UPB_INLINE void google_protobuf_FileOptions_clear_cc_enable_arenas(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008160 const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008161 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008162}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008163UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008164 bool default_val = true;
8165 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008166 const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008167 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8168 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008169 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008170}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008171UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008172 const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008173 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008174}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008175UPB_INLINE void google_protobuf_FileOptions_clear_objc_class_prefix(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008176 const upb_MiniTableField field = {36, UPB_SIZE(56, 72), 76, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008177 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008178}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008179UPB_INLINE upb_StringView google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008180 upb_StringView default_val = upb_StringView_FromString("");
8181 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008182 const upb_MiniTableField field = {36, UPB_SIZE(56, 72), 76, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008183 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8184 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008185 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008186}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008187UPB_INLINE bool google_protobuf_FileOptions_has_objc_class_prefix(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008188 const upb_MiniTableField field = {36, UPB_SIZE(56, 72), 76, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008189 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008190}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008191UPB_INLINE void google_protobuf_FileOptions_clear_csharp_namespace(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008192 const upb_MiniTableField field = {37, UPB_SIZE(64, 88), 77, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008193 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008194}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008195UPB_INLINE upb_StringView google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008196 upb_StringView default_val = upb_StringView_FromString("");
8197 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008198 const upb_MiniTableField field = {37, UPB_SIZE(64, 88), 77, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008199 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8200 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008201 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008202}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008203UPB_INLINE bool google_protobuf_FileOptions_has_csharp_namespace(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008204 const upb_MiniTableField field = {37, UPB_SIZE(64, 88), 77, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008205 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008206}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008207UPB_INLINE void google_protobuf_FileOptions_clear_swift_prefix(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008208 const upb_MiniTableField field = {39, UPB_SIZE(72, 104), 78, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008209 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008210}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008211UPB_INLINE upb_StringView google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008212 upb_StringView default_val = upb_StringView_FromString("");
8213 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008214 const upb_MiniTableField field = {39, UPB_SIZE(72, 104), 78, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008215 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8216 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008217 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008218}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008219UPB_INLINE bool google_protobuf_FileOptions_has_swift_prefix(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008220 const upb_MiniTableField field = {39, UPB_SIZE(72, 104), 78, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008221 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008222}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008223UPB_INLINE void google_protobuf_FileOptions_clear_php_class_prefix(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008224 const upb_MiniTableField field = {40, UPB_SIZE(80, 120), 79, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008225 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008226}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008227UPB_INLINE upb_StringView google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008228 upb_StringView default_val = upb_StringView_FromString("");
8229 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008230 const upb_MiniTableField field = {40, UPB_SIZE(80, 120), 79, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008231 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8232 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008233 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008234}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008235UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008236 const upb_MiniTableField field = {40, UPB_SIZE(80, 120), 79, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008237 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008238}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008239UPB_INLINE void google_protobuf_FileOptions_clear_php_namespace(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008240 const upb_MiniTableField field = {41, UPB_SIZE(88, 136), 80, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008241 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008242}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008243UPB_INLINE upb_StringView google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008244 upb_StringView default_val = upb_StringView_FromString("");
8245 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008246 const upb_MiniTableField field = {41, UPB_SIZE(88, 136), 80, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008247 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8248 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008249 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008250}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008251UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008252 const upb_MiniTableField field = {41, UPB_SIZE(88, 136), 80, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008253 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008254}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008255UPB_INLINE void google_protobuf_FileOptions_clear_php_metadata_namespace(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008256 const upb_MiniTableField field = {44, UPB_SIZE(96, 152), 81, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008257 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008258}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008259UPB_INLINE upb_StringView google_protobuf_FileOptions_php_metadata_namespace(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008260 upb_StringView default_val = upb_StringView_FromString("");
8261 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008262 const upb_MiniTableField field = {44, UPB_SIZE(96, 152), 81, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008263 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8264 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008265 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008266}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008267UPB_INLINE bool google_protobuf_FileOptions_has_php_metadata_namespace(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008268 const upb_MiniTableField field = {44, UPB_SIZE(96, 152), 81, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008269 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008270}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008271UPB_INLINE void google_protobuf_FileOptions_clear_ruby_package(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008272 const upb_MiniTableField field = {45, UPB_SIZE(104, 168), 82, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008273 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008274}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008275UPB_INLINE upb_StringView google_protobuf_FileOptions_ruby_package(const google_protobuf_FileOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008276 upb_StringView default_val = upb_StringView_FromString("");
8277 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008278 const upb_MiniTableField field = {45, UPB_SIZE(104, 168), 82, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008279 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8280 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008281 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008282}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008283UPB_INLINE bool google_protobuf_FileOptions_has_ruby_package(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008284 const upb_MiniTableField field = {45, UPB_SIZE(104, 168), 82, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008285 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008286}
8287UPB_INLINE void google_protobuf_FileOptions_clear_features(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008288 const upb_MiniTableField field = {50, UPB_SIZE(24, 184), 83, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008289 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008290}
8291UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FileOptions_features(const google_protobuf_FileOptions* msg) {
8292 const google_protobuf_FeatureSet* default_val = NULL;
8293 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008294 const upb_MiniTableField field = {50, UPB_SIZE(24, 184), 83, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008295 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8296 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008297 return ret;
8298}
8299UPB_INLINE bool google_protobuf_FileOptions_has_features(const google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008300 const upb_MiniTableField field = {50, UPB_SIZE(24, 184), 83, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008301 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008302}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008303UPB_INLINE void google_protobuf_FileOptions_clear_uninterpreted_option(google_protobuf_FileOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008304 const upb_MiniTableField field = {999, UPB_SIZE(28, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008305 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008306}
Eric Salob7d54ac2022-12-29 11:59:42 -08008307UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008308 const upb_MiniTableField field = {999, UPB_SIZE(28, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008309 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08008310 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008311 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008312 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08008313 } else {
8314 if (size) *size = 0;
8315 return NULL;
8316 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008317}
Deanna Garciab26afb52023-04-25 13:37:18 -07008318UPB_INLINE const upb_Array* _google_protobuf_FileOptions_uninterpreted_option_upb_array(const google_protobuf_FileOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008319 const upb_MiniTableField field = {999, UPB_SIZE(28, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008320 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07008321 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008322 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008323 }
8324 return arr;
8325}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008326UPB_INLINE upb_Array* _google_protobuf_FileOptions_uninterpreted_option_mutable_upb_array(google_protobuf_FileOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008327 const upb_MiniTableField field = {999, UPB_SIZE(28, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008328 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
8329 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07008330 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008331 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008332 }
8333 return arr;
8334}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008335
Joshua Habermanf41049a2022-01-21 14:41:25 -08008336UPB_INLINE void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008337 const upb_MiniTableField field = {1, UPB_SIZE(32, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008338 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008339}
8340UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008341 const upb_MiniTableField field = {8, 40, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008342 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008343}
8344UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008345 const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008346 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008347}
8348UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008349 const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008350 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008351}
8352UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008353 const upb_MiniTableField field = {11, UPB_SIZE(48, 56), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008354 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008355}
8356UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008357 const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008358 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008359}
8360UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008361 const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008362 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008363}
8364UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008365 const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008366 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008367}
8368UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008369 const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008370 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008371}
8372UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008373 const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008374 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008375}
8376UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008377 const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008378 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008379}
8380UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008381 const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008382 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008383}
8384UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008385 const upb_MiniTableField field = {36, UPB_SIZE(56, 72), 76, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008386 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008387}
8388UPB_INLINE void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008389 const upb_MiniTableField field = {37, UPB_SIZE(64, 88), 77, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008390 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008391}
8392UPB_INLINE void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008393 const upb_MiniTableField field = {39, UPB_SIZE(72, 104), 78, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008394 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008395}
8396UPB_INLINE void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008397 const upb_MiniTableField field = {40, UPB_SIZE(80, 120), 79, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008398 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008399}
8400UPB_INLINE void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008401 const upb_MiniTableField field = {41, UPB_SIZE(88, 136), 80, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008402 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008403}
8404UPB_INLINE void google_protobuf_FileOptions_set_php_metadata_namespace(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008405 const upb_MiniTableField field = {44, UPB_SIZE(96, 152), 81, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008406 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008407}
8408UPB_INLINE void google_protobuf_FileOptions_set_ruby_package(google_protobuf_FileOptions *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008409 const upb_MiniTableField field = {45, UPB_SIZE(104, 168), 82, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008410 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008411}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008412UPB_INLINE void google_protobuf_FileOptions_set_features(google_protobuf_FileOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008413 const upb_MiniTableField field = {50, UPB_SIZE(24, 184), 83, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008414 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008415}
8416UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FileOptions_mutable_features(google_protobuf_FileOptions* msg, upb_Arena* arena) {
8417 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FileOptions_features(msg);
8418 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008419 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008420 if (sub) google_protobuf_FileOptions_set_features(msg, sub);
8421 }
8422 return sub;
8423}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008424UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_mutable_uninterpreted_option(google_protobuf_FileOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008425 upb_MiniTableField field = {999, UPB_SIZE(28, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008426 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08008427 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008428 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008429 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08008430 } else {
8431 if (size) *size = 0;
8432 return NULL;
8433 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008434}
Eric Salob7d54ac2022-12-29 11:59:42 -08008435UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_resize_uninterpreted_option(google_protobuf_FileOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008436 upb_MiniTableField field = {999, UPB_SIZE(28, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008437 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
8438 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008439}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008440UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FileOptions_add_uninterpreted_option(google_protobuf_FileOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008441 upb_MiniTableField field = {999, UPB_SIZE(28, 192), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008442 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8443 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008444 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008445 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08008446 return NULL;
8447 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008448 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 -08008449 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008450 UPB_PRIVATE(_upb_Array_Set)
8451 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008452 return sub;
8453}
8454
8455/* google.protobuf.MessageOptions */
8456
Joshua Habermanf41049a2022-01-21 14:41:25 -08008457UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008458 return (google_protobuf_MessageOptions*)_upb_Message_New(&google__protobuf__MessageOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008459}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008460UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8461 google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008462 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008463 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__MessageOptions_msg_init, NULL, 0, arena) !=
8464 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008465 return NULL;
8466 }
8467 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008468}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008469UPB_INLINE google_protobuf_MessageOptions* google_protobuf_MessageOptions_parse_ex(const char* buf, size_t size,
8470 const upb_ExtensionRegistry* extreg,
8471 int options, upb_Arena* arena) {
8472 google_protobuf_MessageOptions* ret = google_protobuf_MessageOptions_new(arena);
8473 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008474 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__MessageOptions_msg_init, extreg, options,
8475 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08008476 return NULL;
8477 }
8478 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008479}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008480UPB_INLINE char* google_protobuf_MessageOptions_serialize(const google_protobuf_MessageOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008481 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008482 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__MessageOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008483 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008484}
8485UPB_INLINE char* google_protobuf_MessageOptions_serialize_ex(const google_protobuf_MessageOptions* msg, int options,
8486 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008487 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008488 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__MessageOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008489 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008490}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008491UPB_INLINE void google_protobuf_MessageOptions_clear_message_set_wire_format(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008492 const upb_MiniTableField field = {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008493 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008494}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008495UPB_INLINE bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008496 bool default_val = false;
8497 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008498 const upb_MiniTableField field = {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008499 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8500 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008501 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008502}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008503UPB_INLINE bool google_protobuf_MessageOptions_has_message_set_wire_format(const google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008504 const upb_MiniTableField field = {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008505 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008506}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008507UPB_INLINE void google_protobuf_MessageOptions_clear_no_standard_descriptor_accessor(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008508 const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008509 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008510}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008511UPB_INLINE bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008512 bool default_val = false;
8513 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008514 const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008515 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8516 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008517 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008518}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008519UPB_INLINE bool google_protobuf_MessageOptions_has_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008520 const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008521 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008522}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008523UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008524 const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008525 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008526}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008527UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008528 bool default_val = false;
8529 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008530 const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008531 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8532 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008533 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008534}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008535UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated(const google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008536 const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008537 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008538}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008539UPB_INLINE void google_protobuf_MessageOptions_clear_map_entry(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008540 const upb_MiniTableField field = {7, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008541 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008542}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008543UPB_INLINE bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008544 bool default_val = false;
8545 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008546 const upb_MiniTableField field = {7, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008547 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8548 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008549 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008550}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008551UPB_INLINE bool google_protobuf_MessageOptions_has_map_entry(const google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008552 const upb_MiniTableField field = {7, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008553 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008554}
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008555UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008556 const upb_MiniTableField field = {11, 13, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008557 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008558}
8559UPB_INLINE bool google_protobuf_MessageOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) {
8560 bool default_val = false;
8561 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008562 const upb_MiniTableField field = {11, 13, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008563 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8564 &default_val, &ret);
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008565 return ret;
8566}
8567UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008568 const upb_MiniTableField field = {11, 13, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008569 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08008570}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008571UPB_INLINE void google_protobuf_MessageOptions_clear_features(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008572 const upb_MiniTableField field = {12, 16, 69, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008573 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008574}
8575UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MessageOptions_features(const google_protobuf_MessageOptions* msg) {
8576 const google_protobuf_FeatureSet* default_val = NULL;
8577 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008578 const upb_MiniTableField field = {12, 16, 69, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008579 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8580 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008581 return ret;
8582}
8583UPB_INLINE bool google_protobuf_MessageOptions_has_features(const google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008584 const upb_MiniTableField field = {12, 16, 69, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008585 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008586}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008587UPB_INLINE void google_protobuf_MessageOptions_clear_uninterpreted_option(google_protobuf_MessageOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008588 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008589 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008590}
Eric Salob7d54ac2022-12-29 11:59:42 -08008591UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008592 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008593 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08008594 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008595 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008596 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08008597 } else {
8598 if (size) *size = 0;
8599 return NULL;
8600 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008601}
Deanna Garciab26afb52023-04-25 13:37:18 -07008602UPB_INLINE const upb_Array* _google_protobuf_MessageOptions_uninterpreted_option_upb_array(const google_protobuf_MessageOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008603 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008604 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07008605 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008606 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008607 }
8608 return arr;
8609}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008610UPB_INLINE upb_Array* _google_protobuf_MessageOptions_uninterpreted_option_mutable_upb_array(google_protobuf_MessageOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008611 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008612 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
8613 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07008614 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008615 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008616 }
8617 return arr;
8618}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008619
8620UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008621 const upb_MiniTableField field = {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008622 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008623}
8624UPB_INLINE void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008625 const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008626 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008627}
8628UPB_INLINE void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008629 const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008630 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008631}
8632UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008633 const upb_MiniTableField field = {7, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008634 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008635}
8636UPB_INLINE void google_protobuf_MessageOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008637 const upb_MiniTableField field = {11, 13, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008638 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008639}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008640UPB_INLINE void google_protobuf_MessageOptions_set_features(google_protobuf_MessageOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008641 const upb_MiniTableField field = {12, 16, 69, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008642 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008643}
8644UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MessageOptions_mutable_features(google_protobuf_MessageOptions* msg, upb_Arena* arena) {
8645 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MessageOptions_features(msg);
8646 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008647 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008648 if (sub) google_protobuf_MessageOptions_set_features(msg, sub);
8649 }
8650 return sub;
8651}
Mike Kruskal232ecf42023-01-14 00:09:40 -08008652UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_mutable_uninterpreted_option(google_protobuf_MessageOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008653 upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008654 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08008655 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008656 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008657 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08008658 } else {
8659 if (size) *size = 0;
8660 return NULL;
8661 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008662}
Eric Salob7d54ac2022-12-29 11:59:42 -08008663UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_resize_uninterpreted_option(google_protobuf_MessageOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008664 upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008665 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
8666 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008667}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008668UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MessageOptions_add_uninterpreted_option(google_protobuf_MessageOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008669 upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008670 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
8671 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008672 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008673 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08008674 return NULL;
8675 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008676 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 -08008677 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008678 UPB_PRIVATE(_upb_Array_Set)
8679 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008680 return sub;
8681}
8682
8683/* google.protobuf.FieldOptions */
8684
Joshua Habermanf41049a2022-01-21 14:41:25 -08008685UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00008686 return (google_protobuf_FieldOptions*)_upb_Message_New(&google__protobuf__FieldOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008687}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008688UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
8689 google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07008690 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008691 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldOptions_msg_init, NULL, 0, arena) !=
8692 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07008693 return NULL;
8694 }
8695 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008696}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008697UPB_INLINE google_protobuf_FieldOptions* google_protobuf_FieldOptions_parse_ex(const char* buf, size_t size,
8698 const upb_ExtensionRegistry* extreg,
8699 int options, upb_Arena* arena) {
8700 google_protobuf_FieldOptions* ret = google_protobuf_FieldOptions_new(arena);
8701 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008702 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldOptions_msg_init, extreg, options,
8703 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08008704 return NULL;
8705 }
8706 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008707}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008708UPB_INLINE char* google_protobuf_FieldOptions_serialize(const google_protobuf_FieldOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008709 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008710 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008711 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008712}
8713UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf_FieldOptions* msg, int options,
8714 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07008715 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008716 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008717 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008718}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008719UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008720 const upb_MiniTableField field = {1, 12, 64, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008721 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008722}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008723UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008724 int32_t default_val = 0;
8725 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008726 const upb_MiniTableField field = {1, 12, 64, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008727 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8728 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008729 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008730}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008731UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008732 const upb_MiniTableField field = {1, 12, 64, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008733 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008734}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008735UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008736 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008737 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008738}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008739UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008740 bool default_val = false;
8741 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008742 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008743 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8744 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008745 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008746}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008747UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008748 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008749 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008750}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008751UPB_INLINE void google_protobuf_FieldOptions_clear_deprecated(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008752 const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008753 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008754}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008755UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008756 bool default_val = false;
8757 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008758 const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008759 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8760 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008761 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008762}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008763UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008764 const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008765 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008766}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008767UPB_INLINE void google_protobuf_FieldOptions_clear_lazy(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008768 const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008769 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008770}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008771UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008772 bool default_val = false;
8773 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008774 const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008775 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8776 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008777 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008778}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008779UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008780 const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008781 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008782}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008783UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008784 const upb_MiniTableField field = {6, 20, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008785 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008786}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008787UPB_INLINE int32_t google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008788 int32_t default_val = 0;
8789 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008790 const upb_MiniTableField field = {6, 20, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008791 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8792 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008793 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008794}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008795UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008796 const upb_MiniTableField field = {6, 20, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008797 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008798}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008799UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008800 const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008801 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008802}
Joshua Habermanf41049a2022-01-21 14:41:25 -08008803UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008804 bool default_val = false;
8805 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008806 const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008807 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8808 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008809 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08008810}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008811UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008812 const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008813 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008814}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008815UPB_INLINE void google_protobuf_FieldOptions_clear_unverified_lazy(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008816 const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008817 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008818}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008819UPB_INLINE bool google_protobuf_FieldOptions_unverified_lazy(const google_protobuf_FieldOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08008820 bool default_val = false;
8821 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008822 const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008823 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8824 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08008825 return ret;
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008826}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008827UPB_INLINE bool google_protobuf_FieldOptions_has_unverified_lazy(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008828 const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008829 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008830}
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008831UPB_INLINE void google_protobuf_FieldOptions_clear_debug_redact(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008832 const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008833 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008834}
8835UPB_INLINE bool google_protobuf_FieldOptions_debug_redact(const google_protobuf_FieldOptions* msg) {
8836 bool default_val = false;
8837 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008838 const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008839 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8840 &default_val, &ret);
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008841 return ret;
8842}
8843UPB_INLINE bool google_protobuf_FieldOptions_has_debug_redact(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008844 const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008845 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot9238c482022-12-16 20:01:55 -08008846}
Adam Cozzette5a568372023-01-24 20:35:59 -08008847UPB_INLINE void google_protobuf_FieldOptions_clear_retention(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008848 const upb_MiniTableField field = {17, 28, 72, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008849 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Adam Cozzette5a568372023-01-24 20:35:59 -08008850}
8851UPB_INLINE int32_t google_protobuf_FieldOptions_retention(const google_protobuf_FieldOptions* msg) {
8852 int32_t default_val = 0;
8853 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008854 const upb_MiniTableField field = {17, 28, 72, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008855 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8856 &default_val, &ret);
Adam Cozzette5a568372023-01-24 20:35:59 -08008857 return ret;
8858}
8859UPB_INLINE bool google_protobuf_FieldOptions_has_retention(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008860 const upb_MiniTableField field = {17, 28, 72, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008861 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Adam Cozzette5a568372023-01-24 20:35:59 -08008862}
Mike Kruskal0c121392023-03-18 00:05:41 -07008863UPB_INLINE void google_protobuf_FieldOptions_clear_targets(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008864 const upb_MiniTableField field = {19, 32, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008865 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Adam Cozzette5a568372023-01-24 20:35:59 -08008866}
Mike Kruskal0c121392023-03-18 00:05:41 -07008867UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008868 const upb_MiniTableField field = {19, 32, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008869 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Mike Kruskal0c121392023-03-18 00:05:41 -07008870 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008871 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008872 return (int32_t const*)upb_Array_DataPtr(arr);
Mike Kruskal0c121392023-03-18 00:05:41 -07008873 } else {
8874 if (size) *size = 0;
8875 return NULL;
8876 }
Adam Cozzette5a568372023-01-24 20:35:59 -08008877}
Deanna Garciab26afb52023-04-25 13:37:18 -07008878UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_targets_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008879 const upb_MiniTableField field = {19, 32, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008880 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07008881 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008882 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008883 }
8884 return arr;
8885}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008886UPB_INLINE upb_Array* _google_protobuf_FieldOptions_targets_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008887 const upb_MiniTableField field = {19, 32, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008888 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
8889 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07008890 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008891 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008892 }
8893 return arr;
8894}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008895UPB_INLINE void google_protobuf_FieldOptions_clear_edition_defaults(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008896 const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008897 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008898}
8899UPB_INLINE const google_protobuf_FieldOptions_EditionDefault* const* google_protobuf_FieldOptions_edition_defaults(const google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008900 const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008901 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008902 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008903 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008904 return (const google_protobuf_FieldOptions_EditionDefault* const*)upb_Array_DataPtr(arr);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008905 } else {
8906 if (size) *size = 0;
8907 return NULL;
8908 }
8909}
8910UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_edition_defaults_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008911 const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008912 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008913 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008914 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008915 }
8916 return arr;
8917}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008918UPB_INLINE upb_Array* _google_protobuf_FieldOptions_edition_defaults_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008919 const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008920 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
8921 &field, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008922 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008923 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008924 }
8925 return arr;
8926}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008927UPB_INLINE void google_protobuf_FieldOptions_clear_features(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008928 const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008929 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008930}
8931UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FieldOptions_features(const google_protobuf_FieldOptions* msg) {
8932 const google_protobuf_FeatureSet* default_val = NULL;
8933 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008934 const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008935 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
8936 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008937 return ret;
8938}
8939UPB_INLINE bool google_protobuf_FieldOptions_has_features(const google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008940 const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00008941 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07008942}
Mike Kruskal3bc50492022-12-01 13:34:12 -08008943UPB_INLINE void google_protobuf_FieldOptions_clear_uninterpreted_option(google_protobuf_FieldOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008944 const upb_MiniTableField field = {999, UPB_SIZE(44, 56), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00008945 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07008946}
Eric Salob7d54ac2022-12-29 11:59:42 -08008947UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008948 const upb_MiniTableField field = {999, UPB_SIZE(44, 56), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008949 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08008950 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008951 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00008952 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08008953 } else {
8954 if (size) *size = 0;
8955 return NULL;
8956 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07008957}
Deanna Garciab26afb52023-04-25 13:37:18 -07008958UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008959 const upb_MiniTableField field = {999, UPB_SIZE(44, 56), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008960 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07008961 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008962 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008963 }
8964 return arr;
8965}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008966UPB_INLINE upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008967 const upb_MiniTableField field = {999, UPB_SIZE(44, 56), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008968 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
8969 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07008970 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00008971 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07008972 }
8973 return arr;
8974}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08008975
8976UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008977 const upb_MiniTableField field = {1, 12, 64, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008978 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008979}
8980UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008981 const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008982 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008983}
8984UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008985 const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008986 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008987}
8988UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008989 const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008990 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008991}
8992UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008993 const upb_MiniTableField field = {6, 20, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008994 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008995}
8996UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00008997 const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00008998 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08008999}
9000UPB_INLINE void google_protobuf_FieldOptions_set_unverified_lazy(google_protobuf_FieldOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009001 const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009002 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009003}
9004UPB_INLINE void google_protobuf_FieldOptions_set_debug_redact(google_protobuf_FieldOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009005 const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009006 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009007}
Adam Cozzette5a568372023-01-24 20:35:59 -08009008UPB_INLINE void google_protobuf_FieldOptions_set_retention(google_protobuf_FieldOptions *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009009 const upb_MiniTableField field = {17, 28, 72, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009010 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Adam Cozzette5a568372023-01-24 20:35:59 -08009011}
Mike Kruskal0c121392023-03-18 00:05:41 -07009012UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009013 upb_MiniTableField field = {19, 32, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009014 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Mike Kruskal0c121392023-03-18 00:05:41 -07009015 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009016 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009017 return (int32_t*)upb_Array_MutableDataPtr(arr);
Mike Kruskal0c121392023-03-18 00:05:41 -07009018 } else {
9019 if (size) *size = 0;
9020 return NULL;
9021 }
9022}
9023UPB_INLINE int32_t* google_protobuf_FieldOptions_resize_targets(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009024 upb_MiniTableField field = {19, 32, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009025 return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9026 &field, size, arena);
Mike Kruskal0c121392023-03-18 00:05:41 -07009027}
9028UPB_INLINE bool google_protobuf_FieldOptions_add_targets(google_protobuf_FieldOptions* msg, int32_t val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009029 upb_MiniTableField field = {19, 32, 0, 6, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009030 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9031 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009032 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009033 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Mike Kruskal0c121392023-03-18 00:05:41 -07009034 return false;
9035 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009036 UPB_PRIVATE(_upb_Array_Set)
9037 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Mike Kruskal0c121392023-03-18 00:05:41 -07009038 return true;
Adam Cozzette5a568372023-01-24 20:35:59 -08009039}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009040UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_mutable_edition_defaults(google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009041 upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009042 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009043 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009044 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009045 return (google_protobuf_FieldOptions_EditionDefault**)upb_Array_MutableDataPtr(arr);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009046 } else {
9047 if (size) *size = 0;
9048 return NULL;
9049 }
9050}
9051UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_resize_edition_defaults(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009052 upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009053 return (google_protobuf_FieldOptions_EditionDefault**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9054 &field, size, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009055}
9056UPB_INLINE struct google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_add_edition_defaults(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009057 upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009058 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9059 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009060 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009061 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009062 return NULL;
9063 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009064 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 -07009065 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009066 UPB_PRIVATE(_upb_Array_Set)
9067 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009068 return sub;
9069}
9070UPB_INLINE void google_protobuf_FieldOptions_set_features(google_protobuf_FieldOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009071 const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009072 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009073}
9074UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FieldOptions_mutable_features(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
9075 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FieldOptions_features(msg);
9076 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009077 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009078 if (sub) google_protobuf_FieldOptions_set_features(msg, sub);
9079 }
9080 return sub;
9081}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009082UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009083 upb_MiniTableField field = {999, UPB_SIZE(44, 56), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009084 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009085 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009086 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009087 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009088 } else {
9089 if (size) *size = 0;
9090 return NULL;
9091 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009092}
Eric Salob7d54ac2022-12-29 11:59:42 -08009093UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009094 upb_MiniTableField field = {999, UPB_SIZE(44, 56), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009095 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9096 &field, size, arena);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009097}
9098UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009099 upb_MiniTableField field = {999, UPB_SIZE(44, 56), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009100 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9101 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009102 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009103 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08009104 return NULL;
9105 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009106 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 -08009107 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009108 UPB_PRIVATE(_upb_Array_Set)
9109 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009110 return sub;
9111}
9112
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009113/* google.protobuf.FieldOptions.EditionDefault */
9114
9115UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009116 return (google_protobuf_FieldOptions_EditionDefault*)_upb_Message_New(&google__protobuf__FieldOptions__EditionDefault_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009117}
9118UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) {
9119 google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena);
9120 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009121 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldOptions__EditionDefault_msg_init, NULL, 0, arena) !=
9122 kUpb_DecodeStatus_Ok) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009123 return NULL;
9124 }
9125 return ret;
9126}
9127UPB_INLINE google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_EditionDefault_parse_ex(const char* buf, size_t size,
9128 const upb_ExtensionRegistry* extreg,
9129 int options, upb_Arena* arena) {
9130 google_protobuf_FieldOptions_EditionDefault* ret = google_protobuf_FieldOptions_EditionDefault_new(arena);
9131 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009132 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FieldOptions__EditionDefault_msg_init, extreg, options,
9133 arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009134 return NULL;
9135 }
9136 return ret;
9137}
9138UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize(const google_protobuf_FieldOptions_EditionDefault* msg, upb_Arena* arena, size_t* len) {
9139 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009140 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldOptions__EditionDefault_msg_init, 0, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009141 return ptr;
9142}
9143UPB_INLINE char* google_protobuf_FieldOptions_EditionDefault_serialize_ex(const google_protobuf_FieldOptions_EditionDefault* msg, int options,
9144 upb_Arena* arena, size_t* len) {
9145 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009146 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FieldOptions__EditionDefault_msg_init, options, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009147 return ptr;
9148}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009149UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_value(google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009150 const upb_MiniTableField field = {2, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009151 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009152}
9153UPB_INLINE upb_StringView google_protobuf_FieldOptions_EditionDefault_value(const google_protobuf_FieldOptions_EditionDefault* msg) {
9154 upb_StringView default_val = upb_StringView_FromString("");
9155 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009156 const upb_MiniTableField field = {2, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009157 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9158 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009159 return ret;
9160}
9161UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_value(const google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009162 const upb_MiniTableField field = {2, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009163 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009164}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009165UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_clear_edition(google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009166 const upb_MiniTableField field = {3, 12, 65, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009167 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009168}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009169UPB_INLINE int32_t google_protobuf_FieldOptions_EditionDefault_edition(const google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009170 int32_t default_val = 0;
9171 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009172 const upb_MiniTableField field = {3, 12, 65, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009173 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9174 &default_val, &ret);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009175 return ret;
9176}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009177UPB_INLINE bool google_protobuf_FieldOptions_EditionDefault_has_edition(const google_protobuf_FieldOptions_EditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009178 const upb_MiniTableField field = {3, 12, 65, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009179 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009180}
9181
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009182UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_value(google_protobuf_FieldOptions_EditionDefault *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009183 const upb_MiniTableField field = {2, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009184 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +00009185}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +00009186UPB_INLINE void google_protobuf_FieldOptions_EditionDefault_set_edition(google_protobuf_FieldOptions_EditionDefault *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009187 const upb_MiniTableField field = {3, 12, 65, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009188 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009189}
9190
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009191/* google.protobuf.OneofOptions */
9192
Joshua Habermanf41049a2022-01-21 14:41:25 -08009193UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009194 return (google_protobuf_OneofOptions*)_upb_Message_New(&google__protobuf__OneofOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009195}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009196UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
9197 google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009198 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009199 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__OneofOptions_msg_init, NULL, 0, arena) !=
9200 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009201 return NULL;
9202 }
9203 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009204}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009205UPB_INLINE google_protobuf_OneofOptions* google_protobuf_OneofOptions_parse_ex(const char* buf, size_t size,
9206 const upb_ExtensionRegistry* extreg,
9207 int options, upb_Arena* arena) {
9208 google_protobuf_OneofOptions* ret = google_protobuf_OneofOptions_new(arena);
9209 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009210 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__OneofOptions_msg_init, extreg, options,
9211 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08009212 return NULL;
9213 }
9214 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009215}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009216UPB_INLINE char* google_protobuf_OneofOptions_serialize(const google_protobuf_OneofOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009217 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009218 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__OneofOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009219 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009220}
9221UPB_INLINE char* google_protobuf_OneofOptions_serialize_ex(const google_protobuf_OneofOptions* msg, int options,
9222 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009223 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009224 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__OneofOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009225 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009226}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009227UPB_INLINE void google_protobuf_OneofOptions_clear_features(google_protobuf_OneofOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009228 const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009229 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009230}
9231UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_OneofOptions_features(const google_protobuf_OneofOptions* msg) {
9232 const google_protobuf_FeatureSet* default_val = NULL;
9233 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009234 const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009235 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9236 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009237 return ret;
9238}
9239UPB_INLINE bool google_protobuf_OneofOptions_has_features(const google_protobuf_OneofOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009240 const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009241 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009242}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009243UPB_INLINE void google_protobuf_OneofOptions_clear_uninterpreted_option(google_protobuf_OneofOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009244 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009245 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009246}
Eric Salob7d54ac2022-12-29 11:59:42 -08009247UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009248 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009249 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009250 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009251 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009252 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009253 } else {
9254 if (size) *size = 0;
9255 return NULL;
9256 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009257}
Deanna Garciab26afb52023-04-25 13:37:18 -07009258UPB_INLINE const upb_Array* _google_protobuf_OneofOptions_uninterpreted_option_upb_array(const google_protobuf_OneofOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009259 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009260 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07009261 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009262 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009263 }
9264 return arr;
9265}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009266UPB_INLINE upb_Array* _google_protobuf_OneofOptions_uninterpreted_option_mutable_upb_array(google_protobuf_OneofOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009267 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009268 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
9269 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07009270 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009271 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009272 }
9273 return arr;
9274}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009275
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009276UPB_INLINE void google_protobuf_OneofOptions_set_features(google_protobuf_OneofOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009277 const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009278 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009279}
9280UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_OneofOptions_mutable_features(google_protobuf_OneofOptions* msg, upb_Arena* arena) {
9281 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_OneofOptions_features(msg);
9282 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009283 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009284 if (sub) google_protobuf_OneofOptions_set_features(msg, sub);
9285 }
9286 return sub;
9287}
Eric Salob7d54ac2022-12-29 11:59:42 -08009288UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_mutable_uninterpreted_option(google_protobuf_OneofOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009289 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009290 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009291 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009292 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009293 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009294 } else {
9295 if (size) *size = 0;
9296 return NULL;
9297 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009298}
Eric Salob7d54ac2022-12-29 11:59:42 -08009299UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_resize_uninterpreted_option(google_protobuf_OneofOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009300 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009301 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9302 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009303}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009304UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_OneofOptions_add_uninterpreted_option(google_protobuf_OneofOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009305 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009306 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9307 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009308 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009309 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08009310 return NULL;
9311 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009312 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 -08009313 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009314 UPB_PRIVATE(_upb_Array_Set)
9315 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009316 return sub;
9317}
9318
9319/* google.protobuf.EnumOptions */
9320
Joshua Habermanf41049a2022-01-21 14:41:25 -08009321UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009322 return (google_protobuf_EnumOptions*)_upb_Message_New(&google__protobuf__EnumOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009323}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009324UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
9325 google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009326 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009327 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumOptions_msg_init, NULL, 0, arena) !=
9328 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009329 return NULL;
9330 }
9331 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009332}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009333UPB_INLINE google_protobuf_EnumOptions* google_protobuf_EnumOptions_parse_ex(const char* buf, size_t size,
9334 const upb_ExtensionRegistry* extreg,
9335 int options, upb_Arena* arena) {
9336 google_protobuf_EnumOptions* ret = google_protobuf_EnumOptions_new(arena);
9337 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009338 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumOptions_msg_init, extreg, options,
9339 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08009340 return NULL;
9341 }
9342 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009343}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009344UPB_INLINE char* google_protobuf_EnumOptions_serialize(const google_protobuf_EnumOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009345 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009346 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009347 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009348}
9349UPB_INLINE char* google_protobuf_EnumOptions_serialize_ex(const google_protobuf_EnumOptions* msg, int options,
9350 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009351 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009352 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009353 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009354}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009355UPB_INLINE void google_protobuf_EnumOptions_clear_allow_alias(google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009356 const upb_MiniTableField field = {2, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009357 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009358}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009359UPB_INLINE bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009360 bool default_val = false;
9361 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009362 const upb_MiniTableField field = {2, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009363 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9364 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009365 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009366}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009367UPB_INLINE bool google_protobuf_EnumOptions_has_allow_alias(const google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009368 const upb_MiniTableField field = {2, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009369 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009370}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009371UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated(google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009372 const upb_MiniTableField field = {3, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009373 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009374}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009375UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009376 bool default_val = false;
9377 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009378 const upb_MiniTableField field = {3, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009379 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9380 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009381 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009382}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009383UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated(const google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009384 const upb_MiniTableField field = {3, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009385 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009386}
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08009387UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009388 const upb_MiniTableField field = {6, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009389 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08009390}
9391UPB_INLINE bool google_protobuf_EnumOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) {
9392 bool default_val = false;
9393 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009394 const upb_MiniTableField field = {6, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009395 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9396 &default_val, &ret);
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08009397 return ret;
9398}
9399UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009400 const upb_MiniTableField field = {6, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009401 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal6b87d6f2022-12-14 10:36:53 -08009402}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009403UPB_INLINE void google_protobuf_EnumOptions_clear_features(google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009404 const upb_MiniTableField field = {7, UPB_SIZE(12, 16), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009405 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009406}
9407UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumOptions_features(const google_protobuf_EnumOptions* msg) {
9408 const google_protobuf_FeatureSet* default_val = NULL;
9409 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009410 const upb_MiniTableField field = {7, UPB_SIZE(12, 16), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009411 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9412 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009413 return ret;
9414}
9415UPB_INLINE bool google_protobuf_EnumOptions_has_features(const google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009416 const upb_MiniTableField field = {7, UPB_SIZE(12, 16), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009417 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009418}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009419UPB_INLINE void google_protobuf_EnumOptions_clear_uninterpreted_option(google_protobuf_EnumOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009420 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009421 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009422}
Eric Salob7d54ac2022-12-29 11:59:42 -08009423UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009424 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009425 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009426 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009427 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009428 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009429 } else {
9430 if (size) *size = 0;
9431 return NULL;
9432 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009433}
Deanna Garciab26afb52023-04-25 13:37:18 -07009434UPB_INLINE const upb_Array* _google_protobuf_EnumOptions_uninterpreted_option_upb_array(const google_protobuf_EnumOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009435 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009436 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07009437 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009438 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009439 }
9440 return arr;
9441}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009442UPB_INLINE upb_Array* _google_protobuf_EnumOptions_uninterpreted_option_mutable_upb_array(google_protobuf_EnumOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009443 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009444 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
9445 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07009446 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009447 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009448 }
9449 return arr;
9450}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009451
9452UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009453 const upb_MiniTableField field = {2, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009454 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009455}
9456UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009457 const upb_MiniTableField field = {3, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009458 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009459}
9460UPB_INLINE void google_protobuf_EnumOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009461 const upb_MiniTableField field = {6, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009462 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009463}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009464UPB_INLINE void google_protobuf_EnumOptions_set_features(google_protobuf_EnumOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009465 const upb_MiniTableField field = {7, UPB_SIZE(12, 16), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009466 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009467}
9468UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumOptions_mutable_features(google_protobuf_EnumOptions* msg, upb_Arena* arena) {
9469 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumOptions_features(msg);
9470 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009471 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009472 if (sub) google_protobuf_EnumOptions_set_features(msg, sub);
9473 }
9474 return sub;
9475}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009476UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_mutable_uninterpreted_option(google_protobuf_EnumOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009477 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009478 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009479 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009480 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009481 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009482 } else {
9483 if (size) *size = 0;
9484 return NULL;
9485 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009486}
Eric Salob7d54ac2022-12-29 11:59:42 -08009487UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_resize_uninterpreted_option(google_protobuf_EnumOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009488 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009489 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9490 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009491}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009492UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumOptions_add_uninterpreted_option(google_protobuf_EnumOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009493 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009494 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9495 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009496 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009497 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08009498 return NULL;
9499 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009500 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 -08009501 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009502 UPB_PRIVATE(_upb_Array_Set)
9503 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009504 return sub;
9505}
9506
9507/* google.protobuf.EnumValueOptions */
9508
Joshua Habermanf41049a2022-01-21 14:41:25 -08009509UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009510 return (google_protobuf_EnumValueOptions*)_upb_Message_New(&google__protobuf__EnumValueOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009511}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009512UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
9513 google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009514 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009515 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumValueOptions_msg_init, NULL, 0, arena) !=
9516 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009517 return NULL;
9518 }
9519 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009520}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009521UPB_INLINE google_protobuf_EnumValueOptions* google_protobuf_EnumValueOptions_parse_ex(const char* buf, size_t size,
9522 const upb_ExtensionRegistry* extreg,
9523 int options, upb_Arena* arena) {
9524 google_protobuf_EnumValueOptions* ret = google_protobuf_EnumValueOptions_new(arena);
9525 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009526 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__EnumValueOptions_msg_init, extreg, options,
9527 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08009528 return NULL;
9529 }
9530 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009531}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009532UPB_INLINE char* google_protobuf_EnumValueOptions_serialize(const google_protobuf_EnumValueOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009533 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009534 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumValueOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009535 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009536}
9537UPB_INLINE char* google_protobuf_EnumValueOptions_serialize_ex(const google_protobuf_EnumValueOptions* msg, int options,
9538 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009539 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009540 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__EnumValueOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009541 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009542}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009543UPB_INLINE void google_protobuf_EnumValueOptions_clear_deprecated(google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009544 const upb_MiniTableField field = {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009545 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009546}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009547UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009548 bool default_val = false;
9549 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009550 const upb_MiniTableField field = {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009551 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9552 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009553 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009554}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009555UPB_INLINE bool google_protobuf_EnumValueOptions_has_deprecated(const google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009556 const upb_MiniTableField field = {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009557 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009558}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009559UPB_INLINE void google_protobuf_EnumValueOptions_clear_features(google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009560 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009561 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009562}
9563UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_features(const google_protobuf_EnumValueOptions* msg) {
9564 const google_protobuf_FeatureSet* default_val = NULL;
9565 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009566 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009567 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9568 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009569 return ret;
9570}
9571UPB_INLINE bool google_protobuf_EnumValueOptions_has_features(const google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009572 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009573 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009574}
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009575UPB_INLINE void google_protobuf_EnumValueOptions_clear_debug_redact(google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009576 const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009577 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009578}
9579UPB_INLINE bool google_protobuf_EnumValueOptions_debug_redact(const google_protobuf_EnumValueOptions* msg) {
9580 bool default_val = false;
9581 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009582 const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009583 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9584 &default_val, &ret);
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009585 return ret;
9586}
9587UPB_INLINE bool google_protobuf_EnumValueOptions_has_debug_redact(const google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009588 const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009589 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009590}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009591UPB_INLINE void google_protobuf_EnumValueOptions_clear_uninterpreted_option(google_protobuf_EnumValueOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009592 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009593 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009594}
Eric Salob7d54ac2022-12-29 11:59:42 -08009595UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009596 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009597 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009598 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009599 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009600 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009601 } else {
9602 if (size) *size = 0;
9603 return NULL;
9604 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009605}
Deanna Garciab26afb52023-04-25 13:37:18 -07009606UPB_INLINE const upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_upb_array(const google_protobuf_EnumValueOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009607 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009608 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07009609 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009610 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009611 }
9612 return arr;
9613}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009614UPB_INLINE upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_mutable_upb_array(google_protobuf_EnumValueOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009615 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009616 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
9617 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07009618 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009619 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009620 }
9621 return arr;
9622}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009623
9624UPB_INLINE void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009625 const upb_MiniTableField field = {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009626 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009627}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009628UPB_INLINE void google_protobuf_EnumValueOptions_set_features(google_protobuf_EnumValueOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009629 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009630 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009631}
9632UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_mutable_features(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) {
9633 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_EnumValueOptions_features(msg);
9634 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009635 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009636 if (sub) google_protobuf_EnumValueOptions_set_features(msg, sub);
9637 }
9638 return sub;
9639}
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009640UPB_INLINE void google_protobuf_EnumValueOptions_set_debug_redact(google_protobuf_EnumValueOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009641 const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009642 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal12e0f1d2023-05-31 15:40:54 -07009643}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009644UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009645 upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009646 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009647 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009648 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009649 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009650 } else {
9651 if (size) *size = 0;
9652 return NULL;
9653 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009654}
Eric Salob7d54ac2022-12-29 11:59:42 -08009655UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_resize_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009656 upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009657 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9658 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009659}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009660UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValueOptions_add_uninterpreted_option(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009661 upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009662 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9663 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009664 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009665 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08009666 return NULL;
9667 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009668 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 -08009669 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009670 UPB_PRIVATE(_upb_Array_Set)
9671 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009672 return sub;
9673}
9674
9675/* google.protobuf.ServiceOptions */
9676
Joshua Habermanf41049a2022-01-21 14:41:25 -08009677UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009678 return (google_protobuf_ServiceOptions*)_upb_Message_New(&google__protobuf__ServiceOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009679}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009680UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
9681 google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009682 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009683 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ServiceOptions_msg_init, NULL, 0, arena) !=
9684 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009685 return NULL;
9686 }
9687 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009688}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009689UPB_INLINE google_protobuf_ServiceOptions* google_protobuf_ServiceOptions_parse_ex(const char* buf, size_t size,
9690 const upb_ExtensionRegistry* extreg,
9691 int options, upb_Arena* arena) {
9692 google_protobuf_ServiceOptions* ret = google_protobuf_ServiceOptions_new(arena);
9693 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009694 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__ServiceOptions_msg_init, extreg, options,
9695 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08009696 return NULL;
9697 }
9698 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009699}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009700UPB_INLINE char* google_protobuf_ServiceOptions_serialize(const google_protobuf_ServiceOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009701 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009702 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ServiceOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009703 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009704}
9705UPB_INLINE char* google_protobuf_ServiceOptions_serialize_ex(const google_protobuf_ServiceOptions* msg, int options,
9706 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009707 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009708 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__ServiceOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009709 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009710}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009711UPB_INLINE void google_protobuf_ServiceOptions_clear_deprecated(google_protobuf_ServiceOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009712 const upb_MiniTableField field = {33, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009713 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009714}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009715UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009716 bool default_val = false;
9717 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009718 const upb_MiniTableField field = {33, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009719 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9720 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009721 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009722}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009723UPB_INLINE bool google_protobuf_ServiceOptions_has_deprecated(const google_protobuf_ServiceOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009724 const upb_MiniTableField field = {33, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009725 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009726}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009727UPB_INLINE void google_protobuf_ServiceOptions_clear_features(google_protobuf_ServiceOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009728 const upb_MiniTableField field = {34, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009729 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009730}
9731UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_ServiceOptions_features(const google_protobuf_ServiceOptions* msg) {
9732 const google_protobuf_FeatureSet* default_val = NULL;
9733 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009734 const upb_MiniTableField field = {34, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009735 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9736 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009737 return ret;
9738}
9739UPB_INLINE bool google_protobuf_ServiceOptions_has_features(const google_protobuf_ServiceOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009740 const upb_MiniTableField field = {34, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009741 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009742}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009743UPB_INLINE void google_protobuf_ServiceOptions_clear_uninterpreted_option(google_protobuf_ServiceOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009744 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009745 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009746}
Eric Salob7d54ac2022-12-29 11:59:42 -08009747UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009748 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009749 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009750 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009751 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009752 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009753 } else {
9754 if (size) *size = 0;
9755 return NULL;
9756 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009757}
Deanna Garciab26afb52023-04-25 13:37:18 -07009758UPB_INLINE const upb_Array* _google_protobuf_ServiceOptions_uninterpreted_option_upb_array(const google_protobuf_ServiceOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009759 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009760 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07009761 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009762 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009763 }
9764 return arr;
9765}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009766UPB_INLINE upb_Array* _google_protobuf_ServiceOptions_uninterpreted_option_mutable_upb_array(google_protobuf_ServiceOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009767 const upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009768 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
9769 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07009770 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009771 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009772 }
9773 return arr;
9774}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009775
9776UPB_INLINE void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009777 const upb_MiniTableField field = {33, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009778 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009779}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009780UPB_INLINE void google_protobuf_ServiceOptions_set_features(google_protobuf_ServiceOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009781 const upb_MiniTableField field = {34, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009782 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009783}
9784UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_ServiceOptions_mutable_features(google_protobuf_ServiceOptions* msg, upb_Arena* arena) {
9785 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_ServiceOptions_features(msg);
9786 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009787 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009788 if (sub) google_protobuf_ServiceOptions_set_features(msg, sub);
9789 }
9790 return sub;
9791}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009792UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_mutable_uninterpreted_option(google_protobuf_ServiceOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009793 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009794 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009795 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009796 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009797 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009798 } else {
9799 if (size) *size = 0;
9800 return NULL;
9801 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009802}
Eric Salob7d54ac2022-12-29 11:59:42 -08009803UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_resize_uninterpreted_option(google_protobuf_ServiceOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009804 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009805 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9806 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009807}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009808UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ServiceOptions_add_uninterpreted_option(google_protobuf_ServiceOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009809 upb_MiniTableField field = {999, UPB_SIZE(16, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009810 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9811 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009812 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009813 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08009814 return NULL;
9815 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009816 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 -08009817 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009818 UPB_PRIVATE(_upb_Array_Set)
9819 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009820 return sub;
9821}
9822
9823/* google.protobuf.MethodOptions */
9824
Joshua Habermanf41049a2022-01-21 14:41:25 -08009825UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009826 return (google_protobuf_MethodOptions*)_upb_Message_New(&google__protobuf__MethodOptions_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009827}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009828UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse(const char* buf, size_t size, upb_Arena* arena) {
9829 google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009830 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009831 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__MethodOptions_msg_init, NULL, 0, arena) !=
9832 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -07009833 return NULL;
9834 }
9835 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009836}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009837UPB_INLINE google_protobuf_MethodOptions* google_protobuf_MethodOptions_parse_ex(const char* buf, size_t size,
9838 const upb_ExtensionRegistry* extreg,
9839 int options, upb_Arena* arena) {
9840 google_protobuf_MethodOptions* ret = google_protobuf_MethodOptions_new(arena);
9841 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009842 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__MethodOptions_msg_init, extreg, options,
9843 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -08009844 return NULL;
9845 }
9846 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009847}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009848UPB_INLINE char* google_protobuf_MethodOptions_serialize(const google_protobuf_MethodOptions* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009849 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009850 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__MethodOptions_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009851 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009852}
9853UPB_INLINE char* google_protobuf_MethodOptions_serialize_ex(const google_protobuf_MethodOptions* msg, int options,
9854 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -07009855 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009856 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__MethodOptions_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009857 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009858}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009859UPB_INLINE void google_protobuf_MethodOptions_clear_deprecated(google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009860 const upb_MiniTableField field = {33, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009861 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009862}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009863UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009864 bool default_val = false;
9865 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009866 const upb_MiniTableField field = {33, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009867 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9868 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009869 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009870}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009871UPB_INLINE bool google_protobuf_MethodOptions_has_deprecated(const google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009872 const upb_MiniTableField field = {33, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009873 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009874}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009875UPB_INLINE void google_protobuf_MethodOptions_clear_idempotency_level(google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009876 const upb_MiniTableField field = {34, 12, 65, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009877 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009878}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009879UPB_INLINE int32_t google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions* msg) {
Eric Salo8809a112022-11-21 13:01:06 -08009880 int32_t default_val = 0;
9881 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009882 const upb_MiniTableField field = {34, 12, 65, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009883 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9884 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -08009885 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -08009886}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009887UPB_INLINE bool google_protobuf_MethodOptions_has_idempotency_level(const google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009888 const upb_MiniTableField field = {34, 12, 65, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009889 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009890}
9891UPB_INLINE void google_protobuf_MethodOptions_clear_features(google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009892 const upb_MiniTableField field = {35, 16, 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009893 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009894}
9895UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_MethodOptions_features(const google_protobuf_MethodOptions* msg) {
9896 const google_protobuf_FeatureSet* default_val = NULL;
9897 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009898 const upb_MiniTableField field = {35, 16, 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009899 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
9900 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009901 return ret;
9902}
9903UPB_INLINE bool google_protobuf_MethodOptions_has_features(const google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009904 const upb_MiniTableField field = {35, 16, 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +00009905 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -07009906}
Mike Kruskal3bc50492022-12-01 13:34:12 -08009907UPB_INLINE void google_protobuf_MethodOptions_clear_uninterpreted_option(google_protobuf_MethodOptions* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009908 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +00009909 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009910}
Eric Salob7d54ac2022-12-29 11:59:42 -08009911UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009912 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009913 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009914 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009915 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009916 return (const google_protobuf_UninterpretedOption* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009917 } else {
9918 if (size) *size = 0;
9919 return NULL;
9920 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009921}
Deanna Garciab26afb52023-04-25 13:37:18 -07009922UPB_INLINE const upb_Array* _google_protobuf_MethodOptions_uninterpreted_option_upb_array(const google_protobuf_MethodOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009923 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009924 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -07009925 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009926 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009927 }
9928 return arr;
9929}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009930UPB_INLINE upb_Array* _google_protobuf_MethodOptions_uninterpreted_option_mutable_upb_array(google_protobuf_MethodOptions* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009931 const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009932 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
9933 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -07009934 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009935 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -07009936 }
9937 return arr;
9938}
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009939
9940UPB_INLINE void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009941 const upb_MiniTableField field = {33, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009942 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009943}
9944UPB_INLINE void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009945 const upb_MiniTableField field = {34, 12, 65, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009946 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -08009947}
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009948UPB_INLINE void google_protobuf_MethodOptions_set_features(google_protobuf_MethodOptions *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009949 const upb_MiniTableField field = {35, 16, 66, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009950 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009951}
9952UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_MethodOptions_mutable_features(google_protobuf_MethodOptions* msg, upb_Arena* arena) {
9953 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_MethodOptions_features(msg);
9954 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009955 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -07009956 if (sub) google_protobuf_MethodOptions_set_features(msg, sub);
9957 }
9958 return sub;
9959}
Mike Kruskal232ecf42023-01-14 00:09:40 -08009960UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_mutable_uninterpreted_option(google_protobuf_MethodOptions* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009961 upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009962 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -08009963 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009964 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009965 return (google_protobuf_UninterpretedOption**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -08009966 } else {
9967 if (size) *size = 0;
9968 return NULL;
9969 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009970}
Eric Salob7d54ac2022-12-29 11:59:42 -08009971UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_resize_uninterpreted_option(google_protobuf_MethodOptions* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009972 upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009973 return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
9974 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009975}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -07009976UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MethodOptions_add_uninterpreted_option(google_protobuf_MethodOptions* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +00009977 upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009978 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
9979 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +00009980 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009981 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -08009982 return NULL;
9983 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009984 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 -08009985 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +00009986 UPB_PRIVATE(_upb_Array_Set)
9987 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009988 return sub;
9989}
9990
9991/* google.protobuf.UninterpretedOption */
9992
Joshua Habermanf41049a2022-01-21 14:41:25 -08009993UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +00009994 return (google_protobuf_UninterpretedOption*)_upb_Message_New(&google__protobuf__UninterpretedOption_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -08009995}
Joshua Habermanf41049a2022-01-21 14:41:25 -08009996UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse(const char* buf, size_t size, upb_Arena* arena) {
9997 google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -07009998 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +00009999 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__UninterpretedOption_msg_init, NULL, 0, arena) !=
10000 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010001 return NULL;
10002 }
10003 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010004}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010005UPB_INLINE google_protobuf_UninterpretedOption* google_protobuf_UninterpretedOption_parse_ex(const char* buf, size_t size,
10006 const upb_ExtensionRegistry* extreg,
10007 int options, upb_Arena* arena) {
10008 google_protobuf_UninterpretedOption* ret = google_protobuf_UninterpretedOption_new(arena);
10009 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010010 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__UninterpretedOption_msg_init, extreg, options,
10011 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080010012 return NULL;
10013 }
10014 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010015}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010016UPB_INLINE char* google_protobuf_UninterpretedOption_serialize(const google_protobuf_UninterpretedOption* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010017 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010018 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__UninterpretedOption_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010019 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010020}
10021UPB_INLINE char* google_protobuf_UninterpretedOption_serialize_ex(const google_protobuf_UninterpretedOption* msg, int options,
10022 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010023 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010024 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__UninterpretedOption_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010025 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010026}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010027UPB_INLINE void google_protobuf_UninterpretedOption_clear_name(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010028 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010029 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010030}
Eric Salob7d54ac2022-12-29 11:59:42 -080010031UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010032 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010033 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010034 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010035 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010036 return (const google_protobuf_UninterpretedOption_NamePart* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010037 } else {
10038 if (size) *size = 0;
10039 return NULL;
10040 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010041}
Deanna Garciab26afb52023-04-25 13:37:18 -070010042UPB_INLINE const upb_Array* _google_protobuf_UninterpretedOption_name_upb_array(const google_protobuf_UninterpretedOption* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010043 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010044 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070010045 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010046 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010047 }
10048 return arr;
10049}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010050UPB_INLINE upb_Array* _google_protobuf_UninterpretedOption_name_mutable_upb_array(google_protobuf_UninterpretedOption* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010051 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010052 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
10053 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070010054 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010055 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010056 }
10057 return arr;
10058}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010059UPB_INLINE void google_protobuf_UninterpretedOption_clear_identifier_value(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010060 const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010061 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010062}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010063UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010064 upb_StringView default_val = upb_StringView_FromString("");
10065 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010066 const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010067 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10068 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010069 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010070}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010071UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010072 const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010073 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010074}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010075UPB_INLINE void google_protobuf_UninterpretedOption_clear_positive_int_value(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010076 const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010077 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010078}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010079UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010080 uint64_t default_val = (uint64_t)0ull;
10081 uint64_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010082 const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010083 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10084 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010085 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010086}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010087UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010088 const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010089 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010090}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010091UPB_INLINE void google_protobuf_UninterpretedOption_clear_negative_int_value(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010092 const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010093 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010094}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010095UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010096 int64_t default_val = (int64_t)0ll;
10097 int64_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010098 const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010099 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10100 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010101 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010102}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010103UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010104 const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010105 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010106}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010107UPB_INLINE void google_protobuf_UninterpretedOption_clear_double_value(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010108 const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010109 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010110}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010111UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010112 double default_val = 0;
10113 double ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010114 const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010115 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10116 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010117 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010118}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010119UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010120 const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010121 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010122}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010123UPB_INLINE void google_protobuf_UninterpretedOption_clear_string_value(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010124 const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010125 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010126}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010127UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010128 upb_StringView default_val = upb_StringView_FromString("");
10129 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010130 const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010131 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10132 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010133 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010134}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010135UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010136 const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010137 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010138}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010139UPB_INLINE void google_protobuf_UninterpretedOption_clear_aggregate_value(google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010140 const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010141 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010142}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010143UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010144 upb_StringView default_val = upb_StringView_FromString("");
10145 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010146 const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010147 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10148 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010149 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010150}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010151UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010152 const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010153 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080010154}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010155
Eric Salob7d54ac2022-12-29 11:59:42 -080010156UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010157 upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010158 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010159 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010160 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010161 return (google_protobuf_UninterpretedOption_NamePart**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010162 } else {
10163 if (size) *size = 0;
10164 return NULL;
10165 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010166}
Eric Salob7d54ac2022-12-29 11:59:42 -080010167UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_resize_name(google_protobuf_UninterpretedOption* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010168 upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010169 return (google_protobuf_UninterpretedOption_NamePart**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
10170 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010171}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010172UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_add_name(google_protobuf_UninterpretedOption* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010173 upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010174 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10175 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010176 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010177 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080010178 return NULL;
10179 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010180 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 -080010181 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010182 UPB_PRIVATE(_upb_Array_Set)
10183 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010184 return sub;
10185}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010186UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010187 const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010188 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010189}
10190UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010191 const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010192 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010193}
10194UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010195 const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010196 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010197}
10198UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010199 const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010200 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010201}
10202UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010203 const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010204 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010205}
10206UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010207 const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010208 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010209}
Mike Kruskal232ecf42023-01-14 00:09:40 -080010210
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010211/* google.protobuf.UninterpretedOption.NamePart */
10212
Joshua Habermanf41049a2022-01-21 14:41:25 -080010213UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010214 return (google_protobuf_UninterpretedOption_NamePart*)_upb_Message_New(&google__protobuf__UninterpretedOption__NamePart_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010215}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010216UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse(const char* buf, size_t size, upb_Arena* arena) {
10217 google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010218 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010219 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__UninterpretedOption__NamePart_msg_init, NULL, 0, arena) !=
10220 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010221 return NULL;
10222 }
10223 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010224}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010225UPB_INLINE google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_NamePart_parse_ex(const char* buf, size_t size,
10226 const upb_ExtensionRegistry* extreg,
10227 int options, upb_Arena* arena) {
10228 google_protobuf_UninterpretedOption_NamePart* ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
10229 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010230 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__UninterpretedOption__NamePart_msg_init, extreg, options,
10231 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080010232 return NULL;
10233 }
10234 return ret;
10235}
10236UPB_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 -070010237 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010238 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__UninterpretedOption__NamePart_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010239 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010240}
10241UPB_INLINE char* google_protobuf_UninterpretedOption_NamePart_serialize_ex(const google_protobuf_UninterpretedOption_NamePart* msg, int options,
10242 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010243 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010244 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__UninterpretedOption__NamePart_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010245 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010246}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010247UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_name_part(google_protobuf_UninterpretedOption_NamePart* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010248 const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010249 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010250}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010251UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010252 upb_StringView default_val = upb_StringView_FromString("");
10253 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010254 const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010255 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10256 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010257 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010258}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010259UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010260 const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010261 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010262}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010263UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_is_extension(google_protobuf_UninterpretedOption_NamePart* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010264 const upb_MiniTableField field = {2, 9, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010265 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010266}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010267UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010268 bool default_val = false;
10269 bool ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010270 const upb_MiniTableField field = {2, 9, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010271 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10272 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010273 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010274}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010275UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010276 const upb_MiniTableField field = {2, 9, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010277 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080010278}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010279
Joshua Habermanf41049a2022-01-21 14:41:25 -080010280UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010281 const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010282 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010283}
10284UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010285 const upb_MiniTableField field = {2, 9, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010286 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010287}
Mike Kruskal232ecf42023-01-14 00:09:40 -080010288
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010289/* google.protobuf.FeatureSet */
10290
10291UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010292 return (google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010293}
10294UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse(const char* buf, size_t size, upb_Arena* arena) {
10295 google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena);
10296 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010297 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FeatureSet_msg_init, NULL, 0, arena) !=
10298 kUpb_DecodeStatus_Ok) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010299 return NULL;
10300 }
10301 return ret;
10302}
10303UPB_INLINE google_protobuf_FeatureSet* google_protobuf_FeatureSet_parse_ex(const char* buf, size_t size,
10304 const upb_ExtensionRegistry* extreg,
10305 int options, upb_Arena* arena) {
10306 google_protobuf_FeatureSet* ret = google_protobuf_FeatureSet_new(arena);
10307 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010308 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FeatureSet_msg_init, extreg, options,
10309 arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010310 return NULL;
10311 }
10312 return ret;
10313}
10314UPB_INLINE char* google_protobuf_FeatureSet_serialize(const google_protobuf_FeatureSet* msg, upb_Arena* arena, size_t* len) {
10315 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010316 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSet_msg_init, 0, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010317 return ptr;
10318}
10319UPB_INLINE char* google_protobuf_FeatureSet_serialize_ex(const google_protobuf_FeatureSet* msg, int options,
10320 upb_Arena* arena, size_t* len) {
10321 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010322 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSet_msg_init, options, arena, &ptr, len);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010323 return ptr;
10324}
10325UPB_INLINE void google_protobuf_FeatureSet_clear_field_presence(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010326 const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010327 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010328}
10329UPB_INLINE int32_t google_protobuf_FeatureSet_field_presence(const google_protobuf_FeatureSet* msg) {
10330 int32_t default_val = 0;
10331 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010332 const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010333 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10334 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010335 return ret;
10336}
10337UPB_INLINE bool google_protobuf_FeatureSet_has_field_presence(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010338 const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010339 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010340}
10341UPB_INLINE void google_protobuf_FeatureSet_clear_enum_type(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010342 const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010343 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010344}
10345UPB_INLINE int32_t google_protobuf_FeatureSet_enum_type(const google_protobuf_FeatureSet* msg) {
10346 int32_t default_val = 0;
10347 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010348 const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010349 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10350 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010351 return ret;
10352}
10353UPB_INLINE bool google_protobuf_FeatureSet_has_enum_type(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010354 const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010355 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010356}
10357UPB_INLINE void google_protobuf_FeatureSet_clear_repeated_field_encoding(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010358 const upb_MiniTableField field = {3, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010359 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010360}
10361UPB_INLINE int32_t google_protobuf_FeatureSet_repeated_field_encoding(const google_protobuf_FeatureSet* msg) {
10362 int32_t default_val = 0;
10363 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010364 const upb_MiniTableField field = {3, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010365 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10366 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010367 return ret;
10368}
10369UPB_INLINE bool google_protobuf_FeatureSet_has_repeated_field_encoding(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010370 const upb_MiniTableField field = {3, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010371 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010372}
Protobuf Team Bot61127952023-09-26 20:07:33 +000010373UPB_INLINE void google_protobuf_FeatureSet_clear_utf8_validation(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010374 const upb_MiniTableField field = {4, 24, 67, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010375 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot61127952023-09-26 20:07:33 +000010376}
10377UPB_INLINE int32_t google_protobuf_FeatureSet_utf8_validation(const google_protobuf_FeatureSet* msg) {
10378 int32_t default_val = 0;
10379 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010380 const upb_MiniTableField field = {4, 24, 67, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010381 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10382 &default_val, &ret);
Protobuf Team Bot61127952023-09-26 20:07:33 +000010383 return ret;
10384}
10385UPB_INLINE bool google_protobuf_FeatureSet_has_utf8_validation(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010386 const upb_MiniTableField field = {4, 24, 67, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010387 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Bot61127952023-09-26 20:07:33 +000010388}
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010389UPB_INLINE void google_protobuf_FeatureSet_clear_message_encoding(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010390 const upb_MiniTableField field = {5, 28, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010391 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010392}
10393UPB_INLINE int32_t google_protobuf_FeatureSet_message_encoding(const google_protobuf_FeatureSet* msg) {
10394 int32_t default_val = 0;
10395 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010396 const upb_MiniTableField field = {5, 28, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010397 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10398 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010399 return ret;
10400}
10401UPB_INLINE bool google_protobuf_FeatureSet_has_message_encoding(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010402 const upb_MiniTableField field = {5, 28, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010403 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010404}
10405UPB_INLINE void google_protobuf_FeatureSet_clear_json_format(google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010406 const upb_MiniTableField field = {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010407 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010408}
10409UPB_INLINE int32_t google_protobuf_FeatureSet_json_format(const google_protobuf_FeatureSet* msg) {
10410 int32_t default_val = 0;
10411 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010412 const upb_MiniTableField field = {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010413 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10414 &default_val, &ret);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010415 return ret;
10416}
10417UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf_FeatureSet* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010418 const upb_MiniTableField field = {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010419 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010420}
10421
10422UPB_INLINE void google_protobuf_FeatureSet_set_field_presence(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010423 const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010424 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010425}
10426UPB_INLINE void google_protobuf_FeatureSet_set_enum_type(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010427 const upb_MiniTableField field = {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010428 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010429}
10430UPB_INLINE void google_protobuf_FeatureSet_set_repeated_field_encoding(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010431 const upb_MiniTableField field = {3, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010432 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010433}
Protobuf Team Bot61127952023-09-26 20:07:33 +000010434UPB_INLINE void google_protobuf_FeatureSet_set_utf8_validation(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010435 const upb_MiniTableField field = {4, 24, 67, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010436 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Protobuf Team Bot61127952023-09-26 20:07:33 +000010437}
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010438UPB_INLINE void google_protobuf_FeatureSet_set_message_encoding(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010439 const upb_MiniTableField field = {5, 28, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010440 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010441}
10442UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_FeatureSet *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010443 const upb_MiniTableField field = {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010444 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal4f9e4172023-06-30 20:14:50 -070010445}
10446
Mike Kruskalba964702023-08-22 17:37:48 -070010447/* google.protobuf.FeatureSetDefaults */
10448
10449UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010450 return (google_protobuf_FeatureSetDefaults*)_upb_Message_New(&google__protobuf__FeatureSetDefaults_msg_init, arena);
Mike Kruskalba964702023-08-22 17:37:48 -070010451}
10452UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse(const char* buf, size_t size, upb_Arena* arena) {
10453 google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena);
10454 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010455 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FeatureSetDefaults_msg_init, NULL, 0, arena) !=
10456 kUpb_DecodeStatus_Ok) {
Mike Kruskalba964702023-08-22 17:37:48 -070010457 return NULL;
10458 }
10459 return ret;
10460}
10461UPB_INLINE google_protobuf_FeatureSetDefaults* google_protobuf_FeatureSetDefaults_parse_ex(const char* buf, size_t size,
10462 const upb_ExtensionRegistry* extreg,
10463 int options, upb_Arena* arena) {
10464 google_protobuf_FeatureSetDefaults* ret = google_protobuf_FeatureSetDefaults_new(arena);
10465 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010466 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FeatureSetDefaults_msg_init, extreg, options,
10467 arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskalba964702023-08-22 17:37:48 -070010468 return NULL;
10469 }
10470 return ret;
10471}
10472UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize(const google_protobuf_FeatureSetDefaults* msg, upb_Arena* arena, size_t* len) {
10473 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010474 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSetDefaults_msg_init, 0, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -070010475 return ptr;
10476}
10477UPB_INLINE char* google_protobuf_FeatureSetDefaults_serialize_ex(const google_protobuf_FeatureSetDefaults* msg, int options,
10478 upb_Arena* arena, size_t* len) {
10479 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010480 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSetDefaults_msg_init, options, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -070010481 return ptr;
10482}
10483UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_defaults(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010484 const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010485 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010486}
10487UPB_INLINE const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* const* google_protobuf_FeatureSetDefaults_defaults(const google_protobuf_FeatureSetDefaults* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010488 const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010489 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010490 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010491 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010492 return (const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* const*)upb_Array_DataPtr(arr);
Mike Kruskalba964702023-08-22 17:37:48 -070010493 } else {
10494 if (size) *size = 0;
10495 return NULL;
10496 }
10497}
10498UPB_INLINE const upb_Array* _google_protobuf_FeatureSetDefaults_defaults_upb_array(const google_protobuf_FeatureSetDefaults* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010499 const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010500 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010501 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010502 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Mike Kruskalba964702023-08-22 17:37:48 -070010503 }
10504 return arr;
10505}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010506UPB_INLINE upb_Array* _google_protobuf_FeatureSetDefaults_defaults_mutable_upb_array(google_protobuf_FeatureSetDefaults* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010507 const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010508 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
10509 &field, arena);
Mike Kruskalba964702023-08-22 17:37:48 -070010510 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010511 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Mike Kruskalba964702023-08-22 17:37:48 -070010512 }
10513 return arr;
10514}
Mike Kruskalba964702023-08-22 17:37:48 -070010515UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_minimum_edition(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010516 const upb_MiniTableField field = {4, UPB_SIZE(16, 12), 64, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010517 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010518}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010519UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) {
10520 int32_t default_val = 0;
10521 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010522 const upb_MiniTableField field = {4, UPB_SIZE(16, 12), 64, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010523 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10524 &default_val, &ret);
Mike Kruskalba964702023-08-22 17:37:48 -070010525 return ret;
10526}
10527UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_minimum_edition(const google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010528 const upb_MiniTableField field = {4, UPB_SIZE(16, 12), 64, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010529 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010530}
10531UPB_INLINE void google_protobuf_FeatureSetDefaults_clear_maximum_edition(google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010532 const upb_MiniTableField field = {5, UPB_SIZE(20, 16), 65, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010533 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010534}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010535UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) {
10536 int32_t default_val = 0;
10537 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010538 const upb_MiniTableField field = {5, UPB_SIZE(20, 16), 65, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010539 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10540 &default_val, &ret);
Mike Kruskalba964702023-08-22 17:37:48 -070010541 return ret;
10542}
10543UPB_INLINE bool google_protobuf_FeatureSetDefaults_has_maximum_edition(const google_protobuf_FeatureSetDefaults* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010544 const upb_MiniTableField field = {5, UPB_SIZE(20, 16), 65, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010545 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010546}
10547
10548UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault** google_protobuf_FeatureSetDefaults_mutable_defaults(google_protobuf_FeatureSetDefaults* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010549 upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010550 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010551 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010552 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010553 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)upb_Array_MutableDataPtr(arr);
Mike Kruskalba964702023-08-22 17:37:48 -070010554 } else {
10555 if (size) *size = 0;
10556 return NULL;
10557 }
10558}
10559UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault** google_protobuf_FeatureSetDefaults_resize_defaults(google_protobuf_FeatureSetDefaults* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010560 upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010561 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
10562 &field, size, arena);
Mike Kruskalba964702023-08-22 17:37:48 -070010563}
10564UPB_INLINE struct google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_add_defaults(google_protobuf_FeatureSetDefaults* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010565 upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010566 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10567 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010568 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010569 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Mike Kruskalba964702023-08-22 17:37:48 -070010570 return NULL;
10571 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010572 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 -070010573 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010574 UPB_PRIVATE(_upb_Array_Set)
10575 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Mike Kruskalba964702023-08-22 17:37:48 -070010576 return sub;
10577}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010578UPB_INLINE void google_protobuf_FeatureSetDefaults_set_minimum_edition(google_protobuf_FeatureSetDefaults *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010579 const upb_MiniTableField field = {4, UPB_SIZE(16, 12), 64, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010580 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskalba964702023-08-22 17:37:48 -070010581}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010582UPB_INLINE void google_protobuf_FeatureSetDefaults_set_maximum_edition(google_protobuf_FeatureSetDefaults *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010583 const upb_MiniTableField field = {5, UPB_SIZE(20, 16), 65, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010584 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskalba964702023-08-22 17:37:48 -070010585}
10586
10587/* google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault */
10588
10589UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010590 return (google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault*)_upb_Message_New(&google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, arena);
Mike Kruskalba964702023-08-22 17:37:48 -070010591}
10592UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse(const char* buf, size_t size, upb_Arena* arena) {
10593 google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena);
10594 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010595 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, NULL, 0, arena) !=
10596 kUpb_DecodeStatus_Ok) {
Mike Kruskalba964702023-08-22 17:37:48 -070010597 return NULL;
10598 }
10599 return ret;
10600}
10601UPB_INLINE google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_parse_ex(const char* buf, size_t size,
10602 const upb_ExtensionRegistry* extreg,
10603 int options, upb_Arena* arena) {
10604 google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* ret = google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_new(arena);
10605 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010606 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, extreg, options,
10607 arena) != kUpb_DecodeStatus_Ok) {
Mike Kruskalba964702023-08-22 17:37:48 -070010608 return NULL;
10609 }
10610 return ret;
10611}
10612UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena, size_t* len) {
10613 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010614 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, 0, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -070010615 return ptr;
10616}
10617UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_serialize_ex(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, int options,
10618 upb_Arena* arena, size_t* len) {
10619 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010620 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init, options, arena, &ptr, len);
Mike Kruskalba964702023-08-22 17:37:48 -070010621 return ptr;
10622}
Mike Kruskalba964702023-08-22 17:37:48 -070010623UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010624 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010625 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010626}
10627UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
10628 const google_protobuf_FeatureSet* default_val = NULL;
10629 const google_protobuf_FeatureSet* ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010630 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010631 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10632 &default_val, &ret);
Mike Kruskalba964702023-08-22 17:37:48 -070010633 return ret;
10634}
10635UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010636 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010637 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskalba964702023-08-22 17:37:48 -070010638}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010639UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010640 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010641 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010642}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010643UPB_INLINE int32_t google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010644 int32_t default_val = 0;
10645 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010646 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010647 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10648 &default_val, &ret);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010649 return ret;
10650}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010651UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_edition(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010652 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010653 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010654}
Mike Kruskalba964702023-08-22 17:37:48 -070010655
Mike Kruskalba964702023-08-22 17:37:48 -070010656UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, google_protobuf_FeatureSet* value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010657 const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010658 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskalba964702023-08-22 17:37:48 -070010659}
10660UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) {
10661 struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(msg);
10662 if (sub == NULL) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010663 sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google__protobuf__FeatureSet_msg_init, arena);
Mike Kruskalba964702023-08-22 17:37:48 -070010664 if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(msg, sub);
10665 }
10666 return sub;
10667}
Protobuf Team Botab58f8f2023-09-26 16:14:19 +000010668UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010669 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010670 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Protobuf Team Botfa98bb32023-09-01 18:11:09 +000010671}
Mike Kruskalba964702023-08-22 17:37:48 -070010672
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010673/* google.protobuf.SourceCodeInfo */
10674
Joshua Habermanf41049a2022-01-21 14:41:25 -080010675UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010676 return (google_protobuf_SourceCodeInfo*)_upb_Message_New(&google__protobuf__SourceCodeInfo_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010677}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010678UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) {
10679 google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010680 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010681 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__SourceCodeInfo_msg_init, NULL, 0, arena) !=
10682 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010683 return NULL;
10684 }
10685 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010686}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010687UPB_INLINE google_protobuf_SourceCodeInfo* google_protobuf_SourceCodeInfo_parse_ex(const char* buf, size_t size,
10688 const upb_ExtensionRegistry* extreg,
10689 int options, upb_Arena* arena) {
10690 google_protobuf_SourceCodeInfo* ret = google_protobuf_SourceCodeInfo_new(arena);
10691 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010692 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__SourceCodeInfo_msg_init, extreg, options,
10693 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080010694 return NULL;
10695 }
10696 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010697}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010698UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize(const google_protobuf_SourceCodeInfo* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010699 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010700 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__SourceCodeInfo_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010701 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010702}
10703UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize_ex(const google_protobuf_SourceCodeInfo* msg, int options,
10704 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010705 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010706 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__SourceCodeInfo_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010707 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010708}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010709UPB_INLINE void google_protobuf_SourceCodeInfo_clear_location(google_protobuf_SourceCodeInfo* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010710 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010711 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010712}
Eric Salob7d54ac2022-12-29 11:59:42 -080010713UPB_INLINE const google_protobuf_SourceCodeInfo_Location* const* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010714 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010715 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010716 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010717 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010718 return (const google_protobuf_SourceCodeInfo_Location* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010719 } else {
10720 if (size) *size = 0;
10721 return NULL;
10722 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010723}
Deanna Garciab26afb52023-04-25 13:37:18 -070010724UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_location_upb_array(const google_protobuf_SourceCodeInfo* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010725 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010726 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070010727 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010728 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010729 }
10730 return arr;
10731}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010732UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_location_mutable_upb_array(google_protobuf_SourceCodeInfo* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010733 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010734 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
10735 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070010736 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010737 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010738 }
10739 return arr;
10740}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010741
Eric Salob7d54ac2022-12-29 11:59:42 -080010742UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_mutable_location(google_protobuf_SourceCodeInfo* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010743 upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010744 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010745 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010746 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010747 return (google_protobuf_SourceCodeInfo_Location**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010748 } else {
10749 if (size) *size = 0;
10750 return NULL;
10751 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010752}
Eric Salob7d54ac2022-12-29 11:59:42 -080010753UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_resize_location(google_protobuf_SourceCodeInfo* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010754 upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010755 return (google_protobuf_SourceCodeInfo_Location**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
10756 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010757}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010758UPB_INLINE struct google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_add_location(google_protobuf_SourceCodeInfo* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010759 upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010760 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10761 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010762 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010763 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080010764 return NULL;
10765 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010766 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 -080010767 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010768 UPB_PRIVATE(_upb_Array_Set)
10769 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010770 return sub;
10771}
10772
10773/* google.protobuf.SourceCodeInfo.Location */
10774
Joshua Habermanf41049a2022-01-21 14:41:25 -080010775UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000010776 return (google_protobuf_SourceCodeInfo_Location*)_upb_Message_New(&google__protobuf__SourceCodeInfo__Location_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010777}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010778UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse(const char* buf, size_t size, upb_Arena* arena) {
10779 google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070010780 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010781 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__SourceCodeInfo__Location_msg_init, NULL, 0, arena) !=
10782 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070010783 return NULL;
10784 }
10785 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010786}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010787UPB_INLINE google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_Location_parse_ex(const char* buf, size_t size,
10788 const upb_ExtensionRegistry* extreg,
10789 int options, upb_Arena* arena) {
10790 google_protobuf_SourceCodeInfo_Location* ret = google_protobuf_SourceCodeInfo_Location_new(arena);
10791 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010792 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__SourceCodeInfo__Location_msg_init, extreg, options,
10793 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080010794 return NULL;
10795 }
10796 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010797}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010798UPB_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 -070010799 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010800 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__SourceCodeInfo__Location_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010801 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010802}
10803UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize_ex(const google_protobuf_SourceCodeInfo_Location* msg, int options,
10804 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070010805 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010806 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__SourceCodeInfo__Location_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010807 return ptr;
10808}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010809UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_path(google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010810 const upb_MiniTableField field = {1, UPB_SIZE(12, 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)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010811 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080010812}
Eric Salob7d54ac2022-12-29 11:59:42 -080010813UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010814 const upb_MiniTableField field = {1, UPB_SIZE(12, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010815 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010816 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010817 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010818 return (int32_t const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010819 } else {
10820 if (size) *size = 0;
10821 return NULL;
10822 }
Joshua Habermand3995ec2022-09-30 16:54:39 -070010823}
Deanna Garciab26afb52023-04-25 13:37:18 -070010824UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_path_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010825 const upb_MiniTableField field = {1, UPB_SIZE(12, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010826 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070010827 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010828 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010829 }
10830 return arr;
10831}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010832UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_path_mutable_upb_array(google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010833 const upb_MiniTableField field = {1, UPB_SIZE(12, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010834 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
10835 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070010836 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010837 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010838 }
10839 return arr;
10840}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010841UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_span(google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010842 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010843 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010844}
Eric Salob7d54ac2022-12-29 11:59:42 -080010845UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010846 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010847 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010848 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010849 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010850 return (int32_t const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010851 } else {
10852 if (size) *size = 0;
10853 return NULL;
10854 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010855}
Deanna Garciab26afb52023-04-25 13:37:18 -070010856UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_span_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010857 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010858 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070010859 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010860 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010861 }
10862 return arr;
10863}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010864UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_span_mutable_upb_array(google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010865 const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010866 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
10867 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070010868 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010869 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010870 }
10871 return arr;
10872}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010873UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010874 const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010875 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010876}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010877UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010878 upb_StringView default_val = upb_StringView_FromString("");
10879 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010880 const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010881 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10882 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010883 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080010884}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010885UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010886 const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010887 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010888}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010889UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_trailing_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010890 const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010891 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070010892}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010893UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080010894 upb_StringView default_val = upb_StringView_FromString("");
10895 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010896 const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010897 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
10898 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080010899 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -070010900}
Mike Kruskal3bc50492022-12-01 13:34:12 -080010901UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010902 const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000010903 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080010904}
10905UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010906 const upb_MiniTableField field = {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000010907 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080010908}
Eric Salob7d54ac2022-12-29 11:59:42 -080010909UPB_INLINE upb_StringView const* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010910 const upb_MiniTableField field = {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010911 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010912 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010913 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010914 return (upb_StringView const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010915 } else {
10916 if (size) *size = 0;
10917 return NULL;
10918 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010919}
Deanna Garciab26afb52023-04-25 13:37:18 -070010920UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_leading_detached_comments_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010921 const upb_MiniTableField field = {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010922 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070010923 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010924 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010925 }
10926 return arr;
10927}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010928UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_leading_detached_comments_mutable_upb_array(google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010929 const upb_MiniTableField field = {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010930 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
10931 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070010932 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010933 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070010934 }
10935 return arr;
10936}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010937
Eric Salob7d54ac2022-12-29 11:59:42 -080010938UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010939 upb_MiniTableField field = {1, UPB_SIZE(12, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010940 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010941 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010942 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010943 return (int32_t*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010944 } else {
10945 if (size) *size = 0;
10946 return NULL;
10947 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010948}
Eric Salob7d54ac2022-12-29 11:59:42 -080010949UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_path(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010950 upb_MiniTableField field = {1, UPB_SIZE(12, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010951 return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
10952 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010953}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010954UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf_SourceCodeInfo_Location* msg, int32_t val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010955 upb_MiniTableField field = {1, UPB_SIZE(12, 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)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010956 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10957 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010958 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010959 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080010960 return false;
10961 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010962 UPB_PRIVATE(_upb_Array_Set)
10963 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -080010964 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010965}
Eric Salob7d54ac2022-12-29 11:59:42 -080010966UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010967 upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010968 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080010969 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010970 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010971 return (int32_t*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080010972 } else {
10973 if (size) *size = 0;
10974 return NULL;
10975 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010976}
Eric Salob7d54ac2022-12-29 11:59:42 -080010977UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_span(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010978 upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010979 return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
10980 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010981}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070010982UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf_SourceCodeInfo_Location* msg, int32_t val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010983 upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010984 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
10985 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000010986 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010987 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080010988 return false;
10989 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +000010990 UPB_PRIVATE(_upb_Array_Set)
10991 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -080010992 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080010993}
Joshua Habermanf41049a2022-01-21 14:41:25 -080010994UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010995 const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000010996 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080010997}
10998UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000010999 const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011000 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011001}
11002UPB_INLINE upb_StringView* google_protobuf_SourceCodeInfo_Location_mutable_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011003 upb_MiniTableField field = {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011004 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011005 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011006 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011007 return (upb_StringView*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011008 } else {
11009 if (size) *size = 0;
11010 return NULL;
11011 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011012}
Eric Salob7d54ac2022-12-29 11:59:42 -080011013UPB_INLINE upb_StringView* google_protobuf_SourceCodeInfo_Location_resize_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011014 upb_MiniTableField field = {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011015 return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
11016 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011017}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011018UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, upb_StringView val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011019 upb_MiniTableField field = {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011020 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
11021 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011022 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011023 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080011024 return false;
11025 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011026 UPB_PRIVATE(_upb_Array_Set)
11027 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -080011028 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011029}
11030
11031/* google.protobuf.GeneratedCodeInfo */
11032
Joshua Habermanf41049a2022-01-21 14:41:25 -080011033UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000011034 return (google_protobuf_GeneratedCodeInfo*)_upb_Message_New(&google__protobuf__GeneratedCodeInfo_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011035}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011036UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse(const char* buf, size_t size, upb_Arena* arena) {
11037 google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070011038 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011039 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__GeneratedCodeInfo_msg_init, NULL, 0, arena) !=
11040 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070011041 return NULL;
11042 }
11043 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011044}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011045UPB_INLINE google_protobuf_GeneratedCodeInfo* google_protobuf_GeneratedCodeInfo_parse_ex(const char* buf, size_t size,
11046 const upb_ExtensionRegistry* extreg,
11047 int options, upb_Arena* arena) {
11048 google_protobuf_GeneratedCodeInfo* ret = google_protobuf_GeneratedCodeInfo_new(arena);
11049 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011050 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__GeneratedCodeInfo_msg_init, extreg, options,
11051 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080011052 return NULL;
11053 }
11054 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011055}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011056UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize(const google_protobuf_GeneratedCodeInfo* msg, upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070011057 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011058 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__GeneratedCodeInfo_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011059 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011060}
11061UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize_ex(const google_protobuf_GeneratedCodeInfo* msg, int options,
11062 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070011063 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011064 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__GeneratedCodeInfo_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011065 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011066}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011067UPB_INLINE void google_protobuf_GeneratedCodeInfo_clear_annotation(google_protobuf_GeneratedCodeInfo* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011068 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011069 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011070}
Eric Salob7d54ac2022-12-29 11:59:42 -080011071UPB_INLINE const google_protobuf_GeneratedCodeInfo_Annotation* const* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011072 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011073 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011074 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011075 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011076 return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011077 } else {
11078 if (size) *size = 0;
11079 return NULL;
11080 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011081}
Deanna Garciab26afb52023-04-25 13:37:18 -070011082UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_annotation_upb_array(const google_protobuf_GeneratedCodeInfo* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011083 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011084 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070011085 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011086 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011087 }
11088 return arr;
11089}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011090UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_annotation_mutable_upb_array(google_protobuf_GeneratedCodeInfo* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011091 const upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011092 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
11093 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070011094 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011095 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011096 }
11097 return arr;
11098}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011099
Eric Salob7d54ac2022-12-29 11:59:42 -080011100UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_mutable_annotation(google_protobuf_GeneratedCodeInfo* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011101 upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011102 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011103 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011104 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011105 return (google_protobuf_GeneratedCodeInfo_Annotation**)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011106 } else {
11107 if (size) *size = 0;
11108 return NULL;
11109 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011110}
Eric Salob7d54ac2022-12-29 11:59:42 -080011111UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_resize_annotation(google_protobuf_GeneratedCodeInfo* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011112 upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011113 return (google_protobuf_GeneratedCodeInfo_Annotation**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
11114 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011115}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011116UPB_INLINE struct google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_add_annotation(google_protobuf_GeneratedCodeInfo* msg, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011117 upb_MiniTableField field = {1, 8, 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011118 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
11119 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011120 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011121 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080011122 return NULL;
11123 }
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000011124 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 -080011125 if (!arr || !sub) return NULL;
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011126 UPB_PRIVATE(_upb_Array_Set)
11127 (arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011128 return sub;
11129}
11130
11131/* google.protobuf.GeneratedCodeInfo.Annotation */
11132
Joshua Habermanf41049a2022-01-21 14:41:25 -080011133UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_new(upb_Arena* arena) {
Protobuf Team Bot4ffe0862023-12-06 02:02:36 +000011134 return (google_protobuf_GeneratedCodeInfo_Annotation*)_upb_Message_New(&google__protobuf__GeneratedCodeInfo__Annotation_msg_init, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011135}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011136UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse(const char* buf, size_t size, upb_Arena* arena) {
11137 google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
Joshua Haberman9d578a32021-08-02 15:32:01 -070011138 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011139 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, NULL, 0, arena) !=
11140 kUpb_DecodeStatus_Ok) {
Joshua Haberman9d578a32021-08-02 15:32:01 -070011141 return NULL;
11142 }
11143 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011144}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011145UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_Annotation_parse_ex(const char* buf, size_t size,
11146 const upb_ExtensionRegistry* extreg,
11147 int options, upb_Arena* arena) {
11148 google_protobuf_GeneratedCodeInfo_Annotation* ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
11149 if (!ret) return NULL;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011150 if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, extreg, options,
11151 arena) != kUpb_DecodeStatus_Ok) {
Joshua Habermanf41049a2022-01-21 14:41:25 -080011152 return NULL;
11153 }
11154 return ret;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011155}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011156UPB_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 -070011157 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011158 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, 0, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011159 return ptr;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011160}
11161UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize_ex(const google_protobuf_GeneratedCodeInfo_Annotation* msg, int options,
11162 upb_Arena* arena, size_t* len) {
Joshua Habermand3995ec2022-09-30 16:54:39 -070011163 char* ptr;
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011164 (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, options, arena, &ptr, len);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011165 return ptr;
11166}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011167UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_path(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011168 const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011169 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermanf41049a2022-01-21 14:41:25 -080011170}
Eric Salob7d54ac2022-12-29 11:59:42 -080011171UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011172 const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011173 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011174 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011175 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011176 return (int32_t const*)upb_Array_DataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011177 } else {
11178 if (size) *size = 0;
11179 return NULL;
11180 }
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011181}
Deanna Garciab26afb52023-04-25 13:37:18 -070011182UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_upb_array(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011183 const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011184 const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
Deanna Garciab26afb52023-04-25 13:37:18 -070011185 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011186 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011187 }
11188 return arr;
11189}
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011190UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_mutable_upb_array(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011191 const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011192 upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
11193 &field, arena);
Deanna Garciab26afb52023-04-25 13:37:18 -070011194 if (size) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011195 *size = arr ? arr->UPB_PRIVATE(size) : 0;
Deanna Garciab26afb52023-04-25 13:37:18 -070011196 }
11197 return arr;
11198}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011199UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_source_file(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011200 const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011201 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011202}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011203UPB_INLINE upb_StringView google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080011204 upb_StringView default_val = upb_StringView_FromString("");
11205 upb_StringView ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011206 const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011207 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
11208 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080011209 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011210}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011211UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011212 const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000011213 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011214}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011215UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_begin(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011216 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011217 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011218}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011219UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080011220 int32_t default_val = (int32_t)0;
11221 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011222 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011223 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
11224 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080011225 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011226}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011227UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011228 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000011229 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011230}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011231UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_end(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011232 const upb_MiniTableField field = {4, UPB_SIZE(20, 16), 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011233 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011234}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011235UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080011236 int32_t default_val = (int32_t)0;
11237 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011238 const upb_MiniTableField field = {4, UPB_SIZE(20, 16), 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011239 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
11240 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080011241 return ret;
Joshua Habermanf41049a2022-01-21 14:41:25 -080011242}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011243UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011244 const upb_MiniTableField field = {4, UPB_SIZE(20, 16), 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000011245 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011246}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011247UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_semantic(google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011248 const upb_MiniTableField field = {5, UPB_SIZE(24, 20), 67, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011249 upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
Joshua Habermand3995ec2022-09-30 16:54:39 -070011250}
11251UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Eric Salo8809a112022-11-21 13:01:06 -080011252 int32_t default_val = 0;
11253 int32_t ret;
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011254 const upb_MiniTableField field = {5, UPB_SIZE(24, 20), 67, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011255 _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
11256 &default_val, &ret);
Eric Salo8809a112022-11-21 13:01:06 -080011257 return ret;
Joshua Habermand3995ec2022-09-30 16:54:39 -070011258}
Mike Kruskal3bc50492022-12-01 13:34:12 -080011259UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011260 const upb_MiniTableField field = {5, UPB_SIZE(24, 20), 67, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot8c1f6352024-01-10 05:18:15 +000011261 return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
Mike Kruskal3bc50492022-12-01 13:34:12 -080011262}
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011263
Eric Salob7d54ac2022-12-29 11:59:42 -080011264UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011265 upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011266 upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
Eric Salob7d54ac2022-12-29 11:59:42 -080011267 if (arr) {
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011268 if (size) *size = arr->UPB_PRIVATE(size);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011269 return (int32_t*)upb_Array_MutableDataPtr(arr);
Eric Salob7d54ac2022-12-29 11:59:42 -080011270 } else {
11271 if (size) *size = 0;
11272 return NULL;
11273 }
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011274}
Eric Salob7d54ac2022-12-29 11:59:42 -080011275UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_resize_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t size, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011276 upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011277 return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
11278 &field, size, arena);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011279}
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070011280UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, int32_t val, upb_Arena* arena) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011281 upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011282 upb_Array* arr = upb_Message_GetOrCreateMutableArray(
11283 UPB_UPCAST(msg), &field, arena);
Protobuf Team Bot81e54332024-01-11 21:04:07 +000011284 if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011285 arr, arr->UPB_PRIVATE(size) + 1, arena)) {
Eric Salob7d54ac2022-12-29 11:59:42 -080011286 return false;
11287 }
Protobuf Team Botf73985a2023-12-19 00:14:19 +000011288 UPB_PRIVATE(_upb_Array_Set)
11289 (arr, arr->UPB_PRIVATE(size) - 1, &val, sizeof(val));
Eric Salob7d54ac2022-12-29 11:59:42 -080011290 return true;
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011291}
Joshua Habermanf41049a2022-01-21 14:41:25 -080011292UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_StringView value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011293 const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011294 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011295}
11296UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011297 const upb_MiniTableField field = {3, UPB_SIZE(16, 12), 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011298 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011299}
11300UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011301 const upb_MiniTableField field = {4, UPB_SIZE(20, 16), 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011302 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011303}
11304UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_semantic(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011305 const upb_MiniTableField field = {5, UPB_SIZE(24, 20), 67, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
Protobuf Team Bot4a8f21e2023-12-21 16:23:10 +000011306 _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011307}
Mike Kruskal232ecf42023-01-14 00:09:40 -080011308
Joshua Habermanf41049a2022-01-21 14:41:25 -080011309/* Max size 32 is google.protobuf.FileOptions */
11310/* Max size 64 is google.protobuf.FileOptions */
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000011311#define _UPB_MAXOPT_SIZE UPB_SIZE(112, 200)
Joshua Habermanf41049a2022-01-21 14:41:25 -080011312
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011313#ifdef __cplusplus
11314} /* extern "C" */
11315#endif
11316
11317
11318#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */
Mike Kruskal232ecf42023-01-14 00:09:40 -080011319// end:github_only
Eric Salo8809a112022-11-21 13:01:06 -080011320
Protobuf Team Bot7dabac92023-09-07 18:35:50 +000011321typedef enum {
11322 kUpb_Syntax_Proto2 = 2,
11323 kUpb_Syntax_Proto3 = 3,
11324 kUpb_Syntax_Editions = 99
11325} upb_Syntax;
Eric Salo8809a112022-11-21 13:01:06 -080011326
11327// Forward declarations for circular references.
11328typedef struct upb_DefPool upb_DefPool;
11329typedef struct upb_EnumDef upb_EnumDef;
11330typedef struct upb_EnumReservedRange upb_EnumReservedRange;
11331typedef struct upb_EnumValueDef upb_EnumValueDef;
11332typedef struct upb_ExtensionRange upb_ExtensionRange;
11333typedef struct upb_FieldDef upb_FieldDef;
11334typedef struct upb_FileDef upb_FileDef;
11335typedef struct upb_MessageDef upb_MessageDef;
11336typedef struct upb_MessageReservedRange upb_MessageReservedRange;
11337typedef struct upb_MethodDef upb_MethodDef;
11338typedef struct upb_OneofDef upb_OneofDef;
11339typedef struct upb_ServiceDef upb_ServiceDef;
11340
11341// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
11342
11343typedef struct upb_DefBuilder upb_DefBuilder;
11344
11345#endif /* UPB_REFLECTION_COMMON_H_ */
11346
11347#ifndef UPB_REFLECTION_DEF_TYPE_H_
11348#define UPB_REFLECTION_DEF_TYPE_H_
11349
11350
11351// Must be last.
11352
11353// Inside a symtab we store tagged pointers to specific def types.
11354typedef enum {
11355 UPB_DEFTYPE_MASK = 7,
11356
11357 // Only inside symtab table.
11358 UPB_DEFTYPE_EXT = 0,
11359 UPB_DEFTYPE_MSG = 1,
11360 UPB_DEFTYPE_ENUM = 2,
11361 UPB_DEFTYPE_ENUMVAL = 3,
11362 UPB_DEFTYPE_SERVICE = 4,
11363
11364 // Only inside message table.
11365 UPB_DEFTYPE_FIELD = 0,
11366 UPB_DEFTYPE_ONEOF = 1,
Eric Salo8809a112022-11-21 13:01:06 -080011367} upb_deftype_t;
11368
11369#ifdef __cplusplus
11370extern "C" {
11371#endif
11372
11373// Our 3-bit pointer tagging requires all pointers to be multiples of 8.
11374// The arena will always yield 8-byte-aligned addresses, however we put
11375// the defs into arrays. For each element in the array to be 8-byte-aligned,
11376// the sizes of each def type must also be a multiple of 8.
11377//
11378// If any of these asserts fail, we need to add or remove padding on 32-bit
11379// machines (64-bit machines will have 8-byte alignment already due to
11380// pointers, which all of these structs have).
11381UPB_INLINE void _upb_DefType_CheckPadding(size_t size) {
11382 UPB_ASSERT((size & UPB_DEFTYPE_MASK) == 0);
11383}
11384
11385upb_deftype_t _upb_DefType_Type(upb_value v);
11386
11387upb_value _upb_DefType_Pack(const void* ptr, upb_deftype_t type);
11388
11389const void* _upb_DefType_Unpack(upb_value v, upb_deftype_t type);
11390
11391#ifdef __cplusplus
11392} /* extern "C" */
11393#endif
11394
11395
11396#endif /* UPB_REFLECTION_DEF_TYPE_H_ */
11397
11398// Must be last.
11399
11400#ifdef __cplusplus
11401extern "C" {
11402#endif
11403
Jason Lunn67dee292023-07-13 13:15:26 -070011404UPB_API void upb_DefPool_Free(upb_DefPool* s);
Eric Salo8809a112022-11-21 13:01:06 -080011405
Jason Lunn67dee292023-07-13 13:15:26 -070011406UPB_API upb_DefPool* upb_DefPool_New(void);
Eric Salo8809a112022-11-21 13:01:06 -080011407
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011408UPB_API const UPB_DESC(FeatureSetDefaults) *
11409 upb_DefPool_FeatureSetDefaults(const upb_DefPool* s);
11410
Protobuf Team Botc6b149c2023-11-10 23:37:46 +000011411UPB_API bool upb_DefPool_SetFeatureSetDefaults(upb_DefPool* s,
11412 const char* serialized_defaults,
11413 size_t serialized_len,
11414 upb_Status* status);
11415
Jason Lunn67dee292023-07-13 13:15:26 -070011416UPB_API const upb_MessageDef* upb_DefPool_FindMessageByName(
11417 const upb_DefPool* s, const char* sym);
Eric Salo8809a112022-11-21 13:01:06 -080011418
11419const upb_MessageDef* upb_DefPool_FindMessageByNameWithSize(
11420 const upb_DefPool* s, const char* sym, size_t len);
11421
Jason Lunn67dee292023-07-13 13:15:26 -070011422UPB_API const upb_EnumDef* upb_DefPool_FindEnumByName(const upb_DefPool* s,
11423 const char* sym);
Eric Salo8809a112022-11-21 13:01:06 -080011424
11425const upb_EnumValueDef* upb_DefPool_FindEnumByNameval(const upb_DefPool* s,
11426 const char* sym);
11427
11428const upb_FileDef* upb_DefPool_FindFileByName(const upb_DefPool* s,
11429 const char* name);
11430
11431const upb_FileDef* upb_DefPool_FindFileByNameWithSize(const upb_DefPool* s,
11432 const char* name,
11433 size_t len);
11434
11435const upb_FieldDef* upb_DefPool_FindExtensionByMiniTable(
11436 const upb_DefPool* s, const upb_MiniTableExtension* ext);
11437
Protobuf Team Bot8aad0582023-11-14 23:47:47 +000011438UPB_API const upb_FieldDef* upb_DefPool_FindExtensionByName(const upb_DefPool* s,
Eric Salo8809a112022-11-21 13:01:06 -080011439 const char* sym);
11440
11441const upb_FieldDef* upb_DefPool_FindExtensionByNameWithSize(
11442 const upb_DefPool* s, const char* name, size_t size);
11443
11444const upb_FieldDef* upb_DefPool_FindExtensionByNumber(const upb_DefPool* s,
11445 const upb_MessageDef* m,
11446 int32_t fieldnum);
11447
11448const upb_ServiceDef* upb_DefPool_FindServiceByName(const upb_DefPool* s,
11449 const char* name);
11450
11451const upb_ServiceDef* upb_DefPool_FindServiceByNameWithSize(
11452 const upb_DefPool* s, const char* name, size_t size);
11453
11454const upb_FileDef* upb_DefPool_FindFileContainingSymbol(const upb_DefPool* s,
11455 const char* name);
11456
Jason Lunn67dee292023-07-13 13:15:26 -070011457UPB_API const upb_FileDef* upb_DefPool_AddFile(
11458 upb_DefPool* s, const UPB_DESC(FileDescriptorProto) * file_proto,
11459 upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080011460
Protobuf Team Bot8aad0582023-11-14 23:47:47 +000011461UPB_API const upb_ExtensionRegistry* upb_DefPool_ExtensionRegistry(
Eric Salo8809a112022-11-21 13:01:06 -080011462 const upb_DefPool* s);
11463
11464const upb_FieldDef** upb_DefPool_GetAllExtensions(const upb_DefPool* s,
11465 const upb_MessageDef* m,
11466 size_t* count);
11467
11468#ifdef __cplusplus
11469} /* extern "C" */
11470#endif
11471
11472
11473#endif /* UPB_REFLECTION_DEF_POOL_H_ */
11474
Protobuf Team Bot06310352023-09-26 21:54:58 +000011475// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011476
11477#ifndef UPB_REFLECTION_ENUM_DEF_H_
11478#define UPB_REFLECTION_ENUM_DEF_H_
Joshua Habermand3995ec2022-09-30 16:54:39 -070011479
11480
11481// Must be last.
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011482
11483#ifdef __cplusplus
11484extern "C" {
Joshua Habermand3995ec2022-09-30 16:54:39 -070011485#endif
Joshua Haberman9abf6e22021-01-13 12:16:25 -080011486
Eric Salo8809a112022-11-21 13:01:06 -080011487bool upb_EnumDef_CheckNumber(const upb_EnumDef* e, int32_t num);
11488const upb_MessageDef* upb_EnumDef_ContainingType(const upb_EnumDef* e);
11489int32_t upb_EnumDef_Default(const upb_EnumDef* e);
Jason Lunn67dee292023-07-13 13:15:26 -070011490UPB_API const upb_FileDef* upb_EnumDef_File(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080011491const upb_EnumValueDef* upb_EnumDef_FindValueByName(const upb_EnumDef* e,
11492 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070011493UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080011494 const upb_EnumDef* e, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070011495UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNumber(
11496 const upb_EnumDef* e, int32_t num);
11497UPB_API const char* upb_EnumDef_FullName(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080011498bool upb_EnumDef_HasOptions(const upb_EnumDef* e);
11499bool upb_EnumDef_IsClosed(const upb_EnumDef* e);
11500
11501// Creates a mini descriptor string for an enum, returns true on success.
11502bool upb_EnumDef_MiniDescriptorEncode(const upb_EnumDef* e, upb_Arena* a,
11503 upb_StringView* out);
11504
11505const char* upb_EnumDef_Name(const upb_EnumDef* e);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011506const UPB_DESC(EnumOptions) * upb_EnumDef_Options(const upb_EnumDef* e);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011507const UPB_DESC(FeatureSet) * upb_EnumDef_ResolvedFeatures(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080011508
11509upb_StringView upb_EnumDef_ReservedName(const upb_EnumDef* e, int i);
11510int upb_EnumDef_ReservedNameCount(const upb_EnumDef* e);
11511
11512const upb_EnumReservedRange* upb_EnumDef_ReservedRange(const upb_EnumDef* e,
11513 int i);
11514int upb_EnumDef_ReservedRangeCount(const upb_EnumDef* e);
11515
Jason Lunn67dee292023-07-13 13:15:26 -070011516UPB_API const upb_EnumValueDef* upb_EnumDef_Value(const upb_EnumDef* e, int i);
11517UPB_API int upb_EnumDef_ValueCount(const upb_EnumDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080011518
11519#ifdef __cplusplus
11520} /* extern "C" */
11521#endif
11522
11523
11524#endif /* UPB_REFLECTION_ENUM_DEF_H_ */
11525
Protobuf Team Bot06310352023-09-26 21:54:58 +000011526// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011527
11528#ifndef UPB_REFLECTION_ENUM_VALUE_DEF_H_
11529#define UPB_REFLECTION_ENUM_VALUE_DEF_H_
11530
11531
11532// Must be last.
11533
11534#ifdef __cplusplus
11535extern "C" {
11536#endif
11537
11538const upb_EnumDef* upb_EnumValueDef_Enum(const upb_EnumValueDef* v);
11539const char* upb_EnumValueDef_FullName(const upb_EnumValueDef* v);
11540bool upb_EnumValueDef_HasOptions(const upb_EnumValueDef* v);
11541uint32_t upb_EnumValueDef_Index(const upb_EnumValueDef* v);
Jason Lunn67dee292023-07-13 13:15:26 -070011542UPB_API const char* upb_EnumValueDef_Name(const upb_EnumValueDef* v);
11543UPB_API int32_t upb_EnumValueDef_Number(const upb_EnumValueDef* v);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011544const UPB_DESC(EnumValueOptions) *
11545 upb_EnumValueDef_Options(const upb_EnumValueDef* v);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011546const UPB_DESC(FeatureSet) *
11547 upb_EnumValueDef_ResolvedFeatures(const upb_EnumValueDef* e);
Eric Salo8809a112022-11-21 13:01:06 -080011548
11549#ifdef __cplusplus
11550} /* extern "C" */
11551#endif
11552
11553
11554#endif /* UPB_REFLECTION_ENUM_VALUE_DEF_H_ */
11555
Protobuf Team Bot06310352023-09-26 21:54:58 +000011556// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011557
11558#ifndef UPB_REFLECTION_EXTENSION_RANGE_H_
11559#define UPB_REFLECTION_EXTENSION_RANGE_H_
11560
11561
11562// Must be last.
11563
11564#ifdef __cplusplus
11565extern "C" {
11566#endif
11567
11568int32_t upb_ExtensionRange_Start(const upb_ExtensionRange* r);
11569int32_t upb_ExtensionRange_End(const upb_ExtensionRange* r);
11570
11571bool upb_ExtensionRange_HasOptions(const upb_ExtensionRange* r);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011572const UPB_DESC(ExtensionRangeOptions) *
11573 upb_ExtensionRange_Options(const upb_ExtensionRange* r);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011574const UPB_DESC(FeatureSet) *
11575 upb_ExtensionRange_ResolvedFeatures(const upb_ExtensionRange* e);
Eric Salo8809a112022-11-21 13:01:06 -080011576
11577#ifdef __cplusplus
11578} /* extern "C" */
11579#endif
11580
11581
11582#endif /* UPB_REFLECTION_EXTENSION_RANGE_H_ */
11583
Protobuf Team Bot06310352023-09-26 21:54:58 +000011584// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011585
11586#ifndef UPB_REFLECTION_FIELD_DEF_H_
11587#define UPB_REFLECTION_FIELD_DEF_H_
11588
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011589#include <stdint.h>
11590
Eric Salo8809a112022-11-21 13:01:06 -080011591
11592// Must be last.
11593
11594// Maximum field number allowed for FieldDefs.
11595// This is an inherent limit of the protobuf wire format.
11596#define kUpb_MaxFieldNumber ((1 << 29) - 1)
11597
11598#ifdef __cplusplus
11599extern "C" {
11600#endif
11601
11602const upb_OneofDef* upb_FieldDef_ContainingOneof(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011603UPB_API const upb_MessageDef* upb_FieldDef_ContainingType(
11604 const upb_FieldDef* f);
11605UPB_API upb_CType upb_FieldDef_CType(const upb_FieldDef* f);
11606UPB_API upb_MessageValue upb_FieldDef_Default(const upb_FieldDef* f);
11607UPB_API const upb_EnumDef* upb_FieldDef_EnumSubDef(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011608const upb_MessageDef* upb_FieldDef_ExtensionScope(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011609UPB_API const upb_FileDef* upb_FieldDef_File(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011610const char* upb_FieldDef_FullName(const upb_FieldDef* f);
11611bool upb_FieldDef_HasDefault(const upb_FieldDef* f);
11612bool upb_FieldDef_HasJsonName(const upb_FieldDef* f);
11613bool upb_FieldDef_HasOptions(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011614UPB_API bool upb_FieldDef_HasPresence(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011615bool upb_FieldDef_HasSubDef(const upb_FieldDef* f);
11616uint32_t upb_FieldDef_Index(const upb_FieldDef* f);
11617bool upb_FieldDef_IsExtension(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011618UPB_API bool upb_FieldDef_IsMap(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011619bool upb_FieldDef_IsOptional(const upb_FieldDef* f);
Protobuf Team Botf2c187d2024-01-09 17:58:04 +000011620UPB_API bool upb_FieldDef_IsPacked(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011621bool upb_FieldDef_IsPrimitive(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011622UPB_API bool upb_FieldDef_IsRepeated(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011623bool upb_FieldDef_IsRequired(const upb_FieldDef* f);
11624bool upb_FieldDef_IsString(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011625UPB_API bool upb_FieldDef_IsSubMessage(const upb_FieldDef* f);
11626UPB_API const char* upb_FieldDef_JsonName(const upb_FieldDef* f);
11627UPB_API upb_Label upb_FieldDef_Label(const upb_FieldDef* f);
11628UPB_API const upb_MessageDef* upb_FieldDef_MessageSubDef(const upb_FieldDef* f);
Protobuf Team Botb58bd402023-09-19 15:42:34 +000011629bool _upb_FieldDef_ValidateUtf8(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011630
11631// Creates a mini descriptor string for a field, returns true on success.
11632bool upb_FieldDef_MiniDescriptorEncode(const upb_FieldDef* f, upb_Arena* a,
11633 upb_StringView* out);
11634
11635const upb_MiniTableField* upb_FieldDef_MiniTable(const upb_FieldDef* f);
Protobuf Team Bot4e90ead2024-01-08 15:46:34 +000011636const upb_MiniTableExtension* upb_FieldDef_MiniTableExtension(
11637 const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011638UPB_API const char* upb_FieldDef_Name(const upb_FieldDef* f);
11639UPB_API uint32_t upb_FieldDef_Number(const upb_FieldDef* f);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011640const UPB_DESC(FieldOptions) * upb_FieldDef_Options(const upb_FieldDef* f);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011641const UPB_DESC(FeatureSet) *
11642 upb_FieldDef_ResolvedFeatures(const upb_FieldDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011643UPB_API const upb_OneofDef* upb_FieldDef_RealContainingOneof(
11644 const upb_FieldDef* f);
11645UPB_API upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011646
11647#ifdef __cplusplus
11648} /* extern "C" */
11649#endif
11650
11651
11652#endif /* UPB_REFLECTION_FIELD_DEF_H_ */
11653
Protobuf Team Bot06310352023-09-26 21:54:58 +000011654// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011655
11656#ifndef UPB_REFLECTION_FILE_DEF_H_
11657#define UPB_REFLECTION_FILE_DEF_H_
11658
11659
11660// Must be last.
11661
11662#ifdef __cplusplus
11663extern "C" {
11664#endif
11665
Protobuf Team Botc6b149c2023-11-10 23:37:46 +000011666UPB_API const char* upb_FileDef_EditionName(int edition);
11667
Eric Salo8809a112022-11-21 13:01:06 -080011668const upb_FileDef* upb_FileDef_Dependency(const upb_FileDef* f, int i);
11669int upb_FileDef_DependencyCount(const upb_FileDef* f);
11670bool upb_FileDef_HasOptions(const upb_FileDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011671UPB_API const char* upb_FileDef_Name(const upb_FileDef* f);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011672const UPB_DESC(FileOptions) * upb_FileDef_Options(const upb_FileDef* f);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011673const UPB_DESC(FeatureSet) * upb_FileDef_ResolvedFeatures(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011674const char* upb_FileDef_Package(const upb_FileDef* f);
Protobuf Team Bot7dabac92023-09-07 18:35:50 +000011675UPB_DESC(Edition) upb_FileDef_Edition(const upb_FileDef* f);
Jason Lunn67dee292023-07-13 13:15:26 -070011676UPB_API const upb_DefPool* upb_FileDef_Pool(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011677
11678const upb_FileDef* upb_FileDef_PublicDependency(const upb_FileDef* f, int i);
11679int upb_FileDef_PublicDependencyCount(const upb_FileDef* f);
11680
11681const upb_ServiceDef* upb_FileDef_Service(const upb_FileDef* f, int i);
11682int upb_FileDef_ServiceCount(const upb_FileDef* f);
11683
Jason Lunn67dee292023-07-13 13:15:26 -070011684UPB_API upb_Syntax upb_FileDef_Syntax(const upb_FileDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080011685
11686const upb_EnumDef* upb_FileDef_TopLevelEnum(const upb_FileDef* f, int i);
11687int upb_FileDef_TopLevelEnumCount(const upb_FileDef* f);
11688
11689const upb_FieldDef* upb_FileDef_TopLevelExtension(const upb_FileDef* f, int i);
11690int upb_FileDef_TopLevelExtensionCount(const upb_FileDef* f);
11691
11692const upb_MessageDef* upb_FileDef_TopLevelMessage(const upb_FileDef* f, int i);
11693int upb_FileDef_TopLevelMessageCount(const upb_FileDef* f);
11694
11695const upb_FileDef* upb_FileDef_WeakDependency(const upb_FileDef* f, int i);
11696int upb_FileDef_WeakDependencyCount(const upb_FileDef* f);
11697
11698#ifdef __cplusplus
11699} /* extern "C" */
11700#endif
11701
11702
11703#endif /* UPB_REFLECTION_FILE_DEF_H_ */
11704
Protobuf Team Bot06310352023-09-26 21:54:58 +000011705// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011706
11707#ifndef UPB_REFLECTION_MESSAGE_DEF_H_
11708#define UPB_REFLECTION_MESSAGE_DEF_H_
11709
11710
11711// Must be last.
11712
11713// Well-known field tag numbers for map-entry messages.
11714#define kUpb_MapEntry_KeyFieldNumber 1
11715#define kUpb_MapEntry_ValueFieldNumber 2
11716
11717// Well-known field tag numbers for Any messages.
11718#define kUpb_Any_TypeFieldNumber 1
11719#define kUpb_Any_ValueFieldNumber 2
11720
11721// Well-known field tag numbers for duration messages.
11722#define kUpb_Duration_SecondsFieldNumber 1
11723#define kUpb_Duration_NanosFieldNumber 2
11724
11725// Well-known field tag numbers for timestamp messages.
11726#define kUpb_Timestamp_SecondsFieldNumber 1
11727#define kUpb_Timestamp_NanosFieldNumber 2
11728
11729// All the different kind of well known type messages. For simplicity of check,
11730// number wrappers and string wrappers are grouped together. Make sure the
11731// order and number of these groups are not changed.
11732typedef enum {
11733 kUpb_WellKnown_Unspecified,
11734 kUpb_WellKnown_Any,
11735 kUpb_WellKnown_FieldMask,
11736 kUpb_WellKnown_Duration,
11737 kUpb_WellKnown_Timestamp,
11738
11739 // number wrappers
11740 kUpb_WellKnown_DoubleValue,
11741 kUpb_WellKnown_FloatValue,
11742 kUpb_WellKnown_Int64Value,
11743 kUpb_WellKnown_UInt64Value,
11744 kUpb_WellKnown_Int32Value,
11745 kUpb_WellKnown_UInt32Value,
11746
11747 // string wrappers
11748 kUpb_WellKnown_StringValue,
11749 kUpb_WellKnown_BytesValue,
11750 kUpb_WellKnown_BoolValue,
11751 kUpb_WellKnown_Value,
11752 kUpb_WellKnown_ListValue,
11753 kUpb_WellKnown_Struct,
11754} upb_WellKnown;
11755
11756#ifdef __cplusplus
11757extern "C" {
11758#endif
11759
11760const upb_MessageDef* upb_MessageDef_ContainingType(const upb_MessageDef* m);
11761
11762const upb_ExtensionRange* upb_MessageDef_ExtensionRange(const upb_MessageDef* m,
11763 int i);
11764int upb_MessageDef_ExtensionRangeCount(const upb_MessageDef* m);
11765
Jason Lunn67dee292023-07-13 13:15:26 -070011766UPB_API const upb_FieldDef* upb_MessageDef_Field(const upb_MessageDef* m,
11767 int i);
11768UPB_API int upb_MessageDef_FieldCount(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011769
Jason Lunn67dee292023-07-13 13:15:26 -070011770UPB_API const upb_FileDef* upb_MessageDef_File(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011771
11772// Returns a field by either JSON name or regular proto name.
11773const upb_FieldDef* upb_MessageDef_FindByJsonNameWithSize(
11774 const upb_MessageDef* m, const char* name, size_t size);
11775UPB_INLINE const upb_FieldDef* upb_MessageDef_FindByJsonName(
11776 const upb_MessageDef* m, const char* name) {
11777 return upb_MessageDef_FindByJsonNameWithSize(m, name, strlen(name));
11778}
11779
11780// Lookup of either field or oneof by name. Returns whether either was found.
11781// If the return is true, then the found def will be set, and the non-found
11782// one set to NULL.
Jason Lunn67dee292023-07-13 13:15:26 -070011783UPB_API bool upb_MessageDef_FindByNameWithSize(const upb_MessageDef* m,
11784 const char* name, size_t size,
11785 const upb_FieldDef** f,
11786 const upb_OneofDef** o);
Eric Salo8809a112022-11-21 13:01:06 -080011787UPB_INLINE bool upb_MessageDef_FindByName(const upb_MessageDef* m,
11788 const char* name,
11789 const upb_FieldDef** f,
11790 const upb_OneofDef** o) {
11791 return upb_MessageDef_FindByNameWithSize(m, name, strlen(name), f, o);
11792}
11793
11794const upb_FieldDef* upb_MessageDef_FindFieldByName(const upb_MessageDef* m,
11795 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070011796UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080011797 const upb_MessageDef* m, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070011798UPB_API const upb_FieldDef* upb_MessageDef_FindFieldByNumber(
11799 const upb_MessageDef* m, uint32_t i);
Eric Salo8809a112022-11-21 13:01:06 -080011800const upb_OneofDef* upb_MessageDef_FindOneofByName(const upb_MessageDef* m,
11801 const char* name);
Jason Lunn67dee292023-07-13 13:15:26 -070011802UPB_API const upb_OneofDef* upb_MessageDef_FindOneofByNameWithSize(
Eric Salo8809a112022-11-21 13:01:06 -080011803 const upb_MessageDef* m, const char* name, size_t size);
Jason Lunn67dee292023-07-13 13:15:26 -070011804UPB_API const char* upb_MessageDef_FullName(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011805bool upb_MessageDef_HasOptions(const upb_MessageDef* m);
11806bool upb_MessageDef_IsMapEntry(const upb_MessageDef* m);
11807bool upb_MessageDef_IsMessageSet(const upb_MessageDef* m);
11808
11809// Creates a mini descriptor string for a message, returns true on success.
11810bool upb_MessageDef_MiniDescriptorEncode(const upb_MessageDef* m, upb_Arena* a,
11811 upb_StringView* out);
11812
Jason Lunn67dee292023-07-13 13:15:26 -070011813UPB_API const upb_MiniTable* upb_MessageDef_MiniTable(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011814const char* upb_MessageDef_Name(const upb_MessageDef* m);
11815
11816const upb_EnumDef* upb_MessageDef_NestedEnum(const upb_MessageDef* m, int i);
11817const upb_FieldDef* upb_MessageDef_NestedExtension(const upb_MessageDef* m,
11818 int i);
11819const upb_MessageDef* upb_MessageDef_NestedMessage(const upb_MessageDef* m,
11820 int i);
11821
11822int upb_MessageDef_NestedEnumCount(const upb_MessageDef* m);
11823int upb_MessageDef_NestedExtensionCount(const upb_MessageDef* m);
11824int upb_MessageDef_NestedMessageCount(const upb_MessageDef* m);
11825
Jason Lunn67dee292023-07-13 13:15:26 -070011826UPB_API const upb_OneofDef* upb_MessageDef_Oneof(const upb_MessageDef* m,
11827 int i);
11828UPB_API int upb_MessageDef_OneofCount(const upb_MessageDef* m);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011829int upb_MessageDef_RealOneofCount(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011830
Mike Kruskal232ecf42023-01-14 00:09:40 -080011831const UPB_DESC(MessageOptions) *
11832 upb_MessageDef_Options(const upb_MessageDef* m);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011833const UPB_DESC(FeatureSet) *
11834 upb_MessageDef_ResolvedFeatures(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011835
11836upb_StringView upb_MessageDef_ReservedName(const upb_MessageDef* m, int i);
11837int upb_MessageDef_ReservedNameCount(const upb_MessageDef* m);
11838
11839const upb_MessageReservedRange* upb_MessageDef_ReservedRange(
11840 const upb_MessageDef* m, int i);
11841int upb_MessageDef_ReservedRangeCount(const upb_MessageDef* m);
11842
Jason Lunn67dee292023-07-13 13:15:26 -070011843UPB_API upb_Syntax upb_MessageDef_Syntax(const upb_MessageDef* m);
11844UPB_API upb_WellKnown upb_MessageDef_WellKnownType(const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011845
11846#ifdef __cplusplus
11847} /* extern "C" */
11848#endif
11849
11850
11851#endif /* UPB_REFLECTION_MESSAGE_DEF_H_ */
11852
Protobuf Team Bot06310352023-09-26 21:54:58 +000011853// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011854
11855#ifndef UPB_REFLECTION_METHOD_DEF_H_
11856#define UPB_REFLECTION_METHOD_DEF_H_
11857
11858
11859// Must be last.
11860
11861#ifdef __cplusplus
11862extern "C" {
11863#endif
11864
11865bool upb_MethodDef_ClientStreaming(const upb_MethodDef* m);
11866const char* upb_MethodDef_FullName(const upb_MethodDef* m);
11867bool upb_MethodDef_HasOptions(const upb_MethodDef* m);
11868int upb_MethodDef_Index(const upb_MethodDef* m);
11869const upb_MessageDef* upb_MethodDef_InputType(const upb_MethodDef* m);
11870const char* upb_MethodDef_Name(const upb_MethodDef* m);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011871const UPB_DESC(MethodOptions) * upb_MethodDef_Options(const upb_MethodDef* m);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011872const UPB_DESC(FeatureSet) *
11873 upb_MethodDef_ResolvedFeatures(const upb_MethodDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080011874const upb_MessageDef* upb_MethodDef_OutputType(const upb_MethodDef* m);
11875bool upb_MethodDef_ServerStreaming(const upb_MethodDef* m);
11876const upb_ServiceDef* upb_MethodDef_Service(const upb_MethodDef* m);
11877
11878#ifdef __cplusplus
11879} /* extern "C" */
11880#endif
11881
11882
11883#endif /* UPB_REFLECTION_METHOD_DEF_H_ */
11884
Protobuf Team Bot06310352023-09-26 21:54:58 +000011885// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011886
11887#ifndef UPB_REFLECTION_ONEOF_DEF_H_
11888#define UPB_REFLECTION_ONEOF_DEF_H_
11889
11890
11891// Must be last.
11892
11893#ifdef __cplusplus
11894extern "C" {
11895#endif
11896
Jason Lunn67dee292023-07-13 13:15:26 -070011897UPB_API const upb_MessageDef* upb_OneofDef_ContainingType(
11898 const upb_OneofDef* o);
11899UPB_API const upb_FieldDef* upb_OneofDef_Field(const upb_OneofDef* o, int i);
11900UPB_API int upb_OneofDef_FieldCount(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011901const char* upb_OneofDef_FullName(const upb_OneofDef* o);
11902bool upb_OneofDef_HasOptions(const upb_OneofDef* o);
11903uint32_t upb_OneofDef_Index(const upb_OneofDef* o);
11904bool upb_OneofDef_IsSynthetic(const upb_OneofDef* o);
11905const upb_FieldDef* upb_OneofDef_LookupName(const upb_OneofDef* o,
11906 const char* name);
11907const upb_FieldDef* upb_OneofDef_LookupNameWithSize(const upb_OneofDef* o,
11908 const char* name,
11909 size_t size);
11910const upb_FieldDef* upb_OneofDef_LookupNumber(const upb_OneofDef* o,
11911 uint32_t num);
Jason Lunn67dee292023-07-13 13:15:26 -070011912UPB_API const char* upb_OneofDef_Name(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011913int upb_OneofDef_numfields(const upb_OneofDef* o);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011914const UPB_DESC(OneofOptions*) upb_OneofDef_Options(const upb_OneofDef* o);
11915const UPB_DESC(FeatureSet*)
11916 upb_OneofDef_ResolvedFeatures(const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080011917
11918#ifdef __cplusplus
11919} /* extern "C" */
11920#endif
11921
11922
11923#endif /* UPB_REFLECTION_ONEOF_DEF_H_ */
11924
Protobuf Team Bot06310352023-09-26 21:54:58 +000011925// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080011926
11927#ifndef UPB_REFLECTION_SERVICE_DEF_H_
11928#define UPB_REFLECTION_SERVICE_DEF_H_
11929
11930
11931// Must be last.
11932
11933#ifdef __cplusplus
11934extern "C" {
11935#endif
11936
11937const upb_FileDef* upb_ServiceDef_File(const upb_ServiceDef* s);
11938const upb_MethodDef* upb_ServiceDef_FindMethodByName(const upb_ServiceDef* s,
11939 const char* name);
11940const char* upb_ServiceDef_FullName(const upb_ServiceDef* s);
11941bool upb_ServiceDef_HasOptions(const upb_ServiceDef* s);
11942int upb_ServiceDef_Index(const upb_ServiceDef* s);
11943const upb_MethodDef* upb_ServiceDef_Method(const upb_ServiceDef* s, int i);
11944int upb_ServiceDef_MethodCount(const upb_ServiceDef* s);
11945const char* upb_ServiceDef_Name(const upb_ServiceDef* s);
Mike Kruskal232ecf42023-01-14 00:09:40 -080011946const UPB_DESC(ServiceOptions) *
11947 upb_ServiceDef_Options(const upb_ServiceDef* s);
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000011948const UPB_DESC(FeatureSet) *
11949 upb_ServiceDef_ResolvedFeatures(const upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080011950
11951#ifdef __cplusplus
11952} /* extern "C" */
11953#endif
11954
11955
11956#endif /* UPB_REFLECTION_SERVICE_DEF_H_ */
Protobuf Team Botffc56ba2023-09-08 15:29:06 +000011957// IWYU pragma: end_exports
Eric Salo8809a112022-11-21 13:01:06 -080011958
11959#endif /* UPB_REFLECTION_DEF_H_ */
11960
11961// Must be last.
11962
11963#ifdef __cplusplus
11964extern "C" {
11965#endif
11966
11967enum { upb_JsonDecode_IgnoreUnknown = 1 };
11968
Jason Lunn67dee292023-07-13 13:15:26 -070011969UPB_API bool upb_JsonDecode(const char* buf, size_t size, upb_Message* msg,
11970 const upb_MessageDef* m, const upb_DefPool* symtab,
11971 int options, upb_Arena* arena, upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080011972
11973#ifdef __cplusplus
11974} /* extern "C" */
11975#endif
11976
11977
11978#endif /* UPB_JSONDECODE_H_ */
11979
11980#ifndef UPB_LEX_ATOI_H_
11981#define UPB_LEX_ATOI_H_
11982
Adam Cozzette7d5592e2023-08-23 12:15:26 -070011983#include <stdint.h>
11984
Eric Salo8809a112022-11-21 13:01:06 -080011985// Must be last.
11986
11987#ifdef __cplusplus
11988extern "C" {
11989#endif
11990
11991// We use these hand-written routines instead of strto[u]l() because the "long
11992// long" variants aren't in c89. Also our version allows setting a ptr limit.
11993// Return the new position of the pointer after parsing the int, or NULL on
11994// integer overflow.
11995
11996const char* upb_BufToUint64(const char* ptr, const char* end, uint64_t* val);
11997const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val,
11998 bool* is_neg);
11999
12000#ifdef __cplusplus
12001} /* extern "C" */
12002#endif
12003
12004
12005#endif /* UPB_LEX_ATOI_H_ */
12006
12007#ifndef UPB_LEX_UNICODE_H_
12008#define UPB_LEX_UNICODE_H_
12009
Adam Cozzette7d5592e2023-08-23 12:15:26 -070012010#include <stdint.h>
12011
Eric Salo8809a112022-11-21 13:01:06 -080012012// Must be last.
12013
12014#ifdef __cplusplus
12015extern "C" {
12016#endif
12017
12018// Returns true iff a codepoint is the value for a high surrogate.
12019UPB_INLINE bool upb_Unicode_IsHigh(uint32_t cp) {
12020 return (cp >= 0xd800 && cp <= 0xdbff);
12021}
12022
12023// Returns true iff a codepoint is the value for a low surrogate.
12024UPB_INLINE bool upb_Unicode_IsLow(uint32_t cp) {
12025 return (cp >= 0xdc00 && cp <= 0xdfff);
12026}
12027
12028// Returns the high 16-bit surrogate value for a supplementary codepoint.
12029// Does not sanity-check the input.
12030UPB_INLINE uint16_t upb_Unicode_ToHigh(uint32_t cp) {
12031 return (cp >> 10) + 0xd7c0;
12032}
12033
12034// Returns the low 16-bit surrogate value for a supplementary codepoint.
12035// Does not sanity-check the input.
12036UPB_INLINE uint16_t upb_Unicode_ToLow(uint32_t cp) {
12037 return (cp & 0x3ff) | 0xdc00;
12038}
12039
12040// Returns the 32-bit value corresponding to a pair of 16-bit surrogates.
12041// Does not sanity-check the input.
12042UPB_INLINE uint32_t upb_Unicode_FromPair(uint32_t high, uint32_t low) {
12043 return ((high & 0x3ff) << 10) + (low & 0x3ff) + 0x10000;
12044}
12045
12046// Outputs a codepoint as UTF8.
12047// Returns the number of bytes written (1-4 on success, 0 on error).
12048// Does not sanity-check the input. Specifically does not check for surrogates.
12049int upb_Unicode_ToUTF8(uint32_t cp, char* out);
12050
12051#ifdef __cplusplus
12052} /* extern "C" */
12053#endif
12054
12055
12056#endif /* UPB_LEX_UNICODE_H_ */
12057
12058#ifndef UPB_REFLECTION_MESSAGE_H_
12059#define UPB_REFLECTION_MESSAGE_H_
12060
Protobuf Team Bot473d20d2023-09-15 22:27:16 +000012061#include <stddef.h>
12062
Eric Salo8809a112022-11-21 13:01:06 -080012063
12064// Must be last.
12065
12066#ifdef __cplusplus
12067extern "C" {
12068#endif
12069
Eric Salo3f36a912022-12-05 14:12:25 -080012070// Returns a mutable pointer to a map, array, or submessage value. If the given
12071// arena is non-NULL this will construct a new object if it was not previously
12072// present. May not be called for primitive fields.
Jason Lunn67dee292023-07-13 13:15:26 -070012073UPB_API upb_MutableMessageValue upb_Message_Mutable(upb_Message* msg,
12074 const upb_FieldDef* f,
12075 upb_Arena* a);
Eric Salo8809a112022-11-21 13:01:06 -080012076
Eric Salo3f36a912022-12-05 14:12:25 -080012077// Returns the field that is set in the oneof, or NULL if none are set.
Jason Lunn67dee292023-07-13 13:15:26 -070012078UPB_API const upb_FieldDef* upb_Message_WhichOneof(const upb_Message* msg,
12079 const upb_OneofDef* o);
Eric Salo8809a112022-11-21 13:01:06 -080012080
Eric Salo3f36a912022-12-05 14:12:25 -080012081// Clear all data and unknown fields.
12082void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080012083
Eric Salo3f36a912022-12-05 14:12:25 -080012084// Clears any field presence and sets the value back to its default.
Jason Lunn67dee292023-07-13 13:15:26 -070012085UPB_API void upb_Message_ClearFieldByDef(upb_Message* msg,
12086 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080012087
Eric Salo3f36a912022-12-05 14:12:25 -080012088// May only be called for fields where upb_FieldDef_HasPresence(f) == true.
Jason Lunn67dee292023-07-13 13:15:26 -070012089UPB_API bool upb_Message_HasFieldByDef(const upb_Message* msg,
12090 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080012091
Eric Salo3f36a912022-12-05 14:12:25 -080012092// Returns the value in the message associated with this field def.
Jason Lunn67dee292023-07-13 13:15:26 -070012093UPB_API upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg,
12094 const upb_FieldDef* f);
Eric Salo3f36a912022-12-05 14:12:25 -080012095
12096// Sets the given field to the given value. For a msg/array/map/string, the
12097// caller must ensure that the target data outlives |msg| (by living either in
12098// the same arena or a different arena that outlives it).
12099//
12100// Returns false if allocation fails.
Jason Lunn67dee292023-07-13 13:15:26 -070012101UPB_API bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f,
12102 upb_MessageValue val, upb_Arena* a);
Eric Salo3f36a912022-12-05 14:12:25 -080012103
12104// Iterate over present fields.
12105//
12106// size_t iter = kUpb_Message_Begin;
12107// const upb_FieldDef *f;
12108// upb_MessageValue val;
12109// while (upb_Message_Next(msg, m, ext_pool, &f, &val, &iter)) {
12110// process_field(f, val);
12111// }
12112//
12113// If ext_pool is NULL, no extensions will be returned. If the given symtab
12114// returns extensions that don't match what is in this message, those extensions
12115// will be skipped.
Eric Salo8809a112022-11-21 13:01:06 -080012116
12117#define kUpb_Message_Begin -1
Eric Salo3f36a912022-12-05 14:12:25 -080012118
Protobuf Team Bot7e324502024-01-04 18:12:49 +000012119UPB_API bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m,
12120 const upb_DefPool* ext_pool,
12121 const upb_FieldDef** f, upb_MessageValue* val,
12122 size_t* iter);
Eric Salo8809a112022-11-21 13:01:06 -080012123
Eric Salo3f36a912022-12-05 14:12:25 -080012124// Clears all unknown field data from this message and all submessages.
Jason Lunn67dee292023-07-13 13:15:26 -070012125UPB_API bool upb_Message_DiscardUnknown(upb_Message* msg,
12126 const upb_MessageDef* m, int maxdepth);
Eric Salo8809a112022-11-21 13:01:06 -080012127
12128#ifdef __cplusplus
12129} /* extern "C" */
12130#endif
12131
12132
12133#endif /* UPB_REFLECTION_MESSAGE_H_ */
12134
12135#ifndef UPB_JSON_ENCODE_H_
12136#define UPB_JSON_ENCODE_H_
12137
12138
12139// Must be last.
12140
12141#ifdef __cplusplus
12142extern "C" {
12143#endif
12144
12145enum {
Protobuf Team Bot986cbb62023-09-19 15:03:51 +000012146 /* When set, emits 0/default values. TODO: proto3 only? */
Eric Salo8809a112022-11-21 13:01:06 -080012147 upb_JsonEncode_EmitDefaults = 1 << 0,
12148
12149 /* When set, use normal (snake_case) field names instead of JSON (camelCase)
12150 names. */
12151 upb_JsonEncode_UseProtoNames = 1 << 1,
12152
12153 /* When set, emits enums as their integer values instead of as their names. */
12154 upb_JsonEncode_FormatEnumsAsIntegers = 1 << 2
12155};
12156
12157/* Encodes the given |msg| to JSON format. The message's reflection is given in
Protobuf Team Botad884532023-09-05 18:31:02 +000012158 * |m|. The DefPool in |ext_pool| is used to find extensions (if NULL,
12159 * extensions will not be printed).
Eric Salo8809a112022-11-21 13:01:06 -080012160 *
12161 * Output is placed in the given buffer, and always NULL-terminated. The output
12162 * size (excluding NULL) is returned. This means that a return value >= |size|
12163 * implies that the output was truncated. (These are the same semantics as
12164 * snprintf()). */
Jason Lunn67dee292023-07-13 13:15:26 -070012165UPB_API size_t upb_JsonEncode(const upb_Message* msg, const upb_MessageDef* m,
12166 const upb_DefPool* ext_pool, int options,
12167 char* buf, size_t size, upb_Status* status);
Eric Salo8809a112022-11-21 13:01:06 -080012168
12169#ifdef __cplusplus
12170} /* extern "C" */
12171#endif
12172
12173
12174#endif /* UPB_JSONENCODE_H_ */
12175
12176#ifndef UPB_LEX_ROUND_TRIP_H_
12177#define UPB_LEX_ROUND_TRIP_H_
12178
12179// Must be last.
12180
12181// Encodes a float or double that is round-trippable, but as short as possible.
12182// These routines are not fully optimal (not guaranteed to be shortest), but are
12183// short-ish and match the implementation that has been used in protobuf since
12184// the beginning.
12185
12186// The given buffer size must be at least kUpb_RoundTripBufferSize.
12187enum { kUpb_RoundTripBufferSize = 32 };
12188
12189#ifdef __cplusplus
12190extern "C" {
12191#endif
12192
12193void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size);
12194void _upb_EncodeRoundTripFloat(float val, char* buf, size_t size);
12195
12196#ifdef __cplusplus
12197} /* extern "C" */
12198#endif
12199
12200
12201#endif /* UPB_LEX_ROUND_TRIP_H_ */
12202
12203#ifndef UPB_PORT_VSNPRINTF_COMPAT_H_
12204#define UPB_PORT_VSNPRINTF_COMPAT_H_
12205
12206// Must be last.
12207
12208UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt,
12209 va_list ap) {
12210#if defined(__MINGW64__) || defined(__MINGW32__) || defined(_MSC_VER)
12211 // The msvc runtime has a non-conforming vsnprintf() that requires the
12212 // following compatibility code to become conformant.
12213 int n = -1;
12214 if (size != 0) n = _vsnprintf_s(buf, size, _TRUNCATE, fmt, ap);
12215 if (n == -1) n = _vscprintf(fmt, ap);
12216 return n;
12217#else
12218 return vsnprintf(buf, size, fmt, ap);
12219#endif
12220}
12221
12222
12223#endif // UPB_PORT_VSNPRINTF_COMPAT_H_
12224
Eric Salodfb71552023-03-22 12:35:09 -070012225#ifndef UPB_PORT_ATOMIC_H_
12226#define UPB_PORT_ATOMIC_H_
12227
12228
12229#ifdef UPB_USE_C11_ATOMICS
12230
Protobuf Team Bot743bf922023-09-14 01:12:11 +000012231// IWYU pragma: begin_exports
Eric Salodfb71552023-03-22 12:35:09 -070012232#include <stdatomic.h>
12233#include <stdbool.h>
Protobuf Team Bot743bf922023-09-14 01:12:11 +000012234// IWYU pragma: end_exports
Eric Salodfb71552023-03-22 12:35:09 -070012235
Deanna Garciac7d979d2023-04-14 17:22:13 -070012236#define upb_Atomic_Init(addr, val) atomic_init(addr, val)
12237#define upb_Atomic_Load(addr, order) atomic_load_explicit(addr, order)
12238#define upb_Atomic_Store(addr, val, order) \
12239 atomic_store_explicit(addr, val, order)
12240#define upb_Atomic_Add(addr, val, order) \
12241 atomic_fetch_add_explicit(addr, val, order)
12242#define upb_Atomic_Sub(addr, val, order) \
Deanna Garciabd6a0cf2023-04-20 10:30:44 -070012243 atomic_fetch_sub_explicit(addr, val, order)
12244#define upb_Atomic_Exchange(addr, val, order) \
12245 atomic_exchange_explicit(addr, val, order)
Deanna Garciac7d979d2023-04-14 17:22:13 -070012246#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \
12247 success_order, failure_order) \
12248 atomic_compare_exchange_strong_explicit(addr, expected, desired, \
12249 success_order, failure_order)
12250#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \
12251 failure_order) \
12252 atomic_compare_exchange_weak_explicit(addr, expected, desired, \
12253 success_order, failure_order)
Eric Salodfb71552023-03-22 12:35:09 -070012254
12255#else // !UPB_USE_C11_ATOMICS
12256
Deanna Garciac7d979d2023-04-14 17:22:13 -070012257#include <string.h>
Eric Salodfb71552023-03-22 12:35:09 -070012258
Deanna Garciac7d979d2023-04-14 17:22:13 -070012259#define upb_Atomic_Init(addr, val) (*addr = val)
12260#define upb_Atomic_Load(addr, order) (*addr)
12261#define upb_Atomic_Store(addr, val, order) (*(addr) = val)
12262#define upb_Atomic_Add(addr, val, order) (*(addr) += val)
12263#define upb_Atomic_Sub(addr, val, order) (*(addr) -= val)
Eric Salodfb71552023-03-22 12:35:09 -070012264
Deanna Garciabd6a0cf2023-04-20 10:30:44 -070012265UPB_INLINE void* _upb_NonAtomic_Exchange(void* addr, void* value) {
12266 void* old;
12267 memcpy(&old, addr, sizeof(value));
12268 memcpy(addr, &value, sizeof(value));
12269 return old;
12270}
12271
12272#define upb_Atomic_Exchange(addr, val, order) _upb_NonAtomic_Exchange(addr, val)
12273
Deanna Garciac7d979d2023-04-14 17:22:13 -070012274// `addr` and `expected` are logically double pointers.
12275UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr,
12276 void* expected,
12277 void* desired) {
12278 if (memcmp(addr, expected, sizeof(desired)) == 0) {
12279 memcpy(addr, &desired, sizeof(desired));
Eric Salodfb71552023-03-22 12:35:09 -070012280 return true;
12281 } else {
Deanna Garciac7d979d2023-04-14 17:22:13 -070012282 memcpy(expected, addr, sizeof(desired));
Eric Salodfb71552023-03-22 12:35:09 -070012283 return false;
12284 }
12285}
12286
Deanna Garciac7d979d2023-04-14 17:22:13 -070012287#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \
12288 success_order, failure_order) \
12289 _upb_NonAtomic_CompareExchangeStrongP((void*)addr, (void*)expected, \
12290 (void*)desired)
12291#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \
12292 failure_order) \
12293 upb_Atomic_CompareExchangeStrong(addr, expected, desired, 0, 0)
12294
Eric Salodfb71552023-03-22 12:35:09 -070012295#endif
12296
12297
12298#endif // UPB_PORT_ATOMIC_H_
12299
Protobuf Team Bot95d7dc02023-12-13 04:09:17 +000012300#ifndef UPB_MESSAGE_COMPAT_H_
12301#define UPB_MESSAGE_COMPAT_H_
12302
12303#include <stdint.h>
12304
12305
12306// Must be last.
12307
12308// upb does not support mixing minitables from different sources but these
12309// functions are still used by some existing users so for now we make them
12310// available here. This may or may not change in the future so do not add
12311// them to new code.
12312
12313#ifdef __cplusplus
12314extern "C" {
12315#endif
12316
Protobuf Team Bot64441a22024-01-23 23:46:32 +000012317const upb_MiniTableExtension* upb_Message_ExtensionByIndex(
12318 const upb_Message* msg, size_t index);
Protobuf Team Botf2845222023-12-19 04:57:32 +000012319
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012320// Returns the minitable with the given field number, or NULL on failure.
12321const upb_MiniTableExtension* upb_Message_FindExtensionByNumber(
12322 const upb_Message* msg, uint32_t field_number);
Protobuf Team Bot95d7dc02023-12-13 04:09:17 +000012323
12324#ifdef __cplusplus
12325} /* extern "C" */
12326#endif
12327
12328
12329#endif /* UPB_MESSAGE_COMPAT_H_ */
12330
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012331// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
12332
Protobuf Team Bot5b343372023-12-19 06:18:53 +000012333#ifndef UPB_MESSAGE_INTERNAL_MAP_SORTER_H_
12334#define UPB_MESSAGE_INTERNAL_MAP_SORTER_H_
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012335
12336#include <stdlib.h>
12337
12338
Protobuf Team Botc12c96e2024-01-16 07:41:08 +000012339#ifndef UPB_MESSAGE_INTERNAL_MAP_ENTRY_H_
12340#define UPB_MESSAGE_INTERNAL_MAP_ENTRY_H_
Protobuf Team Bot5b343372023-12-19 06:18:53 +000012341
12342#include <stdint.h>
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012343
12344
12345// Map entries aren't actually stored for map fields, they are only used during
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012346// parsing. (It helps a lot if all map entry messages have the same layout.)
12347// The mini_table layout code will ensure that all map entries have this layout.
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012348//
12349// Note that users can and do create map entries directly, which will also use
12350// this layout.
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012351
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012352typedef struct {
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012353 struct upb_Message message;
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012354 // We only need 2 hasbits max, but due to alignment we'll use 8 bytes here,
12355 // and the uint64_t helps make this clear.
12356 uint64_t hasbits;
12357 union {
12358 upb_StringView str; // For str/bytes.
12359 upb_value val; // For all other types.
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012360 double d[2]; // Padding for 32-bit builds.
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012361 } k;
12362 union {
12363 upb_StringView str; // For str/bytes.
12364 upb_value val; // For all other types.
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012365 double d[2]; // Padding for 32-bit builds.
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012366 } v;
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012367} upb_MapEntry;
12368
Protobuf Team Botc12c96e2024-01-16 07:41:08 +000012369#endif // UPB_MESSAGE_INTERNAL_MAP_ENTRY_H_
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012370
12371// Must be last.
12372
12373#ifdef __cplusplus
12374extern "C" {
12375#endif
12376
12377// _upb_mapsorter sorts maps and provides ordered iteration over the entries.
12378// Since maps can be recursive (map values can be messages which contain other
12379// maps), _upb_mapsorter can contain a stack of maps.
12380
12381typedef struct {
12382 void const** entries;
12383 int size;
12384 int cap;
12385} _upb_mapsorter;
12386
12387typedef struct {
12388 int start;
12389 int pos;
12390 int end;
12391} _upb_sortedmap;
12392
12393UPB_INLINE void _upb_mapsorter_init(_upb_mapsorter* s) {
12394 s->entries = NULL;
12395 s->size = 0;
12396 s->cap = 0;
12397}
12398
12399UPB_INLINE void _upb_mapsorter_destroy(_upb_mapsorter* s) {
Protobuf Team Botddc54062023-12-12 20:03:38 +000012400 if (s->entries) upb_gfree(s->entries);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012401}
12402
Protobuf Team Bot499c7482023-12-30 01:42:17 +000012403UPB_INLINE bool _upb_sortedmap_next(_upb_mapsorter* s,
12404 const struct upb_Map* map,
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012405 _upb_sortedmap* sorted, upb_MapEntry* ent) {
12406 if (sorted->pos == sorted->end) return false;
12407 const upb_tabent* tabent = (const upb_tabent*)s->entries[sorted->pos++];
12408 upb_StringView key = upb_tabstrview(tabent->key);
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012409 _upb_map_fromkey(key, &ent->k, map->key_size);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012410 upb_value val = {tabent->val.val};
Protobuf Team Bot03440ec2024-01-11 23:13:19 +000012411 _upb_map_fromvalue(val, &ent->v, map->val_size);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012412 return true;
12413}
12414
12415UPB_INLINE bool _upb_sortedmap_nextext(_upb_mapsorter* s,
12416 _upb_sortedmap* sorted,
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012417 const upb_Extension** ext) {
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012418 if (sorted->pos == sorted->end) return false;
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012419 *ext = (const upb_Extension*)s->entries[sorted->pos++];
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012420 return true;
12421}
12422
12423UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter* s,
12424 _upb_sortedmap* sorted) {
12425 s->size = sorted->start;
12426}
12427
12428bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type,
Protobuf Team Bot499c7482023-12-30 01:42:17 +000012429 const struct upb_Map* map, _upb_sortedmap* sorted);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012430
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012431bool _upb_mapsorter_pushexts(_upb_mapsorter* s, const upb_Extension* exts,
12432 size_t count, _upb_sortedmap* sorted);
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012433
12434#ifdef __cplusplus
12435} /* extern "C" */
12436#endif
12437
12438
Protobuf Team Bot5b343372023-12-19 06:18:53 +000012439#endif /* UPB_MESSAGE_INTERNAL_MAP_SORTER_H_ */
Protobuf Team Bot376ba2f2023-09-29 22:17:43 +000012440
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000012441#ifndef UPB_BASE_INTERNAL_LOG2_H_
12442#define UPB_BASE_INTERNAL_LOG2_H_
12443
12444// Must be last.
12445
12446#ifdef __cplusplus
12447extern "C" {
12448#endif
12449
12450UPB_INLINE int upb_Log2Ceiling(int x) {
12451 if (x <= 1) return 0;
12452#ifdef __GNUC__
12453 return 32 - __builtin_clz(x - 1);
12454#else
12455 int lg2 = 0;
12456 while ((1 << lg2) < x) lg2++;
12457 return lg2;
12458#endif
12459}
12460
12461UPB_INLINE int upb_Log2CeilingSize(int x) { return 1 << upb_Log2Ceiling(x); }
12462
12463#ifdef __cplusplus
12464} /* extern "C" */
12465#endif
12466
12467
12468#endif /* UPB_BASE_INTERNAL_LOG2_H_ */
12469
Protobuf Team Bot80b5fe42023-12-27 20:08:36 +000012470#ifndef UPB_MESSAGE_COMPARE_H_
12471#define UPB_MESSAGE_COMPARE_H_
12472
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012473#include <stddef.h>
12474
Protobuf Team Bot80b5fe42023-12-27 20:08:36 +000012475
12476// Must be last.
12477
12478#ifdef __cplusplus
12479extern "C" {
12480#endif
12481
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012482// Returns true if no known fields or extensions are set in the message.
12483UPB_API bool upb_Message_IsEmpty(const upb_Message* msg,
12484 const upb_MiniTable* m);
12485
12486UPB_API bool upb_Message_IsEqual(const upb_Message* msg1,
12487 const upb_Message* msg2,
12488 const upb_MiniTable* m);
12489
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012490// If |ctype| is a message then |m| must point to its minitable.
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012491UPB_API_INLINE bool upb_MessageValue_IsEqual(upb_MessageValue val1,
12492 upb_MessageValue val2,
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012493 upb_CType ctype,
12494 const upb_MiniTable* m) {
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012495 switch (ctype) {
12496 case kUpb_CType_Bool:
12497 return val1.bool_val == val2.bool_val;
12498
12499 case kUpb_CType_Float:
12500 case kUpb_CType_Int32:
12501 case kUpb_CType_UInt32:
12502 case kUpb_CType_Enum:
12503 return val1.int32_val == val2.int32_val;
12504
12505 case kUpb_CType_Double:
12506 case kUpb_CType_Int64:
12507 case kUpb_CType_UInt64:
12508 return val1.int64_val == val2.int64_val;
12509
12510 case kUpb_CType_String:
12511 case kUpb_CType_Bytes:
12512 return upb_StringView_IsEqual(val1.str_val, val2.str_val);
12513
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012514 case kUpb_CType_Message:
12515 return upb_Message_IsEqual(val1.msg_val, val2.msg_val, m);
12516
12517 default:
12518 UPB_UNREACHABLE();
Protobuf Team Botc13512a2024-01-25 18:53:49 +000012519 return false;
12520 }
12521}
12522
Protobuf Team Bot80b5fe42023-12-27 20:08:36 +000012523#ifdef __cplusplus
12524} /* extern "C" */
12525#endif
12526
12527
12528#endif // UPB_MESSAGE_COMPARE_H_
12529
Protobuf Team Bote3dcdfd2024-02-09 21:49:54 +000012530#ifndef UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_
12531#define UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_
12532
12533#include <stddef.h>
12534
12535// Must be last.
12536
12537#ifdef __cplusplus
12538extern "C" {
12539#endif
12540
12541// Returns true if unknown fields from the two messages are equal when sorted
12542// and varints are made canonical.
12543//
12544// This function is discouraged, as the comparison is inherently lossy without
12545// schema data:
12546//
12547// 1. We don't know whether delimited fields are sub-messages. Unknown
12548// sub-messages will therefore not have their fields sorted and varints
12549// canonicalized.
12550// 2. We don't know about oneof/non-repeated fields, which should semantically
12551// discard every value except the last.
12552
12553typedef enum {
12554 kUpb_UnknownCompareResult_Equal = 0,
12555 kUpb_UnknownCompareResult_NotEqual = 1,
12556 kUpb_UnknownCompareResult_OutOfMemory = 2,
12557 kUpb_UnknownCompareResult_MaxDepthExceeded = 3,
12558} upb_UnknownCompareResult;
12559
12560upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)(
12561 const char* buf1, size_t size1, const char* buf2, size_t size2,
12562 int max_depth);
12563
12564#ifdef __cplusplus
12565} /* extern "C" */
12566#endif
12567
12568
12569#endif /* UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_ */
12570
Protobuf Team Bot80b5fe42023-12-27 20:08:36 +000012571#ifndef UPB_MESSAGE_COPY_H_
12572#define UPB_MESSAGE_COPY_H_
12573
12574
12575// Must be last.
12576
12577#ifdef __cplusplus
12578extern "C" {
12579#endif
12580
12581// Deep clones a message using the provided target arena.
12582upb_Message* upb_Message_DeepClone(const upb_Message* msg,
12583 const upb_MiniTable* m, upb_Arena* arena);
12584
12585// Shallow clones a message using the provided target arena.
12586upb_Message* upb_Message_ShallowClone(const upb_Message* msg,
12587 const upb_MiniTable* m, upb_Arena* arena);
12588
12589// Deep clones array contents.
12590upb_Array* upb_Array_DeepClone(const upb_Array* array, upb_CType value_type,
12591 const upb_MiniTable* sub, upb_Arena* arena);
12592
12593// Deep clones map contents.
12594upb_Map* upb_Map_DeepClone(const upb_Map* map, upb_CType key_type,
12595 upb_CType value_type,
12596 const upb_MiniTable* map_entry_table,
12597 upb_Arena* arena);
12598
12599// Deep copies the message from src to dst.
12600bool upb_Message_DeepCopy(upb_Message* dst, const upb_Message* src,
12601 const upb_MiniTable* m, upb_Arena* arena);
12602
12603// Shallow copies the message from src to dst.
12604void upb_Message_ShallowCopy(upb_Message* dst, const upb_Message* src,
12605 const upb_MiniTable* m);
12606
12607#ifdef __cplusplus
12608} /* extern "C" */
12609#endif
12610
12611
12612#endif // UPB_MESSAGE_COPY_H_
12613
Adam Cozzette8059da22023-08-16 07:57:14 -070012614#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12615#define UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12616
Adam Cozzette7d5592e2023-08-23 12:15:26 -070012617#include <stdint.h>
12618
Adam Cozzette8059da22023-08-16 07:57:14 -070012619
12620// Must be last.
12621
12622#ifdef __cplusplus
12623extern "C" {
12624#endif
12625
12626UPB_INLINE char _upb_ToBase92(int8_t ch) {
12627 extern const char _kUpb_ToBase92[];
12628 UPB_ASSERT(0 <= ch && ch < 92);
12629 return _kUpb_ToBase92[ch];
12630}
12631
12632UPB_INLINE char _upb_FromBase92(uint8_t ch) {
12633 extern const int8_t _kUpb_FromBase92[];
12634 if (' ' > ch || ch > '~') return -1;
12635 return _kUpb_FromBase92[ch - ' '];
12636}
12637
12638UPB_INLINE const char* _upb_Base92_DecodeVarint(const char* ptr,
12639 const char* end, char first_ch,
12640 uint8_t min, uint8_t max,
12641 uint32_t* out_val) {
12642 uint32_t val = 0;
12643 uint32_t shift = 0;
12644 const int bits_per_char =
12645 upb_Log2Ceiling(_upb_FromBase92(max) - _upb_FromBase92(min));
12646 char ch = first_ch;
12647 while (1) {
12648 uint32_t bits = _upb_FromBase92(ch) - _upb_FromBase92(min);
12649 val |= bits << shift;
12650 if (ptr == end || *ptr < min || max < *ptr) {
12651 *out_val = val;
12652 UPB_ASSUME(ptr != NULL);
12653 return ptr;
12654 }
12655 ch = *ptr++;
12656 shift += bits_per_char;
12657 if (shift >= 32) return NULL;
12658 }
12659}
12660
12661#ifdef __cplusplus
12662} /* extern "C" */
12663#endif
12664
12665
12666#endif // UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
12667
Protobuf Team Bot91cfce92023-11-27 21:05:28 +000012668#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12669#define UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12670
12671
Adam Cozzette8059da22023-08-16 07:57:14 -070012672// Must be last.
12673
12674// upb_MdDecoder: used internally for decoding MiniDescriptors for messages,
12675// extensions, and enums.
12676typedef struct {
12677 const char* end;
12678 upb_Status* status;
12679 jmp_buf err;
12680} upb_MdDecoder;
12681
12682UPB_PRINTF(2, 3)
12683UPB_NORETURN UPB_INLINE void upb_MdDecoder_ErrorJmp(upb_MdDecoder* d,
12684 const char* fmt, ...) {
12685 if (d->status) {
12686 va_list argp;
12687 upb_Status_SetErrorMessage(d->status, "Error building mini table: ");
12688 va_start(argp, fmt);
12689 upb_Status_VAppendErrorFormat(d->status, fmt, argp);
12690 va_end(argp);
12691 }
12692 UPB_LONGJMP(d->err, 1);
12693}
12694
12695UPB_INLINE void upb_MdDecoder_CheckOutOfMemory(upb_MdDecoder* d,
12696 const void* ptr) {
12697 if (!ptr) upb_MdDecoder_ErrorJmp(d, "Out of memory");
12698}
12699
12700UPB_INLINE const char* upb_MdDecoder_DecodeBase92Varint(
12701 upb_MdDecoder* d, const char* ptr, char first_ch, uint8_t min, uint8_t max,
12702 uint32_t* out_val) {
12703 ptr = _upb_Base92_DecodeVarint(ptr, d->end, first_ch, min, max, out_val);
12704 if (!ptr) upb_MdDecoder_ErrorJmp(d, "Overlong varint");
12705 return ptr;
12706}
12707
12708
12709#endif // UPB_MINI_DESCRIPTOR_INTERNAL_DECODER_H_
12710
12711#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12712#define UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12713
12714
12715// Must be last.
12716
12717typedef enum {
12718 kUpb_EncodedType_Double = 0,
12719 kUpb_EncodedType_Float = 1,
12720 kUpb_EncodedType_Fixed32 = 2,
12721 kUpb_EncodedType_Fixed64 = 3,
12722 kUpb_EncodedType_SFixed32 = 4,
12723 kUpb_EncodedType_SFixed64 = 5,
12724 kUpb_EncodedType_Int32 = 6,
12725 kUpb_EncodedType_UInt32 = 7,
12726 kUpb_EncodedType_SInt32 = 8,
12727 kUpb_EncodedType_Int64 = 9,
12728 kUpb_EncodedType_UInt64 = 10,
12729 kUpb_EncodedType_SInt64 = 11,
12730 kUpb_EncodedType_OpenEnum = 12,
12731 kUpb_EncodedType_Bool = 13,
12732 kUpb_EncodedType_Bytes = 14,
12733 kUpb_EncodedType_String = 15,
12734 kUpb_EncodedType_Group = 16,
12735 kUpb_EncodedType_Message = 17,
12736 kUpb_EncodedType_ClosedEnum = 18,
12737
12738 kUpb_EncodedType_RepeatedBase = 20,
12739} upb_EncodedType;
12740
12741typedef enum {
12742 kUpb_EncodedFieldModifier_FlipPacked = 1 << 0,
12743 kUpb_EncodedFieldModifier_IsRequired = 1 << 1,
12744 kUpb_EncodedFieldModifier_IsProto3Singular = 1 << 2,
Protobuf Team Botb58bd402023-09-19 15:42:34 +000012745 kUpb_EncodedFieldModifier_FlipValidateUtf8 = 1 << 3,
Adam Cozzette8059da22023-08-16 07:57:14 -070012746} upb_EncodedFieldModifier;
12747
12748enum {
12749 kUpb_EncodedValue_MinField = ' ',
12750 kUpb_EncodedValue_MaxField = 'I',
12751 kUpb_EncodedValue_MinModifier = 'L',
12752 kUpb_EncodedValue_MaxModifier = '[',
12753 kUpb_EncodedValue_End = '^',
12754 kUpb_EncodedValue_MinSkip = '_',
12755 kUpb_EncodedValue_MaxSkip = '~',
12756 kUpb_EncodedValue_OneofSeparator = '~',
12757 kUpb_EncodedValue_FieldSeparator = '|',
12758 kUpb_EncodedValue_MinOneofField = ' ',
12759 kUpb_EncodedValue_MaxOneofField = 'b',
12760 kUpb_EncodedValue_MaxEnumMask = 'A',
12761};
12762
12763enum {
12764 kUpb_EncodedVersion_EnumV1 = '!',
12765 kUpb_EncodedVersion_ExtensionV1 = '#',
12766 kUpb_EncodedVersion_MapV1 = '%',
12767 kUpb_EncodedVersion_MessageV1 = '$',
12768 kUpb_EncodedVersion_MessageSetV1 = '&',
12769};
12770
12771
12772#endif // UPB_MINI_DESCRIPTOR_INTERNAL_WIRE_CONSTANTS_H_
12773
12774#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
12775#define UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
12776
12777// Must be last.
12778
12779typedef enum {
12780 kUpb_FieldModifier_IsRepeated = 1 << 0,
12781 kUpb_FieldModifier_IsPacked = 1 << 1,
12782 kUpb_FieldModifier_IsClosedEnum = 1 << 2,
12783 kUpb_FieldModifier_IsProto3Singular = 1 << 3,
12784 kUpb_FieldModifier_IsRequired = 1 << 4,
Protobuf Team Botb58bd402023-09-19 15:42:34 +000012785 kUpb_FieldModifier_ValidateUtf8 = 1 << 5,
Adam Cozzette8059da22023-08-16 07:57:14 -070012786} kUpb_FieldModifier;
12787
Protobuf Team Botb58bd402023-09-19 15:42:34 +000012788// These modifiers are also used on the wire.
Adam Cozzette8059da22023-08-16 07:57:14 -070012789typedef enum {
12790 kUpb_MessageModifier_ValidateUtf8 = 1 << 0,
12791 kUpb_MessageModifier_DefaultIsPacked = 1 << 1,
12792 kUpb_MessageModifier_IsExtendable = 1 << 2,
12793} kUpb_MessageModifier;
12794
12795
12796#endif // UPB_MINI_DESCRIPTOR_INTERNAL_MODIFIERS_H_
12797
Protobuf Team Botc4a7b032023-12-27 00:12:48 +000012798#ifndef UPB_MINI_TABLE_COMPAT_H_
12799#define UPB_MINI_TABLE_COMPAT_H_
12800
12801
12802// Must be last.
12803
12804// upb does not support mixing minitables from different sources but these
12805// functions are still used by some existing users so for now we make them
12806// available here. This may or may not change in the future so do not add
12807// them to new code.
12808
12809#ifdef __cplusplus
12810extern "C" {
12811#endif
12812
12813// Checks if memory layout of src is compatible with dst.
12814bool upb_MiniTable_Compatible(const upb_MiniTable* src,
12815 const upb_MiniTable* dst);
12816
12817typedef enum {
12818 kUpb_MiniTableEquals_NotEqual,
12819 kUpb_MiniTableEquals_Equal,
12820 kUpb_MiniTableEquals_OutOfMemory,
12821} upb_MiniTableEquals_Status;
12822
12823// Checks equality of mini tables originating from different language runtimes.
12824upb_MiniTableEquals_Status upb_MiniTable_Equals(const upb_MiniTable* src,
12825 const upb_MiniTable* dst);
12826
12827#ifdef __cplusplus
12828} /* extern "C" */
12829#endif
12830
12831
12832#endif /* UPB_MINI_TABLE_COMPAT_H_ */
12833
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000012834#ifndef UPB_HASH_INT_TABLE_H_
12835#define UPB_HASH_INT_TABLE_H_
12836
12837
12838// Must be last.
12839
12840typedef struct {
12841 upb_table t; // For entries that don't fit in the array part.
12842 const upb_tabval* array; // Array part of the table. See const note above.
12843 size_t array_size; // Array part size.
12844 size_t array_count; // Array part number of elements.
12845} upb_inttable;
12846
12847#ifdef __cplusplus
12848extern "C" {
12849#endif
12850
12851// Initialize a table. If memory allocation failed, false is returned and
12852// the table is uninitialized.
12853bool upb_inttable_init(upb_inttable* table, upb_Arena* a);
12854
12855// Returns the number of values in the table.
12856size_t upb_inttable_count(const upb_inttable* t);
12857
12858// Inserts the given key into the hashtable with the given value.
12859// The key must not already exist in the hash table.
12860// The value must not be UINTPTR_MAX.
12861//
12862// If a table resize was required but memory allocation failed, false is
12863// returned and the table is unchanged.
12864bool upb_inttable_insert(upb_inttable* t, uintptr_t key, upb_value val,
12865 upb_Arena* a);
12866
12867// Looks up key in this table, returning "true" if the key was found.
12868// If v is non-NULL, copies the value for this key into *v.
12869bool upb_inttable_lookup(const upb_inttable* t, uintptr_t key, upb_value* v);
12870
12871// Removes an item from the table. Returns true if the remove was successful,
12872// and stores the removed item in *val if non-NULL.
12873bool upb_inttable_remove(upb_inttable* t, uintptr_t key, upb_value* val);
12874
12875// Updates an existing entry in an inttable.
12876// If the entry does not exist, returns false and does nothing.
12877// Unlike insert/remove, this does not invalidate iterators.
12878bool upb_inttable_replace(upb_inttable* t, uintptr_t key, upb_value val);
12879
12880// Optimizes the table for the current set of entries, for both memory use and
12881// lookup time. Client should call this after all entries have been inserted;
12882// inserting more entries is legal, but will likely require a table resize.
12883void upb_inttable_compact(upb_inttable* t, upb_Arena* a);
12884
12885// Iteration over inttable:
12886//
12887// intptr_t iter = UPB_INTTABLE_BEGIN;
12888// uintptr_t key;
12889// upb_value val;
12890// while (upb_inttable_next(t, &key, &val, &iter)) {
12891// // ...
12892// }
12893
12894#define UPB_INTTABLE_BEGIN -1
12895
12896bool upb_inttable_next(const upb_inttable* t, uintptr_t* key, upb_value* val,
12897 intptr_t* iter);
12898void upb_inttable_removeiter(upb_inttable* t, intptr_t* iter);
12899
12900#ifdef __cplusplus
12901} /* extern "C" */
12902#endif
12903
12904
12905#endif /* UPB_HASH_INT_TABLE_H_ */
12906
12907#ifndef UPB_WIRE_INTERNAL_CONSTANTS_H_
12908#define UPB_WIRE_INTERNAL_CONSTANTS_H_
12909
12910#define kUpb_WireFormat_DefaultDepthLimit 100
12911
12912// MessageSet wire format is:
12913// message MessageSet {
12914// repeated group Item = 1 {
12915// required int32 type_id = 2;
12916// required bytes message = 3;
12917// }
12918// }
12919
12920enum {
12921 kUpb_MsgSet_Item = 1,
12922 kUpb_MsgSet_TypeId = 2,
12923 kUpb_MsgSet_Message = 3,
12924};
12925
12926#endif /* UPB_WIRE_INTERNAL_CONSTANTS_H_ */
12927
12928/*
12929 * Internal implementation details of the decoder that are shared between
12930 * decode.c and decode_fast.c.
12931 */
12932
12933#ifndef UPB_WIRE_INTERNAL_DECODER_H_
12934#define UPB_WIRE_INTERNAL_DECODER_H_
12935
12936#include "utf8_range.h"
12937
12938// Must be last.
12939
12940#define DECODE_NOGROUP (uint32_t) - 1
12941
12942typedef struct upb_Decoder {
12943 upb_EpsCopyInputStream input;
12944 const upb_ExtensionRegistry* extreg;
12945 const char* unknown; // Start of unknown data, preserve at buffer flip
12946 upb_Message* unknown_msg; // Pointer to preserve data to
12947 int depth; // Tracks recursion depth to bound stack usage.
12948 uint32_t end_group; // field number of END_GROUP tag, else DECODE_NOGROUP.
12949 uint16_t options;
12950 bool missing_required;
12951 union {
12952 upb_Arena arena;
12953 void* foo[UPB_ARENA_SIZE_HACK];
12954 };
12955 upb_DecodeStatus status;
12956 jmp_buf err;
12957
12958#ifndef NDEBUG
12959 const char* debug_tagstart;
12960 const char* debug_valstart;
12961#endif
12962} upb_Decoder;
12963
12964/* Error function that will abort decoding with longjmp(). We can't declare this
12965 * UPB_NORETURN, even though it is appropriate, because if we do then compilers
12966 * will "helpfully" refuse to tailcall to it
12967 * (see: https://stackoverflow.com/a/55657013), which will defeat a major goal
12968 * of our optimizations. That is also why we must declare it in a separate file,
12969 * otherwise the compiler will see that it calls longjmp() and deduce that it is
12970 * noreturn. */
12971const char* _upb_FastDecoder_ErrorJmp(upb_Decoder* d, int status);
12972
12973extern const uint8_t upb_utf8_offsets[];
12974
12975UPB_INLINE
12976bool _upb_Decoder_VerifyUtf8Inline(const char* ptr, int len) {
12977 return utf8_range_IsValid(ptr, len);
12978}
12979
12980const char* _upb_Decoder_CheckRequired(upb_Decoder* d, const char* ptr,
12981 const upb_Message* msg,
12982 const upb_MiniTable* m);
12983
12984/* x86-64 pointers always have the high 16 bits matching. So we can shift
12985 * left 8 and right 8 without loss of information. */
12986UPB_INLINE intptr_t decode_totable(const upb_MiniTable* tablep) {
12987 return ((intptr_t)tablep << 8) | tablep->UPB_PRIVATE(table_mask);
12988}
12989
12990UPB_INLINE const upb_MiniTable* decode_totablep(intptr_t table) {
12991 return (const upb_MiniTable*)(table >> 8);
12992}
12993
12994const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e,
12995 const char* ptr, int overrun);
12996
12997UPB_INLINE bool _upb_Decoder_IsDone(upb_Decoder* d, const char** ptr) {
12998 return upb_EpsCopyInputStream_IsDoneWithCallback(
12999 &d->input, ptr, &_upb_Decoder_IsDoneFallback);
13000}
13001
13002UPB_INLINE const char* _upb_Decoder_BufferFlipCallback(
13003 upb_EpsCopyInputStream* e, const char* old_end, const char* new_start) {
13004 upb_Decoder* d = (upb_Decoder*)e;
13005 if (!old_end) _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed);
13006
13007 if (d->unknown) {
13008 if (!UPB_PRIVATE(_upb_Message_AddUnknown)(
13009 d->unknown_msg, d->unknown, old_end - d->unknown, &d->arena)) {
13010 _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory);
13011 }
13012 d->unknown = new_start;
13013 }
13014 return new_start;
13015}
13016
13017#if UPB_FASTTABLE
13018UPB_INLINE
13019const char* _upb_FastDecoder_TagDispatch(upb_Decoder* d, const char* ptr,
13020 upb_Message* msg, intptr_t table,
13021 uint64_t hasbits, uint64_t tag) {
13022 const upb_MiniTable* table_p = decode_totablep(table);
13023 uint8_t mask = table;
13024 uint64_t data;
13025 size_t idx = tag & mask;
13026 UPB_ASSUME((idx & 7) == 0);
13027 idx >>= 3;
13028 data = table_p->UPB_PRIVATE(fasttable)[idx].field_data ^ tag;
13029 UPB_MUSTTAIL return table_p->UPB_PRIVATE(fasttable)[idx].field_parser(
13030 d, ptr, msg, table, hasbits, data);
13031}
13032#endif
13033
13034UPB_INLINE uint32_t _upb_FastDecoder_LoadTag(const char* ptr) {
13035 uint16_t tag;
13036 memcpy(&tag, ptr, 2);
13037 return tag;
13038}
13039
13040
13041#endif /* UPB_WIRE_INTERNAL_DECODER_H_ */
13042
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013043#ifndef UPB_WIRE_READER_H_
13044#define UPB_WIRE_READER_H_
13045
13046
13047#ifndef UPB_WIRE_INTERNAL_READER_H_
13048#define UPB_WIRE_INTERNAL_READER_H_
13049
13050// Must be last.
13051
13052#define kUpb_WireReader_WireTypeBits 3
13053#define kUpb_WireReader_WireTypeMask 7
13054
13055typedef struct {
13056 const char* ptr;
13057 uint64_t val;
13058} UPB_PRIVATE(_upb_WireReader_LongVarint);
13059
13060#ifdef __cplusplus
13061extern "C" {
13062#endif
13063
13064UPB_PRIVATE(_upb_WireReader_LongVarint)
13065UPB_PRIVATE(_upb_WireReader_ReadLongVarint)(const char* ptr, uint64_t val);
13066
Protobuf Team Bot1d143b52024-01-25 20:29:43 +000013067UPB_FORCEINLINE const char* UPB_PRIVATE(_upb_WireReader_ReadVarint)(
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013068 const char* ptr, uint64_t* val, int maxlen, uint64_t maxval) {
13069 uint64_t byte = (uint8_t)*ptr;
13070 if (UPB_LIKELY((byte & 0x80) == 0)) {
13071 *val = (uint32_t)byte;
13072 return ptr + 1;
13073 }
13074 const char* start = ptr;
13075 UPB_PRIVATE(_upb_WireReader_LongVarint)
13076 res = UPB_PRIVATE(_upb_WireReader_ReadLongVarint)(ptr, byte);
13077 if (!res.ptr || (maxlen < 10 && res.ptr - start > maxlen) ||
13078 res.val > maxval) {
13079 return NULL; // Malformed.
13080 }
13081 *val = res.val;
13082 return res.ptr;
13083}
13084
Protobuf Team Botb3878b52024-02-08 21:50:53 +000013085UPB_API_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag) {
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013086 return tag >> kUpb_WireReader_WireTypeBits;
13087}
13088
Protobuf Team Botb3878b52024-02-08 21:50:53 +000013089UPB_API_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag) {
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013090 return tag & kUpb_WireReader_WireTypeMask;
13091}
13092
13093#ifdef __cplusplus
13094} /* extern "C" */
13095#endif
13096
13097
13098#endif // UPB_WIRE_INTERNAL_READER_H_
13099
13100#ifndef UPB_WIRE_TYPES_H_
13101#define UPB_WIRE_TYPES_H_
13102
13103// A list of types as they are encoded on the wire.
13104typedef enum {
13105 kUpb_WireType_Varint = 0,
13106 kUpb_WireType_64Bit = 1,
13107 kUpb_WireType_Delimited = 2,
13108 kUpb_WireType_StartGroup = 3,
13109 kUpb_WireType_EndGroup = 4,
13110 kUpb_WireType_32Bit = 5
13111} upb_WireType;
13112
13113#endif /* UPB_WIRE_TYPES_H_ */
13114
13115// Must be last.
13116
13117// The upb_WireReader interface is suitable for general-purpose parsing of
13118// protobuf binary wire format. It is designed to be used along with
13119// upb_EpsCopyInputStream for buffering, and all parsing routines in this file
13120// assume that at least kUpb_EpsCopyInputStream_SlopBytes worth of data is
13121// available to read without any bounds checks.
13122
13123#ifdef __cplusplus
13124extern "C" {
13125#endif
13126
13127// Parses a tag into `tag`, and returns a pointer past the end of the tag, or
13128// NULL if there was an error in the tag data.
13129//
13130// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
13131// Bounds checks must be performed before calling this function, preferably
13132// by calling upb_EpsCopyInputStream_IsDone().
Protobuf Team Bot1d143b52024-01-25 20:29:43 +000013133UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr,
13134 uint32_t* tag) {
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013135 uint64_t val;
13136 ptr = UPB_PRIVATE(_upb_WireReader_ReadVarint)(ptr, &val, 5, UINT32_MAX);
13137 if (!ptr) return NULL;
13138 *tag = val;
13139 return ptr;
13140}
13141
13142// Given a tag, returns the field number.
Protobuf Team Botb3878b52024-02-08 21:50:53 +000013143UPB_API_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag);
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013144
13145// Given a tag, returns the wire type.
Protobuf Team Botb3878b52024-02-08 21:50:53 +000013146UPB_API_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag);
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013147
13148UPB_INLINE const char* upb_WireReader_ReadVarint(const char* ptr,
13149 uint64_t* val) {
13150 return UPB_PRIVATE(_upb_WireReader_ReadVarint)(ptr, val, 10, UINT64_MAX);
13151}
13152
13153// Skips data for a varint, returning a pointer past the end of the varint, or
13154// NULL if there was an error in the varint data.
13155//
13156// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
13157// Bounds checks must be performed before calling this function, preferably
13158// by calling upb_EpsCopyInputStream_IsDone().
13159UPB_INLINE const char* upb_WireReader_SkipVarint(const char* ptr) {
13160 uint64_t val;
13161 return upb_WireReader_ReadVarint(ptr, &val);
13162}
13163
13164// Reads a varint indicating the size of a delimited field into `size`, or
13165// NULL if there was an error in the varint data.
13166//
13167// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
13168// Bounds checks must be performed before calling this function, preferably
13169// by calling upb_EpsCopyInputStream_IsDone().
13170UPB_INLINE const char* upb_WireReader_ReadSize(const char* ptr, int* size) {
13171 uint64_t size64;
13172 ptr = upb_WireReader_ReadVarint(ptr, &size64);
13173 if (!ptr || size64 >= INT32_MAX) return NULL;
13174 *size = size64;
13175 return ptr;
13176}
13177
13178// Reads a fixed32 field, performing byte swapping if necessary.
13179//
13180// REQUIRES: there must be at least 4 bytes of data available at `ptr`.
13181// Bounds checks must be performed before calling this function, preferably
13182// by calling upb_EpsCopyInputStream_IsDone().
13183UPB_INLINE const char* upb_WireReader_ReadFixed32(const char* ptr, void* val) {
13184 uint32_t uval;
13185 memcpy(&uval, ptr, 4);
Protobuf Team Botde5ea1e2024-01-02 04:02:53 +000013186 uval = upb_BigEndian32(uval);
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013187 memcpy(val, &uval, 4);
13188 return ptr + 4;
13189}
13190
13191// Reads a fixed64 field, performing byte swapping if necessary.
13192//
13193// REQUIRES: there must be at least 4 bytes of data available at `ptr`.
13194// Bounds checks must be performed before calling this function, preferably
13195// by calling upb_EpsCopyInputStream_IsDone().
13196UPB_INLINE const char* upb_WireReader_ReadFixed64(const char* ptr, void* val) {
13197 uint64_t uval;
13198 memcpy(&uval, ptr, 8);
Protobuf Team Botde5ea1e2024-01-02 04:02:53 +000013199 uval = upb_BigEndian64(uval);
Protobuf Team Botcb8a31e2024-01-02 02:33:01 +000013200 memcpy(val, &uval, 8);
13201 return ptr + 8;
13202}
13203
13204const char* UPB_PRIVATE(_upb_WireReader_SkipGroup)(
13205 const char* ptr, uint32_t tag, int depth_limit,
13206 upb_EpsCopyInputStream* stream);
13207
13208// Skips data for a group, returning a pointer past the end of the group, or
13209// NULL if there was an error parsing the group. The `tag` argument should be
13210// the start group tag that begins the group. The `depth_limit` argument
13211// indicates how many levels of recursion the group is allowed to have before
13212// reporting a parse error (this limit exists to protect against stack
13213// overflow).
13214//
13215// TODO: evaluate how the depth_limit should be specified. Do users need
13216// control over this?
13217UPB_INLINE const char* upb_WireReader_SkipGroup(
13218 const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) {
13219 return UPB_PRIVATE(_upb_WireReader_SkipGroup)(ptr, tag, 100, stream);
13220}
13221
13222UPB_INLINE const char* _upb_WireReader_SkipValue(
13223 const char* ptr, uint32_t tag, int depth_limit,
13224 upb_EpsCopyInputStream* stream) {
13225 switch (upb_WireReader_GetWireType(tag)) {
13226 case kUpb_WireType_Varint:
13227 return upb_WireReader_SkipVarint(ptr);
13228 case kUpb_WireType_32Bit:
13229 return ptr + 4;
13230 case kUpb_WireType_64Bit:
13231 return ptr + 8;
13232 case kUpb_WireType_Delimited: {
13233 int size;
13234 ptr = upb_WireReader_ReadSize(ptr, &size);
13235 if (!ptr) return NULL;
13236 ptr += size;
13237 return ptr;
13238 }
13239 case kUpb_WireType_StartGroup:
13240 return UPB_PRIVATE(_upb_WireReader_SkipGroup)(ptr, tag, depth_limit,
13241 stream);
13242 case kUpb_WireType_EndGroup:
13243 return NULL; // Should be handled before now.
13244 default:
13245 return NULL; // Unknown wire type.
13246 }
13247}
13248
13249// Skips data for a wire value of any type, returning a pointer past the end of
13250// the data, or NULL if there was an error parsing the group. The `tag` argument
13251// should be the tag that was just parsed. The `depth_limit` argument indicates
13252// how many levels of recursion a group is allowed to have before reporting a
13253// parse error (this limit exists to protect against stack overflow).
13254//
13255// REQUIRES: there must be at least 10 bytes of data available at `ptr`.
13256// Bounds checks must be performed before calling this function, preferably
13257// by calling upb_EpsCopyInputStream_IsDone().
13258//
13259// TODO: evaluate how the depth_limit should be specified. Do users need
13260// control over this?
13261UPB_INLINE const char* upb_WireReader_SkipValue(
13262 const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) {
13263 return _upb_WireReader_SkipValue(ptr, tag, 100, stream);
13264}
13265
13266#ifdef __cplusplus
13267} /* extern "C" */
13268#endif
13269
13270
13271#endif // UPB_WIRE_READER_H_
13272
13273#ifndef UPB_LEX_STRTOD_H_
13274#define UPB_LEX_STRTOD_H_
13275
13276// Must be last.
13277
13278#ifdef __cplusplus
13279extern "C" {
13280#endif
13281
13282double _upb_NoLocaleStrtod(const char *str, char **endptr);
13283
13284#ifdef __cplusplus
13285} /* extern "C" */
13286#endif
13287
13288
13289#endif /* UPB_LEX_STRTOD_H_ */
13290
13291#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
13292#define UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
13293
13294#include <stdint.h>
13295
13296
13297// Must be last.
13298
13299// If the input buffer has at least this many bytes available, the encoder call
13300// is guaranteed to succeed (as long as field number order is maintained).
13301#define kUpb_MtDataEncoder_MinSize 16
13302
13303typedef struct {
13304 char* end; // Limit of the buffer passed as a parameter.
13305 // Aliased to internal-only members in .cc.
13306 char internal[32];
13307} upb_MtDataEncoder;
13308
13309#ifdef __cplusplus
13310extern "C" {
13311#endif
13312
13313// Encodes field/oneof information for a given message. The sequence of calls
13314// should look like:
13315//
13316// upb_MtDataEncoder e;
13317// char buf[256];
13318// char* ptr = buf;
13319// e.end = ptr + sizeof(buf);
13320// unit64_t msg_mod = ...; // bitwise & of kUpb_MessageModifiers or zero
13321// ptr = upb_MtDataEncoder_StartMessage(&e, ptr, msg_mod);
13322// // Fields *must* be in field number order.
13323// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
13324// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
13325// ptr = upb_MtDataEncoder_PutField(&e, ptr, ...);
13326//
13327// // If oneofs are present. Oneofs must be encoded after regular fields.
13328// ptr = upb_MiniTable_StartOneof(&e, ptr)
13329// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
13330// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
13331//
13332// ptr = upb_MiniTable_StartOneof(&e, ptr);
13333// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
13334// ptr = upb_MiniTable_PutOneofField(&e, ptr, ...);
13335//
13336// Oneofs must be encoded after all regular fields.
13337char* upb_MtDataEncoder_StartMessage(upb_MtDataEncoder* e, char* ptr,
13338 uint64_t msg_mod);
13339char* upb_MtDataEncoder_PutField(upb_MtDataEncoder* e, char* ptr,
13340 upb_FieldType type, uint32_t field_num,
13341 uint64_t field_mod);
13342char* upb_MtDataEncoder_StartOneof(upb_MtDataEncoder* e, char* ptr);
13343char* upb_MtDataEncoder_PutOneofField(upb_MtDataEncoder* e, char* ptr,
13344 uint32_t field_num);
13345
13346// Encodes the set of values for a given enum. The values must be given in
13347// order (after casting to uint32_t), and repeats are not allowed.
13348char* upb_MtDataEncoder_StartEnum(upb_MtDataEncoder* e, char* ptr);
13349char* upb_MtDataEncoder_PutEnumValue(upb_MtDataEncoder* e, char* ptr,
13350 uint32_t val);
13351char* upb_MtDataEncoder_EndEnum(upb_MtDataEncoder* e, char* ptr);
13352
13353// Encodes an entire mini descriptor for an extension.
13354char* upb_MtDataEncoder_EncodeExtension(upb_MtDataEncoder* e, char* ptr,
13355 upb_FieldType type, uint32_t field_num,
13356 uint64_t field_mod);
13357
13358// Encodes an entire mini descriptor for a map.
13359char* upb_MtDataEncoder_EncodeMap(upb_MtDataEncoder* e, char* ptr,
13360 upb_FieldType key_type,
13361 upb_FieldType value_type, uint64_t key_mod,
13362 uint64_t value_mod);
13363
13364// Encodes an entire mini descriptor for a message set.
13365char* upb_MtDataEncoder_EncodeMessageSet(upb_MtDataEncoder* e, char* ptr);
13366
13367#ifdef __cplusplus
13368} /* extern "C" */
13369#endif
13370
13371
13372#endif /* UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_ */
13373
Eric Salo8809a112022-11-21 13:01:06 -080013374#ifndef UPB_REFLECTION_DEF_POOL_INTERNAL_H_
13375#define UPB_REFLECTION_DEF_POOL_INTERNAL_H_
13376
13377
13378// Must be last.
13379
13380#ifdef __cplusplus
13381extern "C" {
13382#endif
13383
13384upb_Arena* _upb_DefPool_Arena(const upb_DefPool* s);
13385size_t _upb_DefPool_BytesLoaded(const upb_DefPool* s);
13386upb_ExtensionRegistry* _upb_DefPool_ExtReg(const upb_DefPool* s);
13387
13388bool _upb_DefPool_InsertExt(upb_DefPool* s, const upb_MiniTableExtension* ext,
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070013389 const upb_FieldDef* f);
Eric Salo8809a112022-11-21 13:01:06 -080013390bool _upb_DefPool_InsertSym(upb_DefPool* s, upb_StringView sym, upb_value v,
13391 upb_Status* status);
13392bool _upb_DefPool_LookupSym(const upb_DefPool* s, const char* sym, size_t size,
13393 upb_value* v);
13394
13395void** _upb_DefPool_ScratchData(const upb_DefPool* s);
13396size_t* _upb_DefPool_ScratchSize(const upb_DefPool* s);
Mike Kruskal232ecf42023-01-14 00:09:40 -080013397void _upb_DefPool_SetPlatform(upb_DefPool* s, upb_MiniTablePlatform platform);
Eric Salo8809a112022-11-21 13:01:06 -080013398
13399// For generated code only: loads a generated descriptor.
13400typedef struct _upb_DefPool_Init {
13401 struct _upb_DefPool_Init** deps; // Dependencies of this file.
13402 const upb_MiniTableFile* layout;
13403 const char* filename;
13404 upb_StringView descriptor; // Serialized descriptor.
13405} _upb_DefPool_Init;
13406
13407bool _upb_DefPool_LoadDefInit(upb_DefPool* s, const _upb_DefPool_Init* init);
13408
13409// Should only be directly called by tests. This variant lets us suppress
13410// the use of compiled-in tables, forcing a rebuild of the tables at runtime.
13411bool _upb_DefPool_LoadDefInitEx(upb_DefPool* s, const _upb_DefPool_Init* init,
13412 bool rebuild_minitable);
13413
13414#ifdef __cplusplus
13415} /* extern "C" */
13416#endif
13417
13418
13419#endif /* UPB_REFLECTION_DEF_POOL_INTERNAL_H_ */
13420
Protobuf Team Bot7be2a452023-09-13 16:50:05 +000013421#ifndef UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_
13422#define UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_
13423
13424
Eric Salo8809a112022-11-21 13:01:06 -080013425// Must be last.
13426
13427// We want to copy the options verbatim into the destination options proto.
13428// We use serialize+parse as our deep copy.
Mike Kruskal232ecf42023-01-14 00:09:40 -080013429#define UPB_DEF_SET_OPTIONS(target, desc_type, options_type, proto) \
13430 if (UPB_DESC(desc_type##_has_options)(proto)) { \
13431 size_t size; \
13432 char* pb = UPB_DESC(options_type##_serialize)( \
13433 UPB_DESC(desc_type##_options)(proto), ctx->tmp_arena, &size); \
13434 if (!pb) _upb_DefBuilder_OomErr(ctx); \
13435 target = \
13436 UPB_DESC(options_type##_parse)(pb, size, _upb_DefBuilder_Arena(ctx)); \
13437 if (!target) _upb_DefBuilder_OomErr(ctx); \
13438 } else { \
13439 target = (const UPB_DESC(options_type)*)kUpbDefOptDefault; \
Eric Salo8809a112022-11-21 13:01:06 -080013440 }
13441
13442#ifdef __cplusplus
13443extern "C" {
13444#endif
13445
13446struct upb_DefBuilder {
13447 upb_DefPool* symtab;
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013448 upb_strtable feature_cache; // Caches features by identity.
13449 UPB_DESC(FeatureSet*) legacy_features; // For computing legacy features.
13450 char* tmp_buf; // Temporary buffer in tmp_arena.
13451 size_t tmp_buf_size; // Size of temporary buffer.
Eric Salo8809a112022-11-21 13:01:06 -080013452 upb_FileDef* file; // File we are building.
13453 upb_Arena* arena; // Allocate defs here.
13454 upb_Arena* tmp_arena; // For temporary allocations.
13455 upb_Status* status; // Record errors here.
13456 const upb_MiniTableFile* layout; // NULL if we should build layouts.
Mike Kruskal232ecf42023-01-14 00:09:40 -080013457 upb_MiniTablePlatform platform; // Platform we are targeting.
Eric Salo8809a112022-11-21 13:01:06 -080013458 int enum_count; // Count of enums built so far.
13459 int msg_count; // Count of messages built so far.
13460 int ext_count; // Count of extensions built so far.
13461 jmp_buf err; // longjmp() on error.
13462};
13463
13464extern const char* kUpbDefOptDefault;
13465
13466// ctx->status has already been set elsewhere so just fail/longjmp()
13467UPB_NORETURN void _upb_DefBuilder_FailJmp(upb_DefBuilder* ctx);
13468
13469UPB_NORETURN void _upb_DefBuilder_Errf(upb_DefBuilder* ctx, const char* fmt,
13470 ...) UPB_PRINTF(2, 3);
13471UPB_NORETURN void _upb_DefBuilder_OomErr(upb_DefBuilder* ctx);
13472
13473const char* _upb_DefBuilder_MakeFullName(upb_DefBuilder* ctx,
13474 const char* prefix,
13475 upb_StringView name);
13476
13477// Given a symbol and the base symbol inside which it is defined,
13478// find the symbol's definition.
13479const void* _upb_DefBuilder_ResolveAny(upb_DefBuilder* ctx,
13480 const char* from_name_dbg,
13481 const char* base, upb_StringView sym,
13482 upb_deftype_t* type);
13483
13484const void* _upb_DefBuilder_Resolve(upb_DefBuilder* ctx,
13485 const char* from_name_dbg, const char* base,
13486 upb_StringView sym, upb_deftype_t type);
13487
13488char _upb_DefBuilder_ParseEscape(upb_DefBuilder* ctx, const upb_FieldDef* f,
13489 const char** src, const char* end);
13490
13491const char* _upb_DefBuilder_FullToShort(const char* fullname);
13492
13493UPB_INLINE void* _upb_DefBuilder_Alloc(upb_DefBuilder* ctx, size_t bytes) {
13494 if (bytes == 0) return NULL;
13495 void* ret = upb_Arena_Malloc(ctx->arena, bytes);
13496 if (!ret) _upb_DefBuilder_OomErr(ctx);
13497 return ret;
13498}
13499
13500// Adds a symbol |v| to the symtab, which must be a def pointer previously
13501// packed with pack_def(). The def's pointer to upb_FileDef* must be set before
13502// adding, so we know which entries to remove if building this file fails.
13503UPB_INLINE void _upb_DefBuilder_Add(upb_DefBuilder* ctx, const char* name,
13504 upb_value v) {
13505 upb_StringView sym = {.data = name, .size = strlen(name)};
13506 bool ok = _upb_DefPool_InsertSym(ctx->symtab, sym, v, ctx->status);
13507 if (!ok) _upb_DefBuilder_FailJmp(ctx);
13508}
13509
13510UPB_INLINE upb_Arena* _upb_DefBuilder_Arena(const upb_DefBuilder* ctx) {
13511 return ctx->arena;
13512}
13513
13514UPB_INLINE upb_FileDef* _upb_DefBuilder_File(const upb_DefBuilder* ctx) {
13515 return ctx->file;
13516}
13517
13518// This version of CheckIdent() is only called by other, faster versions after
13519// they detect a parsing error.
13520void _upb_DefBuilder_CheckIdentSlow(upb_DefBuilder* ctx, upb_StringView name,
13521 bool full);
13522
Eric Salo8809a112022-11-21 13:01:06 -080013523// Verify a full identifier string. This is slightly more complicated than
13524// verifying a relative identifier string because we must track '.' chars.
13525UPB_INLINE void _upb_DefBuilder_CheckIdentFull(upb_DefBuilder* ctx,
13526 upb_StringView name) {
13527 bool good = name.size > 0;
13528 bool start = true;
13529
13530 for (size_t i = 0; i < name.size; i++) {
13531 const char c = name.data[i];
13532 const char d = c | 0x20; // force lowercase
13533 const bool is_alpha = (('a' <= d) & (d <= 'z')) | (c == '_');
13534 const bool is_numer = ('0' <= c) & (c <= '9') & !start;
13535 const bool is_dot = (c == '.') & !start;
13536
13537 good &= is_alpha | is_numer | is_dot;
13538 start = is_dot;
13539 }
13540
13541 if (!good) _upb_DefBuilder_CheckIdentSlow(ctx, name, true);
13542}
13543
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013544// Returns true if the returned feature set is new and must be populated.
13545bool _upb_DefBuilder_GetOrCreateFeatureSet(upb_DefBuilder* ctx,
13546 const UPB_DESC(FeatureSet*) parent,
13547 upb_StringView key,
13548 UPB_DESC(FeatureSet**) set);
13549
13550const UPB_DESC(FeatureSet*)
13551 _upb_DefBuilder_DoResolveFeatures(upb_DefBuilder* ctx,
13552 const UPB_DESC(FeatureSet*) parent,
13553 const UPB_DESC(FeatureSet*) child,
13554 bool is_implicit);
13555
13556UPB_INLINE const UPB_DESC(FeatureSet*)
13557 _upb_DefBuilder_ResolveFeatures(upb_DefBuilder* ctx,
13558 const UPB_DESC(FeatureSet*) parent,
13559 const UPB_DESC(FeatureSet*) child) {
13560 return _upb_DefBuilder_DoResolveFeatures(ctx, parent, child, false);
13561}
13562
Eric Salo8809a112022-11-21 13:01:06 -080013563#ifdef __cplusplus
13564} /* extern "C" */
13565#endif
13566
13567
13568#endif /* UPB_REFLECTION_DEF_BUILDER_INTERNAL_H_ */
13569
13570#ifndef UPB_REFLECTION_ENUM_DEF_INTERNAL_H_
13571#define UPB_REFLECTION_ENUM_DEF_INTERNAL_H_
13572
13573
13574// Must be last.
13575
13576#ifdef __cplusplus
13577extern "C" {
13578#endif
13579
13580upb_EnumDef* _upb_EnumDef_At(const upb_EnumDef* e, int i);
13581bool _upb_EnumDef_Insert(upb_EnumDef* e, upb_EnumValueDef* v, upb_Arena* a);
13582const upb_MiniTableEnum* _upb_EnumDef_MiniTable(const upb_EnumDef* e);
13583
13584// Allocate and initialize an array of |n| enum defs.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013585upb_EnumDef* _upb_EnumDefs_New(upb_DefBuilder* ctx, int n,
13586 const UPB_DESC(EnumDescriptorProto*)
13587 const* protos,
13588 const UPB_DESC(FeatureSet*) parent_features,
13589 const upb_MessageDef* containing_type);
Eric Salo8809a112022-11-21 13:01:06 -080013590
13591#ifdef __cplusplus
13592} /* extern "C" */
13593#endif
13594
13595
13596#endif /* UPB_REFLECTION_ENUM_DEF_INTERNAL_H_ */
13597
13598#ifndef UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_
13599#define UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_
13600
13601
13602// Must be last.
13603
13604#ifdef __cplusplus
13605extern "C" {
13606#endif
13607
13608upb_EnumValueDef* _upb_EnumValueDef_At(const upb_EnumValueDef* v, int i);
13609
13610// Allocate and initialize an array of |n| enum value defs owned by |e|.
13611upb_EnumValueDef* _upb_EnumValueDefs_New(
13612 upb_DefBuilder* ctx, const char* prefix, int n,
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013613 const UPB_DESC(EnumValueDescriptorProto*) const* protos,
13614 const UPB_DESC(FeatureSet*) parent_features, upb_EnumDef* e,
Eric Salo8809a112022-11-21 13:01:06 -080013615 bool* is_sorted);
13616
13617const upb_EnumValueDef** _upb_EnumValueDefs_Sorted(const upb_EnumValueDef* v,
13618 int n, upb_Arena* a);
13619
13620#ifdef __cplusplus
13621} /* extern "C" */
13622#endif
13623
13624
13625#endif /* UPB_REFLECTION_ENUM_VALUE_DEF_INTERNAL_H_ */
13626
13627#ifndef UPB_REFLECTION_FIELD_DEF_INTERNAL_H_
13628#define UPB_REFLECTION_FIELD_DEF_INTERNAL_H_
13629
13630
13631// Must be last.
13632
13633#ifdef __cplusplus
13634extern "C" {
13635#endif
13636
13637upb_FieldDef* _upb_FieldDef_At(const upb_FieldDef* f, int i);
13638
Eric Salo8809a112022-11-21 13:01:06 -080013639bool _upb_FieldDef_IsClosedEnum(const upb_FieldDef* f);
13640bool _upb_FieldDef_IsProto3Optional(const upb_FieldDef* f);
13641int _upb_FieldDef_LayoutIndex(const upb_FieldDef* f);
13642uint64_t _upb_FieldDef_Modifiers(const upb_FieldDef* f);
13643void _upb_FieldDef_Resolve(upb_DefBuilder* ctx, const char* prefix,
13644 upb_FieldDef* f);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070013645void _upb_FieldDef_BuildMiniTableExtension(upb_DefBuilder* ctx,
13646 const upb_FieldDef* f);
13647
13648// Allocate and initialize an array of |n| extensions (field defs).
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013649upb_FieldDef* _upb_Extensions_New(upb_DefBuilder* ctx, int n,
13650 const UPB_DESC(FieldDescriptorProto*)
13651 const* protos,
13652 const UPB_DESC(FeatureSet*) parent_features,
13653 const char* prefix, upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080013654
13655// Allocate and initialize an array of |n| field defs.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013656upb_FieldDef* _upb_FieldDefs_New(upb_DefBuilder* ctx, int n,
13657 const UPB_DESC(FieldDescriptorProto*)
13658 const* protos,
13659 const UPB_DESC(FeatureSet*) parent_features,
13660 const char* prefix, upb_MessageDef* m,
13661 bool* is_sorted);
Eric Salo8809a112022-11-21 13:01:06 -080013662
13663// Allocate and return a list of pointers to the |n| field defs in |ff|,
13664// sorted by field number.
13665const upb_FieldDef** _upb_FieldDefs_Sorted(const upb_FieldDef* f, int n,
13666 upb_Arena* a);
13667
13668#ifdef __cplusplus
13669} /* extern "C" */
13670#endif
13671
13672
13673#endif /* UPB_REFLECTION_FIELD_DEF_INTERNAL_H_ */
13674
13675#ifndef UPB_REFLECTION_FILE_DEF_INTERNAL_H_
13676#define UPB_REFLECTION_FILE_DEF_INTERNAL_H_
13677
13678
13679// Must be last.
13680
13681#ifdef __cplusplus
13682extern "C" {
13683#endif
13684
13685const upb_MiniTableExtension* _upb_FileDef_ExtensionMiniTable(
13686 const upb_FileDef* f, int i);
13687const int32_t* _upb_FileDef_PublicDependencyIndexes(const upb_FileDef* f);
13688const int32_t* _upb_FileDef_WeakDependencyIndexes(const upb_FileDef* f);
13689
13690// upb_FileDef_Package() returns "" if f->package is NULL, this does not.
13691const char* _upb_FileDef_RawPackage(const upb_FileDef* f);
13692
13693void _upb_FileDef_Create(upb_DefBuilder* ctx,
Mike Kruskal232ecf42023-01-14 00:09:40 -080013694 const UPB_DESC(FileDescriptorProto) * file_proto);
Eric Salo8809a112022-11-21 13:01:06 -080013695
13696#ifdef __cplusplus
13697} /* extern "C" */
13698#endif
13699
13700
13701#endif /* UPB_REFLECTION_FILE_DEF_INTERNAL_H_ */
13702
13703#ifndef UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_
13704#define UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_
13705
13706
13707// Must be last.
13708
13709#ifdef __cplusplus
13710extern "C" {
13711#endif
13712
13713upb_MessageDef* _upb_MessageDef_At(const upb_MessageDef* m, int i);
13714bool _upb_MessageDef_InMessageSet(const upb_MessageDef* m);
13715bool _upb_MessageDef_Insert(upb_MessageDef* m, const char* name, size_t size,
13716 upb_value v, upb_Arena* a);
13717void _upb_MessageDef_InsertField(upb_DefBuilder* ctx, upb_MessageDef* m,
13718 const upb_FieldDef* f);
13719bool _upb_MessageDef_IsValidExtensionNumber(const upb_MessageDef* m, int n);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070013720void _upb_MessageDef_CreateMiniTable(upb_DefBuilder* ctx, upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080013721void _upb_MessageDef_LinkMiniTable(upb_DefBuilder* ctx,
13722 const upb_MessageDef* m);
13723void _upb_MessageDef_Resolve(upb_DefBuilder* ctx, upb_MessageDef* m);
13724
13725// Allocate and initialize an array of |n| message defs.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013726upb_MessageDef* _upb_MessageDefs_New(upb_DefBuilder* ctx, int n,
13727 const UPB_DESC(DescriptorProto*)
13728 const* protos,
13729 const UPB_DESC(FeatureSet*)
13730 parent_features,
13731 const upb_MessageDef* containing_type);
Eric Salo8809a112022-11-21 13:01:06 -080013732
13733#ifdef __cplusplus
13734} /* extern "C" */
13735#endif
13736
13737
13738#endif /* UPB_REFLECTION_MESSAGE_DEF_INTERNAL_H_ */
13739
13740#ifndef UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_
13741#define UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_
13742
13743
13744// Must be last.
13745
13746#ifdef __cplusplus
13747extern "C" {
13748#endif
13749
13750upb_ServiceDef* _upb_ServiceDef_At(const upb_ServiceDef* s, int i);
13751
13752// Allocate and initialize an array of |n| service defs.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013753upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n,
13754 const UPB_DESC(ServiceDescriptorProto*)
13755 const* protos,
13756 const UPB_DESC(FeatureSet*)
13757 parent_features);
Eric Salo8809a112022-11-21 13:01:06 -080013758
13759#ifdef __cplusplus
13760} /* extern "C" */
13761#endif
13762
13763
13764#endif /* UPB_REFLECTION_SERVICE_DEF_INTERNAL_H_ */
13765
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013766#ifndef UPB_REFLECTION_UPB_EDITION_DEFAULTS_H_
13767#define UPB_REFLECTION_UPB_EDITION_DEFAULTS_H_
13768
13769// This file contains the serialized FeatureSetDefaults object for
13770// language-independent features and (possibly at some point) for upb-specific
13771// features. This is used for feature resolution under Editions.
13772// NOLINTBEGIN
13773// clang-format off
Protobuf Team Bot5b8b87f2023-11-30 05:12:08 +000013774#define UPB_INTERNAL_UPB_EDITION_DEFAULTS "\n\021\022\014\010\001\020\002\030\002 \003(\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"
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013775// clang-format on
13776// NOLINTEND
13777
13778#endif // UPB_REFLECTION_UPB_EDITION_DEFAULTS_H_
13779
Eric Salo8809a112022-11-21 13:01:06 -080013780#ifndef UPB_REFLECTION_DESC_STATE_INTERNAL_H_
13781#define UPB_REFLECTION_DESC_STATE_INTERNAL_H_
13782
13783
13784// Must be last.
13785
13786// Manages the storage for mini descriptor strings as they are being encoded.
Protobuf Team Bot986cbb62023-09-19 15:03:51 +000013787// TODO: Move some of this state directly into the encoder, maybe.
Eric Salo8809a112022-11-21 13:01:06 -080013788typedef struct {
13789 upb_MtDataEncoder e;
13790 size_t bufsize;
13791 char* buf;
13792 char* ptr;
13793} upb_DescState;
13794
13795#ifdef __cplusplus
13796extern "C" {
13797#endif
13798
13799UPB_INLINE void _upb_DescState_Init(upb_DescState* d) {
13800 d->bufsize = kUpb_MtDataEncoder_MinSize * 2;
13801 d->buf = NULL;
13802 d->ptr = NULL;
13803}
13804
13805bool _upb_DescState_Grow(upb_DescState* d, upb_Arena* a);
13806
13807#ifdef __cplusplus
13808} /* extern "C" */
13809#endif
13810
13811
13812#endif /* UPB_REFLECTION_DESC_STATE_INTERNAL_H_ */
13813
13814#ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_
13815#define UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_
13816
13817
Protobuf Team Bot06310352023-09-26 21:54:58 +000013818// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080013819
13820#ifndef UPB_REFLECTION_ENUM_RESERVED_RANGE_H_
13821#define UPB_REFLECTION_ENUM_RESERVED_RANGE_H_
13822
13823
13824// Must be last.
13825
13826#ifdef __cplusplus
13827extern "C" {
13828#endif
13829
13830int32_t upb_EnumReservedRange_Start(const upb_EnumReservedRange* r);
13831int32_t upb_EnumReservedRange_End(const upb_EnumReservedRange* r);
13832
13833#ifdef __cplusplus
13834} /* extern "C" */
13835#endif
13836
13837
13838#endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_H_ */
13839
13840// Must be last.
13841
13842#ifdef __cplusplus
13843extern "C" {
13844#endif
13845
13846upb_EnumReservedRange* _upb_EnumReservedRange_At(const upb_EnumReservedRange* r,
13847 int i);
13848
13849// Allocate and initialize an array of |n| reserved ranges owned by |e|.
13850upb_EnumReservedRange* _upb_EnumReservedRanges_New(
13851 upb_DefBuilder* ctx, int n,
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013852 const UPB_DESC(EnumDescriptorProto_EnumReservedRange*) const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080013853 const upb_EnumDef* e);
13854
13855#ifdef __cplusplus
13856} /* extern "C" */
13857#endif
13858
13859
13860#endif /* UPB_REFLECTION_ENUM_RESERVED_RANGE_INTERNAL_H_ */
13861
Protobuf Team Bot7be2a452023-09-13 16:50:05 +000013862#ifndef UPB_REFLECTION_INTERNAL_STRDUP2_H_
13863#define UPB_REFLECTION_INTERNAL_STRDUP2_H_
13864
13865#include <stddef.h>
13866
13867
13868// Must be last.
13869
13870#ifdef __cplusplus
13871extern "C" {
13872#endif
13873
13874// Variant that works with a length-delimited rather than NULL-delimited string,
13875// as supported by strtable.
13876char* upb_strdup2(const char* s, size_t len, upb_Arena* a);
13877
13878#ifdef __cplusplus
13879} /* extern "C" */
13880#endif
13881
13882
13883#endif /* UPB_REFLECTION_INTERNAL_STRDUP2_H_ */
13884
Eric Salo8809a112022-11-21 13:01:06 -080013885#ifndef UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_
13886#define UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_
13887
13888
13889// Must be last.
13890
13891#ifdef __cplusplus
13892extern "C" {
13893#endif
13894
13895upb_ExtensionRange* _upb_ExtensionRange_At(const upb_ExtensionRange* r, int i);
13896
13897// Allocate and initialize an array of |n| extension ranges owned by |m|.
13898upb_ExtensionRange* _upb_ExtensionRanges_New(
13899 upb_DefBuilder* ctx, int n,
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013900 const UPB_DESC(DescriptorProto_ExtensionRange*) const* protos,
13901 const UPB_DESC(FeatureSet*) parent_features, const upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080013902
13903#ifdef __cplusplus
13904} /* extern "C" */
13905#endif
13906
13907
13908#endif /* UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_ */
13909
13910#ifndef UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_
13911#define UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_
13912
13913
13914// Must be last.
13915
13916#ifdef __cplusplus
13917extern "C" {
13918#endif
13919
13920upb_OneofDef* _upb_OneofDef_At(const upb_OneofDef* o, int i);
Jakob Buchgraberc0c79b22023-03-20 08:13:52 -070013921void _upb_OneofDef_Insert(upb_DefBuilder* ctx, upb_OneofDef* o,
13922 const upb_FieldDef* f, const char* name, size_t size);
Eric Salo8809a112022-11-21 13:01:06 -080013923
13924// Allocate and initialize an array of |n| oneof defs owned by |m|.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000013925upb_OneofDef* _upb_OneofDefs_New(upb_DefBuilder* ctx, int n,
13926 const UPB_DESC(OneofDescriptorProto*)
13927 const* protos,
13928 const UPB_DESC(FeatureSet*) parent_features,
13929 upb_MessageDef* m);
Eric Salo8809a112022-11-21 13:01:06 -080013930
13931size_t _upb_OneofDefs_Finalize(upb_DefBuilder* ctx, upb_MessageDef* m);
13932
13933#ifdef __cplusplus
13934} /* extern "C" */
13935#endif
13936
13937
13938#endif /* UPB_REFLECTION_ONEOF_DEF_INTERNAL_H_ */
13939
13940#ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_
13941#define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_
13942
13943
Protobuf Team Bot06310352023-09-26 21:54:58 +000013944// IWYU pragma: private, include "upb/reflection/def.h"
Eric Salo8809a112022-11-21 13:01:06 -080013945
13946#ifndef UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_
13947#define UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_
13948
13949
13950// Must be last.
13951
13952#ifdef __cplusplus
13953extern "C" {
13954#endif
13955
13956int32_t upb_MessageReservedRange_Start(const upb_MessageReservedRange* r);
13957int32_t upb_MessageReservedRange_End(const upb_MessageReservedRange* r);
13958
13959#ifdef __cplusplus
13960} /* extern "C" */
13961#endif
13962
13963
13964#endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_H_ */
13965
13966// Must be last.
13967
13968#ifdef __cplusplus
13969extern "C" {
13970#endif
13971
13972upb_MessageReservedRange* _upb_MessageReservedRange_At(
13973 const upb_MessageReservedRange* r, int i);
13974
13975// Allocate and initialize an array of |n| reserved ranges owned by |m|.
13976upb_MessageReservedRange* _upb_MessageReservedRanges_New(
13977 upb_DefBuilder* ctx, int n,
Mike Kruskal232ecf42023-01-14 00:09:40 -080013978 const UPB_DESC(DescriptorProto_ReservedRange) * const* protos,
Eric Salo8809a112022-11-21 13:01:06 -080013979 const upb_MessageDef* m);
13980
13981#ifdef __cplusplus
13982} /* extern "C" */
13983#endif
13984
13985
13986#endif /* UPB_REFLECTION_MESSAGE_RESERVED_RANGE_INTERNAL_H_ */
13987
13988#ifndef UPB_REFLECTION_METHOD_DEF_INTERNAL_H_
13989#define UPB_REFLECTION_METHOD_DEF_INTERNAL_H_
13990
13991
13992// Must be last.
13993
13994#ifdef __cplusplus
13995extern "C" {
13996#endif
13997
13998upb_MethodDef* _upb_MethodDef_At(const upb_MethodDef* m, int i);
13999
14000// Allocate and initialize an array of |n| method defs owned by |s|.
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000014001upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n,
14002 const UPB_DESC(MethodDescriptorProto*)
14003 const* protos,
14004 const UPB_DESC(FeatureSet*) parent_features,
14005 upb_ServiceDef* s);
Eric Salo8809a112022-11-21 13:01:06 -080014006
14007#ifdef __cplusplus
14008} /* extern "C" */
14009#endif
14010
14011
14012#endif /* UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ */
14013
Eric Salo8809a112022-11-21 13:01:06 -080014014// This should #undef all macros #defined in def.inc
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014015
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014016#undef UPB_SIZE
14017#undef UPB_PTR_AT
Joshua Habermandd69a482021-05-17 22:40:33 -070014018#undef UPB_MAPTYPE_STRING
Eric Salo3f36a912022-12-05 14:12:25 -080014019#undef UPB_EXPORT
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014020#undef UPB_INLINE
Eric Salo3f36a912022-12-05 14:12:25 -080014021#undef UPB_API
14022#undef UPB_API_INLINE
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014023#undef UPB_ALIGN_UP
14024#undef UPB_ALIGN_DOWN
14025#undef UPB_ALIGN_MALLOC
14026#undef UPB_ALIGN_OF
Protobuf Team Bote2785502023-12-21 21:28:36 +000014027#undef UPB_ALIGN_AS
Joshua Habermand3995ec2022-09-30 16:54:39 -070014028#undef UPB_MALLOC_ALIGN
Joshua Habermandd69a482021-05-17 22:40:33 -070014029#undef UPB_LIKELY
14030#undef UPB_UNLIKELY
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014031#undef UPB_FORCEINLINE
14032#undef UPB_NOINLINE
14033#undef UPB_NORETURN
Joshua Habermandd69a482021-05-17 22:40:33 -070014034#undef UPB_PRINTF
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014035#undef UPB_MAX
14036#undef UPB_MIN
14037#undef UPB_UNUSED
14038#undef UPB_ASSUME
14039#undef UPB_ASSERT
14040#undef UPB_UNREACHABLE
Joshua Habermandd69a482021-05-17 22:40:33 -070014041#undef UPB_SETJMP
14042#undef UPB_LONGJMP
14043#undef UPB_PTRADD
14044#undef UPB_MUSTTAIL
14045#undef UPB_FASTTABLE_SUPPORTED
Mike Kruskal232ecf42023-01-14 00:09:40 -080014046#undef UPB_FASTTABLE_MASK
Joshua Habermandd69a482021-05-17 22:40:33 -070014047#undef UPB_FASTTABLE
14048#undef UPB_FASTTABLE_INIT
Joshua Haberman9abf6e22021-01-13 12:16:25 -080014049#undef UPB_POISON_MEMORY_REGION
14050#undef UPB_UNPOISON_MEMORY_REGION
14051#undef UPB_ASAN
Sandy Zhange3b09432023-08-07 09:30:02 -070014052#undef UPB_ASAN_GUARD_SIZE
14053#undef UPB_CLANG_ASAN
Joshua Haberman7ecf43f2022-03-14 13:11:29 -070014054#undef UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3
Joshua Habermand3995ec2022-09-30 16:54:39 -070014055#undef UPB_DEPRECATED
14056#undef UPB_GNUC_MIN
Mike Kruskal232ecf42023-01-14 00:09:40 -080014057#undef UPB_DESCRIPTOR_UPB_H_FILENAME
14058#undef UPB_DESC
Protobuf Team Botce9dcc22023-11-03 22:38:26 +000014059#undef UPB_DESC_MINITABLE
Mike Kruskal232ecf42023-01-14 00:09:40 -080014060#undef UPB_IS_GOOGLE3
Eric Salodfb71552023-03-22 12:35:09 -070014061#undef UPB_ATOMIC
14062#undef UPB_USE_C11_ATOMICS
Deanna Garciac7d979d2023-04-14 17:22:13 -070014063#undef UPB_PRIVATE
Protobuf Team Bot07194fc2023-11-30 05:43:03 +000014064#undef UPB_ONLYBITS