This CL changes the upb compiler to no longer depend on C++ protobuf libraries. upb now uses its own reflection libraries to implement its code generator. # Key Benefits 1. upb can now use its own reflection libraries throughout the compiler. This makes upb more consistent and principled, and gives us more chances to dogfood our own C++ reflection API. This highlighted several parts of the C++ reflection API that were incomplete. 2. This CL removes code duplication that previously existed in the compiler. The upb reflection library has code to build MiniDescriptors and MiniTables out of descriptors, but prior to this CL the upb compiler could not use it. The upb compiler had a separate copy of this logic, and the compiler's copy of this logic was especially tricky and hard to maintain. This CL removes the separate copy of that logic. 3. This CL (mostly) removes upb's dependency on the C++ protobuf library. We still depend on `protoc` (the binary), but the runtime and compiler no longer link against C++'s libraries. This opens up the possibility of speeding up some builds significantly if we can use a prebuilt `protoc` binary. # Bootstrap Stages To bootstrap, we check in a copy of our generated code for `descriptor.proto` and `plugin.proto`. This allows the compiler to depend on the generated code for these two protos without creating a circular dependency. This code is checked in to the `stage0` directory. The bootstrapping process is divided into a few stages. All `cc_library()`, `upb_proto_library()`, and `cc_binary()` targets that would otherwise be circular participate in this staging process. That currently includes: * `//third_party/upb:descriptor_upb_proto` * `//third_party/upb:plugin_upb_proto` * `//third_party/upb:reflection` * `//third_party/upb:reflection_internal` * `//third_party/upbc:common` * `//third_party/upbc:file_layout` * `//third_party/upbc:plugin` * `//third_party/upbc:protoc-gen-upb` For each of these targets, we produce a rule for each stage (the logic for this is nicely encapsulated in Blaze/Bazel macros like `bootstrap_cc_library()` and `bootstrap_upb_proto_library()`, so the `BUILD` file remains readable). For example: * `//third_party/upb:descriptor_upb_proto_stage0` * `//third_party/upb:descriptor_upb_proto_stage1` * `//third_party/upb:descriptor_upb_proto` The stages are: 1. `stage0`: This uses the checked-in version of the generated code. The stage0 compiler is correct and outputs the same code as all other compilers, but it is unnecessarily slow because its protos were compiled in bootstrap mode. The stage0 compiler is used to generate protos for stage1. 2. `stage1`: The stage1 compiler is correct and fast, and therefore we use it in almost all cases (eg. `upb_proto_library()`). However its own protos were not generated using `upb_proto_library()`, so its `cc_library()` targets cannot be safely mixed with `upb_proto_library()`, as this would lead to duplicate symbols. 3. final (no stage): The final compiler is identical to the `stage1` compiler. The only difference is that its protos were built with `upb_proto_library()`. This doesn't matter very much for the compiler binary, but for the `cc_library()` targets like `//third_party/upb:reflection`, only the final targets can be safely linked in by other applications. # "Bootstrap Mode" Protos The checked-in generated code is generated in a special "bootstrap" mode that is a bit different than normal generated code. Bootstrap mode avoids depending on the internal representation of MiniTables or the messages, at the cost of slower runtime performance. Bootstrap mode only interacts with MiniTables and messages using public APIs such as `upb_MiniTable_Build()`, `upb_Message_GetInt32()`, etc. This is very important as it allows us to change the internal representation without needing to regenerate our bootstrap protos. This will make it far easier to write CLs that change the internal representation, because it avoids the awkward dance of trying to regenerate the bootstrap protos when the compiler itself is broken due to bootstrap protos being out of date. The bootstrap generated code does have two downsides: 1. The accessors are less efficient, because they look up MiniTable fields by number instead of hard-coding the MiniTableField into the generated code. 2. It requires runtime initialization of the MiniTables, which costs CPU cycles at startup, and also allocates memory which is never freed. Per google3 rules this is not really a leak, since this memory is still reachable via static variables, but it is undesirable in many contexts. We could fix this part by introducing the equivalent of `google::protobuf::ShutdownProtobufLibrary()`). These downsides are fine for the bootstrapping process, but they are reason enough not to enable bootstrap mode in general for all protos. # Bootstrapping Always Uses OSS Protos To enable smooth syncing between Google3 and OSS, we always use an OSS version of the checked in generated code for `stage0`, even in google3. This requires that the google3 code can be switched to reference the OSS proto names using a preprocessor define. We introduce the `UPB_DESC(xyz)` macro for this, which will expand into either `proto2_xyz` or `google_protobuf_xyz`. Any libraries used in `stage0` must use `UPB_DESC(xyz)` rather than refer to the symbol names directly. PiperOrigin-RevId: 501458451pull/13171/head
parent
9b5a084118
commit
e41a2d7ba0
35 changed files with 7428 additions and 1112 deletions
@ -0,0 +1,397 @@ |
||||
#include <stddef.h> |
||||
#include "upb/collections/array_internal.h" |
||||
#include "upb/message/internal.h" |
||||
#include "upb/mini_table/decode.h" |
||||
#include "upb/mini_table/enum_internal.h" |
||||
#include "google/protobuf/descriptor.upb.h" |
||||
|
||||
static upb_Arena* upb_BootstrapArena() { |
||||
static upb_Arena* arena = NULL; |
||||
if (!arena) arena = upb_Arena_New(); |
||||
return arena; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_FileDescriptorSet_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$G"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 1), google_protobuf_FileDescriptorProto_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_FileDescriptorProto_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$11EGGGG33<<11"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 4), google_protobuf_DescriptorProto_msg_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 5), google_protobuf_EnumDescriptorProto_msg_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 6), google_protobuf_ServiceDescriptorProto_msg_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 7), google_protobuf_FieldDescriptorProto_msg_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 8), google_protobuf_FileOptions_msg_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 9), google_protobuf_SourceCodeInfo_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_DescriptorProto_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$1GGGGG3GGE"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 2), google_protobuf_FieldDescriptorProto_msg_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 6), google_protobuf_FieldDescriptorProto_msg_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 3), google_protobuf_DescriptorProto_msg_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 4), google_protobuf_EnumDescriptorProto_msg_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 5), google_protobuf_DescriptorProto_ExtensionRange_msg_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 8), google_protobuf_OneofDescriptorProto_msg_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 7), google_protobuf_MessageOptions_msg_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 9), google_protobuf_DescriptorProto_ReservedRange_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_DescriptorProto_ExtensionRange_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$((3"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 3), google_protobuf_ExtensionRangeOptions_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_DescriptorProto_ReservedRange_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$(("; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_ExtensionRangeOptions_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$Pf~G"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 999), google_protobuf_UninterpretedOption_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_FieldDescriptorProto_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$11(44113(1f/"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubEnum(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 4), google_protobuf_FieldDescriptorProto_Label_enum_init()); |
||||
upb_MiniTable_SetSubEnum(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 5), google_protobuf_FieldDescriptorProto_Type_enum_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 8), google_protobuf_FieldOptions_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_OneofDescriptorProto_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$13"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 2), google_protobuf_OneofOptions_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_EnumDescriptorProto_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$1G3GE"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 2), google_protobuf_EnumValueDescriptorProto_msg_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 3), google_protobuf_EnumOptions_msg_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 4), google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_EnumDescriptorProto_EnumReservedRange_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$(("; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_EnumValueDescriptorProto_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$1(3"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 3), google_protobuf_EnumValueOptions_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_ServiceDescriptorProto_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$1G3"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 2), google_protobuf_MethodDescriptorProto_msg_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 3), google_protobuf_ServiceOptions_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_MethodDescriptorProto_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$1113//"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 4), google_protobuf_MethodOptions_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_FileOptions_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$P1f14/1d///a/b/c/c/d11a111/a11y|G"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubEnum(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 9), google_protobuf_FileOptions_OptimizeMode_enum_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 999), google_protobuf_UninterpretedOption_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_MessageOptions_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$P///c/c/{}G"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 999), google_protobuf_UninterpretedOption_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_FieldOptions_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$P4//a/4c/d//v}G"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubEnum(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 1), google_protobuf_FieldOptions_CType_enum_init()); |
||||
upb_MiniTable_SetSubEnum(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 6), google_protobuf_FieldOptions_JSType_enum_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 999), google_protobuf_UninterpretedOption_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_OneofOptions_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$Pf~G"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 999), google_protobuf_UninterpretedOption_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_EnumOptions_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$Pa//b/`~G"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 999), google_protobuf_UninterpretedOption_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_EnumValueOptions_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$P/e~G"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 999), google_protobuf_UninterpretedOption_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_ServiceOptions_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$P``/e}G"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 999), google_protobuf_UninterpretedOption_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_MethodOptions_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$P``/4d}G"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubEnum(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 34), google_protobuf_MethodOptions_IdempotencyLevel_enum_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 999), google_protobuf_UninterpretedOption_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_UninterpretedOption_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$aG1,+ 01"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 2), google_protobuf_UninterpretedOption_NamePart_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_UninterpretedOption_NamePart_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$1N/N"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_SourceCodeInfo_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$G"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 1), google_protobuf_SourceCodeInfo_Location_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_SourceCodeInfo_Location_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$<M<M11aE"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_GeneratedCodeInfo_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$G"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 1), google_protobuf_GeneratedCodeInfo_Annotation_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_GeneratedCodeInfo_Annotation_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$<M1((4"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubEnum(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 5), google_protobuf_GeneratedCodeInfo_Annotation_Semantic_enum_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTableEnum* google_protobuf_FieldDescriptorProto_Type_enum_init() { |
||||
static const upb_MiniTableEnum* mini_table = NULL; |
||||
static const char* mini_descriptor = "!@AA1"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTableEnum_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTableEnum* google_protobuf_FieldDescriptorProto_Label_enum_init() { |
||||
static const upb_MiniTableEnum* mini_table = NULL; |
||||
static const char* mini_descriptor = "!0"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTableEnum_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTableEnum* google_protobuf_FileOptions_OptimizeMode_enum_init() { |
||||
static const upb_MiniTableEnum* mini_table = NULL; |
||||
static const char* mini_descriptor = "!0"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTableEnum_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTableEnum* google_protobuf_FieldOptions_CType_enum_init() { |
||||
static const upb_MiniTableEnum* mini_table = NULL; |
||||
static const char* mini_descriptor = "!)"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTableEnum_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTableEnum* google_protobuf_FieldOptions_JSType_enum_init() { |
||||
static const upb_MiniTableEnum* mini_table = NULL; |
||||
static const char* mini_descriptor = "!)"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTableEnum_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTableEnum* google_protobuf_MethodOptions_IdempotencyLevel_enum_init() { |
||||
static const upb_MiniTableEnum* mini_table = NULL; |
||||
static const char* mini_descriptor = "!)"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTableEnum_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTableEnum* google_protobuf_GeneratedCodeInfo_Annotation_Semantic_enum_init() { |
||||
static const upb_MiniTableEnum* mini_table = NULL; |
||||
static const char* mini_descriptor = "!)"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTableEnum_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
return mini_table; |
||||
} |
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,166 @@ |
||||
"""Macros that implement bootstrapping for the upb code generator.""" |
||||
|
||||
load( |
||||
"//bazel:upb_proto_library.bzl", |
||||
"upb_proto_library", |
||||
) |
||||
load( |
||||
"//cmake:build_defs.bzl", |
||||
"staleness_test", |
||||
) |
||||
|
||||
_stages = ["_stage0", "_stage1", ""] |
||||
_protoc = "@com_google_protobuf//:protoc" |
||||
_upbc_base = "//upbc:protoc-gen-upb" |
||||
|
||||
# begin:google_only |
||||
# _is_google3 = True |
||||
# _extra_proto_path = "" |
||||
# end:google_only |
||||
|
||||
# begin:github_only |
||||
_is_google3 = False |
||||
_extra_proto_path = "-Iexternal/com_google_protobuf/src " |
||||
# end:github_only |
||||
|
||||
def _upbc(stage): |
||||
return _upbc_base + _stages[stage] |
||||
|
||||
def bootstrap_cc_library(name, visibility, deps, bootstrap_deps, **kwargs): |
||||
for stage in _stages: |
||||
stage_visibility = visibility if stage == "" else ["//upbc:__pkg__"] |
||||
native.cc_library( |
||||
name = name + stage, |
||||
deps = deps + [dep + stage for dep in bootstrap_deps], |
||||
visibility = stage_visibility, |
||||
**kwargs |
||||
) |
||||
|
||||
def bootstrap_cc_binary(name, deps, bootstrap_deps, **kwargs): |
||||
for stage in _stages: |
||||
native.cc_binary( |
||||
name = name + stage, |
||||
deps = deps + [dep + stage for dep in bootstrap_deps], |
||||
**kwargs |
||||
) |
||||
|
||||
def _generated_srcs_for_suffix(prefix, srcs, suffix): |
||||
return [prefix + "/" + src[:-len(".proto")] + suffix for src in srcs] |
||||
|
||||
def _generated_srcs(prefix, srcs): |
||||
return _generated_srcs_for_suffix(prefix, srcs, ".upb.h") + _generated_srcs_for_suffix(prefix, srcs, ".upb.c") |
||||
|
||||
def _stage0_proto_staleness_test(name, base_dir, src_files, src_rules, strip_prefix): |
||||
native.genrule( |
||||
name = name + "_generate_bootstrap", |
||||
srcs = src_rules, |
||||
outs = _generated_srcs("bootstrap_generated_sources/" + base_dir + "stage0", src_files), |
||||
tools = [_protoc, _upbc(0)], |
||||
cmd = |
||||
"$(location " + _protoc + ") " + |
||||
"-I$(GENDIR)/" + strip_prefix + " " + _extra_proto_path + |
||||
"--plugin=protoc-gen-upb=$(location " + _upbc(0) + ") " + |
||||
"--upb_out=bootstrap_upb:$(@D)/bootstrap_generated_sources/" + base_dir + "stage0 " + |
||||
" ".join(src_files), |
||||
) |
||||
|
||||
staleness_test( |
||||
name = name + "_staleness_test", |
||||
outs = _generated_srcs(base_dir + "stage0", src_files), |
||||
generated_pattern = "bootstrap_generated_sources/%s", |
||||
target_files = native.glob([base_dir + "stage0/**"]), |
||||
# To avoid skew problems for descriptor.proto/pluging.proto between |
||||
# GitHub repos. It's not critical that the checked-in protos are up to |
||||
# date for every change, they just needs to be complete enough to have |
||||
# everything needed by the code generator itself. |
||||
tags = ["manual"], |
||||
) |
||||
|
||||
def bootstrap_upb_proto_library( |
||||
name, |
||||
base_dir, |
||||
google3_src_files, |
||||
google3_src_rules, |
||||
oss_src_files, |
||||
oss_src_rules, |
||||
oss_strip_prefix, |
||||
proto_lib_deps, |
||||
visibility, |
||||
deps = [], |
||||
**kwargs): |
||||
"""A version of upb_proto_library() that is augmented to allow for bootstrapping the compiler. |
||||
|
||||
Args: |
||||
name: Name of this rule. This name will resolve to a upb_proto_library(). |
||||
base_dir: The directory that all generated files should be placed under. |
||||
google3_src_files: Google3 filenames of .proto files that should be built by this rule. |
||||
The names should be relative to the depot base. |
||||
google3_src_rules: Target names of the Blaze rules that will provide these filenames. |
||||
oss_src_files: OSS filenames of .proto files that should be built by this rule. |
||||
oss_src_rules: Target names of the Bazel rules that will provide these filenames. |
||||
oss_strip_prefix: Prefix that should be stripped from OSS file names. |
||||
proto_lib_deps: proto_library() rules that we will use to build the protos when we are |
||||
not bootstrapping. |
||||
visibility: Visibility list for the final upb_proto_library() rule. Bootstrapping rules |
||||
will always be hidden, and will not honor the visibility parameter passed here. |
||||
deps: other bootstrap_upb_proto_library() rules that this one depends on. |
||||
**kwargs: Other arguments that will be passed through to cc_library(), genrule(), and |
||||
upb_proto_library(). |
||||
""" |
||||
_stage0_proto_staleness_test(name, base_dir, oss_src_files, oss_src_rules, oss_strip_prefix) |
||||
|
||||
# stage0 uses checked-in protos. |
||||
native.cc_library( |
||||
name = name + "_stage0", |
||||
srcs = _generated_srcs_for_suffix(base_dir + "stage0", oss_src_files, ".upb.c"), |
||||
hdrs = _generated_srcs_for_suffix(base_dir + "stage0", oss_src_files, ".upb.h"), |
||||
includes = [base_dir + "stage0"], |
||||
visibility = ["//upbc:__pkg__"], |
||||
# This macro signals to the runtime that it must use OSS APIs for descriptor.proto/plugin.proto. |
||||
defines = ["UPB_BOOTSTRAP_STAGE0"], |
||||
deps = [ |
||||
"//:generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", |
||||
"//:mini_table", |
||||
] + [dep + "_stage0" for dep in deps], |
||||
**kwargs |
||||
) |
||||
|
||||
src_files = google3_src_files if _is_google3 else oss_src_files |
||||
src_rules = google3_src_rules if _is_google3 else oss_src_rules |
||||
|
||||
# Generate stage1 protos using stage0 compiler. |
||||
native.genrule( |
||||
name = "gen_" + name + "_stage1", |
||||
srcs = src_rules, |
||||
outs = _generated_srcs(base_dir + "stage1", src_files), |
||||
cmd = "$(location " + _protoc + ") " + |
||||
"--plugin=protoc-gen-upb=$(location " + _upbc(0) + ") " + _extra_proto_path + |
||||
"--upb_out=$(@D)/" + base_dir + "stage1 " + |
||||
" ".join(src_files), |
||||
visibility = ["//upbc:__pkg__"], |
||||
tools = [ |
||||
_protoc, |
||||
_upbc(0), |
||||
], |
||||
**kwargs |
||||
) |
||||
|
||||
native.cc_library( |
||||
name = name + "_stage1", |
||||
srcs = _generated_srcs_for_suffix(base_dir + "stage1", src_files, ".upb.c"), |
||||
hdrs = _generated_srcs_for_suffix(base_dir + "stage1", src_files, ".upb.h"), |
||||
includes = [base_dir + "stage1"], |
||||
visibility = ["//upbc:__pkg__"], |
||||
deps = [ |
||||
"//:generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", |
||||
] + [dep + "_stage1" for dep in deps], |
||||
**kwargs |
||||
) |
||||
|
||||
# The final protos are generated via normal upb_proto_library(). |
||||
upb_proto_library( |
||||
name = name, |
||||
deps = proto_lib_deps, |
||||
visibility = visibility, |
||||
**kwargs |
||||
) |
@ -0,0 +1,198 @@ |
||||
// Copyright (c) 2009-2021, Google LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of Google LLC nor the
|
||||
// names of its contributors may be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY DIRECT,
|
||||
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef UPB_UPBC_PLUGIN_H_ |
||||
#define UPB_UPBC_PLUGIN_H_ |
||||
|
||||
#include <string> |
||||
#include <vector> |
||||
|
||||
// begin:google_only
|
||||
// #ifndef UPB_BOOTSTRAP_STAGE0
|
||||
// #include "net/proto2/compiler/proto/plugin.upb.h"
|
||||
// #include "net/proto2/proto/descriptor.upb.h"
|
||||
// #else
|
||||
// #include "google/protobuf/compiler/plugin.upb.h"
|
||||
// #include "google/protobuf/descriptor.upb.h"
|
||||
// #endif
|
||||
// end:google_only
|
||||
|
||||
// begin:github_only
|
||||
#include "google/protobuf/compiler/plugin.upb.h" |
||||
#include "google/protobuf/descriptor.upb.h" |
||||
// end:github_only
|
||||
|
||||
#include "absl/container/flat_hash_set.h" |
||||
#include "absl/log/log.h" |
||||
#include "absl/strings/str_split.h" |
||||
#include "absl/strings/string_view.h" |
||||
#include "upb/reflection/def.hpp" |
||||
|
||||
// Must be last.
|
||||
#include "upb/port/def.inc" |
||||
|
||||
namespace upbc { |
||||
|
||||
inline std::vector<std::pair<std::string, std::string>> ParseGeneratorParameter( |
||||
const absl::string_view text) { |
||||
std::vector<std::pair<std::string, std::string>> ret; |
||||
for (absl::string_view sp : absl::StrSplit(text, ',', absl::SkipEmpty())) { |
||||
std::string::size_type equals_pos = sp.find_first_of('='); |
||||
std::pair<std::string, std::string> value; |
||||
if (equals_pos == std::string::npos) { |
||||
value.first = std::string(sp); |
||||
} else { |
||||
value.first = std::string(sp.substr(0, equals_pos)); |
||||
value.second = std::string(sp.substr(equals_pos + 1)); |
||||
} |
||||
ret.push_back(std::move(value)); |
||||
} |
||||
return ret; |
||||
} |
||||
|
||||
class Plugin { |
||||
public: |
||||
Plugin() { ReadRequest(); } |
||||
~Plugin() { WriteResponse(); } |
||||
|
||||
absl::string_view parameter() const { |
||||
return ToStringView( |
||||
UPB_DESC(compiler_CodeGeneratorRequest_parameter)(request_)); |
||||
} |
||||
|
||||
template <class T> |
||||
void GenerateFilesRaw(T&& func) { |
||||
absl::flat_hash_set<absl::string_view> files_to_generate; |
||||
size_t size; |
||||
const upb_StringView* file_to_generate = UPB_DESC( |
||||
compiler_CodeGeneratorRequest_file_to_generate)(request_, &size); |
||||
for (size_t i = 0; i < size; i++) { |
||||
files_to_generate.insert( |
||||
{file_to_generate[i].data, file_to_generate[i].size}); |
||||
} |
||||
|
||||
const UPB_DESC(FileDescriptorProto)* const* files = |
||||
UPB_DESC(compiler_CodeGeneratorRequest_proto_file)(request_, &size); |
||||
for (size_t i = 0; i < size; i++) { |
||||
upb::Status status; |
||||
absl::string_view name = |
||||
ToStringView(UPB_DESC(FileDescriptorProto_name)(files[i])); |
||||
func(files[i], files_to_generate.contains(name)); |
||||
} |
||||
} |
||||
|
||||
template <class T> |
||||
void GenerateFiles(T&& func) { |
||||
GenerateFilesRaw( |
||||
[this, &func](const UPB_DESC(FileDescriptorProto) * file_proto, |
||||
bool generate) { |
||||
upb::Status status; |
||||
upb::FileDefPtr file = pool_.AddFile(file_proto, &status); |
||||
if (!file) { |
||||
absl::string_view name = |
||||
ToStringView(UPB_DESC(FileDescriptorProto_name)(file_proto)); |
||||
LOG(FATAL) << "Couldn't add file " << name |
||||
<< " to DefPool: " << status.error_message(); |
||||
} |
||||
if (generate) func(file); |
||||
}); |
||||
} |
||||
|
||||
void SetError(absl::string_view error) { |
||||
char* data = |
||||
static_cast<char*>(upb_Arena_Malloc(arena_.ptr(), error.size())); |
||||
memcpy(data, error.data(), error.size()); |
||||
UPB_DESC(compiler_CodeGeneratorResponse_set_error) |
||||
(response_, upb_StringView_FromDataAndSize(data, error.size())); |
||||
} |
||||
|
||||
void AddOutputFile(absl::string_view filename, absl::string_view content) { |
||||
UPB_DESC(compiler_CodeGeneratorResponse_File)* file = UPB_DESC( |
||||
compiler_CodeGeneratorResponse_add_file)(response_, arena_.ptr()); |
||||
UPB_DESC(compiler_CodeGeneratorResponse_File_set_name) |
||||
(file, StringDup(filename)); |
||||
UPB_DESC(compiler_CodeGeneratorResponse_File_set_content) |
||||
(file, StringDup(content)); |
||||
} |
||||
|
||||
private: |
||||
upb::Arena arena_; |
||||
upb::DefPool pool_; |
||||
UPB_DESC(compiler_CodeGeneratorRequest) * request_; |
||||
UPB_DESC(compiler_CodeGeneratorResponse) * response_; |
||||
|
||||
static absl::string_view ToStringView(upb_StringView sv) { |
||||
return absl::string_view(sv.data, sv.size); |
||||
} |
||||
|
||||
upb_StringView StringDup(absl::string_view s) { |
||||
char* data = |
||||
reinterpret_cast<char*>(upb_Arena_Malloc(arena_.ptr(), s.size())); |
||||
memcpy(data, s.data(), s.size()); |
||||
return upb_StringView_FromDataAndSize(data, s.size()); |
||||
} |
||||
|
||||
std::string ReadAllStdinBinary() { |
||||
std::string data; |
||||
stdin = freopen(nullptr, "rb", stdin); |
||||
char buf[4096]; |
||||
while (size_t len = fread(buf, 1, sizeof(buf), stdin)) { |
||||
data.append(buf, len); |
||||
} |
||||
return data; |
||||
} |
||||
|
||||
void ReadRequest() { |
||||
std::string data = ReadAllStdinBinary(); |
||||
request_ = UPB_DESC(compiler_CodeGeneratorRequest_parse)( |
||||
data.data(), data.size(), arena_.ptr()); |
||||
if (!request_) { |
||||
LOG(FATAL) << "Failed to parse CodeGeneratorRequest"; |
||||
} |
||||
response_ = UPB_DESC(compiler_CodeGeneratorResponse_new)(arena_.ptr()); |
||||
UPB_DESC(compiler_CodeGeneratorResponse_set_supported_features) |
||||
(response_, |
||||
UPB_DESC(compiler_CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)); |
||||
} |
||||
|
||||
void WriteResponse() { |
||||
size_t size; |
||||
char* serialized = UPB_DESC(compiler_CodeGeneratorResponse_serialize)( |
||||
response_, arena_.ptr(), &size); |
||||
if (!serialized) { |
||||
LOG(FATAL) << "Failed to serialize CodeGeneratorResponse"; |
||||
} |
||||
|
||||
if (fwrite(serialized, 1, size, stdout) != size) { |
||||
LOG(FATAL) << "Failed to write response to stdout"; |
||||
} |
||||
} |
||||
}; |
||||
|
||||
} // namespace upbc
|
||||
|
||||
#include "upb/port/undef.inc" |
||||
|
||||
#endif // UPB_UPBC_PLUGIN_H_
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,68 @@ |
||||
#include <stddef.h> |
||||
#include "upb/collections/array_internal.h" |
||||
#include "upb/message/internal.h" |
||||
#include "upb/mini_table/decode.h" |
||||
#include "upb/mini_table/enum_internal.h" |
||||
#include "google/protobuf/compiler/plugin.upb.h" |
||||
|
||||
#include "google/protobuf/descriptor.upb.h" |
||||
static upb_Arena* upb_BootstrapArena() { |
||||
static upb_Arena* arena = NULL; |
||||
if (!arena) arena = upb_Arena_New(); |
||||
return arena; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_compiler_Version_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$(((1"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_compiler_CodeGeneratorRequest_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$E13kG"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 15), google_protobuf_FileDescriptorProto_msg_init()); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 3), google_protobuf_compiler_Version_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_compiler_CodeGeneratorResponse_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$1,lG"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 15), google_protobuf_compiler_CodeGeneratorResponse_File_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTable* google_protobuf_compiler_CodeGeneratorResponse_File_msg_init() { |
||||
static upb_MiniTable* mini_table = NULL; |
||||
static const char* mini_descriptor = "$11l13"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 16), google_protobuf_GeneratedCodeInfo_msg_init()); |
||||
return mini_table; |
||||
} |
||||
|
||||
const upb_MiniTableEnum* google_protobuf_compiler_CodeGeneratorResponse_Feature_enum_init() { |
||||
static const upb_MiniTableEnum* mini_table = NULL; |
||||
static const char* mini_descriptor = "!$"; |
||||
if (mini_table) return mini_table; |
||||
mini_table = |
||||
upb_MiniTableEnum_Build(mini_descriptor, strlen(mini_descriptor), |
||||
upb_BootstrapArena(), NULL); |
||||
return mini_table; |
||||
} |
||||
|
@ -0,0 +1,585 @@ |
||||
/* This file was generated by upbc (the upb compiler) from the input
|
||||
* file: |
||||
* |
||||
* google/protobuf/compiler/plugin.proto |
||||
* |
||||
* Do not edit -- your changes will be discarded when the file is |
||||
* regenerated. */ |
||||
|
||||
#ifndef GOOGLE_PROTOBUF_COMPILER_PLUGIN_PROTO_UPB_H_ |
||||
#define GOOGLE_PROTOBUF_COMPILER_PLUGIN_PROTO_UPB_H_ |
||||
|
||||
#include "upb/collections/array_internal.h" |
||||
#include "upb/collections/map_gencode_util.h" |
||||
#include "upb/message/accessors.h" |
||||
#include "upb/message/internal.h" |
||||
#include "upb/mini_table/enum_internal.h" |
||||
#include "upb/wire/decode.h" |
||||
#include "upb/wire/decode_fast.h" |
||||
#include "upb/wire/encode.h" |
||||
|
||||
// Must be last.
|
||||
#include "upb/port/def.inc" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
typedef struct google_protobuf_compiler_Version google_protobuf_compiler_Version; |
||||
typedef struct google_protobuf_compiler_CodeGeneratorRequest google_protobuf_compiler_CodeGeneratorRequest; |
||||
typedef struct google_protobuf_compiler_CodeGeneratorResponse google_protobuf_compiler_CodeGeneratorResponse; |
||||
typedef struct google_protobuf_compiler_CodeGeneratorResponse_File google_protobuf_compiler_CodeGeneratorResponse_File; |
||||
extern const upb_MiniTable* google_protobuf_compiler_Version_msg_init(); |
||||
extern const upb_MiniTable* google_protobuf_compiler_CodeGeneratorRequest_msg_init(); |
||||
extern const upb_MiniTable* google_protobuf_compiler_CodeGeneratorResponse_msg_init(); |
||||
extern const upb_MiniTable* google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(); |
||||
struct google_protobuf_FileDescriptorProto; |
||||
struct google_protobuf_GeneratedCodeInfo; |
||||
extern const upb_MiniTable* google_protobuf_FileDescriptorProto_msg_init(); |
||||
extern const upb_MiniTable* google_protobuf_GeneratedCodeInfo_msg_init(); |
||||
|
||||
typedef enum { |
||||
google_protobuf_compiler_CodeGeneratorResponse_FEATURE_NONE = 0, |
||||
google_protobuf_compiler_CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL = 1 |
||||
} google_protobuf_compiler_CodeGeneratorResponse_Feature; |
||||
|
||||
|
||||
extern const upb_MiniTableEnum* google_protobuf_compiler_CodeGeneratorResponse_Feature_enum_init(); |
||||
|
||||
/* google.protobuf.compiler.Version */ |
||||
|
||||
UPB_INLINE google_protobuf_compiler_Version* google_protobuf_compiler_Version_new(upb_Arena* arena) { |
||||
return (google_protobuf_compiler_Version*)_upb_Message_New(google_protobuf_compiler_Version_msg_init(), arena); |
||||
} |
||||
UPB_INLINE google_protobuf_compiler_Version* google_protobuf_compiler_Version_parse(const char* buf, size_t size, upb_Arena* arena) { |
||||
google_protobuf_compiler_Version* ret = google_protobuf_compiler_Version_new(arena); |
||||
if (!ret) return NULL; |
||||
if (upb_Decode(buf, size, ret, google_protobuf_compiler_Version_msg_init(), NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
||||
return NULL; |
||||
} |
||||
return ret; |
||||
} |
||||
UPB_INLINE google_protobuf_compiler_Version* google_protobuf_compiler_Version_parse_ex(const char* buf, size_t size, |
||||
const upb_ExtensionRegistry* extreg, |
||||
int options, upb_Arena* arena) { |
||||
google_protobuf_compiler_Version* ret = google_protobuf_compiler_Version_new(arena); |
||||
if (!ret) return NULL; |
||||
if (upb_Decode(buf, size, ret, google_protobuf_compiler_Version_msg_init(), extreg, options, arena) != |
||||
kUpb_DecodeStatus_Ok) { |
||||
return NULL; |
||||
} |
||||
return ret; |
||||
} |
||||
UPB_INLINE char* google_protobuf_compiler_Version_serialize(const google_protobuf_compiler_Version* msg, upb_Arena* arena, size_t* len) { |
||||
char* ptr; |
||||
(void)upb_Encode(msg, google_protobuf_compiler_Version_msg_init(), 0, arena, &ptr, len); |
||||
return ptr; |
||||
} |
||||
UPB_INLINE char* google_protobuf_compiler_Version_serialize_ex(const google_protobuf_compiler_Version* msg, int options, |
||||
upb_Arena* arena, size_t* len) { |
||||
char* ptr; |
||||
(void)upb_Encode(msg, google_protobuf_compiler_Version_msg_init(), options, arena, &ptr, len); |
||||
return ptr; |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_Version_clear_major(google_protobuf_compiler_Version* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_Version_msg_init(), 1); |
||||
_upb_Message_ClearNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE int32_t google_protobuf_compiler_Version_major(const google_protobuf_compiler_Version* msg) { |
||||
int32_t default_val = (int32_t)0; |
||||
int32_t ret; |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_Version_msg_init(), 1); |
||||
_upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
||||
return ret; |
||||
} |
||||
UPB_INLINE bool google_protobuf_compiler_Version_has_major(const google_protobuf_compiler_Version* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_Version_msg_init(), 1); |
||||
return _upb_Message_HasNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_Version_clear_minor(google_protobuf_compiler_Version* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_Version_msg_init(), 2); |
||||
_upb_Message_ClearNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE int32_t google_protobuf_compiler_Version_minor(const google_protobuf_compiler_Version* msg) { |
||||
int32_t default_val = (int32_t)0; |
||||
int32_t ret; |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_Version_msg_init(), 2); |
||||
_upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
||||
return ret; |
||||
} |
||||
UPB_INLINE bool google_protobuf_compiler_Version_has_minor(const google_protobuf_compiler_Version* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_Version_msg_init(), 2); |
||||
return _upb_Message_HasNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_Version_clear_patch(google_protobuf_compiler_Version* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_Version_msg_init(), 3); |
||||
_upb_Message_ClearNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE int32_t google_protobuf_compiler_Version_patch(const google_protobuf_compiler_Version* msg) { |
||||
int32_t default_val = (int32_t)0; |
||||
int32_t ret; |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_Version_msg_init(), 3); |
||||
_upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
||||
return ret; |
||||
} |
||||
UPB_INLINE bool google_protobuf_compiler_Version_has_patch(const google_protobuf_compiler_Version* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_Version_msg_init(), 3); |
||||
return _upb_Message_HasNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_Version_clear_suffix(google_protobuf_compiler_Version* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_Version_msg_init(), 4); |
||||
_upb_Message_ClearNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE upb_StringView google_protobuf_compiler_Version_suffix(const google_protobuf_compiler_Version* msg) { |
||||
upb_StringView default_val = upb_StringView_FromString(""); |
||||
upb_StringView ret; |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_Version_msg_init(), 4); |
||||
_upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
||||
return ret; |
||||
} |
||||
UPB_INLINE bool google_protobuf_compiler_Version_has_suffix(const google_protobuf_compiler_Version* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_Version_msg_init(), 4); |
||||
return _upb_Message_HasNonExtensionField(msg, &field); |
||||
} |
||||
|
||||
UPB_INLINE void google_protobuf_compiler_Version_set_major(google_protobuf_compiler_Version *msg, int32_t value) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_Version_msg_init(), 1); |
||||
_upb_Message_SetNonExtensionField(msg, &field, &value); |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_Version_set_minor(google_protobuf_compiler_Version *msg, int32_t value) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_Version_msg_init(), 2); |
||||
_upb_Message_SetNonExtensionField(msg, &field, &value); |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_Version_set_patch(google_protobuf_compiler_Version *msg, int32_t value) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_Version_msg_init(), 3); |
||||
_upb_Message_SetNonExtensionField(msg, &field, &value); |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_Version_set_suffix(google_protobuf_compiler_Version *msg, upb_StringView value) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_Version_msg_init(), 4); |
||||
_upb_Message_SetNonExtensionField(msg, &field, &value); |
||||
} |
||||
|
||||
/* google.protobuf.compiler.CodeGeneratorRequest */ |
||||
|
||||
UPB_INLINE google_protobuf_compiler_CodeGeneratorRequest* google_protobuf_compiler_CodeGeneratorRequest_new(upb_Arena* arena) { |
||||
return (google_protobuf_compiler_CodeGeneratorRequest*)_upb_Message_New(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), arena); |
||||
} |
||||
UPB_INLINE google_protobuf_compiler_CodeGeneratorRequest* google_protobuf_compiler_CodeGeneratorRequest_parse(const char* buf, size_t size, upb_Arena* arena) { |
||||
google_protobuf_compiler_CodeGeneratorRequest* ret = google_protobuf_compiler_CodeGeneratorRequest_new(arena); |
||||
if (!ret) return NULL; |
||||
if (upb_Decode(buf, size, ret, google_protobuf_compiler_CodeGeneratorRequest_msg_init(), NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
||||
return NULL; |
||||
} |
||||
return ret; |
||||
} |
||||
UPB_INLINE google_protobuf_compiler_CodeGeneratorRequest* google_protobuf_compiler_CodeGeneratorRequest_parse_ex(const char* buf, size_t size, |
||||
const upb_ExtensionRegistry* extreg, |
||||
int options, upb_Arena* arena) { |
||||
google_protobuf_compiler_CodeGeneratorRequest* ret = google_protobuf_compiler_CodeGeneratorRequest_new(arena); |
||||
if (!ret) return NULL; |
||||
if (upb_Decode(buf, size, ret, google_protobuf_compiler_CodeGeneratorRequest_msg_init(), extreg, options, arena) != |
||||
kUpb_DecodeStatus_Ok) { |
||||
return NULL; |
||||
} |
||||
return ret; |
||||
} |
||||
UPB_INLINE char* google_protobuf_compiler_CodeGeneratorRequest_serialize(const google_protobuf_compiler_CodeGeneratorRequest* msg, upb_Arena* arena, size_t* len) { |
||||
char* ptr; |
||||
(void)upb_Encode(msg, google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 0, arena, &ptr, len); |
||||
return ptr; |
||||
} |
||||
UPB_INLINE char* google_protobuf_compiler_CodeGeneratorRequest_serialize_ex(const google_protobuf_compiler_CodeGeneratorRequest* msg, int options, |
||||
upb_Arena* arena, size_t* len) { |
||||
char* ptr; |
||||
(void)upb_Encode(msg, google_protobuf_compiler_CodeGeneratorRequest_msg_init(), options, arena, &ptr, len); |
||||
return ptr; |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorRequest_clear_file_to_generate(google_protobuf_compiler_CodeGeneratorRequest* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 1); |
||||
_upb_Message_ClearNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE upb_StringView const* google_protobuf_compiler_CodeGeneratorRequest_file_to_generate(const google_protobuf_compiler_CodeGeneratorRequest* msg, size_t* size) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 1); |
||||
const upb_Array* arr = upb_Message_GetArray(msg, &field); |
||||
if (arr) { |
||||
if (size) *size = arr->size; |
||||
return (upb_StringView const*)_upb_array_constptr(arr); |
||||
} else { |
||||
if (size) *size = 0; |
||||
return NULL; |
||||
} |
||||
} |
||||
UPB_INLINE bool google_protobuf_compiler_CodeGeneratorRequest_has_file_to_generate(const google_protobuf_compiler_CodeGeneratorRequest* msg) { |
||||
size_t size; |
||||
google_protobuf_compiler_CodeGeneratorRequest_file_to_generate(msg, &size); |
||||
return size != 0; |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorRequest_clear_parameter(google_protobuf_compiler_CodeGeneratorRequest* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 2); |
||||
_upb_Message_ClearNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE upb_StringView google_protobuf_compiler_CodeGeneratorRequest_parameter(const google_protobuf_compiler_CodeGeneratorRequest* msg) { |
||||
upb_StringView default_val = upb_StringView_FromString(""); |
||||
upb_StringView ret; |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 2); |
||||
_upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
||||
return ret; |
||||
} |
||||
UPB_INLINE bool google_protobuf_compiler_CodeGeneratorRequest_has_parameter(const google_protobuf_compiler_CodeGeneratorRequest* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 2); |
||||
return _upb_Message_HasNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorRequest_clear_compiler_version(google_protobuf_compiler_CodeGeneratorRequest* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 3); |
||||
_upb_Message_ClearNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE const google_protobuf_compiler_Version* google_protobuf_compiler_CodeGeneratorRequest_compiler_version(const google_protobuf_compiler_CodeGeneratorRequest* msg) { |
||||
const google_protobuf_compiler_Version* default_val = NULL; |
||||
const google_protobuf_compiler_Version* ret; |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 3); |
||||
_upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
||||
return ret; |
||||
} |
||||
UPB_INLINE bool google_protobuf_compiler_CodeGeneratorRequest_has_compiler_version(const google_protobuf_compiler_CodeGeneratorRequest* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 3); |
||||
return _upb_Message_HasNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorRequest_clear_proto_file(google_protobuf_compiler_CodeGeneratorRequest* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 15); |
||||
_upb_Message_ClearNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE const struct google_protobuf_FileDescriptorProto* const* google_protobuf_compiler_CodeGeneratorRequest_proto_file(const google_protobuf_compiler_CodeGeneratorRequest* msg, size_t* size) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 15); |
||||
const upb_Array* arr = upb_Message_GetArray(msg, &field); |
||||
if (arr) { |
||||
if (size) *size = arr->size; |
||||
return (const struct google_protobuf_FileDescriptorProto* const*)_upb_array_constptr(arr); |
||||
} else { |
||||
if (size) *size = 0; |
||||
return NULL; |
||||
} |
||||
} |
||||
UPB_INLINE bool google_protobuf_compiler_CodeGeneratorRequest_has_proto_file(const google_protobuf_compiler_CodeGeneratorRequest* msg) { |
||||
size_t size; |
||||
google_protobuf_compiler_CodeGeneratorRequest_proto_file(msg, &size); |
||||
return size != 0; |
||||
} |
||||
|
||||
UPB_INLINE upb_StringView* google_protobuf_compiler_CodeGeneratorRequest_mutable_file_to_generate(google_protobuf_compiler_CodeGeneratorRequest* msg, size_t* size) { |
||||
upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 1); |
||||
upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
||||
if (arr) { |
||||
if (size) *size = arr->size; |
||||
return (upb_StringView*)_upb_array_ptr(arr); |
||||
} else { |
||||
if (size) *size = 0; |
||||
return NULL; |
||||
} |
||||
} |
||||
UPB_INLINE upb_StringView* google_protobuf_compiler_CodeGeneratorRequest_resize_file_to_generate(google_protobuf_compiler_CodeGeneratorRequest* msg, size_t size, upb_Arena* arena) { |
||||
upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 1); |
||||
return (upb_StringView*)upb_Message_ResizeArray(msg, &field, size, arena); |
||||
} |
||||
UPB_INLINE bool google_protobuf_compiler_CodeGeneratorRequest_add_file_to_generate(google_protobuf_compiler_CodeGeneratorRequest* msg, upb_StringView val, upb_Arena* arena) { |
||||
upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 1); |
||||
upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
||||
if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
||||
return false; |
||||
} |
||||
_upb_Array_Set(arr, arr->size - 1, &val, sizeof(val)); |
||||
return true; |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorRequest_set_parameter(google_protobuf_compiler_CodeGeneratorRequest *msg, upb_StringView value) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 2); |
||||
_upb_Message_SetNonExtensionField(msg, &field, &value); |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorRequest_set_compiler_version(google_protobuf_compiler_CodeGeneratorRequest *msg, google_protobuf_compiler_Version* value) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 3); |
||||
_upb_Message_SetNonExtensionField(msg, &field, &value); |
||||
} |
||||
UPB_INLINE struct google_protobuf_compiler_Version* google_protobuf_compiler_CodeGeneratorRequest_mutable_compiler_version(google_protobuf_compiler_CodeGeneratorRequest* msg, upb_Arena* arena) { |
||||
struct google_protobuf_compiler_Version* sub = (struct google_protobuf_compiler_Version*)google_protobuf_compiler_CodeGeneratorRequest_compiler_version(msg); |
||||
if (sub == NULL) { |
||||
sub = (struct google_protobuf_compiler_Version*)_upb_Message_New(google_protobuf_compiler_Version_msg_init(), arena); |
||||
if (sub) google_protobuf_compiler_CodeGeneratorRequest_set_compiler_version(msg, sub); |
||||
} |
||||
return sub; |
||||
} |
||||
UPB_INLINE struct google_protobuf_FileDescriptorProto** google_protobuf_compiler_CodeGeneratorRequest_mutable_proto_file(google_protobuf_compiler_CodeGeneratorRequest* msg, size_t* size) { |
||||
upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 15); |
||||
upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
||||
if (arr) { |
||||
if (size) *size = arr->size; |
||||
return (struct google_protobuf_FileDescriptorProto**)_upb_array_ptr(arr); |
||||
} else { |
||||
if (size) *size = 0; |
||||
return NULL; |
||||
} |
||||
} |
||||
UPB_INLINE struct google_protobuf_FileDescriptorProto** google_protobuf_compiler_CodeGeneratorRequest_resize_proto_file(google_protobuf_compiler_CodeGeneratorRequest* msg, size_t size, upb_Arena* arena) { |
||||
upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 15); |
||||
return (struct google_protobuf_FileDescriptorProto**)upb_Message_ResizeArray(msg, &field, size, arena); |
||||
} |
||||
UPB_INLINE struct google_protobuf_FileDescriptorProto* google_protobuf_compiler_CodeGeneratorRequest_add_proto_file(google_protobuf_compiler_CodeGeneratorRequest* msg, upb_Arena* arena) { |
||||
upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorRequest_msg_init(), 15); |
||||
upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
||||
if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
||||
return NULL; |
||||
} |
||||
struct google_protobuf_FileDescriptorProto* sub = (struct google_protobuf_FileDescriptorProto*)_upb_Message_New(google_protobuf_FileDescriptorProto_msg_init(), arena); |
||||
if (!arr || !sub) return NULL; |
||||
_upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
||||
return sub; |
||||
} |
||||
|
||||
/* google.protobuf.compiler.CodeGeneratorResponse */ |
||||
|
||||
UPB_INLINE google_protobuf_compiler_CodeGeneratorResponse* google_protobuf_compiler_CodeGeneratorResponse_new(upb_Arena* arena) { |
||||
return (google_protobuf_compiler_CodeGeneratorResponse*)_upb_Message_New(google_protobuf_compiler_CodeGeneratorResponse_msg_init(), arena); |
||||
} |
||||
UPB_INLINE google_protobuf_compiler_CodeGeneratorResponse* google_protobuf_compiler_CodeGeneratorResponse_parse(const char* buf, size_t size, upb_Arena* arena) { |
||||
google_protobuf_compiler_CodeGeneratorResponse* ret = google_protobuf_compiler_CodeGeneratorResponse_new(arena); |
||||
if (!ret) return NULL; |
||||
if (upb_Decode(buf, size, ret, google_protobuf_compiler_CodeGeneratorResponse_msg_init(), NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
||||
return NULL; |
||||
} |
||||
return ret; |
||||
} |
||||
UPB_INLINE google_protobuf_compiler_CodeGeneratorResponse* google_protobuf_compiler_CodeGeneratorResponse_parse_ex(const char* buf, size_t size, |
||||
const upb_ExtensionRegistry* extreg, |
||||
int options, upb_Arena* arena) { |
||||
google_protobuf_compiler_CodeGeneratorResponse* ret = google_protobuf_compiler_CodeGeneratorResponse_new(arena); |
||||
if (!ret) return NULL; |
||||
if (upb_Decode(buf, size, ret, google_protobuf_compiler_CodeGeneratorResponse_msg_init(), extreg, options, arena) != |
||||
kUpb_DecodeStatus_Ok) { |
||||
return NULL; |
||||
} |
||||
return ret; |
||||
} |
||||
UPB_INLINE char* google_protobuf_compiler_CodeGeneratorResponse_serialize(const google_protobuf_compiler_CodeGeneratorResponse* msg, upb_Arena* arena, size_t* len) { |
||||
char* ptr; |
||||
(void)upb_Encode(msg, google_protobuf_compiler_CodeGeneratorResponse_msg_init(), 0, arena, &ptr, len); |
||||
return ptr; |
||||
} |
||||
UPB_INLINE char* google_protobuf_compiler_CodeGeneratorResponse_serialize_ex(const google_protobuf_compiler_CodeGeneratorResponse* msg, int options, |
||||
upb_Arena* arena, size_t* len) { |
||||
char* ptr; |
||||
(void)upb_Encode(msg, google_protobuf_compiler_CodeGeneratorResponse_msg_init(), options, arena, &ptr, len); |
||||
return ptr; |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorResponse_clear_error(google_protobuf_compiler_CodeGeneratorResponse* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_msg_init(), 1); |
||||
_upb_Message_ClearNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE upb_StringView google_protobuf_compiler_CodeGeneratorResponse_error(const google_protobuf_compiler_CodeGeneratorResponse* msg) { |
||||
upb_StringView default_val = upb_StringView_FromString(""); |
||||
upb_StringView ret; |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_msg_init(), 1); |
||||
_upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
||||
return ret; |
||||
} |
||||
UPB_INLINE bool google_protobuf_compiler_CodeGeneratorResponse_has_error(const google_protobuf_compiler_CodeGeneratorResponse* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_msg_init(), 1); |
||||
return _upb_Message_HasNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorResponse_clear_supported_features(google_protobuf_compiler_CodeGeneratorResponse* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_msg_init(), 2); |
||||
_upb_Message_ClearNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE uint64_t google_protobuf_compiler_CodeGeneratorResponse_supported_features(const google_protobuf_compiler_CodeGeneratorResponse* msg) { |
||||
uint64_t default_val = (uint64_t)0ull; |
||||
uint64_t ret; |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_msg_init(), 2); |
||||
_upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
||||
return ret; |
||||
} |
||||
UPB_INLINE bool google_protobuf_compiler_CodeGeneratorResponse_has_supported_features(const google_protobuf_compiler_CodeGeneratorResponse* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_msg_init(), 2); |
||||
return _upb_Message_HasNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorResponse_clear_file(google_protobuf_compiler_CodeGeneratorResponse* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_msg_init(), 15); |
||||
_upb_Message_ClearNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE const google_protobuf_compiler_CodeGeneratorResponse_File* const* google_protobuf_compiler_CodeGeneratorResponse_file(const google_protobuf_compiler_CodeGeneratorResponse* msg, size_t* size) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_msg_init(), 15); |
||||
const upb_Array* arr = upb_Message_GetArray(msg, &field); |
||||
if (arr) { |
||||
if (size) *size = arr->size; |
||||
return (const google_protobuf_compiler_CodeGeneratorResponse_File* const*)_upb_array_constptr(arr); |
||||
} else { |
||||
if (size) *size = 0; |
||||
return NULL; |
||||
} |
||||
} |
||||
UPB_INLINE bool google_protobuf_compiler_CodeGeneratorResponse_has_file(const google_protobuf_compiler_CodeGeneratorResponse* msg) { |
||||
size_t size; |
||||
google_protobuf_compiler_CodeGeneratorResponse_file(msg, &size); |
||||
return size != 0; |
||||
} |
||||
|
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorResponse_set_error(google_protobuf_compiler_CodeGeneratorResponse *msg, upb_StringView value) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_msg_init(), 1); |
||||
_upb_Message_SetNonExtensionField(msg, &field, &value); |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorResponse_set_supported_features(google_protobuf_compiler_CodeGeneratorResponse *msg, uint64_t value) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_msg_init(), 2); |
||||
_upb_Message_SetNonExtensionField(msg, &field, &value); |
||||
} |
||||
UPB_INLINE google_protobuf_compiler_CodeGeneratorResponse_File** google_protobuf_compiler_CodeGeneratorResponse_mutable_file(google_protobuf_compiler_CodeGeneratorResponse* msg, size_t* size) { |
||||
upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_msg_init(), 15); |
||||
upb_Array* arr = upb_Message_GetMutableArray(msg, &field); |
||||
if (arr) { |
||||
if (size) *size = arr->size; |
||||
return (google_protobuf_compiler_CodeGeneratorResponse_File**)_upb_array_ptr(arr); |
||||
} else { |
||||
if (size) *size = 0; |
||||
return NULL; |
||||
} |
||||
} |
||||
UPB_INLINE google_protobuf_compiler_CodeGeneratorResponse_File** google_protobuf_compiler_CodeGeneratorResponse_resize_file(google_protobuf_compiler_CodeGeneratorResponse* msg, size_t size, upb_Arena* arena) { |
||||
upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_msg_init(), 15); |
||||
return (google_protobuf_compiler_CodeGeneratorResponse_File**)upb_Message_ResizeArray(msg, &field, size, arena); |
||||
} |
||||
UPB_INLINE struct google_protobuf_compiler_CodeGeneratorResponse_File* google_protobuf_compiler_CodeGeneratorResponse_add_file(google_protobuf_compiler_CodeGeneratorResponse* msg, upb_Arena* arena) { |
||||
upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_msg_init(), 15); |
||||
upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); |
||||
if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { |
||||
return NULL; |
||||
} |
||||
struct google_protobuf_compiler_CodeGeneratorResponse_File* sub = (struct google_protobuf_compiler_CodeGeneratorResponse_File*)_upb_Message_New(google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), arena); |
||||
if (!arr || !sub) return NULL; |
||||
_upb_Array_Set(arr, arr->size - 1, &sub, sizeof(sub)); |
||||
return sub; |
||||
} |
||||
|
||||
/* google.protobuf.compiler.CodeGeneratorResponse.File */ |
||||
|
||||
UPB_INLINE google_protobuf_compiler_CodeGeneratorResponse_File* google_protobuf_compiler_CodeGeneratorResponse_File_new(upb_Arena* arena) { |
||||
return (google_protobuf_compiler_CodeGeneratorResponse_File*)_upb_Message_New(google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), arena); |
||||
} |
||||
UPB_INLINE google_protobuf_compiler_CodeGeneratorResponse_File* google_protobuf_compiler_CodeGeneratorResponse_File_parse(const char* buf, size_t size, upb_Arena* arena) { |
||||
google_protobuf_compiler_CodeGeneratorResponse_File* ret = google_protobuf_compiler_CodeGeneratorResponse_File_new(arena); |
||||
if (!ret) return NULL; |
||||
if (upb_Decode(buf, size, ret, google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), NULL, 0, arena) != kUpb_DecodeStatus_Ok) { |
||||
return NULL; |
||||
} |
||||
return ret; |
||||
} |
||||
UPB_INLINE google_protobuf_compiler_CodeGeneratorResponse_File* google_protobuf_compiler_CodeGeneratorResponse_File_parse_ex(const char* buf, size_t size, |
||||
const upb_ExtensionRegistry* extreg, |
||||
int options, upb_Arena* arena) { |
||||
google_protobuf_compiler_CodeGeneratorResponse_File* ret = google_protobuf_compiler_CodeGeneratorResponse_File_new(arena); |
||||
if (!ret) return NULL; |
||||
if (upb_Decode(buf, size, ret, google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), extreg, options, arena) != |
||||
kUpb_DecodeStatus_Ok) { |
||||
return NULL; |
||||
} |
||||
return ret; |
||||
} |
||||
UPB_INLINE char* google_protobuf_compiler_CodeGeneratorResponse_File_serialize(const google_protobuf_compiler_CodeGeneratorResponse_File* msg, upb_Arena* arena, size_t* len) { |
||||
char* ptr; |
||||
(void)upb_Encode(msg, google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), 0, arena, &ptr, len); |
||||
return ptr; |
||||
} |
||||
UPB_INLINE char* google_protobuf_compiler_CodeGeneratorResponse_File_serialize_ex(const google_protobuf_compiler_CodeGeneratorResponse_File* msg, int options, |
||||
upb_Arena* arena, size_t* len) { |
||||
char* ptr; |
||||
(void)upb_Encode(msg, google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), options, arena, &ptr, len); |
||||
return ptr; |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorResponse_File_clear_name(google_protobuf_compiler_CodeGeneratorResponse_File* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), 1); |
||||
_upb_Message_ClearNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE upb_StringView google_protobuf_compiler_CodeGeneratorResponse_File_name(const google_protobuf_compiler_CodeGeneratorResponse_File* msg) { |
||||
upb_StringView default_val = upb_StringView_FromString(""); |
||||
upb_StringView ret; |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), 1); |
||||
_upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
||||
return ret; |
||||
} |
||||
UPB_INLINE bool google_protobuf_compiler_CodeGeneratorResponse_File_has_name(const google_protobuf_compiler_CodeGeneratorResponse_File* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), 1); |
||||
return _upb_Message_HasNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorResponse_File_clear_insertion_point(google_protobuf_compiler_CodeGeneratorResponse_File* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), 2); |
||||
_upb_Message_ClearNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE upb_StringView google_protobuf_compiler_CodeGeneratorResponse_File_insertion_point(const google_protobuf_compiler_CodeGeneratorResponse_File* msg) { |
||||
upb_StringView default_val = upb_StringView_FromString(""); |
||||
upb_StringView ret; |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), 2); |
||||
_upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
||||
return ret; |
||||
} |
||||
UPB_INLINE bool google_protobuf_compiler_CodeGeneratorResponse_File_has_insertion_point(const google_protobuf_compiler_CodeGeneratorResponse_File* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), 2); |
||||
return _upb_Message_HasNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorResponse_File_clear_content(google_protobuf_compiler_CodeGeneratorResponse_File* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), 15); |
||||
_upb_Message_ClearNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE upb_StringView google_protobuf_compiler_CodeGeneratorResponse_File_content(const google_protobuf_compiler_CodeGeneratorResponse_File* msg) { |
||||
upb_StringView default_val = upb_StringView_FromString(""); |
||||
upb_StringView ret; |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), 15); |
||||
_upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
||||
return ret; |
||||
} |
||||
UPB_INLINE bool google_protobuf_compiler_CodeGeneratorResponse_File_has_content(const google_protobuf_compiler_CodeGeneratorResponse_File* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), 15); |
||||
return _upb_Message_HasNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorResponse_File_clear_generated_code_info(google_protobuf_compiler_CodeGeneratorResponse_File* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), 16); |
||||
_upb_Message_ClearNonExtensionField(msg, &field); |
||||
} |
||||
UPB_INLINE const struct google_protobuf_GeneratedCodeInfo* google_protobuf_compiler_CodeGeneratorResponse_File_generated_code_info(const google_protobuf_compiler_CodeGeneratorResponse_File* msg) { |
||||
const struct google_protobuf_GeneratedCodeInfo* default_val = NULL; |
||||
const struct google_protobuf_GeneratedCodeInfo* ret; |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), 16); |
||||
_upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); |
||||
return ret; |
||||
} |
||||
UPB_INLINE bool google_protobuf_compiler_CodeGeneratorResponse_File_has_generated_code_info(const google_protobuf_compiler_CodeGeneratorResponse_File* msg) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), 16); |
||||
return _upb_Message_HasNonExtensionField(msg, &field); |
||||
} |
||||
|
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorResponse_File_set_name(google_protobuf_compiler_CodeGeneratorResponse_File *msg, upb_StringView value) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), 1); |
||||
_upb_Message_SetNonExtensionField(msg, &field, &value); |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorResponse_File_set_insertion_point(google_protobuf_compiler_CodeGeneratorResponse_File *msg, upb_StringView value) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), 2); |
||||
_upb_Message_SetNonExtensionField(msg, &field, &value); |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorResponse_File_set_content(google_protobuf_compiler_CodeGeneratorResponse_File *msg, upb_StringView value) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), 15); |
||||
_upb_Message_SetNonExtensionField(msg, &field, &value); |
||||
} |
||||
UPB_INLINE void google_protobuf_compiler_CodeGeneratorResponse_File_set_generated_code_info(google_protobuf_compiler_CodeGeneratorResponse_File *msg, struct google_protobuf_GeneratedCodeInfo* value) { |
||||
const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google_protobuf_compiler_CodeGeneratorResponse_File_msg_init(), 16); |
||||
_upb_Message_SetNonExtensionField(msg, &field, &value); |
||||
} |
||||
UPB_INLINE struct google_protobuf_GeneratedCodeInfo* google_protobuf_compiler_CodeGeneratorResponse_File_mutable_generated_code_info(google_protobuf_compiler_CodeGeneratorResponse_File* msg, upb_Arena* arena) { |
||||
struct google_protobuf_GeneratedCodeInfo* sub = (struct google_protobuf_GeneratedCodeInfo*)google_protobuf_compiler_CodeGeneratorResponse_File_generated_code_info(msg); |
||||
if (sub == NULL) { |
||||
sub = (struct google_protobuf_GeneratedCodeInfo*)_upb_Message_New(google_protobuf_GeneratedCodeInfo_msg_init(), arena); |
||||
if (sub) google_protobuf_compiler_CodeGeneratorResponse_File_set_generated_code_info(msg, sub); |
||||
} |
||||
return sub; |
||||
} |
||||
|
||||
extern const upb_MiniTableFile google_protobuf_compiler_plugin_proto_upb_file_layout; |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#include "upb/port/undef.inc" |
||||
|
||||
#endif /* GOOGLE_PROTOBUF_COMPILER_PLUGIN_PROTO_UPB_H_ */ |
Loading…
Reference in new issue