From cea737028f7d34e6415c0de5d34587245624db2b Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Wed, 7 Mar 2018 16:30:21 -0800 Subject: [PATCH] Added google/protobuf/descriptor.upb.* to core. This is in preparation for making upb_def capable of parsing binary descriptors directly. We leave upb/descriptor/descriptor.upbdefs.* in place for now, because upb/descriptor/reader.* still depends on it. Also removed a bit of cruft from the codegen. --- Makefile | 17 +- google/protobuf/descriptor.proto | 870 ++++++++++++++++++ .../protobuf}/descriptor.upb.c | 419 +++++++-- .../protobuf}/descriptor.upb.h | 328 +++++-- tests/json/test.upbdefs.h | 8 - tools/amalgamate.py | 3 +- tools/dump_cinit.lua | 53 -- tools/make_c_api.lua | 37 +- tools/upbc.lua | 40 +- upb/descriptor/descriptor.upbdefs.h | 47 - 10 files changed, 1524 insertions(+), 298 deletions(-) create mode 100644 google/protobuf/descriptor.proto rename {upb/descriptor => google/protobuf}/descriptor.upb.c (78%) rename {upb/descriptor => google/protobuf}/descriptor.upb.h (64%) diff --git a/Makefile b/Makefile index ba954693bc..30a6dc139f 100644 --- a/Makefile +++ b/Makefile @@ -141,13 +141,14 @@ clean: clean_leave_profile clean_lua .SECONDEXPANSION: to_srcs = $(subst .,_,$(1)_SRCS) pc = % -make_objs = $$(patsubst upb/$$(pc).c,obj/upb/$$(pc).$(1),$$($$(call to_srcs,$$*))) -make_objs_cc = $$(patsubst upb/$$(pc).cc,obj/upb/$$(pc).$(1),$$($$(call to_srcs,$$*))) +make_objs = $$(patsubst $$(pc).c,obj/$$(pc).$(1),$$($$(call to_srcs,$$*))) +make_objs_cc = $$(patsubst $$(pc).cc,obj/$$(pc).$(1),$$($$(call to_srcs,$$*))) # Core libraries (ie. not bindings). ############################################################### upb_SRCS = \ + google/protobuf/descriptor.upb.c \ upb/decode.c \ upb/def.c \ upb/encode.c \ @@ -230,19 +231,19 @@ $(UPB_LIBS): lib/lib%.a: $(call make_objs,o) $(Q) mkdir -p lib && $(AR) rcs $@ $^ -obj/upb/%.o: upb/%.c | $$(@D)/. +obj/%.o: %.c | $$(@D)/. $(E) CC $< $(Q) $(CC) $(OPT) $(CSTD) $(WARNFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< -obj/upb/%.o: upb/%.cc | $$(@D)/. +obj/%.o: %.cc | $$(@D)/. $(E) CXX $< $(Q) $(CXX) $(OPT) $(CXXSTD) $(WARNFLAGS_CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< -obj/upb/%.lo: upb/%.c | $$(@D)/. +obj/%.lo: %.c | $$(@D)/. $(E) 'CC -fPIC' $< $(Q) $(CC) $(OPT) $(CSTD) $(WARNFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< -fPIC -obj/upb/%.lo: upb/%.cc | $$(@D)/. +obj/%.lo: %.cc | $$(@D)/. $(E) CXX -fPIC $< $(Q) $(CXX) $(OPT) $(CXXSTD) $(WARNFLAGS_CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< -fPIC @@ -263,8 +264,12 @@ genfiles: tools/upbc @# TODO: replace protoc with upbc when upb can parse .proto files $(E) PROTOC upb/descriptor/descriptor.proto $(Q) protoc upb/descriptor/descriptor.proto -oupb/descriptor/descriptor.pb + $(E) PROTOC google/protobuf/descriptor.proto + $(Q) protoc google/protobuf/descriptor.proto -ogoogle/protobuf/descriptor.pb $(E) UPBC upb/descriptor/descriptor.pb $(Q) ./tools/upbc --generate-upbdefs upb/descriptor/descriptor.pb + $(E) UPBC google/protobuf/descriptor.pb + $(Q) ./tools/upbc google/protobuf/descriptor.pb $(E) PROTOC tests/json/test.proto $(Q) protoc tests/json/test.proto -otests/json/test.proto.pb $(E) UPBC tests/json/test.proto.pb diff --git a/google/protobuf/descriptor.proto b/google/protobuf/descriptor.proto new file mode 100644 index 0000000000..4fd66e419a --- /dev/null +++ b/google/protobuf/descriptor.proto @@ -0,0 +1,870 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// 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 Inc. 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 THE COPYRIGHT +// OWNER OR CONTRIBUTORS 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// The messages in this file describe the definitions found in .proto files. +// A valid .proto file can be translated directly to a FileDescriptorProto +// without any other information (e.g. without reading its imports). + + +syntax = "proto2"; + +package google.protobuf; +option go_package = "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "DescriptorProtos"; +option csharp_namespace = "Google.Protobuf.Reflection"; +option objc_class_prefix = "GPB"; +option cc_enable_arenas = true; + +// descriptor.proto must be optimized for speed because reflection-based +// algorithms don't work during bootstrapping. +option optimize_for = SPEED; + +// The protocol compiler can output a FileDescriptorSet containing the .proto +// files it parses. +message FileDescriptorSet { + repeated FileDescriptorProto file = 1; +} + +// Describes a complete .proto file. +message FileDescriptorProto { + optional string name = 1; // file name, relative to root of source tree + optional string package = 2; // e.g. "foo", "foo.bar", etc. + + // Names of files imported by this file. + repeated string dependency = 3; + // Indexes of the public imported files in the dependency list above. + repeated int32 public_dependency = 10; + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + repeated int32 weak_dependency = 11; + + // All top-level definitions in this file. + repeated DescriptorProto message_type = 4; + repeated EnumDescriptorProto enum_type = 5; + repeated ServiceDescriptorProto service = 6; + repeated FieldDescriptorProto extension = 7; + + optional FileOptions options = 8; + + // This field contains optional information about the original source code. + // You may safely remove this entire field without harming runtime + // functionality of the descriptors -- the information is needed only by + // development tools. + optional SourceCodeInfo source_code_info = 9; + + // The syntax of the proto file. + // The supported values are "proto2" and "proto3". + optional string syntax = 12; +} + +// Describes a message type. +message DescriptorProto { + optional string name = 1; + + repeated FieldDescriptorProto field = 2; + repeated FieldDescriptorProto extension = 6; + + repeated DescriptorProto nested_type = 3; + repeated EnumDescriptorProto enum_type = 4; + + message ExtensionRange { + optional int32 start = 1; + optional int32 end = 2; + + optional ExtensionRangeOptions options = 3; + } + repeated ExtensionRange extension_range = 5; + + repeated OneofDescriptorProto oneof_decl = 8; + + optional MessageOptions options = 7; + + // Range of reserved tag numbers. Reserved tag numbers may not be used by + // fields or extension ranges in the same message. Reserved ranges may + // not overlap. + message ReservedRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Exclusive. + } + repeated ReservedRange reserved_range = 9; + // Reserved field names, which may not be used by fields in the same message. + // A given name may only be reserved once. + repeated string reserved_name = 10; +} + +message ExtensionRangeOptions { + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +// Describes a field within a message. +message FieldDescriptorProto { + enum Type { + // 0 is reserved for errors. + // Order is weird for historical reasons. + TYPE_DOUBLE = 1; + TYPE_FLOAT = 2; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + TYPE_INT64 = 3; + TYPE_UINT64 = 4; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + TYPE_INT32 = 5; + TYPE_FIXED64 = 6; + TYPE_FIXED32 = 7; + TYPE_BOOL = 8; + TYPE_STRING = 9; + // Tag-delimited aggregate. + // Group type is deprecated and not supported in proto3. However, Proto3 + // implementations should still be able to parse the group wire format and + // treat group fields as unknown fields. + TYPE_GROUP = 10; + TYPE_MESSAGE = 11; // Length-delimited aggregate. + + // New in version 2. + TYPE_BYTES = 12; + TYPE_UINT32 = 13; + TYPE_ENUM = 14; + TYPE_SFIXED32 = 15; + TYPE_SFIXED64 = 16; + TYPE_SINT32 = 17; // Uses ZigZag encoding. + TYPE_SINT64 = 18; // Uses ZigZag encoding. + }; + + enum Label { + // 0 is reserved for errors + LABEL_OPTIONAL = 1; + LABEL_REQUIRED = 2; + LABEL_REPEATED = 3; + }; + + optional string name = 1; + optional int32 number = 3; + optional Label label = 4; + + // If type_name is set, this need not be set. If both this and type_name + // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + optional Type type = 5; + + // For message and enum types, this is the name of the type. If the name + // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + // rules are used to find the type (i.e. first the nested types within this + // message are searched, then within the parent, on up to the root + // namespace). + optional string type_name = 6; + + // For extensions, this is the name of the type being extended. It is + // resolved in the same manner as type_name. + optional string extendee = 2; + + // For numeric types, contains the original text representation of the value. + // For booleans, "true" or "false". + // For strings, contains the default text contents (not escaped in any way). + // For bytes, contains the C escaped value. All bytes >= 128 are escaped. + // TODO(kenton): Base-64 encode? + optional string default_value = 7; + + // If set, gives the index of a oneof in the containing type's oneof_decl + // list. This field is a member of that oneof. + optional int32 oneof_index = 9; + + // JSON name of this field. The value is set by protocol compiler. If the + // user has set a "json_name" option on this field, that option's value + // will be used. Otherwise, it's deduced from the field's name by converting + // it to camelCase. + optional string json_name = 10; + + optional FieldOptions options = 8; +} + +// Describes a oneof. +message OneofDescriptorProto { + optional string name = 1; + optional OneofOptions options = 2; +} + +// Describes an enum type. +message EnumDescriptorProto { + optional string name = 1; + + repeated EnumValueDescriptorProto value = 2; + + optional EnumOptions options = 3; + + // Range of reserved numeric values. Reserved values may not be used by + // entries in the same enum. Reserved ranges may not overlap. + // + // Note that this is distinct from DescriptorProto.ReservedRange in that it + // is inclusive such that it can appropriately represent the entire int32 + // domain. + message EnumReservedRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Inclusive. + } + + // Range of reserved numeric values. Reserved numeric values may not be used + // by enum values in the same enum declaration. Reserved ranges may not + // overlap. + repeated EnumReservedRange reserved_range = 4; + + // Reserved enum value names, which may not be reused. A given name may only + // be reserved once. + repeated string reserved_name = 5; +} + +// Describes a value within an enum. +message EnumValueDescriptorProto { + optional string name = 1; + optional int32 number = 2; + + optional EnumValueOptions options = 3; +} + +// Describes a service. +message ServiceDescriptorProto { + optional string name = 1; + repeated MethodDescriptorProto method = 2; + + optional ServiceOptions options = 3; +} + +// Describes a method of a service. +message MethodDescriptorProto { + optional string name = 1; + + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + optional string input_type = 2; + optional string output_type = 3; + + optional MethodOptions options = 4; + + // Identifies if client streams multiple client messages + optional bool client_streaming = 5 [default=false]; + // Identifies if server streams multiple server messages + optional bool server_streaming = 6 [default=false]; +} + + +// =================================================================== +// Options + +// Each of the definitions above may have "options" attached. These are +// just annotations which may cause code to be generated slightly differently +// or may contain hints for code that manipulates protocol messages. +// +// Clients may define custom options as extensions of the *Options messages. +// These extensions may not yet be known at parsing time, so the parser cannot +// store the values in them. Instead it stores them in a field in the *Options +// message called uninterpreted_option. This field must have the same name +// across all *Options messages. We then use this field to populate the +// extensions when we build a descriptor, at which point all protos have been +// parsed and so all extensions are known. +// +// Extension numbers for custom options may be chosen as follows: +// * For options which will only be used within a single application or +// organization, or for experimental options, use field numbers 50000 +// through 99999. It is up to you to ensure that you do not use the +// same number for multiple options. +// * For options which will be published and used publicly by multiple +// independent entities, e-mail protobuf-global-extension-registry@google.com +// to reserve extension numbers. Simply provide your project name (e.g. +// Objective-C plugin) and your project website (if available) -- there's no +// need to explain how you intend to use them. Usually you only need one +// extension number. You can declare multiple options with only one extension +// number by putting them in a sub-message. See the Custom Options section of +// the docs for examples: +// https://developers.google.com/protocol-buffers/docs/proto#options +// If this turns out to be popular, a web service will be set up +// to automatically assign option numbers. + + +message FileOptions { + + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + optional string java_package = 1; + + + // If set, all the classes from the .proto file are wrapped in a single + // outer class with the given name. This applies to both Proto1 + // (equivalent to the old "--one_java_file" option) and Proto2 (where + // a .proto always translates to a single class, but you may want to + // explicitly choose the class name). + optional string java_outer_classname = 8; + + // If set true, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the outer class + // named by java_outer_classname. However, the outer class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + optional bool java_multiple_files = 10 [default=false]; + + // This option does nothing. + optional bool java_generate_equals_and_hash = 20 [deprecated=true]; + + // If set true, then the Java2 code generator will generate code that + // throws an exception whenever an attempt is made to assign a non-UTF-8 + // byte sequence to a string field. + // Message reflection will do the same. + // However, an extension field still accepts non-UTF-8 byte sequences. + // This option has no effect on when used with the lite runtime. + optional bool java_string_check_utf8 = 27 [default=false]; + + + // Generated classes can be optimized for speed or code size. + enum OptimizeMode { + SPEED = 1; // Generate complete code for parsing, serialization, + // etc. + CODE_SIZE = 2; // Use ReflectionOps to implement these methods. + LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. + } + optional OptimizeMode optimize_for = 9 [default=SPEED]; + + // Sets the Go package where structs generated from this .proto will be + // placed. If omitted, the Go package will be derived from the following: + // - The basename of the package import path, if provided. + // - Otherwise, the package statement in the .proto file, if present. + // - Otherwise, the basename of the .proto file, without extension. + optional string go_package = 11; + + + + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of google.protobuf. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + optional bool cc_generic_services = 16 [default=false]; + optional bool java_generic_services = 17 [default=false]; + optional bool py_generic_services = 18 [default=false]; + optional bool php_generic_services = 42 [default=false]; + + // Is this file deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for everything in the file, or it will be completely ignored; in the very + // least, this is a formalization for deprecating files. + optional bool deprecated = 23 [default=false]; + + // Enables the use of arenas for the proto messages in this file. This applies + // only to generated classes for C++. + optional bool cc_enable_arenas = 31 [default=false]; + + + // Sets the objective c class prefix which is prepended to all objective c + // generated classes from this .proto. There is no default. + optional string objc_class_prefix = 36; + + // Namespace for generated classes; defaults to the package. + optional string csharp_namespace = 37; + + // By default Swift generators will take the proto package and CamelCase it + // replacing '.' with underscore and use that to prefix the types/symbols + // defined. When this options is provided, they will use this value instead + // to prefix the types/symbols defined. + optional string swift_prefix = 39; + + // Sets the php class prefix which is prepended to all php generated classes + // from this .proto. Default is empty. + optional string php_class_prefix = 40; + + // Use this option to change the namespace of php generated classes. Default + // is empty. When this option is empty, the package name will be used for + // determining the namespace. + optional string php_namespace = 41; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; + + reserved 38; +} + +message MessageOptions { + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + optional bool message_set_wire_format = 1 [default=false]; + + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + optional bool no_standard_descriptor_accessor = 2 [default=false]; + + // Is this message deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the message, or it will be completely ignored; in the very least, + // this is a formalization for deprecating messages. + optional bool deprecated = 3 [default=false]; + + // Whether the message is an automatically generated map entry type for the + // maps field. + // + // For maps fields: + // map map_field = 1; + // The parsed descriptor looks like: + // message MapFieldEntry { + // option map_entry = true; + // optional KeyType key = 1; + // optional ValueType value = 2; + // } + // repeated MapFieldEntry map_field = 1; + // + // Implementations may choose not to generate the map_entry=true message, but + // use a native map in the target language to hold the keys and values. + // The reflection APIs in such implementions still need to work as + // if the field is a repeated message field. + // + // NOTE: Do not set the option in .proto files. Always use the maps syntax + // instead. The option should only be implicitly set by the proto compiler + // parser. + optional bool map_entry = 7; + + reserved 8; // javalite_serializable + reserved 9; // javanano_as_lite + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message FieldOptions { + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is not yet implemented in the open source + // release -- sorry, we'll try to include it in a future version! + optional CType ctype = 1 [default = STRING]; + enum CType { + // Default mode. + STRING = 0; + + CORD = 1; + + STRING_PIECE = 2; + } + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. In proto3, only explicit setting it to + // false will avoid using packed encoding. + optional bool packed = 2; + + // The jstype option determines the JavaScript type used for values of the + // field. The option is permitted only for 64 bit integral and fixed types + // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + // is represented as JavaScript string, which avoids loss of precision that + // can happen when a large value is converted to a floating point JavaScript. + // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + // use the JavaScript "number" type. The behavior of the default option + // JS_NORMAL is implementation dependent. + // + // This option is an enum to permit additional types to be added, e.g. + // goog.math.Integer. + optional JSType jstype = 6 [default = JS_NORMAL]; + enum JSType { + // Use the default type. + JS_NORMAL = 0; + + // Use JavaScript strings. + JS_STRING = 1; + + // Use JavaScript numbers. + JS_NUMBER = 2; + } + + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outer message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + optional bool lazy = 5 [default=false]; + + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + optional bool deprecated = 3 [default=false]; + + // For Google-internal migration only. Do not use. + optional bool weak = 10 [default=false]; + + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; + + reserved 4; // removed jtype +} + +message OneofOptions { + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumOptions { + + // Set this option to true to allow mapping different tag names to the same + // value. + optional bool allow_alias = 2; + + // Is this enum deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum, or it will be completely ignored; in the very least, this + // is a formalization for deprecating enums. + optional bool deprecated = 3 [default=false]; + + reserved 5; // javanano_as_lite + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumValueOptions { + // Is this enum value deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum value, or it will be completely ignored; in the very least, + // this is a formalization for deprecating enum values. + optional bool deprecated = 1 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message ServiceOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // Is this service deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the service, or it will be completely ignored; in the very least, + // this is a formalization for deprecating services. + optional bool deprecated = 33 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message MethodOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // Is this method deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the method, or it will be completely ignored; in the very least, + // this is a formalization for deprecating methods. + optional bool deprecated = 33 [default=false]; + + // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + // or neither? HTTP based RPC implementation may choose GET verb for safe + // methods, and PUT verb for idempotent methods instead of the default POST. + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0; + NO_SIDE_EFFECTS = 1; // implies idempotent + IDEMPOTENT = 2; // idempotent, but may have side effects + } + optional IdempotencyLevel idempotency_level = + 34 [default=IDEMPOTENCY_UNKNOWN]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +message UninterpretedOption { + // The name of the uninterpreted option. Each string represents a segment in + // a dot-separated name. is_extension is true iff a segment represents an + // extension (denoted with parentheses in options specs in .proto files). + // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + // "foo.(bar.baz).qux". + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } + repeated NamePart name = 2; + + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; +} + +// =================================================================== +// Optional source code info + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +message SourceCodeInfo { + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1; + // } + // Let's look at just the field definition: + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendent. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + repeated Location location = 1; + message Location { + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition. For + // example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + repeated int32 path = 1 [packed=true]; + + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + repeated int32 span = 2 [packed=true]; + + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // leading_detached_comments will keep paragraphs of comments that appear + // before (but not connected to) the current element. Each paragraph, + // separated by empty lines, will be one comment element in the repeated + // field. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to qux. + // // + // // Another line attached to qux. + // optional double qux = 4; + // + // // Detached comment for corge. This is not leading or trailing comments + // // to qux or corge because there are blank lines separating it from + // // both. + // + // // Detached comment for corge paragraph 2. + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + // + // // ignored detached comments. + optional string leading_comments = 3; + optional string trailing_comments = 4; + repeated string leading_detached_comments = 6; + } +} + +// Describes the relationship between generated code and its original source +// file. A GeneratedCodeInfo message is associated with only one generated +// source file, but may contain references to different source .proto files. +message GeneratedCodeInfo { + // An Annotation connects some span of text in generated code to an element + // of its generating .proto file. + repeated Annotation annotation = 1; + message Annotation { + // Identifies the element in the original source .proto file. This field + // is formatted the same as SourceCodeInfo.Location.path. + repeated int32 path = 1 [packed=true]; + + // Identifies the filesystem path to the original source .proto. + optional string source_file = 2; + + // Identifies the starting offset in bytes in the generated code + // that relates to the identified object. + optional int32 begin = 3; + + // Identifies the ending offset in bytes in the generated code that + // relates to the identified offset. The end offset should be one past + // the last relevant byte (so the length of the text = end - begin). + optional int32 end = 4; + } +} diff --git a/upb/descriptor/descriptor.upb.c b/google/protobuf/descriptor.upb.c similarity index 78% rename from upb/descriptor/descriptor.upb.c rename to google/protobuf/descriptor.upb.c index f388cfd40a..b20f46f6e0 100644 --- a/upb/descriptor/descriptor.upb.c +++ b/google/protobuf/descriptor.upb.c @@ -1,7 +1,7 @@ /* This file was generated by upbc (the upb compiler) from the input * file: * - * upb/descriptor/descriptor.proto + * google/protobuf/descriptor.proto * * Do not edit -- your changes will be discarded when the file is * regenerated. */ @@ -11,7 +11,7 @@ #include "upb/encode.h" #include "upb/msg.h" #include "upb/upb.h" -#include "upb/descriptor/descriptor.upb.h" +#include "google/protobuf/descriptor.upb.h" struct google_protobuf_FileDescriptorSet { @@ -50,7 +50,7 @@ google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parsenew(up char *google_protobuf_FileDescriptorSet_serialize(google_protobuf_FileDescriptorSet *msg, upb_env *env, size_t *size) { return upb_encode(msg, &google_protobuf_FileDescriptorSet_msginit, env, size); } -upb_array* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet *msg) { +const upb_array* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet *msg) { return msg->file; } void google_protobuf_FileDescriptorSet_set_file(google_protobuf_FileDescriptorSet *msg, upb_array* value) { @@ -131,55 +131,55 @@ upb_stringview google_protobuf_FileDescriptorProto_package(const google_protobuf void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_stringview value) { msg->package = value; } -upb_array* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto *msg) { +const upb_array* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto *msg) { return msg->dependency; } void google_protobuf_FileDescriptorProto_set_dependency(google_protobuf_FileDescriptorProto *msg, upb_array* value) { msg->dependency = value; } -upb_array* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto *msg) { +const upb_array* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto *msg) { return msg->message_type; } void google_protobuf_FileDescriptorProto_set_message_type(google_protobuf_FileDescriptorProto *msg, upb_array* value) { msg->message_type = value; } -upb_array* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto *msg) { +const upb_array* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto *msg) { return msg->enum_type; } void google_protobuf_FileDescriptorProto_set_enum_type(google_protobuf_FileDescriptorProto *msg, upb_array* value) { msg->enum_type = value; } -upb_array* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto *msg) { +const upb_array* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto *msg) { return msg->service; } void google_protobuf_FileDescriptorProto_set_service(google_protobuf_FileDescriptorProto *msg, upb_array* value) { msg->service = value; } -upb_array* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto *msg) { +const upb_array* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto *msg) { return msg->extension; } void google_protobuf_FileDescriptorProto_set_extension(google_protobuf_FileDescriptorProto *msg, upb_array* value) { msg->extension = value; } -google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto *msg) { +const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto *msg) { return msg->options; } void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) { msg->options = value; } -google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto *msg) { +const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto *msg) { return msg->source_code_info; } void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) { msg->source_code_info = value; } -upb_array* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto *msg) { +const upb_array* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto *msg) { return msg->public_dependency; } void google_protobuf_FileDescriptorProto_set_public_dependency(google_protobuf_FileDescriptorProto *msg, upb_array* value) { msg->public_dependency = value; } -upb_array* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto *msg) { +const upb_array* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto *msg) { return msg->weak_dependency; } void google_protobuf_FileDescriptorProto_set_weak_dependency(google_protobuf_FileDescriptorProto *msg, upb_array* value) { @@ -257,55 +257,55 @@ upb_stringview google_protobuf_DescriptorProto_name(const google_protobuf_Descri void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_stringview value) { msg->name = value; } -upb_array* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto *msg) { +const upb_array* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto *msg) { return msg->field; } void google_protobuf_DescriptorProto_set_field(google_protobuf_DescriptorProto *msg, upb_array* value) { msg->field = value; } -upb_array* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto *msg) { +const upb_array* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto *msg) { return msg->nested_type; } void google_protobuf_DescriptorProto_set_nested_type(google_protobuf_DescriptorProto *msg, upb_array* value) { msg->nested_type = value; } -upb_array* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto *msg) { +const upb_array* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto *msg) { return msg->enum_type; } void google_protobuf_DescriptorProto_set_enum_type(google_protobuf_DescriptorProto *msg, upb_array* value) { msg->enum_type = value; } -upb_array* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto *msg) { +const upb_array* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto *msg) { return msg->extension_range; } void google_protobuf_DescriptorProto_set_extension_range(google_protobuf_DescriptorProto *msg, upb_array* value) { msg->extension_range = value; } -upb_array* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto *msg) { +const upb_array* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto *msg) { return msg->extension; } void google_protobuf_DescriptorProto_set_extension(google_protobuf_DescriptorProto *msg, upb_array* value) { msg->extension = value; } -google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto *msg) { +const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto *msg) { return msg->options; } void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) { msg->options = value; } -upb_array* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto *msg) { +const upb_array* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto *msg) { return msg->oneof_decl; } void google_protobuf_DescriptorProto_set_oneof_decl(google_protobuf_DescriptorProto *msg, upb_array* value) { msg->oneof_decl = value; } -upb_array* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto *msg) { +const upb_array* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto *msg) { return msg->reserved_range; } void google_protobuf_DescriptorProto_set_reserved_range(google_protobuf_DescriptorProto *msg, upb_array* value) { msg->reserved_range = value; } -upb_array* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto *msg) { +const upb_array* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto *msg) { return msg->reserved_name; } void google_protobuf_DescriptorProto_set_reserved_name(google_protobuf_DescriptorProto *msg, upb_array* value) { @@ -314,19 +314,25 @@ void google_protobuf_DescriptorProto_set_reserved_name(google_protobuf_Descripto struct google_protobuf_DescriptorProto_ExtensionRange { int32_t start; int32_t end; + google_protobuf_ExtensionRangeOptions* options; }; -static const upb_msglayout_fieldinit_v1 google_protobuf_DescriptorProto_ExtensionRange__fields[2] = { +static const upb_msglayout_msginit_v1 *const google_protobuf_DescriptorProto_ExtensionRange_submsgs[1] = { + &google_protobuf_ExtensionRangeOptions_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_DescriptorProto_ExtensionRange__fields[3] = { {1, offsetof(google_protobuf_DescriptorProto_ExtensionRange, start), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1}, {2, offsetof(google_protobuf_DescriptorProto_ExtensionRange, end), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1}, + {3, offsetof(google_protobuf_DescriptorProto_ExtensionRange, options), 2, UPB_NOT_IN_ONEOF, 0, 11, 1}, }; const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_ExtensionRange_msginit = { - NULL, + &google_protobuf_DescriptorProto_ExtensionRange_submsgs[0], &google_protobuf_DescriptorProto_ExtensionRange__fields[0], NULL, NULL, /* TODO. default_msg */ - UPB_ALIGNED_SIZEOF(google_protobuf_DescriptorProto_ExtensionRange), 2, 0, false, true + UPB_ALIGNED_SIZEOF(google_protobuf_DescriptorProto_ExtensionRange), 3, 0, false, true }; google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_new(upb_env *env) { @@ -357,6 +363,12 @@ int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) { msg->end = value; } +const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange *msg) { + return msg->options; +} +void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) { + msg->options = value; +} struct google_protobuf_DescriptorProto_ReservedRange { int32_t start; int32_t end; @@ -403,6 +415,48 @@ int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_ void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) { msg->end = value; } +struct google_protobuf_ExtensionRangeOptions { + upb_array* uninterpreted_option; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_ExtensionRangeOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_ExtensionRangeOptions__fields[1] = { + {999, offsetof(google_protobuf_ExtensionRangeOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_ExtensionRangeOptions_msginit = { + &google_protobuf_ExtensionRangeOptions_submsgs[0], + &google_protobuf_ExtensionRangeOptions__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_ExtensionRangeOptions), 1, 0, false, true +}; + +google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_new(upb_env *env) { + google_protobuf_ExtensionRangeOptions *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_ExtensionRangeOptions *msg = google_protobuf_ExtensionRangeOptions_new(env); + if (upb_decode(buf, msg, &google_protobuf_ExtensionRangeOptions_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_ExtensionRangeOptions_serialize(google_protobuf_ExtensionRangeOptions *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_ExtensionRangeOptions_msginit, env, size); +} +const upb_array* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions *msg) { + return msg->uninterpreted_option; +} +void google_protobuf_ExtensionRangeOptions_set_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, upb_array* value) { + msg->uninterpreted_option = value; +} struct google_protobuf_FieldDescriptorProto { google_protobuf_FieldDescriptorProto_Label label; google_protobuf_FieldDescriptorProto_Type type; @@ -499,7 +553,7 @@ upb_stringview google_protobuf_FieldDescriptorProto_default_value(const google_p void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_stringview value) { msg->default_value = value; } -google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto *msg) { +const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto *msg) { return msg->options; } void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) { @@ -519,18 +573,24 @@ void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDes } struct google_protobuf_OneofDescriptorProto { upb_stringview name; + google_protobuf_OneofOptions* options; }; -static const upb_msglayout_fieldinit_v1 google_protobuf_OneofDescriptorProto__fields[1] = { +static const upb_msglayout_msginit_v1 *const google_protobuf_OneofDescriptorProto_submsgs[1] = { + &google_protobuf_OneofOptions_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_OneofDescriptorProto__fields[2] = { {1, offsetof(google_protobuf_OneofDescriptorProto, name), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {2, offsetof(google_protobuf_OneofDescriptorProto, options), 1, UPB_NOT_IN_ONEOF, 0, 11, 1}, }; const upb_msglayout_msginit_v1 google_protobuf_OneofDescriptorProto_msginit = { - NULL, + &google_protobuf_OneofDescriptorProto_submsgs[0], &google_protobuf_OneofDescriptorProto__fields[0], NULL, NULL, /* TODO. default_msg */ - UPB_ALIGNED_SIZEOF(google_protobuf_OneofDescriptorProto), 1, 0, false, true + UPB_ALIGNED_SIZEOF(google_protobuf_OneofDescriptorProto), 2, 0, false, true }; google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_new(upb_env *env) { @@ -555,21 +615,32 @@ upb_stringview google_protobuf_OneofDescriptorProto_name(const google_protobuf_O void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_stringview value) { msg->name = value; } +const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto *msg) { + return msg->options; +} +void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) { + msg->options = value; +} struct google_protobuf_EnumDescriptorProto { upb_stringview name; google_protobuf_EnumOptions* options; upb_array* value; + upb_array* reserved_range; + upb_array* reserved_name; }; -static const upb_msglayout_msginit_v1 *const google_protobuf_EnumDescriptorProto_submsgs[2] = { +static const upb_msglayout_msginit_v1 *const google_protobuf_EnumDescriptorProto_submsgs[3] = { + &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, &google_protobuf_EnumOptions_msginit, &google_protobuf_EnumValueDescriptorProto_msginit, }; -static const upb_msglayout_fieldinit_v1 google_protobuf_EnumDescriptorProto__fields[3] = { +static const upb_msglayout_fieldinit_v1 google_protobuf_EnumDescriptorProto__fields[5] = { {1, offsetof(google_protobuf_EnumDescriptorProto, name), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, - {2, offsetof(google_protobuf_EnumDescriptorProto, value), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 1, 11, 3}, - {3, offsetof(google_protobuf_EnumDescriptorProto, options), 1, UPB_NOT_IN_ONEOF, 0, 11, 1}, + {2, offsetof(google_protobuf_EnumDescriptorProto, value), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 2, 11, 3}, + {3, offsetof(google_protobuf_EnumDescriptorProto, options), 1, UPB_NOT_IN_ONEOF, 1, 11, 1}, + {4, offsetof(google_protobuf_EnumDescriptorProto, reserved_range), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, + {5, offsetof(google_protobuf_EnumDescriptorProto, reserved_name), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 3}, }; const upb_msglayout_msginit_v1 google_protobuf_EnumDescriptorProto_msginit = { @@ -577,7 +648,7 @@ const upb_msglayout_msginit_v1 google_protobuf_EnumDescriptorProto_msginit = { &google_protobuf_EnumDescriptorProto__fields[0], NULL, NULL, /* TODO. default_msg */ - UPB_ALIGNED_SIZEOF(google_protobuf_EnumDescriptorProto), 3, 0, false, true + UPB_ALIGNED_SIZEOF(google_protobuf_EnumDescriptorProto), 5, 0, false, true }; google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_new(upb_env *env) { @@ -602,18 +673,76 @@ upb_stringview google_protobuf_EnumDescriptorProto_name(const google_protobuf_En void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_stringview value) { msg->name = value; } -upb_array* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto *msg) { +const upb_array* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto *msg) { return msg->value; } void google_protobuf_EnumDescriptorProto_set_value(google_protobuf_EnumDescriptorProto *msg, upb_array* value) { msg->value = value; } -google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto *msg) { +const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto *msg) { return msg->options; } void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) { msg->options = value; } +const upb_array* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto *msg) { + return msg->reserved_range; +} +void google_protobuf_EnumDescriptorProto_set_reserved_range(google_protobuf_EnumDescriptorProto *msg, upb_array* value) { + msg->reserved_range = value; +} +const upb_array* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto *msg) { + return msg->reserved_name; +} +void google_protobuf_EnumDescriptorProto_set_reserved_name(google_protobuf_EnumDescriptorProto *msg, upb_array* value) { + msg->reserved_name = value; +} +struct google_protobuf_EnumDescriptorProto_EnumReservedRange { + int32_t start; + int32_t end; +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[2] = { + {1, offsetof(google_protobuf_EnumDescriptorProto_EnumReservedRange, start), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1}, + {2, offsetof(google_protobuf_EnumDescriptorProto_EnumReservedRange, end), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit = { + NULL, + &google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_EnumDescriptorProto_EnumReservedRange), 2, 0, false, true +}; + +google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_env *env) { + google_protobuf_EnumDescriptorProto_EnumReservedRange *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_EnumDescriptorProto_EnumReservedRange *msg = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(env); + if (upb_decode(buf, msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, env, size); +} +int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { + return msg->start; +} +void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) { + msg->start = value; +} +int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { + return msg->end; +} +void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) { + msg->end = value; +} struct google_protobuf_EnumValueDescriptorProto { int32_t number; upb_stringview name; @@ -666,7 +795,7 @@ int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_En void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) { msg->number = value; } -google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto *msg) { +const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto *msg) { return msg->options; } void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) { @@ -719,13 +848,13 @@ upb_stringview google_protobuf_ServiceDescriptorProto_name(const google_protobuf void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_stringview value) { msg->name = value; } -upb_array* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto *msg) { +const upb_array* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto *msg) { return msg->method; } void google_protobuf_ServiceDescriptorProto_set_method(google_protobuf_ServiceDescriptorProto *msg, upb_array* value) { msg->method = value; } -google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto *msg) { +const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto *msg) { return msg->options; } void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) { @@ -795,7 +924,7 @@ upb_stringview google_protobuf_MethodDescriptorProto_output_type(const google_pr void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_stringview value) { msg->output_type = value; } -google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto *msg) { +const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto *msg) { return msg->options; } void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) { @@ -823,12 +952,13 @@ struct google_protobuf_FileOptions { bool deprecated; bool java_string_check_utf8; bool cc_enable_arenas; - bool javanano_use_deprecated_package; + bool php_generic_services; upb_stringview java_package; upb_stringview java_outer_classname; upb_stringview go_package; upb_stringview objc_class_prefix; upb_stringview csharp_namespace; + upb_stringview swift_prefix; upb_stringview php_class_prefix; upb_stringview php_namespace; upb_array* uninterpreted_option; @@ -838,7 +968,7 @@ static const upb_msglayout_msginit_v1 *const google_protobuf_FileOptions_submsgs &google_protobuf_UninterpretedOption_msginit, }; -static const upb_msglayout_fieldinit_v1 google_protobuf_FileOptions__fields[18] = { +static const upb_msglayout_fieldinit_v1 google_protobuf_FileOptions__fields[19] = { {1, offsetof(google_protobuf_FileOptions, java_package), 10, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, {8, offsetof(google_protobuf_FileOptions, java_outer_classname), 11, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, {9, offsetof(google_protobuf_FileOptions, optimize_for), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 14, 1}, @@ -853,9 +983,10 @@ static const upb_msglayout_fieldinit_v1 google_protobuf_FileOptions__fields[18] {31, offsetof(google_protobuf_FileOptions, cc_enable_arenas), 8, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, {36, offsetof(google_protobuf_FileOptions, objc_class_prefix), 13, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, {37, offsetof(google_protobuf_FileOptions, csharp_namespace), 14, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, - {38, offsetof(google_protobuf_FileOptions, javanano_use_deprecated_package), 9, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, - {40, offsetof(google_protobuf_FileOptions, php_class_prefix), 15, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, - {41, offsetof(google_protobuf_FileOptions, php_namespace), 16, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {39, offsetof(google_protobuf_FileOptions, swift_prefix), 15, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {40, offsetof(google_protobuf_FileOptions, php_class_prefix), 16, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {41, offsetof(google_protobuf_FileOptions, php_namespace), 17, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {42, offsetof(google_protobuf_FileOptions, php_generic_services), 9, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, {999, offsetof(google_protobuf_FileOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, }; @@ -864,7 +995,7 @@ const upb_msglayout_msginit_v1 google_protobuf_FileOptions_msginit = { &google_protobuf_FileOptions__fields[0], NULL, NULL, /* TODO. default_msg */ - UPB_ALIGNED_SIZEOF(google_protobuf_FileOptions), 18, 0, false, true + UPB_ALIGNED_SIZEOF(google_protobuf_FileOptions), 19, 0, false, true }; google_protobuf_FileOptions *google_protobuf_FileOptions_new(upb_env *env) { @@ -967,11 +1098,11 @@ upb_stringview google_protobuf_FileOptions_csharp_namespace(const google_protobu void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_stringview value) { msg->csharp_namespace = value; } -bool google_protobuf_FileOptions_javanano_use_deprecated_package(const google_protobuf_FileOptions *msg) { - return msg->javanano_use_deprecated_package; +upb_stringview google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions *msg) { + return msg->swift_prefix; } -void google_protobuf_FileOptions_set_javanano_use_deprecated_package(google_protobuf_FileOptions *msg, bool value) { - msg->javanano_use_deprecated_package = value; +void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_stringview value) { + msg->swift_prefix = value; } upb_stringview google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions *msg) { return msg->php_class_prefix; @@ -985,7 +1116,13 @@ upb_stringview google_protobuf_FileOptions_php_namespace(const google_protobuf_F void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_stringview value) { msg->php_namespace = value; } -upb_array* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions *msg) { +bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions *msg) { + return msg->php_generic_services; +} +void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value) { + msg->php_generic_services = value; +} +const upb_array* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions *msg) { return msg->uninterpreted_option; } void google_protobuf_FileOptions_set_uninterpreted_option(google_protobuf_FileOptions *msg, upb_array* value) { @@ -1059,7 +1196,7 @@ bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptio void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) { msg->map_entry = value; } -upb_array* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions *msg) { +const upb_array* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions *msg) { return msg->uninterpreted_option; } void google_protobuf_MessageOptions_set_uninterpreted_option(google_protobuf_MessageOptions *msg, upb_array* value) { @@ -1149,12 +1286,54 @@ bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions *msg) void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) { msg->weak = value; } -upb_array* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions *msg) { +const upb_array* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions *msg) { return msg->uninterpreted_option; } void google_protobuf_FieldOptions_set_uninterpreted_option(google_protobuf_FieldOptions *msg, upb_array* value) { msg->uninterpreted_option = value; } +struct google_protobuf_OneofOptions { + upb_array* uninterpreted_option; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_OneofOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_OneofOptions__fields[1] = { + {999, offsetof(google_protobuf_OneofOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_OneofOptions_msginit = { + &google_protobuf_OneofOptions_submsgs[0], + &google_protobuf_OneofOptions__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_OneofOptions), 1, 0, false, true +}; + +google_protobuf_OneofOptions *google_protobuf_OneofOptions_new(upb_env *env) { + google_protobuf_OneofOptions *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_OneofOptions *google_protobuf_OneofOptions_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_OneofOptions *msg = google_protobuf_OneofOptions_new(env); + if (upb_decode(buf, msg, &google_protobuf_OneofOptions_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_OneofOptions_serialize(google_protobuf_OneofOptions *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_OneofOptions_msginit, env, size); +} +const upb_array* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions *msg) { + return msg->uninterpreted_option; +} +void google_protobuf_OneofOptions_set_uninterpreted_option(google_protobuf_OneofOptions *msg, upb_array* value) { + msg->uninterpreted_option = value; +} struct google_protobuf_EnumOptions { bool allow_alias; bool deprecated; @@ -1207,7 +1386,7 @@ bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions *m void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) { msg->deprecated = value; } -upb_array* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions *msg) { +const upb_array* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions *msg) { return msg->uninterpreted_option; } void google_protobuf_EnumOptions_set_uninterpreted_option(google_protobuf_EnumOptions *msg, upb_array* value) { @@ -1257,7 +1436,7 @@ bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValue void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) { msg->deprecated = value; } -upb_array* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions *msg) { +const upb_array* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions *msg) { return msg->uninterpreted_option; } void google_protobuf_EnumValueOptions_set_uninterpreted_option(google_protobuf_EnumValueOptions *msg, upb_array* value) { @@ -1307,13 +1486,14 @@ bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOpti void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) { msg->deprecated = value; } -upb_array* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions *msg) { +const upb_array* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions *msg) { return msg->uninterpreted_option; } void google_protobuf_ServiceOptions_set_uninterpreted_option(google_protobuf_ServiceOptions *msg, upb_array* value) { msg->uninterpreted_option = value; } struct google_protobuf_MethodOptions { + google_protobuf_MethodOptions_IdempotencyLevel idempotency_level; bool deprecated; upb_array* uninterpreted_option; }; @@ -1322,8 +1502,9 @@ static const upb_msglayout_msginit_v1 *const google_protobuf_MethodOptions_subms &google_protobuf_UninterpretedOption_msginit, }; -static const upb_msglayout_fieldinit_v1 google_protobuf_MethodOptions__fields[2] = { - {33, offsetof(google_protobuf_MethodOptions, deprecated), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, +static const upb_msglayout_fieldinit_v1 google_protobuf_MethodOptions__fields[3] = { + {33, offsetof(google_protobuf_MethodOptions, deprecated), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {34, offsetof(google_protobuf_MethodOptions, idempotency_level), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 14, 1}, {999, offsetof(google_protobuf_MethodOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, }; @@ -1332,7 +1513,7 @@ const upb_msglayout_msginit_v1 google_protobuf_MethodOptions_msginit = { &google_protobuf_MethodOptions__fields[0], NULL, NULL, /* TODO. default_msg */ - UPB_ALIGNED_SIZEOF(google_protobuf_MethodOptions), 2, 0, false, true + UPB_ALIGNED_SIZEOF(google_protobuf_MethodOptions), 3, 0, false, true }; google_protobuf_MethodOptions *google_protobuf_MethodOptions_new(upb_env *env) { @@ -1357,7 +1538,13 @@ bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOption void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) { msg->deprecated = value; } -upb_array* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions *msg) { +google_protobuf_MethodOptions_IdempotencyLevel google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions *msg) { + return msg->idempotency_level; +} +void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, google_protobuf_MethodOptions_IdempotencyLevel value) { + msg->idempotency_level = value; +} +const upb_array* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions *msg) { return msg->uninterpreted_option; } void google_protobuf_MethodOptions_set_uninterpreted_option(google_protobuf_MethodOptions *msg, upb_array* value) { @@ -1411,7 +1598,7 @@ google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parsene char *google_protobuf_UninterpretedOption_serialize(google_protobuf_UninterpretedOption *msg, upb_env *env, size_t *size) { return upb_encode(msg, &google_protobuf_UninterpretedOption_msginit, env, size); } -upb_array* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption *msg) { +const upb_array* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption *msg) { return msg->name; } void google_protobuf_UninterpretedOption_set_name(google_protobuf_UninterpretedOption *msg, upb_array* value) { @@ -1535,7 +1722,7 @@ google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parsenew(upb_stri char *google_protobuf_SourceCodeInfo_serialize(google_protobuf_SourceCodeInfo *msg, upb_env *env, size_t *size) { return upb_encode(msg, &google_protobuf_SourceCodeInfo_msginit, env, size); } -upb_array* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo *msg) { +const upb_array* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo *msg) { return msg->location; } void google_protobuf_SourceCodeInfo_set_location(google_protobuf_SourceCodeInfo *msg, upb_array* value) { @@ -1581,13 +1768,13 @@ google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location char *google_protobuf_SourceCodeInfo_Location_serialize(google_protobuf_SourceCodeInfo_Location *msg, upb_env *env, size_t *size) { return upb_encode(msg, &google_protobuf_SourceCodeInfo_Location_msginit, env, size); } -upb_array* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location *msg) { +const upb_array* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location *msg) { return msg->path; } void google_protobuf_SourceCodeInfo_Location_set_path(google_protobuf_SourceCodeInfo_Location *msg, upb_array* value) { msg->path = value; } -upb_array* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location *msg) { +const upb_array* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location *msg) { return msg->span; } void google_protobuf_SourceCodeInfo_Location_set_span(google_protobuf_SourceCodeInfo_Location *msg, upb_array* value) { @@ -1605,9 +1792,113 @@ upb_stringview google_protobuf_SourceCodeInfo_Location_trailing_comments(const g void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_stringview value) { msg->trailing_comments = value; } -upb_array* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location *msg) { +const upb_array* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return msg->leading_detached_comments; } void google_protobuf_SourceCodeInfo_Location_set_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_array* value) { msg->leading_detached_comments = value; } +struct google_protobuf_GeneratedCodeInfo { + upb_array* annotation; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_GeneratedCodeInfo_submsgs[1] = { + &google_protobuf_GeneratedCodeInfo_Annotation_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_GeneratedCodeInfo__fields[1] = { + {1, offsetof(google_protobuf_GeneratedCodeInfo, annotation), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_GeneratedCodeInfo_msginit = { + &google_protobuf_GeneratedCodeInfo_submsgs[0], + &google_protobuf_GeneratedCodeInfo__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_GeneratedCodeInfo), 1, 0, false, true +}; + +google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_new(upb_env *env) { + google_protobuf_GeneratedCodeInfo *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_GeneratedCodeInfo *msg = google_protobuf_GeneratedCodeInfo_new(env); + if (upb_decode(buf, msg, &google_protobuf_GeneratedCodeInfo_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_GeneratedCodeInfo_serialize(google_protobuf_GeneratedCodeInfo *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_msginit, env, size); +} +const upb_array* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo *msg) { + return msg->annotation; +} +void google_protobuf_GeneratedCodeInfo_set_annotation(google_protobuf_GeneratedCodeInfo *msg, upb_array* value) { + msg->annotation = value; +} +struct google_protobuf_GeneratedCodeInfo_Annotation { + int32_t begin; + int32_t end; + upb_stringview source_file; + upb_array* path; +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_GeneratedCodeInfo_Annotation__fields[4] = { + {1, offsetof(google_protobuf_GeneratedCodeInfo_Annotation, path), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 3}, + {2, offsetof(google_protobuf_GeneratedCodeInfo_Annotation, source_file), 2, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {3, offsetof(google_protobuf_GeneratedCodeInfo_Annotation, begin), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1}, + {4, offsetof(google_protobuf_GeneratedCodeInfo_Annotation, end), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_GeneratedCodeInfo_Annotation_msginit = { + NULL, + &google_protobuf_GeneratedCodeInfo_Annotation__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_GeneratedCodeInfo_Annotation), 4, 0, false, true +}; + +google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_new(upb_env *env) { + google_protobuf_GeneratedCodeInfo_Annotation *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_GeneratedCodeInfo_Annotation *msg = google_protobuf_GeneratedCodeInfo_Annotation_new(env); + if (upb_decode(buf, msg, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_GeneratedCodeInfo_Annotation_serialize(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, env, size); +} +const upb_array* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { + return msg->path; +} +void google_protobuf_GeneratedCodeInfo_Annotation_set_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_array* value) { + msg->path = value; +} +upb_stringview google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { + return msg->source_file; +} +void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_stringview value) { + msg->source_file = value; +} +int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { + return msg->begin; +} +void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { + msg->begin = value; +} +int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { + return msg->end; +} +void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { + msg->end = value; +} diff --git a/upb/descriptor/descriptor.upb.h b/google/protobuf/descriptor.upb.h similarity index 64% rename from upb/descriptor/descriptor.upb.h rename to google/protobuf/descriptor.upb.h index 41eac35869..8438baeac7 100644 --- a/upb/descriptor/descriptor.upb.h +++ b/google/protobuf/descriptor.upb.h @@ -1,13 +1,13 @@ /* This file was generated by upbc (the upb compiler) from the input * file: * - * upb/descriptor/descriptor.proto + * google/protobuf/descriptor.proto * * Do not edit -- your changes will be discarded when the file is * regenerated. */ -#ifndef UPB_DESCRIPTOR_DESCRIPTOR_PROTO_UPB_H_ -#define UPB_DESCRIPTOR_DESCRIPTOR_PROTO_UPB_H_ +#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ +#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ #include "upb/msg.h" @@ -23,12 +23,16 @@ struct google_protobuf_DescriptorProto_ExtensionRange; typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange; struct google_protobuf_DescriptorProto_ReservedRange; typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange; +struct google_protobuf_ExtensionRangeOptions; +typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions; struct google_protobuf_FieldDescriptorProto; typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto; struct google_protobuf_OneofDescriptorProto; typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto; struct google_protobuf_EnumDescriptorProto; typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto; +struct google_protobuf_EnumDescriptorProto_EnumReservedRange; +typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange; struct google_protobuf_EnumValueDescriptorProto; typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto; struct google_protobuf_ServiceDescriptorProto; @@ -41,6 +45,8 @@ struct google_protobuf_MessageOptions; typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions; struct google_protobuf_FieldOptions; typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions; +struct google_protobuf_OneofOptions; +typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions; struct google_protobuf_EnumOptions; typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions; struct google_protobuf_EnumValueOptions; @@ -57,6 +63,10 @@ struct google_protobuf_SourceCodeInfo; typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo; struct google_protobuf_SourceCodeInfo_Location; typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location; +struct google_protobuf_GeneratedCodeInfo; +typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo; +struct google_protobuf_GeneratedCodeInfo_Annotation; +typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation; /* Enums */ typedef enum { @@ -104,96 +114,150 @@ typedef enum { google_protobuf_FileOptions_LITE_RUNTIME = 3 } google_protobuf_FileOptions_OptimizeMode; -/* google_protobuf_FileDescriptorSet message definition. */ +typedef enum { + google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0, + google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1, + google_protobuf_MethodOptions_IDEMPOTENT = 2 +} google_protobuf_MethodOptions_IdempotencyLevel; + +/* google_protobuf_FileDescriptorSet */ extern const upb_msglayout_msginit_v1 google_protobuf_FileDescriptorSet_msginit; google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_new(upb_env *env); google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_FileDescriptorSet_serialize(google_protobuf_FileDescriptorSet *msg, upb_env *env, size_t *len); void google_protobuf_FileDescriptorSet_free(google_protobuf_FileDescriptorSet *msg, upb_env *env); -/* google_protobuf_FileDescriptorSet getters. */ +/* getters. */ +const upb_array* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet *msg); -/* google_protobuf_FileDescriptorSet setters. */ +/* setters. */ +void google_protobuf_FileDescriptorSet_set_file(google_protobuf_FileDescriptorSet *msg, upb_array* value); -/* google_protobuf_FileDescriptorProto message definition. */ +/* google_protobuf_FileDescriptorProto */ extern const upb_msglayout_msginit_v1 google_protobuf_FileDescriptorProto_msginit; google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_new(upb_env *env); google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_FileDescriptorProto_serialize(google_protobuf_FileDescriptorProto *msg, upb_env *env, size_t *len); void google_protobuf_FileDescriptorProto_free(google_protobuf_FileDescriptorProto *msg, upb_env *env); -/* google_protobuf_FileDescriptorProto getters. */ +/* getters. */ upb_stringview google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto *msg); upb_stringview google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto *msg); -google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto *msg); -google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto *msg); +const upb_array* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto *msg); +const upb_array* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto *msg); +const upb_array* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto *msg); +const upb_array* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto *msg); +const upb_array* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto *msg); +const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto *msg); +const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto *msg); +const upb_array* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto *msg); +const upb_array* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto *msg); upb_stringview google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto *msg); -/* google_protobuf_FileDescriptorProto setters. */ +/* setters. */ void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_stringview value); void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_stringview value); +void google_protobuf_FileDescriptorProto_set_dependency(google_protobuf_FileDescriptorProto *msg, upb_array* value); +void google_protobuf_FileDescriptorProto_set_message_type(google_protobuf_FileDescriptorProto *msg, upb_array* value); +void google_protobuf_FileDescriptorProto_set_enum_type(google_protobuf_FileDescriptorProto *msg, upb_array* value); +void google_protobuf_FileDescriptorProto_set_service(google_protobuf_FileDescriptorProto *msg, upb_array* value); +void google_protobuf_FileDescriptorProto_set_extension(google_protobuf_FileDescriptorProto *msg, upb_array* value); void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value); void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value); +void google_protobuf_FileDescriptorProto_set_public_dependency(google_protobuf_FileDescriptorProto *msg, upb_array* value); +void google_protobuf_FileDescriptorProto_set_weak_dependency(google_protobuf_FileDescriptorProto *msg, upb_array* value); void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_stringview value); -/* google_protobuf_DescriptorProto message definition. */ +/* google_protobuf_DescriptorProto */ extern const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_msginit; google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_new(upb_env *env); google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_DescriptorProto_serialize(google_protobuf_DescriptorProto *msg, upb_env *env, size_t *len); void google_protobuf_DescriptorProto_free(google_protobuf_DescriptorProto *msg, upb_env *env); -/* google_protobuf_DescriptorProto getters. */ +/* getters. */ upb_stringview google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto *msg); -google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto *msg); - -/* google_protobuf_DescriptorProto setters. */ +const upb_array* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto *msg); +const upb_array* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto *msg); +const upb_array* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto *msg); +const upb_array* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto *msg); +const upb_array* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto *msg); +const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto *msg); +const upb_array* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto *msg); +const upb_array* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto *msg); +const upb_array* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto *msg); + +/* setters. */ void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_stringview value); +void google_protobuf_DescriptorProto_set_field(google_protobuf_DescriptorProto *msg, upb_array* value); +void google_protobuf_DescriptorProto_set_nested_type(google_protobuf_DescriptorProto *msg, upb_array* value); +void google_protobuf_DescriptorProto_set_enum_type(google_protobuf_DescriptorProto *msg, upb_array* value); +void google_protobuf_DescriptorProto_set_extension_range(google_protobuf_DescriptorProto *msg, upb_array* value); +void google_protobuf_DescriptorProto_set_extension(google_protobuf_DescriptorProto *msg, upb_array* value); void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value); +void google_protobuf_DescriptorProto_set_oneof_decl(google_protobuf_DescriptorProto *msg, upb_array* value); +void google_protobuf_DescriptorProto_set_reserved_range(google_protobuf_DescriptorProto *msg, upb_array* value); +void google_protobuf_DescriptorProto_set_reserved_name(google_protobuf_DescriptorProto *msg, upb_array* value); -/* google_protobuf_DescriptorProto_ExtensionRange message definition. */ +/* google_protobuf_DescriptorProto_ExtensionRange */ extern const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_ExtensionRange_msginit; google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_new(upb_env *env); google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_DescriptorProto_ExtensionRange_serialize(google_protobuf_DescriptorProto_ExtensionRange *msg, upb_env *env, size_t *len); void google_protobuf_DescriptorProto_ExtensionRange_free(google_protobuf_DescriptorProto_ExtensionRange *msg, upb_env *env); -/* google_protobuf_DescriptorProto_ExtensionRange getters. */ +/* getters. */ int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange *msg); int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange *msg); +const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange *msg); -/* google_protobuf_DescriptorProto_ExtensionRange setters. */ +/* setters. */ void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value); void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value); +void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value); -/* google_protobuf_DescriptorProto_ReservedRange message definition. */ +/* google_protobuf_DescriptorProto_ReservedRange */ extern const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_ReservedRange_msginit; google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_new(upb_env *env); google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_DescriptorProto_ReservedRange_serialize(google_protobuf_DescriptorProto_ReservedRange *msg, upb_env *env, size_t *len); void google_protobuf_DescriptorProto_ReservedRange_free(google_protobuf_DescriptorProto_ReservedRange *msg, upb_env *env); -/* google_protobuf_DescriptorProto_ReservedRange getters. */ +/* getters. */ int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange *msg); int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange *msg); -/* google_protobuf_DescriptorProto_ReservedRange setters. */ +/* setters. */ void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value); void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value); -/* google_protobuf_FieldDescriptorProto message definition. */ +/* google_protobuf_ExtensionRangeOptions */ +extern const upb_msglayout_msginit_v1 google_protobuf_ExtensionRangeOptions_msginit; +google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_new(upb_env *env); +google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_ExtensionRangeOptions_serialize(google_protobuf_ExtensionRangeOptions *msg, upb_env *env, size_t *len); +void google_protobuf_ExtensionRangeOptions_free(google_protobuf_ExtensionRangeOptions *msg, upb_env *env); + +/* getters. */ +const upb_array* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions *msg); + +/* setters. */ +void google_protobuf_ExtensionRangeOptions_set_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, upb_array* value); + + +/* google_protobuf_FieldDescriptorProto */ extern const upb_msglayout_msginit_v1 google_protobuf_FieldDescriptorProto_msginit; google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_new(upb_env *env); google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_FieldDescriptorProto_serialize(google_protobuf_FieldDescriptorProto *msg, upb_env *env, size_t *len); void google_protobuf_FieldDescriptorProto_free(google_protobuf_FieldDescriptorProto *msg, upb_env *env); -/* google_protobuf_FieldDescriptorProto getters. */ +/* getters. */ upb_stringview google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto *msg); upb_stringview google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto *msg); int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto *msg); @@ -201,11 +265,11 @@ google_protobuf_FieldDescriptorProto_Label google_protobuf_FieldDescriptorProto_ google_protobuf_FieldDescriptorProto_Type google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto *msg); upb_stringview google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto *msg); upb_stringview google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto *msg); -google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto *msg); +const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto *msg); int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto *msg); upb_stringview google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto *msg); -/* google_protobuf_FieldDescriptorProto setters. */ +/* setters. */ void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_stringview value); void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_stringview value); void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value); @@ -218,86 +282,112 @@ void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldD void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_stringview value); -/* google_protobuf_OneofDescriptorProto message definition. */ +/* google_protobuf_OneofDescriptorProto */ extern const upb_msglayout_msginit_v1 google_protobuf_OneofDescriptorProto_msginit; google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_new(upb_env *env); google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_OneofDescriptorProto_serialize(google_protobuf_OneofDescriptorProto *msg, upb_env *env, size_t *len); void google_protobuf_OneofDescriptorProto_free(google_protobuf_OneofDescriptorProto *msg, upb_env *env); -/* google_protobuf_OneofDescriptorProto getters. */ +/* getters. */ upb_stringview google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto *msg); +const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto *msg); -/* google_protobuf_OneofDescriptorProto setters. */ +/* setters. */ void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_stringview value); +void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value); -/* google_protobuf_EnumDescriptorProto message definition. */ +/* google_protobuf_EnumDescriptorProto */ extern const upb_msglayout_msginit_v1 google_protobuf_EnumDescriptorProto_msginit; google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_new(upb_env *env); google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_EnumDescriptorProto_serialize(google_protobuf_EnumDescriptorProto *msg, upb_env *env, size_t *len); void google_protobuf_EnumDescriptorProto_free(google_protobuf_EnumDescriptorProto *msg, upb_env *env); -/* google_protobuf_EnumDescriptorProto getters. */ +/* getters. */ upb_stringview google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto *msg); -google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto *msg); +const upb_array* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto *msg); +const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto *msg); +const upb_array* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto *msg); +const upb_array* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto *msg); -/* google_protobuf_EnumDescriptorProto setters. */ +/* setters. */ void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_stringview value); +void google_protobuf_EnumDescriptorProto_set_value(google_protobuf_EnumDescriptorProto *msg, upb_array* value); void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value); +void google_protobuf_EnumDescriptorProto_set_reserved_range(google_protobuf_EnumDescriptorProto *msg, upb_array* value); +void google_protobuf_EnumDescriptorProto_set_reserved_name(google_protobuf_EnumDescriptorProto *msg, upb_array* value); + + +/* google_protobuf_EnumDescriptorProto_EnumReservedRange */ +extern const upb_msglayout_msginit_v1 google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit; +google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_env *env); +google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, upb_env *env, size_t *len); +void google_protobuf_EnumDescriptorProto_EnumReservedRange_free(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, upb_env *env); +/* getters. */ +int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg); +int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg); -/* google_protobuf_EnumValueDescriptorProto message definition. */ +/* setters. */ +void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value); +void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value); + + +/* google_protobuf_EnumValueDescriptorProto */ extern const upb_msglayout_msginit_v1 google_protobuf_EnumValueDescriptorProto_msginit; google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_new(upb_env *env); google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_EnumValueDescriptorProto_serialize(google_protobuf_EnumValueDescriptorProto *msg, upb_env *env, size_t *len); void google_protobuf_EnumValueDescriptorProto_free(google_protobuf_EnumValueDescriptorProto *msg, upb_env *env); -/* google_protobuf_EnumValueDescriptorProto getters. */ +/* getters. */ upb_stringview google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto *msg); int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto *msg); -google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto *msg); +const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto *msg); -/* google_protobuf_EnumValueDescriptorProto setters. */ +/* setters. */ void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_stringview value); void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value); void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value); -/* google_protobuf_ServiceDescriptorProto message definition. */ +/* google_protobuf_ServiceDescriptorProto */ extern const upb_msglayout_msginit_v1 google_protobuf_ServiceDescriptorProto_msginit; google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_new(upb_env *env); google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_ServiceDescriptorProto_serialize(google_protobuf_ServiceDescriptorProto *msg, upb_env *env, size_t *len); void google_protobuf_ServiceDescriptorProto_free(google_protobuf_ServiceDescriptorProto *msg, upb_env *env); -/* google_protobuf_ServiceDescriptorProto getters. */ +/* getters. */ upb_stringview google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto *msg); -google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto *msg); +const upb_array* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto *msg); +const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto *msg); -/* google_protobuf_ServiceDescriptorProto setters. */ +/* setters. */ void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_stringview value); +void google_protobuf_ServiceDescriptorProto_set_method(google_protobuf_ServiceDescriptorProto *msg, upb_array* value); void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value); -/* google_protobuf_MethodDescriptorProto message definition. */ +/* google_protobuf_MethodDescriptorProto */ extern const upb_msglayout_msginit_v1 google_protobuf_MethodDescriptorProto_msginit; google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_new(upb_env *env); google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_MethodDescriptorProto_serialize(google_protobuf_MethodDescriptorProto *msg, upb_env *env, size_t *len); void google_protobuf_MethodDescriptorProto_free(google_protobuf_MethodDescriptorProto *msg, upb_env *env); -/* google_protobuf_MethodDescriptorProto getters. */ +/* getters. */ upb_stringview google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto *msg); upb_stringview google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto *msg); upb_stringview google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto *msg); -google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto *msg); +const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto *msg); bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto *msg); bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto *msg); -/* google_protobuf_MethodDescriptorProto setters. */ +/* setters. */ void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_stringview value); void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_stringview value); void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_stringview value); @@ -306,14 +396,14 @@ void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_ void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value); -/* google_protobuf_FileOptions message definition. */ +/* google_protobuf_FileOptions */ extern const upb_msglayout_msginit_v1 google_protobuf_FileOptions_msginit; google_protobuf_FileOptions *google_protobuf_FileOptions_new(upb_env *env); google_protobuf_FileOptions *google_protobuf_FileOptions_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_FileOptions_serialize(google_protobuf_FileOptions *msg, upb_env *env, size_t *len); void google_protobuf_FileOptions_free(google_protobuf_FileOptions *msg, upb_env *env); -/* google_protobuf_FileOptions getters. */ +/* getters. */ upb_stringview google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions *msg); upb_stringview google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions *msg); google_protobuf_FileOptions_OptimizeMode google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions *msg); @@ -328,11 +418,13 @@ bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_Fi bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions *msg); upb_stringview google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions *msg); upb_stringview google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions *msg); -bool google_protobuf_FileOptions_javanano_use_deprecated_package(const google_protobuf_FileOptions *msg); +upb_stringview google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions *msg); upb_stringview google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions *msg); upb_stringview google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions *msg); +bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions *msg); +const upb_array* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions *msg); -/* google_protobuf_FileOptions setters. */ +/* setters. */ void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_stringview value); void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_stringview value); void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, google_protobuf_FileOptions_OptimizeMode value); @@ -347,121 +439,152 @@ void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_File void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value); void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_stringview value); void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_stringview value); -void google_protobuf_FileOptions_set_javanano_use_deprecated_package(google_protobuf_FileOptions *msg, bool value); +void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_stringview value); void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_stringview value); void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_stringview value); +void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value); +void google_protobuf_FileOptions_set_uninterpreted_option(google_protobuf_FileOptions *msg, upb_array* value); -/* google_protobuf_MessageOptions message definition. */ +/* google_protobuf_MessageOptions */ extern const upb_msglayout_msginit_v1 google_protobuf_MessageOptions_msginit; google_protobuf_MessageOptions *google_protobuf_MessageOptions_new(upb_env *env); google_protobuf_MessageOptions *google_protobuf_MessageOptions_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_MessageOptions_serialize(google_protobuf_MessageOptions *msg, upb_env *env, size_t *len); void google_protobuf_MessageOptions_free(google_protobuf_MessageOptions *msg, upb_env *env); -/* google_protobuf_MessageOptions getters. */ +/* getters. */ bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions *msg); bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions *msg); bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions *msg); bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions *msg); +const upb_array* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions *msg); -/* google_protobuf_MessageOptions setters. */ +/* setters. */ void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value); void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value); void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value); void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value); +void google_protobuf_MessageOptions_set_uninterpreted_option(google_protobuf_MessageOptions *msg, upb_array* value); -/* google_protobuf_FieldOptions message definition. */ +/* google_protobuf_FieldOptions */ extern const upb_msglayout_msginit_v1 google_protobuf_FieldOptions_msginit; google_protobuf_FieldOptions *google_protobuf_FieldOptions_new(upb_env *env); google_protobuf_FieldOptions *google_protobuf_FieldOptions_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_FieldOptions_serialize(google_protobuf_FieldOptions *msg, upb_env *env, size_t *len); void google_protobuf_FieldOptions_free(google_protobuf_FieldOptions *msg, upb_env *env); -/* google_protobuf_FieldOptions getters. */ +/* getters. */ google_protobuf_FieldOptions_CType google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions *msg); bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions *msg); bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions *msg); bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions *msg); google_protobuf_FieldOptions_JSType google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions *msg); bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions *msg); +const upb_array* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions *msg); -/* google_protobuf_FieldOptions setters. */ +/* setters. */ void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_CType value); void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value); void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value); void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value); void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_JSType value); void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value); +void google_protobuf_FieldOptions_set_uninterpreted_option(google_protobuf_FieldOptions *msg, upb_array* value); + +/* google_protobuf_OneofOptions */ +extern const upb_msglayout_msginit_v1 google_protobuf_OneofOptions_msginit; +google_protobuf_OneofOptions *google_protobuf_OneofOptions_new(upb_env *env); +google_protobuf_OneofOptions *google_protobuf_OneofOptions_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_OneofOptions_serialize(google_protobuf_OneofOptions *msg, upb_env *env, size_t *len); +void google_protobuf_OneofOptions_free(google_protobuf_OneofOptions *msg, upb_env *env); -/* google_protobuf_EnumOptions message definition. */ +/* getters. */ +const upb_array* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions *msg); + +/* setters. */ +void google_protobuf_OneofOptions_set_uninterpreted_option(google_protobuf_OneofOptions *msg, upb_array* value); + + +/* google_protobuf_EnumOptions */ extern const upb_msglayout_msginit_v1 google_protobuf_EnumOptions_msginit; google_protobuf_EnumOptions *google_protobuf_EnumOptions_new(upb_env *env); google_protobuf_EnumOptions *google_protobuf_EnumOptions_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_EnumOptions_serialize(google_protobuf_EnumOptions *msg, upb_env *env, size_t *len); void google_protobuf_EnumOptions_free(google_protobuf_EnumOptions *msg, upb_env *env); -/* google_protobuf_EnumOptions getters. */ +/* getters. */ bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions *msg); bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions *msg); +const upb_array* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions *msg); -/* google_protobuf_EnumOptions setters. */ +/* setters. */ void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value); void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value); +void google_protobuf_EnumOptions_set_uninterpreted_option(google_protobuf_EnumOptions *msg, upb_array* value); -/* google_protobuf_EnumValueOptions message definition. */ +/* google_protobuf_EnumValueOptions */ extern const upb_msglayout_msginit_v1 google_protobuf_EnumValueOptions_msginit; google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_new(upb_env *env); google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_EnumValueOptions_serialize(google_protobuf_EnumValueOptions *msg, upb_env *env, size_t *len); void google_protobuf_EnumValueOptions_free(google_protobuf_EnumValueOptions *msg, upb_env *env); -/* google_protobuf_EnumValueOptions getters. */ +/* getters. */ bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions *msg); +const upb_array* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions *msg); -/* google_protobuf_EnumValueOptions setters. */ +/* setters. */ void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value); +void google_protobuf_EnumValueOptions_set_uninterpreted_option(google_protobuf_EnumValueOptions *msg, upb_array* value); -/* google_protobuf_ServiceOptions message definition. */ +/* google_protobuf_ServiceOptions */ extern const upb_msglayout_msginit_v1 google_protobuf_ServiceOptions_msginit; google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_new(upb_env *env); google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_ServiceOptions_serialize(google_protobuf_ServiceOptions *msg, upb_env *env, size_t *len); void google_protobuf_ServiceOptions_free(google_protobuf_ServiceOptions *msg, upb_env *env); -/* google_protobuf_ServiceOptions getters. */ +/* getters. */ bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions *msg); +const upb_array* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions *msg); -/* google_protobuf_ServiceOptions setters. */ +/* setters. */ void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value); +void google_protobuf_ServiceOptions_set_uninterpreted_option(google_protobuf_ServiceOptions *msg, upb_array* value); -/* google_protobuf_MethodOptions message definition. */ +/* google_protobuf_MethodOptions */ extern const upb_msglayout_msginit_v1 google_protobuf_MethodOptions_msginit; google_protobuf_MethodOptions *google_protobuf_MethodOptions_new(upb_env *env); google_protobuf_MethodOptions *google_protobuf_MethodOptions_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_MethodOptions_serialize(google_protobuf_MethodOptions *msg, upb_env *env, size_t *len); void google_protobuf_MethodOptions_free(google_protobuf_MethodOptions *msg, upb_env *env); -/* google_protobuf_MethodOptions getters. */ +/* getters. */ bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions *msg); +google_protobuf_MethodOptions_IdempotencyLevel google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions *msg); +const upb_array* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions *msg); -/* google_protobuf_MethodOptions setters. */ +/* setters. */ void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value); +void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, google_protobuf_MethodOptions_IdempotencyLevel value); +void google_protobuf_MethodOptions_set_uninterpreted_option(google_protobuf_MethodOptions *msg, upb_array* value); -/* google_protobuf_UninterpretedOption message definition. */ +/* google_protobuf_UninterpretedOption */ extern const upb_msglayout_msginit_v1 google_protobuf_UninterpretedOption_msginit; google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_new(upb_env *env); google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_UninterpretedOption_serialize(google_protobuf_UninterpretedOption *msg, upb_env *env, size_t *len); void google_protobuf_UninterpretedOption_free(google_protobuf_UninterpretedOption *msg, upb_env *env); -/* google_protobuf_UninterpretedOption getters. */ +/* getters. */ +const upb_array* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption *msg); upb_stringview google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption *msg); uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption *msg); int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption *msg); @@ -469,7 +592,8 @@ double google_protobuf_UninterpretedOption_double_value(const google_protobuf_Un upb_stringview google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption *msg); upb_stringview google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption *msg); -/* google_protobuf_UninterpretedOption setters. */ +/* setters. */ +void google_protobuf_UninterpretedOption_set_name(google_protobuf_UninterpretedOption *msg, upb_array* value); void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_stringview value); void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value); void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value); @@ -478,50 +602,92 @@ void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_Uninte void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_stringview value); -/* google_protobuf_UninterpretedOption_NamePart message definition. */ +/* google_protobuf_UninterpretedOption_NamePart */ extern const upb_msglayout_msginit_v1 google_protobuf_UninterpretedOption_NamePart_msginit; google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_new(upb_env *env); google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_UninterpretedOption_NamePart_serialize(google_protobuf_UninterpretedOption_NamePart *msg, upb_env *env, size_t *len); void google_protobuf_UninterpretedOption_NamePart_free(google_protobuf_UninterpretedOption_NamePart *msg, upb_env *env); -/* google_protobuf_UninterpretedOption_NamePart getters. */ +/* getters. */ upb_stringview google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart *msg); bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg); -/* google_protobuf_UninterpretedOption_NamePart setters. */ +/* setters. */ void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_stringview value); void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value); -/* google_protobuf_SourceCodeInfo message definition. */ +/* google_protobuf_SourceCodeInfo */ extern const upb_msglayout_msginit_v1 google_protobuf_SourceCodeInfo_msginit; google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_new(upb_env *env); google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_SourceCodeInfo_serialize(google_protobuf_SourceCodeInfo *msg, upb_env *env, size_t *len); void google_protobuf_SourceCodeInfo_free(google_protobuf_SourceCodeInfo *msg, upb_env *env); -/* google_protobuf_SourceCodeInfo getters. */ +/* getters. */ +const upb_array* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo *msg); -/* google_protobuf_SourceCodeInfo setters. */ +/* setters. */ +void google_protobuf_SourceCodeInfo_set_location(google_protobuf_SourceCodeInfo *msg, upb_array* value); -/* google_protobuf_SourceCodeInfo_Location message definition. */ +/* google_protobuf_SourceCodeInfo_Location */ extern const upb_msglayout_msginit_v1 google_protobuf_SourceCodeInfo_Location_msginit; google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_new(upb_env *env); google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_parsenew(upb_stringview buf, upb_env *env); char *google_protobuf_SourceCodeInfo_Location_serialize(google_protobuf_SourceCodeInfo_Location *msg, upb_env *env, size_t *len); void google_protobuf_SourceCodeInfo_Location_free(google_protobuf_SourceCodeInfo_Location *msg, upb_env *env); -/* google_protobuf_SourceCodeInfo_Location getters. */ +/* getters. */ +const upb_array* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location *msg); +const upb_array* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location *msg); upb_stringview google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location *msg); upb_stringview google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location *msg); +const upb_array* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location *msg); -/* google_protobuf_SourceCodeInfo_Location setters. */ +/* setters. */ +void google_protobuf_SourceCodeInfo_Location_set_path(google_protobuf_SourceCodeInfo_Location *msg, upb_array* value); +void google_protobuf_SourceCodeInfo_Location_set_span(google_protobuf_SourceCodeInfo_Location *msg, upb_array* value); void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_stringview value); void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_stringview value); +void google_protobuf_SourceCodeInfo_Location_set_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_array* value); + + +/* google_protobuf_GeneratedCodeInfo */ +extern const upb_msglayout_msginit_v1 google_protobuf_GeneratedCodeInfo_msginit; +google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_new(upb_env *env); +google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_GeneratedCodeInfo_serialize(google_protobuf_GeneratedCodeInfo *msg, upb_env *env, size_t *len); +void google_protobuf_GeneratedCodeInfo_free(google_protobuf_GeneratedCodeInfo *msg, upb_env *env); + +/* getters. */ +const upb_array* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo *msg); + +/* setters. */ +void google_protobuf_GeneratedCodeInfo_set_annotation(google_protobuf_GeneratedCodeInfo *msg, upb_array* value); + + +/* google_protobuf_GeneratedCodeInfo_Annotation */ +extern const upb_msglayout_msginit_v1 google_protobuf_GeneratedCodeInfo_Annotation_msginit; +google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_new(upb_env *env); +google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_GeneratedCodeInfo_Annotation_serialize(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_env *env, size_t *len); +void google_protobuf_GeneratedCodeInfo_Annotation_free(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_env *env); + +/* getters. */ +const upb_array* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation *msg); +upb_stringview google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg); +int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg); +int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg); + +/* setters. */ +void google_protobuf_GeneratedCodeInfo_Annotation_set_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_array* value); +void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_stringview value); +void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value); +void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value); UPB_END_EXTERN_C -#endif /* UPB_DESCRIPTOR_DESCRIPTOR_PROTO_UPB_H_ */ +#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */ diff --git a/tests/json/test.upbdefs.h b/tests/json/test.upbdefs.h index 8476060399..065c001a8d 100644 --- a/tests/json/test.upbdefs.h +++ b/tests/json/test.upbdefs.h @@ -19,14 +19,6 @@ UPB_BEGIN_EXTERN_C -/* Enums */ - -typedef enum { - upb_test_json_A = 0, - upb_test_json_B = 1, - upb_test_json_C = 2 -} upb_test_json_MyEnum; - /* MessageDefs: call these functions to get a ref to a msgdef. */ const upb_msgdef *upbdefs_upb_test_json_SubMessage_get(const void *owner); const upb_msgdef *upbdefs_upb_test_json_TestMessage_get(const void *owner); diff --git a/tools/amalgamate.py b/tools/amalgamate.py index 6fd8033865..b496f24799 100755 --- a/tools/amalgamate.py +++ b/tools/amalgamate.py @@ -24,7 +24,8 @@ class Amalgamator: def _process_file(self, infile_name, outfile): for line in open(infile_name): include = parse_include(line) - if include is not None and include.startswith("upb"): + if include is not None and (include.startswith("upb") or + include.startswith("google")): if include not in self.included: self.included.add(include) self._add_header(self.include_path + include) diff --git a/tools/dump_cinit.lua b/tools/dump_cinit.lua index 6135b03a94..56c47ea4c0 100644 --- a/tools/dump_cinit.lua +++ b/tools/dump_cinit.lua @@ -583,51 +583,6 @@ local function make_children_map(file) return map end -local function dump_enum_vals(enumdef, append) - local enum_vals = {} - - for k, v in enumdef:values() do - enum_vals[#enum_vals + 1] = {k, v} - end - - table.sort(enum_vals, function(a, b) return a[2] < b[2] end) - - -- protobuf convention is that enum values are scoped at the level of the - -- enum itself, to follow C++. Ie, if you have the enum: - -- message Foo { - -- enum E { - -- VAL1 = 1; - -- VAL2 = 2; - -- } - -- } - -- - -- The name of VAL1 is Foo.VAL1, not Foo.E.VAL1. - -- - -- This seems a bit sketchy, but people often name their enum values - -- accordingly, ie: - -- - -- enum Foo { - -- FOO_VAL1 = 1; - -- FOO_VAL2 = 2; - -- } - -- - -- So if we don't respect this also, we end up with constants that look like: - -- - -- GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_DOUBLE = 1 - -- - -- (notice the duplicated "TYPE"). - local cident = to_cident(remove_name(enumdef:full_name())) - for i, pair in ipairs(enum_vals) do - k, v = pair[1], pair[2] - append(' %s = %d', cident .. "_" .. k, v) - if i == #enum_vals then - append('\n') - else - append(',\n') - end - end -end - local print_classes local function print_message(def, map, indent, append) @@ -699,14 +654,6 @@ local function dump_defs_h(file, append, linktab) -- Dump C enums for proto enums. - append("/* Enums */\n\n") - for _, def in ipairs(sorted_defs(file:defs(upb.DEF_ENUM))) do - local cident = to_cident(def:full_name()) - append('typedef enum {\n') - dump_enum_vals(def, append) - append('} %s;\n\n', cident) - end - append("/* MessageDefs: call these functions to get a ref to a msgdef. */\n") dump_defs_for_type( "const upb_msgdef *upbdefs_%s_get(const void *owner);\n", diff --git a/tools/make_c_api.lua b/tools/make_c_api.lua index d81ca6b0eb..1770a88800 100644 --- a/tools/make_c_api.lua +++ b/tools/make_c_api.lua @@ -117,14 +117,20 @@ local function field_default(field) end end -local function ctype(field) +local function ctype(field, const) + if const then + const = "const " + else + const = "" + end + if field:label() == upb.LABEL_REPEATED then - return "upb_array*" + return const .. "upb_array*" elseif field:type() == upb.TYPE_MESSAGE then if field:containing_type():file() == field:subdef():file() then - return to_cident(field:subdef():full_name()) .. "*" + return const .. to_cident(field:subdef():full_name()) .. "*" else - return "struct " .. to_cident(field:subdef():full_name()) .. "*" + return const .. "struct " .. to_cident(field:subdef():full_name()) .. "*" end elseif field:type() == upb.TYPE_ENUM then return to_cident(field:subdef():full_name()) @@ -216,7 +222,7 @@ local function write_h_file(filedef, append) for msg in filedef:defs(upb.DEF_MSG) do local msgname = to_cident(msg:full_name()) - append('/* %s message definition. */\n', msgname) + append('/* %s */\n', msgname) append('extern const upb_msglayout_msginit_v1 %s_msginit;\n', msgname) append('%s *%s_new(upb_env *env);\n', msgname, msgname) append('%s *%s_parsenew(upb_stringview buf, upb_env *env);\n', @@ -226,7 +232,7 @@ local function write_h_file(filedef, append) append('void %s_free(%s *msg, upb_env *env);\n', msgname, msgname) append('\n') - append('/* %s getters. */\n', msgname) + append('/* getters. */\n') local setters, get_setters = dump_cinit.str_appender() for field in msg:fields() do local fieldname = to_cident(field:name()) @@ -235,14 +241,10 @@ local function write_h_file(filedef, append) -- Forward declaration for message type declared in another file. append('struct %s;\n', to_cident(field:subdef():full_name())) end - if field:label() == upb.LABEL_REPEATED then - else - local typename = ctype(field) - append('%s %s_%s(const %s *msg);\n', - typename, msgname, fieldname, msgname) - setters('void %s_set_%s(%s *msg, %s value);\n', - msgname, fieldname, msgname, typename) - end + append('%s %s_%s(const %s *msg);\n', + ctype(field, true), msgname, fieldname, msgname) + setters('void %s_set_%s(%s *msg, %s value);\n', + msgname, fieldname, msgname, ctype(field)) end for oneof in msg:oneofs() do @@ -257,7 +259,7 @@ local function write_h_file(filedef, append) end append('\n') - append('/* %s setters. */\n', msgname) + append('/* setters. */\n') append(get_setters()) append('\n') @@ -473,9 +475,8 @@ local function write_c_file(filedef, hfilename, append) append('}\n') for field in msg:fields() do - local typename = ctype(field) append('%s %s_%s(const %s *msg) {\n', - typename, msgname, field:name(), msgname); + ctype(field, true), msgname, field:name(), msgname); if field:containing_oneof() then local oneof = field:containing_oneof() append(' return msg->%s_case == %s ? msg->%s.%s : %s;\n', @@ -486,7 +487,7 @@ local function write_c_file(filedef, hfilename, append) end append('}\n') append('void %s_set_%s(%s *msg, %s value) {\n', - msgname, field:name(), msgname, typename); + msgname, field:name(), msgname, ctype(field)); if field:containing_oneof() then local oneof = field:containing_oneof() append(' msg->%s.%s = value;\n', oneof:name(), field:name()) diff --git a/tools/upbc.lua b/tools/upbc.lua index a538b1c159..8ac4f735ac 100644 --- a/tools/upbc.lua +++ b/tools/upbc.lua @@ -77,28 +77,28 @@ for _, file in ipairs(files) do hfile:close() cfile:close() - end - - -- Write C API. - hfilename = outbase .. ".upb.h" - cfilename = outbase .. ".upb.c" - - if os.getenv("UPBC_VERBOSE") then - print("upbc:") - print(string.format(" source file=%s", src)) - print(string.format(" output file base=%s", outbase)) - print(string.format(" hfilename=%s", hfilename)) - print(string.format(" cfilename=%s", cfilename)) - end + else + -- Write C API. + hfilename = outbase .. ".upb.h" + cfilename = outbase .. ".upb.c" + + if os.getenv("UPBC_VERBOSE") then + print("upbc:") + print(string.format(" source file=%s", src)) + print(string.format(" output file base=%s", outbase)) + print(string.format(" hfilename=%s", hfilename)) + print(string.format(" cfilename=%s", cfilename)) + end - local hfile = assert(io.open(hfilename, "w"), "couldn't open " .. hfilename) - local cfile = assert(io.open(cfilename, "w"), "couldn't open " .. cfilename) + local hfile = assert(io.open(hfilename, "w"), "couldn't open " .. hfilename) + local cfile = assert(io.open(cfilename, "w"), "couldn't open " .. cfilename) - local happend = dump_cinit.file_appender(hfile) - local cappend = dump_cinit.file_appender(cfile) + local happend = dump_cinit.file_appender(hfile) + local cappend = dump_cinit.file_appender(cfile) - make_c_api.write_gencode(file, hfilename, happend, cappend) + make_c_api.write_gencode(file, hfilename, happend, cappend) - hfile:close() - cfile:close() + hfile:close() + cfile:close() + end end diff --git a/upb/descriptor/descriptor.upbdefs.h b/upb/descriptor/descriptor.upbdefs.h index ee260f2043..dd118a049a 100644 --- a/upb/descriptor/descriptor.upbdefs.h +++ b/upb/descriptor/descriptor.upbdefs.h @@ -19,53 +19,6 @@ UPB_BEGIN_EXTERN_C -/* Enums */ - -typedef enum { - google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1, - google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2, - google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3 -} google_protobuf_FieldDescriptorProto_Label; - -typedef enum { - google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1, - google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2, - google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3, - google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4, - google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5, - google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6, - google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7, - google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8, - google_protobuf_FieldDescriptorProto_TYPE_STRING = 9, - google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10, - google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11, - google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12, - google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13, - google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14, - google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15, - google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16, - google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17, - google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18 -} google_protobuf_FieldDescriptorProto_Type; - -typedef enum { - google_protobuf_FieldOptions_STRING = 0, - google_protobuf_FieldOptions_CORD = 1, - google_protobuf_FieldOptions_STRING_PIECE = 2 -} google_protobuf_FieldOptions_CType; - -typedef enum { - google_protobuf_FieldOptions_JS_NORMAL = 0, - google_protobuf_FieldOptions_JS_STRING = 1, - google_protobuf_FieldOptions_JS_NUMBER = 2 -} google_protobuf_FieldOptions_JSType; - -typedef enum { - google_protobuf_FileOptions_SPEED = 1, - google_protobuf_FileOptions_CODE_SIZE = 2, - google_protobuf_FileOptions_LITE_RUNTIME = 3 -} google_protobuf_FileOptions_OptimizeMode; - /* MessageDefs: call these functions to get a ref to a msgdef. */ const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_get(const void *owner); const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_ExtensionRange_get(const void *owner);